What reverse engineering is? (Pure theory)

Leave a comment

This post is for those who don’t know what reverse engineering means.

I am not going to discuss some thing technical as in some disassembly tol or some debugger will just try to tell the young audience what reversing is.

Reverse engineering as the name specifies it’s something like starting from the very end and then finishing on the very start.

This sounds kind of confusing?

Let me to explain using  some better examples it’s a process of getting code form some binary.

 

As there are a lot of closed source binaries available in market and some of them are malicious too so here we feel the need of reversing some particular binary.

Consider example of some malware as we got no code for that and we need to study how malware works to know it’s internal features and what kind of things it’s doing to my machine in that case we have to cut the malware into 2 half 😉 (Kidding)

We have to reverse that malware.

So mostly there are two kind of ways by which we fo this

1) Dynamic analysis

2)Static analysis

Dynamic analysis is Analysis of the sample using some Debugger or some random tools while it’s getting executed over the system. If we are not sure about the sample then better to use some VM for this as that is going to help you protected and not to ruin the data over your machine.

Static Analysis is about simply reversing the sample and then to analyse the code.

Now here Come the Assembly thing as I have already taught the basics of assembly in my previous tutorial so this is going to be fun now as this own;t lok like some MATRIX and stuff 🙂

When you attach a running process with some Debugger or some Decompiler then it is not be able to provide the native code  (The original code in which the ample is written) it use to analyse it and to dump the assembly and for that we should know assebmly and other things

In the next Tutorials we going to need Olley debugger as will start with a simple crack me non malicious file and will carry forward the other things and a s the things proceed will try to train you from Noob to PRO 🙂

Ask any question over comment or mail me.

Do tell me if you find something which is wrong.

Thanks for reading.

 

What is DDOS layer 7 and Layer 4 and Low-Rate Ddos

1 Comment

Introduction

Very recently some hacactivist named as Lulzsec and Anonymous were very famous because they use to hack some of the government website and they use to hack the data and all.

This brings my interest and to know how they are doing all this, as we all know as this is now pretty old and you might be knowing about Ddos but here I am telling you about Ddos layer 3 and 4 attack.

The attacks which are be done by hack activist was layer 7 attack and you may do this kind of attack is by simply pressing the refresh button over your browser.

If hundreds of thousands of people will do this then at some point of time the server will become irresponsible and so it so server stop serving the users.

But for this kind of Ddos we need too many computers some of them might knew that they are being part of this attack or sometimes the people got involved unknowingly as they are under some malware .

So what Layer 3 and layer 4 Ddos .

As the Anonymous got active there got 1 person active against them by the name of “th3j35tor”  who claimed to be ex Security personal.

It was the 1st time when I cam across this level of Ddos which he was executing through a 3G connection over cellphone and was taking down some 3-4 big servers by using just 1 connection.

So what exactly Layer 4 Attack is?

A Layer4 DoS attack is often referred to as a SYN flood. It works at the Transport Protocol (TCP) layer. A TCP connection is established in what is known as a 3-way hand shaking. The client sends a SYN packet, the server responds with a SYN ACK, and the client responds tothat with an ACK. After the “three-way handshake” is complete, the TCP connection is considered established. It is as this point that applications begin sending data using a Layer 7 or application layer protocol, such as HTTP.

A SYN flood uses the inherent patience of the TCP stack to overwhelm a server by sending a flood of SYN packets and then ignoring the SYN ACKs returned by the server. This causes the server to use up resources waiting a configured amount of time for the anticipated ACK thatshould come from a legitimate client. Because web and application servers are limited in the number of concurrent TCP connections they can have open, if an attacker sends enough SYN packets to a server it can easily chew through the allowed number of TCP connections, thus preventing legitimate requests from being answered by the server.

SYN floods are fairly easy for proxy-based application delivery and security products to detect. Because they proxy connections for the servers, and are generally hardware-based with a much higher TCP connection limit, the proxy-based solution can handle the high volume of connections without becoming overwhelmed. Because the proxy-based solution is usually terminating the TCP connection (i.e. it is the “endpoint” of the connection) it will not pass the connection to the server until it has completed the 3-way handshake. Thus, a SYN flood is stopped at the proxy and legitimate connections are passed on to the server with alacrity.

The attackers are generally stopped from flooding the network through the use of SYN cookies.  SYN cookies utilize cryptographic hashing and are therefore computationally expensive, making it desirable to allow a proxy/delivery solution with hardware accelerated cryptographic capabilities handle this type of security measure. Servers can implement SYN cookies, but the additional burden placed on the server alleviates much of the gains achieved by preventing SYN floods and often results in available, but unacceptably slow performing servers and sites.

LDos (I got limited knowledge of this which I am sharing  if you got something more then do share that with me):

Low-rate Distributed Denial-of-Service (LDDoS) attacks send fewer packets to attack legitimate flows by exploiting the vulnerability in TCP’s congestion control mechanism.

They are difficult to detect while causing severe damage to TCP-based applications. Existing approaches can only detect the presence of an LDDoS attack, but fail to identify LDDoS flows. In this paper, we propose a novel metric – Congestion Participation Rate (CPR) – and a CPR-based approach to detect and filter LDDoS attacks by their intention to congest the network. The major innovation of the CPR-base approach is its ability to identify LDDoS flows.

A flow with a CPR higher than a predefined threshold is classified as an LDDoS flow, and consequently all of its packets will be dropped. We analyze the effectiveness of CPR theoretically by quantifying the average CPR difference between normal TCP flows and LDDoS flows and showing that CPR can differentiate them. We conduct ns-2 simulations, test-bed experiments, and Internet traffic trace analysis to validate our analytical results and evaluate the performance of the proposed approach. Experimental results demonstrate that the proposed CPR-based approach is substantially more effective compared to an existing Discrete Fourier Transform (DFT)-based approach

 

My project for the protection against DDos layer 7 attack.

I have created this Ddos protection script which is under the GPL license and it’s useful for protecting the server form leyer 7 Ddos protection.

This is useless for any of layer 3 and layer 4 Ddos attacks and a lot of code is still needed to be completed which I will be completing when got some free time.If you feel like completing then please go ahead and ask me what ever you feel like.

The Script can be download from here will GIT it ASAP.

I am sorry as the previous link was not working so I have uploaded it to GIT now you can get it form here, it’s under GPL license so you can use it for free 🙂
https://github.com/unknownhad/ddos-protection

Hope you like this and do share your views.

 

Assembly Tutorial for Reverse engineering basics.

10 Comments

Introduction

I have learned assembly mostly from reading various tutorials online, reading books, and ask questions in newsgroups and IRC.
This tutorial will focus on x86 assembly. Which going to help you further in reverse engineering tutorials which I will be releasing after this.

Knowledge of higher level programming languages and basic knowledge of computer architecture is assumed.

Why assembly ?

Because when we are going to reverse any binary the code which we going to get will be in assembly.

Who use assembly? 

I don’t know. If you know then do share that with me as according to me now you for higher level languages like C,c++ and a ton of other language then why to use assembly.

Though Assembly generation process is automated then there might be some where we might need handwritten assembly code.

Positive and negative of assembly:

Positive is very fast, it’s powerful and small.

Negatives are Hardware dependent, not easy to debug and consume too much of time then High level languages.

Assemblers

Assembler is used to convert Assembly to machine language.
Often, it will come with a linker that links the assembled files and produces an
executable from it. Windows executables have the .exe extension. Here are some of the
popular ones:

1. MASM – This is the assembler this tutorial is geared towards, and you should
use this while going through this tutorial. Originally by Microsoft, it’s now
included in the MASM32v8 package, which includes other tools as well. You
can get it from here.

2. TASM – Another popular assembler. Made by Borland but is still a
commercial product, so you can not get it for free.

3. NASM – A free, open source assembler, which is also available for other
platforms. It is available at link. Note that
NASM can’t assemble most MASM programs and vice versa.

Basic Commands

There are soem commands to learn (very basic of course) this will help us to understand the reversed code easily in efficient
manner.

CPU registers

Registers are special memory locations on the CPU.
Assuming person is using computers x86 or later processors.

There are 8 32-bit general purpose registers.

The first 4, eax, ebx, ecx, and edx can also be accessed using 16 or 8-bit names.

ax gets the first 16 bits of eax, al gets the first 8 bits, and ah gets bits 9-16.
bx gets the first 16 bits of ebx.
The other registers can be accessed in a similar fashion.

We can use these registers for anything, although most have a special use:

Address Name Description

EAX Accumulator Register calculations for operations and results data

EBX Base Register pointer to data in the DS segment

ECX Count Register counter for string and loop operations

EDX Data Register input/output pointer

link Source Index source pointer for string operations

EDI Destination Index destination pointer for string operations

ESP Stack Pointer stack pointer, should not be used

EBP Base Pointer pointer to data on the stack

NOTE: In windows programming we may only use EAX,ECX and EDX registers

There are 6 16-bit segment registers. They define segments in memory:

Address Name Description

CS :Code Segment,instructions being executed are stored
DS, ES, FS, GS : Data Segment for data segment
SS :Stack Segment, to store the address of stack for the current program.

Two 32-bit registers that don’t fit anywhere:

Address Name Description

EFLAGS Code Segment status, control, and system flags

EIP Instruction Pointer offset for the next instruction to be executed

Basic Instruction Set:

There are a lot of other instructions other than these what I am going to tell you here.
WIll cover other instructions when we going to face them.

ADD: reg/memory, reg/memory/constant Adds the two operands and stores the result into the first operand. If there is a result with carry, it will be set in CF.

SUB: reg/memory, reg/memory/constant Subtracts the second operand from the first and stores the result in the first operand.

AND: reg/memory, reg/memory/constant Performs the bitwise logical AND operation on the operands and stores the result in the first operand.

OR: reg/memory, reg/memory/constant Performs the bitwise logical OR operation on the operands and stores the result in the first operand.

XOR: reg/memory, reg/memory/constant Performs the bitwise logical XOR operation on the operands and stores the result in the first operand. Note that you can not XOR two memory operands.

MUL: reg/memory Multiplies the operand with the Accumulator Register and
stores the result in the Accumulator Register.

DIV: reg/memory Divides the Accumulator Register by the operand and stores
the result in the Accumulator Register.

INC: reg/memory Increases the value of the operand by 1 and stores the result in
the operand.

DEC: reg/memory Decreases the value of the operand by 1 and stores the result
in the operand.

NEG: reg/memory Negates the operand and stores the result in the operand.

NOT: reg/memory Performs the bitwise logical NOT operation on the operand and
stores the result in the operand.

PUSH: reg/memory/constant Pushes the value of the operand on to the top of the stack.

POP: reg/memory Pops the value of the top item of the stack in to the operand.

MOV: reg/memory, reg/memory/constant Stores the second operand’s value in the first operand.

CMP: reg/memory, reg/memory/constant Subtracts the second operand from the first operand and sets the respective flags. Usually used in conjunction with a JMP, REP, etc.

JMP: label Jumps to label.

LEA: reg, memory Takes the offset part of the address of the second operand and
stores the result in the first operand.

CALL: subroutine Calls another procedure and leaves control to it until it returns.

RET: Returns to the caller.

INT: constant Calls the interrupt specified by the operand.

You can grab latest complete instruction set reference at:
link

Push and Pop

Push and Pop are operations that manipulate the stack.
Push takes a value and adds it on top of the stack. Pop takes the value at the top of the stack, removes it, and stores it
in the operand. Thus, the stack uses a Last In First Out (LIFO). Stacks are common data structures in computers.

This much is enough for now, If you have any question or if you find something wrong then do tell me.

HTML 5 and security

Leave a comment

Gaming is not just a mere time pass,it’s something much more than that.
Now people compete in gaming and there are prizes to be won, people use to spend money over gaming to keep their score more than others, even there are so dedicated gamers that use to play almost 24×7.
Working as an HTML 5 game developer with Mintango technologies and a security guy from passion I came up with this though this is something very common but still worth sharing.

I believe almost all of you know about recent google’s olympic special doodles, and some us are more interested in getting good score and getting all those 3 medal and then take a snapshot and paste it over Facebook.

If you are seeing some of your friend’s good score that doesn’t really mean that the person really scored that as if you know a little bit of HTML then it’s very easy to fake your score, I am taking about manipulating the score not Photoshop.

It’s as very simple just right-click over the doodle and click inspect element (I did this over google crome) and then it’s going to redirect you to the HTML code, now simply search for the numbers which represent your score and change it to what you need it to be.

20

to

999
change the value from 20 to 999
and this will be like

Image before changing anything

and now the medals change the class from class=”hplogo_smh” to class=”hplogo_smg”
and tada you got one of the best score.

Why I am telling this story?

Don’t you think it’s very easy, indeed it is. But the question is if this is that easy then is it worth creating some serious kind of games using HTML 5.
I am not a (superhero :P) flash guy but I know that it is that secure that we may create some serious kind of games with that, though companys like zapak and other some are creating games which use to record the final score and then they use to distribute prizes which attract gamers to log on into there site.

I am not saying that it have to be like castle but we need this to be secure, as anyone may easily manipulate the score or the content which we are sending on server which is used or the anlysis of our score and comaparision of players.

I must confess that I never tried this with some big game as for that I need official permission from the server owner, If you got one then I would love to do test over 🙂

Will come up how to make things more secure and what changes we need to make serious gaming more serious.

conclusion:

it’s not that secure yet.

If ou have any questions then you may mail me or comment here.

Spoken tutorials!!

Leave a comment

Spoken-tutorial.org A place where you may learn most of the Opensource technologies,Software and Languages too where language is not a bar. 🙂
Hey all this is my second post and I am going to tell you something great which you should have to know spoken tutorials 🙂
Have you ever heard about that?
It’s a project by which you may earn and learn simultaneously.
It’s a project by National Mission on Education through Information Communication through Technology, launched by MHRD, Govt of India.
It’s being controlled by IITB and they are organizing there workshops throughout the country.
On 2-3 of October,2010 Prof. Kannan Moudgalya was in Jaipur with his team where I met him and worked with him for 2 days and find out Spoken tutorial to be very interesting. There is a lot for each and everyone and biggest thing is it’s all about FOSS 😉
They are accepting tutorials over any of the FOSS technology or software and length of every tutorial is just 10 min and they are paying about 2.5K for every tutorial of 10 min 🙂
The biggest thing is they are not specific to any one language i.e. English or Hindi they are accepting it in all the major languages of India that means Language is no more a problem in learning something.
If you think that you may dube some tutorial into your native language if it is not available then go ahead and they are paying for that too.
All the videos are available FREE to watch if you just want to learn from it.
C00l!! B-)
Now what you are thinking how to create this tutorial how to dube any tutorial???
It’s not really a big deal just navigate to the website and you are going to get Video tutorial even on these things.

Campus Ambassador
There is a program for students for being campus ambassador. By being a campus ambassador you are going to be the one who is going to promote Spoken tutorials in your campus and it’s going to look good in you CV too 🙂
Camus ambassador link is here
and if you want to apply for campus ambassador then hit me
What I am contributing?
I am working on submitting Nmap tutorials in here.
So if you want to learn about how to use Nmap and it’s other features then just go to this website and watch them 🙂
These tutorials are under not completed yet will post the link as soon as the tutorials are completed. 🙂
FAQ’s
Wiki Main page
Brochures are available over here

So, go and enjoy happy learning and earning.

Regards
unknown_had

Newer Entries