1/51
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Cryptography
Scrambling data so that it looks like babble to anyone except those who know the trick to decoding it
Algorithm (aka Cipher)
A precise set of instructions that tells programs how to scramble and unscramble data
Plaintext
Decrypted or unencrypted data
Cipher text
Data that has been encrypted
Cryptanalysis
Attempting to break a cryptographic system and return the encrypted message to plaintext
Substitution Method
Replacement of a character with a different character
Monoalphabetic ciphers
The same letter is used as a substitute every time.
Transposition
Changing the order of items
Scytale cipher
Spartans wrapped a ribbon around a cylinder and wrote the message across. When unwrapped, the letters would look like garbled text. It was deciphered by using a cylinder of the exact same diameter as the original.
Caesar Cipher
- Aka shift cipher
- Caesar's cipher uses an algorithm and a key:
- Algorithm - you offset the alphabet either to the right (forward) or to the left (backward)
- Key - How many letters the offset should be
Cracking a substitution cipher
Each letter is replaced by another letter from the alphabet without correlation — i.e no shift or pattern
Frequency Analysis
Where we use knowledge about the frequency of letters and groups of letters used in a language and then look for this pattern in the ciphertext
Two most frequently used letters in english?
E and T
Common short words?
to, in, is, at ... the, and, for, but ...
OTP
One Time Pad
Definition: An encryption method in which the pre-shared key is used only once. Capturing or stealing the key is useless since it will not be used again to encrypt.
Pros and Cons of OTP
Pros
Unbreakable!
Cons
Dependent on random pad generation
Requires both parties to have identical pad and start from the same point in the pad
Impractical for most common applications
Large pads required
Hard to generate truly random numbers
Hard to get the pads to both parties
Transposition Cipher
The order of the letters are changed (can be split into rows or columns and read in a certain way)
Polyalphabetic ciphers
Substitution based on multiplied alphabets, using a system to switch between them.
Steps for Vigenere Encoding
Example:
Create alphabet grid
Plaintext SCHOOLS and Password = LEARN
Using Vigenere Chart, match plaintext to password
1. Agree on a codeword
2. Write the keyword above the plaintext
3. Find the shift for each letter
4. Encode the letter
5. Repeat
Cryptography
The science of making and breaking codes
Steganography
Definition: The practice of hiding messages so that the presence of the message itself is hidden
aka "Security through obscurity" = no one knows a secret is being exchanged
aka "Hiding in Plain Sight"
Different from regular encryption which only seeks to hide the message, but not the fact that message is being exchanged
Most common is to hide text inside a graphic
Practical Uses for Steganography
You suspect someone is illegally distributing copyrighted pdfs or images and add hidden copyright information in them using steganography tools to to double check
You want to exchange information like passwords or sensitive images over an insecure transmission protocol like email
You want to embed secret files available only to a select few in a public forum.
Tools for Steganography
Photo Editing Software
Hex Editor
Exit Viewer Tool - Extract file MetaData
Binwalk
Photo Editing Software
Enlarge photo to find hidden text inside
Could be obscured by font size or color or position
(Use photo editing software like MS Paint, Photoshop, or Gimp)
Hex Editor - Hxd (Win) or Bless
Text can be hidden inside bits of the file
Using hex editor, you can see the file bits represented in Hexadecimal on the left side and in ASCII on the right side.
Exit Viewer Tool
Extract file MetaData (information about the file)
Use Exiftool (linux/Windows) or use an online exif viewer tool
This tool can find a secret or a CTF flag hidden through the exif data
Binwalk
Search a file for embedded files or code, then extract
You need to know what software was used to encrypt, in order to extract hidden text or file
Is linux case sensitive?
Yes
UP or DOWN arrow on the keyboard to toggle through past commands
Avoid retyping long lines of commands
TAB
Autocomplete typing filenames
clear
Bring you to an empty command prompt
Grep command
Powerful search tool that can be used with many option
grep keyword science.txt
Basic usage of grep is to find a word (keyword) inside a file
grep -i keyword science.txt
Use the -i option to ignore capitalization so it will find 'keyword' or 'Keyword'
grep 'any group of words' science.txt
Use the single quotes ' ' to search for a phrase or pattern
v
display those lines that do NOT match
n
precede each matching line with the line number
c
print only the total count of matched lines
/ (pwd)
(begins with forward slash)
Specifying a file or directory as an absolute path means you are specifying where it sits on the computer in absolute terms, starting from the top level
If an absolute path is used...
The command will do the same thing no matter what directory you are in when you execute the command
. (ls)
(does NOT begin with forward slash)
Specifying a file or directory as a relative path means you are specifying where it sits relative to the directory you're in right now.
If a relative path is used...
A command on a file will only work if that file exists in the current directory
After the command, use > in order to...
Put all the info that the command before > produces and stores it in the file named after >
Example:
ls > listofiles.txt
Command ls info gets stored into listoffiles.txt
>>
Adds data to an existing file
Example:
cat Dragons.txt >> listoffiles.txt
Takes the contents of the Dragons.txt and adds it to the end of the listoffiles.txt
sort
sorts alphabetically
sort -r
sorts in reverse alphabetical order
sort -R
sorts into a random order
Wildcard (*)
represents 'anything'
Pipe (|)
takes the output from one command and sends it as the input to a second command
Creating small working programs without having to know a programming language
Linux - Script
Windows - Batch File
BASH
Using the ______, we can learn the steps for scripting in Linux
Script (linux) - BASH
- Requires shell program
- Open a text editor and create a file with commands
- Start the script with #!/bin/bash (! is known as "shebang")
- Put only one command per line
- Save the file with the .sh extension instead of the .txt extension
- Change the file permissions to make it executable
- chmod +x