Advertisement
_d3f4ult

[+] Opentype Font Privileged Escalation by @hackingteam [+]

Aug 4th, 2015
1,626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. 1. BACKGROUND
  2. http://en.wikipedia.org/wiki/Adobe_Flash_Player
  3.  
  4. Congrats! You are reading about the most beautiful Flash bug for the last four
  5. years since CVE-2010-2161.
  6.  
  7.  
  8. 2. DESCRIPTION
  9.  
  10. The use-after-free vulnerability exists inside the built-in ByteArray class
  11. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/ByteArray.html
  12.  
  13. Let's create a simple ByteArray object:
  14.  
  15. var ba:ByteArray = new ByteArray();
  16. ba.length = 8;
  17. ba[1] = 1;
  18.  
  19. Now we can access ba[] items and write numeric byte values into ba[].
  20. Also we are allowed to write objects into ByteArray. For example:
  21.  
  22. var obj = new MyClass();
  23. ba[0] = obj;
  24.  
  25. AS3 will try to implicitly convert the MyClass object into numeric value by
  26. calling the MyClass.valueOf() method. This method can be easily redefined
  27. within the user's code:
  28.  
  29. class MyClass
  30. {
  31. prototype.valueOf = function()
  32. {
  33. ba.length = 88; // reallocate ba[] storage
  34. return 0; // return byte for ba[offset]
  35. }
  36. }
  37.  
  38. Let's see how that implicit conversion occurs inside the native code:
  39.  
  40. push esi
  41. mov eax, [esp+8] // the offset value from "ba[offset] = obj"
  42. push eax
  43. add ecx, 0x18 // ecx = this = "ba" object pointer
  44. call ByteArray.getStorage() // gets ba[offset] storage pointer and
  45. mov esi, eax // saves it in esi
  46.  
  47. mov ecx, [esp+0xC] // "obj" pointer
  48. push ecx
  49. call AvmCore.toInteger() // call MyClass.valueOf()
  50. add esp,4
  51. mov [esi], al // writes returned byte into array
  52.  
  53. pop esi
  54. ret 8
  55.  
  56. On high-level language this will look like:
  57.  
  58. void ByteArray.setObjInternal(int offset, obj)
  59. {
  60. byte* dest = this.getStorage(offset);
  61. dest* = toInteger(obj);
  62. }
  63.  
  64. So the array storage pointer is saved in local variable, then AS3 valueOf() is
  65. invoked from the native code and returned byte is written into destination
  66. pointer at the end. If valueOf() changes the length of byte array (see above)
  67. and reallocates its internal storage, then local destination pointer becomes
  68. obsolete and further usage of that pointer can lead to UaF memory corruption.
  69.  
  70. Using this vulnerability, it's very easy to control what byte will be written
  71. and at which offset this corruption will occur.
  72.  
  73.  
  74. 3. AFFECTED SOFTWARE
  75. Adobe Flash Player 9 and higher
  76.  
  77.  
  78. 4. TESTING
  79. Open the test "calc.htm" file in your browser and press the button.
  80.  
  81. on Windows:
  82. Calc.exe should be popped on desktop IE.
  83. Calc.exe should be run as a non-GUI child process in metro IE.
  84. Payload returns 0 from CreateProcessA("calc.exe") inside Chrome/FF sandbox.
  85.  
  86. on OS X:
  87. Calculator is launched in FF or standalone Flash Player projector.
  88. Payload returns 1 from vfork() in Safari sandbox.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement