Coder Social home page Coder Social logo

puya-pakshad / vulnerabilitydataset Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 10.21 MB

A dataset of datasets for vulnerability assessment and program analysis

Python 100.00%
ast cfg pdg cpg security program-analysis dataset vulnerability vulnerability-assessment

vulnerabilitydataset's Introduction

VulnerabilityDataset

This is a repository of datasets used to detect security vulnerabilities and types of vulnerabilities at the function level. In the excel-file titled "Main_DataSet", the record number of 15181 rows extracted from source-code of six real projects (OpenSSL, SQLite, libxslt, FreeType, LibTiff, and Binutils) is prepared at the function level. Overally, This dataset includes 49,599 records, each of which specifies the information of a function of 10 projects. Moreover, there are 275 vulnerable functions in this dataset. So Out Vulnerability dataset1 of source code extracted from 10 real projects (OpenSSL, SQLite, FreeType, LibTiff, Libxslt, Binutils, FFmpeg, ImageMagick, OpenSC, and rdesktop) was prepared for the first time that can be used publicly by security experts for further studies. Also, the attack type of each function (each row) is also specified. Each row represents information related to one function of the program. The rest of the files are 8 datasets that are produced in a balanced format (vulnerable / non-vulnerable) from the "Main_DataSet" used for the machine learning model.

Some pseudo-code snippets to calculate security metrics

pseudocode [Joern][4.3.4] as an implemented code snippet is also uploaded among the files. pseudocode of security metrics are as follows: M1:

queryNodeIndex("functionId:(id1 id2 idN) AND isCFGNode:True").as("x").outE("FLOWS_TO").id.as("y").select{it.functionId}{it}.groupBy{it[0]}{it[1]}{it.size()}.cap
queryNodeIndex("functionId:(id1 id2 idN) AND isCFGNode:True").functionId.groupCount().cap

M2:

queryNodeIndex("functionId:(id1 id2 idN) AND type:(ForStatement WhileStatement DoStatement)").groupBy{it.functionId}{it.id}.cap

M3:

queryNodeIndex("functionId:(id1 id2 idN) AND type:(ForStatement WhileStatement DoStatement)").groupBy{it.functionId}{it.id}.cap

M4:

queryNodeIndex('functionId:(*) AND type:(ForStatement WhileStatement DoStatement)').groupBy{it.functionId}{it.id}.as('x').astNodes().children().as('y').filter{it.type == 'ForStatement' || it.type == 'WhileStatement' || it.type == 'DoStatement'}.select{it}{it}.groupBy{it[0]}{it[1]} 

M5:

queryNodeIndex('functionId:(*) AND type:Parameter')

M6:

queryNodeIndex('functionId:(*) AND type:Callee').as('x').parents().astNodes().children().as('y').filter{it.type == 'Argument'}.select{it}{it}
queryNodeIndex('type: Function')

M7:

queryNodeIndex('functionId:(*) AND type:PtrMemberAccess').dedup
queryNodeIndex('functionId:(*) AND type:UnaryOperator').filter{it.code=='*'}.dedup
queryNodeIndex('functionId:(*) AND type:(UnaryExpression IncDecOp)').dedup.groupBy{it.functionId}{it.code}

M8:

queryNodeIndex('functionId:(*) AND type:PtrMemberAccess').out('USE').dedup.groupBy{it.functionId}{it.code}
queryNodeIndex('functionId:(*) AND type:UnaryOp').as('op').children().filter{it.type=='UnaryOperator' && it.code=='&'}.back('op').astNodes().filter{it.type=='Identifier'}.code.as('sys').dedup.select

M9:

queryNodeIndex('functionId:(*) AND type:UnaryOp').as('here').children().filter{it.type=='UnaryOperator' && it.code=='*'}.back('here').out('USE').groupBy{it.functionId}{it.code}.dedup

M10:

OR(queryNodeIndex('functionId:(*) AND type:Condition').in('IS_AST_PARENT'),queryNodeIndex('functionId:%s AND type:ForStatement')).dedup().groupBy{it.functionId}{it.id}.as('x').astNodes().children().as('y').filter{it.type == 'SwitchStatement' ||it.type == 'ForStatement' || it.type == 'WhileStatement' || it.type == 'DoStatement' || it.type == 'IfStatement'}.select{it.id}{it.id}.groupBy{it[0]}{it[1]}
OR(queryNodeIndex('functionId:(*) AND type:Condition').in('IS_AST_PARENT'),queryNodeIndex('functionId:%s AND type:ForStatement')).dedup().groupBy{it.functionId}{it.id}.as('x').astNodes().children().as('y').filter{it.type == 'SwitchStatement' ||it.type == 'ForStatement' || it.type == 'WhileStatement' || it.type == 'DoStatement' || it.type == 'IfStatement'}.select{it.functionId}{it.id}.groupBy{it[0]}{it[1]}

M11:

OR(queryNodeIndex('functionId:(*) AND type:Condition').in('IS_AST_PARENT'),queryNodeIndex('functionId:%s AND type:ForStatement')).dedup().groupBy{it.functionId}{it.id}.as('x').astNodes().children().as('y').filter{it.type == 'SwitchStatement' ||it.type == 'ForStatement' || it.type == 'WhileStatement' || it.type == 'DoStatement' || it.type == 'IfStatement'}.select{[it.functionId,it.id]}{it.id}.groupBy{it[0]}{it[1]}

M12:

queryNodeIndex('functionId:(*) AND type:Condition AND isCFGNode:True').as('x').outE('CONTROLS').as('y').select{[it.id,it.code,it.functionId]}{it}.groupBy{it[0]}{it[1]}

M13:

getNodesWithType('Condition').as('x').select{[it.id,it.functionId]}
queryNodeIndex('functionId:(*) AND isCFGNode:True').as('x').outE('REACHES').as('y').select{it}{it}.groupBy{it[0]}{it[1]}
queryNodeIndex('functionId:(*) AND type:IdentifierDeclStatement').as('x').uses()
queryNodeIndex('functionId:(*) AND type:IdentifierDeclStatement').as('x').defines()

M14:

queryNodeIndex('functionId:(*) AND type:Condition').parents().filter{it.type=='IfStatement'}.as('x').ithChildren('0').as('y').select{it}{it}

M15:

queryNodeIndex('functionId:(*) AND isCFGNode:True').as('x').outE('REACHES').as('y').select{it}{it.property('var')}
getNodesWithType('Condition').astNodes().filter{it.type=='Identifier'}

vulnerabilitydataset's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.