I was thinking about this, if I have already done sudo in a shell & its authentication is active for a bit then any shell script I run (source) can potentially do a sudo and elevate status.
But for an attacker that convinced you to run some malicious shell commands (e.g. `curl ...| sh` or copy/pasting more than you bargained for) that's only a minor inconvenience; next time you sudo, they're root anyway.
//Edit
Also, an attacker aiming for root is a red herring. One compromised account can already be bad enough - why would they need root on your private computer when they already stole your password database, keylogged your master password and created an off-site backup of your home dir?
In any case safest route is to always do a new shell (or a docker vm) for fun activities.