Ho phatlalalitsoe mokhoa oa ho qoba lits'ebetso tse ka thoko tsa ts'ebetso ea khoutu ho Python, ho ipapisitsoe le ts'ebeliso ea kokoanyana e tsebahalang ka nako e telele e hlahileng ho Python 2.7, e ile ea khetholloa ka 2012 mme ha e so lokisoe ho Python 3. Phoso e lumella ho sebelisa sehokelo se ikhethileng. Khoutu ea Python ho qala phihlello ea memori e seng e lokolotsoe (Sebelisa-Kamora-Mahala) ho Python. Qalong, ho ne ho nahanoa hore phoso ha e hlahise tšokelo ea ts'ireletso 'me ke maemong a sa tloaelehang haholo, hangata a entsoeng ka maiketsetso, a ka lebisang ho felisoe ka mokhoa o sa tloaelehang oa script.
Mofuputsi oa ts'ireletso tlas'a lebitso la pseudonym kn32 o ile a thahasella bothata 'me a khona ho lokisetsa ts'ebetso e sebetsang e etsang hore ho khonehe ho letsetsa taelo leha e le efe ea tsamaiso ntle le ho ba le phihlelo e tobileng ea mekhoa e kang os.system. Tšebeliso e sebelisoa Python e hloekileng 'me e sebetsa ntle le ho kenya lilaebrari tsa ka ntle le ntle le ho kenya "code.__new__". Har'a li-hook, ke "builtin.__id__" feela e sebelisoang, eo hangata e sa thibeloang. Ka lehlakoreng le sebetsang, khoutu e reriloeng e ka sebelisoa ho qoba mekhoa ea ho itšehla thajana litšebeletsong le libakeng tse fapaneng (mohlala, libakeng tsa ho ithuta, likhetla tsa marang-rang, ba sebetsang ka hare, joalo-joalo), tse lumellang ho etsoa ha khoutu ea Python, empa ho fokotsa di-call tse fumanehang mme o seke wa dumella mekgwa ya ho letsetsa jwalo ka os.system.
Khoutu e reriloeng ke analogue ea mohala oa os.system, o sebetsang ka ho sebelisa hampe ho ba kotsing ho CPython. Keletso e sebetsa le liphetolelo tsohle tsa Python 3 lits'ebetsong tse nang le meralo ea x86-64 mme e bonts'a ts'ebetso e tsitsitseng ho Ubuntu 22.04, leha mekhoa ea ts'ireletso ea PIE, RELRO le CET e nolofalitsoe. Mosebetsi o theohela ho fumana tlhahisoleseling ho tsoa ho khoutu ea Python mabapi le aterese ea e 'ngoe ea mesebetsi ho khoutu ea CPython e sebetsang. Ho ipapisitsoe le aterese ena, aterese ea mantlha ea CPython mohopolong le aterese ea sistimi () ts'ebetso molemong oa libc tse kentsoeng mohopolong li baloa. Qetellong, phetoho e tobileng ho aterese e itseng ea tsamaiso e qalisoa ka ho nkela sebaka sa pointer ea khang ea pele moleng "/bin/sh".
Source: opennet.ru