I know. Running a full chroot apache is too painful, though. I think what I want is impossible. I want to start my script, then load a couple of perl modules and libraries, grab everything that I need from the real filesystem, then drop as many privileges as I can, and only then start interacting with my user or processing whatever he has given me in the query string. This should make it much harder for a user to create mischief. It would seem like a smart security idea, somewhere in between a full apache chroot (with its double maintenance requirements), and the no drop of privileges whatsoever. I know it wont help against many other vulnerabilities, of course.

It does not really matter how the last hack happened, although I am sure that someone reading this here knows exactly how it happened. (Happened after my first question on security here on perlmonks. Ironically, it was indeed not related to perl, but to a stupid error elsewhere.) It is more important for me to take precautions against my next coding error. Sony has proven that it can happen to anyone.

I still do not understand why chroot is not a permissible privilege reducing operation (which therefore should not require privileges). But it does not really matter if linux does not allow me to. It is not really a perl question in this case, anyway.

Yes, system("chroot") could not work, because it does not apply to the current process. Oh well...

Iaw


In reply to Re^2: chroot() security in cgi script? by iaw4
in thread chroot() security in cgi script? by iaw4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.