Guest User

j00ru's SECURE 2014 presentation

a guest
Oct 23rd, 2014
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.09 KB | None | 0 0
  1. The following is a translation of
  2. http://j00ru.vexillium.org/blog/23_10_14/Ucieczka%20z%20Matrixa.pdf
  3. using Google Translate.
  4. That presentation is linked from http://j00ru.vexillium.org/?p=2454
  5.  
  6.  
  7.  
  8. Escape from the Matrix:
  9. (un) safe malware analysis
  10. Matthew "j00ru" Jurczyk
  11.  
  12.  
  13. Mateusz Jurczyk
  14. ===============
  15. • ISE @ Project Zero, Google
  16. • Dragon Sector Team Vice-Captain
  17. • @j00ru
  18. • http://j00ru.vexillium.org/
  19.  
  20.  
  21. What will this be about?
  22. ========================
  23. • The malware.
  24. • The tools for their analysis.
  25. • The security vulnerabilities in these.
  26. • About their active use in order to implement
  27. malicious code on a victim machine.
  28. In short, what dangers lie in wait for analysts
  29. malicious software on real examples.
  30.  
  31.  
  32. What will this NOT be about?
  33. ============================
  34. The passive hindering analysis
  35. (obfuscation, anti-debugging tricks, steganography
  36. etc.)
  37.  
  38.  
  39.  
  40. A year ago, SECURE ...
  41. =======================
  42. "The thing about increasing (in) security. Food
  43. for thought. "
  44. Gynvael Coldwind
  45.  
  46.  
  47.  
  48. A year ago, SECURE ...
  49. ======================
  50. Gynvael showed that anti-virus applications
  51. in addition to detecting threats can seriously
  52. increase the attack surface of the system
  53. computer.
  54.  
  55.  
  56. A year ago, SECURE ...
  57. ======================
  58. • AV programs that in the end a great target for
  59. bughunter and attacking:
  60. - Most often written in the native languages ​​(yield) ...
  61. - Parse complex data formats: files
  62. executables, archives, documents, ...
  63. - With administrator rights or the kernel ...
  64. - Taking as input each file appears in the
  65. machine.
  66.  
  67.  
  68.  
  69. The thesis is confirmed
  70. =======================
  71. Over the last year there is even more evidence:
  72. - Joxean Koret, Breaking Anti-Virus Software, Syscan 2014 [1].
  73. - Dozens of critical errors in most AV products.
  74. Tavis Ormandy • Denial of Service in Microsoft Malware
  75. Engine Protection, June 2014 [2].
  76.  
  77.  
  78.  
  79. The thesis is confirmed
  80. =======================
  81. Twitter post from Joxean Koret (@matalaz) on Oct 17: "There are some antivirus that I wonder if they happen to know how to code at all. I'm not talking about secure aware coding."
  82.  
  83.  
  84. Okay, ...
  85. =========
  86. ... Anti-virus may not be entirely safe.
  87. And if you generalize a bit the problem, and we consider the
  88. the entire set of software that "contact" with malignant
  89. software?
  90. For example, the tools for the analysis of
  91. malware?
  92.  
  93.  
  94. A brief digression
  95. ==================
  96. • Year 2012 on a popular website with the tip .cn
  97. (China) find the SWF file with interesting me
  98. functionality.
  99. • Cheerfully I load this file into Sothink SWF Decompiler,
  100. one of the better decompilers for Flash files.
  101. • waits for a few seconds, then ...
  102.  
  103.  
  104. A brief digression
  105. ==================
  106. (screenshot of crash fo SWFDecompiler.exe)
  107.  
  108.  
  109.  
  110. A brief digression
  111. ==================
  112. Pinning debugger, and there:
  113. (screenshot of windbg with access violation at 0x41414141)
  114.  
  115.  
  116.  
  117. Coming back to the topic ...
  118. =============================
  119. Can we trust the tools, which on a daily basis
  120. people use the AV companies, other organizations, and
  121. properly and ourselves?
  122. - Who has not started once ProcessExplorer,
  123. ProcessMonitora or Wireshark?
  124. Simple answer: Unfortunately not. :(
  125.  
  126.  
  127. (slide 16, can't copy text to translate)
  128.  
  129.  
  130. Examples
  131. ========
  132.  
  133.  
  134.  
  135. Hex-Rays IDA Pro
  136. ================
  137. • IDA Pro is currently the best available on the market
  138. disassembler executable files.
  139. - Runs on Windows, GNU / Linux, OS X.
  140. - The vast user base: an essential tool
  141. each reverse-engineer.
  142. - Opportunity to buy dekompilatorów platforms
  143. IA-32, IA-64 and ARM 32.
  144.  
  145.  
  146. familiar sight
  147. ==============
  148. (screenshot of IDA Pro)
  149.  
  150.  
  151.  
  152. Hex-Rays invests in safety
  153. ==========================
  154. • ASLR, DEP, / GS and other collateral default
  155. included in the executable and libraries.
  156. • Self, safer implementation of standard
  157. C function such as strncat and strncpy.
  158. • Bug bounty program: for each critical error in
  159. deasemblerze or dekompilatorze company pays 3000
  160. USD.
  161.  
  162.  
  163. Bug bounty program
  164. ==================
  165. (screenshot of hex-rays.com/bugbounty.shtml)
  166.  
  167.  
  168. On the other hand, ...
  169. ======================
  170. • Written entirely in C / C ++.
  171. • Part of the source code available in the IDA SDK.
  172. • A partial list of supported file formats:
  173. (long list of formats)
  174.  
  175.  
  176.  
  177. On the other hand, ...
  178. ======================
  179. • Even more supported formats assembly: more than 60 processor families:
  180. (longer list of processors families)
  181.  
  182.  
  183. Many bugs reported and repaired since 2011
  184. ==========================================
  185. (screenshot of 13 bounties paid from hex-rays.com/bugbounty.shtml)
  186.  
  187.  
  188. Is it pays to look further?
  189. ===========================
  190. • Question in mid-August 2014.
  191. • I decided to give it a chance.
  192. - At 100%, not all formats are supported
  193. exactly przeaudytowane.
  194. - High reward is a good motivator.
  195. • For about three weeks audits the evenings
  196. open and closed code IDA.
  197.  
  198.  
  199.  
  200. Results cursory audit
  201. =====================
  202. • 12 different classes of errors "memory corruption" found parsers
  203. formats:
  204. - QNX, COFF, DBG, EPOC, DEX, PEF
  205. • 2 errors recognized by the Hex-Rays for NOFIX due to unrealistic
  206. attack scenario.
  207. • The remaining 10 vulnerabilities classified as 6 separate problems.
  208. • Corrected by the manufacturer in less than two weeks.
  209. - Date of filing: September 6, 2014
  210. - This patch release: September 15, 2014
  211.  
  212. (screenshot of changelog for IDA Pro with vulns from j00ru)
  213.  
  214.  
  215. Types of errors found
  216. =====================
  217. • COFF, DBG: Heap Buffer Overflow due to an Integer Underflow.
  218. • EPOC: 4-byte Heap Buffer Overflow due to an Off-By_one in bounds checking.
  219. .
  220. • DEX: Heap Buffer Overflow due to Integer Overflow.
  221. • PEF: Multiple Heap Buffer Overflows due to Integer Handling Problems.
  222. • PEF: Heap Memory Corruption due to logical errors in memory management.
  223. • Many: Heap Buffer Overflows due to logical errors in memory management.
  224.  
  225.  
  226.  
  227. EPOC 4-byte Heap Overflow is due Off-By-One
  228. ===========================================
  229. • EPOC is a simple executable file format used
  230. on the operating system of the same name.
  231. - More known as Symbian.
  232. • It consists of a header, followed by sections
  233. memory.
  234. - Data section of the file can be saved to "plain text"
  235. or compressed or DEFLATE algorithm BYTEPAIR
  236.  
  237.  
  238. EPOC file format overview
  239. =========================
  240. (image of file format)
  241. ```
  242. +--------------------------+
  243. | E32 header |
  244. +--------------------------+
  245. | | Text section |
  246. |Code +-----------------+
  247. |section | Export table |
  248. | +-----------------+
  249. | | Import table |
  250. +--------------------------+
  251. |BSS section |
  252. +--------------------------+
  253. |Data section |
  254. +--------------------------+
  255. |Import section |
  256. +--------------------------+
  257. |Relocation section |
  258. +--------------------------+
  259. ```
  260.  
  261.  
  262. Not so fast ...
  263. ===============
  264. • No source code format in the IDA SDK EPOC.
  265. - It only remains to reverse engineer the file epoc.ldw.
  266. • Very poor documentation format, in particular
  267. algorithms (de) compression.
  268. • The only source of knowledge is meaningful projects GnuPoc [3]
  269. (SymbianOS SDK) and symbian-dump (publicly available
  270. Symbian code) [4]
  271.  
  272.  
  273. Further analysis of the
  274. =======================
  275. • After a brief analysis, it was found that Hex-Rays
  276. advantage of DEFLATE decompression code from the package
  277. GnuPoc.
  278. - But we can read C code! :)
  279. • How to decompression, the code is written
  280. exceptionally well.
  281.  
  282.  
  283.  
  284. Short exercise: find the error
  285. ==============================
  286. (image of some code related to Huffman:InteralizeL on slide 33)
  287.  
  288.  
  289.  
  290. Off-By-One Error
  291. ================
  292. • The condition should read:
  293. ```
  294. if (p >= end) {
  295. ```
  296. • Error allows for 4-byte (sizeof (Tuint32))
  297. overwriting a buffer of fixed length 1316 bytes.
  298. • In the nearby code were more mistakes
  299. this type.
  300.  
  301.  
  302. Off-By-One Error
  303. ================
  304. (slide 36, can't copy text)
  305. *** glibc detected *** ./idaq: free(): invalid pointer: 0x09dcecf8 ***
  306. ======= Backtrace: =========
  307. /lib/i386-linux-gnu/libc.so.6(+0x75b12)[0xf5f41b12]
  308. /opt/ida-6.6/loaders/epoc.llx(+0xce3c)[0xf55bde3c]
  309. /opt/ida-6.6/loaders/epoc.llx(+0xd406)[0xf55be406]
  310. /opt/ida-6.6/libida.so(+0x16c815)[0xf749b815]
  311. /opt/ida-6.6/libida.so(load_nonbinary_file+0xde)[0xf749bb8e]
  312. ./idaq[0x80b7ff5]
  313. ./idaq[0x8134d06]
  314. /opt/ida-6.6/libida.so(init_database+0x10d6)[0xf73d1c06]
  315. ./idaq[0x8094a1e]
  316. ./idaq[0x8284848]
  317. ./idaq[0x828497f]
  318. ./idaq[0x809605b]
  319. ./idaq[0x8096133]
  320. ./idaq[0x80963f7]
  321. /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xf5ee54d3]
  322. ./idaq[0x807ed11]
  323.  
  324.  
  325.  
  326. PEF Multiple Heap Buffer Overflows due to Integer Handling Problems
  327. ===================================================================
  328. - Preferred Executable Format
  329. - Executable file format used for many years ago in Mac OS.
  330. - Currently seen only on PowerPC under the control of BeOS.
  331. - Source code available in the IDA SDK.
  332.  
  333.  
  334. The process_loader_data
  335. =======================
  336. • The process data addressed shifts defined in the header file.
  337. (image of code for process_loader_data function)
  338.  
  339.  
  340.  
  341.  
  342. structure pef_loader_t
  343. =======================
  344. • All offsets are defined as 32​​-bit, fully controlled field.
  345. (image of pef_loader_t struct)
  346. • IDA Pro 6.6 is available only in 32-bit version, which favors
  347. formation of Integer overflow errors while performing
  348. operations on indicators and offsets.
  349.  
  350.  
  351. Although the verification is ...
  352. ================================
  353. (image of code, and text I can't copy)
  354.  
  355.  
  356. As a result, the buffer overflows
  357. =================================
  358. (image of seg fault output)
  359.  
  360.  
  361.  
  362. more errors
  363. ===========
  364. - In process_loader_data were 4 Integer
  365. Overflowy leading to memory corruption.
  366. - For the observant: shown earlier in Listing. There is one more logical error.
  367. - Indicators for semantically distinct structure in the file calculated are based on a single input buffer.
  368. - Structures can (and should) overlap in memory.
  369. - A modification can lead to an unexpected change another.
  370.  
  371.  
  372.  
  373.  
  374. BADMEMSIZE
  375. ==========
  376. • IDA internally uses its own memory container for lists and
  377. buffers:
  378. - qvector
  379. - Bytevec_t (inherited from qvector)
  380. • These classes provide some standard methods, such as:
  381. - :: Growfill
  382. - :: Append
  383. - :: Reserve
  384. - :: Resize
  385.  
  386.  
  387. Protection against Integer overflows
  388. ====================================
  389. • These methods detect overflow situations
  390. integer variable.
  391. • handle them but in a rather unusual way.
  392. - Rather than return an error code or throw an exception, lined
  393. the size of the required buffer at a constant BADMEMSIZE.
  394. - Assumption: malloc (BADMEMSIZE) never
  395. fail.
  396.  
  397.  
  398. example
  399. =======
  400. (image of code for checking an append and setting a var to the value BADMEMSIZE)
  401.  
  402.  
  403.  
  404. What is BADMEMSIZE?
  405. ===================
  406. ```
  407. #ifdef __X64__
  408. #define BADMEMSIZE 0xDEADBEEFDEADBEEF
  409. #else
  410. #define BADMEMSIZE 0xDEADBEEF
  411. #endif
  412. ```
  413.  
  414.  
  415. Hmm ...
  416. =======
  417. • IDA is only available in 32-bit, So we consider a fixed 0xDEADBEEF.
  418. • 0xDEADBEEF = 3 735 928 559
  419. - Almost the entire 32-bit address space.
  420. - Well, "Almost". Let's see if in fact allocation of this size never fails.
  421.  
  422.  
  423. Windows
  424. =======
  425. (image of process explorer showing memory usages for processes)
  426.  
  427.  
  428. Mac OS X
  429. ========
  430. CG image 0ad39000-0ad45000 [ 48K] rw-/rwx SM=PRV
  431. OpenGL GLSL 0aec8000-0aeca000 [ 8K] rw-/rwx SM=ZER
  432. MALLOC_LARGE (freed) 0aeca000-0af0b000 [ 260K] rw-/rwx SM=PRV
  433. MALLOC_LARGE (freed) 0af8c000-0afcd000 [ 260K] rw-/rwx SM=PRV
  434. CG image 0afed000-0b000000 [ 76K] rw-/rwx SM=PRV
  435. MALLOC_SMALL 0b000000-0b800000 [ 8192K] rw-/rwx SM=COW
  436. __DATA 0bfbc000-0bffe000 [ 264K] rw-/rwx SM=COW
  437. __DATA 0bffe000-0c023000 [ 148K] rw-/rwx SM=PRV
  438. __DATA 0c12f000-0c145000 [ 88K] rw-/rwx SM=ZER
  439. MALLOC_LARGE (freed) 0c246000-0c287000 [ 260K] rw-/rwx SM=PRV
  440. CG image 0c367000-0c3cb000 [ 400K] rw-/rwx SM=PRV
  441. VM_ALLOCATE 0c3cb000-0c3ce000 [ 12K] rw-/rwx SM=PRV
  442. Memory Tag 241 0c3cf000-0c3e5000 [ 88K] rw-/rwx SM=COW
  443. MALLOC_TINY 0c400000-0c500000 [ 1024K] rw-/rwx SM=PRV
  444. MALLOC_SMALL (freed) 0c800000-0d000000 [ 8192K] rw-/rwx SM=COW
  445. __DATA 488c5000-49599000 [ 12.8M] rw-/rwx SM=COW
  446. __DATA 49599000-495a8000 [ 60K] rw-/rwx SM=PRV
  447. __DATA 8ff08000-8ff0a000 [ 8K] rw-/rwx SM=PRV
  448. __DATA 8ff0a000-8ff32000 [ 160K] rw-/rwx SM=COW
  449. __DATA a032f000-a0330000 [ 4K] rw-/rwx SM=COW
  450. __DATA a0330000-a0331000 [ 4K] rw-/rwx SM=COW
  451.  
  452.  
  453.  
  454. Linux
  455. =====
  456. (092e6000 and f5649000 is highlighted)
  457. ...
  458. 08048000-083de000 r-xp 00000000 fc:01 5250367
  459. 083de000-083e1000 r--p 00395000 fc:01 5250367
  460. 083e1000-083e6000 rw-p 00398000 fc:01 5250367
  461. 083e6000-083f8000 rw-p 00000000 00:00 0
  462. 08e80000-092e6000 rw-p 00000000 00:00 0 [heap]
  463. f5649000-f56c9000 rw-s 00000000 00:04 12582916
  464. f56c9000-f56d4000 r-xp 00000000 fc:01 6817133
  465. f56d4000-f56d5000 r--p 0000a000 fc:01 6817133
  466. f56d5000-f56d6000 rw-p 0000b000 fc:01 6817133
  467. f56eb000-f56ec000 rw-p 00000000 00:00 0
  468. ...
  469.  
  470.  
  471.  
  472. Linux
  473. =====
  474. BINGO
  475. • The address space of 32-bit process on 64-bit
  476. Linux, there is a "gap" of size ~ 0xEC000000 bytes!
  477. • As a result of malloc (BADMEMSIZE) succeeds by assigning
  478. 0xDEADBEEF size allocation, which really entitled to
  479. size ≥ 0x100000000.
  480.  
  481.  
  482.  
  483. Consequences
  484. ============
  485. • The error is in multiple classes responsible for memory management, used by the main engine IDA and support for more than half of the input formats.
  486. • The report for Hex-Rays is presented crash provoked using the Mach-O format.
  487.  
  488.  
  489.  
  490.  
  491. BADMEMSIZE: crash w Mach-O
  492. ==========================
  493. Program received signal SIGSEGV, Segmentation fault.
  494. 0xf4d98168 in ?? () from /opt/ida-6.6/loaders/macho.llx
  495. (gdb) where
  496. #0 0xf4d98168 in ?? () from /opt/ida-6.6/loaders/macho.llx
  497. #1 0xf4db4aaf in ?? () from /opt/ida-6.6/loaders/macho.llx
  498. #2 0xf4db6fec in ?? () from /opt/ida-6.6/loaders/macho.llx
  499. #3 0xf7d7c815 in ?? () from /opt/ida-6.6/libida.so
  500. #4 0xf7d7cb8e in load_nonbinary_file () from /opt/ida-
  501. 6.6/libida.so
  502. ...
  503. (gdb) x/10i $eip
  504. => 0xf4d98168: mov (%edi,%edx,4),%ecx
  505. 0xf4d9816b: mov %ecx,%eax
  506. 0xf4d9816d: mov %ecx,%ebx
  507.  
  508.  
  509.  
  510. Hex-Rays IDA Pro: a summary
  511. ===========================
  512. In short, there are errors and easily find them.
  513. From the perspective of Researcher: not worth the bend and
  514. report. :)
  515. From a user perspective: not exactly safe
  516. software for the analysis of files from untrusted
  517. sources (probably 90% of use cases).
  518.  
  519.  
  520. What else do you use for analysis?
  521. ==================================
  522. Virtual machines!
  523.  
  524.  
  525.  
  526. Security VM
  527. ===========
  528. - Virtual machines used for separation potentially malicious code from the competent environment.
  529. - The assumption of complete separation of environments executables.
  530. But are you sure?
  531.  
  532.  
  533.  
  534. data Flow
  535. =========
  536. - Between the guest and the host is mentioned a large amount of information:
  537. - Virtual machine implemented programmatically by VM (screen, hard disk, card network, etc..)
  538. - Command graphics card, 3D acceleration.
  539. - So called. additions - shared folders, drag-n-drop files, shared storage, ...
  540.  
  541.  
  542.  
  543.  
  544. attack vectors
  545. ===============
  546. • Each communication channel is a potential vector of attack for such isolated applications.
  547. - Ability to attack the secondary controller VM in order to perform ring-0 code (in gueście).
  548. - Ability to monitor VM attack in order to execute code ring-3 (in host).
  549. - In the case of outstanding bugs (eg. CPU), the possibility of nuclear attack host.
  550. • Example: the gaps in the testes and hypervisors associated with operating instructions SYSRET
  551. (Rafal Wojtczuk, 2012)
  552.  
  553.  
  554.  
  555. testability
  556. ===========
  557. • Multiple virtual machines is completely
  558. open-source, allowing audit
  559. (complex) source code.
  560. • In addition, the channels of communication are easy targets
  561. fuzzing (eg. VGA).
  562.  
  563.  
  564. Fuzzing VGA
  565. ===========
  566. DEMO
  567.  
  568.  
  569. Random examples
  570. ===============
  571. HOW IS IN PRACTICE?
  572.  
  573.  
  574. Security VM VirtualBox
  575. ======================
  576. User-mode -> Kernel-mode EOP
  577.  
  578. - Tarjei Mandt, Oracle VirtualBox Integer Overflow
  579. Vulnerabilities, 2011 [5]
  580. - Mateusz Jurczyk, Oracle VirtualBox Integer Overflow
  581. Vulnerabilities, 2012 [6]
  582. - Matt Bergin, Oracle VirtualBox Guest Additions Arbitrary
  583. Write Privilege Escalation, 2014 [7]
  584.  
  585.  
  586. Security VM VirtualBox
  587. ======================
  588. Guest -> host EOP
  589. • Francisco Falcon, Breaking Out of VirtualBox
  590. through 3D Acceleration, Recon, 2014 [8]
  591. • Florian Ledoux, Advanced Exploitation of
  592. VirtualBox 3D Acceleration VM Escape
  593. Vulnerability, VUPEN blog, 2014 [9]
  594.  
  595. Security VM: Vmware
  596. ===================
  597. - Derek Soeder
  598. – dozens of errors: CVE-2008-4279, CVE-2012-1516, CVE-2012-1517, CVE-2013-1406, CVE-2013-3519 i inne.
  599. - Kostya Kortchinsky, CLOUDBURST: A VMware Guest to Host Escape Story, 2009 [10]
  600. - Piotr Bania, VMware CloudBurst - VMware Guest to Host Escape Exploit, 2009 [11]
  601. - Piotr Bania, Old vmware cloudburst exploit, 2012 [12]
  602.  
  603.  
  604. Security in Xen
  605. ===============
  606. 74 errors corrected from the beginning of 2013
  607.  
  608.  
  609. Security in qemu
  610. ================
  611. - Nelson Elhage, Virtunoid: A KVM Guest Host privilege escalation exploit, 2011 [13]
  612. - Dozens of errors primarily in the implementation of
  613. emulated devices
  614.  
  615.  
  616. Security in qemu
  617. ================
  618. (screenshot of CVE list)
  619.  
  620.  
  621.  
  622. Errors on the side of the user's VM
  623. ===================================
  624. • Shared folders
  625. - Has anyone ever run it in programs stored in shared
  626. folder VMki executing untrusted code?
  627. • DLL hijacking or simply infection located in EXEka
  628. catalog.
  629. • No separation of network access to the host file system
  630. through network shares.
  631. • Other forgotten or obvious communication channels.
  632.  
  633.  
  634. A Since we are already AT
  635. VIRTUAL MACHINE ...
  636.  
  637.  
  638.  
  639.  
  640. Other routes of escape
  641. ======================
  642. • If you are using malware to analyze options
  643. Remote debugging kernel, we create
  644. another channel of communication that can become
  645. target of the attack.
  646. • The immediate objective in this case is
  647. WinDbg.
  648.  
  649.  
  650.  
  651. Protocol KDCOM
  652. ==============
  653. • WinDbg talking to the kernel using the Guest
  654. KDCOM protocol.
  655. - Kernel Debugging Communication
  656. - Simple packet header format:
  657. - More than 50 supported message types.
  658.  
  659.  
  660. Protocol KDCOM
  661. ==============
  662. • fully described in several references:
  663. - Kernel and remote Debuggers [14]
  664. - KD extension DLLs & KDCOM protocol [15]
  665. • He lived to see the independent implementation.
  666. - SYSPROGS VirtualKD - accelerating application sessions
  667. Debug COM port for VirtualBox and VMWare
  668. - SecureWorks Wind Pill - Perl implementation
  669. Protocol.
  670.  
  671.  
  672.  
  673.  
  674. fuzzing KDCOM
  675. =============
  676. • Automate testing by creating a proxy
  677. modifying the communication between
  678. WinDbg and the kernel.
  679.  
  680.  
  681. fuzzing KDCOM
  682. =============
  683. • After many attempts have failed to provoke
  684. no error in WinDbg associated
  685. directly to support the protocol.
  686. • Crashes occurred while the mutation
  687. body of the message sent from the virtual
  688. machines for debugging.
  689.  
  690.  
  691. What does WinDbg parse?
  692. =======================
  693. pe files, of course!
  694.  
  695.  
  696.  
  697. Processing PE files
  698. ===================
  699. • WinDbg supports symbols.
  700. - Public EXEków exports in the table.
  701. - Private, located in the corresponding PDB file.
  702. • In order to obtain the information you need to
  703. process executables Z Guest.
  704. - WinDbg zczytuje of guest memory modules, memory, and
  705. then forward them to the responsible DbgHelp API
  706. for handling symbols.
  707.  
  708.  
  709.  
  710. A few words about DbgHelp
  711. =========================
  712. • The auxiliary library provided by
  713. Microsoft.
  714. • Provides high-level functionality
  715. debuggerach useful.
  716. - Supports symbols.
  717. - Create process dumps.
  718. - Hear the call stack.
  719.  
  720.  
  721. A few words about DbgHelp
  722. =========================
  723. • Parse complex
  724. file formats such as PE or
  725. PDB.
  726. • The quality of the code is he made a,
  727. practically lack of any
  728. input validation.
  729. "GREAT
  730.  
  731.  
  732.  
  733.  
  734. Sample susceptibility DbgHelp
  735. =============================
  736. • Many out-of-bounds reads by the lack of validation fields PE structures, for example.
  737. IMAGE_FILE_HEADER.NumberOfSections.
  738. • Arbitrary read while operating the Export Table.
  739. • Out-of-bounds read by the lack of validation of serial numbers in Import
  740. Table.
  741. • Arbitrary read the manual COFF Symbol Table.
  742. • Out-of-bounds write by the lack of validation of serial numbers in
  743. Export Table.
  744. • Integer overflow during dynamic allocation of the internal array to
  745. Operating Export Table.
  746.  
  747.  
  748.  
  749.  
  750. In carrying out the code from the kernel virtual
  751. the machine can lead to violations of
  752. WinDbg memory integrity, and potentially
  753. controlled to run the code.
  754. Research described precisely in 2010, the blog
  755. [16]
  756.  
  757.  
  758.  
  759. WinDbg and logical errors
  760. =========================
  761. • Exactly at the same time Alex Ionescu found that
  762. KDCOM protocol allows the execution of any
  763. WinDbg command from the Guest.
  764. • This command allows you to run any .shell
  765. program with controlled parameters.
  766. • The result is 100% stable performance
  767. controlled code on the host from the Guest.
  768.  
  769.  
  770.  
  771. WinDbg and logical errors
  772. =========================
  773. Solution: run windbg.exe with flag -Secure.
  774. Secure Mode disables the debugger any options for him
  775. tampering with the system on which it is running.
  776.  
  777.  
  778.  
  779. THIS IS NOT THE END!
  780.  
  781.  
  782.  
  783. Wireshark
  784. =========
  785. (list of vuln counts)
  786.  
  787.  
  788.  
  789. Other tools
  790. ===========
  791. Any kind of dissectory, less known deasemblery etc.
  792. are often equally susceptible.
  793. Just devotes less attention to them, which are the most
  794. tested worse than the widely known applications.
  795. Example: said at the beginning of Sothink SWF Decompiler.
  796.  
  797.  
  798. The moral?
  799.  
  800.  
  801. Are there currently active malware attacks on analysts or detection systems?
  802. ============================================================================
  803. probably* not
  804.  
  805. * At least I do not know.
  806.  
  807.  
  808. And could they?
  809. ===============
  810. Definitely yes
  811.  
  812.  
  813.  
  814. Conclusion?
  815. ===========
  816. Obviously not in this thing to stop
  817. use of these tools. :)
  818. Well, however, apply the basic practices
  819. security - but it all depends on
  820. situation and threat model
  821.  
  822.  
  823.  
  824. suggestions
  825. ============
  826. • Use new operating systems
  827. - Each program is much more secure than Windows 8.1 to Windows
  828. Vista.
  829. - Which is the way "fault" Microsoft, but it is a topic for a separate discussion.
  830. • Reduce the attack surface
  831. - Enable only the strictly necessary devices in the VM.
  832. - Use of additions and other additional technologies (eg. 3D acceleration)
  833. only if necessary.
  834. - In general: reducing to a minimum the number of lines of code that process
  835. untrusted data
  836.  
  837.  
  838.  
  839. suggestions
  840. ===========
  841. Whether it is likely that someone will create a
  842. stable exploit our version of IDA Pro?
  843.  
  844. Sure.
  845.  
  846.  
  847. suggestions
  848. ===========
  849. And whether it is likely that someone will attack
  850. exploit host under our version of IDA Pro,
  851. fired in sandboksie operating in truncated
  852. Microsoft virtual machine?
  853. Possible, but unlikely.
  854.  
  855.  
  856. The end
  857. =======
  858. j00ru.vx@gmail.com
  859. http://j00ru.vexillium.org
  860. @j00ru
  861.  
  862.  
  863.  
  864. Materials
  865. =========
  866. [1] http://mincore.c9x.org/breaking_av_software.pdf
  867. [2] https://technet.microsoft.com/en-us/library/security/2974294.aspx
  868. [3] https://github.com/mstorsjo/gnupoc-package
  869. [4] http://sourceforge.net/projects/symbiandump/
  870. [5] http://mista.nu/blog/2011/07/19/oracle-virtualbox-integer-overflow-vulnerabilities/
  871. [6] http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  872. [7] https://www.korelogic.com/Resources/Advisories/KL-001-2014-001.txt
  873. [8] http://recon.cx/2014/slides/Breaking_Out_of_VirtualBox_through_3D_Acceleration-Francisco_Falcon.pdf
  874. [9] http://www.vupen.com/blog/20140725.Advanced_Exploitation_VirtualBox_VM_Escape.php
  875. [10] http://www.blackhat.com/presentations/bh-usa-09/KORTCHINSKY/BHUSA09-Kortchinsky-Cloudburst-SLIDES.pdf
  876. [11] http://blog.piotrbania.com/2009/09/vmware-cloudburst-vmware-guest-to-host.html
  877. [12] http://blog.piotrbania.com/2012/07/old-vmware-cloudburst-exploit.html
  878. [13] https://media.blackhat.com/bh-us-11/Elhage/BH_US_11_Elhage_Virtunoid_WP.pdf
  879. [14] http://www.developerfusion.com/article/84367/kernel-and-remote-debuggers/
  880. [15] http://articles.sysprogs.org/kdvmware/kdcom.shtml
  881. [16] http://j00ru.vexillium.org/?p=405
Add Comment
Please, Sign In to add comment