Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,457 members, 7,954,793 topics. Date: Saturday, 21 September 2024 at 09:30 AM

[HELP] False Image File Passed On HTML IMG - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / [HELP] False Image File Passed On HTML IMG (1063 Views)

Need Help Positioning An Img To Be Fixed On The Page / Free New E-book On HTML And CSS / Need Help On Html Mailto Form (2) (3) (4)

(1) (Reply) (Go Down)

[HELP] False Image File Passed On HTML IMG by Gerardcole(m): 4:20am On Jul 11, 2013
I run a forum and someone embedded an image in his/her post with my bbcode. The image link is http://www.hackedlord.sefanhost.cu.cc/hack/

I don't know how my browser Opera Mini & Chrome for Android ran the image as a script. It interrupts page load and alerts a false login form.

I simply turned of my images and hid the post. But I can't always be there to hide the post. So my question is How can I get rid of browser processing images if they ain't really images?
Re: [HELP] False Image File Passed On HTML IMG by Nobody: 7:23am On Jul 11, 2013
[img]http://www.hackedlord.sefanhost.cu.cc/hack/ [/img]
That one na long thing o, what type of forum are you using?
You might need some kind of code/extension to verify if images in a post are valid before allowing the image to be passed on to a browser.
Re: [HELP] False Image File Passed On HTML IMG by Gerardcole(m): 9:27am On Jul 11, 2013
It is custom written. PHP / MySQL
Re: [HELP] False Image File Passed On HTML IMG by Nobody: 10:38am On Jul 11, 2013
--
Re: [HELP] False Image File Passed On HTML IMG by yawatide(f): 5:50pm On Jul 11, 2013
It's an insertion hack, more than likely. It happened to me once, on an opencart implementation I did for someone a few years ago. Delete it, secure your code and you should be good to go.
Re: [HELP] False Image File Passed On HTML IMG by Nobody: 9:10pm On Jul 11, 2013
What you need is an "insertion filter" to block the "insertion hack", i can help you with such a code - you can mail me via my website .net
Re: [HELP] False Image File Passed On HTML IMG by Gerardcole(m): 4:14am On Jul 12, 2013
Thanks everyone for the responses you gave.
Re: [HELP] False Image File Passed On HTML IMG by Slyr0x: 12:32pm On Jul 12, 2013
A simple Null character(0x00) after the extension can easily do the trick i.e. upload a backdoor shell as backdoor.php%00 and poof. .your defense mechanism would be bypassed.

Ways to prevent this kinda hack

1. Never accept a filename and its extension directly without having a white-list filter (jpg,jpeg,gif and png)
2. Use an algorithm to change filenames before storage. For instance, if i upload slyrox.jpg, it shou ld automatically store as dd7f7d72b88d8069a6b8a0c92edff55e_12_7_13.jpg on the server (i.e. the md5 hash of slyrox + the date of the day)
3. Uploaded directory should not have any “execute” permission (change the folder's permission)
4. Limit the file size to prevent denial of service attacks
5. Prevent from overwriting a file in case of having the same hash for both (In a situation where there are 2 same filenames being uploaded at the same time)
6. Use a virus scanner on the server (like my host Trudigit currently do). .In this case, file should be stored with a random name and without any extension on the server first, and after the virus checking, it can be renamed using the algorithm earlier mentioned

All these won't guarantee you 100% security as there is no such thing as 100% security, however, it will make you more secure.

You can contact me if you wish to know the current security posture of your website/web app.

Cheers
Re: [HELP] False Image File Passed On HTML IMG by bug24(m): 6:56am On Jul 14, 2013
Hmmmm i love dis slyrox guy. smiley
Re: [HELP] False Image File Passed On HTML IMG by Nobody: 7:55am On Jul 15, 2013
All this can be done easily with an image validator code written with php.

Two steps:
1. Parse the bbc/html code to be stored for images
2. Validate the images if they are real or not to know what to do to them. Some of what slyr0x said will apply to images being uploaded, clearly this type of hack involves a remote image.

Anyway, i can code a filter for you if you like, it is not as difficult as it sounds. But i dont like my codes lying all over nairaland - for some reasons i will rather not state.
Re: [HELP] False Image File Passed On HTML IMG by Slyr0x: 10:32am On Jul 15, 2013
bug24: Hmmmm i love dis slyrox guy. smiley

Been ages bro. .where you been?
Re: [HELP] False Image File Passed On HTML IMG by Nobody: 8:09pm On Jul 15, 2013
^^^slyr0x, i must however give you kudos for the way you handle this board, and that reminds me, i am likely to feature in the next 2 jobs i am chasing. . . .until then, i must return back to deeeep cover.
Re: [HELP] False Image File Passed On HTML IMG by Gerardcole(m): 2:09pm On Jul 20, 2013
@Slyrox, thanks for your suggestion, I'm already adopting Tips 1, 3, 4, & 5. I host with Hostgator I guess 6 is also taken care of.

But like @*dhtml said, this file wasn't uploaded to mg server. It was just an external link like what you're seeing. The guy used [i m g]image-link[ / i m g].

@*dhtml, I sent you a mail about a week back and I'm yet to get a reply. It was through the contact u saw at your website.
Re: [HELP] False Image File Passed On HTML IMG by Nobody: 3:38pm On Jul 21, 2013
E ma gba mi o! i no see the mail o! pls send it again o!
Re: [HELP] False Image File Passed On HTML IMG by bug24(m): 7:24pm On Nov 18, 2013
Slyr0x:

Been ages bro. .where you been?

Been hiding under some rocks and chewing Garlic cheesy

Suddenly discovered dats d only way i can concentrate and write me some codes. Lolz

Been stepping ma game bro. SRaAMS now a huge product servicing schools everywhere.

We reppin bro! We Reppin!
Re: [HELP] False Image File Passed On HTML IMG by Slyr0x: 7:42pm On Nov 18, 2013
bug24:

Been hiding under some rocks and chewing Garlic cheesy

Suddenly discovered dats d only way i can concentrate and write me some codes. Lolz

Been stepping ma game bro. SRaAMS now a huge product servicing schools everywhere.

We reppin bro! We Reppin!

That's good news bro.

Happy for you.

Forget us thou not when thy kingdom cometh!!

On some reals though, we (Nairaland family) never see your tithe ooo. .
Re: [HELP] False Image File Passed On HTML IMG by Djtm(m): 12:46am On Nov 19, 2013
I heard renaming a php file to something like dangerous.php.jpg will still execute the script? how true is this?

(1) (Reply)

The Story Behind Www.ng / 9 Errors That Reduces The Effectiveness Of Your Ad On Facebook / Problems With Daily Independent Newspaper Website

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 22
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.