Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: how would you detect a math expression

by Molt (Chaplain)
on Feb 19, 2007 at 15:10 UTC ( #600869=note: print w/ replies, xml ) Need Help??


in reply to Re^3: how would you detect a math expression
in thread how would you detect a math expression

Even with the double fork and chroot there're still a lot of potential security holes which are open, for example consider the following two fairly common attacks for a couple off the top of my head:

  • Denial of service attacks: Make the machine talk to itself a lot.. use LWP::Simple; while (1) { get("http://localhost/something_intensive.cgi")} (bonus points for calling the the calculator again with the same effect), fork bombing with while (1) { fork }, or getting a list of the current user's active processes and kill -9'ing them.
  • Mailing back details from your machine to the aggressor to get information for other attacks: Grab the script, grab the config files listed in the script, connect to the database with credentials from config file, delete all data or subtly corrupt it as you see fit. If this application has no config file there're probably other web apps on the machine who's config file you can get.
Basically this is the Whack-A-Mole kind of thing where you think of two avenues of attack and block them, the attacker thinks of a third and causes you pain. The kind of security provided by the Safe module could be a step in the right direction but that'd need careful config, whereas the route means that the operations the user can execute are strictly restricted to a known-safe subset, and also means that the user can enter terms such as '2x2.23kg in lbs' which'd never run in Perl even with constants carefully defined.


Comment on Re^4: how would you detect a math expression
Select or Download Code
Re^5: how would you detect a math expression
by shmem (Canon) on Feb 19, 2007 at 16:27 UTC
    Even with the double fork and chroot there're still a lot of potential security holes which are open, for example consider the following two fairly common attacks for a couple off the top of my head:

    of course taint mode is required, as well as sanitizing the input, limiting it to a safe subset of expressions. And it seems that I am required to advise the usage of strict and warnings also... but that's not the point of the thread, is it?

    --shmem

    Happy Year of the Golden Pig!
    oink ,,__
        o"   )~
         ''''
    
    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://600869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-12-25 00:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls