@digi7al64: Yes, thats clear. I just mentioned this performance weakness because on my local webserver (ASUS P4, 480MB RAM) the function crashed nearly everything. It's not that bad on a well performing webserver.
As I said, I tried to implement a PHP function which detects manipulated image files. Essentially it just checks the first 256 bytes for HTML tag looking strings. While reading the code please consider that I never really worked with regular expressions that are more complex than to verify an email adress. I just read a short tutorial and started so there will definitely be mistakes.
I'll implement a new version tomorrow, just wanted to present this one today, hoping to get some feedback until tomorrow.
Enough said, here's the link: [
php-classes.net]
Edit:
Quote:Also the only reason the splitbrain POC works is that is it less then 256 bytes which means when IE scans the buffer to determine the mime type it still find html syntax in the comments tag which then overwrite the png mime type. firefox and opera handle the image normally as they should becuase images can have content within the meta data. Also, I believe given a bigger image, the comments field would be pushed further into the object meaning it won't reside in the first 256 bytes and hence it will fail to fire in IE.
Sorry I do not agree with that. In fact the test.png file from splitbrain is less big than 256 bytes but thats simply not the point. It could have any size to make the trick working. The only determination microsoft does in this moment is checking the first (yeah I repeat myself) 256 bytes. Everything that follows will be ignored. Now if the hard-coded "HTML test" succeeds, you'll get text/html outputted.
That means: Grab an arbitrary - lets say - PNG file. Throw it into a tool like TweakPNG and simply edit somewhere in the first bytes. The string '<body>' in a tEXt chunk should be enough to create the illusion that this was HTML.
If this is done correctly, you can add another chunk anywhere, containing arbitrary javascript code. I even checked the mhtml issue, it works.
Regards,
- [
christ1an.blogspot.com]
_______________________
[
php-ids.org] Web Application Security 2.0
Edited 2 time(s). Last edit at 02/21/2007 12:56AM by christ1an.