GHSA-J79F-JRWM-2F2H

Vulnerability from github – Published: 2026-11-30 20:29 – Updated: 2026-11-30 20:29
VLAI
Summary
NukeViet CMS: Authenticated path traversal to arbitrary file write via S/MIME certificate CN in SMTP settings
Details

Summary

When an authenticated non-super administrator (settings-module admin) adds an S/MIME signing certificate via the smimeadd handler (admin/settings/smtp.php:220-296), the on-disk output filename is derived entirely from the certificate's X.509 Subject CN with only str_replace('@','__') applied. Because an X.509 CN may legally contain / and .., an attacker who crafts a self-signed cert with a traversal CN writes attacker-controlled PEM data to an attacker-chosen path (constrained to .key/.crt/.pem extensions, within already-existing writable directories).

This is a distinct, unpatched sink — the write-side analogue of a previously fixed delete-side path-traversal class — in a file the prior fix never touched.

Root Cause

admin/settings/smtp.php smimeadd handler: - openssl_pkcs12_read + openssl_x509_parse extract the Subject CN (:268). - The ONLY transform is $email_name = str_replace('@','__', trim(CN)) (:269). No basename, realpath, nv_is_file, dirname, strpos, or allowlist regex between the CN and the sinks (grep of :244-296 confirms). - file_put_contents(NV_ROOTDIR.'/data/certs/'.$email_name.'.{key,crt,pem}', <attacker PEM>) at :283/:284/:287. - / and .. in the CN survive openssl_x509_parse verbatim (empirically verified with OpenSSL 3 + PHP): CN=../../config/config → resolved write path /data/certs/../../config/config.crt, escaping data/certs. - Reachability: smtp.php:12 gate is NV_IS_MODADMIN; op=smtp is unconditional in $allow_func (admin/settings/functions.php:16). The settings module is seeded (install/data.php:18) with act_1=1, act_2=1, act_3=0, so it is reachable by default to a level-2 SPADMIN (non-GODADMIN). - The smimesign purpose guard (:256) is satisfied by extendedKeyUsage=emailProtection; checkss is a per-user CSRF token — neither constrains the CN.

Impact

Arbitrary-directory file write (existing writable dirs, .key/.crt/.pem extension, attacker-controlled PEM content) by a non-super administrator. - Unconditional (always-on): overwrite the DKIM signing key data/certs/nv_dkim.<domain>.private.pem (set CN=nv_dkim.<domain>.private + an extracerts chain; the .crt overwrite pre-check does not gate the .pem sink) → mail-signing key compromise/forgery (integrity + availability of mail signing). - Conditional ceiling (curl.cainfo php.ini directive empty — the common default): data/certs/cacert.pem (the shipped 203 KB Mozilla CA bundle) is used as CURLOPT_CAINFO/cafile for outbound HTTPS (includes/functions.php:2200-2202). Set CN=cacert with a rogue chain → overwrite the CA bundle → outbound-TLS verification bypass / MITM.

Privileged-precondition test cleared: a level-2 SPADMIN does NOT already possess a designed arbitrary-file-write/RCE primitive — every designed executable-write surface is either in an act_2=0 module or behind an additional NV_IS_GODADMIN op-gate (PHP extensions are hard-force-forbidden even for GODADMIN). This handler therefore grants a NEW capability → a genuine security boundary is crossed.

Proof of Concept

# 1. Craft cert with traversal CN + S/MIME EKU, export legacy-compatible PKCS#12
openssl req -x509 -newkey rsa:2048 -keyout k.pem -out c.pem -days 1 -nodes \
  -config cnf   # cnf: CN=../../config/config, extendedKeyUsage=emailProtection
openssl pkcs12 -export -in c.pem -inkey k.pem -passout pass:x -out p.p12 \
  -certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -macalg sha1

# 2. POST p.p12 to admin/index.php?nv=settings&op=smtp with smimeadd=1, passphrase, valid checkss
#    Observed: CN=cacert -> data/certs/cacert.crt; CN=../../config/config -> config/config.crt;
#              CN=../../install/pwn -> install/pwn.crt  (all SUCCESS; escaped data/certs)

Attack Chain

  1. Entry: authenticated non-GODADMIN admin with the settings module POSTs a crafted .p12 to admin/index.php?nv=settings&op=smtp with smimeadd=1, passphrase, valid checkss. Guard: NV_IS_MODADMIN (smtp.php:12) + op=smtp in $allow_func + checkss CSRF token + upload ext in {pfx,p12}. Bypass proof: all are auth/CSRF/wrapper guards; none constrain the CN; actor legitimately holds the settings module.
  2. Process: openssl_pkcs12_read → openssl_x509_parse → CN read at :268; purpose guard $purpose[0]=='1' and $purpose[2]=='smimesign' at :256. Bypass proof: extendedKeyUsage=emailProtection → purposes reports smimesign enabled (verified empirically).
  3. Sink: $email_name = str_replace('@','__', trim(CN)); file_put_contents(NV_ROOTDIR.'/data/certs/'.$email_name.'.{key,crt,pem}', <attacker PEM>) (:269-287). Guard: none between CN and sink (only @→__). Bypass proof: grep shows str_replace is the sole transform; ..,/,. pass through (empirically CN=../../config/config → /data/certs/../../config/config.crt).
  4. Impact: arbitrary-directory file write (existing dirs, .crt/.key/.pem, attacker PEM content). Unconditional: corrupt DKIM signing key / cert assets (I:H, A:L). Conditional (curl.cainfo empty): overwrite cacert.pem → outbound-TLS MITM (adds C:L).

Bypass Evidence

  • grep of smtp.php :244-296 for basename|realpath|preg_match|nv_is_file|nv_check|in_array|dirname|strpos|escape → only match is str_replace('@','__') at :269.
  • Empirically verified (OpenSSL 3 + PHP): CN=../../config/config survives openssl_x509_parse verbatim; resolved write lands at config/config.crt (outside data/certs); purposes_enabled includes smimesign.
  • Version: git log 4.6.00..HEAD -- admin/settings/smtp.php empty (identical on latest tag and HEAD); pattern present since 4.5.00. The prior path-traversal fix (commit 27ba63c32) touches only modules/comment/admin/edit.php + install/tpl/step1.tpl — NOT smtp.php.

Affected Versions

>= 4.5.00, <= 4.6.00 (S/MIME cert feature introduced in commit d1f74a5be, first shipped in 4.5.00; code byte-identical through latest tag 4.6.00 and HEAD).

Suggested Fix

Apply basename() to the CN-derived name, or validate it with nv_is_file / a strict ^[A-Za-z0-9._@-]+$ allowlist before building the .key/.crt/.pem paths — the same nv_is_file containment the prior fix added to the comment module.


Reported by zx (Jace) — GitHub: @manus-use

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 4.6.00"
      },
      "package": {
        "ecosystem": "Packagist",
        "name": "nukeviet/nukeviet"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.5.00"
            },
            {
              "fixed": "4.6.01"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-94563"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22",
      "CWE-73"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-30T20:29:56Z",
    "nvd_published_at": "2026-11-20T19:18:56Z",
    "severity": "MODERATE"
  },
  "details": "## Summary\nWhen an authenticated non-super administrator (settings-module admin) adds an S/MIME signing certificate via the `smimeadd` handler (`admin/settings/smtp.php:220-296`), the on-disk output filename is derived **entirely from the certificate\u0027s X.509 Subject CN** with only `str_replace(\u0027@\u0027,\u0027__\u0027)` applied. Because an X.509 CN may legally contain `/` and `..`, an attacker who crafts a self-signed cert with a traversal CN writes attacker-controlled PEM data to an attacker-chosen path (constrained to `.key`/`.crt`/`.pem` extensions, within already-existing writable directories).\n\nThis is a distinct, unpatched sink \u2014 the write-side analogue of a previously fixed delete-side path-traversal class \u2014 in a file the prior fix never touched.\n\n## Root Cause\n`admin/settings/smtp.php` `smimeadd` handler:\n- `openssl_pkcs12_read` + `openssl_x509_parse` extract the Subject CN (:268).\n- The ONLY transform is `$email_name = str_replace(\u0027@\u0027,\u0027__\u0027, trim(CN))` (:269). No `basename`, `realpath`, `nv_is_file`, `dirname`, `strpos`, or allowlist regex between the CN and the sinks (grep of :244-296 confirms).\n- `file_put_contents(NV_ROOTDIR.\u0027/data/certs/\u0027.$email_name.\u0027.{key,crt,pem}\u0027, \u003cattacker PEM\u003e)` at :283/:284/:287.\n- `/` and `..` in the CN survive `openssl_x509_parse` verbatim (empirically verified with OpenSSL 3 + PHP): `CN=../../config/config` \u2192 resolved write path `/data/certs/../../config/config.crt`, escaping `data/certs`.\n- Reachability: `smtp.php:12` gate is `NV_IS_MODADMIN`; `op=smtp` is unconditional in `$allow_func` (`admin/settings/functions.php:16`). The `settings` module is seeded (`install/data.php:18`) with `act_1=1, act_2=1, act_3=0`, so it is reachable by default to a level-2 SPADMIN (non-GODADMIN).\n- The `smimesign` purpose guard (:256) is satisfied by `extendedKeyUsage=emailProtection`; `checkss` is a per-user CSRF token \u2014 neither constrains the CN.\n\n## Impact\nArbitrary-directory file write (existing writable dirs, `.key`/`.crt`/`.pem` extension, attacker-controlled PEM content) by a non-super administrator.\n- **Unconditional (always-on):** overwrite the DKIM signing key `data/certs/nv_dkim.\u003cdomain\u003e.private.pem` (set `CN=nv_dkim.\u003cdomain\u003e.private` + an `extracerts` chain; the `.crt` overwrite pre-check does not gate the `.pem` sink) \u2192 mail-signing key compromise/forgery (integrity + availability of mail signing).\n- **Conditional ceiling (`curl.cainfo` php.ini directive empty \u2014 the common default):** `data/certs/cacert.pem` (the shipped 203 KB Mozilla CA bundle) is used as `CURLOPT_CAINFO`/`cafile` for outbound HTTPS (`includes/functions.php:2200-2202`). Set `CN=cacert` with a rogue chain \u2192 overwrite the CA bundle \u2192 outbound-TLS verification bypass / MITM.\n\n**Privileged-precondition test cleared:** a level-2 SPADMIN does NOT already possess a designed arbitrary-file-write/RCE primitive \u2014 every designed executable-write surface is either in an `act_2=0` module or behind an additional `NV_IS_GODADMIN` op-gate (PHP extensions are hard-force-forbidden even for GODADMIN). This handler therefore grants a NEW capability \u2192 a genuine security boundary is crossed.\n\n## Proof of Concept\n```\n# 1. Craft cert with traversal CN + S/MIME EKU, export legacy-compatible PKCS#12\nopenssl req -x509 -newkey rsa:2048 -keyout k.pem -out c.pem -days 1 -nodes \\\n  -config cnf   # cnf: CN=../../config/config, extendedKeyUsage=emailProtection\nopenssl pkcs12 -export -in c.pem -inkey k.pem -passout pass:x -out p.p12 \\\n  -certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -macalg sha1\n\n# 2. POST p.p12 to admin/index.php?nv=settings\u0026op=smtp with smimeadd=1, passphrase, valid checkss\n#    Observed: CN=cacert -\u003e data/certs/cacert.crt; CN=../../config/config -\u003e config/config.crt;\n#              CN=../../install/pwn -\u003e install/pwn.crt  (all SUCCESS; escaped data/certs)\n```\n\n## Attack Chain\n1. **Entry:** authenticated non-GODADMIN admin with the `settings` module POSTs a crafted `.p12` to `admin/index.php?nv=settings\u0026op=smtp` with `smimeadd=1`, passphrase, valid `checkss`. **Guard:** `NV_IS_MODADMIN` (smtp.php:12) + `op=smtp` in `$allow_func` + `checkss` CSRF token + upload ext in `{pfx,p12}`. **Bypass proof:** all are auth/CSRF/wrapper guards; none constrain the CN; actor legitimately holds the settings module.\n2. **Process:** `openssl_pkcs12_read` \u2192 `openssl_x509_parse` \u2192 CN read at :268; purpose guard `$purpose[0]==\u00271\u0027 and $purpose[2]==\u0027smimesign\u0027` at :256. **Bypass proof:** `extendedKeyUsage=emailProtection` \u2192 `purposes` reports `smimesign` enabled (verified empirically).\n3. **Sink:** `$email_name = str_replace(\u0027@\u0027,\u0027__\u0027, trim(CN))`; `file_put_contents(NV_ROOTDIR.\u0027/data/certs/\u0027.$email_name.\u0027.{key,crt,pem}\u0027, \u003cattacker PEM\u003e)` (:269-287). **Guard:** none between CN and sink (only `@`\u2192`__`). **Bypass proof:** grep shows `str_replace` is the sole transform; `..`,`/`,`.` pass through (empirically `CN=../../config/config` \u2192 `/data/certs/../../config/config.crt`).\n4. **Impact:** arbitrary-directory file write (existing dirs, `.crt/.key/.pem`, attacker PEM content). Unconditional: corrupt DKIM signing key / cert assets (I:H, A:L). Conditional (`curl.cainfo` empty): overwrite `cacert.pem` \u2192 outbound-TLS MITM (adds C:L).\n\n## Bypass Evidence\n- grep of smtp.php :244-296 for `basename|realpath|preg_match|nv_is_file|nv_check|in_array|dirname|strpos|escape` \u2192 only match is `str_replace(\u0027@\u0027,\u0027__\u0027)` at :269.\n- Empirically verified (OpenSSL 3 + PHP): `CN=../../config/config` survives `openssl_x509_parse` verbatim; resolved write lands at `config/config.crt` (outside `data/certs`); `purposes_enabled` includes `smimesign`.\n- Version: `git log 4.6.00..HEAD -- admin/settings/smtp.php` empty (identical on latest tag and HEAD); pattern present since 4.5.00. The prior path-traversal fix (commit `27ba63c32`) touches only `modules/comment/admin/edit.php` + `install/tpl/step1.tpl` \u2014 NOT smtp.php.\n\n## Affected Versions\n`\u003e= 4.5.00, \u003c= 4.6.00` (S/MIME cert feature introduced in commit `d1f74a5be`, first shipped in 4.5.00; code byte-identical through latest tag 4.6.00 and HEAD).\n\n## Suggested Fix\nApply `basename()` to the CN-derived name, or validate it with `nv_is_file` / a strict `^[A-Za-z0-9._@-]+$` allowlist before building the `.key/.crt/.pem` paths \u2014 the same `nv_is_file` containment the prior fix added to the comment module.\n\n---\nReported by **zx (Jace)** \u2014 GitHub: @manus-use",
  "id": "GHSA-j79f-jrwm-2f2h",
  "modified": "2026-11-30T20:29:56Z",
  "published": "2026-11-30T20:29:56Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nukeviet/nukeviet/security/advisories/GHSA-j79f-jrwm-2f2h"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-94563"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nukeviet/nukeviet/commit/8f7b3698f1c08b6cdedb500a0d2d2f528d4f0c87"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nukeviet/nukeviet"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nukeviet/nukeviet/releases/tag/4.6.01"
    },
    {
      "type": "WEB",
      "url": "https://nukeviet.vn/vi/news/Tin-tuc/thong-bao-phat-hanh-nukeviet-4-6-01-857.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "NukeViet CMS: Authenticated path traversal to arbitrary file write via S/MIME certificate CN in SMTP settings"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.