<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>On Web Security</title><link href="https://www.onwebsecurity.com/" rel="alternate"></link><link href="/feeds/all.atom.xml" rel="self"></link><id>https://www.onwebsecurity.com/</id><updated>2019-01-24T10:00:00+00:00</updated><subtitle>Adventures while penetration testing: verifying vulnerabilities, learning and teaching about security, and... getting things done</subtitle><entry><title>Compiling WordNet on Windows to use with Emacs</title><link href="https://www.onwebsecurity.com/configuration/compiling-wordnet-on-windows-to-use-with-emacs.html" rel="alternate"></link><published>2019-01-24T10:00:00+00:00</published><updated>2019-01-24T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2019-01-24:/configuration/compiling-wordnet-on-windows-to-use-with-emacs.html</id><summary type="html">&lt;p&gt;&lt;img alt="WordNet running on MSYS2 on Windows" src="/images/wordnet-on-msys2-windows.png" /&gt;&lt;/p&gt;
&lt;p&gt;As a non-native English speaker who reads, writes and reviews lots of English
texts, I frequently look up definitions as well as synonyms of words. Of course
there are numerous online sources available to do this, but I like to decrease
my online 'footprint' due to privacy reasons. It also takes extra time to switch
to a browser window and enter a search query.&lt;/p&gt;
&lt;p&gt;Fortunately the fine folks at Princeton University compiled &lt;a class="reference external" href="https://wordnet.princeton.edu"&gt;WordNet&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;, a large
lexical database of English, which can be used offline - together with a tool to
search that database. Even better, somebody wrote a package to use WordNet
inside my favorite editor &lt;a class="reference external" href="https://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;. This means that just by hovering the cursor
over a word inside Emacs, the definition as well as synonyms can be shown. The
&lt;a class="reference external" href="http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"&gt;source code&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; is kindly provided by Princeton University.&lt;/p&gt;
&lt;div class="section" id="compiling-wordnet-using-msys2-on-for-windows"&gt;
&lt;h2&gt;Compiling WordNet using MSYS2 on/for Windows&lt;/h2&gt;
&lt;p&gt;As is usually the case, compiling on/for Windows using the &lt;a class="reference external" href="https://msys2.github.io/"&gt;MSYS2 subsystem&lt;/a&gt; &lt;a class="footnote-reference" href="#id8" id="id9"&gt;[4]&lt;/a&gt;
can be done, with a few minor tweaks.&lt;/p&gt;
&lt;p&gt;First, start a MSYS2 shell and install the required dependencies (build tools,
as well as the programming language &lt;code class="code"&gt;
Tcl&lt;/code&gt;
 and its widget toolkit
&lt;code class="code"&gt;
Tk&lt;/code&gt;
):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pacman -Sy --noconfirm base-devel mingw-w64-x86_64-tcl mingw-w64-x86_64-tk
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="WordNet running on MSYS2 on Windows" src="/images/wordnet-on-msys2-windows.png" /&gt;&lt;/p&gt;
&lt;p&gt;As a non-native English speaker who reads, writes and reviews lots of English
texts, I frequently look up definitions as well as synonyms of words. Of course
there are numerous online sources available to do this, but I like to decrease
my online 'footprint' due to privacy reasons. It also takes extra time to switch
to a browser window and enter a search query.&lt;/p&gt;
&lt;p&gt;Fortunately the fine folks at Princeton University compiled &lt;a class="reference external" href="https://wordnet.princeton.edu"&gt;WordNet&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;, a large
lexical database of English, which can be used offline - together with a tool to
search that database. Even better, somebody wrote a package to use WordNet
inside my favorite editor &lt;a class="reference external" href="https://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;. This means that just by hovering the cursor
over a word inside Emacs, the definition as well as synonyms can be shown. The
&lt;a class="reference external" href="http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"&gt;source code&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; is kindly provided by Princeton University.&lt;/p&gt;
&lt;div class="section" id="compiling-wordnet-using-msys2-on-for-windows"&gt;
&lt;h2&gt;Compiling WordNet using MSYS2 on/for Windows&lt;/h2&gt;
&lt;p&gt;As is usually the case, compiling on/for Windows using the &lt;a class="reference external" href="https://msys2.github.io/"&gt;MSYS2 subsystem&lt;/a&gt; &lt;a class="footnote-reference" href="#id8" id="id9"&gt;[4]&lt;/a&gt;
can be done, with a few minor tweaks.&lt;/p&gt;
&lt;p&gt;First, start a MSYS2 shell and install the required dependencies (build tools,
as well as the programming language &lt;code class="code"&gt;
Tcl&lt;/code&gt;
 and its widget toolkit
&lt;code class="code"&gt;
Tk&lt;/code&gt;
):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pacman -Sy --noconfirm base-devel mingw-w64-x86_64-tcl mingw-w64-x86_64-tk
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then download the &lt;a class="reference external" href="http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"&gt;source code&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id7"&gt;[3]&lt;/a&gt; as well as the latest &lt;a class="reference external" href="http://wordnetcode.princeton.edu/wn3.1.dict.tar.gz"&gt;database files&lt;/a&gt; &lt;a class="footnote-reference" href="#id10" id="id11"&gt;[5]&lt;/a&gt; using
&lt;code class="code"&gt;
wget&lt;/code&gt;
, and unpack both:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;wget http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz
wget http://wordnetcode.princeton.edu/wn3.1.dict.tar.gz
tar -xzvf WordNet-3.0.tar.gz
&lt;span class="nb"&gt;cd&lt;/span&gt; WordNet-3.0
tar -xzvf ../wn3.1.dict.tar.gz
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Run configure...&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;./configure
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;...and run into the first hurdle:&lt;/p&gt;
&lt;div class="section" id="warning-can-t-find-tk-configuration-definitions"&gt;
&lt;h3&gt;WARNING: Can't find Tk configuration definitions&lt;/h3&gt;
&lt;p&gt;The compiler script warns about not being able to find &lt;code class="code"&gt;
Tk&lt;/code&gt;
 configuration
definitions. Looking at the &lt;code class="code"&gt;
configure&lt;/code&gt;
 script, the file it is looking for
is &lt;code class="code"&gt;
tkConfig.sh&lt;/code&gt;
. On MSYS2, this file has been is installed under
&lt;code class="code"&gt;
/mingw64/lib/tkConfig.sh&lt;/code&gt;
 and this location can directly be passed as
parameter. The same holds true for the &lt;code class="code"&gt;
Tck&lt;/code&gt;
 configuration definitions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;./configure --with-tcl&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/mingw64/lib/&amp;#39;&lt;/span&gt; --with-tk&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/mingw64/lib/&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now the configure script succeeds. The next step, compiling the program
unfortunately fails at first run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;make
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="error-tcl-interp-aka-struct-tcl-interp-has-no-member-named-result"&gt;
&lt;h3&gt;error: 'Tcl_Interp' {aka 'struct Tcl_Interp'} has no member named 'result'&lt;/h3&gt;
&lt;p&gt;This hints at an incorrect version of &lt;code class="code"&gt;
Tcl&lt;/code&gt;
 being expected. Fortunately
this can be &lt;a class="reference external" href="https://www.tcl.tk/man/tcl/TclLib/Interp.htm"&gt;solved&lt;/a&gt; &lt;a class="footnote-reference" href="#id12" id="id13"&gt;[6]&lt;/a&gt; by defining a constant (&lt;code class="code"&gt;
USE_INTERP_RESULT&lt;/code&gt;
) while
compiling, either in the source code or on the command line. As it's best not to
touch the source, I opt for the command line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;CFLAGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;-DUSE_INTERP_RESULT&amp;quot;&lt;/span&gt; ./configure --with-tcl&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/mingw64/lib/&amp;#39;&lt;/span&gt; --with-tk&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/mingw64/lib/&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this the program compiles successfully on MSYS2, running on Windows 10.
The next step now strips the binaries and installs it, ready to be used on the
system.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;make install-strip
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this, when running the executable &lt;code class="code"&gt;
wn&lt;/code&gt;
 it still complains about not
being able to open data and index files:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
WordNet library error: Can't open datafile(/mingw64/dict/data.noun)
WordNet library error: Can't open indexfile(/mingw64/dict/index.noun)
WordNet library error: Can't open datafile(/mingw64/dict/data.verb) WordNet
library error: Can't open indexfile(/mingw64/dict/index.verb) WordNet
library error: Can't open datafile(/mingw64/dict/data.adj) WordNet library
error: Can't open indexfile(/mingw64/dict/index.adj) WordNet library error:
Can't open datafile(/mingw64/dict/data.adv) WordNet library error: Can't
open indexfile(/mingw64/dict/index.adv) WordNet library warning: Can't open
verb example sentence file(/mingw64/dict/sents.vrb) WordNet library warning:
Can't open verb example sentence index file(/mingw64/dict/sentidx.vrb) wn:
Fatal error - cannot open WordNet database
&lt;/pre&gt;
&lt;p&gt;The instructions point out that the environment variable &lt;code class="code"&gt;
WNHOME&lt;/code&gt;
 needs to
be set, pointing to the installation directory. After that, the binary seems to work:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;WNHOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/mingw64
wn successful -over
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;img alt="WordNet successful" src="/images/wordnet-successful.png" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="using-wordnet-with-emacs-using-helm"&gt;
&lt;h2&gt;Using WordNet with Emacs using helm&lt;/h2&gt;
&lt;p&gt;Next up is tying WordNet to Emacs. This is a matter of installing the packages
&lt;code class="code"&gt;
helm&lt;/code&gt;
 and &lt;code class="code"&gt;
helm-wordnet&lt;/code&gt;
, and setting the variable
&lt;code class="code"&gt;
helm-wordnet-wordnet-location&lt;/code&gt;
 to contain the absolute path to the MSYS2
subsystem folder where WordNet installed its dictionary files. This is the same
as the 'virtual' path &lt;code class="code"&gt;
/mingw64/dict&lt;/code&gt;
.&lt;/p&gt;
&lt;p&gt;Personally I use &lt;a class="reference external" href="https://github.com/jwiegley/use-package"&gt;use-package&lt;/a&gt; &lt;a class="footnote-reference" href="#id14" id="id15"&gt;[7]&lt;/a&gt; for all Emacs package management: This code
snippet from the startup file &lt;code class="code"&gt;
.init.el&lt;/code&gt;
 expects that package to be
installed and will take care of all the heavy lifting.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;use-package&lt;/span&gt; &lt;span class="nv"&gt;helm&lt;/span&gt;
  &lt;span class="nb"&gt;:ensure&lt;/span&gt; &lt;span class="no"&gt;t&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;use-package&lt;/span&gt; &lt;span class="nv"&gt;helm-wordnet&lt;/span&gt;
  &lt;span class="nb"&gt;:after&lt;/span&gt; &lt;span class="nv"&gt;helm&lt;/span&gt;
  &lt;span class="nb"&gt;:config&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;helm-wordnet-wordnet-location&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;/full/path/to/mingw64/lib&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nb"&gt;:ensure&lt;/span&gt; &lt;span class="no"&gt;t&lt;/span&gt;
  &lt;span class="nb"&gt;:pin&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;melpa&amp;quot;&lt;/span&gt;                           &lt;span class="c1"&gt;;; The package is only available at Melpa for the moment&lt;/span&gt;
 &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If everything went well, you can execute the function
&lt;code class="code"&gt;
helm-wordnet-suggest&lt;/code&gt;
 and Emacs will happily show synonyms and a definition.&lt;/p&gt;
&lt;p&gt;&lt;img alt="WordNet inside Emacs using helm" src="/images/wordnet-inside-emacs-using-helm.png" /&gt;&lt;/p&gt;
&lt;p&gt;Mission accomplished...&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;On most Linux variants, installing WordNet is simply a case of using the
native package manager, e.g. on Debian &lt;code class="code"&gt;
sudo apt-get install wordnet&lt;/code&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://wordnet.princeton.edu"&gt;https://wordnet.princeton.edu&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.gnu.org/software/emacs/"&gt;https://www.gnu.org/software/emacs/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[3]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#id6"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#id7"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;a class="reference external" href="http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"&gt;http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id8" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id9"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://msys2.github.io/"&gt;https://msys2.github.io/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id10" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id11"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://wordnetcode.princeton.edu/wn3.1.dict.tar.gz"&gt;http://wordnetcode.princeton.edu/wn3.1.dict.tar.gz&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id12" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id13"&gt;[6]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.tcl.tk/man/tcl/TclLib/Interp.htm"&gt;https://www.tcl.tk/man/tcl/TclLib/Interp.htm&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id14" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id15"&gt;[7]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/jwiegley/use-package"&gt;https://github.com/jwiegley/use-package&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="compiling"></category><category term="emacs"></category><category term="msys2"></category><category term="windows"></category></entry><entry><title>VirtualBox Does Not Automatically Resize Disk Image</title><link href="https://www.onwebsecurity.com/configuration/virtualbox-does-not-automatically-resize-disk-image.html" rel="alternate"></link><published>2019-01-14T10:00:00+00:00</published><updated>2019-01-17T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2019-01-14:/configuration/virtualbox-does-not-automatically-resize-disk-image.html</id><summary type="html">&lt;p&gt;I use &lt;a class="reference external" href="https://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; a lot as (local) virtualization software. It is a
full-featured virtualization host, and supports multiple underlying disk image
file types for guests.&lt;/p&gt;
&lt;p&gt;One of those is VirtualBox' native &lt;strong&gt;Virtual Disk Image&lt;/strong&gt; or &lt;strong&gt;VDI&lt;/strong&gt; file type.
An advantage of this type is that one can create a dynamically allocated image.
This image will initially be very small and not occupy any space for unused
virtual disk sectors, but will grow when a disk sector is written to for the
first time. VirtualBox does this by checking for unused sectors.&lt;/p&gt;
&lt;p&gt;However, this poses issues for disks with multiple partitions. If the last
partition is say a (unused) swap partition, then VirtualBox does not
automatically grow the underlying image. Even though the first partition is
full, VirtualBox will not grow and therefore the host disk will be full without
having reached its full potential.&lt;/p&gt;
&lt;p&gt;To solve this issue, the machine needs to be partitioned using one big happy
partition. Then VirtualBox will dynamically resize according to expectations.&lt;/p&gt;
&lt;p&gt;I use &lt;a class="reference external" href="https://www.packer.io"&gt;packer&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt; to prepare disk images for Debian, together with a &lt;a class="reference external" href="https://wiki.debian.org/DebianInstaller/Preseed"&gt;preseed&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; file.
Using preseeding to partition the disk is limited to what is supported by the
partition tool …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I use &lt;a class="reference external" href="https://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; a lot as (local) virtualization software. It is a
full-featured virtualization host, and supports multiple underlying disk image
file types for guests.&lt;/p&gt;
&lt;p&gt;One of those is VirtualBox' native &lt;strong&gt;Virtual Disk Image&lt;/strong&gt; or &lt;strong&gt;VDI&lt;/strong&gt; file type.
An advantage of this type is that one can create a dynamically allocated image.
This image will initially be very small and not occupy any space for unused
virtual disk sectors, but will grow when a disk sector is written to for the
first time. VirtualBox does this by checking for unused sectors.&lt;/p&gt;
&lt;p&gt;However, this poses issues for disks with multiple partitions. If the last
partition is say a (unused) swap partition, then VirtualBox does not
automatically grow the underlying image. Even though the first partition is
full, VirtualBox will not grow and therefore the host disk will be full without
having reached its full potential.&lt;/p&gt;
&lt;p&gt;To solve this issue, the machine needs to be partitioned using one big happy
partition. Then VirtualBox will dynamically resize according to expectations.&lt;/p&gt;
&lt;p&gt;I use &lt;a class="reference external" href="https://www.packer.io"&gt;packer&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt; to prepare disk images for Debian, together with a &lt;a class="reference external" href="https://wiki.debian.org/DebianInstaller/Preseed"&gt;preseed&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; file.
Using preseeding to partition the disk is limited to what is supported by the
partition tool, &lt;code class="code"&gt;
partman&lt;/code&gt;
. The standard mode of operation for partitioning
is &lt;code class="code"&gt;
atomic&lt;/code&gt;
, and according to the documentation, &lt;em&gt;&amp;quot;All files will be in
one partition&amp;quot;&lt;/em&gt;. This is not entirely true, as an additional partition will be
created for swap space - and this poses the dynamically resize issue.&lt;/p&gt;
&lt;p&gt;So therefore one needs to instruct &lt;code class="code"&gt;
partman&lt;/code&gt;
 to specifically create one
partition only, and not an additional swap partition.&lt;/p&gt;
&lt;p&gt;This can be done by adding a recipe to the packer preseed file that will use all
available space for one partition only, and by disabling the warning message of
not configuring a swap partition.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;### Partitioning
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto/method string regular
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-auto/expert_recipe string myroot :: 1000 50 -1 ext4 \
  $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } \
  filesystem{ ext4 } mountpoint{ / } .
d-i partman-auto/choose_recipe select myroot
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code class="code"&gt;
1000&lt;/code&gt;
 value in the recipe sets the minimus size for the partition.
The &lt;code class="code"&gt;
50&lt;/code&gt;
 value sets the priority, but as there will only be one partition
created, this is not used. The &lt;code class="code"&gt;
-1&lt;/code&gt;
 is a special value and instructs
&lt;code class="code"&gt;
partman&lt;/code&gt;
 to use all available disk space (unlimited partition size),
which is what we're after...&lt;/p&gt;
&lt;p&gt;Thanks to an answer on &lt;a class="reference external" href="https://superuser.com/questions/458672/ubuntu-preseed-use-whole-disk-space-but-no-swap#920957"&gt;superuser.com&lt;/a&gt; &lt;a class="footnote-reference" href="#id7" id="id8"&gt;[4]&lt;/a&gt;, which pointed me in the right direction.
Sharing the knowledge is the way to go :)&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.virtualbox.org/"&gt;https://www.virtualbox.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.packer.io"&gt;https://www.packer.io&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id6"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://wiki.debian.org/DebianInstaller/Preseed"&gt;https://wiki.debian.org/DebianInstaller/Preseed&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id7" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id8"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://superuser.com/questions/458672/ubuntu-preseed-use-whole-disk-space-but-no-swap#920957"&gt;https://superuser.com/questions/458672/ubuntu-preseed-use-whole-disk-space-but-no-swap#920957&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><category term="packer"></category><category term="virtualbox"></category></entry><entry><title>Setting Up a New Sphinx Documentation Framework</title><link href="https://www.onwebsecurity.com/configuration/setting-up-a-new-sphinx-documentation-framework.html" rel="alternate"></link><published>2018-10-24T10:00:00+00:00</published><updated>2019-01-24T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-10-24:/configuration/setting-up-a-new-sphinx-documentation-framework.html</id><summary type="html">&lt;p&gt;When having to write documentation for different formats, I always use the
&lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; (or reST) format. As this is something that happens quite
often, it made sense to put some effort in automating the set up of a new
documentation framework, a reusable set up script.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Setting up a framework" src="/images/setting-up-towers.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The standard documentation framework that I use consists of &lt;a class="reference external" href="http://www.sphinx-doc.org"&gt;Sphinx&lt;/a&gt; &lt;a class="footnote-reference" href="#id4" id="id5"&gt;[2]&lt;/a&gt;, which
takes care of converting source pages written in &lt;abbr title="reStructuredText"&gt;reST&lt;/abbr&gt;
into several formats: For example HTML, but also PDF or something more exotic
like ePub files. Note that Sphinx already comes with a setup script,
&lt;a class="reference external" href="http://www.sphinx-doc.org/en/master/man/sphinx-quickstart.html"&gt;sphinx-quickstart&lt;/a&gt; &lt;a class="footnote-reference" href="#id7" id="id8"&gt;[3]&lt;/a&gt; - but this doesn't take care of deploying files.&lt;/p&gt;
&lt;p&gt;In order to be able to create a reusable framework, I split the necessary files
into three groups:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;The Sphinx configuration itself,&lt;/li&gt;
&lt;li&gt;version information, and&lt;/li&gt;
&lt;li&gt;a LaTeX formatting template.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="section" id="the-sphinx-configuration"&gt;
&lt;h2&gt;The Sphinx configuration&lt;/h2&gt;
&lt;p&gt;This part consists of two different files; A generic &lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/Makefile"&gt;Makefile&lt;/a&gt; &lt;a class="footnote-reference" href="#id9" id="id10"&gt;[4]&lt;/a&gt; to build the
different artifact types - as well as a Sphinx configuration file (&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/conf.py"&gt;conf.py&lt;/a&gt; &lt;a class="footnote-reference" href="#id11" id="id12"&gt;[5]&lt;/a&gt;)
containing basic information about the project, and plugin details. These files
rarely change after having initialized the framework.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="version-information"&gt;
&lt;h2&gt;Version information&lt;/h2&gt;
&lt;p&gt;The version information (version, or build number) can change per release, and
is therefore contained in a separate …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;When having to write documentation for different formats, I always use the
&lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; (or reST) format. As this is something that happens quite
often, it made sense to put some effort in automating the set up of a new
documentation framework, a reusable set up script.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Setting up a framework" src="/images/setting-up-towers.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The standard documentation framework that I use consists of &lt;a class="reference external" href="http://www.sphinx-doc.org"&gt;Sphinx&lt;/a&gt; &lt;a class="footnote-reference" href="#id4" id="id5"&gt;[2]&lt;/a&gt;, which
takes care of converting source pages written in &lt;abbr title="reStructuredText"&gt;reST&lt;/abbr&gt;
into several formats: For example HTML, but also PDF or something more exotic
like ePub files. Note that Sphinx already comes with a setup script,
&lt;a class="reference external" href="http://www.sphinx-doc.org/en/master/man/sphinx-quickstart.html"&gt;sphinx-quickstart&lt;/a&gt; &lt;a class="footnote-reference" href="#id7" id="id8"&gt;[3]&lt;/a&gt; - but this doesn't take care of deploying files.&lt;/p&gt;
&lt;p&gt;In order to be able to create a reusable framework, I split the necessary files
into three groups:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;The Sphinx configuration itself,&lt;/li&gt;
&lt;li&gt;version information, and&lt;/li&gt;
&lt;li&gt;a LaTeX formatting template.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="section" id="the-sphinx-configuration"&gt;
&lt;h2&gt;The Sphinx configuration&lt;/h2&gt;
&lt;p&gt;This part consists of two different files; A generic &lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/Makefile"&gt;Makefile&lt;/a&gt; &lt;a class="footnote-reference" href="#id9" id="id10"&gt;[4]&lt;/a&gt; to build the
different artifact types - as well as a Sphinx configuration file (&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/conf.py"&gt;conf.py&lt;/a&gt; &lt;a class="footnote-reference" href="#id11" id="id12"&gt;[5]&lt;/a&gt;)
containing basic information about the project, and plugin details. These files
rarely change after having initialized the framework.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="version-information"&gt;
&lt;h2&gt;Version information&lt;/h2&gt;
&lt;p&gt;The version information (version, or build number) can change per release, and
is therefore contained in a separate text file (&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/installer.sh"&gt;VERSION&lt;/a&gt; &lt;a class="footnote-reference" href="#id13" id="id14"&gt;[6]&lt;/a&gt;). Its values will be
read and included by the build process.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="latex-template"&gt;
&lt;h2&gt;LaTeX template&lt;/h2&gt;
&lt;p&gt;Thirdly, the LaTeX formatting template &lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/latex-styling.tex"&gt;latex-styling.tex&lt;/a&gt; &lt;a class="footnote-reference" href="#id15" id="id16"&gt;[7]&lt;/a&gt; contains styling
information that will be used when building PDF files, and is also stored in a
separate file. This allows for easy updating and different re-use across
projects.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="setting-up-the-framework"&gt;
&lt;h2&gt;Setting up the framework&lt;/h2&gt;
&lt;p&gt;The reusable framework consists of a collection of the files mentioned above, as
well as some basic static files.&lt;/p&gt;
&lt;p&gt;So all that's left when setting up a new documentation framework is creating
some directories, copying the files, and... that's basically it.&lt;/p&gt;
&lt;p&gt;In order to take care of this, I wrote a simple Bash installer script,
&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/installer.sh"&gt;installer.sh&lt;/a&gt; &lt;a class="footnote-reference" href="#id13" id="id17"&gt;[6]&lt;/a&gt;. A new feature in Bash version 4 is the
support of associative arrays. That functionality makes it easier to write a
generic, reusable script which takes care of creating and copying files and
directories.&lt;/p&gt;
&lt;p&gt;A simple&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;./installer.sh TARGET&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will set up the framework in the directory &lt;code class="code"&gt;
TARGET&lt;/code&gt;
. Of course the
prerequisites (Sphinx and GNU Make) need to be installed as well. If they are,
all that's left to do is write some content in &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id3"&gt;[1]&lt;/a&gt;, and let
&lt;a class="reference external" href="http://www.sphinx-doc.org"&gt;Sphinx&lt;/a&gt; &lt;a class="footnote-reference" href="#id4" id="id6"&gt;[2]&lt;/a&gt; build it into an artifact of your choosing, for example HTML:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;make html&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The reusable Sphinx framework can be found at &lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework"&gt;https://github.com/PeterMosmans/setup-sphinx-framework&lt;/a&gt;&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[1]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#id2"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#id3"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;http://docutils.sourceforge.net/rst.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[2]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#id5"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#id6"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;a class="reference external" href="http://www.sphinx-doc.org"&gt;http://www.sphinx-doc.org&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id7" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id8"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://www.sphinx-doc.org/en/master/man/sphinx-quickstart.html"&gt;http://www.sphinx-doc.org/en/master/man/sphinx-quickstart.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id9" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id10"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/Makefile"&gt;https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/Makefile&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id11" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id12"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/conf.py"&gt;https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/conf.py&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id13" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[6]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#id14"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#id17"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/installer.sh"&gt;https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/installer.sh&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id15" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id16"&gt;[7]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/latex-styling.tex"&gt;https://github.com/PeterMosmans/setup-sphinx-framework/blob/master/latex-styling.tex&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="bash"></category><category term="pelican"></category><category term="rst"></category><category term="sphinx"></category></entry><entry><title>Hacker Summer Camp: BSides Las Vegas and DEF CON 2018 review</title><link href="https://www.onwebsecurity.com/opinion/hackersummercamp-bsides-las-vegas-and-def-con-2018-review.html" rel="alternate"></link><published>2018-10-08T10:00:00+00:00</published><updated>2018-10-08T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-10-08:/opinion/hackersummercamp-bsides-las-vegas-and-def-con-2018-review.html</id><summary type="html">&lt;p&gt;&lt;img alt="BSides Las Vegas 2018" src="/images/bsideslv2018.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Time flies... It's already been a few months ago that BSides Las Vegas and DEF
CON 2018 were held.&lt;/p&gt;
&lt;p&gt;BSides Las Vegas was nice, although the overall quality of talks seemed to be a
little higher in previous editions. This of course can be completely due to me
picking exactly the wrong talks: There is simply too much to see.&lt;/p&gt;
&lt;p&gt;DEF CON 2018 was also different than previous editions - mostly, because it was
now so spread out (Caesars Palace as well as the Flamingo Las Vegas). In
practice, this meant a lot of walking between the two locations. When you were
attending a talk in one location, it physically wasn't possible to attend the
next one unless it was located in the same or surrounding room.&lt;/p&gt;
&lt;p&gt;Fortunately DEF CON is all about learning, doing and networking - and in that
aspect it didn't disappoint.&lt;/p&gt;
&lt;p&gt;Especially for Hacker Summer Camp, I designed and built my own badge -
consisting of an &lt;a class="reference external" href="http://esp32.net"&gt;ESP32&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; microprocessor running &lt;a class="reference external" href="https://micropython.org/"&gt;MicroPython&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;, an e-Ink
display, some custom Python code, and a retro cassette case. The display rotates
numerous fitting images. The image was visible even when the power was
disconnected, thanks to the 3-color e-Ink display.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ESP32 and an eInk display" src="/images/eink-esp32.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;A follow-up …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="BSides Las Vegas 2018" src="/images/bsideslv2018.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Time flies... It's already been a few months ago that BSides Las Vegas and DEF
CON 2018 were held.&lt;/p&gt;
&lt;p&gt;BSides Las Vegas was nice, although the overall quality of talks seemed to be a
little higher in previous editions. This of course can be completely due to me
picking exactly the wrong talks: There is simply too much to see.&lt;/p&gt;
&lt;p&gt;DEF CON 2018 was also different than previous editions - mostly, because it was
now so spread out (Caesars Palace as well as the Flamingo Las Vegas). In
practice, this meant a lot of walking between the two locations. When you were
attending a talk in one location, it physically wasn't possible to attend the
next one unless it was located in the same or surrounding room.&lt;/p&gt;
&lt;p&gt;Fortunately DEF CON is all about learning, doing and networking - and in that
aspect it didn't disappoint.&lt;/p&gt;
&lt;p&gt;Especially for Hacker Summer Camp, I designed and built my own badge -
consisting of an &lt;a class="reference external" href="http://esp32.net"&gt;ESP32&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; microprocessor running &lt;a class="reference external" href="https://micropython.org/"&gt;MicroPython&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;, an e-Ink
display, some custom Python code, and a retro cassette case. The display rotates
numerous fitting images. The image was visible even when the power was
disconnected, thanks to the 3-color e-Ink display.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ESP32 and an eInk display" src="/images/eink-esp32.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;A follow-up post will detail the badge design, and the (Python) code behind it.&lt;/p&gt;
&lt;p&gt;It's the idea to build a more elaborate design for next year, which can
communicate with other badges. And yes, build more than one, as the demand
seemed to be high. Sharing is caring...&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://esp32.net"&gt;http://esp32.net&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://micropython.org/"&gt;https://micropython.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><category term="conference"></category></entry><entry><title>Customize and theme tmux the easy way</title><link href="https://www.onwebsecurity.com/configuration/customize-and-theme-tmux-the-easy-way.html" rel="alternate"></link><published>2018-06-11T10:00:00+00:00</published><updated>2018-06-11T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-06-11:/configuration/customize-and-theme-tmux-the-easy-way.html</id><summary type="html">&lt;p&gt;&lt;img alt="tmux" src="/images/tmux-logo-medium.png" /&gt;&lt;/p&gt;
&lt;p&gt;Terminal multiplexers allow you to view multiple separate terminal sessions
within a single terminal window. &lt;strong&gt;Tmux&lt;/strong&gt; is my terminal multiplexer of choice,
as it has more features than the 'original multiplexer' &lt;strong&gt;GNU Screen&lt;/strong&gt;. The
default setup gives you some information, but its appearance is, well...&lt;/p&gt;
&lt;p&gt;&lt;img alt="tmux-default" src="/images/tmux-default.png" /&gt;&lt;/p&gt;
&lt;p&gt;Fortunately you can theme, or customize pretty much everything: From the colors
to the information being shown in the status bar.&lt;/p&gt;
&lt;p&gt;&lt;img alt="tmux-dracula" src="/images/tmux-dracula.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to make it easier to theme tmux, I split the tmux configuration file
into two separate files. One file contains the main configuration
(&lt;code class="code"&gt;
~/.tmux.conf&lt;/code&gt;
), and another file contains only theming (visual)
variables (&lt;code class="code"&gt;
~/.tmux.THEMENAME.theme&lt;/code&gt;
). This setup makes it easier to
switch different themes, without changing the main tmux configuration file.&lt;/p&gt;
&lt;p&gt;As I wanted to automatically load a theme based on a shell environment variable,
I added a small piece of code to the main tmux configuration file. This executes
a shell command, which in turn loads the correct theme file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;run-shell &amp;quot;tmux source-file ~/.tmux.\${TMUX_THEME:-default}.theme&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The theme file is loaded dynamically, based on the environment variable
&lt;code class="code"&gt;
$TMUX_THEME&lt;/code&gt;
. If the environment variable is not set or empty, then the
default theme is loaded: &lt;code class="code"&gt;
~/.tmux.default.theme&lt;/code&gt;
.&lt;/p&gt;
&lt;p&gt;Loading a different …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="tmux" src="/images/tmux-logo-medium.png" /&gt;&lt;/p&gt;
&lt;p&gt;Terminal multiplexers allow you to view multiple separate terminal sessions
within a single terminal window. &lt;strong&gt;Tmux&lt;/strong&gt; is my terminal multiplexer of choice,
as it has more features than the 'original multiplexer' &lt;strong&gt;GNU Screen&lt;/strong&gt;. The
default setup gives you some information, but its appearance is, well...&lt;/p&gt;
&lt;p&gt;&lt;img alt="tmux-default" src="/images/tmux-default.png" /&gt;&lt;/p&gt;
&lt;p&gt;Fortunately you can theme, or customize pretty much everything: From the colors
to the information being shown in the status bar.&lt;/p&gt;
&lt;p&gt;&lt;img alt="tmux-dracula" src="/images/tmux-dracula.png" /&gt;&lt;/p&gt;
&lt;p&gt;In order to make it easier to theme tmux, I split the tmux configuration file
into two separate files. One file contains the main configuration
(&lt;code class="code"&gt;
~/.tmux.conf&lt;/code&gt;
), and another file contains only theming (visual)
variables (&lt;code class="code"&gt;
~/.tmux.THEMENAME.theme&lt;/code&gt;
). This setup makes it easier to
switch different themes, without changing the main tmux configuration file.&lt;/p&gt;
&lt;p&gt;As I wanted to automatically load a theme based on a shell environment variable,
I added a small piece of code to the main tmux configuration file. This executes
a shell command, which in turn loads the correct theme file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;run-shell &amp;quot;tmux source-file ~/.tmux.\${TMUX_THEME:-default}.theme&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The theme file is loaded dynamically, based on the environment variable
&lt;code class="code"&gt;
$TMUX_THEME&lt;/code&gt;
. If the environment variable is not set or empty, then the
default theme is loaded: &lt;code class="code"&gt;
~/.tmux.default.theme&lt;/code&gt;
.&lt;/p&gt;
&lt;p&gt;Loading a different theme is easy to do from within tmux using the
&lt;code class="code"&gt;
source-file&lt;/code&gt;
:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;tmux source-file ~/.tmux.THEMENAME.theme&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;My main tmux configuration file has a shortcut binding (&lt;kbd class="kbd"&gt;
r&lt;/kbd&gt;
) to quickly
reload a new configuration. This means that changes to the current theme can be
applied and viewed easily.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;bind r source-file ~/.tmux.conf \; display-message &amp;quot;tmux configuration file&lt;/span&gt;
&lt;span class="go"&gt;reloaded...&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Tmux can be found at &lt;a class="reference external" href="https://github.com/tmux/tmux"&gt;https://github.com/tmux/tmux&lt;/a&gt; , and my personal tmux
configuration and theme files can be found
&lt;a class="reference external" href="https://github.com/PeterMosmans/dotfiles/blob/master/.tmux.conf"&gt;https://github.com/PeterMosmans/dotfiles/blob/master/.tmux.conf&lt;/a&gt; and
&lt;a class="reference external" href="https://github.com/PeterMosmans/dotfiles/blob/master/.tmux.dracula.conf"&gt;https://github.com/PeterMosmans/dotfiles/blob/master/.tmux.dracula.conf&lt;/a&gt;&lt;/p&gt;
</content><category term="bash"></category><category term="tmux"></category><category term="zsh"></category></entry><entry><title>Improving cross-subsystem git workflow: The different git configuration files</title><link href="https://www.onwebsecurity.com/configuration/improving-git-workflow-difference-system-global-git-config-file.html" rel="alternate"></link><published>2018-04-24T10:00:00+00:00</published><updated>2018-04-24T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-04-24:/configuration/improving-git-workflow-difference-system-global-git-config-file.html</id><summary type="html">&lt;p&gt;&lt;img alt="Cross-platform" src="/images/st-andrews-cross-spider.png" /&gt;&lt;/p&gt;
&lt;p&gt;Git configuration settings can be stored in three different files: The
&lt;strong&gt;system&lt;/strong&gt; configuration file, the &lt;strong&gt;global&lt;/strong&gt; configuration file and the
repository's &lt;strong&gt;local&lt;/strong&gt; configuration file. See &lt;a class="reference external" href="https://www.onwebsecurity.com/configuration/git-on-windows-location-of-global-configuration-file.html"&gt;git on Windows - location of
configuration files&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; for their locations.&lt;/p&gt;
&lt;p&gt;When you use multiple subsystems on Windows (like MSYS2, Cygwin or any of the
the Windows Subsystem for Linux distributions) it can be a chore to keep the git
configurations synchronized. In other words: The less configuration files to
maintain, the better.&lt;/p&gt;
&lt;p&gt;Whether it's git for Windows, or one of the subsystem-specific git binaries:&lt;/p&gt;
&lt;blockquote&gt;
Each of the git binaries that runs on Windows expands the tilde (&lt;code class="code"&gt;
~&lt;/code&gt;
)
to the home directory, and the path separator is always a slash (&lt;code class="code"&gt;
/&lt;/code&gt;
).&lt;/blockquote&gt;
&lt;p&gt;These features can be used in our advantage in order to simplify the git
configuration files between all subsystems.&lt;/p&gt;
&lt;div class="section" id="re-defining-the-system"&gt;
&lt;h2&gt;Re-defining the system&lt;/h2&gt;
&lt;p&gt;The system configuration file is meant to store all system-specific
configuration settings, which will be applied to all users and git repositories
on the system.&lt;/p&gt;
&lt;p&gt;If you're the only user of your workstation, it makes sense to re-define system
as &lt;strong&gt;subsystem&lt;/strong&gt;:&lt;/p&gt;
&lt;blockquote&gt;
All &lt;strong&gt;subsystem-dependent&lt;/strong&gt; git configuration settings should be set in the
&lt;strong&gt;system&lt;/strong&gt; git configuration file.&lt;/blockquote&gt;
&lt;p&gt;This means that settings depending on underlying binaries, like …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Cross-platform" src="/images/st-andrews-cross-spider.png" /&gt;&lt;/p&gt;
&lt;p&gt;Git configuration settings can be stored in three different files: The
&lt;strong&gt;system&lt;/strong&gt; configuration file, the &lt;strong&gt;global&lt;/strong&gt; configuration file and the
repository's &lt;strong&gt;local&lt;/strong&gt; configuration file. See &lt;a class="reference external" href="https://www.onwebsecurity.com/configuration/git-on-windows-location-of-global-configuration-file.html"&gt;git on Windows - location of
configuration files&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; for their locations.&lt;/p&gt;
&lt;p&gt;When you use multiple subsystems on Windows (like MSYS2, Cygwin or any of the
the Windows Subsystem for Linux distributions) it can be a chore to keep the git
configurations synchronized. In other words: The less configuration files to
maintain, the better.&lt;/p&gt;
&lt;p&gt;Whether it's git for Windows, or one of the subsystem-specific git binaries:&lt;/p&gt;
&lt;blockquote&gt;
Each of the git binaries that runs on Windows expands the tilde (&lt;code class="code"&gt;
~&lt;/code&gt;
)
to the home directory, and the path separator is always a slash (&lt;code class="code"&gt;
/&lt;/code&gt;
).&lt;/blockquote&gt;
&lt;p&gt;These features can be used in our advantage in order to simplify the git
configuration files between all subsystems.&lt;/p&gt;
&lt;div class="section" id="re-defining-the-system"&gt;
&lt;h2&gt;Re-defining the system&lt;/h2&gt;
&lt;p&gt;The system configuration file is meant to store all system-specific
configuration settings, which will be applied to all users and git repositories
on the system.&lt;/p&gt;
&lt;p&gt;If you're the only user of your workstation, it makes sense to re-define system
as &lt;strong&gt;subsystem&lt;/strong&gt;:&lt;/p&gt;
&lt;blockquote&gt;
All &lt;strong&gt;subsystem-dependent&lt;/strong&gt; git configuration settings should be set in the
&lt;strong&gt;system&lt;/strong&gt; git configuration file.&lt;/blockquote&gt;
&lt;p&gt;This means that settings depending on underlying binaries, like tools to diff
binary files (see &lt;a class="reference external" href="https://www.onwebsecurity.com/configuration/diff-binary-files-docx-odt-pdf-with-git.html"&gt;Diff binary files like docx, odt and pdf with git&lt;/a&gt; &lt;a class="footnote-reference" href="#id4" id="id5"&gt;[2]&lt;/a&gt;) or
subsystem-specific files should be configured in the &lt;strong&gt;system&lt;/strong&gt; git
configuration file. Examples of such parameters are&lt;/p&gt;
&lt;pre class="code console literal-block"&gt;
&lt;span class="go"&gt;http.sslcainfo
http.sslbackend
sendemail.smtpserver
help.format
diff.pdf.textconv&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;The system configuration has a fixed path, &lt;em&gt;relative&lt;/em&gt; to the installation
directory: &lt;code class="code"&gt;
etc/gitconfig&lt;/code&gt;
. This configuration file can be read using
&lt;code class="code"&gt;
git config --list --system&lt;/code&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="global-means-universal"&gt;
&lt;h2&gt;Global means universal&lt;/h2&gt;
&lt;blockquote&gt;
Any &lt;strong&gt;user-specific&lt;/strong&gt; setting should be set in the &lt;strong&gt;global&lt;/strong&gt; git
configuration file.&lt;/blockquote&gt;
&lt;p&gt;Global configuration files can be found in what the binary or environment
considers the &lt;strong&gt;HOME&lt;/strong&gt; directory (see &lt;a class="reference external" href="https://www.onwebsecurity.com/configuration/git-on-windows-location-of-global-configuration-file.html"&gt;git on Windows - location of
configuration files&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id3"&gt;[1]&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Let's suppose from Window's point of view, the home directory of MSYS2 is
&lt;code class="code"&gt;
U: \&lt;/code&gt;
, and that is where the master &lt;code class="code"&gt;
.gitconfig&lt;/code&gt;
 file resides. By
symlinking that file from a command prompt from the Windows home directory
(&lt;code class="code"&gt;
%USERPROFILE%&lt;/code&gt;
) one universal (or global) configuration file can be
used - only one that needs to be maintained. From the Windows shell:&lt;/p&gt;
&lt;pre class="code console literal-block"&gt;
&lt;span class="go"&gt;mklink %USERPROFILE%\.gitconfig U:\.gitconfig&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;References to other user dependent files like global gitignore files can be set
using the tilde (&lt;code class="code"&gt;
~&lt;/code&gt;
) notation and slash (&lt;code class="code"&gt;
/&lt;/code&gt;
) path separator. They
need to be relative to the home directory.&lt;/p&gt;
&lt;pre class="code console literal-block"&gt;
&lt;span class="go"&gt;git config --global --add core.excludesfile ~/.gitignore_global&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Of course you still need to symlink the file &lt;code class="code"&gt;
.gitignore_global&lt;/code&gt;
 from any
subsystem, similar to &lt;code class="code"&gt;
.gitconfig&lt;/code&gt;
. From Windows:&lt;/p&gt;
&lt;pre class="code console literal-block"&gt;
&lt;span class="go"&gt;mklink %USERPROFILE%\.gitignore_global U:\.gitignore_global&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;The above workflow allows you to maintain a single personal git configuration
file. For each new subsystem all you need to do is create the necessary
symlinks, and everything is good to go. If you're using Debian on Windows for
example, then the command will look something like:&lt;/p&gt;
&lt;pre class="code console literal-block"&gt;
&lt;span class="go"&gt;mklink
&lt;/span&gt;&lt;span class="gp"&gt;%&lt;/span&gt;USERPROFILE%&lt;span class="se"&gt;\A&lt;/span&gt;ppData&lt;span class="se"&gt;\L&lt;/span&gt;ocal&lt;span class="se"&gt;\P&lt;/span&gt;ackages&lt;span class="se"&gt;\T&lt;/span&gt;heDebianProject.DebianGNULinux_76v4gfsz19hv4&lt;span class="se"&gt;\L&lt;/span&gt;ocalState&lt;span class="se"&gt;\r&lt;/span&gt;ootfs&lt;span class="se"&gt;\h&lt;/span&gt;ome&lt;span class="se"&gt;\%&lt;/span&gt;USERNAME%&lt;span class="se"&gt;\.&lt;/span&gt;gitconfig
&lt;span class="go"&gt;U:\.gitconfig&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;The exact path depends on the Windows Subsystem for Linux distribution version,
and your username.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;Symbolic links and the Windows Subsystem for Linux are currently &lt;em&gt;not
entirely working&lt;/em&gt;: This is scheduled for next release, see &lt;a class="reference external" href="https://github.com/Microsoft/WSL/issues/2995"&gt;Microsoft's
GitHub repository&lt;/a&gt; &lt;a class="footnote-reference" href="#id6" id="id7"&gt;[3]&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;So, if you're the only user of a system:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;subsystem-dependent settings go in the system configuration file, per subsystem.&lt;/li&gt;
&lt;li&gt;user-specific settings go in the global configuration file, per user.&lt;/li&gt;
&lt;li&gt;always use relative paths, using a tilde (&lt;code class="code"&gt;
~&lt;/code&gt;
) and slash (&lt;code class="code"&gt;
/&lt;/code&gt;
)&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[1]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#id2"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#id3"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;a class="reference external" href="https://www.onwebsecurity.com/configuration/git-on-windows-location-of-global-configuration-file.html"&gt;https://www.onwebsecurity.com/configuration/git-on-windows-location-of-global-configuration-file.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id5"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.onwebsecurity.com/configuration/diff-binary-files-docx-odt-pdf-with-git.html"&gt;https://www.onwebsecurity.com/configuration/diff-binary-files-docx-odt-pdf-with-git.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id6" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id7"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/Microsoft/WSL/issues/2995"&gt;https://github.com/Microsoft/WSL/issues/2995&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="git"></category><category term="tools"></category><category term="workflow"></category></entry><entry><title>When to sharpen, and when to cut</title><link href="https://www.onwebsecurity.com/opinion/when-to-sharpen-when-to-cut.html" rel="alternate"></link><published>2018-03-15T10:00:00+00:00</published><updated>2018-03-15T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-03-15:/opinion/when-to-sharpen-when-to-cut.html</id><summary type="html">&lt;p&gt;&lt;img alt="Cut down a tree" src="/images/cut-down-tree.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;When performing a task for the first time, I think of whether it's a one-off, or
that it will become a recurring thing. Python scripts for example can be developed
blazingly fast, and a little bit of automation can go a long way.&lt;/p&gt;
&lt;p&gt;However...&lt;/p&gt;
&lt;p&gt;...sometimes, while developing an automated solution that &lt;em&gt;looked so simple
beforehand&lt;/em&gt;, becomes a wild ride from one rabbit hole into the other. Missing
dependencies, compile errors, functions that don't lend themselves very well for
automation; Everything that can go wrong will go wrong.&lt;/p&gt;
&lt;p&gt;That's why I like &lt;a class="reference external" href="https://francescocirillo.com/pages/pomodoro-technique"&gt;The Pomodoro Technique&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; so much, where you work in discrete
time chunks of say 25, or 30 minutes. You decide upon the maximum cost for
the implementation beforehand. Given the expected return, what is a sane investment ? If
the time is up, then it's back to the original task &lt;em&gt;at hand&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I have learned the hard way to always budget some time for &lt;strong&gt;documenting&lt;/strong&gt; the
(partial) solution, so that at least there's the profit of knowledge gained. Or,
another record of a failed attempt...&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://francescocirillo.com/pages/pomodoro-technique"&gt;https://francescocirillo.com/pages/pomodoro-technique&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</summary><content type="html">&lt;p&gt;&lt;img alt="Cut down a tree" src="/images/cut-down-tree.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;When performing a task for the first time, I think of whether it's a one-off, or
that it will become a recurring thing. Python scripts for example can be developed
blazingly fast, and a little bit of automation can go a long way.&lt;/p&gt;
&lt;p&gt;However...&lt;/p&gt;
&lt;p&gt;...sometimes, while developing an automated solution that &lt;em&gt;looked so simple
beforehand&lt;/em&gt;, becomes a wild ride from one rabbit hole into the other. Missing
dependencies, compile errors, functions that don't lend themselves very well for
automation; Everything that can go wrong will go wrong.&lt;/p&gt;
&lt;p&gt;That's why I like &lt;a class="reference external" href="https://francescocirillo.com/pages/pomodoro-technique"&gt;The Pomodoro Technique&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; so much, where you work in discrete
time chunks of say 25, or 30 minutes. You decide upon the maximum cost for
the implementation beforehand. Given the expected return, what is a sane investment ? If
the time is up, then it's back to the original task &lt;em&gt;at hand&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I have learned the hard way to always budget some time for &lt;strong&gt;documenting&lt;/strong&gt; the
(partial) solution, so that at least there's the profit of knowledge gained. Or,
another record of a failed attempt...&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://francescocirillo.com/pages/pomodoro-technique"&gt;https://francescocirillo.com/pages/pomodoro-technique&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><category term="tools"></category><category term="workflow"></category></entry><entry><title>Rebase OpenSSL 1.0.2-chacha to use TLS 1.3</title><link href="https://www.onwebsecurity.com/announcements/rebase-openssl-1-0-2-chacha-to-use-tls-1-3.html" rel="alternate"></link><published>2018-01-31T10:00:00+00:00</published><updated>2018-01-31T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-01-31:/announcements/rebase-openssl-1-0-2-chacha-to-use-tls-1-3.html</id><summary type="html">&lt;p&gt;&lt;img alt="the-road-ahead" src="/images/the-road-ahead.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Since its inception in 2014, the &lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha"&gt;OpenSSL 1.0.2-chacha fork&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; has been used as
standard OpenSSL distribution for numerous SSL/TLS pentesting tools. It includes
default support for ciphers that are deemed insecure, and has extensive starttls
support.... in comparison with the vanilla 1.0.2 branch.&lt;/p&gt;
&lt;p&gt;However, even though 1.0.2 is deemed a Long Term Supported (LTS) version, no new
ciphers or functionality will be added to it.&lt;/p&gt;
&lt;p&gt;The initial reason to start the fork was a lack of ChaCha20 / Poly1305 support
in the 1.0.2 branch. After that, more and more features and insecure ciphers
were added or ported back in from other branches.&lt;/p&gt;
&lt;p&gt;As ChaCha20 / Poly1305 support has been added to the 1.1.1 branch, which also
contains (preliminary) TLS 1.3 support, it might be time for the insecure
OpenSSL version to be rebased onto a new branch. The initial goals will still be
the same:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Add as much ciphers and functionality as possible&lt;/li&gt;
&lt;li&gt;Keep the source aligned as much as possible to the vanilla version&lt;/li&gt;
&lt;li&gt;Keep the patches atomic, transparent and maintainable&lt;/li&gt;
&lt;li&gt;Write as little custom code as possible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This will be quite the challenge, as the architecture and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="the-road-ahead" src="/images/the-road-ahead.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Since its inception in 2014, the &lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha"&gt;OpenSSL 1.0.2-chacha fork&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; has been used as
standard OpenSSL distribution for numerous SSL/TLS pentesting tools. It includes
default support for ciphers that are deemed insecure, and has extensive starttls
support.... in comparison with the vanilla 1.0.2 branch.&lt;/p&gt;
&lt;p&gt;However, even though 1.0.2 is deemed a Long Term Supported (LTS) version, no new
ciphers or functionality will be added to it.&lt;/p&gt;
&lt;p&gt;The initial reason to start the fork was a lack of ChaCha20 / Poly1305 support
in the 1.0.2 branch. After that, more and more features and insecure ciphers
were added or ported back in from other branches.&lt;/p&gt;
&lt;p&gt;As ChaCha20 / Poly1305 support has been added to the 1.1.1 branch, which also
contains (preliminary) TLS 1.3 support, it might be time for the insecure
OpenSSL version to be rebased onto a new branch. The initial goals will still be
the same:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Add as much ciphers and functionality as possible&lt;/li&gt;
&lt;li&gt;Keep the source aligned as much as possible to the vanilla version&lt;/li&gt;
&lt;li&gt;Keep the patches atomic, transparent and maintainable&lt;/li&gt;
&lt;li&gt;Write as little custom code as possible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This will be quite the challenge, as the architecture and underlying code has
changed quite a bit from 1.0.2 to 1.1.1.&lt;/p&gt;
&lt;div class="section" id="differences-between-1-0-2-and-1-1-1"&gt;
&lt;h2&gt;Differences between 1.0.2 and 1.1.1&lt;/h2&gt;
&lt;p&gt;Obviously there are a lot of changes in 1.1.1 with regards to 1.0.2-chacha.&lt;/p&gt;
&lt;div class="section" id="starttls-support"&gt;
&lt;h3&gt;Starttls support&lt;/h3&gt;
&lt;p&gt;The 1.1.1 branch has much more support for starttls protocols (ftp, imap, irc,
ldap, lmtp, mysql, nntp, pop3, postgres, sieve, smtp, telnet, xmpp and
xmpp_server). Therefore there's no need to 're' implement that.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="protocols"&gt;
&lt;h3&gt;Protocols&lt;/h3&gt;
&lt;p&gt;The 1.1.1 branch has (preliminary) TLSv1.3 support, which is great (and one of
the reasons to rebase). Unfortunately support for SSLv2 isn't there. Since the
number of SSLv2 capable servers is very low, I'm wondering whether it makes
sense to 're enable' that in 1.1.1. The SSLv2 code is spread over a large number
of files, and therefore difficult to enable.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="authentication-algorithms"&gt;
&lt;h3&gt;Authentication algorithms&lt;/h3&gt;
&lt;p&gt;The 1.1.1 branch lacks weak authentication algorithms, like DH (Diffie-Hellman),
DSS and the anonymous ECDH (Elliptic curve Diffie-Hellman). Also missing are the
GOST01 and GOST94 algorithms, but they might be re-added by using an engine.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="key-exchange-algorithms"&gt;
&lt;h3&gt;Key exchange algorithms&lt;/h3&gt;
&lt;p&gt;The 1.1.1 branch lacks Diffie-Hellman with keysizes equal or smaller than 1024
bits (DH(512), DH(1024), RSA(512), RSA(1024), DH/DSS, DH/RSA, and algorithms based on ECDH
(ECDH/ECDSA and ECDH/RSA). Also missing is GOST, see above.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="ciphers"&gt;
&lt;h3&gt;Ciphers&lt;/h3&gt;
&lt;p&gt;The following ciphers are included in 1.0.2-chacha, and missing from 1.1.1-dev:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
0x00,0x00,0x00 - NULL-MD5                SSLv2 Kx=RSA(512) Au=RSA  Enc=None      Mac=MD5  export
     0x00,0x03 - EXP-RC4-MD5             SSLv3 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
     0x00,0x06 - EXP-RC2-CBC-MD5         SSLv3 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
     0x00,0x08 - EXP-DES-CBC-SHA         SSLv3 Kx=RSA(512) Au=RSA  Enc=DES(40)   Mac=SHA1 export
     0x00,0x09 - DES-CBC-SHA             SSLv3 Kx=RSA      Au=RSA  Enc=DES(56)   Mac=SHA1
     0x00,0x0B - EXP-DH-DSS-DES-CBC-SHA  SSLv3 Kx=DH/DSS   Au=DH   Enc=DES(40)   Mac=SHA1 export
     0x00,0x0C - DH-DSS-DES-CBC-SHA      SSLv3 Kx=DH/DSS   Au=DH   Enc=DES(56)   Mac=SHA1
     0x00,0x0D - DH-DSS-DES-CBC3-SHA     SSLv3 Kx=DH/DSS   Au=DH   Enc=3DES(168) Mac=SHA1
     0x00,0x0E - EXP-DH-RSA-DES-CBC-SHA  SSLv3 Kx=DH/RSA   Au=DH   Enc=DES(40)   Mac=SHA1 export
     0x00,0x0F - DH-RSA-DES-CBC-SHA      SSLv3 Kx=DH/RSA   Au=DH   Enc=DES(56)   Mac=SHA1
     0x00,0x10 - DH-RSA-DES-CBC3-SHA     SSLv3 Kx=DH/RSA   Au=DH   Enc=3DES(168) Mac=SHA1
     0x00,0x11 - EXP-EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=DSS  Enc=DES(40)   Mac=SHA1 export
     0x00,0x12 - EDH-DSS-DES-CBC-SHA     SSLv3 Kx=DH       Au=DSS  Enc=DES(56)   Mac=SHA1
     0x00,0x14 - EXP-EDH-RSA-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=RSA  Enc=DES(40)   Mac=SHA1 export
     0x00,0x15 - EDH-RSA-DES-CBC-SHA     SSLv3 Kx=DH       Au=RSA  Enc=DES(56)   Mac=SHA1
     0x00,0x17 - EXP-ADH-RC4-MD5         SSLv3 Kx=DH(512)  Au=None Enc=RC4(40)   Mac=MD5  export
     0x00,0x19 - EXP-ADH-DES-CBC-SHA     SSLv3 Kx=DH(512)  Au=None Enc=DES(40)   Mac=SHA1 export
     0x00,0x1A - ADH-DES-CBC-SHA         SSLv3 Kx=DH       Au=None Enc=DES(56)   Mac=SHA1
     0x00,0x30 - DH-DSS-AES128-SHA       SSLv3 Kx=DH/DSS   Au=DH   Enc=AES(128)  Mac=SHA1
     0x00,0x31 - DH-RSA-AES128-SHA       SSLv3 Kx=DH/RSA   Au=DH   Enc=AES(128)  Mac=SHA1
     0x00,0x36 - DH-DSS-AES256-SHA       SSLv3 Kx=DH/DSS   Au=DH   Enc=AES(256)  Mac=SHA1
     0x00,0x37 - DH-RSA-AES256-SHA       SSLv3 Kx=DH/RSA   Au=DH   Enc=AES(256)  Mac=SHA1
     0x00,0x3E - DH-DSS-AES128-SHA256    TLSv1.2 Kx=DH/DSS   Au=DH   Enc=AES(128)  Mac=SHA256
     0x00,0x3F - DH-RSA-AES128-SHA256    TLSv1.2 Kx=DH/RSA   Au=DH   Enc=AES(128)  Mac=SHA256
     0x00,0x42 - DH-DSS-CAMELLIA128-SHA  SSLv3 Kx=DH/DSS   Au=DH   Enc=Camellia(128) Mac=SHA1
     0x00,0x43 - DH-RSA-CAMELLIA128-SHA  SSLv3 Kx=DH/RSA   Au=DH   Enc=Camellia(128) Mac=SHA1
     0x00,0x62 - EXP1024-DES-CBC-SHA     SSLv3 Kx=RSA(1024) Au=RSA  Enc=DES(56)   Mac=SHA1 export
     0x00,0x63 - EXP1024-DHE-DSS-DES-CBC-SHA SSLv3 Kx=DH(1024) Au=DSS  Enc=DES(56)   Mac=SHA1 export
     0x00,0x64 - EXP1024-RC4-SHA         SSLv3 Kx=RSA(1024) Au=RSA  Enc=RC4(56)   Mac=SHA1 export
     0x00,0x65 - EXP1024-DHE-DSS-RC4-SHA SSLv3 Kx=DH(1024) Au=DSS  Enc=RC4(56)   Mac=SHA1 export
     0x00,0x66 - DHE-DSS-RC4-SHA         SSLv3 Kx=DH       Au=DSS  Enc=RC4(128)  Mac=SHA1
     0x00,0x68 - DH-DSS-AES256-SHA256    TLSv1.2 Kx=DH/DSS   Au=DH   Enc=AES(256)  Mac=SHA256
     0x00,0x69 - DH-RSA-AES256-SHA256    TLSv1.2 Kx=DH/RSA   Au=DH   Enc=AES(256)  Mac=SHA256
     0x00,0x80 - GOST94-GOST89-GOST89    SSLv3 Kx=GOST     Au=GOST94 Enc=GOST89(256) Mac=GOST89
0x05,0x00,0x80 - IDEA-CBC-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=IDEA(128) Mac=MD5
0x03,0x00,0x80 - RC2-CBC-MD5             SSLv2 Kx=RSA      Au=RSA  Enc=RC2(128)  Mac=MD5
0x01,0x00,0x80 - RC4-MD5                 SSLv2 Kx=RSA      Au=RSA  Enc=RC4(128)  Mac=MD5
0x08,0x00,0x80 - RC4-64-MD5              SSLv2 Kx=RSA      Au=RSA  Enc=RC4(64)   Mac=MD5
0x04,0x00,0x80 - EXP-RC2-CBC-MD5         SSLv2 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
0x02,0x00,0x80 - EXP-RC4-MD5             SSLv2 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
     0x00,0x81 - GOST2001-GOST89-GOST89  SSLv3 Kx=GOST     Au=GOST01 Enc=GOST89(256) Mac=GOST89
     0x00,0x82 - GOST94-NULL-GOST94      SSLv3 Kx=GOST     Au=GOST94 Enc=None      Mac=GOST94
     0x00,0x83 - GOST2001-NULL-GOST94    SSLv3 Kx=GOST     Au=GOST01 Enc=None      Mac=GOST94
     0x00,0x85 - DH-DSS-CAMELLIA256-SHA  SSLv3 Kx=DH/DSS   Au=DH   Enc=Camellia(256) Mac=SHA1
     0x00,0x86 - DH-RSA-CAMELLIA256-SHA  SSLv3 Kx=DH/RSA   Au=DH   Enc=Camellia(256) Mac=SHA1
     0x00,0x97 - DH-DSS-SEED-SHA         SSLv3 Kx=DH/DSS   Au=DH   Enc=SEED(128) Mac=SHA1
     0x00,0x98 - DH-RSA-SEED-SHA         SSLv3 Kx=DH/RSA   Au=DH   Enc=SEED(128) Mac=SHA1
     0x00,0xA0 - DH-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=DH/RSA   Au=DH   Enc=AESGCM(128) Mac=AEAD
     0x00,0xA1 - DH-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=DH/RSA   Au=DH   Enc=AESGCM(256) Mac=AEAD
     0x00,0xA4 - DH-DSS-AES128-GCM-SHA256 TLSv1.2 Kx=DH/DSS   Au=DH   Enc=AESGCM(128) Mac=AEAD
     0x00,0xA5 - DH-DSS-AES256-GCM-SHA384 TLSv1.2 Kx=DH/DSS   Au=DH   Enc=AESGCM(256) Mac=AEAD
     0x00,0xBB - DH-DSS-CAMELLIA128-SHA256 TLSv1.2 Kx=DH/DSS   Au=DH   Enc=Camellia(128) Mac=SHA256
     0x00,0xBC - DH-RSA-CAMELLIA128-SHA256 TLSv1.2 Kx=DH/RSA   Au=DH   Enc=Camellia(128) Mac=SHA256
     0x00,0xC1 - DH-DSS-CAMELLIA256-SHA256 TLSv1.2 Kx=DH/DSS   Au=DH   Enc=Camellia(256) Mac=SHA256
     0x00,0xC2 - DH-RSA-CAMELLIA256-SHA256 TLSv1.2 Kx=DH/RSA   Au=DH   Enc=Camellia(256) Mac=SHA256
0x01,0x00,0x80 - RC4-MD5                 SSLv2 Kx=RSA      Au=RSA  Enc=RC4(128)  Mac=MD5
0x02,0x00,0x80 - EXP-RC4-MD5             SSLv2 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
0x03,0x00,0x80 - RC2-CBC-MD5             SSLv2 Kx=RSA      Au=RSA  Enc=RC2(128)  Mac=MD5
0x04,0x00,0x80 - EXP-RC2-CBC-MD5         SSLv2 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
0x05,0x00,0x80 - IDEA-CBC-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=IDEA(128) Mac=MD5
0x06,0x00,0x40 - DES-CBC-MD5             SSLv2 Kx=RSA      Au=RSA  Enc=DES(56)   Mac=MD5
0x07,0x00,0xC0 - DES-CBC3-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=3DES(168) Mac=MD5
0x08,0x00,0x80 - RC4-64-MD5              SSLv2 Kx=RSA      Au=RSA  Enc=RC4(64)   Mac=MD5
     0xC0,0x01 - ECDH-ECDSA-NULL-SHA     SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=None      Mac=SHA1
     0xC0,0x02 - ECDH-ECDSA-RC4-SHA      SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=RC4(128)  Mac=SHA1
     0xC0,0x03 - ECDH-ECDSA-DES-CBC3-SHA SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=3DES(168) Mac=SHA1
     0xC0,0x04 - ECDH-ECDSA-AES128-SHA   SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=AES(128)  Mac=SHA1
     0xC0,0x05 - ECDH-ECDSA-AES256-SHA   SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=AES(256)  Mac=SHA1
     0xC0,0x0B - ECDH-RSA-NULL-SHA       SSLv3 Kx=ECDH/RSA Au=ECDH Enc=None      Mac=SHA1
     0xC0,0x0C - ECDH-RSA-RC4-SHA        SSLv3 Kx=ECDH/RSA Au=ECDH Enc=RC4(128)  Mac=SHA1
     0xC0,0x0D - ECDH-RSA-DES-CBC3-SHA   SSLv3 Kx=ECDH/RSA Au=ECDH Enc=3DES(168) Mac=SHA1
     0xC0,0x0E - ECDH-RSA-AES128-SHA     SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(128)  Mac=SHA1
     0xC0,0x0F - ECDH-RSA-AES256-SHA     SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(256)  Mac=SHA1
     0xC0,0x25 - ECDH-ECDSA-AES128-SHA256 TLSv1.2 Kx=ECDH/ECDSA Au=ECDH Enc=AES(128)  Mac=SHA256
     0xC0,0x26 - ECDH-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH/ECDSA Au=ECDH Enc=AES(256)  Mac=SHA384
     0xC0,0x29 - ECDH-RSA-AES128-SHA256  TLSv1.2 Kx=ECDH/RSA Au=ECDH Enc=AES(128)  Mac=SHA256
     0xC0,0x2A - ECDH-RSA-AES256-SHA384  TLSv1.2 Kx=ECDH/RSA Au=ECDH Enc=AES(256)  Mac=SHA384
     0xC0,0x2D - ECDH-ECDSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH/ECDSA Au=ECDH Enc=AESGCM(128) Mac=AEAD
     0xC0,0x2E - ECDH-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH/ECDSA Au=ECDH Enc=AESGCM(256) Mac=AEAD
     0xC0,0x31 - ECDH-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH/RSA Au=ECDH Enc=AESGCM(128) Mac=AEAD
     0xC0,0x32 - ECDH-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH/RSA Au=ECDH Enc=AESGCM(256) Mac=AEAD
     0xC0,0x74 - ECDH-ECDSA-CAMELLIA128-SHA256 TLSv1.2 Kx=ECDH/ECDSA Au=ECDH Enc=Camellia(128) Mac=SHA256
     0xC0,0x75 - ECDH-ECDSA-CAMELLIA256-SHA384 TLSv1.2 Kx=ECDH/ECDSA Au=ECDH Enc=Camellia(256) Mac=SHA384
     0xC0,0x78 - ECDH-RSA-CAMELLIA128-SHA256 TLSv1.2 Kx=ECDH/RSA Au=ECDH Enc=Camellia(128) Mac=SHA256
     0xC0,0x79 - ECDH-RSA-CAMELLIA256-SHA384 TLSv1.2 Kx=ECDH/RSA Au=ECDH Enc=Camellia(256) Mac=SHA384
     0xCC,0x13 - ECDHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH     Au=RSA  Enc=ChaCha20(256) Mac=AEAD
     0xCC,0x14 - ECDHE-ECDSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=ChaCha20(256) Mac=AEAD
     0xCC,0x15 - DHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=DH       Au=RSA  Enc=ChaCha20(256) Mac=AEAD
&lt;/pre&gt;
&lt;p&gt;In short: ciphers based on one of the aforementioned key exchange and
authentication protocols, export ciphers and RC4, MD5 or SHA.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="roadmap"&gt;
&lt;h2&gt;Roadmap&lt;/h2&gt;
&lt;p&gt;The first phase of rebasing 1.0.2-chacha onto master would be to decide on a new
name (suggestions anyone ?), and creating a hierarchy of TODO items. This allows
me (and hopefully other contributors) to work on the items that are in most
'demand' for this generation.&lt;/p&gt;
&lt;p&gt;As soon as a new &lt;a class="reference external" href="https://github.com/openssl/openssl/issues/5120"&gt;Long Term Support&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt; version will be chosen, it would be time
to really rebase on that version, instead of master. If the commits are atomic
and 'rebasable', that would be no problem.&lt;/p&gt;
&lt;p&gt;I'm looking forward to the Long Term Supported future!&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha"&gt;https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/openssl/openssl/issues/5120"&gt;https://github.com/openssl/openssl/issues/5120&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="tools"></category><category term="openssl"></category><category term="pentesting"></category></entry><entry><title>Tools for setting, tracking and achieving long term goals</title><link href="https://www.onwebsecurity.com/opinion/tools-for-setting-tracking-and-achieving-long-term-goals.html" rel="alternate"></link><published>2018-01-18T10:00:00+00:00</published><updated>2018-01-18T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2018-01-18:/opinion/tools-for-setting-tracking-and-achieving-long-term-goals.html</id><summary type="html">&lt;p&gt;&lt;img alt="planner2018" src="/images/planner2018.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Immediately after reading an article on David Allen and his brainchild Getting
Things Done, I started with implementing his methodology. I loved it. I still
love it - especially the Getting Things Done concepts of inbox ZERO, maintaining
lists, and periodic reviews.&lt;/p&gt;
&lt;p&gt;Inbox ZERO for me is not so much about having empty email inboxes, as well as
making sure that input is collected from &lt;em&gt;multiple locations&lt;/em&gt; and stored into
one dedicated location. An inbox can also be a notebook, or note taking software
like Google Keep.&lt;/p&gt;
&lt;p&gt;Electronically stored lists have the benefit of being available on a multitude
of devices, the ability to synchronize between them, backups, and their biggest
advantage - providing dynamic views.&lt;/p&gt;
&lt;p&gt;&lt;img alt="emacs" src="/images/emacs.png" /&gt;&lt;/p&gt;
&lt;p&gt;Both tools that I have been using so far (the open source Java application
&lt;a class="reference external" href="https://www.trgtd.com.au/"&gt;ThinkingRock&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;, and Emacs in &lt;a class="reference external" href="http://orgmode.org/"&gt;Org mode&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;) for maintaining lists of actionable
items and projects were great in that perspective. Using those tools for
periodic reviews was a different story. After trying numerous configurations I
never got the hang of using ThinkingRock and Emacs for that purpose. Items
become abstract letters on a screen. Views never fully captured what was
important or which project served which goal.&lt;/p&gt;
&lt;p&gt;Periodically reviewing projects and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="planner2018" src="/images/planner2018.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Immediately after reading an article on David Allen and his brainchild Getting
Things Done, I started with implementing his methodology. I loved it. I still
love it - especially the Getting Things Done concepts of inbox ZERO, maintaining
lists, and periodic reviews.&lt;/p&gt;
&lt;p&gt;Inbox ZERO for me is not so much about having empty email inboxes, as well as
making sure that input is collected from &lt;em&gt;multiple locations&lt;/em&gt; and stored into
one dedicated location. An inbox can also be a notebook, or note taking software
like Google Keep.&lt;/p&gt;
&lt;p&gt;Electronically stored lists have the benefit of being available on a multitude
of devices, the ability to synchronize between them, backups, and their biggest
advantage - providing dynamic views.&lt;/p&gt;
&lt;p&gt;&lt;img alt="emacs" src="/images/emacs.png" /&gt;&lt;/p&gt;
&lt;p&gt;Both tools that I have been using so far (the open source Java application
&lt;a class="reference external" href="https://www.trgtd.com.au/"&gt;ThinkingRock&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;, and Emacs in &lt;a class="reference external" href="http://orgmode.org/"&gt;Org mode&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;) for maintaining lists of actionable
items and projects were great in that perspective. Using those tools for
periodic reviews was a different story. After trying numerous configurations I
never got the hang of using ThinkingRock and Emacs for that purpose. Items
become abstract letters on a screen. Views never fully captured what was
important or which project served which goal.&lt;/p&gt;
&lt;p&gt;Periodically reviewing projects and actionable lists is in my opinion the single
most important thing one needs to do in order to achieve one's long term goals.
You need to step out of the operation and look back, in order to plan ahead.&lt;/p&gt;
&lt;p&gt;Writing something down with pen on paper is completely different than typing
something on a keyboard. Using pen and paper forces you to think more about what
exactly it is that you want to write down beforehand. It cannot be changed as
easily as with typed words. It also forces you to think about the visual
structure: Where to write down what, where to locate it on the paper. Which
page, what size, which color ink.&lt;/p&gt;
&lt;p&gt;Therefore, in 2017, after a long hiatus, I started using a physical planner
again to keep track of projects and actionable items. While looking for a 2018
planner I came across one from &lt;a class="reference external" href="https://www.mossery.co/collections/2018-planner"&gt;Mossery&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt;, a company I hadn't heard of before.
They allow you to customize your planner somewhat, regarding the look as well as
the contents.&lt;/p&gt;
&lt;p&gt;The planner itself consists of a year section, a monthly overview as well as
detailed weekly pages. It has space for recaps, overviews, and highlights of
past periods. It's ideal to tick off list items on a daily and weekly base, and
naturally nudges you to review each week, each month, and even the year.&lt;/p&gt;
&lt;p&gt;&lt;img alt="planner_monthly" src="/images/planner_monthly.png" /&gt;&lt;/p&gt;
&lt;p&gt;The less time I spend looking at screens, the more I can focus on the vision, on
more ambitious goals. Where before I tried to automate and tweak as much as
possible using applications - the &lt;strong&gt;tooling&lt;/strong&gt;, I'm now focused on the content,
the &lt;strong&gt;vision&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Mossery is a small company from Kuala Lumpur, Malaysia, and I had the pleasure
to meet some of their wonderful team in person for an explanation behind their
planner. They're a passionate bunch, and it shows - their planner is chock-full
of small details, like a list of personal heroes and inspirational quotes.&lt;/p&gt;
&lt;p&gt;Their 2018 planner inspires me to set my future goals even higher - by using old and
proven technologies: pen and paper (planner).&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.trgtd.com.au/"&gt;https://www.trgtd.com.au/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://orgmode.org/"&gt;http://orgmode.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id6"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.mossery.co/collections/2018-planner"&gt;https://www.mossery.co/collections/2018-planner&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><category term="tools"></category><category term="emacs"></category></entry><entry><title>Diff binary files like docx, odt and pdf with git</title><link href="https://www.onwebsecurity.com/configuration/diff-binary-files-docx-odt-pdf-with-git.html" rel="alternate"></link><published>2017-11-19T10:00:00+00:00</published><updated>2017-11-19T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-11-19:/configuration/diff-binary-files-docx-odt-pdf-with-git.html</id><summary type="html">&lt;p&gt;&lt;img alt="conversion_tools" src="/images/conversion_tools.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Working with binary file types like the Microsoft Word XML Format Document
&lt;code class="code"&gt;
docx&lt;/code&gt;
, the OpenDocument Text &lt;code class="code"&gt;
odt&lt;/code&gt;
 format and the Portable Document
Format &lt;code class="code"&gt;
pdf&lt;/code&gt;
 in combination with git has its difficulties. Out of the box,
git only provides diffing for plain text formats. Comparing binary files in
textual format is not supported.&lt;/p&gt;
&lt;p&gt;With a simple configuration change and some open source, cross-platform tools,
git can be adapted to diff those formats as well.&lt;/p&gt;
&lt;div class="section" id="installing-the-tools"&gt;
&lt;h2&gt;Installing the tools&lt;/h2&gt;
&lt;p&gt;First, one needs the tools which can convert the binary files to plain text
formats. For most formats like &lt;code class="code"&gt;
docx&lt;/code&gt;
 and &lt;code class="code"&gt;
odt&lt;/code&gt;
, the open source
tool &lt;a class="reference external" href="https://pandoc.org/"&gt;Pandoc&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; will do the trick. It can even export those files to Markdown
format, or (my personal choice) &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;. A markup language like
reStructuredText makes it possible to make a detailed comparison between
structured documents, for instance when the heading level changed.&lt;/p&gt;
&lt;p&gt;For PDF, there's the open source tool &lt;code class="code"&gt;
pdftotext&lt;/code&gt;
, which is part of the
&lt;a class="reference external" href="https://poppler.freedesktop.org/"&gt;Poppler&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; utils package and available for (almost) all operating systems. This can
convert a PDF file to plain text.&lt;/p&gt;
&lt;p&gt;There's a tiny catch with &lt;code class="code"&gt;
pdftotext&lt;/code&gt;
, as it has issues using stdout as
output, instead of writing to files. This is …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="conversion_tools" src="/images/conversion_tools.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Working with binary file types like the Microsoft Word XML Format Document
&lt;code class="code"&gt;
docx&lt;/code&gt;
, the OpenDocument Text &lt;code class="code"&gt;
odt&lt;/code&gt;
 format and the Portable Document
Format &lt;code class="code"&gt;
pdf&lt;/code&gt;
 in combination with git has its difficulties. Out of the box,
git only provides diffing for plain text formats. Comparing binary files in
textual format is not supported.&lt;/p&gt;
&lt;p&gt;With a simple configuration change and some open source, cross-platform tools,
git can be adapted to diff those formats as well.&lt;/p&gt;
&lt;div class="section" id="installing-the-tools"&gt;
&lt;h2&gt;Installing the tools&lt;/h2&gt;
&lt;p&gt;First, one needs the tools which can convert the binary files to plain text
formats. For most formats like &lt;code class="code"&gt;
docx&lt;/code&gt;
 and &lt;code class="code"&gt;
odt&lt;/code&gt;
, the open source
tool &lt;a class="reference external" href="https://pandoc.org/"&gt;Pandoc&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt; will do the trick. It can even export those files to Markdown
format, or (my personal choice) &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;. A markup language like
reStructuredText makes it possible to make a detailed comparison between
structured documents, for instance when the heading level changed.&lt;/p&gt;
&lt;p&gt;For PDF, there's the open source tool &lt;code class="code"&gt;
pdftotext&lt;/code&gt;
, which is part of the
&lt;a class="reference external" href="https://poppler.freedesktop.org/"&gt;Poppler&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; utils package and available for (almost) all operating systems. This can
convert a PDF file to plain text.&lt;/p&gt;
&lt;p&gt;There's a tiny catch with &lt;code class="code"&gt;
pdftotext&lt;/code&gt;
, as it has issues using stdout as
output, instead of writing to files. This is necessary, as git will expect the
output on stdout.&lt;/p&gt;
&lt;p&gt;This can be fixed by creating a tiny wrapper named &lt;code class="code"&gt;
pdftostdout&lt;/code&gt;
 around
&lt;code class="code"&gt;
pdftotext&lt;/code&gt;
, which will execute the program with the correct parameters. A
dash as &lt;strong&gt;last&lt;/strong&gt; parameter will instruct &lt;code class="code"&gt;
pdftotext&lt;/code&gt;
 to use stdout:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;echo &amp;quot;pdftotext $1 -&amp;quot; &amp;gt; /usr/bin/pdftostdout&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Of course this wrapper can be stored anywhere, as long as it can be executed and
found by git.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="add-new-text-conversion-handlers-to-git"&gt;
&lt;h2&gt;Add new text conversion handlers to git&lt;/h2&gt;
&lt;p&gt;After installing both programs and the wrapper, next git needs to be instructed
how to convert the binary file types to text format. This can be accomplished by
modifying the global git configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --global diff.docx.textconv pandoc --to=rst&lt;/span&gt;
&lt;span class="go"&gt;git config --global diff.odt.textconv pandoc --to=rst&lt;/span&gt;
&lt;span class="go"&gt;git config --global diff.pdf.textconv pdftostdout&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This creates new diff handlers for each of the file types.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;Using the parameter &lt;code class="code"&gt;
--to=rst&lt;/code&gt;
 specifies pandoc to use the
reStructuredText format. This makes comparing hierarchies easier than just
using the plain text format.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="instruct-git-to-apply-the-correct-handlers-per-file-type"&gt;
&lt;h2&gt;Instruct git to apply the correct handlers per file type&lt;/h2&gt;
&lt;p&gt;Finally, git needs to know which conversion handler to use for which file type.
That can be accomplished by modifying the global &lt;a class="reference external" href="https://git-scm.com/docs/gitattributes"&gt;gitattributes&lt;/a&gt; &lt;a class="footnote-reference" href="#id7" id="id8"&gt;[4]&lt;/a&gt; file.&lt;/p&gt;
&lt;p&gt;The gitattributes file defines attributes per path, or per file. That means that
you can specify handlers per file _type_, which will automatically convert the
binary format to text format, using the correct tool.&lt;/p&gt;
&lt;p&gt;The gitattributes file can be specified locally (per git repository), per
system, or globally. Globally is usually the preferred choice, as this means
configure once per user, and use everywhere, with each repository. The global
gitattributes file can be found under &lt;code class="code"&gt;
$HOME/.config/git/attributes&lt;/code&gt;
.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;As the global and system git attributes files have the lowest precedence,
they can easily be overridden on a local base. This can be done by creating a
&lt;code class="code"&gt;
.gitattributes&lt;/code&gt;
 file in the root of a repository.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The following code-snippet adds the correct conversion handlers per file type to
the global git configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;echo &amp;quot;*.docx diff=docx&amp;quot; &amp;gt;&amp;gt; ~/.config/git/attributes&lt;/span&gt;
&lt;span class="go"&gt;echo &amp;quot;*.odt diff=odt&amp;quot; &amp;gt;&amp;gt; ~/.config/git/attributes&lt;/span&gt;
&lt;span class="go"&gt;echo &amp;quot;*.pdf diff=pdf&amp;quot; &amp;gt;&amp;gt; ~/.config/git/attributes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And that's all there is to it. Now &lt;code class="code"&gt;
git diff&lt;/code&gt;
 will show all changes &lt;strong&gt;in
plain text format&lt;/strong&gt; for the binary file types &lt;code class="code"&gt;
docx&lt;/code&gt;
, &lt;code class="code"&gt;
odt&lt;/code&gt;
 and
&lt;code class="code"&gt;
pdf&lt;/code&gt;
.&lt;/p&gt;
&lt;p&gt;Any binary format can be diffed with git, as long as there's a tool which
converts the binary format to plain text. One just needs to add the conversion
handlers and attributes in the same way.&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://pandoc.org/"&gt;https://pandoc.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;http://docutils.sourceforge.net/rst.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id6"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://poppler.freedesktop.org/"&gt;https://poppler.freedesktop.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id7" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id8"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://git-scm.com/docs/gitattributes"&gt;https://git-scm.com/docs/gitattributes&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="git"></category><category term="rst"></category></entry><entry><title>Structure research, talks and trainings using mindmaps, reStructuredText and Emacs Org mode</title><link href="https://www.onwebsecurity.com/opinion/structure-research-talks-and-trainings-using-mindmaps-restructuredtext-and-emacs-org-mode.html" rel="alternate"></link><published>2017-10-18T11:15:00+00:00</published><updated>2017-10-18T11:15:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-10-18:/opinion/structure-research-talks-and-trainings-using-mindmaps-restructuredtext-and-emacs-org-mode.html</id><summary type="html">&lt;p class="first last"&gt;&lt;img alt="flyinghigh" src="/images/flyinghigh.jpg" /&gt; Researching new vulnerabilities, techniques or concepts can be
time-consuming and sometimes chaotic. A streamlined workflow is
necessary to make the process as efficient as possible. This article
describes the open source tools and well-known standards that I'm
currently using for that purpose.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img alt="flyinghigh" src="/images/flyinghigh.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;It's sometimes difficult to know where to start, or how to begin when preparing
talks and trainings, or researching vulnerabilities. This article describes my
current workflow and set of tools that help me in that process. From up above
the clouds down to the details.&lt;/p&gt;
&lt;div class="section" id="finding-the-flow"&gt;
&lt;h2&gt;Finding the flow&lt;/h2&gt;
&lt;p&gt;Mindmaps are great to work with when an idea hasn't fully matured yet: There's a
bigger picture, but not yet a structure, a flow. The visual aspect of mindmaps
helps with finding patterns, and usually a pattern arises while the mindmap
matures (emergent design). It also allows you to quickly reshuffle blobs of
text, moving everything around.&lt;/p&gt;
&lt;p&gt;For mindmapping I use the open source, cross-platform tool, &lt;a class="reference external" href="https://www.freeplane.org/wiki/index.php/Home"&gt;Freeplane&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;. It
stores mindmaps in the open &lt;a class="reference external" href="http://freemind.sourceforge.net/wiki/index.php/File_format"&gt;freemind file format&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;, an XML format (yes, that's
&lt;em&gt;Freemind&lt;/em&gt;, which was forked into Freeplane).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="organization-or-presentation"&gt;
&lt;h2&gt;Organization or presentation&lt;/h2&gt;
&lt;p&gt;When a structure emerges, I use either &lt;a class="reference external" href="http://orgmode.org/"&gt;Org mode&lt;/a&gt; &lt;a class="footnote-reference" href="#id5" id="id6"&gt;[3]&lt;/a&gt; or &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; &lt;a class="footnote-reference" href="#id7" id="id8"&gt;[4]&lt;/a&gt; to
write down the notes in a more detailed format. Why two different formats ?&lt;/p&gt;
&lt;p&gt;Both use the underlying plain-text format, and are well suited to keep notes in.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Org mode is excellent for maintaining TODO lists and planning projects. Its
format allows you to add various data properties, like tags, custom attributes
and even can be used for time registration. It's excellent for &lt;strong&gt;organizing&lt;/strong&gt;
data.&lt;/li&gt;
&lt;li&gt;reStructuredText is excellent for presentation purposes. It allows seamless
exporting to numerous file formats like HTML, PDF or ePub. It gives you a lot
of flexibility with regards to &lt;strong&gt;presentation&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example when preparing presentations I choose reStructuredText, and when
doing research I use the Org mode format. For trainings I use reStructuredText
to prepare handouts, but I use Org mode for my own trainer's notes.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="backward-design"&gt;
&lt;h2&gt;Backward design&lt;/h2&gt;
&lt;p&gt;When a pattern has emerged, I use backward design to structure trainings:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;Identify the desired results, the objectives&lt;/li&gt;
&lt;li&gt;Determine how those results can be measured, for example with assessments or
challenges.&lt;/li&gt;
&lt;li&gt;Plan the training and develop the instructions.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This is also the same way that I write articles or blog posts for example: First
write the summary, the objective, and then the actual contents. It's like with
test-driven development: The requirements first, then the tests, then the actual
code.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="plan-for-the-future"&gt;
&lt;h2&gt;Plan for the future&lt;/h2&gt;
&lt;p&gt;Regardless the tools, I use open file formats. This allows me and others to
easily collaborate, to re-use previous work, and of course it provides freedom.
Anyone can use any tool, as long as it supports those file formats.&lt;/p&gt;
&lt;p&gt;Preferably everything should to be stored in open file formats, which allows
re-use of existing materials.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Both Org mode as reStructuredText use the plain-text file format.&lt;/li&gt;
&lt;li&gt;When using references to articles, papers or websites I store them in an
external file as &lt;a class="reference external" href="http://www.bibtex.org/Format/"&gt;bibtex&lt;/a&gt; &lt;a class="footnote-reference" href="#id9" id="id10"&gt;[5]&lt;/a&gt;, a plain-text file format.
Bibtex files can be used by a wide range of programs. Both Pelican and Sphinx
use reStructuredText, and both allow referencing bibtex files (the reference
&lt;a href='#TheArtofUNIXProgramming2003-09-22' id='ref-TheArtofUNIXProgramming2003-09-22-1'&gt;(Raymond, 2003)&lt;/a&gt; for instance is generated from a bibtex
file). Org mode also allows including external bibtex files.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As the Unix philosophy states &lt;a href='#TheArtofUNIXProgramming2003-09-22' id='ref-TheArtofUNIXProgramming2003-09-22-2'&gt;(Raymond, 2003)&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
Write programs that do one thing and do it well. Write programs to work
together. Write programs to handle text streams, because that is a universal
interface.&lt;/blockquote&gt;
&lt;p&gt;Therefore either Org mode for organization, or reStructuredText for
presentation.&lt;/p&gt;
&lt;p&gt;Of course, as they both use the plain-text format, it's easy to convert between
the two in a later stage....&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://www.freeplane.org/wiki/index.php/Home"&gt;https://www.freeplane.org/wiki/index.php/Home&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://freemind.sourceforge.net/wiki/index.php/File_format"&gt;http://freemind.sourceforge.net/wiki/index.php/File_format&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id6"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://orgmode.org/"&gt;http://orgmode.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id7" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id8"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;http://docutils.sourceforge.net/rst.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id9" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id10"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://www.bibtex.org/Format/"&gt;http://www.bibtex.org/Format/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;Bibliography&lt;/h2&gt;
&lt;p id='TheArtofUNIXProgramming2003-09-22'&gt;Eric&amp;nbsp;S. Raymond.
&lt;em&gt;The Art of UNIX Programming&lt;/em&gt;.
Addison-Wesley Professional, sep 2003. &lt;a class="cite-backref" href="#ref-TheArtofUNIXProgramming2003-09-22-1" title="Jump back to reference 1"&gt;↩&lt;/a&gt;&lt;a class="cite-backref" href="#ref-TheArtofUNIXProgramming2003-09-22-1" title="Jump back to reference 1"&gt; &lt;sup&gt;1&lt;/sup&gt; &lt;/a&gt;&lt;a class="cite-backref" href="#ref-TheArtofUNIXProgramming2003-09-22-2" title="Jump back to reference 2"&gt;&lt;sup&gt;2&lt;/sup&gt; &lt;/a&gt;&lt;/p&gt;
</content><category term="emacs"></category><category term="rst"></category><category term="training"></category><category term="workshop"></category></entry><entry><title>Properly encoding and escaping for the web</title><link href="https://www.onwebsecurity.com/security/properly-encoding-and-escaping-for-the-web.html" rel="alternate"></link><published>2017-09-13T10:15:00+00:00</published><updated>2017-09-26T11:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-09-13:/security/properly-encoding-and-escaping-for-the-web.html</id><summary type="html">&lt;p&gt;&lt;img alt="encoding" src="/images/encoding-and-escaping.png" /&gt;&lt;/p&gt;
&lt;p&gt;When processing untrusted user input for (web) applications, filter the input,
and encode the output. That is the most widely given advice in order to prevent
(server-side) injections. Yet it can be deceivingly difficult to properly encode
(user) input. Encoding is dependent on the type of output - which means that for
example a string, which will be used in a JavaScript variable, should be treated
(encoded) differently than a string which will be used in plain HTML.&lt;/p&gt;
&lt;p&gt;When outputting untrusted user input, one should encode or escape, based on the
&lt;em&gt;context&lt;/em&gt;, the location of the output.&lt;/p&gt;
&lt;p&gt;And what's the difference between escaping and encoding ?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Encoding&lt;/strong&gt; is transforming data from one format into another format.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Escaping&lt;/strong&gt; is a &lt;em&gt;subset&lt;/em&gt; of encoding, where not all characters need to be
encoded. Only &lt;em&gt;some&lt;/em&gt; characters are encoded (by using an escape character).&lt;/p&gt;
&lt;p&gt;There are quite a number of encoding mechanisms, which make this more difficult
than it might look at first glance.&lt;/p&gt;
&lt;div class="section" id="url-encoding"&gt;
&lt;h2&gt;URL encoding&lt;/h2&gt;
&lt;p&gt;URL encoding is a method to encode information in a Uniform Resource Identifier.
There's a set of &lt;em&gt;reserved&lt;/em&gt; characters, which have special meaning, and
&lt;em&gt;unreserved&lt;/em&gt;, or safe characters, which are safe to use. If a character is
reserved, then the …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="encoding" src="/images/encoding-and-escaping.png" /&gt;&lt;/p&gt;
&lt;p&gt;When processing untrusted user input for (web) applications, filter the input,
and encode the output. That is the most widely given advice in order to prevent
(server-side) injections. Yet it can be deceivingly difficult to properly encode
(user) input. Encoding is dependent on the type of output - which means that for
example a string, which will be used in a JavaScript variable, should be treated
(encoded) differently than a string which will be used in plain HTML.&lt;/p&gt;
&lt;p&gt;When outputting untrusted user input, one should encode or escape, based on the
&lt;em&gt;context&lt;/em&gt;, the location of the output.&lt;/p&gt;
&lt;p&gt;And what's the difference between escaping and encoding ?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Encoding&lt;/strong&gt; is transforming data from one format into another format.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Escaping&lt;/strong&gt; is a &lt;em&gt;subset&lt;/em&gt; of encoding, where not all characters need to be
encoded. Only &lt;em&gt;some&lt;/em&gt; characters are encoded (by using an escape character).&lt;/p&gt;
&lt;p&gt;There are quite a number of encoding mechanisms, which make this more difficult
than it might look at first glance.&lt;/p&gt;
&lt;div class="section" id="url-encoding"&gt;
&lt;h2&gt;URL encoding&lt;/h2&gt;
&lt;p&gt;URL encoding is a method to encode information in a Uniform Resource Identifier.
There's a set of &lt;em&gt;reserved&lt;/em&gt; characters, which have special meaning, and
&lt;em&gt;unreserved&lt;/em&gt;, or safe characters, which are safe to use. If a character is
reserved, then the character is encoded using the percent '%' sign, followed by
its hexadecimal digits. That's why URL encoding is sometimes referred to as
&lt;strong&gt;percent encoding&lt;/strong&gt;.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;A Uniform Resource Identifier (URI) identifies an abstract or physical
resource. The URI set includes a Uniform Resource Locator (URL), as well as a
Uniform Resource Name (URN). A URL includes the 'access mechanism', the
scheme. Example of a URN is &lt;cite&gt;extract.pw&lt;/cite&gt;, and a URL is &lt;cite&gt;https://extract.pw&lt;/cite&gt;.
Both are URI's, as all URL and URN are. &lt;cite&gt;tel:+61-123-123&lt;/cite&gt; is a URI, but not a
URL.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;em&gt;current set&lt;/em&gt; of reserved characters for a URI are &lt;code class="code"&gt;
! * ' ( ) ; : &amp;#64; &amp;amp;
= + $ , / ? # [ ]&lt;/code&gt;
. See &lt;a class="reference external" href="http://tools.ietf.org/html/rfc3986.html"&gt;RFC 3986&lt;/a&gt; section 2.2. Note however that the
reserved and safe character sets change over time.&lt;/p&gt;
&lt;p&gt;An example of URL encoding:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class="code literal-block"&gt;
&amp;amp;   -------&amp;gt;   %26
'   -------&amp;gt;   %27
/   -------&amp;gt;   %2F
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;The following is an example of URL encoding using Python, where only reserved
characters are encoded:&lt;/p&gt;
&lt;pre class="code shell literal-block"&gt;
% python -c &lt;span class="s2"&gt;&amp;quot;import urllib;print(urllib.quote_plus('ape&amp;amp;nutz/better '));&amp;quot;&lt;/span&gt;

ape%26nutz%2Fbetter+&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;The following is an example of URL encoding, where all characters except the
access mechanism (protocol) are encoded. This can be used by adversaries to
obfuscate valid addresses, while it's still a valid address.&lt;/p&gt;
&lt;blockquote&gt;
&lt;a class="reference external" href="https://%65%78%74%72%61%63%74%2e%70%77"&gt;https://%65%78%74%72%61%63%74%2e%70%77&lt;/a&gt;&lt;/blockquote&gt;
&lt;p&gt;Modern browsers will show you the decoded URL when hovering over these kinds of
obfuscated links.&lt;/p&gt;
&lt;p&gt;Usually, when people refer to URI encoding, they signify only encoding reserved,
non-safe characters. But again, the above example is still valid.&lt;/p&gt;
&lt;div class="section" id="unicode-encoding"&gt;
&lt;h3&gt;Unicode encoding&lt;/h3&gt;
&lt;p&gt;Unicode is a standard for encoding, representing and handling characters in most
(if not all) languages. Best known is the UTF-8 character encoding standard,
which is a variable length encoding (1, 2, 3 or 4 units of 8 bits, hence the
name UTF-8). It's very similar to ASCII, as in: the first 128 characters of
Unicode are ASCII. That makes it a compact encoding. Other well known Unicode
encodings are UTF-16, and Latin-1 (ISO 8859-1). Unicode characters are
represented by &lt;em&gt;code points&lt;/em&gt;. A character can therefore exist of one or more
8-bit units. Glyphs are representations of characters on the screen.&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
U+2206 ∆ (Increment)
&lt;/pre&gt;
&lt;p&gt;The code point is U+2206, it's called the &lt;strong&gt;Increment&lt;/strong&gt; character and it is
represented by the glyph ∆ on the screen.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;Sometimes vulnerabilities can lurk in the part where Unicode characters are
&lt;em&gt;decoded&lt;/em&gt;, for example by using different word-size encodings, or by using
illegal Unicode encodings. Unicode decoding vulnerabilities warrant their own
article.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="html-encoding"&gt;
&lt;h3&gt;HTML encoding&lt;/h3&gt;
&lt;p&gt;Also known as HTML entity encoding. The &lt;code class="code"&gt;
&amp;amp; &amp;lt; &amp;gt; &amp;quot; ' /&lt;/code&gt;
 characters should
always be HTML entity encoded before outputting it into content. This is used
for example in HTML attributes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class="code literal-block"&gt;
&amp;amp;   -------&amp;gt;   &amp;amp;amp;
'   -------&amp;gt;   &amp;amp;x27;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;When outputting untrusted user input in HTML, make sure to properly HTML encode
the following characters:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class="code literal-block"&gt;
&amp;amp;   -------&amp;gt;   &amp;amp;amp;
&amp;lt;   -------&amp;gt;   &amp;amp;lt;
&amp;gt;   -------&amp;gt;   &amp;amp;gt;
&amp;quot;   -------&amp;gt;   &amp;amp;quot;
'   -------&amp;gt;   &amp;amp;#x27;
/   -------&amp;gt;   &amp;amp;#x2F;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Why ? Because these characters can &amp;quot;break out of the context&amp;quot;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="javascript-encoding"&gt;
&lt;h3&gt;JavaScript encoding&lt;/h3&gt;
&lt;p&gt;In general, &lt;strong&gt;encode&lt;/strong&gt; all non alphanumeric characters instead of using escape
characters. This prevents double encoding / decoding issues, in combination with
HTML encoding.&lt;/p&gt;
&lt;p&gt;JavaScript encoding is done by prepending the value with &lt;code class="code"&gt;
 \x&lt;/code&gt;
 followed by
its hexadecimal digits.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class="code literal-block"&gt;
&amp;amp;   -------&amp;gt;   \x26
&amp;quot;   -------&amp;gt;   \x22
'   -------&amp;gt;   \x27
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Proper encoding or escaping, based on the context, is really difficult, and
easier to get wrong than right. Make sure you know when to use which format.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><category term="pentesting"></category><category term="training"></category></entry><entry><title>Hacker Summer Camp: BSides Las Vegas and DEF CON 2017 review</title><link href="https://www.onwebsecurity.com/opinion/hackersummercamp-bsides-las-vegas-and-def-con-2017-review.html" rel="alternate"></link><published>2017-08-10T22:57:00+00:00</published><updated>2017-08-10T22:57:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-08-10:/opinion/hackersummercamp-bsides-las-vegas-and-def-con-2017-review.html</id><summary type="html">&lt;p&gt;&lt;img alt="BSides Las Vegas 2017" src="/images/bsideslv2017.png" /&gt;&lt;/p&gt;
&lt;p&gt;The 2017 edition of Hacker Summer Camp is over... Blackhat, BSides and DEF CON:
Arguably the best security conferences in the world, being held during a week in
Las Vegas.
And wow, what an amazing edition it was this time.&lt;/p&gt;
&lt;p&gt;I tried to learn, network, enjoy and &lt;em&gt;soak up&lt;/em&gt; as much as possible - which
unfortunately means not seeing each and every talk, and (probably) missing out
on amazing content. That's why I'm so glad that recordings and slidedecks are
being released by BSides and DEF CON, so that you can see where you should have
been - &lt;strong&gt;after the fact&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The biggest draw for me personally to BSides and DEF CON is that you can immerse
yourself in fields and interests that are outside of your daily work or routine.
Car hacking, lockpicking, the Internet of Things, this year even voting
machines: It's all there. You can learn from and play with everything.&lt;/p&gt;
&lt;p&gt;As with playing Capture the Flag, it's a great way to &lt;em&gt;touch a lot of surfaces&lt;/em&gt;
in a short amount of time.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://youtu.be/ehfrQsmrl7M?t=6862"&gt;Josh Corman's BSides Las Vegas keynote&lt;/a&gt; was amazing - each time I hear him
speak, he manages to get everybody even more enthusiastically about cooperation,
about personal …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="BSides Las Vegas 2017" src="/images/bsideslv2017.png" /&gt;&lt;/p&gt;
&lt;p&gt;The 2017 edition of Hacker Summer Camp is over... Blackhat, BSides and DEF CON:
Arguably the best security conferences in the world, being held during a week in
Las Vegas.
And wow, what an amazing edition it was this time.&lt;/p&gt;
&lt;p&gt;I tried to learn, network, enjoy and &lt;em&gt;soak up&lt;/em&gt; as much as possible - which
unfortunately means not seeing each and every talk, and (probably) missing out
on amazing content. That's why I'm so glad that recordings and slidedecks are
being released by BSides and DEF CON, so that you can see where you should have
been - &lt;strong&gt;after the fact&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The biggest draw for me personally to BSides and DEF CON is that you can immerse
yourself in fields and interests that are outside of your daily work or routine.
Car hacking, lockpicking, the Internet of Things, this year even voting
machines: It's all there. You can learn from and play with everything.&lt;/p&gt;
&lt;p&gt;As with playing Capture the Flag, it's a great way to &lt;em&gt;touch a lot of surfaces&lt;/em&gt;
in a short amount of time.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://youtu.be/ehfrQsmrl7M?t=6862"&gt;Josh Corman's BSides Las Vegas keynote&lt;/a&gt; was amazing - each time I hear him
speak, he manages to get everybody even more enthusiastically about cooperation,
about personal involvement and about how 'we' can make a change. About how we,
security people, should do better. &lt;em&gt;We've got to do better&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The best talk I attended at DEF CON was a talk from Deviant Ollam, &amp;quot;Slides And
Jokes And Stage Fright OH MY: How To Prepare A Talk&amp;quot;. More often than not, it's
not the content that matters, but the presentation. People can talk about the
most interesting subject - if the presentation is bad, it's just a bad
presentation. If the presentation is great, then the subject can be literally
anything. And this presentation matched everything.&lt;/p&gt;
&lt;p&gt;A big thank you from the bottom of my heart to all volunteers, organizers and
speakers who make BSides Las Vegas and DEF CON possible.&lt;/p&gt;
&lt;p&gt;On September 1st 2017, the first edition of &lt;a class="reference external" href="https://www.bsidesams.nl/"&gt;BSides Amsterdam&lt;/a&gt; will be held in
The Netherlands: The latest addition to the BSides family.  See you there ?&lt;/p&gt;
</content><category term="conference"></category></entry><entry><title>Generate list of used content tags for Pelican</title><link href="https://www.onwebsecurity.com/configuration/generate-list-of-content-tags-for-pelican.html" rel="alternate"></link><published>2017-07-09T20:25:00+00:00</published><updated>2017-07-09T20:25:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-07-09:/configuration/generate-list-of-content-tags-for-pelican.html</id><summary type="html">&lt;p&gt;If your Pelican-generated site uses lots of different tags for articles, it can
be difficult to remember or use tag names consistently. Therefore I needed a
quick method to print (comma separated) unique tags that were stored in text
files.&lt;/p&gt;
&lt;p&gt;This shell one-liner from within the &lt;em&gt;content&lt;/em&gt; directory will sort and show all
tags from reStructuredText (&lt;code class="code"&gt;
*.rst&lt;/code&gt;
) files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;grep -h &amp;#39;^:tags:&amp;#39; *.rst | sed -e &amp;#39;s/^:tags:\s*//;s/\s*,\s*/\n/g&amp;#39; | sort -u&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;First &lt;code class="code"&gt;
grep&lt;/code&gt;
 will filter on the &lt;code class="code"&gt;
:tags:&lt;/code&gt;
 property and will only
print out the matching line (without filename, thanks to the &lt;strong&gt;-h&lt;/strong&gt; flag).&lt;/p&gt;
&lt;p&gt;Then &lt;code class="code"&gt;
sed&lt;/code&gt;
 will remove the &lt;code class="code"&gt;
:tags:&lt;/code&gt;
 keyword (and trailing spaces),
and all tags will be split using newline characters.&lt;/p&gt;
&lt;p&gt;Finally, &lt;code class="code"&gt;
sort&lt;/code&gt;
 takes care of sorting and only printing unique entries.&lt;/p&gt;
&lt;p&gt;Analogous, one can do the same for categories:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;grep -h &amp;#39;^:category:&amp;#39; *.rst | sed -e &amp;#39;s/^:category:\s*//&amp;#39; | sort -u&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As Pelican only allows one category, this is somewhat simpler.&lt;/p&gt;
&lt;p&gt;For maximum readability, &lt;code class="code"&gt;
tr&lt;/code&gt;
 can convert the newlines into spaces, so
that the output is one big line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;grep -h &amp;#39;^:tags:&amp;#39; *.rst | sed -e &amp;#39;s/^:tags:\s*//;s/\s*,\s*/\n/g&amp;#39; | sort -u | tr &amp;#39;\n&amp;#39; &amp;#39; &amp;#39;; echo&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The last echo is meant to end …&lt;/p&gt;</summary><content type="html">&lt;p&gt;If your Pelican-generated site uses lots of different tags for articles, it can
be difficult to remember or use tag names consistently. Therefore I needed a
quick method to print (comma separated) unique tags that were stored in text
files.&lt;/p&gt;
&lt;p&gt;This shell one-liner from within the &lt;em&gt;content&lt;/em&gt; directory will sort and show all
tags from reStructuredText (&lt;code class="code"&gt;
*.rst&lt;/code&gt;
) files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;grep -h &amp;#39;^:tags:&amp;#39; *.rst | sed -e &amp;#39;s/^:tags:\s*//;s/\s*,\s*/\n/g&amp;#39; | sort -u&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;First &lt;code class="code"&gt;
grep&lt;/code&gt;
 will filter on the &lt;code class="code"&gt;
:tags:&lt;/code&gt;
 property and will only
print out the matching line (without filename, thanks to the &lt;strong&gt;-h&lt;/strong&gt; flag).&lt;/p&gt;
&lt;p&gt;Then &lt;code class="code"&gt;
sed&lt;/code&gt;
 will remove the &lt;code class="code"&gt;
:tags:&lt;/code&gt;
 keyword (and trailing spaces),
and all tags will be split using newline characters.&lt;/p&gt;
&lt;p&gt;Finally, &lt;code class="code"&gt;
sort&lt;/code&gt;
 takes care of sorting and only printing unique entries.&lt;/p&gt;
&lt;p&gt;Analogous, one can do the same for categories:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;grep -h &amp;#39;^:category:&amp;#39; *.rst | sed -e &amp;#39;s/^:category:\s*//&amp;#39; | sort -u&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As Pelican only allows one category, this is somewhat simpler.&lt;/p&gt;
&lt;p&gt;For maximum readability, &lt;code class="code"&gt;
tr&lt;/code&gt;
 can convert the newlines into spaces, so
that the output is one big line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;grep -h &amp;#39;^:tags:&amp;#39; *.rst | sed -e &amp;#39;s/^:tags:\s*//;s/\s*,\s*/\n/g&amp;#39; | sort -u | tr &amp;#39;\n&amp;#39; &amp;#39; &amp;#39;; echo&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The last echo is meant to end the line correctly, or else it would be a partial
line. Shells like &lt;code class="code"&gt;
zsh&lt;/code&gt;
 can automatically detect (and show) whether a line
is correctly terminated, but it's nicer to make sure that the output is
correctly formatted.&lt;/p&gt;
&lt;p&gt;One-liners to rule 'em all...&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;The &lt;code class="code"&gt;
 \s&lt;/code&gt;
 character set is a sed GNU extension, so it'll only work on
GNU sed. When using non-GNU compatible sed, you can replace &lt;code class="code"&gt;
 \s&lt;/code&gt;
 with
&lt;code class="code"&gt;
[[:space::]&lt;/code&gt;
, which is the same whitespace character set.&lt;/p&gt;
&lt;/div&gt;
</content><category term="pelican"></category><category term="rst"></category></entry><entry><title>Convert WordPress to static site generator Pelican</title><link href="https://www.onwebsecurity.com/configuration/convert-wordpress-to-static-site-generator-pelican.html" rel="alternate"></link><published>2017-06-27T00:00:00+00:00</published><updated>2017-06-27T00:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-06-27:/configuration/convert-wordpress-to-static-site-generator-pelican.html</id><summary type="html">&lt;p&gt;&lt;img alt="Pelican" src="/images/pelican.png" /&gt;&lt;/p&gt;
&lt;p&gt;After a number of years using WordPress as blogging software, I converted the
site to a static site generator: Pelican.&lt;/p&gt;
&lt;p&gt;Pelican converts reStructuredText into static HTML. No more PHP, no more
databases, but straight static HTML.&lt;/p&gt;
&lt;p&gt;The process of converting the site was relatively painless. The conversion tool
did a great job of converting an XML export of WordPress into reStructuredText
pages.&lt;/p&gt;
&lt;p&gt;What needed (and still needs) some manual care were/are the code blocks (the
biggest reason of the move from WordPress to Pelican) in articles, and the
escaping of variables. WordPress gets pretty complex once you're trying to use
it for code snippets and console outputs. The reStructuredText is much more
flexible and allows you to edit the site using any text editor. There are tools
to do that with WordPress and its API, but it always felt like a difficult
workaround.&lt;/p&gt;
&lt;p&gt;I thought about keeping the URLs as-is: Over the years the number of
visitors of the site has steadily risen, as has the level of indexing by search
engines. You don't want dead links - but on the other hand, a transition to
another content management system would be &lt;strong&gt;the&lt;/strong&gt; perfect moment to 'clean up'
the category …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Pelican" src="/images/pelican.png" /&gt;&lt;/p&gt;
&lt;p&gt;After a number of years using WordPress as blogging software, I converted the
site to a static site generator: Pelican.&lt;/p&gt;
&lt;p&gt;Pelican converts reStructuredText into static HTML. No more PHP, no more
databases, but straight static HTML.&lt;/p&gt;
&lt;p&gt;The process of converting the site was relatively painless. The conversion tool
did a great job of converting an XML export of WordPress into reStructuredText
pages.&lt;/p&gt;
&lt;p&gt;What needed (and still needs) some manual care were/are the code blocks (the
biggest reason of the move from WordPress to Pelican) in articles, and the
escaping of variables. WordPress gets pretty complex once you're trying to use
it for code snippets and console outputs. The reStructuredText is much more
flexible and allows you to edit the site using any text editor. There are tools
to do that with WordPress and its API, but it always felt like a difficult
workaround.&lt;/p&gt;
&lt;p&gt;I thought about keeping the URLs as-is: Over the years the number of
visitors of the site has steadily risen, as has the level of indexing by search
engines. You don't want dead links - but on the other hand, a transition to
another content management system would be &lt;strong&gt;the&lt;/strong&gt; perfect moment to 'clean up'
the category and tag names.&lt;/p&gt;
&lt;p&gt;After having written numerous articles not only the content but also the style
of this site has changed. Therefore I decided to generate a &lt;pre&gt;
.htaccess&lt;/pre&gt;
 file
containing &lt;pre&gt;
HTTP 301&lt;/pre&gt;
 permanent redirects for all WordPress articles. This
allowed me to retain the links others might have to the articles, while
switching to a new structure.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;Not having to use WordPress means a &lt;strong&gt;reduction of the web server
attack surface&lt;/strong&gt;: No database, no dynamic web interface, and not
having to keep (more) server software up-to-date.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="categories-versus-articles"&gt;
&lt;h2&gt;Categories versus articles&lt;/h2&gt;
&lt;p&gt;Pelican works with one category per article, and zero or more tags. That's
different than WordPress, where each article can have one &lt;em&gt;or more&lt;/em&gt; categories.&lt;/p&gt;
&lt;p&gt;Pelican uses the category as &lt;em&gt;type&lt;/em&gt; of article, which meant that each page had
to be 'recategorized'. A pattern emerged while reading back old posts.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Some posts were &lt;em&gt;experiences&lt;/em&gt;, personal &lt;strong&gt;configurations&lt;/strong&gt; or &lt;em&gt;tips&lt;/em&gt;; on the
use of Emacs, msys, git or other tools, operating systems or architectures.&lt;/li&gt;
&lt;li&gt;Some posts were &lt;em&gt;temporary&lt;/em&gt;; &lt;strong&gt;announcements&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Some posts were &lt;strong&gt;opinions&lt;/strong&gt; and &lt;em&gt;personal reviews&lt;/em&gt; of security, conferences
and meetings.&lt;/li&gt;
&lt;li&gt;Most posts were more permanent, specific on &lt;strong&gt;security&lt;/strong&gt;; security assessment
and penetration testing, on how to discover (new) vulnerabilities, or the
specific use of tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That's what I chose for new category names.&lt;/p&gt;
&lt;p&gt;The new workflow is much simpler than the WordPress workflow: Open up Emacs,
write an article in reStructuredText, and one &lt;pre&gt;
make&lt;/pre&gt;
 command later, the
article is converted and uploaded to the server. Pelican also comes with a
development server, that automatically converts new files, for easy
&lt;em&gt;proofviewing&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Amazing open source software, Pelican.&lt;/p&gt;
&lt;/div&gt;
</content><category term="pelican"></category><category term="rst"></category></entry><entry><title>Write once, present anywhere in every format: preparing an interactive secure coding workshop</title><link href="https://www.onwebsecurity.com/opinion/write-once-present-anywhere-in-every-format-preparing-an-interactive-secure-coding-workshop.html" rel="alternate"></link><published>2017-06-06T08:42:00+00:00</published><updated>2017-06-06T08:42:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-06-06:/opinion/write-once-present-anywhere-in-every-format-preparing-an-interactive-secure-coding-workshop.html</id><summary type="html">&lt;p class="first last"&gt;How to use reStructuredText and Sphinx to convert a single source into
multiple formats for security workshops. Generate a dynamic website, a
PDF handout and more, all using the same plain text files.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;It is always very rewarding teaching people the principles behind secure coding,
about the OWASP top 10, and how to test web applications for vulnerabilities.
Workshops are an excellent format to convey that knowledge, as participants can
immediately practice their knowledge which reinforces the theory.&lt;/p&gt;
&lt;p&gt;I recently had a situation, where I could not physically attend the workshop
itself - and, when you're supposed to prepare and &lt;strong&gt;lead&lt;/strong&gt; that workshop, it
presents a challenge. I like challenges!&lt;/p&gt;
&lt;p&gt;Usually I present materials using a slidedeck (either PDF or HTML5
format). As I wanted to deliver all materials to the participants
beforehand I felt that the slidedeck format wasn't the best 'fit' for
this remote workshop. Yes, a slidedeck format works when you're in the
'classroom', presenting, but to actually structure knowledge it is too
rigid. Not each diagram or list of 'best practices' is suited for the
screen-optimized slideshow screen ratio of 4:3.
Therefore I wanted to use a text format which would not only allow me
to export the data to a slidedeck as usual, but also to export it to a
HTML website.&lt;/p&gt;
&lt;p&gt;Most if not all of my documentation is written in plaintext format -
or, to be more precise, the Org mode format. Org mode is amazingly
well-suited to organize and structure text. It can be exported to
almost any format, like HTML, PDF, OpenOffice, Word or Markdown. The
universal open source document converter Pandoc also has support for
Org mode.&lt;/p&gt;
&lt;p&gt;However, it isn't really well suited to build an interactive website
with. I wanted at least to have a good website navigation, search
capabilities, automatically include output of programs, and a format
which allows easy formatting of images.
Initially I wanted to use a wiki (Dokuwiki in particular, as it's
really versatile, and stores all pages as plaintext). But that has the
disadvantage of using a wiki-specific markup language, which makes it
more difficult to export to other formats.
Markdown is too fragmented to use consistently, and lacks a lot of
formatting options.&lt;/p&gt;
&lt;p&gt;Example of Dokuwiki markup to right-align an image in HTML:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="x"&gt;{{ wiki:dokuwiki-128.png}}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Example of Org mode to right-align an image (when exported to HTML):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nv"&gt;+ATTR_HTML:&lt;/span&gt; &lt;span class="nv"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;float:right;&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then I discovered the reStructuredText format. It's plaintext, and also
has Pandoc (and Emacs) support, so it can be converted to 'any other
format'. Not only that, but the open source tool Sphinx (and underlying
docutils) makes it super easy to convert a number of reStructuredText
files into an interactive HTML website. It has built-in interactive
search capabilities, uses a Jinja-based templating system, comes with
out-of-the-box navigation menu's. Sphinx can also convert the same
source into an ePub, or PDF file, a slidedeck, or a number of other
formats.&lt;/p&gt;
&lt;p&gt;Example of reStructuredText to right-align an image in &lt;strong&gt;any&lt;/strong&gt; format:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="ow"&gt;image&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt; _static/sunny.svg

   &lt;span class="nc"&gt;:align:&lt;/span&gt; &lt;span class="nf"&gt;center&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It allowed me to build a website specifically for the interactive secure coding
workshop in no time, so that I could focus on the content instead of on the
presentation. As reStructuredText is plaintext it's really easy to work with,
and Emacs has built-in support for it. The content can be exported as ePub and
PDF, and optionally used as slidedeck, all without having to alter the content
or the formatting.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;This is an example of reStructuredText, what it looks like:&lt;/div&gt;
&lt;div class="line"&gt;&lt;img alt="Input text about encoding in reStructuredText format" src="/images/rest-input.png" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;And this is part of the resulting HTML, when it's converted using
Sphinx:&lt;/div&gt;
&lt;div class="line"&gt;&lt;img alt="Resulting HTML when converted using Sphinx" src="/images/sphinx-result.png" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The secure coding / OWASP top 10 workshop went according to plan, and
I'm looking forward to convert more workshops, workshop materials and
documentation of projects I'm part of to the reStructuredText format.
That allows me to switch easier between slidedecks, interactive HTML
websites, ePub and PDF formats - all having the same content.&lt;/p&gt;
&lt;p&gt;Write once, export to anything.&lt;/p&gt;
</content><category term="rst"></category><category term="workshop"></category></entry><entry><title>zsh shell inside Emacs on Windows</title><link href="https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html" rel="alternate"></link><published>2017-05-19T02:11:00+00:00</published><updated>2017-05-19T02:11:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-05-19:/configuration/zsh-shell-inside-emacs-on-windows.html</id><summary type="html">&lt;p class="first last"&gt;Configuring Emacs (on Windows) to use the zsh shell can be tricky, especially when you use ( oh my zsh) plugins or fancy prompts.
Emacs sets an environment variable when running a shell, which can be used to selectively disable plugins and change prompts.
Configuring the SSH client and server to set and accept that variable makes ssh-ing inside Emacs to remote servers possible as well.&lt;/p&gt;
</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="zsh shell inside Emacs on Windows" src="/images/zsh-shell-inside-emacs-on-windows.png" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The most obvious advantage of running a cross-platform shell (for example Bash
or zsh) is that you can use the same syntax and scripts on multiple
platforms. Setting up (alternative) shells on Windows can be pretty tricky, but
the small investment is well worth the reward.&lt;/p&gt;
&lt;p&gt;The MSYS2 subsystem allows you to run shells like Bash or zsh on Windows. An
important part of MSYS2 is making sure that the search paths are all pointing to
the MSYS2 subsystem: There are a lot of dependencies.&lt;/p&gt;
&lt;p&gt;Bash is the default shell once MSYS2 is installed; zsh can be installed using
the package manager:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pacman -Sy zsh
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Setting zsh as default shell can be done by modifying the &lt;code class="code"&gt;
/etc/passwd&lt;/code&gt;

file, for instance:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;mkpasswd -c &lt;span class="p"&gt;|&lt;/span&gt; sed -e &lt;span class="s1"&gt;&amp;#39;s/bash/zsh/&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; tee -a /etc/passwd
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will change the default shell from bash to zsh.&lt;/p&gt;
&lt;p&gt;Running zsh under Emacs on Windows can be done by modifying the
&lt;code class="code"&gt;
shell-file-name&lt;/code&gt;
 variable, and pointing it to the zsh binary from the MSYS2
subsystem. The shell binary has to be somewhere in the Emacs &lt;code class="code"&gt;
exec-path&lt;/code&gt;
 variable.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;shell-file-name&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;executable-find&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;zsh.exe&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Don't forget to modify the PATH environment variable for Emacs, as the
MSYS2 paths should be resolved before Windows paths. Using the same
example, where MSYS2 is installed under &lt;pre&gt;
c:\programs\msys2&lt;/pre&gt;
 :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;setenv&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;PATH&amp;quot;&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;C:\\programs\\msys2\\mingw64\\bin;C:\\programs\\msys2\\usr\\local\\bin;C:\\programs\\msys2\\usr\\bin;C:\\Windows\\System32;C:\\Windows&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After setting these two variables in the Emacs configuration file,
running &lt;pre&gt;
M-x shell&lt;/pre&gt;
 in Emacs should bring up the familiar zsh prompt.&lt;/p&gt;
&lt;p&gt;Emacs' terminal settings (eterm) are different than MSYS2' standard
terminal settings (xterm-256color). This means that some plugins or
themes (prompts) might not work - especially when using oh-my-zsh.&lt;/p&gt;
&lt;p&gt;Detecting whether zsh is started under Emacs is easy, using the variable
&lt;pre&gt;
$INSIDE_EMACS&lt;/pre&gt;
. This codesnippet in &lt;pre&gt;
.zshrc&lt;/pre&gt;
 (which will be sourced for
interactive shells) only enables the git plugin when being run in Emacs,
and changes the theme&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# Disable some plugins while running in Emacs&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; -n &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$INSIDE_EMACS&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nv"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;git&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="nv"&gt;ZSH_THEME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;simple&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  &lt;span class="nv"&gt;ZSH_THEME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;compact-grey&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By adding the &lt;code class="code"&gt;
INSIDE_EMACS&lt;/code&gt;
 variable to the local &lt;code class="code"&gt;
~/.ssh/config&lt;/code&gt;

as &lt;code class="code"&gt;
SendEnv&lt;/code&gt;
 variable...&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Host myhost
SendEnv INSIDE_EMACS
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;... and to a ssh server as &lt;code class="code"&gt;
AcceptEnv&lt;/code&gt;
 variable in &lt;code class="code"&gt;
/etc/ssh/sshd_config&lt;/code&gt;
...&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;AcceptEnv LANG LC_* INSIDE_EMACS
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;... this even works when ssh'ing inside an Emacs shell session to another ssh
server, running zsh. When ssh'ing in the zsh shell inside Emacs on Windows,
using the parameters &lt;code class="code"&gt;
-t -t&lt;/code&gt;
 forces pseudo-tty allocation (which is
necessary, as Emacs on Windows don't have a true tty).&lt;/p&gt;
&lt;p&gt;Cross-platform, open-source goodyness...&lt;/p&gt;
</content><category term="emacs"></category><category term="msys2"></category><category term="zsh"></category></entry><entry><title>The complexity of securing Docker versus Vagrant</title><link href="https://www.onwebsecurity.com/opinion/the-complexity-of-securing-docker-versus-vagrant.html" rel="alternate"></link><published>2017-05-03T04:40:00+00:00</published><updated>2017-05-03T04:40:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-05-03:/opinion/the-complexity-of-securing-docker-versus-vagrant.html</id><summary type="html">&lt;p&gt;&lt;img alt="Docker versus Vagrant" src="/images/docker-versus-vagrant.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;There are many, many comparisons out there on the Internet of Docker versus
Vagrant. Usability, scalability, portability, you-name-it-ability.&lt;/p&gt;
&lt;p&gt;This blogpost is about some different security aspects about the &lt;em&gt;current
implementation&lt;/em&gt; of Docker versus Vagrant. It's a high, high-level comparison of
the security impact for the host system.&lt;/p&gt;
&lt;p&gt;Can you compare the two ? Not really, they're being used for completely
different reasons. Docker is wildly popular for medium to large scale production
webserver deployments and microservices, where each service has its own process,
or container. Vagrant is more being used during design and development by
individual developers, or in teams at companies.&lt;/p&gt;
&lt;p&gt;So, having said that, let's compare the security differences in
high-level:&lt;/p&gt;
&lt;div class="section" id="docker"&gt;
&lt;h2&gt;Docker&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Partial isolation from the host&lt;/li&gt;
&lt;li&gt;Shares the kernel with the host.&lt;/li&gt;
&lt;li&gt;Resources aren't guaranteed, they're shared.&lt;/li&gt;
&lt;li&gt;Uses runC/libcontainer as runtime (before version 1.8 it used linux
containers (lxc) under the hood, then libcontainer, and since the
inception of the Open Container Initiative it uses runC which
abstracts even further away from libcontainer). System resources can
be allocated using &lt;strong&gt;control groups&lt;/strong&gt; (cgroups): block devices
(blkio), CPU (cpu), CPU accounting (cpuacct), individual CPU and
memory nodes (cpuset), devices, task management (freezer), memory
usage (memory), network packets (net_cls …&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Docker versus Vagrant" src="/images/docker-versus-vagrant.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;There are many, many comparisons out there on the Internet of Docker versus
Vagrant. Usability, scalability, portability, you-name-it-ability.&lt;/p&gt;
&lt;p&gt;This blogpost is about some different security aspects about the &lt;em&gt;current
implementation&lt;/em&gt; of Docker versus Vagrant. It's a high, high-level comparison of
the security impact for the host system.&lt;/p&gt;
&lt;p&gt;Can you compare the two ? Not really, they're being used for completely
different reasons. Docker is wildly popular for medium to large scale production
webserver deployments and microservices, where each service has its own process,
or container. Vagrant is more being used during design and development by
individual developers, or in teams at companies.&lt;/p&gt;
&lt;p&gt;So, having said that, let's compare the security differences in
high-level:&lt;/p&gt;
&lt;div class="section" id="docker"&gt;
&lt;h2&gt;Docker&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Partial isolation from the host&lt;/li&gt;
&lt;li&gt;Shares the kernel with the host.&lt;/li&gt;
&lt;li&gt;Resources aren't guaranteed, they're shared.&lt;/li&gt;
&lt;li&gt;Uses runC/libcontainer as runtime (before version 1.8 it used linux
containers (lxc) under the hood, then libcontainer, and since the
inception of the Open Container Initiative it uses runC which
abstracts even further away from libcontainer). System resources can
be allocated using &lt;strong&gt;control groups&lt;/strong&gt; (cgroups): block devices
(blkio), CPU (cpu), CPU accounting (cpuacct), individual CPU and
memory nodes (cpuset), devices, task management (freezer), memory
usage (memory), network packets (net_cls), network priority
(net_prio), namespaces (ns) and performace analysis (perf_event).&lt;/li&gt;
&lt;li&gt;Implements &lt;strong&gt;network isolation&lt;/strong&gt;, each Docker container has its own
network stack (zero or more network interfaces).&lt;/li&gt;
&lt;li&gt;Uses &lt;strong&gt;namespaces&lt;/strong&gt; to isolate processes and therefore containers.&lt;/li&gt;
&lt;li&gt;Secures the host, and each of the containers running on the host
using &lt;strong&gt;apparmor&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Vulnerabilities in the container will not affect the host.&lt;/li&gt;
&lt;li&gt;Vulnerabilities in Docker directly affect the host.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="vagrant"&gt;
&lt;h2&gt;Vagrant&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Full isolation from the host&lt;/li&gt;
&lt;li&gt;Runs its own kernel on top of the virtual machine environment.&lt;/li&gt;
&lt;li&gt;Resources are guaranteed in advance.&lt;/li&gt;
&lt;li&gt;Vulnerabilities in the host operating system will not affect the
host.&lt;/li&gt;
&lt;li&gt;Vulnerabilities in the virtual machine environment could affect the
host.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Docker seems to give systems administrators a much more fine-grained
control set to tune the security. And that's exactly what I personally
think still, in 2017, is currently the weak spot: There are simply too
much locations that a DevOps engineer or systems administrator needs to
think of to properly secure the host from the container(s).&lt;/p&gt;
&lt;p&gt;When something is easy to do, and is enabled by default, people will use
it. At the moment, configuring and hardening Docker is much easier than
it was, but still - not easy. The same reason why (unfortunately)
SELinux isn't widely deployed. It's too complex - and complexity is the
enemy of security.&lt;/p&gt;
&lt;/div&gt;
</content></entry><entry><title>Security through obscurity means better operational security</title><link href="https://www.onwebsecurity.com/opinion/security-through-obscurity-means-better-operational-security.html" rel="alternate"></link><published>2017-04-16T06:04:00+00:00</published><updated>2017-04-16T06:04:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-04-16:/opinion/security-through-obscurity-means-better-operational-security.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Are YOU OPSEC ?" src="/images/are-you-opsec.jpg" /&gt;&lt;/div&gt;
&lt;div class="line"&gt;What I personally like so much about being a penetration tester, is
that (I'd like to think that) we make the world a safer place. Better
security means better privacy means more democracy.&lt;/div&gt;
&lt;div class="line"&gt;It's not about telling people what &amp;quot;they&amp;quot; did wrong. On the contrary,
it's a learning process for all of us. No single application, network
or system is the same. Each company has its own risk model, which
means that there often is no one-size-fits-all solution.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It's about &amp;quot;how can we improve the security&amp;quot; for everybody. That's why I
think it's so important that penetration testers should lead by example.
Apply proper operation security procedures themselves.&lt;/p&gt;
&lt;p&gt;Recently my first Pluralsight course was published, operational security
for penetration testers. It deals with what opsec is, and how to apply
it to your penetration testing workflow. The trailer of the course can
be found at &lt;a class="reference external" href="https://www.youtube.com/watch?v=DSF6XbCxYGY"&gt;https://www.youtube.com/watch?v=DSF6XbCxYGY&lt;/a&gt;. The course
itself can be found on Pluralsight's site,
&lt;a class="reference external" href="https://www.pluralsight.com/courses/opsec-penetration-testers"&gt;https://www.pluralsight.com/courses/opsec-penetration-testers&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As beautifully stated by the third law of OPSEC: &lt;em&gt;&amp;quot;If you are not
protecting it, the adversary wins&amp;quot;&lt;/em&gt;.&lt;/p&gt;
</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Are YOU OPSEC ?" src="/images/are-you-opsec.jpg" /&gt;&lt;/div&gt;
&lt;div class="line"&gt;What I personally like so much about being a penetration tester, is
that (I'd like to think that) we make the world a safer place. Better
security means better privacy means more democracy.&lt;/div&gt;
&lt;div class="line"&gt;It's not about telling people what &amp;quot;they&amp;quot; did wrong. On the contrary,
it's a learning process for all of us. No single application, network
or system is the same. Each company has its own risk model, which
means that there often is no one-size-fits-all solution.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It's about &amp;quot;how can we improve the security&amp;quot; for everybody. That's why I
think it's so important that penetration testers should lead by example.
Apply proper operation security procedures themselves.&lt;/p&gt;
&lt;p&gt;Recently my first Pluralsight course was published, operational security
for penetration testers. It deals with what opsec is, and how to apply
it to your penetration testing workflow. The trailer of the course can
be found at &lt;a class="reference external" href="https://www.youtube.com/watch?v=DSF6XbCxYGY"&gt;https://www.youtube.com/watch?v=DSF6XbCxYGY&lt;/a&gt;. The course
itself can be found on Pluralsight's site,
&lt;a class="reference external" href="https://www.pluralsight.com/courses/opsec-penetration-testers"&gt;https://www.pluralsight.com/courses/opsec-penetration-testers&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As beautifully stated by the third law of OPSEC: &lt;em&gt;&amp;quot;If you are not
protecting it, the adversary wins&amp;quot;&lt;/em&gt;.&lt;/p&gt;
</content><category term="opsec"></category><category term="pentesting"></category></entry><entry><title>Use Emacs to create OAuth 2.0 UML sequence diagrams</title><link href="https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html" rel="alternate"></link><published>2017-02-23T03:11:00+00:00</published><updated>2017-02-23T03:11:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2017-02-23:/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html</id><summary type="html">&lt;p&gt;&lt;img alt="OAuth 2.0 abstract protocol flow" src="https://www.onwebsecurity.com/images/oauth2-abstract-protocol-flow.png" /&gt;&lt;/p&gt;
&lt;p&gt;It seems that the &lt;a class="reference external" href="https://tools.ietf.org/html/rfc6749"&gt;OAuth 2.0 framework&lt;/a&gt;
is more and more being used by web (and mobile) applications. Great !&lt;/p&gt;
&lt;p&gt;Although the protocol itself is not that complex, there are a number of
different use-cases, flows and implementations to choose from. As with most
things in life, the devil is in the detail.&lt;/p&gt;
&lt;p&gt;When reviewing OAuth 2.0 implementations or writing penetration testing reports
I like to draw UML diagrams. That makes it easier to understand what's going on,
and to spot potential issues. After all, a picture is worth a thousand words.&lt;/p&gt;
&lt;p&gt;This can be done extremely easy using the GPL-licensed open source &lt;a class="reference external" href="https://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; editor, in conjunction with the
GPL-licensed open source tool &lt;a class="reference external" href="https://plantuml.com"&gt;PlantUML&lt;/a&gt; (and
optionally using Eclipse Public Licensed &lt;a class="reference external" href="http://www.graphviz.org/"&gt;Graphviz&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Emacs is worlds' most versatile editor. In this case, it's being used to edit
the text, and automatically convert the text to an image. PlantUML is a tool
which allows you to write UML in human readable text and does the actual
conversion. Graphviz is visualization software, and optionally - in this case,
it's used to show certain images.&lt;/p&gt;
&lt;p&gt;Download the &lt;a class="reference external" href="http://plantuml.com/download"&gt;compiled PlantUML jar file&lt;/a&gt;,
&lt;a class="reference external" href="https://www.gnu.org/software/emacs/download.html"&gt;Emacs&lt;/a&gt; and optionally
download and install &lt;a class="reference external" href="http://www.graphviz.org/Download.php"&gt;Graphviz&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once you have Emacs installed and running …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="OAuth 2.0 abstract protocol flow" src="https://www.onwebsecurity.com/images/oauth2-abstract-protocol-flow.png" /&gt;&lt;/p&gt;
&lt;p&gt;It seems that the &lt;a class="reference external" href="https://tools.ietf.org/html/rfc6749"&gt;OAuth 2.0 framework&lt;/a&gt;
is more and more being used by web (and mobile) applications. Great !&lt;/p&gt;
&lt;p&gt;Although the protocol itself is not that complex, there are a number of
different use-cases, flows and implementations to choose from. As with most
things in life, the devil is in the detail.&lt;/p&gt;
&lt;p&gt;When reviewing OAuth 2.0 implementations or writing penetration testing reports
I like to draw UML diagrams. That makes it easier to understand what's going on,
and to spot potential issues. After all, a picture is worth a thousand words.&lt;/p&gt;
&lt;p&gt;This can be done extremely easy using the GPL-licensed open source &lt;a class="reference external" href="https://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; editor, in conjunction with the
GPL-licensed open source tool &lt;a class="reference external" href="https://plantuml.com"&gt;PlantUML&lt;/a&gt; (and
optionally using Eclipse Public Licensed &lt;a class="reference external" href="http://www.graphviz.org/"&gt;Graphviz&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Emacs is worlds' most versatile editor. In this case, it's being used to edit
the text, and automatically convert the text to an image. PlantUML is a tool
which allows you to write UML in human readable text and does the actual
conversion. Graphviz is visualization software, and optionally - in this case,
it's used to show certain images.&lt;/p&gt;
&lt;p&gt;Download the &lt;a class="reference external" href="http://plantuml.com/download"&gt;compiled PlantUML jar file&lt;/a&gt;,
&lt;a class="reference external" href="https://www.gnu.org/software/emacs/download.html"&gt;Emacs&lt;/a&gt; and optionally
download and install &lt;a class="reference external" href="http://www.graphviz.org/Download.php"&gt;Graphviz&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once you have Emacs installed and running, the following Lisp code (actually
configuration) in your startup file (&lt;code class="code"&gt;
~/.emacs.d/init.d&lt;/code&gt;
) will&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;configure &lt;code class="code"&gt;
org-mode&lt;/code&gt;
 (a mode to organize and edit text files) to use
PlantUML&lt;/li&gt;
&lt;li&gt;add &lt;code class="code"&gt;
plantuml&lt;/code&gt;
 to the recognized &lt;code class="code"&gt;
org-babel&lt;/code&gt;
 languages (which
allows you to execute source code from within text files)&lt;/li&gt;
&lt;li&gt;allow the execution of PlantUML code as &amp;quot;safe&amp;quot;&lt;/li&gt;
&lt;li&gt;automatically show you the resulting image&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt; &lt;span class="c1"&gt;;; tell org-mode where to find the plantuml JAR file (specify the JAR file)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;org-plantuml-jar-path&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;expand-file-name&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;~/plantuml.jar&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;;; use plantuml as org-babel language&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;org-babel-do-load-languages&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-babel-load-languages&lt;/span&gt; &lt;span class="o"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;plantuml&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="no"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;

&lt;span class="c1"&gt;;; helper function&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;defun&lt;/span&gt; &lt;span class="nv"&gt;my-org-confirm-babel-evaluate&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;lang&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="s"&gt;&amp;quot;Do not ask for confirmation to evaluate code for specified languages.&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;member&lt;/span&gt; &lt;span class="nv"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;plantuml&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;

&lt;span class="c1"&gt;;; trust certain code as being safe&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;org-confirm-babel-evaluate&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;my-org-confirm-babel-evaluate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;;; automatically show the resulting image&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;add-hook&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-babel-after-execute-hook&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-display-inline-images&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you don't have a startup file yet, add this code to the file
&lt;code class="code"&gt;
~/.emacs.d/init.el&lt;/code&gt;
 and restart Emacs.&lt;/p&gt;
&lt;p&gt;Hint: &lt;kbd class="kbd"&gt;
Control-c Control-f&lt;/kbd&gt;
 allows you to create/open a (new) file.
&lt;kbd class="kbd"&gt;
Control-x Control-s&lt;/kbd&gt;
 saves a file, and &lt;kbd class="kbd"&gt;
Control-x Control-c&lt;/kbd&gt;
 exits
Emacs.&lt;/p&gt;
&lt;p&gt;That's it!&lt;/p&gt;
&lt;p&gt;To test the configuration, create/open a file (&lt;kbd class="kbd"&gt;
Control-c Control-f&lt;/kbd&gt;
) with
the extension &lt;code class="code"&gt;
.org&lt;/code&gt;
, e.g. &lt;code class="code"&gt;
test.org&lt;/code&gt;
. This makes sure that Emacs switches
to &amp;quot;org-mode&amp;quot; and recognizes the &amp;quot;org-babel&amp;quot; syntax.&lt;/p&gt;
&lt;p&gt;Insert the following code, and press &lt;kbd class="kbd"&gt;
Control-c Control-c&lt;/kbd&gt;
 within the code
to test the installation:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;#+BEGIN_SRC plantuml :file test.png
@startuml
version
@enduml
#+END_SRC
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If everything went well, you'll see an image appearing inside Emacs, below the
text.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;To quickly insert code snippets like &lt;code class="code"&gt;
#+BEGIN_SRC&lt;/code&gt;
 and
&lt;code class="code"&gt;
#+END_SRC&lt;/code&gt;
, you can use the built-in &lt;em&gt;Easy Templates&lt;/em&gt; system:
Type &lt;kbd class="kbd"&gt;
&amp;lt;s&lt;/kbd&gt;
 followed by a &lt;kbd class="kbd"&gt;
TAB&lt;/kbd&gt;
, and it will automagically
insert a template for you.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For a more advanced example, this is the UML source code used to generate the
image above:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;#+BEGIN_SRC plantuml :file t:/oauth2-abstract-protocol-flow.png
@startuml
hide footbox
title Oauth 2.0 Abstract protocol flow
autonumber
actor user as &amp;quot;resource owner (user)&amp;quot;
box &amp;quot;token stays secure&amp;quot; #FAFAFA
participant client as &amp;quot;client (application)&amp;quot;
participant authorization as &amp;quot;authorization server&amp;quot;
database resource as &amp;quot;resource server&amp;quot;
end box

group user authorizes client
client -&amp;gt; user : request authorization
note left
**grant types**:
# authorization code
# implicit
# password
# client_credentials
end note
user --&amp;gt; client : authorization grant
end

group token is generated
client -&amp;gt; authorization : request token\npresent authorization grant
authorization --&amp;gt; client :var:  access token
note left
**response types**:
# code
# token
end note
end group

group resource can be accessed
client -&amp;gt; resource : request resource\npresent token
resource --&amp;gt; client : resource
end group
@enduml
#+END_SRC
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Don't you just love the versatility of Emacs, and open source tools ?&lt;/p&gt;
</content><category term="emacs"></category><category term="oauth2"></category><category term="pentesting"></category><category term="security"></category></entry><entry><title>It's about the journey: Compiling 64-bit Unison / GTK2 on Windows</title><link href="https://www.onwebsecurity.com/configuration/its-about-the-journey-compiling-64-bit-unison-gtk2-on-windows.html" rel="alternate"></link><published>2016-12-24T03:23:00+00:00</published><updated>2018-05-14T10:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-12-24:/configuration/its-about-the-journey-compiling-64-bit-unison-gtk2-on-windows.html</id><summary type="html">&lt;p&gt;&lt;img alt="Unison File Synchronizer" src="https://www.onwebsecurity.com/images/unison.png" /&gt;&lt;/p&gt;
&lt;p&gt;The excellent MSYS2 (mingw64 and mingw32) subsytem makes compiling native
Windows compilations &amp;quot;as easy as compilation can be&amp;quot;. However, as with
everything in life, sometimes when trying to do one thing (compile a program),
you end up chasing other vaguely related issues (one exotic compile error after
another).&lt;/p&gt;
&lt;p&gt;For synchronizing files between servers and workstations I use the open source
GPLv3 licensed &lt;a class="reference external" href="https://github.com/bcpierce00/unison"&gt;Unison File Synchronizer&lt;/a&gt; &lt;a class="footnote-reference" href="#id2" id="id3"&gt;[1]&lt;/a&gt;. Although the text interface version
of Unison compiles straight-out-of-the box on mingw64, the GTK2 interface proved
to be a bit more cumbersome.&lt;/p&gt;
&lt;p&gt;To compile Unison with the GTK2 interface, &lt;a class="reference external" href="http://lablgtk.forge.ocamlcore.org/"&gt;lablgtk&lt;/a&gt; &lt;a class="footnote-reference" href="#id4" id="id5"&gt;[2]&lt;/a&gt; is needed, an OCaml
interface to GTK.&lt;/p&gt;
&lt;p&gt;So, the journey began with firing up a shell in a fresh mingw64 environment, and
installing the build prerequisites:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Sy --noconfirm base-devel git \&lt;/span&gt;
&lt;span class="go"&gt;mingw-w64-x86_64-{glib2,gtk2,ocaml,pango,toolchain}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After downloading the latest source (&lt;a class="reference external" href="https://forge.ocamlcore.org/frs/download.php/1627/2.18.5.tar.gz"&gt;2.18.5&lt;/a&gt; &lt;a class="footnote-reference" href="#id6" id="id7"&gt;[3]&lt;/a&gt;) and trying to compile it (using
&lt;code class="code"&gt;
make&lt;/code&gt;
) after running&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;./configure --prefix=/mingw64 --disable-gtktest&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;the first error message is shown:&lt;/p&gt;
&lt;div class="section" id="mingw64-include-gtk-2-0-gdk-gdkwin32-h-40-36-fatal-error-gdk-win32-gdkwin32keys-h-no-such-file-or-directory"&gt;
&lt;h2&gt;mingw64/include/gtk-2.0/gdk/gdkwin32.h:40:36: fatal error: gdk/win32/gdkwin32keys.h: No such file or directory&lt;/h2&gt;
&lt;p&gt;It seems that GTK2 version 2.24.31 contains an &lt;a class="reference external" href="http://osdir.com/ml/commits.gnome/2016-11/msg06962.html"&gt;error&lt;/a&gt; &lt;a class="footnote-reference" href="#id8" id="id9"&gt;[4]&lt;/a&gt;, and incorrectly still
references the file …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Unison File Synchronizer" src="https://www.onwebsecurity.com/images/unison.png" /&gt;&lt;/p&gt;
&lt;p&gt;The excellent MSYS2 (mingw64 and mingw32) subsytem makes compiling native
Windows compilations &amp;quot;as easy as compilation can be&amp;quot;. However, as with
everything in life, sometimes when trying to do one thing (compile a program),
you end up chasing other vaguely related issues (one exotic compile error after
another).&lt;/p&gt;
&lt;p&gt;For synchronizing files between servers and workstations I use the open source
GPLv3 licensed &lt;a class="reference external" href="https://github.com/bcpierce00/unison"&gt;Unison File Synchronizer&lt;/a&gt; &lt;a class="footnote-reference" href="#id2" id="id3"&gt;[1]&lt;/a&gt;. Although the text interface version
of Unison compiles straight-out-of-the box on mingw64, the GTK2 interface proved
to be a bit more cumbersome.&lt;/p&gt;
&lt;p&gt;To compile Unison with the GTK2 interface, &lt;a class="reference external" href="http://lablgtk.forge.ocamlcore.org/"&gt;lablgtk&lt;/a&gt; &lt;a class="footnote-reference" href="#id4" id="id5"&gt;[2]&lt;/a&gt; is needed, an OCaml
interface to GTK.&lt;/p&gt;
&lt;p&gt;So, the journey began with firing up a shell in a fresh mingw64 environment, and
installing the build prerequisites:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Sy --noconfirm base-devel git \&lt;/span&gt;
&lt;span class="go"&gt;mingw-w64-x86_64-{glib2,gtk2,ocaml,pango,toolchain}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After downloading the latest source (&lt;a class="reference external" href="https://forge.ocamlcore.org/frs/download.php/1627/2.18.5.tar.gz"&gt;2.18.5&lt;/a&gt; &lt;a class="footnote-reference" href="#id6" id="id7"&gt;[3]&lt;/a&gt;) and trying to compile it (using
&lt;code class="code"&gt;
make&lt;/code&gt;
) after running&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;./configure --prefix=/mingw64 --disable-gtktest&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;the first error message is shown:&lt;/p&gt;
&lt;div class="section" id="mingw64-include-gtk-2-0-gdk-gdkwin32-h-40-36-fatal-error-gdk-win32-gdkwin32keys-h-no-such-file-or-directory"&gt;
&lt;h2&gt;mingw64/include/gtk-2.0/gdk/gdkwin32.h:40:36: fatal error: gdk/win32/gdkwin32keys.h: No such file or directory&lt;/h2&gt;
&lt;p&gt;It seems that GTK2 version 2.24.31 contains an &lt;a class="reference external" href="http://osdir.com/ml/commits.gnome/2016-11/msg06962.html"&gt;error&lt;/a&gt; &lt;a class="footnote-reference" href="#id8" id="id9"&gt;[4]&lt;/a&gt;, and incorrectly still
references the file &lt;strong&gt;gdkwin32keys.h&lt;/strong&gt;. This could be solved by removing the
reference:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt; sed -i &amp;quot;s/#include &amp;lt;gdk\/win32\/gdkwin32keys.h&amp;gt;/\/\/#include &amp;lt;gdk\/win32\/gdkwin32keys.h&amp;gt;/&amp;quot; \&lt;/span&gt;
&lt;span class="go"&gt;/mingw64/include/gtk-2.0/gdk/gdkwin32.h&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After retrying the build process for lablgtk using &lt;code class="code"&gt;
make&lt;/code&gt;
, the next error
message pops up during the build process:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="error-on-dynamically-loaded-library-dlllablgtk2-dll-1-is-not-a-valid-win32-application"&gt;
&lt;h2&gt;Error on dynamically loaded library: .\dlllablgtk2.dll: %1 is not a valid Win32 application.&lt;/h2&gt;
&lt;p&gt;Apparently flexlink 0.34 (which is installed as dependency of OCaml) has an
&lt;a class="reference external" href="https://github.com/alainfrisch/flexdll/issues/6"&gt;issue&lt;/a&gt; &lt;a class="footnote-reference" href="#id10" id="id11"&gt;[5]&lt;/a&gt; with building 64 bit applications on MSYS2 / mingw64. This could be
solved by stripping the incorrect library of its debug symbols:&lt;/p&gt;
&lt;pre class="code console literal-block"&gt;
&lt;span class="go"&gt;strip src/dlllablgtk2.dll&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;And indeed, &lt;code class="code"&gt;
make &amp;amp;&amp;amp; make opt&lt;/code&gt;
 works after this. Next up is installing all
lablgtk files in the correct locations:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;make old-install INSTALLDIR=/mingw64/lib/ocaml/lablgtk2/ BINDIR=/mingw64/bin/ \&lt;/span&gt;
&lt;span class="go"&gt;DLLDIR=/mingw64/lib/ocaml/stublibs/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this, the final destination is in sight: cloning, configuring and
compiling the git version of Unison for GTK2.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pushd /tmp&lt;/span&gt;
&lt;span class="go"&gt;git clone --depth=1 https://github.com/bcpierce00/unison&lt;/span&gt;
&lt;span class="go"&gt;cd unison&lt;/span&gt;
&lt;span class="go"&gt;make windres&lt;/span&gt;
&lt;span class="go"&gt;make src OSARCH=win32gnuc&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While re-validating these instructions in 2017, I ran into another build issue:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="error-caml-frame-undeclared-first-use-in-this-function"&gt;
&lt;h2&gt;error: 'caml__frame' undeclared (first use in this function)&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;In file included from ./lwt/lwt_unix_stubs.c:8:0:&lt;/span&gt;
&lt;span class="go"&gt;./lwt/lwt_unix_stubs.c: In function &amp;#39;invoke_completion_callback&amp;#39;:&lt;/span&gt;
&lt;span class="go"&gt;mingw64\lib\ocaml/caml/memory.h:236:12: error: &amp;#39;caml__frame&amp;#39; undeclared (first use in this function)&lt;/span&gt;
&lt;span class="go"&gt;  (void) caml__frame, \&lt;/span&gt;
&lt;span class="go"&gt;         ^&lt;/span&gt;
&lt;span class="go"&gt;mingw64\lib\ocaml/caml/memory.h:236:12: note: in definition of macro &amp;#39;CAMLxparam2&amp;#39;&lt;/span&gt;
&lt;span class="go"&gt;  (void) caml__frame, \&lt;/span&gt;
&lt;span class="go"&gt;         ^~~~~~~~~~~&lt;/span&gt;
&lt;span class="go"&gt;./lwt/lwt_unix_stubs.c:82:3: note: in expansion of macro &amp;#39;CAMLlocal2&amp;#39;&lt;/span&gt;
&lt;span class="go"&gt;CAMLlocal2 (err, name);&lt;/span&gt;
&lt;span class="go"&gt;^&lt;/span&gt;
&lt;span class="go"&gt;mingw64\lib\ocaml/caml/memory.h:236:12: note: each undeclared identifier is reported only once for each function it appears in&lt;/span&gt;
&lt;span class="go"&gt;  (void) caml__frame, \&lt;/span&gt;
&lt;span class="go"&gt;         ^&lt;/span&gt;
&lt;span class="go"&gt;mingw64\lib\ocaml/caml/memory.h:236:12: note: in definition of macro &amp;#39;CAMLxparam2&amp;#39;&lt;/span&gt;
&lt;span class="go"&gt;  (void) caml__frame, \&lt;/span&gt;
&lt;span class="go"&gt;         ^~~~~~~~~~~&lt;/span&gt;
&lt;span class="go"&gt;./lwt/lwt_unix_stubs.c:82:3: note: in expansion of macro &amp;#39;CAMLlocal2&amp;#39;&lt;/span&gt;
&lt;span class="go"&gt;CAMLlocal2 (err, name);&lt;/span&gt;
&lt;span class="go"&gt;^&lt;/span&gt;
&lt;span class="go"&gt;make[1]: *** [Makefile.OCaml:434: lwt/lwt_unix_stubs.o] Error 2&lt;/span&gt;
&lt;span class="go"&gt;make[1]: Leaving directory &amp;#39;unison/src&amp;#39;&lt;/span&gt;
&lt;span class="go"&gt;make: *** [Makefile:14: src] Error 2&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It seems that the current Unison code does not properly follow OCaml's
guidelines with regards to interfacing. From the OCaml &lt;a class="reference external" href="http://caml.inria.fr/pub/docs/manual-ocaml-4.04/intfc.html"&gt;documentation&lt;/a&gt; &lt;a class="footnote-reference" href="#id12" id="id13"&gt;[6]&lt;/a&gt;&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Rule 1
    A function that has parameters or local variables of type value must
    begin with a call to one of the CAMLparam macros and return with
    CAMLreturn, CAMLreturn0, or CAMLreturnT. In particular, CAMLlocal and
    CAMLxparam can only be called after CAMLparam.
&lt;/pre&gt;
&lt;p&gt;A simple call using &lt;code class="code"&gt;
CAMLparam0()&lt;/code&gt;
 fixes that problem.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gd"&gt;--- a/src/lwt/lwt_unix_stubs.c       2017-06-30 04:46:47.061185900 +0000&lt;/span&gt;
&lt;span class="gi"&gt;+++ b/src/lwt/lwt_unix_stubs.c       2017-06-30 04:45:42.023470300 +0000&lt;/span&gt;
@@ -79,6 +79,7 @@

static void invoke_completion_callback
(long id, long len, long errCode, long action) {
&lt;span class="gi"&gt;+  CAMLparam0();&lt;/span&gt;
   CAMLlocal2 (err, name);
   value args[4];
   err = Val_long(0);
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A pull request was sent upstream (&lt;a class="reference external" href="https://github.com/bcpierce00/unison/pull/82"&gt;https://github.com/bcpierce00/unison/pull/82&lt;/a&gt;)
which has been merged in October 2017.&lt;/p&gt;
&lt;p&gt;And after applying the latest patch...hooray, the binary gets built
successfully, and when starting the &lt;strong&gt;unison.exe&lt;/strong&gt; executable under the mingw64
subsytem, the GTK2 interface is shown. Note that the &lt;code class="code"&gt;
windres&lt;/code&gt;
 command is
to make sure that the resource files are 64-bit compatible.&lt;/p&gt;
&lt;p&gt;If you want to run the &lt;code class="code"&gt;
unison.exe&lt;/code&gt;
 executable standalone, on another
system or without the MSYS2 / mingw64 subsytem, you'll need the 64-bit
GTK2 library files as well as the two MSYS2 libraries
&lt;strong&gt;libgcc_s_seh-1.dll&lt;/strong&gt; and &lt;strong&gt;libstdc++-6.dll&lt;/strong&gt; (as flexlink currently
doesn't allow static builds). These can found and copied using the
following commands:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;YOURTARGETDIR=/your/target/search/path&lt;/span&gt;
&lt;span class="go"&gt;cp&lt;/span&gt;
&lt;span class="go"&gt;/mingw64/bin/{lib{atk-*,bz2-*,cairo-*2,expat-*,ffi-*,fontconfig-*,freetype-*,gailutil-18,gcc_s_dw2-*,gcc_s_seh-*,gdk*-2.*,gio-2*,glib-2*,gmodule-2*,gobject-2*,gthread-2*,gtk-win32-2*,harfbuzz-*,graphite2,iconv-*,intl-*,pixman-*,pango*-1*,pcre-1,png*-*,stdc++-*,winpthread-*},zlib1}.dll $YOURTARGETDIR&lt;/span&gt;
&lt;span class="go"&gt;mkdir -p $YOURTARGETDIR/lib/gdk-pixbuf-2.0/2.10.0&lt;/span&gt;
&lt;span class="go"&gt;cp /mingw64/lib/gdk-pixbuf-2.0/2.10.0/loaders $YOURTARGETDIR/lib/gdk-pixbuf-2.0/2.10.0/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, after the first try of running &lt;strong&gt;unison.exe&lt;/strong&gt; in a windows
shell, with the GTK2 files in a search path, Unison greeted me with the
following message:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="fatal-error-uncaught-exception-gdk-error-gdk-pixmap-create-from-xpm-data"&gt;
&lt;h2&gt;Fatal error - Uncaught exception Gdk.Error (&amp;quot;Gdk.Pixmap.create_from_xpm_data&amp;quot;)&lt;/h2&gt;
&lt;p&gt;After some searching it became apparent that image (xpm) support is
modular, and therefore the Gdk Pixbuf cache (which loads the image
modules) needs to be rebuilt. This can be done by copying the file
&lt;strong&gt;gdk-pixbuf-query-loaders.exe&lt;/strong&gt; and executing it once on/in the
standalone system/path:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gdk-pixbuf-query-loaders.exe --update-cache&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This might show some warnings, and will create the file
&lt;strong&gt;lib/gdk-pixbuf-2.0/2.10.0/loaders.cache&lt;/strong&gt;. This file contains
necessary information for Gdk Pixbuf, so that xpm files can be loaded.&lt;/p&gt;
&lt;p&gt;Indeed, this was the final step in running the latest version of Unison
standalone on a 64-bit system, with the latest GTK2 64-bit library
files.&lt;/p&gt;
&lt;p&gt;This was by far a linear path and took me more time than anticipated.
However, the satisfaction at the end and the accumulated knowledge makes
it worth the journey. Every time.&lt;/p&gt;
&lt;p&gt;For debugging purposes I can heartily recommend the Windows version of
&lt;strong&gt;ldd&lt;/strong&gt;, &lt;a class="reference external" href="https://github.com/LRN/ntldd"&gt;ntldd&lt;/a&gt; &lt;a class="footnote-reference" href="#id14" id="id15"&gt;[7]&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="summary"&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;To summarize, here are all steps to compile the latest master branch of Unison
from scratch on a vanilla mingw64 (MSYS2) installation, using flexdll version
0.34, gcc version 6.2.0, GTK2 version 2.24.31, lablgtk version 2.18.5 and OCaml
version 4.02.3:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Sy --noconfirm base-devel git mingw-w64-x86_64-{glib2,gtk2,ocaml,toolchain}&lt;/span&gt;
&lt;span class="go"&gt;sed -i &amp;quot;s/#include &amp;lt;gdk\/win32\/gdkwin32keys.h&amp;gt;/\/\/#include&lt;/span&gt;
&lt;span class="go"&gt;&amp;lt;gdk\/win32\/gdkwin32keys.h&amp;gt;/&amp;quot; /mingw64/include/gtk-2.0/gdk/gdkwin32.h&lt;/span&gt;

&lt;span class="go"&gt;VERSION=2.18.5&lt;/span&gt;
&lt;span class="go"&gt;pushd /tmp&lt;/span&gt;
&lt;span class="go"&gt;wget -c https://forge.ocamlcore.org/frs/download.php/1627/$VERSION.tar.gz&lt;/span&gt;
&lt;span class="go"&gt;tar -xzvf $VERSION.tar.gz&lt;/span&gt;
&lt;span class="go"&gt;cd lablgtk-$VERSION&lt;/span&gt;
&lt;span class="go"&gt;./configure --prefix=/mingw64 --disable-gtktest&lt;/span&gt;
&lt;span class="go"&gt;make ; strip src/dlllablgtk2.dll&lt;/span&gt;
&lt;span class="go"&gt;make&lt;/span&gt;
&lt;span class="go"&gt;make opt&lt;/span&gt;
&lt;span class="go"&gt;make old-install INSTALLDIR=/mingw64/lib/ocaml/lablgtk2/ \&lt;/span&gt;
&lt;span class="go"&gt;BINDIR=/mingw64/bin/ DLLDIR=/mingw64/lib/ocaml/stublibs/&lt;/span&gt;

&lt;span class="go"&gt;pushd /tmp&lt;/span&gt;
&lt;span class="go"&gt;git clone --depth=1 https://github.com/bcpierce00/unison&lt;/span&gt;
&lt;span class="go"&gt;cd unison&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt; Apply patch https://patch-diff.githubusercontent.com/raw/bcpierce00/unison/pull/82.diff
&lt;span class="go"&gt;make windres&lt;/span&gt;
&lt;span class="go"&gt;make src OSARCH=win32gnuc&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="pango-errors"&gt;
&lt;h2&gt;Pango errors&lt;/h2&gt;
&lt;p&gt;If you see the message &lt;code class="code"&gt;
Error: Unbound module Pango&lt;/code&gt;
, then the
&lt;code class="code"&gt;
OCAMLFIND_CONF&lt;/code&gt;
 path might be incorrect. This can be fixed by setting and
exporting the path to the correct value, where &lt;code class="code"&gt;
findlib.conf&lt;/code&gt;
 lives on
your file system. Then, (re)run the make commands.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;export OCAMLFIND_CONF=/mingw64/etc/findlib.conf&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="lablgtk-errors"&gt;
&lt;h2&gt;lablgtk errors&lt;/h2&gt;
&lt;p&gt;If you see the message &lt;code class="code"&gt;
Error: Unbound value Gpointer.region_of_bytes&lt;/code&gt;
,
then the lablgtk version that you're using is older than 2.8.16. You can either
upgrade lablgtk, or revert the change from commit &lt;a class="reference external" href="https://github.com/bcpierce00/unison/commit/2e7ea9481c"&gt;2e7ea9&lt;/a&gt; &lt;a class="footnote-reference" href="#id16" id="id17"&gt;[8]&lt;/a&gt; on 2018-02-26:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git revert --no-commit 2e7ea9&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="admonition small"&gt;
&lt;p class="first admonition-title"&gt;Changelog&lt;/p&gt;
&lt;ul class="last simple"&gt;
&lt;li&gt;2018-05-14: Added lablgtk error message and solution&lt;/li&gt;
&lt;li&gt;2017-11-05: Added Pango error message and solution&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;table class="docutils footnote" frame="void" id="id2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id3"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/bcpierce00/unison"&gt;https://github.com/bcpierce00/unison&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id5"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://lablgtk.forge.ocamlcore.org/"&gt;http://lablgtk.forge.ocamlcore.org/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id6" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id7"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://forge.ocamlcore.org/frs/download.php/1627/2.18.5.tar.gz"&gt;https://forge.ocamlcore.org/frs/download.php/1627/2.18.5.tar.gz&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id8" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id9"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://osdir.com/ml/commits.gnome/2016-11/msg06962.html"&gt;http://osdir.com/ml/commits.gnome/2016-11/msg06962.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id10" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id11"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/alainfrisch/flexdll/issues/6"&gt;https://github.com/alainfrisch/flexdll/issues/6&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id12" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id13"&gt;[6]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="http://caml.inria.fr/pub/docs/manual-ocaml-4.04/intfc.html"&gt;http://caml.inria.fr/pub/docs/manual-ocaml-4.04/intfc.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id14" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id15"&gt;[7]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/LRN/ntldd"&gt;https://github.com/LRN/ntldd&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id16" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id17"&gt;[8]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/bcpierce00/unison/commit/2e7ea9481c"&gt;https://github.com/bcpierce00/unison/commit/2e7ea9481c&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="compiling"></category><category term="msys2"></category><category term="unison"></category><category term="windows"></category></entry><entry><title>Why Sharing Improves Us</title><link href="https://www.onwebsecurity.com/opinion/why-sharing-improves-us.html" rel="alternate"></link><published>2016-12-16T05:38:00+00:00</published><updated>2016-12-16T05:38:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-12-16:/opinion/why-sharing-improves-us.html</id><summary type="html">&lt;p&gt;&lt;img alt="why sharing improves us" src="https://www.onwebsecurity.com/images/why-sharing-improves-us.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;If you're a perfectionist, it's difficult to release a product: Whether that's
source code, a pentest report or a blogpost. It's always a work in progress, and
never finished.&lt;/p&gt;
&lt;p&gt;That's why I like open sourcing code for example, releasing it for everybody to
see. Knowing beforehand that the code, your work will be read by others (while
you're working on it) forces you to think longer, deeper and harder about the
variable names, the structures, function names and coding styles.&lt;/p&gt;
&lt;p&gt;I'm the lead pentester for a company where we allow the customer to peek over
our shoulder while we're working. The customer can see everything that we try,
do and find out during the pentest. This improves the relationship with the
customer, as s/he sees what we're doing and even can think along with us.&lt;/p&gt;
&lt;p&gt;It also improves the customer satisfaction, as they know exactly what they're
getting. And, it improves the mutual respect. Instead of becoming a classical
us-versus-them pentest (the pentesters versus the developers), it becomes a
'let's improve the overall security together' exercise.&lt;/p&gt;
&lt;p&gt;According to all the positive feedback we're receiving, we're onto something
here. A win-win.&lt;/p&gt;
&lt;p&gt;Sunlight is not only a great disinfectant, it's also …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="why sharing improves us" src="https://www.onwebsecurity.com/images/why-sharing-improves-us.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;If you're a perfectionist, it's difficult to release a product: Whether that's
source code, a pentest report or a blogpost. It's always a work in progress, and
never finished.&lt;/p&gt;
&lt;p&gt;That's why I like open sourcing code for example, releasing it for everybody to
see. Knowing beforehand that the code, your work will be read by others (while
you're working on it) forces you to think longer, deeper and harder about the
variable names, the structures, function names and coding styles.&lt;/p&gt;
&lt;p&gt;I'm the lead pentester for a company where we allow the customer to peek over
our shoulder while we're working. The customer can see everything that we try,
do and find out during the pentest. This improves the relationship with the
customer, as s/he sees what we're doing and even can think along with us.&lt;/p&gt;
&lt;p&gt;It also improves the customer satisfaction, as they know exactly what they're
getting. And, it improves the mutual respect. Instead of becoming a classical
us-versus-them pentest (the pentesters versus the developers), it becomes a
'let's improve the overall security together' exercise.&lt;/p&gt;
&lt;p&gt;According to all the positive feedback we're receiving, we're onto something
here. A win-win.&lt;/p&gt;
&lt;p&gt;Sunlight is not only a great disinfectant, it's also a great energy source for
growth.&lt;/p&gt;
</content><category term="opensource"></category><category term="pentesting"></category></entry><entry><title>Verify security vulnerabilities: A collection of Bash one-liners</title><link href="https://www.onwebsecurity.com/security/verify-security-vulnerabilities-a-collection-of-bash-one-liners.html" rel="alternate"></link><published>2016-11-25T02:09:00+00:00</published><updated>2016-11-25T02:09:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-11-25:/security/verify-security-vulnerabilities-a-collection-of-bash-one-liners.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="security test one-liners" src="https://www.onwebsecurity.com/images/security-test-one-liners.jpg" style="width: 600px; height: 450px;" /&gt;&lt;/div&gt;
&lt;div class="line"&gt;There's manual pentesting and writing reports, and there is blindly
copying the output of automated scantools. I am fortunate enough to
write and review a lot of pentest reports, as well as read pentest
reports of a other companies.&lt;/div&gt;
&lt;div class="line"&gt;Nothing looks as bad as &amp;quot;vulnerabilities&amp;quot; in a report that haven't
been verified as such. This really degrades the quality of the report.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Below is a number of simple one-liners that can help with verifying
vulnerabilities. All examples can be run in a basic shell (Bash, zsh),
where the TARGET variable contains the hostname of the target that needs
to be verified (without protocol).&lt;/p&gt;
&lt;div class="section" id="ssl-tls-breach"&gt;
&lt;h2&gt;SSL/TLS: BREACH&lt;/h2&gt;
&lt;blockquote&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; compression in compress deflate exi gzip identity pack200-gzip br
bzip2 lzma peerdist sdch xpress xz&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; curl -ksI -H &lt;span class="s2"&gt;&amp;quot;Accept-Encoding:&lt;/span&gt;
&lt;span class="nv"&gt;$compression&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; https://&lt;span class="nv"&gt;$TARGET&lt;/span&gt; &lt;span class="se"&gt;\|&lt;/span&gt; grep -i &lt;span class="s2"&gt;&amp;quot;content-encoding:&lt;/span&gt;
&lt;span class="nv"&gt;$compression&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;*Might* be vulnerable when&lt;/strong&gt;: one or more compression methods are
shown.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="ssl-tls-client-initiated-secure-renegotiation"&gt;
&lt;h2&gt;SSL/TLS: Client-Initiated Secure Renegotiation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;R\nQ&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; timeout &lt;span class="m"&gt;10&lt;/span&gt; openssl s_client -connect &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:443
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;Vulnerable when&lt;/strong&gt;: Renegotiation is successful (exit code == 0)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="http-trace-enabled"&gt;
&lt;h2&gt;HTTP: TRACE enabled&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; proto in http https&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; testing &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;proto&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
curl -qskIX TRACE &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;proto&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\|&lt;/span&gt;grep -i TRACE&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;Vulnerable when&lt;/strong&gt;: the verb TRACE is shown&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="http-open-secure-redirect"&gt;
&lt;h2&gt;HTTP: Open …&lt;/h2&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="security test one-liners" src="https://www.onwebsecurity.com/images/security-test-one-liners.jpg" style="width: 600px; height: 450px;" /&gt;&lt;/div&gt;
&lt;div class="line"&gt;There's manual pentesting and writing reports, and there is blindly
copying the output of automated scantools. I am fortunate enough to
write and review a lot of pentest reports, as well as read pentest
reports of a other companies.&lt;/div&gt;
&lt;div class="line"&gt;Nothing looks as bad as &amp;quot;vulnerabilities&amp;quot; in a report that haven't
been verified as such. This really degrades the quality of the report.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Below is a number of simple one-liners that can help with verifying
vulnerabilities. All examples can be run in a basic shell (Bash, zsh),
where the TARGET variable contains the hostname of the target that needs
to be verified (without protocol).&lt;/p&gt;
&lt;div class="section" id="ssl-tls-breach"&gt;
&lt;h2&gt;SSL/TLS: BREACH&lt;/h2&gt;
&lt;blockquote&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; compression in compress deflate exi gzip identity pack200-gzip br
bzip2 lzma peerdist sdch xpress xz&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; curl -ksI -H &lt;span class="s2"&gt;&amp;quot;Accept-Encoding:&lt;/span&gt;
&lt;span class="nv"&gt;$compression&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; https://&lt;span class="nv"&gt;$TARGET&lt;/span&gt; &lt;span class="se"&gt;\|&lt;/span&gt; grep -i &lt;span class="s2"&gt;&amp;quot;content-encoding:&lt;/span&gt;
&lt;span class="nv"&gt;$compression&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;*Might* be vulnerable when&lt;/strong&gt;: one or more compression methods are
shown.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="ssl-tls-client-initiated-secure-renegotiation"&gt;
&lt;h2&gt;SSL/TLS: Client-Initiated Secure Renegotiation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;R\nQ&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; timeout &lt;span class="m"&gt;10&lt;/span&gt; openssl s_client -connect &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:443
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;Vulnerable when&lt;/strong&gt;: Renegotiation is successful (exit code == 0)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="http-trace-enabled"&gt;
&lt;h2&gt;HTTP: TRACE enabled&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; proto in http https&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; testing &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;proto&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
curl -qskIX TRACE &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;proto&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\|&lt;/span&gt;grep -i TRACE&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;Vulnerable when&lt;/strong&gt;: the verb TRACE is shown&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="http-open-secure-redirect"&gt;
&lt;h2&gt;HTTP: Open (Secure) Redirect&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; proto in http https&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; curl -sIH &lt;span class="s2"&gt;&amp;quot;Host: vuln&amp;quot;&lt;/span&gt; &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;proto&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TARGET&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/ &lt;span class="p"&gt;|&lt;/span&gt;
grep -i &lt;span class="s2"&gt;&amp;quot;Location: https\\?://vuln/&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;Vulnerable when&lt;/strong&gt;: The Location header is shown&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that the checks for BREACH and Open Secure Redirect can be found in
the latest version of
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts"&gt;analyze_hosts.py&lt;/a&gt;
- use the &lt;pre&gt;
--http&lt;/pre&gt;
 flag.&lt;/p&gt;
&lt;/div&gt;
</content><category term="bash"></category><category term="pentesting"></category></entry><entry><title>Zen provisioning: Bootstrap the installation of Ansible using Vagrant</title><link href="https://www.onwebsecurity.com/configuration/zen-provisioning-bootstrap-the-installation-of-ansible-using-vagrant.html" rel="alternate"></link><published>2016-10-07T04:20:00+00:00</published><updated>2016-10-07T04:20:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-10-07:/configuration/zen-provisioning-bootstrap-the-installation-of-ansible-using-vagrant.html</id><summary type="html">&lt;p&gt;&lt;img alt="zen" src="/images/zen-provisioning.jpg" style="width: 600px; height: 450px;" /&gt;&lt;/p&gt;
&lt;p&gt;I'm a big fan of the DevOps attitude of &amp;quot;cattle&amp;quot; versus &amp;quot;pets&amp;quot;: machines should
be built in a repeatable, automated and consistent way. If there's something
wrong, don't be afraid to replace a sick &amp;quot;cow&amp;quot; instead of trying to revive your
&amp;quot;pet&amp;quot;.&lt;/p&gt;
&lt;p&gt;This Zen mindset also helps when preparing for demos, trainings and workshops:
Usually I need a number of machines, and what better way than create them by
using automation ? For that I'm using the tools Ansible, Packer, Vagrant and
VirtualBox - they are all Open Source and can be used on a number of platforms
(e.g. Windows, Linux and Mac OS X).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ansible&lt;/strong&gt; is a tool for managing systems and deploying applications,
licensed under the GNU General Public License version 3 (my personal
favorite).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Vagrant&lt;/strong&gt; is a tool for managing virtual machines and is licensed
under the MIT license.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VirtualBox&lt;/strong&gt; is a virtualization environment for local use, licensed
under the GNU General Public License version 2.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Packer&lt;/strong&gt; creates a machine image by installing an operating system to
a multitude of local and cloud platforms, for example VMWare, VirtualBox
as well as Docker, Amazon EC2 and DigitalOcean. Packer is licensed under
the Mozilla Public License Version 2.0.&lt;/p&gt;
&lt;p&gt;How …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="zen" src="/images/zen-provisioning.jpg" style="width: 600px; height: 450px;" /&gt;&lt;/p&gt;
&lt;p&gt;I'm a big fan of the DevOps attitude of &amp;quot;cattle&amp;quot; versus &amp;quot;pets&amp;quot;: machines should
be built in a repeatable, automated and consistent way. If there's something
wrong, don't be afraid to replace a sick &amp;quot;cow&amp;quot; instead of trying to revive your
&amp;quot;pet&amp;quot;.&lt;/p&gt;
&lt;p&gt;This Zen mindset also helps when preparing for demos, trainings and workshops:
Usually I need a number of machines, and what better way than create them by
using automation ? For that I'm using the tools Ansible, Packer, Vagrant and
VirtualBox - they are all Open Source and can be used on a number of platforms
(e.g. Windows, Linux and Mac OS X).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ansible&lt;/strong&gt; is a tool for managing systems and deploying applications,
licensed under the GNU General Public License version 3 (my personal
favorite).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Vagrant&lt;/strong&gt; is a tool for managing virtual machines and is licensed
under the MIT license.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VirtualBox&lt;/strong&gt; is a virtualization environment for local use, licensed
under the GNU General Public License version 2.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Packer&lt;/strong&gt; creates a machine image by installing an operating system to
a multitude of local and cloud platforms, for example VMWare, VirtualBox
as well as Docker, Amazon EC2 and DigitalOcean. Packer is licensed under
the Mozilla Public License Version 2.0.&lt;/p&gt;
&lt;p&gt;How to solve the bootstrap problem and use Ansible to provision machines if you
haven't got Ansible installed (yet) ?&lt;/p&gt;
&lt;p&gt;This post contains the two (!) simple steps on how to set up a Vagrant Box
containing an Ansible server, packaged as a Vagrant box. This allows you to use
Ansible for provisioning all of your (future) (VirtualBox) installations.&lt;/p&gt;
&lt;div class="section" id="prerequisites"&gt;
&lt;h2&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;Make sure that the following tools are installed, up-to-date and can
be executed from the command line.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Vagrant&lt;/strong&gt; : &lt;a class="reference external" href="https://www.vagrantup.com"&gt;https://www.vagrantup.com&lt;/a&gt; (to configure and spin up
virtual machines)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VirtualBox&lt;/strong&gt; : &lt;a class="reference external" href="https://www.virtualbox.org/wiki/Downloads"&gt;https://www.virtualbox.org/wiki/Downloads&lt;/a&gt; (the
virtualization environment)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Start your favorite shell (e.g. zsh or Bash), and verify that the
tools are working:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;vagrant version &amp;amp;&amp;amp; VBoxManage --version &amp;amp;&amp;amp; echo &amp;quot;Hey Ho Let&amp;#39;s Go&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Clone the repository containing the necessary Ansible and Vagrant
files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git clone https://github.com/PeterMosmans/easy-provisioning &amp;amp;&amp;amp; pushd&lt;/span&gt;
&lt;span class="go"&gt;easy-provisioning&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="a-build-and-provision-ansible-on-debian"&gt;
&lt;h2&gt;1a: Build and provision Ansible on Debian&lt;/h2&gt;
&lt;p&gt;Before you start, if you want to add your own user account and public
SSH key to the Ansible server, create the file
&lt;pre&gt;
ansible/group_vars/personal.yml&lt;/pre&gt;
 - there is an example called
ansible/group_vars/personal-example.yml in the repository (see for more
information the corresponding Ansible Galaxy role,
&lt;a class="reference external" href="https://galaxy.ansible.com/PeterMosmans/bootstrap/"&gt;bootstrap&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The following one-liner will spin up a Debian box named &lt;pre&gt;
bootstrap&lt;/pre&gt;
, install
Ansible on it, and provision it for use with VirtualBox. It will also compact
the box, and shut it down:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pushd vagrant/ansible-server &amp;amp;&amp;amp; VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap&lt;/span&gt;
&lt;span class="go"&gt;vagrant up&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What happens ? By using the &lt;pre&gt;
VAGRANT_VAGRANTFILE&lt;/pre&gt;
 environment variable, an
alternative Vagrantfile is specified, &lt;pre&gt;
Vagrantfile.bootstrap&lt;/pre&gt;
. This file
contains parameters that will download a stock Debian installation, installs the
pip version of Ansible, installs the Ansible Galaxy roles specified in
&lt;pre&gt;
ansible/requirements.yml&lt;/pre&gt;
, runs the playbook &lt;pre&gt;
ansible/ansible-server.yml&lt;/pre&gt;
,
and runs a script to compact the box (that was installed by one of the Ansible
roles).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="b-package-the-ansible-server"&gt;
&lt;h2&gt;1b: Package the Ansible server&lt;/h2&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Use the following one-liner command to package the Ansible server as a
new Vagrantbox, and add it to the local catalog, ready to be used:&lt;/div&gt;
&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap vagrant package bootstrap --output&lt;/span&gt;
&lt;span class="go"&gt;ansible-server.box &amp;amp;&amp;amp; vagrant box add ansible-server.box --name&lt;/span&gt;
&lt;span class="go"&gt;ansible-server&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That's all there is to it! Now, you can spin up the Ansible server box anytime
using the command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;vagrant up&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;in the &lt;pre&gt;
vagrant/ansible-server&lt;/pre&gt;
 directory. The directory &lt;pre&gt;
/ansible&lt;/pre&gt;

in the repository is mapped on the VirtualBox to &lt;pre&gt;
/etc/ansible&lt;/pre&gt;
, so
the data persists across Vagrant 'reboots'.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Optionally you can shut down and remove the bootstrap box (as it's
already imported) using&lt;/div&gt;
&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap vagrant destroy &amp;amp;&amp;amp; rm&lt;/span&gt;
&lt;span class="go"&gt;ansible-server.box&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enjoy the Zen and power of Ansible...&lt;/p&gt;
&lt;/div&gt;
</content><category term="ansible"></category><category term="devops"></category><category term="packer"></category><category term="training"></category><category term="vagrant"></category></entry><entry><title>Compile Emacs for Windows using MSYS2 and mingw64</title><link href="https://www.onwebsecurity.com/configuration/compile-emacs-for-windows-using-msys2-and-mingw64.html" rel="alternate"></link><published>2016-09-19T14:25:00+00:00</published><updated>2017-06-27T15:07:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-09-19:/configuration/compile-emacs-for-windows-using-msys2-and-mingw64.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Emacs 25.1" src="/images/emacs.png" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Emacs 25.1 was officially released on September 17th, 2016. The
excellent &lt;a class="reference external" href="https://msys2.github.io/"&gt;MSYS2 subsystem&lt;/a&gt; and the open source gcc
compiler make it super-easy to build binaries on/for Windows (7, 8, 10). In
three easy steps from source to binaries:&lt;/p&gt;
&lt;div class="section" id="install-and-prepare-the-msys2-subsytem"&gt;
&lt;h2&gt;1: Install and prepare the MSYS2 subsytem&lt;/h2&gt;
&lt;p&gt;Download and run the installer at &lt;a class="reference external" href="http://repo.msys2.org/distrib/msys2-x86_64-latest.exe"&gt;http://repo.msys2.org/distrib/msys2-x86_64-latest.exe&lt;/a&gt;
After installing, run MSYS2 64bit which drops you in a Bash shell.
Update all packages using the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Syuu&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Sometimes updates of the runtime/filesystem can cause update errors. This is no
cause for panic - kill and restart the terminal. For building 64-bit Windows
binaries, always use &lt;code class="code"&gt;
mingw64.exe&lt;/code&gt;
 to start the terminal.&lt;/p&gt;
&lt;p&gt;Install all packages necessary for building:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Sy --noconfirm base-devel git \&lt;/span&gt;
&lt;span class="go"&gt;mingw-w64-x86_64-{giflib,gnutls,jbigkit,lib{jpeg-turbo,png,rsvg,tiff,xml2},toolchain,xpm-nox}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="clone-the-emacs-source"&gt;
&lt;h2&gt;2: Clone the Emacs source&lt;/h2&gt;
&lt;p&gt;To simplify building, you can define the environment variables &lt;code class="code"&gt;
BUILDDIR&lt;/code&gt;

(where the binaries are built), &lt;code class="code"&gt;
INSTALLDIR&lt;/code&gt;
 (where the binaries will be
installed to), and &lt;code class="code"&gt;
SOURCEDIR&lt;/code&gt;
 (where the source lives, the git
repository). Note that since you're in the MSYS2 subsystem, paths are
Unix-style, using forward slashes. This command creates &lt;code class="code"&gt;
SOURCEDIR&lt;/code&gt;
 if it
doesn't exist yet, clones the …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Emacs 25.1" src="/images/emacs.png" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Emacs 25.1 was officially released on September 17th, 2016. The
excellent &lt;a class="reference external" href="https://msys2.github.io/"&gt;MSYS2 subsystem&lt;/a&gt; and the open source gcc
compiler make it super-easy to build binaries on/for Windows (7, 8, 10). In
three easy steps from source to binaries:&lt;/p&gt;
&lt;div class="section" id="install-and-prepare-the-msys2-subsytem"&gt;
&lt;h2&gt;1: Install and prepare the MSYS2 subsytem&lt;/h2&gt;
&lt;p&gt;Download and run the installer at &lt;a class="reference external" href="http://repo.msys2.org/distrib/msys2-x86_64-latest.exe"&gt;http://repo.msys2.org/distrib/msys2-x86_64-latest.exe&lt;/a&gt;
After installing, run MSYS2 64bit which drops you in a Bash shell.
Update all packages using the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Syuu&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Sometimes updates of the runtime/filesystem can cause update errors. This is no
cause for panic - kill and restart the terminal. For building 64-bit Windows
binaries, always use &lt;code class="code"&gt;
mingw64.exe&lt;/code&gt;
 to start the terminal.&lt;/p&gt;
&lt;p&gt;Install all packages necessary for building:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;pacman -Sy --noconfirm base-devel git \&lt;/span&gt;
&lt;span class="go"&gt;mingw-w64-x86_64-{giflib,gnutls,jbigkit,lib{jpeg-turbo,png,rsvg,tiff,xml2},toolchain,xpm-nox}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="clone-the-emacs-source"&gt;
&lt;h2&gt;2: Clone the Emacs source&lt;/h2&gt;
&lt;p&gt;To simplify building, you can define the environment variables &lt;code class="code"&gt;
BUILDDIR&lt;/code&gt;

(where the binaries are built), &lt;code class="code"&gt;
INSTALLDIR&lt;/code&gt;
 (where the binaries will be
installed to), and &lt;code class="code"&gt;
SOURCEDIR&lt;/code&gt;
 (where the source lives, the git
repository). Note that since you're in the MSYS2 subsystem, paths are
Unix-style, using forward slashes. This command creates &lt;code class="code"&gt;
SOURCEDIR&lt;/code&gt;
 if it
doesn't exist yet, clones the repository in &lt;code class="code"&gt;
SOURCEDIR&lt;/code&gt;
, and runs the
&lt;code class="code"&gt;
autogen.sh&lt;/code&gt;
 script to create a configure script.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt; SOURCEDIR=c:/var/git/emacs &amp;amp;&amp;amp; mkdir -p $SOURCEDIR &amp;amp;&amp;amp; cd $SOURCEDIR &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span class="go"&gt; git clone git://git.savannah.gnu.org/emacs.git . --depth=1 &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span class="go"&gt;./autogen.sh&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="update-build-and-install-emacs"&gt;
&lt;h2&gt;3: Update, build and install Emacs&lt;/h2&gt;
&lt;p&gt;This updates the repository, empties and/or creates &lt;code class="code"&gt;
BUILDDIR&lt;/code&gt;
, and
runs &lt;code class="code"&gt;
make&lt;/code&gt;
 to build a binary. Afterwards it installs a stripped
version of Emacs to &lt;code class="code"&gt;
INSTALLDIR&lt;/code&gt;
.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;SOURCEDIR=c:/var/git/emacs INSTALLDIR=c:/programs/emacs \&lt;/span&gt;
&lt;span class="go"&gt;BUILDDIR=t:/emacs &amp;amp;&amp;amp; pushd $SOURCEDIR &amp;amp;&amp;amp; git reset --hard HEAD &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span class="go"&gt;git fetch &amp;amp;&amp;amp; git checkout origin/master &amp;amp;&amp;amp; rm -rf $BUILDDIR &amp;amp;&amp;gt;/dev/null&lt;/span&gt;
&lt;span class="go"&gt;mkdir -p $BUILDDIR; pushd $BUILDDIR &amp;amp;&amp;amp; $SOURCEDIR/configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp;&lt;/span&gt;
&lt;span class="go"&gt;make install-strip prefix=$INSTALLDIR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And listo! After having installed MSYS2, only &lt;em&gt;step 3&lt;/em&gt; needs to be
repeated to update the binary to the latest git version.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="optional-copy-necessary-libraries"&gt;
&lt;h2&gt;Optional: copy necessary libraries&lt;/h2&gt;
&lt;p&gt;To run Emacs on a system without MSYS2, one needs to copy a number of
libraries to the installation directory.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;INSTALLDIR=c:/programs/emacs cp&lt;/span&gt;
&lt;span class="go"&gt;/mingw64/bin/{zlib\*,lib{winpthread-\*,Xpm-noX\*,gomp-\*,gcc\_s\_seh-\*,glib-\*,intl-\*,iconv-\*,gobject-\*,ffi-\*,gio-\*,gmodule-\*,freetype-\*,pixman-\*,png\*,expat-\*,harfbuzz-\*,gnutls-\*,gnutlsxx-\*,tiff-\*,tiffxx-\*,jpeg-\*,gif-\*,bz2-\*,jbig-\*,gmp-\*,hogweed-\*,nettle-\*,p11-kit-\*,tasn1-\*}}.dll&lt;/span&gt;
&lt;span class="gp"&gt;$&lt;/span&gt;INSTALLDIR/bin
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</content><category term="emacs"></category><category term="msys2"></category><category term="windows"></category></entry><entry><title>Are you a PenTexter ? Now in BSidesLV</title><link href="https://www.onwebsecurity.com/announcements/are-you-a-pentexter-now-in-bsideslv.html" rel="alternate"></link><published>2016-07-26T08:15:00+00:00</published><updated>2016-07-26T08:15:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-07-26:/announcements/are-you-a-pentexter-now-in-bsideslv.html</id><summary type="html">&lt;p&gt;&lt;img alt="BSidesLV" src="/images/bsideslv.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;If you're around in Las Vegas during BlackHat / BSidesLV / DefCon, I'll
be presenting at BSidesLV 2016 together with Melanie Rieback on an open
source pentest reporting framework.&lt;/p&gt;
&lt;p&gt;The talk will announce a new OWASP project: PenText, a fully
open-sourced XML-based pentest document automation system. The PenText
system is a document automation framework that supports the entire
pentesting lifecycle: from the initial inquiry, through pentest scoping,
quotations, pentesting, and reporting, through the final invoice.&lt;/p&gt;
&lt;p&gt;During this talk, Melanie and I will demonstrate the OWASP PenText
system live, in the context of our larger Pentesting ChatOps
infrastructure (RocketChat, Hubot, and Gitlab). We will describe the
basics of how the OWASP PenText system is architected (XML, XSLT,
XSL-FO), and show how the system can be used to manage the entire
lifecycle of pentesting data, including the automatic generation of
documentation at various points in the process (including quotations,
pentest reports, and invoices).&lt;/p&gt;
&lt;p&gt;Lots of ChatOps in combination with pentesting and open source.&lt;/p&gt;
&lt;p&gt;See
&lt;a class="reference external" href="https://bsideslv2016.sched.org/event/7azc/are-you-a-pentexter-open-sourcing-pentest-reporting-and-automation"&gt;https://bsideslv2016.sched.org/event/7azc/are-you-a-pentexter-open-sourcing-pentest-reporting-and-automation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;See you there ?&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img alt="BSidesLV" src="/images/bsideslv.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;If you're around in Las Vegas during BlackHat / BSidesLV / DefCon, I'll
be presenting at BSidesLV 2016 together with Melanie Rieback on an open
source pentest reporting framework.&lt;/p&gt;
&lt;p&gt;The talk will announce a new OWASP project: PenText, a fully
open-sourced XML-based pentest document automation system. The PenText
system is a document automation framework that supports the entire
pentesting lifecycle: from the initial inquiry, through pentest scoping,
quotations, pentesting, and reporting, through the final invoice.&lt;/p&gt;
&lt;p&gt;During this talk, Melanie and I will demonstrate the OWASP PenText
system live, in the context of our larger Pentesting ChatOps
infrastructure (RocketChat, Hubot, and Gitlab). We will describe the
basics of how the OWASP PenText system is architected (XML, XSLT,
XSL-FO), and show how the system can be used to manage the entire
lifecycle of pentesting data, including the automatic generation of
documentation at various points in the process (including quotations,
pentest reports, and invoices).&lt;/p&gt;
&lt;p&gt;Lots of ChatOps in combination with pentesting and open source.&lt;/p&gt;
&lt;p&gt;See
&lt;a class="reference external" href="https://bsideslv2016.sched.org/event/7azc/are-you-a-pentexter-open-sourcing-pentest-reporting-and-automation"&gt;https://bsideslv2016.sched.org/event/7azc/are-you-a-pentexter-open-sourcing-pentest-reporting-and-automation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;See you there ?&lt;/p&gt;
</content><category term="pentext"></category></entry><entry><title>Verifying webserver compression - BREACH attack</title><link href="https://www.onwebsecurity.com/security/verifying-webserver-compression-breach-attack.html" rel="alternate"></link><published>2016-06-28T03:21:00+00:00</published><updated>2016-06-28T03:21:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-06-28:/security/verifying-webserver-compression-breach-attack.html</id><summary type="html">&lt;p&gt;&lt;img alt="BREACH attack" src="/images/breach.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;A few lines of Bash script let you check which compression methods are
supported by a SSL/TLS-enabled webserver.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt; target=URL-OF-TARGET&lt;/span&gt;
&lt;span class="go"&gt;for compression in compress deflate exi gzip identity pack200-gzip br&lt;/span&gt;
&lt;span class="go"&gt;bzip2 lzma peerdist sdch xpress xz; do&lt;/span&gt;
&lt;span class="go"&gt;curl -ksI -H &amp;quot;Accept-Encoding: ${compression}&amp;quot; https://${target} | grep -i ${compression}&lt;/span&gt;
&lt;span class="go"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;If you see any output (and the server supports one of these
compression algorithms), the site &lt;em&gt;might&lt;/em&gt; be vulnerable to a BREACH
attack. Might, because an attacker has to 'inject' content into the
output (and have some control over it): This is called a chosen
plaintext attack.&lt;/div&gt;
&lt;div class="line"&gt;By carefully injecting certain content to the page, an attacker is
able to deduce (parts) of the page content by merely looking at the
response size (speed). An attacker therefore also has to be able to
observe the server's response. A third prerequisite is that the secret
(that an attacker wants to steal) is contained in the server
response's body, and not 'just' in the response's header. Cookies are
therefore out of scope.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The easiest mitigation is to disable HTTP compression completely. Other
less practical mitigations are adding random content to each page, which
changes the compressed size per page request, rate limiting the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="BREACH attack" src="/images/breach.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;A few lines of Bash script let you check which compression methods are
supported by a SSL/TLS-enabled webserver.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt; target=URL-OF-TARGET&lt;/span&gt;
&lt;span class="go"&gt;for compression in compress deflate exi gzip identity pack200-gzip br&lt;/span&gt;
&lt;span class="go"&gt;bzip2 lzma peerdist sdch xpress xz; do&lt;/span&gt;
&lt;span class="go"&gt;curl -ksI -H &amp;quot;Accept-Encoding: ${compression}&amp;quot; https://${target} | grep -i ${compression}&lt;/span&gt;
&lt;span class="go"&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;If you see any output (and the server supports one of these
compression algorithms), the site &lt;em&gt;might&lt;/em&gt; be vulnerable to a BREACH
attack. Might, because an attacker has to 'inject' content into the
output (and have some control over it): This is called a chosen
plaintext attack.&lt;/div&gt;
&lt;div class="line"&gt;By carefully injecting certain content to the page, an attacker is
able to deduce (parts) of the page content by merely looking at the
response size (speed). An attacker therefore also has to be able to
observe the server's response. A third prerequisite is that the secret
(that an attacker wants to steal) is contained in the server
response's body, and not 'just' in the response's header. Cookies are
therefore out of scope.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The easiest mitigation is to disable HTTP compression completely. Other
less practical mitigations are adding random content to each page, which
changes the compressed size per page request, rate limiting the
requests, or changing the secret per request.&lt;/p&gt;
&lt;p&gt;See for more information &lt;a class="reference external" href="http://breachattack.com/"&gt;http://breachattack.com/&lt;/a&gt;&lt;/p&gt;
</content><category term="openssl"></category><category term="pentesting"></category><category term="tls"></category></entry><entry><title>Automating OAuth 2.0 / JWT token retrieval for pentests</title><link href="https://www.onwebsecurity.com/security/automating-oauth-2-0-jwt-token-retrieval-for-pentests.html" rel="alternate"></link><published>2016-06-21T02:50:00+00:00</published><updated>2016-06-21T02:50:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-06-21:/security/automating-oauth-2-0-jwt-token-retrieval-for-pentests.html</id><summary type="html">&lt;p&gt;&lt;img alt="OAuth 2.0" src="/images/oauth.png" /&gt;&lt;/p&gt;
&lt;p&gt;Recently I was pentesting a complex API which used the OAuth 2.0 framework for
authentication. Each API call needed an &lt;code class="code"&gt;
Authorization: Bearer&lt;/code&gt;
 header,
containing a valid JSON Web Token (JWT).&lt;/p&gt;
&lt;p&gt;To access the API I needed a lot of JWT tokens, as the tokens had a very short
expiry time. To facilitate the quick generation of tokens I created a basic
script that automated the OAuth authorization: It logs on to a domain, requests
an authorization code, and converts that token to an authorization token.&lt;/p&gt;
&lt;p&gt;One or more of these steps can be circumvented by command line options (e.g. by
specifying valid cookies), to speed up the process.&lt;/p&gt;
&lt;p&gt;Another feature of the script is that it automatically performs GET, POST, PUTs
and DELETEs with valid tokens against a list of API endpoints (URLs). This
preloads all API calls into a(n) (attacking) proxy, and helped the pentest speed
up tremendously.&lt;/p&gt;
&lt;div class="section" id="json-web-tokens"&gt;
&lt;h2&gt;JSON Web Tokens&lt;/h2&gt;
&lt;p&gt;A JSON Web Token (JWT) is basically a string, representing a collection of one
or more claims. Claims are name/value pairs which state information about a user
or subject. The claims are either signed using a JSON Web Signature (JWS) or
encrypted using JSON …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="OAuth 2.0" src="/images/oauth.png" /&gt;&lt;/p&gt;
&lt;p&gt;Recently I was pentesting a complex API which used the OAuth 2.0 framework for
authentication. Each API call needed an &lt;code class="code"&gt;
Authorization: Bearer&lt;/code&gt;
 header,
containing a valid JSON Web Token (JWT).&lt;/p&gt;
&lt;p&gt;To access the API I needed a lot of JWT tokens, as the tokens had a very short
expiry time. To facilitate the quick generation of tokens I created a basic
script that automated the OAuth authorization: It logs on to a domain, requests
an authorization code, and converts that token to an authorization token.&lt;/p&gt;
&lt;p&gt;One or more of these steps can be circumvented by command line options (e.g. by
specifying valid cookies), to speed up the process.&lt;/p&gt;
&lt;p&gt;Another feature of the script is that it automatically performs GET, POST, PUTs
and DELETEs with valid tokens against a list of API endpoints (URLs). This
preloads all API calls into a(n) (attacking) proxy, and helped the pentest speed
up tremendously.&lt;/p&gt;
&lt;div class="section" id="json-web-tokens"&gt;
&lt;h2&gt;JSON Web Tokens&lt;/h2&gt;
&lt;p&gt;A JSON Web Token (JWT) is basically a string, representing a collection of one
or more claims. Claims are name/value pairs which state information about a user
or subject. The claims are either signed using a JSON Web Signature (JWS) or
encrypted using JSON Web Encryption (JWE). JSON Web Tokens serve as
self-contained &lt;strong&gt;authorization&lt;/strong&gt; tokens, represented using JWS or JWE compact
serialization.&lt;/p&gt;
&lt;p&gt;A token string consists of a header, payload and optional signature, all base-64
encoded and separated by a dot. An example in python using python-jwt is&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# The namespace has changed from jwt to python_jwt from version 2.0.1&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;python_jwt&lt;/span&gt; &lt;span class="kn"&gt;as&lt;/span&gt; &lt;span class="nn"&gt;jwt&lt;/span&gt;
&lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;jwt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;generate_jwt&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;value&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;none&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
eyJhbGciOiAibm9uZSIsICJ0eXAiOiAiSldUIn0.eyJpYXQiOiAxNDY2NDY5NDU5LCAianRpIjogIkE2RDVMOGRyV0VjREdhMTNnRW5lU3c9PSIsICJuYW1lIjogInZhbHVlIiwgIm5iZiI6IDE0NjY0Njk0NTl9.
&lt;/pre&gt;
&lt;p&gt;The first part contains the header, declaring that the encoded object is a JWT,
and that the payload is a JWT having no encryption/signature (note that I add
some base64 padding for null bytes, as the base64 library mandates this):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;base64&lt;/span&gt;
&lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;eyJhbGciOiAibm9uZSIsICJ0eXAiOiAiSldUIn0&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;padded_header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;=&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;b64decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;padded_header&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;alg&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;none&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;&amp;quot;typ&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;JWT&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The payload decodes to another JSON object, containing the claims, and
some other items (issue time &lt;code class="code"&gt;
iat&lt;/code&gt;
, unique identifier &lt;code class="code"&gt;
jti&lt;/code&gt;
 and not
before time &lt;code class="code"&gt;
nbf&lt;/code&gt;
):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;base64&lt;/span&gt;
&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;eyJpYXQiOiAxNDY2NDY5NDU5LCAianRpIjogIkE2RDVMOGRyV0VjREdhMTNnRW5lU3c9PSIsICJuYW1lIjogInZhbHVlIiwgIm5iZiI6IDE0NjY0Njk0NTl9&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;padded_payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;=&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;b64decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;padded_payload&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;iat&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1466469459&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;&amp;quot;jti&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;A6D5L8drWEcDGa13gEneSw==&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;&amp;quot;nbf&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1466469459&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this instance, the claim consists of 'name' = 'value'.&lt;/p&gt;
&lt;p&gt;The last part, the signature is empty, as I chose 'none' as signature algorithm,
which resulted in an unsecured JWT.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="oauth-2-0"&gt;
&lt;h2&gt;OAuth 2.0&lt;/h2&gt;
&lt;p&gt;OAuth is a framework used for authentication: Say user U wants to use API A. To
use the API a user has to be authorized by domain D, the so-called Authorization
Endpoint.&lt;/p&gt;
&lt;p&gt;First the user logs onto the Authorization Endpoint using valid credentials (for
example a valid username/password), and asking permission to access API A. If
the domain authorizes user U to use the API, it can hand out an authorization
code to the user. The user is then redirected to the Redirect Endpoint (usually
the API).&lt;/p&gt;
&lt;p&gt;This again redirects the user to the Token Endpoint (usually again Domain D),
after which the authorization server hands out the token, containing a claim
that user U is validated by domain D to use API A.&lt;/p&gt;
&lt;p&gt;Now when user U wants to access API A, it sends along a
&lt;code class="code"&gt;
Authorization: Bearer&lt;/code&gt;
 HTTP header, accompanied by the token. In this
case, the token was a JSON Web Token.&lt;/p&gt;
&lt;p&gt;The next automation step for the script could be that valid tokens are
automatically generated, used or renewed by the attack proxy (Burp Suite Pro in
my case). Due to a lack of time this hasn't been done during that particular
pentest: It's always a fine line when automating pentests still makes sense
versus 'manual' testing.&lt;/p&gt;
&lt;p&gt;You can find the script at &lt;a class="reference external" href="https://github.com/radicallyopensecurity/pentesting-scripts/blob/master/apiborker.py"&gt;https://github.com/radicallyopensecurity/pentesting-scripts/blob/master/apiborker.py&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Feedback, improvements and especially pull requests are always welcome.&lt;/p&gt;
&lt;p&gt;See &lt;a class="reference external" href="https://tools.ietf.org/html/rfc7519"&gt;https://tools.ietf.org/html/rfc7519&lt;/a&gt; for more information on JSON Web
Tokens, &lt;a class="reference external" href="https://tools.ietf.org/html/rfc7797"&gt;https://tools.ietf.org/html/rfc7797&lt;/a&gt; for more information on JSON
Web Signatures (JWS) and &lt;a class="reference external" href="http://oauth.net/2/"&gt;http://oauth.net/2/&lt;/a&gt; on OAuth2.&lt;/p&gt;
&lt;/div&gt;
</content><category term="pentesting"></category><category term="tools"></category><category term="oauth2"></category></entry><entry><title>Getting to know your pentesting tools - curl and the HTTP/1.0 protocol</title><link href="https://www.onwebsecurity.com/security/getting-to-know-your-pentesting-tools-curl-and-the-http1-0-protocol.html" rel="alternate"></link><published>2016-05-27T03:32:00+00:00</published><updated>2016-05-27T03:32:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-05-27:/security/getting-to-know-your-pentesting-tools-curl-and-the-http1-0-protocol.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Tooling is important" src="/images/getting-to-know-your-pentesting-tools.jpg" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When pentesting, it's always handy to have a bunch of automated
scanner do the grunt work for you. Using automated tools saves time
and can help in spotting potential vulnerabilities. Usually I run
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;analyze_hosts.py&lt;/a&gt;,
a wrapper around the open source tools droopescan, nmap, nikto,
Wappalyzer and WPscan, with a bit of intelligence built in.&lt;/p&gt;
&lt;p&gt;Recently I had a pentesting engagement where nikto flagged a IIS server as
leaking the internal IP address (see
&lt;a class="reference external" href="https://support.microsoft.com/en-us/kb/218180"&gt;https://support.microsoft.com/en-us/kb/218180&lt;/a&gt; for more information).&lt;/p&gt;
&lt;p&gt;This is a very common issue with older, unhardened IIS servers.
The issue is triggered when a HTTP 1.0 request is made to the server,
without supplying a &lt;strong&gt;Host&lt;/strong&gt; header. The resulting
&lt;strong&gt;Content-Location&lt;/strong&gt; header will contain the server's (private) IP
address, thereby leaking information which can subsequently be used
for other attacks.&lt;/p&gt;
&lt;p&gt;Example of a server's partial response:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;HTTP/1.1 200 OK Content-Location: http://1.1.1.1/Default.htm&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I ran into an interesting observation when I needed to reproduce this using
&lt;a class="reference external" href="https://curl.haxx.se"&gt;curl&lt;/a&gt;. Curl is a great tool do do all kinds of HTTP
requests on-the fly, and it's very well suited for scripting. It has flags to
specify the protocol (e.g …&lt;/p&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Tooling is important" src="/images/getting-to-know-your-pentesting-tools.jpg" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When pentesting, it's always handy to have a bunch of automated
scanner do the grunt work for you. Using automated tools saves time
and can help in spotting potential vulnerabilities. Usually I run
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;analyze_hosts.py&lt;/a&gt;,
a wrapper around the open source tools droopescan, nmap, nikto,
Wappalyzer and WPscan, with a bit of intelligence built in.&lt;/p&gt;
&lt;p&gt;Recently I had a pentesting engagement where nikto flagged a IIS server as
leaking the internal IP address (see
&lt;a class="reference external" href="https://support.microsoft.com/en-us/kb/218180"&gt;https://support.microsoft.com/en-us/kb/218180&lt;/a&gt; for more information).&lt;/p&gt;
&lt;p&gt;This is a very common issue with older, unhardened IIS servers.
The issue is triggered when a HTTP 1.0 request is made to the server,
without supplying a &lt;strong&gt;Host&lt;/strong&gt; header. The resulting
&lt;strong&gt;Content-Location&lt;/strong&gt; header will contain the server's (private) IP
address, thereby leaking information which can subsequently be used
for other attacks.&lt;/p&gt;
&lt;p&gt;Example of a server's partial response:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;HTTP/1.1 200 OK Content-Location: http://1.1.1.1/Default.htm&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I ran into an interesting observation when I needed to reproduce this using
&lt;a class="reference external" href="https://curl.haxx.se"&gt;curl&lt;/a&gt;. Curl is a great tool do do all kinds of HTTP
requests on-the fly, and it's very well suited for scripting. It has flags to
specify the protocol (e.g. &lt;strong&gt;--http1.0&lt;/strong&gt;, &lt;strong&gt;--http1.1&lt;/strong&gt; and
&lt;strong&gt;--http2&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;However, this only changes the protocol version in the
Request-Line (the first line of the HTTP protocol). It doesn't change anything
to the request itself. That means if you would use curl with the HTTP/1.0
parameter to verify the vulnerability, it would fail. You wouldn't find it
using that command. It does something different than you would expect&lt;/p&gt;
&lt;p&gt;Although the &lt;a class="reference external" href="http://tools.ietf.org/html/rfc1945.html"&gt;RFC 1945&lt;/a&gt; doesn't define the request headers &lt;strong&gt;Accept&lt;/strong&gt;,
&lt;strong&gt;Connection&lt;/strong&gt; and &lt;strong&gt;Host&lt;/strong&gt;, when you ask curl to use the HTTP/1.0 protocol it
still sends those headers. This means that the request is strictly speaking non
HTTP/1.0 compliant, not what you might expect when using the &lt;strong&gt;--http1.0&lt;/strong&gt; flag.&lt;/p&gt;
&lt;p&gt;So when verifying the IIS leaking internal vulnerability, one cannot 'simply'
use curl by specifying the HTTP/1.0 flag (&lt;strong&gt;-0&lt;/strong&gt; or &lt;strong&gt;--http1.0&lt;/strong&gt;). Curl doesn't
follow the HTTP/1.0 protocol here to the letter...&lt;/p&gt;
&lt;p&gt;The command &lt;pre&gt;
curl http://extract.pw/ --http1.0&lt;/pre&gt;
 will result in the following
request:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;GET / HTTP/1.0 Host: extract.pw User-Agent: curl/7.48.0 \&lt;/span&gt;
&lt;span class="err"&gt;Accept: */* Connection: close&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;User-Agent is actually the only request header that is defined in the
official HTTP/1.0 RFC. About the 'additional' headers the RFC has the
following statement:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
&amp;quot;Request-Header field names can be extended reliably only in
combination with a change in the protocol version. However, new or
experimental header fields may be given the semantics of request
header fields if all parties in the communication recognize them to
be request header fields. Unrecognized header fields are treated as
Entity-Header fields.&amp;quot;
&lt;/pre&gt;
&lt;p&gt;Even though &lt;strong&gt;Accept&lt;/strong&gt;, &lt;strong&gt;Connection&lt;/strong&gt; and &lt;strong&gt;Host&lt;/strong&gt; are not official
part of the HTTP/1.0 specification, they are very common. To make a curl
request almost completely HTTP/1.0 compliant, one has to overwrite the
non-HTTP/1.0 fields (I say almost, as it seems impossible with curl to
overwrite/remove the connection header - this field was introduced in
HTTP/1.1 (RFC 2068):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;curl http://example.com/ --http1.0 --header &amp;#39;Accept:&amp;#39; --header &amp;#39;Connection:&amp;#39; --header &amp;#39;Host:&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will result in the following request:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;GET / HTTP/1.0 User-Agent: curl/7.48.0 Connection: close&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And indeed, with this command one can reproduce the earlier mentioned IIS
vulnerability.&lt;/p&gt;
&lt;p&gt;Lesson learned: spending time on getting to know (the quirks of) your tools is
time well spent...&lt;/p&gt;
</content><category term="pentesting"></category></entry><entry><title>Automating repetitive git / setup tasks</title><link href="https://www.onwebsecurity.com/configuration/automating-repetitive-git-setup-tasks.html" rel="alternate"></link><published>2016-04-14T06:57:00+00:00</published><updated>2016-04-14T06:57:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-04-14:/configuration/automating-repetitive-git-setup-tasks.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="repetitite work" src="/images/repetitive.jpg" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Imagine you work on a large number of projects. Each of those projects has its
own git repository and accompanying notes file outside of the repo. Each git
repository has its own githooks and custom setup.&lt;/p&gt;
&lt;p&gt;Imagine having to work with multiple namespaces on different remote servers.
Imagine setting up these projects by hand, multiple times a week.&lt;/p&gt;
&lt;p&gt;Automation to the rescue ! Where I usually use Bash shell scripts to automate
workflows, I'm moving more and more towards Python. It's cross-platform and
sometimes easier to work with, as you have a large number of libraries at your
disposal.&lt;/p&gt;
&lt;p&gt;I wrote a simple &lt;a class="reference external" href="https://github.com/PeterMosmans/git-utilities/blob/master/setuprepo.py"&gt;Python script&lt;/a&gt; that
does all of those things more or less 'automated'. Feed the script the &lt;em&gt;name&lt;/em&gt; of
the repository you want to clone, and optionally a &lt;em&gt;namespace&lt;/em&gt;, &lt;em&gt;patchfile&lt;/em&gt; and
&lt;em&gt;templatefile&lt;/em&gt; variable (either command-line or using a configuration file). The
script will then:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;clone the repository&lt;/li&gt;
&lt;li&gt;modify the repository (e.g. apply githooks)&lt;/li&gt;
&lt;li&gt;optionally modify the repository based on given variables&lt;/li&gt;
&lt;li&gt;create a new notes file from a template&lt;/li&gt;
&lt;li&gt;optionally modify the notes file based on given variables&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The advantage is that you can use a configuration file containing the
location of the remote git repository, the patchfile …&lt;/p&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="repetitite work" src="/images/repetitive.jpg" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Imagine you work on a large number of projects. Each of those projects has its
own git repository and accompanying notes file outside of the repo. Each git
repository has its own githooks and custom setup.&lt;/p&gt;
&lt;p&gt;Imagine having to work with multiple namespaces on different remote servers.
Imagine setting up these projects by hand, multiple times a week.&lt;/p&gt;
&lt;p&gt;Automation to the rescue ! Where I usually use Bash shell scripts to automate
workflows, I'm moving more and more towards Python. It's cross-platform and
sometimes easier to work with, as you have a large number of libraries at your
disposal.&lt;/p&gt;
&lt;p&gt;I wrote a simple &lt;a class="reference external" href="https://github.com/PeterMosmans/git-utilities/blob/master/setuprepo.py"&gt;Python script&lt;/a&gt; that
does all of those things more or less 'automated'. Feed the script the &lt;em&gt;name&lt;/em&gt; of
the repository you want to clone, and optionally a &lt;em&gt;namespace&lt;/em&gt;, &lt;em&gt;patchfile&lt;/em&gt; and
&lt;em&gt;templatefile&lt;/em&gt; variable (either command-line or using a configuration file). The
script will then:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;clone the repository&lt;/li&gt;
&lt;li&gt;modify the repository (e.g. apply githooks)&lt;/li&gt;
&lt;li&gt;optionally modify the repository based on given variables&lt;/li&gt;
&lt;li&gt;create a new notes file from a template&lt;/li&gt;
&lt;li&gt;optionally modify the notes file based on given variables&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The advantage is that you can use a configuration file containing the
location of the remote git repository, the patchfile and the
templatefile. If you setup multiple repositories from the same location
and use the same repetitive tasks (e.g. adding git hooks for XML
validation), this can save you a lot of time (at least it saves &lt;em&gt;me&lt;/em&gt; a
lot of time...).&lt;/p&gt;
&lt;p&gt;Example of cloning a basic repo to the location &lt;code class="code"&gt;
/var/git/&lt;/code&gt;
:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;setuprepo.py git-utilities --remote https://github.com --namespace&lt;/span&gt;
&lt;span class="go"&gt;PeterMosmans --target /var/git&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will perform a basic clone of the repo
&lt;a class="reference external" href="https://github.com/PeterMosmans/git-utilities"&gt;https://github.com/PeterMosmans/git-utilities&lt;/a&gt; to &lt;code class="code"&gt;
/var/git/&lt;/code&gt;
.&lt;/p&gt;
&lt;p&gt;If you usually set up some git-specific parameters like the author's
email address, and git hooks for XML validation, then you could apply
these automatically. First create a patchfile which applies the hooks
(see for an example which adds the git hooks for XML validation), and
specify that patchfile:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;setuprepo.py git-utilities --remote https://github.com --namespace&lt;/span&gt;
&lt;span class="go"&gt;PeterMosmans --patch hooks.patch&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Besides cloning to the current directory (as no target is specified), this will
apply the patchfile &lt;code class="code"&gt;
git.patch&lt;/code&gt;
. Before patching, it will automatically
replace the keywords &lt;code class="code"&gt;
NAMESPACE&lt;/code&gt;
, &lt;code class="code"&gt;
REMOTE&lt;/code&gt;
, &lt;code class="code"&gt;
REPO&lt;/code&gt;
 and
&lt;code class="code"&gt;
TARGET&lt;/code&gt;
 with the corresponding variables.&lt;/p&gt;
&lt;p&gt;If you create a notes file for each project from a templates file
(outside of the repository directory) you could do that like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;setuprepo.py git-utilities --remote https://github.com --namespace&lt;/span&gt;
&lt;span class="go"&gt;PeterMosmans --template MY-NOTES --notes /location/of/notes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Again, this will replace the keywords &lt;code class="code"&gt;
NAMESPACE&lt;/code&gt;
, &lt;code class="code"&gt;
REMOTE&lt;/code&gt;
,
&lt;code class="code"&gt;
REPO&lt;/code&gt;
 and &lt;code class="code"&gt;
TARGET&lt;/code&gt;
 in MY-NOTES with the corresponding variables.&lt;/p&gt;
&lt;p&gt;And that's where the script really shines: You can specify all
parameters in a configuration file, and specify that configuration file
on the command line. So, you're setting up the remote, the namespace and
the locations in the config file once, and you can use it a gazillion
times:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;setuprepo.py NAME-OF-REPO --config github.yml&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The format of the configuration file (in this example &lt;code class="code"&gt;
github.yml&lt;/code&gt;
) is&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;namespace: PeterMosmans
notes: /location/where/notes/should/be/stored
patchfile: /location/of/patch.file
remote: https://github.com
target: /where/repositories/are/cloned/to
template: /base/template.txt
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can find the script at
&lt;a class="reference external" href="https://github.com/PeterMosmans/git-utilities/blob/master/setuprepo.py"&gt;https://github.com/PeterMosmans/git-utilities/blob/master/setuprepo.py&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Enjoy !&lt;/p&gt;
&lt;pre class="literal-block"&gt;
usage: setuprepo.py [-h] [-c CONFIG] [-r REMOTE] [-n NAMESPACE] [--no-clone]
                    [--no-modify] [--no-patch] [--no-template]
                    [--patchfile PATCHFILE] [--prepare] [-t TARGET]
                    [--notes NOTES] [--template TEMPLATE] [-v]
                    repo

setuprepo.py version 0.6 - Clones and configures (patches) a git repository

Copyright (C) 2016 Peter Mosmans [Go Forward]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

positional arguments:
  repo                  repository name

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        load config file
  -r REMOTE, --remote REMOTE
                        remote repository address
  -n NAMESPACE, --namespace NAMESPACE
                        namespace of the repository
  --no-clone            do not clone repository
  --no-modify           do not modify patch and/or template
  --no-patch            do not patch repository
  --no-template         do not create template
  --patchfile PATCHFILE
                        patchfile for new repositories
  --prepare             clone the repo, create an original and modified
                        folder, and exit
  -t TARGET, --target TARGET
                        local target for the repository structure
  --notes NOTES         the directory where to create a notes file
  --template TEMPLATE   an empty notes template
  -v, --verbose         Be more verbose
&lt;/pre&gt;
</content><category term="git"></category><category term="tools"></category></entry><entry><title>Bash vs Python (dependency hell)</title><link href="https://www.onwebsecurity.com/opinion/bash-vs-python-dependency-hell.html" rel="alternate"></link><published>2016-01-31T04:11:00+00:00</published><updated>2016-01-31T04:11:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2016-01-31:/opinion/bash-vs-python-dependency-hell.html</id><summary type="html">&lt;p&gt;For a number of years I maintained a &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;small collection of open source
security scripts&lt;/a&gt;,
written in Bash. The main purpose of these scripts was to act as a
wrapper around other open source tools. Why try to remember long and
awkward command line parameters, when you can ask a script to do that
for you ?&lt;/p&gt;
&lt;p&gt;Bash was chosen, as it was distribution-independent. It works almost
everywhere (although sometimes OSX support is troublesome, due to
outdated Bash versions).&lt;/p&gt;
&lt;p&gt;After more and more (requested) features crept in, the
&lt;pre&gt;
analyze_hosts.sh&lt;/pre&gt;
 Bash script became more and more complex. That's
why I decided to port the script to Python. In my experience, it's
at-least-as portable, and the usage of third party (pip) packages means
that less time is spent on re-inventing the weel, and more on the actual
functionality.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Yes, sometimes people talk about the dependency hell of Python, and in
some cases, the usage of third party packages means you have to be
careful of what you're doing.&lt;/div&gt;
&lt;div class="line"&gt;However, when using virtual environments each Python script and its
dependencies can be safely separated from the 'main' Python. For
example, the following commands create a separate virtual environment
for the security scripts repo …&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;For a number of years I maintained a &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;small collection of open source
security scripts&lt;/a&gt;,
written in Bash. The main purpose of these scripts was to act as a
wrapper around other open source tools. Why try to remember long and
awkward command line parameters, when you can ask a script to do that
for you ?&lt;/p&gt;
&lt;p&gt;Bash was chosen, as it was distribution-independent. It works almost
everywhere (although sometimes OSX support is troublesome, due to
outdated Bash versions).&lt;/p&gt;
&lt;p&gt;After more and more (requested) features crept in, the
&lt;pre&gt;
analyze_hosts.sh&lt;/pre&gt;
 Bash script became more and more complex. That's
why I decided to port the script to Python. In my experience, it's
at-least-as portable, and the usage of third party (pip) packages means
that less time is spent on re-inventing the weel, and more on the actual
functionality.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Yes, sometimes people talk about the dependency hell of Python, and in
some cases, the usage of third party packages means you have to be
careful of what you're doing.&lt;/div&gt;
&lt;div class="line"&gt;However, when using virtual environments each Python script and its
dependencies can be safely separated from the 'main' Python. For
example, the following commands create a separate virtual environment
for the security scripts repo:&lt;/div&gt;
&lt;div class="line"&gt;`` cd security-scripts virtualenv .``&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Voila, a safe working environment. As Linux and Windows virtual
environments differ a bit, the following commands can be used to
switch to the virtual environment and works on either platform.&lt;/div&gt;
&lt;div class="line"&gt;`` [[ -f bin/activate ]] &amp;amp;&amp;amp; source bin/activate [[ -f Scripts/activate ]] &amp;amp;&amp;amp; source Scripts/activate``&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;The following command installs the recommended pip packages (currently
only one):&lt;/div&gt;
&lt;div class="line"&gt;`` pip install -r requirements.txt``&lt;/div&gt;
&lt;div class="line"&gt;If you want to switch back to the main environment, use the command
&lt;pre&gt;
deactivate&lt;/pre&gt;
.&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Although the Python version of &lt;pre&gt;
analyze_hosts&lt;/pre&gt;
 script doesn't have
all the functionality the Bash version has (yet), it already contains
a significant number of other features, and is a bit smarter with
regards to working on a large number of hosts.&lt;/div&gt;
&lt;div class="line"&gt;For instance, when running the script on a subnet, it first creates a
queuefile containing all targeted hosts. If a host has been scanned,
it will automatically be removed from the queuefile. The script
doesn't handle forks and subprocesses (yet), but you can safely
execute it in parallel specifying different queue- and output files.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The script can be found on
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;https://github.com/PeterMosmans/security-scripts/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As always, feedback and pull requests are appreciated :smile:&lt;/p&gt;
</content><category term="bash"></category><category term="python"></category></entry><entry><title>Open secure redirect</title><link href="https://www.onwebsecurity.com/security/open-secure-redirect.html" rel="alternate"></link><published>2015-12-08T07:33:00+00:00</published><updated>2017-05-07T10:47:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-12-08:/security/open-secure-redirect.html</id><summary type="html">&lt;p&gt;&lt;img alt="left or right" src="https://www.onwebsecurity.com/images/left-or-right.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Aren't those RFC docs amazing ? Reading up on standards ?&lt;/p&gt;
&lt;p&gt;I needed plenty of time for them, as I encountered some interesting
issues. As it turned out, some websites / loadbalancers are overly
optimistic in encrypting all the things - actually, in &lt;strong&gt;redirecting&lt;/strong&gt;
all the things.&lt;/p&gt;
&lt;div class="section" id="tl-dr"&gt;
&lt;h2&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;Never trust HTTP(s) clients, and be careful when setting up redirection rules. A
non-RFC compliant &lt;em&gt;client&lt;/em&gt; can trigger a (difficult to exploit) open redirect
vulnerability, due to a non-RFC compliant &lt;em&gt;server&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This vulnerability can be tested using&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;analyze_hosts.py --http TARGET&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;https://github.com/PeterMosmans/security-scripts/&lt;/a&gt; for the latest
version of analyze_hosts.py&lt;/p&gt;
&lt;p&gt;Be warned, long post ahead:
A while ago I came across some servers that, when being sent insecure
requests, responded with a redirect to the secure version.&lt;/p&gt;
&lt;p&gt;Request:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;%&lt;/span&gt; curl -sI http://VICTIM/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Response:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kr"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;301&lt;/span&gt; &lt;span class="ne"&gt;Moved Permanently&lt;/span&gt;
&lt;span class="na"&gt;Connection&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="l"&gt;close&lt;/span&gt;
&lt;span class="na"&gt;Location&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="l"&gt;https://VICTIM/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So far so good, nothing fancy going on here. In fact, this is
excellent behaviour. Insecure requests are immediately upgraded to
secure requests.&lt;/p&gt;
&lt;p&gt;However, the server seemed to be overly happy in redirecting, as it
listened to the client-supplied Host parameter:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;%&lt;/span&gt; curl -s -I -H &lt;span class="s2"&gt;&amp;quot;Host: MALICIOUS&amp;quot;&lt;/span&gt; http://VICTIM/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And the server responded by&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kr"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1 …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="left or right" src="https://www.onwebsecurity.com/images/left-or-right.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Aren't those RFC docs amazing ? Reading up on standards ?&lt;/p&gt;
&lt;p&gt;I needed plenty of time for them, as I encountered some interesting
issues. As it turned out, some websites / loadbalancers are overly
optimistic in encrypting all the things - actually, in &lt;strong&gt;redirecting&lt;/strong&gt;
all the things.&lt;/p&gt;
&lt;div class="section" id="tl-dr"&gt;
&lt;h2&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;Never trust HTTP(s) clients, and be careful when setting up redirection rules. A
non-RFC compliant &lt;em&gt;client&lt;/em&gt; can trigger a (difficult to exploit) open redirect
vulnerability, due to a non-RFC compliant &lt;em&gt;server&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This vulnerability can be tested using&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;analyze_hosts.py --http TARGET&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;https://github.com/PeterMosmans/security-scripts/&lt;/a&gt; for the latest
version of analyze_hosts.py&lt;/p&gt;
&lt;p&gt;Be warned, long post ahead:
A while ago I came across some servers that, when being sent insecure
requests, responded with a redirect to the secure version.&lt;/p&gt;
&lt;p&gt;Request:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;%&lt;/span&gt; curl -sI http://VICTIM/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Response:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kr"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;301&lt;/span&gt; &lt;span class="ne"&gt;Moved Permanently&lt;/span&gt;
&lt;span class="na"&gt;Connection&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="l"&gt;close&lt;/span&gt;
&lt;span class="na"&gt;Location&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="l"&gt;https://VICTIM/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So far so good, nothing fancy going on here. In fact, this is
excellent behaviour. Insecure requests are immediately upgraded to
secure requests.&lt;/p&gt;
&lt;p&gt;However, the server seemed to be overly happy in redirecting, as it
listened to the client-supplied Host parameter:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;%&lt;/span&gt; curl -s -I -H &lt;span class="s2"&gt;&amp;quot;Host: MALICIOUS&amp;quot;&lt;/span&gt; http://VICTIM/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And the server responded by&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kr"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;301&lt;/span&gt; &lt;span class="ne"&gt;Moved Permanently&lt;/span&gt;
&lt;span class="na"&gt;Connection&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="l"&gt;close&lt;/span&gt;
&lt;span class="na"&gt;Location&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="l"&gt;https://MALICIOUS/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="vulnerability"&gt;
&lt;h2&gt;Vulnerability&lt;/h2&gt;
&lt;p&gt;An attacker is able to perform malicious open redirects, if he is able to forge
the client's HTTP header.&lt;/p&gt;
&lt;p&gt;Truth be told, this is quite difficult to exploit, as this is currently not
possible with e.g. XMLHttpRequest (see
&lt;a class="reference external" href="http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method)"&gt;http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Still, an attacker could use this attack to redirect unknowing users, or try to
poison caches.&lt;/p&gt;
&lt;p&gt;What does the standard say ? Semantic-wise (in RFC speak) for the last
request, the &lt;strong&gt;target URI&lt;/strong&gt; equals the &lt;strong&gt;absolute-URI&lt;/strong&gt; and is
&lt;a class="reference external" href="http://VICTIM/"&gt;http://VICTIM/&lt;/a&gt;. The &lt;strong&gt;authority&lt;/strong&gt; is VICTIM, the &lt;strong&gt;request-target&lt;/strong&gt; is
/, and the &lt;strong&gt;uri-host&lt;/strong&gt; is MALICIOUS.&lt;/p&gt;
&lt;p&gt;The latest HTTP/1.1 standard &lt;a class="reference external" href="http://tools.ietf.org/html/rfc7230.html"&gt;RFC 7230&lt;/a&gt;, paragraph 5.4, states
the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;&amp;quot;If the target URI includes an authority component, then a client MUST send
a field-value for Host that is identical to that authority component&amp;quot;&lt;/em&gt;.&lt;/blockquote&gt;
&lt;p&gt;So, the client isn't compliant... but as an attacker, we don't have to be
compliant. We can do whatever we want.&lt;/p&gt;
&lt;p&gt;Next, it states our issue:&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;&amp;quot;Since the Host header field acts as an application-level routing mechanism,
it is a frequent target for malware seeking to poison a shared cache or
redirect a request to an unintended server.&amp;quot;&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;Exactly what is happening here. But, should it happen ? According to
the RFC (bear with me, lots of theory here):&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;&amp;quot;If the server's configuration (or outbound gateway) provides a fixed
URI authority component, that authority is used for the effective
request URI.&amp;quot;&lt;/em&gt;.&lt;/blockquote&gt;
&lt;p&gt;Translation: if the server only serves VICTIM, then it
should use that to serve the request URI from.&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;&amp;quot;If not, then if the request-target is in authority-form, the
effective request URI's authority component is the same as the
request-target.&amp;quot;&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;Translation: if the request contains a host, then
the server should 'overrule' the request URI. This is mostly meant for
proxies, for example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;% curl -s -H &lt;span class="s2"&gt;&amp;quot;Host: TARGET&amp;quot;&lt;/span&gt; http://VICTIM/ -x http://PROXY:80
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, the PROXY will receive a request target of HTTP//VICTIM/, and it
should use that as authority, instead of PROXY.&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;&amp;quot;If not, then if a Host header field is supplied with a non-empty
field-value, the authority component is the same as the Host
field-value.&amp;quot;&lt;/em&gt;.&lt;/blockquote&gt;
&lt;p&gt;Translation: If the Host header is supplied (TARGET), it should be
the same as the authority. But in our 'attack' it's not, authority is
VICTIM. So, let's move to the next line.&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;&amp;quot;Otherwise, the authority component is assigned the default name
configured for the server and, if the connection's incoming TCP port
number differs from the default port for the effective request URI's
scheme, then a colon (&amp;quot;:&amp;quot;) and the incoming port number (in decimal
form) are appended to the authority component.&lt;/em&gt;&amp;quot;.&lt;/blockquote&gt;
&lt;p&gt;And this is where the server VICTIM fails to follow the RFC guidelines. The
authority component should be specified by VICTIM, and not by the client.&lt;/p&gt;
&lt;p&gt;Most of the times this issue is the result of wrong redirection rules for
servers and loadbalancers. The rules incorrectly (ab)use the Host field as
authority.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="how-to-test"&gt;
&lt;h2&gt;How to test&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; curl -sIH &lt;span class="s2"&gt;&amp;quot;Host: vuln&amp;quot;&lt;/span&gt; http://&lt;span class="nv"&gt;$VICTIM&lt;/span&gt;/&lt;span class="p"&gt;|&lt;/span&gt;grep -q &lt;span class="s2"&gt;&amp;quot;Location: https\?://vuln/&amp;quot;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Server is vulnerable to open secure redirect&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;pre&gt;
analyze_hosts.py&lt;/pre&gt;
 script on
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts"&gt;https://github.com/PeterMosmans/security-scripts&lt;/a&gt; supports it now as well,
with the &lt;pre&gt;
--http&lt;/pre&gt;
 option.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="mitigation-solution"&gt;
&lt;h2&gt;Mitigation / solution&lt;/h2&gt;
&lt;p&gt;Make sure that you use the correct authority, as specified (or served) by the
server, and do not blindly redirect to the Host 'authority', as specified by the client.&lt;/p&gt;
&lt;p&gt;Stay safe!&lt;/p&gt;
&lt;/div&gt;
</content><category term="pentesting"></category><category term="vulnerability"></category></entry><entry><title>automatic XML validation when using git</title><link href="https://www.onwebsecurity.com/configuration/automatic-xml-validation-when-using-git.html" rel="alternate"></link><published>2015-09-29T13:51:00+00:00</published><updated>2015-09-29T13:51:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-09-29:/configuration/automatic-xml-validation-when-using-git.html</id><summary type="html">&lt;p&gt;&lt;img alt="XML" src="https://www.onwebsecurity.com/images/xml.png" /&gt;&lt;/p&gt;
&lt;p&gt;Recently I worked on a project which involved manually editing a bunch of XML
files. Emacs is my favorite ~operating system~ editor, and it has XML validation
built in (using the nXML mode). It highlights validation errors while-you-type.
Unfortunately, even with Emacs showing potential issues in &lt;em&gt;RED COLOR&lt;/em&gt;, I
managed to commit a number of broken XML files to my local git repository.
Subsequently when I pushed my errors to the remote 'origin' git repository, the
errors broke builds.&lt;/p&gt;
&lt;p&gt;Of course this can be completely prevented by locally using &lt;strong&gt;pre-commit&lt;/strong&gt;
hooks. If your local git repository validates XML files before you can commit
them, and denies invalid XML files, then one part of the problem is solved.&lt;/p&gt;
&lt;p&gt;A &lt;strong&gt;pre-receive&lt;/strong&gt; hook on the receiving server side can do the same as a
pre-commit hook locally: Validate XML files before letting somebody push a
commit which can break the build process.&lt;/p&gt;
&lt;p&gt;I looked around the Internet but couldn't find a lightweight quick script to do
only and exactly that. That's the reason I whipped up a basic pre-commit and
pre-receive hook, written in Python.&lt;/p&gt;
&lt;p&gt;You can find the very basic and rough code at
&lt;a class="reference external" href="https://github.com/PeterMosmans/git-utilities"&gt;https://github.com/PeterMosmans/git-utilities&lt;/a&gt;. By changing the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="XML" src="https://www.onwebsecurity.com/images/xml.png" /&gt;&lt;/p&gt;
&lt;p&gt;Recently I worked on a project which involved manually editing a bunch of XML
files. Emacs is my favorite ~operating system~ editor, and it has XML validation
built in (using the nXML mode). It highlights validation errors while-you-type.
Unfortunately, even with Emacs showing potential issues in &lt;em&gt;RED COLOR&lt;/em&gt;, I
managed to commit a number of broken XML files to my local git repository.
Subsequently when I pushed my errors to the remote 'origin' git repository, the
errors broke builds.&lt;/p&gt;
&lt;p&gt;Of course this can be completely prevented by locally using &lt;strong&gt;pre-commit&lt;/strong&gt;
hooks. If your local git repository validates XML files before you can commit
them, and denies invalid XML files, then one part of the problem is solved.&lt;/p&gt;
&lt;p&gt;A &lt;strong&gt;pre-receive&lt;/strong&gt; hook on the receiving server side can do the same as a
pre-commit hook locally: Validate XML files before letting somebody push a
commit which can break the build process.&lt;/p&gt;
&lt;p&gt;I looked around the Internet but couldn't find a lightweight quick script to do
only and exactly that. That's the reason I whipped up a basic pre-commit and
pre-receive hook, written in Python.&lt;/p&gt;
&lt;p&gt;You can find the very basic and rough code at
&lt;a class="reference external" href="https://github.com/PeterMosmans/git-utilities"&gt;https://github.com/PeterMosmans/git-utilities&lt;/a&gt;. By changing the variable
&lt;pre&gt;
reject&lt;/pre&gt;
 in the hook scripts the behaviour can be changed to reject commits
and updates on validation errors, or not.&lt;/p&gt;
&lt;p&gt;(Of course, the most obvious solution would be that I pay more attention
to &lt;em&gt;RED COLORED ERRORS&lt;/em&gt;...)&lt;/p&gt;
</content><category term="git"></category></entry><entry><title>Preparing your team for a CTF competition - Defcon style</title><link href="https://www.onwebsecurity.com/opinion/preparing-your-team-for-a-ctf-competition-defcon-style.html" rel="alternate"></link><published>2015-08-15T14:35:00+00:00</published><updated>2015-08-15T14:35:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-08-15:/opinion/preparing-your-team-for-a-ctf-competition-defcon-style.html</id><summary type="html">&lt;p&gt;&lt;img alt="Defcon" src="/images/defcon-PRIDE.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Playing Capture The Flag with a team on location is something completely
different than performing penetration tests, security assessments or even trying
to solve CTF challenges over the Internet.&lt;/p&gt;
&lt;p&gt;At Defcon 23 I joined a team of really knowledgeable, nice and friendly people
for the OpenCTF competition. It was an exhilarating ride from setting up all
equipment to the glorious finish. Playing Capture The Flag on Defcon was
educational but foremost fun, fun and fun.&lt;/p&gt;
&lt;p&gt;So why would you spend a good chunk of 48 hours sitting in a chair behind a
screen while there is so much more to see and experience at Defcon ? In one
word: The undescribable exciting atmosphere of playing during a conference, of
competing against all these bright people from all over the world, desperately
trying to solve the challenges.&lt;/p&gt;
&lt;p&gt;Here are some of my personal notes on how to get the most out of competing in an
OpenCTF competition with a team:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Allow plenty of time before the competition to set up (and harden -
&lt;a class="reference external" href="https://www.onwebsecurity.com/opinion/defcon-23-was-great-people-are-great"&gt;don't be a fool like
me&lt;/a&gt;)
your machine. Make sure you have all necessary tools and notes.&lt;/li&gt;
&lt;li&gt;Make sure beforehand that all team members have one communication
channel (eg. IRC …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Defcon" src="/images/defcon-PRIDE.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Playing Capture The Flag with a team on location is something completely
different than performing penetration tests, security assessments or even trying
to solve CTF challenges over the Internet.&lt;/p&gt;
&lt;p&gt;At Defcon 23 I joined a team of really knowledgeable, nice and friendly people
for the OpenCTF competition. It was an exhilarating ride from setting up all
equipment to the glorious finish. Playing Capture The Flag on Defcon was
educational but foremost fun, fun and fun.&lt;/p&gt;
&lt;p&gt;So why would you spend a good chunk of 48 hours sitting in a chair behind a
screen while there is so much more to see and experience at Defcon ? In one
word: The undescribable exciting atmosphere of playing during a conference, of
competing against all these bright people from all over the world, desperately
trying to solve the challenges.&lt;/p&gt;
&lt;p&gt;Here are some of my personal notes on how to get the most out of competing in an
OpenCTF competition with a team:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Allow plenty of time before the competition to set up (and harden -
&lt;a class="reference external" href="https://www.onwebsecurity.com/opinion/defcon-23-was-great-people-are-great"&gt;don't be a fool like
me&lt;/a&gt;)
your machine. Make sure you have all necessary tools and notes.&lt;/li&gt;
&lt;li&gt;Make sure beforehand that all team members have one communication
channel (eg. IRC) readily available, and ways of sharing files (eg.
USB sticks, pastebin or dropbox). Share the knowledge. Our team first
met up at Defcon 23, so this was important for us.&lt;/li&gt;
&lt;li&gt;Read the instructions of the challenge. Read them again. And
preferably again. Look at the challenge.
This was for me an eye opener, as I got the feeling that didn't allow
myself enough time reading into each challenge.&lt;/li&gt;
&lt;li&gt;Don't forget to make notes continuously while playing. If you're
stuck, if there aren't challenges to your liking open or if the
competition floor is closed, you can always do write ups (please
don't hold it against me, but I really like doing write ups).&lt;/li&gt;
&lt;li&gt;Make sure you're comfortable with setting up networking, routing and,
most important (local) firewalls. Several challenges needed network
tweaks like VLAN settings. You could also go on the offense and
attack other teams, so be prepared.&lt;/li&gt;
&lt;li&gt;Bring hardware. Lots of it. Patch cables, USB sticks, chargers,
foreign adaptersmonitors, you-name-it. One of our team members
brought a switch, and it made him the instant uncrowned king of our
team.&lt;/li&gt;
&lt;li&gt;The advantage of being in one location is that you can easily
communicate with each other. I really enjoyed walking around to other
team members, seeing what they were up to and hearing their ideas.
Bouncing theories around is so extremely valuable. If you have pair
programming, why not pair hacking ? And Extreme Hacking is born...&lt;/li&gt;
&lt;li&gt;The helpful organizers Team Vand were walking around all day. It
seemed like they really enjoyed it when you asked them about the
challenges. Why not walk up to them more often when you're stuck ?&lt;/li&gt;
&lt;li&gt;With regards to technical skills, I felt that it was an immense
advantage if you're pretty confident with a glue language like e.g.
Python. Writing (simple) file parsers, doing basic byte conversions
and other file operations is a plus.&lt;/li&gt;
&lt;li&gt;Remember to have fun, it's a social thing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The learning experience was my most important goal of joining a CTF team
and the competition. In that regard Defcon 23 was a huge success. Not
only that, but our team also ended up at a rewarding 12th place out of
the 61 teams. Something that I'm really proud of.&lt;/p&gt;
&lt;p&gt;We will be competing again at Defcon 24, and you should too. See you
next year ?&lt;/p&gt;
&lt;p&gt;Thanks to the organizers &amp;quot;Team Vand&amp;quot; and last but not least all of our
team members. I learned so much from you - You know who you are!&lt;/p&gt;
</content><category term="ctf"></category><category term="pentesting"></category></entry><entry><title>Defcon 23 was great - people are great</title><link href="https://www.onwebsecurity.com/opinion/defcon-23-was-great-people-are-great.html" rel="alternate"></link><published>2015-08-09T21:51:00+00:00</published><updated>2015-08-09T21:51:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-08-09:/opinion/defcon-23-was-great-people-are-great.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Defcon 23" src="https://www.onwebsecurity.com/images/defcon.jpg" /&gt;&lt;/div&gt;
&lt;div class="line"&gt;For quite a while now, I work in the security industry. One of the
things I do is providing security advice for companies on all sorts of
guidelines, policies and hardening stuff. Web penetration tests is
also something I do very regularly. In other words, a disclaimer
before you read on: I should have known better...&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;VirtualBox, Packer, Vagrant and Ansible are tools that I use a lot.
These four tools make virtualizing and provisioning really easy. You
can create new machines, experiment with them and test different
setups in a repeatable and automated way.&lt;/div&gt;
&lt;div class="line"&gt;As I sometimes organize pentesting workshops, I have several virtual
machines with Kali (a penetration testing distribution) installed on
them readily availabe.&lt;/div&gt;
&lt;div class="line"&gt;So, I connected my laptop to the network of the 23rd Defcon conference
in Las Vegas, when one of these standard Kali virtual machines was
(still) running as guest on my machine. Not only was Kali running, the
guest was also configured to run in bridged networking mode. This
means that Kali got it's own network IP address assigned.&lt;/div&gt;
&lt;div class="line"&gt;What I hadn't changed on that machine was Kali's default root
password. To make matters worse, what I had changed was the ssh server …&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="Defcon 23" src="https://www.onwebsecurity.com/images/defcon.jpg" /&gt;&lt;/div&gt;
&lt;div class="line"&gt;For quite a while now, I work in the security industry. One of the
things I do is providing security advice for companies on all sorts of
guidelines, policies and hardening stuff. Web penetration tests is
also something I do very regularly. In other words, a disclaimer
before you read on: I should have known better...&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;VirtualBox, Packer, Vagrant and Ansible are tools that I use a lot.
These four tools make virtualizing and provisioning really easy. You
can create new machines, experiment with them and test different
setups in a repeatable and automated way.&lt;/div&gt;
&lt;div class="line"&gt;As I sometimes organize pentesting workshops, I have several virtual
machines with Kali (a penetration testing distribution) installed on
them readily availabe.&lt;/div&gt;
&lt;div class="line"&gt;So, I connected my laptop to the network of the 23rd Defcon conference
in Las Vegas, when one of these standard Kali virtual machines was
(still) running as guest on my machine. Not only was Kali running, the
guest was also configured to run in bridged networking mode. This
means that Kali got it's own network IP address assigned.&lt;/div&gt;
&lt;div class="line"&gt;What I hadn't changed on that machine was Kali's default root
password. To make matters worse, what I had changed was the ssh server
(which doesn't run by default) that was running now.&lt;/div&gt;
&lt;div class="line"&gt;Once again, I should have known better. What you should do when you
visit the world's biggest hacker's conference is hardening your
machine, and bring a burner (throwaway) laptop.&lt;/div&gt;
&lt;div class="line"&gt;What you shouldn't do is exposing the ssh server of a standard Kali
distribution to the network, with the default root password.&lt;/div&gt;
&lt;div class="line"&gt;Yet, that's exactly what I did...&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;What surprised me though is how quickly the box was owned. Literally
within a minute someone on the network was so kind enough to change
the root password for me. Within a minute! I expected hostile traffic,
but this turnaround time really was impressive. So helpful!&lt;/div&gt;
&lt;div class="line"&gt;I immediately shut down the box and will do some offline forensic
research on it, just for fun. Thankfully, when you have prepared
virtual machines you can be up and running within almost the same time
as it took for someone else to hack the box.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Exactly because of my beginner's mistake I liked Defcon so much. It made
me feel like a rookie (and rightfully so!). There were so many
knowledgeable people, so many clever talks, demonstrations, workshops
and games going on. It made me humble to the core. Everybody was so
friendly and helpful, I learned a lot.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;One of the things I always tell people is that pentesting taught me
that people are generally good. You always find vulnerabilities in
(web) applications, but people haven't exploited those vulnerabilities
yet. People must be good by nature.&lt;/div&gt;
&lt;div class="line"&gt;So a big thank you to the one owning my virtual machine within a
minute. Even though I'm deeply ashamed about my beginner's mistake,
thank you for reminding me of how important consistent operational
security is. Thank you for reminding me of what the world could look
like if people would be evil. But they aren't. People are generally
good. Hackers even more so.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Another post will be on the Defcon OpenCTF competition, which I was
fortunate enough to compete in.&lt;/p&gt;
</content><category term="conference"></category></entry><entry><title>The future is here: HTTP/2</title><link href="https://www.onwebsecurity.com/configuration/the-future-is-here-http2.html" rel="alternate"></link><published>2015-07-31T22:26:00+00:00</published><updated>2015-07-31T22:26:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-07-31:/configuration/the-future-is-here-http2.html</id><summary type="html">&lt;p&gt;Last month I held a number of presentations on the latest and greatest
HTTP/2 protocol. It's an area where there's currently a lot of demand
for knowledge and practical tips. Most people are surprised to find out
that the're actually already using it on a daily base.&lt;/p&gt;
&lt;p&gt;If you're interested you could check out an Ansible role which installs
a number of client-side and server-side tools all HTTP/2 enabled:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;curl&lt;/strong&gt; - A data transferring tool with HTTP/2 support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;h2load&lt;/strong&gt; - A benchmarking tool for HTTP/2 and SPDY servers&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nghttp&lt;/strong&gt; - A HTTP/2 client with SPDY support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nghttpd&lt;/strong&gt; - A HTTP/2 server with SPDY support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nghttpx&lt;/strong&gt; - A transparent HTTP/2 proxy with SPDY support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;openssl&lt;/strong&gt; - A cryptographic library with ALPN support
(1.0.2-chacha)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following libraries will be installed:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;libcrypto&lt;/strong&gt; - OpenSSL&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libcurl&lt;/strong&gt; - CURL library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libnghttp2&lt;/strong&gt; - A HTTP/2 and HPACK C library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libspdylay&lt;/strong&gt; - A SPDY library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libssl&lt;/strong&gt; - OpenSSL&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can find the role at
&lt;a class="reference external" href="https://github.com/PeterMosmans/ansible-role-http2"&gt;https://github.com/PeterMosmans/ansible-role-http2&lt;/a&gt;&lt;/p&gt;
</summary><content type="html">&lt;p&gt;Last month I held a number of presentations on the latest and greatest
HTTP/2 protocol. It's an area where there's currently a lot of demand
for knowledge and practical tips. Most people are surprised to find out
that the're actually already using it on a daily base.&lt;/p&gt;
&lt;p&gt;If you're interested you could check out an Ansible role which installs
a number of client-side and server-side tools all HTTP/2 enabled:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;curl&lt;/strong&gt; - A data transferring tool with HTTP/2 support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;h2load&lt;/strong&gt; - A benchmarking tool for HTTP/2 and SPDY servers&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nghttp&lt;/strong&gt; - A HTTP/2 client with SPDY support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nghttpd&lt;/strong&gt; - A HTTP/2 server with SPDY support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nghttpx&lt;/strong&gt; - A transparent HTTP/2 proxy with SPDY support&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;openssl&lt;/strong&gt; - A cryptographic library with ALPN support
(1.0.2-chacha)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following libraries will be installed:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;libcrypto&lt;/strong&gt; - OpenSSL&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libcurl&lt;/strong&gt; - CURL library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libnghttp2&lt;/strong&gt; - A HTTP/2 and HPACK C library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libspdylay&lt;/strong&gt; - A SPDY library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libssl&lt;/strong&gt; - OpenSSL&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can find the role at
&lt;a class="reference external" href="https://github.com/PeterMosmans/ansible-role-http2"&gt;https://github.com/PeterMosmans/ansible-role-http2&lt;/a&gt;&lt;/p&gt;
</content><category term="ansible"></category><category term="pentesting"></category></entry><entry><title>Safely storing Ansible playbook secrets</title><link href="https://www.onwebsecurity.com/configuration/safely-storing-ansible-playbook-secrets.html" rel="alternate"></link><published>2015-06-23T06:30:00+00:00</published><updated>2015-06-23T06:30:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-06-23:/configuration/safely-storing-ansible-playbook-secrets.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="see the forest for the trees" src="/images/see_the_forest_for_the_trees.jpg" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;More and more organizations use dedicated software to safely handle
the creation and management of secrets (for example SSL certificate
keys, private variables and passwords). Three 'well known' solutions
are Square's &lt;a class="reference external" href="https://square.github.io/keywhiz/"&gt;Keywhiz&lt;/a&gt;,
Hashicorp's &lt;a class="reference external" href="https://www.vaultproject.io/"&gt;Vault&lt;/a&gt; and
&lt;a class="reference external" href="https://xordataexchange.github.io/crypt/"&gt;crypt&lt;/a&gt; in combination
with etcd or consul.&lt;/p&gt;
&lt;p&gt;As with all security solutions the roll-out can be quite cumbersome.
The correct implementation (think key management, think audit trails,
think key recovery) of any one of these solutions is difficult. And
difficult means that most people won't use it, at least not right away
(remember SELinux ?).&lt;/p&gt;
&lt;p&gt;There are a number of tools available to encrypt secrets &lt;em&gt;within&lt;/em&gt;
(Ansible) repositories. One of them for instance is &lt;a class="reference external" href="https://docs.ansible.com/playbooks_vault.html"&gt;Ansible
Vault&lt;/a&gt; (look
&lt;a class="reference external" href="https://www.onwebsecurity.com/tools/openssl-the-ansible-vault-using-pbkdf2"&gt;here&lt;/a&gt;
for a more in-depth review). Although the idea of selectively encrypting
data is a good one, text-oriented version control systems like git or
Subversion aren't meant to store binary blobs of encrypted data.
Moreover you still run the risk of accidentally uploading or sharing
unencrypted files. Mitigations like adding filenames of unencrypted
secrets to a .gitignore file are error-prone.&lt;/p&gt;
&lt;p&gt;How to facilitate developers and system operators to store secrets in a
safe place, &lt;strong&gt;outside&lt;/strong&gt; the repositories where Ansible playbooks and
configuration files are kept ?&lt;/p&gt;
&lt;p&gt;This article describes a …&lt;/p&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="see the forest for the trees" src="/images/see_the_forest_for_the_trees.jpg" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;More and more organizations use dedicated software to safely handle
the creation and management of secrets (for example SSL certificate
keys, private variables and passwords). Three 'well known' solutions
are Square's &lt;a class="reference external" href="https://square.github.io/keywhiz/"&gt;Keywhiz&lt;/a&gt;,
Hashicorp's &lt;a class="reference external" href="https://www.vaultproject.io/"&gt;Vault&lt;/a&gt; and
&lt;a class="reference external" href="https://xordataexchange.github.io/crypt/"&gt;crypt&lt;/a&gt; in combination
with etcd or consul.&lt;/p&gt;
&lt;p&gt;As with all security solutions the roll-out can be quite cumbersome.
The correct implementation (think key management, think audit trails,
think key recovery) of any one of these solutions is difficult. And
difficult means that most people won't use it, at least not right away
(remember SELinux ?).&lt;/p&gt;
&lt;p&gt;There are a number of tools available to encrypt secrets &lt;em&gt;within&lt;/em&gt;
(Ansible) repositories. One of them for instance is &lt;a class="reference external" href="https://docs.ansible.com/playbooks_vault.html"&gt;Ansible
Vault&lt;/a&gt; (look
&lt;a class="reference external" href="https://www.onwebsecurity.com/tools/openssl-the-ansible-vault-using-pbkdf2"&gt;here&lt;/a&gt;
for a more in-depth review). Although the idea of selectively encrypting
data is a good one, text-oriented version control systems like git or
Subversion aren't meant to store binary blobs of encrypted data.
Moreover you still run the risk of accidentally uploading or sharing
unencrypted files. Mitigations like adding filenames of unencrypted
secrets to a .gitignore file are error-prone.&lt;/p&gt;
&lt;p&gt;How to facilitate developers and system operators to store secrets in a
safe place, &lt;strong&gt;outside&lt;/strong&gt; the repositories where Ansible playbooks and
configuration files are kept ?&lt;/p&gt;
&lt;p&gt;This article describes a possible workflow for Ansible users who want to
safely store secrets outside of the Ansible repository for use within
their playbooks. It assumes that current operators already have access
to the correct secrets: Developers have access to the development
environment secrets for example, and system operators have access to
production environment secrets. How you &lt;em&gt;store&lt;/em&gt; these secrets is outside
the scope of this article - this is about structuring (Ansible)
variables in such a way to facilitate the safe storage of secrets.&lt;/p&gt;
&lt;p&gt;The underlying goals are:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Make it as easy as possible for humans to use secrets and store
them outside the repository (don't disrupt the current workflow)&lt;/li&gt;
&lt;li&gt;Have different security levels depending on the environment
(Development, Test, Acceptance or Production)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="section" id="file-structure"&gt;
&lt;h2&gt;File structure&lt;/h2&gt;
&lt;p&gt;This is an example of a file structure, where &lt;em&gt;/ansible&lt;/em&gt; is a git
repository, and &lt;em&gt;/protected/storage&lt;/em&gt; is a protected storage file
system. This can be anything. The protected development storage can be
for instance a private git repository shared amongst developers (low
security clearance), and the production storage could be an encrypted
network mount that is only accessible by operators (high security
clearance). They don't have to share the same filesystem (see goal 2).&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
|-ansible
|---/roles
|-----/vars
|-------public_vars
|-----/files
|-------public_file
|-protected
|---/storage
|-----/development
|-------secret_file
|-------secret_vars.yml
|-----/production
|-------secret_file
|-------secret_vars.yml
&lt;/pre&gt;
&lt;p&gt;Ansible server works great from Vagrant for example, where the various
Vagrant guest directories are mapped to host directories.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="ansible-setup"&gt;
&lt;h2&gt;Ansible setup&lt;/h2&gt;
&lt;p&gt;The design pattern for Ansible is to create an inventory file which
groups the hosts into environments having different (security)
restrictions. This can be one inventory file or separate ones:&lt;/p&gt;
&lt;p&gt;# file: inventory [development] development.domain.com [test] test.domain.com [acceptance] acceptance.domain.com [production] production.domain.com&lt;/p&gt;
&lt;p&gt;This means that Ansible will look for variables for the development
environment in the current directory under &lt;em&gt;group_vars/development&lt;/em&gt;
and in /etc/ansible/group_vars/development. Regardless where you
store these files (in the current directory or on the ansible server
in &lt;em&gt;/etc/ansible&lt;/em&gt;), now you can include other files based on the
environment. See for example the file group_vars/development...&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
--- # file: group_vars/development
protected_storage: /protected/storage/development
&lt;/pre&gt;
&lt;p&gt;....and group_vars/production&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
 --- # file: group_vars/production
protected_storage: /protected/storage/production
&lt;/pre&gt;
&lt;p&gt;The variable &lt;em&gt;protected_storage&lt;/em&gt; is set according to the environment.
This means that by utilizing this pattern you can store any secret
outside of the current Ansible repository, and the secrets will be
loaded based on the environment. This can be used not only for
variables, but files as well. By using the name &lt;em&gt;protected_storage&lt;/em&gt;
developers of Ansible playbooks are 'forced' to store secret files
inside of that directory. Below is a configuration example to deploy
SSL keys:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
- name: Deploy private keys
  copy:
  src={{ protected_storage }}/{{ item }}
  dest=/etc/ssl/private/{{ item }}
  owner=root
  group=root
  mode=600
  with_items: secret_file
&lt;/pre&gt;
&lt;p&gt;This deploys the correct SSL keys based on the environment from the
protected storage to the server.
You can also include files containing secret variables in playbooks:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
# file: webservers.yml
- hosts: all
  roles:
  - role: webtier
    tags: webtier
    tasks:
    - include: roles/webtier/tasks/php.yml
      tags: php
      - include: roles/webtier/tasks/wordpress.yml
        tags: wordpress
        vars_files:
        - &amp;quot;{{ protected_storage }}/wordpress.yml&amp;quot;``
&lt;/pre&gt;
&lt;p&gt;When you run this playbook for the development environment, the
correct secrets will be included from &lt;em&gt;/protected/storage/development&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code literal-block"&gt;
--- # file: protected-storage/development/wordpress.yml
wp_sites:
- name: www.domain.com
  db_name: database_name
  db_user: database_user
  db_password: secret_password
  plugins:
  - akismet
&lt;/pre&gt;
&lt;p&gt;This structure is relatively easy to implement, doesn't interfere with
the current workflow, and separates secrets from the public variables
and files. Hopefully this will last until your company does a complete
roll-out of Keywhiz, Vault or crypt...&lt;/p&gt;
&lt;/div&gt;
</content><category term="ansible"></category><category term="devops"></category></entry><entry><title>OWASP AppSecEU 2015 review - more and more DevOps</title><link href="https://www.onwebsecurity.com/opinion/owasp-appseceu-2015-more-and-more-devops.html" rel="alternate"></link><published>2015-06-15T06:32:00+00:00</published><updated>2015-06-15T06:32:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-06-15:/opinion/owasp-appseceu-2015-more-and-more-devops.html</id><summary type="html">&lt;p&gt;
&lt;center&gt;&lt;/center&gt;&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="line"&gt;This year, the European edition of OWASP AppSec conference was held in
Amsterdam, The Netherlands.&lt;/div&gt;
&lt;div class="line"&gt;One of the things I really like about OWASP conferences is the
atmosphere. Usually it consists of a nice blend of IT people from
literally all over the world, and this conference didn't disappoint.
One of the added values of visiting such a conference is that you hear
stories from the trenches from peers and likeminded people. It makes
it easier to (try to) spot trends in the security world.&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;&lt;p&gt;Some observations:&lt;/p&gt;
&lt;div class="section" id="devops"&gt;
&lt;h2&gt;DevOps&lt;/h2&gt;
&lt;p&gt;I'm a big fan of the DevOps movement, and what it means for security.
More cooperation plus more automated testing means more secure systems.
Thankfully there were a lot of presentations that focused on how to
integrate automated security testing into the continuous deployment
pipeline. As the O from OWASP stands for open, mainly open source
testing tools were covered, like OWASP ZAP, Arachni and the Gauntlt
framework. Some tools still need quite some tweaking to be successful,
but the landscape surely is promising.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="dev-is-running-faster-than-ops"&gt;
&lt;h2&gt;Dev is running faster than Ops&lt;/h2&gt;
&lt;p&gt;I'm still under the impression that the DevOps movement is mainly led by
developers. The tools that are improving faster are the …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;
&lt;center&gt;&lt;/center&gt;&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="line"&gt;This year, the European edition of OWASP AppSec conference was held in
Amsterdam, The Netherlands.&lt;/div&gt;
&lt;div class="line"&gt;One of the things I really like about OWASP conferences is the
atmosphere. Usually it consists of a nice blend of IT people from
literally all over the world, and this conference didn't disappoint.
One of the added values of visiting such a conference is that you hear
stories from the trenches from peers and likeminded people. It makes
it easier to (try to) spot trends in the security world.&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;&lt;p&gt;Some observations:&lt;/p&gt;
&lt;div class="section" id="devops"&gt;
&lt;h2&gt;DevOps&lt;/h2&gt;
&lt;p&gt;I'm a big fan of the DevOps movement, and what it means for security.
More cooperation plus more automated testing means more secure systems.
Thankfully there were a lot of presentations that focused on how to
integrate automated security testing into the continuous deployment
pipeline. As the O from OWASP stands for open, mainly open source
testing tools were covered, like OWASP ZAP, Arachni and the Gauntlt
framework. Some tools still need quite some tweaking to be successful,
but the landscape surely is promising.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="dev-is-running-faster-than-ops"&gt;
&lt;h2&gt;Dev is running faster than Ops&lt;/h2&gt;
&lt;p&gt;I'm still under the impression that the DevOps movement is mainly led by
developers. The tools that are improving faster are the ones that
specifically target a website or application. Although there are a
number of automated open source tools for infrastructural testing, like
Seccubus or OpenVAS, the changes seem to come from the development side.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="go"&gt;
&lt;h2&gt;Go&lt;/h2&gt;
&lt;p&gt;Python was the glue-language-of-choice for a lot of operations people.
Not anymore, the new go-to language is Go. More and more (DevOps) people
seem to choose that nowadays. More minimalistic and faster.&lt;/p&gt;
&lt;p&gt;Mind you, these observations are personal and not backed by any
scientific measure.&lt;/p&gt;
&lt;p&gt;Overall it was a well-balanced conference, with content for builders,
breakers and defenders. It seems that OWASP gains more and more traction
besides the 'usual security incrowd' - which is a good thing. Learning
about breaking security is one thing, but learning how to protect your
assets against attackers is more important in my opinion. The more
developers join the crusade for a safer Internet the better.&lt;/p&gt;
&lt;p&gt;A big thanks to the OWASP AppSec 2015 team for a great conference.&lt;/p&gt;
&lt;/div&gt;
</content></entry><entry><title>OpenSSL the Ansible vault... using PBKDF2</title><link href="https://www.onwebsecurity.com/configuration/openssl-the-ansible-vault-using-pbkdf2.html" rel="alternate"></link><published>2015-04-25T12:38:00+00:00</published><updated>2015-04-25T12:38:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-04-25:/configuration/openssl-the-ansible-vault-using-pbkdf2.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="OpenSSL the Ansible vault" src="https://www.onwebsecurity.com/images/locks.jpg" style="width: 600px; height: 450px;" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.ansible.com"&gt;Ansible&lt;/a&gt; is a popular open-source software
platform for configuring and managing computers. It helps sysadmins to
provision new servers in a reliable and repeatable way, and helps
developers who want to push their code as fast as possible.
It takes scripts (playbooks) as input, which a lot of people can and
do share with each other. The beauty of open source.
Playbooks can contain sensitive data like passwords and SSL keys -
stuff that you don't want to share, or incidentally upload to GitHub.&lt;/p&gt;
&lt;p&gt;Last year Ansible added a tool to its arsenal to easily encrypt
structured datafiles (containing sensitive data), called Ansible
Vault. You can specify a key or keyfile when running a playbook, which
decrypts the data on-the-fly. Encrypted data can still be edited&lt;/p&gt;
&lt;p&gt;I love it when people make it easier to use encryption. The easier it
becomes, the more people will use it, the safer everybody will be.&lt;/p&gt;
&lt;p&gt;Another beauty of open source is that you can inspect the code. And
modify it! I wanted to be able to encrypt and decrypt the data
where/when you cannot use Ansible vault, by using other tools and
languages like OpenSSL and Bash script.&lt;/p&gt;
&lt;p&gt;Under the hood Ansible vault …&lt;/p&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;img alt="OpenSSL the Ansible vault" src="https://www.onwebsecurity.com/images/locks.jpg" style="width: 600px; height: 450px;" /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.ansible.com"&gt;Ansible&lt;/a&gt; is a popular open-source software
platform for configuring and managing computers. It helps sysadmins to
provision new servers in a reliable and repeatable way, and helps
developers who want to push their code as fast as possible.
It takes scripts (playbooks) as input, which a lot of people can and
do share with each other. The beauty of open source.
Playbooks can contain sensitive data like passwords and SSL keys -
stuff that you don't want to share, or incidentally upload to GitHub.&lt;/p&gt;
&lt;p&gt;Last year Ansible added a tool to its arsenal to easily encrypt
structured datafiles (containing sensitive data), called Ansible
Vault. You can specify a key or keyfile when running a playbook, which
decrypts the data on-the-fly. Encrypted data can still be edited&lt;/p&gt;
&lt;p&gt;I love it when people make it easier to use encryption. The easier it
becomes, the more people will use it, the safer everybody will be.&lt;/p&gt;
&lt;p&gt;Another beauty of open source is that you can inspect the code. And
modify it! I wanted to be able to encrypt and decrypt the data
where/when you cannot use Ansible vault, by using other tools and
languages like OpenSSL and Bash script.&lt;/p&gt;
&lt;p&gt;Under the hood Ansible vault uses open and known encryption standards,
through the Python PyCrypto library. All information is encrypted
using the AES cipher in counter (CTR) mode with a key size of 256
bits &lt;a class="footnote-reference" href="#id4" id="id1"&gt;[1]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A user enters a password, which, together with a salt, serves as input
for &lt;a class="reference external" href="https://en.wikipedia.org/wiki/PBKDF2"&gt;PBKDF2&lt;/a&gt;, a well-known
keystretching function. Here, SHA 256 is being used as hash-based
pseudorandom function for PBKDF2.&lt;/p&gt;
&lt;p&gt;After 10000 iterations PBKDF2 spews out three 'keys': One 256 bit key
to encrypt the actual data, one 256 bit key to create a keyed hash
(again using SHA 256) over the data, and one 128 bit nonce
(initialization vector) &lt;a class="footnote-reference" href="#id5" id="id2"&gt;[2]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The 10000 iterations is a nice big number to make it harder for
attackers to bruteforce the key.&lt;/p&gt;
&lt;p&gt;When you use Ansible vault on a plaintext file the contents are
overwritten with the encrypted contents.
The first line contains a header of three fields separated by colons:
A header containing the magic string &lt;cite&gt;$ANSIBLE_VAULT&lt;/cite&gt;, the Vault
version number (as of this writing 1.1), and the cipher being used
(AES256).
The next huge string (truncated on 80 columns) contains a hexadecimal
representation of three variables. Each of those variables is also
hexadecimal encoded &lt;a class="footnote-reference" href="#id6" id="id3"&gt;[3]&lt;/a&gt;.
The three values are a salt, the HMAC and the encrypted data.&lt;/p&gt;
&lt;p&gt;To be able to decrypt this data using OpenSSL you first need to
stretch a password using PBKDF2 using 10000 iterations and SHA 256. As
the stock version of OpenSSL doesn't have this functionality exposed
(yet) in the application I created a patch (loosely inspired on &lt;a class="reference external" href="http://rt.openssl.org/Ticket/Display.html?id=3255&amp;amp;user=guest&amp;amp;pass=guest"&gt;an
earlier rejected OpenSSL patch&lt;/a&gt;).
It lets you choose the number of iterations, the pseudo random
function and the number of keys.
Using this patch you can compile openssl, and use it to create two 256
bit keys and a 128 bit initialization vector from a given salt and
password. That's almost all that's needed to convert Ansible vault
encrypted files into plaintext, and vice versa: AES-256-CTR and SHA
256 are already supported.&lt;/p&gt;
&lt;p&gt;Using the following command, three keys can be derived from password
&amp;quot;password&amp;quot; and salt &amp;quot;salt&amp;quot;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;openssl enc -pbkdf2 -pass pass:password -S 73616c74 -md sha256 -c &lt;span class="m"&gt;10000&lt;/span&gt; -dklen &lt;span class="m"&gt;80&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Almost... all that's missing is a Bash script wrapping everything nicely
up. Until next time!&lt;/p&gt;
&lt;p&gt;You can find the PBKDF2 patch for openssl &lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/enc-pbkdf"&gt;on my GitHub
repository&lt;/a&gt;.&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;AES CTR mode is a stream cipher, so padding the data using the
PKCS7 standard seems an unnecessary step.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Since 256 + 256 + 128 bits of output are needed, SHA 512 would
probably be a better fit than SHA 256.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id6" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;The hexadecimal-encoding-of-hexadecimal-encoded data explains the
weird looking file with lots of 3's in it.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><category term="ansible"></category><category term="openssl"></category></entry><entry><title>Replacing ChaCha20/Poly1305: a new owner</title><link href="https://www.onwebsecurity.com/announcements/replacing-chacha20poly1305-a-new-owner.html" rel="alternate"></link><published>2015-04-07T02:27:00+00:00</published><updated>2015-04-07T02:27:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-04-07:/announcements/replacing-chacha20poly1305-a-new-owner.html</id><summary type="html">&lt;p&gt;A post back I wrote about the 'design goals' of the 1.0.2-chacha fork of
OpenSSL - see
&lt;a class="reference external" href="https://www.onwebsecurity.com/openssl/the-work-flow-of-the-full-featured-openssl-fork-chacha20poly1305"&gt;https://www.onwebsecurity.com/openssl/the-work-flow-of-the-full-featured-openssl-fork-chacha20poly1305&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="A new owner" src="/images/new_owner.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The ChaCha20 / Poly1305 code in the 1.0.2-chacha fork is originally from
the OpenSSL repository, but has since been abandoned there. BoringSSL
became its new home, where it's actively being maintained by Google
(primarily Adam Langley and David Benjamin). Over time I applied several
patches that BoringSSL applied to the ChaCha20 / Poly1305 code, to keep
it as up to date as possible.&lt;/p&gt;
&lt;p&gt;The issue now is that BoringSSL diverges more and more from the OpenSSL
code, which makes it more difficult to maintain (error-prone), and, more
important, makes the fork itself diverge too much from OpenSSL.&lt;/p&gt;
&lt;p&gt;That's why it's my intention to replace the current ChaCha20 / Poly1305
code from 1.0.2-chacha with more recent attributions that align better
with the official OpenSSL code. As far as I understood the official
OpenSSL distribution will add ChaCha20 / Poly1305 at some time in the
future, which of course would be the best possible outcome. Official
support.&lt;/p&gt;
&lt;p&gt;Until that time I will do my best to maintain the 1.0.2-chacha branch.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;A post back I wrote about the 'design goals' of the 1.0.2-chacha fork of
OpenSSL - see
&lt;a class="reference external" href="https://www.onwebsecurity.com/openssl/the-work-flow-of-the-full-featured-openssl-fork-chacha20poly1305"&gt;https://www.onwebsecurity.com/openssl/the-work-flow-of-the-full-featured-openssl-fork-chacha20poly1305&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="A new owner" src="/images/new_owner.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The ChaCha20 / Poly1305 code in the 1.0.2-chacha fork is originally from
the OpenSSL repository, but has since been abandoned there. BoringSSL
became its new home, where it's actively being maintained by Google
(primarily Adam Langley and David Benjamin). Over time I applied several
patches that BoringSSL applied to the ChaCha20 / Poly1305 code, to keep
it as up to date as possible.&lt;/p&gt;
&lt;p&gt;The issue now is that BoringSSL diverges more and more from the OpenSSL
code, which makes it more difficult to maintain (error-prone), and, more
important, makes the fork itself diverge too much from OpenSSL.&lt;/p&gt;
&lt;p&gt;That's why it's my intention to replace the current ChaCha20 / Poly1305
code from 1.0.2-chacha with more recent attributions that align better
with the official OpenSSL code. As far as I understood the official
OpenSSL distribution will add ChaCha20 / Poly1305 at some time in the
future, which of course would be the best possible outcome. Official
support.&lt;/p&gt;
&lt;p&gt;Until that time I will do my best to maintain the 1.0.2-chacha branch.&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>The workflow of the Full-Featured openssl Fork (ChaCha20/Poly1305) 1.0.2-chacha</title><link href="https://www.onwebsecurity.com/announcements/the-work-flow-of-the-full-featured-openssl-fork-chacha20poly1305.html" rel="alternate"></link><published>2015-03-13T08:49:00+00:00</published><updated>2015-03-13T08:49:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-03-13:/announcements/the-work-flow-of-the-full-featured-openssl-fork-chacha20poly1305.html</id><summary type="html">&lt;p&gt;As you might know I maintain a fork of OpenSSL at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt; The 1.0.2-chacha fork started out of
adding the ChaCha20/Poly1305 ciphers to the official fork, and slowly more and
more ciphers and features were added.&lt;/p&gt;
&lt;p&gt;&lt;img alt="workflow" src="/images/workflow.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The main goals of the fork are&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;add as much ciphers and (test)functionality as possible&lt;/li&gt;
&lt;li&gt;to keep the source as aligned to the original as possible&lt;/li&gt;
&lt;li&gt;keep the patches transparent (easily applicable to the original source)&lt;/li&gt;
&lt;li&gt;keep the patches maintainable&lt;/li&gt;
&lt;li&gt;write as little custom/new code as possible&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For 2 (to keep the source as aligned to the original as possible) I try
to merge and test the code as often as I can, so that the fork is never
too far behind the official repository.&lt;/p&gt;
&lt;p&gt;As it was my first idea to start a feature branch I used no-fast forwarding git
merges. This kept it transparent when I merged the code, and what the history of
the commits was. However, since I'm probably going to maintain this fork besides
the official fork I'm going to use fast-forwarding merges from now on (March
2014) whenever possible. I think this will keep the commit history
cleaner - see …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As you might know I maintain a fork of OpenSSL at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt; The 1.0.2-chacha fork started out of
adding the ChaCha20/Poly1305 ciphers to the official fork, and slowly more and
more ciphers and features were added.&lt;/p&gt;
&lt;p&gt;&lt;img alt="workflow" src="/images/workflow.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The main goals of the fork are&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;add as much ciphers and (test)functionality as possible&lt;/li&gt;
&lt;li&gt;to keep the source as aligned to the original as possible&lt;/li&gt;
&lt;li&gt;keep the patches transparent (easily applicable to the original source)&lt;/li&gt;
&lt;li&gt;keep the patches maintainable&lt;/li&gt;
&lt;li&gt;write as little custom/new code as possible&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For 2 (to keep the source as aligned to the original as possible) I try
to merge and test the code as often as I can, so that the fork is never
too far behind the official repository.&lt;/p&gt;
&lt;p&gt;As it was my first idea to start a feature branch I used no-fast forwarding git
merges. This kept it transparent when I merged the code, and what the history of
the commits was. However, since I'm probably going to maintain this fork besides
the official fork I'm going to use fast-forwarding merges from now on (March
2014) whenever possible. I think this will keep the commit history
cleaner - see point 3 (keep the patches transparent).&lt;/p&gt;
&lt;p&gt;Goal 4 (keep the patches maintainable) is somewhat more difficult. The
ChaCha20/Poly1305 source code is from a now-defunct AEAD branch of the
official openssl source. Since then, the code has kind of moved to
Google's BoringSSL fork, where it is being actively maintained.&lt;/p&gt;
&lt;p&gt;In the near future I will try to replace the ChaCha20/Poly1305 with
BoringSSL's active codebase. I am aware of a recent patch from Intel
(see &lt;a class="reference external" href="https://rt.openssl.org/Ticket/Display.html?id=3615"&gt;https://rt.openssl.org/Ticket/Display.html?id=3615&lt;/a&gt;) but that
conflicts with goal 3 (keep the patches maintainable). Patches are
usually a one-off thing, and as you might know security is a dynamic
thing. What is secure code today can become insecure code tomorrow.&lt;/p&gt;
&lt;p&gt;For complete transparency please find an alphabetical list here of the
differences between the 1.0.2-chacha fork and the official
OpenSSL_1_0_2-stable fork:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;.gitignore&lt;/li&gt;
&lt;li&gt;.travis.yml&lt;/li&gt;
&lt;li&gt;CHANGES&lt;/li&gt;
&lt;li&gt;Configure&lt;/li&gt;
&lt;li&gt;Makefile.org&lt;/li&gt;
&lt;li&gt;Makefile.shared&lt;/li&gt;
&lt;li&gt;apps/s_client.c&lt;/li&gt;
&lt;li&gt;apps/speed.c&lt;/li&gt;
&lt;li&gt;crypto/chacha/Makefile&lt;/li&gt;
&lt;li&gt;crypto/chacha/chacha.h&lt;/li&gt;
&lt;li&gt;crypto/chacha/chacha_enc.c&lt;/li&gt;
&lt;li&gt;crypto/chacha/chacha_vec.c&lt;/li&gt;
&lt;li&gt;crypto/chacha/chachatest.c&lt;/li&gt;
&lt;li&gt;crypto/evp/Makefile&lt;/li&gt;
&lt;li&gt;crypto/evp/aeadtest.c&lt;/li&gt;
&lt;li&gt;crypto/evp/aes_128_gcm_tests.txt&lt;/li&gt;
&lt;li&gt;crypto/evp/aes_256_gcm_tests.txt&lt;/li&gt;
&lt;li&gt;crypto/evp/chacha20_poly1305_tests.txt&lt;/li&gt;
&lt;li&gt;crypto/evp/e_aes.c&lt;/li&gt;
&lt;li&gt;crypto/evp/e_chacha20_poly1305.c&lt;/li&gt;
&lt;li&gt;crypto/evp/evp.h&lt;/li&gt;
&lt;li&gt;crypto/evp/e_aead.c&lt;/li&gt;
&lt;li&gt;crypto/evp/evp_err.c&lt;/li&gt;
&lt;li&gt;crypto/evp/evp_locl.h&lt;/li&gt;
&lt;li&gt;crypto/opensslv.h&lt;/li&gt;
&lt;li&gt;crypto/poly1305/Makefile&lt;/li&gt;
&lt;li&gt;crypto/poly1305/poly1305.c&lt;/li&gt;
&lt;li&gt;crypto/poly1305/poly1305.h&lt;/li&gt;
&lt;li&gt;crypto/poly1305/poly1305_arm.c&lt;/li&gt;
&lt;li&gt;crypto/poly1305/poly1305_vec.c&lt;/li&gt;
&lt;li&gt;crypto/poly1305/poly1305test.c&lt;/li&gt;
&lt;li&gt;doc/apps/ciphers.pod&lt;/li&gt;
&lt;li&gt;doc/apps/s_client.pod&lt;/li&gt;
&lt;li&gt;doc/crypto/EVP_AEAD_CTX_init.pod&lt;/li&gt;
&lt;li&gt;engines/Makefile&lt;/li&gt;
&lt;li&gt;engines/ccgost/Makefile&lt;/li&gt;
&lt;li&gt;ssl/s2_clnt.c&lt;/li&gt;
&lt;li&gt;ssl/s2_enc.c&lt;/li&gt;
&lt;li&gt;ssl/s2_lib.c&lt;/li&gt;
&lt;li&gt;ssl/s2_srvr.c&lt;/li&gt;
&lt;li&gt;ssl/s3_clnt.c&lt;/li&gt;
&lt;li&gt;ssl/s3_enc.c&lt;/li&gt;
&lt;li&gt;ssl/s3_lib.c&lt;/li&gt;
&lt;li&gt;ssl/s3_srvr.c&lt;/li&gt;
&lt;li&gt;ssl/ssl.h&lt;/li&gt;
&lt;li&gt;ssl/ssl3.h&lt;/li&gt;
&lt;li&gt;ssl/ssl_ciph.c&lt;/li&gt;
&lt;li&gt;ssl/ssl_lib.c&lt;/li&gt;
&lt;li&gt;ssl/ssl_locl.h&lt;/li&gt;
&lt;li&gt;ssl/ssl_txt.c&lt;/li&gt;
&lt;li&gt;ssl/ssltest.c&lt;/li&gt;
&lt;li&gt;ssl/t1_enc.c&lt;/li&gt;
&lt;li&gt;ssl/tls1.h&lt;/li&gt;
&lt;li&gt;test/Makefile&lt;/li&gt;
&lt;li&gt;util/libeay.num&lt;/li&gt;
&lt;li&gt;util/mkbuildinf.pl&lt;/li&gt;
&lt;li&gt;util/mkdef.pl&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;This list can be created by adding the official openssl repo as
upstream for the 1.0.2-chacha branch, and by comparing (diffing) the
branches:&lt;/div&gt;
&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git remote add upstream https://github.com/openssl/openssl.git&lt;/span&gt;
&lt;span class="go"&gt;git diff 1.0.2-chacha upstream/OpenSSL_1_0_2-stable&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Please enjoy!&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>FREAK!</title><link href="https://www.onwebsecurity.com/security/freak.html" rel="alternate"></link><published>2015-03-04T11:40:00+00:00</published><updated>2015-03-04T11:40:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-03-04:/security/freak.html</id><summary type="html">&lt;p&gt;As you probably read somewhere else, and on another place, and another... on
March 3rd 2015, another attack on SSL/TLS was published. Following the tradition
of BEAST, CRIME, Heartbleed, LUCKY13 and POODLE this one also has a catchy name:
FREAK (Factoring RSA Export Keys).&lt;/p&gt;
&lt;p&gt;It's a man-in-the-middle attack where a man in the middle can decrypt a SSL/TLS
connection between a client and a server.&lt;/p&gt;
&lt;p&gt;&lt;img alt="FREAK" src="https://www.onwebsecurity.com/images/FREAK.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Vulnerable *servers* are servers that accept export-grade ciphers
(RSA-EXPORT). Checking whether a server is vulnerable can be done in
many ways.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Take for example
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/blob/master/analyze_hosts.py"&gt;analyze_hosts.py&lt;/a&gt;,
a Python wrapper around several tools:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;analyze_hosts --ssl HOST&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you see any EXPort ciphers, the server is vulnerable.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Another way is by using
&lt;a class="reference external" href="https://github.com/jvehent/cipherscan"&gt;cipherscan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;cipherscan HOST:443&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you see any EXPort ciphers, the server is vulnerable.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Yet another way is by using nmap:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;nmap --script ssl-enum-ciphers -p433 HOST&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you see any EXPort ciphers, the server is vulnerable.&lt;/p&gt;
&lt;p&gt;You get the idea...&lt;/p&gt;
&lt;p&gt;Mitigate this vulnerability server-side by making sure that your server
doesn't allow export ciphers in the OpenSSL configuration: add the
following expression&lt;/p&gt;
&lt;pre class="literal-block"&gt;
!EXP
&lt;/pre&gt;
&lt;p&gt;There are also vulnerable clients...&lt;/p&gt;
&lt;p&gt;Clients using OpenSSL are &lt;strong&gt;not&lt;/strong&gt; vulnerable if they were built after
&lt;a class="reference external" href="https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-0204"&gt;CVE-2015-0204&lt;/a&gt; was
published.&lt;/p&gt;
&lt;p&gt;The …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As you probably read somewhere else, and on another place, and another... on
March 3rd 2015, another attack on SSL/TLS was published. Following the tradition
of BEAST, CRIME, Heartbleed, LUCKY13 and POODLE this one also has a catchy name:
FREAK (Factoring RSA Export Keys).&lt;/p&gt;
&lt;p&gt;It's a man-in-the-middle attack where a man in the middle can decrypt a SSL/TLS
connection between a client and a server.&lt;/p&gt;
&lt;p&gt;&lt;img alt="FREAK" src="https://www.onwebsecurity.com/images/FREAK.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Vulnerable *servers* are servers that accept export-grade ciphers
(RSA-EXPORT). Checking whether a server is vulnerable can be done in
many ways.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Take for example
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/blob/master/analyze_hosts.py"&gt;analyze_hosts.py&lt;/a&gt;,
a Python wrapper around several tools:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;analyze_hosts --ssl HOST&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you see any EXPort ciphers, the server is vulnerable.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Another way is by using
&lt;a class="reference external" href="https://github.com/jvehent/cipherscan"&gt;cipherscan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;cipherscan HOST:443&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you see any EXPort ciphers, the server is vulnerable.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Yet another way is by using nmap:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;nmap --script ssl-enum-ciphers -p433 HOST&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you see any EXPort ciphers, the server is vulnerable.&lt;/p&gt;
&lt;p&gt;You get the idea...&lt;/p&gt;
&lt;p&gt;Mitigate this vulnerability server-side by making sure that your server
doesn't allow export ciphers in the OpenSSL configuration: add the
following expression&lt;/p&gt;
&lt;pre class="literal-block"&gt;
!EXP
&lt;/pre&gt;
&lt;p&gt;There are also vulnerable clients...&lt;/p&gt;
&lt;p&gt;Clients using OpenSSL are &lt;strong&gt;not&lt;/strong&gt; vulnerable if they were built after
&lt;a class="reference external" href="https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-0204"&gt;CVE-2015-0204&lt;/a&gt; was
published.&lt;/p&gt;
&lt;p&gt;The current/latest version of 1.0.2-chacha, the OpenSSL fork including ChaCha20
and Poly1305 is not vulnerable. The fork is being kept up to date on a regular
base. See &lt;a class="reference external" href="https://www.onwebsecurity.com/cryptography/openssl"&gt;https://www.onwebsecurity.com/cryptography/openssl&lt;/a&gt; for the latest
Windows binaries, and more information on the source.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;This attack method is possible due to the NSA deliberately weakening crypto.
Read more on this fascinating story at
&lt;a class="reference external" href="https://blog.cryptographyengineering.com/2015/03/attack-of-week-freak-or-factoring-nsa.html"&gt;https://blog.cryptographyengineering.com/2015/03/attack-of-week-freak-or-factoring-nsa.html&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To paraphrase cryptographer Matthew Green: &lt;em&gt;&amp;quot;Encryption backdoors will
always turn around and bite you in the ass. They are never worth it.&amp;quot;&lt;/em&gt;&lt;/p&gt;
</content><category term="openssl"></category><category term="pentesting"></category><category term="tls"></category><category term="vulnerability"></category></entry><entry><title>Us versus them: CrikeyCon 2015 review</title><link href="https://www.onwebsecurity.com/opinion/us-versus-them-crikeycon-2015-review.html" rel="alternate"></link><published>2015-02-26T11:27:00+00:00</published><updated>2015-02-26T11:27:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-02-26:/opinion/us-versus-them-crikeycon-2015-review.html</id><summary type="html">&lt;p&gt;I had the chance to visit &lt;a class="reference external" href="http://crikeycon.com"&gt;CrikeyCon&lt;/a&gt; February 2015,
which was held in Brisbane&lt;/p&gt;
&lt;p&gt;&lt;img alt="CrikeyCon" src="https://www.onwebsecurity.com/images/crikeycon-2015.png" /&gt;&lt;/p&gt;
&lt;p&gt;It was the second time this event was held, but it already got the looks and
feel of a professional organization behind it. The program was really diverse,
from social engineering and awkward hugs to iOS runtime hacking, and everything
in between.&lt;/p&gt;
&lt;p&gt;Takeaway ? Well, it surprised me to hear that there's still a general
feeling of &lt;em&gt;us&lt;/em&gt; versus &lt;em&gt;them&lt;/em&gt;. We the security gods who lay bare all the
faults and stupid mistakes the others make.&lt;/p&gt;
&lt;p&gt;As a security professional, especially as a pentester, it's your job
to find vulnerabilities and weaknesses. It's your job to hunt for
other people's mistakes, lack of knowledge, or constrained security
budgets. Security falls into the quality assurance department.&lt;/p&gt;
&lt;p&gt;This means that most of the time you're telling other people what's wrong with
an application. Unfortunately it's not your job to tell them how awesome their
web application is, how well it scales, or the nifty features it has.&lt;/p&gt;
&lt;p&gt;One of the more challenging issues when for instance presenting a
pentest report to a group of developers is to get everybody on board, to
get everybody to work together. And if …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I had the chance to visit &lt;a class="reference external" href="http://crikeycon.com"&gt;CrikeyCon&lt;/a&gt; February 2015,
which was held in Brisbane&lt;/p&gt;
&lt;p&gt;&lt;img alt="CrikeyCon" src="https://www.onwebsecurity.com/images/crikeycon-2015.png" /&gt;&lt;/p&gt;
&lt;p&gt;It was the second time this event was held, but it already got the looks and
feel of a professional organization behind it. The program was really diverse,
from social engineering and awkward hugs to iOS runtime hacking, and everything
in between.&lt;/p&gt;
&lt;p&gt;Takeaway ? Well, it surprised me to hear that there's still a general
feeling of &lt;em&gt;us&lt;/em&gt; versus &lt;em&gt;them&lt;/em&gt;. We the security gods who lay bare all the
faults and stupid mistakes the others make.&lt;/p&gt;
&lt;p&gt;As a security professional, especially as a pentester, it's your job
to find vulnerabilities and weaknesses. It's your job to hunt for
other people's mistakes, lack of knowledge, or constrained security
budgets. Security falls into the quality assurance department.&lt;/p&gt;
&lt;p&gt;This means that most of the time you're telling other people what's wrong with
an application. Unfortunately it's not your job to tell them how awesome their
web application is, how well it scales, or the nifty features it has.&lt;/p&gt;
&lt;p&gt;One of the more challenging issues when for instance presenting a
pentest report to a group of developers is to get everybody on board, to
get everybody to work together. And if &lt;em&gt;we&lt;/em&gt; are only telling them what
&lt;em&gt;they&lt;/em&gt; did wrong, well, personally I don't think that's the best way to
get everybody behind the same goal of improving the security.&lt;/p&gt;
&lt;p&gt;Security needs more cooperation. Let's see what &lt;strong&gt;we&lt;/strong&gt; can do better...&lt;/p&gt;
</content><category term="conference"></category></entry><entry><title>OpenSSL 1.0.2 - now with less whitespace!</title><link href="https://www.onwebsecurity.com/announcements/openssl-1-0-2-now-with-less-whitespace.html" rel="alternate"></link><published>2015-02-08T15:34:00+00:00</published><updated>2015-02-08T15:34:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-02-08:/announcements/openssl-1-0-2-now-with-less-whitespace.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;On January 22 2015, version 1.0.2 of OpenSSL was released. Besides
some new bugfixes and features, the biggest change under the hood was
a &lt;a class="reference external" href="https://www.openssl.org/blog/blog/2015/01/05/source-code-reformat/"&gt;complete
reformatting&lt;/a&gt;
of the source code. An &lt;a class="reference external" href="https://www.openssl.org/about/codingstyle.txt"&gt;official coding style
document&lt;/a&gt; was
published, and as a result primarily buckets and lots of tabs and
newline characters have been converted into whitespaces.&lt;/div&gt;
&lt;div class="line"&gt;Personally I hope that this action, which affected the majority of
lines(!) of code, will help the project for the best and will make it
easier to maintain the project in the future.&lt;/div&gt;
&lt;div class="line"&gt;One disadvantage of reformatting code for instance however is that it
makes it a lot harder to spot differences in code between certain
versions, as almost all files have most of their lines changed.&lt;/div&gt;
&lt;div class="line"&gt;Another disadvantage is that merging additional patches (like the
ChaCha20 and Poly1305 ciphers) back into OpenSSL took a great deal of
extra time. Unnecessary time, one might say.&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;The OpenSSL 1.0.2 fork including the ChaCha20 and Poly1305 ciphers has
been pushed to the github repo at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/"&gt;https://github.com/PeterMosmans/openssl/&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;As always, you can find compiled Windows 32 and 64 bit binaries at
&lt;a class="reference external" href="https://www.onwebsecurity.com/cryptography/openssl%20"&gt;https://www.onwebsecurity.com/cryptography/openssl&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;February 2015 update: read …&lt;/p&gt;</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;On January 22 2015, version 1.0.2 of OpenSSL was released. Besides
some new bugfixes and features, the biggest change under the hood was
a &lt;a class="reference external" href="https://www.openssl.org/blog/blog/2015/01/05/source-code-reformat/"&gt;complete
reformatting&lt;/a&gt;
of the source code. An &lt;a class="reference external" href="https://www.openssl.org/about/codingstyle.txt"&gt;official coding style
document&lt;/a&gt; was
published, and as a result primarily buckets and lots of tabs and
newline characters have been converted into whitespaces.&lt;/div&gt;
&lt;div class="line"&gt;Personally I hope that this action, which affected the majority of
lines(!) of code, will help the project for the best and will make it
easier to maintain the project in the future.&lt;/div&gt;
&lt;div class="line"&gt;One disadvantage of reformatting code for instance however is that it
makes it a lot harder to spot differences in code between certain
versions, as almost all files have most of their lines changed.&lt;/div&gt;
&lt;div class="line"&gt;Another disadvantage is that merging additional patches (like the
ChaCha20 and Poly1305 ciphers) back into OpenSSL took a great deal of
extra time. Unnecessary time, one might say.&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;The OpenSSL 1.0.2 fork including the ChaCha20 and Poly1305 ciphers has
been pushed to the github repo at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/"&gt;https://github.com/PeterMosmans/openssl/&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;As always, you can find compiled Windows 32 and 64 bit binaries at
&lt;a class="reference external" href="https://www.onwebsecurity.com/cryptography/openssl%20"&gt;https://www.onwebsecurity.com/cryptography/openssl&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;February 2015 update: read more
&lt;a class="reference external" href="https://www.openssl.org/blog/blog/2015/02/11/code-reformat-finished/"&gt;here&lt;/a&gt;
about the whole reformatting process at OpenSSL&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>CVSSv2 rating of new vulnerabilities patched in OpenSSL</title><link href="https://www.onwebsecurity.com/announcements/cvssv2-rating-of-new-vulnerabilities-patched-in-openssl.html" rel="alternate"></link><published>2015-01-10T04:45:00+00:00</published><updated>2015-01-10T04:45:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2015-01-10:/announcements/cvssv2-rating-of-new-vulnerabilities-patched-in-openssl.html</id><summary type="html">&lt;p&gt;On January 8th, 2015, the OpenSSL team published an &lt;a class="reference external" href="https://openssl.org/news/secadv_20150108.txt"&gt;OpenSSL Security
Advisory&lt;/a&gt; containing 8
previously unknown vulnerabilities in OpenSSL.&lt;/p&gt;
&lt;p&gt;Unfortunately, as with most large software suppliers/vendors nowadays,
OpenSSL uses its own &lt;a class="reference external" href="https://www.openssl.org/about/secpolicy.html"&gt;severity classification
system&lt;/a&gt; for
vulnerabilities. There are many classifications systems out there, which
results in less transparent patching policies and procedures for system
administrators and end users. Fortunately NIST publishes the CVSSv2
Severity Base Score of most, if not all vulnerabilities with a CVE
entry. This makes it easier to classify.&lt;/p&gt;
&lt;p&gt;&lt;img alt="CVSSv2" src="https://www.onwebsecurity.com/images/cvss.png" /&gt;&lt;/p&gt;
&lt;p&gt;Two of the eight vulnerabilities (CVE-2014-3571 and CVE-2015-0205) have
the OpenSSL vulnerability rating 'moderate'. This corresponds to a
CVSSv2 base score of 5.0 (MEDIUM) for
&lt;a class="reference external" href="https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-3571"&gt;CVE-2014-2571&lt;/a&gt;
as well as
&lt;a class="reference external" href="https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-0205"&gt;CVE-2015-0205&lt;/a&gt;
Both of these vulnerabilities could be exploited for a Denial of Service
attack of the OpenSSL service. The remaining six vulnerabilities have a
lower rating.&lt;/p&gt;
&lt;p&gt;The 1.0.2-chacha and 1.0.1-chacha branches of the ChaCha20 - Poly1305
fork of OpenSSL have been patched for all of the published
vulnerabilities.&lt;/p&gt;
&lt;p&gt;As always, see &lt;a class="reference external" href="https://www.onwebsecurity.com/cryptography/openssl"&gt;https://www.onwebsecurity.com/cryptography/openssl&lt;/a&gt; for
the Windows 32 and 64 bit binaries, and more information.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;On January 8th, 2015, the OpenSSL team published an &lt;a class="reference external" href="https://openssl.org/news/secadv_20150108.txt"&gt;OpenSSL Security
Advisory&lt;/a&gt; containing 8
previously unknown vulnerabilities in OpenSSL.&lt;/p&gt;
&lt;p&gt;Unfortunately, as with most large software suppliers/vendors nowadays,
OpenSSL uses its own &lt;a class="reference external" href="https://www.openssl.org/about/secpolicy.html"&gt;severity classification
system&lt;/a&gt; for
vulnerabilities. There are many classifications systems out there, which
results in less transparent patching policies and procedures for system
administrators and end users. Fortunately NIST publishes the CVSSv2
Severity Base Score of most, if not all vulnerabilities with a CVE
entry. This makes it easier to classify.&lt;/p&gt;
&lt;p&gt;&lt;img alt="CVSSv2" src="https://www.onwebsecurity.com/images/cvss.png" /&gt;&lt;/p&gt;
&lt;p&gt;Two of the eight vulnerabilities (CVE-2014-3571 and CVE-2015-0205) have
the OpenSSL vulnerability rating 'moderate'. This corresponds to a
CVSSv2 base score of 5.0 (MEDIUM) for
&lt;a class="reference external" href="https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-3571"&gt;CVE-2014-2571&lt;/a&gt;
as well as
&lt;a class="reference external" href="https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-0205"&gt;CVE-2015-0205&lt;/a&gt;
Both of these vulnerabilities could be exploited for a Denial of Service
attack of the OpenSSL service. The remaining six vulnerabilities have a
lower rating.&lt;/p&gt;
&lt;p&gt;The 1.0.2-chacha and 1.0.1-chacha branches of the ChaCha20 - Poly1305
fork of OpenSSL have been patched for all of the published
vulnerabilities.&lt;/p&gt;
&lt;p&gt;As always, see &lt;a class="reference external" href="https://www.onwebsecurity.com/cryptography/openssl"&gt;https://www.onwebsecurity.com/cryptography/openssl&lt;/a&gt; for
the Windows 32 and 64 bit binaries, and more information.&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>MSYS2 - successful successor of MSYS ?</title><link href="https://www.onwebsecurity.com/opinion/msys2-succesful-successor-of-msys.html" rel="alternate"></link><published>2014-12-05T09:34:00+00:00</published><updated>2014-12-05T09:34:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-12-05:/opinion/msys2-succesful-successor-of-msys.html</id><summary type="html">&lt;p&gt;&lt;img alt="MSYS2" src="https://www.onwebsecurity.com/images/msys2.png" /&gt;&lt;/p&gt;
&lt;p&gt;MSYS can best be described as a Bash shell and some GNU tools, which facilitate
compiling sources under and for a Windows environment. It's the environment to
use when compiling for instance OpenSSL or Emacs on Windows.&lt;/p&gt;
&lt;p&gt;MSYS2 is the 'new and improved' version of MSYS.&lt;/p&gt;
&lt;p&gt;One of its biggest advantages is better package management. MSYS2 has pacman, a
package manager from Arch Linux. Upgrading can finally be done from within the
shell session itself, with only a few basic commands.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; download package descriptions from the remote repositories
&lt;span class="go"&gt;pacman -Sy&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt; upgrade MSYS2 core components and the shell itself
&lt;span class="go"&gt;pacman --needed -S bash pacman msys2-runtime&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt; restart MSYS2 &lt;span class="k"&gt;if&lt;/span&gt; any package needed updating, &lt;span class="k"&gt;then&lt;/span&gt; update the rest
&lt;span class="go"&gt;pacman -Su&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This was 'somewhat more difficult' under MSYS.&lt;/p&gt;
&lt;p&gt;Another advantage is the Bash version - currently at 4.3.30 versus 3.1.17 on
MSYS. Bash 4 means support for functions like associative arrays and fancier
redirections:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; redirect stdout and stderr at the same &lt;span class="nb"&gt;time&lt;/span&gt;
&lt;span class="go"&gt;command &amp;amp;&amp;gt; output&lt;/span&gt;

&lt;span class="gp"&gt;#&lt;/span&gt; same &lt;span class="nb"&gt;command&lt;/span&gt; in Bash &lt;span class="m"&gt;3&lt;/span&gt; syntax
&lt;span class="go"&gt;command &amp;gt; output 2&amp;gt;&amp;amp;1&lt;/span&gt;

&lt;span class="gp"&gt;#&lt;/span&gt; pipe stdout and stderr at the same &lt;span class="nb"&gt;time&lt;/span&gt;
&lt;span class="go"&gt;command |&amp;amp; someothercommand&lt;/span&gt;

&lt;span class="gp"&gt;#&lt;/span&gt; same &lt;span class="nb"&gt;command&lt;/span&gt; in Bash &lt;span class="m"&gt;3&lt;/span&gt; syntax
&lt;span class="go"&gt;command 2&amp;gt;&amp;amp;1 \| someothercommand&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The third big plus is that it's …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="MSYS2" src="https://www.onwebsecurity.com/images/msys2.png" /&gt;&lt;/p&gt;
&lt;p&gt;MSYS can best be described as a Bash shell and some GNU tools, which facilitate
compiling sources under and for a Windows environment. It's the environment to
use when compiling for instance OpenSSL or Emacs on Windows.&lt;/p&gt;
&lt;p&gt;MSYS2 is the 'new and improved' version of MSYS.&lt;/p&gt;
&lt;p&gt;One of its biggest advantages is better package management. MSYS2 has pacman, a
package manager from Arch Linux. Upgrading can finally be done from within the
shell session itself, with only a few basic commands.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; download package descriptions from the remote repositories
&lt;span class="go"&gt;pacman -Sy&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt; upgrade MSYS2 core components and the shell itself
&lt;span class="go"&gt;pacman --needed -S bash pacman msys2-runtime&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt; restart MSYS2 &lt;span class="k"&gt;if&lt;/span&gt; any package needed updating, &lt;span class="k"&gt;then&lt;/span&gt; update the rest
&lt;span class="go"&gt;pacman -Su&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This was 'somewhat more difficult' under MSYS.&lt;/p&gt;
&lt;p&gt;Another advantage is the Bash version - currently at 4.3.30 versus 3.1.17 on
MSYS. Bash 4 means support for functions like associative arrays and fancier
redirections:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; redirect stdout and stderr at the same &lt;span class="nb"&gt;time&lt;/span&gt;
&lt;span class="go"&gt;command &amp;amp;&amp;gt; output&lt;/span&gt;

&lt;span class="gp"&gt;#&lt;/span&gt; same &lt;span class="nb"&gt;command&lt;/span&gt; in Bash &lt;span class="m"&gt;3&lt;/span&gt; syntax
&lt;span class="go"&gt;command &amp;gt; output 2&amp;gt;&amp;amp;1&lt;/span&gt;

&lt;span class="gp"&gt;#&lt;/span&gt; pipe stdout and stderr at the same &lt;span class="nb"&gt;time&lt;/span&gt;
&lt;span class="go"&gt;command |&amp;amp; someothercommand&lt;/span&gt;

&lt;span class="gp"&gt;#&lt;/span&gt; same &lt;span class="nb"&gt;command&lt;/span&gt; in Bash &lt;span class="m"&gt;3&lt;/span&gt; syntax
&lt;span class="go"&gt;command 2&amp;gt;&amp;amp;1 \| someothercommand&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The third big plus is that it's easier to switch between a 32 bit and
64 bit environment.&lt;/p&gt;
&lt;p&gt;With MSYS you had to change the mapping in &lt;code class="code"&gt;
/etc/fstab&lt;/code&gt;
 of &lt;code class="code"&gt;
/mingw&lt;/code&gt;
.
That meant that files that you installed in &lt;code class="code"&gt;
/mingw&lt;/code&gt;
 in one environment
weren't available in the other.&lt;/p&gt;
&lt;p&gt;MSYS2 keeps the same environments accessible at the same time - &lt;code class="code"&gt;
/mingw32&lt;/code&gt;

for 32 bit, and &lt;code class="code"&gt;
/mingw64&lt;/code&gt;
 for 64 bit. You can install packages for one
environment while you're in the other.&lt;/p&gt;
&lt;p&gt;All OpenSSL binaries that are distributed through this site will be built using
MSYS2 from now on.&lt;/p&gt;
&lt;p&gt;MSYS2 can be found at &lt;a class="reference external" href="https://sourceforge.net/projects/msys2/"&gt;https://sourceforge.net/projects/msys2/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;More on pacman at &lt;a class="reference external" href="https://wiki.archlinux.org/index.php/pacman"&gt;https://wiki.archlinux.org/index.php/pacman&lt;/a&gt;&lt;/p&gt;
</content><category term="msys2"></category><category term="windows"></category></entry><entry><title>OpenSSL: Fatal SSL alert number 47 (Illegal Parameter)</title><link href="https://www.onwebsecurity.com/announcements/openssl-fatal-ssl-alert-number-47-illegal-parameter.html" rel="alternate"></link><published>2014-11-25T06:33:00+00:00</published><updated>2014-11-25T06:33:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-11-25:/announcements/openssl-fatal-ssl-alert-number-47-illegal-parameter.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;As a pentester, I regularly test the configuration of SSL servers. For
this purpose I use my &lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;customized OpenSSL
fork&lt;/a&gt; which contains a lot
more ciphers than the official version, and &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts"&gt;wrapper
scripts&lt;/a&gt; (easier
than remembering command line options).&lt;/div&gt;
&lt;div class="line"&gt;Last month I ran into an issue with servers behind a SSL terminator
from a well-known network equipment supplier. As soon as the SSL
Client Hello offered 128 or more ciphers to the server and the tls1_2
protocol was specified, the handshake was aborted with the following
error message&lt;/div&gt;
&lt;/div&gt;
&lt;pre class="literal-block"&gt;
9304:error:14094417:SSL routines:ssl3_read_bytes:sslv3 alert illegal parameter:s3_pkt.c:1481:SSL alert number 47 9304:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:636:
&lt;/pre&gt;
&lt;p&gt;The supplier hadn't heard of this bug yet - I suspect that not that many
browsers or generic SSL clients offer 128 or more ciphers. A bugreport
has been filed.&lt;/p&gt;
&lt;p&gt;To facilitate the testing of SSL/TLS handshakes I created a script,
which can be found at
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/blob/master/test_ssl_handshake.sh"&gt;GitHub&lt;/a&gt;.
Currently 3 handshake bugs are identified.&lt;/p&gt;
&lt;p&gt;Of course you can test for this bug using a version of OpenSSL with enough (128
or more) ciphers, and the command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;openssl s_client -connect host:port -tls1_2&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;As a pentester, I regularly test the configuration of SSL servers. For
this purpose I use my &lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;customized OpenSSL
fork&lt;/a&gt; which contains a lot
more ciphers than the official version, and &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts"&gt;wrapper
scripts&lt;/a&gt; (easier
than remembering command line options).&lt;/div&gt;
&lt;div class="line"&gt;Last month I ran into an issue with servers behind a SSL terminator
from a well-known network equipment supplier. As soon as the SSL
Client Hello offered 128 or more ciphers to the server and the tls1_2
protocol was specified, the handshake was aborted with the following
error message&lt;/div&gt;
&lt;/div&gt;
&lt;pre class="literal-block"&gt;
9304:error:14094417:SSL routines:ssl3_read_bytes:sslv3 alert illegal parameter:s3_pkt.c:1481:SSL alert number 47 9304:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:636:
&lt;/pre&gt;
&lt;p&gt;The supplier hadn't heard of this bug yet - I suspect that not that many
browsers or generic SSL clients offer 128 or more ciphers. A bugreport
has been filed.&lt;/p&gt;
&lt;p&gt;To facilitate the testing of SSL/TLS handshakes I created a script,
which can be found at
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/blob/master/test_ssl_handshake.sh"&gt;GitHub&lt;/a&gt;.
Currently 3 handshake bugs are identified.&lt;/p&gt;
&lt;p&gt;Of course you can test for this bug using a version of OpenSSL with enough (128
or more) ciphers, and the command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;openssl s_client -connect host:port -tls1_2&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
</content><category term="openssl"></category></entry><entry><title>Black Hat Europe 2014 review</title><link href="https://www.onwebsecurity.com/opinion/black-hat-europe-2014-review.html" rel="alternate"></link><published>2014-11-11T12:56:00+00:00</published><updated>2014-11-11T12:56:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-11-11:/opinion/black-hat-europe-2014-review.html</id><summary type="html">&lt;p&gt;Black Hat Europe was held in Amsterdam in October, 2014. The so called Briefings
(tech talks) were extremely versatile, ranging from Android pentesting to SCADA
hacks. It was difficult to choose which talk to attend - there were around 50 or
so, each title vying for your attention (&amp;quot;Hack Your ATM with Friend's
Raspberry.Py&amp;quot; [sic], or &amp;quot;Endrun - Secure Digital Communications for Our Modern
Dystopia&amp;quot;).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Black Hat Europe 2014" src="https://www.onwebsecurity.com/images/Black_Hat_Europe_2014.png" /&gt;&lt;/p&gt;
&lt;p&gt;I really enjoyed the technical depth of some talks, and it was great to hear
someone like Adi Shamir, one of the inventors of the famous RSA algorithm, talk
about his current research.&lt;/p&gt;
&lt;p&gt;Because of the sheer size I couldn't find one generic takeaway, or see the, or a
current bigger picture in information security land. Even all of the vendors'
offerings looked similar.&lt;/p&gt;
&lt;p&gt;Now that I come to think of it, that actually IS the key takeaway:
&lt;strong&gt;Genericity&lt;/strong&gt;.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;Black Hat Europe was held in Amsterdam in October, 2014. The so called Briefings
(tech talks) were extremely versatile, ranging from Android pentesting to SCADA
hacks. It was difficult to choose which talk to attend - there were around 50 or
so, each title vying for your attention (&amp;quot;Hack Your ATM with Friend's
Raspberry.Py&amp;quot; [sic], or &amp;quot;Endrun - Secure Digital Communications for Our Modern
Dystopia&amp;quot;).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Black Hat Europe 2014" src="https://www.onwebsecurity.com/images/Black_Hat_Europe_2014.png" /&gt;&lt;/p&gt;
&lt;p&gt;I really enjoyed the technical depth of some talks, and it was great to hear
someone like Adi Shamir, one of the inventors of the famous RSA algorithm, talk
about his current research.&lt;/p&gt;
&lt;p&gt;Because of the sheer size I couldn't find one generic takeaway, or see the, or a
current bigger picture in information security land. Even all of the vendors'
offerings looked similar.&lt;/p&gt;
&lt;p&gt;Now that I come to think of it, that actually IS the key takeaway:
&lt;strong&gt;Genericity&lt;/strong&gt;.&lt;/p&gt;
</content><category term="conference"></category></entry><entry><title>Creating and verifying digital signatures of files</title><link href="https://www.onwebsecurity.com/security/creating-and-verifying-digital-signatures-of-files.html" rel="alternate"></link><published>2014-10-28T06:51:00+00:00</published><updated>2014-10-28T06:51:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-10-28:/security/creating-and-verifying-digital-signatures-of-files.html</id><summary type="html">&lt;p&gt;Digital signatures can be used to establish the authenticity and integrity of a
(binary) file. These signatures can also be used for non-repudiation purposes,
but that's usually not the intention when you're distributing or receiving
files. (Note: non-repudiation means impossible to reject; to make sure beyond a
doubt that the signer's key has been used to create that signature).&lt;/p&gt;
&lt;p&gt;The easiest and most secure way of creating and verifying digital signatures is
by using PGP. The following commands assume that you have downloaded and
configured GPG, the free and complete implementation of the OpenPGP standard.&lt;/p&gt;
&lt;div class="section" id="create-a-digital-signature-of-filename"&gt;
&lt;h2&gt;Create a digital signature of FILENAME&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gpg --armor --detach-sig --output FILENAME.sig FILENAME&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;table class="docutils option-list" frame="void" rules="none"&gt;
&lt;col class="option" /&gt;
&lt;col class="description" /&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--armor&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;make sure that the file is ASCII armored (Radix-64 encoded)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--detach-sig&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;create a separate signature file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--output&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;the name of the signature file&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="section" id="paranoid-options"&gt;
&lt;h2&gt;Paranoid options&lt;/h2&gt;
&lt;table class="docutils option-list" frame="void" rules="none"&gt;
&lt;col class="option" /&gt;
&lt;col class="description" /&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--no-version&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;don't show which software version has been used to create the signature&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--comment&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;don't show which software has been used to create the signature&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="section" id="verify-a-digital-signature"&gt;
&lt;h2&gt;Verify a digital signature&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gpg --verify FILENAME.sig&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command assumes that the original file is FILENAME and resides in the same
location as the signature file FILENAME.sig. To verify a signature you also need
the signer's public key. If …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Digital signatures can be used to establish the authenticity and integrity of a
(binary) file. These signatures can also be used for non-repudiation purposes,
but that's usually not the intention when you're distributing or receiving
files. (Note: non-repudiation means impossible to reject; to make sure beyond a
doubt that the signer's key has been used to create that signature).&lt;/p&gt;
&lt;p&gt;The easiest and most secure way of creating and verifying digital signatures is
by using PGP. The following commands assume that you have downloaded and
configured GPG, the free and complete implementation of the OpenPGP standard.&lt;/p&gt;
&lt;div class="section" id="create-a-digital-signature-of-filename"&gt;
&lt;h2&gt;Create a digital signature of FILENAME&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gpg --armor --detach-sig --output FILENAME.sig FILENAME&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;table class="docutils option-list" frame="void" rules="none"&gt;
&lt;col class="option" /&gt;
&lt;col class="description" /&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--armor&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;make sure that the file is ASCII armored (Radix-64 encoded)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--detach-sig&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;create a separate signature file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--output&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;the name of the signature file&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="section" id="paranoid-options"&gt;
&lt;h2&gt;Paranoid options&lt;/h2&gt;
&lt;table class="docutils option-list" frame="void" rules="none"&gt;
&lt;col class="option" /&gt;
&lt;col class="description" /&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--no-version&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;don't show which software version has been used to create the signature&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="option-group"&gt;
&lt;kbd&gt;&lt;span class="option"&gt;--comment&lt;/span&gt;&lt;/kbd&gt;&lt;/td&gt;
&lt;td&gt;don't show which software has been used to create the signature&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="section" id="verify-a-digital-signature"&gt;
&lt;h2&gt;Verify a digital signature&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gpg --verify FILENAME.sig&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command assumes that the original file is FILENAME and resides in the same
location as the signature file FILENAME.sig. To verify a signature you also need
the signer's public key. If you don't have that key you can add it to your local
keyring.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="add-a-public-key-to-your-keyring"&gt;
&lt;h2&gt;Add a public key to your keyring&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gpg --recv-keys KEYID&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You also can use &lt;code class="code"&gt;
--keyserver KEYSERVER&lt;/code&gt;
 to specify a keyserver.&lt;/p&gt;
&lt;/div&gt;
</content><category term="openpgp"></category></entry><entry><title>Patched openssl SSLv3 downgrade attack (POODLE) with ChaCha20 and Poly1305 support</title><link href="https://www.onwebsecurity.com/announcements/patched-openssl-sslv3-downgrade-attack-poodle-with-chacha20-and-poly1305-support.html" rel="alternate"></link><published>2014-10-25T07:35:00+00:00</published><updated>2014-10-25T07:35:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-10-25:/announcements/patched-openssl-sslv3-downgrade-attack-poodle-with-chacha20-and-poly1305-support.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;The OpenSSL team published a security advisory on October 15th 2014,
see &lt;a class="reference external" href="https://www.openssl.org/news/secadv_20141015.txt"&gt;the OpenSSL
site&lt;/a&gt; for more
information.&lt;/div&gt;
&lt;div class="line"&gt;In short, SSLv3 using Cipher Block Chaining mode (CBC) has a weakness,
which can be exploited using the POODLE attack having CVE entry
CVE-2014-3566.&lt;/div&gt;
&lt;div class="line"&gt;The POODLE attack depends on SSLv3 and tries to downgrade a connection
to that specific, really old protocol. This downgrade can be mitigated
by using the signaling cipher suite value (SCSV) TLS_FALLBACK_SCSV,
which is implemented in the/this latest version of openssl. Please be
advised that not only the server, but the client itself also has to
support this relatively new method.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;All vulnerabilities in the advisory have been patched in the latest
versions of OpenSSL 1.0.2-chacha. Moreover, the new binaries/source are
aligned with the latest beta release (3).&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;SRTP Memory Leak (CVE-2014-3513)&lt;/li&gt;
&lt;li&gt;Session Ticket Memory Leak (CVE-2014-3567)&lt;/li&gt;
&lt;li&gt;SSL 3.0 Fallback protection&lt;/li&gt;
&lt;li&gt;Build option no-ssl3 is incomplete (CVE-2014-3568)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, check &lt;a class="reference external" href="https://onwebsecurity.com/cryptography/openssl"&gt;https://onwebsecurity.com/cryptography/openssl&lt;/a&gt; for the
latest Windows 32 and 64 bit binaries, and
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt; for the latest sources.&lt;/p&gt;
</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;The OpenSSL team published a security advisory on October 15th 2014,
see &lt;a class="reference external" href="https://www.openssl.org/news/secadv_20141015.txt"&gt;the OpenSSL
site&lt;/a&gt; for more
information.&lt;/div&gt;
&lt;div class="line"&gt;In short, SSLv3 using Cipher Block Chaining mode (CBC) has a weakness,
which can be exploited using the POODLE attack having CVE entry
CVE-2014-3566.&lt;/div&gt;
&lt;div class="line"&gt;The POODLE attack depends on SSLv3 and tries to downgrade a connection
to that specific, really old protocol. This downgrade can be mitigated
by using the signaling cipher suite value (SCSV) TLS_FALLBACK_SCSV,
which is implemented in the/this latest version of openssl. Please be
advised that not only the server, but the client itself also has to
support this relatively new method.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;All vulnerabilities in the advisory have been patched in the latest
versions of OpenSSL 1.0.2-chacha. Moreover, the new binaries/source are
aligned with the latest beta release (3).&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;SRTP Memory Leak (CVE-2014-3513)&lt;/li&gt;
&lt;li&gt;Session Ticket Memory Leak (CVE-2014-3567)&lt;/li&gt;
&lt;li&gt;SSL 3.0 Fallback protection&lt;/li&gt;
&lt;li&gt;Build option no-ssl3 is incomplete (CVE-2014-3568)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, check &lt;a class="reference external" href="https://onwebsecurity.com/cryptography/openssl"&gt;https://onwebsecurity.com/cryptography/openssl&lt;/a&gt; for the
latest Windows 32 and 64 bit binaries, and
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt; for the latest sources.&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>Patched vulnerabilities in OpenSSL with ChaCha20 and Poly1305 support</title><link href="https://www.onwebsecurity.com/announcements/patched-vulnerabilities-in-openssl-with-chacha20-and-poly1305-support.html" rel="alternate"></link><published>2014-08-07T14:49:00+00:00</published><updated>2014-08-07T14:49:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-08-07:/announcements/patched-vulnerabilities-in-openssl-with-chacha20-and-poly1305-support.html</id><summary type="html">&lt;p&gt;The OpenSSL team published a security advisory on August 6th 2014, see
&lt;a class="reference external" href="https://www.openssl.org/news/secadv_20140806.txt"&gt;the OpenSSL site&lt;/a&gt;
for more information. All vulnerabilities in that advisory have been
patched in the latest versions of OpenSSL 1.0.1-chacha and 1.0.2-chacha:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Information leak in pretty printing functions (CVE-2014-3508)&lt;/li&gt;
&lt;li&gt;Crash with SRP ciphersuite in Server Hello message (CVE-2014-5139)&lt;/li&gt;
&lt;li&gt;Race condition in ssl_parse_serverhello_tlsext (CVE-2014-3509)&lt;/li&gt;
&lt;li&gt;Double Free when processing DTLS packets (CVE-2014-3505)&lt;/li&gt;
&lt;li&gt;DTLS memory exhaustion (CVE-2014-3506)&lt;/li&gt;
&lt;li&gt;DTLS memory leak from zero-length fragments (CVE-2014-3507)&lt;/li&gt;
&lt;li&gt;OpenSSL DTLS anonymous EC(DH) denial of service (CVE-2014-3510)&lt;/li&gt;
&lt;li&gt;OpenSSL TLS protocol downgrade attack (CVE-2014-3511)&lt;/li&gt;
&lt;li&gt;SRP buffer overrun (CVE-2014-3512)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, check &lt;a class="reference external" href="https://onwebsecurity.com/cryptography/openssl"&gt;https://onwebsecurity.com/cryptography/openssl&lt;/a&gt; for the
latest Windows 32 and 64 bit binaries, and
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt; for the latest sources.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;The OpenSSL team published a security advisory on August 6th 2014, see
&lt;a class="reference external" href="https://www.openssl.org/news/secadv_20140806.txt"&gt;the OpenSSL site&lt;/a&gt;
for more information. All vulnerabilities in that advisory have been
patched in the latest versions of OpenSSL 1.0.1-chacha and 1.0.2-chacha:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Information leak in pretty printing functions (CVE-2014-3508)&lt;/li&gt;
&lt;li&gt;Crash with SRP ciphersuite in Server Hello message (CVE-2014-5139)&lt;/li&gt;
&lt;li&gt;Race condition in ssl_parse_serverhello_tlsext (CVE-2014-3509)&lt;/li&gt;
&lt;li&gt;Double Free when processing DTLS packets (CVE-2014-3505)&lt;/li&gt;
&lt;li&gt;DTLS memory exhaustion (CVE-2014-3506)&lt;/li&gt;
&lt;li&gt;DTLS memory leak from zero-length fragments (CVE-2014-3507)&lt;/li&gt;
&lt;li&gt;OpenSSL DTLS anonymous EC(DH) denial of service (CVE-2014-3510)&lt;/li&gt;
&lt;li&gt;OpenSSL TLS protocol downgrade attack (CVE-2014-3511)&lt;/li&gt;
&lt;li&gt;SRP buffer overrun (CVE-2014-3512)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, check &lt;a class="reference external" href="https://onwebsecurity.com/cryptography/openssl"&gt;https://onwebsecurity.com/cryptography/openssl&lt;/a&gt; for the
latest Windows 32 and 64 bit binaries, and
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt; for the latest sources.&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>DevOps 2014 Brisbane and security</title><link href="https://www.onwebsecurity.com/opinion/devops-2014-brisbane-and-security.html" rel="alternate"></link><published>2014-07-28T13:10:00+00:00</published><updated>2014-07-28T13:10:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-07-28:/opinion/devops-2014-brisbane-and-security.html</id><summary type="html">&lt;p&gt;DevOps is a worldwide phenomenon, which is reflected by the global
popularity of its major event, the DevOps Days.&lt;/p&gt;
&lt;p&gt;&lt;img alt="DevOps Days 2014 - Brisbane" src="/images/dodbne2014.png" /&gt;&lt;/p&gt;
&lt;p&gt;I was fortunate enough to attend the DevOps Days 2014 in Brisbane.&lt;/p&gt;
&lt;p&gt;The keynote speaker was &lt;a class="reference external" href="http://sidneydekker.com"&gt;Sidney Dekker&lt;/a&gt;, a
Dutchman who has extensive experience on human factors and safety. He
argued that a lot of major incidents don't have any precursor events.&lt;/p&gt;
&lt;p&gt;You can have a clean track record with regards to security and still
suffer a huge incident. Do I agree ? Not completely, but nonetheless
thought provoking.&lt;/p&gt;
&lt;p&gt;Personally I think that the inverse will always hold true: There is a higher
chance on a major security incidents after a number of several minor security
incidents. Cluttered desks mean cluttered minds after all.&lt;/p&gt;
&lt;p&gt;Some buzzwords and issues that were (frequently) discussed:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://www.docker.com/"&gt;Docker&lt;/a&gt; - A lightweight virtualization
platform (can it live up to its sky-high expectations ?)&lt;/li&gt;
&lt;li&gt;Microservices - Build small, independently deployable services&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://github.com/Netflix/SimianArmy/wiki/Chaos-Monkey"&gt;ChaosMonkey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Terminate random virtual machines to test (and improve) resiliency&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://en.wikipedia.org/wiki/W._Edwards_Deming"&gt;Edwards Deming&lt;/a&gt; -
The godfather of Devops ?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For me the key takeaway was that DevOps doesn't really changes your
(level of operational) security. Whether system administrators deploy
code built by developers or developers push their own code to an
environment - in both …&lt;/p&gt;</summary><content type="html">&lt;p&gt;DevOps is a worldwide phenomenon, which is reflected by the global
popularity of its major event, the DevOps Days.&lt;/p&gt;
&lt;p&gt;&lt;img alt="DevOps Days 2014 - Brisbane" src="/images/dodbne2014.png" /&gt;&lt;/p&gt;
&lt;p&gt;I was fortunate enough to attend the DevOps Days 2014 in Brisbane.&lt;/p&gt;
&lt;p&gt;The keynote speaker was &lt;a class="reference external" href="http://sidneydekker.com"&gt;Sidney Dekker&lt;/a&gt;, a
Dutchman who has extensive experience on human factors and safety. He
argued that a lot of major incidents don't have any precursor events.&lt;/p&gt;
&lt;p&gt;You can have a clean track record with regards to security and still
suffer a huge incident. Do I agree ? Not completely, but nonetheless
thought provoking.&lt;/p&gt;
&lt;p&gt;Personally I think that the inverse will always hold true: There is a higher
chance on a major security incidents after a number of several minor security
incidents. Cluttered desks mean cluttered minds after all.&lt;/p&gt;
&lt;p&gt;Some buzzwords and issues that were (frequently) discussed:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://www.docker.com/"&gt;Docker&lt;/a&gt; - A lightweight virtualization
platform (can it live up to its sky-high expectations ?)&lt;/li&gt;
&lt;li&gt;Microservices - Build small, independently deployable services&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://github.com/Netflix/SimianArmy/wiki/Chaos-Monkey"&gt;ChaosMonkey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Terminate random virtual machines to test (and improve) resiliency&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://en.wikipedia.org/wiki/W._Edwards_Deming"&gt;Edwards Deming&lt;/a&gt; -
The godfather of Devops ?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For me the key takeaway was that DevOps doesn't really changes your
(level of operational) security. Whether system administrators deploy
code built by developers or developers push their own code to an
environment - in both instances the implicit level of trust doesn't
change. Yes, procedures change, quite profound sometimes.&lt;/p&gt;
&lt;p&gt;Still I was left with the overall impression that there are more
developers interested in moving towards DevOps than system
administrators....&lt;/p&gt;
</content><category term="conference"></category></entry><entry><title>Should you disable RC4 in SSL/TLS ?</title><link href="https://www.onwebsecurity.com/opinion/should-you-disable-rc4-in-ssltls.html" rel="alternate"></link><published>2014-07-23T11:22:00+00:00</published><updated>2014-07-23T11:22:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-07-23:/opinion/should-you-disable-rc4-in-ssltls.html</id><summary type="html">&lt;p&gt;I'm by no means a crypto expert. Still I'm frequently getting (and
answering) questions regarding the use of RC4 in SSL/TLS. Should you
disable it? Or keep it enabled?&lt;/p&gt;
&lt;p&gt;March 2015 update - A 'new' attack method (&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Bar_mitzvah_attack"&gt;Bar Mitsvah
Attack&lt;/a&gt;) using a
previously known RC4 vulnerability was presented, thereby reducing the
RC4 security even more.&lt;/p&gt;
&lt;p&gt;February 2015 update - RFC 7456 has been published, which effectively
prohibits the use of RC4 in TLS.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;This document requires that Transport Layer Security (TLS) clients&lt;/div&gt;
&lt;div class="line"&gt;and servers never negotiate the use of RC4 cipher suites when they&lt;/div&gt;
&lt;div class="line"&gt;establish connections. This applies to all TLS versions.&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;See
&lt;a class="reference external" href="https://tools.ietf.org/html/rfc7465"&gt;http://tools.ietf.org/html/rfc7465&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is my reasoning to &lt;strong&gt;disable&lt;/strong&gt; all ciphersuites using RC4:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;RC4 is a stream cipher that has been around since 1987. The number
and quality of attacks on RC4 (in SSL/TLS) increases.
&lt;strong&gt;Fact:&lt;/strong&gt; Attacks on encryption algorithms only get better, they
never get worse.&lt;/li&gt;
&lt;li&gt;A lot of sites still enable RC4 in their ciphers, to support a wide
browser base.
&lt;strong&gt;Fact:&lt;/strong&gt; Even Internet Explorer on Windows XP supports DES-CBC3-SHA
(an alternative to one of the RC4 ciphers)&lt;/li&gt;
&lt;li&gt;RC4 is one of the few ciphers that is resistant to the BEAST attack …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I'm by no means a crypto expert. Still I'm frequently getting (and
answering) questions regarding the use of RC4 in SSL/TLS. Should you
disable it? Or keep it enabled?&lt;/p&gt;
&lt;p&gt;March 2015 update - A 'new' attack method (&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Bar_mitzvah_attack"&gt;Bar Mitsvah
Attack&lt;/a&gt;) using a
previously known RC4 vulnerability was presented, thereby reducing the
RC4 security even more.&lt;/p&gt;
&lt;p&gt;February 2015 update - RFC 7456 has been published, which effectively
prohibits the use of RC4 in TLS.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;This document requires that Transport Layer Security (TLS) clients&lt;/div&gt;
&lt;div class="line"&gt;and servers never negotiate the use of RC4 cipher suites when they&lt;/div&gt;
&lt;div class="line"&gt;establish connections. This applies to all TLS versions.&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;See
&lt;a class="reference external" href="https://tools.ietf.org/html/rfc7465"&gt;http://tools.ietf.org/html/rfc7465&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is my reasoning to &lt;strong&gt;disable&lt;/strong&gt; all ciphersuites using RC4:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;RC4 is a stream cipher that has been around since 1987. The number
and quality of attacks on RC4 (in SSL/TLS) increases.
&lt;strong&gt;Fact:&lt;/strong&gt; Attacks on encryption algorithms only get better, they
never get worse.&lt;/li&gt;
&lt;li&gt;A lot of sites still enable RC4 in their ciphers, to support a wide
browser base.
&lt;strong&gt;Fact:&lt;/strong&gt; Even Internet Explorer on Windows XP supports DES-CBC3-SHA
(an alternative to one of the RC4 ciphers)&lt;/li&gt;
&lt;li&gt;RC4 is one of the few ciphers that is resistant to the BEAST attack
&lt;strong&gt;Fact:&lt;/strong&gt; BEAST is a client-side attack, announced in 2011. Since
then, almost all clients (openssl, NSS, SChannel) have mitigations
implemented. BEAST can also be mitigated by using TLS 1.1 and TLS 1.2&lt;/li&gt;
&lt;li&gt;A lot of companies can only use Federal Information Processing
Standard FIPS PUB 140-2 approved algorithms.
&lt;strong&gt;Fact:&lt;/strong&gt; RC4 is not a FIPS-approved algorithm&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What do the crypto experts say ?&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;Bruce Schneier:&lt;/strong&gt; &lt;a class="reference external" href="https://www.schneier.com/blog/archives/2013/03/new_rc4_attack.html"&gt;Move away from RC4 to something like
AES&lt;/a&gt;
(March 2013)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jacob Appelbaum:&lt;/strong&gt; &lt;a class="reference external" href="https://twitter.com/ioerror/status/398059565947699200"&gt;RC4 is broken in realtime by the NSA. Stop
using it&lt;/a&gt;
(November 2013)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Microsoft:&lt;/strong&gt; &lt;a class="reference external" href="http://blogs.technet.com/b/srd/archive/2013/11/12/security-advisory-2868725-recommendation-to-disable-rc4.aspx"&gt;Disable
RC4&lt;/a&gt;
(November 2013)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some form of encryption is always better than no encryption - however
you don't want to give visitors of your site a false sense of security.
Currently there are better cipher alternatives to RC4.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Disadvantages&lt;/div&gt;
&lt;div class="line"&gt;RC4 is a fast algorithm; 3DES is slower and more CPU intensive&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;How to disable it&lt;/div&gt;
&lt;div class="line"&gt;When using openssl, add the following line in your cipher string:&lt;/div&gt;
&lt;div class="line"&gt;`` !RC4``&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Example of an Apache SSL/TLS configuration which disables RC4 among
other ciphers and protocols&lt;/div&gt;
&lt;div class="line"&gt;`` SSLProtocol All -SSLv2 -SSLv3 SSLHonorCipherOrder On SSLCipherSuite HIGH:!IDEA:!RC4:!MD5:!ADH:!AECDH:!aNULL:!eNULL:&amp;#64;STRENGTH``&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Useful links&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://wiki.mozilla.org/Security/Server_Side_TLS#RC4_weaknesses"&gt;https://wiki.mozilla.org/Security/Server_Side_TLS#RC4_weaknesses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://blog.cryptographyengineering.com/2013/03/attack-of-week-rc4-is-kind-of-broken-in.html"&gt;http://blog.cryptographyengineering.com/2013/03/attack-of-week-rc4-is-kind-of-broken-in.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://community.qualys.com/blogs/securitylabs/2013/03/19/rc4-in-tls-is-broken-now-what"&gt;https://community.qualys.com/blogs/securitylabs/2013/03/19/rc4-in-tls-is-broken-now-what&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf"&gt;http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.isg.rhul.ac.uk/tls/"&gt;http://www.isg.rhul.ac.uk/tls/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.educatedguesswork.org/2011/11/rizzoduong_beast_countermeasur.html"&gt;http://www.educatedguesswork.org/2011/11/rizzoduong_beast_countermeasur.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content><category term="cryptography"></category><category term="tls"></category></entry><entry><title>git on Windows - location of configuration files</title><link href="https://www.onwebsecurity.com/configuration/git-on-windows-location-of-global-configuration-file.html" rel="alternate"></link><published>2014-07-09T09:10:00+00:00</published><updated>2018-04-19T00:00:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-07-09:/configuration/git-on-windows-location-of-global-configuration-file.html</id><summary type="html">&lt;p&gt;Git is used as distributed version control system for the majority of
projects I work on. On Windows I use the official &lt;a class="reference external" href="https://git-scm.com/download/win"&gt;Git for
Windows&lt;/a&gt; version, as well as the
'native' mingw/MSYS2 git binary when using the &lt;a class="reference external" href="https://msys2.github.io/"&gt;MSYS2
shell&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The location of the system and global &lt;strong&gt;gitconfig&lt;/strong&gt; configuration files varies,
depending on which environment (native Windows command, Windows shell or MSYS2
shell) you're using, and depending on which binary (Git for Windows versus
native git). There's a logic to it, but it can be hard to figure out...&lt;/p&gt;
&lt;p&gt;Git version 2 introduced a much easier method of finding where the git
configuration files are stored, the &lt;code class="code"&gt;
--show-origin&lt;/code&gt;
 flag. This parameter
tells you exactly where each of the configuration files can be found.&lt;/p&gt;
&lt;p&gt;Retrieve the locations (and name value pairs) of all git configuration files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --show-origin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Retrieve the location (and name value pairs) of the system git configuration
file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --system --show-origin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Retrieve the unique locations of all git configuration files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --show-origin | awk &amp;#39;{print $1}&amp;#39; | uniq&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="local"&gt;
&lt;h2&gt;Local&lt;/h2&gt;
&lt;p&gt;Regardless from where you use git on Windows, the repository (local)
configuration always resides at the same location, in the root directory of your
repository …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Git is used as distributed version control system for the majority of
projects I work on. On Windows I use the official &lt;a class="reference external" href="https://git-scm.com/download/win"&gt;Git for
Windows&lt;/a&gt; version, as well as the
'native' mingw/MSYS2 git binary when using the &lt;a class="reference external" href="https://msys2.github.io/"&gt;MSYS2
shell&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The location of the system and global &lt;strong&gt;gitconfig&lt;/strong&gt; configuration files varies,
depending on which environment (native Windows command, Windows shell or MSYS2
shell) you're using, and depending on which binary (Git for Windows versus
native git). There's a logic to it, but it can be hard to figure out...&lt;/p&gt;
&lt;p&gt;Git version 2 introduced a much easier method of finding where the git
configuration files are stored, the &lt;code class="code"&gt;
--show-origin&lt;/code&gt;
 flag. This parameter
tells you exactly where each of the configuration files can be found.&lt;/p&gt;
&lt;p&gt;Retrieve the locations (and name value pairs) of all git configuration files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --show-origin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Retrieve the location (and name value pairs) of the system git configuration
file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --system --show-origin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Retrieve the unique locations of all git configuration files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --show-origin | awk &amp;#39;{print $1}&amp;#39; | uniq&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="local"&gt;
&lt;h2&gt;Local&lt;/h2&gt;
&lt;p&gt;Regardless from where you use git on Windows, the repository (local)
configuration always resides at the same location, in the root directory of your
repository: &lt;code class="code"&gt;
.git \config&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;You can check this configuration using&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --local&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="system"&gt;
&lt;h2&gt;System&lt;/h2&gt;
&lt;p&gt;The system configuration has also a fixed path on Windows, &lt;em&gt;relative&lt;/em&gt; to the
installation directory: &lt;code class="code"&gt;
etc \gitconfig&lt;/code&gt;
&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;For msysGit: &lt;code class="code"&gt;
%ProgramFiles(x86)% \Git \etc \gitconfig&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;For Git for Windows (64 bit): &lt;code class="code"&gt;
%ProgramFiles% \Git \mingw64 \etc \gitconfig&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;For MSYS2-native git: &lt;code class="code"&gt;
[MSYS2-install-path] \etc \gitconfig&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This configuration file can be read using&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --system&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="global"&gt;
&lt;h2&gt;Global&lt;/h2&gt;
&lt;p&gt;This is the tricky one. Basically, it depends on what the binary or environment
considers the &lt;strong&gt;HOME&lt;/strong&gt; directory.&lt;/p&gt;
&lt;p&gt;When using the Windows command shell, batch scripts or Windows programs,
&lt;strong&gt;HOME&lt;/strong&gt; is &lt;code class="code"&gt;
%USERPROFILE%&lt;/code&gt;
. The global config file will be read from
&lt;code class="code"&gt;
%USERPROFILE% \.gitconfig&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;However, when you're using a (Bash) shell under MSYS2 or Cygwin, &lt;strong&gt;HOME&lt;/strong&gt; under
that shell is &lt;code class="code"&gt;
%HOME%&lt;/code&gt;
. The global config file will be read from
&lt;code class="code"&gt;
$HOME/.gitconfig&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;The global configuration file can be found on yet another location, for Windows
programs that use their own &lt;strong&gt;HOME&lt;/strong&gt; environment. Take Emacs (which uses magit)
for example: When Emacs is started from a Windows command shell, it sets the
&lt;strong&gt;HOME&lt;/strong&gt; variable to &lt;code class="code"&gt;
%APPDATA%&lt;/code&gt;
, which means that &lt;code class="code"&gt;
.gitconfig&lt;/code&gt;
 will
reside in &lt;code class="code"&gt;
%APPDATA% \.gitconfig&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;This configuration file can be read using&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git config --list --global&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So to recap, the global git configuration file can be found under what that
application considers to be the &lt;strong&gt;HOME&lt;/strong&gt; directory, in &lt;code class="code"&gt;
.gitconfig&lt;/code&gt;
.&lt;/p&gt;
&lt;div class="section" id="workflow-setup-linking-the-global-configuration"&gt;
&lt;h3&gt;Workflow setup: Linking the global configuration&lt;/h3&gt;
&lt;p&gt;In my workflow I symlink the various versions of the global configuration. The
system configration stays independent. The file at
&lt;code class="code"&gt;
%USERPROFILE% \.gitconfig&lt;/code&gt;
 is considered the master global file where you
make all your changes.&lt;/p&gt;
&lt;p&gt;Run this command from within a Windows command shell to create a symbolic link
for the system and global file. Be careful, as this command deletes the current
gitconfig file in your MSYS2 home directory, as well as the one in
&lt;code class="code"&gt;
%APPDATA%&lt;/code&gt;
. Moreover mklink doesn't expand variables, so you'll have to
type in the expanded path yourself.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;mklink /h %APPDATA%\.gitconfig %USERPROFILE%\.gitconfig&lt;/span&gt;
&lt;span class="go"&gt;mklink /h [MSYS2-install-path]\home\[username]\.gitconfig&lt;/span&gt;
&lt;span class="gp"&gt;%&lt;/span&gt;USERPROFILE%&lt;span class="se"&gt;\.&lt;/span&gt;gitconfig
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You also might be interested in other &lt;a class="reference external" href="../tag/git.html"&gt;git-related articles&lt;/a&gt;
articles, for instance on how to &lt;a class="reference external" href="./diff-binary-files-docx-odt-pdf-with-git.html"&gt;diff binary files with git&lt;/a&gt;.&lt;/p&gt;
&lt;div class="admonition small"&gt;
&lt;p class="first admonition-title"&gt;Changelog&lt;/p&gt;
&lt;ul class="last simple"&gt;
&lt;li&gt;2018-04-19: Added better explanation about HOME directory, links&lt;/li&gt;
&lt;li&gt;2017-10-19: Formatting&lt;/li&gt;
&lt;li&gt;2017-09-17: Formatting&lt;/li&gt;
&lt;li&gt;2016-12-03: Added new &lt;code class="code"&gt;
--show-location&lt;/code&gt;
 option, changed git binary,
edits.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><category term="git"></category><category term="msys2"></category><category term="windows"></category></entry><entry><title>OpenSSL 1.0.2-chacha</title><link href="https://www.onwebsecurity.com/announcements/openssl-1-0-2-chacha.html" rel="alternate"></link><published>2014-06-26T14:04:00+00:00</published><updated>2014-06-26T14:04:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-06-26:/announcements/openssl-1-0-2-chacha.html</id><summary type="html">&lt;p&gt;&lt;em&gt;Note: see
`http://www.onwebsecurity.com/cryptography/openssl &amp;lt;https://www.onwebsecurity.com/cryptography/openssl&amp;gt;`__
for the latest binary. The version below is obsoleted by newer builds&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Windows 64-bit binary build from a 26-06-2014 snapshot of
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha"&gt;https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha&lt;/a&gt;. This is the
official 1.0.2 branch (OpenSSL_1_0_2_stable), merged with support
for the ChaCha20 and Poly1305 ciphers. Some minor build patches for
Windows compatibility were applied. See the git repo for the full
source.&lt;/p&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;mingw64 shared experimental-jpake enable-md2 enable-rc5
enable-rfc3779 enable-ec_nistp_64_gcc_128 enable-static-engine
--openssldir=c\:/programs/openssl -DOPENSSL_NO_HEARTBEATS&lt;/li&gt;
&lt;li&gt;make depend&lt;/li&gt;
&lt;li&gt;make util/libeay.num&lt;/li&gt;
&lt;li&gt;make util/ssleay.num&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;make report&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Compiler used:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gcc version 4.9.0 (x86\_64-posix-seh-rev1, Built by MinGW-W64 project)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All tests passed&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;em&gt;Note: see
`http://www.onwebsecurity.com/cryptography/openssl &amp;lt;https://www.onwebsecurity.com/cryptography/openssl&amp;gt;`__
for the latest binary. The version below is obsoleted by newer builds&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Windows 64-bit binary build from a 26-06-2014 snapshot of
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha"&gt;https://github.com/PeterMosmans/openssl/tree/1.0.2-chacha&lt;/a&gt;. This is the
official 1.0.2 branch (OpenSSL_1_0_2_stable), merged with support
for the ChaCha20 and Poly1305 ciphers. Some minor build patches for
Windows compatibility were applied. See the git repo for the full
source.&lt;/p&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;mingw64 shared experimental-jpake enable-md2 enable-rc5
enable-rfc3779 enable-ec_nistp_64_gcc_128 enable-static-engine
--openssldir=c\:/programs/openssl -DOPENSSL_NO_HEARTBEATS&lt;/li&gt;
&lt;li&gt;make depend&lt;/li&gt;
&lt;li&gt;make util/libeay.num&lt;/li&gt;
&lt;li&gt;make util/ssleay.num&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;make report&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Compiler used:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;gcc version 4.9.0 (x86\_64-posix-seh-rev1, Built by MinGW-W64 project)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All tests passed&lt;/p&gt;
</content><category term="openssl"></category></entry><entry><title>OpenSSL 1.0.1-chacha</title><link href="https://www.onwebsecurity.com/announcements/openssl-1-0-1-chacha.html" rel="alternate"></link><published>2014-06-18T05:54:00+00:00</published><updated>2014-06-18T05:54:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-06-18:/announcements/openssl-1-0-1-chacha.html</id><summary type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;A Windows 64-bit binary build from the 1.0.1 branch of OpenSSL
(OpenSSL_1_0_1-stable), including (assembly code for) ChaCha20,
Poly1305, J-PAKE, NIST P-224, NIST P-256 and the relatively unsafe
ciphers MD2 and RC5 and broken protocol SSLv2. All available engines
are provided as separate DLLs.&lt;/div&gt;
&lt;div class="line"&gt;If you're using this in a production environment, don't forget to
explicitly enable only ciphers that are considered safe.&lt;/div&gt;
&lt;div class="line"&gt;The code for this build can be found at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.1-chacha"&gt;https://github.com/PeterMosmans/openssl/tree/1.0.1-chacha&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Example openssl.cnf cipher string:&lt;/div&gt;
&lt;div class="line"&gt;`` HIGH:!SSLv2:!IDEA:!RC4:!MD5:!ADH:!aNULL:!eNULL``&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Configure mingw64 shared experimental-jpake enable-md2 enable-rc5
enable-rfc3779 enable-ec_nistp_64_gcc_128 enable-static-engine
--openssldir=c\:/programs/openssl -DOPENSSL_NO_HEARTBEATS&lt;/li&gt;
&lt;li&gt;make depend&lt;/li&gt;
&lt;li&gt;make util/libeay.num&lt;/li&gt;
&lt;li&gt;make util/ssleay.num&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;make report (all tests passed)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;a class="reference external" href="http://www.onwebsecurity.com/files/1.0.1-chacha-latest.zip"&gt;http://www.onwebsecurity.com/files/1.0.1-chacha-latest.zip&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;md5sum: d890de1ab4eba13c7d39139c5726144f&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Compiler used:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;gcc version 4.9.0 (x86_64-posix-seh-rev1, Built by MinGW-W64
project)&lt;/li&gt;
&lt;/ul&gt;
</summary><content type="html">&lt;div class="line-block"&gt;
&lt;div class="line"&gt;A Windows 64-bit binary build from the 1.0.1 branch of OpenSSL
(OpenSSL_1_0_1-stable), including (assembly code for) ChaCha20,
Poly1305, J-PAKE, NIST P-224, NIST P-256 and the relatively unsafe
ciphers MD2 and RC5 and broken protocol SSLv2. All available engines
are provided as separate DLLs.&lt;/div&gt;
&lt;div class="line"&gt;If you're using this in a production environment, don't forget to
explicitly enable only ciphers that are considered safe.&lt;/div&gt;
&lt;div class="line"&gt;The code for this build can be found at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl/tree/1.0.1-chacha"&gt;https://github.com/PeterMosmans/openssl/tree/1.0.1-chacha&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Example openssl.cnf cipher string:&lt;/div&gt;
&lt;div class="line"&gt;`` HIGH:!SSLv2:!IDEA:!RC4:!MD5:!ADH:!aNULL:!eNULL``&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Configure mingw64 shared experimental-jpake enable-md2 enable-rc5
enable-rfc3779 enable-ec_nistp_64_gcc_128 enable-static-engine
--openssldir=c\:/programs/openssl -DOPENSSL_NO_HEARTBEATS&lt;/li&gt;
&lt;li&gt;make depend&lt;/li&gt;
&lt;li&gt;make util/libeay.num&lt;/li&gt;
&lt;li&gt;make util/ssleay.num&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;make report (all tests passed)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;a class="reference external" href="http://www.onwebsecurity.com/files/1.0.1-chacha-latest.zip"&gt;http://www.onwebsecurity.com/files/1.0.1-chacha-latest.zip&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;md5sum: d890de1ab4eba13c7d39139c5726144f&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Compiler used:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;gcc version 4.9.0 (x86_64-posix-seh-rev1, Built by MinGW-W64
project)&lt;/li&gt;
&lt;/ul&gt;
</content><category term="openssl"></category></entry><entry><title>OpenSSL 1.0.2 (10-06-2014)</title><link href="https://www.onwebsecurity.com/announcements/openssl-1-0-2-10-06-2014.html" rel="alternate"></link><published>2014-06-10T07:37:00+00:00</published><updated>2014-06-10T07:37:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-06-10:/announcements/openssl-1-0-2-10-06-2014.html</id><summary type="html">&lt;p&gt;&lt;em&gt;Note: see http://www.onwebsecurity.com/cryptography/openssl for the
latest binary. The version below is obsoleted by newer builds&lt;/em&gt;&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;A Windows 64-bit binary build from a 10-06-2014 snapshot of the
official 1.0.2 branch (OpenSSL_1_0_2_stable). This means that 'the
latest OpenSSL vulnerabilities' that were disclosed on June 5th 2014
are fixed - see &lt;a class="reference external" href="https://www.openssl.org/news/secadv_20140605.txt"&gt;https://www.openssl.org/news/secadv_20140605.txt&lt;/a&gt; for
more information.&lt;/div&gt;
&lt;div class="line"&gt;I applied some minor patches for Windows compatibility and changed the
version string.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Configure mingw64 shared experimental-jpake enable-md2 enable-rc5 \&lt;/span&gt;
&lt;span class="go"&gt;enable-rfc3779 enable-ssl-trace enable-ec_nistp_64_gcc_128 \&lt;/span&gt;
&lt;span class="go"&gt;enable-static-engine --openssldir=c:/tools -DOPENSSL_NO_HEARTBEATS \&lt;/span&gt;
&lt;span class="go"&gt;-mtune=native&lt;/span&gt;
&lt;span class="go"&gt;make depend&lt;/span&gt;
&lt;span class="go"&gt;make util/libeay.num&lt;/span&gt;
&lt;span class="go"&gt;make util/ssleay.num&lt;/span&gt;
&lt;span class="go"&gt;make&lt;/span&gt;
&lt;span class="go"&gt;make report&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Compiler used:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;gcc version 4.9.0 (x86_64-posix-seh-rev1, Built by MinGW-W64
project)&lt;/li&gt;
&lt;/ul&gt;
</summary><content type="html">&lt;p&gt;&lt;em&gt;Note: see http://www.onwebsecurity.com/cryptography/openssl for the
latest binary. The version below is obsoleted by newer builds&lt;/em&gt;&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;A Windows 64-bit binary build from a 10-06-2014 snapshot of the
official 1.0.2 branch (OpenSSL_1_0_2_stable). This means that 'the
latest OpenSSL vulnerabilities' that were disclosed on June 5th 2014
are fixed - see &lt;a class="reference external" href="https://www.openssl.org/news/secadv_20140605.txt"&gt;https://www.openssl.org/news/secadv_20140605.txt&lt;/a&gt; for
more information.&lt;/div&gt;
&lt;div class="line"&gt;I applied some minor patches for Windows compatibility and changed the
version string.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Configure mingw64 shared experimental-jpake enable-md2 enable-rc5 \&lt;/span&gt;
&lt;span class="go"&gt;enable-rfc3779 enable-ssl-trace enable-ec_nistp_64_gcc_128 \&lt;/span&gt;
&lt;span class="go"&gt;enable-static-engine --openssldir=c:/tools -DOPENSSL_NO_HEARTBEATS \&lt;/span&gt;
&lt;span class="go"&gt;-mtune=native&lt;/span&gt;
&lt;span class="go"&gt;make depend&lt;/span&gt;
&lt;span class="go"&gt;make util/libeay.num&lt;/span&gt;
&lt;span class="go"&gt;make util/ssleay.num&lt;/span&gt;
&lt;span class="go"&gt;make&lt;/span&gt;
&lt;span class="go"&gt;make report&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Compiler used:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;gcc version 4.9.0 (x86_64-posix-seh-rev1, Built by MinGW-W64
project)&lt;/li&gt;
&lt;/ul&gt;
</content><category term="openssl"></category></entry><entry><title>OpenSSL on 64 bit Windows with ChaCha and Poly1305 support</title><link href="https://www.onwebsecurity.com/announcements/openssl-on-64-bit-windows-with-chacha-and-poly1305-support.html" rel="alternate"></link><published>2014-05-19T09:09:00+00:00</published><updated>2014-05-19T09:09:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-05-19:/announcements/openssl-on-64-bit-windows-with-chacha-and-poly1305-support.html</id><summary type="html">&lt;p&gt;&lt;em&gt;Note: see https://www.onwebsecurity.com/cryptography/openssl for the
latest binary. The version below is obsoleted by newer builds&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The main development branch of OpenSSL doesn't have support yet for the
(relatively new) ChaCha 20 and Poly1305 ciphers. These can be found
however on the 1.0.2-aead branch.&lt;/p&gt;
&lt;p&gt;By slightly modifying some makefiles the source can be compiled for
64-bit Windows using mingw64 and msys.&lt;/p&gt;
&lt;p&gt;Please find a binary build from a 27-05-2014 snapshot of the source code
(1.0.2-aead branch) with assembly code enabled (imported from the 1.0.2
stable branch), and a lot of insecure, new and experimental ciphers
enabled. I added the GOST engine gosteay32.dll as well.&lt;/p&gt;
&lt;p&gt;The source code for this build can be found at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Configure mingw64 shared experimental-jpake enable-md2 enable-rc5
enable-rfc3779 enable-ssl-trace enable-ec_nistp_64_gcc_128
enable-static-engine --openssldir=c:/tools&lt;/li&gt;
&lt;li&gt;make depend&lt;/li&gt;
&lt;li&gt;make util/libeay.num&lt;/li&gt;
&lt;li&gt;make util/ssleay.num&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;make test&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Enabled ciphers:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;ECDHE-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;SRP-DSS-AES-256-CBC-SHA&lt;/li&gt;
&lt;li&gt;SRP-RSA-AES-256-CBC-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DH-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DH-RSA-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DH-DSS-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES256-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-AES256-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-CHACHA20-POLY1305&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-CHACHA20-POLY1305&lt;/li&gt;
&lt;li&gt;DHE-RSA-CHACHA20-POLY1305&lt;/li&gt;
&lt;li&gt;DHE-RSA-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;GOST2001-GOST89-GOST89&lt;/li&gt;
&lt;li&gt;GOST94-GOST89-GOST89&lt;/li&gt;
&lt;li&gt;AECDH-AES256-SHA&lt;/li&gt;
&lt;li&gt;SRP-AES-256-CBC-SHA&lt;/li&gt;
&lt;li&gt;ADH-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ADH-AES256-SHA256&lt;/li&gt;
&lt;li&gt;ADH-AES256-SHA&lt;/li&gt;
&lt;li&gt;ADH-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES256-SHA …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;&lt;em&gt;Note: see https://www.onwebsecurity.com/cryptography/openssl for the
latest binary. The version below is obsoleted by newer builds&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The main development branch of OpenSSL doesn't have support yet for the
(relatively new) ChaCha 20 and Poly1305 ciphers. These can be found
however on the 1.0.2-aead branch.&lt;/p&gt;
&lt;p&gt;By slightly modifying some makefiles the source can be compiled for
64-bit Windows using mingw64 and msys.&lt;/p&gt;
&lt;p&gt;Please find a binary build from a 27-05-2014 snapshot of the source code
(1.0.2-aead branch) with assembly code enabled (imported from the 1.0.2
stable branch), and a lot of insecure, new and experimental ciphers
enabled. I added the GOST engine gosteay32.dll as well.&lt;/p&gt;
&lt;p&gt;The source code for this build can be found at
&lt;a class="reference external" href="https://github.com/PeterMosmans/openssl"&gt;https://github.com/PeterMosmans/openssl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Build commands:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Configure mingw64 shared experimental-jpake enable-md2 enable-rc5
enable-rfc3779 enable-ssl-trace enable-ec_nistp_64_gcc_128
enable-static-engine --openssldir=c:/tools&lt;/li&gt;
&lt;li&gt;make depend&lt;/li&gt;
&lt;li&gt;make util/libeay.num&lt;/li&gt;
&lt;li&gt;make util/ssleay.num&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;make test&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Enabled ciphers:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;ECDHE-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;SRP-DSS-AES-256-CBC-SHA&lt;/li&gt;
&lt;li&gt;SRP-RSA-AES-256-CBC-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DH-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DH-RSA-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DH-DSS-AES256-SHA256&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES256-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-AES256-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-CHACHA20-POLY1305&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-CHACHA20-POLY1305&lt;/li&gt;
&lt;li&gt;DHE-RSA-CHACHA20-POLY1305&lt;/li&gt;
&lt;li&gt;DHE-RSA-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;GOST2001-GOST89-GOST89&lt;/li&gt;
&lt;li&gt;GOST94-GOST89-GOST89&lt;/li&gt;
&lt;li&gt;AECDH-AES256-SHA&lt;/li&gt;
&lt;li&gt;SRP-AES-256-CBC-SHA&lt;/li&gt;
&lt;li&gt;ADH-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ADH-AES256-SHA256&lt;/li&gt;
&lt;li&gt;ADH-AES256-SHA&lt;/li&gt;
&lt;li&gt;ADH-CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES256-SHA384&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES256-SHA&lt;/li&gt;
&lt;li&gt;AES256-GCM-SHA384&lt;/li&gt;
&lt;li&gt;AES256-SHA256&lt;/li&gt;
&lt;li&gt;AES256-SHA&lt;/li&gt;
&lt;li&gt;CAMELLIA256-SHA&lt;/li&gt;
&lt;li&gt;PSK-AES256-CBC-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;SRP-DSS-3DES-EDE-CBC-SHA&lt;/li&gt;
&lt;li&gt;SRP-RSA-3DES-EDE-CBC-SHA&lt;/li&gt;
&lt;li&gt;EDH-RSA-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;EDH-DSS-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;AECDH-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;SRP-3DES-EDE-CBC-SHA&lt;/li&gt;
&lt;li&gt;ADH-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;ECDH-RSA-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;DES-CBC3-SHA&lt;/li&gt;
&lt;li&gt;DES-CBC3-MD5&lt;/li&gt;
&lt;li&gt;PSK-3DES-EDE-CBC-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES128-SHA256&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES128-SHA256&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-AES128-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-AES128-SHA&lt;/li&gt;
&lt;li&gt;SRP-DSS-AES-128-CBC-SHA&lt;/li&gt;
&lt;li&gt;SRP-RSA-AES-128-CBC-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;DH-RSA-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES128-SHA256&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES128-SHA256&lt;/li&gt;
&lt;li&gt;DH-RSA-AES128-SHA256&lt;/li&gt;
&lt;li&gt;DH-DSS-AES128-SHA256&lt;/li&gt;
&lt;li&gt;DHE-RSA-AES128-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-AES128-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-AES128-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-AES128-SHA&lt;/li&gt;
&lt;li&gt;DHE-RSA-SEED-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-SEED-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-SEED-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-SEED-SHA&lt;/li&gt;
&lt;li&gt;DHE-RSA-CAMELLIA128-SHA&lt;/li&gt;
&lt;li&gt;DHE-DSS-CAMELLIA128-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-CAMELLIA128-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-CAMELLIA128-SHA&lt;/li&gt;
&lt;li&gt;AECDH-AES128-SHA&lt;/li&gt;
&lt;li&gt;SRP-AES-128-CBC-SHA&lt;/li&gt;
&lt;li&gt;ADH-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;ADH-AES128-SHA256&lt;/li&gt;
&lt;li&gt;ADH-AES128-SHA&lt;/li&gt;
&lt;li&gt;ADH-SEED-SHA&lt;/li&gt;
&lt;li&gt;ADH-CAMELLIA128-SHA&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES128-SHA256&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES128-SHA256&lt;/li&gt;
&lt;li&gt;ECDH-RSA-AES128-SHA&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-AES128-SHA&lt;/li&gt;
&lt;li&gt;AES128-GCM-SHA256&lt;/li&gt;
&lt;li&gt;AES128-SHA256&lt;/li&gt;
&lt;li&gt;AES128-SHA&lt;/li&gt;
&lt;li&gt;SEED-SHA&lt;/li&gt;
&lt;li&gt;CAMELLIA128-SHA&lt;/li&gt;
&lt;li&gt;IDEA-CBC-SHA&lt;/li&gt;
&lt;li&gt;IDEA-CBC-MD5&lt;/li&gt;
&lt;li&gt;RC2-CBC-MD5&lt;/li&gt;
&lt;li&gt;PSK-AES128-CBC-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-RSA-RC4-SHA&lt;/li&gt;
&lt;li&gt;ECDHE-ECDSA-RC4-SHA&lt;/li&gt;
&lt;li&gt;AECDH-RC4-SHA&lt;/li&gt;
&lt;li&gt;ADH-RC4-MD5&lt;/li&gt;
&lt;li&gt;ECDH-RSA-RC4-SHA&lt;/li&gt;
&lt;li&gt;ECDH-ECDSA-RC4-SHA&lt;/li&gt;
&lt;li&gt;RC4-SHA&lt;/li&gt;
&lt;li&gt;RC4-MD5&lt;/li&gt;
&lt;li&gt;PSK-RC4-SHA&lt;/li&gt;
&lt;li&gt;EDH-RSA-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EDH-DSS-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;DH-RSA-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;DH-DSS-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;ADH-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;DES-CBC-MD5&lt;/li&gt;
&lt;li&gt;EXP-EDH-RSA-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EXP-EDH-DSS-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EXP-DH-RSA-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EXP-DH-DSS-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EXP-ADH-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EXP-DES-CBC-SHA&lt;/li&gt;
&lt;li&gt;EXP-RC2-CBC-MD5&lt;/li&gt;
&lt;li&gt;EXP-ADH-RC4-MD5&lt;/li&gt;
&lt;li&gt;EXP-RC4-MD5&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
</content><category term="openssl"></category><category term="windows"></category></entry><entry><title>test_bn fails for OpenSSL on Windows</title><link href="https://www.onwebsecurity.com/configuration/test_bn_fails_for_openssl_on_windows.html" rel="alternate"></link><published>2014-05-06T02:16:00+00:00</published><updated>2014-05-06T02:16:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-05-06:/configuration/test_bn_fails_for_openssl_on_windows.html</id><summary type="html">&lt;p&gt;Compiling OpenSSL on Windows using MSYS and mingw64 is pretty
straightforward. However, one of the tests (test_bn) to verify OpenSSL
fails: The temporary file that test_bncreates contains Windows newline
characters (\r\n) instead of the Unix type newline charater (\n).&lt;/p&gt;
&lt;p&gt;The original regular expression checks for a zero (0) at the beginning
of a line, and a newline character (\n).&lt;/p&gt;
&lt;p&gt;&lt;pre&gt;
(!/^0$$/)&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;A change to the regular expression that test_bn uses fixes this
problem, and can be used on Unix as well as Windows environments. This
makes the Makefile more cross-platform friendly. The modified regular
expression checks for a zero (0) at the beginning of a line, an optional
Windows newline character (\r) and a newline character (\n).&lt;/p&gt;
&lt;p&gt;&lt;pre&gt;
(!/^0\r?$$/)&lt;/pre&gt;
&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;File:
&lt;a class="reference external" href="http://www.onwebsecurity.com/files/openssl-test-Makefile.patch"&gt;openssl-test-Makefile.patch&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;md5sum: 1032dff7f957c4d1cdfa96af305c152b&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Here's the patchfile (can be applied in the source directory using
patch -Np1)&lt;/div&gt;
&lt;div class="line"&gt;&lt;pre&gt;
--- openssl-1.0.1g/test/Makefile 2014-04-07 16:55:44 +0000 +++ patched/test/Makefile 2014-05-06 00:07:20 +0000 &amp;#64;&amp;#64; -227,7 +227,7 &amp;#64;&amp;#64; &amp;#64;../util/shlib_wrap.sh ./$(BNTEST) &amp;gt;tmp.bntest &amp;#64;echo quit &amp;gt;&amp;gt;tmp.bntest &amp;#64;echo &amp;quot;running bc&amp;quot; - &amp;#64;) {if (/^test (.*)/) {print STDERR &amp;quot;\nverify $$1&amp;quot;;} elsif (!/^0$$/) {die &amp;quot;\nFailed! bc: $$_&amp;quot;;} else {print STDERR &amp;quot;.&amp;quot;; $$i++;}} print STDERR &amp;quot;\n$$i tests passed\n&amp;quot;' + &amp;#64;) {if (/^test (.*)/) {print STDERR &amp;quot;\nverify …&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Compiling OpenSSL on Windows using MSYS and mingw64 is pretty
straightforward. However, one of the tests (test_bn) to verify OpenSSL
fails: The temporary file that test_bncreates contains Windows newline
characters (\r\n) instead of the Unix type newline charater (\n).&lt;/p&gt;
&lt;p&gt;The original regular expression checks for a zero (0) at the beginning
of a line, and a newline character (\n).&lt;/p&gt;
&lt;p&gt;&lt;pre&gt;
(!/^0$$/)&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;A change to the regular expression that test_bn uses fixes this
problem, and can be used on Unix as well as Windows environments. This
makes the Makefile more cross-platform friendly. The modified regular
expression checks for a zero (0) at the beginning of a line, an optional
Windows newline character (\r) and a newline character (\n).&lt;/p&gt;
&lt;p&gt;&lt;pre&gt;
(!/^0\r?$$/)&lt;/pre&gt;
&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;File:
&lt;a class="reference external" href="http://www.onwebsecurity.com/files/openssl-test-Makefile.patch"&gt;openssl-test-Makefile.patch&lt;/a&gt;&lt;/div&gt;
&lt;div class="line"&gt;md5sum: 1032dff7f957c4d1cdfa96af305c152b&lt;/div&gt;
&lt;/div&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;Here's the patchfile (can be applied in the source directory using
patch -Np1)&lt;/div&gt;
&lt;div class="line"&gt;&lt;pre&gt;
--- openssl-1.0.1g/test/Makefile 2014-04-07 16:55:44 +0000 +++ patched/test/Makefile 2014-05-06 00:07:20 +0000 &amp;#64;&amp;#64; -227,7 +227,7 &amp;#64;&amp;#64; &amp;#64;../util/shlib_wrap.sh ./$(BNTEST) &amp;gt;tmp.bntest &amp;#64;echo quit &amp;gt;&amp;gt;tmp.bntest &amp;#64;echo &amp;quot;running bc&amp;quot; - &amp;#64;) {if (/^test (.*)/) {print STDERR &amp;quot;\nverify $$1&amp;quot;;} elsif (!/^0$$/) {die &amp;quot;\nFailed! bc: $$_&amp;quot;;} else {print STDERR &amp;quot;.&amp;quot;; $$i++;}} print STDERR &amp;quot;\n$$i tests passed\n&amp;quot;' + &amp;#64;) {if (/^test (.*)/) {print STDERR &amp;quot;\nverify $$1&amp;quot;;} elsif (!/^0\r?$$/) {die &amp;quot;\nFailed! bc: $$_&amp;quot;;} else {print STDERR &amp;quot;.&amp;quot;; $$i++;}} print STDERR &amp;quot;\n$$i tests passed\n&amp;quot;' &amp;#64;echo 'test a^b%c implementations' ../util/shlib_wrap.sh ./$(EXPTEST)&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;As of May 28, 2014 this patch has been applied to the main branch of
openssl: see
&lt;a class="reference external" href="http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=028bac0670c167f154438742eb4d0fbed73df209"&gt;http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=028bac0670c167f154438742eb4d0fbed73df209&lt;/a&gt;&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;If you're interested in cherry-picking:&lt;/div&gt;
&lt;div class="line"&gt;git cherry-pick 028bac0670c167f154438742eb4d0fbed73df209&lt;/div&gt;
&lt;/div&gt;
</content><category term="openssl"></category><category term="windows"></category></entry><entry><title>analyze_hosts</title><link href="https://www.onwebsecurity.com/security/analyze_hosts.html" rel="alternate"></link><published>2014-01-23T03:57:00+00:00</published><updated>2014-01-23T03:57:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2014-01-23:/security/analyze_hosts.html</id><summary type="html">&lt;p&gt;If you're like me, you don't want to spend your precious memory on
remembering awkward command line parameters. However, lots of tools
require exactly that: awkward command line parameters.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;To simplify scanning of hosts for network vulnerabilities I wrote &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/blob/master/analyze_hosts.sh"&gt;a
simple wrapper
script&lt;/a&gt;
around several open source security tools. The script lets you analyze
one or several hosts for common misconfiguration vulnerabilities and
weaknesses.&lt;/div&gt;
&lt;div class="line"&gt;My main objective in writing the script was to make it as easy as
possible to perform generic security tests, without any heavy
prerequisites, make the script as informative as possible, and make
use of open source tools.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that the latest version is the &lt;strong&gt;Python&lt;/strong&gt; version - please use that one.&lt;/p&gt;
&lt;div class="section" id="how-to-install"&gt;
&lt;h2&gt;How to install&lt;/h2&gt;
&lt;p&gt;Clone the git archive using the command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git clone https://github.com/PeterMosmans/security-scripts.git&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="needed"&gt;
&lt;h2&gt;Needed&lt;/h2&gt;
&lt;p&gt;Linux, and nmap&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="optional"&gt;
&lt;h2&gt;Optional&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
curl&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;for fingerprinting and to test for TRACE&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
dig&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;to test for recursive DNS servers&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
git&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;to update the script&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
nikto&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;for webscanning&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
testssl.sh&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;to check the SSL configuration&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="usage"&gt;
&lt;h2&gt;Usage&lt;/h2&gt;
&lt;p&gt;Oh irony - the command line parameters for the tool:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
usage: analyze_hosts.sh [OPTION]... [HOST]

Scanning options:
 -a, --all perform all basic scans
 --max perform all advanced scans (more thorough)
 -b, --basic …&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;If you're like me, you don't want to spend your precious memory on
remembering awkward command line parameters. However, lots of tools
require exactly that: awkward command line parameters.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;To simplify scanning of hosts for network vulnerabilities I wrote &lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/blob/master/analyze_hosts.sh"&gt;a
simple wrapper
script&lt;/a&gt;
around several open source security tools. The script lets you analyze
one or several hosts for common misconfiguration vulnerabilities and
weaknesses.&lt;/div&gt;
&lt;div class="line"&gt;My main objective in writing the script was to make it as easy as
possible to perform generic security tests, without any heavy
prerequisites, make the script as informative as possible, and make
use of open source tools.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that the latest version is the &lt;strong&gt;Python&lt;/strong&gt; version - please use that one.&lt;/p&gt;
&lt;div class="section" id="how-to-install"&gt;
&lt;h2&gt;How to install&lt;/h2&gt;
&lt;p&gt;Clone the git archive using the command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;git clone https://github.com/PeterMosmans/security-scripts.git&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="needed"&gt;
&lt;h2&gt;Needed&lt;/h2&gt;
&lt;p&gt;Linux, and nmap&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="optional"&gt;
&lt;h2&gt;Optional&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
curl&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;for fingerprinting and to test for TRACE&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
dig&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;to test for recursive DNS servers&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
git&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;to update the script&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
nikto&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;for webscanning&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;li&gt;&lt;dl class="first docutils"&gt;
&lt;dt&gt;&lt;pre&gt;
testssl.sh&lt;/pre&gt;
&lt;/dt&gt;
&lt;dd&gt;to check the SSL configuration&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="usage"&gt;
&lt;h2&gt;Usage&lt;/h2&gt;
&lt;p&gt;Oh irony - the command line parameters for the tool:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
usage: analyze_hosts.sh [OPTION]... [HOST]

Scanning options:
 -a, --all perform all basic scans
 --max perform all advanced scans (more thorough)
 -b, --basic perform basic scans (fingerprint, ssl, trace)
 --filter=FILTER only proceed with scan of HOST if WHOIS
 results of HOST matches regexp FILTER
 --dns test for recursive query
 -f perform web fingerprinting (all webports)
 --fingerprint perform all web fingerprinting methods
 -h, --header show webserver headers (all webports)
 -n, --nikto nikto webscan (all webports)
 -p nmap portscan (top 1000 ports)
 --ports nmap portscan (all ports)
 -s check SSL configuration
 --ssl perform all SSL configuration checks
 --timeout=SECONDS change timeout for sslscan (default=30)
 --ssh perform SSH configuration checks
 -t check webserver for HTTP TRACE method
 --trace perform all HTTP TRACE method checks
 -w, --whois perform WHOIS lookup for the IP address
 -W confirm WHOIS results before continuing scan

Port selection (comma separated list):
 --webports=PORTS use PORTS for web scans (default 80,443)
 --sslports=PORTS use PORTS for ssl scans (default 443,993,995)

Logging and input file:
 -d, --directory=DIR location of temporary files (default /tmp)
 -i, --inputfile=FILE use a file containing hostnames
 -l, --log log each scan in a separate logfile
 --nocolor don't use fancy colors in screen output
 -o, --output=FILE concatenate all results into FILE
 -q, --quiet quiet
 -v, --verbose show server responses

-u update this script (if it's a cloned repository)
 --update force update (overwrite all local modifications)
 --version print version information and exit

 BLUE: status messages
 GREEN: secure settings
 RED: possible vulnerabilities

[HOST] can be a single (IP) address, an IP range, eg. 127.0.0.1-255
 or multiple comma-separated addresses, eg 127.0.0.1,127.0.0.2

example: /usr/local/sbin/analyze_hosts -a --filter Amazon www.google.com
&lt;/pre&gt;
&lt;/div&gt;
</content><category term="pentesting"></category><category term="tools"></category></entry><entry><title>securing AMFPHP</title><link href="https://www.onwebsecurity.com/security/securing-amfphp.html" rel="alternate"></link><published>2013-05-30T09:13:00+00:00</published><updated>2013-05-30T09:13:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2013-05-30:/security/securing-amfphp.html</id><summary type="html">&lt;p&gt;I regulary run into Flash applications when I perform a web application
penetration test. One of the most widely used server frameworks for
communicating with a Flash object is AMFPHP.&lt;/p&gt;
&lt;p&gt;Unfortunately the default installation of AMFPHP is insecure. A system
administrator or developer actively has to secure the installation,
which is often forgotten.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;There are some tips lying around the Internet how to secure an AMFPHP
installation. The summary:&lt;/div&gt;
&lt;div class="line"&gt;In the root of your AMFPHP deployment,&lt;/div&gt;
&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;delete the DiscoveryService.php file&lt;/li&gt;
&lt;li&gt;Delete the browser folder and its contents&lt;/li&gt;
&lt;li&gt;Edit gateway.php and set the PRODUCTION_SERVER property to true&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course it's at least as important to write secure code, harden your
server and implement proper patch and maintenance procedures.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;I regulary run into Flash applications when I perform a web application
penetration test. One of the most widely used server frameworks for
communicating with a Flash object is AMFPHP.&lt;/p&gt;
&lt;p&gt;Unfortunately the default installation of AMFPHP is insecure. A system
administrator or developer actively has to secure the installation,
which is often forgotten.&lt;/p&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;There are some tips lying around the Internet how to secure an AMFPHP
installation. The summary:&lt;/div&gt;
&lt;div class="line"&gt;In the root of your AMFPHP deployment,&lt;/div&gt;
&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;delete the DiscoveryService.php file&lt;/li&gt;
&lt;li&gt;Delete the browser folder and its contents&lt;/li&gt;
&lt;li&gt;Edit gateway.php and set the PRODUCTION_SERVER property to true&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course it's at least as important to write secure code, harden your
server and implement proper patch and maintenance procedures.&lt;/p&gt;
</content><category term="amfphp"></category></entry><entry><title>unsafe HTTP methods</title><link href="https://www.onwebsecurity.com/security/unsafe-http-methods.html" rel="alternate"></link><published>2013-03-20T09:01:00+00:00</published><updated>2017-04-07T10:37:00+00:00</updated><author><name>Peter Mosmans</name></author><id>tag:www.onwebsecurity.com,2013-03-20:/security/unsafe-http-methods.html</id><summary type="html">&lt;div class="section" id="vulnerability-name-unsafe-http-methods"&gt;
&lt;h2&gt;Vulnerability name: Unsafe HTTP methods&lt;/h2&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;Aliases&lt;/dt&gt;
&lt;dd&gt;&lt;ul class="first last simple"&gt;
&lt;li&gt;Web server HTTP Trace/Track method support&lt;/li&gt;
&lt;li&gt;Cross-site tracing vulnerability&lt;/li&gt;
&lt;li&gt;Dangerous HTTP methods&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;Scope&lt;/dt&gt;
&lt;dd&gt;Although this is a &lt;em&gt;server&lt;/em&gt; configuration issue, the &lt;em&gt;client&lt;/em&gt; is at risk here&lt;/dd&gt;
&lt;dt&gt;Remediation&lt;/dt&gt;
&lt;dd&gt;Disable TRACE and/or TRACK and/or DEBUG methods&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;div class="section" id="verification"&gt;
&lt;h2&gt;Verification&lt;/h2&gt;
&lt;p&gt;Using &lt;code class="code"&gt;
curl&lt;/code&gt;
, one can employ one of the methods by hand:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;curl -sIX TRACE $TARGET | awk &amp;#39;NR==1 {print $2}&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Vulnerable when: the result is &lt;strong&gt;200&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One should expect (not vulnerable) &lt;em&gt;405&lt;/em&gt; (Method Not Allowed) or &lt;em&gt;501&lt;/em&gt; (Not
Implemented) results.&lt;/p&gt;
&lt;p&gt;This executes the TRACE method against &lt;code class="code"&gt;
$TARGET&lt;/code&gt;
, and prints out the HTTP
status code using &lt;code class="code"&gt;
awk&lt;/code&gt;
. The &lt;code class="code"&gt;
-I&lt;/code&gt;
 parameter fetches the head only,
&lt;code class="code"&gt;
-s&lt;/code&gt;
 stands for silent mode, and &lt;code class="code"&gt;
-X&lt;/code&gt;
 specifies the method.&lt;/p&gt;
&lt;p&gt;The easiest way to test whether a server is vulnerable is by using the script
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;analyze_hosts.py&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This script uses &lt;code class="code"&gt;
curl&lt;/code&gt;
 as well as &lt;code class="code"&gt;
nmap&lt;/code&gt;
 to perform multiple tests.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;analyze_hosts.py --trace http://www.target.com&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;When an OPTIONS method is issued, the webserver should return the
supported methods. Some web servers have a habit of replying with methods
that are in fact not supported - which does not combine nicely with inferior
security scanners (and pentesters, I might add) that relying …&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="section" id="vulnerability-name-unsafe-http-methods"&gt;
&lt;h2&gt;Vulnerability name: Unsafe HTTP methods&lt;/h2&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;Aliases&lt;/dt&gt;
&lt;dd&gt;&lt;ul class="first last simple"&gt;
&lt;li&gt;Web server HTTP Trace/Track method support&lt;/li&gt;
&lt;li&gt;Cross-site tracing vulnerability&lt;/li&gt;
&lt;li&gt;Dangerous HTTP methods&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;Scope&lt;/dt&gt;
&lt;dd&gt;Although this is a &lt;em&gt;server&lt;/em&gt; configuration issue, the &lt;em&gt;client&lt;/em&gt; is at risk here&lt;/dd&gt;
&lt;dt&gt;Remediation&lt;/dt&gt;
&lt;dd&gt;Disable TRACE and/or TRACK and/or DEBUG methods&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;div class="section" id="verification"&gt;
&lt;h2&gt;Verification&lt;/h2&gt;
&lt;p&gt;Using &lt;code class="code"&gt;
curl&lt;/code&gt;
, one can employ one of the methods by hand:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;curl -sIX TRACE $TARGET | awk &amp;#39;NR==1 {print $2}&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Vulnerable when: the result is &lt;strong&gt;200&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One should expect (not vulnerable) &lt;em&gt;405&lt;/em&gt; (Method Not Allowed) or &lt;em&gt;501&lt;/em&gt; (Not
Implemented) results.&lt;/p&gt;
&lt;p&gt;This executes the TRACE method against &lt;code class="code"&gt;
$TARGET&lt;/code&gt;
, and prints out the HTTP
status code using &lt;code class="code"&gt;
awk&lt;/code&gt;
. The &lt;code class="code"&gt;
-I&lt;/code&gt;
 parameter fetches the head only,
&lt;code class="code"&gt;
-s&lt;/code&gt;
 stands for silent mode, and &lt;code class="code"&gt;
-X&lt;/code&gt;
 specifies the method.&lt;/p&gt;
&lt;p&gt;The easiest way to test whether a server is vulnerable is by using the script
&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;analyze_hosts.py&lt;/a&gt; &lt;a class="footnote-reference" href="#id1" id="id2"&gt;[1]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This script uses &lt;code class="code"&gt;
curl&lt;/code&gt;
 as well as &lt;code class="code"&gt;
nmap&lt;/code&gt;
 to perform multiple tests.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;analyze_hosts.py --trace http://www.target.com&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;When an OPTIONS method is issued, the webserver should return the
supported methods. Some web servers have a habit of replying with methods
that are in fact not supported - which does not combine nicely with inferior
security scanners (and pentesters, I might add) that relying on the OPTIONS
command. Always verify the method itself, and do not rely on the OPTIONS
method (and the results of a security scanner).&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="explanation"&gt;
&lt;h2&gt;Explanation&lt;/h2&gt;
&lt;p&gt;There are a number of official (standards compliant) HTTP methods:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;OPTIONS, HEAD, GET, POST, PUT, DELETE, TRACE, CONNECT&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;An ordinary web server supports the HEAD, GET and POST methods to retrieve
static and dynamic content (enabling WebDAV on a web server will add support for
the PUT and DELETE methods).&lt;/p&gt;
&lt;p&gt;TRACE and TRACK are methods which can be used for debugging
purposes. It repeats the content of a request, and an attacker could steal
credentials by using a client-side attack.&lt;/p&gt;
&lt;p&gt;These HTTP methods should not be supported on public web servers, as they
increase the attack surface.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="solution-remediation"&gt;
&lt;h2&gt;Solution/remediation&lt;/h2&gt;
&lt;div class="section" id="apache"&gt;
&lt;h3&gt;Apache&lt;/h3&gt;
&lt;p&gt;Add the following to your Apache httpd.conf file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;TraceEnable Off
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="iis7-and-higher"&gt;
&lt;h4&gt;IIS7 and higher&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;appcmd.exe set config /section:requestfiltering /+verbs.[verb=&amp;#39;TRACE&amp;#39;,allowed=&amp;#39;false&amp;#39;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="iis6"&gt;
&lt;h4&gt;IIS6&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;REGEDIT4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters] &amp;quot;EnableTraceMethod&amp;quot;=dword:00000000&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="iis5-and-lower"&gt;
&lt;h4&gt;IIS5 and lower&lt;/h4&gt;
&lt;p&gt;Install &lt;a class="reference external" href="https://technet.microsoft.com/en-us/security/cc242650.aspx"&gt;URLscan&lt;/a&gt; &lt;a class="footnote-reference" href="#id3" id="id4"&gt;[2]&lt;/a&gt;&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;Microsoft's IIS 5 supports the non-RFC compliant methode TRACK, which
is basically the same as the TRACE method. This should be disabled as well
(by installing URLScan)&lt;/p&gt;
&lt;/div&gt;
&lt;table class="docutils footnote" frame="void" id="id1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id2"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://github.com/PeterMosmans/security-scripts/"&gt;https://github.com/PeterMosmans/security-scripts/&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="id3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id4"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class="reference external" href="https://technet.microsoft.com/en-us/security/cc242650.aspx"&gt;https://technet.microsoft.com/en-us/security/cc242650.aspx&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><category term="pentesting"></category><category term="vulnerability"></category></entry></feed>