T09 · Insecure Skill Coding Practices
- Location
references/implementation.md:243- Finding
Client-Controlled Test Scoring and Unvalidated Item Submission
- Content
View full analysis
Vulnerability Details
File Location:
references/implementation.md, lines 243–246 and 274–283
Vulnerability Type: Client-controlled scoring and missing test-flow validation
Risk Level: HighVulnerable Code
python class SubmitAnswerRequest(BaseModel): session_id: str item_id: int response: bool # True = correct, False = incorrect @app.post("/api/test/answer") async def submit_answer(req: SubmitAnswerRequest): # Load session session = get_session(req.session_id) engine = session.engine # Get item item = get_item(req.item_id) # Process response engine.administer_item(item, req.response)Technical Analysis
The API accepts a client-provided Boolean indicating whether an answer is correct. This makes the client authoritative for scoring: a malicious test taker can submit
response: truewithout knowing the correct answer.The endpoint also retrieves an arbitrary client-supplied
item_idwithout verifying that the item was issued as the session's current question. No check prevents submitting an unassigned item, submitting the same item repeatedly, or submitting an item after it has already been answered.These flaws violate the principle that security-sensitive decisions must be made on the trusted server side. The server should receive an answer choice, validate it against a protected answer key, and enforce the assessment's state transition rules.
Attack Path
- The attacker starts or obtains a valid test session.
- The attacker calls
/api/test/answerwith the session identifier and an arbitrary item ID. - The attacker sets
responsetotrue, regardless of the actual answer. - The attacker repeats forged submissions until the stopping rule is reached.
- The system calculates and returns an artificially elevated ability estimate.
- Depending on how results are consumed, the attacker may obtain an improper placement, passing result, or certification outcome.
Impact
...[truncated 491 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the client-provided correctness Boolean with a submitted answer value or answer-choice identifier.
- Score the submitted answer exclusively on the server against a protected answer key.
- Store the currently issued item in trusted session state.
- Verify that
item_idmatches the current unanswered item assigned to the session. - Reject duplicate, skipped, stale, out-of-order, or post-completion submissions.
- Use an atomic state transition or database transaction to prevent concurrent duplicate submissions.
- Validate that every submitted item belongs to the session's configured test and item bank.
- Avoid returning answer keys or correctness metadata in serialized item responses.
- Add tests covering forged correctness values, arbitrary item IDs, replayed submissions, and concurrent requests.
