Coder Social home page Coder Social logo

audit-springbok's Introduction

Springbok project

Dependencies

To launch the springbok project you need to have:

Installation

apt-get install python-gtk2 python-networkx python-matplotlib python-reportlab python-netaddr
pip install graphviz

Launch springbok project

python springbok.py

Supported Firewall equipments

  • Cisco Asa
  • Juniper Netscreen
  • Fortinet Fortigate
  • Iptables (cf. Using iptables)

CHANGELOG

v0.6:

  • Add Iptables
  • Implement VDOM for Fortigate
  • Add generation of anonymous configuration file

How it works

Using iptables

You can import your script configuration file or the output of the iptables-save command.

In order to import iptables configuration files, you must concatenate the output of the ifconfig command with your configuration file :

ifconfig | cat - my_iptables.conf > /tmp/out && mv /tmp/out my_iptables.conf

File menu

Import firewall

Start to import a configuration file File → Import configuration.

You can select multiple files. For each file the tool will try to detect the equipment type.

Once the import finished, the tool launches the construction of ROBDD, which may decrease temporarily the performance of the tool. But don't worry, it won't block the software. In fact, the operation is launched in a thread.

Open project

You can open saved project File → Open project.

Once again, the tool launches the construction of ROBDD.

Save project

You can save the state of the current project File → Save project.

Network topology

After importing files, the tool draws the network topology. You can interact with all elements. The elements can be moved and you can zoom in or out using your mouse scroll or the zoom bar at the bottom of the zone. The "Redraw" button redraws the topology. If you double click on an element a default action is launched.

Firewall

Default action:

  • Show the configuration file : the firewall configuration is not editable.

When you right click on a firewall a popup menu appears and you can:

  • Show the configuration file : the firewall configuration is not editable.
  • Add a note : this will display a small note on the firewall
  • Detect anomaly : this will launch the internal anomaly detection
  • Show configuration error : this will show unused objects and unbounded rules
  • Show defined object list : this will show the list of defined objects
  • Show enabled services : this will show all enable services (based on the rule destination ports)
  • Generate anonymous configuration : this enables you to create an anonymous configuration file
  • Remove : this will remove the selected firewall

Network

Default action:

  • Add a note : this will display a small note on the network

When you right click on a node a popup menu appear and you can:

  • Add a note : this will display a small note on the network
  • Add itinerary form this place : this will add the start marker on the network (see query path)
  • Add itinerary to this place : this will add the end marker on the network (see query path)
  • Change sensitivity : this enables you to change the color of the network (for faster overview)

Edge

Default action:

  • Show all ACLs : this will show all ACLs from/to this network

When you right click on an edge a popup menu appear and you can:

  • Select an ACL : this enables you to show an ACL from/to this network

Background

When you right click on the background a popup menu appear and you can:

  • Clear query path : this will remove marked paths and markers (see query path)
  • Choose a background image : this will enable you to choose a background image (png file only)

Anomaly detection

Algorithms for detecting anomalies are based on the work of Al-Shaer and H. Hamed and the FIREMAN project.

Taxonomy of anomalies

Internal detection
  • Masked rules: The rule will not match any packets and action defined by the rule will never be taken.

  • Shadowing: The rule has been defined to accept/deny some packets which have been denied/accepted by preceding rules.

  • Redundancy: All the packets have been accepted/denied by preceding rules or will not take this path.

  • Redundancy and correlation: Part of the packets for this rule have been denied/accepted. Others are either accepted/denied or will not take this path.

  • Partially masked rules: The rule matches some packets that have already been matched.

  • Correlation: Part of the packets supposed to be accepted/denied by the rule have been denied/accepted by preceding rules.

  • Generalization: The rule is a generalization of preceding rules since preceding rules match a subset of the current rule but have a different action.

  • Redundant: If preceding rules are removed, all the packets that match preceding rules can still be accepted/denied by the current rule. Therefore, preceding rules are redundant.

Distributed detection
  • Shadowing: The rule is shadowed by upstream ACLs. It tries to accept some packets that are blocked on all reachable path.
  • Raised security level: The rule probably reveals a raised security level. Certain packets might be allowed to access part of the network path but not to the end of this path.
  • Redundant: The rule is probably a redundancy since the packets supposed to be denied will not reach this ACL anyway. However, multiple lines of defense are often encouraged in practice to increase overall security level.
  • Correlation: The rule is probably an overlapping rule. Part of the packets intend to be accepted/denied by this rule have been denied/accepted by upstream ACLs.

Internal detection

You can launch the internal detection of a firewall by clicking on it Right click → Detect anomaly.

The internal detection will take each ACL of the firewall individually and will check for anomalies between the rules. The 'Deep search' option enables you to have all blamed rules on an anomaly. However, this option will take too much time to perform.

Distributed detection

You can launch the distributed detection of all firewalls by clicking on the menu Audit → Distributed detection.

The distributed detection will construct rooted tree for each pair of network and will check for anomalies along the path. The 'Deep search' option enables you to have all blamed rules on an anomaly. However, this option will take too much time to perform.

Query path

Manual method

You can seek for a path between two networks. To start a search:

  • Place the start marker on a network Right click on a network → Itinerary from this place
  • Place the end marker on another network Right click on a network → Itinerary to this place

Then a popup shows up and you can specify:

  • The protocol
  • The ip source
  • The port source
  • The ip destination
  • The port destination

You can leave a field empty to not take it into account.

If paths are found, you will be able to select a path in the right lateral pane.

  • If you select a row, this will highlight the path on the network topology
  • If you double click on a row, this will show you the concerned rules

Automatic method

You can import a query file to launch multiple query requests Audit → Import query file.

Each query must be separated with a single line of two hyphens.

The syntax is the following (if you don't want to specify a field just delete it):

protocol : protocol_value
ip-source : ip_value [optional_mask_value]
port-source : port_value
ip-destination : ip_value [optional_mask_value]
port-destination : port_value

Exporting result

You can export result of the following tabs Audit → Export result:

  • Internal detection
  • Distributed detection
  • Configuration error
  • Query path (automatic version only)

Springbox cli

The Springbox cli is a small script using springbok's module to export equipment ACL to an unified csv format.

Launch Springbox cli

python springbox_cli.py [OPTION]... [FILE]

Usage

Usage: ./springbox_cli.py [OPTION]... [FILE]
Parse firewall configuration files (Cisco Asa, JuniperNetscreen, Fortinet Forigate) and export parsed rules to csv format.
Create a folder tree of the configuration ACL (springbok_rulesXXXXXX)

	-h, --help          show this help
	-n, --no-confirm    no confirmation on the device detected

Example:
./springbox_cli.py -n cisco_example1.conf cisco_example2.conf

audit-springbok's People

Contributors

conix-security avatar quack1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

audit-springbok's Issues

Program fails to launch.

Here is the crash log:

WARNING: 'p_info' not defined as a function
WARNING: Token 'WS' defined, but not used
WARNING: There is 1 unused token
Generating LALR tables
Traceback (most recent call last):
  File "./springbok.py", line 7, in <module>
    from Gtk import Gtk_Main
  File "/root/Desktop/springbok/Gtk/Gtk_Main.py", line 10, in <module>
    import Gtk_NetworkCanvas
  File "/root/Desktop/springbok/Gtk/Gtk_NetworkCanvas.py", line 14, in <module>
    from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_gtkagg.py", line 14, in <module>
    from matplotlib.backends.backend_gtk import (
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk.py", line 35, in <module>
    from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_gdk.py", line 33, in <module>
    from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk

Export audit results in 0 byte file.

Traceback (most recent call last):
File "/home/kali/Downloads/Springbok/springbok/Gtk/Gtk_MenuBar.py", line 692, in on_export
Gtk_Main.Gtk_Main().notebook.export(filename)
File "/home/kali/Downloads/Springbok/springbok/Gtk/Gtk_NoteBook.py", line 293, in export
Gtk_Export.Gtk_Export(filename, self.export_tab[k], k).save()
File "/home/kali/Downloads/Springbok/springbok/Gtk/Gtk_Export.py", line 45, in save
self.callback(fd, self.ref)
File "/home/kali/Downloads/Springbok/springbok/Gtk/Gtk_Export.py", line 81, in export_distributed_detection
path += elem.to_string()
AttributeError: 'str' object has no attribute 'to_string'

Can't convert IPtables

I'm receiving the following error when parsing an Iptables firewall.

Traceback (most recent call last):
File "/root/springbok/Gtk/Gtk_MenuBar.py", line 454, in on_click
firewalls = Parser.parser(filename, parser_module, progressBar)
File "/root/springbok/Parser/Parser.py", line 65, in parser
_parse_kit.finish()
File "/root/springbok/Parser/IpTables/IpTablesParser.py", line 433, in finish
input_path_list = my_parser.create_all_path_from_node(input_node)
File "/root/springbok/Parser/IpTables/IpTablesParser.py", line 280, in create_all_path_from_node
for idx, component in enumerate(node.data_list):
AttributeError: 'NoneType' object has no attribute 'data_list'

If you can provide me a private email address I can provide the original file for parsing.

Error while parsing file

I am not able to parse my fortigate files... After i import it, it just stops.. In the background this is what i'm seeing.

--------------Zone list-------------------
{}
Traceback (most recent call last):
File "/home/frazera/springbok/Gtk/Gtk_MenuBar.py", line 454, in on_click
firewalls = Parser.parser(filename, parser_module, progressBar)
File "/home/frazera/springbok/Parser/Parser.py", line 70, in parser
return _parse_kit.get_firewall()
File "/home/frazera/springbok/Parser/FortiGate/FortiGateYacc.py", line 148, in get_firewall
end_zones()
File "/home/frazera/springbok/Parser/FortiGate/FortiGateYacc.py", line 166, in end_zones
f = open(path + 'zones2', 'w')
IOError: [Errno 2] No such file or directory: '/home/frazera/springbok/Parser/FortiGate/../../output/zones2'

Gitter or IRC for the project?

o/ Thank you for the awesome project. I have few queries regarding the code. Is there any gitter or IRC channel for the same?

Yours Sincerely,
Vijay

Object group in destination

Hello,
run in to a problem with FW rules on Cisco ASA.
Rules with object-group in destination are not parsed.

Example:
access-list ANON-NAME_access_in extended permit object-group TCPUDP object-group ANON_NETWORK_RANGE1 object-group ANON_NETWORK_RANGE2 object-group TCP-UDP-proxy

Inside the objects:
object-group network ANON_NETWORK_RANGE1
network-object 10.XX.XX.0 255.255.255.0
network-object object 10.XX.XX.0
network-object object 10.XX.XX.0

object-group network ANON_NETWORK_RANGE2
network-object host 10.XX.XX.0
network-object host 10.XX.XX.0
network-object host 10.XX.XX.0
network-object host 10.XX.XX.0
network-object object ANOTHER_OBJECT_GROUP1
network-object object ANOTHER_OBJECT_GROUP2
network-object object 10.XX.XX.0

object-group service TCP-UDP-proxy tcp-udp
port-object eq 3128

Parsing starts but doesn't display anything

Hello,

I just downloaded Springbok on my Debian-Stretch.

I first attempted to install it without GUI but since it didn't work I installed Xfce. Then, the installation completed without problem.

So, I executed it but when I tried to import my Fortigate Configuration File I created by doing a Backup of my Fortigate. It started to parse the file then, nothing. No error. No equipment. No interfaces. It just stayed blocked at the progression bar of the parsing (which seemed to have gone all the way however).

Can you help me please ? What is the problem ?

Procedure used :
Failing to Add Fortigate in Springbok.docx

Fortigate multiple VDOM support

Hi,

Great tool ! I just tried it and it looks very useful.

However, when importing a large Fortigate configuration file, it seems that only the first VDOM is analyzed, while I have 3 others.

Unfortunately, i won't be able to provide logs/config file...

Keep up the good work.

Error when download pygtk

system info :

  • system : Linux PC-010 4.4.0-22000-Microsoft #653-Microsoft Wed Apr 27 16:06:00 PST 2022 x86_64 GNU/Linux
  • pip version : pip 20.0.2 from /usr/lib/python2.7/dist-packages/pip (python 2.7)

when i install some libs i get this errors

~# python2 -m pip install pygtk

************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please follow up at
https://bit.ly/setuptools-py2-warning.
************************************************************
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pygtk
  Using cached pygtk-2.24.0.tar.bz2 (2.4 MB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1zMCNs/pygtk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1zMCNs/pygtk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-1zMCNs/pygtk/pip-egg-info
         cwd: /tmp/pip-install-1zMCNs/pygtk/
    Complete output (4 lines):
    ********************************************************************
    * Building PyGTK using distutils is only supported on windows. *
    * To build PyGTK in a supported way, read the INSTALL file.    *
    ********************************************************************
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

Requirements List - can't find a module and update to the module list to install

Can you please add the following libraries to your requirements

reportlab
graphviz

I also can't seem to find the library in apt or on the internet that provides this module. Some help please

eperry@SilverHWK:~/springbok$ python springbok.py
WARNING: There was a problem loading the table file: KeyError('p_ip_src_line_2',)
WARNING: 'p_info' not defined as a function
WARNING: Token 'WS' defined, but not used
WARNING: There is 1 unused token
Generating LALR tables
Traceback (most recent call last):
  File "springbok.py", line 7, in <module>
    from Gtk import Gtk_Main
  File "/home/eperry/springbok/Gtk/Gtk_Main.py", line 9, in <module>
    import Gtk_MenuBar
  File "/home/eperry/springbok/Gtk/Gtk_MenuBar.py", line 30, in <module>
    from Tools.ExcelToolKit import ExcelToolKit
ImportError: No module named Tools.ExcelToolKit

could you adapt for python3

Hello sir!

as springbok uses deprecated libs, could you please adapt it, or tell me how to adapt it, to python3/pip3 ?

because I would like to try your tool, but it fails on some backend-GDK when I run it.
I did install python2 and manually all dependencies.

Thanks a lot, because I would really like to try it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.