How to get vulnerabilities by asset trought the VM API

I´m trying to get a list of vulnerabilities filtering by asset using the API, but I´m not being able to perform it.
I can get the assets or vulnerabilities information separately, but not this.

Anyone has ever done it? I´ve already spent many time reading documentation.

Thanks in advance.

Miguel

1 Like

I was able to get what I think you’re looking for using this endpoint:

hxxps://insightvm[.]example[.]com/api/3/vulnerabilities/flash_player-cve-2018-15982/assets

{
  "links" : [ {
    "href" : "hxxps://insightvm[.]example[.]com/api/3/vulnerabilities/flash_player-cve-2018-15982/assets",
    "rel" : "self"
  }, {
    "href" : "hxxps://insightvm[.]example[.]com/api/3/assets/123”,
    "rel" : "Asset"
  }, {
    "href" : "hxxps://insightvm[.]example[.]com/api/3/assets/456”,
    "rel" : "Asset"
  } ],
  "resources" : [ 123, 456 ]
}

EDIT: You can also do it by asset:

hxxps://insightvm[.]example[.]com/api/3/assets/123/vulnerabilities

{
  "resources" : [ {
    "id" : "7-zip-cve-2016-2334",
    "instances" : 1,
    "links" : [ {
      "href" : "hxxps://insightvm[.]example[.]com/api/3/assets/123/vulnerabilities/7-zip-cve-2016-2334",
      "rel" : "self"
/*SNIP*/

Hope this helps.

-Beau

Thank you!! In addition, do you know if there is a way to get the “solution” vulnerability field? It shows when you query for vulnerabilities.

Thanks in advance!