[PATCH] SECURITY.md: Document trusted and untrusted inputs
Collin Funk
collin.funk1@gmail.com
Fri Nov 20 01:51:36 GMT 2026
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> +* A report should show the problem through the public interfaces of the
> + library. A proof of concept that copies library code into a test program,
> + or calls internal functions with arguments that the library never passes to
> + them, does not show a vulnerability.
Haha, I assume you got a few reports where people copy-pasted a function
from glibc internals and called it with bogus values, stating it was a
"vulnerability" when a call with those values is not possible in the
actual code? I had a few like that in GNU Inetutils a while ago, but not
recently.
> +The following inputs are trusted:
> +
> +* The dynamic loader configuration: `/etc/ld.so.conf` and the files it
> + includes, `/etc/ld.so.cache`, `/etc/ld.so.preload` and `/etc/tunables.conf`.
> +* Executables and shared objects, including the objects that programs load
> + with `dlopen`. The section on shared objects, `ldd` and `ldconfig` below
> + has more details.
> +* The name service configuration and the databases that the administrator
> + maintains: `/etc/nsswitch.conf`, the files read by the `files` service (such
> + as `/etc/passwd`, `/etc/group`, `/etc/hosts` and `/etc/services`),
> + `/etc/host.conf`, `/etc/nscd.conf`, and directory services such as NIS and
> + LDAP. The rest of `/etc/resolv.conf`, apart from the values listed above,
> + is trusted as well.
> +* Locale data: the compiled locales in the system locale directory and locale
> + archive, and the sources (locale definitions, character maps and repertoire
> + maps) that `localedef` compiles into them. `LOCPATH` is ignored in
> + `AT_SECURE` processes, so a locale loaded through it only affects processes
> + of the user who sets it, and crafted binary locale files are not a security
> + issue.
> +* Message catalogs (`.mo` files) used by `gettext` and related functions.
> + Translations are used as `printf` format strings, so a crafted catalog can
> + take control of a program regardless of how carefully the library parses it.
> + Bugs triggered by crafted catalogs are not security bugs, but a bug that lets
> + untrusted input make a program load a catalog from a location that the
> + program did not select is a security bug.
> +* The character set conversion configuration: the `gconv-modules` files, the
> + `gconv-modules.cache` file built by `iconvconfig`, and the conversion
> + modules.
> +* The input of the tools that build system data, such as `ldconfig`,
> + `localedef`, `iconvconfig` and `zic`. Like a compiler, these tools trust
> + their input, so untrusted input should only be processed in a sandbox.
> +* For a process that is not `AT_SECURE`, anything that only the user who
> + starts it controls, apart from locale names: the environment (for example
> + `GLIBC_TUNABLES`, `LD_PRELOAD`, `LD_LIBRARY_PATH`, the `MALLOC_*` variables,
> + `LOCPATH` and `GCONV_PATH`), the command line and the resource limits. This
> + user can already run arbitrary code in the process, for example with
> + `LD_PRELOAD`.
> +
> +Files are trusted only while untrusted users cannot modify them. A program
> +that directs the library to a file or directory that untrusted users can
> +modify, for example with `bindtextdomain` or by running `ldconfig` on it,
> +extends its trust to those users.
Right, you can define locales, for example, to do stupid things.
Sometimes those stupid things are useful, e.g., for testing, so getting
rid of them for a false sense of "security" would be undesirable.
> +The DNS stub resolver does not authenticate responses and an attacker who can
> +observe or modify the traffic to the configured name servers can supply
> +arbitrary answers, and this is not a bug in the library. Bugs in the
> +processing of DNS responses are security bugs.
Intuitively, this sounds correct, but it is an area of glibc I have not
looked at, so I can't comment beyond that.
> ### Security Exceptions
>
> It may be especially complicated to determine the security status of bugs in
> @@ -101,10 +191,27 @@ standard-conforming and has races and leaks. Again, such bugs are only treated
> as security bugs if applications (as opposed to synthetic test cases) have
> security exposures due to these bugs.
>
> -#### Crafted binaries and ldd
> +#### Shared objects, ldd and ldconfig
> +
> +Loading a shared object runs code from it, such as ELF constructors and IFUNC
> +resolvers, so the dynamic loader trusts the objects it loads. Bugs triggered
> +by crafted executables or shared objects are not security bugs, whether the
> +objects are loaded at startup (through `DT_NEEDED` dependencies, `LD_PRELOAD`,
> +or `LD_AUDIR`) or with `dlopen` in a process that is not `AT_SECURE`. A bug
> +that makes an `AT_SECURE` process load an object from a location that the
> +invoking user controls, for example through `LD_LIBRARY_PATH`, `LD_PRELOAD`
> +or `$ORIGIN`.
>
> The `ldd` tool is not expected to be used with untrusted executables.
>
> +The `ldconfig` tool is run by the administrator, usually as root. Its
> +configuration files and the shared objects in the directories it scans are
> +trusted, including when the `-f`, `-C` or `-r` options point it to another
> +configuration file, cache or root directory. Crashes, hangs or excessive
> +resource use caused by crafted configuration files or crafted shared objects
> +(for example, malformed ELF notes) are not security bugs. To run `ldconfig`
> +on a directory tree that untrusted users can modify, use a sandbox.
All of this looks good to me. It feels a bit self-explanatory that these
aren't security issues, so it is unfortunate that this is even needed.
Sadly, the CVE system seems to be viewed more as a primary means of
marketing for some rather than a useful tool for tracking issues,
especially as of late. Hopefully, this results in some issues being
reported as normal bugs, where they can be handled more productively.
Anyways, feel free to add:
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Of course, please allow Carlos and/or Siddhesh to review as well before
pushing.
Collin
More information about the Libc-alpha
mailing list