The answer to your question is "it depends". If you have NOPASSWD access through sudo to run any command, then any program or script could potentially escalate itself to superuser access through a simple system call.
If your sudoers configuration is more sane, allowing NOPASSWD access to only a specific list of commands that are expected to be run as batch jobs (or otherwise frequently enough to make NOPASSWD arguably prudent), then attempting to sudo other commands will still balk without a password.