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

Add sanity check for credentials #1783

Open
nichtsfrei opened this issue Dec 13, 2024 · 0 comments
Open

Add sanity check for credentials #1783

nichtsfrei opened this issue Dec 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nichtsfrei
Copy link
Member

nichtsfrei commented Dec 13, 2024

As long as the openvas implementation is used it is not possible to define credentials with the same service type multiple times per target. This is because the credentials are getting exposed via a NASL script, that gets the preferences and exposes them as kb item, as an example:

krb5_login    = script_get_preference( "KRB5 login:", id:1 );
krb5_password = script_get_preference( "KRB5 password:", id:2 );
krb5_realm    = script_get_preference( "KRB5 realm:", id:3 );
krb5_kdc      = script_get_preference( "KRB5 kdc:", id:4 );

if( krb5_login )    set_kb_item( name:"KRB5/login_filled/0", value:krb5_login );
if( krb5_password ) set_kb_item( name:"KRB5/password_filled/0", value:krb5_password );
if( krb5_realm )    set_kb_item( name:"KRB5/realm_filled/0", value:krb5_realm );
if( krb5_kdc )      set_kb_item( name:"KRB5/kdc_filled/0", value:krb5_kdc );

exit( 0 );

This effectively limits the credential per target and credential service to one.

However neither the API documentation mentions that limitation nor does openvasd prevent adding multiple entries for the same service and target.

A scan with multiple entries per service

    "credentials": [
      {
        "service": "ssh",
        "up": {
          "username": "tesme",
          "password": "testme"
        },
        {
        "service": "ssh",
        "up": {
          "username": "testus",
          "password": "praktikus"
        }
    ],

Is accepted although it cannot work as the caller intended (try first, when not working try the second).

The expected behavior would be a 400 with a reasoning that ssh got defined twice.

Jira: SC-1212

@nichtsfrei nichtsfrei added the bug Something isn't working label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant