Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CVE-2023-40551: pe-relocate: Fix bounds check for MZ binaries
In read_header(), we attempt to parse the PE binary headers. In doing so, if there is an MZ (i.e. MS-DOS) header, we locate the PE header by finding the offset in that header. Unfortunately that is not correctly bounds checked, and carefully chosen values can cause an out-of-bounds ready beyond the end of the loaded binary. Unfortunately the trivial fix (bounds check that value) also makes it clear that the way we were determining if an image is loadable on this platform and distinguishing between PE32 and PE32+ binaries has the exact same issue going on, and so the fix includes reworking that logic to correctly bounds check all of those tests as well. It's not currently known if this is actually exploitable beyond creating a denial of service, and an attacker who is in a position to use it for a denial of service attack must already be able to do so. Resolves: CVE-2023-40551 Reported-by: gkirkpatrick@google.com Signed-off-by: Peter Jones <pjones@redhat.com>
- Loading branch information