CVE-2023-40178: @node saml/node saml @node-saml/node-saml's ValidatePostRequestAsync Does Not Include Vulnerability
MODERATECVE-2023-40178 is a MODERATE (CVSS 5.3) @node-saml/node-saml's validatepostrequestasync does not include vulnerability (CWE-613: Insufficient Session Expiration) affecting @node saml/node saml libraries in the npm ecosystem. The issue involves @node-saml/node-saml's validatepostrequestasync does not include checktimestampsvalidityerror. Remediation is available by upgrading affected packages to version 4.0.5.
CVE-2023-40178 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2023-40178
To remediate this vulnerability, upgrade all affected @node saml/node saml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @node-saml/node-saml@4.0.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @node-saml/node-saml
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2023-40178, inspect your project dependencies using npm:
npm ls @node-saml/node-saml
Analyze the terminal output to locate any version of @node saml/node saml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.5), your application is affected.
Note: The npm ls @node-saml/node-saml command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-613: Insufficient Session Expiration, where according to wasc, "insufficient session expiration is when a web site permits an attacker to reuse old session credentials or session ids for authorization.". In @node saml/node saml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-40178 Affected @node saml/node saml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@node-saml/node-saml
|
npm |
< 4.0.5
|
4.0.5
|
References
Frequently Asked Questions
What is CVE-2023-40178?
Which @node saml/node saml versions are affected?
What version fixes CVE-2023-40178?
Is @node-saml/node-saml affected?
What is the CVSS score of CVE-2023-40178?
What CWE is associated with CVE-2023-40178?
How can I check npm dependencies for CVE-2023-40178?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vx8m-6fhw-pccw",
"modified" : "2023-08-21T20:13:05Z",
"published" : "2023-08-21T20:13:05Z",
"aliases" : [ "CVE-2023-40178" ],
"summary" : "@node-saml/node-saml's validatePostRequestAsync does not include checkTimestampsValidityError",
"details" : "### Summary\n\nThe lack of checking of current timestamp allows a LogoutRequest XML to be reused multiple times even when the current time is past the NotOnOrAfter. \n\n### Details\n\nIt was noticed that in the validatePostRequestAsync() flow in saml.js, the current timestamp is never checked. This could present a vulnerability where a user who has an XML LogoutRequest could validated it if the IssueInstance and the NotOnOrAfter are valid along with valid credentials (signature, certificate etc.). \n\n### PoC\n\nI was able to validate a sample valid LogoutRequest XML multiple times through postman by sending it to my endpoint regardless if the current present time was past the NotOnOrAfter time. After some further testing, it seems that only the IssueInstance is checked against NotOnOrAfter. Not sure if this was the intended behaviour but I believe having a never expiring valid LogoutRequest could be dangerous.\n\n### Impact\n\nThis could impact the user where they would be logged out from an expired LogoutRequest. In bigger contexts, if LogoutRequests are sent out in mass to different SPs, this could impact many users on a large scale.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@node-saml/node-saml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/node-saml/node-saml/security/advisories/GHSA-vx8m-6fhw-pccw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-40178"
}, {
"type" : "WEB",
"url" : "https://github.com/node-saml/node-saml/commit/045e3b9c54211fdb95f96edf363679845b195cec"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/node-saml/node-saml"
}, {
"type" : "WEB",
"url" : "https://github.com/node-saml/node-saml/releases/tag/v4.0.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-347", "CWE-613" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-08-21T20:13:05Z",
"nvd_published_at" : "2023-08-23T21:15:08Z"
}
}