CVE-2013-0340 is the billion laughs entity-expansion flaw in Expat (libexpat): before version 2.4.0, released on 23 May 2021, the parser set no limit on how far nested entity references could expand, so a small XML document could exhaust a device's CPU and memory. NVD's only Primary score is CVSS v2 6.8, and Siemens lists S7-1500 MFP firmware before V3.1.5 as affected.
Vulnerability summary
CVSS base score
6.8
Medium severity
EPSS score (FIRST)
19.4%
Probability of exploitation in the wild in the next 30 days
CISA KEV catalog
No
Not listed
Published
Vulnerability ID: CVE-2013-0340 · Source: NVD
Affected components
| Component | CPE | Version range |
|---|---|---|
| Expat / libexpat (entity expansion, billion laughs) | cpe:2.3:a:libexpat_project:libexpat:*:*:*:*:*:*:*:* | before 2.4.0 (fixed in 2.4.0, 23 May 2021) |
| CPython (bundled Expat copy) | cpe:2.3:a:python:python:*:*:*:*:*:*:*:* | 3.6.0 to before 3.6.15, 3.7.0 to before 3.7.12, 3.8.0 to before 3.8.12, 3.9.0 to before 3.9.7 (per NVD) |
| Siemens SIMATIC S7-1500 CPU 1518(F)-4 PN/DP MFP and SIPLUS S7-1500 CPU 1518-4 PN/DP MFP (GNU/Linux subsystem) | — | V3.1.0 to before V3.1.5 (fixed in V3.1.5, per SSA-398330) |
What does this mean for affected devices?
CVE-2013-0340 is an entity-expansion denial-of-service flaw in Expat (libexpat), the C XML parser built into many device firmware images. NVD's description: "expat before version 2.4.0 does not properly handle entities expansion unless an application developer uses the XML_SetEntityDeclHandler function, which allows remote attackers to cause a denial of service (resource consumption), send HTTP requests to intranet servers, or read arbitrary files via a crafted XML document". NVD published the record on 2014-01-21 and its only Primary metric is CVSS v2 6.8, vector AV:N/AC:M/Au:N/C:P/I:P/A:P, with weakness CWE-611; it has no CVSS 3.x Primary score (NVD). The NVD text also carries a dispute note: because Expat already let developers disable external entity expansion, "it could be argued" that each affected application needs its own CVE.
Expat itself tracks the issue as CWE-776, recursive entity references in DTDs, which MITRE files under CWE-674 (uncontrolled recursion). The fix landed in Expat 2.4.0 on 23 May 2021. The Expat Changes file describes it as protection "against billion laughs attacks (denial-of-service; flavors targeting CPU time or RAM or both, leveraging general entities or parameter entities or both)", done by tracking the input amplification factor: by default amplification up to a factor of 100.0 is tolerated and rejection only starts after 8 MiB of output. The release added XML_SetBillionLaughsAttackProtectionMaximumAmplification and XML_SetBillionLaughsAttackProtectionActivationThreshold to tighten both values. The Expat XML security page confirms that versions before 2.4.0 were affected and warns that variations of the attack keep appearing; Expat 2.6.0 fixed CVE-2023-52426, the same attack against builds compiled without XML_DTD.
Which devices ship an affected Expat?
Siemens ProductCERT SSA-398330 lists CVE-2013-0340 for the additional GNU/Linux subsystem of the SIMATIC S7-1500 CPU 1518-4 PN/DP MFP and CPU 1518F-4 PN/DP MFP (order numbers 6ES7518-4AX00-1AB0, -1AC0, 6ES7518-4FX00-1AB0, -1AC0) and the SIPLUS S7-1500 CPU 1518-4 PN/DP MFP (6AG1518-4AX00-4AC0), versions V3.1.0 to before V3.1.5. The fix is V3.1.5 or later, and Siemens scores the CVE 9.1 in CVSS 3.1. CISA republished the advisory as ICSA-23-348-10 (CISA CSAF). The same Siemens advisory lists more than 20 other Expat CVEs for that subsystem, including CVE-2022-25235 and CVE-2022-40674.
NVD's configurations also list CPython 3.6.0 to before 3.6.15, 3.7 before 3.7.12, 3.8 before 3.8.12 and 3.9 before 3.9.7, because CPython bundles its own Expat copy in the pyexpat module. A device with a Python interpreter can therefore carry an affected Expat that the package database does not list as libexpat.
How do you decide whether a device is exposed?
The attack needs a document with a DTD that declares nested entities, so the question is whether the firmware parses XML with DTDs from an untrusted source: UPnP and SOAP device-management requests, uploaded configuration files or update manifests. The Expat Changes file notes for 2.10.0 that a layer of compression around XML can significantly reduce the minimum attack payload size, so a compressed manifest belongs on the same path. Firmware that only reads fixed XML files from a read-only partition is outside that path. The Debian tracker rates the CVE unimportant for Debian because the application using Expat controls the mitigation, and records the fix in expat 2.4.1-2 in unstable.
CVE-2013-0340 is not in the CISA KEV catalog as of 2026-11-17 (catalog version 2026.11.13, CISA KEV). FIRST EPSS gives it 0.194, the 97.4th percentile, in its 2026-11-16 dataset (FIRST EPSS).
What fixes CVE-2013-0340?
Upgrade Expat to 2.4.0 or later; the current release is 2.10.0 of 2 November 2026, which detects more billion laughs variants. On the S7-1500 MFP, update the firmware to V3.1.5 or later. Keep the default amplification limits, or tighten them for devices that only parse small documents. Our zlib, Expat and libxml2 vulnerabilities in embedded firmware guide covers locating every Expat copy in an image, including bundled ones, and the input handling fix guide covers limiting resource use for untrusted input. For a 32-bit Expat overflow on the same kind of devices, see CVE-2024-45491.
Evidence
- expat before 2.4.0 does not properly handle entities expansion; NVD Primary CVSS v2 6.8 AV:N/AC:M/Au:N/C:P/I:P/A:P; CWE-611; published 2014-01-21; CPython 3.6-3.9 configurations; dispute note. — NVD
- Expat 2.4.0 (23 May 2021): CVE-2013-0340/CWE-776 billion laughs protection, amplification factor 100.0 tolerated, rejection after 8 MiB; two new API functions. Expat 2.6.0 fixed CVE-2023-52426 for builds without XML_DTD. — Expat Changes
- Expat versions before 2.4.0 affected by the billion laughs attack (CVE-2013-0340); default limit 100 times and 8 MiB; variations exist. — Expat XML security page
- S7-1500 CPU 1518(F)-4 PN/DP MFP and SIPLUS S7-1500 CPU 1518-4 PN/DP MFP GNU/Linux subsystem V3.1.0 to before V3.1.5 affected; fix V3.1.5; Siemens CVSS 3.1 9.1. — Siemens SSA-398330
- CISA republished SSA-398330 as ICSA-23-348-10 with the same affected products and fix. — CISA CSAF ICSA-23-348-10
- CWE-776 is a child of CWE-674 (uncontrolled recursion). — MITRE CWE
- Debian: unimportant, app controls mitigation; fixed in expat 2.4.1-2 (unstable). — Debian Security Tracker
- Not in the CISA KEV catalog version 2026.11.13 as of 2026-11-17. — CISA KEV
- EPSS 0.19433, percentile 0.97409, dataset 2026-11-16. — FIRST EPSS

Related advisories
Sources
Frequently asked questions
Why does CVE-2013-0340 only have a CVSS v2 score on NVD?
NVD published the record on 2014-01-21 and its Primary metric is CVSS v2 6.8; NVD has added no CVSS 3.x Primary score. Siemens scores the CVE 9.1 in CVSS 3.1 for the S7-1500 MFP subsystem (per NVD and Siemens SSA-398330).
Which Expat version fixes CVE-2013-0340?
Expat 2.4.0, released 23 May 2021, added billion laughs protection that tolerates amplification up to a factor of 100 and starts rejecting after 8 MiB of output by default (per the Expat Changes file).
Which Siemens devices are affected by CVE-2013-0340?
SSA-398330 lists the GNU/Linux subsystem of the SIMATIC S7-1500 CPU 1518-4 PN/DP MFP, CPU 1518F-4 PN/DP MFP and SIPLUS S7-1500 CPU 1518-4 PN/DP MFP, V3.1.0 to before V3.1.5, fixed in V3.1.5 (per Siemens ProductCERT).
Is CVE-2013-0340 in the CISA KEV catalog?
No, it is absent from catalog version 2026.11.13 as of 2026-11-17. FIRST EPSS gives it 0.194, the 97.4th percentile, in the 2026-11-16 dataset (per CISA KEV and FIRST EPSS).
Questions about this page?