jltxgcy
加下日志定位下情况吧,竞争的漏洞最好用真机,我原来也调试过一个其他竞争的洞,用模拟怎么都不行,真机却很稳定能够竞争成功。
我写了个POC,binder_buffer的debugid为126800,对应的data为0x7167642100。client主线程为4017:4017,发送BC_TRANSACTION的线程为4017:4018,server线程为233:3081。binder日志如下:
[ 9397.842620] binder: 4017:4017 write 12 at 0000007167642100, read 0 at 0000000000000000
[ 9397.842658] binder: 4017:4017 BC_FREE_BUFFER u0000007167503c08 found buffer 126800 for finished transaction
[ 9397.842669] binder: 4017 buffer release 126800, size 20-0, failed at (null)
[ 9397.842713] binder: 4017:4017 wrote 12 of 12, read return 0 of 0
[ 9397.844505] binder: 4017:4017 write 12 at 0000007167642100, read 0 at 0000000000000000
[ 9397.844514] binder: 4017:4017 BC_FREE_BUFFER u0000007167503c08 no match
[ 9397.844522] binder: 4017:4017 wrote 12 of 12, read return 0 of 0
[ 9397.846759] binder: 4017:4018 write 68 at 0000007164a14100, read 256 at 0000007164a14000
[ 9397.846784] binder: 4017:4018 BC_TRANSACTION 126804 -> 233 - node 126776, data 0000007164a15000-0000000000000000 size 128-0-0
[ 9397.846820] binder: 4017:4018 BR_TRANSACTION_COMPLETE
[ 9397.846830] binder: 4017:4018 wrote 68 of 68, read return 8 of 256
[ 9397.846844] binder: 4017:4018 write 0 at 0000007164a14100, read 256 at 0000007164a14000
[ 9397.846911] binder: 233:3081 BR_TRANSACTION 126804 4017:4018, cmd -2143260158 size 128-0 ptr 00000000e6482058-00000000e64820d8
[ 9397.846922] binder: 233:3081 wrote 12 of 12, read return 72 of 256
[ 9397.847133] binder: 233:3081 write 68 at 00000000e4805900, read 256 at 00000000e4805800
[ 9397.847148] binder: 233:3081 BC_REPLY 126805 -> 4017:4018, data 00000000e4d951c8-0000000000000000 size 20-0-0
[ 9397.847166] binder: 233:3081 BR_TRANSACTION_COMPLETE
[ 9397.847175] binder: 233:3081 wrote 68 of 68, read return 8 of 256
[ 9397.847230] binder: 233:3081 write 12 at 00000000e4805900, read 256 at 00000000e4805800
[ 9397.847242] binder: 233:3081 BC_FREE_BUFFER u00000000e6482058 found buffer 126804 for finished transaction
[ 9397.847253] binder: 233 buffer release 126804, size 128-0, failed at (null)
[ 9397.847595] binder: 4017:4018 BR_REPLY 126805 0:0, cmd -2143260157 size 20-0 ptr 0000007167503c08-0000007167503c20
[ 9397.847607] binder: 4017:4018 wrote 0 of 0, read return 72 of 256
看时间是可以知道BC_TRANSACTION到BC_REPLY的时间差大概是847148 - 846784 = 364us,但这个时间是动态变化的,所以很好奇exp里的usleep为什么会是进入竞争窗口的依赖条件,而且能达到这么高的成功率?