<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bash on Tyler's Blog</title><link>https://blog.zars.me/tags/bash/</link><description>Recent content in Bash on Tyler's Blog</description><generator>Hugo</generator><language>en-us</language><copyright>© Athul</copyright><lastBuildDate>Mon, 10 Jul 2023 12:13:32 +0530</lastBuildDate><atom:link href="https://blog.zars.me/tags/bash/index.xml" rel="self" type="application/rss+xml"/><item><title>pwnable cmd1</title><link>https://blog.zars.me/posts/pwnable/cmd1/</link><pubDate>Mon, 10 Jul 2023 12:13:32 +0530</pubDate><guid>https://blog.zars.me/posts/pwnable/cmd1/</guid><description>Starting to solve the pwnable.kr series of problems!
Provided Source #include &amp;lt;stdio.h&amp;gt; #include &amp;lt;string.h&amp;gt; int filter(char* cmd){ int r=0; r += strstr(cmd, &amp;#34;flag&amp;#34;)!=0; r += strstr(cmd, &amp;#34;sh&amp;#34;)!=0; r += strstr(cmd, &amp;#34;tmp&amp;#34;)!=0; return r; } int main(int argc, char* argv[], char** envp){ putenv(&amp;#34;PATH=/thankyouverymuch&amp;#34;); if(filter(argv[1])) return 0; system( argv[1] ); return 0; } Breaking this down, we can see three main parts:
Reset the $PATH to only include one entry Filter the input to no include any strings Run system() Solving The $PATH holds the main directories for where binaries are located, allowing for users to just run something short like pwd instead of /bin/pwd.</description></item></channel></rss>