Skip to content

Add shared memory hardening #3

Description

@ranjith-src

What

Add shared memory hardening to the sysctl or misc module: mount /run/shm with noexec,nosuid to prevent code execution from shared memory.

Why

Attackers commonly use /dev/shm or /run/shm to stage and execute payloads because it's world-writable and often allows execution. Adding noexec,nosuid prevents this attack vector.

Suggested implementation

Add to /etc/fstab if not already present:

tmpfs /run/shm tmpfs defaults,noexec,nosuid 0 0

Then remount: mount -o remount /run/shm

This is essentially a one-liner addition to an existing module. Add a verification check in mod_verify() that confirms noexec is in the mount options for /run/shm.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions