La mouvance NoSQL fait de plus en plus parler d'elle. La plupart du temps open source, les implémentations sont nombreuses et offrent des alternatives intéressantes à la rigidité du SQL. Malheureusement ces diverses solutions NoSQL (MongoDB, CouchDB, Cassandra...) débarquent avec NoSecurity. Nous verrons que, tout comme le SQL, une mauvaise utilisation des clients/drivers peut avoir des conséquences tout aussi critique, si ce n'est plus...
3. 3
NoSQL fashion way of life
› Database system
› ''Not only SQL''
› More simple
› Flexible Schema
› Easier scalability/replication
› No SQL language
› Young and hipster
32. 32
mongoDB – Exploitation
› Land to the stack
› PIVOT 1
› [Eax] => pointer+0xb => nativeHelper argument
› Gadget 1 : Mov eax, [eax] … call [eax+0x1c]
› nativeHelper argument is UTF8 encoded without null
byte
› eax+0x1c : gadget 2 : xchg esp, eax [inc esp], ret
› Esp-1 => begining of nativeHelper argument
› Gadget 3 : [inc esp] to clean stack control
33. 33
mongoDB – Exploitation
› Control the stack
› UTF8 and no null byte in nativeHelper argument
› PIVOT 2 => to the rop chain heap sprayed
› Gadget 4 : pop eax, ... ret
› Eax => rop chain in the heap (0x20202020)
› Gadget 5 : xchg esp,eax … ret
› RetSled
› Stack control done !
34. 34
mongoDB – Exploitation
› Execute shellcode
› First Heap Spray with nopsled+shellcode
› mmap RWX the heap
› Jump to the heap (0x0C0C0C0C)
› Enjoy !
35. 35
mongoDB – Exploitation
› To improve
› Heap spray is for pork !
› 64 bits exploit... (null byte :o :o :o)
› Windows exploit
› Multiple version exploit
36. 36
The end
› Still mongo 0day o/
› A lot of work to do...
› NoSQL is not so bad !