Fail-Open Refund Check
Make the risk check fail, and the refund pays out.
What Is Fail-Open Refund Check?
A refund endpoint runs its risk check inside a try/catch, and the catch approves the refund when the check throws. That makes it a fail-open error-handling flaw: the one control that stops fraud is skipped exactly when it cannot run. You'll send one malformed field to make the check throw, watch a declined refund pay out, and read the raw error the response leaks. Then you make the handler fail closed: refuse on a failed check, log the error for on-call, and return a generic error with no internal detail.
What You'll Learn in Fail-Open Refund Check
- Recognize a fail-open flaw: a security check that approves when it errors instead of refusing
- Make a risk check throw with one malformed field and watch the control be skipped
- Explain why echoing a raw exception leaks the internal host and the trigger to an attacker
- Rewrite the error path to fail closed: refuse, log for on-call, return a generic error
- Distinguish failing closed from input validation, which blocks one input but not every failure
Fail-Open Refund Check — Training Steps
-
Read the refunds docs
Tollvane publishes its refunds API endpoint for integrators. Every refund is scored by a risk service before any money moves. Bob reads the docs to see what stands between a refund request and a payout.
-
The one check in the way
One paragraph tells Bob what he has to get past.
-
A normal refund request
First, a clean request so Bob sees the check working. He asks for a refund on an order the risk service will not like.
-
The check does its job
With a well-formed request, the risk service runs and declines it.
-
Make the check fail
Bob changes one thing: he sends amount as a string instead of a number. The risk service expects a number, so scoring the request throws before it can reach a decision.
-
Approved for free
The same refund the check declined a moment ago is now approved and paid, because the check never finished. The endpoint failed open: when it could not get a risk decision, it let the refund through.
-
Knowledge check
-
The finance alert
You own Tollvane's refunds service. Finance flagged a run of refunds that paid out with no risk decision recorded against them. Security operations traced the cause and emailed you.
-
How often has this happened
Before touching the code, see the blast radius. The refund log records every time the risk check was skipped and the refund approved anyway.
-
Open the refund handler
Open the refund handler and look at how it treats a failed risk check.
Security Framework Coverage
OWASP Top 10
- A10:2025 Mishandling of Exceptional Conditions
OWASP ASVS
- V16.5.3 Error Handling
- V16.5.1 Error Handling
CWE
- CWE-636 Not Failing Securely ('Failing Open')
- CWE-755 Improper Handling of Exceptional Conditions
- CWE-209 Generation of Error Message Containing Sensitive Information
CIS Controls
- CIS 16 Application Software Security
NIST CSF
- PR.AT-02 Individuals in specialized roles are provided with awareness and training so that they possess the knowledge and skills to perform relevant tasks with cybersecurity risks in mind
- PR.PS Platform Security
NICE Framework
- DD-WRL-003 Secure Software Development