Summary
A critical SQL injection vulnerability in PeerTube allows an unauthenticated remote server to influence a database query through a crafted ActivityPub actor inbox URL. Successful exploitation may let an attacker read or modify database records, expose OAuth access tokens, and take over administrator accounts.
Affected context
The vulnerability occurs in PeerTube's ActivityPub federation workflow when ActorFollowModel.updateScore() processes an attacker-controlled actor inboxUrl. Deployments become at risk when they accept federated actor data from remote servers and interpolate that value into SQL without reliable parameterization or equivalent query protection.
Exploit preconditions
- Attack surface: ActivityPub federation and actor-processing functionality
- Required access: No authenticated PeerTube account is required; the attacker operates or controls a remote federated server
- Trigger point: Processing an ActivityPub actor or follow-related update that invokes
ActorFollowModel.updateScore() - Why exploitation is possible: The remote actor's
inboxUrlis incorporated into an SQL query as attacker-controlled data, allowing query structure and database operations to be influenced
Why this happens
The underlying bug is SQL query construction that incorporates externally supplied actor data through string interpolation rather than treating it strictly as a parameter value. This breaks the separation between SQL code and data and maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). Because the affected input is accepted through federation, an unauthenticated remote system may reach the vulnerable processing path.
Potential impact
- An attacker may read sensitive PeerTube database records
- An attacker may modify or delete database tables and application data
- OAuth access tokens may be exposed
- Administrator accounts may be taken over
- Federated content, users, or application integrity could be compromised
- The PeerTube instance may be used for further abuse or lateral movement
General mitigation guidance
Mitigation generally focuses on eliminating SQL construction from untrusted strings and reducing the trust placed in federated metadata.
Common defensive patterns include:
- Use parameterized queries, prepared statements, or carefully constrained ORM query interfaces
- Apply strict type, format, and length validation to ActivityPub URLs before processing
- Reject malformed or unexpected federation data early, before database operations
- Run the application with a database account limited to the permissions it requires
- Protect OAuth tokens and other secrets with appropriate encryption, access controls, and rotation procedures
- Limit federation exposure and isolate database services from unnecessary network access
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules that identify SQL built by concatenating or interpolating request, federation, or URL data
- Code review checks for ORM escape hatches, raw-query APIs, and missing parameter binding
- Tests that verify query parameters remain data rather than altering query behavior
- Database audit logs for unusual reads, writes, schema changes, or access to token tables
- Application logs showing abnormal federated actor activity or repeated processing failures
- Policy enforcement requiring parameterized database access and security review for federation handlers

