Author Topic: Anti Hack Guidelines for a secure site  (Read 11494 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Anti Hack Guidelines for a secure site
« on: February 15, 2007, 09:41:33 PM »
Well, at least 3 times a week i read about sites getting hacked, and i read every time the same
questions like "Did you install all bugfixes", "Do you have a secure password"

Yes we have!

But why is my site being hacked even if i did all the fixes etc?
Because you can do more!

I won't discuss server related things here, because most of you don't have root access to your server,
but some simple thing's you can do will do the job ;) Here we go:

Step ONE to a more secure site
Gettin' rid of the yoursite.com/admin directory

1. Make a new folder in your 4images and called it something like "87cfgh77FG1F0C"
2. Move all your files from your admin folder into the new folder you created
3. Insert an empty "index.html" file in your admin folder
4. Open now yoursite.com/87cfgh77FG1F0C/admin_global.php and search for:

Code: [Select]
include(ROOT_PATH.'admin2/admin_functions.php');
and replace "admin" with the name of your new folder

5. Save it.
6. You do the same modification in all files located in your former admin directory, wich include path to "admin"

7. Search google for "htaccess" and put an extra login to your new folder
------------

Now your admin area is securet twice, first with the new name of the admin folder, and second, with the additional login (using the htaccess)
DONT change your other php files to use direct links to that new folder. You have to manually enter the admin area with an bookmark, and
for example search for the image you want to modify. No direct link from your homepage anymore - witch makes it more difficult to administrate, but more secure.
Again, i can tell you how to directly link for example "edit image"/"delete image" to that new folder, but the changes we've made would have no effect.

TIP: If you want to edit something, simply copy the adress and replace "admin" with the name of your new folder.


Step TWO to a more secure site
Because you wife's name isn't hard to guess

Don't use ever normal passwords like "qwerty", "sexy69" or "paaasword" - You really don't know how smart current hackers are. There are so many ways
to hack or even guess such a password. Use password's like:

ab2j87ffe
c4v5hh7k

and so on. I know, it's hard to remember. But after 3-4 days you will remember the password.



Step THREE to a more secure site
Trojan horses and 4images

NEVER login into your 4images site from:

- public computers (most of them have keyloggers installed)
- your friend's computer (trust no one!)

Use only your own PC if possible. And when you use it, make sure you have a good anti virus program installed (kaspersky, norton).
Trojan horses are one of the top reasons sites get hacked! Someone mails you an "greeting card", and you open it because you're curious,
and that's it - a trojan horse on your computer. It mails now all passwords, onlinebanking details, EVERYTHING to the hacker!

So please be sure you use an every day updated anti virus program! This is VERY important!

Well that's it for now - i can assure you, that following those 3 steps will make your site 90% more secure!
If you have any questons please write in this thread, don't write me PM's about that topic.

Greetings,

George
« Last Edit: February 15, 2007, 10:37:09 PM by trez »

Offline Jenn

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Anti Hack Guidelines for a secure site
« Reply #1 on: February 15, 2007, 10:52:15 PM »
Very nice. It will help out ALOT of people.

Great job!

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Anti Hack Guidelines for a secure site
« Reply #2 on: February 15, 2007, 11:30:08 PM »
... thanks for your secure site notes George ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Anti Hack Guidelines for a secure site
« Reply #3 on: February 16, 2007, 12:14:04 AM »
thank you very much. i will do the changes in my website  :D
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: Anti Hack Guidelines for a secure site
« Reply #4 on: February 16, 2007, 07:26:16 AM »
Nice, was waiting for someone to have enough about reading the same old things over and over  :wink:

Now lets hope this helps :!:
Maybe a sticky or something  :?:

Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Re: Anti Hack Guidelines for a secure site
« Reply #5 on: February 16, 2007, 09:56:12 AM »
Das ist sehr gut!!!
Nur eine Frage: wer sagt uns denn, das das hacken der Galerien, die hier genannt wurden in den letzten Wochen über den Ordner "ADMIN" erfolgt ist??

den Ordner umbennen und per .htaccess zu schützen ist ja OK, leider hat niemand, dem die Galerie gehackt wurde uns:
1. mal Zutritt zum Server gelassen
2. alle Dateien sehen lassen
3. alle Ordner sehen lassen
um diese anschließend zu vergleichen!

es wurde doch immer die Startseite so gehackt, das im Quelltext 4images lag, aber die galerie nicht aufgerufen wurde, stimmt doch, oder??

ich denke der Ordner "admin" muss geschützt sein, liegt das nicht eher an: data/database/

in dem die Dateien blockiert werden??

wie schon gesagt, wir haben NIE eine vollständige gehackte Galerie gesehen (incl. Serverzugang, Datenbank, ect.)

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Anti Hack Guidelines for a secure site
« Reply #6 on: February 16, 2007, 10:31:27 AM »
Quote from: honda2000
Das ist sehr gut!!!
Nur eine Frage: wer sagt uns denn, das das hacken der Galerien, die hier genannt wurden in den letzten Wochen über den Ordner "ADMIN" erfolgt ist??

Niemand, und wenn deine gallerie gehackt worden ist ist es sehr unwarscheinlich dass du weisst WIE sie gehackt worden ist.

Quote from: honda2000
den Ordner umbennen und per .htaccess zu schützen ist ja OK, leider hat niemand, dem die Galerie gehackt wurde uns:
1. mal Zutritt zum Server gelassen
2. alle Dateien sehen lassen
3. alle Ordner sehen lassen
um diese anschließend zu vergleichen!

es wurde doch immer die Startseite so gehackt, das im Quelltext 4images lag, aber die galerie nicht aufgerufen wurde, stimmt doch, oder??

ich denke der Ordner "admin" muss geschützt sein, liegt das nicht eher an: data/database/

in dem die Dateien blockiert werden??

wie schon gesagt, wir haben NIE eine vollständige gehackte Galerie gesehen (incl. Serverzugang, Datenbank, ect.)

Nein, alles is verknuepft. Wenn ich als Hacker eine Gallerie lahmlegen will, ist der ordner "Admin" sehr wichtig. Allerdings muss ich den pfad zum admin ordner wissen, wenn ich
den nicht weiss ist es hoechst unwarscheinlich etwas zu erreichen. Warum und wie es detailiert genau funktioniert werde ich aus Sicherheitsgruenden nicht in diesem thread veroeffentlichen,
du kannst mir ja ne PM schreiben falls du genau wissen willst um was es geht.

Was den ordner data/database angeht werde ich den thread updaten, auch was die Sicherheitsluecken in der search.php und image.php angeht.

Was die gehackten seiten angeht schau dir mal das hier an:
http://lists.seifried.org/pipermail/security/2006-March/012490.html
http://retrogod.altervista.org/4images_171_incl_xpl.html

Hier geht es um das bekannte exif problem, das ja mitlerweile mehr oder weniger behoben wurde.



Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Anti Hack Guidelines for a secure site
« Reply #7 on: February 16, 2007, 07:16:43 PM »
If you having trouble using your Postcard Viewer after STEP ONE please replace your current postcard_view.php with this code:

Code: [Select]
<?php // PLUGIN_TITLE: Postcard Viewer 

$nozip 1
define('IN_CP'1); 

define('ROOT_PATH'"./../../");
require(
ROOT_PATH.'DEIN_VERZEICHNISS/admin_global.php'); 
show_admin_header(); 

function 
display_results() { 
    global 
$site_db

    
$sql "SELECT * 
                    FROM "
.POSTCARDS_TABLE." p, ".IMAGES_TABLE." i 
                    WHERE p.image_id = i.image_id 
                    ORDER BY postcard_date DESC"

    
$result $site_db->query($sql); 
    while(
$row $site_db->fetch_array($result)){ 
      
$postcard_id $row["postcard_id"]; 
        
$postcard_date date("D d M, Y g:i a"$row["postcard_date"]); 
        
$image_id $row["image_id"]; 
        
$postcard_bg_color $row["postcard_bg_color"]; 
        
$postcard_border_color $row["postcard_border_color"]; 
        
$postcard_font_color $row["postcard_font_color"]; 
        
$postcard_font_face $row["postcard_font_face"]; 
        
$postcard_sender_name $row["postcard_sender_name"]; 
        
$postcard_sender_email $row["postcard_sender_email"]; 
        
$postcard_recipient_name $row["postcard_recipient_name"]; 
        
$postcard_recipient_email $row["postcard_recipient_email"]; 
        
$postcard_headline $row["postcard_headline"]; 
        
$postcard_message $row["postcard_message"]; 
        
$cat_id $row['cat_id']; 
        
$image_media_file get_media_code($row['image_media_file'], $image_id$cat_id$row['image_name']); 
        
$template TEMPLATE_PATH

        echo <<<END
        <table cellspacing="0" cellpadding="1" align="center" border="0">
  <tbody>
    <tr> 
      <td bgcolor="
$postcard_border_color"><table cellspacing="0" cellpadding="10" bgcolor="$postcard_bg_color" border="0">
  <tbody>
    <tr> 
      <td valign="top"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">
$postcard_date</font><br><a href="../../details.php?image_id=$image_id" target="_blank">$image_media_file</a><br> 
        <font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">
$postcard_recipient_name - </font>
<a href="mailto:
$postcard_recipient_email"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">$postcard_recipient_email</font></a></td>
      <td valign="top" width="200" height="250"><div align="right"><img src="
$template/images/stamp.gif" border="0"></div>
        <br> <br> <b><font face="
$postcard_font_face" color="$postcard_font_color" size="4">$postcard_headline</font></b><br> 
        <br> <font face="
$postcard_font_face" color="$postcard_font_color" size="2">$postcard_message</font><br> 
        <br> <font face="
$postcard_font_face" color="$postcard_font_color" size="2">$postcard_sender_name</font><br> <a href="mailto:$postcard_sender_email"><font 
                  face="
$postcard_font_face" color="$postcard_font_color" size="2">$postcard_sender_email</font></a></td>
    </tr>
  </tbody>
</table></td>
    </tr>
  </tbody>
</table><br> 
END;
    } 


display_results(); 
show_admin_footer(); 
?>


Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Re: Anti Hack Guidelines for a secure site
« Reply #8 on: February 16, 2007, 07:38:03 PM »
hast schon irgendwie recht!
Klar brauchen die den Admin-Ordner

den Pfad kennt jeder, der die galerie runtergeladen (noch nicht einmal) installiert hat!

trozdem möchte ich gern wissen, welche Dateien genau angegriffen werden und was dann von dort aus WIE verknüpft wird :wink:

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.421
    • View Profile
    • 4images - Image Gallery Management System
Re: Anti Hack Guidelines for a secure site
« Reply #9 on: February 16, 2007, 08:25:19 PM »
Thanks trez!

Additionally:

  • Always upgrade to the latest version of 4images.
  • Always install the latest security fixes.
  • Password protect the Admin Control Panel directories using .htaccess/.htpassword.
  • If you have phpMyAdmin running on your server make sure it's .htaccess password protected.
  • Make sure all the admin passwords are secure. Change them if you have any doubts. And use hard to guess passwords.
  • Change your 4images admin password regularly.
  • If you suspect a hacking attempt, ask your host to change the login password for your web account and your 4images admin password.
  • Make absolutely sure there are no viruses, trojans or keylogger spyware on your PC. Any of these could steal your password and other personal info.
  • Make regular backups and download them to your local harddisk.
  • Subscribe to the Bug Fixes & Patches board. (Visit the board and click the "Notify"-Button (Deutsch: "Benachrichtigen"-Button) on the top board-menu)

Taken from the FAQ "4images security tips":
http://www.4homepages.de/forum/index.php?topic=14982.0
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Anti Hack Guidelines for a secure site
« Reply #10 on: February 17, 2007, 01:44:58 PM »
hast schon irgendwie recht!
Klar brauchen die den Admin-Ordner
den Pfad kennt jeder, der die galerie runtergeladen (noch nicht einmal) installiert hat!
trozdem möchte ich gern wissen, welche Dateien genau angegriffen werden und was dann von dort aus WIE verknüpft wird :wink:

Ich denke ob diese Frage beantwortet werden darf muesste Kai oder ein anderer developer von 4images entscheiden, am besten du fragst ihn oder andere per PM.

Offline Bommel

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: Anti Hack Guidelines for a secure site
« Reply #11 on: January 21, 2010, 05:20:11 AM »
Hallo allerseits,

folgende Frage zu Schritt 1 dieser Anleitung - können nach erfolgreicher Umsetzung der einzelnen Schritte die überflüssigen Dateien aus dem Verzeichnis "admin" gefahrlos gelöscht werden? Ich habe dies nur soweit ausprobiert indem ich die "admin/index.php" umbenannt habe. Der Zugriff auf das ACP ist trotzdem erfolgreich.

Eine weitere Frage bezieht sich auf ".htaccess" - welche Standard-Ordner können mittels ".htaccess" ohne weitere Probleme für den normalen Ablauf abgesichert werden?

Freundliche Grüße, Bommel
Freundliche Grüße, Bommel

Nicht die Geduld mit mir verlieren, ich bin noch am Lernen./ Do not lose the patience with me, I am still in the learning. ;)

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.421
    • View Profile
    • 4images - Image Gallery Management System
Re: Anti Hack Guidelines for a secure site
« Reply #12 on: January 21, 2010, 08:40:42 AM »
Please also have a look at the 4images security tips:
http://www.4homepages.de/forum/index.php?topic=14982.0
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Bommel

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: Anti Hack Guidelines for a secure site
« Reply #13 on: January 21, 2010, 09:19:53 AM »
Hallo Kai,

Danke für deinen Hinweis, aber diesen kenne ich bereits. Vielleicht liegt es auch nur an meinen mangelhaften Englischkenntnissen, doch ich finde dort keine Antworten zu meinen beiden Fragen. Bezüglich .htaccess meinte ich ob noch weitere Ordner und wenn ja, welche Ordner mittels .htaccess abgesichert werden können, ohne dass die normale Funktion von 4Images beeinträchtigt wird.

Freundliche Grüße, Bommel
Freundliche Grüße, Bommel

Nicht die Geduld mit mir verlieren, ich bin noch am Lernen./ Do not lose the patience with me, I am still in the learning. ;)