Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
March 29, 2024
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 y3dips ITsec
 Md5 Cracker
 User Manuals
 AlbumNow
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9145

People Online:
Visitors: 862
Members: 0
Total: 862
PacketStorm News
·301 Moved Permanently

read more...
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Php -> Link in forum
Post new topic  Reply to topic View previous topic :: View next topic 
Link in forum
PostPosted: Sun Jan 13, 2008 9:54 am Reply with quote
shmk
Active user
Active user
 
Joined: Jul 22, 2004
Posts: 25




What's the most secure PHP filter that allow users to insert links to sites or images in a forum without flaws in security? (regarding xss and csrf overall)
View user's profile Send private message
PostPosted: Sun Jan 13, 2008 12:23 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




It's always possible to fool the security filters. Attacker can first place normal picture to remote server and then post img link to it. This will pass all security tests and posting will be allowed. After that attacker just changes original image on remote server with anything else he wants. Attacker can use Amapche's mod_rewrite, so that (victim) client browser will ask for jpg and will get 301/302 redirect pointing somewhere - classical CSRF case through GET method. I have seen more paranoid solutions, where webserver will check remote image validity within ANY request, and even this will not help, because image hosting server can serve different content based on client IP - so that checking webserver will see this as normal image, but subsequent victim browser will get mailicious CSRF redirection.
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sun Jan 13, 2008 1:42 pm Reply with quote
shmk
Active user
Active user
 
Joined: Jul 22, 2004
Posts: 25




waraxe wrote:
It's always possible to fool the security filters. Attacker can first place normal picture to remote server and then post img link to it. This will pass all security tests and posting will be allowed. After that attacker just changes original image on remote server with anything else he wants. Attacker can use Amapche's mod_rewrite, so that (victim) client browser will ask for jpg and will get 301/302 redirect pointing somewhere - classical CSRF case through GET method. I have seen more paranoid solutions, where webserver will check remote image validity within ANY request, and even this will not help, because image hosting server can serve different content based on client IP - so that checking webserver will see this as normal image, but subsequent victim browser will get mailicious CSRF redirection.


So the only secure system is disable external links?
And a "quite" secure system? Rolling Eyes

The classical hidden token system could limit the CSRF or it's quite useless? (i saw it mainly in POST form but it could be used in GET too?)
View user's profile Send private message
PostPosted: Sun Jan 13, 2008 2:33 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Anti-CSRF measures with random token or even with CAPTCHA (for critical requests) are very effective by my personal experience. So if you have securely written code with no potential CSRF threats, then linking remote images is not big security risk. But you must be sure about XSS too, because if there is XSS possibilities, then hidden token protection can be bypassed - because attacker can read token values right from html source or even submit POST forms without user interaction. Most secure anti-csrf still is CAPTCHA - critical operations, like new admin account creation, password change, file deletion - these are the situations, where CAPTCHA is useful.
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sun Jan 13, 2008 3:02 pm Reply with quote
shmk
Active user
Active user
 
Joined: Jul 22, 2004
Posts: 25




waraxe wrote:
Anti-CSRF measures with random token or even with CAPTCHA (for critical requests) are very effective by my personal experience. So if you have securely written code with no potential CSRF threats, then linking remote images is not big security risk. But you must be sure about XSS too, because if there is XSS possibilities, then hidden token protection can be bypassed - because attacker can read token values right from html source or even submit POST forms without user interaction. Most secure anti-csrf still is CAPTCHA - critical operations, like new admin account creation, password change, file deletion - these are the situations, where CAPTCHA is useful.


Many thanks, so a token + capthca and maybe a verification email could block CSRF.

Now I need to analyze the BIG XSS problem Razz
At this time I have only a htmlentities(strip_tags(),ENT_QUOTES)
View user's profile Send private message
PostPosted: Mon Jan 14, 2008 9:51 pm Reply with quote
shmk
Active user
Active user
 
Joined: Jul 22, 2004
Posts: 25




waraxe wrote:
Attacker can first place normal picture to remote server and then post img link to it. This will pass all security tests and posting will be allowed. After that attacker just changes original image on remote server with anything else he wants.


With this stratagem every forum security could be bypassed? Yours PHPBB too? Very Happy
View user's profile Send private message
PostPosted: Mon Jan 14, 2008 11:08 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Yes - in this forum remote images are allowed in postings so that CSRF possibilities are real.

Still - remote image can forge only GET request, and as much as i know and i have looked at phpbb source, most of the operations in user and admin control panel are based on POST method. So potential security impact is low here.

Bottom line - use POST as much as possible in any critical operations. This will cripple image-based CSRF attacks ... Smile
View user's profile Send private message Send e-mail Visit poster's website
Link in forum
  www.waraxe.us Forum Index -> Php
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  




Powered by phpBB © 2001-2008 phpBB Group






Space Raider game for Android, free download - Space Raider gameplay video - Zone Raider mobile games
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2020 Janek Vind "waraxe"
Page Generation: 0.131 Seconds