{"id":"CVE-2021-29935","aliases":["EUVD-2021-1890","GHSA-vcw4-8ph6-7vw8","RUSTSEC-2021-0044"],"status":"published","title":"Use after free in Rocket","description":"An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.","severity":{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-10","score":0.01025,"percentile":0.63868,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-416"],"published":"2021-02-09T12:00:00Z","modified":"2026-10-24T10:30:23Z","fixes":[{"ecosystem":"crates.io","package":"rocket","fixed_in":["0.4.7"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"rocket","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.4.7"}]}]},{"source":"osv","ecosystem":"crates.io","package":"rocket","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.4.7"}]}]},{"source":"osv","ecosystem":"crates.io","package":"rocket","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.4.7"}]}]}],"products":[{"vendor":"rocket","product":"rocket"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0044.html","tags":["x_refsource_MISC","x_transferred","Exploit","Vendor Advisory","evidence","web","advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29935","tags":["advisory"]},{"url":"https://github.com/SergioBenitez/Rocket/issues/1534","tags":["web","report"]},{"url":"https://github.com/SergioBenitez/Rocket/commit/b53a906a8e170fe9b151381c66a76a872c419f9e","tags":["web"]},{"url":"https://github.com/SergioBenitez/Rocket/commit/e325e2fce4d9f9f392761e9fb58b418a48cef8bb","tags":["web"]},{"url":"https://github.com/advisories/GHSA-vcw4-8ph6-7vw8"},{"url":"https://github.com/SergioBenitez/Rocket","tags":["package"]},{"url":"https://crates.io/crates/rocket","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-29935","description":"An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.","status":"published","published":"2021-04-01T04:23:59Z","modified":"2024-08-03T22:18:03.183Z","updated_at":"2026-11-02T14:33:06.658806Z"}],"euvd":[{"id":"EUVD-2021-1890","description":"An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.","status":"published","published":"2021-04-01T04:23:59Z","modified":"2024-08-03T22:18:03Z","updated_at":"2026-11-03T03:24:43.413555Z"}],"ghsa":[{"id":"GHSA-vcw4-8ph6-7vw8","title":"Use after free in Rocket","description":"Affected versions of this crate transmuted a \u0026str to a \u0026'static str before pushing it into a StackVec, this value was then popped later in the same function.\n\nThis was assumed to be safe because the reference would be valid while the method's stack was active. In between the push and the pop, however, a function f was called that could invoke a user provided function.\n\nIf the user provided panicked, then the assumption used by the function was no longer true and the transmute to \u0026'static would create an illegal static reference to the string. This could result in a freed string being used during (such as in a Drop implementation) or after (e.g through catch_unwind) the panic unwinding.\n\nThis flaw was corrected in commit `e325e2f` by using a guard object to ensure that the \u0026'static str was dropped inside the function.","status":"published","published":"2021-08-25T20:54:20Z","modified":"2023-06-13T20:47:55Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-416"],"updated_at":"2026-11-02T14:36:54.225318Z"}],"nvd":[{"id":"CVE-2021-29935","description":"An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.","status":"published","published":"2021-04-01T05:15:14.593Z","modified":"2026-06-17T03:48:28.23Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high","assessor":"primary"},{"version":"2.0","score":7.5,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","level":"high","assessor":"primary"}],"cwes":["CWE-416"],"updated_at":"2026-11-02T14:06:51.197859Z"}],"osv":[{"id":"CVE-2021-29935","description":"An issue was discovered in the rocket crate before 0.4.7 for Rust. uri::Formatter can have a use-after-free if a user-provided function panics.","status":"published","published":"2021-04-01T05:15:14.593Z","modified":"2026-10-24T10:30:23.503354715Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"updated_at":"2026-11-02T15:44:19.483607Z"},{"id":"GHSA-vcw4-8ph6-7vw8","title":"Use after free in Rocket","description":"Affected versions of this crate transmuted a \u0026str to a \u0026'static str before pushing it into a StackVec, this value was then popped later in the same function.\n\nThis was assumed to be safe because the reference would be valid while the method's stack was active. In between the push and the pop, however, a function f was called that could invoke a user provided function.\n\nIf the user provided panicked, then the assumption used by the function was no longer true and the transmute to \u0026'static would create an illegal static reference to the string. This could result in a freed string being used during (such as in a Drop implementation) or after (e.g through catch_unwind) the panic unwinding.\n\nThis flaw was corrected in commit `e325e2f` by using a guard object to ensure that the \u0026'static str was dropped inside the function.","status":"published","published":"2021-08-25T20:54:20Z","modified":"2023-11-08T04:05:43.819286Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-416"],"updated_at":"2026-11-02T15:46:56.981655Z"},{"id":"RUSTSEC-2021-0044","title":"Use after free possible in `uri::Formatter` on panic","description":"Affected versions of this crate transmuted a `\u0026str` to a `\u0026'static str` before\npushing it into a `StackVec`, this value was then popped later in the same\nfunction.\n\nThis was assumed to be safe because the reference would be valid while the\nmethod's stack was active. In between the push and the pop, however, a function\n`f` was called that could invoke a user provided function.\n\nIf the user provided panicked, then the assumption used by the function was no\nlonger true and the transmute to `\u0026'static` would create an illegal static\nreference to the string. This could result in a freed string being used during\n(such as in a `Drop` implementation) or after (e.g through `catch_unwind`) the\npanic unwinding.\n\nThis flaw was corrected in commit [e325e2f](https://github.com/SergioBenitez/Rocket/commit/e325e2fce4d9f9f392761e9fb58b418a48cef8bb)\nby using a guard object to ensure that the `\u0026'static str` was dropped inside\nthe function.","status":"published","published":"2021-02-09T12:00:00Z","modified":"2023-11-08T04:05:43.819286Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"updated_at":"2026-11-02T15:53:39.492624Z"}]}}
