渗透备忘录

Convenient commands for your pentesting / red-teaming engagements, OSCP and CTFs.

探测 / 枚举

从Nmap扫描中获取在线的IP

nmap 10.1.1.1 --open -oG scan-results; cat scan-results | grep "/open" | cut -d " " -f 2 > exposed-services-ips

简单的端口探活

for x in 7000 8000 9000; do nmap -Pn –host_timeout 201 –max-retries 0 -p $x 1.1.1.1; done

DNS 查找, 区域变化& 暴力破解

whois domain.com
dig {a|txt|ns|mx} domain.com
dig {a|txt|ns|mx} domain.com @ns1.domain.com
host -t {a|txt|ns|mx} megacorpone.com
host -a megacorpone.com
host -l megacorpone.com ns1.megacorpone.com
dnsrecon -d megacorpone.com -t axfr @ns2.megacorpone.com
dnsenum domain.com
nslookup -> set type=any -> ls -d domain.com
for sub in $(cat subdomains.txt);do host $sub.domain.com|grep "has.address";done

端口 Banner 信息获取

NFS 共享文件服务

列出NFS共享目录。. 如果'rw,no_root_squash'是现在的状态, no_root_squash 登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有 root 的权限

Kerberos 枚举

HTTP 暴力破解 & 漏洞扫描

RPC / NetBios / SMB

SNMP

SMTP简单邮件传输协议

活动目录

监听端口 (Powershell)

权限取得

使用限制壳

Bash

Perl

URL-Encoded Perl: Linux

Python

PHP

Ruby

Netcat without -e #1

Netcat without -e #2

Java

XTerm

JDWP RCE

使用限制壳

交互式 TTY Shells

通过WWW上传表格上传/张贴文件

通过PUT把文件放到网站主机上

生成有效载荷模式和计算偏移量

绕过File 上传

  • file.php -> file.jpg

  • file.php -> file.php.jpg

  • file.asp -> file.asp;.jpg

  • file.gif (contains php code, but starts with string GIF/GIF98)

  • 00%

  • file.jpg with php backdoor in exif (see below)

  • .jpg -> proxy intercept -> rename to .php

将PHP注入JPEG

上传.htaccess 解释 .blah 成 .php

暴力破解密码

使用Hydra破解Web表单

使用Hydra破解通用协议

HashCat开裂

使用msfvenom产生有效载荷

从Linux编译代码

从Windows编译程序集

本地文件包含到Shell

本地文件包含:读取文件

远程文件包含Shell: Windows + PHP

SQL注入到Shell或后门

SQLite注入到Shell或后门

ms sql控制台

Upgradig非交互式Shell

Python输入代码注入

本地枚举和权限升级

检查AppLocker策略

Applocker:可写的Windows目录

在Windows中找到可写的文件/文件夹

检查是否启用了Powershell日志记录

检查WinEvent日志是否暴露了安全字符串

检查WinEvent机器唤醒/休眠时间

审计政策

检查PPL中是否运行LSASS

使用ImmunityDebugger进行二进制开发

得到加载模块

查找JMP ESP地址

破解ZIP密码

设置简单HTTP服务器

MySQL用户自定义功能权限升级

Requires raptor_udf2.c and sid-shell.c or full raptor.tar:

{% file src="../../.gitbook/assets/sid-shell.c" %}

{% file src="../../.gitbook/assets/raptor_udf2.c" %}

{% file src="../../.gitbook/assets/raptor.tar" %}

码头工人特权Esclation

重新设置root密码

上传文件到目标机器

TFTP

FTP

CertUtil

PHP

Python

HTTP: Powershell

HTTP: VBScript

Copy and paste contents of wget.vbs into a Windows Shell and then:

HTTP: Linux

NetCat

HTTP: Windows”调试。exe”方法

HTTP: Windows BitsAdmin

Wscript脚本代码的下载和执行

{% tabs %} {% tab title="cmd" %}

{% endtab %}

{% tab title="code.js" %}

{% endtab %} {% endtabs %}

域名查询服务数据漏出

数据泄露

远程登录命令数据漏出

Bash平扫

在Python中使用1字节键强制XOR'ed字符串

生成坏字符串

将Python转换为Windows可执行文件(.py ->. exe )

使用NetCat进行端口扫描

使用Masscan进行端口扫描

利用脆弱的Windows服务:薄弱的服务权限

查找为给定用户显式设置的文件/文件夹权限

始终安装升高的MSI

Windows存储凭证

Unquoted 服务路径

Persistence via 服务

端口转发/ SSH隧道

SSL:本地端口转发

SSH:端口动态转发

SSH:远程端口转发

代理隧道

HTTP隧道:SSH Over HTTP

Netsh—Windows端口转发

RunAs /启动进程As

PowerShell

CMD

PsExec

Pth-WinExe

递归地查找隐藏文件: Windows

文件搜索

后开发和维护访问

浏览注册蜂巢

解密RDG密码

远程桌面连接管理器的密码可以在加密的同一计算机/帐户上解密:

解密VNC密码

创建用户并添加本地管理员

隐藏新创建的本地管理员

创建SSH授权密钥

创建没有密码的后门用户

创建另一个root用户

生成OpenSSL密码

持续的后门

代码执行/应用程序白名单绕过

Ieframe.dll

{% tabs %} {% tab title="cmd" %}

{% endtab %}

{% tab title="test.url" %}

{% endtab %} {% endtabs %}

This was inspired by and forked/adapted/updated from Dostoevsky's Pentest Notes.

最后更新于

这有帮助吗?