Business logic vulnerabilities
Business logic and logic flaws
Business logic refers to the set of rules that define how the application operates. These rules aren't directly related to a business domain in this context — they are the rules governing workflows, validation, and how different parts of an application interact.
Logic flaws are vulnerabilities that occur when users misuse the application or when developers make flawed assumptions about user behavior or application state. These vulnerabilities:
Arise due to flawed assumptions about user behaviors or how components interact.
Involve manipulating legitimate functionality rather than exploiting memory bugs or injections.
Typically require human understanding of the application's workflows to detect and exploit.
Are generally not detected by automated scanners — they are a great target for bug bounty hunters and manual testers.
Examples of logic-flaw behavior:
Completing a transaction without following the intended purchase workflow.
Passing unexpected values into server-side logic.
How business logic vulnerabilities arise
Design and development teams make flawed assumptions about how users interact with the app.
These assumptions lead to inadequate server-side validation or the assumption that input is only supplied via a browser.
Relying entirely on weak client-side controls allows attackers to bypass validations using intercepting proxies (e.g., Burp, ZAP).
Complex systems with many interacting features are more likely to contain logic flaws — an attacker often needs to understand the whole application to combine functions in unexpected ways.
Incorrect assumptions about how other components behave can open exploitable paths.
Impact
They increase the attack surface for other exploits.
They can lead to stolen funds, fraud, unauthorized access, or other business-impacting events.
Examples and labs
Learn from real-world cases and hands-on labs. Each lab below is presented as a stepper (Vulnerability → End goal → Analysis → Payload).
Excessive trust in client-side controls
Analysis
Use Burp while logging in and attempt to buy the leather jacket. The order is rejected due to insufficient store credit.
Inspect HTTP history and study the order process.
Add an item to the cart and observe a price parameter in
POST /cart.Send the request to Repeater, change the price, and resend.
Refresh the cart to confirm the price change.
Repeat to any amount less than available credit.
2FA broken logic
Analysis
Access the email server to receive 2FA code for wiener.
Login and investigate the 2FA verification process.
Observe
POST /login2uses averifyparameter to determine which user is being accessed.Send
GET /login2to Repeater and changeverifytocarlosto generate a temporary 2FA code for carlos.Submit an invalid 2FA code in the login page, then use Burp Intruder on
POST /login2, setverify=carlos, and brute-force themfa-codeparameter.Load the 302 response in the browser and navigate to My account to solve the lab.
Failing to handle unconventional input
Context: If developers don't code for edge cases (e.g., negative quantities), unexpected behavior can occur. Example PHP logic that only checks numeric comparison:
If an attacker sends -1000, the logic may incorrectly approve the transfer.
High-level logic vulnerability
Analysis
Run Burp, log in and add a cheap item to the cart.
Inspect
POST /cartand noticequantityparameter.Intercept and forward the request, change
quantityto an arbitrary integer.Update cart quantities: select a high-price and a low-price item.
Use negative quantity for the lower-priced item; total price decreases (negative amount).
Repeat to manipulate total to desired value (stay above $0 to mimic normal purchase).
Place the order to solve the lab.
Low-level logic flaw
Analysis
With Burp, attempt to buy the jacket; rejected due to insufficient credit.
Send
POST /cartto Repeater; note only 2-digit quantity allowed per request.Send request to Intruder, set the quantity parameter to 99 as a position.
Use Null payloads with "Continue indefinitely" to increment quantity in many requests.
As attack runs, refresh the cart page and observe price wrapping once integer max is exceeded.
Generate enough payloads (e.g., 323) and use resource pool (max concurrent = 1).
After attack, send a single
POST /cartwith 47 jackets; total becomes a large negative value.Add another item so price falls between $0 and $100; place order to solve lab.
Inconsistent handling of exceptional input
Analysis
Use Burp's content discovery to find
/admin./adminis restricted toDontWannacryusers.On registration, use an email at
@YOUR-EMAIL-ID.web-security-academy.netwith a very-long-string (≥200 chars). Confirm and check the confirmation email.Observe the stored email is truncated to 255 characters.
Register again with
very-long-string@dontwannacry.com.YOUR-EMAIL-ID.web-security-academy.netand craft the string so themindontwannacry.comends at character 255.Confirm registration via the email link and log in — you now have admin access due to truncation logic.
Making flawed assumptions about user behavior
Trusted users may become untrusted or lose privileges.
Business and security controls must be applied consistently across the application.
Inconsistent security controls
Users won't always supply mandatory input
Browsers may prevent missing inputs, but attackers can tamper with parameters in transit.
Presence/absence of a parameter can cause application to execute different code paths.
Try removing parameters, deleting names and values, or changing cookies and following multi-stage workflows to observe effects.
Weak isolation on dual-use endpoint
Analysis
Log in and change your password while proxying with Burp.
Send
POST /my-account/change-passwordto Repeater and remove thecurrent-passwordparameter entirely.Observe you can change the password without supplying the current one.
The target user is determined by the
usernameparameter. Setusername=administratorand resend.Logout and log in as administrator using the new password.
Password reset broken logic
Analysis
Use the "Forgot your password" flow and inspect the reset email: token is included as a URL query parameter.
When submitting new password (
POST /forgot-password?temp-forgot-password-token), the username is a hidden input.Send the request to Repeater and delete the token value in both the URL and body — the reset still works, showing token isn't verified on submission.
Request a new reset, send the
POSTto Repeater, delete the token, changeusernametocarlos, set a new password, and submit.Login as Carlos using the new password.
Users won't always follow the intended sequence
Applications assume users follow predefined workflows; skipping steps or reordering can open vulnerabilities (e.g., 2FA bypasses).
2FA simple bypass
Making assumptions about the sequence of events
Use an intercepting proxy (Burp) to forward, drop, or replay requests out-of-order to force the application into unexpected states.
Insufficient workflow validation
Analysis
Log in and buy a cheap item you can afford.
Observe
POST /cart/checkoutredirects to an order confirmation page.Send
GET /cart/order-confirmation?order-confirmation=trueto Repeater and add the leather jacket to the basket.Resend the order confirmation request in Repeater; observe the order completes without deducting cost from store credit.
Authentication bypass via flawed state machine
Analysis
Complete login where you must select a role before reaching home.
Identify
/adminvia content discovery.Intercept and forward
POST /login; the next request isGET /role-selector. Drop this role-selector request.Visit the home page — role defaults to
administrator.Access
/adminand delete carlos.
Domain-specific flaws
Flaws tied to the domain/purpose of the site (e.g., discount logic, coupon stacking, gift cards).
Watch for any situation where prices or sensitive values are adjusted or computed.
Flawed enforcement of business rules
Infinite money logic flaw (gift card automation)
Analysis
Sign up for newsletter to get
SIGNUP30.Buy a $10 gift card, add to basket, and apply coupon to get discount.
Redeem the gift card on My account to add $3 credit (example).
Use Burp's macro and session handling to automate the sequence:
Create a macro encompassing requests:
POST /cart,POST /cart/coupon,POST /cart/checkout,GET /cart/order-confirmation?order-confirmed=true,POST /gift-card.Configure macro to extract the generated gift card code from the order confirmation and feed it into
POST /gift-card.Test macro, then send
GET /my-accountto Intruder using Null payloads (generate many payloads) and a resource pool with max concurrent = 1 to automate many redemptions.
This yields many small credits that sum to a large balance.
Providing an encryption oracle
When user-controlled input is encrypted and the ciphertext is exposed to users, the site provides an "encryption oracle." An attacker can use it to create valid encrypted inputs and potentially decrypt values by using application behavior — enabling privilege escalation or forging authenticated cookies.
Authentication bypass via encryption oracle
Analysis
Log in with "stay logged in" enabled and post a comment. Study the requests/responses.
Observe
stay-logged-incookie is encrypted.Submit a comment with an invalid email; the response sets an encrypted
notificationcookie and reflectsinvalid email address: your-invalid-emailin the error.Use the application to (a) encrypt arbitrary input via the
POST /post/commentrequest (obtain a correspondingnotificationcookie), and (b) use the endpoint that reflects input (with thenotificationcookie) to decrypt arbitrary ciphertext.In Repeater, use one request named
encryptand one nameddecrypt. Useencryptto get ciphertext foradministrator:timestampanddecryptto reveal decrypted plaintext.Remove the
invalid email address:prefix by editing ciphertext in Burp Decoder and Repeater (careful block-based encryption/padding).Adjust prefix length and padding so deleting bytes aligns to 16-byte blocks.
Replace
stay-logged-incookie with your crafted ciphertext and send request: you become administrator.Visit
/admin/delete?username=carlosto solve the lab.
How to prevent business logic vulnerabilities
Understand the application domain thoroughly — developers and testers should know how the app is supposed to behave.
Avoid implicit assumptions about user behavior or the behavior of other components.
Apply consistent business rules and security controls across the application.
Perform robust server-side validation (do not rely on client-side checks).
Write clear, maintainable code so intended behavior and checks are obvious.
Model workflows and edge cases, and create tests for unconventional inputs, sequence deviations, and multi-component interactions.
Conduct manual security testing with an understanding of the domain, and incorporate threat modeling focused on logic flaws.
Last updated