howto – UNAM-Chapter – The honeynet Project https://blog.honeynet.org.mx Thu, 03 Sep 2015 14:51:22 +0000 en-US hourly 1 97611161 PNAF 0.1.2 basic howto https://blog.honeynet.org.mx/pnaf-0-1-2-basic-howto/ Thu, 03 Sep 2015 12:59:15 +0000 http://blog.honeynet.org.mx/?p=210 The goal of this article is to present a basic howto of Passive Network Audit Framework (PNAF), a PNA (Passive Network Audit) based framework that can be use as useful tool to perform network audits in a passive way by taking advantages from different network traffic analysis tools. The scope of this article includes installation, configuration and basic execution models to extract, parse and interpret information from PCAP files as single input. For additional information about the theoretical model, you can check its original source (masters thesis)[1] , as well as the article (in Spanish)  “Frameworks para monitoreo, forense y auditoría de tráfico de red” published in edition 24th of the digital magazine .Seguridad .

Explore this article (English)  (Spanish)

The content of this article was published (in Spanish) in the edition 25th of the digital magazine .Seguridad of UNAM-CERT.


 

CONTENT

 

Introduction

PNAF v0.1 public prototype is an implementation of a TU/e masters thesis developed as internship project at Fox-IT B.V in The Netherlands. This public prototype DOES NOT include any internal information about TU/e nor Fox-IT.

From Version 0.1.2, PNAF is a project of UNAM-Chapter [The Honeynet Project]

Main development repository

News, updates and howtos

Resources downloads

Version 0.1.2 will get just minor updates (bugs/parsing) and it is the last version of 0.1.x branch. You can either clone this repository and install it on your standalone machine, or download the Virtual Machine image available on http://pnaf.honeynet.org.mx/download/

Summary

PNAF is a framework intended to provide the capability of getting a security assessment of network platforms by analysing in-depth the network traffic (in a passive way) and by providing a high-level interpretation in an automated way. It combines different analysis techniques and tools. The framework is intended to achieve the following goals:

Architecture

  • To be a flexible, scalable and modular framework
  • To provide accurate analysis of network platforms
  • To provide a useful API in order to develop further features and improvements (not included on 0.1.2 prototype, but on 0.2.x)

Functional

  • Summary of the security level of the network
  • Findings of anomalous activities
  • Findings of security audit policy
  • Findings of impact analysis (e.g. based on CVE)
  • Summary of security recommendations
  • Reference of evidence

ARCHITECTURE

PNAF (original prototype) is comprised by three main modules. Each module has its own engines which manage specific tools and process the data. PNAF is written in Perl, why? because Perl rules!

DCM – DATA COLLECTION MODULE

  1. NTCE – Network Traffic Capture Engine
  2. NCPE – Network Traffic Pre-processing Engine

DPM – DATA PROCESSING MODULE

  1. NPEE – Network Profiling and Enumeration Engine
    • p0f : Network and service enumeration
    • prads : Network and service enumeration
  2. IDSE – Network Intrusion Detection Engine
    • Suricata
    • Snort
    • Bro
    • Barnyard : Unified2 reader
  3. NFAE – Network Flow Analysis Engine
    • Cxtracker : Basic flow data summary
    • Argus : Flow data analysis
    • Yaf : Flow data analysis
    • Silk : Flow data analysis
    • Tcpdstat : Protocol statistics
  4. DPIE – Deep Packet Inspection Engine
    • Chaosreader : Application data extraction “any-snarf”
    • Nftracker : File extraction
    • Xplico : Application data extraction (url, files, …)
    • Httpry : HTTP data logger
    • Ssldump : SSLv3/TLS data tracker
    • Dnsdump : DNS data extraction
    • PassiveDNS : Passive DNS data collection
    • Dnscap : DNS capture utility (tcpdump-like for DNS)
    • Tcpxtract : File extraction
    • Tcpdump : Pcap filtering
  5. NSAE – Network Security Audit Engine
    • Pnaf-auditor

DVM – DATA VISUALIZATION MODULE (TODO — Dev)

  • WDVE – Web Data Visualization Engine
  • GSVE – Graphic Security Visualization Engine
  • SARE – Security Audit Report Engine
  • DIEE – Data Import/Export Engine

 

General model of PNAF

The general model of PNAF (Figure 1) defines the workflow of how PNAF decodes, filters and interprets data from network traffic capture files as single input.

fig01_pnaf_modelo

Figure 1. Workflow of Passive Network Audit Framework (PNAF)

 

INSTALLATION MODES

PNAF includes a set of tools[2] for capturing and analysis of network traffic such as passive profilers, IDS, protocol decoders, etc. Since some of these tools are quite complex by themselves, they may involve complex installation processes as well. Thus, PNAF is designed not only to use the set of tools in an automated way, but also to facilitate their integration by implementing clean and easy ways to deploy the whole unified framework. There are four main installation modes which are explained in the sections below.

Installation using installer

PNAF includes an installer that automates the downloading, compilation and configuration of all the tools included within the framework. This installer is a shell script (bash) that provides a wizard based on dialog. In order to use this installation mode, it is necessary to meet the following requirements:

  • Debian GNU/Linux 7 or later (8.x recommended) o Gentoo stage 3.x.
  • Internet connection during installation process (the installer downloads and installs some libraries and other dependencies via Apt or Emerge), as well as some Perl modules through CPAN.

 

It may be possible to make PNAF work under Ubuntu or any other GNU/Linux distribution based on Debian APT packages. However, it would imply checking of all the libraries’ equivalences corresponding with such distributions. Moreover, it may be possible to use the installer under other systems which are not based on APT nor Emerge. To do so, you would need to install all needed dependencies manually and then make some small changes on the installer itself. For more information you can check the list of dependencies on README file. Further versions of PNAF are planned to include additional support for the installer as well as additional automated (easier) ways to deploy it (e.g. containers).

 

Since PNAF needs to install a lot of libraries and dependencies that may cause compatibility issues with the native system, then it is recommended to install PNAF within a chroot environment. This article explains how to perform the installation using chroot.

Thus, assuming that a Debian 8 (amd64) system is used:

1. Generation of chroot environment (via debootstrap)

  # aptitude install debootstrap
  # debootstrap --arch amd64 jessie chroot_pnaf http://ftp.nl.debian.org/debian
  # mount -t sysfs sysfs   chroot_pnaf/sys
  # mount -t proc proc     chroot_pnaf/proc
  # mount -o bind /dev     chroot_pnaf/dev
  # mount -o bind /dev/pts chroot_pnaf/dev/pts

Then switch to the chroot environment:

  # chroot chroot_pnaf
  # cd ~

2. Download PNAF

Option 1: From its official repository (main development site)

 # aptitude install git
 # git clone https://dev.honeynet.org.mx/traffic-analysis/pnaf.git


Option 2: From github (mirror)

 # git clone https://github.com/jusafing/pnaf

Once pnaf latest release is downloaded, get into the directory and execute the installer.

 # cd pnaf
 # ./install.sh

This will execute the installer wizard. First it is necessary to confirm that you want to install PNAF on the system. Afterwards, it is possible to choose what tools will be installed. Despite the fact that in version 0.1.2 not all the tools are used, it is recommended to install all the listed tools. Thus, PNAF installer by itself can be considered as an automated and easy tool to deploy a set of network traffic analysis tools..

fig02_pnaf_installer2

Figure 2. Selection of tools within PNAF installer

If it is the very first time that PNAF is installed on the system, then it should be a “clean installation”. Otherwise, in case of PNAF is already on the system, a clean installation will delete any tool and configuration previously set. So, if you need to install or re-install certain too and keeping a previous configuration, then select “NO” option on this step.

fig03_pnaf_installer3

Figure 3. Selection of clean installation

After this step, PNAF will start the compilation and configuration process. which may take around 30-40 minutes depending on the features of the machine. In case of any error encountered by the installer, it will show up the corresponding message and you can check the details in the files install.log (basic log)  and install.log.exec (detailed log) to identify the problem. If no problems are encountered, then the installer will show a success confirmation and PNAF will be installed on the system.

It is recommended that in order to update all the environment variables, exit out of the chroot environment and switch back again. Furthermore, it may be useful to add a tag on the chroot shell:

 # echo 'PS1="(PNAF) $PS1"' >> ~/.bashrc
 # exit
 # chroot chroot_pnaf

To verify that PNAF has been installed correctly:

# pnaf_auditor --help

fig04_pnaf_installer4

Figure 4. Execution option of PNAF auditor

Installation with a preconfigured Debian chroot (tarball)

The second installation mode can be done by using a preconfigured chroot directory with all the tools already installed and configured. This mode basically avoid the whole process explained in the first installation mode (using debootstrap and run the installer). Moreover, this mode provides a way of deploying environments through the use of templates (chroot directory). In order to use this installation mode, it is only necessary to download the tarball (about 1.3 Gb) that contains the aforementioned template and then just unpack it within the local filesystem.

Note: It is important to emphasize the fact that this mode only works if the native system in which the template is used is Debian 8 (amd64), although it might be possible to make it work on any 64 bit Debian based system.

  # wget http://pnaf.honeynet.org.mx/download/chroot_pnaf.tar.bz2
  # tar -jxvf chroot_pnaf.tar.bz2
  # mount -t sysfs sysfs   chroot_pnaf/sys
  # mount -t proc proc     chroot_pnaf/proc
  # mount -o bind /dev     chroot_pnaf/dev
  # mount -o bind /dev/pts chroot_pnaf/dev/pts
  # chroot chroot_pnaf

Similarly, it can be tested that PNAF works properly by running:

 # pnaf_auditor --help

 

Installation by using a Virtual machine

This installation mode is very simple. It only need to download an image of a virtual machine (OVA file) that contains a pre-installed and configured PNAF environment under a Debian system. This OVA file can be imported using either VirtualBox or Vmware.

    1. Download the OVA image http://pnaf.honeynet.org.mx/download/pnaf-0.1.2.ova
    2. Import it on Virtual Box:

 

Menu  File/Import appliance/ and select the OVA file in order to create the virtual machine. This virtual machine includes a chroot directory with all the tools that the installer is able to deploy. The login credential are shown in the Welcome screen itself once the virtual machine is started. fig05_pnaf_vm

Figure 5. Pre-configured virtual machine with PNAF environment

Once the user is logged in, it is necessary to switch to the PNAF environment included in a chroot directory.

  # mount -t sysfs sysfs   chroot_pnaf/sys
  # mount -t proc proc     chroot_pnaf/proc
  # mount -o bind /dev     chroot_pnaf/dev
  # mount -o bind /dev/pts chroot_pnaf/dev/pts
  # chroot /root/chroot_pnaf

 

Independent installation (advanced mode)

This installation mode is intended to be used when some tools are already installed and configured on the system, so the PNAF core itself (Perl module) is used to process all the information generated by such tools. However, it is not recommended to use this mode since it implies that a huge set of parameters need to be specified on the configuration files, which would make the framework very prone to fail. Thus, it is recommended to use any of the aforementioned installation modes instead.

If you really need to use an independent installation, then just install the Perl module:

 # cd pnaf
 # vim build/pnaf/Pnaf/lib/Pnaf/Core.pm (set all the parameters: paths, binaries, configuration files, etc.)
 # cd build/pnaf/Pnaf
 # perl Makefile.PL
 # make
 # make test
 # make install

CONFIGURATION

Version 0.1.2 takes all the configuration options directly from the arguments passed during execution. In order to see the available option of PNAF (pnaf_auditor), it can be used the following options:

 # pnaf_auditor –-help

In addition, in order to visualize the versions of the tools included on the built version:

 # pnaf_auditor –-version

 

In case any specific configuration is needed (e.g. a specific path or rules file for suricata, log files for prads, etc), all the configuration files within the directory /pnaf/etc can be set.

 

POC: Analysis of network traffic files (pcap)

This PoC will show how to perform a basic analysis of network traffic files using PNAF. It has to be emphasized that PNAF extracts and interprets information in different ways, depending the purpose and depth of the desired analysis. Thus, the information presented on this PoC does not represent all the findings that can be obtained using PNAF.

The following table describes the kind of information and purpose obtained on this general analysis.

 

Type of data Purpose
Asset identification Identification of assets that perform activities within the network including their type of link connection, protocols involved, usage rates, platforms, software, among others.
Security events (IDS based alerts) Identification of potential anomalous or malicious activities based on IDS data.
Resources Identification of resources that provide information of workflow activities as well as data sources such as URL, domains, transferred files, etc.
Software audit Passive identification of software that is being used within the network. This information is taken as baseline to identify potential vulnerabilities based on CVEs.

 

Initial execution

General processing:

Having the PCAP file test1.cap, pnaf_auditor is executed as follows:

 # pnaf_auditor –-cap test1.cap –log_dir /pnaf/www/test1

These options specify that the file will be taken by the tools used by PNAF and the output data will be stored within /pnaf/www/test1 directory.

fig06_poc_pnaf1

Figure 6. PNAF generic processing execution

Specific processing

Now, assuming that a more specific analysis is needed, it is possible to execute pnaf_auditor using the following options:

 # pnaf_auditor –-cap test2.cap –log_dir /pnaf/www/test2 --home_net 192.168.1.0/24 –-payload

With these parameters pnaf_editor will analyze the pcap file test2.cap, taking the network segment 192.168.1.0/24 as “home_net”, which is the internal network of theorganization. It is possible to specify the home_net using CIDR format. Furthermore, it is specified that payloads will be decoded in case any IDS alert is triggered. This is specially useful to analyse and identify potential false positives.

 

Analysis and data interpretation

In order to get a basic meaningful information, based on a bunch of raw data, the analysis can be done through different stages.

1.  Command line logs (execution stdout)

Logs generated during the execution are displayed on the standard output (Figure 7 below). This phase is important since the analyst can check what tools are being used to retrieve raw logs, as well as the basic overview of parsed events and assets audit.

fig07_poc_pnaf2_en

Figure 7. Execution log and summary

2.      Web visualization

PNAF provides a basic web visualization that includes the following data:

  • Raw data logs generated by all the tools included on the PNAF built
  • Pre-processed logs in JSON format
  • Audit data processed logs in JSON format displayed on a JSON viewer.

All JSON data generated by PNAF can be used and interpreted within the framework itself, however it is important to emphasize that such data can be also exported to feed data analysis systems such as SIEM.

 

In order to use the basic web visualization, it is necessary to enable the web server Apache.

 

 # apachectl start

 

By default, all the findings are stored in /pnaf/www directory. When pnaf_auditor is executed, –log_dir option can be used to specify that the output directory is set directly within the webdir. In the running example the output directory was set on /pnaf/www/test2 which can be accessed directly through a web browser on http://localhost or the corresponding IP address of the server where PNAF has been deployed.

fig09_pnaf_web3

Figure 8. PNAF basic web visualization

The web directory has the following structure (practical example on Figure 9):

 

DIRECTORY_NAME/                 (Raw logs generated by tools)
 |
 |----- JSON/                    (Parsed files in JSON format)
 |       |
 |       |---SUMMARY/            (JSON tree view of dataset and audits)
 |       |   |                   (This is the main basic visualizer)
 |       |   |
 |       |   |---dataset         (Parsed data of all toolsets)
 |       |   |---auditSummary    (Summary of audit information)
 |       |   |---dataset.html    (All software found within trafic)
 |       |   |---auditOutput     (Audit based on CVE (NIST) and software)
 |       |   |---dataset.html    (Audit data sorted per single asset)
 |       |
 |       |-------VIEW1/          (Alternative JSON viewer)
 |       |
 |       |-------VIEW2/          (Deprecated)

 

Figure 9. Files generated for web visualization

 

The analysis of this PoC is performed from general data to specific findings. First, it is useful to review the file  json/summary/dataset.html. Here, the analyst can visualize data logs generated by all the tools using JSON viewers. Each tree has two main categories:

  • Summary: it contains the summary of findings
  • Tracking: It contains data sorted out by single asset

 

Depending on the depth of the analysis, it is possible to dig into details on each dataset, as well as perform searching using the textbox embedded on the viewer.

fig10_pnaf_web4

Figure 10. Dataset of tools used in PNAF

 

The next step on the analysis involves checking the parsed and correlated data stored on the file /json/summary/auditSummary.html . Here, the analyst can visualize detailed information of each asset identified on the network traffic. For instance, it is possible to review information about URLs, SSL certificates, IDS alerts, transferred files, software, etc. Moreover, it is possible to review the audit correlation through a Tracking category (just as the main dataset explained before), in which audit data is sorted out by single asset. In order to do so, the file /json/summary/auditTracking.html can be accessed.

fig11_pnaf_web5

Figura 11. Audit summary. Main correlation

fig12_pnaf_web6

Figure 12. Audit summary. Tracking category (sorted by assets)

Finally, the file /json/summary/auditOutput.html  shows findings about vulnerabilities in software identified within the network traffic, based on CVE database[3]. This analysis includes a score that measures the impact of the aforementioned vulnerabilities. Furthermore, a list of assets identified within blacklists (IP & domain name based and taken from trusted sources: e.g. EmergingTheats DB) is presented.

fig13_pnaf_web7

Figure 13. Audit summary. Vulnerability and blacklisted asset analysis based on trusted databases

 

Taking into consideration all the data gathered by the tools, the information interpreted by PNAF, as well as the meaningful (specific) interpretation performed by the analyst herself, then a big picture of the context and characteristics of the network can be determined. In fact, the kind of information that should be filtered and put focus on, depends upon the kind of problem, context and issue that needs to be identified.

It is very important to note that PNAF is prone to false positives due to the nature of PNA itself, in which the single input and potential lack of complete datasets (e.g. actual logs from applications, etc) may cause a miss interpretation and inaccurate correlation, leading to inaccurate findings that need to be verified manually by the analyst himself.

 

Currently PNAF is under development. Version 0.1.2 is the last version of 0.1 branch. Next versions will include improvements mainly on the visualization of the results, stability, ease of deployment and integration with external software for data analysis. For additional information you can follow the activities on the official blog of the UNAM-Chapter of the Honeynet Project and its development repository:

 

 

References

[1] Passive Network Audit Framework, Master thesis. Santillan, Javier. Eindhoven University of Technology. The Netherlands. 2014

[2]Tabla 1. “Herramientas de análisis de tráfico de red” del artículo anterior

[3] https://cve.mitre.org/

 

]]>
210
PNAF 0.1.2 howto básico https://blog.honeynet.org.mx/pnaf-0-1-2-howto-basico/ Mon, 03 Aug 2015 23:07:43 +0000 http://blog.honeynet.org.mx/?p=154 Este artículo tiene como objetivo presentar una prueba de concepto de Passive Network Audit Framework (PNAF), implementación de un framework basado en PNA (Passive Network Audit) el cual puede ser utilizado como herramienta de análisis pasivo de tráfico de red, aprovechando ventajas de otras herramientas. El alcance de este artículo incluye la instalación, configuración y modelos de ejecución para extracción de datos e interpretación de información. Para una mejor referencia del modelo teórico, puede consultarse el artículo “Frameworks para monitoreo, forense y auditoría de tráfico de red” del número 24 de la revista .Seguridad y la fuente original[2] de dicho framework.

Explore this article

El contenido de este artículo será publicado en el número 25 de la revista .Seguridad del UNAM-CERT.

 


CONTENIDO


 

MODELO GENERAL DE PNAF

El modelo general de PNAF (Figura 1), define el funcionamiento y flujo de datos a través del cual PNAF decodifica, filtra e interpreta información a partir del tráfico de red.

fig01_pnaf_modelo

Figura 1. Modelo de análisis de Passive Network Audit Framework (PNAF)

MODOS DE INSTALACIÓN

PNAF incluye una serie de herramientas[3] para captura y análisis de tráfico de red. Debido a sus características y capacidades, algunas de estas herramientas por sí mismas pueden involucrar complejos procesos de instalación y configuración. Por esta razón, PNAF está diseñado para proveer modos de instalación que faciliten y automaticen el proceso de manera que el analista pueda hacer uso del framework sin mayor problema. Existen cuatro modos de instalación los cuales se explican a continuación.

Instalación mediante Instalador

PNAF incluye un instalador que automatiza la descarga, compilación y configuración de todas las herramientas. Este instalador incluye un Wizard (asistente de instalación) basado en dialog. Para poder utilizar este modo de instalación es necesario cumplir los siguientes requerimientos:

  • Sistema Debian GNU/Linuxx o superior o Gentoo stage 3.x.
  • Conexión a internet durante la instalación (El instalador descarga e instala algunas dependencias via Apt o Emerge), así como algunos módulos de Perl via CPAN.

Es posible su funcionamiento en Ubuntu u otra distribución basada en Debian, sin embargo implica verificar las equivalencias en paquetes instalados por Apt. Asimismo, es posible usar el instalador en otros sistemas no basados en Debian siempre y cuando se instalen manualmente todas las dependencias necesarias para la compilación de las herramientas. Para esto se puede consultar el archivo README e instalar las dependencias equivalentes de la lista de Apt/emerge.

Debido a que PNAF instala una gran cantidad de dependencias, se recomienda instalar el framework en un ambiente chroot para evitar cualquier problema de compatibilidad de dependencias en el sistema nativo. En esta prueba de concepto se hará de esa manera y el proceso se explica a continuación.

Asumiendo que se cuenta con un sistema Debian 8 de 64 bits (amd64):

  1. Creación del ambiente chroot (via debootstrap)

 # aptitude install debootstrap
 # debootstrap --arch amd64 jessie chroot_pnaf http://ftp.mx.debian.org/debian
 # mount -t sysfs sysfs   chroot_pnaf/sys
 # mount -t proc proc     chroot_pnaf/proc
 # mount -o bind /dev     chroot_pnaf/dev
 # mount -o bind /dev/pts chroot_pnaf/dev/pts

Ahora se cambia al ambiente chroot

 # chroot chroot_pnaf
 # cd ~
  1. Descarga de PNAF

Opción 1: Desde el repositorio oficial del proyecto

# aptitude install git
# git clone https://dev.honeynet.org.mx/traffic-analysis/pnaf.git

 

Opción 2: Desde el mirror en github

# git clone https://github.com/jusafing/pnaf

Una vez descargado, ingresar al directorio y ejecutar el instalador

# cd pnaf
# ./install.sh

Esto ejecutará el asistente. Primero se deberá confirmar que se desea instalar PNAF. Posteriormente se pueden seleccionar las herramientas que se incluirán en el framework. A pesar de que no todas las herramientas se utilizan en esta versión de PNAF (v0.1.2), se recomienda seleccionar todas para utilizarlas de manera independiente. Visto de este modo, PNAF es también un asistente para la instalación de herramientas de análisis de tráfico de red.

fig02_pnaf_installer2

Figura 2. Selección de herramientas en la instalación de PNAF

Si es la primera vez que se instala PNAF se debe seleccionar una instalación limpia “clean installation”. En caso de que exista una instalación previa, la instalación limpia eliminará cualquier herramienta y archivos instalados por PNAF. Si solo se desea agregar o reinstalar ciertas herramientas, se debe seleccionar “NO” en este paso.

fig03_pnaf_installer3

Figura 3. Selección del tipo de instalación

A partir de ese momento el instalador comenzará a compilar y configurar todas las herramientas. Este proceso puede durar aproximadamente 30 minutos dependiendo de las capacidades del equipo. En caso de que exista un error en el proceso de instalación, el instalador mostrará el mensaje correspondiente y se pueden verificar los archivos install.log e install.log.exec para identificar el problema. De lo contrario, si el proceso terminó correctamente, PNAF ha quedado instalado y listo para usarse.

Como recomendación, para actualizar las variables de ambiente hay que salir del ambiente chroot y volver a entrar. Asimismo, para identificar cuando se esté dentro del directorio de chroot, es conveniente agregar una etiqueta al shell :

# echo 'PS1="(PNAF) $PS1"' >> ~/.bashrc
# exit
# chroot chroot_pnaf

Para verificar que PNAF se ha instalado correctamente:

# pnaf_auditor --help

fig04_pnaf_installer4

Figura 4. Opciones de ejecución de PNAF

 

Instalación mediante Debian chroot pre-configurado

El segundo modo de instalación corresponde al uso de un directorio chroot con todas las herramientas pre-compiladas y pre-configuradas. Esta alternativa básicamente evita todo el proceso de compilación y creación del directorio raíz con debootstrap presentada en el modo anterior. Por otro lado, facilita tener una plantilla con un directorio preparado para usar con chroot. Usando este modo solo es necesario descargar el archivo empaquetado .tar.bz2 (aproximadamente 1.3Gb) y desempaquetarlo en el sistema de archivos local.

Es importante mencionar que este modo funciona solo si el sistema local en el que se planea instalar es Debian 8 amd64 (la compilación de todas las herramientas depende de la arquitectura y de las versiones de las dependencias usadas por Apt).

 # wget http://pnaf.honeynet.org.mx/download/chroot_pnaf.tar.bz2
 # tar -jxvf chroot_pnaf.tar.bz2
 # mount -t sysfs sysfs   chroot_pnaf/sys
 # mount -t proc proc     chroot_pnaf/proc
 # mount -o bind /dev     chroot_pnaf/dev
 # mount -o bind /dev/pts chroot_pnaf/dev/pts
 # chroot chroot_pnaf

Igualmente se puede verificar que PNAF se ha instalado correctamente:

# pnaf_auditor –help

 

Instalación (uso) mediante una máquina virtual

En este modo de instalación es necesario descargar una imagen de máquina virtual en formato OVA para ser importando con VirtualBox o Vmware.

  1. Descargar la imagen en http://pnaf.honeynet.org.mx/download/pnaf-0.1.2.ova
  2. En virtual Box:

En el menú  File/Import appliance/ seleccionar el archivo OVA y crear la máquina virtual

Esta máquina virtual tiene instalado PNAF con todas las opciones mostradas en el instalador. Las credenciales de acceso para el usuario root se muestran en el mensaje de bienvenida una vez que se inicia la máquina virtual.

fig05_pnaf_vm

Figura 5. Máquina virtual pre-configurada con PNAF

Una vez dentro de la máquina virtual se debe ingresar nuevamente al directorio con chroot.

 # mount -t sysfs sysfs   chroot_pnaf/sys
 # mount -t proc proc     chroot_pnaf/proc
 # mount -o bind /dev     chroot_pnaf/dev
 # mount -o bind /dev/pts chroot_pnaf/dev/pts
 # chroot /root/chroot_pnaf

Instalación mediante módulo de Perl (Instalación independiente)

Esta opción incluye la instalación del core (núcleo) de PNAF, es decir, instalación independiente del módulo de Perl. Este modo se puede utilizar cuando se desee usar PNAF con una instalación propia de las herramientas. Sin embargo, no es recomendable ya que se necesitan configurar una gran cantidad de opciones incluyendo la ruta de los archivos binarios de cada una de las herramientas, archivos de configuración, logs, etc. Para esto, una vez descargado PNAF, editar la configuración de cada una de las herramientas:

# cd pnaf
# vim build/pnaf/Pnaf/lib/Pnaf/Core.pm (establecer rutas)
# cd build/pnaf/Pnaf
# perl Makefile.PL
# make
# make test
# make install

CONFIGURACIÓN

La mayoría de las opciones de configuración se definen directamente como argumentos al momento de la ejecución del auditor de PNAF (pnaf_auditor).

Para visualizar las herramientas incluidas en el framework se puede ejecutar

# pnaf_auditor –-version

Para mayor información sobre las opciones disponibles en PNAF 0.1.2

# pnaf_auditor –-help

En caso de necesitar una configuración específica, por ejemplo agregar firmas del IDS Suricata, se pueden modificar los archivos de configuración dentro del directorio /pnaf/etc

 


POC: ANALISIS DE CAPTURAS DE TRÁFICO DE RED

A continuación se analizarán tres archivos de captura en formato PCAP. La flexibilidad de las herramientas usadas por PNAF permite extraer e interpretar la información de maneras diferentes. El análisis en esta prueba de concepto no representa la totalidad de información que se puede obtener. Así, la PoC incluye un análisis general los archivos de captura de manera que se obtenga la siguiente información y cuyo propósito se explica en la siguiente tabla:

 

Información a identificar Propósito
Identificación de activos Identificación de los equipos que participan en el tráfico de red incluyendo estadísticas de uso por tipo de conexión, protocolos, tasas de transferencia, etc.
Posible eventos de seguridad (alertas de IDS) Identificación de posibles actividades anómalas o maliciosas a partir de un motor IDS
Recursos que se acceden Identificación de recursos como URLs, dominios, archivos transferidos
Auditoría de software usado en la organización Identificación pasiva del software utilizado en la red tanto por clientes como por servidores. A partir de esta información se lleva a cabo la identificación de potenciales vulnerabilidades basadas en CVE.

 

Ejecución inicial

Procesamiento general:

Teniendo el archivo de captura test1.cap, se ejecuta pnaf_auditor de la siguiente manera:

# pnaf_auditor –-cap test1.cap –log_dir /pnaf/www/test1

Esto ejecutará una serie de herramientas y procesará la información almacenando los resultados en el directorio /pnaf/www/test1

fig06_poc_pnaf1

Figura 6. Ejecución de PNAF

Procesamiento específico

Ahora, asumiendo que se desea obtener un filtrado específico se puede ejecutar pnaf_auditor con las siguientes opciones

# pnaf_auditor –-cap test2.cap –log_dir /pnaf/www/test2 --home_net 192.168.1.0/24 –-payload

En esta ejecución se indica que se analizará el archivo de captura test2.cap y que la red de la organización “home_net” es el segmento 192.168.1.0/24. (Se pueden indicar más segmentos en formato CIDR[4] separados por comas). Asimismo, se indica que se desea extraer el payload en caso de identificar una alerta de IDS (útil para análisis a fondo y verificación de falsos positivos).

 

Análisis e interpretación de la información

La interpretación de la información se puede llevar a cabo en distintas etapas.

1.      Logs de línea de comandos

El log generado durante la ejecución muestra el resumen de los resultados. Esta fase es importante porque se obtiene información sobre las herramientas utilizadas, asi como del panorama general de los datos obtenidos. La siguiente figura muestra la explicación del log generado por PNAF.

fig07_poc_pnaf2

Figura 7. Log de ejecución y resultados generales de PNAF

2.      Logs en interfaz web

PNAF permite una visualización de los resultados a través de una interfaz web básica. Esta interfaz permite listar:

  • Archivos de log “crudos” generados por cada una de las herramientas
  • Archivos de log pre-procesados en formato JSON[5]
  • Archivos de log con resultados de auditoría en formato JSON y visualizados en forma de árbol

Para poder utilizar la interfaz web es necesario activar el servidor web apache incluido en PNAF.

# apachectl start

Usando la configuración default, todos los directorios de resultados que se almacenen en /pnaf/www e indicados en la opción –log_dir, podrán ser visualizados en web, usando http://localhost o la dirección IP específica donde se ejecute PNAF.

fig08_pnaf_web1

Figura 8. Visualización web básica de PNAF

Dentro de este directorio se tiene la siguiente estructura y se muestra un ejemplo en la Figura 9:

tabla02


fig09_pnaf_web3

Figura 9. Archivos generados para la visualización web de PNAF

El análisis en esta PoC va de lo general a lo particular. Primeramente se puede dar un vistazo general en el contenido del archivo json/summary/dataset.html. Aquí, el analista puede acceder a la información clasificada de las herramientas. Cada herramienta contiene dos categorías principales, Summary (resumen de los datos) y Tracking (información por activos -IPs, servers, etc-). Según la necesidad del analista y los hallazgos encontrados, se pueden extraer datos a profundidad por cada herramienta y filtrar la información mediante el cuadro de búsqueda en cada árbol de herramienta.

 

fig10_pnaf_web4

Figura 10. Conjunto de datos (datasets) de las herramientas usadas en PNAF

Continuando con el análisis, ahora se visualiza el filtrado y pre-procesamiento de datos generados por PNAF, el cual lleva a cabo una correlación básica y conjunta la información creando diferentes categorías. Para ello se accede al archivo /json/summary/auditSummary.html y es aquí donde el analista puede extraer información detallada de la actividad de cada uno de los activos que intervienen en el tráfico de red. Por ejemplo, se puede obtener información sobre URL, certificados SSL, alertas IDS, archivos transferidos, Software utilizado, etc. De la misma manera, si la auditoría se prefiere hacer tomando como clasificación general a los activos, entonces se puede visualizar el archivo /json/summary/auditTracking.html

fig11_pnaf_web5

Figura 11. Resumen de auditoría. Clasificación general

fig12_pnaf_web6

Figura 12. Resumen de auditoría. Clasificación por activos

Finalmente, el archivo /json/summary/auditOutput.html muestra el resultado del análisis de vulnerabilidades basadas en CVE[6] y versiones de software encontradas. Este análisis incluye un sistema de puntaje (score) que indica el posible impacto de las vulnerabilidades identificadas. Asimismo, se muestra la lista de equipos identificados en listas negras de dominios o IP o cuya interacción estuvo involucrada con equipos de la red.

fig13_pnaf_web7

Figura 13. Resumen de auditoría. Análisis de vulnerabilidad de software basado en CVE

Conjuntando toda la información recopilada y filtrada tanto por PNAF como por el mismo analista, es posible determinar el estado general y características de la red. La información detallada dependerá del tipo de problema o necesidad que desea resolver.

Finalmente, es importante hacer énfasis en el hecho de que PNAF es susceptible a falsos positivos debido a la naturaleza misma de PNA, en donde, al no contar con la información completa y obtener datos a partir de una interpretación del tráfico de red, cierta información podría representar hechos erróneos. Así, una de las tareas del analista implica la identificación y verificación de información certera.

Actualmente PNAF se encuentra en desarrollo en la versión 0.2. Futuras versiones incluirán cambios significativos en la interfaz web y estabilidad del framework. Para actualizaciones consultar las páginas del proyecto.

 


 

Referencias

[1] Frameworks para monitoreo, forense y auditoría de tráfico de red I. Revista .Seguridad número 24.

[2] Passive Network Audit Framework, Master thesis. Santillan, Javier. Eindhoven University of Technology. The Netherlands. 2014

[3]Tabla 1. “Herramientas de análisis de tráfico de red” del artículo anterior

[4] https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

[5] https://en.wikipedia.org/wiki/JSON

[6] https://cve.mitre.org/

]]>
154