CVE-2026-48788: Remark42: Cross-Site Scripting (XSS) on /api/v1/img via content-type spoofing

Published Jun 16, 2026
·
Updated

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:

go 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:

go 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:

go 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

python self.sendresponse(200) self.sendheader("Content-Type", "image/png") self.sendheader("Content-Length", str(len(body))) self.endheaders() 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-TOKEN cookie and re-send it as the X-XSRF-TOKEN header, 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.SafeImgContentType validates sniffed body bytes against a strict allowlist (image/png, image/jpeg, image/gif, image/webp, image/bmp, image/x-icon). Non-image content returns 415 with 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, and Content-Disposition: inline; filename="image". The ETag is bumped to "v2:<base64(src)>". Browsers that revalidate cached pre-fix responses get a fresh validated 200 instead of a 304 against the poisoned cached entry. The strict default-src 'none'; sandbox CSP 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.

Other sources

Remark42 is a self-hosted comment engine for blogs, articles, or any other place where readers can add comments. Versions 1.6.0 through 1.15.0 contain a Cross-Site Scripting (XSS) vulnerability exploitable through content-type spoofing. The Remark42 image proxy fetches an arbitrary remote URL and re-serves the response from Remark42's own origin. During the download phase, the proxy determines whether the resource is an image by inspecting only the Content-Type header advertised by the remote server, never examining the actual bytes; during the serving phase, it instead derives the response Content-Type by sniffing those bytes with http.DetectContentType. An attacker can exploit this inconsistency by hosting a URL that advertises Content-Type: image/png while returning an HTML/JavaScript body: the download check accepts it as an image, the serving path sniffs the body and emits Content-Type: text/html, and the browser renders the attacker-controlled HTML/JavaScript as a document within Remark42's origin. Exploitation 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, such as email, direct message, or a link on another website. This issue has been fixed in version 1.16.0.

— NVD

Affected Software

2 affected componentsFixes available
remark42 remark42>=1.6.0<=1.15.0
go/github.com/umputun/remark42>=1.6.0<1.16.0
1.16.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/umputun/remark42 to a version that resolves this vulnerability.

    Fixed in 1.16.0
  2. Upgrade

    Upgrade remark42 to a version that resolves this vulnerability.

    Fixed in 1.16.0
  3. Compensating control

    If you have a CDN/edge cache in front of Remark42, purge/invalidate the cached path `/api/v1/img` after deploying v1.16.0 (to remove pre-fix poisoned/cached `text/html` responses served under spoofed `Content-Type: image/png`).

Event History

Jun 16, 2026
CVE Published
via MITRE·10:29 PM
Data Sourced
via MITRE·10:29 PM
DescriptionSeverityWeakness
Jun 17, 2026
Data Sourced
via NVD·01:20 PM
DescriptionSeverityWeakness
Jun 26, 2026
Advisory Published
via GitHub·07:26 PM
Data Sourced
via GitHub·07:26 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-48788?

The severity of CVE-2026-48788 is high, with a score of 8.2 on the CVSS scale.

2

How do I fix CVE-2026-48788?

To fix CVE-2026-48788, upgrade to Remark42 version 1.16.0 or later.

3

What type of vulnerability is CVE-2026-48788?

CVE-2026-48788 is classified as a Cross-Site Scripting (XSS) vulnerability.

4

What is the impact of CVE-2026-48788?

The impact of CVE-2026-48788 allows for potential arbitrary script execution through content-type spoofing.

5

Which versions of Remark42 are affected by CVE-2026-48788?

Versions of Remark42 from 1.6.0 to 1.15.0 are affected by CVE-2026-48788.

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