CVE-2023-42456: sudo-rs Session File Relative Path Traversal vulnerability

sudo-rs Updated 02 Oct 2025

Summary

21/09/2023
Yes i
Low
3.1

CVE-2023-42456: sudo-rs Session File Relative Path Traversal vulnerability. Affects sudo-rs versions < 0.2.1. Fixed in 0.2.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Sudo-rs is a tool that allows users to authenticate themselves for sudo attempts only once in a while, instead of every time. It achieves this by using session files (timestamps) stored in /var/run/sudo-rs/ts. These files are named after the username of the user making the sudo attempt. The vulnerability in sudo-rs allows for the corruption of specific files on the filesystem when usernames containing certain characters are used.

Vulnerability Detail

The vulnerability arises when usernames containing the '.' and '/' characters are used. These characters can be used to construct a username that appears to be a relative path. For example, a user with the username '../../../../bin/cp' can 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, effectively removing the 'cp' binary from the system. This vulnerability requires the ability to login as a user with a constructed username and the ability to create users with such usernames.

How To Fix

Latest published version: 0.2.15 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.2.1

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If you do not have any users with specially crafted usernames and untrusted users cannot create arbitrary users on your system, you should not be vulnerable to this issue. However, you can also run 'sudo -K' or 'sudo -k' commands to clear session records, even if you have no sudo access.

Conclusion

The sudo-rs Session File Relative Path Traversal vulnerability allows for the corruption of files on the filesystem, potentially leading to the removal of important binaries. Upgrading to version 0.2.1 of sudo-rs fixes this vulnerability by using the uid instead of the username for determining the filename. If you are not vulnerable to this issue, you can still use the 'sudo -K' or 'sudo -k' commands to clear session records. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for sudo-rs →

Share this vulnerability

FAQ

Sudo-rs is a tool that allows users to authenticate themselves for sudo attempts only once in a while, instead of every time.

The vulnerability allows for the corruption of specific files on the filesystem, potentially leading to the removal of important binaries.

You can fix this vulnerability by upgrading to version 0.2.1 of sudo-rs, which uses the uid instead of the username for determining the filename.

Yes, you can use the 'sudo -K' or 'sudo -k' commands to clear session records, even if you have no sudo access.

If you do not have any users with specially crafted usernames and untrusted users cannot create arbitrary users on your system, you should not be vulnerable to this issue.

Related vulnerabilities

Recent vulnerabilities recorded for sudo-rs.

How To Fix

Latest published version: 0.2.15 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.2.1

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback