CSRF to ATO at https://█████/user/account [HtUS]
The account settings endpoint accepted JSON data but also processed the same fields when sent as a simple form-encoded request, so it lacked CSRF protection. An attacker could host a page that silently submits a form and change a logged-in victim's email address, leading to account takeover.
- Triaged in 22 hours
- Fixed in 43 days
- Paid in 27 hours
- Disclosed after 6 months
hello dod security team today while i was doing pentest on your scope i came across https://████████/user/account so i register and after that tried to edit my data and the data was in json request so i simple change content-type to content-type application/x-www-form-urlencoded and the data was change and in the next step i create html file to edit users data with 0 click which allow me to change victim email and leads to account takeover check my html poc file and video
Impact
account takeover
What the report shows
The target is a U.S. Department of Defence web application, and the feature in scope is the account settings page at:
https://████████/user/account
The researcher registered an account and edited their own profile data. The edit was submitted as a JSON request. By changing the request's content type to a form encoding, the same data was still accepted:
content-type application/x-www-form-urlencoded
That change matters because a form encoding is one of the content types a browser can produce from a cross-site HTML form, while a JSON body cannot be sent cross-origin without a CORS preflight. With the endpoint accepting the form encoding, the researcher built an HTML file that submits the profile edit on behalf of a logged-in victim with no interaction beyond loading the page, described as "0 click". The edit changes the victim's email address, and the researcher states this leads to account takeover. The report includes an HTML proof of concept and a video demonstrating it.
The impact section states the outcome plainly: account takeover. The report records a high severity rating with a CVSS score of 8.1, a bounty of 500.00 USD, and disclosure on 2023-01-06. The report does not describe the fix that was applied.
Root cause
The report shows the profile update endpoint accepted application/x-www-form-urlencoded bodies in addition to JSON, which allowed a cross-site form to submit the edit. Accepting a form encoding removes the practical barrier that JSON-only endpoints have against cross-site form submission, because a simple HTML form can only send form encodings, not application/json. With the form encoding accepted, a page on another site can make the victim's browser submit the state-changing request with the victim's session cookies attached.
Impact
Because the endpoint changes the account's email address, an attacker who can forge the request can point the victim's account at an address the attacker controls. The report states that changing the victim's email address leads to account takeover. The researcher describes the attack as requiring 0 clicks from the victim. The report does not describe any additional preconditions, such as whether the current password is required for the email change.
How this kind of bug works
CSRF abuses the fact that browsers attach a site's cookies to requests regardless of which page caused them. A malicious page can contain a form whose action points at the target and whose fields match the target's parameters; when the victim visits the page, the browser submits the form with the victim's session cookie. The attacker cannot read the response, but for a state-changing action reading the response is unnecessary.
Two things make an endpoint vulnerable. First, it performs a meaningful change based only on the session cookie. Second, it accepts a request shape that a cross-origin page can produce without a CORS preflight: form encodings, multipart/form-data, or plain text. JSON bodies are not in that set, which is why JSON-only APIs are often accidentally protected, and why relaxing the accepted content type reopens the hole. Defences are a per-session or per-request anti-CSRF token validated server-side, SameSite cookie attributes that keep the session cookie off cross-site requests, and checking the Origin or Referer header against the expected site.
How to test for it
- Map every state-changing request the application makes: profile edits, email and password changes, MFA enrolment, API key creation, role changes, and anything else that alters account state.
- For each one, note the content type and whether the body carries a token that is unpredictable and tied to the session.
- Try re-sending the same request with the body converted to a form encoding, keeping all parameters and values. If the server still processes it, the request is a candidate.
- Build a local HTML page with a form that posts the same fields to the endpoint, open it in a browser where you are logged in to the target, and submit it. A positive result is that the change is applied without any token being supplied.
- Confirm the security consequence: if the changed field is the email address, check whether the password reset flow then delivers to the new address.
Common false positives: the endpoint returns a success status but silently ignores the change; the action requires the current password, which the attacker does not know; the session cookie is SameSite=Strict or Lax in a way that blocks the cross-site submission; or the server validates Origin and rejects the forged request. Verify the change actually persisted by reloading the account page, not just by reading the response.
How it is fixed
Require a server-validated anti-CSRF token on every state-changing request, and reject requests whose token is missing or does not match the session. Set session cookies with SameSite=Lax or Strict where the application's flows allow it. Validate the Origin header, falling back to Referer, against the expected site for state-changing requests. For sensitive changes such as email or password updates, require the current password or a fresh re-authentication. Restricting the endpoint to JSON alone is not a substitute for these controls, since it is a side effect of browser behaviour rather than a deliberate defence.
Hunting notes
CSRF hides in endpoints that were originally JSON APIs and later gained form support, in older parts of an application that predate token frameworks, and in flows that are easy to overlook: email change, MFA device removal, connected accounts, and notification settings. Recon signals include endpoints that accept multiple content types, frameworks with CSRF protection disabled globally, and session cookies without SameSite attributes.
What happened, in plain words
A security researcher was testing a U.S. Department of Defence web application. They found an account settings page at:
https://████████/user/account
They registered an account and edited their own profile data. The edit was sent as a JSON request. JSON is a common format for sending data between a browser and a server, like a structured note. The researcher then changed the request's content type to a form encoding:
content-type application/x-www-form-urlencoded
The content type tells the server what format the body is in. application/x-www-form-urlencoded is the format a normal HTML form produces when you click submit. The server accepted the same data in this new format.
That change matters because a browser can send a form encoding from any website, but it cannot send a JSON body to another site without extra checks (called a CORS preflight). The researcher then built an HTML page that submitted the edit from another site.
The researcher then created an HTML file that submits the profile edit on behalf of a logged-in victim. The victim only has to load the page; no clicks are needed. The report includes an HTML proof of concept and a video showing it.
The impact section states the outcome plainly: account takeover. The report records a high severity rating with a CVSS score of 8.1, a bounty of 500.00 USD, and disclosure on 2023-01-06. The report does not describe the fix that was applied.
In general, how this kind of bug works
This is a Cross-Site Request Forgery (CSRF) attack. It abuses the fact that browsers attach a site's cookies to requests regardless of which page caused them. A cookie is a small piece of data a site stores in your browser, often to keep you logged in. When you visit a malicious page, that page can contain a form whose action points at the target site and whose fields match the target's parameters. When the victim visits the page, the browser submits the form with the victim's session cookie. The attacker cannot read the response, but for a state-changing action reading the response is unnecessary.
Two things make an endpoint vulnerable. First, it performs a meaningful change based only on the session cookie. Second, it accepts a request shape that a cross-origin page can produce without a CORS preflight: form encodings, multipart/form-data, or plain text. JSON bodies are not in that set, which is why JSON-only APIs are often accidentally protected, and why relaxing the accepted content type reopens the hole. Defences are a per-session or per-request anti-CSRF token validated server-side, SameSite cookie attributes that keep the session cookie off cross-site requests, and checking the Origin or Referer header against the expected site.
How to test for it
- Map every state-changing request the application makes: profile edits, email and password changes, MFA enrolment, API key creation, role changes, and anything else that alters account state.
- For each one, note the content type and whether the body carries a token that is unpredictable and tied to the session.
- Try re-sending the same request with the body converted to a form encoding, keeping all parameters and values. If the server still processes it, the request is a candidate.
- Build a local HTML page with a form that posts the same fields to the endpoint, open it in a browser where you are logged in to the target, and submit it. A positive result is that the change is applied without any token being supplied.
- Confirm the security consequence: if the changed field is the email address, check whether the password reset flow then delivers to the new address.
Common false positives: the endpoint returns a success status but silently ignores the change; the action requires the current password, which the attacker does not know; the session cookie is SameSite=Strict or Lax in a way that blocks the cross-site submission; or the server validates Origin and rejects the forged request. Verify the change actually persisted by reloading the account page, not just by reading the response.
How it is fixed
Require a server-validated anti-CSRF token on every state-changing request, and reject requests whose token is missing or does not match the session. Set session cookies with SameSite=Lax or Strict where the application's flows allow it. Validate the Origin header, falling back to Referer, against the expected site for state-changing requests. For sensitive changes such as email or password updates, require the current password or a fresh re-authentication. Restricting the endpoint to JSON alone is not a substitute for these controls, since it is a side effect of browser behaviour rather than a deliberate defence.
Hunting notes
CSRF hides in endpoints that were originally JSON APIs and later gained form support, in older parts of an application that predate token frameworks, and in flows that are easy to overlook: email change, MFA device removal, connected accounts, and notification settings. Recon signals include endpoints that accept multiple content types, frameworks with CSRF protection disabled globally, and session cookies without SameSite attributes.
Glossary
- CSRF (Cross-Site Request Forgery): an attack where a malicious site makes a logged-in user's browser send a request to another site without the user's knowledge.
- Account takeover (ATO): when an attacker gains control of another person's account.
- JSON: a text format for structured data, often used to send information between a browser and a server.
- Content type: a header that tells the server what format the request body is in.
application/x-www-form-urlencoded: the format a standard HTML form uses to send data.- CORS preflight: an extra check a browser performs before sending certain cross-origin requests, such as those with a JSON body.
- Cookie: a small piece of data stored by the browser that a site can use to remember you, for example to keep you logged in.
- Session cookie: a cookie that identifies your logged-in session.
- Token (anti-CSRF token): a secret value included in requests to prove they come from the legitimate site, not a forged page.
SameSite: a cookie attribute that controls whether the cookie is sent with cross-site requests.Originheader: a request header that indicates which site the request came from.Refererheader: a request header that indicates the page from which the request was made.- MFA: multi-factor authentication, an extra login step beyond a password.
- Proof of concept (PoC): a demonstration that the vulnerability can be exploited.
- CVSS: a standard scoring system for the severity of security vulnerabilities.