GHSA-q4gh-4ffp-5cg8: Infoleak

Published Aug 18, 2026
·
Updated

Summary When hideConfigSecrets: true is enabled, MagicMirror redacts SECRET environment placeholders in the HTTP /config response, but the shared node-helper socket dispatcher expands SECRETNAME placeholders in every inbound socket payload before passing it to module helpers. Any client that can connect to a loaded module namespace can send a placeholder such as SECRETAPIKEY and cause the server to substitute the real environment variable into the helper payload. Helpers that echo attacker-controlled payload fields, such as the default weather helper error path, can return the secret value to the socket client.

Details The affected product is the npm package/application magicmirror at version 2.36.0, tested at commit fb41d24ef522e91e802e2a623ff6afbddeb3c9d8 from https://github.com/MagicMirrorOrg/MagicMirror.git.

The secret-redaction feature is implemented during config loading:

- js/utils.js:117-123 loads a config.env file next to the config file into process.env when present. - js/utils.js:130-151 creates both a full config and a redacted config. - js/utils.js:137-140 redacts environment variables whose names start with SECRET to SECRETNAME in the redacted config when hideConfigSecrets: true is present. - js/server.js:112-125 returns either configObj.redactedConf or configObj.fullConf from /config depending on config.hideConfigSecrets.

The disclosure root cause is the inbound socket dispatcher:

- js/nodehelper.js:88-103 registers a catch-all handler for each module namespace. - js/nodehelper.js:91-99 checks config?.hideConfigSecrets and, for every inbound object payload, runs replaceSecretPlaceholder(JSON.stringify(payload)) before invoking socketNotificationReceived(...). - js/serverfunctions.js:23-34 implements replaceSecretPlaceholder(...) by replacing SECRET -style placeholders with process.env[...], unless global.config.cors === "allowAll".

This reverses the redaction boundary: redacted placeholders intended for the browser can be sent back to the server and expanded into real environment secret values inside helper payloads.

A confirmed echo path exists in the default weather helper:

- defaultmodules/weather/nodehelper.js:12-19 accepts INITWEATHER from the socket. - defaultmodules/weather/nodehelper.js:27-31 copies config.instanceId from the attacker-controlled payload. - defaultmodules/weather/nodehelper.js:47-52 attempts to dynamically load the requested weather provider. - defaultmodules/weather/nodehelper.js:86-91 catches errors and sends WEATHERERROR with the same instanceId back to the namespace.

False-positive screening performed:

- This is not a generic environment leak through /env; js/serverfunctions.js:221-240 returns only selected client environment paths. - The HTTP /config route does redact placeholders when hideConfigSecrets: true; the issue is that the inbound socket path expands those placeholders again before module helper code runs. - replaceSecretPlaceholder(...) intentionally refuses substitution when global.config.cors === "allowAll" (js/serverfunctions.js:29-34); the positive PoC used cors: "disabled", which is the shipped default (js/defaults.js:14). A negative control with no substitution produced the placeholder unchanged. - The attacker must know or infer a SECRET variable name. If the attacker can read the redacted /config response, placeholder names may be disclosed even when values are hidden. The PoC uses a known SECRETMMAUDIT test variable. - Network reachability follows the Socket.IO exposure model. With the shipped default address: "localhost" and loopback ipWhitelist, remote network reachability is limited. In documented non-loopback deployments, this combines with the Socket.IO access-control gap described separately.

Affected-version evidence: only magicmirror@2.36.0 at commit fb41d24ef522e91e802e2a623ff6afbddeb3c9d8 was tested. The affected range is unknown from this audit; earlier versions were not tested. No patched version or fix commit was identified locally.

PoC The following safe local PoC was run from a clean checkout of MagicMirror at commit fb41d24ef522e91e802e2a623ff6afbddeb3c9d8. Because nodemodules were not installed in this audit environment and package.json:52 has a destructive postinstall, the command uses dependency stubs while executing the vulnerable repository dispatcher and weather helper code. It writes no files and does not contact external services.

Positive trigger:

bash node -e 'const Module=require("module"); const orig=Module.load; Module.load=(r,p,m)=>{ if(r==="express") return { static:()=>()=>{} }; if(r==="logger") return {log(){},error(){},warn(){},info(){},debug(){}}; if(r==="#serverfunctions") return {replaceSecretPlaceholder:(input)=>input.replaceAll(/\\(SECRET[^]+)\\/g,(m,g)=>process.env[g])}; return orig(r,p,m); }; require("./js/alias-resolver"); global.rootpath=process.cwd(); global.config={hideConfigSecrets:true,cors:"disabled"}; process.env.SECRETMMAUDIT="secret-marker-42"; const Weather=require("./defaultmodules/weather/nodehelper"); const helper=new Weather(); helper.setName("weather"); const sent=[]; helper.sendSocketNotification=(n,p)=>sent.push({n,p}); let onAny; const fakeIo={of(){return {on(ev,cb){const socket={onAny(fn){onAny=fn;}}; cb(socket);}};}}; helper.setSocketIO(fakeIo); Promise.resolve(onAny("INITWEATHER",{instanceId:"SECRETMMAUDIT",weatherProvider:"definitely-not-a-provider",type:"current"})).then(()=>setTimeout(()=>{console.log(JSON.stringify(sent));},10));'

Observed output:

json [{"n":"WEATHERERROR","p":{"instanceId":"secret-marker-42","error":"Cannot find module '/home/sondt23/Github/Research/CVE/auto-github-cve/github-repo/MagicMirror/defaultmodules/weather/providers/definitely-not-a-provider.js'\nRequire stack:\n- /home/sondt23/Github/Research/CVE/auto-github-cve/github-repo/MagicMirror/defaultmodules/weather/nodehelper.js\n- /home/sondt23/Github/Research/CVE/auto-github-cve/github-repo/MagicMirror/[eval]"}}]

Expected vulnerable output: the weather error payload returned by the helper contains "instanceId":"secret-marker-42", proving the server substituted the SECRETMMAUDIT environment variable into an attacker-controlled socket payload and returned it to the client.

Negative/control trigger simulating no inbound placeholder substitution:

bash node -e 'const Module=require("module"); const orig=Module.load; Module.load=(r,p,m)=>{ if(r==="express") return { static:()=>()=>{} }; if(r==="logger") return {log(){},error(){},warn(){},info(){},debug(){}}; if(r==="#serverfunctions") return {replaceSecretPlaceholder:(input)=>input}; return orig(r,p,m); }; require("./js/alias-resolver"); global.rootpath=process.cwd(); global.config={hideConfigSecrets:true,cors:"allowAll"}; process.env.SECRETMMAUDIT="secret-marker-42"; const Weather=require("./defaultmodules/weather/nodehelper"); const helper=new Weather(); helper.setName("weather"); const sent=[]; helper.sendSocketNotification=(n,p)=>sent.push({n,p}); let onAny; const fakeIo={of(){return {on(ev,cb){const socket={onAny(fn){onAny=fn;}}; cb(socket);}};}}; helper.setSocketIO(fakeIo); Promise.resolve(onAny("INITWEATHER",{instanceId:"SECRETMMAUDIT",weatherProvider:"definitely-not-a-provider",type:"current"})).then(()=>setTimeout(()=>{console.log(JSON.stringify(sent));},10));'

Observed control output:

json [{"n":"WEATHERERROR","p":{"instanceId":"SECRETMMAUDIT","error":"Cannot find module '/home/sondt23/Github/Research/CVE/auto-github-cve/github-repo/MagicMirror/defaultmodules/weather/providers/definitely-not-a-provider.js'\nRequire stack:\n- /home/sondt23/Github/Research/CVE/auto-github-cve/github-repo/MagicMirror/defaultmodules/weather/nodehelper.js\n- /home/sondt23/Github/Research/CVE/auto-github-cve/github-repo/MagicMirror/[eval]"}}]

Expected control output: the placeholder remains SECRETMMAUDIT, showing that the positive case depends on the vulnerable server-side placeholder expansion step.

Final repro re-check: both the positive and negative harnesses were re-run after drafting, and the observed outputs above are from this environment. No cleanup was required.

Impact Any client that can connect to a module Socket.IO namespace can disclose SECRET environment variables by sending known placeholder names in object payloads that are expanded by js/nodehelper.js before helper processing. This undermines the purpose of hideConfigSecrets: true: secrets are hidden in the HTTP config response but can be converted back into their real values through inbound socket payloads.

The confidentiality impact depends on what the deployment stores under SECRET variables. MagicMirror configurations commonly include API tokens, calendar credentials, service keys, or network allowlist values in config/environment variables. The PoC proves disclosure of a test secret through a default helper echo path.

CVSS 3.1 rationale: AV:A because MagicMirror is intended for trusted local/private networks and remote exploitation requires a reachable local/private-network deployment; AC:L because once namespace access is available the attacker only needs a known or guessed SECRET name and an invalid weather provider to trigger the echo; PR:N because no application authentication is required; UI:N because the attacker sends socket messages directly; S:U because the impact is disclosure of secrets from the vulnerable application's own process environment; C:H because environment secrets can include credentials/API tokens; I:N/A:N because this report proves disclosure only.

Suggested remediation Do not expand SECRET placeholders in inbound socket payloads. The redaction boundary should be one-way: server-to-client responses may contain placeholders, but client-to-server messages must not be treated as authority to retrieve real environment values.

Concrete fixes:

- Remove the replaceSecretPlaceholder(JSON.stringify(payload)) call from js/nodehelper.js:91-99 for inbound socket payloads. - If a specific module legitimately needs secret material, resolve it only from server-loaded trusted configuration, not from client-supplied placeholders. - Keep hideConfigSecrets redaction for /config, but avoid disclosing placeholder names to clients when not necessary. - Add regression tests that set hideConfigSecrets: true and SECRETTEST=value, send a socket payload containing SECRETTEST, and assert that every helper receives/returns the literal placeholder rather than the secret value.

Affected Software

1 affected componentFixes available
npm/magicmirror<2.37.0
2.37.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/magicmirror to a version that resolves this vulnerability.

    Fixed in 2.37.0
  2. Upgrade

    Upgrade magicmirror to a version that resolves this vulnerability.

    Fixed in 2.36.0
  3. Configuration

    Remove/avoid the inbound socket payload placeholder expansion step: do not run replaceSecretPlaceholder(JSON.stringify(payload)) in js/node_helper.js:91-99 for inbound socket messages; ensure client-sent placeholders like **SECRET_NAME** remain unchanged when hideConfigSecrets: true is enabled.

    MagicMirror node-helper socket dispatcher (js/node_helper.js) replaceSecretPlaceholder(JSON.stringify(payload)) for inbound socket payloads = disabled

Event History

Aug 18, 2026
Advisory Published
via GitHub·06:00 PM
Data Sourced
via GitHub·06:00 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What conditions are required for exploitation?

Exposure requires hideConfigSecrets: true, a SECRET_* environment variable available to the MagicMirror process, and a client able to connect to a loaded module's socket namespace. The client does not need prior privileges or user interaction.

2

How can the secret reach an attacker?

The vulnerable dispatcher expands **SECRET_NAME** placeholders in every inbound socket payload before delivering it to a module helper. A helper that returns an attacker-controlled field can disclose the substituted value; the default weather helper's error path is identified as one such path.

3

Does redaction in the HTTP configuration response protect the secrets?

The issue affects MagicMirror 2.36.0 as tested at commit fb41d24ef522e91e802e2a623ff6afbddeb3c9d8. The HTTP /config redaction does not prevent this socket-based disclosure path.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203