The Subtle Threat in Your Frontend: How a Misconfigured CDN Key Escalates to a CVSS 10.0 Defacement
A public API key embedded in frontend asset URLs had full write access to the organisation's S3 bucket, allowing unauthenticated uploads and overwrites of production files. An attacker could deface the site, host phishing pages on the trusted domain, or tamper with developer-facing assets.
Published on medium.com
Cybersecurity
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Modern web development leans on third-party SaaS pipelines. Content-heavy applications, developer portals and dynamic storefronts rarely build their own image-processing and file-storage infrastructure; teams offload that complexity to third-party media APIs and cloud content delivery networks.
In frontend architectures, an API key sitting inside a client-side bundle or an image URL is often waved away: it is just an asset delivery key, it only resizes images. The author argues that assumption is dangerous, and uses an independent security assessment of an enterprise developer platform to show why. An asset processing key visible in plain HTML did not only handle image resizing: it held unauthenticated, full write permissions to the organisation's underlying Amazon S3 storage bucket.
The write-up traces how the architecture failed, how a simple information leak could be escalated into a persistent site defacement, and which engineering controls would prevent it.
Setup
The assessment was independent and targeted an enterprise developer platform. The report does not describe accounts, roles, tooling versions or other preconditions. The only tooling shown is curl. The only tooling shown is curl.
Finding it
When auditing Single Page Applications or CMS-driven frontends, static asset URLs are frequently treated as passive targets. Dynamic media processors, however, construct image transformation paths using explicit identifiers. A standard asset URL rendered in production looked like this:
<img src="https://cms-assets.example.com/ADJUngP4LRSSXxtIH9SDJz/resize=width:1200/clz9watoh0012/hero.png" />
At first glance it is a straightforward CDN path. Analysing the structure reveals the vendor architecture underneath:
cms-assets.example.comroutes to a third-party file ingestion and delivery service.- The first path component (
ADJUngP4LRSSXxtIH9SDJz) is not an asset hash or route identifier: it is the account's public API key.
Many deployments assume such a key operates in a restricted read-and-transform context. The author's point is that security boundaries cannot rely on UI convention: if the provider's underlying API exposes storage actions, the key has to be evaluated against every endpoint the platform offers.
Exploitation
Step 1: Test the store API with the exposed key
Third-party asset management suites commonly offer direct storage APIs designed for browser-side uploads. When client-side upload widgets are configured without backend cryptographic verification, the API key alone acts as the authorisation token. To test that boundary, the author inspected the provider's store API:
curl -X POST "https://www.filestackapi.com/api/store/S3?key=ADJUngP4LRSSXxtIH9SDJz&filename=poc.html" \ -H "Content-Type: text/html" \ -d '<html><body><h1>Asset Pipeline Write Verification</h1></body></html>'
The request posts a small HTML document to the S3 store endpoint, passing the exposed key as the key query parameter and naming the object poc.html. If the key were properly locked down through backend policies, the request would fail with a 403 Forbidden or require an accompanying HMAC signature. In this instance the API returned an immediate 200 OK:
{ "container": "enterprise-cms-storage-prod", "url": "https://cdn.filestackcontent.com/KTShCdSXSzuToL5ACXMh", "filename": "poc.html", "key": "dnKsobCR6qzwDltCZh4w_poc.html", "type": "text/html", "size": 181 }
The response revealed two critical issues:
- Direct cloud storage write primitive. Any unauthenticated visitor could store arbitrary files in the enterprise's dedicated S3 container.
- Arbitrary MIME type reflection. The file was served directly from the CDN with
content-type: text/html; charset=utf-8andaccess-control-allow-origin: *, creating an instant vector for high-reputation phishing and cross-site scripting.
Step 2: Read metadata for an existing production asset
Unrestricted upload to an S3 bucket is typically classified as resource abuse or a medium-severity bug. The real danger emerges when an attacker can control the destination storage path, so the next question was whether existing, authoritative production assets could be overwritten. To answer it, the author turned to the provider's metadata endpoints, inspecting assets already embedded on the target website:
curl -s "https://cdn.filestackcontent.com/3bBdxV2zTCOvHPnxHX6D/metadata"
The service returned granular backend metadata:
{ "container": "enterprise-cms-storage-prod", "filename": "platform-logo-main.png", "key": "production/assets/branding/platform-logo-main.png", "location": "S3", "mimetype": "image/png", "size": 1704, "writeable": true }
Two fields transformed the issue into a Critical (CVSS 10.0) compromise:
key: the exact, absolute S3 key path used by the production web application was exposed.writeable: true: the asset lacked write-protection locks.
Step 3: Overwrite the production asset
By passing that exact destination key back into the store API through the path= parameter, an attacker could instruct the API to write directly over the target file:
curl -X POST "https://www.filestackapi.com/api/store/S3?key=ADJUngP4LRSSXxtIH9SDJz&path=production/assets/branding/platform-logo-main.png" \ -H "Content-Type: image/png" \ -d "OVERWRITTEN_PAYLOAD"
Because the key matched the legitimate asset's storage location, the storage provider updated the underlying object in S3. Once the edge CDN cache expired or was invalidated, every visitor navigating to the primary developer portal would receive the modified content.
Root cause
The design mistake is trusting a bare client-side API key as an authorisation token for storage operations. The key was embedded in public HTML on the assumption that it only permitted read and transform operations, but the provider's store API accepted it for writes without any backend cryptographic verification, so the key alone authorised uploads. The metadata endpoint then disclosed the absolute S3 key path of production assets and flagged them as writeable, and the store API accepted that path as a write destination. The store API accepted the key without a signature, and the metadata endpoint reported the production asset as writeable, which is what allowed the chain to proceed.
Impact
The author frames the chain as a Critical (CVSS 10.0) compromise and lists three consequences:
- Persistent site defacement. An attacker could silently replace core visual branding, navigation assets and platform logos across the target domain.
- Supply-chain and developer compromise. On a developer-facing portal delivering SDK documentation, modifying inline diagrams or visual walkthroughs, for example swapping a verification QR code or a download button graphic, could trick downstream engineers into pulling malicious software.
- Enterprise domain hijacking for phishing. Serving arbitrary HTML and JavaScript from enterprise infrastructure with permissive CORS headers allows threat actors to build phishing portals with zero reputation loss, hosted on reputable infrastructure.
These outcomes depend on the conditions shown above: the key must be exposed client-side, the store API must accept it without a signature, and the target asset must be writeable and reachable through the CDN cache.
Fix
The report describes remediation as architectural, enforcing strict authorisation boundaries between the client, the backend and the third-party SaaS provider. It does not say which of these were actually applied.
A. Cryptographic signatures and scoped policies
Never rely on bare API keys in the frontend. Providers such as Filestack, Cloudinary and AWS require policy-based signatures for secure operations.
- The backend should generate a short-lived, HMAC-signed security policy.
- The policy must explicitly restrict operations (read-only, strict file-size limits, predefined upload directories) and include a mandatory expiry timestamp.
- Any request lacking
&policy=...&signature=...should be automatically rejected by the provider.
B. Immutability on production buckets
Storage layers should implement defensive controls independently of application logic:
- Object versioning. Enable S3 Object Versioning so overwritten assets can be immediately rolled back.
- S3 Object Lock / WORM storage. Use write-once-read-many models or strict bucket IAM policies that deny
s3:PutObjectpermissions on established production paths (/branding/*,/core/*) to anyone outside the primary CI/CD service role.
C. Content types and CORS at the edge
If the bucket serves user-uploaded content:
- Enforce strict Content-Type overrides. Never serve user uploads with executable MIME types such as
text/htmlorapplication/javascriptunless explicitly designed as a sandbox. - Restrict
Access-Control-Allow-Originheaders to trusted application domains rather than wildcards (*).
Variants to test
- Store API without a signature. Take any key found in an asset URL and POST a small file to the provider's store endpoint as shown above. A positive result is a 200 OK with a container name and a CDN URL, rather than a 403 or a demand for an HMAC signature.
- MIME reflection. Request the URL returned by a successful upload and check the response headers. A positive result is
content-type: text/html(or another executable type) together withaccess-control-allow-origin: *. - Metadata disclosure. Query the metadata endpoint for assets already embedded on the site. A positive result is a response containing the absolute storage key path and
writeable: true. - Path overwrite. Pass a disclosed production key back through the
path=parameter of the store API. A positive result is a successful write to the same object, visible on the site once the CDN cache expires or is invalidated. - Policy enforcement gaps. Where a provider supports signed policies, try requests with a missing, expired or over-broad policy. A positive result is acceptance of an operation the policy was meant to forbid, such as a write outside the predefined upload directory or above the size limit.
What happened, in plain words
A security researcher was looking at the public website of a large company that runs a developer platform. Like most modern sites, it did not store and process its own images. It rented that job from another company, a media service, and that service in turn kept the files in Amazon S3, which is Amazon's online file storage (think of a very large shared drive in the cloud).
To make the images load, the website's HTML contained a long string of letters and numbers in the image address. Many teams assume such a string is harmless: it is "just the key that lets the image service resize pictures". The researcher tested that assumption. The string turned out to be a key that allowed uploading files, reading metadata about existing files, and even replacing the company's own logo on the live site.
This article walks through the steps the researcher took and explains the terms from scratch. You only need to know how to use a browser to follow it.
Background: why sites rent their image handling
Building a website that hosts lots of pictures, videos and documents is hard work. You need somewhere to keep the files, software to shrink and crop them for different screen sizes, and a fast network to deliver them worldwide. Most teams do not build that themselves. They pay a third-party service (often called SaaS, short for Software as a Service, meaning software you rent over the internet instead of installing) to do it.
So a typical setup has three parts:
- The company's own website, which you see in your browser.
- A media service (in this case Filestack, a service that accepts uploads and transforms images) that sits in the middle.
- A cloud storage bucket (in this case Amazon S3) where the actual files live.
A bucket is simply a named folder in cloud storage. A CDN (Content Delivery Network) is a network of servers spread around the world that keep copies of files close to visitors so pages load quickly. When a file changes, the CDN may keep serving the old copy until its cache (the stored copy) expires or is cleared.
The starting point: a key hidden in plain sight
When you audit a website (audit here means: look at it carefully to find weaknesses), the addresses of images are easy to ignore. They look like boring plumbing. But image services build those addresses out of pieces that mean something. Here is an image tag the researcher found on the live site:
<img src="https://cms-assets.example.com/ADJUngP4LRSSXxtIH9SDJz/resize=width:1200/clz9watoh0012/hero.png" />
Line by line:
<img ... />is the HTML instruction that tells a browser to display a picture.src=is the address of that picture.https://cms-assets.example.comis the server the picture comes from. The researcher found that this address actually belongs to a third-party file service, not to the company directly.ADJUngP4LRSSXxtIH9SDJzis the first piece of the path. It looks like a random identifier, but it is the account's public API key. An API key is a password-like string that identifies who is making a request. "Public" means it is meant to be visible, for example in page code.resize=width:1200is an instruction to the image service: make this picture 1200 pixels wide.clz9watoh0012/hero.pngidentifies which stored file to use.
An API (Application Programming Interface) is the set of web addresses a service offers so that other software can talk to it. When your browser loads a page, it is constantly calling APIs behind the scenes. The key point here: the same service that resizes images may also offer other addresses, for example one that stores new files. If the key works on those too, then a key that looks read-only is in fact a write key.
The researcher's reasoning was simple: you cannot assume a key is limited just because the website only uses it for one thing. You have to test it against every capability the service offers.
Step 1: trying to upload a file with the key
Many media services offer a direct upload address so that a website can let visitors upload pictures straight from the browser. If the website's upload widget does not add a cryptographic proof (explained below) to each upload, then the key alone is enough to upload. The researcher tested exactly that with curl.
curl is a free command-line tool that sends web requests and prints the answers. It is the same kind of request your browser makes, just typed by hand.
curl -X POST "https://www.filestackapi.com/api/store/S3?key=ADJUngP4LRSSXxtIH9SDJz&filename=poc.html" \ -H "Content-Type: text/html" \ -d '<html><body><h1>Asset Pipeline Write Verification</h1></body></html>'
Line by line:
curlstarts the tool.-X POSTsays which kind of request to send. A GET request asks for something (like opening a page). A POST request sends data to the server, usually to create or change something. Here the researcher is deliberately trying to create a file.- The quoted address is the service's storage address.
?key=ADJUngP4LRSSXxtIH9SDJzpasses the key found in the image tag.&filename=poc.htmlasks for the new file to be calledpoc.html. "poc" is short for proof of concept, a small harmless test that proves a weakness exists. -H "Content-Type: text/html"adds a header. Headers are extra labels attached to a request or response, like the notes on a parcel. This one tells the server the content being sent is an HTML page.-d '<html>...'is the actual content being uploaded: a tiny web page with the heading "Asset Pipeline Write Verification". It does nothing harmful; it only proves the upload worked.
If the key had been properly restricted on the service's side, the answer would have been 403 Forbidden, which is the web's way of saying "you are not allowed". Or the service would have demanded an HMAC signature: a short code computed from the request using a secret that only the company's own server knows. Without the secret you cannot produce the code, so a signature proves the request came from the company's server and not from a stranger.
Instead, the service answered 200 OK, which means "done, it worked":
{ "container": "enterprise-cms-storage-prod", "url": "https://cdn.filestackcontent.com/KTShCdSXSzuToL5ACXMh", "filename": "poc.html", "key": "dnKsobCR6qzwDltCZh4w_poc.html", "type": "text/html", "size": 181 }
This is a JSON response, a common text format for data, made of field names and values. Line by line:
containeris the name of the storage bucket the file landed in. The name suggests a production (live) system for an enterprise content management system.urlis the public web address where the uploaded file can now be fetched.filenameis the name the file was stored under.keyis the internal identifier of the stored file.typesays the file istext/html, meaning a web page.sizeis the file size in bytes.
Two serious problems follow from this single answer:
- Anyone could write to the company's storage. No login, no account, no signature. The key alone was enough. In security language this is a write primitive: a basic ability to make a change on someone else's system.
- The service served the uploaded file back as a web page. The researcher found the file was delivered with
content-type: text/html; charset=utf-8(the label that tells a browser "this is a web page, run it as such") andaccess-control-allow-origin: *. That last header is a CORS setting. CORS (Cross-Origin Resource Sharing) is the browser rule that decides which other websites may read a response. A*means "any website at all may read this".
Why does that matter? If a stranger can upload a web page to a trusted company's address and it is served as a real page, that page can contain JavaScript (the programming language browsers run) and can be opened by victims under the company's good name. That is the recipe for phishing (fake pages that trick people into typing passwords) and for cross-site scripting, usually shortened to XSS: getting your own code to run inside a page that belongs to someone else's site.
Step 2: asking the service about an existing file
Uploading random files is annoying, but on its own it is usually treated as abuse of resources, a medium-level problem. The far bigger question is whether an attacker can choose where the file goes, and in particular whether they can overwrite a file the company already uses.
To find out, the researcher asked the service for information about an image that was already on the target site. This kind of request goes to a metadata address: metadata means "data about data", the details of a file rather than its contents.
curl -s "https://cdn.filestackcontent.com/3bBdxV2zTCOvHPnxHX6D/metadata"
Line by line:
curlis the same tool as before.-smeans silent: do not print progress information, only the answer.- The address points at the media service's CDN and asks for the metadata of the file identified by
3bBdxV2zTCOvHPnxHX6D, which the researcher had taken from an image already embedded on the target website.
The service replied with detailed internal information:
{ "container": "enterprise-cms-storage-prod", "filename": "platform-logo-main.png", "key": "production/assets/branding/platform-logo-main.png", "location": "S3", "mimetype": "image/png", "size": 1704, "writeable": true }
Line by line:
containeris again the storage bucket name.filenameis the file's name: the platform's main logo.keyis the exact internal path of the file inside the bucket:production/assets/branding/platform-logo-main.png. This is like being told the full shelf address of an item in a warehouse.locationsays the file lives in S3.mimetypesays it is a PNG image.sizeis its size in bytes.writeable: truesays the file can be changed.
Two of these fields turned a medium problem into a critical one. The key gave the exact address of a real production file. The writeable: true said nothing was protecting it from being replaced. CVSS is a standard scoring system for the severity of a security flaw, running from 0 to 10; the researcher rated this chain 10.0, the maximum.
Step 3: replacing the company's own logo
The last step combines what the first two steps revealed. The upload address from step 1 accepts a path= parameter, which lets the caller choose where in the storage the file is written. The researcher passed the exact production path from step 2 into it:
curl -X POST "https://www.filestackapi.com/api/store/S3?key=ADJUngP4LRSSXxtIH9SDJz&path=production/assets/branding/platform-logo-main.png" \ -H "Content-Type: image/png" \ -d "OVERWRITTEN_PAYLOAD"
Line by line:
curl -X POSTagain sends data to create or change something.- The address is the same storage address, with the same exposed key.
&path=production/assets/branding/platform-logo-main.pngis the crucial part: it tells the service to write at the exact location of the real logo, instead of creating a new file somewhere else.-H "Content-Type: image/png"labels the content as a PNG image.-d "OVERWRITTEN_PAYLOAD"is the replacement content. In the write-up it is a placeholder; the point is that whatever is sent lands in place of the logo.
Because the path matched the real file, the service wrote over the object in S3. From that moment the stored logo was different. Visitors would not see the change immediately, because the CDN keeps serving its cached copy. Once that cache expired or was cleared, every visitor to the developer portal would receive the modified file.
Why it worked
The root cause is one design decision: the company treated a key that anyone can see in the page as proof of permission to write to storage. The key was placed in public HTML on the belief that it only allowed reading and resizing. The service's storage address, however, accepted it for uploads with no signature from the company's server. The metadata address then handed out the exact internal path of production files and said they were writeable, and the storage address accepted that path as a destination.
The storage address accepted the key without a signature, and the metadata said the production file was writeable. The absence of signed policies and of protection against overwriting production files is what let the whole thing proceed.
What an attacker could do with it
The researcher rated the chain as a critical compromise and listed three consequences:
- Persistent site defacement. Defacement means changing a site's appearance without permission. An attacker could quietly swap the company's branding, navigation images and logos across the whole domain, and visitors would see the fake versions.
- Supply-chain and developer compromise. A supply chain here means the chain of software and materials that developers rely on. On a portal that teaches developers how to use the company's tools, an attacker could alter diagrams or walkthrough images, for example swapping a verification QR code or a download button picture, and trick engineers into downloading malicious software.
- Using the company's name for phishing. Because the service served uploaded HTML and JavaScript from the company's own infrastructure, with CORS open to any site, an attacker could host a convincing fake login page on a trusted address. Victims see a reputable domain and have no reason to be suspicious.
All of this depends on the same conditions: the key is visible in the page, the storage address accepts it without a signature, and the target file is writeable and reachable through the CDN.
How to fix it
The fix is architectural, meaning it changes how the parts of the system trust each other, not just one line of code. The report describes the controls; it does not say which of them the company actually applied.
A. Signatures and limited policies
Never rely on a bare key in the frontend. The frontend is everything that runs in the visitor's browser; the backend is the company's own server, which visitors cannot see or change. Services such as Filestack, Cloudinary and AWS expect a signed policy for sensitive operations.
- The backend should create a short-lived policy, signed with HMAC. A policy is a written set of rules: what may be done, to which files, up to what size, until when. Signing it with HMAC means attaching a code computed with a secret, so the service can verify the rules really came from the company.
- The policy must state exactly what is allowed (read-only, strict file-size limits, predefined upload folders) and must include an expiry time.
- Any request without
&policy=...&signature=...should be rejected by the service automatically.
B. Make production files impossible to overwrite
The storage layer should protect itself, regardless of what the website's code does:
- Object versioning. Turn on S3 Object Versioning, which keeps every previous version of a file, so an overwritten asset can be restored immediately.
- S3 Object Lock / WORM storage. WORM stands for write once, read many: a file can be written but not changed afterwards. Alternatively, strict bucket permissions (IAM policies, the rules that say who may do what in AWS) can deny the
s3:PutObjectpermission (the right to upload or overwrite) on established production paths such as/branding/*and/core/*to everyone except the company's own automated deployment system, the CI/CD service role.
C. Control file types and CORS at the edge
If the bucket serves files uploaded by users:
- Force strict content types. Never serve user uploads as executable types such as
text/htmlorapplication/javascriptunless the design is explicitly a sandbox (an isolated area where running code is intended and contained). - Limit the
Access-Control-Allow-Originheader to trusted domains instead of the wildcard*.
The same pattern on other targets
- Storage address without a signature. Take any key found in an image address and POST a small file to the service's storage address as shown above. A positive result is a 200 OK with a container name and a CDN address, rather than a 403 or a demand for an HMAC signature.
- File type reflection. Open the address returned by a successful upload and look at the response headers. A positive result is
content-type: text/html(or another executable type) together withaccess-control-allow-origin: *. - Metadata disclosure. Ask the metadata address about files already on the site. A positive result is a response containing the absolute storage path and
writeable: true. - Path overwrite. Send a disclosed production path back through the
path=parameter of the storage address. A positive result is a successful write to the same file, visible on the site once the CDN cache expires or is cleared. - Gaps in policy enforcement. Where a service supports signed policies, try requests with a missing, expired or overly broad policy. A positive result is acceptance of an operation the policy was meant to forbid, such as a write outside the allowed upload folder or above the size limit.
Glossary
- API: the set of web addresses a service offers so other software can talk to it.
- API key: a password-like string that identifies who is making a request to a service.
- Audit: a careful examination of a website or system to find weaknesses.
- Backend: the company's own servers, which visitors cannot see or change.
- Bucket: a named folder in cloud storage where files are kept.
- Cache: a stored copy of a file kept close to visitors so pages load faster.
- CDN: Content Delivery Network, servers spread around the world that deliver copies of files quickly.
- CI/CD service role: the identity used by a company's automated build and deployment system.
- Container: the name of a storage bucket as reported by the service.
- Content-Type: a header that tells a browser what kind of content it is receiving, such as a web page or an image.
- CORS: Cross-Origin Resource Sharing, the browser rule that decides which other websites may read a response.
- Cross-site scripting (XSS): getting your own code to run inside a page that belongs to someone else's site.
- curl: a command-line tool that sends web requests and prints the answers.
- CVSS: a standard scoring system for the severity of a security flaw, from 0 to 10.
- Defacement: changing a website's appearance without permission.
- Frontend: everything that runs in the visitor's browser.
- GET: a request that asks for something, like opening a page.
- Header: an extra label attached to a web request or response, like notes on a parcel.
- HMAC signature: a short code computed from a request using a secret, proving the request came from someone who holds the secret.
- HTML: the language web pages are written in.
- IAM policy: AWS rules that say who may do what with which resources.
- JavaScript: the programming language browsers run.
- JSON: a common text format for data, made of field names and values.
- Metadata: data about data, the details of a file rather than its contents.
- MIME type: a label for the kind of a file, such as
text/htmlorimage/png. - Object versioning: keeping every previous version of a stored file so it can be restored.
- Phishing: fake pages or messages that trick people into giving away information.
- Policy: a written set of rules about what may be done, to which files, up to what size, until when.
- POST: a request that sends data to a server, usually to create or change something.
- Primitive: a basic ability to make something happen on someone else's system.
- S3: Amazon's cloud file storage service.
- SaaS: Software as a Service, software you rent over the internet instead of installing.
- Sandbox: an isolated area where running code is intended and contained.
- Supply chain: the chain of software and materials that developers rely on.
- WORM: write once, read many, a storage mode where a file can be written but not changed afterwards.
- 403 Forbidden: the web's answer meaning "you are not allowed".
- 200 OK: the web's answer meaning "done, it worked".