PHP FAQs and Stickies
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP DevelopmentPHP FAQs and Stickies

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 28 votes, 4.54 average. Display Modes
 
Unread Dev Shed Forums Sponsor:
  #166  
Old October 13th, 2003, 09:45 AM
torkil torkil is offline
Another damn newb...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Bodø, Norway
Posts: 94 torkil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
I myself place all .inc files inside a separate folder. Then I add a .htaccess file to this folder, containing the following two lines:

Order allow,deny
Deny from all

This way, you can only reach the files inside this folder through include or require.
__________________
Torkil Johnsen

Never underestimate the power of stupid people in large groups...
---------------------------(òÓ,)----

Reply With Quote
  #167  
Old October 13th, 2003, 09:48 AM
URSLOWR URSLOWR is offline
<? unset($sanity) ?>
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Posts: 613 URSLOWR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 38 sec
Reputation Power: 10
Quote:
Originally posted by torkil
I myself place all .inc files inside a separate folder. Then I add a .htaccess file to this folder, containing the following two lines:

Order allow,deny
Deny from all

This way, you can only reach the files inside this folder through include or require.


I was reading somewhere that if I didn't want my files that had .inc extensions to be read(parsed) as text, then I should use .php file extension instead. Which is what I do. But I like that idea that you're doing with .htaccess
__________________
"I haven't failed, I've found 10,000 ways that won't work."
- Thomas Edison

-=Rick=-

Chat Refinance Loans

Reply With Quote
  #168  
Old October 22nd, 2003, 10:17 PM
oarko oarko is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: FL USA
Posts: 2 oarko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
if all you do is rely on sessions for validation check this website out
URL
it talks about how people are taking over sessions.
I change the session id on every page to keep up with this terror.

Reply With Quote
  #169  
Old November 26th, 2003, 04:01 PM
dcolors dcolors is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 dcolors User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Learned a good lesson

Reply With Quote
  #170  
Old November 26th, 2003, 04:32 PM
URSLOWR URSLOWR is offline
<? unset($sanity) ?>
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Posts: 613 URSLOWR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 38 sec
Reputation Power: 10
Why can't you validate your session ID's to give an error if a duplicate it trying to be acheved?

Reply With Quote
  #171  
Old February 6th, 2004, 09:03 PM
PeterR PeterR is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: USA
Posts: 1 PeterR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Regarding the security risks of using a variable to include a page, such as
Code:
$page = $_GET['page'];
include( $page );

In addition to adding a hardcoded extension,
Code:
include( $page . '.php' );

or prefix,
Code:
include( 'myfile' . $page . '.php' );

You can easily strip off any extraneous path information when you retrieve the value, like this
Code:
$page = basename( $_GET['page'] );
include( 'myfile' . $page . '.php' );

This way directory traversal by injection is defeated.

Reply With Quote
  #172  
Old March 13th, 2004, 10:07 AM
R Roberts R Roberts is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 4 R Roberts User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Very good to know. Thanks, JeffCT!

Reply With Quote
  #173  
Old March 16th, 2004, 10:05 PM
Ahad Ahad is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Arlington, TX
Posts: 171 Ahad User rank is Private First Class (20 - 50 Reputation Level)Ahad User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 19 h 27 m 42 sec
Reputation Power: 10
Send a message via AIM to Ahad
Wow, excellent thread in its entirety. I'm glad I took the time to read through all of these. Wtg JeffCT, this thing made me aware of some very unnoticed security leaks in my code.

Although it did turn my 2-line include to an 8-line monster for validation I figure security's worth the slight bloating of code.
__________________
-Ahad L. Amdani
Programmer/Developer

Reply With Quote
  #174  
Old April 16th, 2004, 04:38 AM
zonelinks zonelinks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 9 zonelinks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
wat is escapeshellcmd ppl?
-----------------------------
http://www.zonelinks.com

Reply With Quote
  #175  
Old April 16th, 2004, 05:27 PM
Sorvoja Sorvoja is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Oslo, Norway
Posts: 120 Sorvoja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 48 sec
Reputation Power: 10
Thank your the great advice.
__________________
SEO Blog

Reply With Quote
  #176  
Old April 19th, 2004, 08:10 AM
MaierMan's Avatar
MaierMan MaierMan is offline
Titles are useless ;)
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Germanski West
Posts: 216 MaierMan User rank is Corporal (100 - 500 Reputation Level)MaierMan User rank is Corporal (100 - 500 Reputation Level)MaierMan User rank is Corporal (100 - 500 Reputation Level)MaierMan User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 57 m 4 sec
Reputation Power: 14
Send a message via ICQ to MaierMan Send a message via AIM to MaierMan Send a message via MSN to MaierMan
Quote:
Originally Posted by oarko
if all you do is rely on sessions for validation check this website out
http://www.acros.si/papers/session_fixation.pdf
it talks about how people are taking over sessions.
I change the session id on every page to keep up with this terror.

Really bad problem...

vBulletin is not safe also eg.
We had a guy that wrote a lil javascript which included an image to the site with a serverside script target and passing the users cookie in that url.
(We are allowing html).
He was able to "reuse" the session (and login) and broke into some accounts he got.
Wasnt able to take 'em over, cause you need the current password to change the password.
But was able to post, access restricted forums and read/download the private messages.

Another javascript (without "stealing" cookies) was also done to post randomly generated threads.
Pretty simple to implement. Simply open a new (hidden) window by javascript which points to another page containing a form with javascript based auto-submitter and using setTimeout functions to repeat frequently.
Users will "open" that page when having javascript with openwindow enabled.
This also is a problem with sessions (stored in cookies, but other ways also are possible) even if you dont know the actual session id of the "victim".

Target was a vBulletin 3 (Beta 4?) board.
Real bad one. Results in a high server load and also all the fake threads have to be deleted afterwards.
And these fake threads itself could replicate the evil javascript code itself, so that the code spreads itself.

Recommend to "censor" all script tags and all other stuff which might execute javascript code like the on* tag attributes in all scripts that allow "insecure" users to transmit raw and unfiltered html.
I saw many scripts that use a censor mechanism stripping script tags but missing those other javascript on* attributes eg.
Pretty dangerous.

Reply With Quote
  #177  
Old April 19th, 2004, 08:17 AM
Sepodati's Avatar
Sepodati Sepodati is offline
Banned (not really)
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 1999
Location: Brussels, Belgium
Posts: 14,630 Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)  Folding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced Folder
Time spent in forums: 3 Months 6 Days 2 h 55 m 52 sec
Reputation Power: 4408
Send a message via ICQ to Sepodati Send a message via Yahoo to Sepodati
That's what you get for allowing HTML.
__________________
-- Cigars, whiskey and wild, wild women. --

Reply With Quote
  #178  
Old April 19th, 2004, 08:23 AM
MaierMan's Avatar
MaierMan MaierMan is offline
Titles are useless ;)
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Germanski West
Posts: 216 MaierMan User rank is Corporal (100 - 500 Reputation Level)MaierMan User rank is Corporal (100 - 500 Reputation Level)MaierMan User rank is Corporal (100 - 500 Reputation Level)MaierMan User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 57 m 4 sec
Reputation Power: 14
Send a message via ICQ to MaierMan Send a message via AIM to MaierMan Send a message via MSN to MaierMan
Quote:
Originally Posted by Sepodati
That's what you get for allowing HTML.

Sure, learning from mistakes.

But the 2nd attack (posting random threads) is also possible by simply letting users click on a link.
And links might be done even when disallowing raw html.
The cookie and session of that user is valid, thus vB will accept the unwanted request to post the thread.

Reply With Quote
  #179  
Old May 3rd, 2004, 07:58 AM
lauramali lauramali is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 lauramali User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
stupid question, perhaps.

is there any really safe? I mean, without serious bugs?

Reply With Quote
  #180  
Old May 3rd, 2004, 08:13 AM
URSLOWR URSLOWR is offline
<? unset($sanity) ?>
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Posts: 613 URSLOWR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 38 sec
Reputation Power: 10
Quote:
Originally Posted by lauramali
is there any really safe? I mean, without serious bugs?


Yes. No coding whatsoever.

Serisously. There is no way to TOTALLY secure something, there is always someone out there who is just smart enough to figure it out. Only thing you can really do is try to stay one step ahead of the game.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming LanguagesPHP DevelopmentPHP FAQs and Stickies > [Everyone] Must read Security Notes

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap