Python3 漏洞

Python3 漏洞

任何人都可以幫助我理解這兩個 python 輸出之間的差異。

root@ip-192-168-20-21:~# apt install python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


root@ip-192-168-20-21:~# apt install python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.6 is already the newest version (3.6.9-1~18.04ubuntu1.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

root@ip-192-168-20-21:~# python3 --version
Python 3.6.9

cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

我的問題是 Python 3.6.9 有很多安全漏洞,例如CVE-2021-3177.按照https://ubuntu.com/security/cve-2021-3177該漏洞已修復(3.6.9-1~18.04ubuntu1.4)並發布。

作業系統伺服器已使用最新的 Ubuntu 修補程式進行更新。然而,My VA 工具仍然報告這些系統中仍然存在相同的漏洞。有人知道為什麼會發生這種情況以及有什麼想法可以克服這個問題嗎?

我希望這種情況發生,因為我的預設 python3 版本仍然顯示Python 3.6.9在最後一個命令輸出中。有人可以對此提出建議嗎?

答案1

python3 命令連結到許多已安裝的 python 二進位之一。

您可以看到還有其他可用的,對於您的具體範例,我想使用python3.6 --version會產生輸出告訴您它是,3.6.9-1~18.04ubuntu1.4並且簡單地運行python3.6本身將啟動 python 版本 3.6 repl

若要了解已安裝並可用的 python3 二進位檔案的版本變體,請嘗試執行ls -la /usr/bin | grep python3(刪除 3 以查看其中的任何 python 2)。

只能有 1 個 python 版本連結到python3指令,上述指令的輸出應該會給你類似的內容python3 -> python3.6

which python3您可以透過執行which shoudl be來驗證哪一個是最新的/usr/bin/python3

python3這不是很好的做法,但您可以透過別名使用戶會話使用不同版本的命令: alias python3='/usr/bin/python3.9'。最佳實踐是進入apt install python-venv需要特定版本的專案目錄/usr/bin/python3.9 -m venv .venv

相關內容