Skip to content

Mishandling of json configuration file could lead to Null Pointer Dereference #1739

@viennadd

Description

@viennadd

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,

} else if (strcmp(name, "plugin") == 0) {
conf.plugin = to_string(value);
if (strlen(conf.plugin) == 0) {
ss_free(conf.plugin);
conf.plugin = NULL;
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions