Windows Spotlight Image Location

Bit of a change from my typical security related posts. I was hunting around on my machine for a new blog post when I stumbled across a folder full of oddly named files. The files were named as their SHA1 hash value with no file extension.

I opened them in Notepad++ (too lazy to open a Linux VM…. shoot me) and saw they were image files. After I opened them in PhotoViewer I noticed they were the images I see when my screen is locked; Spotlight Images.

So if you are looking for a cool picture that you saw on your Windows 10 Spotlight, look no further than:

Drive:\Users\<UserName>\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_<randomstring>\LocalState\Assets
Posted in Content Delivery Manager, Windows Spotlight | Tagged , , , , , | 1 Comment

OpenDoor Scanner vs SimpleHTTPServer (PCAP)

Often when analysing attacks, scans or just general traffic it is difficult to identify the specific tool or technique in use. This is simply because there isn’t a reference database for every tool.

So I thought I would upload a nice simple PCAP of OpenDoor Scanner so that if this is being used against you, you have the possibility of spotting it.

Quick disclaimer: this was used with no options, arguments or exclusions. This is the tool used with the default command line:

"python ./opendoor.py --url "http://privateIPaddress/"

One of the first things to note about this tool is that by default it only does “HEAD” requests. This only requests the header from that specific page and not the body (i.e. no data from the page; images, text etc). It also runs alphabetically, which is not uncommon, but certainly helps easily identify a scan.

packets

The User-Agent field changes, in fact it does not appear to be the same for any two requests. This may be an attempt to avoid automatic blocking, or maybe just the author was a little bored 🙂

user-agent

The ‘accept-language’ and ‘accept-encoding’ fields remain the same throughout. This is probably one of the best identifiers.

stream0

language-and-encoding

Analysing the PCAP

In order to see if you were affected by this I recommend the following filter in Wireshark:

http.request || http.response

This will show all requests (GET, HEAD etc) and all responses (404, 302 etc). You are looking for anything that is not a ‘404 not found’ response.

200 OK – Generally what the attacker is looking for, this means a page was delivered. Bear in mind however, some devices show a custom 404 page, meaning a 200 response is shown, but it is not the page the attacker wants.

30x – Typically a 302, however could be 301, 303 or 307. This will be in place if the page has moved, but may also redirect to a HTTPS version of the page. Watch what the responses are and work with the web dev team to decide if any action needs to be taken. I have seen a 302 give an IP of the internal interface of the webpage. While this isn’t a critical failure, it’s not good.

403/404 – Unauthorised and Not Found respectively. 404 is by far the better option. 403 gives the attacker hope the page is up, but not available to them right now. They may try to pivot back at a later attack stage.

418 – I’m a Teapot. If your server responds with this; either your web dev team have a sense of humour or you’re already screwed 🙂

I hope this helped. Please leave a comment with any constructive feedback and pop back anytime!

Download PCAP

Posted in Network Forensics, PCAP Analysis, Research, Wireshark | Tagged , , , , , | Leave a comment

Cyber Security Challenge Masterclass 2016

This year’s Cyber Security Challenge Masterclass saw over 40 contestants battling to become crowned the winner. I was fortunate enough to be invited as an assessor for the whole event. What follows are my views and interpretation of the event.

The challenge was set, and created, by PwC this year. This was the first year the company had picked up the mantle and was attempting to top the likes of HP, Airbus and BT to name just three; no small feat! Previous Masterclasses had seen a wide variety of features from disabling the guns on the HMS Belfast to dealing with a critical infrastructure compromise in the Churchill War Rooms.

The location this year was in the Shoreditch area of London in a beautifully set photography studio. The railway arches and traditional brickwork lit by red, blue and green lights created an ambiance that was both pleasant and terrifying.

Day 1

Wednesday late afternoon was the kick off to this event; all of the contestants were brought together in the Tower Hotel, split into their respective teams and shipped over to the venue. Upon arrival, they were immediately told that a large sum of money had gone missing from fictitious power company Bolt Power.

The company were sure this was an insider threat and had compiled a list of suspects; these suspects were available to be interviewed by the contestants. Some excellent acting then ensued from the PwC representatives, playing Bolt Power staff. A particularly commendable performance was from the “secretary” who was considered the central point of gossip for Bolt Power.

By the end of the first night most of the teams had a good idea of who was to blame. The evidence however, took a little longer to compile.

Day 2

Thursday morning the candidates turned up bright eyed and bushy tailed. They still had to gather the evidence of the insider threat, but were also presented with a 9GB PCAP (network traffic capture) file. This was intentionally made so large that it could not be opened with the traditional tools; instead the teams had to use their imagination.

Many teams carved the file up using Editcap, a program from the Wireshark suite of tools. This gave them multiple files to view. Some teams realised a single ‘stream’ in the PCAP was making up the bulk of the size and used TShark (also part of the Wireshark suite) to remove this single flow of data.

While the teams were working out how to deal with this issue, an email was received from Bolt Power SOC, explaining that Bolt Power were under cyber attack. They gave the teams access to Alien Vault IDS and log files using Kibana. The teams then had to demonstrate not only time management but task prioritisation. This attack was live and for every false positive that was reported points were deducted, in order to demonstrate the analytical skills of the teams.

As if this wasn’t enough, the teams were then provided with a memory capture and disk image of a compromised host within the Bolt Power environment. Volatility was the tool of choice for the memory dump, and a combination of tools was used on the disk image.

The teams discovered that there had been a compromise involving a flash exploit allowing a reverse shell to be established and data to be exfiltrated. There was also evidence that this was a nation state sponsored attack, however it was difficult to identify an individual or group.

The second day was by far the longest; the teams worked until 17:30 and were lured into a false sense of security and allowed to relax with alcohol. At around 19:00 an alarm sounded and all teams were asked to return to their workstations. Ransomware! There had been an infection of ransomware on the network and the teams were tasked with reverse engineering the malicious program to see if the data could be released. The ransomware was intentionally written with a symmetrical key, meaning the answer was available to the contestants if they knew where to look. Additional questions were also posed to the teams, including ‘what registry keys were created?’. There were some very imaginative ways of getting the required answers, however by the end of the evening all teams had dealt with the problem and were ready for Day 3

Day 3

Friday was very much a continuation of the previous day’s work with a Penetration Test (Pen Test) thrown in for good measure. The idea of the pen test; like the forensics considerations, was to see if the candidates understood how to carry out the task while taking into account legal considerations. A letter of authorisation was then issued to any team that requested it.

The end of Day 3 saw the teams given 30 minutes to create a verbal presentation to give the board of directors at Bolt Power, the people manning this board were actual directors from sponsoring companies meaning this is as real as it can get within the game environment. The teams were given a time to report to PwC Head Office were Bolt Power had set up their board room. Each team were expected to set their own timings with Bolt Power paying for the taxi journey. No help was given in terms of timings, adding to the pressure.

Each team sat in front of the board and had to explain what had gone on. As with previous competitions, the board intentionally played down their technical knowledge in order to show the candidates that explaining a ‘reverse shell’ to the CEO is not a simple task, especially when they have just been told a nation sponsored attack may have just hit their company. The pressure was turned up if the team hit a buzzword. Words like ‘safety’ would instantly get a strong reaction as Bolt Power controlled the nation’s nuclear power facilities.

Each team faced the board; each team survived the ordeal and was commended on a variety of topics.

Once the board meetings were completed, the candidates were told to go and relax in the hotel until the awards dinner later that evening; where the winning team, and winning individuals, would be decided.

Conclusion

I have assessed at several Cyber Security Challenge events, and this was one of the first to cover off almost all disciplines within the Cyber Security field, as such the assessment team noticed there was no obvious winner that excelled across every area, instead we had many strong contenders for the top slot and picking the winner was not an easy task. As always there was a passionate debate with strong arguments for and against many of the candidates.

As a result of this the assessment team were all very impressed with PwC’s competition. This is the first time we have had such a broad sweep of challenges, and I personally hope this will set the standard for all future challenges.

I would strongly encourage any company interested in embracing new talent, of all age groups, to contact the Cyber Security Challenge and register their interest. Next year’s Masterclass could contain your future analysts, consultants, engineers or even your future CISO.

Posted in Competition, Cyber, Cyber Security Challenge, Memory Forensics, Network Forensics, Pen Testing, Windows Forensics, Wireshark | Tagged , , , , , , , , , | 1 Comment

Flash Cookies – aka Locally Shared Objects

Flash Cookie Location

[Throughout this article I will use the term ‘flash cookie’ over ‘LSO’ as these posts are currently about finding and removing cookies]

%AppData%\Macromedia\Flash Player\#SharedObjects\<random text>\

Under this folder you will a list of the sites which have stored the Flash Cookie on your machine.

The following location will save the settings for these cookies

%AppData%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\

As I don’t have Flash installed on my host machine I had to ‘infect’ a virtual machine to get these cookies populated. One thing I noticed is that very few sites use flash cookies now. For example YouTube used flash cookies in 2011 (as I found in my research), however as they no longer use Flash, there are no cookies stored.

Rumours are that Adobe are looking to end Flash. However, nothing official as yet.

Removing Flash Cookies

There are a couple of options for removing these cookies

Option 1

Go to this page on the Adobe site which will fire up the Flash settings page and allow you to delete cookies and change settings

Adobe_Site_Settings

Option 2

Install a Firefox add-on like Better Privacy which will allow you to delete the cookies from the browser.

Option 3

Just delete the files! Sounds a bit brutish, but as with most cookies, they will recreate themselves if they are needed. Flash Cookies are rarely needed, I haven’t had Flash installed for 6 months and I have only noticed a couple of sites that don’t load correctly.

Cross Browser – but not Cross Site

Flash Cookies can persist between different browsers, so if you have a preferred browser for certain tasks you may notice other browsers picking up on certain habits.

Cookies cannot talk to other domains however. So if you got a cookies from ‘cdn.aaa.com’ that wouldn’t be accessible from ‘cdn.bbb.org’.

Is there a risk in deleting them?

The only risk is losing basic settings, or website specific settings. For example some Flash games will store your score in the flash cookies. However as most games are moving away from Flash this should be less of an issue.

Posted in Browser Forensics, Cookies, Firefox | Tagged , , , , | Leave a comment

HTTP Cookies – Part 4 – Safari Cookies

Safari Location

Pretty sure this location has been the same for a number of years now, if not let me know in the comments:

~/libraries/cookies

Removing Safari Cookies

I am not a MAC expert, so I am going to bow out on this part and pass you over to a blog post I have found on the subject 🙂

http://www.leancrew.com/all-this/2013/03/deleting-safari-cookies-via-applescript/

Posted in Browser Forensics, Cookies, Safari | Tagged , , , , , | Leave a comment

HTTP Cookies – Part 3 – Chrome Cookies

Chrome Location

Windows 7 onwards:

%LocalAppData%\Google\Chrome\User Data\Default

Unlike Internet Explorer (and like Firefox) Chrome does not use individual text files, but instead uses a SQLite database. In order to view this you will need a SQLite browser (easy to get via Google).

Chrome Removal

As with Internet Explorer and Firefox Ctrl + Shift + Del will shortcut you to the delete history page to allow fast removal.

If your wife hasn’t just walked through the door, and you don’t know what Private Browsing is, follow these steps:

  • Click on the “Customize and control Google Chrome” menu in the top right of the browser
  • Choose “Settings” – or type “chrome://settings” in the URL bar
  • Scroll down to the “Privacy” section and click the “Clear browsing data…” button
  • Choose the appropriate tick boxes and time frame from the drop down
Posted in Browser Forensics, Chrome, Cookies | Tagged , , , , , , , , | Leave a comment

HTTP Cookies – Part 2 – Firefox

Firefox Location

Windows 7 and onwards
%AppData%\Mozilla\Firefox\Profiles\<profile.name>\cookies.sqlite

Unlike Internet Explorer (and like Chrome) Firefox does not use individual text files for storing cookies, instead it uses a SQLite database. In order to view this you will need a SQLite browser (many free ones via Google).

You will notice Firefox is the only browser (of the big 3) that stores the Cookies in the Roaming folder.

Firefox Removal

As with IE you can press Ctrl + Shift + Del to access a quick menu to remove browsing history.

I am tempted to rename this the “Oh shit the wife’s home” combination, either that or the “pre-private browsing” combination. Let me know which sounds better in the comments.

You can also remove the cookies via the following steps

  • Press the “Open Menu” icon in the top right of your browser
  • Go to “Options” – this will open the options tab
  • Go to “Privacy” on the left hand menu ribbon
  • You then have two options:
    • “clear your recent history” – press the down arrow to ensure you clear the correct artefacts
    • “remove individual cookies” – does exactly what it says on the tin.

The “remove individual cookies” option is a good way to view what cookies are installed without the need for a 3rd party SQLite browser.

Posted in Browser Forensics, Cookies, Firefox | Tagged , , , , , , , , | Leave a comment

HTTP Cookies – Part 1 – Internet Explorer and Microsoft Edge

Finding Internet Explorer/Edge Cookies (Windows 7-10… possibly Vista, but who uses Vista?!)

Microsoft introduced a cool new way of finding your cookies. From the Run prompt or any Explorer window type “shell:cookies” and you will be taken to the Cookies location. Like a Windows Hearthstone 🙂

Location of Cookies

Just in case you want to do it the old fashioned way…

Windows 10
%LocalAppData%\Microsoft\Windows\INetCookies

Windows 8.1
%LocalAppData%\Microsoft\Windows\INetCookies

Windows 8
%AppData%\Microsoft\Windows\Cookies

Windows 7
%AppData%\Microsoft\Windows\Cookies

As you can see there was a shift from Windows 8 to 8.1. the “Roaming” folder was designed around “Roaming Profiles”, these are used in some domain environments and allow users to have things like Desktop icons and favourites when they move to a new machine.

I would suspect one of the reasons for moving them to “Local” would be because of all of the tracking cookies and other nasties that can reside there. You are basically offering free lateral movement to an attacker if they managed to get some clever attack based around cookies.

Speaking of which….

“Low” Folders

The “Low” folder was introduced in Vista to allow for browsers to run and contain certain artefacts in a segregated place.

Removing Cookies

Like most HTTP cookies these can be removed easily via the browser.

Edge

  • Click on the ” . . . ” button in the top right of the screen.
  • Click on Settings – Or press Ctrl + Shift + Del to jump to this step
  • Under the heading “Clear browsing data” press the button “Choose what to clear”
  • Ensure “Cookies and saved website data” is selected
  • Press “Clear”

Internet Explorer

  • Press Alt to bring up the menu options and go to “Tools”. Or go to “Tools” from the tool bar.
  • Go to “Internet Options”
  • Under the “General” tab, under the “Browsing History” sub-section, click “Delete” to bring up the options page – Or press press Ctrl + Shift + Del to jump to this step
  • Select the appropriate tick boxes.

Windows 7’s Internet Explorer has a lot more inverted options. For example you can keep a box ticked to keep some cookies whilst ticking another box on the same page to remove other cookies. By default removal of the “Do Not Track” cookies is ticked.

Things got a lot simpler by Windows 10.

Posted in Browser Forensics, Cookies, Internet Explorer, Microsoft Edge | Tagged , , , , , , , , , , | Leave a comment

Removing Cookies

Do you know how many cookies are tracking you? Have you tried to clear the cookies only to find some things not quite gone? Well I have a product for you!… just kidding, it sounded like an advert, so I went with it.

This post was inspired by the Evercookie

Cookie Types

  • HTTP Cookies
    • Internet Explorer
    • Firefox
    • Chrome
    • Apple Safari
  • Flash
  • Android
  • Windows Phone
  • BlackBerry
  • Silverlight
  • CSS (typically on older browsers)
  • HTTP Strict Transport Security (HSTS)
  • Window.Name cache
  • IE User data storage
  • HTML5 Storage
  • Java

[Source and inspiration for this post: https://github.com/samyk/evercookie ]

Rather than make a really long single post, I have decided to split this up in to chunks (that helps me keep from going f-ing nuts too)

I will start with good old HTTP cookies 🙂

 

Posted in Browser Forensics, Cookies | Tagged , , , | Leave a comment

Wireshark – Introduction

What is Wireshark

According to Wireshark.org:

Wireshark® is a network protocol analyzer. It lets you capture and interactively browse the traffic running on a computer network.

What does this mean to you? This means Wireshark allows you to view network traffic. The way in which you capture the network traffic further refines this statement, but basically, you can look at network traffic.

What do you mean by capture traffic?

Well, there are two ways to view traffic, live or… well dead I suppose. Live captures can be useful for seeing what is going across your network, or what your machine is doing at that moment, but it’s not easy to analyse live traffic as your interrogation of the data will change at each step.

A recorded live stream is saved off into a .pcapng file, these were formally .pcap files and most people will refer to a saved network stream simply as a “pcap” (pe-cap).

Most analysis is done on a pcap file, whether this is a network forensics looking for illegal activity, a malware specialist looking at command and control traffic or a SOC analyst investigating and intrusion detection signature firing.

Where and how do you capture data?

There are a lot of possible answers to this, but I will give two simple answers.

  1. On your local machine, capturing your own network interface card
  2. On a network, aided by a network device, such as a switch with a span port, or specially designed network device known as a tap.

The network traffic is then stored into data files, typically a pcap (pcapng). It is possible to store the data in other formats, but that is outside the scope of this post.

The method of capturing data is not important at this stage. Just bear in mind that Wireshark is used to capture data on a local machine. There is the option of the GUI or command line interface (CLI) version. Previously this was called “tshark” however since version 2 this seems to be the same as typing “wireshark” into the CLI.

Why do you need to capture data?

When a company captures all network traffic entering, leaving and traversing their network, they are said to have “full packet capture”. By having this in place they enable their security analysts to prove if something happened.

Picture the scene:

You are eagerly sat reviewing Arcsight/Logrhythm/, an alert pops up from your Intrusion Detection System (IDS). The alert reads something along the lines of “Bash vulnerability attempt”. Immediately you think of Shellshock and try to remember if that got patched. You ask the IT guy who shrugs at you and mumbles something about patching causing more problems than it fixes. The trigger packet (typically a single packet) on the IDS shows the attack, with a wget calling out to a tools server pulling down a script.

You are at the Schrödinger’s stage of compromise. You are both totally owned and 100% safe all at the same time. Without full packet capture you are now destined to explain to the IT guy why he has to pull log files, patch his server (if it’s not already done) and generally do as you tell him. This requires a booking code, justification, and explaining to various levels of management that you don’t know if the system is compromised or not.

Now let’s assume you have full packet capture.

You get the same alert, you retrieve the packets from your full packet capture system (there are many ways to do this… lets say you have a specialist product for this) and begin to investigate. You see the initial packet…… you see the tell-tale parenthesis of the shellshock, followed by the call out for the script….. did it work? The server only responded with reset (RST) packets. The tools server has not been contacted at all.

You can now escalate this as a true positive (alert fired correctly) that was thwarted by the security tools (OK, it was thwarted by the fact the server wasn’t vulnerable, but hey). The IT guy can carry on eating his doughnuts and the managers can have ten meetings to decide that you are awesome. Well done.

Ok, slightly silly example, but you get the idea.

So why do I care?

As the scenario shows being able to manipulate packets, or network data, whichever term you prefer, can calm a potentially bad situation by having visibility. It takes away the requirement to guess. The program that you would use to investigate the pcaps in this scenario would be Wireshark. It is free, easy to learn and has the depth to challenge even the most experienced analyst.

By understanding the basics of the program, you will be able to find a wealth of information.

My next set of blog posts will take us through Wireshark basics and up to an intermediate level. The posts will be technical in nature and you will need to have a basic understanding of networks.

Until next time 🙂

Posted in Network Forensics, Shellshock, Wireshark | Tagged , , , , | Leave a comment