i earned a 15k bug bounty from @Aptos, by demonstrating how to...

however the aptos object implementation allows objects to be deleted, while resources stored in the same object address still exists
this means if you delete the object containing a FungibleStore, the FA admin (circle, tether, thala) with the freeze capability can no longer create a reference to that object
as a result those assets can never be frozen
this allows the exploiter to continue to deposit/withdraw from that FungibleStore, while the admin cannot freeze the funds
storing an Object reference to the FungibleStore is step 1) of the exploit
and before users can withdraw a FungibleAsset, there is an ownership check: signer == object.owner
normally this check requires the object metadata, ObjectCore still exists
but i found a way to bypass this check
here is the previous object::owns() implementation, can you spot the issue?
this assumption does not hold true; a user can store the object's ExtendRef and generate signatures for the object, even AFTER the object is destroyed
step 2) to the exploit is storing the FungibleStore's Object's ExtendRef
now lets say the exploiter has done some malicious activity and wants to prevent the admin from freezing their funds
step 4) we delete the Object
from this point on, the only way to withdraw, freeze or deposit funds is through the single Object
no other modules or users can read/write to this reference
the thala admin was able to freeze MOD and thAPT balances, ending the drawdown of MOD and thAPT liquidity. with this trick, the exploiters assets could never be frozen, presenting an existential risk to MOD and thAPT liquidity
circle, tether and most stablecoin issuers also have AML compliance obligations to freeze OFAC and other illegal on-chain activity

finally thala freezes the exploiters MOD and thAPT and the exploiter returns 400,000 APT to the thala treasury leaving the account with a balance of 0.01 APT
the withdraw address can also be another FungibleStore Object with freeze disabled, preventing the admin from ever freezing or seizing malicious funds, all while the exploiter can continue to misuse their funds
step 5) withdraw all funds to a new address
github.com/MoonShiesty/fa…
aptos patched the issue in aptos-framework v1.24.1
you can deploy this code, to confirm it's patched
this guarantees that if an object is owned by an address, the object still exists
now when the object metadata containing the owner is destroyed, developers are guaranteed there is no longer an object "owner"
github.com/aptos-labs/apt…
AIP-112, allows objects to manage access policies for resources stored inside them
this will allows aptos devs to restrict access to resources stored inside an object, if the object is destroyed
i like the direction aptos objects are headed. and i like how aptos objects are more powerful than sui objects; aptos object don't force developers into specific design patterns
aptos objects model is also clearly more complicated than sui's object model. this makes aptos objects more difficult to understand and reason about. in my opinion this was a key factor that contributed to this issue making into prod
i hope the new features in the aptos pipeline continue to make objects more useful, while providing the tools and apis to easily and securely reason about objects
object::owns() behavior was formally specified, but the specification itself contained an incorrect assumption that objects cannot sign for themselves after they are destroyed
the only way to find this issue was to read the code and reason about the way objects and the fungible asset api interact
i was reviewing @mirage_protocol code and thought to myself "i should check we never destroy an object containing a FungibleStore by mistake, then there's probably no way recover the funds"
so i looked. turns out you can still withdraw after destroying the object, if a reference of type Object
my next thought was "doesn't that mean you can't freeze the assets" 🤔
so i created the proof-of-concept, demonstrated it locally and submitted to the aptos bug portal
i racked my brain, and fungible_asset was the only aptos-framework code impacted by this issue
its possible other protocols were affected depending on implementation. i did some research and i wasn't able to find any














