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
发送bal
lamports,并创建一个账户存储SailorUnion
结构的数据,初始available_funds
为 0 - PayDues 当
member
的余额不低于amt
时,将amt
lamports 从member
转移到vault
,SailorUnion
的available_funds
增加amt
- StrikePay 当
available_funds
不低于amt
时,将amt
lamports 从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: