Skip to content
CSRF Write-up Intermediate

Basic HTTP Authentication Risk: Uncovering pyspider Vulnerabilities

PySpider's web UI uses HTTP Basic Authentication, which browsers automatically attach to cross-site requests, and lacks CSRF protections, allowing an attacker to craft a malicious site that makes an authenticated victim execute arbitrary Python code. A reflected XSS in the /update endpoint can be exploited via CSRF to achieve the same code execution.

Yaniv Nizry Follow

Published on sonarsource.com

pyspider is a powerful and versatile web crawling framework that caters to various use cases. With its user-friendly approach, robust features, and extensive support for different technologies, it's a great choice for developers who want to build reliable and efficient web scrapers in Python.

Yaniv Nizry (@YNizry), on sonarsource.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application relies on HTTP Basic Authentication without CSRF tokens, and browsers automatically include the Authorization header on cross-site requests, so no endpoint-level CSRF protection exists.

What the attacker needed

PySpider with authentication enabled; Victim logged in to PySpider UI; Victim visits attacker's website

The fix

The project was not fixed; the maintainer archived the repository, and users should avoid unmaintained code or disable the WebUI component.

How it was found

  1. Set up PySpider with the --need-auth flag to enable authentication.
  2. Log in to the web interface using the browser's Basic Auth prompt.
  3. Identify the requests that execute arbitrary code on the server.
  4. Craft a malicious website that replicates those requests.
  5. Trick an authenticated victim into visiting the malicious website, resulting in code execution.

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 write-up has not been written yet. The Original tab links to the source.

PySpider is a tool for scraping websites, and its control panel lets users run Python code. The panel uses a simple login method where the browser automatically sends the password with every request, even to other websites. Because the panel does not check where requests come from, an attacker can trick a logged-in user into visiting a malicious page that silently sends commands to the panel, running code on the server.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More by Yaniv Nizry

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.