RE: Secure Form Script?

From: Glynn Clements (glynn.clements_at_virgin.net)
Date: 05/16/04

  • Next message: Jim: "Re: iptables firewall script for debian-woody, 2.4.24"
    Date: Sun, 16 May 2004 10:52:05 +0100
    To: "Bryce Porter" <bporter@heart.net>
    
    

    Bryce Porter wrote:

    > Also, what if you call sendmail directly, but quote it wrong? Someone
    > could send an email with '; cat /etc/passwd' or whatever they wanted in
    > it, and have it be executed with the same permissions the script is
    > running as. Directly executing anything is a big risk no matter how you
    > look at it, as far as I'm concerned.

    No. The risk isn't in *directly* executing a program; it's executing
    it via the shell.

    So long as you use an interface which allows you to specify the
    individual arguments (argv[]) directly, as opposed to a single string
    which is passed to the shell, you don't have to worry about
    shell-syntax issues.

    In perl, if you pass an array with more than one element to either
    exec or system, the command is executed directly without using the
    shell.

    OTOH, if you pass a scalar or a single-element array, it may be passed
    to the shell (if the string contains no shell metacharacters, perl
    will use its own trivial shell emulation instead). Similarly,
    backticks use the shell.

    -- 
    Glynn Clements <glynn.clements@virgin.net>
    

  • Next message: Jim: "Re: iptables firewall script for debian-woody, 2.4.24"

    Relevant Pages

    • Re: Basic question on shell
      ... in the same shell, by sticking a dot in front of it. ... > the script executes and comes back to my current directory. ... > not same as that of directory i was in while executing the ... If you wish to confirm the origin or content of this communication, ...
      (AIX-L)
    • Re: Cocoa Newbie Question.
      ...  Don't be surprised if executing the program appears to ... no response at all, since "test" is a shell builtin. ... on other people asking for help by ganging up with another poster to ...
      (comp.sys.mac.programmer.help)
    • Re: Cocoa Newbie Question.
      ...  Don't be surprised if executing the program appears to ... no response at all, since "test" is a shell builtin. ... Congratulations on having one less poster here on mac.programmer.help. ...
      (comp.sys.mac.programmer.help)
    • Re: Cocoa Newbie Question.
      ...  Don't be surprised if executing the program appears to ... since "test" is a shell builtin. ... I have exactly 24 hours worth of Objective-C ... Congratulations on having one less poster here on mac.programmer.help. ...
      (comp.sys.mac.programmer.help)
    • Re: Cocoa Newbie Question.
      ...  Don't be surprised if executing the program appears to produce ... no response at all, since "test" is a shell builtin. ... between an executable C file and a shell command, ...
      (comp.sys.mac.programmer.help)