Skip to content

Security Intelligence

Ghost’s security intelligence system provides layered vulnerability detection — from passive traffic analysis that runs automatically in the background, to AI-driven active testing with external security scanners, to runtime instrumentation with Frida for bypassing app protections.

When you switch Ghost to Security Mode, the entire interface transforms: the sidebar shows findings and targets instead of domains and bookmarks, the flow list highlights vulnerability severity, the inspector gains a findings tab and JWT decoder, and the AI agent switches from a QA engineer persona to a senior penetration tester following PTES (Penetration Testing Execution Standard) methodology.

What this diagram shows:

All security detections — whether from the passive interceptor (54 checks across 3 tiers) or from active testing tools — flow through a deduplication engine before being stored. The dedup engine ensures the same finding is only reported once per session (e.g., if 100 responses from api.example.com are missing the HSTS header, you get one finding, not 100). The findings are stored in SQLite and streamed to the UI via WebSocket events.

Ghost operates in two modes. Security intelligence activates when you switch to Security Mode.

AspectQA ModeSecurity Mode
SidebarScope Panel (domains, bookmarks)Findings Panel (targets, severity stats)
Flow listStandard columnsSeverity dots, findings count, auth badges
InspectorHeaders, body, timingFindings tab, auth analysis, JWT decoder
Agent personaQA engineerSenior penetration tester
Agent toolsQA tools (test generation, regression, export)Security tools (scanners, attacker, Frida)
Accent colorCyan/BlueRed/Orange
Finding prefixBUG-NNNVULN-NNN
Sub-ModeWhat’s Different
WebWeb + API security testing. No Frida tools in prompt, no mobile inspector context.
MobileAdds Frida tools section, mobile inspector context, mobile vulnerability taxonomy (certificate pinning, insecure local storage, root/jailbreak detection, sensitive data in logs, hardcoded secrets, deep link injection, clipboard leakage, missing binary protections, debug mode enabled, excessive permissions, weak encryption, man-in-the-disk).

Scan modes control how aggressive the AI agent is allowed to be. They form a trust escalation chain — you start passive and can escalate as you get comfortable.

Observe and analyze captured traffic only. Ghost reads traffic that’s already flowing — it never sends additional requests.

Allowed:

  • Analyze all captured flows for vulnerabilities
  • Search traffic, get flow details, list endpoints
  • List existing findings from the store
  • run_trufflehog with --no-verification flag only (static secret scanning — scans existing data without making network requests)
  • run_semgrep (static analysis for DOM XSS patterns)
  • Browser read-only actions (browser_read_page, browser_query_all, browser_screenshot)
  • proxy_inject_script for DOM annotation only (read-only highlights)

Forbidden: replay_request, send_http_request, attack_request, all other external scanners, all Frida tools, all browser modification actions

Test without modifying target data — like a security auditor who looks but doesn’t touch.

Allowed (in addition to everything in passive):

  • GET requests freely, read-only POST endpoints
  • All external scanners at safe configurations: nuclei, dalfox, ffuf, katana, nmap, sslscan
  • run_sqlmap (risk capped at level 1 — detection only, no exploitation)
  • attack_request for automated payload testing
  • Browser click/fill actions
  • frida_check, frida_list_apps, frida_trace (read-only function hooking)

Requires request_approval first: Data-modifying requests (POST/PUT/PATCH/DELETE that modify data), frida_bypass_ssl, frida_root_bypass, frida_inject, browser script injection

Full exploitation capability. All tools unrestricted without approval.

Still requires request_approval: Data-modifying write operations (even in full mode, the agent asks before modifying production data), credential brute force (run_hydra)

The SecurityInterceptor sits at the end of the interceptor pipeline (after storage), analyzing every response passively with 54 checks. It runs in OnResponse only — OnRequest is a no-op.

The interceptor only scans traffic for hosts matching configured target patterns (using Go’s path.Match glob syntax):

*.mydomain.com
api.example.com
staging-*.internal.net

Port numbers are stripped before matching, and comparison is case-insensitive. Empty target list = scan nothing. This prevents noise from CDNs, analytics, and third-party services.

CheckWhat It DetectsSeverityCWE
Plain HTTPNon-TLS traffic to target hostsHighCWE-319
URL Sensitive DataPasswords, tokens, API keys in URL query parametersHighCWE-598
Security HeadersMissing HSTS, X-Content-Type-Options, clickjacking protectionMedium/LowCWE-319/16/1021
Dangerous CORSWildcard origin + credentials, reflected originHigh/MediumCWE-942
Cookie FlagsMissing Secure, HttpOnly, SameSite on session cookiesMedium/LowCWE-614/1004/1275
Info LeakageServer version, X-Powered-By disclosureInfoCWE-200
Sensitive Data in BodyAWS keys, GitHub/Slack/OpenAI tokens, private keysCritical/HighCWE-200/321
Stack TracesJava, Python, Go, Node.js, .NET in error responsesMediumCWE-209
JWT ReflectionJWT tokens in response body, request JWT reflected, JWT claims reflectedHigh/MediumCWE-200

Extended Checks — Tier 1: High Impact (10)

Section titled “Extended Checks — Tier 1: High Impact (10)”
CheckSeverityCWE
CSP missing or weak (unsafe-inline, unsafe-eval, wildcard, data: in script-src)Medium/LowCWE-693
Private IP disclosure (RFC 1918, IPv6 link-local, EC2 hostnames)LowCWE-200
Credit card numbers (Visa/MC/Amex/Discover + Luhn validation)HighCWE-359
Basic authentication over HTTPHighCWE-522
Mixed content (HTTP resources in HTTPS pages)MediumCWE-311
Missing anti-CSRF tokens on POST formsMediumCWE-352
Directory listing enabledMediumCWE-548
SQL errors + framework debug pages (Django, Laravel, Spring, Express, Rails, Flask, ASP.NET)MediumCWE-209
Cache-Control missing on sensitive responsesMediumCWE-525
Open redirect via Location headerMediumCWE-601

Extended Checks — Tier 2: High Value (10)

Section titled “Extended Checks — Tier 2: High Value (10)”
CheckSeverityCWE
Missing Referrer-PolicyLowCWE-200
Missing Permissions-PolicyLowCWE-693
Cross-domain script without SRILowCWE-829
Reverse tabnabbing (target=_blank without noopener)MediumCWE-1022
Dangerous JavaScript sinks (eval, document.write, innerHTML)InfoCWE-79
Session ID in URL (JSESSIONID, PHPSESSID, sid)MediumCWE-598
Full path disclosure (/home/, /var/www/, C:\inetpub)LowCWE-200
Source map exposed (header + sourceMappingURL in JS)InfoCWE-540
Debug headers (X-Debug-Token, X-ChromeLogger-Data)MediumCWE-200
Password returned in API responseHighCWE-200

Extended Checks — Tier 3: Comprehensive (25)

Section titled “Extended Checks — Tier 3: Comprehensive (25)”

Email disclosure, suspicious comments, HSTS misconfiguration, cookie domain scope, password autocomplete, deprecated headers (X-XSS-Protection), X-AspNet-Version disclosure, X-Backend-Server disclosure, GraphQL introspection, sensitive JSON fields, CORS null origin, Java serialization, SSN patterns, cleartext password submission, user input reflection, insecure HTTP methods (TRACE), big redirect bodies, source code disclosure (PHP/ASP/JSP), compromised CDN domains (polyfill.io).

For full details on every check, see the Security Interceptor backend reference.

Only text content types are scanned (8 prefix patterns). Maximum body size: 5 MB (maxBodyScanSize). All regex patterns are compiled once at package level (not per-call). HTML-specific checks (mixed content, anti-CSRF, SRI) only run when content-type contains html. JS-specific checks (dangerous sinks, source maps) only run when content-type contains javascript.

Cookie flag checks use isLikelySessionCookie() to avoid false positives on harmless cookies. Only cookies with names containing session-related substrings (session, token, auth, jwt, etc.) are flagged. Flag detection parses only the attributes portion (after first ;) to avoid false negatives on cookie names containing flag-like strings.

Each finding gets a dedup key formatted as host|type|title — for example, api.example.com|config|Missing HSTS Header. A UNIQUE database index on (session_id, dedup_key) ensures the same issue is only stored once per session.

Every security finding — whether from passive detection, active scanning, or AI analysis — follows the same structure:

FieldTypeDescription
idstringUnique ULID identifier
session_idstringWhich session this finding belongs to
flow_idstringThe specific HTTP flow where this was detected (nullable — some findings aren’t tied to a single flow)
dedup_keystringDeduplication key: host|type|title
typestringCategory of vulnerability (see table below)
severitystringImpact level: critical, high, medium, low, or info
confidencefloatHow confident the detection is (0.0 to 1.0). A confidence of 0.95 means very likely a real issue. Lower values (0.7) indicate heuristic detections that may be false positives.
titlestringShort description of the finding (e.g., “Missing HSTS Header”)
descriptionstringDetailed explanation of the vulnerability and its impact
evidencestringThe specific data that triggered the finding (e.g., the header value, the leaked key, the stack trace excerpt)
remediationstringHow to fix the issue
cwe_idstringCommon Weakness Enumeration identifier (e.g., CWE-319) — the industry-standard vulnerability classification
owasp_idstringOWASP Top 10 category (e.g., A02:2021) — the most well-known web application security risk list
statusstringCurrent review state: open, confirmed, false_positive, or fixed
sourcestringWhat created this finding: passive (interceptor), active (scanners/attacker), or ai (agent analysis)
metadatamapAdditional key-value data specific to the finding
created_atdatetimeWhen the finding was first detected
updated_atdatetimeLast status change
TypeWhat It Covers
authAuthentication and authorization issues — weak auth mechanisms, missing auth on endpoints, session fixation
injectionSQL injection, XSS, command injection, template injection, NoSQL injection
exposureData exposure — sensitive information in responses, leaked API keys, PII in URLs
configSecurity misconfiguration — missing headers, dangerous CORS, verbose error messages
cryptoCryptographic weaknesses — weak TLS versions, bad JWT configuration, missing encryption
accessAccess control issues — IDOR (insecure direct object references), privilege escalation, broken authorization
sessionSession management — cookie flag issues, session fixation, predictable session IDs
StatusMeaning
openNewly detected, not yet reviewed by a human
confirmedReviewed and verified as a real vulnerability
false_positiveReviewed and dismissed as not a real issue (the detection was wrong)
fixedThe vulnerability has been remediated
SourceCreated By
passiveSecurityInterceptor (runs automatically on every response matching target patterns)
activeExternal scanners (run_nuclei, run_dalfox, etc.) or attack_request payloads
aiAI agent’s analysis of traffic patterns and flow data

Security findings use VULN-NNN prefix (e.g., VULN-001, VULN-002), while QA mode findings use BUG-NNN. This is managed by the EngagementState which tracks a sequential counter per session. The counter is zero-padded to 3 digits and capped at 100 findings per session.

Deduplication at the engagement level: the same finding type for the same endpoint is only counted once. Evidence files are tracked when the agent writes files like findings/VULN-001-sqli.md — the path is parsed to link the file back to the finding.

Ghost integrates external CLI security tools. There are 7 tools with full UI management (install, toggle, version detection) and 3 additional tools available only to the AI agent:

These appear in the Security Tools panel where you can install them with one click, see their version, and toggle them on/off:

ToolPurposeWhat It Does
nucleiTemplate-based vulnerability scannerRuns 9,000+ security checks against target URLs. The most comprehensive single-tool scanner.
dalfoxXSS specialist scannerFocused specifically on finding cross-site scripting (XSS) vulnerabilities with advanced payload generation.
ffufPath and parameter fuzzerDiscovers hidden directories, files, and parameters by trying thousands of common paths and names.
sqlmapSQL injection detectionThe industry-standard SQL injection tool. In Active Safe mode, restricted to risk level 1 (detection only, no exploitation). Requires Python.
trufflehogSecret scannerScans for leaked secrets — API keys, passwords, tokens — using 800+ detector types. In passive mode, runs with --no-verification (checks patterns but doesn’t verify against live services).
katanaJavaScript endpoint discoveryCrawls JavaScript files to find hidden API endpoints, internal URLs, and hardcoded paths.
semgrepStatic analysis for DOM XSSAnalyzes JavaScript code for DOM XSS patterns using semantic analysis rules. Requires Python.

Tool management:

  • Auto-detection: Ghost checks for each tool using exec.LookPath + a version command (10-second timeout) on startup
  • Installation: SSE (Server-Sent Events) streaming shows real-time progress during installation (10-minute timeout, 512 KB output cap)
  • Toggle: Per-tool enable/disable stored in ~/.ghost/config.toml under security.disabled_tools

Input validation: All scanner tools validate their inputs before execution to prevent flag injection and SSRF attacks:

  • Host validation (ValidateExternalHost) — every target hostname is checked: empty hosts are rejected, hosts that look like CLI flags (starting with -) are rejected, and the hostname is DNS-resolved with the resulting IP checked against loopback, private (RFC 1918), link-local, and unspecified addresses. Hosts that are explicitly configured as scan targets bypass the private-IP check (since the user intentionally chose them).
  • Parameter allowlisting — tools that accept enum-like parameters (e.g., nmap’s scan type -sV/-sS/-sT/-sU, sslscan’s StartTLS protocol smtp/pop3/imap/ftp) validate against a fixed allowlist rather than passing user input directly to the CLI. Any value not in the allowlist is silently ignored.
  • Pipeline panic recovery — the scan pipeline wraps each run in a defer recover() block. If a scanner panics (e.g., nil pointer in output parsing), the panic is caught, the session is marked as "failed" with the panic message, a EventFailed is emitted, and the pipeline cleans up — Ghost never crashes from a scanner bug.
  • StopAll for graceful shutdown — the scanner manager exposes a StopAll() method that cancels all running scans. This is called during Ghost’s graceful shutdown sequence to ensure no orphaned scanner processes are left running.

These are registered as agent tools but have no UI management — they must be pre-installed on the system:

ToolPurpose
nmapNetwork port scanning and service detection
sslscanSSL/TLS configuration auditing (cipher suites, certificate details, protocol versions)
hydraCredential brute force testing (requires request_approval even in Active Full mode)
Agent ToolScannerScan Mode Restriction
run_nucleinucleiActive Safe+
run_dalfoxdalfoxActive Safe+
run_ffufffufActive Safe+
run_sqlmapsqlmapActive Safe+ (risk capped at 1)
run_trufflehogtrufflehogPassive (with --no-verification) or Active
run_katanakatanaActive Safe+
run_semgrepsemgrepPassive+
run_nmapnmapActive Safe+
run_ssl_scansslscanActive Safe+
run_hydrahydraActive Full (requires approval)

When dalfox runs blind XSS tests, it embeds a callback URL in payloads. If a stored XSS payload fires later (e.g., when an admin views a page containing the injected payload), the victim’s browser sends a request to Ghost’s callback endpoint (/api/v1/security/xss-callback). This endpoint is unauthenticated by design — the XSS payload fires in an arbitrary browser context that cannot include Ghost’s bearer token.

To prevent attackers from injecting fake findings into arbitrary sessions, callback URLs are HMAC-signed. The SignCallbackURL function generates an HMAC-SHA256 signature binding the session ID and plan ID to the Ghost bearer token. The callback endpoint verifies this signature before creating a finding — requests with an invalid ?sig= parameter are rejected with HTTP 403. Unsigned callbacks are currently allowed with a warning log for backward compatibility, but this will become mandatory.

The callback body (execution context like document.cookie, document.domain) is capped at 4 KB (maxCallbackBody).

In security mode, the agent operates as a senior penetration tester following PTES methodology. The agent progresses through phases autonomously using a plan-execute-reflect-terminate loop.

What this diagram shows: The agent moves through five phases, with each phase unlocking different tool categories. Phase transitions happen automatically based on how many tools the agent has used in the current phase:

PhaseTransitions AfterWhat The Agent Does
Traffic Analysis3+ reconnaissance tool callsExamines captured traffic to understand the application — maps endpoints, identifies auth mechanisms, catalogs technologies
Passive Detection4+ passive tool callsAnalyzes headers, cookies, response bodies for vulnerabilities without sending any traffic
Active Scanning3+ active tool callsRuns external scanners, sends test payloads, probes for vulnerabilities
Exploitation4+ exploit tool callsGenerates proof-of-concept scripts, validates findings, tests exploit chains
Reporting(Terminal)Summarizes findings, generates report, writes PoC files

The following tools are registered and available in security mode:

ToolPurpose
list_findingsQuery existing findings from the store (filter by severity, type, status)
send_http_requestSend arbitrary HTTP requests with SSRF protection and scan mode enforcement
get_page_resourcesMap JavaScript, CSS, and image dependencies from HTML responses
attack_requestAutomated payload testing (see Request Attacker)
list_wordlistsList available attack payload wordlists
request_approvalGate for write operations — the agent asks for your permission before modifying data
6 Frida toolsSee Frida Integration
10 external scanner toolsSee the scanner table above

Note: The AI agent performs authentication analysis, JWT decoding, sensitive data detection, IDOR pattern recognition, security header auditing, and PoC generation directly using its language understanding capabilities — it reads the raw flow data and reasons about it, rather than using dedicated tools for these tasks.

Replaces the Scope Panel when in security mode:

  • Target hosts — add/remove glob patterns for what the passive interceptor should scan
  • Severity stats bar — color-coded breakdown showing how many findings at each severity level (critical=red, high=orange, medium=yellow, low=blue, info=gray)
  • Clickable severity filters — tap a severity segment to filter the flow list
  • Three tabs: Traffic, Devices, Findings

The flow list gains security-specific columns:

  • Severity dot — color-coded left border indicating the highest finding severity for that flow
  • Findings count — number of security findings associated with each flow
  • Security-test badge — marks flows generated by active testing tools (scanners, attacker)
  • Auth type badge — shows the detected authentication mechanism (JWT, cookie, API key)

The flow inspector adds security context:

  • Findings tab — per-flow findings with severity badges, evidence (shown in code blocks), and remediation guidance
  • Request/Response — standard headers and body view
  • Auth Analysis — JWT decoder with security checks

A standalone JWT analysis tool in the auth analysis tab:

  • Decodes header, payload, and signature sections
  • alg:none detection — flags tokens with no algorithm (can be forged without a key)
  • HS256/RS256 confusion — flags algorithm switching attacks (where an attacker tricks the server into using the public key as an HMAC secret)
  • Expiry check — warns on expired tokens or missing exp claim
  • PII detection — warns if the JWT payload contains email addresses, phone numbers, or SSN patterns (these shouldn’t be in tokens)

Full-screen findings list with:

  • Severity pill filters — click to filter by critical / high / medium / low / info
  • Status filter dropdown — filter by open / confirmed / false_positive / fixed
  • Card-based display — each finding shows severity badge, type tag, description, evidence (in a code block), remediation guidance, CWE/OWASP references, a status dropdown to change the finding’s state, and a link to the source flow

Security findings from the passive interceptor are often terse — “Missing HSTS Header” with a generic description. Ghost’s AI enhancement rewrites findings into full exploitation reports with pentest-grade detail.

Click “Enhance with AI” on any finding card. Ghost sends the finding’s title, type, severity, classification (CWE/OWASP), evidence, and current description/remediation to the configured LLM provider. The AI returns a structured JSON response with enhanced fields that are stored as metadata on the finding.

FieldWhat the AI Produces
TitleVulnerability class + specific target. Max 100 chars.
Description4-8 sentences. What was observed, why it matters, inferred risk with hedging language.
RemediationSpecific fixes with config/code snippets. Defense-in-depth layers.
CVSS VectorCVSS v3.1 vector scored on demonstrated impact only.
PoCFull pentest procedure with tagged steps (see below).
Attack ChainHow this finding chains with other vulnerabilities for escalated impact. 2-4 chains.
Severity RecommendationWhether severity should change, based on proven impact only.

The enhancement prompt enforces strict evidence-based standards across all fields — not just the PoC. This prevents the common LLM failure mode of presenting inferred risk as proven fact.

PoC Structure — the PoC field uses a mandatory 4-section format that structurally separates verified from hypothetical steps:

=== PREREQUISITES ===
Tools needed, setup instructions
=== VERIFIED STEPS (evidence-backed) ===
Step 1: curl command using actual URLs from evidence
Step 2: additional verification from observed data
=== HYPOTHETICAL STEPS (inferred — needs validation) ===
Step 3: exploitation scenario with explicit assumptions
Step 4: further exploitation
=== IMPACT ===
What the attacker gains if hypothetical steps succeed
SectionRendering
=== VERIFIED STEPS ===Green (emerald) left border per step
=== HYPOTHETICAL STEPS ===Amber left border + “needs validation” per step
=== PREREQUISITES ===Gray left border
=== IMPACT ===Red left border

The frontend parser (parsePoCSteps()) also supports legacy inline tags ([VERIFIED], [HYPOTHETICAL]) for backward compatibility. Findings without any recognized format fall back to raw <pre> rendering.

Description — must separate observed facts from inferred risk. “The target returns 14 tokens with 10-day expiry (verified). If tokens are accepted by other services (not verified), lateral movement is possible.” Not: “grants access to seller management and financial operations.”

CVSS Vector — scored only on demonstrated impact. S:C (Scope Changed) requires proven cross-boundary impact. Default to S:U when scope change is unproven.

Severity Recommendation — can only recommend changes based on proven impact. Must explain what evidence would be needed to justify escalation.

Each finding card shows the enhancement lifecycle:

StateButton TextVisual
Not enhanced”Enhance with AI”Standard card
Enhancing”Enhancing with AI…”Cyan shimmer animation + pulsing sparkle icon
Enhanced”Re-enhance with AI""Enhanced with AI” sparkle label + original/enhanced toggle

The original/enhanced toggle switches between the original passive scanner output and the AI-enhanced version for title, description, and remediation. PoC, attack chain, and CVSS are only shown when viewing the enhanced version.

EventWhen It FiresWhat Happens in UI
finding.createdNew finding detected (passive or active)Finding appears in panel. Critical and high severity findings trigger toast notifications automatically.
finding.updatedFinding status changed (e.g., open → confirmed)Status badge updates in the findings list
finding.deletedFinding removedFinding disappears from the panel
MethodEndpointDescription
GET/api/v1/findingsList findings. Requires session_id. Supports filters: type, severity, status, flow_id, limit (max 500), offset.
GET/api/v1/findings/statsGet finding statistics by session — totals broken down by severity, type, and status.
GET/api/v1/findings/{id}Get a single finding with full details.
PATCH/api/v1/findings/{id}/statusUpdate a finding’s status. Body: { "status": "confirmed" }. Validates against allowed statuses.
DELETE/api/v1/findings/{id}Delete a finding.

Note: There is no POST /findings endpoint — findings are created exclusively by the SecurityInterceptor callbacks and AI agent tools, never directly via the API.

MethodEndpointDescription
GET/api/v1/security/toolsList all external security tools with installation status, version, and enabled state. Includes Frida status.
POST/api/v1/security/tools/installInstall a tool via package manager. SSE streaming output. 10-minute timeout.
PATCH/api/v1/security/tools/{name}/toggleToggle a tool’s enabled/disabled state.

Passive security audit — Just capture traffic from your application normally. Ghost’s security interceptor automatically finds missing security headers, exposed API keys, dangerous CORS configurations, and sensitive data in response bodies — all without sending a single additional request.

Active penetration test — Switch to Active Safe mode and let the AI agent run nuclei, dalfox, and sqlmap against your application. The agent follows PTES methodology — starting with reconnaissance, moving to passive detection, then active scanning, and finally generating a report with findings and PoC scripts.

Mobile app security — Switch to Mobile sub-mode. Use Frida to bypass SSL pinning and root detection, then let the passive interceptor analyze the now-visible traffic. The mobile vulnerability taxonomy guides the agent to check for certificate pinning bypass, insecure local storage, sensitive data in logs, and other mobile-specific issues.

JWT security analysis — The JWT decoder instantly reveals weak algorithms (alg:none, HS256/RS256 confusion), missing expiry claims, and PII leaked in token payloads. No manual decoding needed.

Compliance checking — Run in passive mode to audit security headers across your entire application. The findings panel shows which hosts are missing HSTS, which cookies lack Secure flags, and which endpoints expose server version information — exactly the data a compliance auditor needs.