Tuesday, August 2, 2022

TryHackMe Write-up | MISP Task 5  Scenario Event

CIRCL (Computer Incident Respons Center Luxembourg) published an event associated with PupyRAT infection. Your organisation is on alert for remote access trojans and malware in the wild, and you have been tasked to investigate this event and correlate the details with your SIEM. Use what you have learned from the room to identify the event and complete this task.

Answer the questions below

What event ID has been assigned to the PupyRAT event?

How to: Start at the home page of MISP, on the right side of the screen is a filter box, type into the filter box PupyRAT. Click the Filter button and give it a moment, the page for PupyRAT should load up and the Event ID will be the first entry you see. Copy and past it over in the answer box on THM. 

Answer: 1146

The event is associated with the adversary gaining ______ into organisations.

How to: Look at the tags for this event, the answer can be found in the purple tag labeled ms-caro-malware:malware-type. 

Answer: Remote Access 

Hint: What does RAT stand for?

What IP address has been mapped as the PupyRAT C2 Server

How to: Use ctrl + f, to bring up the find feature. Type into the find bar command this will bring you to the only time it is mentioned on the page. The IP address to the left of this find is the IP address of the C2 server. 

Answer: 89.107.62.39

From the Intrusion Set Galaxy, what attack group is known to use this form of attack?

How to: Scroll back up towards the top, till you see the galaxy tab (the text is blue in this area). Then look for the Intrusion Set label. The one entry under this is the answer to this question. 

Answer: Magic Hound

There is a taxonomy tag set with a Certainty level of 50. Which one is it?

How to: Go back up to the tags section, look for a liter blue background with white text and the number 50. The first part of this is the answer to this question. 

Answer: OSINT 

Hint: Check Tags

TryHackMe Write-Up | MISP Task 3  Using the System

 

For you to understand how MISP works and follow along in the task, launch the attached machine and use the credentials provided to log in to the Analyst Account on https://LAB_WEB_URL.p.thmlabs.com/. Wait 1 minute for the URL and lab to start up.

Username: Analyst@THM.thm  Password: Analyst1234&


Dashboard

The analyst's view of MISP provides you with the functionalities to track, share and correlate events and IOCs identified during your investigation. The dashboard's menu contains the following options, and we shall look into them further:

  • Home button: Returns you to the application's start screen, the event index page or the page set as a custom home page using the star in the top bar.
  • Event Actions: All the malware data entered into MISP comprises an event object described by its connected attributes. The Event actions menu gives access to all the functionality related to the creation, modification, deletion, publishing, searching and listing of events and attributes.
  • Dashboard: This allows you to create a custom dashboard using widgets.
  • Galaxies: Shortcut to the list of MISP Galaxies on the MISP instance. More on these on the Feeds & Taxonomies Task.
  • Input Filters: Input filters alter how users enter data into this instance. Apart from the basic validation of attribute entry by type, the site administrators can define regular expression replacements and blocklists for specific values and block certain values from being exportable. Users can view these replacement and blocklist rules here, while an administrator can alter them.
  • Global Actions: Access to information about MISP and this instance. You can view and edit your profile, view the manual, read the news or the terms of use again, see a list of the active organisations on this instance and a histogram of their contributions by an attribute type.
  • MISP: Simple link to your baseurl.
  • Name: Name (Auto-generated from Mail address) of currently logged in user.
  • Envelope: Link to User Dashboard to consult some of your notifications and changes since the last visit. Like some of the proposals received for your organisation.
  • Log out: The Log out button to end your session immediately.

https://tryhackme-images.s3.amazonaws.com/user-uploads/5fc2847e1bbebc03aa89fbf2/room-content/b4d6aae4ec0523a305b0280d4558f533.png

Home Dashboard showing available events

Event Management

The Event Actions tab is where you, as an analyst, will create all malware investigation correlations by providing descriptions and attributes associated with the investigation. Splitting the process into three significant phases, we have:

  • Event Creation.
  • Populating events with attributes and attachments.
  • Publishing.

We shall follow this process to create an event based on an investigation of Emotet Epoch 4 infection with Cobalt Strike and Spambot from malware-traffic-analysis.net. Follow along with the examples provided below.

Event Creation

In the beginning, events are a storage of general information about an incident or investigation. We add the description, time, and risk level deemed appropriate for the incident by clicking the Add Event button. Additionally, we specify the distribution level we would like our event to have on the MISP network and community. According to MISP, the following distribution options are available:

  • Your organisation only: This only allows members of your organisation to see the event.
  • This Community-only: Users that are part of your MISP community will be able to see the event. This includes your organisation, organisations on this MISP server and organisations running MISP servers that synchronise with this server.
  • Connected communities: Users who are part of your MISP community will see the event, including all organisations on this MISP server, all organisations on MISP servers synchronising with this server, and the hosting organisations of servers that are two hops away from this one.
  • All communities: This will share the event with all MISP communities, allowing the event to be freely propagated from one server to the next.

Additionally, MISP provides a means to add a sharing group, where an analyst can define a predefined list of organisations to share events.

https://tryhackme-images.s3.amazonaws.com/user-uploads/5fc2847e1bbebc03aa89fbf2/room-content/b08778016cc041ada7067c4a52376ed4.gif

Event details can also be populated by filling out predefined fields on a defined template, including adding attributes to the event. We can use the email details of the CobaltStrike investigation to populate details of our event. We will be using the Phishing E-mail category from the templates.

https://tryhackme-images.s3.amazonaws.com/user-uploads/5fc2847e1bbebc03aa89fbf2/room-content/b0fe2b5aa3cb6556b53551e1846a9ca8.gif

Attributes & Attachments

Attributes can be added manually or imported through other formats such as OpenIOC and ThreatConnect. To add them manually, click the Add Attribute and populate the form fields.

Some essential options to note are:

  • For Intrusion Detection System: This allows the attribute to be used as an IDS signature when exporting the NIDS data unless it overrides the permitted list. If not set, the attribute is considered contextual information and not used for automatic detection.
  • Batch import: If there are several attributes of the same type to enter (such as a list of IP addresses, it is possible to join them all into the same value field, separated by a line break between each line. This will allow the system to create separate lines for each attribute.

In our example below, we add an Emotet Epoch 4 C2 IP address associated with the infection as our attributes, obtained from the IOC text file.

https://tryhackme-images.s3.amazonaws.com/user-uploads/5fc2847e1bbebc03aa89fbf2/room-content/7ba507e671b184bb567708993fbe136d.gif

The analyst can also add file attachments to the event. These may include malware, report files from external analysis or simply artefacts dropped by the malware. We have added the Cobalt Strike EXE binary file to our event in our example. You also have to check the Malware checkbox to mark the file as malware. This will ensure that it is zipped and passworded to protect users from accidentally downloading and executing the file.

https://tryhackme-images.s3.amazonaws.com/user-uploads/5fc2847e1bbebc03aa89fbf2/room-content/c13e7206797bdd3e726d9bf74c831fc3.gif

Publish Event

Once the analysts have created events, the organisation admin will review and publish those events to add them to the pool of events. This will also share the events to the distribution channels set during the creation of the events.

https://tryhackme-images.s3.amazonaws.com/user-uploads/5fc2847e1bbebc03aa89fbf2/room-content/4caf7734a850d778397cb5c86f3ae237.gif

Answer the questions below

How many distribution options does MISP provide to share threat information?

How to: The answer can be found in the Event Creation section above or if you have already created the event in the MISP, choose to edit event then go over to Distribution , click on it and count the number of chooses. This is your answer. 

Answer: 4

Which user has the role to publish events?

How to: The answer can be found in the Publish section above, and if you are typing it into the answer box and getting wrong you have to use the british spelling for the first word. 

Answer: organisation admin

Monday, August 1, 2022

TryHackMe Write-Up | OpenVAS Task 7  Practical Vulnerability Management

The OpenVAS reports used are created from rooms on TryHackMe, machines used are credited to their respective owners.

Case 001: MS00-What?

In this scenario, you are assigned to a routine vulnerability management pipeline as a SOC analyst. Your automated pipeline has already pulled a scan on the server, it is up to you to analyze and identify risk in this report.

Answer the questions below

When did the scan start in Case 001?

How to: Download the file for this task, open it to reveal the report. In the report you will see Host Summary, in this section you will see a column marked Start, under this is the answer you can copy and paste it in the answer box of THM. 

Answer: Feb 28, 00:04:46

When did the scan end in Case 001?

How to: This answer is directly to the right of the previous answer. Copy and paste over in the answer box on THM. 

Answer: Feb 28, 00:21:02

How many ports are open in Case 001?

How to: Scroll down to the next section you will see Port Summary, count the number of port numbers you see in this section. Put the number you counted over into the THM answer box. 

Answer: 3

How many total vulnerabilities were found in Case 001?

How to: Right above Port Summary you will see number of results, the number in this row is the answer. Write it over in the THM answer box. 

Answer: 5

What is the highest severity vulnerability found? (MSxx-xxx)

How to: Scroll down to the Security Issues section, in the first vulnerability look into the summary. The answer is at the end of this first summary, copy and paste it over in the THM answer box. 

Answer: MS17-010

What is the first affected OS to this vulnerability?

How to: Staying in the Security Issues Section, scroll down till you see the chart title Affected Software/OS . In this section highlight the first OS up until you reach the next OS (the next OS starts with the same thing as the one you are highlighting). Now copy and paste over in the THM answer box. 

Answer: Microsoft Windows 10 x32/x64 Edition

What is the recommended vulnerability detection method?

How to: Still staying in the Security Issues Section, scroll down till you reach the Vulnerability Detection Method. Now highlight and copy the entire first line, paste it over in THM answer box. 

Answer: Send the crafted SMB transaction request with fid = 0 and check the response to confirm the vulnerability.

TryHackMe Write-up | Intro to ISAC Task 9  Investigation Scenarios

Scenario 1

Your incident response team has quarantined a suspicious bin file. The team thinks it is a ransomware variation. Investigate and create indicators for the file.

You can find the shellcode under C:\Users\Jon\Documents\Scenarios\Scenario 1

Scenario 2

You have been assigned to analyze this week's quarantined files. The file is thought to be an unknown trojan or a new strain of the emotet malware. Investigate and create indicators for the file.

You can find the shellcode under C:\Users\Jon\Documents\Scenarios\Scenario 2

Answer the questions below

Read the above and complete the investigations

How to: So even though this doesn’t require an answer, you need to do investigation on the two scenario files. Open up your favorite text editor, you will use this to document your findings as you check out this two possible malicious files. Going to each folder in turn you can right click on the file and in the drop down menu go to properties, this will give you most of the information you will need. Record in the text editor the following: File Name, File Type, Size, Size on Disk, Date Created, and file path. Now that you have all that info for both files you can now open up the program WinMD5free. Click on the Browse button to the right of the pop-up box, you can copy and paste the file path in or just click on documents, scenarios, scenario 1, and then the file. Copy the MD5 hash over to the text editor, now do the same thing but for the file in the scenario 2 folder. now the last thing to do is run strings. Click on the start icon in the bottom left corner, in the search type cmd and hit enter to open command prompt. Use the command ./strings.exe “C:\Users\Jon\Documents\Scenarios\Scenario 1\29D6161522C7F7F21B35401907C702BDDB05ED47.bin” -accepteula > “C:\Users\Jon\Documents\Scenarios\Scenario 1\output.txt” . This will save the output to a text file in the scenario 1 folder. Now use this command for the second file ./strings.exe “C:\Users\Jon\Documents\Scenarios\Scenario 2\cryptowall.bin” -accepteula > “C:\Users\Jon\Documents\Scenarios\Scenario 2\output.txt” . Now that you have completed you investigation you can answer the question for this task. 

Answer: No Answer Needed.

What is the name of the file from Scenario 1?

How to: Found this answer while doing the investigation. 

Answer: 29D6161522C7F7F21B35401907C702BDDB05ED47.bin

What is the size of the file from Scenario 1 in bytes?

How to: Found this answer while doing the investigation. 

Answer: 96,535

What is the size on disk of the file from Scenario 1 in bytes?

How to: Found this answer while doing the investigation. 

Answer: 98,304

What is the MD5 hash of the file from Scenario 1?

How to: Found this answer while doing the investigation. 

Answer: 8baa9b809b591a11af423824f4d9726a

What is the name of the file from Scenario 2?

How to: Found this answer while doing the investigation. 

Answer: cryptowall.bin

What is the size of the file from Scenario 2 in bytes?

How to: Found this answer while doing the investigation. 

Answer: 246,272

What is the size on disk of the file from Scenario 2 in bytes?

How to: Found this answer while doing the investigation. 

Answer: 249,856

What is the MD5 hash of the file from Scenario 2?

How to: Found this answer while doing the investigation. 

Answer: 47363b94cee907e2b8926c1be61150c7

Create IOCs for both files using IOCe.

How to: No Answer Needed. 

Answer: No Answer Needed.

Tuesday, July 19, 2022

TryHackMe Write-up | Yara Task 9 Using LOKI and its Yara rule set

9.1 Using LOKI

As a security analyst, you may need to research various threat intelligence reports, blog postings, etc. and gather information on the latest tactics and techniques used in the wild, past or present. Typically in these readings, IOCs (hashes, IP addresses, domain names, etc.) will be shared so rules can be created to detect these threats in your environment, along with Yara rules. On the flip side, you might find yourself in a situation where you've encountered something unknown, that your security stack of tools can't/didn't detect. Using tools such as Loki, you will need to add your own rules based on your threat intelligence gathers or findings from an incident response engagement (forensics).

As mentioned before, Loki already has a set of Yara rules that we can benefit from and start scanning for evil on the endpoint straightaway.

Navigate to the Loki directory. Loki is located in the tools.

https://assets.tryhackme.com/additional/yara/yara5.png

Run python loki.py -h to see what options are available.

If you are running Loki on your own system, the first command you should run is --update. This will add the signature-base ****directory, which Loki uses to scan for known evil. This command was already executed within the attached VM.

https://assets.tryhackme.com/additional/yara/yara6.png

Navigate to the yara directory. Feel free to inspect the different Yara files used by Loki to get an idea of what these rules will hunt for.

To run Loki, you can use the following command (note that I am calling Loki from within the file 1 directory)

https://assets.tryhackme.com/additional/yara/yara7.png

Scenario: You are the security analyst for a mid-size law firm. A co-worker discovered suspicious files on a web server within your organization. These files were discovered while performing updates to the corporate website. The files have been copied to your machine for analysis. The files are located in the suspicious-files directory. Use Loki to answer the questions below.

Answer the questions below

Scan file 1. Does Loki detect this file as suspicious/malicious or benign?

How to: Instead of going to the file's location, you can just stay in the Loki directory, use the following command python loki.py -p ~/suspicious-files/file1 , the -p indicates the path to the file. Hit enter and Loki should be running now, wait till it is done and you should see in yellow at the bottom of RESULTS. The answer is in here. 

Answer: suspicious

What Yara rule did it match on?

How to: If you look in the section above where you found the first answer you will see REASON_1 , if you look to the right you will see the word MATCH, the answer is right after this. 

Answer: webshell_metaslsoft

What does Loki classify this file as?

How to: This can be found right underneath the answer to the previous question. 

Answer: Web Shell 

Hint: Check description

Based on the output, what string within the Yara rule did it match on?

How to: This can be found underneath the answer to the previous question, string is key. 

Answer: Str1

What is the name and version of this hack tool?

How to: This one was really difficult for me to find but once I did I kicked myself. Go down till you first see the Warning label. From there go to the FIRST_BYTES , and go all the way to the right. The answer is after the *. 

Answer: b374k 2.2 

Hint: Check first_bytes

Inspect the actual Yara file that flagged file 1. Within this rule, how many strings are there to flag this file?

How to: If you go up to the info section on your Loki scan you will see Processing YARA rules at once, then it has a file path after it. Follow this path to the location of the YARA file. Then you need to find the file that deals with webshells, if you need help look at the hint (I had too), then nano it. Now that your in nano press F6, this will bring up the search in nano and copy the answer from question two and paste it in here. You should be brought right to it. Now just scroll down and count how many strings there are, and you will have your answer.

Answer: 1 

Hint: yara/thor-webshells.yar

Scan file 2. Does Loki detect this file as suspicious/malicious or benign?

How to: Run this scan the same way you did for file 1, python loki.py -p ~/suspicious-files/file2 . The RESULTS will have your answer. 

Answer: benign

Inspect file 2. What is the name and version of this web shell?

How to: To inspect file 2 run the command, nano /home/cmnatic/suspicious-files/file2/1ndex.php. At the top you will see the answer, just take shell out of it.

Answer: b374k 3.2.3 

Hint: Read the comments in the file

TryHackMe Write-Up | Yara Task 2 What is Yara?


https://i.imgur.com/SQJYZLf.jpg

2.1. All about Yara

"The pattern matching swiss knife for malware researchers (and everyone else)" (Virustotal., 2020)

With such a fitting quote, Yara can identify information based on both binary and textual patterns, such as hexadecimal and strings contained within a file.

Rules are used to label these patterns. For example, Yara rules are frequently written to determine if a file is malicious or not, based upon the features - or patterns - it presents.

Strings are a fundamental component of programming languages. Applications use strings to store data such as text.

For example, the code snippet below prints "Hello World" in Python. The text "Hello World" would be stored as a string.

https://i.imgur.com/yltgfD8.png

Hello Earth! Can you hear me?

We could write a Yara rule to search for "hello world" in every program on our operating system if we would like.

2.2. Why does Malware use Strings?

Malware, just like our "Hello World" application, uses strings to store textual data. Here are a few examples of the data that various malware types store within strings:

Untitled

2.3. Caveat: Malware Analysis

Explaining the functionality of malware is vastly out of scope for this room due to the sheer size of the topic. I have covered strings in much more detail in "Task 12 - Strings" of myMAL: Introductory room. In fact, I am creating a whole Learning Path for it. If you'd like to get a taster whilst learning the fundamentals, I'd recommend my room.

Answer the questions below

What is the name of the base-16 numbering system that Yara can detect?

How to: The answer can be found in the first sentence of this room (Not the quote), and it is the abbreviated name.

Answer: Hex

Would the text "Enter your Name" be a string in an application? (Yay/Nay)

How to: Any text with in qoutes (””), will be a string. 

Answer: Yay


TryHackMe Write-Up | Sysinternals Task 9  Miscellaneous

BgInfo "It automatically displays relevant information about a Windows computer on the desktop's background, such as the computer ...