Unable to get nvts from a scan config

I’m trying to get all NVTs from a scan config but I get the following error:

VirtualSystem:~# runuser -u _gvm -- gvm-cli tls --pretty --hostname 127.0.0.1 -X "<get_nvts config_id='d21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663'/>"
Remote closed the connection

    md   main:  DEBUG:2021-02-18 13h10.35 UTC:8602: <= client  "<get_nvts config_id='d21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663'/>"
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql: SELECT user_can_everything ('ca024a03-432e-45f6-bfad-18d6b3b88d2e');
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql_x end (SELECT user_can_everything ('%s');)
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql: SELECT value FROM public.meta WHERE name = 'nvts_feed_version';
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql_x end (SELECT value FROM %s.meta WHERE name = 'nvts_feed_version';)
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql: SELECT EXISTS (SELECT * FROM permissions               WHERE                 name = 'Super'                AND ((resource = 0)                     OR ((resource_type = 'user')                         AND (resource = (SELECT configs.owner                                          FROM configs                                          WHERE uuid = 'd21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663')))                     OR ((resource_type = 'role')                         AND (resource                              IN (SELECT DISTINCT role                                  FROM role_users                                  WHERE "user"                                        = (SELECT configs.owner                                           FROM configs                                           WHERE uuid                                                 = 'd21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663'))))                     OR ((resource_type = 'group')                         AND (resource                              IN (SELECT DISTINCT "group"                                  FROM group_users                                  WHERE "user"                                        = (SELECT configs.owner                                           FROM configs                                           WHERE uuid = 'd21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663')))))                AND subject_location = 0                AND ((subject_type = 'user'                      AND subject                          = (SELECT id FROM users                             WHERE users.uuid = 'ca024a03-432e-45f6-bfad-18d6b3b88d2e'))                     OR (subject_type = 'group'                         AND subject                             IN (SELECT DISTINCT "group"                                 FROM group_users                                 WHERE "user"                                       = (SELECT id                                          FROM users                                          WHERE users.uuid                                                = 'ca024a03-432e-45f6-bfad-18d6b3b88d2e')))                     OR (subject_type = 'role'                         AND subject                             IN (SELECT DISTINCT role                                 FROM role_users                                 WHERE "user"                                       = (SELECT id                                          FROM users                                          WHERE users.uuid                                                = 'ca024a03-432e-45f6-bfad-18d6b3b88d2e')))));
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql_x end (SELECT EXISTS (SELECT * FROM permissions               WHERE                 name = 'Super'                AND ((resource = 0)                     OR ((resource_type = 'user')                         AND (resource = (SELECT %ss%s.owner                                          FROM %ss%s                                          WHERE %s = '%s')))                     OR ((resource_type = 'role')                         AND (resource                              IN (SELECT DISTINCT role                                  FROM role_users                                  WHERE "user"                                        = (SELECT %ss%s.owner                                           FROM %ss%s                                           WHERE %s                                                 = '%s'))))                     OR ((resource_type = 'group')                         AND (resource                              IN (SELECT DISTINCT "group"                                  FROM group_users                                  WHERE "user"                                        = (SELECT %ss%s.owner                                           FROM %ss%s                                           WHERE %s = '%s')))))                AND subject_location = 0                AND ((subject_type = 'user'                      AND subject                          = (SELECT id FROM users                             WHERE users.uuid = '%s'))                     OR (subject_type = 'group'                         AND subject                             IN (SELECT DISTINCT "group"                                 FROM group_users                                 WHERE "user"                                       = (SELECT id                                          FROM users                                          WHERE users.uuid                                                = '%s')))                     OR (subject_type = 'role'                         AND subject                             IN (SELECT DISTINCT role                                 FROM role_users                                 WHERE "user"                                       = (SELECT id                                          FROM users                                          WHERE users.uuid                                                = '%s')))));)
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql: SELECT id FROM configs WHERE uuid = 'd21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663';
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602:    sql_x end (SELECT id FROM %ss%s WHERE uuid = '%s'%s%s;)
md   main:  DEBUG:2021-02-18 13h10.35 UTC:8602: -> client: <get_nvts_response status="200" status_text="OK">
md manage:  DEBUG:2021-02-18 13h10.35 UTC:8602: Received Aborted signal
md   main:  DEBUG:2021-02-18 13h10.35 UTC:8602:    Cleaning up
md   main:  DEBUG:2021-02-18 13h10.35 UTC:8602:    Exiting    

However, I can execute the rest of the commands without errors. There are no errors in the log files and I can see that the information is stored in the database.

Any thoughts about what is happening?

Getting all the NVTs of a config this way is (currently) not allowed. With the get_nvts command you always have to select a family or a single NVT when using the config_id parameter.

To make this clear, I’ll add a proper error message and update the GMP documentation for the next GVM 20.08 release and future ones.

3 Likes

I looked at the source code and I saw the constraint yesterday. Anyway, thank you so much.