2023 | ångstromCTF | pwn
Sailor's Revenge
题目¶
After the sailors were betrayed by their trusty anchor, they rewrote their union smart contract to be anchor-free! They even added a new registration feature so you can show off your union registration on the blockchain!
nc challs.actf.co 31404
解题思路¶
-
目标是获取至少 \(10^8\) lamports
-
程序支持四种指令
- CreateUnion 向
vault发送ballamports,并创建一个账户存储SailorUnion结构的数据,初始available_funds为 0 - PayDues 当
member的余额不低于amt时,将amtlamports 从member转移到vault,SailorUnion的available_funds增加amt - StrikePay 当
available_funds不低于amt时,将amtlamports 从vault转移到member(增加user账户余额的唯一方法 :D) - RegisterMember 创建一个账户存储
Registration结构的数据,初始balance为 -100
- CreateUnion 向
-
SailorUnion和Registration的字段是重合的,且balance的类型为i64,若按照SailorUnion反序列化balance为负数的Registration类型的数据,将得到一个数值很大的u64,同时member对应authority -
那么,在调用
strike_pay时将rich_boi为user注册的Registration账户作为SailorUnion账户传入就可以啦 (ΦˋωˊΦ)
Exploitation¶
Cargo.toml
Flag¶
actf{maybe_anchor_can_kind_of_protect_me_from_my_own_stupidity}
最后更新:
2023年7月29日 22:01:56
Contributors: