summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorNoah Misch2024-11-11 14:23:43 +0000
committerNoah Misch2024-11-11 14:23:46 +0000
commit3ebcfa54db3309651d8f1d3be6451a8449f6c6ec (patch)
tree21ee56b1f5e8abf86190c24bb90ef577c43333bc /doc/src
parent6bf5bf11c3944886225778790bf35aaff3b12a34 (diff)
Block environment variable mutations from trusted PL/Perl.
Many process environment variables (e.g. PATH), bypass the containment expected of a trusted PL. Hence, trusted PLs must not offer features that achieve setenv(). Otherwise, an attacker having USAGE privilege on the language often can achieve arbitrary code execution, even if the attacker lacks a database server operating system user. To fix PL/Perl, replace trusted PL/Perl %ENV with a tied hash that just replaces each modification attempt with a warning. Sites that reach these warnings should evaluate the application-specific implications of proceeding without the environment modification: Can the application reasonably proceed without the modification? If no, switch to plperlu or another approach. If yes, the application should change the code to stop attempting environment modifications. If that's too difficult, add "untie %main::ENV" in any code executed before the warning. For example, one might add it to the start of the affected function or even to the plperl.on_plperl_init setting. In passing, link to Perl's guidance about the Perl features behind the security posture of PL/Perl. Back-patch to v12 (all supported versions). Andrew Dunstan and Noah Misch Security: CVE-2024-10979
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/plperl.sgml13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml
index 25b1077ad73..8007261d022 100644
--- a/doc/src/sgml/plperl.sgml
+++ b/doc/src/sgml/plperl.sgml
@@ -1093,6 +1093,19 @@ $$ LANGUAGE plperl;
be permitted to use this language.
</para>
+ <warning>
+ <para>
+ Trusted PL/Perl relies on the Perl <literal>Opcode</literal> module to
+ preserve security.
+ Perl
+ <ulink url="https://perldoc.perl.org/Opcode#WARNING">documents</ulink>
+ that the module is not effective for the trusted PL/Perl use case. If
+ your security needs are incompatible with the uncertainty in that warning,
+ consider executing <literal>REVOKE USAGE ON LANGUAGE plperl FROM
+ PUBLIC</literal>.
+ </para>
+ </warning>
+
<para>
Here is an example of a function that will not work because file
system operations are not allowed for security reasons: