An issue was discovered in StaticPool in SUCHMOKUO node-worker-threads-pool version 1.4.3 that allows attackers to cause a denial of service.
This can be mitigated by manually creating a timeout. For example:
const { StaticPool } = require(\"node-worker-threads-pool\");
const staticPool = new StaticPool({
size: 1,
task: (n) => {
while (n) {
console.log(\"a\");
}
return n;
}
});
staticPool.createExecutor().setTimeout(10).exec(1).then((result) => {
console.log(\"result from thread pool:\", result);
}).catch(() => console.error('timeout'));
{
"nvd_published_at": "2023-08-11T14:15:12Z",
"severity": "MODERATE",
"github_reviewed_at": "2023-08-11T22:16:44Z",
"github_reviewed": true,
"cwe_ids": [
"CWE-400",
"CWE-770"
]
}