Thursday, November 28, 2019

Do you know CSRF attack ? Lets Understand Together

What is CSRF attack ? ✊


Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.

Image result for csrf


Impact : Stealing Password / Changing credentials existing logged user 



 How it will be done?


 1. I am simulating this scenario in my internal Lab setup.

 2. I have already setup which is vulnerable to CSRF( cross site scripting request forgery )

 












3.First create the  New user , i have created for testing purpose as  username raj and password as test@xxxx



4.Try to login with created account, remember this user password was test@xxx









5.Now test that web app is really vulnerable for XSS attacks , i found by simple script that it was vulnerable to XSS reflected attack.




6. Now we know webapplication is vulnerable and target the user whom we want to attack.

Note : User must be already logged in that webapplication

7.Now i am writing simple java script that will be executed from browser end and executes when ever user click on it.

<form action="http://192.168.56.103/bWAPP/csrf_1.php" method="GET">
        
        <p><label for="password_new">New password:</label><br />
        <input type="password" id="password_new" name="password_new" value="nasagoni"></p>

        <p><label for="password_conf">Re-type new password:</label><br />
        <input type="password" id="password_conf"  name="password_conf" value="nasagoni"></p>            <button type="submit" name="action" value="change">Change</button>   

    </form>

8.Send the above link to targeted user .(in values feild keep which password you want to keep )



9. Thats all when ever user click it will be redirected to our script page executes , now user password gets changed (as you kept in user value feild)

10. See below screen says password get changed




11.Now you can  do chnages to Raj  account , transfer money if it a bank application :-)
12👐👐✊✊✊✊.Hope you now familiar with this attack

Happy Hacking :0

Sunday, November 24, 2019

OSSEC-HIDS


OSSEC-HIDS 

[open source security -Host Intrusion Detection System]

Introduction :


OSSEC is a platform to monitor and control your systems. It mixes together all the aspects of HIDS (host-based intrusion detection), log monitoring, and Security Incident Management (SIM)/Security Information and Event Management (SIEM) together in a simple, powerful, and open source solution.


The following operating systems are supported by the OSSEC agent:

• GNU/Linux (all distributions, including RHEL, Ubuntu, Slackware, Debian, etc)
• Windows XP, 2003, Vista, 2008, 2012
• VMWare ESX 3.0,3.5 (including CIS checks)
• FreeBSD (all current versions)
• OpenBSD (all current versions)
• NetBSD (all current versions)
• Solaris 2.7, 2.8, 2.9 and 10
• AIX 5.2 and 5.3

Key Benefits:


Compliance Requirements

OSSEC helps customers meet specific compliance requirements such as PCI and HIPAA. It lets customers detect and alert on unauthorized file system modifications and malicious behaviour embedded in the log files of commercial products as well as custom applications. For PCI, it covers the sections of file integrity monitoring (PCI 11.5, 10.5), log inspection and monitoring (section 10), and policy enforcement/checking

Multi-platform:

OSSEC lets customers implement a comprehensive host  based intrusion detection system with fine grained application/server specific policies across multiple platforms such as Linux, Solaris, Windows, and Mac OS X

Real-time and Configurable Alerts:

OSSEC lets customers configure incidents they want to be alerted on, and lets them focus on raising the priority of critical incidents over the regular noise on any system. Integration with smtp, sms, and syslog allows customers to be on top of alerts by sending them to e-mail enabled devices. Active response options to block an attack immediately are also available

Integration with current infrastructure:

OSSEC will integrate with current investments from customers such as SIM/SEM (Security Incident Management/Security Events Management) products for centralized reporting and correlation of events.

Example : currently routing to  as below architecture Splunk

Key Features

File Integrity checking :

There is one thing in common to any attack to your networks and computers: they change your systems in some way. The goal of file integrity checking (or FIM - file integrity monitoring) is to detect these changes and alert you when they happen. It can be an attack, or a misuse by an employee or even a typo by an admin, any file, directory or registry change will be alerted to you.

Log Monitoring

Your operating system wants to speak to you, but do you know how to listen? Every operating system, application, and device on your network generate logs (events) to let you know what is happening. OSSEC collects, analyzes and correlates these logs to let you know if something suspicious is happening (attack, misuse, errors, etc). Do you want to know when an application is installed on your client box? Or when someone changes a rule in your firewall? By monitoring your logs, OSSEC will notify you.

Rootkit detection :

Criminal hackers want to hide their actions, but using rootkit detection you can be notified when the system is modified in a way common to rootkits. Active response Active response allows OSSEC to take immediate action when specified alerts are triggered. This may prevent an incident from spreading before an administrator can take action.

OSSEC Architecture :

Manager (server)
Manager (or Server) The manager is the central piece of the OSSEC deployment. It stores the file integrity checking databases, the logs, events, and system auditing entries. All the rules, decoders, and major configuration options are stored centrally in the manager; making it easy to administer even a large number of agents.

Agent

Agents The agent is a small program, or collection of programs, installed on the systems to be monitored. The agent will collect information and forward it to the manager for analysis and correlation. Some information is collected in real time, others periodically. It has a very small memory and CPU footprint by default, not affecting the system’s usage. Agent security: It runs with a low privilege user (generally created during the installation) and inside a chroot jail isolated from the system. Most of the agent configuration can be pushed from the manager.

Agent -less

Agentless For systems that an agent cannot be installed on, the agentless support may allow integrity checks to be performed. Agentless scans can be used to monitor firewalls, routers, and even Unix systems

Functions of each module ?

Work-flow :                                                                                                            

Internal Architecture :

 

File Directory Structure as below :

Description
Location of file

Installed at
/var/ossec

Main Configuration file
/var/ossec/etc/ossec.conf

Decoders stored at
/var/ossec/etc/decorders.xml

Binaries at
/Var/ossec/bin

Rules stored at
/var/ossec/rules/*.xml

Alerts
/var/ossec/logs/alerts.log

Agent Components
Syscheckd
File integrity
Rootcheckd
Malware and rootkits detection
Agentd
Forwards data to the server
Logcollectord
Read logs (Syslogs,wmi, flat files)
Server Components
Remoted
Receives data
Analysid
Process data
Monitord
Monitor agents








Installation Procedure of  OSSEC-HIDS:

On Ubuntu you will need the build-essential package in order to compile and install OSSEC. To install the package run the following command.
# apt-get install build-essential
If database support is needed mysql-dev or postgresql-dev should be installed. Run the following command to install these packages
# apt-get install mysql-dev postgresql-dev

Installation of server package :
Installation of OSSEC HIDS is very simple, the install.sh shell script automating most of it. There are a few questions to be answered before the installation will occur, one of the most important being which type of installation is desired. It is important to choose the correct installation type: server, agent, local, or hybrid.

1. Download the latest version and verify its checksum

# wget -U ossec  http://www.ossec.net/files/ossec-hids-2.8.1.tar.gz       //Server package//

# wget -U ossec  http://www.ossec.net/files/ossec-hids-2.8.1-checksum.txt  //verify hash value//


  2.  Extract the compressed package and the run the file (install.sh)

# tar -zxvf ossec-hids-*.tar.gz (or gunzip -d; tar -xvf)
# cd ossec-hids-*
# ./install.sh

Note :  Usually installed files will be present in   /home/InfoSec/


Step by step by configuration of server :

1.       What kind of installation do you want    :Server
2.       Where to install the OSSEC HIDS : at     /var/ossec
3.       Email notification (Yes /No) -Yes ,  
4.       Do you want to run integrity check daemon ? (Yes/No) : Yes
5.       Root kit detection engine (Yes/No) : Yes
6.       Active response allows : (Yes/No): 


Installing GUI :

1.       Download the package from  https://github.com/ossec/ossec-wui/archive/v0.8.tar.gz
2.       Extract to Desktop : # cd  /home/infosec/
                                  
                                    # tar xvf  v0.8.tar.gz

3.       Move extracted file (ossec-wui-0.8 ) to
                                 
 # mv   /home/infosec/ossec-wui-0.8   /var/www/html/

4.       Navigate to ossec-wui-0.8 directory and run setup.sh
1.       Try to install check apache2 server status by below command
                                 Service apache2  status | restart | start 

Configuration check if any problem troubleshoot as below 

#Cd /var/www/html/ossec-wui-0.8
#Chmod 770 tmp/
#Chgrp www-data tmp/
#apachectl restart
#service apache2 start
#usermod  -a -G ossec www-data
#apachectl restart
To get logs into desired location please run this command:
Cd /var/ossec/bin/
/var/ossec/bin/ossec-control enable client-syslog


Try to access Web-GUI via browser:


The etc/ossec.conf has 6 sections:
• global (global);
• rules (rules);
• syscheck (syscheck/rootcheck);
• alerts (alert);
• active-response (command/active-response);
•      * collector (localfile

Agent Installation on windows:

1.       Download the agent package from below link https://updates.atomicorp.com/channels/atomic/windows/ossec-agent-win32-3.1.0 5696.exe
2.       Install as normal package
      
3.      Run as administrator
4.      You see page as below
5.      Provide server IP as : xxxx
6.      Copy key from ossec-HIDS server and save restart.
Adding Agent on OSSEC-HIDS server & Extraction of Key :

   Goto below directory as below :
/var/osssec/bin/manage_agents
2choose A to add agent as below
cchoose E to extract key and paste the key to associated agent .

   *   If communication has not done kindly check logs at agent side located in path :

C:\Program Files (x86)\ossec-agent\ossec

If successfully connected you see logs as below :


Note : You must allow 1514 port from firewall if server and agent in different network
You check Alerts in below location :
#Cd /var/ossec/logs/alerts/
#nano  alerts.log


Conclusion:


OSSEC Reports On :


·        Common Web attack detections
·        XSS attempts
·        SQL injections
·        Windows authentication failure attempts
·        MySQL authentication attempt failed   detections
·        PostgreSQL authentication attempts failed detections
·        SonicWALL authentication attempt failed detections
·        RDP attempts failed detections
·        SSH service authentication attempts failed
·       Login authentication failed detections

HOW TO SEND ANONYMOUS EMAIL ?



HOW TO SEND ANONYMOUS EMAIL ?

Why we use anonymous emails is it just make your friends to fool or are do you use it for any professional practices purpose? but i strongly recommend that this tutorial is completely educational purpose only to make people aware of anonymous email , technically we called email spoofing.

Email Spoofing ?

Email which is sent behalf any organization name or any other email which you want send, you feel this email received from legitimate source, it will cause huge damage .


What actually this will used for ?

1.Phishing attacks 
2.Social Engineering attacks.


How actually it will be done , let's start without wait..........

Follow me .....:-D

1. Just look for target email address .(example : pruthviraj65.pr@gmail.com)

2. Go to this website  http://www.sendanonymousemail.net/





3. Write genuine email as shown below .



4. Receiver email you need put as victim (Target ) email address.

5. Type Subject as possible as genuine to make email come from trusted source.

6. Type Captcha and you done ... with configuring from your end ....



                                           

                                                                                                                       
        



Sunday, September 29, 2019

ePO Upgrade 👇

ePolicy Orchestrator Upgrade 👇

1.      Backup the all the product policy backups store in shared folder.
2.      Go with all pre-checks of Database and ePo servers as per McAfee Recommendations https://kc.mcafee.com/corporate/index?id=KB71825&page=content.

3.      Remove file inside of these below directory (No folders, only files inside it)
<epo_installation_directory>\Server\Temp
<epo_installation_directory>\Server\Logs
<epo_installation_directory>\DB\Logs
<epo_installation_directory>\Apache2\Logs

4.      Take the backup of below folders from ePO server as well.
SNO
FolderPath in ePO installation directory
File Actual name
Rename_If
1
C:\Program Files (x86)\McAfee\ePolicy Orchestrator\Server\extensions
Extensions
Not Renamed
2
C:\Program Files (x86)\McAfee\ePolicy Orchestrator\Server\conf
Conf
Not Renamed
3
C:\Program Files (x86)\McAfee\ePolicy Orchestrator\Server\keystore
Keystore
Not Renamed
4
C:\Program Files (x86)\McAfee\ePolicy Orchestrator\DB\Software
Software
Not Renamed
5
C:\Program Files (x86)\McAfee\ePolicy Orchestrator\DB\Keystore
Keystore
Yes as [DBKeystore]
6
C:\Program Files (x86)\McAfee\ePolicy Orchestrator\Apache2\conf
conf
Yes as [Apacheconf]

5.       Take Backup of SQL Database as below

               I.            Using SQL management console)
             II.            Select the McAfee ePO database
           III.            Right click database and select tasks and Backup (Select Fullbackup ).
           IV.            Select the location to where you wanted to store (Make file extension as .bak)





ePolicy Orchestrator installation and update checklist
Requirements
6.       Existing ePo version
5.3.2 (Build 156)
7.       Upgrade Version
5.9.1
8.       Supported Operating System
Windows server 2012 R2
9.       Processor Recommended
4 Cores
10.   RAM Recommended
8 GB
11.   System temp drive minimum size
2 GB
12.   Epo Installation drive( 3 Times than installation package)
X*3 = y GB
13.   Reduce the drive space requirement by purging log files and temp files from the ePO installation directory, before upgrading

1.       <epo_installation_directory>\Server\Temp
2.       <epo_installation_directory>\Server\Logs
3.       <epo_installation_directory>\DB\Logs
4.       <epo_installation_directory>\Apache2\Logs
18.   <epo_installation_directory>\Server\software managers (Recommended by McAfee as per meeting  scheduled)

19.   <epo_installation_directory>\Server\Eventparser files(Recommended by McAfee as per meeting  scheduled)
20.   Disable run immediately client tasks:

21.   Disable ePO server tasks

SERVER TEAM TASKS


22.   Make sure that the Windows 8.3 naming convention is enabled, Enable Windows 8.3 naming convention on the drive where McAfee ePO is installed.
1.       Click Start, Run, type regedit, and click OK.
2.       Navigate to, and select, the following registry key:
         [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]  

3.       Right-click NtfsDisable8dot3NameCreation, and select Properties or Modify.
4.       Modify the Value data from 1 to 0.
5.       Windows Server 2008 the default value is 2; you must change it to 0
6.       Restart
7.       To verify that 8.3 naming convention is enabled
         Start, Run, type cmd, and click OK
         Enter the command : dir /x

         Now we can see that folders now have a column for short names, for example, Progra~1 for Program Fi    

23 Windows scheduled tasks that might be set to run on the ePO server:
example : >http://www.sarayoo.info/how-to-turn-off-automatic-windows-update-on-windows-server-2012-and-server-2016/
24. latest patch & certificates 

25.   Ensure the id="orion.server.https" attribute is not missing from server.xml


26.   Disable remote Agent Handlers

I.            https://kc.mcafee.com/corporate/index?page=content&id=KB83298
II.            Do not disable any Agent Handlers in the Handler List page.
III.            Log on to the system where the Agent Handler is installed, open the Windows Services panel, and stop the McAfee Event Parser and McAfee Apache services.
IV.            External Agent Handler ALF1WPRDMZEPO01

SQL SERVER TASKS: 

Custom Indexes:  Need check with Database team on this if any custom index is created for ePo server :https://serverFQDN.:8443

27.   Ensure correct account permissions
                    I.            Public
                  II.            db_owner
Default database must be master 
1.            Click Start, Programs, Microsoft SQL Server, SQL Server Management Studio.
2.            Expand Security, Logins.
3.            Right-click the account and select Properties.
4.            Ensure the default database is set to master.
5.            Expand User Mapping and ensure that the account has dbo in the schema for the database

This account must be the db_owner in the database security properties 

1.            Click Start, Programs, Microsoft SQL Server, SQL Server Management Studio.
2.            Expand Databases, your ePO database, Security, Users.
3.            Right-click the dbo account and select Properties.
4.            Ensure that the account has dbo in the Default schema for the database.

If you use an NT account to authenticate to the ePO database, ensure that the account has Local Admin rights on the ePO server.


Verify the SQL instance that ePO is using  (Confirmed servername is listed in DB as  - RS)
1.       select @@servername
2.       go

 Ensure Auto Close is set to False for the ePO database   (Confirmed - RS)
1.     Click Start, Programs, Microsoft SQL Server, SQL Server Management Studio.
2.     Right-click the ePO database and select Properties.
3.     Click Options and ensure Auto Close is set to False. If it is not, click Auto Close, select False, and click OK.

Ensure Arithmetic Abort Enabled is set to True for the ePO database  (Was set to FALSE!  Changed to True per instructions - RS
                                 I.            Click Start, Programs, Microsoft SQL Server, SQL Server Management Studio.
                               II.            Right-click the ePO database and select Properties.
                              III.            Click Options and ensure Arithmetic Abort Enabled is set to True. If it is not, click Arithmetic Abort Enabled, selectTrue, and click OK.

Ensure the Compatibility level is set to 100 or higher for the ePO database   Click Start, Programs, Microsoft SQL Server, SQL Server Management Studio.
1.     Right-click the ePO database and select Properties.
2.     Click Options and ensure Compatibility level is set to 100 rather than 80 or 90. If it is not, select 100 from the Compatibility level drop-down list and click OK.

Verify the correct DB collation is set on the SQL server  (Coll Level is default SQL_Latin1_General_CP1_CI_AS - RS)
1.     Click Start, Programs, Microsoft SQL Server, SQL Server Management Studio.
2.     Log on to the server using Windows Authentication or SQL Server Authentication, as applicable.
3.     In Object Explorer, expand Databases, and locate the ePO database.
4.     Right-click the ePO database and select Properties.
5.     Review the Collation field in the General page.
See KB73717 for detailed information on supported collation types for ePO.

Ensure the SQL browser service is running  
1.     Click Start, Run, type services.msc, and click OK.
2.     Locate the SQL Server Browser service and ensure that it is started and running.
3.     If it is not, right-click the SQL Server Browser service and select Start.

To avoid the issue documented in KB76645 if you are using Microsoft SQL 2008 R2 or earlier, ensure that Microsoft KB 2653857 is applied on the SQL server. If that is not possible, disable SQL Force Encryption before upgrading if it is enabled

Ensure that the ePO admin and SQL account usernames and passwords meet the criteria
  
26.Disable VSE Access Protection

Perform a preventative measure to avoid Tomcat failing to stop
        I.            Click Start, Run, type services.msc, and click OK.
      II.            Stop the ePolicy Orchestrator Server Service and ePolicy Orchestrator Event Parser Service.
    III.            Restart the ePolicy Orchestrator Application Server Service.
    IV.            Right-click the installer setup.exe and run it as an administrator




28.   Download both the ePO 5.9.1 installer and our Pre-Install Auditor. They are in your existing ePO Software Manager.  Enter "McAfee ePolicy Orchestrator 5.9 in the search window
(Requires Password of DB /Windows Login
29.   ePo Database hosted  Window server  name
Epo Database server hostname
30.   ePo Database name
DB name
31.   service account of AD to sync LDAP
Pwd: ******
32.   ePo Database hosted  Window server  username
Username :****

Upgrade Steps:

33.   Download the ePO 5.9.1 setup file it usually as zip and extract it.
34.   Before running setup, file make sure that you check compatibility of setup file.
35.   To Run this compatibility, you required ePo Administrator password.
36.   Check for the patch if require if not upgrade will fail


  
37.   Run the patch setup in ePO server and follow the instructions take help from server team if required.
38.   Once Patch is updated you need to reboot the server.
39.   If everything fine , Run the setup of ePO 5.9.1 and proceed accordingly.
40.   SQL credentials also required for the upgrade to run and ePO Administrator password also required.
41.   Once it start license information then it will take huge hours then finish it.
42.   Check the all McAfee services and Apache other make sure everything looks fine.
43.   Sometime it will show you certificate errors suggest articles also.
44.   Login to ePO and certification manager and regenerate and Activate it.
45.   Don’t finish and restart the McAfee ePolicy Orchestrator services.
46.   Login back and verify the certificate and finish activation finally.




Note: if any communication issue please do follow the steps(If Certificate mismatch only perform)


1.Rename the SSL.CRT folder (see path below) to SSL.CRT.OLD and manually create an empty folder named SSL.CRT in the same path. If you do not, the setup fails to create a new certificate:

64-bit: "C:\Program Files (x86)\McAfee\ePolicy Orchestrator\Apache2\conf\ssl.crt"
32-bit: "C:\Program Files\McAfee\ePolicy Orchestrator\Apache2\conf\ssl.crt"
  2.Click Start, type cmd in the search field, right-click, and select Run as administrator.

3.Change directories to your ePO installation directory.
Default paths:

64-bit: D:>  cd Program Files (x86)\McAfee\ePolicy Orchestrator\
32-bit: Program Files\McAfee\ePolicy Orchestrator\
  
4.Run the following command:
 Syntax:
Rundll32.exe ahsetup.dll RunDllGenCerts <ePO_server_name> <console_HTTPS_port> <admin_username> <password> <"installdir\Apache2\conf\ssl.crt">
 Example:
Rundll32.exe ahsetup.dll RunDllGenCerts alf1wprdmepo01  8443 <***ePO_username > <ePO_Admin_Password***> "installdir\Apache2\conf\ssl.crt"

Note: Login to ePO server ( ePO Eventparser stop, ePO server service stop)
Start again
Where:
<ePO_server_name> is your ePO server NetBIOS name
<console_HTTPS_port> is your ePO console port (default is 8443)
<admin_username> is admin (use the default ePO admin console account)
<password> is the password to the ePO admin console account
<installdir\Apache2\conf\ssl.crt> is your installation path to the Apache folder; Default installation path:

64-bit: "C:\Program Files (x86)\McAfee\ePolicy Orchestrator\Apache2\conf\ssl.crt"
32-bit: "C:\Program Files\McAfee\ePolicy Orchestrator\Apache2\conf\ssl.crt"

Example
Rundll32.exe ahsetup.dll RunDllGenCerts epo_server_name 8443 username  administrator password "C:\Program Files\McAfee\ePolicy Orchestrator\Apache2\conf\ssl.crt"