CSRF On stealing lock in support.mozilla.org
The steal-lock endpoint in support.mozilla.org accepts GET requests without CSRF protection, so an attacker can force a logged-in victim to lock a wiki article by making them visit a crafted URL. This could prevent other users from editing the article.
Originally disclosed on Mozilla
- Fixed in 21 days
- Paid in 27 days
- Disclosed after 21 days
Hi. The steal-lock function, allows get request making it vulnerable to csrf attacks since get requests in django doesnt need csrf protections. The endpoint is defined in `wiki/urls.py` in
'''python
re_path(r"^/steal_lock$", views.steal_lock, name="wiki.steal_lock"),
'''
This is the steal lock function
'''python
@login_required
def steal_lock(request, document_slug, revision_id=None):
doc = get_object_or_404(Document, locale=request.LANGUAGE_CODE, slug=document_slug)
user = request.user
ok = _document_lock_steal(doc.id, user.username)
return HttpResponse("", status=200 if ok else 400)
'''
So, when we trick a victim into following `https://support.allizom.org/en-US/kb/<article_slug>/steal_lock`, the document will be locked even if the victim is not actually editing the article.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The endpoint performs a state-changing action (stealing a document lock) via a GET request, which Django does not protect with CSRF tokens.
Impact
An attacker could cause a document to be locked by the victim, potentially denying other users the ability to edit it.
What the attacker needed
Victim is logged in; victim visits a crafted link
How it was found
- Identify the steal_lock endpoint that accepts GET requests.
- Craft a URL to the steal_lock endpoint for a target article.
- Trick a logged-in victim into visiting that URL.
- The document becomes locked by the victim's account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
CSRF (Cross-Site Request Forgery) is when a malicious site tricks your browser into sending a request to another site where you're logged in. Here, the lock action could be triggered just by loading a link, so an attacker could make you lock a page without you meaning to.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.