Showing posts with label metasploit. Show all posts
Showing posts with label metasploit. Show all posts

Friday, August 3, 2012

exploit/windows/smb/psexec

Microsoft Windows Authenticated User Code Execution

"This module uses a valid administrator username and password (or password hash) to execute an arbitrary payload. This module is similar to the "psexec" utility provided by SysInternals. This module is now able to clean up after itself. The service created by this tool uses a randomly chosen name and description."

So all you need is an administrator account credentials

PsExec is a light-weight telnet-replacement that lets you execute processes on remote systems.
e.g:  psexec \\ZEAGLE -u test -p test ipconfig

which execute "ipconfig" command on remote computer "ZEAGLE" with ADMINISTRATOR (must be  administrator ) account "test" and password "test".




One great method with psexec in metasploit is it allows you to enter the password itself, or you can simply just specify the hash values, no need to crack to gain access to the system. Let's think deeply about how we can utilize this attack to further penetrate a network. Lets first say we compromise a system that has an administrator password on the system, we don't need to crack it because psexec allows us to utilize just the hash values, that administrator account is the same on every account within the domain infrastructure. We can now go from system to system without ever having to worry about cracking the password. One important thing to note on this is that if NTLM is only available (for example its a 15+ character password or through GPO they specify NTLM response only), simply replace the ****NOPASSWORD**** with 32 0's for example:
******NOPASSWORD*******:8846f7eaee8fb117ad06bdd830b7586c
Would be replaced by:
00000000000000000000000000000000:8846f7eaee8fb117ad06bdd830b7586c




Wednesday, August 1, 2012

auxiliary/server/capture/XXXX part-1



auxiliary/server/capture/ftp

This module provides a fake FTP service that is designed to capture authentication credentials.
I've used FileZilla for logins

[used FileZilla to pentest login]




auxiliary/server/capture/smb


This module provides a FAKE SMB service that can be used to capture the challenge-response password hashes of SMB client systems.

Responses sent by this service have by default the configurable challenge string (\x11\x22\x33\x44\x55\x66\x77\x88), allowing for easy cracking using Cain & Abel, L0phtcrack or John the ripper (with jumbo patch).

To exploit this, the target system must try to authenticate to this module. The easiest way to force a SMB authentication attempt is by embedding a UNC path (\SERVER\SHARE) into a web page or email message. When the victim views the web page or email, their system will automatically connect to the server specified in the UNC share (the IP address of the system running this module) and attempt to authenticate.

SMB: Server Message Block (SMB), also known as Common Internet File System (CIFS) used for providing shared access to files, printers, serial ports, and miscellaneous communications between nodes on a network.

http://en.wikipedia.org/wiki/Server_Message_Block

http://oss.sgi.com/LDP/HOWTO/SMB-HOWTO-8.html

To test accessing the fake server and put the password »
smbclient -L [serverip] -U [username]
smbclient -L 192.168.45.1 -U test


To crack the password hash »
john JOHNPWFILE






auxiliary/server/capture/pop3

This module provides a fake POP3 service that is designed to capture authentication credentials.



[used Microsoft Outlook for pentest login]






auxiliary/server/capture/telnet

auxiliary/server/capture/smtp





 


Sunday, July 29, 2012

Notes on Metasploit

1-How to stop running server?
jobs >> kill


2-How to set global variable? use SETG instead of SET

3-All CAPTURE Auxiliary modules (auxiliray/server/capture/XXXX) are used to create FAKE services that is designed to capture authentication credentials.

4-When it's "RHOSTS", that means you can define a range of ip addresses, BUT you can't specify that range by for example 192.168.1.1-254 or 192.168.1.,2,3,4 :(



auxiliary/scanner/telnet/

setting up the environment:

windows machine:

Control Panel\Programs\Programs and Features >> turn windows features on or off >> check Telnet server
run >> services.msc >> Telnet >> start
Till now you can login with the administrator credential,
to permit another account >> Control Panel\System and Security\Administrative Tools >> computer management >> system tools >> local users and groups >> Groups >> TelnetClients, then add another account
[the server accounts must have password]

Backtrack machine:

you can test the server by :
telnet [server_ip]

scanner/telnet/telnet_version

Used to detect telnet version on remote system



scanner/telnet/telnet_login

This module will test a telnet login on a range of machines and report successful logins






login successful





scanner/telnet/telnet_encrypt_overflow
scanner/telnet/lantronix_telnet_version



auxiliary/scanner/ssh/

Metasploit auxiliray modules come with four SSH scanners namely,
  1. scanner/ssh/ssh_version 
  2. scanner/ssh/ssh_login 
  3. scanner/ssh/ssh_identify_pubkeys 
  4. scanner/ssh/ssh_login_pubkey

All are used against a RANGE of IPs, so most of the other modules, and that  is the damn good advantage of auxiliary modules. BUT you need to specify one ip by another, you can't use for example xx.xx.xx.1-254 or xx.xx.xx.1,2,3,4 :(

There are two types of SSH authentication, USERNAME-PASSWORD and PRIVATE-PUBLIC KEYS.
USERNAME-PASSWORD authentication is simply the user and password of a user on the local machine. key authentication is an alternative to user-pass authentication, simply the public key is the server-side and the private key is the remote-side.


auxiliary/scanner/ssh/ssh_version
This module is used to detect SSH version on a range of ip addresses 




auxiliary/scanner/ssh/ssh_login

This module will test ssh logins on a range of machines and report successful logins

[SSH login is simply a server account login]



auxiliary/scanner/ssh/ssh_identify_pubkeys

This module can determine what public keys are configured for key-based authentication across a range of machines, users, and sets of known keys
set KEY_FILE to whether the puplic key path or the private key path



auxiliary/scanner/ssh/ssh_login_pubkey

This module will test ssh logins on a range of machines using a defined private key file, and report successful logins




Puplic-private key authentication is an alternative to Username-password authentication. Demo:

To generate Puplic-private authentication key:

ssh-keygen -t rsa

This will generate 2 files, located in /root/.ssh/

public key "id_rsa.pub" >> for the server
private key "id_rsa" >> for the client

To register that key, you need to add the .pub to /root/.ssh/authorized_keys, automatically by using:


ssh-id-copy -i /root/.ssh/id_rsa.pub [user@server_ip]

To test your registered key:
ssh -i [private_key] [server_ip]


http://linuxconfig.org/Passwordless_ssh



Saturday, July 28, 2012

auxiliary/scanner/discovery/arp_sweep

This module scan a range of ip addresses to identify hosts alive and missing on the local Ethernet