Consulta de información de vulnerabilidad sobre un servidor
Función
Esta API se utiliza para consultar la información de vulnerabilidad de un servidor.
Método de invocación
Para obtener más información, consulte Invocación a las API.
URI
GET /v5/{project_id}/vulnerability/host/{host_id}
Parámetro |
Obligatorio |
Tipo |
Descripción |
---|---|---|---|
project_id |
Sí |
String |
ID del proyecto del tenant. Mínimo: 1 Máximo: 256 |
host_id |
Sí |
String |
ID del servidor. Mínimo: 1 Máximo: 128 |
Parámetro |
Obligatorio |
Tipo |
Descripción |
---|---|---|---|
enterprise_project_id |
No |
String |
ID de proyecto empresarial. Para consultar todos los proyectos empresariales, establezca este parámetro en all_granted_eps. Valor predeterminado: 0 Mínimo: 0 Máximo: 256 |
type |
No |
String |
Tipo de vulnerabilidad. El valor predeterminado es linux_vul. Las opciones son las siguientes:
Mínimo: 0 Máximo: 64 |
vul_name |
No |
String |
Nombre de vulnerabilidad Mínimo: 0 Máximo: 256 |
limit |
No |
Integer |
Número de registros mostrados en cada página. Mínimo: 0 Máximo: 200 Valor predeterminado: 10 |
offset |
No |
Integer |
Desfase, que especifica la posición inicial del registro que se va a devolver. El valor debe ser un número no menor que 0. El valor predeterminado es 0. Mínimo: 0 Máximo: 2000000 Valor predeterminado: 0 |
handle_status |
No |
String |
Estado de gestión. Las opciones son las siguientes: - unhandled - handled Mínimo: 1 Máximo: 32 |
status |
No |
String |
Estado de vulnerabilidad. Las opciones son las siguientes:
Mínimo: 1 Máximo: 32 |
repair_priority |
No |
String |
Prioridad de corrección. Las opciones son las siguientes:
Mínimo: 1 Máximo: 10 |
Parámetros de solicitud
Parámetro |
Obligatorio |
Tipo |
Descripción |
---|---|---|---|
X-Auth-Token |
Sí |
String |
Token de usuario. Se puede obtener invocando a la API de IAM utilizada para obtener un token de usuario. El valor de X-Subject-Token en el encabezado de respuesta es un token. Mínimo: 1 Máximo: 32768 |
Parámetros de respuesta
Código de estado: 200
Parámetro |
Tipo |
Descripción |
---|---|---|
total_num |
Long |
Total Mínimo: 0 Máximo: 2147483647 |
data_list |
Array of HostVulInfo objects |
Lista de vulnerabilidades en un servidor Longitud de matriz: 0 - 2147483647 |
Parámetro |
Tipo |
Descripción |
---|---|---|
vul_name |
String |
Nombre de vulnerabilidad Mínimo: 0 Máximo: 256 |
vul_id |
String |
ID de vulnerabilidad Mínimo: 0 Máximo: 64 |
label_list |
Array of strings |
Lista de etiquetas de vulnerabilidad Mínimo: 0 Máximo: 65534 Longitud de matriz: 0 - 2147483647 |
repair_necessity |
String |
Urgencia de reparación. Las opciones son las siguientes:
Mínimo: 0 Máximo: 64 |
scan_time |
Long |
Hora de escaneo más reciente Mínimo: 0 Máximo: 9223372036854775807 |
type |
String |
Tipo de vulnerabilidad. Las opciones son las siguientes: -linux_vul: vulnerabilidad de Linux -windows_vul: vulnerabilidad de Windows -web_cms: vulnerabilidad de Web-CMS -app_vul: vulnerabilidad de aplicación Mínimo: 0 Máximo: 128 |
app_list |
Array of app_list objects |
Lista de software afectado por la vulnerabilidad en el servidor Longitud de matriz: 0 - 2147483647 |
severity_level |
String |
Nivel de riesgo.
Mínimo: 1 Máximo: 128 |
solution_detail |
String |
Solución Mínimo: 0 Máximo: 65534 |
url |
String |
URL Mínimo: 0 Máximo: 2083 |
description |
String |
Descripción de la vulnerabilidad Mínimo: 0 Máximo: 65534 |
repair_cmd |
String |
Comando de reparación Mínimo: 1 Máximo: 256 |
status |
String |
Estado de vulnerabilidad
Mínimo: 1 Máximo: 128 |
repair_success_num |
Integer |
Cantidad total de veces que HSS corrige la vulnerabilidad en toda la red Mínimo: 0 Máximo: 1000000 |
cve_list |
Array of cve_list objects |
Lista de CVE Longitud de matriz: 1 - 10000 |
is_affect_business |
Boolean |
Si los servicios se ven afectados |
first_scan_time |
Long |
Fecha y hora de primer análisis Mínimo: 0 Máximo: 9223372036854775807 |
app_name |
String |
Software Mínimo: 0 Máximo: 256 |
app_version |
String |
Versión Mínimo: 0 Máximo: 256 |
app_path |
String |
Ruta de software Mínimo: 0 Máximo: 512 |
version |
String |
Cuota de ECS Mínimo: 0 Máximo: 128 |
support_restore |
Boolean |
Indica si los datos se pueden revertir a la copia de respaldo creada cuando se corrigió la vulnerabilidad. |
disabled_operate_types |
Array of disabled_operate_types objects |
Lista de tipos de operación de vulnerabilidades que no se pueden realizar. Longitud de matriz: 1 - 10000 |
repair_priority |
String |
Prioridad de corrección. Las opciones son las siguientes:
Mínimo: 1 Máximo: 10 |
Parámetro |
Tipo |
Descripción |
---|---|---|
app_name |
String |
Software Mínimo: 0 Máximo: 256 |
app_version |
String |
Versión de software Mínimo: 0 Máximo: 256 |
upgrade_version |
String |
Versión a la que se debe actualizar el software con vulnerabilidad Mínimo: 0 Máximo: 256 |
app_path |
String |
Ruta del software de la aplicación (Este campo solo está disponible para las vulnerabilidades de la aplicación). Mínimo: 1 Máximo: 512 |
Parámetro |
Tipo |
Descripción |
---|---|---|
cve_id |
String |
ID de CVE Mínimo: 1 Máximo: 32 |
cvss |
Float |
Puntaje de CVSS Mínimo: 0 Máximo: 10 |
Parámetro |
Tipo |
Descripción |
---|---|---|
operate_type |
String |
Tipo de operación.
Mínimo: 1 Máximo: 64 |
reason |
String |
Indica el motivo por el que no se puede realizar la operación. Mínimo: 0 Máximo: 512 |
Solicitudes de ejemplo
Consultar las primeras 10 vulnerabilidades en el servidor cuyo ID es xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxxxxxxxxx.
GET https://{endpoint}/v5/2b31ed520xxxxxxebedb6e57xxxxxxxx/vulnerability/host/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx?offset=0&limit=10
Ejemplo de respuestas
Código de estado: 200
Lista de vulnerabilidades en un servidor
{ "data_list" : [ { "app_list" : [ { "app_name" : "Apache Log4j API(Apache Log4j API)", "app_version" : "2.8.2", "upgrade_version" : "2.8.3", "app_path" : "/CloudResetPwdUpdateAgent/lib/log4j-api-2.8.2.jar" }, { "app_name" : "Apache Log4j Core(Apache Log4j Core)", "app_version" : "2.8.2", "upgrade_version" : "2.8.3", "app_path" : "/CloudResetPwdUpdateAgent/lib/log4j-api-2.8.2.jar" } ], "app_name" : "Apache Log4j API(Apache Log4j API)", "app_path" : "/CloudResetPwdUpdateAgent/lib/log4j-api-2.8.2.jar", "app_version" : "2.8.2", "cve_list" : [ { "cve_id" : "CVE-2021-45046", "cvss" : 9 } ], "description" : "It was found that the fix for address CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete in some non-default configurations. This could allow attackers with control over Thread Context Map (MDC) input data when the logging configuration uses a non-default Pattern Layout with either a Context Lookup (for example, $${ctx:loginId}) or a Thread Context Map pattern (%X, %mdc, or %MDC) to craft malicious input data using a JNDI Lookup pattern, leading to information leakage and remote code execution in some environments. Log4j 2.16.0 (Java 8) and 2.12.2 (Java 7) fix this issue by removing support for the message search mode and disabling the JNDI function by default.", "first_scan_time" : 1688956612533, "is_affect_business" : true, "label_list" : [ ], "repair_necessity" : "Critical", "scan_time" : 1690469489713, "severity_level" : "Critical", "repair_cmd" : "yum update tcpdump", "solution_detail" : "The official fixing suggestions for this vulnerability have been released. You can visit the following website and fix the vulnerability accordingly:\nhttps://logging.apache.org/log4j/2.x/security.html\nFor details about the patch for this vulnerability, visit the following website:\nhttps://www.oracle.com/security-alerts/cpujan2022.html\nFor details about unofficial fixing suggestions for this vulnerability, visit the following website:\nhttp://www.openwall.com/lists/oss-security/2021/12/14/4\nhttps://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00646.html\nhttps://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-apache-log4j-qRuKNEbd\nhttp://www.openwall.com/lists/oss-security/2021/12/15/3\nhttps://cert-portal.siemens.com/productcert/pdf/ssa-661247.pdf\nhttps://www.kb.cert.org/vuls/id/930724\nhttps://cert-portal.siemens.com/productcert/pdf/ssa-714170.pdf\nhttps://www.debian.org/security/2021/dsa-5022\nhttps://www.oracle.com/security-alerts/alert-cve-2021-44228.html\nhttps://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0032\nhttp://www.openwall.com/lists/oss-security/2021/12/18/1\nhttps://cert-portal.siemens.com/productcert/pdf/ssa-397453.pdf\nhttps://cert-portal.siemens.com/productcert/pdf/ssa-479842.pdf\nhttps://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EOKPQGV24RRBBI4TBZUDQMM4MEH7MXCY/\nhttps://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SIG7FZULMNK2XF6FZRU4VWYDQXNMUGAJ/\nThe vulnerability exploitation/POC of this vulnerability has been exposed. You can verify the vulnerability by referring to the following links:\nhttps://github.com/X1pe0/Log4J-Scan-Win\nhttps://github.com/cckuailong/Log4j_CVE-2021-45046\nhttps://github.com/BobTheShoplifter/CVE-2021-45046-Info\nhttps://github.com/tejas-nagchandi/CVE-2021-45046\nhttps://github.com/pravin-pp/log4j2-CVE-2021-45046\nhttps://github.com/mergebase/log4j-samples\nhttps://github.com/lukepasek/log4jjndilookupremove\nhttps://github.com/ludy-dev/cve-2021-45046\nhttps://github.com/lijiejie/log4j2_vul_local_scanner\nhttps://github.com/CaptanMoss/Log4Shell-Sandbox-Signature\nhttps://github.com/taise-hub/log4j-poc", "status" : "vul_status_unfix", "type" : "app_vul", "url" : "[\"https://www.oracle.com/security-alerts/cpujan2022.html\"]", "version" : "hss.version.wtp", "vul_id" : "HCVD-APP-CVE-2021-45046", "vul_name" : "CVE-2021-45046", "repair_success_num" : 3, "support_restore" : true, "disabled_operate_types" : [ { "operate_type" : "immediate_repair", "reason" : "The kernel vulnerability of CCE container node cannot be automatically fixed." } ] } ], "total_num" : 31 }
Código de ejemplo del SDK
El código de ejemplo del SDK es el siguiente.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.hss.v5.region.HssRegion; import com.huaweicloud.sdk.hss.v5.*; import com.huaweicloud.sdk.hss.v5.model.*; public class ListHostVulsSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); HssClient client = HssClient.newBuilder() .withCredential(auth) .withRegion(HssRegion.valueOf("<YOUR REGION>")) .build(); ListHostVulsRequest request = new ListHostVulsRequest(); request.withEnterpriseProjectId("<enterprise_project_id>"); request.withType("<type>"); request.withVulName("<vul_name>"); request.withLimit(<limit>); request.withOffset(<offset>); request.withHandleStatus("<handle_status>"); request.withStatus("<status>"); request.withRepairPriority("<repair_priority>"); try { ListHostVulsResponse response = client.listHostVuls(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkhss.v5.region.hss_region import HssRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkhss.v5 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = __import__('os').getenv("CLOUD_SDK_AK") sk = __import__('os').getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = HssClient.new_builder() \ .with_credentials(credentials) \ .with_region(HssRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListHostVulsRequest() request.enterprise_project_id = "<enterprise_project_id>" request.type = "<type>" request.vul_name = "<vul_name>" request.limit = <limit> request.offset = <offset> request.handle_status = "<handle_status>" request.status = "<status>" request.repair_priority = "<repair_priority>" response = client.list_host_vuls(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" hss "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := hss.NewHssClient( hss.HssClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListHostVulsRequest{} enterpriseProjectIdRequest:= "<enterprise_project_id>" request.EnterpriseProjectId = &enterpriseProjectIdRequest typeRequest:= "<type>" request.Type = &typeRequest vulNameRequest:= "<vul_name>" request.VulName = &vulNameRequest limitRequest:= int32(<limit>) request.Limit = &limitRequest offsetRequest:= int32(<offset>) request.Offset = &offsetRequest handleStatusRequest:= "<handle_status>" request.HandleStatus = &handleStatusRequest statusRequest:= "<status>" request.Status = &statusRequest repairPriorityRequest:= "<repair_priority>" request.RepairPriority = &repairPriorityRequest response, err := client.ListHostVuls(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
Más información
Para obtener un código de ejemplo del SDK de más lenguajes de programación, consulte la pestaña Código de ejemplo en API Explorer. El código de ejemplo del SDK se puede generar automáticamente.
Códigos de estado
Código de estado |
Descripción |
---|---|
200 |
Lista de vulnerabilidades en un servidor |
Códigos de error
Consulte Códigos de error.