What are Business Logic Flaws?
Business logic is essentially the blueprint for how an application works. It dictates how data is handled and stored, how workflows operate, and how the application actually works as a whole. This logic is decided prior to development and forms almost a foundational pillar for the application.
Business logic flaws (also referred to as logic flaws or application logic flaws) occur when these rules are not properly configured or enforced. They tend to arise due to oversights on the design stage of development, resulting in gaps in the application’s logic that attackers can exploit by forcing unintended outcomes, manipulating the application rules to force entry into a system, or instigating attacks.
Business Logic Flaws and Their Impact
These vulnerabilities arise from flaws or inconsistencies with the development teams’ logic during the development of software. While the name doesn’t sound particularly threatening, it can end up causing quite serious security risks which can compromise your data, your revenue, and ultimately your business’ reputation. While this sounds straightforward enough, finding these flaws is a whole other problem in and of itself.
Software development has an on-demand culture where updates, patches, and new releases are expected by consumers rather quickly, with most developers in a company working to two-week sprints. This drive to get things out as fast as possible means there’s a lot of room for error and missed vulnerabilities and business logic flaws are one of them.
The 8th Annual Hacker-Powered Security Report 2024/2025 from Hacker One has found that business logic flaws are ranked within the top 10 most common vulnerabilities – totalling 2%. This is a 5% year-over-year increase from the previous year, indicating that these flaws are becoming more of a common occurrence. What was also interesting to note from the report is that the crypto and blockchain industries had the highest rate of business logic flaws compared to other industries – with an eye-watering increase of 37% from 2023.
So, what are some of the most common business logic flaws we’re seeing today?
Top 5 Business Logic Flaws
Some of the most common and complex business logic flaws include:
1. Inconsistent Input Validation
Input validation flaws happen when rules for validating input data vary across an application. When this occurs, applications fail to validate user input, meaning that certain and targeted data inputs can bypass critical business rules or even security checks. An attacker could purchase an item for the wrong price, by entering in an input for either zero or a negative value.
2. Failure to handle unconventional outputs
A core goal of application logic is to make sure user input is restricted to rules that align with the business. Applications can be designed to accept arbitrary values of certain data types, but the logic would determine whether or not this would be in line with business rules. So, when it comes to creating rules, developers need to envision literally every scenario possible and then figure out how to resolve these potential unconventional outputs. No logic to handle a scenario? That means that there is a potential vulnerability to be exploited.
What would this look like IRL? An online shop could use a third-party payment application to handle the payment side of the business. Once a purchase has been successful, the third-party app sends an HTTP request to the shop’s server, letting it know if the payment was successful or not.
Problems happen when the logic doesn’t account for unconventional outputs. An unconventional output for this could be an empty or malformed response. Another could be if the transaction didn’t go the way it should have done, such as “pending” if the shopper’s bank hasn’t approved the payment or the purchase was cancelled immediately and a refund was issued. An attacker could begin purchase but then intercept the HTTP request and modify the response so the process was classed as a refund. The server would fail to validate the status properly and assume, incorrectly, that the transaction was successful and the attacker had paid, meaning the business suffers a loss and the attacker gets free merch.
3. Authorisation Bypasses
Authentication and authorisation have become core tenets of cybersecurity, with constant conversation circling around who has what level of access and to what, and what authentication is needed to ensure that the right person has the right access to the right application.
However, lack of oversight or consideration when it comes to developing access controls can lead to potential logic flaws occurring. When this happens, attackers can find weaknesses in a company’s access controls and bypass login steps or even manipulate the role of a user in order to gain access to information.
In practice, a threat actor could bypass two-factor authentication (2FA) if this is not configured correctly. A platform could have 2FA but if it does not enforce correct server-side checks to actually verify this authentication, then the attacker could manipulate client-side information or API requests and bypass this process. It is imperative to make sure that all access controls are developed and configured correctly, as having 2FA is there to ensure information is secure. If it’s not configured correctly and is easily bypassed, then it defeats the purpose of having it in the first place.
4. Manipulation of Workflow
Workflow manipulation isn’t always necessarily a bad thing. Sometimes it's necessary to make sure that data is actually imported and exported to where it should be. However, in this context with flawed logic, threat actors would be able to exploit loopholes and manipulate workflows in order to bypass certain steps or alter input data to allow them to achieve unauthorised actions.
An example would be a threat actor manipulating client-side data in order to avoid paying for products and receiving them anyway, changing product quantities for discounts, and even changing the value of a transaction. Another example would be an attacker adding parameters to a request in order to trick a system into thinking certain preconditions have been met such as payment verification steps or order confirmations.
5. Domain-specific Flaws
Domain-specific flaws are a business logic issue that is a vulnerability within an application’s design and implementation that is unique to the domain or industry the application is a part of. For example, an online shop could have a flaw that means that the application can’t validate discounts. This means that if spotted by a user, they could apply multiple discounts and either get a product for free or far below what is a reasonable price.
Interested in learning more? Head to our other blog on business logic flaws and how they impact application security here.
Detecting and Preventing Business Logic Flaws
All these flaws have the potential to cause security risks and the above five are only just the tip of the iceberg. The chances of having some in your software depends on your circumstances, but it’s worth pointing out that these can be quite critical when it comes to real-life consequences – especially as they’re strongly tied to a company’s process.
Fixing Business Logic Vulnerabilities
Fixing business logic vulnerabilities usually needs a deep understanding of a system and the application it is effectively, as well as user behaviour and the business’ goals. Once a flaw has been identified, flaws need to be fixed by applying stronger input validations, access controls, and flows for error-handling. Applying a standardised logic across the company helps it happen in the future.
There are a few key ways to find and fix business logic vulnerabilities as well as mitigate any potential damage, which include performing regular risk assessments and conducting regular code reviews. Teams should also be mindful to implement state checks, logical flow controls, and comprehensive input validation.
Prevention
They say prevention is the best type of medicine and, while it’s probably true, it’s not realistic. There are plenty of safeguards, though, which you can and should do, and companies should always adhere to best practices. Developers should understand domains inside and out and should be aware of making assumptions about user behaviour. Product teams should also make sure that developers actually get tickets with enough context and instructions in. Security teams should also prioritise educating developers and assist them with information to help developers succeed.. Careful consideration needs to go into development.
But with all that said and done, these vulnerabilities still happen. So, how do you find them?
Detecting Business Logic Flaws with Cytix
Finding business logic flaws isn’t easy. Automated scanners won’t pick them up because there’s nothing inherently wrong with the code. The alternative would be a pen test, which happens once or twice a year for most organisations. This means that a business logic flaw could be bleeding your data and your revenue out and you wouldn’t even know until the next pen test – which could be 11 months away.
“Then what’s the alternative?” we hear you cry.
At Cytix, we help companies achieve true continuous security testing. How? By using live development changes and using LLMs and human intelligence to determine whether or not these changes would create a vulnerability. After reporting back to your team about exactly where we think a vulnerability – including those pesky business logic flaws – could happen within your software, Cytix determines with prioritised testing plans when and where to test. We cut the time, the overhead, and the noise so your team can find vulnerabilities faster.
Business logic flaws are some of the hardest to spot vulnerabilities, but they don’t have to be. Find out more about our solution by scheduling a demo with us today.