{"id":"GHSA-rm8v-mxj3-5rmq","aliases":["GHSA-rm8v-mxj3-5rmq","GO-2023-1859"],"related":[],"kind":"vulnerability","state":"published","title":"github.com/lestrrat-go/jwx vulnerable to Potential Padding Oracle Attack","summary":"### Summary\n\nDecrypting AES-CBC encrypted JWE has Potential Padding Oracle Attack Vulnerability.\n\n### Details\n\nOn [v2.0.10](https://github.com/lestrrat-go/jwx/releases/tag/v2.0.10), decrypting AES-CBC encrypted JWE may return an error \"failed to generate plaintext from decrypted blocks: invalid padding\":\n\nhttps://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213\n\nReporting padding error causes [Padding Oracle Attack](https://en.wikipedia.org/wiki/Padding_oracle_attack) Vulnerability.\nRFC 7516 JSON Web Encryption (JWE) says that we **MUST NOT** do this.\n\n> 11.5.  Timing Attacks\n> To mitigate the attacks described in RFC 3218 [RFC3218], the\n> recipient MUST NOT distinguish between format, padding, and length\n> errors of encrypted keys.  It is strongly recommended, in the event\n> of receiving an improperly formatted key, that the recipient\n> substitute a randomly generated CEK and proceed to the next step, to\n> mitigate timing attacks.\n\nIn addition, the time to remove padding depends on the length of the padding.\nIt may leak the length of the padding by Timing Attacks.\n\nhttps://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66\n\nTo mitigate Timing Attacks, it MUST be done in constant time.\n\n### Impact\n\nThe authentication tag is verified, so it is not an immediate attack.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"### Summary\n\nDecrypting AES-CBC encrypted JWE has Potential Padding Oracle Attack Vulnerability.\n\n### Details\n\nOn [v2.0.10](https://github.com/lestrrat-go/jwx/releases/tag/v2.0.10), decrypting AES-CBC encrypted JWE may return an error \"failed to generate plaintext from decrypted blocks: invalid padding\":\n\nhttps://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213\n\nReporting padding error causes [Padding Oracle Attack](https://en.wikipedia.org/wiki/Padding_oracle_attack) Vulnerability.\nRFC 7516 JSON Web Encryption (JWE) says that we **MUST NOT** do this.\n\n> 11.5.  Timing Attacks\n> To mitigate the attacks described in RFC 3218 [RFC3218], the\n> recipient MUST NOT distinguish between format, padding, and length\n> errors of encrypted keys.  It is strongly recommended, in the event\n> of receiving an improperly formatted key, that the recipient\n> substitute a randomly generated CEK and proceed to the next step, to\n> mitigate timing attacks.\n\nIn addition, the time to remove padding depends on the length of the padding.\nIt may leak the length of the padding by Timing Attacks.\n\nhttps://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66\n\nTo mitigate Timing Attacks, it MUST be done in constant time.\n\n### Impact\n\nThe authentication tag is verified, so it is not an immediate attack.","format":"markdown","source":"ghsa"},{"lang":"en","text":"AES-CBC decryption is vulnerable to a timing attack which may permit an attacker to recover the plaintext of JWE data.","format":"markdown","source":"go"}],"published":"2023-06-14T17:24:36.000Z","modified":"2024-05-20T16:03:47.000Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.11"}],"ecosystem":"Go","package":"github.com/lestrrat-go/jwx/v2","purl":"pkg:golang/github.com/lestrrat-go/jwx/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.2.26"}],"ecosystem":"Go","package":"github.com/lestrrat-go/jwx","purl":"pkg:golang/github.com/lestrrat-go/jwx","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.2.26"}],"ecosystem":"Go","package":"github.com/lestrrat-go/jwx","purl":"pkg:golang/github.com/lestrrat-go/jwx","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.11-0.20230614080639-c8b6bec919a1"}],"ecosystem":"Go","package":"github.com/lestrrat-go/jwx/v2","purl":"pkg:golang/github.com/lestrrat-go/jwx/v2","source":"go"}],"references":[{"url":"https://github.com/lestrrat-go/jwx/security/advisories/GHSA-rm8v-mxj3-5rmq","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/lestrrat-go/jwx/commit/6c41e3822485fc7e11dd70b4b0524b075d66b103","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/lestrrat-go/jwx/commit/d9ddbc8e5009cfdd8c28413390b67afa7f576dd6","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/lestrrat-go/jwx","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213","tags":["web"],"sources":["ghsa"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rm8v-mxj3-5rmq","url":"https://github.com/advisories/GHSA-rm8v-mxj3-5rmq","licence":"CC-BY-4.0","modified":"2023-11-08T04:22:49.387Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2023-1859","url":"https://pkg.go.dev/vuln/GO-2023-1859","licence":"CC-BY-4.0","modified":"2024-05-20T16:03:47.000Z"}],"updatedAt":"2026-11-25T22:56:23.514Z"}