Capabilities

Code analysis

The scan-code skill (Exorcist) performs AI-native static analysis. It traces data flows, checks for mitigations, and only reports findings when all criteria for a genuine vulnerability are met.


Pattern matching is not enough

Pattern-matching SAST catches known vulnerability patterns (like query("SELECT * FROM users WHERE id = " + userId)) but misses everything that doesn't match a signature. Business logic flaws, authorization bypasses, and novel attack vectors are invisible to it.

It also over-reports. Every SQL query with string concatenation gets flagged, even when parameterized queries are used elsewhere in the same handler, or when input validation middleware runs upstream.


Five-phase analysis

Phase 1: Plan attack vectors

Based on the repository context (project type, frameworks, sensitive data types), the planner selects which vulnerability vectors to check. This is informed by structured criteria files that define 89 vulnerability types across backend, frontend, and mobile platforms.

The depth setting controls how many vectors to check:

DepthVectors per projectBest for
QuickTop 5Fast feedback during development
BalancedTop 15Regular security reviews
FullAll availableComprehensive audits

Phase 2: Nominate candidate files

For each selected vector, a fast triage pass identifies candidate files using pattern matching (Grep/Glob). The goal is to find files that might contain vulnerabilities, not to analyze them.

The nominator looks for signals like SQL query builders, authentication middleware, file upload handlers, or cryptographic function calls.

Phase 3: Deep analysis

Each nominated file gets thorough analysis that traces data flows from user input to dangerous sinks:

  • Input tracing -- where does user-controlled data enter this code path?
  • Sink identification -- where could that data cause harm (database queries, file operations, response rendering)?
  • Mitigation checking -- are there parameterized queries, input validation, escaping functions, or middleware that neutralize the threat?
  • Criteria validation -- every finding must satisfy all criteria defined for its vulnerability type. These criteria are specific and auditable (e.g., "User-controlled input reaches SQL query without parameterization" AND "Query uses string concatenation" AND "Input not validated or sanitized" AND "Vulnerable code reachable remotely").

A finding is only reported when all criteria are met. Missing even one criterion (like "input validation is absent") means the vulnerability doesn't exist.

Phase 4: Independent verification

Each finding goes through a second, independent analysis pass. The verifier re-reads the source code, confirms each criterion with specific code evidence, and checks for mitigations the analyzer might have missed.

Findings are classified as verified or rejected, with detailed reasoning. Rejection categories include: theoretical (possible but not practically exploitable), mitigated (protection exists), false positive (criteria not actually met), unreachable (code path can't be triggered), or best-practice-only (not a real vulnerability).

Phase 5: Auto-fix

Every verified finding includes a remediation section with corrected code. Your AI agent can apply these fixes directly.


Vulnerability coverage

Exorcist covers 89 vulnerability types organized by platform:

Backend (48 vectors)

CategoryVulnerabilities
InjectionSQL injection, command injection, NoSQL injection, XPath injection, XML injection, template injection, prompt injection
AuthorizationBOLA, BFLA, privilege escalation, mass assignment
AuthenticationBroken auth, weak passwords, missing MFA, insecure sessions, JWT implementation flaws, cookie security, credential stuffing, missing auth
CryptographyWeak encryption, insecure randomness, weak hashing, missing encryption at rest, improper certificate validation
Data exposureSensitive logging, sensitive errors, stack traces in production, debug endpoints, information disclosure, enumeration
Request forgerySSRF
API securityMissing rate limiting, missing input validation, CSRF, excessive data exposure, resource-level rate limiting
SerializationUnsafe deserialization, XXE, object injection
File handlingPath traversal, arbitrary file upload, unrestricted file types, file inclusion
Business logicRace conditions, workflow bypasses, signup flow abuse, password reset vulnerabilities, weak verification tokens

Frontend (15 vectors)

CategoryVulnerabilities
XSSDOM XSS, mutation XSS
InjectionCSS injection
AuthenticationInsecure token storage, token URL exposure
AuthorizationClient-side authorization bypass
Data exposureSensitive client-side code, console data leakage, sourcemap exposure
CryptographyClient-side crypto implementation, weak randomness
Third-party risksMissing subresource integrity
NavigationClient-side open redirect
MessagingMissing postMessage origin validation

Mobile (26 vectors)

CategoryVulnerabilities
Data storageUnencrypted local storage, sensitive logs, keychain misuse, SQLite encryption, backup exposure
CommunicationMissing certificate pinning, cleartext traffic, weak TLS
AuthenticationBiometric bypass, missing root detection, insecure sessions
CryptographyWeak encryption, insecure key storage, custom crypto
Code tamperingMissing obfuscation, debug mode enabled, insecure IPC, exported components
Reverse engineeringHardcoded secrets, API keys in code, logic exposure, missing anti-tamper
Platform-specificInsecure deep links, intent manipulation, URL scheme hijacking, WebView vulnerabilities

All criteria are defined in YAML files and are fully inspectable in the skills repository.


Example

claude "run a code security analysis on this project"

For a deeper analysis:

claude "/ghost:scan-code depth=full"

A typical finding looks like:

markdown
# Finding: SQL Injection in Account Handler

## Metadata
- Type: backend
- Vector: sql-injection
- CWE: CWE-89
- Severity: high

## Location
- File: src/handlers/account.go:87
- Function: GetAccount

## Vulnerable Code
  rows, err := db.Query("SELECT * FROM accounts WHERE id = " + accountId)

## Remediation
Use parameterized queries to prevent SQL injection.

## Fixed Code
  rows, err := db.Query("SELECT * FROM accounts WHERE id = ?", accountId)

For full documentation of the analysis engine, criteria format, and finding format, see Exorcist.

Previous
Dependency scanning