Skip to content

fix: prevent cross-parent IDOR via body-supplied up__ keys - #513

Closed
cschuerings wants to merge 2 commits into
cap-js:mainfrom
cschuerings:fix/cross-parent-idor-upkeys
Closed

fix: prevent cross-parent IDOR via body-supplied up__ keys#513
cschuerings wants to merge 2 commits into
cap-js:mainfrom
cschuerings:fix/cross-parent-idor-upkeys

Conversation

@cschuerings

Copy link
Copy Markdown
Contributor

Problem

finalizePrepareAttachment used a hasUpKey guard to skip parent-key population when any up__ key was already present in the request body. An attacker could exploit this by POSTing to a URL they are authorized for (their own parent) while supplying a different parent's ID in the body — the body value would be used as-is, associating the attachment with the victim's parent record.

Fix

Remove the hasUpKey guard entirely. Parent (up__) keys are now always derived from the URL path, overwriting any values supplied in the request body. A 404 is returned when the URL-referenced parent record does not exist.

Client-supplied attachment IDs on NEW are also rejected — the server always assigns a UUID.

Out of Scope

Authorisation checks beyond existence of the parent record (i.e. whether the requesting user is allowed to write to that parent) remain the responsibility of the application's service handlers.

@cschuerings
cschuerings requested a review from a team as a code owner August 4, 2026 16:12
Remove undefined inferTargetCAP8 CAP 8 fallback — cds.infer.target is
always available on CDS 9+. Drop unused bobGET variable in test.
@cschuerings

Copy link
Copy Markdown
Contributor Author

Not exploitable without the fix. CAP's propagateForeignKeys already overwrites body-supplied up__ keys from the URL path before our handler runs. The removed hasUpKey guard was dead code; the new re-derivation is defense-in-depth only.

@cschuerings cschuerings closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant