{
  "threat_severity" : "Important",
  "public_date" : "2021-01-26T18:00:00Z",
  "bugzilla" : {
    "description" : "sudo: Heap buffer overflow in argument parsing",
    "id" : "1917684",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1917684"
  },
  "cvss3" : {
    "cvss3_base_score" : "7.8",
    "cvss3_scoring_vector" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
    "status" : "verified"
  },
  "cwe" : "CWE-122",
  "details" : [ "Sudo before 1.9.5p2 contains an off-by-one error that can result in a heap-based buffer overflow, which allows privilege escalation to root via \"sudoedit -s\" and a command-line argument that ends with a single backslash character.", "A flaw was found in sudo. A heap-based buffer overflow was found in the way sudo parses command line arguments. This flaw is exploitable by any local user who can execute the sudo command (by default, any local user can execute sudo) without authentication. Successful exploitation of this flaw could lead to privilege escalation. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability." ],
  "statement" : "This flaw does not affect the versions of sudo shipped with Red Hat Enterprise Linux 5, because the vulnerable code was not present in these versions.",
  "affected_release" : [ {
    "product_name" : "Red Hat Enterprise Linux 6 Extended Lifecycle Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0227",
    "cpe" : "cpe:/o:redhat:rhel_els:6",
    "package" : "sudo-0:1.8.6p3-29.el6_10.4"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "release_date" : "2021-01-27T00:00:00Z",
    "advisory" : "RHSA-2021:0221",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7",
    "package" : "sudo-0:1.8.23-10.el7_9.1"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.2 Advanced Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0226",
    "cpe" : "cpe:/o:redhat:rhel_aus:7.2",
    "package" : "sudo-0:1.8.6p7-17.el7_2.3"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.3 Advanced Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0225",
    "cpe" : "cpe:/o:redhat:rhel_aus:7.3",
    "package" : "sudo-0:1.8.6p7-23.el7_3.3"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.4 Advanced Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0224",
    "cpe" : "cpe:/o:redhat:rhel_aus:7.4",
    "package" : "sudo-0:1.8.19p2-12.el7_4.2"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.4 Telco Extended Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0224",
    "cpe" : "cpe:/o:redhat:rhel_tus:7.4",
    "package" : "sudo-0:1.8.19p2-12.el7_4.2"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.4 Update Services for SAP Solutions",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0224",
    "cpe" : "cpe:/o:redhat:rhel_e4s:7.4",
    "package" : "sudo-0:1.8.19p2-12.el7_4.2"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.6 Extended Update Support",
    "release_date" : "2021-01-27T00:00:00Z",
    "advisory" : "RHSA-2021:0223",
    "cpe" : "cpe:/o:redhat:rhel_eus:7.6",
    "package" : "sudo-0:1.8.23-3.el7_6.2"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7.7 Extended Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0222",
    "cpe" : "cpe:/o:redhat:rhel_eus:7.7",
    "package" : "sudo-0:1.8.23-4.el7_7.3"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0218",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8",
    "package" : "sudo-0:1.8.29-6.el8_3.1"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8.1 Extended Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0220",
    "cpe" : "cpe:/o:redhat:rhel_eus:8.1",
    "package" : "sudo-0:1.8.25p1-8.el8_1.2"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8.2 Extended Update Support",
    "release_date" : "2021-01-26T00:00:00Z",
    "advisory" : "RHSA-2021:0219",
    "cpe" : "cpe:/o:redhat:rhel_eus:8.2",
    "package" : "sudo-0:1.8.29-5.el8_2.1"
  }, {
    "product_name" : "Red Hat Virtualization 4 for Red Hat Enterprise Linux 7",
    "release_date" : "2021-02-03T00:00:00Z",
    "advisory" : "RHSA-2021:0395",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7::hypervisor",
    "package" : "redhat-virtualization-host-0:4.3.13-20210127.0.el7_9"
  }, {
    "product_name" : "Red Hat Virtualization 4 for Red Hat Enterprise Linux 8",
    "release_date" : "2021-02-03T00:00:00Z",
    "advisory" : "RHSA-2021:0401",
    "cpe" : "cpe:/o:redhat:rhev_hypervisor:4.4::el8",
    "package" : "redhat-virtualization-host-0:4.4.4-20210201.0.el8_3"
  } ],
  "package_state" : [ {
    "product_name" : "Red Hat Enterprise Linux 5",
    "fix_state" : "Not affected",
    "package_name" : "sudo",
    "cpe" : "cpe:/o:redhat:enterprise_linux:5"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "sudo",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  } ],
  "references" : [ "https://www.cve.org/CVERecord?id=CVE-2021-3156\nhttps://nvd.nist.gov/vuln/detail/CVE-2021-3156\nhttps://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txt\nhttps://www.sudo.ws/alerts/unescape_overflow.html\nhttps://www.cisa.gov/known-exploited-vulnerabilities-catalog" ],
  "csaw" : true,
  "name" : "CVE-2021-3156",
  "mitigation" : {
    "value" : "Red Hat Product Security strongly recommends customers to update to fixed sudo packages once they are available. For customers who cannot update immediately, the following interim partial mitigation using systemtap is suggested:\n1. Install required systemtap packages and dependencies: \n```\nsystemtap yum-utils kernel-devel-\"$(uname -r)\"\n```\nThen for RHEL 7 install kernel debuginfo, using:\n```\ndebuginfo-install -y kernel-\"$(uname -r)\" \n```\nThen for RHEL 8 & 6 install sudo debuginfo, using:\n```\ndebuginfo-install sudo\n```\n2. Create the following systemtap script: (call the file as sudoedit-block.stap)\n```\nprobe process(\"/usr/bin/sudo\").function(\"main\")  {\ncommand = cmdline_args(0,0,\"\");\nif (isinstr(command, \"edit\")) {\nraise(9);\n}\n}\n```\n3. Install the script using the following command: (using root)\n```\n# nohup stap -g sudoedit-block.stap &\n```\n(This should output the PID number of the systemtap script)\nThis script will cause the vulnerable sudoedit binary to stop working. The sudo command will still work as usual.\nThe above change does not persist across reboots and must be applied after each reboot.\nPlease consult How to make a systemtap kernel module load persistently across reboots? (https://access.redhat.com/solutions/5752521) to learn how to\nturn this into a service managed by initd. \n4. Once the new fixed packages are installed, the systemtap script can be removed by killing the systemtap process.  For example, by using:\n```\n# kill -s SIGTERM 7590\n```\n(where 7590 is the PID of the systemtap process)",
    "lang" : "en:us"
  }
}