capstone.CsError: Different API version between core & binding (CS_ERR_VERSION)
Grazfather opened this issue · 4 comments
Grazfather commented
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import capstone
>>> capstone.version_bind()
(3, 0, 768)
vagrant@kali:/vagrant/ctfs/bostonkp2016$ ROPgadget --version
Version: ROPgadget v5.4
Author: Jonathan Salwan
Author page: https://twitter.com/JonathanSalwan
Project page: http://shell-storm.org/project/ROPgadget/
$ ROPgadget --binary ../x
Traceback (most recent call last):
File "/usr/local/bin/ROPgadget", line 17, in <module>
ropgadget.main()
File "/usr/local/lib/python2.7/dist-packages/ropgadget/__init__.py", line 28, in main
sys.exit(Core(Args().getArgs()).analyze())
File "/usr/local/lib/python2.7/dist-packages/ropgadget/core.py", line 176, in analyze
self.__getAllgadgets()
File "/usr/local/lib/python2.7/dist-packages/ropgadget/core.py", line 52, in __getAllgadgets
if not self.__options.norop: self.__gadgets += G.addROPGadgets(section)
File "/usr/local/lib/python2.7/dist-packages/ropgadget/gadgets.py", line 118, in addROPGadgets
return self.__gadgetsFinding(section, gadgets, arch, arch_mode)
File "/usr/local/lib/python2.7/dist-packages/ropgadget/gadgets.py", line 64, in __gadgetsFinding
md = Cs(arch, mode)
File "/usr/local/lib/python2.7/dist-packages/capstone/__init__.py", line 661, in __init__
raise CsError(CS_ERR_VERSION)
capstone.CsError: Different API version between core & binding (CS_ERR_VERSION)
JonathanSalwan commented
$ python
Python 2.7.10 (default, Nov 23 2015, 15:55:18)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import capstone
>>> capstone.version_bind()
(3, 0, 768)
$ ROPgadget --version
Version: ROPgadget v5.4
Author: Jonathan Salwan
Author page: https://twitter.com/JonathanSalwan
Project page: http://shell-storm.org/project/ROPgadget/
$ ROPgadget --binary /usr/bin/id
Gadgets information
============================================================
0x0000000000405853 : adc al, 0xeb ; retf
0x0000000000402ff7 : adc byte ptr [rax + rcx*4 + 0x24], al ; sbb byte ptr [rax - 0x7d], cl ; ret
0x0000000000403a09 : adc byte ptr [rax - 0x77], cl ; ret
0x000000000040396f : adc byte ptr [rcx + 0x39], cl ; ret
[...]
Grazfather commented
vagrant@kali:/usr/local/lib/python2.7/dist-packages$ sudo rm -rf capstone-3.0.4.egg-info/
vagrant@kali:/usr/local/lib/python2.7/dist-packages$ sudo rm -rf capstone-3.0.4-py2.7.egg/
vagrant@kali:/usr/local/lib/python2.7/dist-packages$ sudo rm -rf /usr/lib/libcapstone.*
vagrant@kali:/usr/local/lib/python2.7/dist-packages$ sudo rm -rf ROPGadget-5.4-py2.7.egg/
vagrant@kali:/usr/local/lib/python2.7/dist-packages$ sudo easy_install ROPgadget
Searching for ROPgadget
[...]
vagrant@kali:/usr/local/lib/python2.7/dist-packages$ ROPgadget --binary /usr/bin/id
Gadgets information
============================================================
0x0000000000400ad4 : adc byte ptr [rax], al ; int1 ; jmp qword ptr [rax]
[...]
Perhaps worth mentioning.
I am sure something like pwnlib, peda, pwnbug, etc depended on a different version of capstone and is broken now :(
hub2 commented
@Grazfather you are right, ROPgadget inside pwndbg is broken now because of that...