Back to skill

Security audit

fofamap

Security checks for vulnerabilities and agentic risk

Overview

This FOFA reconnaissance skill is mostly coherent, but it needs review because its helper can expose FOFA credentials to a configured endpoint and can run a locally spoofed nuclei executable.

Install only if you trust the workspace and launcher environment. Keep FOFA_BASE_URL unset unless you intentionally use a trusted FOFA-compatible endpoint, avoid running nuclei commands from untrusted directories, and treat CSV/XLSX exports as untrusted internet data before opening them in spreadsheet software.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fofa_recon.py:483
Finding

FOFA Credentials Can Be Transmitted to an Arbitrary Configured Endpoint

Content
View full analysis
tuple[str, str, str, int]: base_url = get_env("FOFA_BASE_URL", required=False, default="https://fofa.info").rstrip("/") email = get_env("FOFA_EMAIL") api_key = get_env("FOFA_API_KEY") timeout_raw = get_env("FOFA_TIMEOUT", required=False, default="60") try: timeout = int(timeout_raw) except ValueError: timeout = 60 return base_url, email, api_key, timeout def request_json(path: str, params: Dict[str, Any], retries: int = 3) -> Dict[str, Any]: base_url, email, api_key, timeout = api_config() merged = {"email": email, "key": api_key} merged.update(params) url = f"{base_url}{path}?{urllib.parse.urlencode(merged)}" headers = {"User-Agent": "fofamap-skill/2.0"} for attempt in range(1, retries + 1): request = urllib.request.Request(url, headers=headers) try: with urllib.request.urlopen(request, timeout=timeout) as response: return json.loads(response.read().decode("utf-8", errors="replace")) ``` ### Technical Analysis Every FOFA API request includes `FOFA_EMAIL` and `FOFA_API_KEY` in the URL query string. The destination is controlled by the optional `FOFA_BASE_URL` environment variable, but the code does not validate its scheme, hostname, port, or relationship to FOFA. Consequently, a modified process environment can redirect credentials to any HTTP or HTTPS endpoint. Use of a plaintext `http://` endpoint is also accepted, allowing credentials to cross the network without transport encryption. Even over HTTPS, query-string credentials can be retained in reverse-proxy, web-server, monitoring, or diagnostic logs. The Skill legitimately needs to authenticate to FOFA. However, transmitting ...[truncated 1380 chars]
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/fofa_recon.py:3300
Finding

Untrusted Nuclei Executable Can Be Loaded from the Current Working Directory

Content
View full analysis
str | None: found = shutil.which("nuclei") if found: return found cwd_candidate = Path.cwd() / "nuclei" if cwd_candidate.exists() and cwd_candidate.is_file(): return str(cwd_candidate) exe_candidate = Path.cwd() / "nuclei.exe" if exe_candidate.exists() and exe_candidate.is_file(): return str(exe_candidate) return None def run_nuclei_scan(nuclei_path: str, targets_file: str, extra_args: str, output_file: str) -> Dict[str, Any]: cmd = [nuclei_path, "-l", targets_file, "-o", output_file, "-stats"] + shlex.split(extra_args or "") completed = subprocess.run(cmd, capture_output=True, text=True) ``` The returned path is also used by `project-run --run-nuclei`, `nuclei-run`, and `nuclei-update`. ### Technical Analysis When `shutil.which("nuclei")` does not find an installed executable, the helper automatically trusts a file named `nuclei` or `nuclei.exe` in the current working directory. It checks only whether the candidate exists and is a regular file. The implementation does not verify executable ownership, permissions, cryptographic integrity, provenance, or whether the path belongs to an approved installation. A project workspace is commonly writable by repository contents, extraction processes, build jobs, or other users. Treating that directory as a trusted executable source creates a tool-spoofing boundary violation. Use of an argument list instead of `shell=True` prevents ordinary shell metacharacter injection through `extra_args`, but it does not mitigate execution of a substituted binary. ### Attack Path 1. An attacker places a malicious executable named `nuclei` or `nuclei.exe` in the working directory. 2. No legitimate `nuclei` executable is available t ...[truncated 944 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fofa_recon.py:925
Finding

Untrusted FOFA Results Are Exported to CSV Without Spreadsheet Formula Neutralization

Content
View full analysis
None: path.parent.mkdir(parents=True, exist_ok=True) with open(path, "w", encoding="utf-8-sig", newline="") as handle: writer = csv.writer(handle) writer.writerow(headers) writer.writerows(rows) ``` ```python def build_export_rows(result_objects: List[Dict[str, str]], fields_str: str, include_http_status: bool) -> tuple[List[str], List[List[str]]]: names = field_names(fields_str) headers = ["ID"] + [name.upper() for name in names] if include_http_status: headers.append("HTTP_STATUS") rows: List[List[str]] = [] for index, item in enumerate(result_objects, start=1): row = [str(index)] + [item.get(name, "") for name in names] if include_http_status: row.append(item.get("http_status", "")) rows.append(row) return headers, rows ``` ### Technical Analysis FOFA result fields can contain content controlled by operators of indexed services, including titles, banners, headers, domains, and product metadata. These values are copied directly into CSV cells. The standard CSV writer provides syntactic CSV quoting, but it does not prevent spreadsheet applications from interpreting cells beginning with `=`, `+`, `-`, or `@` as formulas. An attacker can expose a crafted service value that FOFA indexes and that the Skill later exports. When an analyst opens the generated CSV in a spreadsheet application, the formula may execute in the spreadsheet context. Effects depend on the client and its security configuration, but can include outbound requests, disclosure of spreadsheet data, misleading content, or command execution through legacy spreadsheet features. ### Attack Path 1. An a ...[truncated 1112 chars]
Remediation
View remediation
Vulnerability Patterns
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (53)

YARA rule 'c2_framework_indicators': Command-and-control framework indicators (Cobalt Strike, Metasploit, Sliver, etc.) [malware]

Critical
Category
YARA Match
Confidence
85% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/query-playbook.md (reported line 139)May include surrounding context.

md
roader fallback query

## Attack infrastructure tracking

Use FOFA to find hosted offensive tooling, staging panels, and suspicious service clusters.

Good pivots:

- `asn=` for cloud clusters
- `app=` for known framework or beacon families
- `title=` and `body=` for panel and kit artifacts
- `header=` and `server=` for brittle but sometimes unique stack leakage

Examples:

- `asn="45102" && app="COBALTSTRIKE-beacon"`
- `asn="16509" && app="RAPID7-Metasploit"`
- `body="miner start"`
- `body="get all proxy from proxy pool"`

Good follow-up questions for the agent:

- is this the same cloud family as other suspicious assets
- is the stack concentrated in one ASN or spread across multiple clouds
- does the title or body suggest a staging panel, a kit, or a management console

## Honeypot and deception review

Honeypots and decoys often leak contradictory or theatrical signals.

Look for:

- impossible or strange stack combinations
- old or generic servers mixed with enterprise middleware

YARA rule 'c2_framework_indicators': Command-and-control framework indicators (Cobalt Strike, Metasploit, Sliver, etc.) [malware]

Critical
Category
YARA Match
Confidence
85% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/redteam-hunt-playbook.md (reported line 39)May include surrounding context.

md
roader fallback query

## Attack infrastructure tracking

Use FOFA to find hosted offensive tooling, staging panels, and suspicious service clusters.

Good pivots:

- `asn=` for cloud clusters
- `app=` for known framework or beacon families
- `title=` and `body=` for panel and kit artifacts
- `header=` and `server=` for brittle but sometimes unique stack leakage

Examples:

- `asn="45102" && app="COBALTSTRIKE-beacon"`
- `asn="16509" && app="RAPID7-Metasploit"`
- `body="miner start"`
- `body="get all proxy from proxy pool"`

Good follow-up questions for the agent:

- is this the same cloud family as other suspicious assets
- is the stack concentrated in one ASN or spread across multiple clouds
- does the title or body suggest a staging panel, a kit, or a management console

## Honeypot and deception review

Honeypots and decoys often leak contradictory or theatrical signals.

Look for:

- impossible or strange stack combinations
- old or generic servers mixed with enterprise middleware

YARA rule 'c2_framework_indicators': Command-and-control framework indicators (Cobalt Strike, Metasploit, Sliver, etc.) [malware]

Critical
Category
YARA Match
Confidence
85% confidence
Finding

The C2-framework indicator hit is not malware execution, but the document does provide concrete hunt examples for identifying offensive tooling such as Cobalt Strike and Metasploit infrastructure. In the context of a FOFA reconnaissance skill, these examples can materially assist threat hunting, but also lower the barrier for locating attacker infrastructure or repurposing searches for unauthorized reconnaissance.

Content

Scanner excerpt · references/syntax-arsenal.md (reported line 118)May include surrounding context.

md
y nearby stable pivots such as:

- `cert.not_before`
- `cert.not_after`
- `after=`

Use certificate pivots to find:

- infrastructure issued by the same organization
- newly deployed HTTPS exposure
- mismatched branding across asset groups

### ASN and cloud pivots

When the real intent is "which cloud or hosting cluster is carrying this exposure", pivot by ASN.

Examples:

- `asn="45102" && app="COBALTSTRIKE-beacon"`
- `asn="16509" && app="RAPID7-Metasploit"`
- `asn="45102" && body="login"`

Treat ASN as a way to move from one asset to an infrastructure family, especially for cloud-hosted offensive tooling, SaaS assets, or burst deployments.

### Geography plus stack pivots

The strongest real-world searches often combine place and technology.

Examples:

- `city="Hangzhou" && domain="edu.cn"`
- `city="Shenzhen" && app="HIKVISION"`
- `city="Chengdu" && port="3389"`
- `city="Beijing" && cert="baidu"`
- `country="CN" && city!="Hong Kong"`

Use this when the user is really asking for:

-

YARA rule 'c2_framework_indicators': Command-and-control framework indicators (Cobalt Strike, Metasploit, Sliver, etc.) [malware]

Critical
Category
YARA Match
Confidence
85% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/fofa_recon.py (reported line 363)May include surrounding context.

python
platforms, and brand-control gaps",
        "title_suffix": "Takeover Risk",
    },
}

REPORT_PROFILE_CHOICES = list(REPORT_PROFILE_METADATA.keys())

CLOUD_PROVIDER_MARKERS = [
    "amazon",
    "aws",
    "alibaba",
    "aliyun",
    "tencent",
    "google",
    "gcp",
    "azure",
    "microsoft",
    "cloudflare",
    "digitalocean",
    "oracle",
    "huawei",
]

ATTACK_INFRA_MARKERS = [
    "cobaltstrike",
    "cobalt strike",
    "beacon",
    "metasploit",
    "sliver",
    "mythic",
    "supershell",
    "v2ray",
    "frp",
    "gost",
    "xray",
    "nps",
    "shadowsocks",
    "teamserver",
    "proxy pool",
]

ABNORMAL_EXPOSURE_MARKERS = [
    "swagger",
    "actuator",
    "jenkins",
    "grafana",
    "dashboard",
    "kibana",
    "elasticsearch",
    "mongodb",
    "redis",
    "listbucketresult",
    "config.txt",
    "algolia_api_key",
    "/api/",
    "/admin",
    "hacked by",
    "miner",
]

TAKEOVER_MARKERS = [
    "github pages",
    "site not found",
    "there

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill further extends beyond passive recon by describing direct nuclei execution, potential template/binary updates, and local learning artifacts, none of which are reflected in the declared purpose. In a security context this is especially risky because users may invoke what appears to be a search helper while actually enabling vulnerability scanning, software updates, and retention of operational history.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill further extends beyond passive recon by describing direct nuclei execution, potential template/binary updates, and local learning artifacts, none of which are reflected in the declared purpose. In a security context this is especially risky because users may invoke what appears to be a search helper while actually enabling vulnerability scanning, software updates, and retention of operational history.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 6)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 17)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 62)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 64)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 65)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 68)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 69)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 70)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 71)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 72)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 73)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 74)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 76)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 77)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 96)May include surrounding context.

md
","requires":{"env":["FOFA_EMAIL","FOFA_API_KEY"],"bins":["python3"]},"files":["scripts/fofa_recon.py","references/setup.md","references/query-playbook.md","ref

Static analysis

No suspicious patterns detected.