{
    "id": "1dabc43b-a444-425b-8f17-cbcdf8ada891",
    "name": "Effectively Using Splunk (Scenario 2)",
    "slug": "effectively-using-splunk-scenario-2",
    "status": "published",
    "lab_type": "pta",
    "is_sample": false,
    "duration_in_seconds": 1800,
    "metadata": {
        "courses": [
            "5c7838a9-c6c4-4062-a3b2-ec2e908c19f2"
        ],
        "pta_sdn": "207",
        "pta_namespace": "my.ine",
        "learning_paths": [],
        "has_published_parent": true
    },
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2022-06-16T17:51:33.035452Z",
    "modified": "2023-10-03T18:58:30.887735Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": "3e1aa06f-2e9f-4789-b50d-aa027ad8dcfa",
    "learning_areas": [
        {
            "id": "3e1aa06f-2e9f-4789-b50d-aa027ad8dcfa",
            "name": "Cyber Security",
            "slug": "cyber-security"
        }
    ],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": false,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "external_url": "",
    "solution_video": null,
    "explanation_video": null,
    "description": "# Effectively Using Splunk (Scenario 2)\n\n## LAB 8\n\n# Scenario\n\nThe organization you work for (**Wayne Enterprises**) is using [Splunk](https://www.splunk.com/) as a SIEM solution to enhance its intrusion detection capabilities. Wayne Enterprises went through a red team exercise and the red team provided you with technical details about some of their exploitation activities (a.k.a Tactical Threat Intelligence). Your SOC manager tasked you with first trying to identify successful exploitation attempts on your own through Splunk. He then tasked you with translating the provided TTPs into Splunk searches, once the initial investigation is complete.\n\n**Note**: This lab is based on the [Boss Of The SOC (BOTS) v1 dataset](https://github.com/splunk/botsv1) released by Splunk.\n\n# Learning Objectives\n\nThe learning objective of this lab, is to learn effective Splunk search writing and how to translate attacker TTPs into Splunk searches.\n\nSpecifically, you will learn how to use Splunk's capabilities in order to:\n\n-   Have better visibility over a network\n\n-   Respond to incidents timely and effectively\n\n-   Proactively hunt for threats\n\n# Recommended tools\n\n-   Splunk\n\n-   Use a Chrome or Firefox browser to connect to Splunk's web interface (**http://demo.ine.local:8000**)",
    "description_html": "<h1>Effectively Using Splunk (Scenario 2)</h1>\n<h2>LAB 8</h2>\n<h1>Scenario</h1>\n<p>The organization you work for (<strong>Wayne Enterprises</strong>) is using <a href=\"https://www.splunk.com/\">Splunk</a> as a SIEM solution to enhance its intrusion detection capabilities. Wayne Enterprises went through a red team exercise and the red team provided you with technical details about some of their exploitation activities (a.k.a Tactical Threat Intelligence). Your SOC manager tasked you with first trying to identify successful exploitation attempts on your own through Splunk. He then tasked you with translating the provided TTPs into Splunk searches, once the initial investigation is complete.</p>\n<p><strong>Note</strong>: This lab is based on the <a href=\"https://github.com/splunk/botsv1\">Boss Of The SOC (BOTS) v1 dataset</a> released by Splunk.</p>\n<h1>Learning Objectives</h1>\n<p>The learning objective of this lab, is to learn effective Splunk search writing and how to translate attacker TTPs into Splunk searches.</p>\n<p>Specifically, you will learn how to use Splunk's capabilities in order to:</p>\n<ul>\n<li>\n<p>Have better visibility over a network</p>\n</li>\n<li>\n<p>Respond to incidents timely and effectively</p>\n</li>\n<li>\n<p>Proactively hunt for threats</p>\n</li>\n</ul>\n<h1>Recommended tools</h1>\n<ul>\n<li>\n<p>Splunk</p>\n</li>\n<li>\n<p>Use a Chrome or Firefox browser to connect to Splunk's web interface (<strong>http://demo.ine.local:8000</strong>)</p>\n</li>\n</ul>",
    "tasks": "# Tasks\n\n## Task 1: Try to identify a successful exploitation attempt without consulting with the provided TTPs\n\nAs already mentioned the red team provided you with technical details about some of their exploitation activities. Your SOC manager tasked with first trying to identify a successful exploitation attempt on your own leveraging Splunk.\n\nThe red team performed a plethora of exploitation activities. Identifying one is enough to complete this task.\n\n**Hints**:\n\n-   Start your investigation by focusing on the **stream:dns** sourcetype. Then, keep following leads until you identify what actually happened. Curious-looking domain names are always of interest.\n\n## Task 2: Translate the provided red team TTPs into Splunk searches\n\nThe red team informed you that they used the following TTPs during the exercise.\n\n1.  Malicious USB\n\n2.  Computer-generated domain names (to speed the domain generation process up)\n\n3.  Malicious VBS\n\n4.  Mature Ransomware\n\n5.  Code Obfuscation\n\nTranslate the provided red team TTPs into Splunk searches.\n\n**Hints**:\n\n1.  Removable media can be identified by the existence of drive letters in Sysmon logs or the existence of the string *friendlyname* in Windows registry logs\n\n2.  <https://www.splunk.com/blog/2017/11/03/you-can-t-hyde-from-dr-levenshtein-when-you-use-url-toolbox.html>\n\n3.  The **CommandLine** field of Sysmon logs can help you with that\n\n4.  Mature ransomware in addition to attempting to disable system restore try to delete everything stored in the VSC using the Volume Shadow Copy Service (VSS)\n\n5.  Obfuscated code usually involves the execution of an overly long command",
    "tasks_html": "<h1>Tasks</h1>\n<h2>Task 1: Try to identify a successful exploitation attempt without consulting with the provided TTPs</h2>\n<p>As already mentioned the red team provided you with technical details about some of their exploitation activities. Your SOC manager tasked with first trying to identify a successful exploitation attempt on your own leveraging Splunk.</p>\n<p>The red team performed a plethora of exploitation activities. Identifying one is enough to complete this task.</p>\n<p><strong>Hints</strong>:</p>\n<ul>\n<li>Start your investigation by focusing on the <strong>stream:dns</strong> sourcetype. Then, keep following leads until you identify what actually happened. Curious-looking domain names are always of interest.</li>\n</ul>\n<h2>Task 2: Translate the provided red team TTPs into Splunk searches</h2>\n<p>The red team informed you that they used the following TTPs during the exercise.</p>\n<ol>\n<li>\n<p>Malicious USB</p>\n</li>\n<li>\n<p>Computer-generated domain names (to speed the domain generation process up)</p>\n</li>\n<li>\n<p>Malicious VBS</p>\n</li>\n<li>\n<p>Mature Ransomware</p>\n</li>\n<li>\n<p>Code Obfuscation</p>\n</li>\n</ol>\n<p>Translate the provided red team TTPs into Splunk searches.</p>\n<p><strong>Hints</strong>:</p>\n<ol>\n<li>\n<p>Removable media can be identified by the existence of drive letters in Sysmon logs or the existence of the string <em>friendlyname</em> in Windows registry logs</p>\n</li>\n<li>\n<p><a href=\"https://www.splunk.com/blog/2017/11/03/you-can-t-hyde-from-dr-levenshtein-when-you-use-url-toolbox.html\">https://www.splunk.com/blog/2017/11/03/you-can-t-hyde-from-dr-levenshtein-when-you-use-url-toolbox.html</a></p>\n</li>\n<li>\n<p>The <strong>CommandLine</strong> field of Sysmon logs can help you with that</p>\n</li>\n<li>\n<p>Mature ransomware in addition to attempting to disable system restore try to delete everything stored in the VSC using the Volume Shadow Copy Service (VSS)</p>\n</li>\n<li>\n<p>Obfuscated code usually involves the execution of an overly long command</p>\n</li>\n</ol>",
    "published_date": "2020-10-20T15:32:25Z",
    "solutions": "# SOLUTIONS\n\nBelow, you can find solutions for every task of this lab. Remember though, that you can follow your own strategy (which may be different from the one explained in the following lab.\n\n**Kali Machine**\n\n![0](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/0.jpg)\n\n## Task 1: Try to identify a successful exploitation attempt without consulting with the provided TTPs\n\nOnce you are logged into Splunk's web management interface, click the **Search & Reporting** application that resides on the **Apps** column on your left. You should see something similar to the below.\n\n![1](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/1.jpg)\n\nBefore starting your investigation change the time range picker to **All time**.\n\nAlways identify the available sourcetypes before you begin your investigation. You can do that as follows.\n\n```\n| metadata type=sourcetypes index=\"botsv1\"\n```\n\nYou should see the below.\n\n![2](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/2.jpg)\n\nAs you can see, Splunk has ingested Windows event logs, Sysmon logs, Fortigate UTM logs, Suricata logs etc.\n\nIf you want better granularity regarding the available sourcetypes, submit the search below.\n\n```\n| metadata type=sources index=\"botsv1\"\n```\n\nNotice that searches leveraging metadata are executed almost instantaneously.\n\nYou should now see something similar to the below.\n\n![3](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/3.jpg)\n\nThe results between the last two searches are the same. The second search will provide you with a little more detail about the available sourcetypes.\n\nIf you look carefully enough you will notice that the *firstTime*, *lastTime* and *recentTime* entries follow the epoch time representation. To convert epoch time to a human understandable representation submit the following search.\n\n```\n| metadata type=sources index=\"botsv1\" | convert ctime(firstTime) as firstTime | convert ctime(lastTime) as lastTime | convert ctime(recentTime) as recentTime\n```\n\nYou should see the following.\n\n![4](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/4.jpg)\n\nIn case you want to identify all the available hosts in the dataset before you start your investigation, you can do that through the following search.\n\n```\n| metadata type=hosts index=\"botsv1\" | convert ctime(firstTime) as firstTime | convert ctime(lastTime) as lastTime | convert ctime(recentTime) as recentTime\n```\nYou can sort the above by total count to gain a better understanding.\n\n![5](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/5.jpg)\n\n\nA great sourcetype to start with is **stream:dns**.\n\n```\nindex=botsv1 sourcetype=stream:dns | fieldsummary\n```\n\n![6](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/6.jpg)\n\nThe results of the search above may be difficult to read, so create a table that will contain **field** and **values** entries only. You can that by submitting the following search.\n\n```\nindex=botsv1 sourcetype=stream:dns | fieldsummary | table field values\n```\n\nYou should see something similar to the below.\n\n![7](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/7.jpg)\n\nYou now need to determine which of the available fields is more important. **dest** could provide you with useful information, but the most interesting field in these results is **query{}**, since it can provide you with information related to interactions with remote (and possibly malicious) servers.\n\n![8](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/8.jpg)\n\nTo better analyze DNS query information, submit the following search.\n\n```\nindex=botsv1 sourcetype=stream:dns | stats count by query{} | sort count\n```\nYou should see something similar to the below.\n\n![9](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/9.jpg)\n\nGoing through all queries you will spot some curious-looking domain names. Such a domain name is **cerberhhyed5frqa.xmfir0.win**\n\nYou can look into this curious-looking domain, as follows.\n\n```\nindex=botsv1 sourcetype=stream:dns query{}=cerberhhyed5frqa.xmfir0.win | table _time src_ip dest_ip query{}\n```\n\nYou will see the following results.\n\n![10](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/10.jpg)\n\n\nIn the results (sorted by time) above you can see the **192.168.250.100** host making a DNS query to **192.168.250.20**. **192.168.250.20** in turn makes a number of external DNS queries. From this behavior you can assume that **192.168.250.20** is a DNS server and **192.168.250.100** is probably a compromised machine.\n\nBased on the time included in the results above, you can give **192.168.250.100** a look as follows.\n\n```\nindex=botsv1 sourcetype=stream:dns src_ip=192.168.250.100 earliest=08/24/2016:0:0:0 | table _time src_ip dest_ip query{} | dedup query{}\n```\n\nYou should see the following.\n\n![11](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/11.jpg)\n\nNotice that the earliest events are located at the bottom of the table.\n\nThe possibly compromised **192.168.250.100** system is looking for *isatap* and *wpad* right after visiting the curious-looking **cerberhhyed5frqa.xmfir0.win** domain. *isatap* is related to IPv6 tunneling and *wpad* to proxying. This is quite suspicious...\n\nWhat you should do next is investigate the behavior of the possibly compromised **192.168.250.100** system, by analyzing other logs <u>for approximately the same period of time as above</u>. Sysmon logs are perfect for this.\n\nFirst, change the time range picker as follows and click **Apply**.\n\n![12](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/12.jpg)\n\nThen, submit the following search.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" SourceIp=\"192.168.250.100\"\n```\nYou should see something similar to the below.\n\n![13](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/13.jpg)\n\nThose two spikes are certainly suspicious.\n\nAn important field to check is **app**.\n\n![14](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/14.jpg)\n\n-   The fact that *osk.exe* is in around 83% of the values is certainly suspicious\n\n-   *osk.exe* is usually related to on screen keyboard. The known *osk.exe* though doesn't reside in the     *C:\\\\\\\\Users\\\\\\\\<user>\\\\\\\\AppData\\\\\\\\Roaming\\\\\\\\* directory. This is also suspicious.\n\n-   Notice a user named Bob Smith, who is a possible attack victim\n\nYou could have also identified this application, as follows.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" SourceIp=\"192.168.250.100\" | stats count by app\n```\n\n![15](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/15.jpg)\n\n*osk.exe* definitely looks suspicious. So, give it a closer look by simply clicking on it.\n\nYou should see something similar to the below.\n\n![16](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/16.jpg)\n\nBy inspecting the **dest_port** field. You will be presented with the below.\n\n![17](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/17.jpg)\n\n-   That's an awful lot of network traffic for an application like on screen keyboard. This is suspicious.\n\n-   Port 6892 corresponds to bit torrent and windows live messenger file transfer, something also suspicious.\n\nThere is only one communication on port 80, click on it to learn more. You should see the below.\n\n![18](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/18.jpg)\n\nThere's a destination IP in the result **54.148.194.58**, which is worth checking, but since user Bob Smith is most probably a victim of an attack, consult with the available Sysmon logs to identify what else is running on his machine. You can do that as follows.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" app=\"C:\\\\Users\\\\bob.smith.WAYNECORPINC*\"\n```\nInspect the **app** field once again. You should see the following.\n\n![19](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/19.jpg)\n\nNotice the existence of another curious looking application **C:\\Users\\bob.smith.WAYNECORPINC\\AppData\\Roaming\\121214.tmp**. Give it a look by clicking on it. You should see the following.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" app=\"C:\\\\Users\\\\bob.smith.WAYNECORPINC*\" app=\"C:\\\\Users\\\\bob.smith.WAYNECORPINC\\\\AppData\\\\Roaming\\\\121214.tmp\"\n```\n\n![20](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/20.jpg)\n\nNothing curious-looking in the results, but there are important fields that could be added to assist your investigation, such as the **CommandLine** or the **ParentCommandLine** one.\n\nSubmit the following search to see all the occurrences of *121214.tmp* in the Sysmon logs and also any entry/log that contains **ParentCommandLine** or **CommandLine** entries.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"121214.tmp\" AND (ParentCommandLine=* OR CommandLine=*) | table _time process process_id ParentProcessId ParentImage CommandLine ParentCommandLine\n```\nYou should see the following.\n\n![21](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/21.jpg)\n\nThe earliest events are at the bottom of the table. If you start from the first (earliest) event you will see that *wscript.exe* (parent) called *cmd.exe* (child). In addition to that, you can see from **ParentCommandLine** that *wscript.exe* executed *20429.vbs*.\n\nYou can identify more about *20429.vbs* by submitting the following search.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"20429.vbs\" AND (ParentCommandLine=* OR CommandLine=*) | table _time process process_id ParentProcessId ParentImage CommandLine ParentCommandLine\n```\n\nYou should see the following.\n\n![22](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/22.jpg)\n\nThis is clearly obfuscated code. User Bob Smith is definitely victim of an attack.\n\n\nSysmon logs also contain MD5 hashes. If you would like to learn more about that *121214.tmp* file you saw earlier, change time range picker to **All time**, submit the following search and inspect the **md5** field.\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"121214.tmp\" \n```\n\n![23](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/23.jpg)\n\nYou will come across the following.\n\n![24](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/24.jpg)\n\nIf you submit the **EE0828A4E4C195D97313BFC7D4B531F1** hash on a search engine, you will identify that you are dealing with Cerber ransomware.\n\n## Task 2: Translate the provided red team TTPs into Splunk searches\n\n1.  Identify a malicious USB\n\nRemovable media can be identified through the following Splunk searches.\n\n```\nindex=botsv1 sourcetype=\"xmlwineventlog:microsoft-windows-sysmon/operational\" \"d:\\\\\" | stats count by Computer,CommandLine\n```\n\n![25](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/25.jpg)\n\nYou will have to include all possible drive letters. The search above is to test the existence of a D: drive only.\n\n```\nindex=botsv1 sourcetype=winregistry friendlyname | table host object data\n```\n\n![26](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/26.jpg)\n\n2.  Identify computer-generated domain names\n\nThe following search may uncover computer-generated domain names.\n\n```\nindex=botsv1 sourcetype=stream:dns | table query{} | lookup ut_parse_extended_lookup url as query{} | search ut_domain!=None NOT (ut_domain_without_tld=microsoft OR ut_domain_without_tld=msn OR ut_domain_without_tld=akamaiedge OR ut_domain_without_tld=akadns OR ut_domain=nsatc.net OR ut_domain=quest.net OR ut_domain=windows.com OR ut_domain=arin.net) | `ut_shannon(ut_subdomain)` | stats count by query{} ut_subdomain ut_domain ut_domain_without_tld ut_tld ut_shannon | sort - ut_shannon\n```\n\n![27](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/27.jpg)\n\n3.  Identify malicious VBS\n\nThe following search may identify malicious VBS files\n\n```\nindex=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"*.vbs\" AND (ParentCommandLine=* OR CommandLine=*) | table _time process process_id Parent rocessId ParentImage CommandLine ParentCommandLine\n```\n\n![28](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/28.jpg)\n\n4.  Identify mature ransomware activity\n\nThe following search can possibly identify mature ransomware activity.\n\n```\nindex=\"botsv1\" source=\"wineventlog:microsoft-windows-sysmon/operational\" EventCode=1 process=*\\\\vssadmin.exe | search CommandLine=\"*vssadmin*\" CommandLine=\"*Delete *\" CommandLine=\"*Shadows*\"\n```\n\n![29](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/29.jpg)\n\n5.  Identify code obfuscation\n\nThe following search can possibly identify attackers using code obfuscation.\n\n```\nindex=\"botsv1\" source=\"wineventlog:microsoft-windows-sysmon/operational\" | eval len=len(CommandLine) | table User, len, CommandLine | sort - len\n```\n![30](https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/30.jpg)",
    "solutions_html": "<h1>SOLUTIONS</h1>\n<p>Below, you can find solutions for every task of this lab. Remember though, that you can follow your own strategy (which may be different from the one explained in the following lab.</p>\n<p><strong>Kali Machine</strong></p>\n<p><img alt=\"0\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/0.jpg\" /></p>\n<h2>Task 1: Try to identify a successful exploitation attempt without consulting with the provided TTPs</h2>\n<p>Once you are logged into Splunk's web management interface, click the <strong>Search &amp; Reporting</strong> application that resides on the <strong>Apps</strong> column on your left. You should see something similar to the below.</p>\n<p><img alt=\"1\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/1.jpg\" /></p>\n<p>Before starting your investigation change the time range picker to <strong>All time</strong>.</p>\n<p>Always identify the available sourcetypes before you begin your investigation. You can do that as follows.</p>\n<pre class=\"codehilite\"><code>| metadata type=sourcetypes index=\"botsv1\"</code></pre>\n\n<p>You should see the below.</p>\n<p><img alt=\"2\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/2.jpg\" /></p>\n<p>As you can see, Splunk has ingested Windows event logs, Sysmon logs, Fortigate UTM logs, Suricata logs etc.</p>\n<p>If you want better granularity regarding the available sourcetypes, submit the search below.</p>\n<pre class=\"codehilite\"><code>| metadata type=sources index=\"botsv1\"</code></pre>\n\n<p>Notice that searches leveraging metadata are executed almost instantaneously.</p>\n<p>You should now see something similar to the below.</p>\n<p><img alt=\"3\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/3.jpg\" /></p>\n<p>The results between the last two searches are the same. The second search will provide you with a little more detail about the available sourcetypes.</p>\n<p>If you look carefully enough you will notice that the <em>firstTime</em>, <em>lastTime</em> and <em>recentTime</em> entries follow the epoch time representation. To convert epoch time to a human understandable representation submit the following search.</p>\n<pre class=\"codehilite\"><code>| metadata type=sources index=\"botsv1\" | convert ctime(firstTime) as firstTime | convert ctime(lastTime) as lastTime | convert ctime(recentTime) as recentTime</code></pre>\n\n<p>You should see the following.</p>\n<p><img alt=\"4\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/4.jpg\" /></p>\n<p>In case you want to identify all the available hosts in the dataset before you start your investigation, you can do that through the following search.</p>\n<p><pre class=\"codehilite\"><code>| metadata type=hosts index=\"botsv1\" | convert ctime(firstTime) as firstTime | convert ctime(lastTime) as lastTime | convert ctime(recentTime) as recentTime</code></pre>\nYou can sort the above by total count to gain a better understanding.</p>\n<p><img alt=\"5\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/5.jpg\" /></p>\n<p>A great sourcetype to start with is <strong>stream:dns</strong>.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=stream:dns | fieldsummary</code></pre>\n\n<p><img alt=\"6\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/6.jpg\" /></p>\n<p>The results of the search above may be difficult to read, so create a table that will contain <strong>field</strong> and <strong>values</strong> entries only. You can that by submitting the following search.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=stream:dns | fieldsummary | table field values</code></pre>\n\n<p>You should see something similar to the below.</p>\n<p><img alt=\"7\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/7.jpg\" /></p>\n<p>You now need to determine which of the available fields is more important. <strong>dest</strong> could provide you with useful information, but the most interesting field in these results is <strong>query{}</strong>, since it can provide you with information related to interactions with remote (and possibly malicious) servers.</p>\n<p><img alt=\"8\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/8.jpg\" /></p>\n<p>To better analyze DNS query information, submit the following search.</p>\n<p><pre class=\"codehilite\"><code>index=botsv1 sourcetype=stream:dns | stats count by query{} | sort count</code></pre>\nYou should see something similar to the below.</p>\n<p><img alt=\"9\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/9.jpg\" /></p>\n<p>Going through all queries you will spot some curious-looking domain names. Such a domain name is <strong>cerberhhyed5frqa.xmfir0.win</strong></p>\n<p>You can look into this curious-looking domain, as follows.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=stream:dns query{}=cerberhhyed5frqa.xmfir0.win | table _time src_ip dest_ip query{}</code></pre>\n\n<p>You will see the following results.</p>\n<p><img alt=\"10\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/10.jpg\" /></p>\n<p>In the results (sorted by time) above you can see the <strong>192.168.250.100</strong> host making a DNS query to <strong>192.168.250.20</strong>. <strong>192.168.250.20</strong> in turn makes a number of external DNS queries. From this behavior you can assume that <strong>192.168.250.20</strong> is a DNS server and <strong>192.168.250.100</strong> is probably a compromised machine.</p>\n<p>Based on the time included in the results above, you can give <strong>192.168.250.100</strong> a look as follows.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=stream:dns src_ip=192.168.250.100 earliest=08/24/2016:0:0:0 | table _time src_ip dest_ip query{} | dedup query{}</code></pre>\n\n<p>You should see the following.</p>\n<p><img alt=\"11\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/11.jpg\" /></p>\n<p>Notice that the earliest events are located at the bottom of the table.</p>\n<p>The possibly compromised <strong>192.168.250.100</strong> system is looking for <em>isatap</em> and <em>wpad</em> right after visiting the curious-looking <strong>cerberhhyed5frqa.xmfir0.win</strong> domain. <em>isatap</em> is related to IPv6 tunneling and <em>wpad</em> to proxying. This is quite suspicious...</p>\n<p>What you should do next is investigate the behavior of the possibly compromised <strong>192.168.250.100</strong> system, by analyzing other logs <u>for approximately the same period of time as above</u>. Sysmon logs are perfect for this.</p>\n<p>First, change the time range picker as follows and click <strong>Apply</strong>.</p>\n<p><img alt=\"12\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/12.jpg\" /></p>\n<p>Then, submit the following search.</p>\n<p><pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" SourceIp=\"192.168.250.100\"</code></pre>\nYou should see something similar to the below.</p>\n<p><img alt=\"13\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/13.jpg\" /></p>\n<p>Those two spikes are certainly suspicious.</p>\n<p>An important field to check is <strong>app</strong>.</p>\n<p><img alt=\"14\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/14.jpg\" /></p>\n<ul>\n<li>\n<p>The fact that <em>osk.exe</em> is in around 83% of the values is certainly suspicious</p>\n</li>\n<li>\n<p><em>osk.exe</em> is usually related to on screen keyboard. The known <em>osk.exe</em> though doesn't reside in the     <em>C:\\\\Users\\\\<user>\\\\AppData\\\\Roaming\\\\</em> directory. This is also suspicious.</p>\n</li>\n<li>\n<p>Notice a user named Bob Smith, who is a possible attack victim</p>\n</li>\n</ul>\n<p>You could have also identified this application, as follows.</p>\n<pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" SourceIp=\"192.168.250.100\" | stats count by app</code></pre>\n\n<p><img alt=\"15\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/15.jpg\" /></p>\n<p><em>osk.exe</em> definitely looks suspicious. So, give it a closer look by simply clicking on it.</p>\n<p>You should see something similar to the below.</p>\n<p><img alt=\"16\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/16.jpg\" /></p>\n<p>By inspecting the <strong>dest_port</strong> field. You will be presented with the below.</p>\n<p><img alt=\"17\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/17.jpg\" /></p>\n<ul>\n<li>\n<p>That's an awful lot of network traffic for an application like on screen keyboard. This is suspicious.</p>\n</li>\n<li>\n<p>Port 6892 corresponds to bit torrent and windows live messenger file transfer, something also suspicious.</p>\n</li>\n</ul>\n<p>There is only one communication on port 80, click on it to learn more. You should see the below.</p>\n<p><img alt=\"18\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/18.jpg\" /></p>\n<p>There's a destination IP in the result <strong>54.148.194.58</strong>, which is worth checking, but since user Bob Smith is most probably a victim of an attack, consult with the available Sysmon logs to identify what else is running on his machine. You can do that as follows.</p>\n<p><pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" app=\"C:\\\\Users\\\\bob.smith.WAYNECORPINC*\"</code></pre>\nInspect the <strong>app</strong> field once again. You should see the following.</p>\n<p><img alt=\"19\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/19.jpg\" /></p>\n<p>Notice the existence of another curious looking application <strong>C:\\Users\\bob.smith.WAYNECORPINC\\AppData\\Roaming\\121214.tmp</strong>. Give it a look by clicking on it. You should see the following.</p>\n<pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" app=\"C:\\\\Users\\\\bob.smith.WAYNECORPINC*\" app=\"C:\\\\Users\\\\bob.smith.WAYNECORPINC\\\\AppData\\\\Roaming\\\\121214.tmp\"</code></pre>\n\n<p><img alt=\"20\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/20.jpg\" /></p>\n<p>Nothing curious-looking in the results, but there are important fields that could be added to assist your investigation, such as the <strong>CommandLine</strong> or the <strong>ParentCommandLine</strong> one.</p>\n<p>Submit the following search to see all the occurrences of <em>121214.tmp</em> in the Sysmon logs and also any entry/log that contains <strong>ParentCommandLine</strong> or <strong>CommandLine</strong> entries.</p>\n<p><pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"121214.tmp\" AND (ParentCommandLine=* OR CommandLine=*) | table _time process process_id ParentProcessId ParentImage CommandLine ParentCommandLine</code></pre>\nYou should see the following.</p>\n<p><img alt=\"21\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/21.jpg\" /></p>\n<p>The earliest events are at the bottom of the table. If you start from the first (earliest) event you will see that <em>wscript.exe</em> (parent) called <em>cmd.exe</em> (child). In addition to that, you can see from <strong>ParentCommandLine</strong> that <em>wscript.exe</em> executed <em>20429.vbs</em>.</p>\n<p>You can identify more about <em>20429.vbs</em> by submitting the following search.</p>\n<pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"20429.vbs\" AND (ParentCommandLine=* OR CommandLine=*) | table _time process process_id ParentProcessId ParentImage CommandLine ParentCommandLine</code></pre>\n\n<p>You should see the following.</p>\n<p><img alt=\"22\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/22.jpg\" /></p>\n<p>This is clearly obfuscated code. User Bob Smith is definitely victim of an attack.</p>\n<p>Sysmon logs also contain MD5 hashes. If you would like to learn more about that <em>121214.tmp</em> file you saw earlier, change time range picker to <strong>All time</strong>, submit the following search and inspect the <strong>md5</strong> field.</p>\n<pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"121214.tmp\" </code></pre>\n\n<p><img alt=\"23\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/23.jpg\" /></p>\n<p>You will come across the following.</p>\n<p><img alt=\"24\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/24.jpg\" /></p>\n<p>If you submit the <strong>EE0828A4E4C195D97313BFC7D4B531F1</strong> hash on a search engine, you will identify that you are dealing with Cerber ransomware.</p>\n<h2>Task 2: Translate the provided red team TTPs into Splunk searches</h2>\n<ol>\n<li>Identify a malicious USB</li>\n</ol>\n<p>Removable media can be identified through the following Splunk searches.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=\"xmlwineventlog:microsoft-windows-sysmon/operational\" \"d:\\\\\" | stats count by Computer,CommandLine</code></pre>\n\n<p><img alt=\"25\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/25.jpg\" /></p>\n<p>You will have to include all possible drive letters. The search above is to test the existence of a D: drive only.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=winregistry friendlyname | table host object data</code></pre>\n\n<p><img alt=\"26\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/26.jpg\" /></p>\n<ol>\n<li>Identify computer-generated domain names</li>\n</ol>\n<p>The following search may uncover computer-generated domain names.</p>\n<pre class=\"codehilite\"><code>index=botsv1 sourcetype=stream:dns | table query{} | lookup ut_parse_extended_lookup url as query{} | search ut_domain!=None NOT (ut_domain_without_tld=microsoft OR ut_domain_without_tld=msn OR ut_domain_without_tld=akamaiedge OR ut_domain_without_tld=akadns OR ut_domain=nsatc.net OR ut_domain=quest.net OR ut_domain=windows.com OR ut_domain=arin.net) | `ut_shannon(ut_subdomain)` | stats count by query{} ut_subdomain ut_domain ut_domain_without_tld ut_tld ut_shannon | sort - ut_shannon</code></pre>\n\n<p><img alt=\"27\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/27.jpg\" /></p>\n<ol>\n<li>Identify malicious VBS</li>\n</ol>\n<p>The following search may identify malicious VBS files</p>\n<pre class=\"codehilite\"><code>index=botsv1 source=\"WinEventLog:Microsoft-Windows-Sysmon/Operational\" \"*.vbs\" AND (ParentCommandLine=* OR CommandLine=*) | table _time process process_id Parent rocessId ParentImage CommandLine ParentCommandLine</code></pre>\n\n<p><img alt=\"28\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/28.jpg\" /></p>\n<ol>\n<li>Identify mature ransomware activity</li>\n</ol>\n<p>The following search can possibly identify mature ransomware activity.</p>\n<pre class=\"codehilite\"><code>index=\"botsv1\" source=\"wineventlog:microsoft-windows-sysmon/operational\" EventCode=1 process=*\\\\vssadmin.exe | search CommandLine=\"*vssadmin*\" CommandLine=\"*Delete *\" CommandLine=\"*Shadows*\"</code></pre>\n\n<p><img alt=\"29\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/29.jpg\" /></p>\n<ol>\n<li>Identify code obfuscation</li>\n</ol>\n<p>The following search can possibly identify attackers using code obfuscation.</p>\n<p><pre class=\"codehilite\"><code>index=\"botsv1\" source=\"wineventlog:microsoft-windows-sysmon/operational\" | eval len=len(CommandLine) | table User, len, CommandLine | sort - len</code></pre>\n<img alt=\"30\" src=\"https://assets.ine.com/content/ptp/Effectively_Using_Splunk_Scenario_2/30.jpg\" /></p>",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "default",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": [],
    "global_running_session": {
        "id": "c3de86a5-32f0-4dbb-9511-a5a591515e52",
        "user_id": "5dde02c1-353c-4e44-af4d-e217c38efd6a",
        "lab": {
            "id": "ad7c1ba5-4f43-39d6-87fb-be25e6623608",
            "name": "XSS Attack with XSSer",
            "lab_type": "pta"
        },
        "pta_url": "https://jznfpnoy8i385wsg90w9sfzb8.us-east-4.attackdefensecloudlabs.com",
        "last_started_at": "2024-06-21T18:53:01.159725Z",
        "terminated_at": null,
        "running_time": 10185,
        "metadata": {
            "layout": "en-us-qwerty",
            "region": "US-East",
            "context": {
                "parent_id": "ec4e1013-09f0-486a-acea-ee4936e2cf7f",
                "parent_name": "Web Application Penetration Testing: Introduction to the Web and HTTP Protocol",
                "parent_type": "course"
            }
        },
        "status": "started",
        "created": "2024-06-21T18:53:01.159766Z",
        "modified": "2024-06-21T21:42:47.103438Z",
        "duration_in_seconds": 10179,
        "shutdown_time": 10800
    }
}