Submitted by aldarion, also found by 056Security, 0xaudron, 0xbrett8571, 0xGondar, 0xgremlincat, 0xiehnnkta, 0xiehnnkta, 0xKann, 0xLasadie, 0xleadwizard, 0xLeveler, 0xMitev, 0xMosh, 4B, 4rdiii, Agontuk, Akay, anonymousjoe, ast3ros, aster, aua_oo7, Bauchibred, BenRai, BenRai, Bryan_Conquer, bumbleb33, c0pp3rscr3w3r, chaduke, Coldless, Coldless, CrazyMoose, crmx_lom, dd0x7e8, dhank, DharkArtz, dic0de, EchoKly, eLSeR17, EPSec, ETHworker, Evo, FalseGenius, farismaulana, favelanky, Fitro, Fon, franfran20, gkrastenov, Gosho, harry_cryptodev, honey-k12, hyuunn, icy_petal, Infect3d, inh3l, IzuMan, jaraxxus, jesusrod15, Jiri123, jkk812812, John_Femi, jrstrunk, jyjh, KiteWeb3, KKaminsk, komorebi, KupiaSec, lanyi2023, Le_Rems, Le_Rems, LeFy, LordAdhaar, m4k2, m4k2, macart224, Matin, mgf15, montecristo, Moyinmaala, MrPotatoMagic, mrudenko, newspacexyz, NexusAudits, OpaBatyo, Oxsadeeq, parishill24, pfapostol, pontifex, prapandey031, Prosperity, PumpkingWok, rare_one, Rhaydden, rilwan99, Robinx33, rouhsamad, rspadi, saikumar279, Shubham, silver_eth, Silverwind, slowbugmayor, SpicyMeatball, Stingo, stuart_the_minion, Summer, TenderBeastJr, threadmodeling, tpiliposian, tusharr1411, Tychai0s, typicalHuman, udo, Vagabond, Vasquez, viking71, vladi319, web3km, willycode20, X0sauce, xiao, YoanYJD, zaevlad, zaevlad, ZhengZuo999, zxriptor, and zzebra83
https://github.com/code-423n4/2024-12-lambowin/blob/874fafc7b27042c59bdd765073f5e412a3b79192/src/VirtualToken.sol#L78
In the VirtualToken contract cashIn() function uses msg.value instead of amount for minting tokens when dealing with ERC20 tokens. This causes users to lose their deposited ERC20 tokens as they receive 0 virtual tokens in return.
The root cause is the incorrect usage of msg.value in the minting logic. While the function correctly handles the token transfer with the amount parameter, it incorrectly uses msg.value for minting, which is probably 0 for ERC20 token transactions. They receive 0 virtual tokens in return (since msg.value is 0 for ERC20 transactions)
Shaneson (Lambo.win) confirmed and commented:
