Unays Learn ยท Cybersecurity

Staying safe online: passwords, phishing and two-step sign-in

Most hacked accounts are not broken into with clever code. They are opened with reused passwords or tricked out of people with fake messages. A few habits stop most of these attacks.

Strong passwords are long

Length matters more than odd symbols. A passphrase of four or more random, unrelated words, such as lamp-orbit-pepper-violin, is far harder to guess than P@ssw0rd1 and easier to remember. Avoid names, birthdays, pets and teams: attackers try those first.

This short program shows why length helps. It counts how many combinations an attacker would have to try:

def combinations(alphabet_size, length):
    return alphabet_size ** length

print("8 letters and digits:", f"{combinations(62, 8):,}")
print("4 words from 7,776:  ", f"{combinations(7776, 4):,}")
print("5 words from 7,776:  ", f"{combinations(7776, 5):,}")

7,776 is the size of a common word list used for random passphrases. Each extra word multiplies the work by 7,776.

Never reuse a password

Websites get breached, and leaked passwords are tried on other sites automatically. If you use the same password for a game and for your email, a leak from the game can unlock your email, and your email can reset almost everything else.

A password manager creates and remembers a different strong password for every site. You only remember one strong passphrase for the manager itself. Browsers and phones include one, and there are well-known separate apps.

Turn on two-step verification

Two-step verification (2SV, also called two-factor or 2FA) asks for something extra after your password: a code from an authenticator app, a prompt on your phone, or a passkey. Even if someone steals your password, they still cannot sign in. Turn it on first for your email, then for social media and school accounts. Keep the backup codes somewhere safe and offline.

Passkeys go a step further: you sign in with your fingerprint, face or device PIN, and there is no password to steal or type into a fake site.

Spotting phishing

Phishing messages pretend to be from someone you trust to make you click a link, type a password or send money. Warning signs:

  • Urgency or fear: "Your account will be deleted in 24 hours!"
  • A link whose address does not match the real site, such as unays-login.example.com or a misspelled name. On a computer, hover over the link to see where it really goes.
  • Requests for passwords, codes or payment. Real services never ask you to send your password or a sign-in code by message.
  • Unexpected attachments or prizes.

When unsure, do not use the link. Open the app or type the site's address yourself, or ask the person through another channel. Never share a sign-in code someone "accidentally" sent you.

If an account is hacked

  1. Tell a parent, teacher or the school's IT contact.
  2. Use the service's official "forgot password" or account recovery page to get back in, and set a new, unique password.
  3. Sign out of all other sessions and turn on two-step verification.
  4. Check the account's recovery email and phone number, and any forwarding rules, in case the attacker changed them.
  5. Change the same password anywhere else you used it.

Try it yourself

Check that your main email has two-step verification turned on. Then run the password example in Unays Code and change it to compare a 12-character password with a six-word passphrase. If you are building websites, read HTML forms to see how sign-in forms are built. Then try the editing challenge: find the data leak, a safe hands-on exercise where you fix code that secretly sends visitor data to an outside server.

This tutorial was written with AI assistance and reviewed by Unays. The runnable code examples were tested before publishing. Spotted a mistake? Tell us at [email protected].