Topic: Bug with [ img ] tag
like this [ img ] http://punbb.org/forums/login.php?action=out [ img ]
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 bug reports → Bug with [ img ] tag
like this [ img ] http://punbb.org/forums/login.php?action=out [ img ]
check it out, i've just made a post, in test forum, topic testing
Nice one! :D
Evil trick!
Haha, cool. I'll investigate it further. Any ideas?
1) Add a list of _permitted_ image file types, jpg/jpeg/gif/png/etc
then in the post submission look for [ img ] tags that don't match up.
2) Check it during the bbcode->html conversion - though I think 1 is better since it is done once rather than every time a post is viewed.
3) More specific - check the img url for login.php and deny it (assuming login.php is the only place action=out can work).
I'd rather not have a blanket ban on images sent from a .php page since I've several graph generation scripts that use such urls.
1) Add a list of _permitted_ image file types, jpg/jpeg/gif/png/etc
then in the post submission look for [ img ] tags that don't match up.2) Check it during the bbcode->html conversion - though I think 1 is better since it is done once rather than every time a post is viewed.
3) More specific - check the img url for login.php and deny it (assuming login.php is the only place action=out can work).
I'd rather not have a blanket ban on images sent from a .php page since I've several graph generation scripts that use such urls.
1) is not a solution. a can rename my file so evilcode.jpg
2) --||--
3) is not a solution, because i can use not only this url, but also smth like this evilcode.js
yeah... rather hard problem, isnt ?
the only solution i see - is to upload images to server, then check its mime-type... by it will slow down the server greatly.... + it will do MUCH traffick...
I dont see whats so evil about it. It just logs you out. If it gets really annoying, then turn turn off link conversions.
pgregg wrote:1) Add a list of _permitted_ image file types, jpg/jpeg/gif/png/etc
then in the post submission look for [ img ] tags that don't match up.1) is not a solution. a can rename my file so evilcode.jpg
2) --||--
3) is not a solution, because i can use not only this url, but also smth like this evilcode.js
yeah... rather hard problem, isnt ?
the only solution i see - is to upload images to server, then check its mime-type... by it will slow down the server greatly.... + it will do MUCH traffick...
Hmm, I don't see how 1 is not a solution. Sure, if you want to rename your login.php to evilcode.jpg and pass all jpgs through the PHP engine then on your own head be it. The goal is to prevent regault users from causing another user to logout - not from admins shooting themselves in the foot.
Or, in all img conversions append a ?image (or &image if the url aready has a ?) to the url. Then in the logout/login script:
if (isset($_GET['image'])) { // some lamer created a logout link in an image
just for now , i've done such thing
$message = preg_replace('#\[img\]((f)tp://)([^\?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#si', '<img src="$1' . eregi_replace('\?.*|&.*', '', str_replace(' ', '%20', '$3')) . '" border="0" align="top" alt="< ??????? ??????????? > ">', $message);
$message = preg_replace('#\[img\]((ht)tp://)([^\?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#si', '< <a href="$1' . eregi_replace('\?.*|&.*', '', str_replace(' ', '%20', '$3')) . '" target="_blank"><b>?????? ?? ??????? ???????????</b></a> >', $message);
Nice XuMiX!
preg_replace('#\[img\]((ht|f)tp://)([^\r\n\t<"\'\?&=]+\.(bmp|tif|jpg|jpeg|gif|png))\[/img\]#si', '<img src="$1$3".....
hmmm... smth is wrong with your code... it works fine with single image, but sux with series of them... i'll see it through
Fixed in 1.2. If people really want to be assholes, they can setup their server to interpret e.g. .jpeg as PHP code and then link to that "image" which in turn does a header('Location: http://example.com/login.php?action=out'); but I don't believe there's a way of dealing with that. One could make sure the image is an image via e.g. getimagesize(), but it's just not worth it.
so now it will only accept certain extensions as images?
have you blocked out PHP, if so, is there an admin option or do one need to mod it?
(I use quite a few php images, for different stuff)
thats what i was thinking, a few people post links to php stuff for random images and things
Oh shit. I forgot. Then, my friends, I have no idea how to solve this.
if you just have an option or a commented out line or something, I'm sure that those that want to allow php need to uncomment that line, and therefore be aware of the 'risks' (considering all the important stuff is using post, the get variables won't hur the board that much, will they?)
ok how about just blocking (i don't know regular expressions) this
(forum_path)*.php*
as you only need to block scripts on that forum and that would stop any php scripts on the actual forum being run but would allow php images from anywhere else ot be accessed
the only problem with this is you could be logged out of other forums by that forum e.g. this forum from my forum
btw, look at the size of some of the posts above with the code bit is that another bug?
btw, look at the size of some of the posts above with the code bit is that another bug?
no, it's supposed to be like that
PunBB Forums → PunBB 1.2 bug reports → Bug with [ img ] tag
Powered by PunBB, supported by Informer Technologies, Inc.