Application Security Automation Part 2

Automated Static Code Analysis

Görkem Çetin
6 min readJan 7, 2022

Installation

Note that almost all of the installations and configurations are not hardened so if you create something similar on a production environment please do it in a more secure way (I will post about this topic later), this process is just for demonstrating this system and its potential capabilities on a local environment.

Lab Information

Windows 10, updated, local firewall disabled (all parts can be installed on Linux too), 4 machines in total on VMware.

  • 1 Sensor -> number of sensors can be increased
  • 1 SSC -> Requires a DB which I will install on same machine. In a production environment DB and application server should be on different machines.
  • 1 Controller ->Scan Central Controller
  • 1 Jenkins -> no nodes for now just a simple installation for testing

1-Sensor(s)

You need to install Fortify SCA first then modify it as a worker of Scan Central.

What You Need

  • Fortify SCA Installer exe
  • Valid Fortify License

Run the exe and the installer will lead you. I will point out some important decisions below. Check out the screenshot descriptions.

I don’t need IDE plugins because I will start scans from Jenkins. Audit Workbench is for examining results of scans which is .fpr files. It is totally optional.
License file’s name should be fortify.license. Different names cause problems.
You need to access following URL for rules so if there is a proxy on your system, you should provide information about proxy.
It is always good to have samples for testing.

Installation is done, you have a working standalone SCA. “sourceanalyzer” is added to path so you can use it directly from command line. It is not a worker for Scan Central yet, we will configure it later in the upcoming posts.

2-SSC

You need to have a database and a Tomcat server for SSC. I will use MySQL. MsSQL and Oracle are supported too.

What You Need

  • MySQL installer
  • Tomcat installer
  • JDK for Tomcat
  • SSC files
JDK is simple, follow the installer.
A simple non-secure default installation for testing purposes.

Important configurations for MySQL, other DB systems require different configurations.

I will use Workbench for creating tables and by default Workbench blocks UPDATE and DELETE so we need to disable it.

Edit > Preferences> SQL Editor > Others > Disable Safe Updates

After confirming the new preference, you need to restart Workbench.

You also need to change “max_allowed_packet” size because default size of MySQL is too small for SSC’s seeding packets. There are various ways to change this parameter, but I will change mine directly from my.ini.

After restarting MySQL, it is ready for SSC tables. create_tables script can be found in SSC setup files.

Fortify SSC requires case sensitive collation, and it is crucial. I will use latin1_general_cs
We can run the create-tables script now.
There may be warnings but make sure there are no errors on the output.

When the script execution is done, database for SSC is ready.

Next step is Tomcat. I will install it as a Windows Service, so installer is great.

Even it is a test environment and almost all of installations are not hardened, not installing manager is a good habit for reducing attack surface.
After the installation is complete do not start the Tomcat yet. There is some configuration to do.

You need to create a folder for SSC’s files and add this path to Tomcat, default location of this folder usually cause a chaotic situation. I almost always use following path for the home folder. The name of the folder is up to your creativity.

Go to Tomcat’s service manager and add new home folder.
New path under Java Options and increase max memory pool

After copying SSC .war file under Tomcat webapps folder, we are ready to start Tomcat.

Next step is basic configuration of SSC. Open your browser and go to http://localhost:8080/ssc . 8080 is the port I chose. It may be different if you choose another port.

Click on “Administrators”. Setup will require a token. We can find the token in home folder we created before.
Good to go.
You need to upload a valid license and agree the path you are using as home folder.
I do not need “Global Search” or “Header Validation” for this test system.
You need to connect SSC with database schema you created before. Testing the connection and making sure that it works properly is important before going further, it won’t work without a database.
Next step is seeding the database. The order of packets is important, so do not do this randomly. I modified the max_allowed_packet for these packets.
SSC basic setup is done, restart the Tomcat service and we are good to go.
Default admin user’s password is “admin”. SSC will ask you to change it in first login, it is a high complexity password by default so new password must include upper, lower case letter, numbers and symbols. You know the drill.

SSC is ready to go.

3-Controller

Scan Central Controller is similar with SSC, a java application running on Tomcat, but it is less customizable than SSC. It comes as a package from Microfocus.

What You Need:

  • JDK
  • Controller installation files
JDK is simple, follow the installer.
You need to create a home folder for controller too. I prefer a location directly under C. Naming of folder must not have spaces.
Extract the controller files to folder.
I will set the controller as a service, Microfocus provides a script for this goal. I will name the service as “controller”

We are good to go, controller is ready.

4-Jenkins & Scan Central Client

To translate the source code, you need Fortify SCA. Setup is same with sensor at this point, I will configure it as a client later. Please refer to “1-Sensor(s)” for details.

Jenkins is default too, I only changed the port and plugins that come with suggested settings. Jenkins requires JDK too. It is possible to follow Jenkins’ documentation.

4 machines for this system are ready now.

--

--

Görkem Çetin

CSSLP, Security+ / I try to share my knowledge and experience about cyber security.