-
Notifications
You must be signed in to change notification settings - Fork 5
Deserialization: verify manifest size #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| originalDump shouldBe newDump | ||
| } | ||
|
|
||
| /* show that we're no longer vulnerable to the denial of service issue filed here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment suggests that we're no longer vulnerable to the denial of service attack "small flatgraph file causes OOM". This is not correct. The fix only addresses the case where the manifest offset is changed, which is one specific instance of that general issue -- and we currently do not intend to address the general issue at all.
Can you be clearer on that? Otherwise we'll get justified "oh, we can bypass that check" vuln reports, and will implicitly condone deployments for which this is an actual security vuln.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 added more details
| throw new DeserializationException(s"corrupt file: manifest size ($manifestSize) cannot be larger than the file's size ($fileSize)") | ||
| } | ||
|
|
||
| val manifestBytes = ByteBuffer.allocate(manifestSize.toInt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to do this check at all, then please also handle the case where manifestSize overflows the 32 bit integer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 doen
bbrehm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider addressing the comments; but if you disagree, it's OK to merge as-is.
re https://github.com/joernio/flatgraph/security/advisories/GHSA-jqmx-3x2p-69vh n.b. it is not our goal to have a "safe" file format, and we need to document that properly. But adding some more straightforward checks doesn't harm.
1822557 to
cf6f7b2
Compare
re https://github.com/joernio/flatgraph/security/advisories/GHSA-jqmx-3x2p-69vh
n.b. it is not our goal to have a "safe" file format, and we need to
document that properly. But adding some more straightforward checks
doesn't harm.