Skip to main content

Auditing Cisco configuration - CIS RAT

CIS RAT (Centre for Internet Security - Router Assessment Tool) is a free Perl tool that audits Cisco config files against CIS benchmarks, it creates an HTML report and shows where your config meets or fails CIS benchmark. We can audit against benchmark level 1 and 2.The tool is supported on both Linux and Windows (though getting it to work on Windows required a bit of source code tweaking). 


RAT can audit configuration of the following devices:
  • IOS
  • ASA
  • PIX
  • FWSM
RAT can be downloaded here: 

Installation on Windows requires ActiveState Perl to be installed. Detailed installation instruction can be found in "rat\etc\install.win32.txt" upon extraction. 


Upon installing RAT I had to edit "rat.pl" and change the following (this shouldn't be required so it may work in your case)

  • line 669: to point to the correct directory
    • use lib 'c:\rat\lib';.
  • lines 746 & 747: again hard coding the paths
    • $ncat_prog        = $PROG_PREFIX . '\bin\ncat.pl';
    • $ncat_report_prog = $PROG_PREFIX . '\bin\ncat_report.pl'

RAT allows us to customize set of "checks" we want to perform. This step is not required if you want to audit against actual CIS benchmark, in most cases however, we will want to edit it to align it with our Security Policy. 

Run "ncat_config.pl":

"C:\rat\bin>perl ncat_config.pl -s customorules.conf"

The script will ask a number of questions and allow you to customize set of checks it'll perform. It'll then save "customrules.conf". For example if you have a separate management network (for VTY access or SNMP) that you already protect with ACLs you may not want to apply additional local ACLs, which is required by the "default" CIS benchmark. Another example is exec timeout. CIS requires that the timeout is set to 10 while your security policy may require 5.  

Running RAT:

By default RAT uses rule set for IOS devices, so we don't need to specify -t. 

c:\>perl rat.pl  -r customrules.conf "c:\confs\10.10.10.10.txt"



To audit PIX, ASA, FWSM we need to use option "-t" to specify config type:


c:\>perl rat.pl -t cisco-firewall -r customrules.conf "c:\confs\ 10.10.10.100.txt"


I have run into issue where RAT will fail with the following error:


"Nested quantifiers in regex; marked by <-- HERE in m/IOSSNMPCommunity->** <-- "


This happens when "snmp-server community" option is set to asterisks. That would be the case if you copy the IOS config file from CiscoWorks.  Just delete the asterisks and re-run the script. 

Comments

Popular posts from this blog

x.509 Certificates - Critical vs non-critical extensions

Extensions are used to associate additional information with the user or the key.  Each certificate extension has three attributes - extnID, critical, extnValue extnID - Extension ID - an OID that specifies the format and definitions of the extension critical - Critical flag - Boolean value extnValue - Extension value  Criticality flag specifies whether the information in an extension is important. If an application doesn't recognize the extension marked as critical, the certificate cannot be accepted. If an extension is not marked as critical (critical value False) it can be ignored by an application. In Windows, critical extensions are marked with a yellow exclamation mark,  View certificate extensions using OpenSSL: # openssl x509 -inform pem -in cert.pem -text -noout (output abbreviated)         X509v3 extensions:             X509v3 Key Usage: critical                 Digital Signature, Key Encipherment             X509v3 Subject Key Identifier

DNS response and error types

In this post we explore common DNS response codes. We will cover the following responses: NOERROR SERVFAIL NXDOMAIN NODATA REFUSED Throughout article we’ll refer to the following RFCs: RFC 1034 - DOMAIN NAMES - CONCEPTS AND FACILITIES RFC 2308 - Negative Caching of DNS Queries (DNS NCACHE) RFC 2136 - Dynamic Updates in the Domain Name System (DNS UPDATE) RFC 8914 - Extended DNS Errors Response Codes - RCODEs The DNS RCODES are best defined in RFC2316 .  They signify what type of response was sent by the server. “RCODE   Response code - this four bit field is undefined in requests and set in responses.”   The table below shows the summary of the currently defined RCODEs. Mnemonic Val Description NOERROR 0 No error condition.

DNS blocking in Indonesia

DNS based censorship and domain blocking in Indonesia is very inconsistent among ISPs. There’s a government mandated black list which the ISPs operating in the country should enforce. However, Indonesia lacks centralised internet infrastructure and has many separate ISPs. In addition, the Indonesian government granted ISPs the authority to block content at their own discretion. All of this leads to a very inconsistent DNS blocking in Indonesia. Official DNS domain blacklist in Indonesia The Government mandated DNS blacklist is published in a redacted form and can be downloaded here: https://trustpositif.kominfo.go.id/ . This is where the blocked domains get redirected to. We can search the database and check if a domain is blocked. In the screenshot below we can see that a popular cryptocurrency exchange is blocked (Ada) and that wikipedia.org is not (Tidak Ada) - thanks to Google Translate. Examples of blocked DNS queries dig binance.com @182.253.45.122 ;; global options: +cmd ;; Got