Miggo Logo

CVE-2022-23646: Improper CSP in Image Optimization API for Next.js versions between 10.0.0 and 12.1.0

5.9

CVSS Score
3.1

Basic Information

EPSS Score
0.79553%
Published
2/17/2022
Updated
2/3/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
nextnpm>= 10.0.0, < 12.1.012.1.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the default image optimization handler (imageOptimizer) not applying proper CSP headers for SVG files. The linked GitHub PR #34075 shows modifications to the image-optimizer.ts file related to response caching and security headers. The vulnerability only exists when using the default loader, as alternative loaders bypass this code path. The function's failure to implement adequate CSP protections for SVGs from user-configured domains directly enables UI misrepresentation attacks.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

N*xt.js is * R***t *r*m*work. St*rtin* wit* v*rsion **.*.* *n* prior to v*rsion **.*.*, N*xt.js is vuln*r**l* to Us*r Int*r**** (UI) Misr*pr*s*nt*tion o* *riti**l In*orm*tion. In or**r to ** *****t**, t** `n*xt.*on*i*.js` *il* must **v* *n `im***s.*o

Reasoning

T** vuln*r**ility st*ms *rom t** ****ult im*** optimiz*tion **n*l*r (im***Optimiz*r) not *pplyin* prop*r *SP *****rs *or SV* *il*s. T** link** *it*u* PR #***** s*ows mo*i*i**tions to t** `im***-optimiz*r.ts` *il* r*l*t** to r*spons* ****in* *n* s**ur