Skip to content

Conversation

@Konstanty
Copy link
Owner

@Konstanty Konstanty commented Jan 28, 2022

Merge several OOB read fixes discovered from a long fuzzing operation (debrouxl).

Konstanty added 30 commits May 29, 2017 06:49
- ensures good 'state' of variable
- use single % as it wont execute additional code
- this solution is much cleaner
(This is purely cosmetic)
- previously only events were freed.
- avoid need to check twice.
- there are many more required elements in an OKT file.
- many checks vs mt2instrument
- check wDataLen - it might be large enough to be negative in signed equiv.
- len might be zero (or len-4)
- check before memcpy
- check before reading ps[x] data
- Another octave of possible values, means no OOB read will occur.
- prevents strange negative numbers,
- prevents divide by zero
@debrouxl
Copy link

debrouxl commented Jan 28, 2022

Woo, fixes have been merged :)

When the dust has settled a bit, it's time for a new release.
While creating CVE IDs for every single fix made to the library as part of this PR is both undesirable (some issues only have practical impact with instrumented code, AFAICT) and really cumbersome, considering the sheer number of fixes, several CVE IDs for more severe or more visible vulnerabilities (e.g. OOB writes such as aea13cc , UAF, UMR, divide by zero which is pure DoS but doesn't require instrumentation, nullptr deref which is pure DoS under sane OS unless the offset is large) should be requested nevertheless, so as to prod downstreams into upgrading libmodplug.

@AliceLR
Copy link
Contributor

AliceLR commented Jan 28, 2022

So far I've found a couple of minor redundant checks from combining this and my patch that can be revised. I also found more potential breakage in the Oktalyzer loader I somehow never noticed. Will follow up with a small patch after I test this a little more.

edit: yep, 0.1 seconds of fuzzing with UBSan confirmed this loader has major alignment problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants