Safe SVG icon

Safe SVG

Permits SVG file uploads to WordPress while removing XML and SVG-based security risks. Maintains a 94.3 PF Score and ranks in the top 1% of all plugins, with over 1 million active installations.

Generated on 8 Jul 2026. Score and stats mentioned may differ from current live data.

  • #50 Global Rank
  • 1.0M+ active installs
  • 4.9/5 79 ratings
  • Since 2015 11 years active

PF Score (About PF Scores)

PF Score is not a quality guarantee. It is a ranking based on available public signals.

Platinum96.6
+3.4 · 30d
Platinum
Gold
Silver
Bronze
Low

Score Breakdown

+3.4 over the last 30 days - Recently updated

100
Popularity 40% 1.0M+ active installs
90.3
Reputation 35% 4.9★ from 79 ratings
99.9
Freshness 25% Updated 4 days ago +13.8 · 30d

No active penalty: 6 historical CVEs, resolved - details

Download Trends

Loading download data...

Vulnerabilities

6 Total
6 Patched
0 Active
100% Resolved rate
CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The Safe SVG plugin for WordPress is vulnerable to Stored Cross-Site Scripting via SVG File uploads in all versions up to, and including, 2.2.5 due to insufficient input sanitization and output escaping. This makes it possible for authenticated attackers, with Author-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses the SVG file.

5.4 Medium Affected All - 2.2.5 Patched in ✓ 2.2.6 Published 17 Oct 2024 CVE CVE-2024-8378
CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The SVG Sanitizer library is vulnerable to XSS Bypass in versions up to, and including, 0.15.4. This may allow an attacker to successfully upload an SVG with persistent Cross-Site Scripting payloads in cases where a plugin is using this library to safely process SVG files.

7.2 High Affected All - 2.0.3 Patched in ✓ 2.1.0 Published 23 Mar 2023 CVE CVE-2023-28426
CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The sanitisation step of the Safe SVG WordPress plugin before 1.9.10 can be bypassed by spoofing the content-type in the POST request to upload a file. Exploiting this vulnerability, an attacker will be able to perform the kinds of attacks that this plugin should prevent (mainly XSS, but depending on further use of uploaded SVG files potentially other XML attacks).

7.7 High Affected All - 1.9.10 Patched in ✓ 1.9.10 Published 25 Mar 2022 CVE CVE-2022-1091
CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The Safe SVG plugin for WordPress is vulnerable to Cross-Site Scripting in versions up to, and including, 1.9.5 due to insufficient input sanitization and output escaping. This makes it possible for attackers to inject arbitrary web scripts that execute in a victim's browser.

5.4 Medium Affected All - 1.9.5 Patched in ✓ 1.9.6 Published 8 Nov 2019
CWE-400 · Uncontrolled Resource Consumption

A Denial Of Service vulnerability exists in the safe-svg (aka Safe SVG) plugin through 1.9.4 for WordPress, related to unlimited recursion for a '' substring.

6.5 Medium Affected All - 1.9.4 Patched in ✓ 1.9.5 Published 5 Nov 2019 CVE CVE-2019-18854

Vulnerability data provided by Wordfence Intelligence (opens in a new tab). CVE data: Copyright 1999-2026 The MITRE Corporation. CVE Terms of Use (opens in a new tab).

About Safe SVG

Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website.

Safe SVG is the best way to Allow SVG Uploads in WordPress!

It gives you the ability to allow SVG uploads whilst making sure that they’re sanitized to stop SVG/XML vulnerabilities affecting your site. It also gives you the ability to preview your uploaded SVGs in the media library in all views.

Current Features

  • Sanitised SVGs – Don’t open up security holes in your WordPress site by allowing uploads of unsanitised files.
  • SVGO Optimisation – Runs your SVGs through the SVGO tool on upload to save you space. This feature is disabled by default but can be enabled by adding the following code: add_filter( 'safe_svg_optimizer_enabled', '__return_true' );
  • View SVGs in the Media Library – Gone are the days of guessing which SVG is the correct one, we’ll enable SVG previews in the WordPress media library.
  • Choose Who Can Upload – Restrict SVG uploads to certain users on your WordPress site or allow anyone to upload.

Initially a proof of concept for #24251.

SVG Sanitization is done through the following library: https://github.com/darylldoyle/svg-sanitizer.

SVG Optimization is done through the following library: https://github.com/svg/svgo.

Technical: Upload Path Security

WordPress’s _wp_handle_upload( $file, $action ) function allows any $action value, which determines the filter hook name: {$action}_prefilter. Safe SVG hooks common actions like wp_handle_upload and wp_handle_sideload, but cannot hook arbitrary custom actions defined by third-party code. Since upload actions are unbounded and MIME allowances are global, we cannot guarantee sanitization coverage across all possible upload paths.

Frequently Asked Questions

Can we change the allowed attributes and tags?

Yes, this can be done using the svg_allowed_attributes and svg_allowed_tags filters.
They take one argument that must be returned. See below for examples:

add_filter( 'svg_allowed_attributes', function ( $attributes ) {

    // Do what you want here...

    // This should return an array so add your attributes to
    // to the $attributes array before returning it. E.G.

    $attributes[] = 'target'; // This would allow the target="" attribute.

    return $attributes;
} );


add_filter( 'svg_allowed_tags', function ( $tags ) {

    // Do what you want here...

    // This should return an array so add your tags to
    // to the $tags array before returning it. E.G.

    $tags[] = 'use'; // This would allow the <use> element.

    return $tags;
} );
Can my theme style an inline SVG?

Mostly, yes. The Inline SVG block renders an SVG that carries its own <style> element inside a shadow root, because CSS inside an inline SVG is otherwise applied to the whole page rather than just the SVG. Stylesheets cannot reach into a shadow root, so theme CSS such as .entry-content svg { fill: red; } will not apply to those SVGs.

Inherited properties still cross the boundary, so setting color on an ancestor and using currentColor inside the SVG works, as do CSS custom properties. SVGs that do not contain a <style> element are rendered without the shadow root and can be styled by theme stylesheets.

To turn isolation off, at the cost of allowing an SVG’s CSS to affect the rest of the page:

add_filter( 'safe_svg_inline_use_shadow_dom', '__return_false' );
Why doesn’t Safe SVG globally enable SVG uploads?

Safe SVG only allows SVGs through upload paths it can actively sanitize. While most WordPress uploads use standard functions like wp_handle_upload() (which Safe SVG hooks), plugins and themes can create custom upload paths by calling WordPress’s underlying _wp_handle_upload() function with arbitrary action parameters.

Globally enabling the image/svg+xml MIME type would allow SVGs through all upload paths—including custom ones Safe SVG cannot intercept and sanitize. This would create security vulnerabilities where unsanitized SVGs containing malicious scripts could be uploaded.

This is a deliberate design decision: Safe SVG prioritizes guaranteed sanitization over broad compatibility. SVGs are only allowed when we can ensure they’re safe.

Where do I report security bugs found in this plugin?

Please report security bugs found in the source code of the Safe SVG plugin through the Patchstack Vulnerability Disclosure  Program. The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.

Ratings & Reviews

Recent Reviews

Loading reviews...

View all reviews on WordPress.org (opens in a new tab)

Changelog

2.5.0 – 2026-09-07

2.4.0 – 2025-09-22

2.3.3 – 2025-08-13

2.3.2 – 2025-07-21

2.3.1 – 2024-12-05

2.3.0 – 2024-11-25

2.2.6 – 2024-08-28

View historical changelog details here.

Alternatives to Safe SVG

Other WordPress plugins serving a similar purpose, ranked by relevance and PF Score.

Platinum96.7
SVG Support icon

SVG Support

Upload SVG files securely with integrated sanitization and animation support.

★ 4.8/5·1.0M+ installs·Updated 25 Jul 2026
Platinum99.1
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) icon

Really Simple Security

Hardens WordPress security with two-factor authentication, login protection, and vulnerability detection across 3 million active sites.

★ 4.9/5·3.0M+ installs·Updated 1 Sep 2026
Platinum98.2
Limit Login Attempts Security – Login Security, 2FA, Firewall, Brute Force Prevention icon

Limit Login Attempts Security

Defends WordPress logins with brute force protection, two-factor authentication, and IP blocking.

★ 4.8/5·1.0M+ installs·Updated 1 Sep 2026
Platinum97.8
Loginizer icon

Loginizer

Protects WordPress login pages from brute force attacks through automated threat detection and blocking.

★ 4.8/5·1.0M+ installs·Updated 19 Aug 2026
Platinum97.1
Wordfence Security – Firewall, Malware Scan, and Login Security icon

Wordfence Security

Firewall, malware scanner, and two-factor authentication for WordPress site security.

★ 4.7/5·5.0M+ installs·Updated 10 Aug 2026
Platinum96.4
ManageWP Worker icon

ManageWP Worker

Centralized dashboard for managing, backing up, and securing multiple WordPress sites simultaneously.

★ 4.6/5·1.0M+ installs·Updated 21 Aug 2026
Platinum95.5
MainWP Child – Securely Connects to the MainWP Dashboard to Manage Multiple Sites icon

MainWP Child

Connects multiple WordPress sites to a centralized self-hosted dashboard for management and monitoring.

★ 5/5·700K+ installs·Updated 25 Aug 2026
Platinum95.0
Kadence Security – Password, Two Factor Authentication, and Brute Force Protection icon

Kadence Security

Adds login security, two-factor authentication, vulnerability scanning, and firewall protection to WordPress sites.

★ 4.6/5·700K+ installs·Updated 27 Jul 2026
Platinum94.4
User Role Editor icon

User Role Editor

Edit, add, and delete WordPress user roles and capabilities through an admin interface.

★ 4.5/5·700K+ installs·Updated 25 Aug 2026
Platinum92.6
FileBird – WordPress Media Library Folders & File Manager icon

FileBird

Create folder structures to organize thousands of WordPress media files and attachments systematically.

★ 4.7/5·200K+ installs·Updated 22 Aug 2026