CVE-2026-48788: Remark42 Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-4c8j-mgm4-qqvp
CVSS 8.2
CWE-436 CWE-79
Published
Advisory Summary

CVE-2026-48788 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-436: Interpretation Conflict) affecting Remark42 libraries in the Go ecosystem. The issue involves cross-site scripting (xss) on /api/v1/img via content-type spoofing. Remediation is available by upgrading affected packages to version 1.16.0.

CVE-2026-48788 at a Glance

CVE Identifier CVE-2026-48788
GHSA Identifier GHSA-4c8j-mgm4-qqvp
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-436: Interpretation Conflict
Affected Product Remark42
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-48788

To remediate this vulnerability, upgrade all affected Remark42 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/umputun/remark42 fixed: 1.16.0
Upgrade github.com/umputun/remark42 to 1.16.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/umputun/remark42

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-48788, inspect your project dependencies for Remark42:

inspect dependencies for github.com/umputun/remark42

Analyze the terminal output to locate any version of Remark42 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.16.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-436: Interpretation Conflict, where product a handles inputs or steps differently than product b, which causes a to perform incorrect actions based on its perception of b's state. In Remark42, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.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-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`.

CVE-2026-48788 Affected Remark42 Versions

1 component(s)
Fixed Versions:
1.16.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/umputun/remark42
Go
≥ 1.6.0
< 1.16.0
1.16.0

References

Frequently Asked Questions

What is CVE-2026-48788?
CVE-2026-48788 is a security vulnerability in Remark42 involving Cross-Site Scripting (XSS) on /api/v1/img via content-type spoofing under CWE-436: Interpretation Conflict.
Which Remark42 versions are affected?
Affected versions include releases prior to 1.16.0 across affected packages: github.com/umputun/remark42.
What version fixes CVE-2026-48788?
Upgrading to 1.16.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/umputun/remark42 affected?
Yes, github.com/umputun/remark42 is affected in releases prior to 1.16.0. Upgrade your dependency to 1.16.0 or later.
What is the CVSS score of CVE-2026-48788?
CVE-2026-48788 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2026-48788?
CVE-2026-48788 is classified under CWE-436: Interpretation Conflict (Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.).
How can I check Go dependencies for CVE-2026-48788?
Run the dependency tree command: 'inspect dependencies for github.com/umputun/remark42'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4c8j-mgm4-qqvp",
  "modified" : "2026-06-26T19:26:44Z",
  "published" : "2026-06-26T19:26:43Z",
  "aliases" : [ "CVE-2026-48788" ],
  "summary" : "Remark42: Cross-Site Scripting (XSS) on /api/v1/img via content-type spoofing",
  "details" : "### Summary\nThe 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`.\n\nAn attacker hosts a URL that sets `Content-Type` to `image/png` but returns an HTML/JavaScript body:\n\n* the download check sees `image/png` → accepts it;\n* the serve path sniffs the body → emits `Content-Type: text/html`;\n* the browser renders attacker HTML/JS as a document in remark42's origin.\n\n### Details\n#### Downloader\n\n`backend/app/rest/proxy/image.go` — `downloadImage()`, lines 189-206:\n\n```go\ncontentType := resp.Header.Get(\"Content-Type\")\nif !strings.HasPrefix(contentType, \"image/\") {\n    return nil, fmt.Errorf(\"invalid content type %s\", contentType)\n}\n\nmaxSize := 5 * 1024 * 1024 // 5MB default\nif p.ImageService != nil && p.ImageService.MaxSize > 0 {\n    maxSize = p.ImageService.MaxSize\n}\nlr := io.LimitReader(resp.Body, int64(maxSize)+1)\nimgData, err := io.ReadAll(lr)\nif err != nil {\n    return nil, fmt.Errorf(\"unable to read image body: %w\", err)\n}\nif len(imgData) > maxSize {\n    return nil, fmt.Errorf(\"image is too large\")\n}\nreturn imgData, nil          // <-- bytes never validated, returned as-is\n```\n\nSend `Content-Type: image/png` and the check passes regardless of what the body actually contains.\n\n#### Server\n\n`backend/app/rest/proxy/image.go` — `Handler()`, line 131:\n\n```go\nw.Header().Add(\"Content-Type\", p.ImageService.ImgContentType(img))\n_, err = io.Copy(w, bytes.NewReader(img))\n```\n\n`backend/app/store/image/image.go` — `ImgContentType()`, lines 242-249:\n\n```go\nfunc (s *Service) ImgContentType(img []byte) string {\n    contentType := http.DetectContentType(img)\n    if contentType == \"application/octet-stream\" {\n        return \"image/*\"\n    }\n    return contentType                 // <-- returns text/html for an HTML body\n}\n```\n\n### PoC\n\n```python\nself.send_response(200)\nself.send_header(\"Content-Type\", \"image/png\")\nself.send_header(\"Content-Length\", str(len(body)))\nself.end_headers()\nself.wfile.write(body)            # body = <!DOCTYPE html><script>...</script>\n```\n\nThen have the victim open `https://<remark42-host>/api/v1/img?src=<base64(attacker-host)>` top-level.\n\n### Impact\n* The script can issue authenticated, same-origin API calls with `credentials: 'include'` — the JWT cookie is sent automatically.\n* 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.\n\nTriggering 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.).\n\n### Fix\n\n`v1.16.0` adds layered defense to `/api/v1/img` and `/api/v1/picture/{user}/{id}`:\n\n* `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.\n* Every response carries `Content-Security-Policy: default-src 'none'; sandbox; frame-ancestors 'none'`, `X-Content-Type Options: nosniff`, and `Content-Disposition: inline; filename=\"image\"`.\n* 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.\n* The strict `default-src 'none'; sandbox` CSP also applies to all `/api/v1/*` routes as defense-in-depth.\n\n#### Residual exposure\n\nBrowser-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`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/umputun/remark42"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0"
      }, {
        "fixed" : "1.16.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/umputun/remark42/security/advisories/GHSA-4c8j-mgm4-qqvp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-48788"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/umputun/remark42/commit/78d6de6bce1e961f023969da3ec8a00dd80c9ae8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/umputun/remark42"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/umputun/remark42/releases/tag/v1.16.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-436", "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-26T19:26:43Z",
    "nvd_published_at" : "2026-06-17T13:20:43Z"
  }
}