Skip to content
UI spoofing Write-up Beginner

I Tried to Hack a Small Web Store. The Vulnerability Wasn’t SQL Injection

Armando Peña Tamayo Follow

Published on medium.com

When most people picture a hacked online store, they imagine SQL injection through a login form. My most recent authorized audit looked nothing like that.

Armando Peña Tamayo, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

The target was a small e-commerce store: a catalogue, product pages, a cart, URLs for sharing carts, and contact buttons. It ran on Vercel. The audit was authorised.

The first impression was that the site was built with Next.js. That impression was wrong: the reality check came fast and the application turned out to be a React + Vite single-page application. That initial misread shaped the entire approach, and it is exactly the kind of detail that matters in a real engagement.

The defining shift behind the work is to stop asking "how do I protect an application?" and start asking "how can I break it?" With an authorised target, the researcher got to find out.

Photo by Kevin Ku on Unsplash From the original on medium.com

Setup

The engagement started from the domain only. The reconnaissance covered robots.txt, sitemap.xml, routes and parameters, product and cart flows, and HTTP headers. No accounts, roles or tool versions are described beyond that; the only tool explicitly named is curl, used with -I to read response headers.

The precondition that shaped everything else was architectural: the application had practically no API of its own, no server and no database. The researcher expected /api/products and /api/cart, and they didn't exist.

Finding it

Reconnaissance

The boring part produced nothing. Checking robots.txt, sitemap.xml, routes and parameters, product and cart flows, and HTTP headers gave zero findings: no magic /admin endpoint, nothing hiding in the sitemap.

Where's the server?

The expected API endpoints, /api/products and /api/cart, did not exist. This is the first rule of the job in action: architecture is the attack surface. No server means no SQLi, no authentication bypass, and no server-side HTML injection to hunt. When you cannot attack an API, you attack the application's assumptions.

What if I change the ID?

Walking product URLs by incrementing the identifier, /producto/1 then /producto/2 then /producto/3, and so on, revealed that products which appeared as sold out were reachable by changing the ID inside certain flows.

The researcher is careful with the label. This is not classic IDOR, because IDOR implies a server protecting a resource and there is no server in play. The honest classification is identifier manipulation plus insufficient business-logic validation. Classifying findings correctly is part of the security work, not a footnote.

The cart

The URLs used to share carts could be tampered with to introduce sold-out products. The logic happily accepted states the owner never intended: a stock state the business had explicitly ruled out.

Headers

Reading the response headers with curl -I showed no X-Frame-Options and no Content-Security-Policy: frame-ancestors. The entire application could load inside an <iframe>.

Exploitation

Step 1: confirm the missing framing defences

Bash
curl -I

The header check showed no X-Frame-Options and no CSP frame-ancestors directive.

Step 2: prove the store is embeddable

The clickjacking proof of concept is embarrassingly short:

HTML
<iframe src="https://TARGET"></iframe>

It loaded. The store was embeddable.

Step 3: combine the tampered cart with the frame

An external page loads a tampered cart URL inside an iframe, with the attacker's own visual elements layered on top. The visitor sees the real store through a third-party frame that controls what happens around it.

Root cause

Two separate weaknesses, both in the application's assumptions rather than in a server:

  1. Business logic trusted client-supplied state. Product identifiers and shared-cart URLs were accepted as given, so a sold-out product could be reached by changing an ID or by editing a cart-sharing URL. With no backend, there was no server-side availability check to fall back on.
  2. No framing controls. The absence of X-Frame-Options and of a CSP frame-ancestors directive left the whole application embeddable, which is what made the combined attack possible.

Reconnaissance found no hidden endpoints or sitemap entries, and the response headers contained nothing that restricted framing.

Impact

Not obtained: passwords, remote code execution, server access, the database, control of the application.

Demonstrated: state manipulation, a manipulable cart, an embeddable application, and the combination of all three.

The business concern is where engineering turns into money. A well-crafted "promotion" link lands on a third-party page that renders the legitimate store inside it. The customer believes they are buying from the store. The realistic outcomes are confusion over prices and availability, loss of trust, visual impersonation, and complaints that land on a business that did nothing wrong.

Fix

The patch has two parts:

  • Clickjacking: X-Frame-Options: DENY or CSP frame-ancestors 'none'.
  • Business logic: stop trusting client data, and validate availability on every flow.

Verification

After the fix the researcher retried the attack. The iframe no longer loads. Not "I think it's fixed": the attack was tried again and no longer worked.

Variants to test

  1. Increment product identifiers in every flow. Walk /producto/1, /producto/2, /producto/3 and so on, including inside cart flows. A positive result is a product shown as sold out that is reachable by changing the ID.
  2. Tamper with shared-cart URLs. Edit the identifiers inside a cart-sharing link to reference sold-out products. A positive result is a cart that accepts the state the business explicitly ruled out.
  3. Check framing headers on every response. Look for X-Frame-Options and Content-Security-Policy: frame-ancestors. A positive result is a response with neither, followed by an <iframe> that loads the target.
  4. Combine the two. Load a tampered cart URL inside an iframe with your own visual elements on top. A positive result is the real store rendering inside a third-party page whose surrounding content you control.
  5. Confirm the stack before choosing an approach. A site that looks like Next.js may be a React + Vite SPA with no API at all. A positive result is the absence of the expected /api/... endpoints, which redirects the audit towards business logic and client-side assumptions.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

A security researcher was given permission to test a small online shop. The shop sells products through a catalogue, product pages, a shopping cart, and links you can share so someone else can see your cart. It also has contact buttons. The whole thing was hosted on Vercel, a service that puts websites online.

Most people picture the classic kind of break-in: a login form that lets you sneak database commands in, known as SQL injection. That is not what happened. The shop had almost no server behind it, so there was nothing on the server side to attack. The weaknesses were in the assumptions the shop made about how people would use it.

The most useful mindset change in the whole exercise is this: stop asking "how do I protect this application?" and start asking "how can I break it?" Because the test was authorised, the researcher could actually try.

Photo by Kevin Ku on Unsplash From the original on medium.com

The setup

The target was a small e-commerce store: a catalogue, product pages, a cart, URLs for sharing carts, and contact buttons. It ran on Vercel. The audit was authorised.

A few of those words deserve a plain explanation before we go further.

  • E-commerce store: a website that sells things. The catalogue is the list of products, a product page shows one product, and the cart is the basket you fill before paying.
  • Cart-sharing URL: a web address that, when opened, shows someone else the contents of a cart. Think of it like a link to a shared shopping list rather than a link to a single product.
  • Vercel: a hosting company. You give it your website files and it serves them to visitors. It is not the same as running your own server machine.
  • Authorised audit: the person testing has written permission from the owner. Without that permission, the same actions would be a crime in most countries.

The first impression was that the site was built with Next.js. That impression was wrong: the reality check came fast and the application turned out to be a React + Vite single-page application. That initial misread shaped the entire approach, and it is exactly the kind of detail that matters in a real engagement.

What are those two things?

  • Next.js is a toolkit for building websites with React. It often comes with a server part that runs on the hosting provider, so a Next.js site frequently has hidden endpoints that answer requests.
  • React is a library for building the visible parts of a web page out of reusable pieces. Vite is a tool that bundles those pieces into files a browser can load quickly.
  • A single-page application (SPA) is a website where the browser downloads one bundle of code and then draws every screen itself, without asking a server for a fresh page each time you click. Think of the difference between a printed book (each page is fetched) and an app on your phone (everything is already installed and the app just changes what it shows).

Why does the misread matter? Because if you believe a site is Next.js, you go looking for the server endpoints that Next.js usually brings. If it is actually a React + Vite SPA, those endpoints may simply not exist, and you have to change your plan. Getting the technology wrong at the start sends the whole audit down the wrong road.

Recon: the boring part

Reconnaissance (recon) means looking around before attacking: reading what the site publicly offers, without trying to break anything yet. It is the equivalent of walking around a building and noting the doors before you try any of them.

The researcher started from the domain only: robots.txt, sitemap.xml, routes and parameters, product and cart flows, HTTP headers.

  • Domain: the site's main address, for example example.com.
  • robots.txt: a small text file at the root of a site that tells search engines which pages they may crawl. Testers read it because it sometimes lists paths the owner would rather keep quiet.
  • sitemap.xml: a file that lists the site's pages for search engines. Same idea: it can reveal pages you would not otherwise guess.
  • Routes: the different addresses a site responds to, such as /producto/1 or /cart.
  • Parameters: the extra pieces at the end of an address after a ?, such as ?id=3, which pass values to the page.
  • HTTP headers: small labels the server sends alongside every page. They describe things like the content type and security rules. You will meet two of them later.

Findings: zero. No magic /admin endpoint, nothing hiding in the sitemap.

An /admin endpoint would be a page meant for staff. Finding one that is reachable without logging in is a common beginner's dream, and it is also why so many people check for it first. Here there was nothing.

"Where's the server?"

The researcher expected /api/products and /api/cart. They didn't exist. The application had practically no API of its own: a SPA with no server and no database.

  • An API is a way for one piece of software to ask another for data. On a shop, the page might ask an API "give me the list of products" and the API replies with a list. Think of it as a waiter: the page orders, the kitchen (the server) prepares, the waiter brings it back.
  • A server is a computer somewhere that answers those requests. A database is where the server keeps the data, such as products, prices and stock.
  • /api/products and /api/cart are the kind of addresses such an API usually lives at. Those addresses did not exist, because there was no kitchen at all.

This is the first rule of the job in action: architecture is the attack surface. No server means no SQLi, no authentication bypass, no server-side HTML injection to hunt. When you can't attack an API, you attack the application's assumptions.

Unpacking that sentence:

  • Architecture is how the pieces of a system are arranged: what runs in the browser, what runs on a server, what talks to a database.
  • The attack surface is the total set of places an attacker could try to interfere. A house with ten windows has a bigger attack surface than a house with one door.
  • SQL injection (SQLi) is when an attacker slips database commands into a form field so the database runs them. It needs a database and a server that builds queries carelessly. No database, no SQLi.
  • Authentication bypass means getting into an account or admin area without the right password. It needs a login system on a server. There wasn't one.
  • Server-side HTML injection means tricking a server into putting attacker-supplied HTML into a page it generates. Again, it needs a server generating pages.

So the researcher stopped looking for a server to break and started looking at what the application assumed about its users.

What if I change the ID?

/producto/1 → /producto/2 → /producto/3...

This is the simplest possible experiment. Each product page has a number in its address. The researcher changed the number by hand and watched what came back. It is the web equivalent of trying every key on a keyring to see which doors open.

Finding 1: identifier manipulation. Products that appeared as sold out were reachable by changing the ID inside certain flows.

  • An identifier (ID) is the number or code that names a specific item. Product 1, product 2, product 3.
  • Identifier manipulation means editing that number in the address to reach a different item than the one the page linked to.
  • Sold out means the shop has decided not to sell that item right now. The catalogue hides it or marks it unavailable.

The interesting part is not that product 2 exists. It is that a product the shop had marked as sold out could still be reached by typing its number. The shop's own rule ("do not sell this") was not enforced in certain flows.

Let me be careful with the label here. This is not classic IDOR. IDOR implies a server protecting a resource, and there's no server in play. The honest classification is identifier manipulation plus insufficient business-logic validation. Classifying findings correctly is part of the security work, not a footnote.

  • IDOR stands for Insecure Direct Object Reference. It means a server hands out a resource to anyone who guesses its identifier, without checking whether that person is allowed to see it. Picture a hotel where room 101 opens for anyone who says "101", because the reception desk never checks your key. Crucially, IDOR describes a failure of a server-side check.
  • Business logic is the set of rules the shop follows: what can be bought, in what quantity, at what price, and what happens when something is out of stock. These rules are not about passwords or encryption; they are about how the business works.
  • Business-logic validation means checking those rules at the moment they matter.

Why be so fussy about the name? Because the name tells the owner what to fix. If you call it IDOR, they will go looking for a broken permission check on a server that does not exist. If you call it identifier manipulation plus missing business-logic validation, they will look at the code that decides what is buyable, which is where the real problem is.

The cart

The URLs used to share carts could be tampered with to introduce sold-out products. The logic happily accepted states the owner never intended: a stock state the business had explicitly ruled out.

A cart-sharing URL is a link that opens a shared cart. The shop then reads the edited list and builds a cart from it. The logic accepted the state the business had explicitly ruled out.

Think of a restaurant where the order slip is written by the customer and the kitchen never checks the menu. If you write a dish that was taken off the menu, the kitchen still cooks it.

Headers

curl -I showed no X-Frame-Options and no Content-Security-Policy: frame-ancestors. The entire application could load inside a <iframe>.

  • curl is a command-line tool that fetches a web address and prints the response. It is useful because it shows you the raw reply, not the pretty page.
  • The -I option asks curl to fetch only the headers, not the page body. It is like asking for the envelope instead of the letter.
  • An <iframe> is an HTML element that places one web page inside another. Websites use it for embedded videos and maps. Attackers use it to put a victim's site inside their own page.
  • X-Frame-Options is a header that tells the browser whether the page may be shown inside an iframe. A value of DENY means never.
  • Content-Security-Policy (CSP) is a broader header that lists what a page is allowed to do. One of its directives, frame-ancestors, says which other sites may embed this page. frame-ancestors 'none' means nobody may.

Neither header was present. In plain terms, the shop never told browsers "do not put me in a frame", so browsers were free to do exactly that.

Clickjacking

Clickjacking is an attack where a victim site is loaded invisibly or misleadingly inside an attacker's page, and the visitor is tricked into interacting with the real site while thinking they are interacting with something else. The name comes from "click hijacking": your click is hijacked. A common comparison is a transparent sheet of glass placed over a cash machine keypad, with a fake keypad printed on it: you press what you think are the real buttons, but the presses land somewhere else.

The proof of concept is embarrassingly short:

HTML
<iframe src="https://TARGET"></iframe>

Line by line:

  • <iframe starts an iframe element.
  • src="https://TARGET" sets the address of the page to load inside the frame. TARGET is a placeholder for the real site address.
  • ></iframe> closes the element.

That is the whole attack page. If the shop loads inside that frame, the shop is embeddable, and an attacker can build a page around it.

It loaded. The store was embeddable.

The combined move

An external page that loads a tampered cart URL inside an iframe, with my own visual elements layered on top. The visitor sees the real store through a third-party frame that controls what happens around it.

Two separate weaknesses are now working together. The tampered cart URL puts a sold-out product into the cart. The iframe puts the real shop inside a page the attacker controls. The attacker can then draw buttons, prices or messages around the frame, and the visitor sees the genuine shop surrounded by the attacker's decorations. The shop itself is real; the context is not.

What I got, and what I didn't

Not obtained: passwords, remote code execution, server access, the database, control of the application.

  • Remote code execution (RCE) means running your own commands on the target's machine. It is the worst outcome in most engagements. It did not happen here.
  • Server access means getting a foothold on the machine that runs the site. There was no such machine to reach.
  • The database means the stored data behind the shop. There was none.
  • Control of the application means being able to change what the site does for everyone. That was not achieved either.

Demonstrated: state manipulation, a manipulable cart, an embeddable application, and the combination of all three.

  • State is the current situation of something: which products are in the cart, whether an item is in stock, what the page is showing. State manipulation means changing that situation in a way the owner did not intend.
  • Manipulable cart means a cart whose contents can be altered by editing a link rather than by clicking in the shop.
  • Embeddable application means the site can be placed inside another page's frame.

Saying clearly what was not achieved is part of honest reporting. It stops the owner panicking about a data breach that never happened, and it stops the researcher overstating the result.

Why a business should care

This is where engineering turns into money. A well-crafted "promotion" link lands on a third-party page that renders the legitimate store inside it. The customer believes they are buying from the store. The realistic outcomes: confusion over prices and availability, loss of trust, visual impersonation, and complaints that land on a business that did nothing wrong.

  • Visual impersonation means an attacker's page looks like the real brand, using the real site inside a frame plus their own styling around it.
  • Loss of trust is the business consequence: customers who feel tricked stop buying, even if the shop itself was never breached.

Notice that no password was stolen and no database was read, yet the business still has a problem. Security is not only about secrets; it is also about whether customers can trust what they see.

The role of AI in the audit

I used an assistant as a second opinion. It correctly identified the React + Vite stack, the absence of a server/database/auth, and rough version ranges. But the question that mattered was human:

The AI: "What problems could this code have?" Me: "What happens if I use this functionality in a way the developer never expected?"

  • Stack means the collection of technologies a site is built from: here, React and Vite.
  • Auth is short for authentication, the login system.
  • Version ranges are approximate version numbers of the software in use. Knowing them helps you look up known bugs, but only if the software is actually there.

The AI was useful for identifying what was on the page. It was not useful for asking the question that found the bugs, because that question is about intent and expectation, not about matching known patterns.

The patch

The patch has two parts:

  • Clickjacking: X-Frame-Options: DENY or CSP frame-ancestors 'none'.

  • Business logic: stop trusting client data, and validate availability on every flow.

  • A patch is a change to the code or configuration that closes the weakness.

  • Client data is anything the browser sends: addresses, parameters, cart contents. The rule is that the browser is under the visitor's control, so anything it sends can be edited. The shop must check it again on its own side, or at least in code the visitor cannot rewrite.

  • Validate availability on every flow means: wherever a product can enter a cart, check whether it is actually for sale, not just on the product page.

The first fix stops the shop being framed at all. The second fix stops a sold-out product entering a cart, whether through an edited ID or an edited sharing link.

Verification

After the fix I retried the attack. The iframe no longer loads. Not "I think it's fixed": I tried again and it no longer works.

Verification is a step people skip. A fix that has not been retested is a hope, not a result. The researcher retried the attack and the iframe no longer loaded.

What I learned

  1. Architecture matters. React + Vite is not the same attack surface as frontend + API + backend + database, even if the customer sees the same shop.
  2. Business logic is hard to automate. No scanner in the world will ask "should I be able to put a sold-out product into the cart?"
  3. Attacks begin with tiny questions. What happens if I change this ID? This URL? This iframe? And what happens if I combine them?

A scanner is an automated tool that tries thousands of known problems against a site. Scanners are good at matching patterns they have seen before. They are bad at asking whether a rule makes sense, because that requires understanding the business.

Variants to test

These are the same ideas written as a checklist, so someone else can repeat the work on a similar shop.

  1. Increment product identifiers in every flow. Walk /producto/1, /producto/2, /producto/3 and so on, including inside cart flows. A positive result is a product shown as sold out that is reachable by changing the ID.
  2. Tamper with shared-cart URLs. Edit the identifiers inside a cart-sharing link to reference sold-out products. A positive result is a cart that accepts the state the business explicitly ruled out.
  3. Check framing headers on every response. Look for X-Frame-Options and Content-Security-Policy: frame-ancestors. A positive result is a response with neither, followed by an <iframe> that loads the target.
  4. Combine the two. Load a tampered cart URL inside an iframe with your own visual elements on top. A positive result is the real store rendering inside a third-party page whose surrounding content you control.
  5. Confirm the stack before choosing an approach. A site that looks like Next.js may be a React + Vite SPA with no API at all. A positive result is the absence of the expected /api/... endpoints, which redirects the audit towards business logic and client-side assumptions.

Epilogue

I'm a developer learning red teaming. The shift is small and brutal:

Developer: "How do I make this work?" Attacker: "What happens if I make it work in a way nobody expected?" Beneath it all:"What is this developer taking for granted?"*

  • Red teaming is the practice of testing systems by thinking like an attacker, with permission.
  • Taking for granted is the key phrase. Every bug in this story came from something the developer assumed would always be true: that visitors would only use the links the shop provided, that sold-out products would stay hidden, that nobody would put the shop inside another page.

Glossary

  • API: a way for one piece of software to ask another for data, like a waiter carrying orders between a page and a server.
  • Attack surface: the total set of places an attacker could try to interfere with a system.
  • Authentication: the process of proving who you are, usually with a password.
  • Authentication bypass: getting into an account or admin area without the right credentials.
  • Authorised audit: security testing done with written permission from the owner.
  • Business logic: the rules a business follows, such as what can be bought and when something is out of stock.
  • Business-logic validation: checking those rules at the moment they matter, rather than assuming the browser already did.
  • Cart: the basket of products a visitor intends to buy.
  • Cart-sharing URL: a web address that carries a cart's contents so it can be shared with someone else.
  • Clickjacking: tricking a visitor into interacting with a real site embedded misleadingly inside an attacker's page.
  • Client data: anything the browser sends to a site, which the visitor can edit.
  • Content-Security-Policy (CSP): a response header listing what a page is allowed to do, including which sites may embed it.
  • curl: a command-line tool that fetches a web address and prints the response.
  • curl -I: the option that fetches only the response headers, not the page body.
  • Database: where a server stores data such as products, prices and stock.
  • Domain: the main address of a website, such as example.com.
  • E-commerce store: a website that sells products.
  • Embeddable: able to be placed inside another page's frame.
  • frame-ancestors: the CSP directive that says which sites may embed a page.
  • HTTP headers: small labels sent alongside a web response that describe the content and its security rules.
  • Identifier (ID): the number or code that names a specific item, such as a product.
  • Identifier manipulation: editing an identifier in an address to reach a different item than the page linked to.
  • IDOR: Insecure Direct Object Reference, where a server hands out a resource to anyone who guesses its identifier without checking permission.
  • <iframe>: an HTML element that places one web page inside another.
  • Next.js: a toolkit for building React websites, often with a server part.
  • Parameter: an extra value at the end of an address after a ?, passed to the page.
  • Patch: a change to code or configuration that closes a weakness.
  • React: a library for building the visible parts of a web page from reusable pieces.
  • Reconnaissance (recon): looking around a target before attacking, to learn what it offers.
  • Red teaming: testing systems by thinking like an attacker, with permission.
  • Remote code execution (RCE): running your own commands on the target's machine.
  • robots.txt: a file telling search engines which pages they may crawl, sometimes revealing hidden paths.
  • Route: an address a site responds to, such as /producto/1.
  • Scanner: an automated tool that tries many known problems against a site.
  • Server: a computer that answers requests from browsers.
  • Server-side HTML injection: tricking a server into putting attacker-supplied HTML into a page it generates.
  • Single-page application (SPA): a site where the browser downloads one bundle of code and draws every screen itself.
  • sitemap.xml: a file listing a site's pages for search engines.
  • Sold out: an item the shop has decided not to sell right now.
  • SQL injection (SQLi): slipping database commands into input so the database runs them.
  • Stack: the collection of technologies a site is built from.
  • State: the current situation of something, such as what is in a cart or whether an item is in stock.
  • State manipulation: changing that situation in a way the owner did not intend.
  • Vercel: a hosting company that serves website files to visitors.
  • Version range: an approximate version number of software in use.
  • Vite: a tool that bundles a site's code into files a browser can load quickly.
  • Visual impersonation: making an attacker's page look like the real brand.
  • X-Frame-Options: a response header telling the browser whether a page may be shown inside an iframe.

Similar reports

View all

Same bug class and techniques, clearest first.

Clickjacking and UI spoofing

The lesson behind this report.

The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.