CRITICAL: API v1 routes use cookie auth without CSRF protection — cross-site request forgery #112
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
merge-ready
merge-ready
needs-checks
needs-checks
needs-rebase
needs-rebase
needs-review
needs-review
needs-rework
needs-rework
notplanned
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#112
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The API v1 routes (
/api/v1/*) use cookie-based session authentication but explicitly bypass CSRF protection. This means any malicious website can make authenticated requests on behalf of a logged-in user.Location
internal/server/routes.go— lines inSetupRoutes():The comment even acknowledges it:
cookie-based session auth, no CSRF.Impact
An attacker can create a webpage that, when visited by a logged-in upaas admin:
DELETE /api/v1/apps/{id}POST /api/v1/apps/{id}/deployPOST /api/v1/appsGET /api/v1/apps/{id}(if CORS allows, or via form submission)This requires only that the victim visits a malicious page while logged in.
Suggested Fix
Either:
X-CSRF-Tokenheader (from a cookie or meta tag)Authorization: Bearer <token>instead of cookies. This is immune to CSRF since browsers don't auto-attach custom headers.X-Requested-With: XMLHttpRequest. Browsers won't send custom headers in cross-origin simple requests.Option 2 or 3 is recommended for APIs.
Severity
CRITICAL — Any logged-in admin visiting a malicious page can have their entire PaaS infrastructure destroyed or compromised.
disable the api’s write methods.