XSS on https://www.udemy.com/asset/export.html
The file title parameter in the asset upload endpoint was not sanitised, allowing an attacker to inject HTML and JavaScript. When the lecture was previewed, the Flash player fetched a JSON endpoint that served content as text/html, causing the injected script to execute in the victim's browser.
Originally disclosed on HackerOne
- Triaged in 6 days
- Fixed in 3 months
- Paid in 4 months
- Disclosed after 5 months
##Description
https://www.udemy.com/asset/export.html is used to generate a content of a lecture and it will be dispalyed on https://www.udemy.com/staticx/udemy/flash/udemypresentation.player.swf?.
https://www.udemy.com/asset/export.html contain json response but the content type is text/html, allowing the browser to render some html tag
Step to Reproduces
- create a new course then go to
curriculum tab, https://www.udemy.com/course-manage/edit-curriculum?courseId=ID_here - on lecture add new content then select presentation, the https://www.udemy.com/upload/ will upload your pdf file.
- after the uploading process the new file will be added to your
Lectureby sending a request in this url
https://www.udemy.com/asset/add-submit/?type=Presentation containing the file and the file title.
the vulnerable parameter is the file title so put your XSS payload on this parameter
Dump Request
POST /asset/add-submit/?type=Presentation HTTP/1.1 Host: www.udemy.com Connection: keep-alive Content-Length: 301 Accept: application/json, text/javascript, */*; q=0.01 X-NewRelic-ID: XAcEWV5ADQIBUlNW Origin: https://www.udemy.com X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 DNT: 1 Referer: https://www.udemy.com/course-manage/edit-curriculum?courseId=497324 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8,et;q=0.6,fil;q=0.4
##(removed cookie)
type=Presentation&title="><svg/onload=javascript:alert(2);>Neglected+DNS+Records+Exploited+To+Takeover+Subdomains+Yassine+ABOUKIR&isSubmitted=1&csrf=dc5d07dd336b1ab185623b1f83fd932e&file=2015-05-14_06-09-55__Neglected_DNS_records_exploited_to_takeover_subdomains___Yassine_ABOUKIR.pdf&displayType=ajax
- now preview the lecture as instructor or student, the flash file (https://www.udemy.com/staticx/udemy/flash/udemypresentation.player.swf) will generate a request on this endpoint -> https://www.udemy.com/asset/export.html which is vulnerable to XSS
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 failed to sanitise user-supplied input (the file title) before reflecting it in an HTML context, and the export endpoint served JSON with a text/html content type, enabling script execution.
Impact
An attacker could run JavaScript in a victim's browser when the victim previews a lecture.
What the attacker needed
Attacker can create a course; victim previews the lecture
How it was found
- Create a new course and go to the curriculum tab.
- Add new content to a lecture and select presentation, then upload a PDF file.
- Submit the file with a malicious file title via the add-submit endpoint.
- Preview the lecture as instructor or student to trigger the Flash player request to the export endpoint.
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.
When you upload a file, the website saves the title you give it. The site later shows that title on a page without cleaning it, so if you put special code in the title, the browser runs it as if it were part of the website. This lets an attacker run their own code in another user's session.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.