# There is a vulnerability in the executeFlashloan function of the PeUSDMainnet contract. Hackers can use this vulnerability to burn other people's eUSD token balance without permission

PeUSDMainnet.executeFlashloan accepts an arbitrary receiver, so anyone can burn a victim's eUSD by naming them as receiver and inflating the loan fee.

- Payout: Contest reward
- Severity: high
- Program: Lybra Finance
- Credited: Neon2835
- Disclosed: 2023-08-21
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2023-06-lybra-findings/issues/769
- Library page: https://bugbountylibrary.com/r/c4%3A2023-06-lybra%3AH-01
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic

**Target:** PeUSDMainnetStableVision.executeFlashloan / EUSD.burnShares
**Root cause:** executeFlashloan takes a caller-supplied FlashBorrower receiver and charges the flash-loan fee by calling EUSD.burnShares(address(receiver), burnShare), so the fee is burned from the receiver's balance rather than the borrower's.
**Steps:**
1. Identify a victim contract holding eUSD whose fallback/onFlashLoan does not revert (e.g. GnosisSafeProxy at 0x32034276343de43844993979e5384d4b7e030934 holding 200,000 eUSD).
2. Call `PeUSDMainnet.executeFlashloan(receiver=victim, eusdAmount=4_000_000, data)` with eusdAmount large enough that fee = eusdAmount * feeRate (up to 10%) equals the victim's balance.
3. Line 132 `receiver.onFlashLoan(shareAmount, data)` succeeds via the victim's fallback (delegatecall to singleton returns without revert).
4. Line 133 `EUSD.transferFrom(receiver, address(this), getMintedEUSDByShares(shareAmount))` succeeds without allowance because PeUSDMainnet is a mintVault.
5. Fee is burned via `EUSD.burnShares(address(receiver), burnShare)`, destroying the victim's eUSD balance.
**How found:** Code reading of executeFlashloan revealed the receiver parameter is user-controlled and the fee is burned from receiver; then checked EUSD.transferFrom/burnShares mintVault bypass and searched for on-chain contracts with permissive fallback (GnosisSafeProxy) holding eUSD.
**Exploitation:** Attacker picks any eUSD-holding contract with a permissive fallback, sets eusdAmount so the computed fee equals the victim's balance, and calls executeFlashloan; the victim's eUSD is burned as the flash-loan fee with no approval needed.
**Insight:** When a fee or penalty is charged to a caller-supplied address, check whether that address can be a third party; also note mintVault roles bypass ERC20 allowance in transferFrom, turning any fee-burn into an unapproved balance drain.
