{"id":292136,"date":"2019-07-16T15:01:13","date_gmt":"2019-07-16T15:01:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292136"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292136","title":{"rendered":"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441 pwnable.kr 07 \u2014 input. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 pwntools"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/al\/py\/ef\/alpyefagnx81cc2xc1ncjqs8lus.png\" alt=\"image\"><\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"http:\/\/docs.pwntools.com\/en\/stable\/\">pwntools<\/a>.<\/p>\n<div class=\"spoiler\"><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\">\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0441\u0444\u0435\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u0445:<\/p>\n<ul>\n<li>PWN;<\/li>\n<li>\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f (Crypto);<\/li>\n<li>c\u0435\u0442\u0435\u0432\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 (Network);<\/li>\n<li>\u0440\u0435\u0432\u0435\u0440\u0441 (Reverse Engineering);<\/li>\n<li>\u0441\u0442\u0435\u0433\u0430\u043d\u043e\u0433\u0440\u0430\u0444\u0438\u044f (Stegano);<\/li>\n<li>\u043f\u043e\u0438\u0441\u043a \u0438 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u044f WEB-\u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/li>\n<\/ul>\n<p>  \u0412\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043a \u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b\u0438\u0441\u0442\u0438\u043a\u0435, \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043c\u0430\u043b\u0432\u0430\u0440\u0438 \u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043e\u043a, \u0430\u0442\u0430\u043a\u0430\u0445 \u043d\u0430 \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u0435\u043d\u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u043a\u0441\u043f\u043b\u043e\u0438\u0442\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a><br \/>  \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\">\u043a\u0430\u043d\u0430\u043b \u0432 Telegram<\/a> \u0438 <a href=\"https:\/\/t.me\/RalfHackerPublicChat\">\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\">\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 \/>  <cut><\/cut><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<\/div>\n<p>  <\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f input<\/h2>\n<p>  \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u0438\u043a\u043e\u043d\u043a\u0443 \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e input, \u0438 \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e SSH \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c guest.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_w\/fs\/8n\/_wfs8nwkwtgd-2ezbk3prmnfrwq.png\" alt=\"image\"><\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u0430\u043d\u043d\u0435\u0440.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ta\/h-\/f-\/tah-f-wuqrhtghcchgvy1vbxvki.png\" alt=\"image\"><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0435\u0441\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a\u0438\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0430\u0432\u0430.<\/p>\n<pre><code class=\"bash\">ls -l<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k6\/re\/aa\/k6reaalaqoyg13qhbu0arwtvali.png\" alt=\"image\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 fd (\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d sticky-\u0431\u0438\u0442). \u0414\u0430\u0432\u0430\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u0445\u043e\u0434 \u043a\u043e\u0434.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 input.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;sys\/socket.h&gt; #include &lt;arpa\/inet.h&gt;  int main(int argc, char* argv[], char* envp[]){         printf(\"Welcome to pwnable.kr\\n\");         printf(\"Let's see if you know how to give input to program\\n\");         printf(\"Just give me correct inputs then you will get the flag :)\\n\");          \/\/ argv         if(argc != 100) return 0;         if(strcmp(argv['A'],\"\\x00\")) return 0;         if(strcmp(argv['B'],\"\\x20\\x0a\\x0d\")) return 0;         printf(\"Stage 1 clear!\\n\");          \/\/ stdio         char buf[4];         read(0, buf, 4);         if(memcmp(buf, \"\\x00\\x0a\\x00\\xff\", 4)) return 0;         read(2, buf, 4);         if(memcmp(buf, \"\\x00\\x0a\\x02\\xff\", 4)) return 0;         printf(\"Stage 2 clear!\\n\");          \/\/ env         if(strcmp(\"\\xca\\xfe\\xba\\xbe\", getenv(\"\\xde\\xad\\xbe\\xef\"))) return 0;         printf(\"Stage 3 clear!\\n\");          \/\/ file         FILE* fp = fopen(\"\\x0a\", \"r\");         if(!fp) return 0;         if( fread(buf, 4, 1, fp)!=1 ) return 0;         if( memcmp(buf, \"\\x00\\x00\\x00\\x00\", 4) ) return 0;         fclose(fp);         printf(\"Stage 4 clear!\\n\");          \/\/ network         int sd, cd;         struct sockaddr_in saddr, caddr;         sd = socket(AF_INET, SOCK_STREAM, 0);         if(sd == -1){                 printf(\"socket error, tell admin\\n\");                 return 0;         }         saddr.sin_family = AF_INET;         saddr.sin_addr.s_addr = INADDR_ANY;         saddr.sin_port = htons( atoi(argv['C']) );         if(bind(sd, (struct sockaddr*)&amp;saddr, sizeof(saddr)) &lt; 0){                 printf(\"bind error, use another port\\n\");                 return 1;         }         listen(sd, 1);         int c = sizeof(struct sockaddr_in);         cd = accept(sd, (struct sockaddr *)&amp;caddr, (socklen_t*)&amp;c);         if(cd &lt; 0){                 printf(\"accept error, tell admin\\n\");                 return 0;         }         if( recv(cd, buf, 4, 0) != 4 ) return 0;         if(memcmp(buf, \"\\xde\\xad\\xbe\\xef\", 4)) return 0;         printf(\"Stage 5 clear!\\n\");          \/\/ here's your flag         system(\"\/bin\/cat flag\");         return 0; }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0437 \u043a\u043e\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u044f\u0442\u044c \u0443\u0440\u043e\u0432\u043d\u0435\u0439. \u0411\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u0445 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lf\/iz\/rr\/lfizrrvs8nymwjwmz_kgruwhr8q.png\" alt=\"image\"><\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0447\u0438\u0441\u043b\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u0430\u0432\u043d\u044f\u043b\u043e\u0441\u044c 100. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c 65-\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430 \u201c\\x00\u201d, \u0430 66-\u043c \u2014 \u201c\\x20\\x0a\\x0d\u201d. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0432\u043e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \/tmp\/ \u0438 \u0442\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hr\/jv\/cp\/hrjvcpftgukbkucztpoxfarvxum.png\" alt=\"image\"><\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0441\u0442\u0430 \u0441\u0442\u0440\u043e\u043a \u2018A\u2019. \u0418 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">from pwn import *  a = ['A']*100 a[0] = '\/home\/input2\/input' a[ord('A')] = '\\x00' a[ord('B')] = '\\x20\\x0a\\x0d'  ex = process(argv=a)  ex.interactive()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2x\/wq\/ak\/2xwqakwlb0r_kfrt77plnmtnofi.png\" alt=\"image\"><\/p>\n<p>  \u041c\u044b \u043f\u0440\u043e\u0448\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c. \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qd\/s4\/ep\/qds4epgg8p3ucpibt5wxlhajzeo.png\" alt=\"image\"><\/p>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u043e\u043a, \u043e\u0434\u043d\u043e\u0439 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 stdin, \u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u0438\u0437 stderr. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y4\/wz\/en\/y4wzenzqoyigjqmaa3cuhjdyam4.png\" alt=\"image\"><\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u0438 \u043a \u044d\u0442\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 stdin \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043d\u0430 \u043f\u043e\u0442\u043e\u043a \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 stderr \u2014 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"python\">from pwn import *  a = ['A']*100 a[0] = '\/home\/input2\/input' a[ord('A')] = '\\x00' a[ord('B')] = '\\x20\\x0a\\x0d'  fin = open('\/tmp\/ex\/in.txt', 'r') ferr = open('\/tmp\/ex\/err.txt', 'r')  ex = process(argv=a, stdin=fin, stderr=ferr)  fin.close() ferr.close()  ex.interactive()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/os\/se\/qq\/osseqqsq37snhvxbku7sq4_pqok.png\" alt=\"image\"><\/p>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fd\/ec\/de\/fdecdeek9nfii1n9txv-hpyczmw.png\" alt=\"image\"><\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f getenv() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"python\">from pwn import *  a = ['A']*100  a[0] = '\/home\/input2\/input' a[ord('A')] = '\\x00' a[ord('B')] = '\\x20\\x0a\\x0d'  fin = open('\/tmp\/ex\/in.txt', 'r') ferr = open('\/tmp\/ex\/err.txt', 'r')  e={'\\xde\\xad\\xbe\\xef':'\\xca\\xfe\\xba\\xbe'}  ex = process(argv=a, stdin=fin, stderr=ferr, env=e)  fin.close() ferr.close()  ex.interactive()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/si\/g2\/w7\/sig2w7bze79xuf5de9xnurbxl7o.png\" alt=\"image\"><\/p>\n<p>  \u0421 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u0441 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v7\/2z\/_1\/v72z_1rlpvr49dlumkw1zsjye-8.png\" alt=\"image\"><\/p>\n<p>  \u041f\u043e \u043a\u043e\u0434\u0443 \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u201c\\x0a\u201d \u0438 \u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0437 \u043d\u0435\u0433\u043e 4 \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441 \u0431\u0430\u0439\u0442\u0430\u043c\u0438 \u201c\\x00\u201d. \u0422\u0430\u043a \u043a\u0430\u043a \u0438 \u0441\u0430\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u043f\u0435\u0447\u0430\u0442\u0443\u0435\u043c\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c python.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x2\/kj\/lx\/x2kjlx3bsbpca-cljqvqvdp5nja.png\" alt=\"image\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ku\/qe\/pn\/kuqepnlbnrp90jzzz6jxiuiltcg.png\" alt=\"image\"><\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mc\/9m\/a6\/mc9ma61qo_tgnnyypnwz7yn4m4u.png\" alt=\"image\"><\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043a\u0435\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432 66-\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435. \u041f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e \u0441\u0435\u0442\u0438 4 \u0431\u0430\u0439\u0442\u0430 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0441 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0440\u0442\u0430, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 4 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<pre><code class=\"python\">from pwn import *  a = ['A']*100 a[0] = '\/home\/input2\/input' a[ord('A')] = '\\x00' a[ord('B')] = '\\x20\\x0a\\x0d' a[ord('C')] = '1234'  fin = open('\/tmp\/ex\/in.txt', 'r') ferr = open('\/tmp\/ex\/err.txt', 'r')  e={'\\xde\\xad\\xbe\\xef':'\\xca\\xfe\\xba\\xbe'}  ex = process(argv=a, stdin=fin, stderr=ferr, env=e)  fin.close() ferr.close()  ex.interactive()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hl\/qh\/io\/hlqhiowvmaorjc2hn3dllpj_yfq.png\" alt=\"image\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oy\/x-\/kb\/oyx-kb5xbrbt0pmwgeern_omjji.png\" alt=\"image\"><\/p>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0432\u043e\u0438 \u043e\u0447\u043a\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kb\/im\/le\/kbimlec-28qy9gzfxfjydg-z90a.png\" alt=\"image\"><\/p>\n<p>  \u0414\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445!<\/p><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/460249\/\"> https:\/\/habr.com\/ru\/post\/460249\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/al\/py\/ef\/alpyefagnx81cc2xc1ncjqs8lus.png\" alt=\"image\"><\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"http:\/\/docs.pwntools.com\/en\/stable\/\">pwntools<\/a>.<\/p>\n<div class=\"spoiler\"><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\">\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0441\u0444\u0435\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u0445:<\/p>\n<ul>\n<li>PWN;<\/li>\n<li>\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f (Crypto);<\/li>\n<li>c\u0435\u0442\u0435\u0432\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 (Network);<\/li>\n<li>\u0440\u0435\u0432\u0435\u0440\u0441 (Reverse Engineering);<\/li>\n<li>\u0441\u0442\u0435\u0433\u0430\u043d\u043e\u0433\u0440\u0430\u0444\u0438\u044f (Stegano);<\/li>\n<li>\u043f\u043e\u0438\u0441\u043a \u0438 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u044f WEB-\u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/li>\n<\/ul>\n<p>  \u0412\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043a \u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b\u0438\u0441\u0442\u0438\u043a\u0435, \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043c\u0430\u043b\u0432\u0430\u0440\u0438 \u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043e\u043a, \u0430\u0442\u0430\u043a\u0430\u0445 \u043d\u0430 \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u0435\u043d\u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u043a\u0441\u043f\u043b\u043e\u0438\u0442\u043e\u0432.  <\/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-292136","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292136","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=292136"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292136\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}