Category: NIST

  • Security concerns regarding OpenSSH mac sha1 in Debian

    What is HMAC?

    HMAC stands for Hash-Based Message Authentication Code. It’s a specific way to use a cryptographic hash function (like SHA-1, SHA-256, etc.) along with a secret key to produce a unique “fingerprint” of some data. This fingerprint allows someone else with the same key to verify that the data hasn’t been tampered with.

    How HMAC Works

    Keyed Hashing: The core idea is to incorporate the secret key into the hashing process. This is done in a specific way to prevent clever attacks that might try to bypass the security.
    Inner and Outer Hashing: HMAC uses two rounds of hashing. First, the message and a modified version of the key are hashed together. Then, the result of that hash, along with another modified version of the key, are hashed again. This two-step process adds an extra layer of protection.

    HMAC in OpenSSH

    OpenSSH uses HMAC to ensure the integrity of messages sent back and forth during an SSH session. This prevents an attacker from subtly modifying data in transit.

    HMAC-SHA1 with OpenSSH: Is it Weak?

    SHA-1 itself is considered cryptographically broken. This means that with enough computing power, it’s possible to find collisions (two different messages that produce the same hash). However, HMAC-SHA1 is generally still considered secure for most purposes. This is because exploiting weaknesses in SHA-1 to break HMAC-SHA1 is much more difficult than just finding collisions in SHA-1.

    Should you use it?

    While HMAC-SHA1 might still be okay for now, it’s best practice to move to stronger alternatives like HMAC-SHA256 or HMAC-SHA512. OpenSSH supports these, and they provide a greater margin of safety against future attacks.

    In Summary

    HMAC is a powerful tool for ensuring data integrity. Even though SHA-1 has weaknesses, HMAC-SHA1 in OpenSSH is likely still safe for most users. However, to be on the safe side and prepare for the future, switching to HMAC-SHA256 or HMAC-SHA512 is recommended.

    Following are instructions for creating dataproc clusters with sha1 mac support removed:

    I can appreciate an excess of caution, and I can offer you some code to produce Dataproc instances which do not allow HMAC authentication using sha1.

    Place code similar to this in a startup script or an initialization action that you reference when creating a cluster with gcloud dataproc clusters create:

    #!/bin/bash
    # remove mac specification from sshd configuration
    sed -i -e 's/^macs.*$//' /etc/ssh/sshd_config
    # place a negative MACs specification in the /etc/ssh/sshd_config.d/ config directory
    mkdir -p /etc/ssh/sshd_config.d
    ssh -Q mac | perl -e \
      '@mac=grep{ chomp; /sha1/ }; print("MACs -", join(",",@mac), $/)' >> \
      /etc/ssh/sshd_config.d/disable-mac-sha1.conf
    # reload the new ssh service configuration
    systemctl reload ssh.service
    

    If this code is hosted on GCS, you can refer to it with

    --initialization-actions=CLOUD_STORAGE_URI,[...]

    or

    --metadata startup-script-url=CLOUD_STORAGE_URI,[...]
  • Trip Report: UW signing-party

    Dear Debian Users,

    I met last night with a friend from many years ago and a number of students of cryptography. I was disappointed to see the prevalence of black hat, anti-government hackers at the event. I was hoping that civilized humanity had come to agree that using cryptography for deception, harm to others and plausible deniability is bad, m’kay? When one speaks of the government as “they,” nobody’s going to get anywhere really quick. Let’s take responsibility for the upkeep of the environment in which we find ourselves, please.

    Despite what I perceived as a negative focus of the presentation, it was good to meet with peers in the Seattle area. I was very pleasantly surprised to find that better than half of the attendees were not male, that many of the socioeconomic classes of the city were represented, as were those of various ethnic backgrounds. I am really quite proud of the progress of our State University, even if I’m not always in agreement with the content that they’re polluting our kids’ brains with. I guess I should roll up my sleeves and get busy, eh?

    V/R,

    C.J.

  • NIST::NVD CWE development – follow along

    I’m in the process of getting the tests passing for the 0.03 release of NIST::NVD::Store::SQLite3 wherein our hero imports the CWE data and cross-indexes it with CVEs and CPEs.

    Follow along and suggest some patches. I’m developing on Debian Wheezy, but I would very much like input from devs on other platforms.

    http://git.colliertech.org/?p=NIST-NVD-Store-SQLite3.git;a=summary

    cjac@foxtrot:/tmp$ time git clone http://git.colliertech.org/git/NIST-NVD-Store-SQLite3.git
    Cloning into 'NIST-NVD-Store-SQLite3'...
    
    real	0m32.757s
    user	0m0.200s
    sys	0m0.088s
    cjac@foxtrot:/tmp$ ls NIST-NVD-Store-SQLite3/t/data/
    cwec_v2.1.xml  nvdcve-2.0-test.xml
    

    Publish your patches and I’ll fetch them, or you can submit them in udiff format and I’ll review/apply. Thanks for playing along!

    [edit 20120216T1456 -0800]
    Seems I need to update the NIST::NVD package as well.

    cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db *.db ; perl Makefile.PL ; make ; time perl -Iblib/lib /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3
    rm: cannot remove `t/data/*.db': No such file or directory
    Writing Makefile for NIST::NVD::Store::SQLite3
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm
    using store [SQLite3]
    reading NVDs from file: /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml.......................................................................read 68 entries
    Processing CWE file...vvvvvvvvvvvvvvvvvvvvvvvvvvvcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeDone.
    Writing CPE URNs to disk...Done.
    Writing NVD entries to disk....................................................................... Done.
    Writing CPE index to disk...Done.
    Writing CWE index to disk...Can't locate object method "put_idx_cwe" via package "NIST::NVD::Update" at /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve line 77.
    
    real	0m13.072s
    user	0m12.421s
    sys	0m0.044s
    
    $ time git clone http://git.colliertech.org/git/NIST-NVD.git
    Cloning into 'NIST-NVD'...
    
    real	0m2.921s
    user	0m0.016s
    sys	0m0.024s
    

    [edit 20120216T16:28 -0800]

    cjac@foxtrot:/usr/src/git/f5/NIST-NVD$ git log | head -5
    commit 82c72a79ee810c2b5c269a15dca5151ad67059f9
    Author: C.J. Adams-Collier 
    Date:   Thu Feb 16 16:25:53 2012 -0800
    
        added put_idx_cwe to NIST::NVD::Update
    

    [edit 20120216T1635 -0800]

    cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db *.db ; perl Makefile.PL ; make ; time perl -Iblib/lib /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3
    rm: cannot remove `t/data/*.db': No such file or directory
    Writing Makefile for NIST::NVD::Store::SQLite3
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm
    using store [SQLite3]
    reading NVDs from file: /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml.......................................................................read 68 entries
    Processing CWE file...vvvvvvvvvvvvvvvvvvvvvvvvvvvcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeDone.
    Writing CPE URNs to disk...Done.
    Writing NVD entries to disk....................................................................... Done.
    Writing CPE index to disk...Done.
    Writing CWE index to disk...Done.
    
    real	0m13.968s
    user	0m13.225s
    sys	0m0.064s
    

    Alright. before going to bed, I made those “w” characters above mean something. Same with some of the “v” characters above.

    [edit 20120217T10:50 -0800]

    Now processing the Categories from the CWE files. At this point we have parsed the Description elements. Next up are:

    [edit 20120217T11:35 -0800]

    1. Likelihood_of_Exploit
    2. Time_of_Introduction
    3. Affected_Resources
    4. Applicable_Platforms
    cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db *.db ; perl Makefile.PL ; make ; time perl -Iblib/lib /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3
    rm: cannot remove `t/data/*.db': No such file or directory
    Writing Makefile for NIST::NVD::Store::SQLite3
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm
    using store [SQLite3]
    reading NVDs from file: /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml.......................................................................Done.
    read 68 nvd entries
    Processing CWE file...vvvvvvvvvvvvvvvvvvvvvvvvvvvvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeDone.
    read 27 cwe Views
    read 1 cwe Categories
    read 693 cwe Weaknesses
    read 1 cwe Compound Elements
    Writing CPE URNs to disk...Done.
    Writing NVD entries to disk....................................................................... Done.
    Writing CPE index to disk...Done.
    Writing CWE index to disk...Done.
    
    real	0m14.306s
    user	0m13.501s
    sys	0m0.072s
    
    

    [edit 20120217T1333 -0800]

    Alright, I’ve got enough of the CWE processing done that I feel comfortable releasing this stuff. Let’s make sure that the data got all the way down into the database. I’ll write some tests in t/cwe.t to exercise the CRUD

    [edit 20120217T1345 -0800]

    Tests are in place and failing (this is good, by the way). Now to turn the tests green.

    cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ pushd ../NIST-NVD ; perl Makefile.PL ; make ; popd ; rm t/data/*.db *.db ; perl Makefile.PL ; make ; time prove -v -I../NIST-NVD/blib/lib -Iblib/lib t/cwe.t
    /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/svn/f5/axiom/branches/cjac/F5-Discovery
    Writing Makefile for NIST::NVD
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/Base.pm (unchanged)
    Skip blib/lib/NIST/NVD.pm (unchanged)
    Skip blib/lib/NIST/NVD/Query.pm (unchanged)
    Skip blib/lib/NIST/NVD/Update.pm (unchanged)
    Skip blib/lib/NIST/NVD/Store/DB_File.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::Base.3pm
    Manifying blib/man3/NIST::NVD.3pm
    Manifying blib/man3/NIST::NVD::Query.3pm
    Manifying blib/man3/NIST::NVD::Update.3pm
    Manifying blib/man3/NIST::NVD::Store::DB_File.3pm
    /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/svn/f5/axiom/branches/cjac/F5-Discovery
    rm: cannot remove `t/data/*.db': No such file or directory
    Writing Makefile for NIST::NVD::Store::SQLite3
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm
    t/cwe.t .. 
    1..10
    ok 1 - use NIST::NVD::Query;
    ok 2 - no error
    ok 3 - constructor returned an object of correct class
    not ok 4 - cve_for_cpe returned ARRAY ref
    
    #   Failed test 'cve_for_cpe returned ARRAY ref'
    #   at t/cwe.t line 36.
    #          got: ''
    #     expected: 'ARRAY'
    not ok 5 - cwe_for_cpe returned ARRAY ref
    
    #   Failed test 'cwe_for_cpe returned ARRAY ref'
    #   at t/cwe.t line 37.
    #          got: ''
    #     expected: 'ARRAY'
    Can't use an undefined value as an ARRAY reference at t/cwe.t line 39.
    # Looks like you planned 10 tests but ran 5.
    # Looks like you failed 2 tests of 5 run.
    # Looks like your test exited with 2 just after 5.
    Dubious, test returned 2 (wstat 512, 0x200)
    Failed 7/10 subtests 
    
    Test Summary Report
    -------------------
    t/cwe.t (Wstat: 512 Tests: 5 Failed: 2)
      Failed tests:  4-5
      Non-zero exit status: 2
      Parse errors: Bad plan.  You planned 10 tests but ran 5.
    Files=1, Tests=5,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.07 cusr  0.01 csys =  0.10 CPU)
    Result: FAIL
    
    real	0m0.442s
    user	0m0.144s
    sys	0m0.028s
    
    

    [edit 20120220T1311 -0800]

    CWE load is passing. It takes 13 seconds to process all CWEs in cwec_v2.1.xml and some recent CVEs from the 13th of December of 2011. It seems I’ve broken t/query.t, though. When it’s green I’ll push a new release. Everything is in master. Check it out if you like pain.

    cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db ; pushd ../NIST-NVD/ ; perl Makefile.PL ; make ; popd ; perl -I../NIST-NVD/blib/lib Makefile.PL ; make ; PERL5LIB=../NIST-NVD/blib/lib:blib/lib prove -I../NIST-NVD/blib/lib -bv t/01-load-nvdcve.t 
    /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3
    Writing Makefile for NIST::NVD
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/Base.pm (unchanged)
    Skip blib/lib/NIST/NVD.pm (unchanged)
    Skip blib/lib/NIST/NVD/Query.pm (unchanged)
    Skip blib/lib/NIST/NVD/Update.pm (unchanged)
    Skip blib/lib/NIST/NVD/Store/DB_File.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::Base.3pm
    Manifying blib/man3/NIST::NVD.3pm
    Manifying blib/man3/NIST::NVD::Query.3pm
    Manifying blib/man3/NIST::NVD::Update.3pm
    Manifying blib/man3/NIST::NVD::Store::DB_File.3pm
    /usr/src/git/f5/NIST-NVD-Store-SQLite3
    Writing Makefile for NIST::NVD::Store::SQLite3
    Writing MYMETA.yml and MYMETA.json
    Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged)
    cp bin/convert-nvdcve blib/script/convert-nvdcve
    /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve
    Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm
    t/01-load-nvdcve.t .. 
    1..20
    ok 1 - $dist_dir is a directory
    ok 2 - $test_dir is a directory
    ok 3 - $data_dir is a directory
    ok 4 - $convert_script is a file
    ok 5 - $nvd_source_file is a file
    ok 6 - $db_file does not yet exist
    # running /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3 2>&1
    ok 7 - took less than 15 seconds to load CWE data: 13
    ok 8 - conversion script returned cleanly
    ok 9 - database file exists
    ok 10 - database file not empty
    ok 11 - database file readable
    ok 12 - database file writeable
    ok 13 - database file not executable
    ok 14 - file is correct type: [application/octet-stream]
    ok 15 - $mtime is close
    ok 16 - opened database file for reading
    ok 17 - file contents indicate correct type: [application/octet-stream]
    ok 18 - file contents indicate correct type: [application/octet-stream]
    ok 19 - file contents indicate correct type: [SQLite 3.x database]
    ok 20 - constructor returned an object of correct class
    ok
    All tests successful.
    Files=1, Tests=20, 13 wallclock secs ( 0.02 usr  0.02 sys + 12.78 cusr  0.07 csys = 12.89 CPU)
    Result: PASS
    
    

    [edit 20120220T2220 -0800]
    Okay, it’s published. I’ll need to factor the changes in to the DB_File storage engine as well.

    [edit 20120225T20:27 -0800]
    Just published an update. It probably works better.

    Next up is creating another index from cpe urn to cwe data

  • NIST::NVD::Store::SQLite3

    I published an SQLite3 storage back-end to NIST::NVD on the CPAN. It’s pretty quick. About as fast as the DB_File one, but without the down side of being tied to DB_File. It shouldn’t be too difficult to re-factor this code to any DBI-based database. MariaDB anyone?

    I know it works on Debian. The nightly CPAN test results should come back shortly and I’ll find out how well it works on other platforms.

  • Perl interface to processing / querying NIST’s NVD feed

    For a work project, I wrote a library in perl that can be used to query the NVD feed that NIST publishes here:

    http://nvd.nist.gov/download.cfm

    Here’s a snippit from the perldoc:

    use NIST::NVD::Query;
     
    # use convert_nvdcve to generate these files from the XML dumps at
    # http://nvd.nist.gov/download.cfm
     
    my( $path_to_db, $path_to_idx_cpe ) = @ARGV;
     
    my $q = NIST::NVD::Query->new( database => $path_to_db,
                                   idx_cpe  => $path_to_idx_cpe,
                                  );
     
    # Given a Common Platform Enumeration urn, returns a list of known
    # CVE IDs
     
    my $cve_id_list = $q->cve_for_cpe( cpe => 'cpe:/a:zaal:tgt:1.0.6' );
     
    my @entry;
     
    foreach my $cve_id ( @$cve_id_list ){
     
      # Given a CVE ID, returns a CVE entry
     
      my $entry = $q->cve( cve_id => $cve_id );
      push( @entry, $entry );
     
      print $entry->{'vuln:summary'};
    }