Skip to content

SSR/SSG dev error page discloses the full shell environment and its </script> escape is bypassable

Moderate
rstoenescu published GHSA-r5mf-4r5x-q78f Jul 29, 2026

Package

npm @quasar/app-vite (npm)

Affected versions

<= 3.2.0

Patched versions

3.3.0
npm @quasar/render-ssr-error (npm)
<= 2.2.3
2.2.4

Description

Summary

The error page that Quasar CLI shows when an SSR or SSG render throws in development serializes every variable in process.env, every request header and every cookie into the HTTP response, and the dev server binds 0.0.0.0 by default. Any host that can reach the port therefore gets the developer's cloud keys, registry tokens and database URLs from a single unauthenticated GET. The same page embeds that data inside a <script> element behind a replaceAll('</script>', ...) guard that is ASCII-case-sensitive and requires a literal >, so </SCRIPT>, </script > and </script/> all escape the element and give script execution in the dev server's origin.

Details

renderSSRError() builds the page by splicing a JSON blob into a prebuilt bundle (utils/render-ssr-error/src/index.js):

errorHtml:
  before +
  JSON.stringify(data).replaceAll('</script>', String.raw`<\/script>`) +
  after

before and after are the two halves of the compiled error-page UI, split inside a <script type="module"> element, so data is emitted as a JS object literal in raw script text. The data itself comes from utils/render-ssr-error/src/env.js:

function getEnvironmentVariablesData () {
  return Object.keys(process.env).reduce((acc, name) => {
    acc[ name ] = process.env[ name ]
    return acc
  }, {})
}

export function getEnv (req) {
  return {
    Request: getRequestData(req),
    Headers: getHeadersData(req),
    Cookies: getCookiesData(req),
    'Shell environment variables': getEnvironmentVariablesData()
  }
}

The page is served by serve.devError({ err, req }) in app-vite/lib/modes/ssr/ssr-devserver.js and by the SSG equivalent, which the generated render middleware calls on any render exception. The dev server listens on every interface because app-vite/lib/quasar-config-file.js overrides Vite's localhost default:

} else if (!cfg.devServer.host) {
  cfg.devServer.host = '0.0.0.0'
}

The escape fails because the HTML tokenizer ends script raw text on </ followed by a case-insensitive script followed by any of tab, newline, form feed, space, / or >. replaceAll with a string pattern matches one exact spelling. </SCRIPT>, </ScRiPt>, </script > and </script/> are all untouched and all close the element. JSON.stringify does not escape < or >, and cookie values are additionally run through decodeURIComponent before being placed in the blob, so percent-encoded payloads decode into working markup.

The project already implements this correctly elsewhere. ui/src/plugins/meta/Meta.js uses a case-insensitive pattern with no trailing >:

function protectRawText (value, tagName) {
  return String(value).replaceAll(new RegExp(`</${tagName}`, 'gi'), `<\\/${tagName}`)
}

PoC

Harness that replicates the dev server's error branch using the published @quasar/render-ssr-error@2.2.3, with two canary values planted in the environment:

import http from 'node:http'
import renderSSRError from '@quasar/render-ssr-error'

process.env.AWS_SECRET_ACCESS_KEY = 'CANARY_AWS_SECRET_dev_machine_9f3a1c'
process.env.NPM_TOKEN = 'CANARY_npm_TOKEN_abcdef'

http.createServer((req, res) => {
  const err = new Error('Cannot read properties of undefined (reading "x")')
  const { errorHeaders, errorHtml } = renderSSRError({ err, req, rootFolder: process.cwd() })
  res.writeHead(500, errorHeaders)
  res.end(errorHtml)
}).listen(3200, '0.0.0.0')

Disclosure needs no payload at all. A plain GET / returns a 957 KB page containing both canaries:

ENV DISCLOSURE (plain GET, no injection): 2/2 canary secrets present in the 500 page
  -> CANARY_AWS_SECRET_dev_machine_9f3a1c, CANARY_npm_TOKEN_abcdef

For the injection, the payload goes in an ordinary request header. JSON.stringify escapes " as \", so the handler uses single quotes:

<TAG><img src=/nonexistent-image onerror='window.__QPWN=document.domain+":"+location.port'>

Loaded in headless Chromium:

POSITIVE  </SCRIPT >  (uppercase + space)   window.__QPWN=127.0.0.1:3200  injectedImg=1  ATTACKER SCRIPT EXECUTED
POSITIVE  </script >  (lowercase + space)   window.__QPWN=127.0.0.1:3200  injectedImg=1  ATTACKER SCRIPT EXECUTED
POSITIVE  </script/>  (lowercase + slash)   window.__QPWN=127.0.0.1:3200  injectedImg=1  ATTACKER SCRIPT EXECUTED
POSITIVE  </ScRiPt>   (mixed case)          window.__QPWN=127.0.0.1:3200  injectedImg=1  ATTACKER SCRIPT EXECUTED
NEG-CTRL  </script>   (what the filter matches)
                                            window.__QPWN=null            injectedImg=0  no execution

The negative control is the same payload with the one spelling replaceAll actually matches. Nothing is injected and nothing runs, which isolates the bug to the escape rather than to the surrounding page. Confirming the injection context, a probe header comes back inside the single <script type="module"> element:

..."Headers":{"host":"127.0.0.1:3200","user-agent":"curl/8.18.0","accept":"*/*",
   "x-probe":"</SCRIPT ><img src=/nope onerror=\"window.__QPWN=1\">MARKEREND"},...

No Content-Security-Policy is sent with the page.

Impact

Exposure of sensitive system information, plus HTML injection into a page that carries it. This is development only, since serve.devError does not exist in a production build, and it requires the app's SSR render to throw. That is the routine state this page exists to display, and an attacker who can reach the port can simply poll for it.

The disclosure is the substantive half and needs nothing but a TCP connection: shell environment, all request headers, all cookies, and ten lines of source around every stack frame. On a developer machine that typically means cloud credentials, npm or GitHub tokens and database connection strings. Because Quasar overrides Vite's localhost default with 0.0.0.0, everyone on the same network segment or in a shared container network can ask for it.

The injection is best treated as a chained issue on top of that rather than as a drive-by. A raw HTTP client can set the header but only poisons its own page. For the code to run in the developer's browser the payload has to travel with the developer's own request, which in practice means the cookie channel, since cookie values are URL-decoded and any page on a localhost or 127.0.0.1 origin can set a cookie that is sent to every port on that host. Cross-origin fetch does not work: CORS-safelisted headers forbid < and >, and browsers percent-encode them in the URL while req.url is never decoded.

Remediation

The fix omits process.env from development error pages and serializes the remaining diagnostic data with HTML-safe escaping for <, >, &, U+2028, and U+2029. Request headers and parsed cookies remain available as development diagnostics, but can no longer terminate the raw-text script context. Malformed cookie encodings no longer replace the original rendering error, and the diagnostic header and cookie maps use null-prototype objects.

Upgrade to @quasar/render-ssr-error@2.2.4 or later. Applications using Quasar App Vite should upgrade to @quasar/app-vite@3.3.0 or later.

Severity

Moderate

CVE ID

No known CVE

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Exposure of Sensitive System Information to an Unauthorized Control Sphere

The product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does. Learn more on MITRE.

Credits