Intro To InfoSec
Intro To InfoSec
IIT(BHU)CyberSec
What is cryptography?
Readable format - It is the process of It is the data that you Decryption is the It’s the original text
non encrypted data. converting the get after encryption process of converting that we sent which
E.g - A message plaintext through which can’t be simply the ciphertext back to reached us in a safe
saying - “Hello various techniques like read. E.g our message plain text and it may manner - “Hello
Everyone” ROT13,vigenere cipher after ROT13 encryption sometimes require a Everyone”.
etc to a form that is gets converted to special key.
not readable by “Uryyb Rirelbar”
humans
Different types of Encryptions
● Symmetric Encryption:- Encryption and Decryption uses same key
● Asymmetric Encryption:- Encryption and Decryption use different keys(public and private)
Hash function
Plaintext Ciphertext
Different Data types
● Binary
● Decimal
● Octal
● Hexadecimal
Decimal Representation
● Decimal representation is simply how we study numbers in our number system where each place holds
a value of some power of 10.
● Unit place hold the value of 10^0 ,ten’s place holds the value 10^1 and so on
● So a number lets say 12345 can be represented as -
● This is how we generally understand numbers and data and this representation is the most convenient
for us.
Binary Representation
● Binary is the representation of data using just 1’s and 0’s.
● Each 0 or 1 is called a bit and 8 bits are called as a byte.
● Just like in decimal where each place holds some value here also each place holds a value of some
power of 2.
Say we have a byte 01010011 this can be converted to decimal like this -
decimal(01010011)2 = 2^7 x 0 + 2^6 x 1 + 2^5 x 0 + 2^4 x1 + 2^3 x 0 + 2^2 x 0 + 2^1 x1 + 2^0 x 1 =
83
Here’s another example -
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
● Just like the others here also each place has a value of some power of 16. The
only addition here being the alphabets and their corresponding values.
● Message: “HELLO”
● ASCII bytes: [72, 69, 76, 76, 79]
● HEX bytes: [0x48, 0x45, 0x4c, 0x4c, 0x4f]
● Base-16: 0x48454c4c4f
● Base-10: 310400273487
Base 64
● Just like ASCII base64 has a separate index list which maps letters to numbers
● The difference here is that instead of 8 bits we use only 6 bits to represent characters and the
encryption is based on converting 3 bytes(24 bits) to 24 bits made up of four characters from
base64 index list.
A B OUTPUT
1 0 1
0 0 0
1 1 0
0 1 1
Application
● Let’s take an example plaintext = “label”
● Key = 13
● We know from ASCII ‘label’ can be represented as decimal numbers
● l = 108 a = 97 b = 98 e = 101
● If we represent it in binary l = 01101100,a = 01100001,b = 01100010,e = 01100101,13 = 00001101
● If we take the xor of each letter with 13 in binary form we get :-
● 01100001 , 01101100 , 01101111 , 01101000 , 0110001
● If we convert them back to decimal :- 97 108 111 104 97
● Using ASCII encoding we convert them back to letters to get :- ‘aloha’ (Our encrypted text)
XOR has some properties like e.g it’s commutative,associative and A^A gives 0 always and A^0 gives A
Hashing
Hashing is like a one-way algorithm in which a plain text is converted into cipher text of a fixed length
and the plain text cannot be recovered easily. The only way to get the plaintext would be to guess
something and put it into the hash function and see if we get the same ciphertext as before.E.g SHA -
256,MD5
But this is not the end there are sites like www.crackstation.net which go through common inputs in
common hash functions and match the output upto some extent. E.g the hash of a simple password like
1234 can be easily cracked using this website.
IIT(BHU)CYBERSEC
Steganography
WHAT IS
STEGANOGRAPHY?
• Steganography is a Greek word meaning "Secret Writing" or
"Hidden Writing".
• Steganography is the technique of hiding secret data within
an ordinary file or message in order to avoid detection.
• Steganography can be used to conceal almost any type of
digital content, including text, image, video, audio or
documents, then the hidden data will be extracted at
destination.
• Thus we can see that its hard to detect, so if you download
a malicious file and open it in your computer, the malware
can get activated.
TYPES OF STEGANOGRAPHY?
Steganography
Image steganography is
the method of hiding data or text embedded
inside an image file.
One of the popular
technique used is
Least significant Bit(LSB)
LEAST SIGNIFICANT BIT
In this technique,
attacker identifies the
least significant bit of
the file and replaces it
with malicious code.
HOW DATA CAN BE HIDDEN IN
IMAGE FILE?
Install using:
wget http://www.caesum.com/handbook/Stegsolve.jar -O stegsolve.jar
STEGHIDE
Install using:
sudo apt install steghide
Binwalk is a tool for searching a given binary
image for embedded files and executable code.
Specifically, it is designed for identifying files and
code embedded inside of firmware images.
BINWALK
Install using:
Sudo apt install binwalk
EXIFTOOL
Install using:
Sudo apt install exiftool
AUDIO STEGANOGRAPHY
Instruction pointer: stores the pointer to next instruction in memory. (EIP, RIP)
Stack Pointer: stores the current top of the stack (ESP, RSP)
Base Pointer: stores the starting point of current frame on stack. (EBP, RBP)
Data Registers: for working with arithmetic and other pointers - EAX, EBX, ECX, EDX, EDI,
ESI.
Call Stack
● GDB
● RADARE2
● IDA
● GHIDRA
Static and Dynamic Linking
● wiki.skullsecurity.org/Assembly
● Crackmes.one
● picoCTF
● Microcorruption.com
● ctflearn.com/
● backdoor.sdslabs.co/beginner
● Participate in CTFs
Web Exploitation
Chall 1
https://jupiter.challenges.picoctf.org/problem/9670/
Web Crawlers
Robots.txt
Chall 2
https://jupiter.challenges.picoctf.org/problem/56830/
Cookies
Chall 3
https://jupiter.challenges.picoctf.org/problem/44573/