<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/noexec+tmp'
         s:cUser='retep'
         s:oUser=''
         s:mUser='alicia'>
        <s:name>knowledgebase/linux/webserver/noexec tmp</s:name>
        <s:content>Do you have a &apos;broken&apos; web application that let&apos;s hackers upload files to /tmp and execute them?  Here is how to prevent programs uploaded to /tmp from running.&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;# create a 10MB block device which will be the /tmp file system&#xD;&#xA;cd /root&#xD;&#xA;dd if=/dev/zero of=/root/tmpMnt bs=1024 count=10000&#xD;&#xA;mkfs.ext3 -F /root/tmpMnt&#xD;&#xA;# mount it at /tmp&#xD;&#xA;mv /tmp /tmp.backup&#xD;&#xA;mkdir /tmp&#xD;&#xA;mount -o loop,noexec,nosuid,rw /root/tmpMnt /tmp&#xD;&#xA;chmod 0777 /tmp&#xD;&#xA;# make it so it is used on boot up&#xD;&#xA;if ! grep -qai tmpMnt /etc/fstab ; then &#xD;&#xA;     echo &quot;/root/tmpMnt /tmp ext3 loop,noexec,nosuid,rw  0 0&quot; &gt;&gt; /etc/fstab&#xD;&#xA;fi&#xD;&#xA;# check your syntax is ok&#xD;&#xA;mount -a&#xD;&#xA;# check that programs in /tmp will not run&#xD;&#xA;cp /bin/ls /tmp/&#xD;&#xA;/tmp/ls&#xD;&#xA;{code}&#xD;&#xA;</s:content>
        <s:mTime>2007-08-14 01:26:34.0</s:mTime>
        <s:cTime>2005-09-14 20:00:06.0</s:cTime>
        <s:comments>
            <rdf:Bag>
                <rdf:li>
                    <s:Comment rdf:about='http://bliki.rimuhosting.com/rdf#comment-knowledgebase/linux/webserver/noexec+tmp-1'
                         s:cUser='alicia'
                         s:oUser=''
                         s:mUser='alicia'>
                        <s:name>comment-knowledgebase/linux/webserver/noexec tmp-1</s:name>
                        <s:content>Keep in mind sometimes a hacker may upload a perl script to your /tmp directory.&#xD;&#xA;In this case the script calls perl and perl is executed outside of the /tmp directory, regardless of the permissions on /tmp. This is why it&apos;s good to ensure your /tmp directory is &#xD;&#xA;&#xD;&#xA;1) perms set to: &#xD;&#xA;   chmod 1777 /tmp&#xD;&#xA;   this sets the sticky bit and ensures that no other users may write to anothers&apos; files.&#xD;&#xA;&#xD;&#xA;2) Monitored often for possible malicious scripts unknowingly uploaded to your server.&#xD;&#xA;</s:content>
                        <s:mTime>2007-08-14 01:26:27.0</s:mTime>
                        <s:cTime>2007-08-14 01:25:52.0</s:cTime>
                        <s:commentedSnip rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/noexec+tmp'/>
                    </s:Comment>
                </rdf:li>
                <rdf:li>
                    <s:Comment rdf:about='http://bliki.rimuhosting.com/rdf#comment-knowledgebase/linux/webserver/noexec+tmp-2'
                         s:cUser='yves'
                         s:oUser=''
                         s:mUser='yves'>
                        <s:name>comment-knowledgebase/linux/webserver/noexec tmp-2</s:name>
                        <s:content>See also:&#xD;&#xA;&#xD;&#xA;http://www.debian.org/doc/manuals/securing-debian-howto/ch4.en.html#s4.9</s:content>
                        <s:mTime>2007-08-14 16:58:47.0</s:mTime>
                        <s:cTime>2007-08-14 16:58:47.0</s:cTime>
                        <s:commentedSnip rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/noexec+tmp'/>
                    </s:Comment>
                </rdf:li>
            </rdf:Bag>
        </s:comments>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li>
                    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/noexec+tmp'>
                        <s:attachments
                             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
                    </s:Snip>
                </rdf:li>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on debian sarge'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/grub boot cd'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/networking/null route an attackers ip'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/tomcat on plesk'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/distros/ubuntu'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/phpmyadmin'/>
                <rdf:li rdf:resource='#alicia'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#KDE4 and the Plasma desktop'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin+on+debian+sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/moving imap folders between hosts'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/svn notes'/>
            </rdf:Bag>
        </s:snipLinks>
    </s:Snip>
</rdf:RDF>
