-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Patch bv for DoS due to malformed deserialization #8882
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8882 +/- ##
========================================
+ Coverage 80.2% 80.2% +<.1%
========================================
Files 267 267
Lines 57844 57871 +27
========================================
+ Hits 46436 46462 +26
- Misses 11408 11409 +1 |
Can't depend on a branch like that. That'll add build nondeterminism if that user pushes more commits. That also created a security hole, as that user can now add a build.rs that runs on our CI hardware using your credentials. Also, depending on git will prevent the release automation from publishing to crates.io. You need to fork the repo to solana-labs, create a release branch, push your fix there, tag it for release, and push the release to crates.io. |
AFAIK this is not an issue as git-dependencies are pinned to specific commits in the Line 339 in 2d12606
|
@garious Thanks for head-ups! As @Mrmaxmeier said, I thought this is a safe; cargo fails before building even if Anyway, I was careless a bit. I should have noted as such that this PR will be updated accordingly as soon as the upstream publishes a new release containing the fix. So the
I thought forking in that way is an overkill if the upstream is responsibly and reasonably active (which is in this case, yay!). The maintainer indicated the interest to merge the PR. So the forking route will be avoided. Build fails if the locked git revision doesn't match:diff --git a/Cargo.lock b/Cargo.lock
index c1ff6c767..eb62a15ee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -336,7 +336,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bv"
version = "0.11.1-alpha.0"
-source = "git+file:///home/ryoqun/work/bv-rs?branch=deserialize-check-invariants#a689add1163564464c812b9069729a3d27dcb32e"
+source = "git+file:///home/ryoqun/work/bv-rs?branch=deserialize-check-invariants#a689add1163564464c812b9069729a3d27dcb32f"
dependencies = [
"feature-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
Sweet, that's perfect. Let's try to work upstream then! That's the best outcome |
FYI: I just confimed this actually works; now our CI just refuses to build an unknown revision due to the rebased-then-force-pushed upstream PR's branch, which I re-audited as well. :) |
Replaced by #8952 |
Problem
There is a remotely-exploitable DoS vulnerability in validator.
This is caused with
unsafe
s and a missing sanitization of thebv
crate, which should catch theBitVec
's internal invariant violation from the desrialization code path.The deserialization of
BitVec
in gossip packets are under ourlimited_deserialize
protection. Nonetheless ourbincode
-basedlimited_deserialize
protection is ineffective because the memory allocation per-se isn't abnormal but its future access is by a bad pointer offsetlen
.Affected
struct
s areBloom
(both master and v1.0 branches) andEpochSlots
(only master).Also, this is affects the sysvar
SlotHistory
, but which is usually protected by BankHash, so less severe than gossips.Summary of Changes
[patch]
a upstream's pending PR, thanks to @Mrmaxmeier's PR to address this.Fixes #8873