Repository navigation
csprecon v0.5.0 🥳
Discover new target domains using Content Security Policy
✨ New: CSP bypass detection ✨
csprecon can now check a target's enforced CSP against the known bypass gadgets from the CSPBypass dataset.
| Flag | Description |
|---|---|
-b, -bypass |
Report known CSP bypass gadgets (CSPBypass dataset) |
-bf, -bypass-file |
Use a local data.tsv (CSPBypass format) instead of fetching |
csprecon -u https://www.apple.com -b
csprecon -u https://www.apple.com -bf ./data.tsv- Plain output prints one
[bypass] <url> <domain> <directive> <code>line per match. JSON output adds aBypassesarray. - Only enforced policies are checked.
- The dataset is not bundled. It is fetched at runtime, cached per user (
~/.cache/csprecon/or the OS equivalent) and the cached copy is used when the fetch fails. - Credit to @renniepak and the CSPBypass contributors.
Fixes
- Every CSP header is parsed. Before, only the first value of a repeated header was read (thanks @amalsaidov).
- Domain extraction is more accurate. Only hosts are reported, lowercased. File names in paths (e.g.
app.min.js) are no longer reported as domains. - Fixed a race condition in output deduplication.
- URLs are kept intact. The query string is now sent, a space in the query is encoded as
%20and the fragment is dropped. - Redirects:
'self'and scheme-less sources are matched against the final page. JSON output has a newFinalURLfield, set when the target redirected. - Domain filter (
-d) ignores case. -ois safer. The output file is opened only after setup succeeds, so a failed run no longer empties it. A write error stops the run instead of silently dropping lines.
Improvements
-cidrranges are streamed. Large ranges no longer have to fit in memory and scanning starts right away.- One shared HTTP client for the whole run, so connections are reused.
- Output is written by a single writer. A target's lines are printed together and stay whole.
- Stricter flag validation at startup:
-timeoutmust be greater than 0.-pxmust bescheme://host[:port], with schemehttp,https,socks5orsocks5h.
CI & maintenance
- GitHub Actions pinned to commit SHAs, with least-privilege
permissionsandpersist-credentials: false. - The Go version is read from
go.mod. Dependabot now also updates GitHub Actions, with a 7-day cooldown. - Large new test suite: matcher, bypass, runner, input checks and edge cases.
- Dependency updates:
goflagsv0.2.1,gologgerv1.1.75,utilsv0.11.13, plus indirect bumps. - README: documented the bypass flags and supported proxy schemes and fixed the golangci-lint link (thanks @RanaKhan77).
Changelog
- 80bb5c8 Merge pull request #524 from edoardottt/devel
- 6346433 Highlight [BYPASS] findings on the terminal and tidy verbose logging
- 3a9cd63 Merge pull request #523 from edoardottt/devel
- 669641e update README.md
- f23e539 dependencies update
- e7135fc v0.5.0
- cf49114 Document bypass flags
- f1cb643 Add bypass and runner tests
- 017f5ad Rework runner, wire bypass
- eb00400 Add bypass flags and validation
- 908626d Add bypass gadget loader
- 0f5102c Fix URL handling, stream CIDR
- 454788d Parse CSP hosts and policies
- 51fd824 Add CSP source matcher
- 7849286 Fix race in output dedup
- 33764b6 Merge pull request #520 from amalsaidov/fix/multiple-csp-headers
- b6b056b Merge pull request #522 from RanaKhan77/docs/fix-golangci-lint-install-link
- 65bf754 docs: fix golangci-lint install link (404 after docs restructure)
- 16af531 fix: parse every CSP header, not only the first
- c47913f Merge pull request #518 from edoardottt/devel
- db17985 Merge pull request #517 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/utils-0.11.12
- e67eb62 chore(deps): bump github.com/projectdiscovery/utils
- c9ee620 Merge pull request #516 from edoardottt/devel
- fb4d6ac Merge pull request #515 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/utils-0.11.11
- 41136f3 Merge branch 'devel' into dependabot/go_modules/devel/github.com/projectdiscovery/utils-0.11.11
- 15bd3c7 Merge pull request #514 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/gologger-1.1.75
- 4b11916 chore(deps): bump github.com/projectdiscovery/utils
- 0d5d223 chore(deps): bump github.com/projectdiscovery/gologger
- c5c54db Merge pull request #513 from edoardottt/devel
- 2e6f69e actions update
- 5ec8af4 Merge pull request #512 from edoardottt/devel
- ab6ec38 Merge pull request #511 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/utils-0.11.9
- c6c8a0b chore(deps): bump github.com/projectdiscovery/utils
- c717047 Merge pull request #510 from edoardottt/devel
- 2f28ea7 Merge pull request #509 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/utils-0.11.6
- 3a52d32 Update go.sum
- 6ea4955 Merge branch 'devel' into dependabot/go_modules/devel/github.com/projectdiscovery/utils-0.11.6
- 13c3bc4 Merge pull request #507 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/gologger-1.1.73
- 0e4bb0e chore(deps): bump github.com/projectdiscovery/utils
- 1a61813 Merge branch 'devel' into dependabot/go_modules/devel/github.com/projectdiscovery/gologger-1.1.73
- 12c7192 Merge pull request #506 from edoardottt/dependabot/go_modules/devel/github.com/projectdiscovery/goflags-0.2.1
- 2a36abd Update README.md
- c1b121b chore(deps): bump github.com/projectdiscovery/gologger
- cac9ced chore(deps): bump github.com/projectdiscovery/goflags
If you encounter a problem, just open an issue