{"id":5751,"date":"2021-08-13T14:01:53","date_gmt":"2021-08-13T11:01:53","guid":{"rendered":"https:\/\/skeletor.org.ua\/?p=5751"},"modified":"2024-03-29T12:50:24","modified_gmt":"2024-03-29T10:50:24","slug":"address-space-layout-randomization-aslr","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5751","title":{"rendered":"Address Space Layout Randomization (ASLR)"},"content":{"rendered":"\n<p><strong>ASLR<\/strong>&nbsp;(<a href=\"https:\/\/ru.bmstu.wiki\/%D0%90%D0%BD%D0%B3%D0%BB%D0%B8%D0%B9%D1%81%D0%BA%D0%B8%D0%B9_%D1%8F%D0%B7%D1%8B%D0%BA\">\u0430\u043d\u0433\u043b.<\/a>&nbsp;<em><strong>a<\/strong>ddress&nbsp;<strong>s<\/strong>pace&nbsp;<strong>l<\/strong>ayout&nbsp;<strong>r<\/strong>andomization<\/em>&nbsp;\u2014 \u00ab\u0440\u0430\u043d\u0434\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430\u00bb) \u2014 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u0430\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432\u0430\u0436\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u0443\u0447\u0438 \u0438 \u0441\u0442\u0435\u043a\u0430.<\/p>\n\n\n<p><!--more--><\/p>\n\n\n<p>\u0427\u0442\u043e \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043b\u0438 <strong>ASLR<\/strong>, \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <strong>ldd <\/strong> (\u0434\u043b\u044f <strong>Solaris <\/strong>\u0442\u0430\u043a\u043e\u0439 \u0442\u0440\u044e\u043a \u043d\u0435 \u043f\u0440\u043e\u043a\u0430\u0442\u0438\u0442 \u0438 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u0431\u043e <strong>sxadm<\/strong>, \u043b\u0438\u0431\u043e <strong>elfedit<\/strong>, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435) \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0434 \u043f\u043e\u0434\u0440\u044f\u0434 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f <strong>libc.so<\/strong>: \u0435\u0441\u043b\u0438 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043e:<\/p>\n\n\n<p><code><br \/>\n# ldd \/usr\/sbin\/ppp | grep libc.so<br \/>\n        libc.so.7 =&gt; \/lib\/libc.so.7 (0x80639d000)<br \/>\n# ldd \/usr\/sbin\/ppp | grep libc.so<br \/>\n        libc.so.7 =&gt; \/lib\/libc.so.7 (0x806f79000)<br \/>\n# ldd \/usr\/sbin\/ppp | grep libc.so<br \/>\n        libc.so.7 =&gt; \/lib\/libc.so.7 (0x806925000)<br \/>\n<\/code><\/p>\n\n\n<p><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-blue-color\">FreeBSD<\/span><\/strong><\/p>\n\n\n\n<p>\u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f\/\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0435\u0442\u0443, \u0447\u0435\u0440\u0435\u0437 <strong>sysctl<\/strong>:<\/p>\n\n\n<p><code><br \/>\nkern.elf{32,64}.aslr.enable - Enable address map randomization (Default: 0)<br \/>\nkern.elf{32,64}.aslr.pie_enable - Enable ASLR for Position-Independent Executables (PIE) binaries (Default: 0)<br \/>\nkern.elf{32,64}.aslr.honor_sbrk - Assume sbrk is used (Default: 1)<br \/>\nvm.cluster_anon - Cluster anonymous mappings (Default: 1)<br \/>\n<\/code><\/p>\n\n\n<p>\u0422\u0430\u043a \u0436\u0435, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u043b\u0435\u0442\u0443 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437\u00a0<strong>elfctl<\/strong>:<\/p>\n\n\n\n<p><code>% elfctl -e +noaslr \/usr\/local\/sbin\/unbound<\/code><\/p>\n\n\n\n<p><strong><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-blue-color\">Linux<\/span><\/strong><\/p>\n\n\n\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043e. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f\/\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0435\u0442\u0443, \u0447\u0435\u0440\u0435\u0437 <strong>sysctl kernel.randomize_va_space<\/strong><\/p>\n\n\n<p><code><br \/>\n0 = Disabled<br \/>\n1 = Conservative Randomization<br \/>\n2 = Full Randomization<br \/>\n<\/code><\/p>\n\n\n<p><strong><span class=\"has-inline-color has-blue-color\">OpenBSD<\/span><\/strong><\/p>\n\n\n\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043e (\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0444\u0435\u0432\u0440\u0430\u043b\u044f 2002). \u0412\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-blue-color\">Solaris<\/span><\/strong><\/p>\n\n\n\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043e. \u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <strong>sxadm<\/strong><\/p>\n\n\n<p><code># sxadm info|grep aslr<br \/>\naslr             enable (tagged-files)    enable (tagged-files)<br \/># sxadm disable aslr<br \/>\n<\/code><\/p>\n<p>\u0422\u0430\u043a \u0436\u0435, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u043b\u0435\u0442\u0443 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 <strong>elfedit<\/strong>:<br \/><code><br \/>\n% elfedit -e 'dyn:sunw_aslr enable' a.out<br \/>\n% elfdump -d a.out | grep ASLR<br \/>\n[29]  SUNW_ASLR  0x2  ENABLE<br \/>\n% elfedit -e 'dyn:sunw_aslr disable' a.out<br \/>\n% elfdump -d a.out | grep ASLR<br \/>\n[29]  SUNW_ASLR   0x1  DISABLE<br \/>\n<\/code><\/p>","protected":false},"excerpt":{"rendered":"<p>ASLR&nbsp;(\u0430\u043d\u0433\u043b.&nbsp;address&nbsp;space&nbsp;layout&nbsp;randomization&nbsp;\u2014 \u00ab\u0440\u0430\u043d\u0434\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430\u00bb) \u2014 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u0430\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432\u0430\u0436\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u0443\u0447\u0438 \u0438 \u0441\u0442\u0435\u043a\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,10,25,24],"tags":[],"class_list":["post-5751","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-linux","category-others","category-openbsd","category-solaris"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5751"}],"version-history":[{"count":3,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5751\/revisions"}],"predecessor-version":[{"id":6369,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5751\/revisions\/6369"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}