CVE-2024-30248: Piccolo admin Piccolo Admin's Raw SVG Loading Vulnerability
HIGHCVE-2024-30248 is a HIGH (CVSS 7.7) piccolo admin's raw svg loading vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Piccolo admin libraries in the PyPI ecosystem. The issue involves piccolo admin's raw svg loading may lead to complete data compromise from admin page. Remediation is available by upgrading affected packages to version 1.3.2.
CVE-2024-30248 at a Glance
Security Impact
CVSS: 7.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2024-30248
To remediate this vulnerability, upgrade all affected Piccolo admin dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install piccolo-admin>=1.3.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show piccolo-admin
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-30248, inspect your installed packages using pip:
pip show piccolo-admin
Analyze the terminal output to locate any version of Piccolo admin in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.2), your application is affected.
Note: The pip show piccolo-admin command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Piccolo admin, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-30248 Affected Piccolo admin Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
piccolo-admin
|
PyPI |
≥ 1.2.0
< 1.3.2
|
1.3.2
|
References
Frequently Asked Questions
What is CVE-2024-30248?
Which Piccolo admin versions are affected?
What version fixes CVE-2024-30248?
Is piccolo-admin affected?
What is the CVSS score of CVE-2024-30248?
What CWE is associated with CVE-2024-30248?
How can I check PyPI dependencies for CVE-2024-30248?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pmww-v6c9-7p83",
"modified" : "2024-04-02T18:53:44Z",
"published" : "2024-04-01T15:49:22Z",
"aliases" : [ "CVE-2024-30248" ],
"summary" : "Piccolo Admin's raw SVG loading may lead to complete data compromise from admin page",
"details" : "### Summary\n\nPiccolo's admin panel provides the ability to upload media files and view them within the admin panel. If SVG is an allowed file type for upload; the default; an attacker can upload an SVG which when loaded under certain contexts allows for arbitrary access to the admin page. \n\nThis access allows the following actions for example:\n- The ability for an attacker to gain access to all data stored within the admin page\n- The ability for an attacker to make any action within the admin page such as creating, modifying or deleting table records\n\nAs the SVG is executed from the context of an authenticated admin session, any actions they may be able to make can be made by the attacker. \n\n*N.b. The relevant session cookies are inaccessible from JavaScript due to httponly being set so all exploits must be present within the SVG file*\n\n### PoC\n_Complete instructions, including specific configuration details, to reproduce the vulnerability._\n\nCurrently, this requires the ability for a user to have access to an administrators account in order to upload the malicious file for simplicity sake. I can however imagine situations where general end users have the ability to upload files which can later be managed via the admin page. \n\nSee the following repository: [Piccolo XSS](https://github.com/Skelmis/piccolo_xss)\n\n1. Clone the repo\n2. Run all migrations & create an admin user\n3. Run `app.py` as a FastAPI application\n4. Login to the admin page\n5. Create a new task and upload the following file to see basic execution: `payloads/basic_xss.svg`\n6. Click the SVG to view it inline \n7. Click \"Open image in new tab\"\n8. Observe the XSS triggering\n\n\n*Fig 1: An example XSS payload executing*\n\n\n\n##### Extended PoC\n\nThis repo also includes an extended PoC which sends the `Task` table to an attacker controlled server.\n\n1. Run `exhil_server.py` as a FastAPI application\n2. Upload the following payload: `payloads/exhil.svg`\n3. Open the SVG in a new tab and observe the data being sent to the attacker controlled server\n\n*Fig 2: An example screenshot from the attacker controlled server showing incoming data*\n\n\nFurther, the repo includes a list of routes the admin panel exposes which could be used to automate table discovery and compromise in a more sophisticated PoC.\n\n### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nAll applications with the following conditions present are affected:\n- An enabled admin panel\n- A model which features media upload that allows for SVG files\n\nFurther, if the site is behind a proxy of sorts it must not set the relevant security headers.\n\n### Further thoughts\n\nWhile this issue has been raised against the `piccolo_admin` repository, it technically exists for all file uploads within a piccolo website if an end developer chooses to include the ability to view SVG files inline within their application. Further thought should likely be given to either or both of the following:\n- Ensuring the documentation for media handling includes some form of warning/recommendation relating to this. Ideally I think it should just provide an example of a code fix and link to security headers to test their own application\n- Modifying the Piccolo template generation to include the relevant security headers by default. These include things such as xss protection and a content security policy. [This](https://securityheaders.com/) site is a great resource for testing the security headers set on a website\n\nGiven the need to allow end developers the freedom to allow for SVG upload, removing the ability to upload them entirely is likely out of the picture. \n\nThis could also be resolved by making attempts to view attachments in a new tab set the relevant content-disposition header and force the browser to download the file instead of rendering it inline of the website.\n\nWhat are your thoughts on the approach to take to mitigate this?",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "piccolo-admin"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.2.0"
}, {
"fixed" : "1.3.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/piccolo-orm/piccolo_admin/security/advisories/GHSA-pmww-v6c9-7p83"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-30248"
}, {
"type" : "WEB",
"url" : "https://github.com/piccolo-orm/piccolo_admin/commit/c419575c2467959d906154084d305648eb2b8faf"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/piccolo-orm/piccolo_admin"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-04-01T15:49:22Z",
"nvd_published_at" : "2024-04-02T15:15:53Z"
}
}