<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Francisco Navarro </title>
    <description>The latest articles on DEV Community by Francisco Navarro  (@spothound).</description>
    <link>https://dev.to/spothound</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F312611%2F72d90fad-7963-493f-afee-23286cafd8eb.jpeg</url>
      <title>DEV Community: Francisco Navarro </title>
      <link>https://dev.to/spothound</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/spothound"/>
    <language>en</language>
    <item>
      <title>Learning pentesting path</title>
      <dc:creator>Francisco Navarro </dc:creator>
      <pubDate>Fri, 09 Oct 2020 16:14:36 +0000</pubDate>
      <link>https://dev.to/spothound/learning-pentesting-path-1e17</link>
      <guid>https://dev.to/spothound/learning-pentesting-path-1e17</guid>
      <description>&lt;ul&gt;
&lt;li&gt;How to start? Targets? Create or reuse?&lt;/li&gt;
&lt;li&gt;Read about metasploitable, we will use it as a target&lt;/li&gt;
&lt;li&gt;Set up a metasploitable3 environment using Vagrant/Virtualbox&lt;/li&gt;
&lt;li&gt;Read about nmap&lt;/li&gt;
&lt;li&gt;Some tutorials nmap, examples, etc..&lt;/li&gt;
&lt;li&gt;VPN: mullvad vpn&lt;/li&gt;
&lt;li&gt;Read about SQL injection&lt;/li&gt;
&lt;li&gt;' OR 1=1#'&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>kali</category>
      <category>security</category>
      <category>pentest</category>
      <category>paths</category>
    </item>
    <item>
      <title>How to monitorize program execution on Windows using Wazuh and sysmon.</title>
      <dc:creator>Francisco Navarro </dc:creator>
      <pubDate>Fri, 25 Sep 2020 14:54:18 +0000</pubDate>
      <link>https://dev.to/spothound/how-to-monitorize-program-execution-on-windows-using-wazuh-and-sysmon-3amj</link>
      <guid>https://dev.to/spothound/how-to-monitorize-program-execution-on-windows-using-wazuh-and-sysmon-3amj</guid>
      <description>&lt;p&gt;A few months ago I wrote a post in the Wazuh blog describing &lt;a href="https://wazuh.com/blog/monitoring-root-actions-on-linux-using-auditd-and-wazuh/"&gt;how to monitoring root actions on Linux systems using auditd and Wazuh&lt;/a&gt; which had been useful for a lot of users. Nevertheless, I've been asked by a slack community user how to do something similar on Windows and I've found the solution may be a little bit tricky.&lt;/p&gt;

&lt;p&gt;I'm writing this post sharing with you the solution I've proposed to this user in order to leave it in writing and have it at hand if someone needs it in the future.&lt;/p&gt;

&lt;h1&gt;
  
  
  Sysmon
&lt;/h1&gt;

&lt;p&gt;My proposal was simple: use Sysmon, a (and I'm quoting Microsoft documentation) Windows system service and device driver that, once installed on a system, remains resident across system reboots to monitor and log system activity to the Windows event log which It provides detailed information about process creations among other things.&lt;/p&gt;

&lt;p&gt;But, how does Sysmon integrates with &lt;a href="https://documentation.wazuh.com/3.13/getting-started/"&gt;Wazuh?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, there is &lt;a href="https://wazuh.com/blog/how-to-collect-windows-events-with-wazuh/"&gt;an interesting post&lt;/a&gt; in Wazuh blog talking about Sysmon and how to install and integrate it with Wazuh, but it described a particular case where the execution of a concrete program is realized.&lt;/p&gt;

&lt;p&gt;As we want to track every program execution in the system (As a starting point, of course, we could filter the data in one way or another and we won't generate alerts for every single program execution!), we need a different Sysmon config.&lt;/p&gt;

&lt;p&gt;So what do we do?&lt;/p&gt;

&lt;p&gt;Install Sysmon as described in &lt;a href="https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon"&gt;Microsoft documentation&lt;/a&gt; and configure it according to our needs. I recommend using it as a base &lt;a href="https://github.com/SwiftOnSecurity/sysmon-config/blob/master/sysmonconfig-export.xml"&gt;this Sysmon configuration&lt;/a&gt; which is well documented and available at GitHub. It has some exceptions for the Sysmon event with ID 1 (process creation) which is the one we want to track.&lt;/p&gt;

&lt;p&gt;After enabling Sysmon on our system, we will start receiving events on the event viewer for program executions (on the Sysmon folder, like it is shown in the image)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YJaYNfdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dlz60eni132lksc1ewm3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YJaYNfdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dlz60eni132lksc1ewm3.png" alt="Alt Text" width="835" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we will need to include this to our Wazuh Windows Agent configuration (&lt;code&gt;ossec.conf&lt;/code&gt;) to make it analyze those Sysmon logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;Microsoft-Windows-Sysmon/Operational eventchannel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And, in order to generate alerts, add to our manager custom rules (&lt;code&gt;/var/ossec/etc/local_rules.xml&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;sysmon_event1 Process creation detected: $(win.eventdata.description) by $(win.eventdata.user)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Naturally, this will generate alerts for every single process created on the system (with the exception of those that we filter in the Sysmon configuration). My advice over here would be to receive an alert of level 3 for all command execution (maybe filtering with Sysmon that program that doesn't matter to us) and child alerts with a severer level for more unusual programs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OGbhyoWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/za7y9jvav38qhpxh987p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OGbhyoWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/za7y9jvav38qhpxh987p.png" alt="Alt Text" width="880" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;sysmon_event1 mimikatz.exe Malicious program process creation detected: $(win.eventdata.description) by $(win.eventdata.user)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, an example of a complete alert generated by Wazuh using Sysmon:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CW4ByiqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hgrj248nzuwc7x4bivr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CW4ByiqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hgrj248nzuwc7x4bivr8.png" alt="Alt Text" width="880" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra: Legacy systems.
&lt;/h2&gt;

&lt;p&gt;What if my system is old and doesn't support sysmon? Another way could be to enable a security system policy to track program execution:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jfQjIxV4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cna55r2m5qqwss7wbep1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jfQjIxV4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cna55r2m5qqwss7wbep1.png" alt="Alt Text" width="880" height="611"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gBKvNN47--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z4zfb81bm1l1xn3rp99s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gBKvNN47--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z4zfb81bm1l1xn3rp99s.png" alt="Alt Text" width="880" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And enable eventlog data collection on Wazuh Windows Agent configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;Security eventlog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And a custom rule on your manager:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;18104 Process started on windows server 4688
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With these steps you could generate another simpler but awesome alert like this one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;** Alert 1601034144.2471775: - local,syslog,sshd,
2020 Sep 25 11:42:24 (windows) any-&amp;gt;WinEvtLog
Rule: 100009 (level 5) -&amp;gt; 'Process started on windows server'
User: (no user)
2020 Sep 25 11:42:21 WinEvtLog: registry: AUDIT_SUCCESS(4688): Microsoft-Windows-Security-Auditing: (no user): no domain: windows: S-1-5-21-3469229866-3176928381-1688825521-1000 vagrant WINDOWS 0x3fce6 0x1240 C:\Program Files (x86)\Internet Explorer\iexplore.exe %%1936 0xd9c ? S-1-0-0 - - 0x0 C:\Program Files\internet explorer\iexplore.exe S-1-16-12288
type: registry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It would be easy as well to create child rules for more concrete security events.&lt;/p&gt;

&lt;p&gt;And that is all! I hope you've found this post useful. If you need help with something don't doubt to ask here or open a thread in Wazuh slack channel, someone would be glad to help you!&lt;/p&gt;

</description>
      <category>security</category>
      <category>windows</category>
      <category>wazuh</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Destroy virtualbox machines from command line</title>
      <dc:creator>Francisco Navarro </dc:creator>
      <pubDate>Fri, 21 Feb 2020 17:36:07 +0000</pubDate>
      <link>https://dev.to/spothound/destroy-virtualbox-machines-from-command-line-4idm</link>
      <guid>https://dev.to/spothound/destroy-virtualbox-machines-from-command-line-4idm</guid>
      <description>&lt;p&gt;Here how I destroy virtualbox machines from command line (stop and unregister them)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# name: Check if the machine is running
VBoxManage list runningvms

# Stop the machine
vboxmanage controlvm {{ machine_name }} poweroff soft &amp;amp;&amp;amp; sleep 7

# Check if the machine exists
VBoxManage list vms

# Destroy selected machine.
vboxmanage unregistervm --delete {{ machine_name }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>devops</category>
      <category>virtualbox</category>
    </item>
    <item>
      <title>Compile Python3.7 on Solaris 10</title>
      <dc:creator>Francisco Navarro </dc:creator>
      <pubDate>Tue, 11 Feb 2020 19:57:36 +0000</pubDate>
      <link>https://dev.to/spothound/compile-python3-7-on-solaris-10-2h7b</link>
      <guid>https://dev.to/spothound/compile-python3-7-on-solaris-10-2h7b</guid>
      <description>&lt;p&gt;Today I've spent some hours fighting with Solaris 10 trying to compile Python3.7 from sources with openSSL support.&lt;/p&gt;

&lt;p&gt;The process is quite simple so I'll write it here so it can help someone with the same problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pkgadd -d http://get.opencsw.org/now
/opt/csw/bin/pkgutil -U
/opt/csw/bin/pkgutil -y -i libssl_dev
/opt/csw/bin/pkgutil -y -i libssl1_0_0
/opt/csw/bin/pkgutil -y -i libreadline6 
/opt/csw/bin/pkgutil -y -i libreadline_dev 
/opt/csw/bin/pkgutil -y -i libncurses_dev 
/opt/csw/bin/pkgutil -y -i libssl_dev 
/opt/csw/bin/pkgutil -y -i libsqlite3_dev 
/opt/csw/bin/pkgutil -y -i tk_dev 
/opt/csw/bin/pkgutil -y -i libgdbm_dev 
/opt/csw/bin/pkgutil -y -i libbz2_dev 
/opt/csw/bin/pkgutil -y -i libffi_dev 
/opt/csw/bin/pkgutil -y -i tk 
/opt/csw/bin/pkgutil -y -i pkgconfig 
/opt/csw/bin/pkgutil -y -i libsodium_dev # for paramiko
wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz
gunzip -c Python-3.7.6.tgz | tar xvf -
cd Python-3.7.6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;tip: edit Modules/socketmodule.c&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ diff -u ../socketmodule.c Modules/socketmodule.c
--- ../socketmodule.c   Wed May 15 16:36:32 2019
+++ Modules/socketmodule.c      Wed May 15 15:34:50 2019
@@ -5212,6 +5212,10 @@
 extern int sethostname(const char *, size_t);
 #endif

+#if (defined(__sun) &amp;amp;&amp;amp; defined(__SVR4))
+extern int sethostname(const char *, size_t);
+#endif
+
     if (!PyArg_ParseTuple(args, "S:sethostname", &amp;amp;hnobj)) {
         PyErr_Clear();
         if (!PyArg_ParseTuple(args, "O&amp;amp;:sethostname",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To avoid an error related to sethostname.&lt;/p&gt;

&lt;p&gt;Also, yo avoid problems with ctypes module you need to add the PKG_CONFIG_PATH option in the configure statement as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ./configure --prefix=/opt/python3 --with-openssl=/opt/csw/ --enable-optimizations LDFLAGS='-L/opt/local/lib -I/opt/csw/include -L/opt/csw/lib  -R/opt/local/lib' PKG_CONFIG_PATH=/opt/csw/lib/amd64/pkgconfig/ CPPFLAGS='-L/opt/local/lib -I/opt/csw/include -L/opt/csw/lib  -R/opt/local/lib'

 gmake
 gmake install
 PATH=/opt/python3/bin/:$PATH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You won't be able to use pip3 without adding such openssl flag to the configure step. And you need to install exactly the version 1.0.0 of libssl from CSW.&lt;/p&gt;

&lt;p&gt;With all of this we will have python3 installed and pip3 working!&lt;/p&gt;

&lt;p&gt;If you need to install pandas or numpy or somilar software I would recommend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/opt/csw/bin/pkgutil -y -i gcc5g++ libffi_dev libssl_dev libbabl_dev cython automake autoconf libsodium_dev jq pkgconfig cswpki libatlas_c++ libatk_dev
pip3 install --upgrade cython
pip3 install pandas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Best regards. &lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
