You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ExtNetInfo deserialization drops a repeated purpose unvalidated, so mined ProTx netInfo can carry bytes Core never checks #7864
ExtNetInfo deserialization reads the purpose map with UnserializeMap, which inserts each pair with m.insert(...) (src/serialize.h:1232-1243). A purpose that appears twice is parsed and then silently dropped: insert keeps the first copy. ExtNetInfo::Validate() (src/evo/netinfo.cpp) iterates only over the resulting m_data, so the dropped copy is never validated.
Its entries can hold bytes that NetInfoEntry::Unserialize tolerates without failing (src/evo/netinfo.h:243-264): an unknown entry type is cleared after its type byte, and an invalid or unreadable service is cleared too. As a result a ProTx whose netInfo is, for example,
version 1 | 2 pairs | [CORE_P2P: <valid entry>] | [CORE_P2P: <entry with type byte 0x03>]
passes IsTriviallyValid and can be mined. The txid covers every byte, including the copy Core never looked at.
Read at develop0981a582f5 (v24.0.0-rc.3 has the same netinfo.h and providertx.h). This comes from reading the source; I have not reproduced it on a node yet.
Why it matters
Third-party parsers. Any parser that decodes netInfo strictly rejects a transaction Core accepts, and with it the whole block. rust-dashcore currently rejects unknown entry types and unknown network ids, so a crafted ProRegTx or ProUpServTx would stop SPV clients and DAPI block streaming at that block. To be safe, every library (rust-dashcore, dashcore-lib, DashSync, dashj, Insight) would have to reproduce Core's exact leniency, including the duplicate drop.
Non-canonical payloads. One masternode configuration has many valid serializations, and only the first copy of each purpose means anything.
Cheap to fix now. V24 is still NEVER_ACTIVE on mainnet, so the rule can tighten before its parameters are set. Testnet may need care if V24 activates there first.
Suggested fix
Reject a repeated purpose key while deserializing ExtNetInfo, or have Validate() compare the number of pairs read with m_data.size(). Optionally, reject cleared (invalid) entries in every copy, so the accepted byte form of netInfo is canonical.
Activity
fix(evo): reject repeated purpose in ExtNetInfo deserialization
fix(evo): reject repeated purpose in ExtNetInfo deserialization
fix(evo): reject repeated purpose in ExtNetInfo deserialization
Merge dashpay#7888: fix(consensus): canonical ExtNetInfo encoding and…
Merge dashpay#7888: fix(consensus): canonical ExtNetInfo encoding and…
Merge dashpay#7888: fix(consensus): canonical ExtNetInfo encoding and…