Sploitus

Exploit for Off-by-one Error in Sudo Project Sudo

gitee Β· 2021-04-14

Exploit Code

MARKDOWN17 lines
## https://sploitus.com/exploit?id=11486F72-2D9A-5EBB-9746-53177E059541
This is a Python-based exploit for the CVE-2021-3156 vulnerability in sudo. The exploit targets Linux systems with glibc and nscd service not running. It overwrites the struct service_user to gain root privileges.

The exploit has several variants, including:

1. **exploit_nss.py**: This is the main exploit script that overwrites the struct service_user. It requires glibc with tcache and nscd service not running.
2. **exploit_nss_manual.py**: This is a simplified version of the main exploit script, without checking code and embedded library.
3. **exploit_nss_d9.py**: This exploit targets Ubuntu 14.04 and overwrites the struct service_user.
4. **exploit_nss_u14.py**: This exploit targets Ubuntu 14.04 and overwrites the struct service_user.
5. **exploit_nss_u16.py**: This exploit targets Ubuntu 16.04 and overwrites the struct service_user.

The exploit works by:

1. Overwriting the struct service_user with a fake service_user object.
2. NULLing the next and service pointers in the name_database_entry struct.
3. Overwriting the name pointer in the name_database_entry struct with a valid address.
4. Overwriting