SunQuest
           Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 16th, 2000, 09:34 AM
jezebel jezebel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 7 jezebel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm currently working on a script wich is presenting search-results from a SQL-database, and it works great. Anyone got a tip for me were to find more about security issues?
I'd like to know more about known ways to abuse cgi-scripts, known ways to abuse perl-scripts in general and ways to prevent this.
My scripts will run on a fairly secured Apache-server, but I'm not the hostmaster so there's nothing much for me to do there, but I'd like to make my scripts secure if there is a way.

Reply With Quote
  #2  
Old March 17th, 2000, 02:49 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
first step for preventing of your script from abusing is,
upload your script only in CGI-BIN directory...


second step is ,filter the entries of the user...

third and final step is ,make sure that the script is only able to run from your server.


best way to find out this is check the HTTP_REFERER enviurment varible =your host address.

if you search for some article about security issues ,you may find out some important informations..






Reply With Quote
  #3  
Old March 17th, 2000, 04:58 AM
jezebel jezebel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 7 jezebel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you for helping me out

You don't happen to have a decent URL or a FAQ I could read more about security in? I find security somewhat tricky...


Reply With Quote
  #4  
Old March 21st, 2000, 01:33 AM
mwatkins mwatkins is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 1999
Posts: 2 mwatkins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to mwatkins

Hello there,

You may want to take a look at the following URL;
http://www.freeperlcode.com/info/Security/

There's a few good links there about CGI security. Best piece of info I got from that is, ALWAYS check user input. For example, if you have an HTML form with a hidden form field, it doesn't mean the value of that hidden field is going to stay the same when it gets submitted to the CGI script. Or if you have a select box, it doesn't mean the script is going to get one of the values of the select box.

Hope that helps,
Mike

Reply With Quote
  #5  
Old March 21st, 2000, 05:03 AM
jezebel jezebel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 7 jezebel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Does this mean that if I have a form that uses the get-method, the code could be replaced?
I didn't think that was possible, since I define the variables in the script, like:
$query = CGI::new();
$name = $query->param('name');
I like using CGI.pm since it handles a lot of things for me very smothly, but I've never considered the security to be an issue, not with CGI.pm. Should I reconsider?

Reply With Quote
  #6  
Old April 4th, 2000, 04:07 AM
KenByrne KenByrne is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 1 KenByrne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to KenByrne
no need to reconsider using CGI.pm its a very good module although you should be wary of a few things:
check $name for the main security holes..
a backslash ` and the pipe character |
these two might allow people to execute system commands so if the cgi parameter contains these quit out or reset the page indicating that you shouldnt use these
(theres no reason why you would need them in forms anyway)
there are other things but i cant think of them off top of my head URL

[This message has been edited by KenByrne (edited April 04, 2000).]

Reply With Quote
  #7  
Old April 6th, 2000, 03:39 AM
jezebel jezebel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 7 jezebel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can I check for ` and | in $name with an
if ($name eq "`") { die "n" } elseif ($name eq "|") { die "n" }
in the script or how do I write it? I'm not sure I quite understand what someone might do with | or ` since I use the $name for calling different sub routines. Something like:
if ($name eq "year") { &year }
if ($name eq "author") { &author }
and if the script gets something else, it's supposed to display a page with an error message, or can someone fool the script anyway? (Getting confused here)


*learning about security right away would have been a geat idea*

Reply With Quote
  #8  
Old April 11th, 2000, 03:17 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
Hi,

you can check wired characters in perl very easily.

use substitution operation or transaltion operator for removing a particular character from the input.

let us say ,user entered ` or | into the name field .you may remove that from the field using substitution operator.

$name=~ s/`/ /;
$name=~ s/|/ /;

see Regular Expressions topics in perl for getting some good information...

------------------
SR -
shiju.dreamcenter.net

[This message has been edited by Shiju Rajan (edited April 11, 2000).]

Reply With Quote
  #9  
Old April 11th, 2000, 08:32 AM
jezebel jezebel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 7 jezebel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks!
That didn't sound complicated at all

Do I have to do this everytime I use $name, or is it enought to do it once at the beginning of the script?

Reply With Quote
  #10  
Old April 11th, 2000, 01:21 PM
Imo Imo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 1999
Posts: 33 Imo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
man perlsec (assuming you're using unix of some flavour)

and have a look at the FAQs on www.perl.com... you know it makes sense.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Security issues usin Perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway