Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Usb2shell: Root on Linux from a USB Plug-In

https://usb2shell.com/

Servers might be safe from this one but still, from my limited understanding, there is still some chance that it could perhaps be exploited remotely as well in some settings if you are using things like GL.iNet Comet Remote KVM (for example) over ip.

Kinda really curious what's the opinion on this bug.

Comments

  • ralfralf Member

    @whynotlearn said:
    Kinda really curious what's the opinion on this bug.

    Not this bug per se, but maybe this is the time for microkernels to stage a comeback. So many of these recent vulnerabilities are in subsystems that really have no need to be in the kernel at all.

  • luckypenguinluckypenguin Member
    edited December 1

    For a long time already, I disable all protocols, devices, and obscure stuff that I will never use on Linux kernels. Here is a sample:

    _root@debian:~# cat /etc/modprobe.d/blacklist-vps-unused.conf
    _

    install usb-storage /bin/false
    install uas /bin/false
    install xhci_hcd /bin/false
    install ehci_hcd /bin/false
    install uhci_hcd /bin/false

    Sound / Audio

    install snd /bin/false
    install snd_pcm /bin/false
    install soundcore /bin/false
    install pcspkr /bin/false

    Wireless / Bluetooth / Firewire / Floppy

    install bluetooth /bin/false
    install btusb /bin/false
    install cfg80211 /bin/false
    install mac80211 /bin/false
    install firewire-core /bin/false
    install floppy /bin/false

    Linux kernel privilege-escalation CVEs)

    install dccp /bin/false
    install sctp /bin/false
    install rds /bin/false
    install tipc /bin/false
    install n-hdlc /bin/false
    install ax25 /bin/false
    install netrom /bin/false
    install rose /bin/false
    install decnet /bin/false
    install econet /bin/false
    install af_802154 /bin/false
    install ipx /bin/false
    install appletalk /bin/false
    install psnap /bin/false
    install p8023 /bin/false
    install p8022 /bin/false
    install can /bin/false
    install atm /bin/false
    install bluetooth /bin/false
    install btusb /bin/false
    install bnep /bin/false
    install rfcomm /bin/false
    install hidp /bin/false

    2. Sound, Multimedia & Unneeded Virtual Hardware

    install snd /bin/false
    install snd_pcm /bin/false
    install snd_timer /bin/false
    install snd_hda_intel /bin/false
    install snd_ac97_codec /bin/false
    install soundcore /bin/false
    install uvcvideo /bin/false
    install videodev /bin/false
    install v4l2_common /bin/false
    install pcspkr /bin/false
    install joydev /bin/false
    install mousedev /bin/false
    install floppy /bin/false
    install cdrom /bin/false
    install sr_mod /bin/false
    install parport /bin/false
    install parport_pc /bin/false
    install lp /bin/false

    3. Legacy & Attack-Prone Filesystems

    install cramfs /bin/false
    install freevxfs /bin/false
    install jffs2 /bin/false
    install hfs /bin/false
    install hfsplus /bin/false
    install squashfs /bin/false
    install udf /bin/false
    install btrfs /bin/false
    install xfs /bin/false
    install zfs /bin/false
    install gfs2 /bin/false
    install f2fs /bin/false
    install reiserfs /bin/false
    install ntfs3 /bin/false
    install cifs /bin/false
    install nfs /bin/false
    install nfsv3 /bin/false
    install nfsv4 /bin/false
    install ksmbd /bin/false

    Recent local privilege escalation paths (no IPsec, AFS, SMB or tc pedit)

    install algif_aead /bin/false
    install esp4 /bin/false
    install esp6 /bin/false
    install ipcomp /bin/false
    install ipcomp6 /bin/false
    install af_key /bin/false
    install rxrpc /bin/false
    install kafs /bin/false
    install rds /bin/false
    install rds_tcp /bin/false
    install rds_rdma /bin/false
    install act_pedit /bin/false

    4. Physical Bus & DMA Attack Vectors

    install firewire-core /bin/false
    install firewire-ohci /bin/false
    install ohci1394 /bin/false
    install sbp2 /bin/false
    install dv1394 /bin/false
    install raw1394 /bin/false
    install video1394 /bin/false
    install thunderbolt /bin/false
    install usb-storage /bin/false
    install uas /bin/false

    not nesting VMs

    blacklist kvm_intel
    blacklist kvm
    install kvm /bin/false
    install kvm_intel /bin/false

    Memory ballooning

    blacklist virtio_balloon
    install virtio_balloon /bin/false

    ATA/IDE

    blacklist ata_piix
    blacklist ata_generic
    blacklist libata

    Input devices

    blacklist evdev
    blacklist button
    blacklist serio_raw

    VMware

    blacklist vmw_vmci
    blacklist vmw_vsock_vmci_transport
    blacklist vmw_vsock_virtio_transport_common
    blacklist vsock_loopback
    blacklist vsock
    install vsock /bin/false

    QEMU firmware

    blacklist qemu_fw_cfg

    SCSI generic

    blacklist sg

    i6300ESB

    blacklist i6300esb

    Intel RAPL power management

    blacklist intel_rapl_msr
    blacklist intel_rapl_common
    blacklist iosf_mbi
    blacklist rapl

    EFI pstore

    blacklist efi_pstore

    Binary format

    blacklist binfmt_misc

    Automount

    blacklist autofs4

    Watchdog hardware driver

    blacklist watchdog

    configfs

    blacklist configfs
    install configfs /bin/false

    T10 DIF SCSI

    blacklist crct10dif_pclmul

    Thanked by 1deafcon
  • tentortentor Member, Host Rep

    @luckypenguin said:
    For a long time already, I disable all protocols, devices, and obscure stuff that I will never use on Linux kernels.

    List is way too big, why have not you considered abandoning distro provided kernels in favor of your own minimalistic build with what you actually use?

    Thanked by 1tux
  • @tentor said: List is way too big, why have not you considered abandoning distro provided kernels in favor of your own minimalistic build with what you actually use?

    What I actually use? Minimalistic FreeBSD kernel.
    What my customers use? The usual stuff: nginx, php, mariadb, redis, postfix, etc.
    I need to make sure the kernel remains relatively vanilla and usable, while making sure
    that when there is another 0day coming, at least the attacker won't get root simply by
    chaining vulnerable paths.

    Thanked by 2tentor deafcon
  • Is there a VPS specific kernel/distro that bakes in some/most of those exclusions without needing to compile my own?

  • @deafcon said: Is there a VPS specific kernel/distro that bakes in some/most of those exclusions without needing to compile my own?

    Nothing to compile, you just add it to a modprobe file. Then they are just not loaded.
    The closest thing you are probably looking for is:
    https://www.redhat.com/en/products/hardened-images

    Thanked by 1deafcon
  • @luckypenguin said:

    @deafcon said: Is there a VPS specific kernel/distro that bakes in some/most of those exclusions without needing to compile my own?

    Nothing to compile, you just add it to a modprobe file. Then they are just not loaded.
    The closest thing you are probably looking for is:
    https://www.redhat.com/en/products/hardened-images

    No, I get that I could do what you're doing without need to compile. I was just curious if there is a middle ground between what you're doing and @tentor's suggestion to run a custom kernel.

  • luckypenguinluckypenguin Member
    edited December 1

    @deafcon said: No, I get that I could do what you're doing without need to compile. I was just curious if there is a middle ground between what you're doing and @tentor's suggestion to run a custom kernel.

    https://secureblue.dev/features

    But I'm not sure if it's ready for small VPS, it has large performance and memory overhead.
    Also, you MUST run your stack in containers. There is no "dnf install nginx php-fpm mariadb"
    as root. You spin a container for each service.

    Thanked by 1deafcon
  • @luckypenguin said:
    For a long time already, I disable all protocols, devices, and obscure stuff that I will never use on Linux kernels.

    Careful with copying that list as is though. It blocks xfs and squashfs, and on an Alma or Rocky VPS the root fs is usually xfs, while snaps on Ubuntu mount through squashfs. If that modprobe.d file gets pulled into the initramfs on the next kernel update, the box just won't boot.

  • @luckypenguin said:

    @deafcon said: No, I get that I could do what you're doing without need to compile. I was just curious if there is a middle ground between what you're doing and @tentor's suggestion to run a custom kernel.

    https://secureblue.dev/features

    But I'm not sure if it's ready for small VPS, it has large performance and memory overhead.
    Also, you MUST run your stack in containers. There is no "dnf install nginx php-fpm mariadb"
    as root. You spin a container for each service.

    Interesting. Thanks for the link. It looks like the Debian cloud-am64 kernel excludes a good bit of your list. I think I'll play with both options a bit considering I have some new servers from BF that need to be configured anyway.

  • @VpsVictor said: Careful with copying that list as is though. It blocks xfs and squashfs, and on an Alma or Rocky VPS the root fs is usually xfs, while snaps on Ubuntu mount through squashfs. If that modprobe.d file gets pulled into the initramfs on the next kernel update, the box just won't boot.

    Never said it's universal. I only tested it on Debian, and with ext4. Obviously if you run something else you will need to comment some stuff.

    A good baseline for just a kernel, without tampering with it yourself is: https://git.unredacted.org/unredacted/linux-hardened-unredacted

    but this project is not a distro by itself.

  • I liked this idea of module blacklisting anything not already running in the kernel, for starters. After I set up a vps its one command and poof.
    https://github.com/jnuyens/modulejail

    Thanked by 1luckypenguin
  • ralfralf Member

    @tentor said:

    @luckypenguin said:
    For a long time already, I disable all protocols, devices, and obscure stuff that I will never use on Linux kernels.

    List is way too big, why have not you considered abandoning distro provided kernels in favor of your own minimalistic build with what you actually use?

    That was my first thought too, but I'd prefer a massive long list of blacklists that I occasionally need to revisit AND a distro-supplied kernel that auto-updates for security patches than having to recompile the kernel all the time.

Sign In or Register to comment.