VMSA-2021-0028 | Workaround in vCenter Server virtual appliance (87081, 87088)

By Lerpong Intaraworrapath | January 6th, 2022

Workaround instructions to address CVE-2021-44228 and CVE-2021-45046 in vCenter Server and vCenter Cloud Gateway (87081)

ในบทความนี้ เราจะมาทำ workaround ในการแก้ปัญหา instructions to address CVE-2021-44228 and CVE-2021-45046 in vCenter Server virtual appliance 7.x, 6.7.x, 6.5.x โดยจะ followup วิธีการ จาก KB87081 และ KB87088

https://kb.vmware.com/s/article/87081?lang=en_US
https://kb.vmware.com/s/article/87088

Note: ในส่วนของ Product อื่นของ VMware และ ข้อมูล CVE-2021-44228 and CVE-2021-45046 ให้ อ่านได้จาก VMSA-2021-0028

Impact / Risks

  • ให้ทำการ remove VCHA ก่อนทำการ run script.
  • environment ที่มี external PSCs จะต้องทำการ run script ทั้ง vCenter และ PSC appliances.
  • Restore จาก File-Based Backup จะทำให้ environment กลับสู่ vulnerable. ให้ใช้ vc_log4j_mitigator.py หลังจาก restore.
  • อัปเกรด vCenter Appliance จะทำให้ environment กลายเป็น vulnerable. ให้ใช้ vc_log4j_mitigator.py หลังจาก อัปเกรด vCenter Appliance.

Resolution

Workaround ในบทความนี้เป็น Temporary solution เท่านั้น.

Completed remediation scenarios:

จะมี 3 วิธีในการทำ workaround สำหรับ vCenter server virtual appliance. ให้เลือกทำ วิธีใดวิธีหนึ่งเท่านั้น

  1. Used vc_log4j_mitigator.py from KB87081.
  2. Used vmsa-2021-0028-kb87081.py script from KB 87088 and remove_log4j_class.py from this KB87081.
  3. Used the manual workaround steps in KB87081 and remove_log4j_class.py.

Note: ในบทความนี้ จะใช้ วิธีที่ 2Used vmsa-2021-0028-kb87081.py script from KB 87088 and remove_log4j_class.py from this KB87081.
โดยจะเป็น vCenter server virtual appliance version 7.0.1.00301

Workaround

Automated Workaround (Recommended)

  1. ทำการ take snapshot “vCenter server virtual appliance”.
  2. ทำการ check disk space available by command “df-h” (capture screen ไว้ด้วย).
  3. ทำการ check vCenter server service by command “service-control –status –all” (capture screen ไว้ด้วย).
  4. Download the script attached this KB 87088 (vmsa-2021-0028-kb87081.py )

5. Login to the vCSA using an SSH Client (using Putty.exe or any similar SSH Client)

6. Login to the vCSA using an SSH Client (using Putty.exe or any similar SSH Client)

7. Transfer the file to /tmp folder on vCenter Server Appliance using WinSCP
Note: It’s necessary to enable the bash shell before WinSCP will work

8. Provide the root user name and password when prompted.

9. Run this command to enable the Bash shell:
shell.set --enable True

10. Run this command to access the Bash shell:
shell

11. In the Bash shell, run this command to change the default shell to Bash:
chsh -s /bin/bash root

12. ทำการ copy ไฟล์ vmsa-2021-0028-kb87081.py และ remove_log4j_class.py โดยใช้ WinSCP ไปเก็บไว้ที่ /tmp

13. ทำการ Login to the vCSA using an SSH Client (using Putty.exe or any similar SSH Client) แล้วเข้าไปที่ path /tmp ใช้ “ls” command ทำการตรวจสอบไฟล์ ที่เราทำการ upload เข้าไป

14. ทำการ run script vmsa-2021-0028-kb87081.py
root@xxxx[/tmp]#python vmsa-2021-0028-kb87081.py

15. พิมพ์ Y แล้วกด Enter

16. Script ก็จะทำการ run process เพื่อจะทำ workaround เกี่ยวกับ CVE-2021-44228 and CVE-2021-45046 (ใช้เวลา10 นาที โดยประมาณ).
โดย script ก็จะแสดง status ของแต่ละ process และที่สำคัญจะต้องแสดงผล “SUCCESS”
-vMON Config files
-VMware Update Manager Config files
-Analytics service Config files
-DBCC Utility Config files

17. เมื่อทำการ run script แรก เสร็จเรียบร้อยแล้วให้ เรา run script ตัวที่ 2 คือ remove_log4j_class.py from this KB87081.
root@xxxx[/tmp]#python remove_log4j_class.py

18. พิมพ์ Y แล้วกด Enter

19. Script ก็จะทำการ run process เพื่อจะทำ workaround เกี่ยวกับ CVE-2021-44228 and CVE-2021-45046 (ใช้เวลา10 นาที โดยประมาณ).โดย script ก็จะแสดง status ของแต่ละ process

Verify the changes

เมื่อเราทำการ run script ทั้ง 2 scripts completed แล้วให้เราทำ การ ตรวจสอบให้แน่ใจว่า script ที่เรา run นั้นถูกต้อง

  1. Verify if the stsd, idmd, and vMon controlled services were started with the new -Dlog4j2.formatMsgNoLookups=true parameter:
    ps auxww | grep formatMsgNoLookups

โดย จะแสดง ผล -Dlog4j2.formatMsgNoLookups=true

2. Verify the Update Manager changes are shown under “System Properties” in the output of the following two commands:
cd /usr/lib/vmware-updatemgr/bin/jetty/
java -jar start.jar --list-config
system properties:
log4j2.formatMsgNoLookups = true (/usr/lib/vmware-updatemgr/bin/jetty/start.ini)

3. Verify the Analytics Service changes:
grep -i jndilookup /usr/lib/vmware/common-jars/log4j-core-2.8.2.jar | wc -l
โดย จะแสดงค่า “0

4. Verify the script successfully removed JndiLookup.class from all java files with the following command:
python remove_log4j_class.py -r

จะได้ผลลัพธ์ ดังนี้
2021-12-18T00:04:38 INFO main: Running in dryrun mode
2021-12-18T00:05:04 INFO main:
===== Summary =====
List of vulnerable files:
2021-12-18T00:05:04 INFO main: Done.

Remark

หลังจาก เราทำการ run script เสร็จเมื่อกลับที่ vSphere client browser ของ vCenter server จะพบว่า ที่ Tab -> Monitor ในหน้า Skyline Health จะ show warning “Online health checks execution” (ถ้าไม่เจอแบบนี้ก็ไม่เป็นไร นะครับ)
!!!warning ที่แสดง จะหายไป เอง นะครับ!!!

Conclusion

ในบทความนี้จะเป็น workaround สำหรับ vCenter server virtual appliance 7.x เท่านั้น โดย fix version ยังไม่มีออกมาในส่วน version อื่น ให้ทุกท่านติดตาม VMSA-2021-0028 ในการทำ workaround หรือ fix version รวมถึง Product อื่นๆ ของ VMware ที่ได้รับผลกระทบ เช่นกัน.