Sunday, 21 October 2018

Home Lab ATT&CK Use Case

Hi All,

I was working on some presentaiton slides for my upcoming talk on 'communication'. I felt I made some good progress and wanted to reward myself by blogging.

Update: This idea was inspired from a blog post on ATT&CK by the Brakeing Incident Response Podcast crew, Episode 7

Blogging on what? The ATT&CK framework of course. Its super popular, very useful, and I was like: "I should try this in my home lab in just a basic use case". So the idea was to pick an attack and just investigate a local system. SUPER BASIC.

AKA: As a defender I want to investigate if my windows system has been compromised.

My Lab as the platform

I have a simple home LAB setup. Always needing to finish it off properly. The most important pieces is that I have a Domain setup and wanted to use that for the ATT&CK use case.

Example of my Home Lab (I am quite proud of this so far):


The Test Case from ATT&CK
So lets go to the mitre ATT&CK page and then to the Windows Techniques. There are many techniques to choose from.




Having many to choose from. I chose something simple. Something like "Brute Force". The idea here is that I can just check the event viewer for logs maybe. Without having to install tools like sysmon or OSquery for advanced logging and metrics.

From the section on "Brute Force" on ATT&CK the description is:
"Adversaries may use brute force techniques to attempt access to accounts when passwords are unknown or when password hashes are obtained."

The below paragraph I thought would be a good use case

"Adversaries may attempt to brute force logins without knowledge of passwords or hashes during an operation either with zero knowledge or by attempting a list of known or possible passwords. This is a riskier option because it could cause numerous authentication failures and account lockouts, depending on the organization's login failure policies."


The Plan:

I want to check my Domain / systems for any instance of brute force attacks.


Where to start?

Let us Google Windows Password Brute Force Attack. But this more comes up with Password Cracking Tools.  Such as shown here:

This is in the right area. But not really Brute forcing a system.
There is a tool called THC- Hydra that can brute force Windows, such as SMB authentication.

But is that right?

So I've found a tool that brute forces SMB, but that does not help me look on Windows for Brute Force Attacks - It does help me emulate the attacks if I am unable to see anything on my Windows System.

ATT&CK Brute Force

I was Googling around and though that a failed brute force attack will show many failed logins on Windows Systems. I checked the ATT&CK Brute Force description page and I was correct.

There is a detection system and they suggest monitoring authentication logs for system and application login falies of Valid Accounts. - Lesson learned, ATT&CK will give a break down of mitigation and detection of attacks. Super cool!




So how does one monitor authentication logs? - GOOGLE ftw

Viewing Authentication Logs


I got lost in here for a while. Deep and helpful, but not specifically what I was looking for.

I found an article on monitoring logons in windows environments. Which fortunately covers Domain authentication and where to look for the logs.  The key point is that authentication in a Domain is by default managed by Kerberos.



Specifically for a Windows Domain

There are 2 places to monitor for a Windows domain:
  • The Domain Controller
  • Windows Client (computer a user logs into).


Domain Controller Security Log

So I have a Domain Controller installed headless. So I had to look at powershell commands to view the event logs.

Initially I ran the Get-EventLog Security command. Which was close, but results in a high amount of scrolling data:



I can search the Security events which is great. But I need to be more specific


Using Powershell on the Domain Controller, I had no 'failed login attempts':


I was not sure if my command was correct. So I quickly created some failed logins via Powershell.
I re-ran the command and it worked:



Clearly my DC has not had any bruteforce attacks on it.

I attempted to get the Username with some PowerShell fu (that I Googled), but I need more practice:




Windows Client Security Log

My Windows client is simply a base install of Windows10.













Being a home lab. That is fairly segregated. There are no failed login logs:





Wrap -up

So as expected I found very little evidence of BruteForce attacks specifically through the event viewer. This was a very basic example of using ATT&CK for detection / hunting.

None of this was advanced, and is a very simple of example of learning using the ATT&CK framework.

Cheers
Haydn





Tuesday, 4 April 2017

3 Books I highly recommend for anxiety, imposter syndrome & my own flaw

Bene' Brown

I first heard of Bene' Browns work when I saw a YouTube video on empathy. Someone had created a cartoon with Bene's voice-over from a talk of hers. I think the cartoon adds a lot of power to the message. She discussed the difference between sympathy and empathy, in a nutshell that being able to feel what the other person is feeling without Judgement. It can be found here: https://www.youtube.com/watch?v=1Evwgu369Jw


It was a good video and resonated with me really well. The imagery of the goat (I think) eating  sandwich and responding to someones marriage falling apart with 'at least you had a marriage' is quite strong. 

So many people when responding to your struggle or how you are feeling will respond with a silver lining, unable to accept that you are not 'happy'. Which reminds me of my mother, when I had exams, or an important interview, I was stressed, needing someone to listen and she would respond with 'you'll be fine', or 'you always pass the exam'... This coming across that she thinks me passing an exam or interview is easy or a given. This is certainly not the case and to pass an exam takes hours and hours of study, frustration and perseverance, a simple you'll be fine diminishes every effort I go through in passing an exam.

Anyhow, that is an example in my life of getting sympathy and not empathy.

Bene' Brown is a shame researcher, using research to understand shame and how best to deal with it. In short, she is like a doctor for your conscious.

3 books

So obviously with an introduction on Bene' Brown the 3 books I am going to recommend are by here.

#1) The Gifts of Imperfection

Someone first suggested this book when I was not accepting my anxiety, not aware of it and not understand why I could not control my emotions. This book helped so much.

This one as Bene' summarises is about being you, living genuinely yourself and accepting who you area.

Sidenote: I still struggle with anxiety and hate myself for it. - Something I am working on

#2) Daring Greatly

Honestly, I have not read this one yet.. But it is about having the confidence to be the real you. So I am looking forward to reading it.

#3) Rising Strong

This one is about when you fall, or fail and the long hard climb back to where you work.

I am reading / listening to this book now.

This one is much more relevant to my current situation. Especially with anxiety and that 'fake' story we jump to. Or I jump to when something bad is happening, or when my emotions explode.

I am unsure if it is an evolutionary trait, or bias, as a way to survive, but when something happens (bad, a fight, bad meeting etc) I think the worst. I have an issue with self-worth.  This can happen when you open yourself up to someone/colleagues etc etc. and they brush it off, or sharing something you are excited about and friends brush it off, or a thing at work that you are all pumped for and does not go well, things like that, that cause shame.. I instinctively go to I am not enough... It is my current worst flaw in my personal life. A nice video here sort of explains it: https://www.youtube.com/watch?v=5RsPjFnNdw4

This book is helping me to understand it, or at least become aware of it. I have not read it all, so I am unsure what exactly to do. I do know, that the easy path of shutting down, hiding and giving everything away is not the answer.. This is not something new, its always been there, one of those 'curses' we bare right?..



I will continue to work on this, and blog my experiences.

Cheers
Haydn

Monday, 3 April 2017

My quick Post on UAC.

So I have been reading a bit more on some foundational knowledge. I know about UAC, using getsystem in meterpreter for uac bypasses and all the super cool UAC bypasses implemented in powershell.

Below you will find my brain-dump on how UAC works and the bypasses (or 1).

Different Levels - for security right

So process run in different levels for security reasons. Thus if a process gets popped, it shouldn't necessarily mean straight to Local Admin. Same premise of popping Apache; you become www-data with minimal rights.

So what are these levels.

System - I believe I was told this is not a 'level' but transcends the levels.
High Integrity - basically admin rights
Medium Integrity - Standard user
Low - Restricted

This is relevant when you get a shell as a user who is local admin, because you type hashdump in Meterpreter and cannot dump the hash. It is annoying as an attacker, but Windows is basically like 'lol you can't execute admin actions as a medium integrity'. You have to explicitly state that you want to execute an administrative task (hence that annoying UAC PLEASE SELECT ACCEPT pop-up).

This annoying pop up was  designed initially in Vista... EVERY process that needed admin rights caused a UAC pop-up. It was annoying to everyone, I am sure you remember Vista.


So in the later versions of windows. The Microsoft peeps decided that some applications could automatically elevate themselves, thus gaining admin rights without annoying the user...... This sounds great until it was realised that the way this happens, could be manipulated to execute a DLL of an attackers choice. Thus the UAC bypass.

This is my summary, but obviously I have to give credit to here:
https://blog.cobaltstrike.com/2014/03/20/user-account-control-what-penetration-testers-should-know/

In Short:
Using DLL hijacking to force a DLL chosen by the attacker to be loaded can allow one to bypass UAC. It is called Leo's Bypass Attack and uses sysprep.exe. When sysprep.exe ran it would look for a DLL called CRYPTBASE.dll, if you supplied it in an area that it found before the REAL dll, it would load the first dll, thus allowing High integrity. Pretty Cool huh, its an awesome trick.

The cool part is in lateral movement!

So that is awesome on that system. The cooler part I think is when you want to move laterally. If you can connect to another system, that high integrity token goes with it to the next system.

So in essence, which  named the bounceback UAC bypass (haha) is the idea of using this idea to get high integrity on your current system without DLL hijacking on that system (again mentione din the blog post above). You may have a normal user (not local admin) on a system, cannot find ways to priv esc or bypass uac, but on another system you do have local admin. So in a nutshell you connect over to that system as that user, gain the high integrity token and then connect BACK to the original system, gaining local admin on the original system.

I thought that was pretty cool.

Just a nice brain dump of what I 'remembered' from reading the post.

Cheers
Haydn





Saturday, 18 March 2017

Tripwire Blog Posts

I realized I don't have a centralized place of links for all my 'guest' blogging. So here are my Tripwire ones :).


This one was the inspiration for my BsidesSLC talk. Pretty cool how things can snowball from one another. Basically someone from BsidesSLC liked the post and said be cool if it was turned into a talk. So I did.

https://www.tripwire.com/state-of-security/risk-based-security-for-executives/connecting-security-to-the-business/top-4-tips-for-purple-team-exercises/


I was slowly getting more momentum on researching Purple Teaming / Colalboration and I was seeing a lot of us verse them with regard to Red and Blue. So I wrote this post to try to break those walls down.

https://www.tripwire.com/state-of-security/risk-based-security-for-executives/connecting-security-to-the-business/red-team-v-blue-team-they-are-in-fact-one-the-purple-team/


Working at two Big 4's gives me lots of experience with a variety of different clients, wants and needs, and many different internal managers. This all resulted in different understandings of what a penetration Test is. So I wrote this one to  consider that maybe we need a completely new term to fix things.

https://www.tripwire.com/state-of-security/security-awareness/events/penetration-testing-do-we-need-a-new-term/

Thursday, 17 September 2015

Security Cons & Twitter - Oh the value! New to infosec?

Hi all,

This blog post is about Security Cons and Twitter and the new realisation in value I am finding.

Depending on how you use them, there is enormous value in attending conferences and having a "vocal" twitter account.

  1. You will meet heroes.

    1. Great for self belief
    2. Gain new mentors

  1. You will meet others above, below and similar in skill level.

    1. Great for motivation, inspiration, finding new passions
    2. Make new friends

  1. You will gain new ideas and motivation.

    1. Great for keeping the daily grind going

  1. You will find belief in yourself

    1. Self belief is the most important in anything you do.
    2. You will see your life beyond that of the work cubicle and your day to day activities.

The caveat:
Learning is very lonely, people can help, guide, lead you to the water as they say. However you must LEARN and UNDERSTAND it yourself. To start learning is hard, to create habit is hard, but it must be done. People, conferences help with to keep pushing, to feel part of a community, but nothing changes that you must grind those hours (how many is individual) in order to build those technical skills.

TL;DR: Go to Conferences, contribute on twitter == profit.



My reasons are based on my personal experiences below:

RUXCON:

Back in 2013 I was fortunate enough to be funded by my employer to attend Ruxcon, a security conference in Australia. I was super excited and it lived up to all my hopes. Not only were there technical talks where I could learn things, I was around people who enjoyed the very same thing I did, security/hacking!  This is important because at the time security was looked down on, due to the lack of engagement opportunities of bringing money in, "go do internal audit" was the response.

I was lucky enough to hang out with @thecolonial, @egypt, @troyhunt and many others that one in infosec would typically look up too. The realization that these people are just like you and I, they love to chat, love to share knowledge is mind blowing. Mind blowing because there is a invaluable amount of knowledge that can come from them, just from a simply chat over a beer.

In addition to knowledge sharing, people at cons inspire you, everyday people have very different and great ideas that it is very hard for inspiration not to rub off on you. You could be like me, stuck in a job that infosec is not a popular topic, so losing motivation can happen easily.

DerbyCon:
I was lucky enough to gain a ticket to DerbyCon (next week), I have already connected with people I am looking forward to meet, I have gained advice on introducing myself to people. I have booked to attend the DerbyCon family dinner. I am super excited! Enthusiasm is an all time high. These times are needed to help get your through the tough lonely nights of study.


Twitter:
I did not know many people in infosec within my community, reaching out to those on twitter and receiving near real time responses is very important. Twitter helps me to feel that I am part of a caring, breaking the limits community.

I listen to 3 amazing podcasts, and the hosts reply on twitter! You ask questions, debate what they said and get a feel for how and where you are in relation to infosec.

Anyone new to infosec I always tell them to listen to:

  1. Defensive Security Podcast
  2. Down the Security Rabbit Hole Podcast
  3. Brakeing Down Security Podcast

Some people on twitter have certs I hope to achieve one day, to interact with them lowers the belief that those certs are only for rockstars.

A fellow OSCP:
I moved countries, and had a lot of things happen. I had people tell me my learning curve is longer than most people and that their instincts tell them I am not and never will be technical. That is a punch in the guts, especially when your self beliefs are already that you have a learning disability.

An OSCP joined the team, we caught up (over beers of course) and helped change my self beliefs. Chatting about their story, sharing mine, understanding that everyone starts at a different stage, which a different baseline was beneficial. It was not fixed overnight, however enough changed in me to decide once again to keep going.












Sunday, 19 April 2015

Quickly evading AV– simple and basic

Hi all,

So I have been reading “The Hacker Playbook” found here and was on the topic of evading AV. I was also looking at my OSCP course guide as I am starting the labs again soon and was on AV, so I thought why not test it out instead of just knowing the theory!

The Hacker Playbook goes through using powersploit and executing a command which can download scripts from there and run them in memory, one example is using a keylogger and having it execute in memory. Pretty sweet.

Pyinstall and all sorts of techniques were explained, most of you would be aware of the veil-framework. So I thought I would try and inject a payload into an executable via msfvenom and see if AV would pick it up, if so I would try and see if I could evade AV.

 

Testing AV evasion

My setup is simple a Kali box and a Windows VM with Free AV installed, nothing enterprise size.

So I decided to follow this tutorial from Insecurety (note the 2012 date). It is old, but with security being behind in certain areas and what not it was worth giving it a shot.

The idea of injecting into a payload is explained in the post quite clearly as “By backdooring a legitimate executable, we can effectively hide our “evil” code amongst a pile of “good” code, and backdoor it in an undetectable manner. This means antivirus software will have a hard time finding our backdoor – or at least that is what we hope.”

The key points being; hiding the malicious code amongst good code, the only problem is that the malicious code does not interrupt the execution of the program so it can easily be detected.It would be like trying to hide a ‘B’ in front of or behind  a line of ‘A’s. The 3 B’s being malicious code to launch a reverse shell for example.

 

  • Example: AAAAAAAAAA
  • Example of not interrupting the execution: BBBAAAAAA
  • Example 2: ‘ AAABAAAAAAABAAAAABAA’

 

The example of not interrupting the execution shows the B stand out like a sore thumb, so an AV would simple just scan a normal executable and if the malicious code is all together as one, it could be flagged as malicious.

Whereas in the example 2 the malicious code is broken up, making it harder for the AV to detect the malicious code as being a reverse shell.  This is a most basic example and it is how I visualize the process of simply injecting malicious code into a normal executable say putty.exe

So following the Insecurety  tutorial I created a reverse https meterpreter shell using putty.exe. I think copied it onto a shared folder to then move it onto my windows testing machine. I dropped the exe onto the windows machine and thought oh it worked, but after a few seconds it scanned the exe and found it to be malicious (my low ram may be the cause of the delay). I did not have to execute it, it was picked up before that.

 

Avast picked it up a a trojan. I did a quick goole for win32 swrort and found from Lavasoft it detects as: “Trojan. A program that appears to do one thing but actually does another (a.k.a. Trojan Horse).” Aka a backdoor.

Example of AV warning:

Selection_001

So I wanted to delve deeper and see if I could bypass basic AV. Since you need those l33t skillz. “The Hacker Playbook” in the startup phase has you install the veil-framework and also discusses it in the evade AV section. So without reading more I jumped on to install Veil and wanted to follow the steps in Veil for creating a payload to evade AV.

I am a BIG fan of Python and heard much about p2exe and pyinstaller, so I wanted to create a Python executable that launched a meterpreter reverse HTTPS payload (staged version). The same payload used in the Insecurety blog post, so I could bypass with the same reverse shell.

So I followed the steps thought Veil, which is very simple.

I created a python meterpreter reverse shell via HTTPS encrypting communications, and used pyherion (encrypts the data, I may do some more reading and post for how it works).

 

You can see the options and output below:

veil_1

 

So I did the same again having a new executable, nothing to do with putty.exe this time, but I wanted to use the same payload which my AV has the signature for and will detect. I dropped it on to my windows machine and nothing happened, *yes its on the machine*.

 

I setup a msf multi handler listener to catch it. I had to choose the payload to be

windows/meterpreter/reverse_https (the staged version). I believe if you do not set a payload it by default expects the non staged version of the windows meterpreter reverse https payload.

Setting the payload:

msf exploit(handler) > set payload windows/meterpreter/reverse_https
payload => windows/meterpreter/reverse_https
msf exploit(handler) > exploit

I double clicked the executable to launch it, the Free Avast popped up with a ‘DEEP INSPECTION’ and thought crap its picked it up, but no! It allowed it to execute.

 

Catching the reverse shell from my python executable with my meterpreter shell Smile:

 

veil_2

 

 

So that was a fun adventure, and it did not take too long to complete. Feel free to add any comments on what you have done or more in-depth explanation on the how and why of the evasion.

Saturday, 4 April 2015

Priv_checker Recon script && Free material

 


 

Hi All,

Been a while since posting. Gone through a lot in a YEAR, but I think that will be for another posting. I am more excited about some scripts I have been working on.

I am planning to take the OSCP challenge in June so I thought I would automate some things. So far automating the checking for privilege checking on windows and Unix boxes and automating recon.

 

Python Privilege Checker

The first I would like to present is my Python privilege checking script. This one I gained the idea off of a blog for an OSCP review. Which can be found at Securitysift. Also @securitysift.

He writes it in Python as well, and as I am a great fan of Python I decided to write it in the same language.

My focus is that the output is to be reviewed by me so I did not need to create a HTML template. As it is for when being on a box I wanted to use native windows/Linux command to create text files for my output.

The most basic flow of my script is:

  • Check if Linux or Windows OS
    • If Linux: run all Linux system commands
    • If Windows: run all Windows command

 

The code is on Pastebin for the month. I am figuring out an easier way to highlight my python code.

I have also created a start of a batch file in case the windows box does not a) have python installed or b) does not allow me to run executables (py installer). A shell script is almost in the making in case I find my self on a Unix box unable to run python scripts.

http://pastebin.com/zfDihegh

 

 


 

Recon script

I also gained the idea from the same blog from @securitysift.

My recon script at the moment does a simple nmap scan on all ports, parses the output from an XML file and runs other nmap scans based on the ports it finds. I wanted to use the GREP format so as to not copy cat @securitysift but found that it is difficult to parse GREP and XML was much easier. So why re-invent the wheel.

The code again can be found here:

http://pastebin.com/8pGG4fG6

 

My code is in draft, aka work in progress. It does not run other scripts off every port nor does it run every tool for the main ports. I thought I would work on it more when I am in the labs  and can see what more I need, or even if any problems are arising.

@securitysift did the great idea of having separate python scripts that the main executes, so that they can be used individually if needed, for example dns_recon.py is a script focused on dns. Mine at the current time does not do that. As the focus is oscp I feel that its not necessary, but for real work who knows, or for team exercises @securitysift module based scripts would be great.

 

 

 

Mentioning of Free material

#Infosec is great for sharing resources and most people you would consider l33t are really open to questions as long as you have done some research or considered options. Obviously there are exceptions to every rule and not all people are so open, but in generally I feel it is a great community.

A shout out I want to do is for Cybrary.IT. You may have seen their funding campaign or presence on twitter (@cybraryIT).  Go to their courses list at http://www.cybrary.it/courses/ and you will see a gigantic list of FREE material. You will notice that have Network Administration and Systems administration and a BIG focus on  security, which I really like.

So say for aspiring pentesters (yes I am still one) they have a great source of foundational material as well as post exploitation (once you get on a box). Many skilled pen testers / red teamers already have had experience in Admin experience so do not discount the other ‘not so infosecy courses’.

 

The one course I like is the Penetration Testing course, you could follow this and learn a LOT of stuff. It covers basics like footprinting yes, but the way it is white boarded in the video really helps you gain the concepts. Having a quick look at additional study material includes other free and not free materials (as shown below). Their recommendations are valid, I am currently working through TheHackerPlaybook and its great.

 

Just a little shout out to them, if you are wanting to upskill or learn a little more, hit Cybrary.IT up. Its free, its good quality, just be consistent keep at it and push through. So many materials I have that I jump from and too, I am finally learning to stick to one! This is a great path.

 

Testing the hooking in Beef Open-mouthed smile

 

 

COPY PASTE FROM THEIR WEBSITE BELOW:

Recommended Additional Study Material