Do your dependencies leave you open to attack?

According to the 2015 Verizon Data Breach Investigations Report (DBIR). 98% of attacks are opportunistic in nature, and aimed at easy targets. The report also found that more than 70% of attacks exploited known vulnerabilities that had patches available.

The recent breach at Equifax was caused by a known vulnerability in the popular Struts web framework library, when uploading files. It took Equifax at least two weeks after the attack to discover the data breach and this was almost four months after the exploit had been made public. Automated alerting on known exploits could have prevented this catastrophic security hole.

This post shows an automated way to check your third party library dependencies to ensure your site does not become a victim to these opportunistic attacks.

We will use the dependency checker provided by OWASP. This example shows integration with a Maven build where the check is run against every build during the verify stage. The first run will take a while as it has to download the entire vulnerability database. Subsequent runs will have this cached and so will run much faster.

Maven dependency include:

         <dependency>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>${org.owasp.dependency-check-maven.version}</version>
            <scope>test</scope>
        </dependency>
Maven plugin configuration:
             <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <cveValidForHours>12</cveValidForHours>
                    <failBuildOnCVSS>8</failBuildOnCVSS>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


Maven command to run:

mvn org.owasp:dependency-check-maven:check

Reference

https://www.triology.de/en/blog-entries/automatic-checks-for-vulnerabilities-in-java-project-dependencies

https://jeremylong.github.io/DependencyCheck/dependency-check-maven/index.html

https://www.owasp.org/index.php/OWASP_Dependency_Check

 

The Four Tendencies

Gretchen Rubin says a useful way to think about people’s behavior is by considering how willing they are to meet or resist expectations on them. Expectations can either be external, like your boss asking for a project to be completed or internal, like exercising regularly.

From these she identifies the four combinations labelled as The Four Tendencies.

External Expectation
Internal Expectation
Upholder (tick) (tick)
Questioner (warning) (tick)
Obliger (tick) (warning)
Rebel (warning) (warning)

(tick) Meets (warning) Resists

This could provide you with more empathy when considering your colleagues, friends or family and make you a more effective communicator. Maybe try thinking about members of your software development team and which tendency they seem to exhibit.

Which one are you? Take the quiz and find out.

Achieving PCI compliance the easy way with a serverless architecture

Achieving PCI Compliance can be a rather onerous ongoing commitment. The first thing you will have to show is your architecture in the form of a network diagram together with a data flow diagram showing the routes where credit card data is transmitted. The more complex the architecture the more work involved in making it PCI compliant. So what can you do to mimise the amount of effort? Well your first thought should be around minimising the scope that falls under PCI compliance. This can be done by isolating only the components requried for payments and moving everything else outside of this scope.Once this is done you should then think about how to implement the system that will be in scope for compliance and this is what I want to talk about in this post.

The key to easier PCI compliance of YOUR system is to offload as much as possible to other providers and by other providers I mean Cloud hosting providers like AWS and GCP who’s platforms hare already attained PCI compliance.

In this example I’m going to use AWS. I’m going to compare two architectures, one deploying your application on EC2 instances and the other using Lambda as our serverless facilitator.

Lets take a simple application that takes credit card details from customers over the phone line and uses Paypal payment gateway to process the payment.

High level network diagram

If we ignore the telephony section of the data flow to keep things simple in this illustration then these are the architectures that we have to produce in each case

Traditional Architecture

Network diagram for traditional architecture

AWS Components used

  1. VPC
  2. public subnets
  3. private subnets
  4. Internet gateway
  5. NAT gateway
  6. Two Availability zones
  7. Internet Gateway
  8. Bastion host for SSH
  9. Security groups
  10. ACLs
  11. Route tables
  12. S3 buckets for Cloudwatch logs


Serverless Architecture

Network diagram for serverless architecture

AWS Components used

  1. Lambda (using default VPC)
  2. API gateway
  3. S3 buckets for Cloudwatch logs

It’s pretty clear how much simpler the serverless architecture is.

Next we’ll see how some of the PCI requirements are met by each architecture and especially how must of the compliance responsibility is handed over to AWS when using the serverless solution.

How each architecture meets PCI requirements – traditional versus serverless

PCI requirement
Traditional Architecture
Serverless Architecture
Harden operating system Hardened AMIs, remove unused applications, lock down ports No instances  (AWS takes care of runtime)
Incoming Firewall  DMZ to prevent unauthorized access, Security Group on VPC Lambda comes with default VPC
Outoing internet access Internet gateway, NAT gateway, Security groups and/or ACLs Default Lambda VPC has outgoining internet access
Do not provide direct access to instances Use a bastion host to allow SSH access No Instances, so no SSH required

 

By going serverless we are able to totally ignore the following requirements:

  • Requirement 2: Do not use vendor-supplied defaults for system passwords and other security parameters
  • Requirement 5: Protect all systems against malware and regularly update anti-virus software or programsg

Does your Kanban maturity level match your team’s ?

A Kanban board seems at first site like something easy to implement. You draw some columns on a wall, put headings for backlog, in progress and done and then stick postit notes all over it to represents tasks, easy right?

Well kind of 🙂

I’ve been promoting the use of Kanban at our company, we have been using it for about 6 months now. I knew it was an incremental approach and that we should introduce something simple and build from there with the attitude of continuous improvement (Kaizen).

However, alot of the Kanban guides push you in at a quite advanced level, talking about limiting Work In Progress (WIP) and pulling work through the system.

For immature teams (which I guess is the majaority first adopting Kanban) this is too much early on and could lead to the team rejecting the kanban system.

After reading David J Anderson’s excellent book I’ve come to realise that the best way is to evolve Kanban into an organisation gradually, being aware of the maturity of your team and matching that to the sophistication of the Kanban system in use.

This is a great article on doing just that:

http://anderson.leankanban.com/kanban-patterns-organizational-maturity/

Calculating Transactions Per Minute from log file entries

Here’s a linux command I found useful in extracting simple transactions per minute from log file entries

grep -h 'Unique text per transaction' requests.log.* | cut -c1-16 | uniq -c | sed s/./,/8 > transactions_per_minute.csv

This produces a file with the number of transactions/requests for each minute over time: e.g.

34,2017-03-29 11:45
83,2017-03-29 11:46
114,2017-03-29 11:47
84,2017-03-29 11:48
70,2017-03-29 11:49
64,2017-03-29 11:50
76,2017-03-29 11:51

You can now convert this into a visually revealing graph, using for example Google Sheets e.g.

Install Docker on Linux Mint 18

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install linux-image-extra-$(uname -r) -y
sudo apt-get install docker-engine cgroup-lite apparmor -y
sudo usermod -a -G docker $USER
sudo service docker start

Keyboard shortcuts for any web page

Vimium gives you a way to navigate a web page without using the mouse.

I now use this browser extension all the time, in fact I feel lost when using someone else’s computer and have to resort to reaching for the mouse.

It simply gives each hyper link a unique character code e.g. ‘gw’ which you type to select the link. To trigger the codes simply press ‘f’ on a web page.

Vimium is free and open source, and supports Chrome and Firefox.

https://vimium.github.io/

 

Do you have any keyboard shortcut productivity tricks? Let me know.

Text to UML

The problem with using drawing tools to produce your UML diagrams is that it makes it hard for someone else to maintain. How many times have you come across a document/wiki you need to update and just have a .PNG file for the sequence diagram, to make changes you now have to redraw the diagram from scratch! Rats!

Text to UML solves this problem by giving you the source code for a diagram. Now all you have to do is edit the source code and re-render and voila, your existing sequence diagram is up to date, lovely.

Other advantages are:

  • It’s much quicker to make changes
  • You don’t have to worry about consistent layout
  • Diagrams can be generated

The best tool I’ve found so far is PlantUml it supports most UML diagram types. PlantUml is open source available on SourceForge

Martin Fowler also seems to prefer a text to UML approach