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:
  #1  
Old July 12th, 2001, 08:33 AM
bonzo bonzo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 bonzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation evil nulls

hi there,
i'm building a perl script that will make some system calls and i want to make it smart enough to catch "evil nulls".

by that i mean there are characters that can trick perl but when they get processed by the system it gets something different than was given to perl.

ie.
in perl, i look for user input to change a password and i want to make sure it's not root.

if ( $input ne "root" )
{
chpass( $input );
}

but there are chars you can pass perl that are null characters:
ie.

$input = "root\0asdf3df23v";
perl sees that and knows it's not equal to "root" so it lets the request thru.... but the system sees the null ("\0") and terminates the string there, changing password for "root".

has anyone programmed things to deal with this condition? above is about the extent of my knowledge on this subject.

any help is greatly appreciated.

Reply With Quote
  #2  
Old July 12th, 2001, 10:37 AM
bonzo bonzo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 bonzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking found it!

well... after some extensive searching, i found it.

this condition is called a "poison nul" not "evil null". and in case anyone is coding perl for system use, here's how you can get rid of those chars:

$userinput =~ s/\0//g;

no longer do you have to worry about someone exploiting your perl code for use on your system!

hooray!


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > evil nulls


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 2 hosted by Hostway
Stay green...Green IT