comp.os.linux.security
  Home FAQ Contact Sign in
comp.os.linux.security only
 
Advanced search
July 2008
motuwethfrsasuw
 123456 27
78910111213 28
14151617181920 29
21222324252627 30
28293031    31
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.os.linux.security Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  security vulnerabilities in bash script         


Author: Ggds
Date: Jul 8, 2008 01:24

Hello everyone,

I have this simple bash script that reads from standard input and executes
some work depending on the input that it has read. The input lines are
meant to be in the form of a command followed by an argument.

#!/bin/bash

read input

#these two lines divide input in a first word and the rest; are they safe?
command=`echo ${input%%%% *}`
rest=`echo ${input#* }`

case $command in

print)
echo $rest
;;

*)
echo "wrong command"
;;

esac

Is is possible for the user to provide something to the standard input and
make this script do something different from what it was meant?
Show full article (0.84Kb)
6 Comments