Commit 27fe69e
committed
libpsl: fix to not leak build-time PSL db filename into the binaries [ci skip]
To prevent libpsl trying to load it a runtime, insecurely, from
uncontrolled, potentially world-writable disk locations, and overriding
the embedded PSL database with it.
Fix by patching the code generated by the Python script shipping with
libpsl. Also verify that the filename is not present in the C source.
Explanation:
The libpsl script responsible for generating the embedded PSL data is
also including the local, built-time PSL data filename in the generated
C source. In case of curl-for-win this filename is a relative one.
When curl/libcurl calls `psl_latest()` to load the list, libpsl is
accessing this filename on disk, and if there is such file that's newer
than the embedded PSL data, it loads it. This filename in practice is
a relative one to the current working directory. It means that an
attacker can place an empty or doctored, new PSL database on disk and
override the embedded one with it.
Probably something to be fixed in upstream libpsl, possibly by allowing
to customize the filename that is being hard-coded (including to an
empty filename to prevent loading it), and/or allowing to disable the
dynamic loading feature fully.
(The latter would also fix the `stat()` use issue on Windows and
mingw-w64 v13.)1 parent 153f658 commit 27fe69e
1 file changed
+26
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
27 | 52 | | |
28 | 53 | | |
29 | 54 | | |
| |||
0 commit comments