{"id":13056,"date":"2026-05-22T04:04:00","date_gmt":"2026-05-22T04:04:00","guid":{"rendered":"https:\/\/serisec.com\/index.php\/2026\/05\/22\/33002\/"},"modified":"2026-05-22T04:04:00","modified_gmt":"2026-05-22T04:04:00","slug":"33002","status":"publish","type":"post","link":"https:\/\/serisec.com\/index.php\/2026\/05\/22\/33002\/","title":{"rendered":"Selective HTTP Proxying in Linux, (Thu, May 21st)"},"content":{"rendered":"<p>    Selective HTTP Proxying in Linux, (Thu, May 21st)<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n    <!-- no image --><br \/>\n \t<BR><br \/>\n<BR><\/BR><\/p>\n<div>\n<p>Recently, Rob <a href=\"https:\/\/isc.sans.edu\/diary\/Proxying+the+Unproxyable+Sending+EXE+traffic+to+a+Proxy\/32982\">wrote about a tool, Proxifier<\/a>, that can intercept requests from specific processes. Proxifier is available for Windows, macOS, and Android. But I have not seen a generic Linux option yet. The advantage of a tool like Proxifier is the ability to target specific software. For debugging, reverse engineering, and similar tasks, selecting a specific process is quite useful, as it creates less noise to sift through and simplifies analysis.<\/p>\n<p>There are a few methods for how proxies are usually configured in Linux:<\/p>\n<h3>Environment Variables<\/h3>\n<p>Many software programs look for the environment variables http_proxy and https_proxy. These environment variables\u00a0can be targeted by setting them for specific processes. Open a shell, set the environment variables, and run the software you wish to inspect in the same shell.<\/p>\n<blockquote>\n<p><tt>export http_proxy=\"http:\/\/proxy.example.com:80\"<br \/>\nexport https_proxy=\"http:\/\/proxy.example.com:443\"<br \/>\n.\/software-under-test<\/tt><\/p>\n<\/blockquote>\n<h3>iptables<\/h3>\n<p>The Linux firewall code, iptables, has a number of lesser-known interesting options that can help. For example, traffic can be redirected for a specific user:<\/p>\n<blockquote>\n<p><tt>iptables -t nat -A OUTPUT -m owner --uid-owner\u00a01234\u00a0-j REDIRECT --to-ports\u00a08080<\/tt><\/p>\n<\/blockquote>\n<p>This example will direct all traffic generated by the user with UID 1234 to port 8080. Now start the software as this specific user (maybe set up a test user for that purpose), and you will only see traffic created by this specific user. There is no option to select a pid as pids are constantly changing, and there may be multiple pids if the process uses multiple threads, which is common for networking.<\/p>\n<h3>Network Namespaces<\/h3>\n<p>Usually, a particular Linux system uses a single routing table. Network namespaces enable the creation of separate routing tables for different processes. First, you create a new namespace. You need to assign interfaces to it, as namespaces cannot\u00a0&#8220;see&#8221; network interfaces unless you explicitly add them.\u00a0<\/p>\n<blockquote>\n<p><code>ip netns add testing # adding namespace 'testing'<br \/>\nip link set dev ens18 netns testing # add ens18 interface to testing. However, most use virtual interfaces<br \/>\nip netns exec testing software-under-test # execute software-under-test in namespace<\/code><\/p>\n<\/blockquote>\n<p>\nThere are a number of more complete &#8220;recipes&#8221;\u00a0for network namespaces available online. I find it\u00a0the most versatile solution, particularly if environment variables do not work. The iptables solution is often simpler than namespaces, but you may end up with some unintended additional traffic.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>&#8212;<br \/>\nJohannes B. Ullrich, Ph.D. , Dean of Research, <a href=\"https:\/\/sans.edu\/\">SANS.edu<\/a><br \/>\n<a href=\"https:\/\/jbu.me\/164\">Twitter<\/a>|<\/p>\n<p> (c) SANS Internet Storm Center. https:\/\/isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.<\/p><\/div>\n<p> \t<BR><br \/>\n <BR><\/BR><\/p>\n<p> \t<BR><br \/>\n<BR><\/BR><br \/>\n<a href=\"https:\/\/isc.sans.edu\/diary\/rss\/33002\">Go to isc.sans.edu<\/a><br \/>\n \t<BR><br \/>\n <BR><\/BR><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Selective HTTP Proxying in Linux, (Thu, May 21st) Recently, Rob wrote about a tool, Proxifier, that can intercept requests from specific processes. Proxifier is available for Windows, macOS, and Android. But I have not seen a generic Linux option yet. The advantage of a tool like Proxifier is the ability to target specific software. For [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[69],"class_list":["post-13056","post","type-post","status-publish","format-standard","hentry","category-isc-sans-edu","tag-isc-sans-edu"],"_links":{"self":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/13056"}],"collection":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/comments?post=13056"}],"version-history":[{"count":0,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/13056\/revisions"}],"wp:attachment":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/media?parent=13056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/categories?post=13056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/tags?post=13056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}