<?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 Josué Carvajal on Medium]]></title>
        <description><![CDATA[Stories by Josué Carvajal on Medium]]></description>
        <link>https://medium.com/@josue-carvajal?source=rss-ec9ee5dcd6e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3QowQkTBUGHX7gwlJ55mSw.jpeg</url>
            <title>Stories by Josué Carvajal on Medium</title>
            <link>https://medium.com/@josue-carvajal?source=rss-ec9ee5dcd6e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:08:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@josue-carvajal/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[Blockchain Vulnerabilities: Sybil attack & 51% attack]]></title>
            <link>https://josue-carvajal.medium.com/blockchain-vulnerabilities-sybil-attack-51-attack-2e789a0e3ed0?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e789a0e3ed0</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Thu, 09 Jan 2025 13:33:17 GMT</pubDate>
            <atom:updated>2025-01-09T13:33:17.942Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Sybil Attack</h3><p>A Sybil Attack is based on creating multiple identities or nodes to obtain an unfair advantage or alter a system and Blockchain is not exempt from this vulnerability, although they rely on consensus mechanisms to validate transactions and guarantee the security of the network. The name “Sybil” is received thanks to the reference to the book Sybil Dorsett, which is a case study about a woman with multiple personality disorder. Similar to the movie Split.</p><p>A Sybil attack serves as a cornerstone for performing a 51% attack by allowing the attacker to create a large number of fake nodes, giving them the illusion of majority control. This is important because of how Consensus mechanisms work, for example Proof of Work (PoW), where computing power is the key factor in achieving consensus.</p><p>For example, in a blockchain network where the majority of nodes reach a consensus on the transaction history and it turns out to be valid. An attacker can launch a Sybil attack, creating hundreds of fake nodes. If these fake nodes, combined with any legitimate nodes they control, exceed 50% of the total nodes on the network, they can effectively launch a 51% attack, and acquire consensus control. While large-scale Sybil attacks on major Blockchains are particularly difficult due to their strong security mechanisms, they remain a potential threat, especially for smaller or less established blockchains.</p><h3>Types of Sybil attacks</h3><ul><li><strong>Direct Sybil Attacks:</strong> This one is like an spoiled fruit around healthy fruit. Here the malicious nodes influence the network by directly communicating with honest nodes to take control of decision-making processes, voting procedures, or consensus mechanisms.</li><li><strong>Indirect Sybil Attacks: Aim to silently </strong>increase the reputation of the sybil nodes, they artificially increase the reputation of particular nodes, alter a network’s topology, or isolate certain parts of the network.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7Rhz8fu4n_E5XuXf.png" /></figure><p><strong>Sybil attack can have several negative consequences, including:</strong></p><ul><li><strong>Network control:</strong> The attacker can use their multiple identities to control the network consensus, allowing them to manipulate transactions or even stop the network entirely.</li><li><strong>Double Spending: </strong>The attacker can use their multiple identities to spend the same digital currency twice, which can lead to inflation and loss of trust in the network.</li><li><strong>Identity theft:</strong> The attacker can use their multiple identities to impersonate other users, which can lead to theft of funds or loss of network access.</li></ul><p><strong>But what do these “sybil nodes” look like?</strong></p><p>A Sybil node might look pretty similar to a legit node, they can be a full node and they can also be validators, the difference is that they still have the main node functionalities to participate in the blockchain, for example: participate in the consensus and verify transactions. Sybil nodes just slightly modify the behavior so the core functionalities remain unaltered, for example they can reject all the transactions but only process those coming from the attacker, we can say it has a little bit of changes.</p><p>By default one single sybil node cannot affect the consensus, let’s assume there is a network of 10 nodes, where 1 of them is a sybil node, the tampered verification response will be only 10% and 90% of the network will discard the response for that node, so the impact at this point is not critical. On the other hand if there are 10 nodes and the attacker is able to manage 6 of them (60%) they can modify the consensus and start validating transactions that are not legit.</p><p><strong>Measures to Prevent Sybil Attacks</strong></p><p>In blockchain there are proof-of-work (PoW) or proof-of-stake (PoS) consensus mechanisms, they have measures to make Sybil attacks difficult:</p><p><strong>Proof of Work (PoW):</strong></p><ul><li>Computational cost: PoW requires participants to solve complex mathematical problems to validate transactions and add blocks to the blockchain. This makes it computationally expensive for attackers to create and maintain a large number of fake nodes.</li><li>Resource consumption: Running many nodes requires significant power and hardware resources, making it economically difficult for attackers to sustain a Sybil attack.</li></ul><p>This makes the ROI (Return of Investment) very low and with high risk, discouraging many attackers from trying it.</p><p><strong>Proof of Stake (PoS):</strong></p><ul><li><strong>Economic cost</strong>: PoS requires participants to “stake” or lock a certain amount of cryptocurrency to participate in transaction validation. This makes it expensive for attackers to create many fake nodes, as they need to stake a significant amount of their own cryptocurrency.</li><li><strong>Slashing:</strong> Many PoS systems have “slashing” mechanisms, where participants lose a portion of their staked cryptocurrency if they engage in malicious behavior, such as creating fake nodes.</li><li><strong>Consensus mechanisms:</strong></li><li><strong>Node validation</strong>: Blockchain networks often have mechanisms to validate the legitimacy of nodes, such as requiring them to prove their identity or demonstrate a history of good behavior.</li><li><strong>Reputation systems</strong>: Some blockchains use reputation systems to track the behavior of nodes, making it easier to identify and flag potentially malicious ones.</li></ul><p>Also you can rely on tools that will help you identify monitor and safeguard Ethereum validators such as <a href="https://arxiv.org/abs/2310.09193">Tikuna</a>. There are also (not in the node context) Zero Knowledge Proofs that are “Proof of Humanity” that allows the users to sent a ZK proof to validate they are real users and not faked entities, some examples of them are:</p><ul><li>WorldCoin</li><li>zk Proof of Humanity</li><li>Open Passport</li><li>zk Gitcoin Passport</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2w1IMPcKDF7RB_MN.jpg" /></figure><p><strong>Key points to remember</strong></p><ul><li>Sybil attackers create fake nodes instead of stealing legitimate ones.</li><li>PoW and PoS mechanisms have built-in economic and computational costs that make Sybil attacks difficult, making the attacker’s ROI very low and at high risk.</li><li>Consensus mechanisms and node validation procedures help prevent attackers from introducing fake nodes into the network. This does not guarantee that they are bullet proof (no system is), but it makes them very secure.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e789a0e3ed0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An introduction to Generative AI]]></title>
            <link>https://josue-carvajal.medium.com/an-introduction-to-generative-ai-a9a4585cf7f4?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9a4585cf7f4</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 14:21:14 GMT</pubDate>
            <atom:updated>2024-12-04T14:21:14.099Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Imagine a super smart robot that has a special power: it can create amazing things! It can write stories, draw pictures, and even make up new songs. This robot learned how to do all this by looking at lots and lots of examples made by humans. It’s like a magical toy that can use its imagination to come up with brand new ideas, just like you do when you play pretend! That’s what Gen AI is — a super smart robot that uses its knowledge to create cool and surprising things, including text, images, audio and synthetic data.</em></blockquote><p>The sentence above was created using Gemini’s GenAI by asking it to explain GenAI to a kid, pretty cool huh? In this post we are going to cover all the basics you need to know to understand where GenAI comes from and a more formal approach of What Gen AI is.</p><p>Before we start, we need to understand the difference between Machine Learning and Artificial Intelligence.</p><h3>Machine Learning &amp; Artificial Intelligence</h3><p>Artificial Intelligence (AI) is a broad field of computer science dedicated to creating intelligent agents, which are systems capable of reasoning, learning, and independent action. <em>The ultimate goal of AI is to develop machines that can think and act like humans</em>.</p><p>Machine learning (ML) is a subfield of AI that focuses on the development of algorithms and models that <em>empower computers to learn from data and make predictions</em> or decisions without explicit programming. It teaches computers to learn from experience, mirroring the way humans learn from their own encounters. Through this process, a model is trained on input data, enabling it to generate useful <strong><em>predictions </em></strong>when presented with new, previously unseen data that is similar in nature to the training data.</p><p>Deep learning, <strong>a subset of machine learning,</strong> plays a crucial role in this process. In essence, AI can be viewed as a scientific discipline such as physics is on science, while ML represents a specialized subfield within that discipline.</p><p>This might be a little overwhelming, isn’t it? Let’s ask AI to generate an explanation of the difference between AI and ML so a 5 year old can understand it.</p><blockquote><em>Imagine you have a big box of toys. That big box is like Artificial Intelligence (AI). Inside that big box, there’s a special set of toys. These toys are like Machine Learning (ML). They help the machines learn and get better at things, just like you learn to ride a bike or draw a picture. These special toys help the machines learn from examples, so they can figure out how to do new things without being told exactly what to do every step of the way. So, remember, AI is the big box of all the smart toys, and ML is a special set of toys inside that help the machines learn and get even smarter!</em></blockquote><p>A little bit easier, huh?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ksgf-bjGnCdKIdR0" /></figure><h3>Learning methods for Machine Learning</h3><p>Learning methods are ways of teaching a machine new things, each learning method has its strengths and weaknesses, and the choice depends on the specific problem and the available data.</p><p>Let’s explore the two primary training methods:</p><h3>Supervised learning</h3><p>Supervised Learning is a powerful technique that can be used to solve a wide variety of problems, such as image classification, natural language processing, and speech recognition.</p><p>Here a model learns to make predictions based on labeled data that has been annotated with the correct answer or outcome. For example, a dataset of images of cats and dogs that has been labeled with the correct animal name would be a labeled dataset.</p><p>In this type of learning, the model is given a set of labeled data and is asked to learn the relationship between the input features and the output labels. Once the model has learned this relationship, it can be used<strong> to make predictions </strong>on new, unseen data.</p><p>Here’s a simplified example of how supervised learning works:</p><ul><li>We have a dataset of labeled images of cats and dogs.</li><li>We split the dataset into a training set and a test set.</li><li>We train a machine learning model on the training set.</li><li>We test the model on the test set to see how well it can predict the correct animal name for new, unseen images.</li><li>If the model performs well on the test set, then we can be confident that it has learned the relationship between the input features (the pixels in the images) and the output labels (the animal names).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bj6JBZU9RKN-C5OG" /></figure><h3>Unsupervised Learning</h3><p>Here a model learns from unlabeled data, that is, data that has not been annotated with the correct answer or outcome. The goal of unsupervised learning is to find patterns or structures in the data without being explicitly told what to look for.</p><p>Unsupervised learning is often used for tasks such as:</p><ul><li>Clustering: Grouping similar data points together</li><li>Dimensionality reduction: Reducing the number of features in a dataset without losing important information</li><li>Anomaly detection: Identifying data points that are significantly different from the rest of the data</li></ul><p>Here’s a simplified example of how unsupervised learning works:</p><ul><li>We have a dataset of images of cats and dogs, but the images are not labeled with the correct animal name.</li><li>We train an unsupervised learning model on the dataset.</li><li>The model learns to group the images into two clusters, one for cats and one for dogs.</li><li>We can then use the model to label new, unseen images of cats and dogs.</li></ul><p>Unsupervised learning can be a powerful tool for exploring data and finding patterns that would not be immediately obvious to a human observer.</p><p>Here are some of the key benefits of unsupervised learning:</p><ul><li>It can be used to find patterns in data that is not labeled.</li><li>It can be used to reduce the dimensionality of data, making it easier to analyze.</li><li>It can be used to detect anomalies in data.</li></ul><p>However, unsupervised learning also has some limitations:</p><ul><li>It can be difficult to interpret the results of unsupervised learning models.</li><li>Can be sensitive to noise and outliers in the data.</li><li>Can be computationally expensive to train.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7reP5hkmbqG0Ip2k" /></figure><h3>Other types of learning</h3><ul><li><strong>Semi-Supervised Learning:</strong> This approach combines a small amount of labeled data with a larger amount of unlabeled data. It leverages the benefits of both supervised and unsupervised learning.</li><li><strong>Reinforcement Learning:</strong> This method involves an agent learning to interact with an environment by receiving rewards or penalties for its actions. It’s like training a pet with treats and corrections.</li></ul><h3>What actually is GenAI</h3><p>Generative AI is a subset of Deep Learning. Which can process both labeled and unlabeled data using supervised, unsupervised and semi-supervised methods, meaning GenAI is a specific type of deep learning focused on generating new content like text, images, or audio, rather than just analyzing existing data; essentially, it uses deep learning techniques to create new things that resemble existing data. LLM is also a subset of deep learning.</p><p>Here’s a breakdown of the relationships between some key AI concepts:</p><ul><li><strong>Deep Learning:</strong> A subset of machine learning, deep learning uses artificial neural networks inspired by the human brain. These networks excel at processing complex patterns.</li><li><strong>Generative AI:</strong> A subset of deep learning, generative AI models can create new content like text, images, or music.</li><li><strong>Large Language Models (LLMs):</strong> These are a specific type of generative AI model focused on understanding and generating text.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y3xStgOp644xIYf2" /></figure><p><strong>Key Points:</strong></p><ul><li>Deep learning models can learn from both labeled and unlabeled data using various methods (supervised, unsupervised, and semi-supervised).</li><li>Semi-supervised learning is particularly useful when there’s limited labeled data available.</li><li>Labeled data provides initial guidance, while unlabeled data helps the model generalize and learn broader patterns.</li></ul><p><strong>Remember:</strong></p><ul><li>Deep learning is a powerful tool within the larger field of machine learning.</li><li>Generative AI, including LLMs, is a specialized application of deep learning with a focus on creating new content.</li></ul><p>In conclusion, deep learning, including generative AI and LLMs, offers a range of powerful techniques for learning from both labeled and unlabeled data. While supervised learning provides guidance, unsupervised and semi-supervised learning enable models to discover patterns and make predictions on new data. This opens up exciting possibilities for further advancements in AI and machine learning.</p><p>PD: In the next chapter we are going to cover the security challenges that we face with GenAI and some of the benefits that they bring into security as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9a4585cf7f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An overview of threat modeling: Securing your applications proactively]]></title>
            <link>https://josue-carvajal.medium.com/an-overview-of-threat-modeling-securing-your-applications-proactively-ec1842cdc70c?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec1842cdc70c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[application-security]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Wed, 22 May 2024 23:24:40 GMT</pubDate>
            <atom:updated>2024-05-22T23:31:03.851Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*LD46VwZSOywpoyd2IwxOfg.png" /><figcaption>Image #0. Thread Modeling</figcaption></figure><p>In today’s rapidly evolving digital landscape, security is still being seen as a cost center for many companies, since securing products does not directly make any money. But, if no action is taken to harden our products it can cause a loss of millions of dollars and company reputation.</p><p>Some time ago I created an <a href="https://4noobies.medium.com/an-overview-of-threat-intelligence-in-cybersecurity-f48ecf37c323">overview of Thread Intelligence</a> which had a lot of interaction and interest between people willing to learn more about security, today, I’ll provide an overview of what threat modeling is, its importance, and how to implement it effectively in your security strategy.</p><h3>What is Thread Modeling?</h3><p>Threat modeling has roots in military strategy! The concept of threat modeling isn’t just a modern cybersecurity practice; it has historical parallels in military strategy. <strong>Just like threat modeling in software involves identifying potential threats and vulnerabilities to devise defensive measures, </strong>ancient and modern military strategists have long used similar approaches to assess and mitigate risks on the battlefield.</p><p>If we google for thread modeling in software we will find some results like:</p><blockquote>Thread modeling is a powerful guide t<strong>o protect our valuable assets in the early stages of development</strong>, saving time and identifying weak areas to have an action plan when a weakness is discovered.</blockquote><p>But what does this mean? Well to understand what threat modeling is and its benefits we need to start from the basics of SDLC (Software Development Life Cycle)</p><p>As you can see in the next image, the traditional SDLC consists of 6 different phases, where you plan what you want to execute, analyze if it is feasible, design the architecture, then you implement it and then QA tests and integrates everything, and the last phase is maintenance of the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/0*Ae2Pb_9vBenSYTT9.png" /><figcaption>Image #1. SDLC</figcaption></figure><p>But what is wrong with this? In reality, there is nothing wrong but as you can see security is not in any part of the diagram, even though some companies can execute security tests during the testing &amp; integration phase, it will be harder to fix since several months have passed since the early stages started, so changing a critical vulnerability will be difficult since it could also require changes in the initial proposed architecture.</p><p>During these last years, a couple of new concepts have been gaining popularity, such as SSDLC (Secure Software Development Life Cycle) and the Shift-Left approach in the Development Security Operations (DevSecOps)</p><p>When we talk about <strong>Shift Left, </strong>this incorporates software testing procedures, <strong>such as security</strong>, <strong>as early</strong> in the software development lifecycle as feasible, on the other hand, SSDLC covers from the beginning to the final product with security in mind, let’s take a look:</p><p>In the next image, we can see that we have similar phases of SDLC, Requirements, design, implementation, test, deployment, and maintenance but we also have a couple of security assessments that can be performed during these development phases, such as SAST, PENTEST, Thread modeling, so we work with different vulnerability and risk assessment. Cool isn’t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fLu1mjLY0IlCXgfA.jpg" /><figcaption>Image #2. SSDLC</figcaption></figure><p>So, why am I explaining all this? Well, when working on thread modeling roles you are expected to have a full understanding of SDLC as well as know how to code, as you can see thread modeling relies on the early stages of the SDLC, specifically during the design phase.</p><p>When working with Thread Modeling we have access to architecture diagrams, we meet with developers to understand what they are building, and around that we can spot weak areas and suggest changes to the teams to mitigate possible vulnerabilities.</p><p><strong><em>So what Threat modeling is?</em></strong> It is a f<strong>ormal and structured examination of the application components to identify weak areas and how we can mitigate them</strong>, allowing us to improve the security posture and have high confidence that our application meets the needed standards.</p><p>The primary goal for Thread modeling, is to <strong>visualize the application’s attack surface, identifying possible attack vectors, and devising appropriate defensive measures.</strong></p><h3>How can I start performing thread modeling?</h3><p>Thread modeling is a never-ending process, it starts when you are building a new application, and if new features are added, the outputs of the thread modeling process must be updated accordingly.</p><p>To start implementing the thread modeling, you should know that some frameworks such as STRIDE from Microsoft, or PASTA (if you are working closely with development) are a good start, they work as a guide to make sure that we are covering different scenarios, let’s deep dive into STRIDE.</p><h4>STRIDE</h4><p>As I’ve mentioned, STRIDE was developed by Microsoft, and it stands for different threads:</p><ul><li><strong>S</strong>(spoofing): Which affects <strong>Authenticity</strong></li><li><strong>T</strong>(tampering): Which affects <strong>Integrity</strong></li><li><strong>R</strong>(Repudiation): Which affects <strong>Non-repudiability</strong></li><li><strong>I</strong> (Information Disclosure ): Which affects <strong>Confidentiality</strong></li><li><strong>D</strong>(denial of service): Which affects <strong>Availability</strong></li><li><strong>E</strong> (escalation of privilege): Which affects <strong>Authorization</strong></li></ul><p>Using this, we can evaluate different threats within our application, but how can I achieve this? Well let’s deep dive now into the DFD (Data Flow Diagrams)</p><h4>Data Flow Diagrams (DFD)</h4><p>When working in thread modeling, the DFD are our best friends, they are an abstraction of what the application, it allow us to identify the flow of data within the application, allowing us to spot <strong>trust boundaries, </strong>and also weak areas</p><p>There are different levels of DFD, starting from 0 to 2 or higher, the higher the level, the deeper into details it goes, and allows us to identify more weaknesses.</p><p>Here is what a DFD-0 looks like (Level-0): As you can see a pretty simple and high-level perspective, abstracting a lot of the complexity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ltu_2uSW7YKnDhN7.jpg" /><figcaption>Image: #3. DFD-0</figcaption></figure><p>Here is what a DFD-2 looks like (Level-2): In this level dive deeper into the subprocess, and we can keep increasing the level by identifying everything that is being done by each of the components</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Hkzv1RP8BpKInPJV.jpg" /><figcaption>Image #4. DFD-2</figcaption></figure><p>So as an example, let’s assume that we are performing thread modeling for a bank:</p><ul><li><strong>Level 0 DFD</strong>: Shows the entire banking system as a single process interacting with users, third-party payment gateways, and external databases.</li><li><strong>Level 1 DFD</strong>: Break down the system into processes like “User Login”, “Account Management”, “Transaction Processing”, and “Report Generation”.</li><li><strong>Level 2 DFD</strong>: Further decomposes “Transaction Processing” into sub-processes like “Input Validation”, “Transaction Validation”, “Database Update”, and “Notification”.</li></ul><p>Here is a pretty cool article about DFD if you want to learn more <a href="https://www.linkedin.com/pulse/data-flow-diagram-dfd-levels-dfd-0-dfd-1-dfd-2-how-impacts-shachar/">https://www.linkedin.com/pulse/data-flow-diagram-dfd-levels-dfd-0-dfd-1-dfd-2-how-impacts-shachar/</a></p><h4>Trust Boundaries</h4><p>I did mention trust boundaries in the previous section, these are important since will allow us to connect the DFD to the STRIDE model. <strong>Trust boundaries are meant to spot places where the level of access of a user or process changes</strong></p><p>For example, let’s assume that a user needs to log into the system to perform some actions, well we are passing from an unauthenticated session to an authenticated session with some privileges, and when we are storing that info at the db level, a subprocess with authentication with the database perform the write operation. <br>The trust boundaries are marked with lines and labeled. This is important since it will allow us to identify how the different components interact</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRUQUzhXXTJ6VmSeR0v-Eg.png" /><figcaption>Image #5. Trust boundaries</figcaption></figure><h4>Unifying DFD with STRIDE</h4><p>It is nothing fancy usually we can write a report in Excel, but the trust boundaries will help us define the level of access required for each tool.</p><p>Once we have the different DFD and trust boundaries in place, we create a table to compare the communication of a component with another one, in this case, The User with the App Backend and vice-versa, the AppBackend with the User, also the App Backend with the DB and vice-versa, you got the point, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7r0DcfJ6bweN0CztA3rkeA.png" /><figcaption>Image #6. Table + STRIDE</figcaption></figure><p>So in this table, we put the STRIDE and identify the Strengths and weaknesses of each component, one weakness of the app backend could be that it is not performing input sanitization and a strength, that it uses HTTPS.</p><p>The idea is to understand what the application does, be familiar with the common attacks and techniques, the broader knowledge you have, the better thread modeling reports you will get!</p><h3>Conclusion</h3><p>Threat modeling is a critical component of a proactive security strategy. By systematically identifying, assessing, and mitigating potential threats, organizations can significantly enhance their security posture and protect their applications from evolving cyber threats. Implementing threat modeling early in the development lifecycle not only helps in managing risks more effectively but also contributes to building secure, resilient applications that stand up to the challenges of today’s threat landscape.</p><p>Start incorporating threat modeling into your security processes today to stay ahead of potential threats and safeguard your valuable assets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec1842cdc70c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This is what you need to know if you want to become a Security Software Engineer]]></title>
            <link>https://josue-carvajal.medium.com/this-is-what-you-need-to-know-if-you-want-to-become-a-security-software-engineer-fd0c23b0c612?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd0c23b0c612</guid>
            <category><![CDATA[security-certifications]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[roadmaps]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 22:22:54 GMT</pubDate>
            <atom:updated>2022-08-30T22:22:54.330Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>One of the most common questions that I receive when I teach some of my co-workers and students about security is “Where do I start?”, “What are the areas that I can work in the security field”, “Do I need a bachelor’s degree?”. Well, this is going to be a very personal post, answering all the questions that I’ve been asked, everything that I’m going to share is 100% from my experience, based on the analysis that I’ve been doing of the Security Engineering Market and the Place that you are located.</p><p>Before start let me introduce my self… I’m not good at it and I do not want to share too much PII (Personal Identifiable Information). My name is Josue Carvajal, and I’m a Senior Security Software engineer that has been in this field for the past 4 years. I do have a bachelor’s degree in computer science and I’m a certified Ethical Hacker (CEH) and Security+ from CompTIA.</p><p>If you want to know how do I went from 0 knowledge on Security to get my first Security Job until I’ve become a Senior Security Engineer, please read the <strong>Summary of my Journey</strong>, if not, you can skip to the <strong>Where do I start? </strong>section.</p><h3>Brief overview of my journey</h3><h4>The problem of Universities in my country (Or most of them).</h4><p>You may wondering if I did received a security approach while I was studying computer since, and the short answer for this is: <strong><em>NO</em></strong>. But let me elaborate a little bit more on it.</p><p>During those 4 years of University it was purely focused in Development, Project Management, good practices and testing. The goal was to get the things done and make sure it was not going to break, even though it was not properly secure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*Q5d86yZF_63JyyN5dg6EVw.png" /><figcaption>Image #1. Your First Login</figcaption></figure><h4>What really matters!</h4><p>As you can see, I did not receive any security training during my time in the university until I took a formal summer class called “Security Concepts — Advanced Course” and I was fascinated! Our teacher showed us how he got access to an android device and access the camera! This was the start of my journey! And thanks to this I was able to get my first job as a Security Java Developer in which I was able to move to another position called Security Escalation Engineer at ArcSight, Microfocus.</p><p><strong><em>So why I’m sharing this?</em></strong> Well, you do not really need a bachelor’s degree for some security areas BUT it is a big advantage in your professional growth since the higher the position, the higher the responsibilities and background you need. As you can see I want you to know that you do not need to have any kind of certification to get your first job in this area, if you are able to show the interest and expertise you are going to nail it! But make sure to keep learning since it will allow you to get better positions and a better salary!</p><h3>Identifying the right path to follow!</h3><p>During my time at ArcSight, I’ve learned a lot about SIEMS, Collectors, Security devices, Networking, Operative Systems but I wanted to learn more! I knew I was good at Linux, Bash, and solving complex problems, so, I started attending different webinars to know “How to Start” and started building my own path! At this point I’ve started to obtain security certifications and follow the goal that I wanted: <strong><em>to become a DevSecOps engineer and some day work in another country, maybe Canada, New Zeland, USA.</em></strong> I do not know, I feel good when I think on it (I’m currently located in Costa Rica) Hopefully some day...</p><p>As you can see I knew what I wanted, but this was not an easy decision, it took me a couple of years to realize where I wanted to put effort, so don’t feel bad if you do not know yet! Keep exploring, at the end you will be a better engineer since you might know how the things are done in different areas!</p><p>If you do not know the areas of specialization, please keep reading!</p><h3>Areas of specialization</h3><p>The same way computer engineering is not only programming, security is not only performing actions that you saw in the Mr. Robot series. There are a wide number of branches that you can follow depending in the areas of your interest and these others generates a bunch of new branches, so do not give up!</p><p>Some of those areas are:</p><ul><li><strong>Penetration Testing:</strong> I think everyone in the field gets excited about this, Here is purely practical but also requires a lot of knowledge, here you test systems security capabilities in order to report back those vulnerabilities to the blue team, that will fix it to avoid damage of an external threat.</li><li><strong>Security Software Engineer</strong>: Most of the common ones, can vary from Application Security to Cloud Security, requires security knowledge depending of the area that you are focusing, some of the duties are: to patch vulnerabilities, to improve the security standpoint of your application, maintain LDAP, etc.</li><li><strong>DevSecOps Engineer: </strong>Similar as a DevOps but adding a security layer to the process, we improve the security standpoint from the creation, building and release of the systems in order to quickly fix any vulnerability found. We find ways to secure our SDLC (Secure Development Life Cycle) and helps the developers to improve the security quality of the code.</li><li><strong>Security Analyst: </strong>The most common one, usually does not requires bachelor’s degree, can be seen as a “Secure support” in which you work with a SIEM to find IoC (Indicators of Compromise)</li></ul><p>As you can see, these are just a summary of those roles that you can find withing the security field, all of them requires at least some type of certification.</p><h3>Are certifications worth it?</h3><p>It depends, but in the security field there are highly valued certifications that you need to get more points that your competitors, as I said earlier, the Universities often does not graduate people in security, security is something that you need to learn on your own and the way to probe it is by using highly looked certifications. So yes, they are worth but not all of them, it will depend in the area of specialization that you want to be part of.</p><h3>What certifications do I need?</h3><p>I personally recommend the <a href="https://www.comptia.org/es/certificaciones/security">CompTIA Security+</a> to start getting familiarized with the concepts, the way of thinking and to confirm that you really like this field. BUT here is a cool tool: <a href="https://pauljerimy.com/security-certification-roadmap/">Security Certification RoadMap</a> that show you, depending of your areas of interested what kind of certifications are good for that position, the price and the link for the official page!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HpVHkXMrJZc5efewjh3Sw.png" /><figcaption>Image#2. Security Certification Roadmap</figcaption></figure><p>Also, I do recommend to deep dive in LinkedIn and check what types of certifications do the companies are looking for, for the area of specialization that you want to be!</p><p><strong>For example: </strong>I know that for pen-testing, one of the most valued certification is from OSCP, here you can see the number of job posting that contains that certification for the USA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*Hcw8D0W-4jr2GDYsm3DltA.png" /></figure><p>And here one for the CISA, for audit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*n_pBAPqe9ol_dG__Um_wxg.png" /></figure><h3>My two cents</h3><p>I did a lot of mistakes! I had a lot of frustration, headaches and wanted to quit from this security journey, mostly because I was not finding my next big move, I know it was going to be hard, even though I had offers from IBM, Pfizer &amp; EY from different positions: Incident Responder / Security Correlation Engineer / Penetration tester! Those were not in the DevSecOps area!</p><p>Security field is challenging and there are big tech companies trying to find an All-in-one engineer to do from DevSecOps to Pentesting and Incident Management and they want to pay like us like a junior dev! Be careful with those type of companies, red flags can be found easily in the job description!</p><p>But even though I knew it was going to be hard, I was able to made it! And if I was able to do it, you are able to do it as well!</p><p>With that said, here are some other advises:</p><ul><li><strong>Make sure to identify what are the most common fields of your country: </strong>for example, in Costa Rica you can easily get a Security Analyst position with a few certs, but not for penetration testing, there are a few openings and all of them require a lot of certs and a lot of years of experience! Make sure to put the efforts in an area where you can start gaining experience.</li><li><strong>Identify the requirements for the given position:</strong> Identify what types of certifications does it requires, years of experience and also if it needs or not a bachelor’s degree (Because if you have one probably you will get underpaid in another security field)</li><li><strong>Schedule &amp; Duties</strong>: Make sure if the job description contains “On call Rotation” quote, <strong>this means they are rotating working hours</strong>! I’ve discarded a lot of positions due to this, security field can easily cause burn out if you are in the hands of those big techs that does not cares about their employees, so make sure to check that carefully and make sure the posting company has good reviews for your contry, this can be found at Glassdoor, so make sure to do this homework before you start! This will save you a lot of headaches</li><li><strong>One step at a time</strong>: I’ve seen a lot of people trying to install all the tools at once, paying a lot of subscriptions to “speed up their process”, learning networking, pen testing techniques, and everything at ones, it is not always a good idea, focus in a tool or a specific area, understand how’s that is applicable, how to improve it and how to prevent. And you will boost your knowledge. Interviews are mostly situational so you need to know how to think before just throwing commands or concepts on paper.</li></ul><p>Thanks for reading, I hope this will help you to find a clear path in this journey! Just remember everything was from my point of view, so you can disagree with me in some areas. Feel free to add me to your LinkedIn network and rate this post if you like it!</p><p>Oh, one last thing: <strong><em>make sure to look forward even if the sun hits you in the face.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd0c23b0c612" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vault secrets as environment variables]]></title>
            <link>https://josue-carvajal.medium.com/vault-secrets-as-environment-variables-1f0788de28b9?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f0788de28b9</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[vault]]></category>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[helm]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Fri, 01 Jul 2022 02:04:32 GMT</pubDate>
            <atom:updated>2022-07-01T02:07:40.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*tPq2fDDctydFbjze.png" /></figure><p>If you are a DevSecOps engineer working with Vault to provide a secure way to handle secrets and you are reading this post, then there are high chances that you have tried different solutions out there to inject environment variables without success. Do not worry. In this post I’ll show you how to beat this road blocker.</p><h3>Secrets-as-env &amp; Secrets-as-file</h3><p>It is important to highlight that there are mostly two types of secrets; those that are read from environment variables (<strong>secrets-as-env</strong>) and those that are read from a secrets files (<strong>secrets-as-file</strong>). Vault works particularly fine with secrets-as-file, in which the agent-injector adds a vault-agent container inside your pod in order to load the secrets under the <strong>/vault/secrets/&lt;secret-file&gt;</strong> path.</p><p>The problem is not with secrets-as-file,<strong> the problem is mostly with secrets-as-env</strong>, since<strong> Vault does not provide an easy use case to inject secrets-as-env</strong>. If you read their documentation they will suggest to use template injection in which it “partially works” and it is kind of dark the way it is being handled. A lot of requests has been made in the GitHub and the community place for Vault without any release date. And I’ve tried several approaches of their documentation without success.</p><p>The good thing is that there are some third party (Open Source) Solutions that provides a full customized vault implementation in order to fix some problems. The tool that we are going to work in this post is called <strong>Bank Vault</strong> by BanzaiCloud, BUT we are <strong>only</strong> going to <strong>use their Mutating webhook</strong> to handle the secrets-as-env.</p><h3>Solution overview</h3><p>As mentioned before there are several third parties tools such as Patroni or Tozny that only allows read secrets as environment variables, and there are a bunch of other tools that can read secrets from a file (secrets-as-file).</p><p>Imagine that we are using<strong> kubernetes + Helm</strong> charts to deploy our solution. We will have a namespace called vault-infra which will contain the Official <strong>Vault Helm in one pod, and within the same namespace the Bank Vault</strong> webhook. The idea is to use the Vault Helm solution to handle everything related to secrets and the webhook will connect to that vault via service address to provide the extra capabilities to read environment variables.</p><p>So if you have an application in another namespace such as <strong>Redis that only reads secrets-as-file, you will be using the regular vault annotation</strong>s to achieve it. If there is a case in which a<strong> third party only works with environment variables, you will connect that app to the Bank Vault webhook</strong> using their specific annotations.</p><p>In this way we can extend the capabilities of vault without affecting the (possible) already deployed vault infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*SQJ9lF1BzzSVL6yn88mMoQ.png" /><figcaption>Figure 1. Solution overview</figcaption></figure><h3>Bank Vault — Webhook annotations</h3><p>As mentioned before, the annotations for Bank Vault are specific to Banzai, meaning that we need to add different pod annotations in order to work with the webhook. But those are not too different. Let’s take a look.</p><p>In your pod annotation you will need the following annotations.</p><ul><li><strong>The vault-addr:</strong> that defines the service address of your Vaul Helm</li><li><strong>The vault-role:</strong> Which is the service account / Vault rol name</li><li><strong>The skip-verify:</strong> To avoid the TLS verification</li><li><strong>The vault-path</strong>: Which is the secret location path in your vault</li></ul><pre>vault.security.banzaicloud.io/vault-addr: &quot;https://vaultname:443&quot;<br>vault.security.banzaicloud.io/vault-role: &quot;patroni&quot;<br>vault.security.banzaicloud.io/vault-skip-verify: &quot;true&quot;<br>vault.security.banzaicloud.io/vault-path: &quot;secret/patroni&quot;</pre><p>And that’s it! Those are the only annotations that you need.</p><h3>Bank Vault — Loading secrets</h3><p>In order to read the specific secrets we are going to use the following “path” “vault:SECRET_PATH#SECRET_KEY” and it will look like this.</p><pre>env:<br>- name: DB_PASSWORD<br>  value: vault:secret/data/db#DB_SECRET_KEY</pre><p>This means that we are going to use the secret path and then specify the KEY that will hold the secret for our environment variable. As you can see this is really easy to read.</p><h3>How does it work?</h3><p>I highly recommend checking this official <a href="https://banzaicloud.com/docs/bank-vaults/mutating-webhook/">article</a>, but basically it is really secure since it does not store any values in etcd, or kubernetes secrets. It copies a binary called /vault/vault-env which is executed before the entry point of your pod, allowing to translate the path above to your specific secret.</p><p>If you check the environment variables of your running container you will see it just shows the path, but if you run the following command</p><p>kubectl exec -it patroni — /bin/sh -c &quot;/vault/vault-env env&quot;</p><p>You should be able to see your translated environment variables.</p><p>That’s it for now. And I hope this article was helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f0788de28b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A deep dive into Vulnerability Analysis]]></title>
            <link>https://josue-carvajal.medium.com/a-deep-dive-into-vulnerability-analysis-4bf2b993ebb0?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bf2b993ebb0</guid>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[vulnerability-management]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Sun, 27 Mar 2022 04:13:06 GMT</pubDate>
            <atom:updated>2022-03-27T04:13:46.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*dj9kgX1_6XBOJU6x.jpg" /></figure><h3>Introduction</h3><p>Vulnerability assessment plays a major role in providing security to any organization’s resources and infrastructure from various internal and external threats. We scan networks for known security weaknesses but attackers perform vulnerability analysis to identify security loopholes to further exploit that target network.</p><p>To do properly secure your network and code, an administrator needs to perform patch management, check configurations, solve known issues in third-party applications, and also check the code to avoid security flaws. All these activities together constitute a vulnerability assessment. We will learn more about it later on.</p><p>You will need to know that usually, the vulnerability analysis refers to proper management configurations, patches and also keeping the systems up to date, but here I’ll be also following the Application security approach, showing some tips to secure your DevOps pipeline (SecDevOps) and perform the proper SAST and DAST analysis.</p><p>In this article, you will learn the key concepts, the life-cycle of vulnerability management, and how to implement it. All this information is based on the content for both CEH and Security+ Certification.</p><h3>1- Key Vulnerability concepts</h3><p>There are generally two main causes for vulnerable systems in a network, software or hardware misconfiguration and <em>poor programming practices</em>. Attackers exploit these vulnerabilities to perform various types of attacks on organizational resources. In this section, we will learn about the Vulnerability assessment, research, and scoring system.</p><h4>1.1 Vulnerability Research</h4><p>Vulnerability research is the process of analyzing everything in our organization, from protocols, services, and configurations to discovering vulnerabilities and design flaws that will expose an operating system and its applications to exploit attack or misuse.</p><p>The reason why the vulnerabilities experts require to perform vulnerability research goes from gathering information about security trends, newly discovered threats, attack surfaces, attack vectors, and techniques to keep the security measures up to date (<a href="https://4noobies.medium.com/an-overview-of-threat-intelligence-in-cybersecurity-f48ecf37c323">Thread Intelligence</a>)<br><br>It is important that the employee in charge of the security (usually a security software engineer with ethical hacker expertise) needs to keep up with the most recently discovered vulnerabilities and exploits to stay one step ahead of attackers through vulnerability research, which includes:</p><ul><li>Discovering the system design faults and weaknesses that might allow attackers to compromise a system</li><li>Staying updated about new products and technologies and reading news related to current exploits</li></ul><p>And not only about the software that is being used, but also for those that are building new software and having the role of an <a href="https://4noobies.medium.com/an-overview-of-application-security-appsec-faee9ced4ff1">application security engineer</a> and be able to prioritize and locate the vulnerabilities based on the Severity Level (Low, Medium, High) and exploit range (local or remote).</p><p>You might be wondering which resources can we use to perform the proper vulnerability research, here are some of them:</p><ul><li><a href="https://www.exploit-db.com/">Exploit Database</a>: Here you can learn how to exploit different vulnerabilities and if there are automated scripts to perform the attack</li><li><a href="https://www.darkreading.com/">Dark Reading:</a> This is a place to keep up to date about the latest threats and attacks!</li><li><a href="https://www.securitymagazine.com/topics/2189-security-newswire">Security Magazine: </a>A security world magazine, same as Dark Reading.</li><li><a href="https://attack.mitre.org/">MITRE:</a> The latest about TTP (Tactics, techniques, and procedures) used by the threat actors!</li></ul><h4>1.2 Vulnerability Assessment</h4><p>Vulnerability assessment is an in-depth examination of our current position including the current security procedures and controls, to withstand the exploitation. It helps us to understand our current position and define the desired state, by prioritizing and fixing those vulnerabilities. It recognizes, measures, and classifies security vulnerabilities in a computer system, network, and communication channels.</p><p>Typically, this vulnerability assessment is performed using automated tools, these tools are called vulnerability-scanning tools and they search network segments for IP-enabled devices and enumerate systems, operating systems, and applications to identify vulnerabilities.</p><p>This is useful since there are thousands of machines to measure in production systems and they help us to identify the weaknesses that could be exploited and also help us identify the following information:</p><ul><li>The OS version running on computers or devices</li><li>IP and Transmission Control Protocol/User Datagram Protocol (TCP/UDP) ports that are listening</li><li>Applications installed on computers</li><li>Common WebServer vulnerabilities (Path Traversal, SlowLoris, etc)</li><li>Accounts with weak passwords</li><li>Missing patches</li><li>Risky ports and weak network configurations</li></ul><h4><strong>1.2.1 Scanning types</strong></h4><ul><li><strong>Passive Scanning</strong>: This means to find the information available on the internet, in which we are not interacting with the target host, for example using OSINT (Open Source Intelligence), the ExploitDB, or finding public information about the target which can be an organization (If we are performing a pen-testing).</li><li><strong>Active Scanning</strong>: This scan refers to the one in which we interact with the target, for example, the servers and the applications running on those servers. Here is very likely to generate alerts to the monitoring systems such as IDS (Intrusion detection system), IPS (Intrusion Prevention System), and a WAF (Web Application Firewall).</li></ul><p>It is important to know that active scanning can generate alerts, why? Let’s assume that we are performing an analysis of our recently created binaries for our application, this process is automated and runs right after a new build is created, so we perform automated vulnerability analysis and an alert is generated due to an SQLi weakness in a form field. This alert goes to the SOC (Security Operation Center) and an analysis start. Do you see where the issue is? We do not want to create false positives of an application that is being built, so we must be able to identify from which time frame and which servers we are performing such analysis to avoid those vulnerabilities that are expected in the early stages of development to affect the SOC.</p><h4><strong>1.2.2 Types of vulnerability alerts</strong></h4><p>When performing vulnerability scans and network monitoring (IDS) we must understand some key differences between the different types of alerts, since this will help to identify and properly discard/confirm a vulnerability.</p><ul><li><strong>True Positive (Attack — Alert):</strong> The system raises an alarm when a legitimate attack occurs</li><li><strong>False Positive (No Attack — Alert):</strong> The system raises an alarm when no attack has taken place (Most common)</li><li><strong>False Negative (Attack — No Alert):</strong> The system does not raise an alarm when a legitimate attack has taken place (Worst!) We were attacked and no alarm was raised.</li><li><strong>True Negative (No Attack — No Alert):</strong> The system does not raise an alarm when an attack has not taken place</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Xy1Rrl7KYL9-xtF9.png" /></figure><h4>1.2.3 Limitations of Vulnerability Assessment</h4><p>Until now everything was too cool, but there are several limitations of the vulnerability assessment, some of those are:</p><ul><li>Human judgment is needed to analyze the data after scanning and identifying the false positives and false negatives</li><li>Vulnerability-scanning software itself is not immune to software engineering flaws that might lead to it missing serious vulnerabilities, extra actions are needed to avoid this.</li><li>Vulnerability-scanning software is limited in its ability to detect vulnerabilities at a given point in time security controls</li></ul><h4>1.2.4 Vulnerability Assessment Techniques</h4><p>When deciding which tool to be used, we need to identify if we are going to use a network-based scan, host-based scan with an agent or agent-oriented solution, and also if we want a passive or active scan in our network… Our choice will depend on our needs, and if we are going to perform Application Security in our DevOps systems we should identify which type of analysis we want to perform as well.</p><p>Here are some types of vulnerability scanners:</p><ul><li><strong>Active</strong>: Uses a network scanner to find hosts, services, and vulnerabilities (interacts with our target servers)</li><li><strong>Passive</strong>: Here we sniff the network traffic to discover present active systems, applications, and payloads, usually we create custom scripts to track specific encoded values.</li><li><strong>External: </strong>Assess the network from a Hackers perspective (Red Team) to discover vulnerabilities from the outside.</li><li><strong>Internal</strong>: Scans the internal infrastructure to discover exploits and vulnerabilities</li><li><strong>Host-based</strong>: Conducts a configuration-level check to identify system configurations, file systems, etc in the host.</li><li><strong>Network-based</strong>: Determines possible network security attacks.</li><li><strong>Application</strong>: Test and analyzes all elements of the web infrastructure for any misconfiguration, outdated content, or known vulnerabilities.</li><li><strong>Credentialed / Non-Credentialed</strong>: Assess the network accessing (login) the systems or not, like from the attacker’s perspective.</li><li><strong>Manual:</strong> Checking the CVE, the CVSS.</li><li><strong>Automated: </strong>Running tools such as Nessus, Qualys, or GFI languard, Nikto</li></ul><h4>1.3 Common Vulnerability Scoring Systems (CVSS) &amp; Common Vulnerabilities and Exposures (CVE)</h4><p>The CVE is a free-to-use list of standardized identifiers for common software vulnerabilities, and the CVSS is the quantitative model that ranks the vulnerabilities from 0 to 10, the higher the score, the more critical it is.</p><p>We can have a vulnerability such as CVE-2021-44228 (Log4Shell) that shares the details of the vulnerability and the CVSS of 10 out of 10 which is the most critical rank for a vulnerability.</p><h3>2- Vulnerability Management Life Cycle</h3><p>The vulnerability management life cycle is an important process that helps identify and remediate security weaknesses before they can be exploited. The implementation of this lifecycle helps gain a strategic perspective regarding possible cybersecurity threats and be more resilient to attacks.</p><p><strong>2.1 Pre-Assessment Phase</strong></p><p>Before starting ANY vulnerability management we need to understand some key steps to be 100% of the success of the management life cycle. The pre-assessment phase is a preparatory phase that involves defining policies and standards, scopes, and designing proper security measures.</p><p>Some of the key steps to success are:</p><ul><li>Identintify and understanding the current business process</li><li>Understand the applications, data, and services that support the business process and perform code reviews</li><li>Identify controls already in place</li><li>Understand the network architecture</li><li>Define the scope of the assessment</li></ul><p><strong>2.2 Vulnerability Assessment Phase</strong></p><p>Refers to identifying vulnerabilities in the organization’s infrastructure, including the operating system, web applications, and web server. It helps identify the category and criticality of the vulnerability in an organization and minimizes the level of risk</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*-CBm7YSuF83uuWfAGhSLrg.png" /></figure><ul><li><strong>Identify Assets and create a baseline</strong>: This phase identifies critical assets and prioritizes them to define the risk based on the criticality and value of each system in order to develop and maintain a system baseline.</li><li><strong>Vulnerability Scan: </strong>This phase is very crucial in vulnerability management. In this step, the security analyst performs the vulnerability scan on the network to identify the known vulnerabilities in the organization’s infrastructure.</li><li><strong>Risk Assessment: </strong>Here are the serious uncertainties that are associated with the system that are assessed and prioritized. Summarizes the risk level identified for each of the selected assets. It determines whether the risk level for a particular asset is high, moderate, or low.</li><li><strong>Remedation</strong>: Planned based on the determined risk level. Here is where we apply the fixes on vulnerable systems in order to reduce the impact.</li><li><strong>Verification:</strong> The security team performs a re-scan of systems to assess if the required remediation is complete and whether the individual fixes have been applied to the impacted assets.</li><li><strong>Monitor</strong>: Regular monitoring to maintain system security</li></ul><h3>3- Types of Vulnerabilities</h3><p>Any vulnerability that is present in a system can cause severe damage to the organization. It is important for security engineers to have knowledge about various types of vulnerabilities that they can employ, along with various vulnerability assessment techniques.</p><p>Some of the most common vulnerabilities that can be found in a system and network are:</p><ul><li><strong>Misconfiguration</strong>: Mostly caused by human error, and allow hackers to gain unauthorized access. Some examples are debugging mode enabled by default, unnecessary services on the machine, incorrect permissions, default accounts, etc.</li><li><strong>Default Installations</strong>: When the system is used for the first time when the primary concern is usability rather than security. The risk is not in the content but the machine might be connected to the corporate network.</li><li><strong>Buffer Overflows</strong>: Due to coding errors, the attackers try to take control of the system by writing content beyond the allocated size of the buffer.</li><li><strong>Unpatched Servers</strong>: Servers not running the latest security patches.</li><li><strong>Design Flaws</strong>: Poor encryption and poor validation.</li><li><strong>Application Flaws</strong>: Vulnerabilities in applications that are exploited by the attackers (OWASP top 10) are an example of those.</li><li><strong>Open Services</strong>: Open ports, vulnerable services exposed in those ports.</li><li><strong>Default Passwords</strong>: Default credentials to critical systems, easy to get in using a dictionary attack.</li></ul><h3>4- Vulnerability assessment tools and criteria for choosing them</h3><p>Selecting an appropriate assessment plays a major role in mitigating the threats that an organization faces. As you were able to see through this article, there are different types but, which tool do we need to choose based on our needs? Here we will take a look at the different types and how to choose them.</p><p>Some of the good characteristics that you need to find are that:</p><ul><li>Supports multiple networks</li><li>Automatically scans against continuously updated databases</li><li>Ensures correct outcomes by testing the network (low false-positive rate)</li><li>Suggests appropriate remedies and workarounds correct vulnerabilities</li><li>Matches your environment and expertise</li><li>Generate reports</li><li>Contains several hundred different attack signatures</li><li>Types of vulnerabilities being assesed</li><li>Test run scheduling</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DNJJJM5l0V-mSwZl.jpg" /><figcaption>Source JCSHIELD</figcaption></figure><h4>4.1 Comparing solutions</h4><p><strong>Product vs Service-based solutions: </strong>The product refers to a regular application that is installed in the internal network, and the service is like a SaaS approach that is hosted inside the network.</p><p><strong>Tree vs Inference based Assessment: </strong>Tree-based means that the auditor choose how to perform the assessment, and the inference does all this automatically</p><h4>4.2 How do the vulnerability tools works?</h4><p>Vulnerability scanning solutions perform vulnerability penetration tests on the organizational network in three steps:</p><ul><li><strong>Locating nodes:</strong> The first step in vulnerability scanning is to locate live hosts in the target network using various scanning techniques. It is like checking all the different places in which it can scan.</li><li><strong>Performing service and OS discovery on them: </strong>Enumerate the open ports and services along with the operating system on the target systems. Like performing a manual map…</li><li><strong>Check for known vulnerabilities</strong>: Finally, after identifying the open services and the operating system running on the target nodes, they are tested for known vulnerabilities.</li></ul><h3>5- Vulnerability Reports</h3><p>Last but not least, the reports, here is the really important part after all the hard work, since it will help us to show management our security posture and what we need to keep growing. Here the security team will try to disclose any identified vulnerabilities, document any variations and findings, and include all these in the final report along with remediation steps to mitigate the identified risks. In this <a href="https://purplesec.us/wp-content/uploads/2019/03/Sample-Network-Security-Vulnerability-Assessment-Report-Purplesec.pdf">link</a> you can find an awesome example of how the report should be built.</p><p>There are different key sections that cannot be skipped, such as the scan information, target information, results, services, etc… Everything that was found and how it was classified and mitigated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*876PakbfCue6nQfGgL78Pg.png" /><figcaption>Purple Sec — Example of the vulnerability scan report</figcaption></figure><p>That’s it for now, I hope you like this content, the vulnerability assessment should be done in every place and not just in the software/network, remember that humans are the weakest link in the chain, and we should be able to identify vulnerabilities there too. When implementing SecDevOps all the tools seen are good to test our systems and also required when we are following to implement a proper Application Security phase, in which we run scanners to check our code and find vulnerabilities, without forgetting the limitations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bf2b993ebb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A software troubleshooting guide — Tips & Tricks]]></title>
            <link>https://josue-carvajal.medium.com/a-software-troubleshooting-guide-tips-tricks-5989ff5e31d5?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5989ff5e31d5</guid>
            <category><![CDATA[network]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[troubleshooting]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Tue, 22 Mar 2022 03:19:38 GMT</pubDate>
            <atom:updated>2022-03-22T03:19:38.959Z</atom:updated>
            <content:encoded><![CDATA[<h3>A software troubleshooting guide — Tips &amp; Tricks</h3><p>I’ve been a software engineer for more than 4 years now, on the last job I had, I was doing a kinda “software escalation engineer role” in which I had to be the lead of issues occurring in the production systems of our customers, train our team and also support team, my daily bread was always weird and hard issues that I needed to resolve in a timely manner when possible, providing daily updates to Management, support, and customer.</p><p>And this has helped me a lot to be more open-minded and find more creative ways to troubleshoot different types of issues, from network, database, and code to weird distributed application performances. Today, in this article I’ll show you some tips and tricks in how I narrow down an issue, from the beginning to the end.</p><h3>A weird issue appeared, what can we do?</h3><p>This is always how an escalation case come into our hands, and as software engineers, we will be fixing new stuff that is not documented anywhere, imagine that there is an escalation that said “<strong><em>My customer cannot perform remote searches to their geo-distributed applications</em></strong>” this may sound tricky, challenging and scaring at the beginning but here I’m to show how I like to work with such scenarios. Do not worry we will have a detailed section of what to do from each specific network, performance, code, database issue at the end, let’s just focus on the initial approach of the example above;</p><h4>1- Aks questions! Understand their scenario…</h4><p>When a case like that comes in, I always ask questions since it will speed up the investigation, some questions that may arise are: In which specific data center is their application located? Is it just impacting searches? How frequently does this occur? Which application version are they using? Is it old or outdated? How’s their architecture? Are they using on-premises systems or the cloud? Which is the error that they are seeing? Is it a timeout? or another type of exception? As you can see there are a lot of questions that can be asked in such a situation (and I think that is why some support folks had a hard time following up) since you can lose the reason for those questions, which leads me to the second point</p><h4>2- Explain what you are trying to achieve</h4><p>When working on a worldwide team, there is always a cultural barrier as well as the English language skill (I talk Spanish, English is my second language) so I can understand that not all people have the same facility to the language, so always explain, give a context to try to get better feedback from your team and your customers, if you show up confidence and explain them in details you will ace that interaction!</p><h4>3- Now you understand the issue… What’s next?</h4><p>Let’s assume you understand the issue, they have a distributed application based on 10 worker applications and 3 master nodes in which the masters perform remote searches to the workers and you can see the data on the masters, they are located in the US in different places such as Chicago, New York, and Texas. The version is up to date so they have all the latest patches, and the logs show that they are having several timeouts…. so… what could be wrong here? You are right! Since they are geo-located in different places the network could be the problem here, or maybe a mix of latency and code.</p><p>I hope this preliminary analysis was clear enough for you and you got the point of the importance of understanding the issue, this is important since now we are going to move to the more technical part, how to troubleshoot this based on the evidence that we already gathered?</p><h3>Troubleshooting tips &amp; tricks</h3><p>We are going to continue the issue that I’ve just described earlier, in which we were able to narrow down the issue to something related to the network or application level.</p><h4>Troubleshooting network-related issues!</h4><p>Here you must understand how the network connections works, TCP and UDP is key, identifying how the remote calls are done as well in your application is key since not all the applications have the same way to communicate, some of them use a Pub/Sub architecture, other ones RPC calls, and others just on endpoints.</p><p>I recommend as well to get familiarized with the OSI Model, OSI is our friend to troubleshoot issues like this, in our example, the issue might be related to the Network or Transport layer, as well to the application (since it was also receiving and processing information)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*RSam_iIXCSJgM05j.png" /><figcaption>Figure #1 OSI is my friend</figcaption></figure><p>At this point, we have identified 3 possible layers in which our issue in the example might be wrong The Network, Transport, and Application… so what’s next? Well, let’s identify a feasible test for each of them, we need to discard/probe that our approach is good enough which this leads me to another tip</p><h4>Always get metrics!</h4><p>When troubleshooting any type of issue related to network, performance, etc the metrics are gold! How will you identify you are facing a problem if you do not have trustworthy data to compare against it? A good way of getting metrics (depending on your issue) is to gather OS metrics such as CPU, DISK I/O, RAM, Threads Dumps, etc! If you do not have the tools to do it, <strong>create your own scripts!</strong></p><p>But how we will do it for the issue that we are troubleshooting? Well since it is a distributed application, all the requests go over the network so we can create scripts to gather metrics of the <strong>ICMP traces (pings) </strong>and save that with a timestamp and parsing the duration of each ping, in this case, it should be placed on a search master and ping each machine of the workers so we a confirm or discard the issue with the network layer.</p><p>To discard the application issue (webserver) we may follow the same approach but maybe send a GET request to an endpoint so we can identify if the webserver is dying or not. If there is a gap between our metrics it will be the issue of the transport layer.</p><h4>Troubleshooting performance issues!</h4><p>As I said before we always need metrics, before and after any change, in order to provide good performance metrics we should also monitor the server behavior and consumption maybe with grafana and Prometheus to be able to have very good visibility of our application consumption as well using the network debugger of every browser and track the time each request takes.</p><p>One common error that I noticed is that everyone does performance metrics with the happy path, but not with the worst-case scenario, for example: If the application is fully loaded how those numbers are affected? Can we improve how it behaves under load? This is really important.</p><h4>Troubleshooting non-replicable issues in the lab!</h4><p>These are the hardest ones since we do not have a local lab to play with and everything must be planned to avoid unnecessary time loss. Here we must understand in which circumstances it is occurring and doing like a “history” of all the issues faced with the given application or machine, I know that usually, those issues not replicable in our lab are due to specific issues affecting the specific machine of the customer.</p><p>So it is important to understand if there was any crash before, or if they added new software that could affect their system, I remember a time in which the customer deleted data while moving an NFS and he wanted us to fix that, well… sometimes it is not possible</p><p>Other tips that I want to share with you are:</p><ul><li>Understand the user use meant to do</li><li>Always read logs and isolate classes</li><li>Check network and communication protocols</li><li>Do not forget ciphers</li><li>Always get metrics!</li><li>Create scripts and more scripts when needed!</li><li>Do not trust what the customer says and always double-check</li><li>The most basic thing could lead to incredible headaches, so always check the basis</li><li>Check every module that plays a role in the communication, from the code to the network and hardware systems</li></ul><p>This was a high-level overview of how to face those challenging issues it does not contain all the details but I wanted to share this as an example of how you can divide and conquer in order to achieve progress.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5989ff5e31d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DNS resolution process]]></title>
            <link>https://josue-carvajal.medium.com/dns-resolution-process-cddd0d647092?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cddd0d647092</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Tue, 22 Mar 2022 02:17:57 GMT</pubDate>
            <atom:updated>2022-03-22T02:17:57.114Z</atom:updated>
            <content:encoded><![CDATA[<h3>DNS Terminology</h3><p>When we talk about DNS there are a lot of concepts that are always mentioned: TLD, FQDN, HOST, DOMAIN, SUBDOMAIN but what does that even mean? or how can this be easily understood?</p><p>So, before starting with this deep dive, we will check the basic concepts of the DNS terminology, and hopefully, this explanation is easy and clear enough to understand.</p><p>Let’s take as an example the following address <strong>dev.google.com. </strong>here we have a lot to check! We have a TLD, a subdomain, and a root domain, are you able to spot it? If not, let me show you a small trick to identify them.</p><p>When working with those addresses we need to follow a similar logic as a binary tree in which we have a root parent and different depth levels, this is really helpful to have a visual way to represent each concept!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*KhO2Hgv808C80h4_.png" /><figcaption>Figure #1. Binary tree example</figcaption></figure><p>Returning back to our previous example <strong>dev.google.com.</strong> this address is <strong>always read from right to left! </strong>In which just the initial dot<strong> “</strong>.<strong>” </strong>will be considered (any other “dots” will be skipped). <strong>This initial dot represents the root of our tree. </strong>And then each of the content of <strong>dev google com</strong> will be added in each node, following the same order from right to left</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*St3_hOCS_GhccLzAyRkeWA.png" /><figcaption>Figure #2. Filling our tree</figcaption></figure><p>You may be wondering why I’m showing you this? Well, Following this structure, if we put that in that way we can easily break down each of the concepts that that specific address has. The “dot” is the root of our address, the com represents the TLD (top-level domain), google the domain name, and dev the subdomain. With that strategy, we were able to break down which part of the address was associated with which concept!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*JuzOX0P8A1GY8FAbFOej4Q.png" /><figcaption>Figure #3. Breaking down the tree</figcaption></figure><p>Now that we understood how to break down those, let’s check in detail what are those concepts.</p><ul><li><strong>Root Name Server</strong>: The root of the Domain Name System (DNS) hierarch</li><li><strong>TLD (Top Level Domain)</strong>: The first stop after the Root name server, this contains: com, org, net, UK, edu, etc. There are also different types, the generics (gTLD), country code (ccTLD), Sponsored (sTLD), and reserved TLD like .localhost or .example which are not permanently available.</li><li><strong>domain name</strong>: Like in the yellow-pages in the old times, associate a human-readable name to an IP via DNS A records to IPv4 or AAAA records to IPv6</li><li><strong>Subdomain</strong>: A domain that is a part of another domain, in this case, the domain name.</li></ul><h3>DNS resolution process</h3><p>When you type google.com there is a lot of “magic” going behind scenes, but how does that magic work? The DNS runs on port 53 and helps us to resolve a HOST to IP address, based on some DNS Records, the A, and AAAA respectively, there are other DNS record types such as the image below, but the important thing here to know is that DNS works like the old yellow pages where you were able to find phone numbers (IP’s) based on someone’s name (domain name)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/0*TbcFrobJEAYnFhRO.png" /><figcaption>Figure#4 DNS Record Types</figcaption></figure><p>When we type google.com., our computer will first check its local cache to find any association, if nothing is found there:</p><p>1- It will call the <strong>Recursive DNS</strong> which will help us to communicate with the other DNS servers, this recursive DNS has its own local cache</p><p>2- If nothing is found, it will go to the root name server (remember, the . in the google.com.)</p><p>3- And will answer with the IP of the TLD server, in our example the .com server.</p><p>4- Then the recursive DNS will call the TLD based on the IP retrieved from the Root nameserver (step #3)</p><p>5- Here the TLD will replay with the IP of the SLD (Second Level Domain)</p><p>6- We call asking for the IP of that DNS to the TLD</p><p>7- And finally here it will replay to us with the address</p><p>8- The recursive DNS Resolver will save in its own cache the domain-IP record to avoid that big call the next time is requested and will send the info to the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*6zAWY74lME1tVC8bXrK0zg.png" /><figcaption>Figure#5. DNS Resolution process</figcaption></figure><p>Remember that the DNS is not secure and runs on port 53, in order to achieve security you should adopt DNSSEC approach which add an extra layer to provide integrity and authenticity of the data in transit. I hope this helps you to understand better the resolution process the next time you type google.com in your browser!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cddd0d647092" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Public key infraestructure — PKI]]></title>
            <link>https://josue-carvajal.medium.com/public-key-infraestructure-pki-6d7ede68317e?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d7ede68317e</guid>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[public-key-infrastructure]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Sun, 13 Mar 2022 04:27:24 GMT</pubDate>
            <atom:updated>2022-03-13T04:29:27.188Z</atom:updated>
            <content:encoded><![CDATA[<h3>Public key infraestructure — PKI</h3><p>The <strong>Public key infrastructure (PKI) </strong>is a <strong>framework</strong> (guideline) that consists of several security policies, communication protocols, and procedures <strong>to enable secure and trusted communication between different entities using public-key encryption</strong>. This framework r<strong>elies on a hierarchy of trust relationships</strong>, by providing authentication (to confirm the owner using digital certificates) and confidentiality by providing encryption (confidentiality) with the public-key encryption.</p><h3><strong>How does asymmetric encryption work?</strong></h3><p>When using asymmetric encryption we make use of two sets of key pairs, a public (which is shared) and a private (which is not shared). The Public key is used to encrypt the message to a receiver and the receiver then can decrypt the message using their own private key. When we encrypt a message it is called <strong>ciphertext. </strong>Do not worry about what occurs from behind, it is all about mathematics, in which those two keys are able to solve the same puzzle!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/0*7cf4JJ71OrzAV-Zl.png" /><figcaption>Figure #1. Asymmetric Encryption</figcaption></figure><p>There is also a Diffie-Hellman key exchange that explains how to distribute the public key. But not needed for this specific topic. Another question that is usually is asked is, ok this provides confidentiality but how we can ensure authentication? This is where digital certificates play a key role.</p><h3>Digital Certificates</h3><p>The digital certificates help to guarantee authentication, as well as confidentiality since it associates a public key with a specific entity. It is issued by a CA (certificate authority), more of this later on this post.</p><p>These digital certificates are referred to as x.509 certificates, and <strong>it defines a standard defining the format of a public-key certificate. </strong>The content of a certificate contains different attributes such as the valid period, optional values, serial numbers, the CA (the issuer) for that certificate, and other relevant information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/0*MBAN7mO719qJmtr-.gif" /><figcaption>Figure #2. Inside a container</figcaption></figure><h3>Types of certificates</h3><ul><li><strong>Self-signed certificate: </strong>These certificates won’t be trusted by the browsers of external users, but internal systems may be configured to trust the internal CA, saving the expense of obtaining certificates from a third-party CA.</li><li><strong>Root certificate</strong>: the top-level certificate for their entire PKI.</li><li><strong>Personal certificate</strong>: Identifies a person and includes a digitally signed version of the person’s name, organization, and public key</li></ul><h3>Certificate formats</h3><ul><li>Distinguished encoding rules (DER)</li><li>Privacy enhanced mail (PEM)</li><li>Personal information exchange (PFX): Commonly in windows systems</li><li>.cer</li></ul><p>Remember the PKI is based on <strong>a trust model</strong> which is Hierarchical, Mesh, web-of-trust. in which everyone trusts everyone, a friend of a friend is someone to trust A = B and B= C therefore A=C. And this is important to understand due to<strong> the Certificate chaining</strong>: To validate a certificate, the browser verifies the identity of the intermediate CA(s) first and then traces the path of trust back to a known root CA, verifying the identity of each link in the chain of trust.</p><h3><strong>Certificate of Authority (CA)</strong></h3><p>The CA manages certificates from issuing, revoking, and distribution. These neutral organizations offer notarization services for digital certificates. To obtain a digital certificate from a reputable CA, you must prove your identity to the satisfaction of the CA, and once confirmed the public key is stored in a directory that is available to anyone that wants to verify your certificate. Some examples of CA are VeriSign, DigiCert. This is also known as the <strong>Root CA</strong>.</p><ul><li><strong>Offline CA:</strong> Certificate authorities must carefully protect their own private keys to preserve their trust relationships. To do this, they often use an <em>offline CA</em> <strong>to protect their <em>root certificate</em></strong>, this offline CA is disconnected from networks and powered down until it is needed. The offline CA uses the root certificate to create subordinate <strong><em>intermediate CAs</em></strong> that serves as the <em>online CAs</em> used to issue certificates on a routine basis.</li></ul><h3>Intermediate CA</h3><p>Transfer trust between different CAs. The purpose of creating and using intermediate Cas is <strong>primarily for security</strong>. They can register their own certificates, if this one is vulnerable it will only affect the certificate belonging to him. So the root CA will remain secure since it is usually turned off after the Intermediate CA servers are live!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*lNgRU8wZFOl70ywDZg4olg.png" /></figure><h3><strong>Registration authority (RA)</strong></h3><p>Here is where new certificates are created, but not where they are signed. It verifies the information, payment, and all the data to generate a valid certificate. You can also send to them your own created public key instead of relying on the third-party CA to create both keys. It is important that only the Registrant can revoke the certificate, if they do no longer work for the company, you must revoke those certs and create a new one. There are some specific validations that can be done when deciding if there is a certificate that can be issued or not:</p><ul><li><strong>Domain validation (DV)</strong>: Simply verifies that the certificate subject has control of the domain name.</li><li><strong>Extended validation (EV)</strong>: A higher level of assurance and the CA takes steps to verify that the certificate owner is a legitimate business before issuing the certificate.</li></ul><p>When everything was okay, then there is a <strong>Certificate signing request (CSR)</strong>: in which the public key of your certificate is sent to the CA to generate the Certificate with X.509 standard, BUT after validating the identity.</p><h3>Validation Authority (VA)</h3><p><strong>The VA provides validation of PKI certificates. </strong>If we are going to visit a website, the browser will look to this VA and check for the certificate validation services that can include access to Certificate Revocation Lists (<strong>CRL</strong>), Online Certificate Status Protocol (<strong>OCSP</strong>), and CA chain certificate downloads.</p><h4>Certificate revocation list (CRL)</h4><p>It is the place where each CA put a list of revoked certificates this should be posted in a public directory. There are different reasons in which a certificate might be revoked, for example:</p><ul><li><strong>Certificate expiration</strong>: The expiration date was met</li><li><strong>Certificate revocation: </strong>which is permanent, due to a compromised private key, company name changes, the key owner does no longer works for the company, etc.</li><li><strong>Suspended certificates</strong>: To put the certificate on “hold”</li></ul><h4><strong>Online Certificate Status Protocol (OCSP)</strong></h4><p>Checks the state of the certificate, it asks (the browser) and the OCSP responder will reply if it is valid or invalid. For example, it will check if the certificate is not in the CRL.</p><h3>The Certificate request and validation process</h3><p>It might be hard to explain this without a video, but I’ve enumerated each of the steps.</p><p>1- The User wants to generate a new certificate, so it shares the contact info, payment, and locally created public key to the RA (Registration Authority).</p><p>2- The registration authority will take that info and perform the proper validation and call the CA (root or intermediate) to issue the certificate if correct.</p><p>3- Then the CA will share the proper certificate to the user</p><p>4- Now the user wants to add this brand new certificate to its page.</p><p>5- When someone accesses the page, the browser will call the Validation Authority</p><p>6- Then the VA will check the OSCP in the CA</p><p>7- And finally confirm if the certificate is valid or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*4oUc2HtJNPI9GIhTcokM1w.png" /></figure><h3>Recovery Agent (We lost the key, what can we do now?)</h3><p>The person who created the certificate needs to access the key recovery server, normally it is an in-house CA implementation. And you will be requested for some Key Recovery Information (KRI) such as:</p><ul><li>The proof that the request is from an authorized agent</li><li>Name of the key owner</li><li>Time key was created</li><li>Issuing CA server</li></ul><p>If we lost the whole access, the current certificate must be revoked and a new one must be created.</p><p>In this article I showed a little bit more in detail how the PKI and certificate process works, this is key if you are trying to get a cybersecurity position as a software engineer / professional services role. I hope you liked it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d7ede68317e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An overview of message brokers]]></title>
            <link>https://josue-carvajal.medium.com/an-overview-of-message-brokers-fb12d041c681?source=rss-ec9ee5dcd6e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb12d041c681</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[message-queue]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[message-broker]]></category>
            <dc:creator><![CDATA[Josué Carvajal]]></dc:creator>
            <pubDate>Wed, 09 Mar 2022 22:36:44 GMT</pubDate>
            <atom:updated>2022-03-09T22:36:44.099Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>The message brokers have earn a lot of popularity during the past years, some companies have been increasing the efforts to provide a message queuing solution and get a part of the cake. But what are message brokers / message queues? In this article I’ll show you what they are meant for and some solutions that you can find outside.</p><h3>How does the application communication works?</h3><p>First of all, before getting into details and understand why they exists, we need to know how the different applications can communicate and exchange information.</p><p>Let’s assume that we want to connect an App #1 to send data to the App #2, here we must use a connection strategy that can be either: TCP connection, a regular RPC call, etc.</p><p>But this lead to a different limitations, for example, what happens if the network is slowing down? What happens with that data if the App #2 goes down and maybe we have different products that does not speak the same language and causing a problem to integrate those solutions… A lot of questions are shown when we have this old way of communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*gJV4iMpRs8KG4K6NE4skEA.png" /><figcaption>Figure #1. Regular application communication</figcaption></figure><h3>Message Broker</h3><p>The message broker will help us to avoid the issues associated to the questions shown before. The message broker acts here like a middle man in which it receive events from a source and forward those to the destinations and this message broker has its own storage to save events if the destinations are not available. Some of the benefits is to provide High availability, avoid the “spoken language” limitation as well as working properly with Firewalls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*zFFhrqTQhvKq2cjlurqT6A.png" /><figcaption>Figure #2. Message broker communication</figcaption></figure><p>Here are some basic examples:</p><ul><li>If the App #2 goes down, the message broker will write down those events or streams on the storage until the App #2 is available again. This is really important since it allow us to avoid event loss by providing High Availability of our systems (HA)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*MfndUmA1bj396LrJoA-_ZQ.png" /><figcaption>Figure #3. Destination is down</figcaption></figure><ul><li>If the connection to the App #2 is slow, the message broker will not sent all those streams or events as fast as it could be, but it will “delay” those messages to avoid to saturate the network. Same applies if the App#2 is really busy that cannot handle the load as fast as they need.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*U1-eDd6SPEg2MyU4JWwD6w.png" /><figcaption>Figure #4. Network is slow</figcaption></figure><h3>Message Queues</h3><p>Now that we understood how the message broker works, let’s take a deep dive in the Message queues, which are required to use the Brokers. The message queues are First In First Out concept (FIFO) in which the first message that arrives to the queue will be the first in being sent. Just like being on a red traffic light of a single lane road, all the cars will be doing a queue and the first one in that queue will be the first one to get out of there.</p><p>In the message broker we do not have only one queue, we have multiple number of queues with different names, allowing us to receive and sent from / to specific applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*fyLxnZ4VboHclCZNzm9CFg.png" /><figcaption>Figure #5 Message Queues</figcaption></figure><p>We can also have a queue that receives from several applications and forwards to different applications, when this occurs the events are sent in the way they arrived and causing what is called “Competing consumers” in which we have several destinations to sent the event load, so the message broker will be able to manage this as well in which the consumers will take the next available massage in the queue…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*bfjsCZ4CuIdLpuPgyiymfw.png" /><figcaption>Figure #6 Competing consumers</figcaption></figure><h3>Topics &amp; Subscriptions</h3><p>Maybe these are the most important concepts when building distributed systems. They follow the same logic as the queues we have just discussed but there are a few differences! and they can also be different between different message brokers.</p><p>These topics and subscriptions are needed when we want to achieve more specific goals, for example: how we can replicate the events between two consumers (receiving applications), how can we scale the queues and implement the Competing consumers approach? That is why the topics and subscriptions are here!</p><p>You may be wondering what are actually those topics and subscriptions? Well… <strong>A topic can be described as a way</strong> <strong>to organize messages</strong>. Each topic has a name that is unique across the entire Message Broker. In the diagram bellow we have a topic called customers, here the message or events are sent to that topic by the producers (or sending applications) and then we can have a <strong>subscription queue</strong> which is basically a queue that copy what was received by to that specific topic and that is how we can achieve the replication in the consumers (or receiving application). It is important to know that the Topics are based on the business functions and will be created based on the business needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*mF5XaUXbEGNgDLZvTvP6bQ.png" /><figcaption>Figure #7. Topic &amp; Subscriptions</figcaption></figure><h3>Publish &amp; Subscribe</h3><p>Now that we have understood the basics of the Message Brokers, the next topic to understand are the publish and subscribe, these are the basics for the Publish / subscribe Pattern, which basically allow us to decouple senders and receivers of messages.</p><p>The decouple follow this logic:</p><ul><li>The producers (sending application) only needs to know the topic name to sent</li><li>The consumers (receiving application) only needs to know the topic to subscribe to.</li></ul><p>This is extremely powerful since we can scale our system faster by adding more consumers and producers and just caring about the topic name and the topic subscription.</p><h3>Distributed Log topics</h3><p>When working on distributed topics <strong>we do not use the subscriptions</strong>, here the things work a little bit different. First of all when we are working on distributed topics we are talking about <strong>clusters in which we have different servers running our message brokers,</strong> for example<strong> Apache Kafka.</strong></p><p>Inside a topic each message in the queue has an index and follows the same logic of FIFO, and instead of the broker taking care from which specific index we are, the client should ask which events they want to receive and in which <strong>offset</strong>.</p><p>And <strong>offset </strong>is like telling the topic from which position in the index you want to start reading, for example if the offset is two, we will read from there and the rest of the messages in the queue.</p><p>One more thing to mention here is that the message once it was read, it does not get deleted. It will be deleted until the message worker decides.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*G2GMsDvUAhU763NkApPVQQ.png" /><figcaption>Figure #8. Reading from a topic</figcaption></figure><p>And each topic can also have multiple partitions, these partitions allow topics to be parallelized by splitting the data into a particular topic across multiple brokers (servers in the cluster). One important thing here is that you cannot have more active consumers (receiving applications) than you do partitions. If there are less consumers than partitions, consumers will receive more than one partition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7C3sBREpntAoznp6RUfi9Q.png" /><figcaption>Figure #9. Topic partitions</figcaption></figure><p>There is another concept called <strong>Consumer groups</strong> which you can consume from the same partitions to replicate your content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rL4tudMnDjubiYNYqwsEcg.png" /><figcaption>Figure #10. Consumer groups.</figcaption></figure><p>And to end this section some message brokers examples are: Kafka, Azure Event Hub, Amazon Kinesis, RabbitMQ…</p><p>I hope this was helpful for your knowledge!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb12d041c681" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>