Mishandling of json configuration file could lead to Null Pointer Dereference
What version of shadowsocks-libev are you using?
shadowsocks-libev-3.1.0
What operating system are you using?
Ubuntu 16.04 64 bit
What did you do?
In parsing json configuration file, two of the properties ("mode", "plugin") do not perform null checking before invoking strlen,
https://github.com/shadowsocks/shadowsocks-libev/blob/c67d275803dc6ea22c558d06b1f7ba9f94cd8de3/src/jconf.c#L248-L253
feeding null json value to "mode" or "plugin" property will trigger process crash.
PoC:
(py3) ➜ src ./ss-server -c config.json
[1] 28610 segmentation fault (core dumped) ./ss-server -c config.json
(py3) ➜ src cat config.json
{
"server":"my_server_ip",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"plugin": null
}
What did you expect to see?
What did you see instead?
What is your config in detail (with all sensitive info masked)?
Regards, Alex, SourceBrella Inc.
Cool! Thanks for reporting this!
@madeye the "mode" property shares the similar issue: https://github.com/shadowsocks/shadowsocks-libev/blob/b3f3b58a1d33da73f42420e1d4ec904beb5a9761/src/jconf.c#L295-L300
I just notice that it's part of this paper now: http://www.cs.ust.hk/~charlesz/pinpoint.pdf
Great work!