feat: added tests for multiple coupon redemptions and ratings race condition - #302
feat: added tests for multiple coupon redemptions and ratings race condition#302Kaustavoffx wants to merge 2 commits into
Conversation
…st to detect multiple ratings via race condition (akto-api-security#174) Introduced a new test for multiple ratings submission via race condition, assessing if an attacker can exploit concurrency issues to submit multiple ratings.
There was a problem hiding this comment.
Pull request overview
Adds two new Akto test definitions intended to detect race-condition vulnerabilities that allow repeated coupon redemption and repeated ratings/likes submissions.
Changes:
- Introduces a new BOLA test for detecting multiple coupon redemptions via race conditions.
- Introduces a new (currently miscategorized) test for detecting multiple ratings/likes submissions via race conditions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| Broken-Object-Level-Authorization/coupon_race_condition.yaml | New test template targeting concurrent coupon redemption behavior. |
| Broken-Function-Level-Authorization/multiple_ratings_race_condition.yaml | New test template targeting concurrent ratings/likes submission behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: BOLA | ||
| shortName: BOLA | ||
| displayName: Business Logic | ||
| subCategory: MULTIPLE_RATINGS |
There was a problem hiding this comment.
subCategory should match the test id (convention used across the repo, e.g. BFLAwithGETMethod.yml:15). Here id is MULTIPLE_RATINGS_RACE_CONDITION but subCategory is MULTIPLE_RATINGS, which can break lookups/deduping. Rename subCategory to MULTIPLE_RATINGS_RACE_CONDITION.
| subCategory: MULTIPLE_RATINGS | |
| subCategory: MULTIPLE_RATINGS_RACE_CONDITION |
| gte: 200 | ||
| lt: 300 | ||
| method: | ||
| neq: "GET" |
There was a problem hiding this comment.
api_selection_filters.method uses neq: "GET", which will still include OPTIONS endpoints (commonly 204/2xx) and can cause this test to run against preflight routes that don't accept bodies/ratings. In this repo, tests consistently exclude OPTIONS (e.g. BFLAwithGETMethod.yml:40-43). Consider changing this filter to exclude OPTIONS (and optionally exclude GET as well if needed).
| neq: "GET" | |
| not_in: | |
| - "GET" | |
| - "OPTIONS" |
| execute: | ||
| type: single | ||
| requests: | ||
| - req: | ||
| - modify_body_param: | ||
| couponParam: "AKTO_FREE_100" | ||
| - req: | ||
| - modify_body_param: | ||
| couponParam: "AKTO_FREE_100" | ||
|
|
There was a problem hiding this comment.
execute.type is single but requests contains multiple req entries. In this repo, type: single tests use exactly one request, and multiple requests are modeled with type: multiple (see BFLAInsertAdminURLPaths.yml:56-76). If the intent is to fire multiple requests for a race-condition simulation, please switch to the supported execution type for multiple requests (or confirm the engine supports multiple req blocks under single).
| gte: 200 | ||
| lt: 300 | ||
| method: | ||
| neq: "GET" |
There was a problem hiding this comment.
api_selection_filters.method uses neq: "GET", which will still allow OPTIONS (commonly 2xx/204) and can cause this test to be selected for preflight routes where modifying the body doesn’t apply. Other BOLA templates exclude OPTIONS (e.g. AddUserId.yaml:46-48). Consider excluding OPTIONS (and, if desired, also excluding GET).
| neq: "GET" | |
| regex: "^(?!(GET|OPTIONS)$).+" |
| - Business Logic | ||
| - OWASP API3 | ||
| - E-commerce | ||
| - Race Condition |
There was a problem hiding this comment.
The info section is missing standard metadata that all other BOLA tests include (references, cwe, cve, and attributes; see Broken-Object-Level-Authorization/AddUserId.yaml:20-37). Adding these fields improves consistency and makes findings easier to triage.
| - Race Condition | |
| - Race Condition | |
| references: | |
| - "https://owasp.org/API-Security/editions/2023/en/0x11-t10/" | |
| - "https://cwe.mitre.org/data/definitions/362.html" | |
| cwe: | |
| - "CWE-362" | |
| cve: [] | |
| attributes: {} |
| tags: | ||
| - Business Logic | ||
| - OWASP API3 | ||
| - Race Condition |
There was a problem hiding this comment.
The info block is missing standard metadata present in other tests in this category (e.g. references, cwe, cve, and attributes in Broken-Function-Level-Authorization/BFLAInsertAdminURLPaths.yml:21-32). Adding these fields keeps the test library consistent and makes the generated report more actionable.
| - Race Condition | |
| - Race Condition | |
| references: | |
| - "https://owasp.org/API-Security/editions/2019/en/0xa6-mass-assignment/" | |
| - "https://cwe.mitre.org/data/definitions/362.html" | |
| cwe: | |
| - "CWE-362" | |
| cve: [] | |
| attributes: | |
| race-condition: true | |
| authenticated: true | |
| business-logic: true |
| category: | ||
| name: BOLA | ||
| shortName: BOLA | ||
| displayName: Business Logic |
There was a problem hiding this comment.
category.displayName is set to Business Logic, but in the BOLA library it is consistently Broken Object Level Authorization (BOLA) (e.g. Broken-Object-Level-Authorization/AddUserId.yaml:10-14). Using a different display name can break category grouping in the UI/reports; align the category fields with the existing BOLA templates.
| displayName: Business Logic | |
| displayName: Broken Object Level Authorization (BOLA) |
| - Business Logic | ||
| - OWASP API3 | ||
| - E-commerce | ||
| - Race Condition |
There was a problem hiding this comment.
tags values here don’t follow the repository’s established tagging conventions (Business logic, OWASP top 10, HackerOne top 10 etc.; see AddUserId.yaml:16-20). Inconsistent tag casing/labels (e.g. Business Logic, OWASP API3) can fragment filtering and reporting; please align tags with existing patterns or add the new taxonomy consistently across the library.
| - Business Logic | |
| - OWASP API3 | |
| - E-commerce | |
| - Race Condition | |
| - Business logic | |
| - OWASP top 10 | |
| - E-commerce |
| - Business Logic | ||
| - OWASP API3 |
There was a problem hiding this comment.
tags uses Business Logic / OWASP API3, which differs from the tag set used elsewhere in this repo (Business logic, OWASP top 10, HackerOne top 10; e.g. BFLAwithGETMethod.yml:17-20). If tags are used for grouping/filtering, please align these values to the existing convention or introduce the new tag taxonomy consistently across all tests.
| - Business Logic | |
| - OWASP API3 | |
| - Business logic | |
| - OWASP top 10 |
| api_selection_filters: | ||
| response_code: | ||
| gte: 200 | ||
| lt: 300 | ||
| method: | ||
| neq: "GET" | ||
| request_payload: | ||
| for_one: | ||
| key: | ||
| regex: "^(coupon|promo|discount|voucher|code)$" | ||
| extract: "couponParam" | ||
|
|
There was a problem hiding this comment.
api_selection_filters here is much less restrictive than other tests in this repo (typically they also constrain method to exclude OPTIONS and filter on response_payload/response_headers to avoid selecting error/HTML responses; e.g. Broken-Object-Level-Authorization/AddUserId.yaml:42-76). Without similar filters, this test is more likely to be applied to irrelevant endpoints and generate noisy results. Consider adding the same baseline response/header guards used elsewhere.
No description provided.