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

- LFI limits and timeouts to avoid unending hanging of child processes of ffuf. - One URL per param for LFI scanning , to make LFI detection more robust.

kleozzy1af3307470fa
diff --git a/README.md b/README.md
index 1790d36..c3f2bbc 100644
--- a/README.md
+++ b/README.md
@@ -662,6 +662,7 @@ TEST_SSL=true # SSL misconfigs
SSRF_CHECKS=true # SSRF checks
CRLF_CHECKS=true # CRLF checks
LFI=true # LFI by fuzzing
+LFI_MAX_URLS=150 # Max single-parameter LFI candidates to test per target (0 = unlimited)
SSTI=true # SSTI by fuzzing
SSTI_ENGINE="TInjA" # SSTI engine
SQLI=true # Check SQLI
@@ -717,6 +718,7 @@ DNSX_THREADS=25 # Threads for dnsx when behind NAT (safe for home routers)
DNSX_RATE_LIMIT=100 # QPS for dnsx
DNSVALIDATOR_THREADS=200
INTERLACE_THREADS=10
+LFI_INTERLACE_THREADS=4 # Dedicated interlace concurrency for LFI
TLSX_THREADS=1000
XNLINKFINDER_DEPTH=3
@@ -724,11 +726,17 @@ XNLINKFINDER_DEPTH=3
HTTPX_RATELIMIT=150
NUCLEI_RATELIMIT=150
FFUF_RATELIMIT=0
+LFI_FFUF_THREADS=20 # Dedicated ffuf threads for LFI
+LFI_FFUF_RATELIMIT=50 # Dedicated ffuf rate limit for LFI
# Timeouts
SUBFINDER_ENUM_TIMEOUT=180 # Minutes
CMSSCAN_TIMEOUT=3600 # Seconds
FFUF_MAXTIME=900 # Seconds
+LFI_INTERLACE_TIMEOUT=180 # Seconds per LFI interlace worker
+LFI_FFUF_TIMEOUT=10 # Seconds per LFI HTTP request
+LFI_FFUF_MAXTIME=90 # Seconds per single LFI ffuf job
+LFI_FOLLOW_REDIRECTS=false # Follow redirects during LFI fuzzing
HTTPX_TIMEOUT=10 # Seconds
HTTPX_UNCOMMONPORTS_TIMEOUT=10 # Seconds
PERMUTATIONS_LIMIT=21474836480 # Bytes, default is 20 GB
diff --git a/modules/vulns.sh b/modules/vulns.sh
index 15c199a..1142693 100644
--- a/modules/vulns.sh
+++ b/modules/vulns.sh
@@ -238,6 +238,78 @@ function crlf_checks() {
}
+_lfi_emit_single_param_candidates() {
+ local url="$1"
+ [[ "$url" == *"?"* ]] || return 0
+
+ local base="${url%%\?*}"
+ local query_and_fragment="${url#*\?}"
+ local query="$query_and_fragment"
+ local fragment=""
+
+ if [[ "$query_and_fragment" == *"#"* ]]; then
+ query="${query_and_fragment%%#*}"
+ fragment="#${query_and_fragment#*#}"
+ fi
+ [[ -n "$query" ]] || return 0
+
+ local IFS='&'
+ local -a params=()
+ read -r -a params <<<"$query"
+ [[ ${#params[@]} -gt 0 ]] || return 0
+
+ local -A seen=()
+ local idx j param key rebuilt other_param other_key new_param
+ for idx in "${!params[@]}"; do
+ param="${params[$idx]}"
+ key="${param%%=*}"
+ [[ -n "$key" ]] || continue
+ if [[ -n "${seen[$key]+x}" ]]; then
+ continue
+ fi
+ seen["$key"]=1
+
+ rebuilt=""
+ for j in "${!params[@]}"; do
+ other_param="${params[$j]}"
+ other_key="${other_param%%=*}"
+ if [[ "$other_key" == "$key" ]]; then
+ new_param="${other_key}=FUZZ"
+ else
+ new_param="$other_param"
+ fi
+
+ if [[ -n "$rebuilt" ]]; then
+ rebuilt="${rebuilt}&${new_param}"
+ else
+ rebuilt="$new_param"
+ fi
+ done
+
+ [[ -n "$rebuilt" ]] && printf "%s?%s%s\n" "$base" "$rebuilt" "$fragment"
+ done
+}
+
+_lfi_prepare_candidates() {
+ local input_file="$1"
+ local output_file="$2"
+ local all_candidates=".tmp/tmp_lfi_all.txt"
+ : >"$all_candidates"
+ : >"$output_file"
+
+ while IFS= read -r url || [[ -n "$url" ]]; do
+ [[ -z "$url" ]] && continue
+ _lfi_emit_single_param_candidates "$url"
+ done <"$input_file" | sort -u >"$all_candidates"
+
+ cat "$all_candidates" >"$output_file"
+
+ if [[ "${LFI_MAX_URLS:-0}" -gt 0 ]] && [[ -s "$output_file" ]]; then
+ head -n "${LFI_MAX_URLS}" "$output_file" >"${output_file}.limited"
+ mv "${output_file}.limited" "$output_file"
+ fi
+}
+
function lfi() {
# Create necessary directories
@@ -253,8 +325,12 @@ function lfi() {
if [[ -s "gf/lfi.txt" ]]; then
_print_msg INFO "Running: LFI Payload Generation"
- # Process lfi.txt with qsreplace and filter lines containing 'FUZZ'
- run_command qsreplace "FUZZ" <"gf/lfi.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_lfi.txt"
+ # Generate one candidate per parameter and prioritize likely LFI sinks first.
+ _lfi_prepare_candidates "gf/lfi.txt" ".tmp/tmp_lfi.txt"
+ if [[ ! -s ".tmp/tmp_lfi.txt" ]]; then
+ end_func "No per-parameter LFI candidates generated." "${FUNCNAME[0]}" "SKIP_NOINPUT"
+ return 0
+ fi
# Determine whether to proceed based on DEEP flag or number of URLs
URL_COUNT=$(wc -l <".tmp/tmp_lfi.txt")
@@ -262,8 +338,19 @@ function lfi() {
_print_msg INFO "Running: LFI Fuzzing with FFUF"
+ local lfi_interlace_threads="${LFI_INTERLACE_THREADS:-4}"
+ local lfi_interlace_timeout="${LFI_INTERLACE_TIMEOUT:-180}"
+ local lfi_ffuf_threads="${LFI_FFUF_THREADS:-20}"
+ local lfi_ffuf_rate="${LFI_FFUF_RATELIMIT:-50}"
+ local lfi_ffuf_timeout="${LFI_FFUF_TIMEOUT:-10}"
+ local lfi_ffuf_maxtime="${LFI_FFUF_MAXTIME:-90}"
+ local lfi_follow_redirects="${LFI_FOLLOW_REDIRECTS:-false}"
+ local lfi_redirect_flag=""
+ [[ "$lfi_follow_redirects" == true ]] && lfi_redirect_flag="-r"
+
# Use Interlace to parallelize FFUF scanning
- run_command interlace -tL ".tmp/tmp_lfi.txt" -threads "$INTERLACE_THREADS" -c "ffuf -v -r -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w \"${lfi_wordlist}\" -u \"_target_\" -mr \"root:\" " 2>>"$LOGFILE" \
+ run_command interlace -tL ".tmp/tmp_lfi.txt" -threads "$lfi_interlace_threads" -timeout "$lfi_interlace_timeout" \
+ -c "ffuf -v -noninteractive ${lfi_redirect_flag} -t ${lfi_ffuf_threads} -rate ${lfi_ffuf_rate} -timeout ${lfi_ffuf_timeout} -maxtime ${lfi_ffuf_maxtime} -H \"${HEADER}\" -w \"${lfi_wordlist}\" -u \"_target_\" -mr \"root:\" " 2>>"$LOGFILE" \
| grep "URL" | sed 's/| URL | //' | anew -q "vulns/lfi.txt"
end_func "Results are saved in vulns/lfi.txt" "${FUNCNAME[0]}"
diff --git a/reconftw.cfg b/reconftw.cfg
index 8df5764..e9b90e9 100644
--- a/reconftw.cfg
+++ b/reconftw.cfg
@@ -258,6 +258,7 @@ SSRF_CHECKS=true # SSRF checks
SSRF_ALT_MATCH_REGEX="169\\.254\\.169\\.254|latest/meta-data|root:|127\\.0\\.0\\.1|localhost|gopher://|dict://|file://" # Body/content regex for alternate SSRF payload checks
CRLF_CHECKS=true # CRLF checks
LFI=true # LFI by fuzzing
+LFI_MAX_URLS=150 # Max single-parameter LFI candidates to test per target (0 = unlimited)
SSTI=true # SSTI by fuzzing
SSTI_ENGINE="TInjA" # SSTI engine: TInjA|SSTImap
TInjA_RATELIMIT=0 # TInjA requests per second (0 = unlimited)
@@ -361,6 +362,7 @@ DNSX_THREADS=100 # Threads for dnsx when behind NAT
DNSX_RATE_LIMIT=500 # QPS for dnsx when behind NAT
DNSVALIDATOR_THREADS=200
INTERLACE_THREADS=10
+LFI_INTERLACE_THREADS=4 # Dedicated interlace concurrency for LFI
TLSX_THREADS=1000
XNLINKFINDER_DEPTH=3
@@ -368,11 +370,17 @@ XNLINKFINDER_DEPTH=3
HTTPX_RATELIMIT=150
NUCLEI_RATELIMIT=150
FFUF_RATELIMIT=0
+LFI_FFUF_THREADS=20 # Dedicated ffuf threads for LFI
+LFI_FFUF_RATELIMIT=50 # Dedicated ffuf rate limit for LFI
# Timeouts
SUBFINDER_ENUM_TIMEOUT=180 # Minutes
CMSSCAN_TIMEOUT=3600 # Seconds
FFUF_MAXTIME=900 # Seconds
+LFI_INTERLACE_TIMEOUT=180 # Seconds per LFI interlace worker
+LFI_FFUF_TIMEOUT=10 # Seconds per LFI HTTP request
+LFI_FFUF_MAXTIME=90 # Seconds per single LFI ffuf job
+LFI_FOLLOW_REDIRECTS=false # Follow redirects during LFI fuzzing
HTTPX_TIMEOUT=10 # Seconds
HTTPX_UNCOMMONPORTS_TIMEOUT=10 # Seconds
PERMUTATIONS_LIMIT=2147483648 # Bytes, default is 2 GB (prevents accidental disk exhaustion)
diff --git a/tests/unit/test_new_tool_integrations.bats b/tests/unit/test_new_tool_integrations.bats
index 162c775..9f53b6b 100644
--- a/tests/unit/test_new_tool_integrations.bats
+++ b/tests/unit/test_new_tool_integrations.bats
@@ -29,6 +29,89 @@ teardown() {
[[ -d "$TEST_DIR" ]] && rm -rf "$TEST_DIR"
}
+@test "lfi generates one-parameter candidates and uses explicit budgets" {
+ mkdir -p gf .tmp vulns
+ printf '%s\n' 'https://target.example.com/download?file=1&q=test' > gf/lfi.txt
+ printf '%s\n' '/etc/passwd' > "$TEST_DIR/lfi_wordlist.txt"
+
+ cat > "$MOCK_BIN/anew" <<'SH'
+#!/usr/bin/env bash
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+outfile="$1"
+mkdir -p "$(dirname "$outfile")"
+touch "$outfile"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq -- "$line" "$outfile"; then
+ printf '%s\n' "$line" >> "$outfile"
+ if [[ "$quiet" != true ]]; then
+ printf '%s\n' "$line"
+ fi
+ fi
+done
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ cat > "$MOCK_BIN/interlace" <<'SH'
+#!/usr/bin/env bash
+raw_args="$*"
+input=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -tL)
+ input="$2"
+ shift 2
+ ;;
+ -c)
+ printf '%s\n' "$2" > "$TEST_DIR/lfi_ffuf_cmd.txt"
+ shift 2
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+printf '%s\n' "$0 $raw_args" > "$TEST_DIR/lfi_interlace_args.txt"
+if [[ -n "$input" ]]; then
+ head -n 1 "$input" | sed 's/^/| URL | /'
+fi
+SH
+ chmod +x "$MOCK_BIN/interlace"
+
+ export LFI=true
+ export DEEP=false
+ export DEEP_LIMIT=500
+ export lfi_wordlist="$TEST_DIR/lfi_wordlist.txt"
+ export HEADER="User-Agent: bats"
+ export LFI_INTERLACE_THREADS=3
+ export LFI_INTERLACE_TIMEOUT=44
+ export LFI_FFUF_THREADS=9
+ export LFI_FFUF_RATELIMIT=77
+ export LFI_FFUF_TIMEOUT=7
+ export LFI_FFUF_MAXTIME=33
+ export LFI_FOLLOW_REDIRECTS=false
+ export LFI_MAX_URLS=2
+
+ run lfi
+ [ "$status" -eq 0 ]
+ [ -s ".tmp/tmp_lfi.txt" ]
+ [ "$(wc -l < ".tmp/tmp_lfi.txt" | tr -d ' ')" -eq 2 ]
+ grep -qx 'https://target.example.com/download?file=FUZZ&q=test' ".tmp/tmp_lfi.txt"
+ grep -qx 'https://target.example.com/download?file=1&q=FUZZ' ".tmp/tmp_lfi.txt"
+ grep -q -- '-threads 3' "$TEST_DIR/lfi_interlace_args.txt"
+ grep -q -- '-timeout 44' "$TEST_DIR/lfi_interlace_args.txt"
+ grep -q -- '-noninteractive' "$TEST_DIR/lfi_ffuf_cmd.txt"
+ grep -q -- '-timeout 7' "$TEST_DIR/lfi_ffuf_cmd.txt"
+ grep -q -- '-maxtime 33' "$TEST_DIR/lfi_ffuf_cmd.txt"
+ grep -q -- '-rate 77' "$TEST_DIR/lfi_ffuf_cmd.txt"
+ ! grep -q -- ' -r ' "$TEST_DIR/lfi_ffuf_cmd.txt"
+ [ -s "vulns/lfi.txt" ]
+}
+
@test "ssti uses TInjA engine and writes compatible output" {
mkdir -p gf .tmp vulns
printf 'https://target.example.com/?q=test\n' > gf/ssti.txt