Skip to main content

A verification-driven CSRF exploitation assistant for VAPT teams

Project description

Sentinel-CSRF

 ███████╗███████╗███╗   ██╗████████╗██╗███╗   ██╗███████╗██╗     
 ██╔════╝██╔════╝████╗  ██║╚══██╔══╝██║████╗  ██║██╔════╝██║     
 ███████╗█████╗  ██╔██╗ ██║   ██║   ██║██╔██╗ ██║█████╗  ██║     
 ╚════██║██╔══╝  ██║╚██╗██║   ██║   ██║██║╚██╗██║██╔══╝  ██║     
 ███████║███████╗██║ ╚████║   ██║   ██║██║ ╚████║███████╗███████╗
 ╚══════╝╚══════╝╚═╝  ╚═══╝   ╚═╝   ╚═╝╚═╝  ╚═══╝╚══════╝╚══════╝

 CSRF Exploit Verification Tool | Author: N15H

A verification-driven CSRF exploitation assistant for VAPT teams and bug bounty hunters. Unlike traditional scanners that flood reports with false positives, Sentinel-CSRF reports only what it can prove.

🎯 Philosophy

  • Prefer false negatives over false positives
  • Never report without exploit reasoning
  • Every finding answers: "Why does the browser allow this?"

📦 Installation

Option 1: pip from PyPI (Easiest)

pip install sentinel-csrf

Option 2: pipx (Recommended for CLI tools)

# Install pipx if not already installed
sudo apt install pipx
pipx ensurepath

# Install Sentinel-CSRF
pipx install sentinel-csrf

Option 3: From Source

git clone https://github.com/NI54NTH/sentinel-csrf.git
cd sentinel-csrf
pip install -e .

Verify Installation

sentinel-csrf --version
sentinel-csrf --help

🚀 Quick Start

Basic Scan

# Scan a request for CSRF vulnerabilities
sentinel-csrf scan -c cookies.txt -r request.txt -o ./results

Generate PoC

# Generate HTML exploit from request
sentinel-csrf poc generate -r request.txt -o poc.html

Reuse Last Inputs

# After first scan, reuse cached inputs
sentinel-csrf scan --reuse-last

📖 Complete Command Reference

Global Options

sentinel-csrf --help              # Show help
sentinel-csrf --version           # Show version
sentinel-csrf --verbose           # Enable verbose output

scan - CSRF Vulnerability Scanner

Analyze HTTP requests for exploitable CSRF vulnerabilities.

sentinel-csrf scan [OPTIONS]

Input Options (choose one for each)

Cookie Input Description
-c FILE, --cookies FILE Path to Netscape cookie file
--cookies-stdin Read cookies from STDIN (Ctrl+D to end)
--reuse-last-cookies Reuse last cached cookies
--reuse-last Reuse both cached request and cookies
Request Input Description
-r FILE, --request FILE Path to raw HTTP request file
--request-stdin Read request from STDIN (Ctrl+D to end)
--reuse-last-request Reuse last cached request

Output Options

Option Description
-o DIR, --output-dir DIR Results directory (default: ./csrf-results)
-f FORMATS, --format FORMATS Output formats: json,markdown (default: both)
--suppress-informational Hide low-confidence findings
--no-cache Don't cache inputs after scan

Examples

# Basic scan with files
sentinel-csrf scan -c cookies.txt -r request.txt

# Scan with STDIN input (paste, then Ctrl+D)
sentinel-csrf scan --request-stdin --cookies-stdin

# Pipe request from clipboard
xclip -o | sentinel-csrf scan --request-stdin -c cookies.txt

# Reuse last scan inputs
sentinel-csrf scan --reuse-last

# Mix: new request with cached cookies
sentinel-csrf scan -r new-request.txt --reuse-last-cookies

# Custom output directory
sentinel-csrf scan -c cookies.txt -r request.txt -o ./my-results

import - Format Conversion

Convert Burp exports and cookie strings to canonical formats.

import burp - Burp XML to Raw HTTP

sentinel-csrf import burp -i burp-export.xml -o ./requests/
Option Description
-i FILE, --input FILE Burp Suite XML export file
-o DIR, --output DIR Output directory for request files

import cookies - Cookie String to Netscape

sentinel-csrf import cookies -i "session=abc123; auth=xyz" -d example.com -o cookies.txt
Option Description
-i STRING, --input STRING Cookie string (from browser DevTools)
-d DOMAIN, --domain DOMAIN Target domain
-o FILE, --output FILE Output Netscape cookie file

poc - Proof-of-Concept Generation

Generate and serve CSRF proof-of-concept HTML files.

poc generate - Create HTML Exploit

sentinel-csrf poc generate [OPTIONS] -o OUTPUT
Input Option Description
-r FILE, --request FILE Raw HTTP request file
-f FILE, --finding FILE Finding JSON file from scan
--request-stdin Read request from STDIN
Option Description
-o FILE, --output FILE Output HTML file (required)
--vector VECTOR Attack vector (see below)

Attack Vectors:

Vector Description
form_post Auto-submitting POST form (default)
form_get GET form submission
img_tag Silent GET via <img> tag
iframe Hidden iframe
fetch Fetch API request
# Generate from request file
sentinel-csrf poc generate -r request.txt -o poc.html

# Generate from STDIN
sentinel-csrf poc generate --request-stdin -o poc.html

# Use specific attack vector
sentinel-csrf poc generate -r request.txt -o poc.html --vector img_tag

# Generate from finding JSON
sentinel-csrf poc generate -f findings.json -o poc.html

poc serve - Local HTTP Server

Serve PoCs for browser testing (required for SameSite=Lax testing).

sentinel-csrf poc serve -d ./pocs -p 8080
Option Description
-d DIR, --dir DIR PoC directory (default: ./pocs)
-p PORT, --port PORT Port number (default: 8080)

📋 Input File Formats

Netscape Cookie File (cookies.txt)

# Netscape HTTP Cookie File
.example.com	TRUE	/	FALSE	0	session_id	abc123
.example.com	TRUE	/	TRUE	0	auth_token	xyz789

Raw HTTP Request (request.txt)

POST /api/user/update HTTP/1.1
Host: example.com
Cookie: session_id=abc123
Content-Type: application/x-www-form-urlencoded

email=attacker@evil.com

📊 Output

Scan Results

==================================================
SCAN SUMMARY
==================================================
  Target:            example.com
  Requests Analyzed: 1
  CSRF Candidates:   1

  Confirmed:         0
  Likely:            1
  Informational:     0
  Suppressed:        0
==================================================

FINDINGS:
  🔴 [CSRF-001] CRITICAL: /api/user/update
     Type: form_based, Vector: form_post

Generated Files

  • findings.json - Machine-readable results
  • report.md - Human-readable report

🔍 CSRF Types Detected

Type Description
Form-based (POST) Traditional auto-submitting form
GET-based State-changing GET requests
Login CSRF Force victim to login as attacker

🛡️ What Makes It Different

Feature Sentinel-CSRF Traditional Scanners
False Positive Rate <10% >50%
Browser Awareness ✅ SameSite, CORS ❌ None
Verification ✅ Proves exploitability ❌ Flags missing tokens
PoC Generation ✅ Ready-to-use HTML ❌ Manual

📁 Cache Location

Inputs are cached for quick reuse:

~/.sentinel-csrf/cache/
├── last-request.txt
└── last-cookies.txt

🔗 Links


📄 License

MIT License - Use freely, contribute back!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentinel_csrf-1.0.1.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentinel_csrf-1.0.1-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

Details for the file sentinel_csrf-1.0.1.tar.gz.

File metadata

  • Download URL: sentinel_csrf-1.0.1.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sentinel_csrf-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3ac0d495cd28e0cc73f54c55cb18e3b9a0a84a018028848ba961683d10786595
MD5 50eae598f55729df5de8b62c40fa4418
BLAKE2b-256 e8b87371c89574a0fcdabb8bafb36f1487af0471ff97ff04e4d1f2a56d247d59

See more details on using hashes here.

File details

Details for the file sentinel_csrf-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sentinel_csrf-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sentinel_csrf-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34d9c4afef71d801921d115b9f4401a8838b8dce016f3fa4cbe30e9709f4a7e7
MD5 c701cf1154c944fd8cd41d2e0e515249
BLAKE2b-256 2ae79a29fb2c4b2d2585f70f5aca4532e068cd65fafa36739cd8853604cce8ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page