[PATCH] SECURITY.md: Document trusted and untrusted inputs
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu Nov 19 20:45:25 GMT 2026
Recent reports against ldconfig, localedef, message catalog parsing
and tunables were handled as regular bugs, because only the
administrator or the user who runs the process controls the input
that triggers them. SECURITY.md only says this for ldd, so reporters
cannot tell in advance how such reports will be classified.
Add a section that lists the inputs the library treats as untrusted
and trusted, with the CVEs that set the precedent. Extend the ldd
exception to dynamic loading and ldconfig, and add guidance on
interface misuse and on proofs of concept that do not go through the
public interfaces.
---
SECURITY.md | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 109 insertions(+), 2 deletions(-)
diff --git a/SECURITY.md b/SECURITY.md
index e10e6699525..7a4fdef1c37 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -33,7 +33,20 @@ vulnerability as such. The following guidelines can help with a decision.
exploitable in practice, due to general system instability.
* Bugs that crash `nscd` are generally security bugs, except if they can only
be triggered by a trusted data source (DNS is not trusted, but NIS and LDAP
- probably are).
+ are).
+* Bugs that can only be triggered through trusted inputs, such as the system
+ configuration, are not security bugs. The section on trusted and untrusted
+ inputs below gives examples.
+* Bugs that only occur when an application breaks the documented interface
+ are not security bugs. Examples include passing flag bits that the manual
+ does not document (some are reserved for internal use), and operations that
+ ISO C or POSIX leave undefined, such as reading from a stream right after
+ writing to it without a call to `fflush` or a file positioning function in
+ between.
+* 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.
* The [Security Exceptions](#SecurityExceptions) section below describes
subsystems for which determining the security status of bugs is especially
complicated.
@@ -49,6 +62,83 @@ the GNU C Library causes a security bug in an application (and the application
uses the library in a standard-conforming manner or according to the manual),
the GNU C Library bug should be treated as security-relevant.
+### Trusted and untrusted inputs
+
+Whether a bug is a security bug usually depends on who controls the data that
+triggers it. The GNU C Library assumes that the system administrator controls
+the system configuration and the files installed in system locations, and that
+the user who starts a process controls that process, unless the process runs
+in secure-execution mode (`AT_SECURE`, for example a set-user-ID or
+set-group-ID program). Bugs that only these trusted parties can trigger are
+not security bugs, even if they cause memory corruption.
+
+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.
+* Locale names, including the values of `LANG`, `LC_ALL`, the other `LC_*`
+ variables and `LANGUAGE`. These variables commonly cross trust boundaries
+ in processes that are not `AT_SECURE`, for example when an SSH server accepts
+ them from clients, so they are untrusted in every process.
+* Configuration values that network configuration software commonly copies
+ from the network, such as the name servers and search domains that a DHCP
+ or VPN server supplies for `/etc/resolv.conf`.
+
+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.
+
+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.
+
### 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.
+
#### Post-exploitation countermeasures
Certain features have been added to the library only to make exploitation of
--
2.53.0
More information about the Libc-alpha
mailing list