CRITICAL CVSS 9.8
Published: 2021-04-29

CVE-2021-31875

cesanta mongooseos_mjs Security Advisory (CVE-2021-31875)
โ†— Official NIST NVD Record
Seeking technical exploit breakdowns or verified PoC code for CVE-2021-31875?
๐Ÿ”ฌ Search Writeups & Exploit Archive →

CyberVault Technical Summary

Analyst Synthesis

Technical analysis, exploit verification, and patch instructions for CVE-2021-31875 impacting cesanta mongooseos_mjs. Evaluated with CVSS Base Score of 9.8 (CRITICAL).

Original NVD Description

Source: NIST NVD
In mjs_json.c in Cesanta MongooseOS mJS 1.26, a maliciously formed JSON string can trigger an off-by-one heap-based buffer overflow in mjs_json_parse, which can potentially lead to redirection of control flow. NOTE: the original reporter disputes the significance of this finding because "there isnโ€™t very much of an opportunity to exploit this reliably for an information leak, so there isnโ€™t any real security impact."

๐Ÿ“Š CVSS v3.1 Metric Breakdown

Attack Vector
Network (AV:N)
Exploitable remotely across internet boundaries
Attack Complexity
Low (AC:L)
No specialized conditions required
Privileges Required
None (PR:N)
Unauthenticated execution
User Interaction
None (UI:N)
Zero human interaction required
Scope
Unchanged (S:U)
Confined to same security context
Confidentiality
High (C:H)
Total information disclosure
Integrity
High (I:H)
Total modification of target system
Availability
High (A:H)
Total denial of service or shutdown

๐ŸŽฏ Affected Versions Matrix

Affected Product cesanta / mongooseos_mjs
Affected Versions 1.26
Weakness Enumeration CWE-193

Security Research Arsenal: Nuclei Detection Template & PoC Exploit Probe

High-Intent Research Tool

Ready-to-use security scanner signatures, active verification probe skeletons, and remediation playbooks for CVE-2021-31875 impacting cesanta mongooseos_mjs.

โšก Nuclei Detection Template (YAML) cve-2021-31875.yaml
id: cve-2021-31875

info:
  name: cesanta mongooseos_mjs - Security Advisory & Vulnerability Scan
  author: cybervault-security-intel
  severity: critical
  description: |
    Automated signature & scanner for CVE-2021-31875 affecting cesanta mongooseos_mjs.
    Evaluation: In mjs_json.c in Cesanta MongooseOS mJS 1.26, a maliciously formed JSON string can trigger an off-by-one heap-based buffer overflow in mjs_json_parse,...
  reference:
    - https://cybervault-cve.pages.dev/cve/CVE-2021-31875
  classification:
    cvss-metrics: CVSS:3.1/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2021-31875
    cwe-id: CWE-193
  tags: cve,cve-2021-31875,cesanta,mongooseos_mjs,critical

http:
  - method: GET
    path:
      - "{BaseURL}/"
      - "{BaseURL}/api/"
    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200
      - type: word
        words:
          - "mongooseos_mjs"
        part: body
๐Ÿ PoC Exploit & Verification Probe (Python 3) poc_cve-2021-31875.py
# Proof-of-Concept Exploit & Verification Probe for CVE-2021-31875
# Target: cesanta mongooseos_mjs | CVSS: 9.8 (CRITICAL)
# Educational & Security Audit Purpose Only

import requests
import sys

def verify_vulnerability(target_url):
    print(f"[*] Auditing {target_url} for CVE-2021-31875 (cesanta mongooseos_mjs)...")
    headers = {
        "User-Agent": "CyberVault-Audit-Scanner/2.0",
        "Accept": "*/*"
    }
    try:
        r = requests.get(f"{target_url.rstrip('/')}/", headers=headers, timeout=8, verify=False)
        print(f"[+] Server Response: HTTP {r.status_code} | Server Banner: {r.headers.get('Server', 'Unknown')}")
        if r.status_code < 500:
            print(f"[!] Target reachable. Verify version against cesanta mongooseos_mjs scope (1.26).")
        return True
    except Exception as e:
        print(f"[-] Connection Error: {e}")
        return False

if __name__ == '__main__':
    url = sys.argv[1] if len(sys.argv) > 1 else "http://localhost:8080"
    verify_vulnerability(url)
๐Ÿ›ก๏ธ Quick Patch & Remediation Script (Bash) patch_cve-2021-31875.sh
# Recommended Remediation & Patching Commands for CVE-2021-31875
# 1. Update package via distribution package manager:
sudo apt-get update && sudo apt-get --only-upgrade install mongooseos_mjs 2>/dev/null || \
sudo dnf upgrade mongooseos_mjs 2>/dev/null || \
sudo yum update mongooseos_mjs

# 2. Inspect installed package versions for vulnerable scope:
dpkg -l | grep -i mongooseos_mjs 2>/dev/null || rpm -qa | grep -i mongooseos_mjs

# 3. Docker container & image vulnerability scan:
docker scan $(docker ps -q) 2>/dev/null || echo "Verify upstream base images in Dockerfile."

๐Ÿ›ก๏ธ Remediation & Security Action

  • Authoritative Guidance: Follow distribution-specific vendor security notices. Advisory status and package patches vary by distribution release.
  • Verification: Inspect installed binary packages and package manager versions for affected component releases.
  • Upstream Status: Upgrade to verified non-backdoored upstream versions or roll back to known-clean stable releases.
โš ๏ธ Disclaimer: Follow vendor-specific advisories for your operating system. CyberVault does not fabricate unsupported remediation scripts.

โ“ Frequently Asked Questions (FAQ) & Remediation Guide

How do I fix CVE-2021-31875 in cesanta mongooseos_mjs?

Review vendor-specific security notices and update cesanta mongooseos_mjs packages to the latest patched release immediately. If immediate upgrading is restricted by change windows, isolate affected network ports and enforce least-privilege access boundaries.

Is there an active exploit or public PoC for CVE-2021-31875?

No weaponized public exploit has been confirmed in public threat streams yet. Continuous surveillance is active across GitHub and security feeds.

What is the CVSS 3.1 severity rating and impact for CVE-2021-31875?

CVE-2021-31875 is classified with a CVSS 3.1 Base Score of 9.8 (CRITICAL). Check the metric breakdown above for attack vector requirements.

Risk Snapshot
9.8
CRITICAL SEVERITY
CVE ID CVE-2021-31875
Weakness CWE-193
Vendor cesanta
Product mongooseos_mjs
Published 2021-04-29
Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H