Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(exploitdb): add the information of exploitdb-papers #52

Merged
merged 7 commits into from
Aug 8, 2021

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Jun 20, 2021

What did you implement:

The current fetch exploitdb inserts Exploits and Shellcodes information from offensive-security/exploitdb.

In this PR, I would like to add information about offensive-security/exploitdb-papers to fetch exploitdb. exploitdb-papers contains information about papers and so on.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Search by CVE-ID

// PR
$ go-exploitdb search --type CVE --param CVE-2012-6613

Results: 
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2012-6613
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 22930
  URL: https://www.exploit-db.com/exploits/22930
  Description: D-Link DSR-250N Persistent Root Access

[*]Exploit Detail Info: 
  [*]OffensiveSecurity: 
  - Paper:
    https://github.com/offensive-security/exploitdb-papers/blob/master/papers/english/22930-d-link-dsr-250n-persistent-root-access.txt
---------------------------------------

// upstream/master
$ go-exploitdb search --type CVE --param CVE-2012-6613

Results: 
---------------------------------------
No Record Found

Search by ExploitUniqueID

$ go-exploitdb search --type ID --param 30061

Results: 
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2013-5946
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 30061
  URL: https://www.exploit-db.com/exploits/30061
  Description: Zine: D-Link DSR Router Series - Remote Command Execution

[*]Exploit Detail Info: 
  [*]OffensiveSecurity: 
  - Paper:
    https://github.com/offensive-security/exploitdb-papers/blob/master/papers/english/30061-zine-d-link-dsr-router-series---remote-command-execution.txt
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2013-7004
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 30061
  URL: https://www.exploit-db.com/exploits/30061
  Description: Zine: D-Link DSR Router Series - Remote Command Execution

[*]Exploit Detail Info: 
  [*]OffensiveSecurity: 
  - Paper:
    https://github.com/offensive-security/exploitdb-papers/blob/master/papers/english/30061-zine-d-link-dsr-router-series---remote-command-execution.txt
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2013-7005
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 30061
  URL: https://www.exploit-db.com/exploits/30061
  Description: Zine: D-Link DSR Router Series - Remote Command Execution

[*]Exploit Detail Info: 
  [*]OffensiveSecurity: 
  - Paper:
    https://github.com/offensive-security/exploitdb-papers/blob/master/papers/english/30061-zine-d-link-dsr-router-series---remote-command-execution.txt
---------------------------------------

Query modification

The offensive_security_id used in WHERE when searching for documents, shell_codes, (papers) has been changed to use the correct one.
The upstream/master only uses offensive_securities.id:7449. The query should use both 7449 and 7500. It has been fixed as such.

sqlite> SELECT id FROM "exploits"  WHERE ("exploits"."exploit_unique_id" = '6560');
id
7449
7450
sqlite> SELECT * FROM "offensive_securities"  WHERE ("offensive_securities"."exploit_unique_id" = '6560');
id|exploit_id|exploit_unique_id
7449|7449|6560
7450|7450|6560

// PR
$ go-exploitdb search --type ID --param 6560 --debug-sql

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:53) 
[2021-06-28 12:38:47]  [0.05ms]  PRAGMA foreign_keys = ON  
[0 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:181) 
[2021-06-28 12:38:47]  [8.18ms]  SELECT * FROM "exploits"  WHERE ("exploits"."exploit_unique_id" = '6560')  
[2 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [0.70ms]  SELECT * FROM "offensive_securities"  WHERE ("offensive_securities"."exploit_id" = 7449) ORDER BY "offensive_securities"."id" ASC LIMIT 1  
[1 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [6.43ms]  SELECT * FROM "documents"  WHERE ("offensive_security_id" IN (7449)) ORDER BY "documents"."id" ASC  
[0 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [0.24ms]  SELECT * FROM "shell_codes"  WHERE ("offensive_security_id" IN (7449)) ORDER BY "shell_codes"."id" ASC  
[0 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [0.30ms]  SELECT * FROM "papers"  WHERE ("offensive_security_id" IN (7449)) ORDER BY "papers"."id" ASC  
[0 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [0.38ms]  SELECT * FROM "offensive_securities"  WHERE ("offensive_securities"."exploit_id" = 7450) ORDER BY "offensive_securities"."id" ASC LIMIT 1  
[1 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [9.16ms]  SELECT * FROM "documents"  WHERE ("offensive_security_id" IN (7450)) ORDER BY "documents"."id" ASC  
[1 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [0.36ms]  SELECT * FROM "shell_codes"  WHERE ("offensive_security_id" IN (7450)) ORDER BY "shell_codes"."id" ASC  
[0 rows affected or returned ] 

(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186) 
[2021-06-28 12:38:47]  [0.44ms]  SELECT * FROM "papers"  WHERE ("offensive_security_id" IN (7450)) ORDER BY "papers"."id" ASC  
[0 rows affected or returned ]

// upstream/master
$ go-exploitdb search --type ID --param 6560 --debug-sql

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:54) 
[2021-06-28 12:37:43]  [0.06ms]  PRAGMA foreign_keys = ON  
[0 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:152) 
[2021-06-28 12:37:43]  [8.77ms]  SELECT * FROM "exploits"  WHERE ("exploits"."exploit_unique_id" = '6560')  
[2 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157) 
[2021-06-28 12:37:43]  [0.19ms]  SELECT * FROM "offensive_securities"  WHERE ("offensive_securities"."exploit_unique_id" = '6560') ORDER BY "offensive_securities"."id" ASC LIMIT 1  
[1 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157) 
[2021-06-28 12:37:43]  [5.25ms]  SELECT * FROM "documents"  WHERE ("offensive_security_id" IN (7449))  
[0 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157) 
[2021-06-28 12:37:43]  [0.32ms]  SELECT * FROM "shell_codes"  WHERE ("offensive_security_id" IN (7449))  
[0 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157) 
[2021-06-28 12:37:43]  [0.15ms]  SELECT * FROM "offensive_securities"  WHERE ("offensive_securities"."exploit_unique_id" = '6560') ORDER BY "offensive_securities"."id" ASC LIMIT 1  
[1 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157) 
[2021-06-28 12:37:43]  [6.34ms]  SELECT * FROM "documents"  WHERE ("offensive_security_id" IN (7449))  
[0 rows affected or returned ] 

(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157) 
[2021-06-28 12:37:43]  [0.33ms]  SELECT * FROM "shell_codes"  WHERE ("offensive_security_id" IN (7449))  
[0 rows affected or returned ]

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n changed the title [WIP] feat(exploitdb): add the information of exploitdb-papers feat(exploitdb): add the information of exploitdb-papers Jun 28, 2021
@kotakanbe kotakanbe self-requested a review July 14, 2021 03:47
Copy link
Collaborator

@kotakanbe kotakanbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kotakanbe kotakanbe merged commit 79c6cb4 into vulsio:master Aug 8, 2021
@MaineK00n MaineK00n deleted the add-exploitdb-papers branch August 8, 2021 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants