How to Prevent Binary Execution From Mounted Device
Most probable reasons of leaving a post-compiled trojan programs after successfully exploiting a system is brought about by small percentage of having increased security by root not to enable user from compiling a program source, or run executable scripts and binary programs from particular device.
How to mount your device to further prevent script execution from it or program compilation from that mounted device?
Here’s a quick tip on preventing any users from doing binary and shell scripts execution from particular mounted device such as /tmp or /dev/shm directory folder.
How to mount device with noexec preventing program execution?
Simply remount your device as non-suidable and non-executable system device
# mount -o remount, noexec, nosuid /tmp
Yes, remounting them individually can also be done
# mount -o remount, noexec /tmp
# mount -o remount, noexec /tmp
Now, to do some testing, copy an existing executable script and placed in under /tmp folder like so
# cp /root/scripts/test.pl /tmp
# cp /root/scripts/test.sh /tmp
and try to execute those copied scripts like so
# cd /tmp
# ./test.pl
bash: ./test.pl: Permission denied
# ./test.sh
bash: ./test.sh: Permission denied
You can also copy a linux binary file into /tmp and try to execute them.
# cp /usr/bin/who /tmp
# /tmp/who
bash: /tmp/who: Permission denied
Program execution should fail since the device is mounted with noexec and nosuid. However, some linux OS requires the said mounted /tmp device to be listed from /etc/fstab with valid file system type before it can be remounted back again.
To remount all your device back to its default boot up settings based on /etc/fstab, simply
# mount -a
To make the device noexec and nosuid remounts permanently between reboots, simply add it to your existing /tmp mounting flags from /etc/fstab similarly like so.
/dev/sda5 /tmp ext3 noexec,nosuid 0 0
Be noted that remounting a device with noexec and nosuid flag would not totally prevent someone from exploiting or abusing your system.
bases, boot, compilation, compiler, Copy, directory, enable, file, folders, linux, listing, prevent, roots, scripts, secure, Security, shell, source, system, systems, usr
Leave a Reply Cancel reply
Categories
- Alerts & News
- Android
- Anti-Malware
- Anti-Spam/Virus
- Anti-Spyware
- Anti-Virus
- Apache
- Archiving
- Articles
- Audio and Video
- AWS
- Backup
- Backup
- Braindumps
- Browsers
- Browsers and Plugins
- Build Tools
- Cacti
- CentOS
- Cisco
- Cisco IOS Command Reference
- Citrix NetScaler
- Cleaning and Tweaking
- Clustering
- Clustering
- Compilers
- Data recovery
- Database
- Database
- Databases
- Debuggers
- Dell
- Dell
- Desktops
- Developer
- DHCP
- DNS
- Drivers Download
- Drupal
- Editors
- Encryption Software
- Exchange Server
- Fedora
- File Management
- firefox
- Firefox Add-ons
- Firewall
- Free ebooks
- Free software downloads
- Free Tools
- FTP
- FTP
- Games
- Google Plus
- Graphics
- Hacking
- Hardware
- Help Desk software
- High-Availability
- HP
- HP
- IIS
- Interpreters
- iphone
- IT-Tips
- LAMP
- Languages
- Laptops
- Latest Product & Technologies
- Linux
- Linux Commands
- Load Balancer
- Mac
- Memcached
- Messaging and Chat
- miscellaneous
- Mobile Development
- Mobiles
- Monitoring
- MySQL
- NAS
- Networking
- Networking
- Networking Software
- Office and News
- Open Source
- OpenSource Applications
- openSUSE
- Oracle
- PHP
- Popular downloads
- PostgreSQL
- Project Management Software
- Qmail
- Red Hat
- Remote Access
- Repository
- Sci-Tech Education
- Security
- Security
- Sendmail
- SEO
- SEO Tools
- Server OS
- Service Pack
- social networking
- Software Development
- solr
- SQL
- Squid
- Storage
- Sun Solaris
- System Tuning
- Tech Guru
- Technology News
- Testing
- Ubuntu
- Utilities
- Version Control
- Video Tutorial
- Virtual Machine Applications
- Virtualization
- VoIP
- VPN
- Web-related
- web-related
- Websense
- Website Promotion
- Windows
- Windows Commands
- Zend Studio
Recent Posts
- The best memcached Monitoring tool
- Is Thin Clients are Useful for Call center ?
- A new Email Service from Microsoft called Outlook.com
- How to Detect Back Links from spam websites
- How to Ignore Replication errors in MySQL
