You can remember the meaning of 卧底 with this easy mnemonic:
You've been lying (卧) to me and hiding your identity as an undercover agent while trying to steal all our information from top to base (底) level?
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.