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

<channel>
	<title>CryptonDie &#8211; @Forensicxs</title>
	<atom:link href="https://www.forensicxs.com/tag/cryptondie/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.forensicxs.com</link>
	<description>Ethical Hacking &#124; Cybersecurity</description>
	<lastBuildDate>Thu, 13 May 2021 18:15:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>CryptonDie : a &#8220;ransomware&#8221; developed for study purposes</title>
		<link>https://www.forensicxs.com/cryptondie-a-ransomware-developed-for-study-purposes/</link>
					<comments>https://www.forensicxs.com/cryptondie-a-ransomware-developed-for-study-purposes/#respond</comments>
		
		<dc:creator><![CDATA[Forensicxs]]></dc:creator>
		<pubDate>Sat, 16 Nov 2019 21:40:30 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CryptonDie]]></category>
		<category><![CDATA[cryptondie.py]]></category>
		<category><![CDATA[Ransomware]]></category>
		<guid isPermaLink="false">https://www.forensicxs.com/?p=167</guid>

					<description><![CDATA[On the 07th October 2019, I&#8217;ve seen a post from @binitamshah (a good source of information on Twitter for IT security topics), about a ransomware developed for study purposes : CryptonDie. I decided to have a deeper look The tool has been coded in Python by Gabriel Dutra, akka @zer0dxx, located in the city of &#8230; <p class="link-more"><a href="https://www.forensicxs.com/cryptondie-a-ransomware-developed-for-study-purposes/" class="more-link">Continue reading<span class="screen-reader-text"> "CryptonDie : a &#8220;ransomware&#8221; developed for study purposes"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<p>On the 07th October 2019, I&#8217;ve seen a post from @binitamshah (a good source of information on Twitter for IT security topics), about a ransomware developed for study purposes : <strong><span class="has-inline-color has-luminous-vivid-orange-color">CryptonDie.</span></strong> I decided to have a deeper look</p>



<p>The tool has been coded in Python by Gabriel Dutra, akka <strong><span class="has-inline-color has-luminous-vivid-orange-color">@zer0dxx</span></strong>, located in the city of Marialva in Brazil (state of Paraná), and can be found on GithHub : <a href="https://github.com/gmdutra/cryptondie" target="_blank" rel="noreferrer noopener">https://github.com/gmdutra/cryptondie</a></p>



<p>Don&#8217;t expect to find a real badass ransomware ready for use (with penetration mechanism, ransom / bitcoin payment etc), instead you&#8217;ll get a good study purpose package that will raise your awareness about file encryption mechanisms using Python</p>



<p>The installation process is pretty straightforward and the key steps are explained in the README. At first, start cloning the repository </p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-4.png" alt="" class="wp-image-177" width="313" height="23" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-4.png 399w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-4-300x22.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-4-230x17.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-4-350x25.png 350w" sizes="(max-width: 313px) 100vw, 313px" /></figure>



<p>This is what you get in the directory. Then just pip install the requirements.txt</p>



<figure class="wp-block-image size-large"><img decoding="async" width="358" height="112" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-3.png" alt="" class="wp-image-176" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-3.png 358w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-3-300x94.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-3-230x72.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-3-350x109.png 350w" sizes="(max-width: 358px) 100vw, 358px" /></figure>



<p>Then go in into the discovery directory and launch the Web Service, by running the service_discovery.py with Python3</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="605" height="180" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-5.png" alt="" class="wp-image-179" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-5.png 605w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-5-300x89.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-5-230x68.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-5-350x104.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-5-480x143.png 480w" sizes="(max-width: 605px) 100vw, 605px" /></figure>



<p>I opened a second shell. In the modules directory, you&#8217;ve got an info.py file, let&#8217;s have a look inside</p>



<figure class="wp-block-image size-large"><img decoding="async" width="605" height="439" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-6.png" alt="" class="wp-image-181" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-6.png 605w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-6-300x218.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-6-550x400.png 550w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-6-230x167.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-6-350x254.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-6-480x348.png 480w" sizes="(max-width: 605px) 100vw, 605px" /></figure>



<p>The example provided allows to test easily, the AES based file encryption mecanism, with a real and local example at 127.0.0.1:5000  and dir /var/www which is the usual place for an HTTP Apache Server default html page (if you create a Web site and host it on an Apache Server, this is where you&#8217;re application will be located&#8230;)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="605" height="227" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-7.png" alt="" class="wp-image-183" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-7.png 605w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-7-300x113.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-7-230x86.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-7-350x131.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-7-480x180.png 480w" sizes="(max-width: 605px) 100vw, 605px" /></figure>



<p>Let&#8217;s go and encrypt all files using the test key</p>



<figure class="wp-block-image size-large"><img decoding="async" width="605" height="329" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-8.png" alt="" class="wp-image-184" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-8.png 605w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-8-300x163.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-8-230x125.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-8-350x190.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-8-480x261.png 480w" sizes="(max-width: 605px) 100vw, 605px" /></figure>



<p>It&#8217;s a success ! The index.html and index.nginx-debian.html are now encrypted with AES using the test key. A cat on the index.html proves it, it&#8217;s unreadable and in BIN format (to decrypt just do the same but with the keyword &#8211;decrypt !)</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-9.png" alt="" class="wp-image-185" width="673" height="188" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-9.png 605w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-9-300x84.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-9-230x64.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-9-350x98.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-9-480x134.png 480w" sizes="(max-width: 673px) 100vw, 673px" /></figure>



<p>OK, cool. So now, let&#8217;s have a deeper look at the Python code for a better understanding of the tool <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>In the <strong><span class="has-inline-color has-vivid-cyan-blue-color">main</span></strong> CryptonDie repository, you&#8217;ve got three key components :</p>



<ul class="wp-block-list"><li><strong><span class="has-inline-color has-luminous-vivid-orange-color">cryptondie.py</span></strong> : this is the main program that we executed to encrypt the files</li><li>directory <strong><span class="has-inline-color has-luminous-vivid-orange-color">discovery</span></strong> : several .py services are managing the target IP discovery, information gathering, and output into an SQL database</li><li>directory <span class="has-inline-color has-luminous-vivid-orange-color"><strong>modules</strong> </span>: several .py services are targeting the IP, managing to parse through the files to encrypt, and implement the encryption mechanism</li></ul>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-10.png" alt="" class="wp-image-187" width="439" height="176" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-10.png 587w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-10-300x120.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-10-230x92.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-10-350x140.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-10-480x192.png 480w" sizes="(max-width: 439px) 100vw, 439px" /></figure>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-11.png" alt="" class="wp-image-188" width="441" height="87" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-11.png 550w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-11-300x59.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-11-230x46.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-11-350x69.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-11-480x95.png 480w" sizes="(max-width: 441px) 100vw, 441px" /></figure>



<p>Let&#8217;s start with the directory <strong><span class="has-inline-color has-vivid-cyan-blue-color">discovery</span></strong>. Within the directory, you&#8217;ve got several .py files that are able to create a local SQLlite database containing full details about the target IP adress</p>



<p>Let&#8217;s understand some key points inside service_discovery.py and create_database.py</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-12.png" alt="" class="wp-image-190" width="442" height="255" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-12.png 593w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-12-300x173.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-12-230x133.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-12-350x202.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-12-480x277.png 480w" sizes="(max-width: 442px) 100vw, 442px" /></figure>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-13.png" alt="" class="wp-image-191" width="715" height="156" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-13.png 926w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-13-300x66.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-13-768x168.png 768w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-13-830x182.png 830w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-13-230x50.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-13-350x77.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-13-480x105.png 480w" sizes="(max-width: 715px) 100vw, 715px" /></figure>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Flask</span></strong> :  it&#8217;s a well-known Python web micro-framework  <a href="https://pymbook.readthedocs.io/en/latest/flask.html" target="_blank" rel="noreferrer noopener">https://pymbook.readthedocs.io/en/latest/flask.html</a>   It allows you to build websites and web apps quite rapidly and easily, it&#8217;s really good and light</p>



<p><span class="has-inline-color has-luminous-vivid-orange-color"><strong>RESTful API</strong> </span>: an API for a website is a code that allows two software programs to communicate with each another; one of the purposes of an API is to decouple the data from the application that uses it, hiding the data implementation details</p>



<p>A &#8216;RESTful API&#8217; is a remote API that follows the REST style of software architecture. A REST API defines a set of functions which developers can perform requests and receive responses via HTTP protocol such as GET and POST</p>



<p>The World Wide Web is an example of a distributed system that uses REST protocol architecture to provide a hypermedia driven interface for websites. REST APIs use multiple standards like HTTP, JSON, URL, and XML </p>



<p>See : <a href="https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask" target="_blank" rel="noreferrer noopener">https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask</a></p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">reqparse</span></strong> : Flask-RESTful’s request parsing interface, <a href="https://flask-restful.readthedocs.io/en/0.3.5/api.html#module-reqparse" target="_blank" rel="noreferrer noopener">reqparse</a>, is modeled after the <a href="http://docs.python.org/dev/library/argparse.html" target="_blank" rel="noreferrer noopener">argparse</a> interface. It’s designed to provide simple and uniform access to any variable in Flask <a href="https://flask-restful.readthedocs.io/en/0.3.5/reqparse.html" target="_blank" rel="noreferrer noopener">https://flask-restful.readthedocs.io/en/0.3.5/reqparse.html</a> </p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">jsonify</span></strong> : allows to import the API data with JSON data, as such Flask&#8217;s <code>jsonify</code> function generates JSON for us from the data structure</p>



<p><span class="has-inline-color has-luminous-vivid-orange-color"><strong>SQLite</strong> </span>:  SQLite is an embedded relational database engine. It is very popular. Several programming languages have built-in support for SQLite including Python <a href="https://pynative.com/python-sqlite/" target="_blank" rel="noreferrer noopener">https://pynative.com/python-sqlite/</a></p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">SQLAlchemy</span></strong> :  SQLAlchemy is the Python SQL toolkit and object relational mapper that  gives application developers the full power and flexibility of SQL into  Python</p>



<p>Let&#8217;s continue with the directory <strong><span class="has-inline-color has-vivid-cyan-blue-color">modules</span></strong>.  Within the directory, you&#8217;ve got several .py files that are able to  target the IP adress, parse through the files in the target repository, and encrypt the data. Let&#8217;s understand some key points inside create_infos.py  and encryption.py </p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-14.png" alt="" class="wp-image-196" width="481" height="494" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-14.png 629w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-14-292x300.png 292w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-14-230x236.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-14-350x359.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-14-480x493.png 480w" sizes="(max-width: 481px) 100vw, 481px" /></figure>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-15.png" alt="" class="wp-image-197" width="480" height="603" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-15.png 683w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-15-239x300.png 239w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-15-230x289.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-15-350x440.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-15-480x603.png 480w" sizes="(max-width: 480px) 100vw, 480px" /></figure>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">JSON</span></strong> (cf jsonify above) : The <a href="https://pymotw.com/2/json/#module-json">json</a> module provides an API for converting in-memory Python objects to a serialized representation known as <a href="http://json.org/" target="_blank" rel="noreferrer noopener">JavaScript Object Notation</a> (JSON). JSON has the benefit of having implementations in many languages (especially JavaScript), making it suitable for inter-application communication</p>



<p><span class="has-inline-color has-luminous-vivid-orange-color"><strong>requests</strong> </span>: Python comes with two built-in modules, <code>urllib</code> and <code>urllib2</code>,  to handle HTTP related operation and import data from websites. Both modules come with a different  set of functionalities and many times they need to be used together</p>



<p>To make things simpler, one easy-to-use third-party library, known as <a rel="noreferrer noopener" target="_blank" href="http://docs.python-requests.org/en/master/">Requests</a>, is available and most developers prefer to use it instead or <code>urllib</code>/<code>urllib2</code> </p>



<p>See : <a href="https://stackabuse.com/the-python-requests-module/" target="_blank" rel="noreferrer noopener">https://stackabuse.com/the-python-requests-module/</a></p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">OS.path</span></strong> :  this module implements some useful functions on pathnames. To read or write files see <a href="https://docs.python.org/3/library/functions.html#open" target="_blank" rel="noreferrer noopener"><code>open()</code></a>, and for accessing the filesystem see the <a href="https://docs.python.org/3/library/os.html#module-os" target="_blank" rel="noreferrer noopener"><code>os</code></a> module <a href="https://docs.python.org/3/library/os.path.html" target="_blank" rel="noreferrer noopener">https://docs.python.org/3/library/os.path.html</a></p>



<p><span class="has-inline-color has-luminous-vivid-orange-color"><strong>pyaes</strong> </span>:  a pure-Python implementation of the AES block-cipher algorithm and common modes of operation (CBC, CFB, CTR, ECB, OFB) with no dependencies beyond standard Python libraries. See : <a href="https://github.com/ricmoo/pyaes" target="_blank" rel="noreferrer noopener">https://github.com/ricmoo/pyaes</a></p>



<p>Last but not least, <strong><span class="has-inline-color has-vivid-cyan-blue-color">cryptondie.py</span></strong>, as the main program, is going to gather the database informations (from the target IP), then parse through the files to encrypt, then proceed with the AES encryption, and give a confirmation of successfull operation</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2019/11/image-16.png" alt="" class="wp-image-200" width="493" height="457" srcset="https://www.forensicxs.com/wp-content/uploads/2019/11/image-16.png 705w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-16-300x278.png 300w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-16-230x213.png 230w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-16-350x324.png 350w, https://www.forensicxs.com/wp-content/uploads/2019/11/image-16-480x445.png 480w" sizes="(max-width: 493px) 100vw, 493px" /></figure>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Conclusion</span></strong> : as an overall conclusion of this review, I&#8217;ve not been explaining every details but I&#8217;ll let the reader enjoy the intricacies of the code <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> I&#8217;ve tried focusing on the key mechanisms instead. Overall, I find this study program very interesting and quite high level with a good combination of many tools</p>



<ul class="wp-block-list"><li>web framework Flask and RESTful API, to import a target IP data</li><li>SQL database to structure the extracted data</li><li>parsing through the data and the files with efficient techniques (JSON, reqparse, requests, OS.walk,&#8230;)</li><li>strong encryption using AES and a dedicated Python implementation</li></ul>



<p>It&#8217;s a great way to learn ! Congratulations to the author @zer0dxx !</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.forensicxs.com/cryptondie-a-ransomware-developed-for-study-purposes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Database Caching 40/46 queries in 0.045 seconds using Disk

Served from: www.forensicxs.com @ 2025-12-27 23:24:41 by W3 Total Cache
-->