Site-wide CSRF on Safari due to CORS misconfiguration (not localhost)
The site's anti-CSRF check only validated the Referer header using a flawed regex that accepted domains with a trailing brace, and Safari would load such a malformed domain. An attacker could host a page on a domain like new.cs.money{.attacker.com and trick a logged-in Safari user into submitting a forged request to change their email address.
- Triaged in 5 days
- Fixed in 49 days
- Paid in 16 days
- Disclosed after 51 days
Description
Hello there, on new.cs.money or cs.money, there is anti-CSRF mechanism, which is Referer header check.
However, I discovered that regex logic for checking Referer header is flawed.
I found that adding { or } at the end of the domain pass the validation.
Therefore, if a request comes from new.cs.money{.attacker.com it would pass validation.
And because there is no other protective mechanisms in place (SameSite flag, Origin check, Content-Type check), thus allowing attacker to perform CSRF attack on victim.
According to this research, https://www.corben.io/advanced-cors-techniques/
Unlike other browsers, Safari will load the domain with weird characters like { or } in it.
You can try this by accessing new.cs.money{.withgoogle.com on Safari and Chrome then see the differences.
Steps To Reproduce
These steps are gonna demonstrate how an attacker can perform CSRF attack forcing user to change_email on this endpoint https://new.cs.money/change_email
1.Open Safari on MacOS, login on new.cs.money (you also need steam account to do this)
2.Open new tab on safari, and navigate to new.cs.money{.withgoogle.com
I want to note that new.cs.money{.withgoogle.com can be hosted on attacker site like, new.cs.money{.attacker.com. However, I'm still on the process of buying new domain, so I'm gonna come back and provide you with another way to exploit this with my domain. But I think that these steps are also enough for PoC
3.Inspect element to bring up javascript console (To enable dev tool, please refer to https://stackoverflow.com/questions/40234993/how-to-inspect-element-using-safari-browser) 4.Go to JS console, paste below code and hit enter
var FormEl = `
<form action="https://new.cs.money/change_email" method="POST">
<input type="hidden" name="email" value="[email protected]" />
<button type="submit" style="font-size:28pt;z-index:99999">Submit</button>
</form>
`;
var Div = document.createElement('div');
Div.innerHTML = FormEl;
document.body.appendChild(Div);
5.Click submit button 6.Go back to https://new.cs.money/th/csgo/personal-info and see that the email is changed
Video Demonstration
Impact
Because new.cs.money and cs.money implement anti-CSRF mechanism the same way, and use it in all endpoints, therefore, it could lead to site-wide CSRF attack on any endpoints. I can't test Cash Out function yet because I can't access it, but I set the severity to high because of this.
I can't access https://hackerone_sellmode.zaebumba.com/ despite the new credentials you updated.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The Referer validation regex was flawed and allowed a trailing brace, so a domain like new.cs.money{.attacker.com passed validation.
Impact
Because the same flawed anti-CSRF mechanism is used on all endpoints of both new.cs.money and cs.money, this could lead to site-wide CSRF attacks on any endpoint, though the attacker could not test the Cash Out function.
What the attacker needed
Victim uses Safari; victim is logged in to new.cs.money; attacker controls a domain with a brace; victim visits attacker's page
The fix
The Referer check was flawed and no SameSite, Origin or Content-Type protections were in place.
How it was found
- Open Safari on macOS and log in to new.cs.money (requires a Steam account).
- Open a new tab and navigate to new.cs.money{.withgoogle.com.
- Open the JavaScript console via Inspect Element.
- Paste the provided HTML form code into the console and press Enter.
- Click the submit button that appears.
- Go to the personal-info page and observe that the email address has changed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
CSRF (Cross-Site Request Forgery) is when a malicious website makes a logged-in user's browser send a request to another site without the user's knowledge. The site tried to block this by checking the Referer header, which tells where a request came from, but its check was too loose. Safari loads domains with unusual characters like braces, so an attacker could use a lookalike domain that passed the check.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.