FreeBSD : py-yaml -- FullLoader (still) exploitable for arbitrary command execution (aae8fecf-888e-11ea-9714-08002718de91)

critical Nessus Plugin ID 136021

Language:

Synopsis

The remote FreeBSD host is missing one or more security-related updates.

Description

Riccardo Schirone (https://github.com/ret2libc) reports :

In FullLoader python/object/new constructor, implemented by construct_python_object_apply, has support for setting the state of a deserialized instance through the set_python_instance_state method.
After setting the state, some operations are performed on the instance to complete its initialization, however it is possible for an attacker to set the instance' state in such a way that arbitrary code is executed by the FullLoader.

This patch tries to block such attacks in FullLoader by preventing set_python_instance_state from setting arbitrar properties. It implements a blacklist that includes extend method (called by construct_python_object_apply) and all special methods (e.g. __set__,
__setitem__, etc.).

Users who need special attributes being set in the state of a deserialized object can still do it through the UnsafeLoader, which however should not be used on untrusted input. Additionally, they can subclass FullLoader and redefine state_blacklist_regexp to include the additional attributes they need, passing the subclassed loader to yaml.load.

Solution

Update the affected packages.

See Also

https://bugzilla.redhat.com/show_bug.cgi?id=1807367

https://github.com/yaml/pyyaml/pull/386

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245937

http://www.nessus.org/u?9931df75

Plugin Details

Severity: Critical

ID: 136021

File Name: freebsd_pkg_aae8fecf888e11ea971408002718de91.nasl

Version: 1.4

Type: local

Published: 4/28/2020

Updated: 3/14/2024

Supported Sensors: Nessus

Risk Information

VPR

Risk Factor: Medium

Score: 5.9

CVSS v2

Risk Factor: Critical

Base Score: 10

Temporal Score: 7.4

Vector: CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C

CVSS Score Source: CVE-2020-1747

CVSS v3

Risk Factor: Critical

Base Score: 9.8

Temporal Score: 8.5

Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Temporal Vector: CVSS:3.0/E:U/RL:O/RC:C

Vulnerability Information

CPE: p-cpe:/a:freebsd:freebsd:py35-yaml, p-cpe:/a:freebsd:freebsd:py37-yaml, p-cpe:/a:freebsd:freebsd:py36-yaml, p-cpe:/a:freebsd:freebsd:py27-yaml, cpe:/o:freebsd:freebsd, p-cpe:/a:freebsd:freebsd:py38-yaml

Required KB Items: Host/local_checks_enabled, Host/FreeBSD/release, Host/FreeBSD/pkg_info

Exploit Ease: No known exploits are available

Patch Publication Date: 4/27/2020

Vulnerability Publication Date: 3/2/2020

Reference Information

CVE: CVE-2020-1747

IAVA: 2021-A-0463