National Cyber Warfare Foundation (NCWF)login

csprecon for discovering hidden target domains through content security policy headers


0 user ratings
2026-10-30 05:30:09
milo
Red Team (CNA)

csprecon is a Go-based reconnaissance tool that parses Content-Security-Policy headers to enumerate subdomains and external origins during authorized security assessments.








Tooledoardottt/csprecon — Go utility that extracts domains and origins from Content-Security-Policy headers for reconnaissance
CategoryPassive/semi-passive web reconnaissance and attack surface mapping
Primary UseExpanding the known scope of an authorized target by harvesting hostnames, CDN endpoints, and third-party origins declared in CSP headers via csprecon -u or csprecon -l
Safe UseIntended for bug bounty programs with defined scope, authorized penetration tests, and internal asset-inventory exercises run by defenders on systems they own or are contracted to assess
Telemetry NoteGenerates ordinary HTTPS GET requests indistinguishable from a browser fetch of the page itself; defenders can observe unusual volumes of single-request scans from one source, and -rl rate-limiting means the footprint is deliberately modest

csprecon, written by edoardottt in Go, addresses a narrow but genuinely useful niche in the reconnaissance phase of an authorized engagement: mining Content-Security-Policy headers for hostnames the target organization has implicitly declared. A CSP header is, in effect, a whitelist of origins the application is permitted to load scripts, styles, images, and connections from. Every entry in script-src, connect-src, img-src, and their siblings is a hostname somebody configured deliberately — which makes the header a surprisingly high-signal, low-noise source of subdomain and third-party intelligence. Rather than brute-forcing wordlists against DNS, csprecon simply reads what the target publicly announces on every response, making it one of the gentler enumeration techniques available to professionals.


The tool has accumulated roughly 527 stars on GitHub, is MIT-licensed, and ships with continuous integration via a go.yml GitHub Actions workflow, which signals an actively maintained project rather than a weekend experiment. Its topic tags place it squarely in the bug bounty ecosystem — bugbounty, recon, recon-tool, redteam-tools, web-security — and it has picked up organic attention from the community, with the README listing mentions in the tl;dr sec newsletter, Securibee's Hive Five Newsletter, Trickest, and the Critical Thinking bug bounty podcast. That kind of editorial coverage matters when you are deciding whether a recon utility is worth adding to a working toolchain, because it indicates real-world adoption by working hunters rather than star-farming.


Installation is trivially low-friction across the three distribution channels the README documents. brew install csprecon covers macOS and Linux Homebrew users, sudo snap install csprecon covers snap-based systems, and the canonical Go route is go install github.com/edoardottt/csprecon/cmd/csprecon@latest, which pulls a single static binary with no runtime dependencies. The fact that the author maintains all three channels — plus the visible CI badge — suggests release hygiene that many small recon tools lack. For operators who keep tools containerized or in a per-engagement VM, the static Go binary model makes csprecon easy to pin and audit.


The flag surface is compact and reads like a tool designed by someone who actually pipelines. Input comes from -u/-url for a single domain, -l/-list for a file of targets, or -cidr to interpret input as a network range. Results can be filtered to those belonging to specific parent domains with -d/-domain, which is the scope-tightening feature that separates responsible enumeration from sloppy sprawl: if your authorization covers example.com but the target's CSP references a SaaS analytics vendor, -d lets you keep only what is in-scope rather than polluting your notes with unrelated origins. Notably, the examples require protocols in list files — csprecon -l targets.txt expects URLs, not bare hostnames — a detail that trips up first-time users.


Concurrency and pacing controls are first-class. -c/-concurrency defaults to 50 parallel workers, -t/-timeout defaults to 10 seconds per connection, and -rl/-rate-limit caps requests per second. For engagements against fragile staging environments or bug bounty programs with explicit traffic policies in their rules, the combination of -rl 10 with a modest -c is the professional way to stay inside acceptable behavior. The -px/-proxy flag routes traffic through a proxy such as http://127.0.0.1:8080, which is how most operators will run it — through Burp Suite or mitmproxy — so that every request the tool makes is logged, reviewable, and attributable during reporting.


Output handling covers the full range of pipeline ergonomics. -o writes results to a file, -v gives verbose progress, -s suppresses everything but the results themselves for clean shell composition, and -j emits structured JSON for consumption by downstream tooling. The stdin-friendly design is the real workflow multiplier: echo https://www.github.com | csprecon and cat targets.txt | csprecon both work, which means csprecon slots naturally after subdomain enumerators like subfinder or amass, taking a list of resolved hosts and extracting their CSP intelligence as a second-pass enrichment. Composed that way, it becomes one stage in a chain rather than a standalone one-shot.


Under the hood, the architecture is what you would expect from a well-behaved Go recon tool: a worker pool sized by -c, per-request timeouts, and a parser that tokenizes the Content-Security-Policy directive values into individual origins, then normalizes and deduplicates them. The -cidr mode expands an input like 192.168.1.0/24 into address-space scanning — clearly aimed at internal or lab use on ranges you own, since spraying an external CIDR you do not control is neither authorized nor productive. The filtering logic behind -d is simple substring/belongs-to matching against the comma-separated domain list, but that simplicity is a feature: predictable behavior you can reason about when scope discipline matters.


The README's examples also show the csprecon -u https://www.github.com single-target form, demonstrating output against a well-known site — an appropriate, public, non-victim demonstration choice. It is worth pausing on what this kind of collection actually yields: CSP headers routinely disclose asset CDN hostnames, API gateways, SaaS integrations, analytics endpoints, and occasionally forgotten infrastructure from past migrations. For a defender running the same tool against their own estate, that last category is the interesting one — origins in a live CSP that no longer correspond to a sanctioned vendor are both an attack-surface finding and a CSP hygiene finding, since overly permissive or stale policies degrade the header's protective value.


From a defensive telemetry perspective, csprecon is nearly indistinguishable from a browser fetching the page once, because that is essentially all it does. There is no aggressive scanning, no exploitation, no anomalous payloads — just ordinary HTTPS requests. This means blue teams should not rely on network-level detection of the collection itself; instead, the defensive value comes from running csprecon inward. Asset inventory teams can periodically crawl their own domains, diff the extracted origins against configuration-management records, and flag undocumented third-party dependencies before an attacker's recon pass finds them first. That inversion — attacker tooling as inventory instrument — is the strongest argument for keeping csprecon in a defender's kit alongside the red-team one.


Governance of the project itself is clean: contributions flow through GitHub issues and pull requests, with the author requiring golangci-lint run to pass before a PR is accepted, which enforces a baseline of code quality uncommon in hobby recon utilities. Changes are tracked in GitHub releases notes, and the MIT license imposes no friction on commercial engagement use. The author, edoardottt, is reachable via edoardottt.com and maintains a broader family of security tooling, which is relevant when you are assessing whether a dependency will still be patched next year.


In sum, csprecon earns its place in the reconnaissance stage not by doing something exotic but by industrializing a high signal-to-noise source that manual workflows tend to skip. Its scope-filtering, rate-limiting, proxy, and JSON output flags show deliberate design for pipeline integration, and its footprint is light enough to satisfy even strict bug bounty traffic rules. For authorized professionals — whether hunters expanding in-scope attack surface or defenders auditing their own CSP disclosures — it converts a header everyone can read into a structured asset list in one command, and it does so with the reliability and polish of a project that clearly intends to be depended on.



Official project repository for edoardottt/csprecon.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/10/csprecon-for-discovering-hidden-target.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.