[PATCH] SECURITY.md: Document trusted and untrusted inputs
Florian Weimer
fweimer@redhat.com
Fri Nov 20 08:29:50 GMT 2026
* Adhemerval Zanella:
> +The following inputs are untrusted:
> +
> +* Data that applications process on behalf of other parties: network data
> + (including DNS responses), file contents, and the strings that applications
> + pass to the library for conversion or parsing (for example to `iconv`, the
> + `scanf` family or `getaddrinfo`). This includes the names of character sets,
> + which applications often take from the documents or messages they process.
> +* The environment of an `AT_SECURE` process. The library removes or ignores
> + variables such as `LD_PRELOAD`, `LD_LIBRARY_PATH`, `GLIBC_TUNABLES`,
> + `GCONV_PATH`, `LOCPATH` and `NLSPATH` in such processes, and a bug that lets
> + them take effect is a security bug.
* The current directory of an AT_SECURE process.
* The installation path of an AT_SECURE process. That is, the directory
in which the program is installed, and all its parent directories.
* The initial open file descriptors of an AT_SECURE process.
> +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.
It is conceivable that otherwise unprivileged users are allowed to edit
the GECOS field of their user. Users are routinely allowed to change
their passwords. This applies to the IDM data mentioned below, too.
I would also add:
* Data retrieved from IDM services such as NIS and Hesiod is trusted at
the protocol level, that is, both the formatting of the data on the
wire and the data return is trusted.
And completely unrelated:
* Information related to buffer length supplied by the kernel, for
example the return value of successful read and write system calls.
* Standard system installation directories as specified at configure
time (--prefix, --bindir, --libdir etc.).
> +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.
I think the first sentence is reversed? I would say that files are
still treated as trusted regardless of their file permissions and
ownership.
> +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.
This overlaps with the IDM suggestion I made above. We probably should
make an exception regarding malformed DNS data.
> +#### 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
LD_AUDIT
> +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`.
Incomplete setnence.
Overall, these additions are a nice improvement.
Thanks,
Florian
More information about the Libc-alpha
mailing list