8.1
HIGH
CVE-2023-42456
Sudo-rs Path Traversal Vulnerability
Description

Sudo-rs, a memory safe implementation of sudo and su, allows users to not have to enter authentication at every sudo attempt, but instead only requiring authentication every once in a while in every terminal or process group. Only once a configurable timeout has passed will the user have to re-authenticate themselves. Supporting this functionality is a set of session files (timestamps) for each user, stored in `/var/run/sudo-rs/ts`. These files are named according to the username from which the sudo attempt is made (the origin user). An issue was discovered in versions prior to 0.2.1 where usernames containing the `.` and `/` characters could result in the corruption of specific files on the filesystem. As usernames are generally not limited by the characters they can contain, a username appearing to be a relative path can be constructed. For example we could add a user to the system containing the username `../../../../bin/cp`. When logged in as a user with that name, that user could run `sudo -K` to clear their session record file. The session code then constructs the path to the session file by concatenating the username to the session file storage directory, resulting in a resolved path of `/bin/cp`. The code then clears that file, resulting in the `cp` binary effectively being removed from the system. An attacker needs to be able to login as a user with a constructed username. Given that such a username is unlikely to exist on an existing system, they will also need to be able to create the users with the constructed usernames. The issue is patched in version 0.2.1 of sudo-rs. Sudo-rs now uses the uid for the user instead of their username for determining the filename. Note that an upgrade to this version will result in existing session files being ignored and users will be forced to re-authenticate. It also fully eliminates any possibility of path traversal, given that uids are always integer values. The `sudo -K` and `sudo -k` commands can run, even if a user has no sudo access. As a workaround, make sure that one's system does not contain any users with a specially crafted username. While this is the case and while untrusted users do not have the ability to create arbitrary users on the system, one should not be able to exploit this issue.

INFO

Published Date :

Sept. 21, 2023, 4:15 p.m.

Last Modified :

Nov. 4, 2023, 3:15 a.m.

Remotely Exploitable :

Yes !

Impact Score :

5.2

Exploitability Score :

2.8
Affected Products

The following products are affected by CVE-2023-42456 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Memorysafety sudo
References to Advisories, Solutions, and Tools

Here, you will find a curated list of external links that provide in-depth information, practical solutions, and valuable tools related to CVE-2023-42456.

URL Resource
http://www.openwall.com/lists/oss-security/2023/11/02/1
https://ferrous-systems.com/blog/sudo-rs-audit/
https://github.com/memorysafety/sudo-rs/commit/bfdbda22968e3de43fa8246cab1681cfd5d5493d Patch
https://github.com/memorysafety/sudo-rs/security/advisories/GHSA-2r3c-m6v7-9354 Vendor Advisory

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2023-42456 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2023-42456 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • CVE Modified by [email protected]

    May. 14, 2024

    Action Type Old Value New Value
  • CVE Modified by [email protected]

    Nov. 04, 2023

    Action Type Old Value New Value
    Added Reference https://ferrous-systems.com/blog/sudo-rs-audit/ [No Types Assigned]
  • CVE Modified by [email protected]

    Nov. 02, 2023

    Action Type Old Value New Value
    Added Reference http://www.openwall.com/lists/oss-security/2023/11/02/1 [No Types Assigned]
  • Initial Analysis by [email protected]

    Sep. 26, 2023

    Action Type Old Value New Value
    Added CVSS V3.1 NIST AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
    Changed Reference Type https://github.com/memorysafety/sudo-rs/commit/bfdbda22968e3de43fa8246cab1681cfd5d5493d No Types Assigned https://github.com/memorysafety/sudo-rs/commit/bfdbda22968e3de43fa8246cab1681cfd5d5493d Patch
    Changed Reference Type https://github.com/memorysafety/sudo-rs/security/advisories/GHSA-2r3c-m6v7-9354 No Types Assigned https://github.com/memorysafety/sudo-rs/security/advisories/GHSA-2r3c-m6v7-9354 Vendor Advisory
    Added CWE NIST CWE-22
    Added CPE Configuration OR *cpe:2.3:a:memorysafety:sudo:*:*:*:*:*:rust:*:* versions up to (excluding) 0.2.1
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2023-42456 is associated with the following CWEs:

Exploit Prediction

EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.

0.12 }} 0.04%

score

0.46197

percentile

CVSS31 - Vulnerability Scoring System
Attack Vector
Attack Complexity
Privileges Required
User Interaction
Scope
Confidentiality
Integrity
Availability