Attackathon _ Fuel Network 32768 - [Blockchain_DLT - Medium] WDCM and WQCM doesnt respect the fuel-s
Description
Brief/Intro
Vulnerability Details
73 pub(crate) fn [<alu_wideint_cmp_ $t:lower>](
74 &mut self,
75 ra: RegisterId,
76 b: Word,
77 c: Word,
78 args: CompareArgs,
79 ) -> SimpleResult<()> {
80 let (SystemRegisters { pc, .. }, mut w) = split_registers(&mut self.registers);
81 let dest: &mut Word = &mut w[ra.try_into()?];
82
83 // LHS argument is always indirect, load it
84 let lhs: $t = $t::from_be_bytes(self.memory.as_ref().read_bytes(b)?);
85
86 // RHS is only indirect if the flag is set
87 let rhs: $t = if args.indirect_rhs {
88 $t::from_be_bytes(self.memory.as_ref().read_bytes(c)?)
89 } else {
90 c.into()
91 };
92
93 *dest = [<cmp_ $t:lower>](lhs, rhs, args.mode);
94
95 inc_pc(pc)?;
96 Ok(())
97 }Impact Details
References
Proof of concept
Proof of Concept
PreviousAttackathon _ Fuel Network 32730 - [Smart Contract - Low] The Sway compiler currently disallows readNextAttackathon _ Fuel Network 32786 - [Smart Contract - Low] incorrect set of i bits to which it should
Last updated
Was this helpful?