Spawn the shell

24
Spawning Reverse Shell Spawning Reverse Shell Anytime With Any IP ! Anytime With Any IP ! Bhaumik Merchant Bhaumik Merchant

description

Spawning reverse shell, Anytime with any IP!

Transcript of Spawn the shell

Page 1: Spawn the shell

Spawning Reverse ShellSpawning Reverse ShellAnytime With Any IP !Anytime With Any IP !

Bhaumik MerchantBhaumik Merchant

Page 2: Spawn the shell

Author And Speaker at….

Page 3: Spawn the shell

Objectives

• Reverse shell basics• Advance reverse shell method• Dynamic DNS concepts• Demo

Page 4: Spawn the shell

Let’s Consider One Scenario To Understand Reverse Shell Attack……

• Jack works in a corporate environment which is protected by IPSs , IDSs , Firewalls etc.

• He plans for an attack , and decides to plant reverse shell , because few security mechanisms permit some amount of out bound traffic.

• He wants to spawn the shell from his office machine to home machine after 6 p.m, i.e. once he reaches his home.

Page 5: Spawn the shell

• Jack wants one live system which is up and going, plus a handler running on it at his place, to receive the shell.

• Jack must know the IP address of his home machine before planting the shell in the office machine.

Page 6: Spawn the shell

Then what is the roadblock for Jack?

Page 7: Spawn the shell

• Jack’s home machine should be working during the office hours with the handler listening on some port to get the shell .

• Jack should know the IP address of his home machine before planting the shell into office machine.

• But if he is using PPP or DHCP mechanism then IP address will change for each connect and disconnect. (ISPs allocates Dynamic IP to home users, e.g. Home Routers , Internet Dongles)

Page 8: Spawn the shell

What Is The Original Problem In Following The Formal Way To Spawn Reverse-Shell?

• Your Place• Your Time• Your IP

Page 9: Spawn the shell

#include < reverse-shell.h>

Page 10: Spawn the shell

One• Handler started in the attacker machine.

Two

• Payload transfer phase from attacker to victim machine.

Three• Reverse Shell or msf payload injected in the victim’s

machine.

Four• Attacker get’s victim’s bash/cmd (Attack !! )

Page 11: Spawn the shell

Formal Way To Spawn The Reverse Shell !

Attacker

Handler Started In The Attacker’s Machine

Inject Shell Into The Victim’s Machine

Handler Gets The Reverse Shell

Game Over !

Page 12: Spawn the shell

Formal Flow Of Reverse-Shell - IAttacker

Start Handler

If Handler Is Started ?

Wait For Reverse-Shell

Get Reverse-Shell

Game Over !

Yes

No

Page 13: Spawn the shell

Dynamic Flow Of Reverse-Shell - IIAttacker

Start Handler

If Handler Is Started ?

Wait For Reverse-Shell

Get Reverse-Shell

Game Over !

Yes

YesHandler started or may not have started but still you can plant reverse shell

Page 14: Spawn the shell

Base Level Mechanism (Diagram)

EXE - I

EXE - II

EXE-I :- Existence check for attacker , whether online or offline

EXE-I I :- Transfer reverse shell to attacker machine, Any Payload.

Synchronous Execution

Page 15: Spawn the shell

So How It Works (I) ?

Attacker Machine Listening For Reverse Shell

Victim’s Machine Sends Some Packets To Check

The Existence Of Attacker

EXE – I In Execution

A

V

Page 16: Spawn the shell

So How It Works (II) ?

Attacker Machine Listening For Reverse Shell

Victim’s Machine Sends Some Packets To Check

The Existence Of Attacker

Execution Of EXE – I Completed !

A

V

Page 17: Spawn the shell

So How It Works (III) ?

Attacker Machine Listening For Reverse Shell

Victim’s Machine Sends Some Packets To Check

The Existence Of Attacker

Execution Of EXE – II Started N Game Over !

A

V

Page 18: Spawn the shell

#include < my-method.h>

Page 19: Spawn the shell

Dynamic Flow Of Reverse-Shell - IIAttacker

Start Handler

If Handler Is Stared ?

Wait For Reverse-Shell

Get Reverse-Shell

Game Over !

Yes

YesHandler is started or may not have been started but still you can plant reverse shell

Page 20: Spawn the shell

While(true){

if( icmp reply from hh2012.dynamic-update.com){

break;}

}

Void Reverse_Shell_Transfer(){

Transfer Reverse Shell;}

How To Program it ?

Page 21: Spawn the shell

Captured DNS Request Made By Normal Browser

Page 22: Spawn the shell

Captured DNS Request Made By Our EXE In Live Attack

Page 23: Spawn the shell

Let’s Get Our Hands Dirty !

#include < demo.h>

Page 24: Spawn the shell

[email protected]@indusface.com

Thank You