assignment 2 of database (database security)

49

Upload: aey-unthika

Post on 23-Feb-2017

352 views

Category:

Data & Analytics


4 download

TRANSCRIPT

Group 8• นายเฉลมเกยรต ชนะชาญ

• นายธนวชญ โทราช• นสอญธกาหนองบว

Assignment 2

Database SecurityCompare With File-System Security (Permission)

• Standard Permission เปน Permission ทไดน ำเอำ SpecialPermission มำจดกลมใหจ ำนวนรำยกำรลดลงเหลอเพยง 4 กลมส ำหรบแฟมขอมลไดแก

Database SecurityCompare With File-System Security (Permission)

• Read(RX) ประกอบดวย Special Access 2 รำยกำรคอ Read และ Executeซงหมำยถงสำมำรถอำนขอมล และเรยกโปรแกรมมำท ำงำน (ถำแฟมนนเปนโปรแกรมรวม)

• Change(RWXD) ใชส ำหรบอำน/แกไข/ลบขอมล• Full Control(RWXDPO) สำมำรถท ำรำยกำรไดทงหมด• No Access() ไมสำมำรถเรยกดขอมลได ถงแมวำจะอยในกลม ทก ำหนดใหเรยกดได (หมำยถง

No Access จะ Overwrite ควำมสำมำรถอน) รำยกำรส ำหรบโฟลเดอร ไดแก (รปแบบก ำรแสดงเป น xxxx (dir-permission) (file-permission) วงเลบแรกเปนกำรก ำหนดสทธส ำหรบโฟลเดอรนน สวนวงเลบหลงเปนกำรก ำหนดสทธของแฟมขอมล ในโฟลเดอรนน

Specifications of Computer

Simple Database ForA1 User

Tables\Name Users Passenger Airport Staff AdminsAirport R CRU Full Control (CRUD)

Airplane_Type - CRU Full Control (CRUD)

Airplane - CRU Full Control (CRUD)

Leg_Instance - CRU Full Control (CRUD)

Seat R CRU Full Control (CRUD)

Flight_Leg R CRU Full Control (CRUD)

Flight R CRU Full Control (CRUD)

Fare R CRU Full Control (CRUD)

Can_Land - CRU Full Control (CRUD)

Discretionary Access Control

R: Read, Retrieve C: Create U: Update, Modify D: Delete, Destroy

Create User

•MysqlCreate User

•Mysqlค ำสงทใช

ผลลพธทได

•MysqlPassenger

ค ำสงทใช

•Mysqlสทธท user Passenger สำมำรถเขำถงได

•MysqlAirport Staff

ค ำสงทใช

ผลลพธทได

•MysqlAdmins

ค ำสงทใช

ผลลพธทได

•PostgreSQLCreate user

•PostgreSQLค ำสงทใช

ผลทได

•PostgreSQL Passenger

ค ำสงทใช

•PostgreSQLAirport Staff

ค ำสงทใช

•PostgreSQLAdmins

ค ำสงทใช

•PostgreSQLผลลพธทได

•SQLite3ค ำสงทใช

สรำง user ubuntu ขนมำ 2 user โดยท admins จะ ท ำไดทกอยำง เชนกำรอำนขอมล

•SQLite3Passenger จะอำนไดอยำงเดยว ถำ insert จะขนดงรป

admin insert+select ได

Database Log Files

Database Log Files

• ต ำแหนงข อง Log filesใน Ubuntu : /var/log/postgresql/

การด Database Log Files

• สำมำรถกดดไดดวยค ำสง cat , tail , head , nano , geditตวอยำง tail postgresql-9.3-main.log

ตวอยำง nano postgresql-9.3-main.log

Backup/Restore

Backup /Restore Database Files

• Backup ใชค ำสง pg_dump –Fc Database Name > Backup_Name.bakหรอ pg_dump –Ft Database Name > Backup_Name.tar

• Restore ใชค ำสง pg_restore –Fc Database Name > Backup_Name.bak หรอ pg_resotre –Ft Database Name > Backup_Name.tar

PostgreSQL Backup /Restore

ไฟลจะอยใน /var/lib/postgreSQL

PostgreSQL Backup /Restoreสรำงdatabase ใหม

ค ำสง restore

เสรจแลวจะปรำกฏดงรป

PostgreSQL Backup /Restore

SQLite3 Backup /Restoreค ำสง backup

ไฟลจะอยบน desktop

SQLite3 Backup /Restoreค ำสง restore

mySQL Backup /Restoreค ำสง backup

ค ำสง restore

mySQL Backup /Restore

Possible unethical uses of your group database?

•Our Databaseabout airline reservations system.

การเปดเผยขอมลลกคา (ผโดยสาร) เปนการไมสมควรเนองจากถอเปนการละเมดสทธสวนบคคล ซงผดตอกฎหมาย และอาจกอใหเกดความเสยหายได

การเปดเผยขอมลเทยวบน เนองจากอาจกอใหเกดความเสยหายตอสายการบน ทงดานความปลอดภย และความนาเชอถอ อาจเปนเหตท าใหเกดการกออาชญากรรมบนเครองบนไดงาย เพราะทราบขอมลทงหมดแลว

SQL Injection

• SQL INJECTION

SQL injection is a technique where malicious users can inject SQL commands into an SQL statement, via web page input.เปนเทคนคทผประสงครายสามารถบบค าสงของ SQL เขาไปในขอความ SQL ผานทางหนาเวปเพจInjected SQL commands can alter SQL statement and compromise the security of a web application.ค าสง SQL ทถกบบอด สามารถปรบเปลยนค าสง SQL และยอมรบความปลอดภยของเวปแอปพเคชน

• Example of SQL Injection

ตองกำรคนหำขอมลสำยกำรบน DMKค ำสง SELECT * FROM Airport WHERE Airport_code = ‘DMK’;

• Example of SQL Injection

และถำเพม or 1=1ค ำสง SELECT * FROM Airport WHERE Airport_code = ‘DMK’ or 1=1;

• How to test SQL Injection

ตรวจสอบเพอทตองการหาวาการคนหาหรอดงขอมล (Query) จากดาตาเบส นนถกตองตามทตองการหรอไมสวนทตองการตรวจสอบกคอสวนทมปฏสมพนธกบขอมลโดยตรงเชน สวนของลอกอนของผใช(Authentication) , สวนคนหาขอมล(Search Engines) , สวนทกรอกจ านวนสนคา หรอราคาตางๆ (E-commerce)

• Standard SQL Injection Testing

1. SQL Injection based on 1 = 1 is always TRUE2. SQL Injection based on “=“ is alsways TRUE3. SQL Injection based on batched SQL statements

• SQL Injection Based on ""="" is Always True

SELECT * FROM Airport WHERE Airport_code = ‘DMK’ or 1=1;

• SQL Injection based on “=“ is alsways TRUE

• SQL Injection based on batched SQL statements