Pengantar Teknologi Web

44
Pengantar Teknologi Web Keamanan + Keamanan Web

description

Pengantar Teknologi Web. Keamanan + Keamanan Web. Why worry? (cont.). Pengantar Security. Keamanan komputer -> fisik Dari bencana alam Dari pencuri Dari serangan / bom Keamanan sistem informasi -> non fisik Dari sisi software dan data. Komponen Security (CIA-AN). - PowerPoint PPT Presentation

Transcript of Pengantar Teknologi Web

Page 1: Pengantar Teknologi Web

Pengantar Teknologi Web

Keamanan + Keamanan Web

Page 2: Pengantar Teknologi Web

Why worry? (cont.)Security Vulnerabilities vs. Incidents

CERT

0

10,000

20,000

30,000

40,000

50,000

60,000

70,000

80,000

90,000

1995 1996 1997 1998 1999 2000 2001 2002

Vulnerabilities

Incidents

Page 3: Pengantar Teknologi Web

Pengantar Security

• Keamanan komputer -> fisik– Dari bencana alam– Dari pencuri– Dari serangan / bom

• Keamanan sistem informasi -> non fisik– Dari sisi software dan data

Page 4: Pengantar Teknologi Web

Komponen Security (CIA-AN)

• Confidentiality: akses terhadap sistem komputer tidak boleh dilakukan oleh unauthorized parties

• Integrity: aset sistem komputer tidak boleh dimodifikasi oleh unauthorized users

• Availability: Sistem harus dapat selalu online/ada sehingga dapat diakses oleh authorized users

Tambahan• Authenticity: sistem mengetahui asal muasal suatu

objek atau asal muasal modifikasi yang terjadi• Non-repudiation: seseorang/sesuatu tidak dapat

menyanggah bahwa dia melakukan sesuatu

Page 5: Pengantar Teknologi Web

Ancaman

• Ancaman (threat) adalah:– Seseorang, sesuatu, kejadian atau ide yang menimbulkan

bahaya bagi suatu aset– Threat muncul dari vulnerability (kelemahan sistem & desain)

• Serangan (attack) adalah realisasi dari threat.• Klasifikasi threats:

– Disengaja (mis. hacker penetration);– Tidak disengaja (mis. Mengirimkan file yang sensitif ke alamat

yang salah)

• Threats yang disengaja dapat dibagi lagi :– Pasif – tidak kontak langsung (mis. monitoring, wire-tapping,);– Aktif – kontak langsung (mis. mengubah nilai transaksi finansial)

Page 6: Pengantar Teknologi Web

Tujuan Security

• Prevention - Penjagaan– Prevent attackers from violating security

policy

• Detection - Deteksi– Detect attackers’ violation of security policy

• Recovery - Mereparasi– Stop attack, assess and repair damage– Continue to function correctly even if attack

happen

Page 7: Pengantar Teknologi Web

Segitiga Sistem

Functionality

Security Easy to use

Posisi suatu sistem

Page 8: Pengantar Teknologi Web

Tahapan penyerangan

• Reconnaissance– Mengumpulkan data mengenai target

• Aktif dan pasif

• Scanning– Tanda dimulainya serangan, berusaha mencari jalan masuk

• Gaining access– Mendapatkan target

• Maintaining access– Mempertahankan akses dgn berbagai cara termasuk

menanamkan program dan memperbaiki kelemahan

• Covering tracks– Menutupi jejak mereka

Page 9: Pengantar Teknologi Web

Level Serangan

• Level Sistem Operasi– Patch & upgrade

• Level aplikasi– Patch, Antivirus & Upgrade

• Level Shrink Wrap code– Menggunakan program2 bantu untuk

serangan

• Level Kesalahan konfigurasi

Page 10: Pengantar Teknologi Web

Commonly attacked services• SMTP servers (port 25)

– sendmail: “The address parser performs insufficient bounds checking in certain conditions due to a char to int conversion, making it possible for an attacker to take control of the application”

• RPC servers (port 111 & others)• NetBIOS shares (ports 135, 139, 445)

– Blaster worm– Sasser worm

• FTP servers (ports 20, 21)– wuftpd vulnerabilities

• SSH servers (port 22)– OpenSSH, PAM vulnerabilities

• Web servers (ports 80, 443)– Apache chunked encoding vulnerability

Page 11: Pengantar Teknologi Web

Web server attack• Scan to find open ports• Find out what’s running on open ports (banner

grabbing)• Profile the server

– Windows (look for Kerberos, NetBIOS, AD)– Unix– Use TCP fingerprinting

• Probe for weaknesses on interesting ports– Default configuration files and settings (e.g. popular

IIS ones)– Buffer overflows– Insecure applications

• Launch attack– Use exploit code from Internet…– …or build your own

Page 12: Pengantar Teknologi Web

Scanning…What O/S is this system?

Page 13: Pengantar Teknologi Web

Scanning…What O/S is this system?

Page 14: Pengantar Teknologi Web

Phising

Page 15: Pengantar Teknologi Web

Pharming

Page 16: Pengantar Teknologi Web

Peminjaman lewat URL

<IMG SRC=“tempat.yang.dipinjam/gambarku.gif”>

• Gambar / image / berkas tidak dikopi tapi “dipinjam” melalui hyperlink

• Pemilk berkas dapat dirugikan: bandwidth terpakai

• Auditing sulit dilakukan pemakai biasa, tanpa akses ke berkas log (referer)

Page 17: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

Berikut adalah 10 kelemahan security teratas

pada aplikasi web

Masukan (input) yang tidak tervalidasiBroken Access ControlPengelolaan Autentikasi dan Session yang tidak

baikCross site scriptingBuffer overflowsInjections flawsPenyimpanan yang tidak amanDenial of ServicePengelolaan konfigurasi yang tidak aman

http://www.owasp.org

Page 18: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

Input yang tidak divalidasi

Aplikasi web menerima data dari HTTP request yang dimasukkan oleh user

Hacker dapat memanipulasi request untuk menyerang keamanan situs

Hal – hal yang harus diperhatikan ketika mengelola validasi:

Tidak cukup hanya bergantung pada script client side yang biasa digunakan untuk mencegah masukan form ketika ada input yang invalid

Penggunaan kode validasi untuk memeriksa masukan tidak mencukupi

Page 19: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

Broken Access Control

Pada aplikasi yang membedakan akses dengan menggunakan perbedaan ID, hanya menggunakan satu halaman untuk memeriksa user.

Jika user berhasil melewati halaman login, maka dia bebas melakukan apa saja

Permasalahan lain adalah:• ID yang tidak aman

ID bisa ditebak• Ijin file File yang berisi daftar user bisa dibaca orang

lain

Page 20: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

Pengelolaan Autentikasi dan Session yang tidak baik

Beberapa hal yang harus diperhatikan:• Password strength• Penggunaan password• Penyimpanan password• Session ID Protection

Page 21: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

Buffer Overflows

Pengiriman request yang dapat membuat

server menjalankan kode kode yang tidak

biasa

Page 22: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

Injection Flaws

Penyerang mengirimkan “inject” calls ke OS atau resource lain, seperti database

Salah satu yang terkenal adalah SQL Injection

Page 23: Pengantar Teknologi Web

Kelemahan security pada Kelemahan security pada aplikasi webaplikasi web

•Keamanan server juga menjadi hal penting

dalam hal keamanan aplikasi web

Berikut adalah beberapa kesalahan konfigurasi

pada server : Lubang keamanan yang tidak ditambal (patched)

Ijin file dan direktori yang tidak baik Account default dengan password default

Page 24: Pengantar Teknologi Web

Command Injection• Allows attacker to relay malicious code in form

variables or URL– System commands– SQL– Interpreted code (Perl, Python, etc.)

• Many apps use calls to external programs– sendmail

• Examples– Path traversal: “../”– Add more commands: “; rm –r *”– SQL injection: “’ OR 1=1”

• Countermeasures– Taint all input– Avoid system calls (use libraries instead)– Run with limited privileges

Page 25: Pengantar Teknologi Web

Error Handling

• Examples: stack traces, DB dumps• Helps attacker know how to target the app• Inconsistencies can be revealing too

– “File not found” vs. “Access denied”

• Fail-open errors• Need to give enough info to user w/o giving

too much info to attacker• Countermeasures

– Code review– Modify default error pages (404, 401, etc.)

Page 26: Pengantar Teknologi Web

Error messages example

Page 27: Pengantar Teknologi Web

Poor Cryptography

• Insecure storage of credit cards, passwords, etc.• Poor choice of algorithm (or invent your own)• Poor randomness

– Session IDs– Tokens– Cookies

• Improper storage in memory• Countermeasures

– Store only what you must– Store a hash instead of the full value (SHA-1)– Use only vetted, public cryptography

Page 28: Pengantar Teknologi Web

Web/App Server Misconfiguration

• Tension between “work out of the box” and “use only what you need”

• Developers ≠ web masters• Examples

– Unpatched security flaws (BID example)

– Misconfigurations that allow directory traversal

– Administrative services accessible– Default accounts/passwords

• Countermeasures– Create and use hardening guides– Turn off all unused services– Set up and audit roles, permissions,

and accounts– Set up logging and alerts

Page 29: Pengantar Teknologi Web

Web vulnerabilities

• Intercept informasi dari klien– Data, password, dll

• Pencurian data di server– Data, password, dll

• Menjalankan aplikasi di server– Memungkinkan melakukan eksekusi program “ngak benar” di

server

• Denial Of Services• Server Side Scripting, Cgi-Bin

– Kesalahan pemograman membuka peluang

Page 30: Pengantar Teknologi Web

Three opportunities for theft:

• on server by other registered users

• into server using HTTP

• on network by snooping

Page 31: Pengantar Teknologi Web

Kemanan Web

• Authentikasi – FORM HTML

– Basic, Digest

– Klien Side + Server Side Scripting

• Manajemen Sesi

• Menggunakan Layer lain– S-HTTP ( discontinoued)

– HTTPS ( HTTP ovel SSL)

– IPSec

• Konfigurasi Web Server– Hak Akses

– Indexes

– Penempatan File

Page 32: Pengantar Teknologi Web

HTTP Authentication

• Protect web content from those who don’t have a “need to know”• Require users to authenticate using a userid/password before they

are allowed access to certain URLs• HTTP/1.1 requires that when a user makes a request for a protected

resource the server responds with a authentication request header– WWW-Authenticate

• contains enough pertinent information to carry out a “challenge-response” session between the user and the server

Web ServerClient

Client requests a protected resource

Server responds with a 401 (not authorized and a challenge requestfor the client to authenticate

Page 33: Pengantar Teknologi Web

Authentikasi

• FORM HTML– <form action="modules.php?name=Your_Account" method="post">...

– <br><input type="hidden" name="op" value="login"> ...

– </form>

– Tidak di enkripsi

• BASIC– Algortima Base64

– Mudah di Dekrip

• DIGEST– Alghoritma Digest Ex: MD5

– Belum 100% di support

• CS + SS Script– Belum 100% di support– http://toast.newcastle.edu.au/js/md5/

browsertest.php3.

Page 34: Pengantar Teknologi Web

WWW-Authenticate

• Digest Authentication– attempts to overcome the shortcomings of Basic Authentication

– WWW-Authenticate = Digest realm=“defaultRealm” nonce=“Server SpecificString”

– see RFC 2069 for description of nonce, each nonce is different

– the nonce is used in the browser in a 1-way function (MD5, SHA-1….) to encode the userid and password for the server, this function essentially makes the password good for only one time

• Common browsers don’t use Digest Authentication but an applet could as an applet has access to all of the Java Encryption classes needed to create the creation of a Digest.

Page 35: Pengantar Teknologi Web

Manajemen Sesi

• Hiden Form Field– <input type="hidden" name="uniqueticket"– View page Source

• Cookies– User harus mennghidupkan fasilitas

– Poisoned cookies

• Session Id– -rw------- 1 nobody nobody 180 Jun 30 18:46

sess_5cbdcb16f ...– Dapat menggunakan History jika umur sesi belum habis

• URL Rewriting – http://login.yahoo.com/config/

login?.tries=&.src=ym&.last=&promo=&.intl=us

Page 36: Pengantar Teknologi Web

SSL

• Untuk Semua Protokol TCP– Telnet -> SSH

– HTTP -> HTTPS

• Public Key Server

• Hashing– MD5 + SHA

• CA

• Sekarang -> TLS

Page 37: Pengantar Teknologi Web

CertificateCertificate

Untuk mengkonfigurasi server, diperlukan sertifikat keamanan (security certificate)

Security Certificate dikeluarkan oleh Certification Authorities (CAs)

Jika tidak ada sertifikat dari CAs, bisa dibuat dengan menggunakan Java 1.4 SDK

Page 38: Pengantar Teknologi Web
Page 39: Pengantar Teknologi Web
Page 40: Pengantar Teknologi Web
Page 41: Pengantar Teknologi Web

Langkah-langkah untuk menaikkan tingkat keamanan browser

• Selalu mengupdate web browser menggunakan patch terbaru

• Mencegah virus• Menggunakan situs yang aman untuk transaksi

finansial dan sensitif• Menggunakan secure proxy• Mengamankan lingkungan jaringan• Tidak menggunakan informasi pribadi• Hati-hati ketika merubah setting browser

Page 42: Pengantar Teknologi Web

General Recommendations• Hati-hati ketika merubah konfigurasi browser • Jangan membuat konfigurasi yang mendukung scripts dan macros • Jangan langsung menjalankan program yang anda download dari internet• Browsing ke situs-situs yang aman

– Mengurangi kemungkinan adanya malcode dan spyware• Konfigurasi home pae harus hati-hati

– Lebih baik gunakan blank.• Jangan mempercayai setiap links (periksa dulu arah tujuan link itu)• Jangan selalu mengikuti link yang diberitahukan lewat e-mail• Jangan browsing dari sistem yang mengandung data sensitif• Lindungi informasi anda kalau bisa jangan gunakan informasi pribadi pada web• Gunakan stronger encryption

– Pilih 128-bit encryption• Gunakan browser yang jarang digunakan

– Serangan banyak dilakukan pada web browser yang populer• Minimalkan penggunaan plugins• Minimalkan penggunaan cookies• Perhatikan cara penanganan dan lokasi penyimpanan temporary files

Page 43: Pengantar Teknologi Web

Tools used in this preso

• WebGoat –vulnerable web applications for demonstration

• VMWare – runs Linux & Windows 2000 virtual machines on demo laptop.

• nmap –host/port scanning to find vulnerable hosts

• Ethereal – network traffic sniffing• Metasploit Framework – exploit tool• Brutus – password cracking• Sleuth – HTTP mangling against web sites

Page 44: Pengantar Teknologi Web

NEXT