# Welcome

Welcome to the section dedicated to vulnerabilities and Common Vulnerabilities and Exposures ([CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures)) that I have obtained during my research as a penetration tester. Here you will find detailed information on the various vulnerabilities I discovered, including their impact, exploitation steps, and advice on how to apply remediations.

If you have any questions or suggestions, please do not hesitate to contact me via one of the contact information available on [my website](https://nstsec.com).

Thank you for your interest in cybersecurity and happy browsing!


# CVE-2022-44023

PwnDoc <= 0.5.3 - Username Enumeration via different responses

## <mark style="color:yellow;">CVE Detail</mark>

PwnDoc through 0.5.3 might allow remote attackers to identify disabled user account names by leveraging response messages for authentication attempts.

<table><thead><tr><th width="111">Product</th><th width="175">CVE</th><th width="163">Owner</th><th width="175">CVSSv3 Score</th><th>CWE</th></tr></thead><tbody><tr><td><a href="https://github.com/pwndoc/pwndoc/issues/382">pwndoc</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2022-44023">CVE-2022-44023</a></td><td><a href="https://nstsec.com">Lorenzo Anastasi</a></td><td><mark style="background-color:orange;"><strong>5.3 Medium</strong></mark></td><td><a href="https://cwe.mitre.org/data/definitions/307.html">CWE-307</a></td></tr></tbody></table>

## <mark style="color:yellow;">Exploitation Steps</mark>

It is possible to enumerate "disabled account" usernames in PwnDoc (tested on 0.5.3 - 2022-07-19) observing the web server responses to login requests.\
For example, let's suppose these users were registered on PwnDoc and then disabled:

<figure><img src="https://user-images.githubusercontent.com/43656486/197575082-75aa6a5b-a6d1-42d5-812a-d7c187f290d5.png" alt=""><figcaption></figcaption></figure>

Trying to log in with one of these disabled users in fact the application responds with the message "Account disabled".

<figure><img src="https://user-images.githubusercontent.com/43656486/197575370-dc703a4a-1b7c-441f-b7d4-e0daa76f01cd.png" alt=""><figcaption></figcaption></figure>

Client request and server response:<br>

<figure><img src="https://user-images.githubusercontent.com/43656486/197575737-eb306e25-72e4-4038-8d6c-8d68a517a593.png" alt=""><figcaption></figcaption></figure>

Trying to log in with a user who does not exist, the application responds with "Invalid credentials":

<figure><img src="https://user-images.githubusercontent.com/43656486/197577964-54e66c72-ef86-4159-b32a-0e01c6e69470.png" alt=""><figcaption></figcaption></figure>

This server behavior can be exploited to enumerate disabled users on the platform, who may be re-enabled by an admin and used again in the future.

By performing a brute force dictionary attack, a defined list of users can be provided via login POST request to detect all the "Account disabled" server's responses and exclude the "Invalid credentials" ones.

<figure><img src="https://user-images.githubusercontent.com/43656486/197577080-a04374ec-70fc-4ab8-b15c-e8e19b84927e.png" alt=""><figcaption></figcaption></figure>

The standard recommendation to mitigate this vulnerability is to return identical responses for “valid user/wrong password” and “invalid user” login requests.


# CVE-2022-44022

PwnDoc <= 0.5.3 - Username Enumeration via response timings

## <mark style="color:yellow;">CVE Detail</mark>

PwnDoc through 0.5.3 might allow remote attackers to identify valid user account names by leveraging response timings for authentication attempts.

<table><thead><tr><th width="111">Product</th><th width="175">CVE</th><th width="163">Owner</th><th width="175">CVSSv3 Score</th><th>CWE</th></tr></thead><tbody><tr><td><a href="https://github.com/pwndoc/pwndoc/issues/381">pwndoc</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2022-44022">CVE-2022-44022</a></td><td><a href="https://nstsec.com">Lorenzo Anastasi</a></td><td><mark style="background-color:orange;"><strong>5.3 Medium</strong></mark></td><td><a href="https://cwe.mitre.org/data/definitions/307.html">CWE-307</a></td></tr></tbody></table>

## <mark style="color:yellow;">Exploitation Steps</mark>

It is possible to enumerate users registered in PwnDoc (tested on 0.5.3 - 2022-07-19 and previous versions) observing the web server response timing.\
For example, let's suppose these users were registered on PwnDoc:

<figure><img src="https://user-images.githubusercontent.com/43656486/194424548-0684d566-f28b-40b2-ab9c-cb3b11bf0173.jpg" alt=""><figcaption></figcaption></figure>

By performing a brute force dictionary attack, a defined list of users can be provided via login POST request to detect the server's response time.

<figure><img src="https://user-images.githubusercontent.com/43656486/194425746-0642cf93-973c-40ca-900b-a1eac7c9ae6c.png" alt=""><figcaption></figcaption></figure>

All the valid users can be discovered by a potential attacker checking if the response time to the login request is long. For not-existing users we can see a shorter response time.

The attack success depends higly on the stability of the server and the Internet connection between hosts. In any case, in order to apply a remediation, it is advisable to add a timing delay to balance the response timing for each login request.


# CVE-2020-13654

XWiki Platform before 12.8 mishandles escaping in the property displayer.

## <mark style="color:yellow;">CVE Detail</mark>

In XWiki Platform before 12.8, some fileds like "Company" in the user profile editing section are vulnerables to Stored Cross Site Scripting (XSS).

<table><thead><tr><th width="111">Product</th><th width="175">CVE</th><th width="163">Owner</th><th width="175">CVSSv3 Score</th><th>CWE</th></tr></thead><tbody><tr><td><a href="https://github.com/xwiki/xwiki-platform">XWiki</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2020-13654">CVE-2020-13654</a></td><td><a href="https://nstsec.com">Lorenzo Anastasi</a></td><td> <mark style="background-color:red;"><strong>7.5 High</strong></mark> </td><td><a href="https://cwe.mitre.org/data/definitions/116.html">CWE-116</a></td></tr></tbody></table>

## <mark style="color:yellow;">Exploitation Steps</mark>

As I first reported at <https://jira.xwiki.org/browse/XWIKI-17374>, I report below the steps describing the identified vulnerability.

Some fileds like "Company" in the user profile editing section, are vulnerables to Cross Site Scripting XSS.

So, inserting for example "\<script> alert("XSS Cross Site Scripting in this field !!!"); \</script>" in the Company field someone has access to this page can inject malicious code.

An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site.

Following are the steps to reproduce the vulnerability:

1. Login as admin
2. Create a test user
3. Open the user profile page (<https://localhost/bin/view/XWiki/>\<user>)
4. Click edit button near Personal Information
5. Edit Company field and insert for example \<script> alert("Hello World!"); \</script>
6. Save & View and see the XSS in action

<figure><img src="/files/t2fZQg2TTf9jutIe09io" alt=""><figcaption></figcaption></figure>


