slimm609 / checksec

Checksec
https://slimm609.github.io/checksec
Other
2.05k stars 306 forks source link

Duplicate keys in json #218

Closed Artoria2e5 closed 5 months ago

Artoria2e5 commented 1 year ago

checksec --output=json --fortify-file=/bin/bash gives a json with duplicate keys

{
  "fortify-test": {
    "name": "/bin/bash",
    "libc_fortify_source": "yes",
    "binary_compiled_with_fortify": "yes",
    "function": { "name": "asprintf_chk", "libc": "asprintf", "fortifiable": "no" },
    "function": { "name": "confstr", "libc": "confstr", "fortifiable": "yes" },
    "function": { "name": "fdelt_chk", "libc": "fdelt", "fortifiable": "no" },
    "function": { "name": "fgets", "libc": "fgets", "fortifiable": "yes" },
    "function": { "name": "fprintf_chk", "libc": "fprintf", "fortifiable": "no" },
    "function": { "name": "getcwd", "libc": "getcwd", "fortifiable": "yes" },
    "function": { "name": "getgroups", "libc": "getgroups", "fortifiable": "yes" },
    "function": { "name": "gethostname", "libc": "gethostname", "fortifiable": "yes" },
    "function": { "name": "longjmp_chk", "libc": "longjmp", "fortifiable": "no" },
    "function": { "name": "mbsnrtowcs", "libc": "mbsnrtowcs", "fortifiable": "yes" },
    "function": { "name": "mbsrtowcs", "libc": "mbsrtowcs", "fortifiable": "yes" },
    "function": { "name": "mbstowcs", "libc": "mbstowcs", "fortifiable": "yes" },
    "function": { "name": "memcpy", "libc": "memcpy", "fortifiable": "yes" },
    "function": { "name": "memcpy_chk", "libc": "memcpy", "fortifiable": "no" },
    "function": { "name": "memmove", "libc": "memmove", "fortifiable": "yes" },
    "function": { "name": "memmove_chk", "libc": "memmove", "fortifiable": "no" },
    "function": { "name": "memset", "libc": "memset", "fortifiable": "yes" },
    "function": { "name": "read", "libc": "read", "fortifiable": "yes" },
    "function": { "name": "readlink", "libc": "readlink", "fortifiable": "yes" },
    "function": { "name": "snprintf_chk", "libc": "snprintf", "fortifiable": "no" },
    "function": { "name": "sprintf_chk", "libc": "sprintf", "fortifiable": "no" },
    "function": { "name": "strcat", "libc": "strcat", "fortifiable": "yes" },
    "function": { "name": "strcpy", "libc": "strcpy", "fortifiable": "yes" },
    "function": { "name": "strcpy_chk", "libc": "strcpy", "fortifiable": "no" },
    "function": { "name": "strncpy", "libc": "strncpy", "fortifiable": "yes" },
    "function": { "name": "strncpy_chk", "libc": "strncpy", "fortifiable": "no" },
    "function": { "name": "vfprintf_chk", "libc": "vfprintf", "fortifiable": "no" },
    "function": { "name": "vsnprintf_chk", "libc": "vsnprintf", "fortifiable": "no" },
    "function": { "name": "wcrtomb", "libc": "wcrtomb", "fortifiable": "yes" },
    "function": { "name": "wcsrtombs", "libc": "wcsrtombs", "fortifiable": "yes" },
    "function": { "name": "wctomb", "libc": "wctomb", "fortifiable": "yes" },
    "stats": { "nb_libc_func": "79", "nb_total_func": "1899", "nb_fortifiable_func": "31", "nb_checked_func": "12", "nb_unchecked_func": "19" }
  }
}

The same will happen when you try to do multiple files, such as via --dir.

What are the problems?

slimm609 commented 5 months ago

This will be resolved with the upcoming 3.0 release, which changes to golang and includes a json library to assist with formatting.