Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    New Philips Hue update improves battery status accuracy

    GameSir’s GameHub is bringing Steam (PC) games to Mac

    Asus and Acer hit with laptop and PC sales ban amid Nokia HEVC patent dispute in Germany

    Facebook X (Twitter) Instagram
    • Artificial Intelligence
    • Business Technology
    • Cryptocurrency
    • Gadgets
    • Gaming
    • Health
    • Software and Apps
    • Technology
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Tech AI Verse
    • Home
    • Artificial Intelligence

      Read the extended transcript: President Donald Trump interviewed by ‘NBC Nightly News’ anchor Tom Llamas

      February 6, 2026

      Stocks and bitcoin sink as investors dump software company shares

      February 4, 2026

      AI, crypto and Trump super PACs stash millions to spend on the midterms

      February 2, 2026

      To avoid accusations of AI cheating, college students are turning to AI

      January 29, 2026

      ChatGPT can embrace authoritarian ideas after just one prompt, researchers say

      January 24, 2026
    • Business

      The HDD brand that brought you the 1.8-inch, 2.5-inch, and 3.5-inch hard drives is now back with a $19 pocket-sized personal cloud for your smartphones

      February 12, 2026

      New VoidLink malware framework targets Linux cloud servers

      January 14, 2026

      Nvidia Rubin’s rack-scale encryption signals a turning point for enterprise AI security

      January 13, 2026

      How KPMG is redefining the future of SAP consulting on a global scale

      January 10, 2026

      Top 10 cloud computing stories of 2025

      December 22, 2025
    • Crypto

      Binance Denies Sanctions Breach Claims After $1 Billion Iran-Linked USDT Transactions Reported

      February 16, 2026

      Ray Dalio Says the World Order Has Broken Down: What Does It Mean for Crypto?

      February 16, 2026

      Cardano Whales are Trying to Rescue ADA Price

      February 16, 2026

      MYX Finance Lost 70% In a Week: What Triggered the Sharp Sell-Off?

      February 16, 2026

      What Really Happened Between Binance and FTX? CZ Finally Tells His Side

      February 16, 2026
    • Technology

      New Philips Hue update improves battery status accuracy

      February 16, 2026

      GameSir’s GameHub is bringing Steam (PC) games to Mac

      February 16, 2026

      Asus and Acer hit with laptop and PC sales ban amid Nokia HEVC patent dispute in Germany

      February 16, 2026

      Kingdom Come: Deliverance gets a next-gen 60 FPS update as its Royal Edition with all DLCs drops to $7.99 on the PlayStation Store

      February 16, 2026

      Eufy launches motion detector with smart feature in new market

      February 16, 2026
    • Others
      • Gadgets
      • Gaming
      • Health
      • Software and Apps
    Check BMI
    Tech AI Verse
    You are at:Home»Technology»Linux Capabilities Revisited
    Technology

    Linux Capabilities Revisited

    TechAiVerseBy TechAiVerseOctober 22, 2025No Comments5 Mins Read4 Views
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Linux Capabilities Revisited
    Share
    Facebook Twitter LinkedIn Pinterest WhatsApp Email

    Linux Capabilities Revisited

    Introduction

    Notes to kernel developers: The goal of capabilities is divide the power of superuser into pieces, such that if a program that has one or more capabilities is compromised, its power to do damage to the system would be less than the same program running with root privilege. Capabilities(7) — Linux manual page

    Capabilities are a fine-grained access control mechanism in Linux, allowing more granular permissions than the traditional superuser (root) model. Capabilities divide the privileges typically associated with the root user into distinct units that can be independently enabled or disabled for different processes. This allows for more secure and controlled privilege management.

    For example, a process may need permission to bind to privileged ports but not require any other elevated permissions.

    Understanding Capabilities

    To see how many capabilities our Linux host is aware of, we can query the file cap_last_cap inside the /proc directory:

    # cat /proc/sys/kernel/cap_last_cap
    40
    

    The capsh --print command displays the current capabilities and related settings of the shell or the process invoking the command. When executing this command on our Linux host, we see the full list of capabilities.

    # capsh --print
    Current: =ep
    Bounding set =cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read,cap_perfmon,cap_bpf,cap_checkpoint_restore
    

    Each capability corresponds to a specific privileged action.

    Backdooring Python

    The command setcap sets file capabilities on an executable. The cap_setuid capability allows a process to make arbitrary manipulations of user IDs (UIDs), including setting the UID to a value that would otherwise be restricted (i.e. UID 0, the root user). setcap takes a set of parameters, where

    • e: Effective means the capability is activated
    • p: Permitted means the capability can be used/is allowed.

    Putting this together, we’re adding the cap_setuid capabilities to the Python binary:

    # setcap cap_setuid+ep /usr/bin/python3.12
    

    One can find a list of supported capabilities here:

    # cat /usr/include/linux/capability.h
    

    Testing

    For testing purposes, we created a new user (malmoeb) and switched to the context of this user (useradd && su):

    # useradd -m malmoeb
    # su malmoeb
    $ id
    uid=1000(malmoeb) gid=1000(malmoeb) groups=1000(malmoeb)
    

    Using the following command line, we set the UID of the bash shell we are calling with Python to 0 (UID 0 == root), effectively spawning a root shell:

    $ /usr/bin/python3 -c 'import os;os.setuid(0);os.system("/bin/bash")'
    # id
    uid=0(root) gid=1000(malmoeb) groups=1000(malmoeb)
    

    The exciting thing about this technique is that we have not set a suid bit on a binary, or changed the Python binary. By setting the capabilities, we, as attackers, can build a powerful backdoor.

    Hunting

    Traditionally, system administrators and security professionals have focused on finding SUID (Set User ID) and SGID (Set Group ID) files, because these files can be used to escalate privileges under certain conditions. However, with the introduction of POSIX capabilities, it is now equally important to hunt for files with capabilities set, as demonstrated above.

    Enumerating all binaries with capabilities set is possible with the command getcap -r:

    # getcap -r / 2>/dev/null
    /usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-ptp-helper cap_net_bind_service,cap_net_admin,cap_sys_nice=ep
    /usr/bin/mtr-packet cap_net_raw=ep
    /usr/bin/ping cap_net_raw=ep
    /usr/bin/python3.12 cap_setuid=ep
    

    Inside the /proc directory:

    # cat /proc/1143966/status | grep Cap
    

    where:

    • CapInh = Inherited capabilities
    • CapPrm = Permitted capabilities
    • CapEff = Effective capabilities
    • CapBnd = Bounding set
    • CapAmb = Ambient capabilities set

    Utilising the command capsh, we decode the capabilities as follows:

    # capsh --decode=0000000000000080
    0x0000000000000080=cap_setuid
    

    Or with the command getpcaps, passing the PID as an argument:

    # getpcaps 1143966
    Capabilities for `1143966': = cap_setuid+ep
    

    Remove the capabilities from a binary with setcap -r

    # setcap -r /usr/bin/python3.12
    

    LinPeas

    LinPEAS, the Linux Privilege Escalation Awesome Script, also performs some checks to find (interesting) capabilities. Following the commands taken directly from the relevant script:

    • Current shell capabilities: cat "/proc/$$/status"
    • Parent process capabilities: cat "/proc/$PPID/status"
    • Files with capabilities: getcap -r / 2>/dev/null

    Besides checking for suid files, LinPEAS does an excellent job here for searching for (hidden) capabilities discussed so far.

    Elastic rule: Process Capability Set via setcap Utility

    Elastic “detects the use of the setcap utility to set capabilities on a process.” See here for the full description.

    process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start") and
    process.name == "setcap" and not (
      process.parent.executable == null or
      process.parent.executable : ("/var/lib/dpkg/*", "/var/lib/docker/*", "/tmp/newroot/*", "/var/tmp/newroot/*") or
      process.parent.name in ("jem", "vzctl")
    )
    

    security.capability

    Extended permissions—such as access control lists (ACLs) set with setfacl and capability flags set with setcap are stored in the same location as traditional permission bits and setuid/setgid flags configured via chmod: the file’s inode.

    The ls command does not display capability flags set by setcap. To view them, use getcap. To list all extended attributes, you can use getfattr -d -m -. The attribute setcap uses is security.capability, and it’s stored in a binary format that getcap conveniently decodes for you.

    # getfattr -d -m - /usr/bin/python3.12 
    getfattr: Removing leading '/' from absolute path names
        # file: usr/bin/python3.12
    security.capability=0sAQAAAoAAAAAAAAAAAAAAAAAAAAA=
    

    Conclusion

    While traditional SUID/SGID checks are still crucial, modern security practices must include hunting for files with specific capabilities set. Capabilities provide a more granular and potentially stealthy way to grant necessary privileges, and if not monitored, they can introduce significant security risks. Using tools like getcap to search the file system for these capabilities recursively is essential to ensure a comprehensive security audit and to mitigate potential exploitation vectors.

    We have not touched upon user capabilities, which are stored in the /etc/security/capability.conf configuration file, or the service files, where you can specify AmbientCapabilities. The following section presents two good resources for an in-depth discussion of this topic.

    References

    Here are two recommended websites if you want to dig deeper into this topic:

    • Capabilities – Linux Privilege Escalation
    • Linux Capabilities
    Share. Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Telegram Email
    Previous ArticleAI assistants misrepresent news content 45% of the time
    Next Article Tiny sugar spoons are popping up on NYC fast-food menus
    TechAiVerse
    • Website

    Jonathan is a tech enthusiast and the mind behind Tech AI Verse. With a passion for artificial intelligence, consumer tech, and emerging innovations, he deliver clear, insightful content to keep readers informed. From cutting-edge gadgets to AI advancements and cryptocurrency trends, Jonathan breaks down complex topics to make technology accessible to all.

    Related Posts

    New Philips Hue update improves battery status accuracy

    February 16, 2026

    GameSir’s GameHub is bringing Steam (PC) games to Mac

    February 16, 2026

    Asus and Acer hit with laptop and PC sales ban amid Nokia HEVC patent dispute in Germany

    February 16, 2026
    Leave A Reply Cancel Reply

    Top Posts

    Ping, You’ve Got Whale: AI detection system alerts ships of whales in their path

    April 22, 2025680 Views

    Lumo vs. Duck AI: Which AI is Better for Your Privacy?

    July 31, 2025261 Views

    6.7 Cummins Lifter Failure: What Years Are Affected (And Possible Fixes)

    April 14, 2025155 Views

    6 Best MagSafe Phone Grips (2025), Tested and Reviewed

    April 6, 2025112 Views
    Don't Miss
    Technology February 16, 2026

    New Philips Hue update improves battery status accuracy

    New Philips Hue update improves battery status accuracy – NotebookCheck.net News ⓘ Philips HueSome Philips…

    GameSir’s GameHub is bringing Steam (PC) games to Mac

    Asus and Acer hit with laptop and PC sales ban amid Nokia HEVC patent dispute in Germany

    Kingdom Come: Deliverance gets a next-gen 60 FPS update as its Royal Edition with all DLCs drops to $7.99 on the PlayStation Store

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Welcome to Tech AI Verse, your go-to destination for everything technology! We bring you the latest news, trends, and insights from the ever-evolving world of tech. Our coverage spans across global technology industry updates, artificial intelligence advancements, machine learning ethics, and automation innovations. Stay connected with us as we explore the limitless possibilities of technology!

    Facebook X (Twitter) Pinterest YouTube WhatsApp
    Our Picks

    New Philips Hue update improves battery status accuracy

    February 16, 20263 Views

    GameSir’s GameHub is bringing Steam (PC) games to Mac

    February 16, 20262 Views

    Asus and Acer hit with laptop and PC sales ban amid Nokia HEVC patent dispute in Germany

    February 16, 20263 Views
    Most Popular

    7 Best Kids Bikes (2025): Mountain, Balance, Pedal, Coaster

    March 13, 20250 Views

    VTOMAN FlashSpeed 1500: Plenty Of Power For All Your Gear

    March 13, 20250 Views

    This new Roomba finally solves the big problem I have with robot vacuums

    March 13, 20250 Views
    © 2026 TechAiVerse. Designed by Divya Tech.
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.