Pages

Showing posts with label IDS_IPS. Show all posts
Showing posts with label IDS_IPS. Show all posts

Setting up IDP on the Juniper SRX

Trước khi thực hiện: SRX cần ra được Internet, cấu hình DNS


Intrusion Detection Prevention (IDP); or sometimes known as IPS, is a feature of the Juniper SRX range. IDP is available on the branch SRX’s all the way through to the datacentre versions and is a fantastic item under the IT Services feature set. IDP is particularly useful as another layer of security to inspect data transmissions between client and server and perform an actions upon it, a good example is IDP’s ability to detect known Shell code buffer overflow exploits that are out there in the wild and stop them in their tracks AND also block that IP for set period of time, like 1 hour, 1 day or a week! These buffer overflow style attacks are typically launched at a server once traditional enumeration steps have been performed by the remote attacker. To thwart the enumeration attacks juniper makes use of SCREENS, but that is a discussion for another time.
so how do we configure an SRX for IDP?
Step by Step IDP configuration
The first thing you do is tell the Juniper were to get the latest packages for the IDP updates from

root@iLab.SRX#set security idp security-package url https://services.netscreen.com/cgi-bin/index.cgi
root@iLab.SRX#commit
Next we download the packages to the device, first checking that the we can see the update server, the actually downloading the packages
root@iLab.SRX> request security idp security-package download check-server
Download is already in progress..

root@iLab.SRX> request security idp security-package download
Download is already in progress..
you can monitor the status of the IDP package download with the following command, just keep checking the status until you get the completed notification
root@iLab.SRX> request security idp security-package download status    
In progress: Downloading ..

Check again;
root@iLab.SRX> request security idp security-package download status   
Done;Successfully downloaded from(https://services.netscreen.com/cgi-bin/index.cgi).
Version info:2946(Thu Jul  6 01:10:33 2017 UTC, Detector=12.6.130170603)

Once the download of the IDP definitions is complete we install those definitions

root@iLab.SRX> request security idp security-package install
Will be processed in async mode. Check the status using the status checking CLI

check status: 
root@iLab.SRX> request security idp security-package install status
In progress:performing DB update for an xml (SignatureUpdate.xml)

check again;
root@iLab.SRX> request security idp security-package install status   
Done;Attack DB update : successful - [UpdateNumber=2946,ExportDate=Thu Jul  6 01:10:33 2017 UTC,Detector=12.6.130170603]
     Updating control-plane with new detector : successful
     Updating data-plane with new attack or detector : not performed
      due to no active policy configured.

Get policy templates;
root@iLab.SRX> request security idp security-package download policy-templates
Will be processed in async mode. Check the status using the status checking CLI

root@iLab.SRX> request security idp security-package download status 
Done;Successfully downloaded from(https://services.netscreen.com/cgi-bin/index.cgi).
Version info:2946

Install policy templates

root@iLab.SRX>request security idp security-package install policy-templates                    
Will be processed in async mode. Check the status using the status checking CLI

root@iLab.SRX> request security idp security-package install status 
Done;policy-templates has been successfully updated into internal repository
     (=>/var/db/scripts/commit/templates.xsl)!

Here is the results
root@iLab.SRX# set security idp idp-policy ?
Possible completions:
  <policy-name>        IDP policy name
  Client-And-Server-Protection  IDP policy name
  Client-And-Server-Protection-1G  IDP policy name
  Client-Protection    IDP policy name
  Client-Protection-1G  IDP policy name
  DMZ_Services         IDP policy name
  DNS_Service          IDP policy name
  File_Server          IDP policy name
  Getting_Started      IDP policy name
  IDP_Default          IDP policy name
  Recommended          IDP policy name
  Server-Protection    IDP policy name
  Server-Protection-1G  IDP policy name
  Web_Server           IDP policy name
[edit]

We have 2 ways to use IDP:
1. active IDP default and use the available templates
2. we create the actual IDP rule and then apply these to policy

To monitor the effectiveness of the IDP policies, you can perform the following commands. The ‘attack table’ command shows how many and what type of exploits have been launched at your servers and is quite informative
> show security idp active-policy
> show security idp attack table
> show security idp status
> show security idp application-statistics

Install and Use ClamAV - Antivirus


1.      Yêu cầu hệ thống

-       CentOS 5/6 (32bit or 64bit)
-       zlib and zlib-devel packages
-       GCC C and C++ compilers (gcc-c++)
-       bzip2 and bzip2-devel library
-       Python (version 2.5.4 or newer)
-       GNU Libtool Dynamic Module Loader (libtool-ltdl)

2.      Cài đặt ClamAV

-       Tải và cài đặt thư viện zlib, zlib-devel, gcc-c++, libtool-ltdl
#yum -y install zlib zlib-devel gcc-c++ libtool-ltdl

-       Tải các gói cài đặt của ClamAV
#cd /usr/local/src

For 32 bit (CentOS 6):
#wget http://pkgs.repoforge.org/clamav/clamav-0.98-2.el6.rf.i686.rpm http://pkgs.repoforge.org/clamav/clamav-db-0.98-2.el6.rf.i686.rpm http://pkgs.repoforge.org/clamav/clamav-devel-0.98-2.el6.rf.i686.rpm http://pkgs.repoforge.org/clamav/clamd-0.98-2.el6.rf.i686.rpm

For 64 bit (CentOS 6):
# wget http://pkgs.repoforge.org/clamav/clamav-0.98-2.el6.rf.x86_64.rpm http://pkgs.repoforge.org/clamav/clamav-db-0.98-2.el6.rf.x86_64.rpm http://pkgs.repoforge.org/clamav/clamav-devel-0.98-2.el6.rf.x86_64.rpm http://pkgs.repoforge.org/clamav/clamd-0.98-2.el6.rf.x86_64.rpm

·        Lưu ý: Tất cả các packages nên lưu tại /usr/local/src để tiện việc quản lý. Phiên bản mới nhất tại thời điểm viết tài liệu này là 0.98-2.

-       Cài đặt packages của ClamAV
#rpm -Uvh clam*

3.      Cập nhật database antivirus

-       Download file main.cvd, daily.cvd, bytecode.cvd, safebrowsing.cvd trên trang www.clamav.net
-       http://db.local.clamav.net/safebrowsing.cvd
-        Overwrite copy vào thư mục chứa database của ClamAV /var/clamav

4.      Sử dụng ClamAV

-       Bật service ClamAV
#service clamd start

-       Auto-start khi boot hệ thống
#chkconfig clamd on

-       Quét toàn bộ hệ thống
#clamscan

5.      Lập lịch quét hệ thống

-       Quét vào Chủ Nhật hàng tuần
#crontab -e

0 7 * * sun /usr/bin/clamscan

DoS command on kali linux

1. Hping3

hping3 should be used to…

- Traceroute/ping/probe hosts behind a firewall that blocks attempts using the standard utilities.
-  Perform the idle scan (now implemented in nmap with an easy user interface).
- Test firewalling rules.
- Test IDSes.
- Exploit known vulnerabilties of TCP/IP stacks.
- Networking research.
- Learn TCP/IP (hping was used in networking courses AFAIK).
- Write real applications related to TCP/IP testing and security.
- Automated firewalling tests.
- Proof of concept exploits.
- Networking and security research when there is the need to emulate complex TCP/IP behaviour.
- Prototype IDS systems.
- Simple to use networking utilities with Tk interface.

DoS using hping3 with random source IP


Let me explain the syntax’s used in this command:
  1. hping3 = Name of the application binary.
  2. -c 100000 = Number of packets to send.
  3. -d 120 = Size of each packet that was sent to target machine.
  4. -S = I am sending SYN packets only.
  5. -w 64 = TCP window size.
  6. -p 21 = Destination port (21 being FTP port). You can use any port here.
  7. --flood = Sending packets as fast as possible, without taking care to show incoming replies. Flood mode.
  8. --rand-source = Using Random Source IP Addresses. You can also use -a or –spoof to hide hostnames. See MAN page below.
  9. www.hping3testsite.com = Destination IP address or target machines IP address. You can also use a website name here. In my case resolves to 127.0.0.1 (as entered in /etc/hosts file)
===> Logs on Graylog server : 
Another command:
-Simple SYN flood - DoS 
#hping3 -S --flood -V domain/IP
- Simple SYN flood with spoofed IP - DoS
#hping3 -S -P -U --flood -V --rand-source domain/ip

2. nping
Command: #nping -help
#nping --tcp-connect -rate=90000 -c 900000 -q domain/ip


tham khảo: www.blackmoreops.com

Ossec: Khái niệm và cài đặt Ossec trên Centos

1. Lý thuyết

            - là HIDS , mã nguồn mở.
            - Quản lý log tập trung, theo thời gian thực, phân tích log truy cập.
            - Kiểm tra tính toàn vẹn(windows, linux,...)
            -Kiểm tra registry (windows)
            -Tính toàn vẹn của tập tin, thư mục...
            - Phát hiện rootkit
            - phát hiện tấn công
            - Phản ứng với các cuộc tấn công.
            * Các thành phần của Ossec
           

         
       * Các Luật trong ossec (rule)
                
       

3.2. Cài đặt và cấu hình

                Lab: cài đặt server trên: logs.thudv.com - ip:192.168.22.2
                                                Agent: centos.thudv.com - ip:192.168.k
                - Gói  cài đặt tại thời điểm làm lab: ossec-hids-2.8.2
                - Yêu cầu cài đầy đủ các gói sau.
                        #yum install mysql-devel postgresql-devel
                        #yum install gcc
            !!nếu thiếu sẽ báo lỗi : Error : 0x5.... không cài được.
* Cài đặt :        #tar -zxf ossec-hids-2.8.2.tar.gz
                        #cd ossec-hids-2.8.2
           

            - Cài đặt lần lượt theo yêu cầu: cài server hoặc agent..
               
- Cấu hình theo luồng cài đặt

- Add agent .... /var/ossec/bin/manage_agent
- Extract key cho agent.
- copy key này dán vào agent để  được active
-Restart server và agent.
- Kiểm tra xem agent đã được active chưa.
- Các lệnh khi vận hành
             #/var/ossec/bin/ossec-control start (or stop/restart)                                       
* Chỉnh sửa cấu hình trên server: vi /var/ossec/etc/ossec.conf
            - Để monitor file, directory tham khảo cấu hình : http://ossec-docs.readthedocs.org/en/latest/manual/syscheck/
*Update:
            Download lastest package và cài đặt bình thường. Ossec sẽ tự động phát hiện ra cài đặt trước đó và sẽ hỏi:
               - You already have OSSEC installed. Do you want to update it? (y/n): y
            Hai file local_rules.xml và local_decoder.xml sẽ không bị chỉnh sửa trong quá trình nâng cấp
            Tiếp đến sẽ hỏi:
- Do you want to update the rules? (y/n): y

* Kiểm tra ossec có gửi mail về mailserver không ???

==> Check
a) Check /var/ossec/logs/alerts/alert.log
b) Check /var/log/ossim/agent.log
c) Check /var/log/ossim/server.log
kiểm tra log theo ngày: ví dụ: vi /var/ossec/logs/alerts/2016/Jan/ossec-alerts-23.log

==> muốn monitor file or folder chỉnh sửa file ossec.conf tại syscheck (chỉ cần chỉnh ở agent) chỉ đường dẫn tới file cần monitor. Chú ý thêm về level nữa. cấu hình level alert để bắt đầu send mail.

Adsense

Translate