Amazon Linux AMI : sudo (ALAS-2021-1478) - Nessus

High   Plugin ID: 145451

This page contains detailed information about the Amazon Linux AMI : sudo (ALAS-2021-1478) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 145451
Name: Amazon Linux AMI : sudo (ALAS-2021-1478)
Filename: ala_ALAS-2021-1478.nasl
Vulnerability Published: 2021-01-26
This Plugin Published: 2021-01-26
Last Modification Time: 2022-04-07
Plugin Version: 1.7
Plugin Type: local
Plugin Family: Amazon Linux Local Security Checks
Dependencies: ssh_get_info.nasl
Required KB Items [?]: Host/AmazonLinux/release, Host/AmazonLinux/rpm-list, Host/local_checks_enabled

Vulnerability Information


Severity: High
Vulnerability Published: 2021-01-26
Patch Published: 2021-01-26
CVE [?]: CVE-2021-3156
CPE [?]: cpe:/o:amazon:linux, p-cpe:/a:amazon:linux:sudo, p-cpe:/a:amazon:linux:sudo-debuginfo, p-cpe:/a:amazon:linux:sudo-devel
Exploited by Malware: True

Synopsis

The remote Amazon Linux AMI host is missing a security update.

Description

The version of sudo installed on the remote host is prior to 1.8.23-9.56. It is, therefore, affected by a vulnerability as referenced in the ALAS-2021-1478 advisory.

- When sudo runs a command in shell mode, either via the -s or -i command line option, it escapes special characters in the command's arguments with a backslash. The sudoers policy plugin will then remove the escape characters from the arguments before evaluating the sudoers policy (which doesn't expect the escape characters) if the command is being run in shell mode. (CVE-2021-3156)

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number.

Solution

Run 'yum update sudo' to update your system.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Amazon Linux AMI : sudo (ALAS-2021-1478) vulnerability:

  1. Metasploit: exploit/linux/local/sudo_baron_samedit
    [Sudo Heap-Based Buffer Overflow]
  2. Exploit-DB: exploits/multiple/local/49521.py
    [EDB-49521: Sudo 1.9.5p1 - 'Baron Samedit ' Heap-Based Buffer Overflow Privilege Escalation (1)]
  3. Exploit-DB: exploits/multiple/local/49522.c
    [EDB-49522: Sudo 1.9.5p1 - 'Baron Samedit ' Heap-Based Buffer Overflow Privilege Escalation (2)]
  4. GitHub: https://github.com/0xd114/CVE-2021-3156
    [CVE-2021-3156]
  5. GitHub: https://github.com/0xsakthi/my-pentest-notes
    [CVE-2021-3156]
  6. GitHub: https://github.com/1N53C/CVE-2021-3156-PoC
    [CVE-2021-3156]
  7. GitHub: https://github.com/ARGOeu/secmon-probes
    [CVE-2021-3156]
  8. GitHub: https://github.com/Al1ex/LinuxEelvation
    [CVE-2021-3156]
  9. GitHub: https://github.com/AlexSeniorProject/CVE-2021-3156
    [CVE-2021-3156]
  10. GitHub: https://github.com/Chal13W1zz/Sudo-Spunk
    [CVE-2021-3156: An Exploit Utlising CVE-2021-3156 To Harvest All passwords in any Linux system with ...]
  11. GitHub: https://github.com/ClassBluer/Exploit_Tools
    [CVE-2021-3156]
  12. GitHub: https://github.com/CrackerCat/cve-2021-3157
    [CVE-2021-3156]
  13. GitHub: https://github.com/CyberCommands/CVE-2021-3156
    [CVE-2021-3156]
  14. GitHub: https://github.com/CyberCommands/exploit-sudoedit
    [CVE-2021-3156]
  15. GitHub: https://github.com/EGI-Federation/SVG-advisories
    [CVE-2021-3156]
  16. GitHub: https://github.com/EdgeSecurityTeam/Vulnerability
    [CVE-2021-3156]
  17. GitHub: https://github.com/Exodusro/CVE-2021-3156
    [CVE-2021-3156]
  18. GitHub: https://github.com/Floodnut/papers_documents_Analysis
    [CVE-2021-3156]
  19. GitHub: https://github.com/Gutem/scans-exploits
    [CVE-2021-3156]
  20. GitHub: https://github.com/H4ckForJob/cve-2021-3156
    [CVE-2021-3156: 脚本小子竟是我自己?]
  21. GitHub: https://github.com/HynekPetrak/HynekPetrak
    [CVE-2021-3156]
  22. GitHub: https://github.com/Jauler/cve2021-3156-sudo-heap-overflow
    [CVE-2021-3156]
  23. GitHub: https://github.com/Kiprey/Skr_Learning
    [CVE-2021-3156]
  24. GitHub: https://github.com/Kleptocratic/CVE-2021-3156
    [CVE-2021-3156: Sudo heap-based buffer overflow privilege escalation commands and mitigations.]
  25. GitHub: https://github.com/Mr-xn/Penetration_Testing_POC
    [CVE-2021-3156]
  26. GitHub: https://github.com/NeQuissimus/nixos-vuln
    [CVE-2021-3156]
  27. GitHub: https://github.com/OrangeGzY/security-research-learning
    [CVE-2021-3156]
  28. GitHub: https://github.com/Pluto-123/CVE-2021-3156sadsad
    [CVE-2021-3156: sadsdsssssssssss]
  29. GitHub: https://github.com/Pluto-123/CVE-2021-3156
    [CVE-2021-3156: sadsanjdjsand]
  30. GitHub: https://github.com/RodricBr/CVE-2021-3156
    [CVE-2021-3156]
  31. GitHub: https://github.com/SPXcz/IC1_projekt
    [CVE-2021-3156]
  32. GitHub: https://github.com/SantiagoSerrao/ScannerCVE-2021-3156
    [CVE-2021-3156]
  33. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2021-3156]
  34. GitHub: https://github.com/TheFlash2k/CVE-2021-3156
    [CVE-2021-3156]
  35. GitHub: https://github.com/Timirepo/CVE_Exploits
    [CVE-2021-3156]
  36. GitHub: https://github.com/Toufupi/CVE_Collection
    [CVE-2021-3156]
  37. GitHub: https://github.com/Y3A/CVE-2021-3156
    [CVE-2021-3156]
  38. GitHub: https://github.com/ajtech-hue/CVE-2021-3156-Mitigation-ShellScript-Build
    [CVE-2021-3156]
  39. GitHub: https://github.com/amanszpapaya/MacPer
    [CVE-2021-3156]
  40. GitHub: https://github.com/baka9moe/CVE-2021-3156-Exp
    [CVE-2021-3156]
  41. GitHub: https://github.com/barebackbandit/CVE-2021-3156
    [CVE-2021-3156: Exploit for CVE-2021-3156]
  42. GitHub: https://github.com/bc29ea3c101054baa1429ffc2edba4ae/sigma_detection_rules
    [CVE-2021-3156]
  43. GitHub: https://github.com/binw2018/CVE-2021-3156-SCRIPT
    [CVE-2021-3156]
  44. GitHub: https://github.com/blasty/CVE-2021-3156
    [CVE-2021-3156]
  45. GitHub: https://github.com/bollwarm/SecToolSet
    [CVE-2021-3156]
  46. GitHub: https://github.com/bsauce/kernel-exploit-factory
    [CVE-2021-3156]
  47. GitHub: https://github.com/bsauce/kernel-security-learning
    [CVE-2021-3156]
  48. GitHub: https://github.com/capturingcats/CVE-2021-3156
    [CVE-2021-3156]
  49. GitHub: https://github.com/cdeletre/Serpentiel-CVE-2021-3156
    [CVE-2021-3156]
  50. GitHub: https://github.com/chenaotian/CVE-2021-3156
    [CVE-2021-3156: CVE-2021-3156 POC and Docker and Analysis write up]
  51. GitHub: https://github.com/d3c3ptic0n/CVE-2021-3156
    [CVE-2021-3156]
  52. GitHub: https://github.com/dock0d1/CVE-2021-3156
    [CVE-2021-3156]
  53. GitHub: https://github.com/donghyunlee00/CVE-2021-3156
    [CVE-2021-3156]
  54. GitHub: https://github.com/dyne/sud
    [CVE-2021-3156]
  55. GitHub: https://github.com/foyjog/shocker-attack
    [CVE-2021-3156]
  56. GitHub: https://github.com/freeFV/CVE-2021-3156
    [CVE-2021-3156]
  57. GitHub: https://github.com/freitzzz/tpas-binary-exploitation
    [CVE-2021-3156]
  58. GitHub: https://github.com/gamblingmaster2020/vCenterExp
    [CVE-2021-3156]
  59. GitHub: https://github.com/greg-workspace/my_sudo_heap_overflow_exploit
    [CVE-2021-3156]
  60. GitHub: https://github.com/hac425xxx/heap-exploitation-in-real-world
    [CVE-2021-3156]
  61. GitHub: https://github.com/harsh-bothra/learn365
    [CVE-2021-3156]
  62. GitHub: https://github.com/hilbix/suid
    [CVE-2021-3156]
  63. GitHub: https://github.com/jokerTPR2004/CVE-2021-3156
    [CVE-2021-3156]
  64. GitHub: https://github.com/joydo/CVE-Writeups
    [CVE-2021-3156]
  65. GitHub: https://github.com/kaosagnt/ansible-everyday
    [CVE-2021-3156]
  66. GitHub: https://github.com/ker2x/DearDiary
    [CVE-2021-3156]
  67. GitHub: https://github.com/leterts/CVE-2021-3156-sudo-raising
    [CVE-2021-3156]
  68. GitHub: https://github.com/liqimore/ECE9609-Introduction-to-Hacking
    [CVE-2021-3156]
  69. GitHub: https://github.com/litt1eb0yy/CVE-2021-3156
    [CVE-2021-3156: Exploit for CVE-2021-3156]
  70. GitHub: https://github.com/lockedbyte/CVE-Exploits
    [CVE-2021-3156]
  71. GitHub: https://github.com/lockedbyte/slides
    [CVE-2021-3156]
  72. GitHub: https://github.com/lognoz/puppet-freebsd-workstation
    [CVE-2021-3156]
  73. GitHub: https://github.com/loong576/ansible-production-practice-6
    [CVE-2021-3156]
  74. GitHub: https://github.com/lovechinacoco/https-github.com-mai-lang-chai-Middleware-Vulnerability-detection
    [CVE-2021-3156]
  75. GitHub: https://github.com/ltfafei/CVE-2021-3156
    [CVE-2021-3156]
  76. GitHub: https://github.com/ltfafei/my_POC
    [CVE-2021-3156]
  77. GitHub: https://github.com/mrofisr/docker-cve-2021-3156
    [CVE-2021-3156]
  78. GitHub: https://github.com/mr-r3b00t/CVE-2021-3156
    [CVE-2021-3156]
  79. GitHub: https://github.com/mstxq17/SecurityArticleLogger
    [CVE-2021-3156]
  80. GitHub: https://github.com/musergi/CVE-2021-3156
    [CVE-2021-3156]
  81. GitHub: https://github.com/neolin-ms/LinuxDocLinks
    [CVE-2021-3156]
  82. GitHub: https://github.com/nexcess/sudo_cve-2021-3156
    [CVE-2021-3156]
  83. GitHub: https://github.com/njahrckstr/exploits-
    [CVE-2021-3156]
  84. GitHub: https://github.com/oneoy/CVE-2021-3156
    [CVE-2021-3156]
  85. GitHub: https://github.com/oneoy/exploits1
    [CVE-2021-3156]
  86. GitHub: https://github.com/oriolOrnaque/TFG-Binary-exploitation
    [CVE-2021-3156]
  87. GitHub: https://github.com/password520/CVE-2021-3156
    [CVE-2021-3156]
  88. GitHub: https://github.com/pathakabhi24/Awesome-C
    [CVE-2021-3156]
  89. GitHub: https://github.com/puckiestyle/CVE-2021-3156
    [CVE-2021-3156]
  90. GitHub: https://github.com/pvnovarese/2022-02-enterprise-demo
    [CVE-2021-3156]
  91. GitHub: https://github.com/qxxxb/ctf_challenges
    [CVE-2021-3156]
  92. GitHub: https://github.com/r0eXpeR/pentest
    [CVE-2021-3156]
  93. GitHub: https://github.com/r4j0x00/exploits
    [CVE-2021-3156]
  94. GitHub: https://github.com/redhawkeye/sudo-exploit
    [CVE-2021-3156]
  95. GitHub: https://github.com/ret2basic/SudoScience
    [CVE-2021-3156: CVE-2021-3156 deep dive.]
  96. GitHub: https://github.com/ret2basic/sudoscience
    [CVE-2021-3156: CVE-2021-3156 deep dive.]
  97. GitHub: https://github.com/sandesvitor/simple-ansible-lab
    [CVE-2021-3156]
  98. GitHub: https://github.com/saucer-man/exploit
    [CVE-2021-3156]
  99. GitHub: https://github.com/siddicky/yotjf
    [CVE-2021-3156]
  100. GitHub: https://github.com/stressboi/TA-Samedit
    [CVE-2021-3156]
  101. GitHub: https://github.com/tainguyenbp/linux-cve
    [CVE-2021-3156]
  102. GitHub: https://github.com/teamtopkarl/CVE-2021-3156
    [CVE-2021-3156]
  103. GitHub: https://github.com/uhub/awesome-c
    [CVE-2021-3156]
  104. GitHub: https://github.com/unauth401/CVE-2021-3156
    [CVE-2021-3156]
  105. GitHub: https://github.com/wuuconix/CVE-2021-3156-Dockerfile-not-succeed
    [CVE-2021-3156: 试图在ubuntu:20.04里复现CVE-2021-3156。但是失败了,请大佬看看问题出在哪里]
  106. GitHub: https://github.com/xtaran/sshudo
    [CVE-2021-3156]
  107. GitHub: https://github.com/ypl6/heaplens
    [CVE-2021-3156: CMPT733 Cybersecurity Lab II Project: GDB plugin for heap exploits inspired by ...]
  108. GitHub: https://github.com/0x7183/CVE-2021-3156
    [CVE-2021-3156: Sudo Heap Overflow Baron Samedit]
  109. GitHub: https://github.com/AbdullahRizwan101/Baron-Samedit
    [CVE-2021-3156: This is a repo for the PoC's I found from diffrernt github repoisitory of the recent ...]
  110. GitHub: https://github.com/apogiatzis/docker-CVE-2021-3156
    [CVE-2021-3156: A docker environment to research CVE-2021-3156]
  111. GitHub: https://github.com/Ashish-dawani/CVE-2021-3156-Patch
    [CVE-2021-3156: Patch Script for CVE-2021-3156 Heap Overflow]
  112. GitHub: https://github.com/Bubleh21/CVE-2021-3156
    [CVE-2021-3156: CVE-2021-3156 exploit]
  113. GitHub: https://github.com/CptGibbon/CVE-2021-3156
    [CVE-2021-3156: Root shell PoC for CVE-2021-3156]
  114. GitHub: https://github.com/dinhbaouit/CVE-2021-3156
    [CVE-2021-3156: CVE-2021-3156 Vagrant Lab]
  115. GitHub: https://github.com/elbee-cyber/CVE-2021-3156-PATCHER
    [CVE-2021-3156: This simple bash script will patch the recently discovered sudo heap overflow ...]
  116. GitHub: https://github.com/GatoGamer1155/CVE-2021-3156
    [CVE-2021-3156: About Script en python sobre la vulnerabilidad CVE-2021-3156]
  117. GitHub: https://github.com/gmldbd94/cve-2021-3156
    [CVE-2021-3156: 보안취약점 확인]
  118. GitHub: https://github.com/kal1gh0st/CVE-2021-3156
    [CVE-2021-3156: Description Sudo before 1.9.5p2 has a Heap-based Buffer Overflow, allowing privilege ...]
  119. GitHub: https://github.com/kernelzeroday/CVE-2021-3156-Baron-Samedit
    [CVE-2021-3156: 1day research effort]
  120. GitHub: https://github.com/LiveOverflow/pwnedit
    [CVE-2021-3156: CVE-2021-3156 - Sudo Baron Samedit]
  121. GitHub: https://github.com/lmol/CVE-2021-3156
    [CVE-2021-3156: Exploit generator for sudo CVE-2021-3156]
  122. GitHub: https://github.com/mbcrump/CVE-2021-3156
    [CVE-2021-3156: Notes regarding CVE-2021-3156: Heap-Based Buffer Overflow in Sudo]
  123. GitHub: https://github.com/Nokialinux/CVE-2021-3156
    [CVE-2021-3156: CVE-2021-3156漏洞修复Shell]
  124. GitHub: https://github.com/perlun/sudo-1.8.3p1-patched
    [CVE-2021-3156: Custom version of sudo 1.8.3p1 with CVE-2021-3156 patches applied]
  125. GitHub: https://github.com/ph4ntonn/CVE-2021-3156
    [CVE-2021-3156]
  126. GitHub: https://github.com/Q4n/CVE-2021-3156
    [CVE-2021-3156: 复现别人家的CVEs系列]
  127. GitHub: https://github.com/r3k4t/how-to-solve-sudo-heap-based-bufferoverflow-vulnerability
    [CVE-2021-3156: How to solve Sudo Heap-Based Buffer Overflow Vulnerability — CVE-2021-3156?]
  128. GitHub: https://github.com/reverse-ex/CVE-2021-3156
    [CVE-2021-3156]
  129. GitHub: https://github.com/Rvn0xsy/CVE-2021-3156-plus
    [CVE-2021-3156: CVE-2021-3156非交互式执行命令]
  130. GitHub: https://github.com/sharkmoos/Baron-Samedit
    [CVE-2021-3156: Exploit and Demo system for CVE-2021-3156]
  131. GitHub: https://github.com/stong/CVE-2021-3156
    [CVE-2021-3156: PoC for CVE-2021-3156 (sudo heap overflow)]
  132. GitHub: https://github.com/TheSerialiZator/CTF-2021
    [CVE-2021-3156: CTF for HDE 64 students at See Security College. Exploit a JWT (web part) & ...]
  133. GitHub: https://github.com/worawit/CVE-2021-3156
    [CVE-2021-3156: Sudo Baron Samedit Exploit]
  134. GitHub: https://github.com/ymrsmns/CVE-2021-3156
    [CVE-2021-3156]
  135. GitHub: https://github.com/0xdevil/CVE-2021-3156
    [CVE-2021-3156: Exploit for Sudo heap overflow (CVE-2021-3156) on Debain 10]
  136. GitHub: https://github.com/jm33-m0/CVE-2021-3156
    [CVE-2021-3156: Sudo heap overflow to LPE, in Go]
  137. GitHub: https://github.com/nobodyatall648/CVE-2021-3156
    [CVE-2021-3156: Checking CVE-2021-3156 vulnerability & patch script]
  138. GitHub: https://github.com/voidlsd/CVE-2021-3156
    [CVE-2021-3156: A simple script to patch CVE-2021-3156 (heap based buffer overflow via sudo).]
  139. GitHub: https://github.com/yaunsky/cve-2021-3156
    [CVE-2021-3156: Cve-2021-3156;sudo堆溢出漏洞;漏洞检测]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2021-3156
CVSS V2 Vector: AV:L/AC:L/Au:N/C:C/I:C/A:C/E:H/RL:OF/RC:C
CVSS Base Score:7.2 (High)
Impact Subscore:10.0
Exploitability Subscore:3.9
CVSS Temporal Score:6.3 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.3 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:H/RL:O/RC:C
CVSS Base Score:7.8 (High)
Impact Subscore:5.9
Exploitability Subscore:1.8
CVSS Temporal Score:7.5 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.5 (High)
STIG Severity [?]: I
STIG Risk Rating: High

Go back to menu.

Plugin Source


This is the ala_ALAS-2021-1478.nasl nessus plugin source code. This script is Copyright (C) 2021-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
##
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Amazon Linux AMI Security Advisory ALAS-2021-1478.
##

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(145451);
  script_version("1.7");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/07");

  script_cve_id("CVE-2021-3156");
  script_xref(name:"ALAS", value:"2021-1478");
  script_xref(name:"IAVA", value:"2021-A-0053");
  script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2022/04/27");

  script_name(english:"Amazon Linux AMI : sudo (ALAS-2021-1478)");

  script_set_attribute(attribute:"synopsis", value:
"The remote Amazon Linux AMI host is missing a security update.");
  script_set_attribute(attribute:"description", value:
"The version of sudo installed on the remote host is prior to 1.8.23-9.56. It is, therefore, affected by a vulnerability
as referenced in the ALAS-2021-1478 advisory.

  - When sudo runs a command in shell mode, either via the -s or -i command line option, it escapes special
    characters in the command's arguments with a backslash. The sudoers policy plugin will then remove the
    escape characters from the arguments before evaluating the sudoers policy (which doesn't expect the escape
    characters) if the command is being run in shell mode. (CVE-2021-3156)

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version
number.");
  script_set_attribute(attribute:"see_also", value:"https://alas.aws.amazon.com/ALAS-2021-1478.html");
  script_set_attribute(attribute:"see_also", value:"https://access.redhat.com/security/cve/CVE-2021-3156");
  script_set_attribute(attribute:"solution", value:
"Run 'yum update sudo' to update your system.");
  script_set_cvss_base_vector("CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:H/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2021-3156");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploited_by_malware", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Sudo Heap-Based Buffer Overflow');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2021/01/26");
  script_set_attribute(attribute:"patch_publication_date", value:"2021/01/26");
  script_set_attribute(attribute:"plugin_publication_date", value:"2021/01/26");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:sudo");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:sudo-debuginfo");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:sudo-devel");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:amazon:linux");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Amazon Linux Local Security Checks");

  script_copyright(english:"This script is Copyright (C) 2021-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/local_checks_enabled", "Host/AmazonLinux/release", "Host/AmazonLinux/rpm-list");

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("rpm.inc");

if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);

release = get_kb_item("Host/AmazonLinux/release");
if (isnull(release) || !strlen(release)) audit(AUDIT_OS_NOT, "Amazon Linux");
os_ver = pregmatch(pattern: "^AL(A|\d)", string:release);
if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Amazon Linux");
os_ver = os_ver[1];
if (os_ver != "A")
{
  if (os_ver == 'A') os_ver = 'AMI';
  audit(AUDIT_OS_NOT, "Amazon Linux AMI", "Amazon Linux " + os_ver);
}

if (!get_kb_item("Host/AmazonLinux/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);

pkgs = [
    {'reference':'sudo-1.8.23-9.56.amzn1', 'cpu':'i686', 'release':'ALA'},
    {'reference':'sudo-1.8.23-9.56.amzn1', 'cpu':'x86_64', 'release':'ALA'},
    {'reference':'sudo-debuginfo-1.8.23-9.56.amzn1', 'cpu':'i686', 'release':'ALA'},
    {'reference':'sudo-debuginfo-1.8.23-9.56.amzn1', 'cpu':'x86_64', 'release':'ALA'},
    {'reference':'sudo-devel-1.8.23-9.56.amzn1', 'cpu':'i686', 'release':'ALA'},
    {'reference':'sudo-devel-1.8.23-9.56.amzn1', 'cpu':'x86_64', 'release':'ALA'}
];

flag = 0;
foreach package_array ( pkgs ) {
  reference = NULL;
  release = NULL;
  cpu = NULL;
  el_string = NULL;
  rpm_spec_vers_cmp = NULL;
  allowmaj = NULL;
  if (!empty_or_null(package_array['reference'])) reference = package_array['reference'];
  if (!empty_or_null(package_array['release'])) release = package_array['release'];
  if (!empty_or_null(package_array['cpu'])) cpu = package_array['cpu'];
  if (!empty_or_null(package_array['el_string'])) el_string = package_array['el_string'];
  if (!empty_or_null(package_array['rpm_spec_vers_cmp'])) rpm_spec_vers_cmp = package_array['rpm_spec_vers_cmp'];
  if (!empty_or_null(package_array['allowmaj'])) allowmaj = package_array['allowmaj'];
  if (reference && release) {
    if (rpm_check(release:release, cpu:cpu, reference:reference, el_string:el_string, rpm_spec_vers_cmp:rpm_spec_vers_cmp, allowmaj:allowmaj)) flag++;
  }
}

if (flag)
{
  security_report_v4(
      port       : 0,
      severity   : SECURITY_HOLE,
      extra      : rpm_report_get()
  );
  exit(0);
}
else
{
  tested = pkg_tests_get();
  if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
  else audit(AUDIT_PACKAGE_NOT_INSTALLED, "sudo / sudo-debuginfo / sudo-devel");
}

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/ala_ALAS-2021-1478.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\ala_ALAS-2021-1478.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/ala_ALAS-2021-1478.nasl

Go back to menu.

How to Run


Here is how to run the Amazon Linux AMI : sudo (ALAS-2021-1478) as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Amazon Linux Local Security Checks plugin family.
  6. On the right side table select Amazon Linux AMI : sudo (ALAS-2021-1478) plugin ID 145451.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl ala_ALAS-2021-1478.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a ala_ALAS-2021-1478.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - ala_ALAS-2021-1478.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state ala_ALAS-2021-1478.nasl -t <IP/HOST>

Go back to menu.

References


IAVA | Information Assurance Vulnerability Alert:
  • 2021-A-0053
ALAS | Amazon Linux Security Advisory: See also: Similar and related Nessus plugins:
  • 145457 - Amazon Linux 2 : sudo (ALAS-2021-1590)
  • 145460 - Scientific Linux Security Update : sudo on SL7.x i686/x86_64 (2021:0221)
  • 145461 - Oracle Linux 7 : sudo (ELSA-2021-0221)
  • 145462 - Oracle Linux 8 : sudo (ELSA-2021-0218)
  • 145463 - Ubuntu 16.04 LTS / 18.04 LTS / 20.04 LTS / 20.10 : Sudo vulnerabilities (USN-4705-1)
  • 145471 - Debian DSA-4839-1 : sudo - security update
  • 145472 - Slackware 14.0 / 14.1 / 14.2 / current : sudo (SSA:2021-026-01)
  • 145475 - Debian DLA-2534-1 : sudo security update
  • 145477 - GLSA-202101-33 : sudo: Multiple vulnerabilities
  • 145479 - SUSE SLES12 Security Update : sudo (SUSE-SU-2021:0225-1)
  • 145481 - SUSE SLED15 / SLES15 Security Update : sudo (SUSE-SU-2021:0227-1)
  • 145482 - Fedora 32 : sudo (2021-8840cbdccd)
  • 145484 - SUSE SLES12 Security Update : sudo (SUSE-SU-2021:0226-1)
  • 145486 - Fedora 33 : sudo (2021-2cb63d912a)
  • 145488 - FreeBSD : sudo -- Multiple vulnerabilities (f3cf4b33-6013-11eb-9a0e-206a8a720317)
  • 145492 - RHEL 7 : sudo (RHSA-2021:0223)
  • 145493 - RHEL 8 : sudo (RHSA-2021:0218)

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file ala_ALAS-2021-1478.nasl version 1.7. For more plugins, visit the Nessus Plugin Library.

Go back to menu.