{"id":473218,"date":"2025-09-02T15:50:35","date_gmt":"2025-09-02T15:50:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=473218"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=473218","title":{"rendered":"<span>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0430\u0447\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Persistent Mode \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 Libfuzzer + CURL<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p> <strong>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440:<\/strong> \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u0435\u0442 \u043d\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438\u043b\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430. \u0410\u0432\u0442\u043e\u0440 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u043e\u0441\u0438\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u043e\u043c, \u043d\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u043b\u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0442\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u043b\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.  <\/p>\n<\/blockquote>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#1\" rel=\"noopener noreferrer nofollow\">\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#2\" rel=\"noopener noreferrer nofollow\">\u0418\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#3\" rel=\"noopener noreferrer nofollow\">\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (stdin)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#4\" rel=\"noopener noreferrer nofollow\">\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c filename\/fd<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u0432\u0438\u0436\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 LibFuzzer \u0438\u043b\u0438 AFL++ \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dc7\/c93\/462\/dc7c934626669fc1a7e3e67592a41446.png\" alt=\"\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0434\u0432\u0438\u0436\u043a\u0430\" title=\"\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0434\u0432\u0438\u0436\u043a\u0430\" width=\"960\" height=\"720\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/dc7\/c93\/462\/dc7c934626669fc1a7e3e67592a41446.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dc7\/c93\/462\/dc7c934626669fc1a7e3e67592a41446.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0434\u0432\u0438\u0436\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <strong>persistent mode<\/strong> \u2014 \u0440\u0435\u0436\u0438\u043c\u0430, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u0430\u0451\u0442 \u043a\u043e\u043b\u043e\u0441\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043e\u043d \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0443\u0434\u0430, \u0433\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0445 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0442.<\/p>\n<p>\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>\u0447\u0435\u0440\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u043c\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043e\u0431\u0449\u0438\u0435 \u0438 \u0434\u043b\u044f LibFuzzer, \u0438 \u0434\u043b\u044f AFL++:<\/p>\n<ul>\n<li>\n<p>\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0437\u0437\u0438\u043d\u0433 \u0432 <strong>persistent mode<\/strong> \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u00ab\u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u00bb \u0432\u0432\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <strong>curl \u0438 libfuzzer<\/strong>, \u043a\u0430\u043a \u0440\u0435\u0448\u0430\u0442\u044c \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438: \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c <code>argv<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>fmemopen<\/code> \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0438\u0431\u043a\u043e \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0437\u0437\u0435\u0440 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0443 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043a \u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u044b.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 Curl<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u0431\u043e\u0440\u043a\u0443 curl \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 Address Sanitizer&#8217;\u0430 \u0438 libfuzzer&#8217;\u0430:<\/p>\n<pre><code>.\/buildconf; CC=clang CFLAGS=\"-fsanitize=fuzzer-no-link,address -g\" LDFLAGS=\"-fsanitize=fuzzer-no-link,address -g\" .\/configure --with-openssl; make;<\/code><\/pre>\n<h2>\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/h2>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 <strong>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/strong>, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u2014 \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <code>argv<\/code>.<\/p>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c <code>int main(int argc, char **argv)<\/code> <code>argv<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u043a, \u0430 <code>argc<\/code> &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 argv \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439:<\/p>\n<ol>\n<li>\n<p><code><strong>argv[0]<\/strong><\/code><strong> &#8212; \u0438\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 (<\/strong><code><strong>argv[i] - \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong><\/code><strong>) \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0430<\/strong><br \/> \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0438\u0437 \u0444\u0430\u0437\u0437\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0440\u0435\u0437\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>\\0<\/code>.<\/p>\n<\/li>\n<li>\n<p><code><strong>argv[argc] == NULL . <\/strong><\/code>\u041d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0435<code><strong> argc.<\/strong><\/code><\/p>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e<strong> \u0432\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 arg<\/strong>v, \u0441 \u0432\u0435\u0440\u043d\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <strong>argc<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/34a\/b55\/bed\/34ab55bed6ff11099dc43a6874d59771.png\" alt=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 argv\" title=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 argv\" width=\"810\" height=\"389\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/34a\/b55\/bed\/34ab55bed6ff11099dc43a6874d59771.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/34a\/b55\/bed\/34ab55bed6ff11099dc43a6874d59771.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 argv<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435 <strong>\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 main \u0444\u0443\u043d\u043a\u0446\u0438\u0438 curl &#8212; <strong>globalconf_init() <\/strong>\u0438 <strong>globalconf_free<\/strong>.<br \/>curl\/src\/too_main.c: <\/p>\n<pre><code>int main(int argc, char *argv[]) #endif {   CURLcode result = CURLE_OK;    tool_init_stderr();  ...    if(main_checkfds()) {     errorf(\"out of file descriptors\");     return CURLE_FAILED_INIT;   }  ...    \/* Initialize memory tracking *\/   memory_tracking_init();    \/* Initialize the curl library - do not call any libcurl functions before      this point *\/   result = globalconf_init();   if(!result) {     \/* Start our curl operation *\/     result = operate(argc, argv);      \/* Perform the main cleanup *\/     globalconf_free();   }<\/code><\/pre>\n<h4>\u0428\u0430\u0433\u0438 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/h4>\n<ol>\n<li>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <strong>\u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong> \u0432\u044b\u0431\u0435\u0440\u0435\u043c <strong>operate. <\/strong> \u0412 \u0444\u0430\u0439\u043b\u0435 tool_operate.h \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e ASCII-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u044c \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f libfuzzer \u0441 \u0444\u043b\u0430\u0433\u043e\u043c <strong>-only-ascii=1).<\/strong><\/p>\n<\/li>\n<li>\n<p> \u0412\u044b\u0437\u043e\u0432 <strong>memset (global) &#8212; <\/strong> \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0444\u0430\u0437\u0437\u0435\u0440\u0430<\/p>\n<\/li>\n<li>\n<p> \u0412\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b argv \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 argc<\/p>\n<\/li>\n<\/ol>\n<h4>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/h4>\n<pre><code>#include &lt;stdint.h&gt; #include &lt;stddef.h&gt; #include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #include \"src\/tool_setup.h\"  #include \"src\/tool_getparam.h\"  #include \"src\/tool_operate.h\"  #include \"src\/config2setopts.h\"  #include &lt;curl\/curl.h&gt;  #include &lt;stdint.h&gt;  #include &lt;string.h&gt;   #define MAX_ASCII_CHARS 4096  #define MAX_ARGS 32  #define MAX_ARG_LEN 256  \/\/ \u0428\u0430\u0433 2 - Simple ASCII filter  static int is_ascii_char(uint8_t c) {     return (c &gt;= 0x20 &amp;&amp; c &lt;= 0x7E); \/\/ printable ASCII }  int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {     if (size == 0) {         return 0;     }      CURLcode result = CURLE_OK;      \/\/ Buffer to store only printable ASCII input     char ascii_data[MAX_ASCII_CHARS + 1] = {0};     size_t ascii_pos = 0;      for (size_t i = 0; i &lt; size &amp;&amp; ascii_pos &lt; MAX_ASCII_CHARS - 1; i++) {         if (is_ascii_char(data[i])) {             ascii_data[ascii_pos++] = (char)data[i];         }     }      if (ascii_pos == 0) {         return 0;     }      \/\/ \u0428\u0430\u0433 4 - \u0412\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b argv, argc     char *fuzz_argv[MAX_ARGS + 2] = {0};     int fuzz_argc = 1;     fuzz_argv[0] = \"argv-fuzz\";      char *token = strtok(ascii_data, \" \");     while (token &amp;&amp; fuzz_argc &lt; MAX_ARGS + 1) {         fuzz_argv[fuzz_argc++] = token;         token = strtok(NULL, \" \");     }     fuzz_argv[fuzz_argc] = NULL;      if (fuzz_argc &lt; 4) {         return 0;     }      \/\/ \u0428\u0430\u0433 3 - \u0418\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a     memset(&amp;global, 0, sizeof(global));      tool_init_stderr();     result = globalconf_init();     if (!result) {            \/\/ \u0428\u0430\u0433 3 - \u0418\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a            memset(&amp;global-&gt;state, 0, sizeof(global-&gt;state));             operate(fuzz_argc, fuzz_argv);    }      globalconf_free();        \/\/ \u0428\u0430\u0433 3 - \u0418\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a    memset(&amp;global, 0, sizeof(global));    return 0; } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 .\/src \u0431\u0435\u0437 \u0444\u0430\u0439\u043b\u0430<code>libcurltool_la-tool_help.o<\/code> :<br \/><code>ar -rcT static.a $(ls *.o | grep -v libcurltool_la-tool_help.o)<\/code><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u0431\u043e\u0440\u043a\u0443 \u043e\u0431\u0451\u0440\u0442\u043a\u0438:<\/p>\n<pre><code>clang -fsanitize=\"fuzzer,address\" -I ..\/include\/ -I .. -I ..\/lib arg_fuzzing.c -DSIZEOF_CURL_OFF_T=8 -DHAVE_STRUCT_TIMEVAL -Dsread -Dswrite -o argv_fuzzer ..\/src\/static.a ..\/lib\/.libs\/libcurl.a -lssl -lcrypto -lz -lpsl -lzstd<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7e9\/348\/eb6\/7e9348eb63a9849f81cb235f3ad714ed.png\" alt=\"\u0418\u0442\u043e\u0433\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u0430\u0437\u0437\u0435\u0440\u0430\" title=\"\u0418\u0442\u043e\u0433\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u0430\u0437\u0437\u0435\u0440\u0430\" width=\"1545\" height=\"493\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/7e9\/348\/eb6\/7e9348eb63a9849f81cb235f3ad714ed.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7e9\/348\/eb6\/7e9348eb63a9849f81cb235f3ad714ed.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0418\u0442\u043e\u0433\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u0430\u0437\u0437\u0435\u0440\u0430<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0448 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/strong>, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0431\u043e <strong>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e<\/strong> \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e iptables (<a href=\"https:\/\/blog.trailofbits.com\/2023\/02\/14\/curl-audit-fuzzing-libcurl-command-line-interface\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 trailofbits<\/a>), \u043b\u0438\u0431\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <strong>\u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/strong>.<\/p>\n<\/blockquote>\n<h2>\u0418\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/h2>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<p>\u041c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0441\u0432\u043e\u0438\u043c \u043f\u0443\u0442\u0435\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 seccomp.<\/p>\n<p><strong>seccomp<\/strong> (Secure Computing Mode) \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 Linux, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u044f\u0434\u0440\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (<strong>syscalls<\/strong>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c.<\/p>\n<ul>\n<li>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>prctl()<\/code> \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 <strong>seccomp-bpf<\/strong> \u0444\u0438\u043b\u044c\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 (Docker, LXC), \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445 (Chrome), \u0438 \u0432 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 (\u0447\u0442\u043e\u0431\u044b &#171;\u0433\u043b\u0443\u0448\u0438\u0442\u044c&#187; \u0441\u0435\u0442\u044c \u0438\u043b\u0438 \u0444\u0430\u0439\u043b).<\/p>\n<\/li>\n<\/ul>\n<h4>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h4>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0432\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0430\u044f seccomp, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0432 \u044f\u0434\u0440\u043e \u0444\u0438\u043b\u044c\u0442\u0440, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 BPF (Berkeley Packet Filter).<br \/> \u042d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 <strong>\u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432<\/strong>: \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c, \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<h4>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/h4>\n<p>\u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438\/\u043f\u0440\u0438\u0451\u043c\u0430 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b:<\/p>\n<ul>\n<li>\n<p><code>socket()<\/code><\/p>\n<\/li>\n<li>\n<p><code>connect()<\/code><\/p>\n<\/li>\n<li>\n<p><code>send()<\/code>, <code>sendto()<\/code>, <code>sendmsg()<\/code><\/p>\n<\/li>\n<li>\n<p><code>write()<\/code> (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u043a\u0435\u0442)<\/p>\n<\/li>\n<li>\n<p><code>recv()<\/code>, <code>recvfrom()<\/code>, <code>recvmsg()<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432:<\/p>\n<pre><code>#include &lt;seccomp.h&gt; void mute_network() {     scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_ALLOW);     if (!ctx) return;      \/\/ Deny network-related syscalls     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(socket), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(connect), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(sendto), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(sendmsg), 0);      seccomp_load(ctx);     seccomp_release(ctx); }    int LLVMFuzzerInitialize(int *argc, char ***argv) {     mute_network(); \/\/ your helper to stub network     return 0; } <\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<strong> \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/strong> \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<strong> \u0434\u043e ~2000<\/strong> \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ac\/d0b\/153\/9acd0b15335289a98b8e17afe084e57f.png\" alt=\"\u0418\u0442\u043e\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f seccomp\" title=\"\u0418\u0442\u043e\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f seccomp\" width=\"1346\" height=\"523\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9ac\/d0b\/153\/9acd0b15335289a98b8e17afe084e57f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ac\/d0b\/153\/9acd0b15335289a98b8e17afe084e57f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0418\u0442\u043e\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f seccomp<\/figcaption><\/div>\n<\/figure>\n<h2>\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (stdin)<\/h2>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f seccomp \u043f\u0440\u0438 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ed3\/b94\/0f8\/ed3b940f8d6704f81981a4f25e51250c.png\" alt=\"\u0412\u0432\u043e\u0434 \u043f\u0430\u0440\u043e\u043b\u044f\" title=\"\u0412\u0432\u043e\u0434 \u043f\u0430\u0440\u043e\u043b\u044f\" width=\"942\" height=\"235\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ed3\/b94\/0f8\/ed3b940f8d6704f81981a4f25e51250c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ed3\/b94\/0f8\/ed3b940f8d6704f81981a4f25e51250c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0412\u0432\u043e\u0434 \u043f\u0430\u0440\u043e\u043b\u044f<\/figcaption><\/div>\n<\/figure>\n<p><code>stdin<\/code> \u2014 \u044d\u0442\u043e <strong>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0432\u043e\u0434\u0430<\/strong> (standard input) \u0432 \u044f\u0437\u044b\u043a\u0435 C. \u042d\u0442\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>FILE<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.  <\/p>\n<p><code>stdin<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0438\u0442\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430:<\/p>\n<h3>\u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e:<\/h3>\n<ul>\n<li>\n<p><code>fgets(buf, size, stdin);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p><code>getline(&amp;line, &amp;len, stdin);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e:<\/h3>\n<ul>\n<li>\n<p><code>getc(stdin);<\/code> \u0438\u043b\u0438 <code>fgetc(stdin);<\/code><\/p>\n<\/li>\n<li>\n<p><code>ungetc(ch, stdin);<\/code><\/p>\n<\/li>\n<\/ul>\n<h3>\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435:<\/h3>\n<ul>\n<li>\n<p><code>scanf(\"%d\", &amp;x);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0437 <code>stdin<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>fscanf(stdin, \"%s\", str);<\/code><\/p>\n<\/li>\n<\/ul>\n<h3>\u0411\u043b\u043e\u043a\u0430\u043c\u0438:<\/h3>\n<ul>\n<li>\n<p><code>fread(buf, 1, size, stdin);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0431\u043b\u043e\u043a \u0431\u0430\u0439\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0417\u0430\u043c\u0435\u043d\u0438\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0432\u043e\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435.<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u0443\u0447\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code>char *getpass_r(const char *prompt, \/* prompt to display *\/                 char *password,     \/* buffer to store password in *\/                 size_t buflen)      \/* size of buffer to store password in *\/ {   ssize_t nread;   bool disabled;   int fd = open(\"\/dev\/tty\", O_RDONLY);   if(fd == -1)     fd = STDIN_FILENO;; \/* use stdin if the tty could not be used *\/    disabled = ttyecho(FALSE, fd); \/* disable terminal echo *\/    fputs(prompt, tool_stderr);   nread = read(fd, password, buflen);   if(nread &gt; 0)     password[--nread] = '\\0'; \/* null-terminate where enter is stored *\/   else     password[0] = '\\0'; \/* got nothing *\/    if(disabled) {     \/* if echo actually was disabled, add a newline *\/     fputs(\"\\n\", tool_stderr);     (void)ttyecho(TRUE, fd); \/* enable echo *\/   }    if(STDIN_FILENO != fd)     close(fd);    return password; \/* return pointer to buffer *\/ } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 7 \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f<strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f tty<\/strong>. \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 7 <code>int fd = stdin,<\/code>\u0443\u0434\u0430\u043b\u0438\u0432 \u0441\u0442\u0440\u043e\u043a\u0438 8 \u0438 9.<code> <\/code><\/p>\n<p><strong>\u041f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/strong> \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 curl <strong>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/strong><\/p>\n<pre><code>make  cd .\/src &amp;&amp; ar -rcT static.a $(ls *.o | grep -v libcurltool_la-tool_help.o)<\/code><\/pre>\n<blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f <strong>\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/strong> &#8212;<strong> fmemopen<\/strong> \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e <strong>\u0437\u0430\u043c\u0435\u043d\u044f\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c stdin. <\/strong><\/p>\n<\/blockquote>\n<pre><code>if (!result) {         FILE *old_stdin = stdin;         FILE *memfile = fmemopen(data, size, \"r\");         if (!memfile) {             perror(\"fmemopen\");            return 1;         }          \/\/ Redirect stdin         stdin = memfile;         memset(&amp;global-&gt;state, 0, sizeof(global-&gt;state));         operate(fuzz_argc, fuzz_argv);         fclose(memfile);          \/\/ Restore original stdin         stdin = old_stdin; }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u0444\u0430\u0437\u0437\u0435\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0441 \u0432\u0432\u043e\u0434\u043e\u043c \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9d2\/78a\/c42\/9d278ac4281d87d3e2662c0972b99a7f.png\" alt=\"\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043c\u0435\u043d\u044b stdin\" title=\"\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043c\u0435\u043d\u044b stdin\" width=\"927\" height=\"106\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9d2\/78a\/c42\/9d278ac4281d87d3e2662c0972b99a7f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9d2\/78a\/c42\/9d278ac4281d87d3e2662c0972b99a7f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043c\u0435\u043d\u044b stdin<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u041f\u043e <strong>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u043c \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430<\/strong> \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 <strong>use-afte-free<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438:<br \/><a href=\"https:\/\/github.com\/curl\/curl\/issues\/18352\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/curl\/curl\/issues\/18352<\/a><\/p>\n<\/blockquote>\n<h4>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u043e\u0431\u0451\u0440\u0442\u043a\u0438:<\/h4>\n<pre><code>#include &lt;ctype.h&gt; #include &lt;curl\/curl.h&gt; #include &lt;errno.h&gt; #include &lt;seccomp.h&gt; #include &lt;stdarg.h&gt; #include &lt;stddef.h&gt; #include &lt;stdint.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt;  #include \"src\/config2setopts.h\" #include \"src\/tool_getparam.h\" #include \"src\/tool_operate.h\" #include \"src\/tool_setup.h\"  #define MAX_ASCII_CHARS 4096 #define MAX_ARGS 32 #define MAX_ARG_LEN 256  \/\/ Simple ASCII filter static int is_ascii_char(uint8_t c) {     return (c &gt;= 0x20 &amp;&amp; c &lt;= 0x7E);  \/\/ printable ASCII }  void mute_network() {     scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_ALLOW);     if (!ctx) return;      \/\/ Deny network-related syscalls     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(socket), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(connect), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(sendto), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(sendmsg), 0);      seccomp_load(ctx);     seccomp_release(ctx); }  int LLVMFuzzerInitialize(int *argc, char ***argv) {     mute_network();  \/\/ your helper to stub network     return 0; }  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {     if (size == 0) {         return 0;     }      CURLcode result = CURLE_OK;      \/\/ Buffer to store only printable ASCII input     char ascii_data[MAX_ASCII_CHARS + 1] = {0};     size_t ascii_pos = 0;      for (size_t i = 0; i &lt; size &amp;&amp; ascii_pos &lt; MAX_ASCII_CHARS - 1; i++) {         if (is_ascii_char(data[i])) {             ascii_data[ascii_pos++] = (char)data[i];         }     }      if (ascii_pos == 0) {         return 0;     }      char *fuzz_argv[MAX_ARGS + 4] = {0};     int fuzz_argc = 1;     fuzz_argv[0] = \"argv-fuzz\";     \/\/ Add --max-time 0.2 to enforce 100 ms timeout     fuzz_argv[fuzz_argc++] = \"--max-time\";     fuzz_argv[fuzz_argc++] = \"0.1\";      char *token = strtok(ascii_data, \" \");     while (token &amp;&amp; fuzz_argc &lt; MAX_ARGS + 1) {         fuzz_argv[fuzz_argc++] = token;         token = strtok(NULL, \" \");     }     fuzz_argv[fuzz_argc] = NULL;      if (fuzz_argc &lt; 4) {         return 0;     }      memset(&amp;global, 0, sizeof(global));     tool_init_stderr();     result = globalconf_init();     if (!result) {         FILE *old_stdin = stdin;         FILE *memfile = fmemopen(data, size, \"r\");         if (!memfile) {             perror(\"fmemopen\");             return 1;         }          \/\/ Redirect stdin         stdin = memfile;         memset(&amp;global-&gt;state, 0, sizeof(global-&gt;state));         operate(fuzz_argc, fuzz_argv);         fclose(memfile);          \/\/ Restore original stdin         stdin = old_stdin;     }     globalconf_free();     memset(&amp;global, 0, sizeof(global));     return 0<\/code><\/pre>\n<h2>\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c filename\/fd<\/h2>\n<p><a class=\"anchor\" name=\"4\" id=\"4\"><\/a><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0431\u0435\u0440\u0435\u043c &#8212; parseconfig(filename);<\/p>\n<p>\u0414\u043b\u044f <strong>\u044d\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430<\/strong> \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <strong>memfd_create<\/strong>:<\/p>\n<h4>memfd_create(&#171;fuzz&#187;, 0);<\/h4>\n<ul>\n<li>\n<p><code>memfd_create<\/code> \u2014 Linux-\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 <strong>\u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/strong> (tmpfs), \u043e\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 (\u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0430 \u0434\u0438\u0441\u043a).<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440<\/strong> <code>fd<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>\"fuzz\"<\/code> \u2014 \u044d\u0442\u043e \u0438\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e \u0432 <code>\/proc\/&lt;pid&gt;\/fdinfo\/<\/code> (\u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438).<\/p>\n<\/li>\n<li>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 (<code>flags = 0<\/code>) \u2014 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u043b\u0430\u0433\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>MFD_CLOEXEC<\/code>).<\/p>\n<\/li>\n<\/ul>\n<p>\ud83d\udccc \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 &#171;\u0444\u0430\u0439\u043b&#187;, \u043d\u043e \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430  \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<\/blockquote>\n<pre><code>int fd = memfd_create(\"fuzz\", 0);  write(fd, data, size);  lseek(fd, 0, SEEK_SET);<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440, \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443:<\/p>\n<ul>\n<li>\n<p>\u0412 Linux \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0435\u0441\u0442\u044c \u00ab\u0441\u0441\u044b\u043b\u043a\u0430\u00bb \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <code>\/proc\/self\/fd\/<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>self<\/code> = \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, <code>fd<\/code> = \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c <code>\/proc\/self\/fd\/3<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e\u0442 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u0432\u0430\u0441 \u0432 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0435 3.<\/p>\n<\/li>\n<li>\n<p><code>snprintf<\/code> \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u0443\u0442\u0438 \u043a <strong>\u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0434\u0451\u0442 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 <code>memfd<\/code>.<\/p>\n<\/li>\n<\/ul>\n<pre><code>char filename[64]; snprintf(filename, sizeof(filename), \"\/proc\/self\/fd\/%d\", fd);<\/code><\/pre>\n<blockquote>\n<p> \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c <code>filename<\/code> \u0432 \u043b\u044e\u0431\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f <strong>\u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u0444\u0430\u0439\u043b\u0430<\/strong> . \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<\/blockquote>\n<pre><code>#include &lt;stdint.h&gt; #include &lt;stddef.h&gt; #include &lt;stdio.h&gt; #include \"src\/tool_setup.h\"  #include \"src\/tool_getparam.h\"  #include \"src\/tool_operate.h\"  #include \"src\/config2setopts.h\"  #include &lt;curl\/curl.h&gt;  #include &lt;string.h&gt;   #define MAX_ASCII_CHARS 4096  #define MAX_ARGS 32  #define MAX_ARG_LEN 256  int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {     if (size == 0) {         return 0;     }      CURLcode result = CURLE_OK;     memset(&amp;global, 0, sizeof(global));     tool_init_stderr();     result = globalconf_init();          int fd = memfd_create(\"fuzz\", 0);     write(fd, data, size);     lseek(fd, 0, SEEK_SET);      char filename[64];     snprintf(filename, sizeof(filename), \"\/proc\/self\/fd\/%d\", fd);      if (!result) {         parseconfig(filename);     }            globalconf_free();     memset(&amp;global, 0, sizeof(global));     close(fd);     return 0; } <\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/p>\n<pre><code>clang -fsanitize=\"fuzzer,address\" -I ..\/include\/ -I .. -I ..\/lib config_fuzzing.c -DSIZEOF_CURL_OFF_T=8 -DHAVE_STRUCT_TIMEVAL -Dsread -Dswrite -o config_fuzzer ..\/src\/static.a ..\/lib\/.libs\/libcurl.a -lssl -lcrypto -lz -lpsl -lzstd<\/code><\/pre>\n<blockquote>\n<p>\u0417\u0430 \u0441\u0447\u0451\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>memfd_create<\/strong> \u043d\u0430\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0438\u0447\u044c<strong> \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/strong> \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f &#8212; <strong>~17000 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/strong><\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dbf\/bb4\/433\/dbfbb4433965644fb905170ee3d94728.png\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430\" width=\"1376\" height=\"396\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/dbf\/bb4\/433\/dbfbb4433965644fb905170ee3d94728.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dbf\/bb4\/433\/dbfbb4433965644fb905170ee3d94728.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u044b \u0430\u0432\u0442\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u044c\u0438:<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043a\u043e\u043d\u0441\u0443\u043b\u044c\u0442\u0430\u0446\u0438\u044f, \u043b\u0438\u0431\u043e \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u0448\u0438\u0445\/open-source \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 &#8212; \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0432\u044f\u0437\u0430\u0442\u044c\u0441\u044f \u0441 \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438 (telegram &#8212; <a class=\"mention\" href=\"\/users\/fugaru\">@fugaru<\/a>)<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/940946\/\"> https:\/\/habr.com\/ru\/articles\/940946\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p> <strong>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440:<\/strong> \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u0435\u0442 \u043d\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438\u043b\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430. \u0410\u0432\u0442\u043e\u0440 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u043e\u0441\u0438\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u043e\u043c, \u043d\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u043b\u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0442\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u043b\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.  <\/p>\n<\/blockquote>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#1\" rel=\"noopener noreferrer nofollow\">\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#2\" rel=\"noopener noreferrer nofollow\">\u0418\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#3\" rel=\"noopener noreferrer nofollow\">\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (stdin)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/940946#4\" rel=\"noopener noreferrer nofollow\">\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c filename\/fd<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u0432\u0438\u0436\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 LibFuzzer \u0438\u043b\u0438 AFL++ \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. <\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0434\u0432\u0438\u0436\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <strong>persistent mode<\/strong> \u2014 \u0440\u0435\u0436\u0438\u043c\u0430, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u0430\u0451\u0442 \u043a\u043e\u043b\u043e\u0441\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043e\u043d \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0443\u0434\u0430, \u0433\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0445 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0442.<\/p>\n<p>\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>\u0447\u0435\u0440\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u043c\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043e\u0431\u0449\u0438\u0435 \u0438 \u0434\u043b\u044f LibFuzzer, \u0438 \u0434\u043b\u044f AFL++:<\/p>\n<ul>\n<li>\n<p>\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0437\u0437\u0438\u043d\u0433 \u0432 <strong>persistent mode<\/strong> \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u00ab\u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u00bb \u0432\u0432\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <strong>curl \u0438 libfuzzer<\/strong>, \u043a\u0430\u043a \u0440\u0435\u0448\u0430\u0442\u044c \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438: \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c <code>argv<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>fmemopen<\/code> \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0438\u0431\u043a\u043e \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0437\u0437\u0435\u0440 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0443 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043a \u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u044b.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 Curl<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u0431\u043e\u0440\u043a\u0443 curl \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 Address Sanitizer&#8217;\u0430 \u0438 libfuzzer&#8217;\u0430:<\/p>\n<pre><code>.\/buildconf; CC=clang CFLAGS=\"-fsanitize=fuzzer-no-link,address -g\" LDFLAGS=\"-fsanitize=fuzzer-no-link,address -g\" .\/configure --with-openssl; make;<\/code><\/pre>\n<h2>\u0424\u0430\u0437\u0437\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/h2>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 <strong>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/strong>, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u2014 \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <code>argv<\/code>.<\/p>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c <code>int main(int argc, char **argv)<\/code> <code>argv<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u043a, \u0430 <code>argc<\/code> &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 argv \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439:<\/p>\n<ol>\n<li>\n<p><code><strong>argv[0]<\/strong><\/code><strong> &#8212; \u0438\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 (<\/strong><code><strong>argv[i] - \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong><\/code><strong>) \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0430<\/strong><br \/> \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0438\u0437 \u0444\u0430\u0437\u0437\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0440\u0435\u0437\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>\\0<\/code>.<\/p>\n<\/li>\n<li>\n<p><code><strong>argv[argc] == NULL . <\/strong><\/code>\u041d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0435<code><strong> argc.<\/strong><\/code><\/p>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e<strong> \u0432\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 arg<\/strong>v, \u0441 \u0432\u0435\u0440\u043d\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <strong>argc<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 argv<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435 <strong>\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 main \u0444\u0443\u043d\u043a\u0446\u0438\u0438 curl &#8212; <strong>globalconf_init() <\/strong>\u0438 <strong>globalconf_free<\/strong>.<br \/>curl\/src\/too_main.c: <\/p>\n<pre><code>int main(int argc, char *argv[]) #endif {   CURLcode result = CURLE_OK;    tool_init_stderr();  ...    if(main_checkfds()) {     errorf(\"out of file descriptors\");     return CURLE_FAILED_INIT;   }  ...    \/* Initialize memory tracking *\/   memory_tracking_init();    \/* Initialize the curl library - do not call any libcurl functions before      this point *\/   result = globalconf_init();   if(!result) {     \/* Start our curl operation *\/     result = operate(argc, argv);      \/* Perform the main cleanup *\/     globalconf_free();   }<\/code><\/pre>\n<h4>\u0428\u0430\u0433\u0438 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/h4>\n<ol>\n<li>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <strong>\u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong> \u0432\u044b\u0431\u0435\u0440\u0435\u043c <strong>operate. <\/strong> \u0412 \u0444\u0430\u0439\u043b\u0435 tool_operate.h \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e ASCII-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u044c \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f libfuzzer \u0441 \u0444\u043b\u0430\u0433\u043e\u043c <strong>-only-ascii=1).<\/strong><\/p>\n<\/li>\n<li>\n<p> \u0412\u044b\u0437\u043e\u0432 <strong>memset (global) &#8212; <\/strong> \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0444\u0430\u0437\u0437\u0435\u0440\u0430<\/p>\n<\/li>\n<li>\n<p> \u0412\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b argv \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 argc<\/p>\n<\/li>\n<\/ol>\n<h4>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/h4>\n<pre><code>#include &lt;stdint.h&gt; #include &lt;stddef.h&gt; #include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #include \"src\/tool_setup.h\"  #include \"src\/tool_getparam.h\"  #include \"src\/tool_operate.h\"  #include \"src\/config2setopts.h\"  #include &lt;curl\/curl.h&gt;  #include &lt;stdint.h&gt;  #include &lt;string.h&gt;   #define MAX_ASCII_CHARS 4096  #define MAX_ARGS 32  #define MAX_ARG_LEN 256  \/\/ \u0428\u0430\u0433 2 - Simple ASCII filter  static int is_ascii_char(uint8_t c) {     return (c &gt;= 0x20 &amp;&amp; c &lt;= 0x7E); \/\/ printable ASCII }  int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {     if (size == 0) {         return 0;     }      CURLcode result = CURLE_OK;      \/\/ Buffer to store only printable ASCII input     char ascii_data[MAX_ASCII_CHARS + 1] = {0};     size_t ascii_pos = 0;      for (size_t i = 0; i &lt; size &amp;&amp; ascii_pos &lt; MAX_ASCII_CHARS - 1; i++) {         if (is_ascii_char(data[i])) {             ascii_data[ascii_pos++] = (char)data[i];         }     }      if (ascii_pos == 0) {         return 0;     }      \/\/ \u0428\u0430\u0433 4 - \u0412\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b argv, argc     char *fuzz_argv[MAX_ARGS + 2] = {0};     int fuzz_argc = 1;     fuzz_argv[0] = \"argv-fuzz\";      char *token = strtok(ascii_data, \" \");     while (token &amp;&amp; fuzz_argc &lt; MAX_ARGS + 1) {         fuzz_argv[fuzz_argc++] = token;         token = strtok(NULL, \" \");     }     fuzz_argv[fuzz_argc] = NULL;      if (fuzz_argc &lt; 4) {         return 0;     }      \/\/ \u0428\u0430\u0433 3 - \u0418\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a     memset(&amp;global, 0, sizeof(global));      tool_init_stderr();     result = globalconf_init();     if (!result) {            \/\/ \u0428\u0430\u0433 3 - \u0418\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a            memset(&amp;global-&gt;state, 0, sizeof(global-&gt;state));             operate(fuzz_argc, fuzz_argv);    }      globalconf_free();        \/\/ \u0428\u0430\u0433 3 - \u0418\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a    memset(&amp;global, 0, sizeof(global));    return 0; } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 .\/src \u0431\u0435\u0437 \u0444\u0430\u0439\u043b\u0430<code>libcurltool_la-tool_help.o<\/code> :<br \/><code>ar -rcT static.a $(ls *.o | grep -v libcurltool_la-tool_help.o)<\/code><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u0431\u043e\u0440\u043a\u0443 \u043e\u0431\u0451\u0440\u0442\u043a\u0438:<\/p>\n<pre><code>clang -fsanitize=\"fuzzer,address\" -I ..\/include\/ -I .. -I ..\/lib arg_fuzzing.c -DSIZEOF_CURL_OFF_T=8 -DHAVE_STRUCT_TIMEVAL -Dsread -Dswrite -o argv_fuzzer ..\/src\/static.a ..\/lib\/.libs\/libcurl.a -lssl -lcrypto -lz -lpsl -lzstd<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u0442\u043e\u0433\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u0430\u0437\u0437\u0435\u0440\u0430<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0448 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/strong>, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0431\u043e <strong>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e<\/strong> \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e iptables (<a href=\"https:\/\/blog.trailofbits.com\/2023\/02\/14\/curl-audit-fuzzing-libcurl-command-line-interface\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 trailofbits<\/a>), \u043b\u0438\u0431\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <strong>\u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/strong>.<\/p>\n<\/blockquote>\n<h2>\u0418\u0437\u043e\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430<\/h2>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<p>\u041c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0441\u0432\u043e\u0438\u043c \u043f\u0443\u0442\u0435\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 seccomp.<\/p>\n<p><strong>seccomp<\/strong> (Secure Computing Mode) \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 Linux, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u044f\u0434\u0440\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (<strong>syscalls<\/strong>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c.<\/p>\n<ul>\n<li>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>prctl()<\/code> \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 <strong>seccomp-bpf<\/strong> \u0444\u0438\u043b\u044c\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 (Docker, LXC), \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445 (Chrome), \u0438 \u0432 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 (\u0447\u0442\u043e\u0431\u044b &#171;\u0433\u043b\u0443\u0448\u0438\u0442\u044c&#187; \u0441\u0435\u0442\u044c \u0438\u043b\u0438 \u0444\u0430\u0439\u043b).<\/p>\n<\/li>\n<\/ul>\n<h4>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h4>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0432\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0430\u044f seccomp, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0432 \u044f\u0434\u0440\u043e \u0444\u0438\u043b\u044c\u0442\u0440, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 BPF (Berkeley Packet Filter).<br \/> \u042d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 <strong>\u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432<\/strong>: \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c, \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<h4>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/h4>\n<p>\u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438\/\u043f\u0440\u0438\u0451\u043c\u0430 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b:<\/p>\n<ul>\n<li>\n<p><code>socket()<\/code><\/p>\n<\/li>\n<li>\n<p><code>connect()<\/code><\/p>\n<\/li>\n<li>\n<p><code>send()<\/code>, <code>sendto()<\/code>, <code>sendmsg()<\/code><\/p>\n<\/li>\n<li>\n<p><code>write()<\/code> (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u043a\u0435\u0442)<\/p>\n<\/li>\n<li>\n<p><code>recv()<\/code>, <code>recvfrom()<\/code>, <code>recvmsg()<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432:<\/p>\n<pre><code>#include &lt;seccomp.h&gt; void mute_network() {     scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_ALLOW);     if (!ctx) return;      \/\/ Deny network-related syscalls     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(socket), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(connect), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(sendto), 0);     seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(sendmsg), 0);      seccomp_load(ctx);     seccomp_release(ctx); }    int LLVMFuzzerInitialize(int *argc, char ***argv) {     mute_network(); \/\/ your helper to stub network     return 0; } <\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<strong> \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/strong> \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<strong> \u0434\u043e ~2000<\/strong> \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u0442\u043e\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f seccomp<\/figcaption><\/div>\n<\/figure>\n<h2>\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (stdin)<\/h2>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f seccomp \u043f\u0440\u0438 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u0430\u0437\u0437\u0438\u043d\u0433\u0430.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0432\u043e\u0434 \u043f\u0430\u0440\u043e\u043b\u044f<\/figcaption><\/div>\n<\/figure>\n<p><code>stdin<\/code> \u2014 \u044d\u0442\u043e <strong>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0432\u043e\u0434\u0430<\/strong> (standard input) \u0432 \u044f\u0437\u044b\u043a\u0435 C. \u042d\u0442\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>FILE<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.  <\/p>\n<p><code>stdin<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0438\u0442\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430:<\/p>\n<h3>\u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e:<\/h3>\n<ul>\n<li>\n<p><code>fgets(buf, size, stdin);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p><code>getline(&amp;line, &amp;len, stdin);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e:<\/h3>\n<ul>\n<li>\n<p><code>getc(stdin);<\/code> \u0438\u043b\u0438 <code>fgetc(stdin);<\/code><\/p>\n<\/li>\n<li>\n<p><code>ungetc(ch, stdin);<\/code><\/p>\n<\/li>\n<\/ul>\n<h3>\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435:<\/h3>\n<ul>\n<li>\n<p><code>scanf(\"%d\", &amp;x);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0437 <code>stdin<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>fscanf(stdin, \"%s\", str);<\/code><\/p>\n<\/li>\n<\/ul>\n<h3>\u0411\u043b\u043e\u043a\u0430\u043c\u0438:<\/h3>\n<ul>\n<li>\n<p><code>fread(buf, 1, size, stdin);<\/code> \u2014 \u0447\u0438\u0442\u0430\u0435\u0442 \u0431\u043b\u043e\u043a \u0431\u0430\u0439\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0417\u0430\u043c\u0435\u043d\u0438\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0432\u043e\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0430\u0437\u0437\u0438\u043d\u0433-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435.<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u0443\u0447\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code>char *getpass_r(const char *prompt, \/* prompt to display *\/                 char *password,     \/* buffer to store password in *\/                 size_t buflen)      \/* size of buffer to store password in *\/ {   ssize_t nread;   bool disabled;   int fd = open(\"\/dev\/tty\", O_RDONLY);   if(fd == -1)     fd = STDIN_FILENO;; \/* use stdin if the tty could not be used *\/    disabled = ttyecho(FALSE, fd); \/* disable terminal echo *\/    fputs(prompt, tool_stderr);   nread = read(fd, password, buflen);   if(nread &gt; 0)     password[--nread] = '\\0'; \/* null-terminate where enter is stored *\/   else<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-473218","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/473218","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=473218"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/473218\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=473218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=473218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=473218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}