Mục lục bài họcĐang ở d05-b4
Safe Computing: Authentication, Encryption and Attacks
Proving who you are
Authentication measures protect devices and information from unauthorized access. A strong password is easy for the user to remember but hard for someone else to guess. Its strength comes from the size of the key space: with an alphabet of $a$ symbols and length $n$ there are $a^n$ possible passwords, so a brute-force attacker making $r$ guesses per second needs up to $a^n/r$ seconds. Length matters most, because it is the exponent.
Multifactor authentication (MFA) requires at least two of three different kinds of evidence: something you know (password, PIN, security question), something you have (phone receiving a code, hardware key), something you are (fingerprint, face). Two pieces of the same kind, such as a password plus a security question, are not multifactor. MFA means a stolen password alone is not enough to log in.
MFA is not invulnerable. A fake login page can ask for both the password and the current one-time code and pass them to the real site within seconds, before the code expires. Hardware keys that check the website's real address resist this; codes typed by the user do not.
Xác thực (authentication) bảo vệ thiết bị và thông tin khỏi truy cập trái phép. Mật khẩu mạnh là mật khẩu chủ nhân dễ nhớ mà người khác khó đoán. Độ mạnh đến từ kích thước không gian khoá: bảng ký tự có $a$ ký hiệu, dài $n$ ký tự thì có $a^n$ mật khẩu khả dĩ, nên kẻ dò vét cạn thử $r$ lần mỗi giây cần tối đa $a^n/r$ giây. Độ dài quan trọng nhất, vì nó nằm ở số mũ.
Xác thực đa yếu tố (MFA) đòi ít nhất hai trong ba loại bằng chứng khác nhau: thứ bạn biết (mật khẩu, PIN, câu hỏi bảo mật), thứ bạn có (điện thoại nhận mã, khoá phần cứng), thứ bạn là (vân tay, khuôn mặt). Hai thứ cùng loại — mật khẩu cộng câu hỏi bảo mật — không phải đa yếu tố. MFA nghĩa là chỉ lấy được mật khẩu thôi thì chưa đăng nhập được.
MFA không bất khả xâm phạm. Một trang đăng nhập giả có thể hỏi cả mật khẩu lẫn mã dùng một lần hiện tại rồi chuyển ngay sang trang thật trong vài giây, trước khi mã hết hạn. Khoá phần cứng kiểm tra địa chỉ thật của trang web thì chống được kiểu này; mã do người dùng tự gõ thì không.
Encryption and common attacks
Encryption is the process of encoding data to prevent unauthorized access; decryption reverses it. In symmetric encryption one key both encrypts and decrypts, as in a shift (Caesar) cipher where every letter moves forward $k$ places and decrypting moves back $k$. Its problem is distribution: the two parties must already share the secret key. Public key encryption pairs a key that is published for everyone with a private key held only by the recipient. Anyone can encrypt a message with Bob's public key; only Bob's private key decrypts it. Certificate authorities issue digital certificates that vouch that a public key really belongs to a particular website, which is how a browser knows it is talking to the real bank.
Common attacks: malware is software intended to damage a system or gain unauthorized access; a computer virus attaches itself to legitimate programs and spreads; keylogging records keystrokes to capture passwords. Phishing tricks a user into giving personal information, often through a look-alike email or website. A rogue access point is a wireless network set up without authorization, often named like a legitimate one, that lets its owner intercept unencrypted traffic. Defenses include keeping software updated, checking a site's address and certificate before entering credentials, using encrypted connections (HTTPS), and MFA.
Mã hoá (encryption) là mã hoá dữ liệu để chặn truy cập trái phép; giải mã là làm ngược lại. Trong mã hoá đối xứng, một khoá dùng cho cả mã hoá lẫn giải mã — như mật mã dịch chữ Caesar, mỗi chữ tiến $k$ vị trí (quay vòng từ Z về A), giải mã thì lùi $k$. Vấn đề của nó là trao khoá: hai bên phải chia sẻ khoá bí mật từ trước. Mã hoá khoá công khai ghép một khoá công bố cho mọi người với một khoá riêng chỉ người nhận giữ. Ai cũng mã hoá được bằng khoá công khai của Bob; chỉ khoá riêng của Bob giải được. Tổ chức chứng thực (certificate authority) cấp chứng chỉ số xác nhận một khoá công khai đúng là của một trang web cụ thể — nhờ đó trình duyệt biết mình đang nói chuyện với ngân hàng thật.
Các kiểu tấn công hay gặp: malware là phần mềm nhằm phá hệ thống hoặc chiếm quyền trái phép; virus bám vào chương trình hợp lệ và lây lan; keylogging ghi lại phím gõ để lấy mật khẩu. Phishing lừa người dùng tự đưa thông tin cá nhân, thường qua email hay trang web giả mạo trông y như thật. Điểm truy cập giả (rogue access point) là mạng không dây dựng trái phép, hay đặt tên giống mạng hợp lệ, cho phép chủ của nó chặn đọc lưu lượng không mã hoá. Phòng vệ: cập nhật phần mềm, kiểm địa chỉ và chứng chỉ trước khi nhập thông tin đăng nhập, dùng kết nối mã hoá (HTTPS), và bật MFA.
Kẻ tấn công thử $10^9$ mật khẩu mỗi giây. So sánh thời gian vét cạn tối đa của: (1) mật khẩu 8 ký tự chỉ gồm chữ thường; (2) mật khẩu 8 ký tự gồm chữ thường, chữ hoa và chữ số. Rồi cho biết thêm 2 ký tự chữ thường vào mật khẩu (1) có tác dụng ra sao.
(1) Bảng 26 ký tự: $26^8\approx 2{.}09\times 10^{11}$ mật khẩu. Thời gian $\dfrac{2{.}09\times 10^{11}}{10^9}\approx 209$ giây, chưa tới 4 phút.
(2) Bảng $26+26+10=62$ ký tự: $62^8\approx 2{.}18\times 10^{14}$. Thời gian $\approx 2{.}18\times 10^{5}$ giây, khoảng $2{.}5$ ngày — gấp khoảng $\left(62/26\right)^8\approx 1045$ lần.
Thêm 2 chữ thường vào (1): $26^{10}\approx 1{.}41\times 10^{14}$, khoảng $1{.}6$ ngày — gấp $26^2=676$ lần chỉ nhờ thêm hai ký tự dễ nhớ. Độ dài nằm ở số mũ nên tăng độ dài thường là cách rẻ nhất để làm mật khẩu khó dò. Dù vậy, không độ dài nào cứu được mật khẩu đã bị keylogger ghi lại hay bị gõ vào trang phishing — đó là việc của MFA.
Đọc xong rồi — làm thử ngay
Bài tập của chương Unit 5 — Impact of Computing gồm 14 câu trắc nghiệm và 5 đề tự luận. Đáp án hiện ngay khi chọn, miễn phí.