Skip to content

reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities

proxychains: split PROXYCHAINS_EXCLUDE on spaces, as its docs promise

six2dezca86b6a75dd6
diff --git a/modules/utils.sh b/modules/utils.sh
index 9eb8d96..c9d710a 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -523,9 +523,25 @@ function _proxychains_applies() {
local _tool="${1:-}"
[[ -z "$_tool" ]] && return 1
+ # Narrowing IFS here is REQUIRED, not stylistic. reconftw.sh:8 sets
+ # IFS=$'\n\t' process-wide, so an unquoted ${PROXYCHAINS_EXCLUDE} does NOT
+ # split on spaces — and reconftw.cfg documents this variable as
+ # space-separated. PROXYCHAINS_EXCLUDE="httpx nuclei" therefore arrived as
+ # the SINGLE word "httpx nuclei", matched no tool name, and both tools were
+ # proxied anyway: the operator's exclusion silently did nothing. Splitting
+ # on space/tab/newline accepts every separator a user might reach for.
+ local -a _extra=()
+ if [[ -n "${PROXYCHAINS_EXCLUDE:-}" ]]; then
+ local _oifs="$IFS"
+ IFS=$' \t\n'
+ # shellcheck disable=SC2206 # deliberate word splitting, IFS narrowed above
+ _extra=(${PROXYCHAINS_EXCLUDE})
+ IFS="$_oifs"
+ fi
+
local _skip
for _skip in massdns puredns dnsx shuffledns naabu nmap masscan \
- ${PROXYCHAINS_EXCLUDE:-}; do
+ "${_extra[@]}"; do
[[ "$_tool" == "$_skip" ]] && return 1
done
return 0
diff --git a/tests/unit/test_proxychains.bats b/tests/unit/test_proxychains.bats
index 1f17add..006e9dd 100644
--- a/tests/unit/test_proxychains.bats
+++ b/tests/unit/test_proxychains.bats
@@ -99,6 +99,37 @@ teardown() {
&& [ ! -s "$PC_CALLS" ]
}
+@test "PROXYCHAINS_EXCLUDE splits on spaces, not just a single name" {
+ # The single-name case above passes even when the list is never word-split, so
+ # it cannot see the bug this pins: reconftw.sh:8 sets IFS=$'\n\t' process-wide,
+ # while reconftw.cfg documents PROXYCHAINS_EXCLUDE as space-separated. Unsplit,
+ # "httpx nuclei" is ONE word that matches no tool name and BOTH get proxied —
+ # the operator's exclusion silently does nothing. Assert on the SECOND name:
+ # a list that is never split would still appear to work for the first one.
+ export PROXYCHAINS=true
+ export PROXYCHAINS_EXCLUDE="httpx nuclei"
+
+ cat > bin/nuclei <<'STUB'
+#!/usr/bin/env bash
+echo "nuclei ran"
+STUB
+ chmod +x bin/nuclei
+
+ run run_command nuclei -silent
+ [ "$status" -eq 0 ] \
+ && [ "$output" = "nuclei ran" ] \
+ && [ ! -s "$PC_CALLS" ]
+}
+
+@test "PROXYCHAINS_EXCLUDE still excludes the first name when several are given" {
+ export PROXYCHAINS=true
+ export PROXYCHAINS_EXCLUDE="httpx nuclei"
+ run run_command httpx -silent
+ [ "$status" -eq 0 ] \
+ && [ "$output" = "httpx ran" ] \
+ && [ ! -s "$PC_CALLS" ]
+}
+
@test "a missing proxychains binary fails the command instead of running it direct" {
export PROXYCHAINS=true
export PROXYCHAINS_BIN="proxychains-that-does-not-exist"