<?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 D3SYNCx on Medium]]></title>
        <description><![CDATA[Stories by D3SYNCx on Medium]]></description>
        <link>https://medium.com/@D3SYNCx?source=rss-36700e22ec10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*scGCF4-YHpK3vyE83_QAdg@2x.jpeg</url>
            <title>Stories by D3SYNCx on Medium</title>
            <link>https://medium.com/@D3SYNCx?source=rss-36700e22ec10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 04:24:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@D3SYNCx/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[AI Forensics | TryHackMe Writeups | By D3SYNC]]></title>
            <link>https://medium.com/@D3SYNCx/ai-forensics-tryhackme-writeups-by-d3sync-e05eba8b5c84?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/e05eba8b5c84</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Wed, 09 Jul 2025 16:14:16 GMT</pubDate>
            <atom:updated>2025-07-09T16:14:16.253Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*kIc6UFHOsYOagFJL" /></figure><p>Explore AI DFIR and learn how it boosts your investigation capabilities.</p><p>Room Access : <a href="https://tryhackme.com/room/aiforensics">https://tryhackme.com/room/aiforensics</a></p><p><strong>Task 1 : Introduction</strong></p><p>The world of Digital Forensics is full of pieces needing to be connected, often under a time constraint. This can be a challenging task, but one that many forensics analysts have accomplished without the need for AI tools. This begs the question: Does the digital forensics industry need the AI tools being used by so many other adjacent industries? This room aims to answer this question, exploring the potential application of AI in digital forensics, the challenges that come with that and the potential ethical and legal implications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*Mh5HrBXsk4HRtufxiCPltg.png" /></figure><h4>Learning Prerequisites</h4><p>In this room, we will cover AI, specifically its potential implementation in the Digital Forensics / DFIR field. Because of this, it is <strong>recommended</strong> that you:</p><ul><li>Know the basics of AI covered in the <a href="https://tryhackme.com/jr/introtoaisecuritythreats">AI/ML Security Threats room</a></li><li>Know the basics of DFIR (if you need to scrub up on your basics, consider <a href="https://tryhackme.com/room/introductoryroomdfirmodule">DFIR: An Introduction </a>and <a href="https://tryhackme.com/room/linuxforensics">Linux Forensics</a>)</li><li>Know the challenges faced in DFIR, covered in <a href="https://tryhackme.com/room/irdifficultiesandchallenges">the IR Difficulties and Challenges room</a></li></ul><h4>Learning Objectives</h4><ul><li>Understand the day-to-day challenges faced in DFIR</li><li>Understand how AI can be used to address those challenges</li><li>Understand the challenges that arise when you use AI for forensics investigations and the ethical/legal implications this has</li><li>Understand how AI impacts the DFIR investigation process</li></ul><p>Answer the questions below</p><p>I’m ready to learn!</p><p><strong>Task 2 : The AI Forensics Landscape</strong></p><p>Many of the abilities of AI/ML discussed in the AI/ML Security Threats room lend themselves to solving the challenges faced in DFIR. Consider the following examples:</p><ul><li><strong>Data Processing: </strong>The field of Digital Forensics is one ripe with tasks requiring the investigator/analyst to process vast amounts of data in search of evidence or environmental clues. This data processing can be a massive undertaking for an investigator and requires a lot of manual work and time. Now armed with the power of parallelised deep learning &amp; Transformer models, which can process entire bodies of text in parallel (often in mere milliseconds), providing insights and classifications on the processed data.</li><li><strong>Anomaly Detection:</strong> Analysts are tasked with identifying attacks, and this can often be a “needle in a haystack” scenario, especially sophisticated attacks which can (and often are designed to) blend in with normal activity. Machine Learning algorithms can learn what “normal” behaviour looks like for users, systems and networks, allowing supervised and unsupervised models to identify potential anomalies that could indicate malicious behaviour. Turning the haystack into a handful of hay. This ability to recognise patterns on such a large scale can also mean patterns are spotted that humans can’t comprehend.</li><li><strong>Scalability:</strong> Modern infrastructures can take many different forms, such as cloud, hybrid, remote endpoints, etc., generating more forensic data than ever. AI systems can scale effortlessly, continually processing and learning from millions of events across these large and distributed environments, enabling DFIR teams to cover more ground without a proportional increase in workload.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xtqVKXpOHPr3vryE.png" /></figure><p><strong>AI in the Wild</strong></p><p>AI/ML has already been heavily adopted into the DFIR landscape; a lot of tools now boast AI integration and increased productivity as a result. Take a look at the table below to see how AI/ML is being applied practically in the field:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*4kRbbvgKfEpLcoJLbrixng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9bSXnF4iOIGZucCf.jpg" /></figure><h3>AI Limitations</h3><p>So far, we have been singing artificial intelligence’s praises, of which there are many that we can take advantage of in DFIR. However, nothing is perfect, and AI is no different. Understanding the limitations of AI is fundamental knowledge if you are going to effectively utilise it, especially in DFIR. Let’s start by exploring the nature of AI.</p><p><strong>Probabilistic vs Deterministic</strong></p><p>Traditional software and algorithms are deterministic; in other words, if you provide them with the same input, they will always provide you with the same output. Consider a calculator function provided with the sum 5 + 5; it will always, without exception, return 10. Its behaviour is predictable and reliable (within its defined scope). However, the same cannot be said about AI systems and modern machine learning models. These are generally <em>probabilistic;</em> instead of following a fixed ruleset that provides a fixed outcome, they use statistical models to learn from data and make predictions with certain possibilities. It’s why you rarely get the same output when you ask AI a query unless you have customised your settings to make it more deterministic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q74eBjC9iR8H-EAa.png" /></figure><p>AI’s non-deterministic nature is not necessarily a bad thing; it’s because of this that allows AI to handle uncertainty and adapt to new patterns, a key characteristic and one of the reasons it’s so widely used in today’s society. However, digital forensics is a field that demands consistent and repeatable results. Non-determinism can lead to issues like different timelines being reconstructed when given the same input data, and prompt sensitivity can also mean vastly different outputs can be generated with a slight tweak to the input, so extensive prompt engineering is required when using AI in evaluative contexts. This is a consideration which needs to be taken into account when adopting AI technology into the DFIR process.</p><p><strong>Accuracy vs Precision vs Recall</strong></p><p>When using AI to help with a task as important as assisting with identifying and analysing potential evidence, you must be able to assess the performance of the model you are using to achieve this. Important metrics to consider when evaluating AI performance are:</p><ul><li><strong>Accuracy:</strong> Accuracy refers to the overall rate of correct predictions. It’s very important when assessing an AI’s performance to not only consider accuracy, as in isolation, it can be very misleading. Especially in a field such as digital forensics, where we often deal with highly imbalanced data (a few malicious files amongst thousands of benign ones, etc.), so a model can achieve a high accuracy by simply predicting the majority class each time. For example, if there are 100 files, 99 are benign and, one is malicious. If a model were to predict all files to be benign, it would achieve 99% accuracy, but this does not make it efficient. Overfitting (briefly discussed in the AI/ML Security Threats room), where a model can be overtrained on training data, can directly affect the accuracy of a model.</li><li><strong>Precision:</strong> Precision measures how often a model’s positive predictions are correct. In other words, out of all of the files flagged as malicious, how many are actually malicious? Higher precision = fewer false positives (saving time chasing down irrelevant leads). However, this metric also suffers in isolation as the model can choose to be very selective, only flagging the very obvious malicious files, meaning some malicious files may be missed.</li><li><strong>Recall:</strong> Recall measures how successful the model was in identifying all positives in the provided dataset. e.g. identifying 18 out of 20 malicious files present would result in a 90% recall. Again, in isolation, this metric would be ineffective as a model could simply cast a wide net, flagging every file as malicious, achieving 100% recall but flagging many false positives in the process.</li></ul><p>The above shows that these metrics can be misleading in isolation. However, if we consider all of these metrics together, we can gain a deeper insight into the model’s performance. This allows us to tweak it to perform the digital forensics tasks we give it optimally.</p><p><strong>Garbage In, Garbage Out</strong></p><p>The GIGO (Garbage In, Garbage Out) principle is just as true for AI systems (if not more) than it is for any system. In other words, the quality of an AI’s output is directly determined by the quality of its input. This means if an AI has been trained on “bad” data, that is, data that doesn’t accurately capture the scope of what is being learned and understood by the model, it will lead to the model confidently asserting false predictions as though they were fact. When using this technology to pursue justice, you can see why this calls for extra caution.</p><p><strong>What Does This Mean?</strong></p><p>In conclusion, while AI offers powerful capabilities in DFIR, it’s not a silver bullet. Its non-determinism, evaluation challenges, and performance trade-offs mean it should never replace human expertise. AI can accelerate and enhance our work, but human oversight, judgment, and validation will always remain essential. In other words, <strong>AI cannot replace humans as digital forensic analysts.</strong></p><p>Answer the questions below</p><p><strong>1.What ability of AI helps turn a DFIR investigator by recognising patterns they might not have been able to comprehend?</strong></p><p><strong>Answer : Anomaly Detection</strong></p><p><strong>2.Which metric tells you the proportion of positively flagged results that were actually correct?</strong></p><p><strong>Answer : Precision</strong></p><p><strong>3.What term describes the AI characteristic where the same input may yield different outputs across different runs?</strong></p><p><strong>Answer : non-determinism</strong></p><p><strong>Task 3 : AI &amp; DFIR</strong></p><p>In this task, we will discuss how certain features of AI/ML (such as pattern recognition, anomaly detection, natural language processing (NLP), user behaviour analysis, etc.) are being harnessed in digital forensics to tackle common challenges faced within the field more efficiently. We will explore this by looking at how AI/ML can be used across four key areas of DFIR.</p><p><strong>Image and Video Forensics</strong></p><p>Digital image and video forensics is an excellent example of AI/ML and its capabilities, making our lives in DFIR easier. One way in which it does this is through CNN (convolutional neural networks). A CNN is a type of neural network that automatically learns patterns in data using small filters commonly used for images. However, it can also be applied to other types of data like audio, time series, or text where spatial or sequential patterns are important. Examples of how this can be used in the field include:</p><ul><li><strong>CNN-Based Forgery Detection:</strong> Researchers have started combining traditional forensics methods such as ELA (Error Level Analysis, a technique used in image forensics to detect areas of an image that may have been digitally altered) with CNN models to identify image tampering. <a href="https://peerj.com/articles/cs-2205/">This 2024 study</a> proposes an ELA+CNN framework in which ELA first processes the image to highlight compression inconsistencies, and then a CNN classifies the regions as forged or not. This approach achieved a high accuracy rating of 94%.</li><li><strong>Deepfake Detection</strong>: The advancement of AI technologies has also meant advancements for the attacker. Deepfakes are one area which has seen a dramatic increase in quality, and as a forensics analyst, this is yet another area where new challenges are presented. As is often the case, one of the best ways we can tackle attackers using AI is by wielding it ourselves. CNN models have recently started being used in conjunction with some other AI technologies to develop specialised detectors. These detectors are used to analyse subtle inconsistencies in facial videos, <a href="https://link.springer.com/article/10.1007/s11042-024-20548-6#:~:text=deepfakes,test%20videos%20with%20reference%20videos">achieving state-of-the-art accuracy in identifying deepfakes</a>.</li><li><strong>GANs</strong>: Another exciting development in image and video forensics is the use of Generative Adversarial Networks (GANs), a setup where two neural networks compete: one generates fake media, and the other tries to detect it. As they battle, both improve. This approach has driven advances in deepfake creation, which raises concerns about this technology being used for identity theft/ privacy breaches. However, GANs are also being used defensively, allowing for both sides to benefit from them. Forensic tools now use GANs to train detectors on AI-generated fakes, making them better at spotting subtle manipulations that even humans miss. Ultimately, it’s an arms race, and both sides are powered by AI.</li></ul><p><strong>Communication Analysis</strong></p><p>Communication analysis (and other areas of DFIR, for that matter) involves the processing and analysis of large volumes of text. As we know, large language models use deep learning to process vast amounts of data, so it makes sense that we can leverage this technology to help us in forensics.</p><ul><li><strong>Phishing Email Detection:</strong> Transformer-based models that are trained for NLP (Natural Language Processing), such as BERT and RoBERTa, excel at identifying phishing emails. In fact, <a href="https://www.mdpi.com/2076-3417/15/6/3396#:~:text=In,the%20balanced%20merged%20dataset%2C">this study found</a> that they achieved 99% accuracy in classifying phishing emails against legitimate ones. This technology not only means we can move away from a rule-based approach for detecting incoming phishing emails (which looked for known bad URLs or keywords) and adopt deep learning, context-aware models but also means it can be used to categorise emails for <strong>human review</strong>, saving a lot of time.</li><li><strong>Chat Log and Social Media Analysis:</strong> The same technology mentioned above is also harnessed by some forensic platforms, allowing forensic investigators to automatically scan chats for keywords or patterns related to threats (like discussing of nefarious plans) and perform sentiment analysis to gauge emotional tone. This helps investigators massively as it helps identify communications present in massive datasets that could have otherwise been missed due to the impracticality of manually reading/processing.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gpmyb5-Ie2JAL2On.png" /></figure><p><strong>Timeline Reconstruction and User Behaviour</strong></p><p>Reconstructing incident timelines is a common and critical part of an investigation; it is also a very labour-intensive and time-consuming task. Machine learning is now being harnessed to help us with this task:</p><ul><li><strong>Automated Event Timeline Reconstruction:</strong> AI systems are particularly adept at correlating time-sequenced data from multiple sources and putting together what happened before, during, and after an incident. For example, ML algorithms can ingest logs, filesystem timestamps, network records, etc., and automatically build a chronological timeline of events or merge events from server logs, firewall alerts and application logs into a unified timeline. In cases where the attacker has deliberately tried to obscure their actions by altering logs, etc, this technology can be especially useful.</li><li><strong>Anomaly Detection:</strong> Artificial Intelligence is incredibly good at identifying patterns. In DFIR, this ability can give you an eagle eye, flagging things like impossible logins, where a user was logged in at two places simultaneously, or behaviour unusual for this specific user. Behaviour analysis isn’t just limited to users either; it can also be used to determine what constitutes “normal” behaviour for a web application. Web application firewalls can then be used to defend against what it has chosen to be abnormal, potentially dangerous behaviour.</li></ul><p><strong>Malware Detection/Analysis</strong></p><p>AI/ML has also lent itself greatly to the area of Malware detection and analysis, with research into this subject looking to provide an edge over traditional analysis methods and signature-based detection:</p><ul><li>Breakthroughs in being able to represent malware files in ways processible by deep neural networks have made it possible to <strong>classify a file</strong> as malicious or benign (<a href="https://www.cyberdefensemagazine.com/stamina-a-new-approach-to-malware-detection-by-microsoft-intel/">e.g. Microsoft and Intel’s STAMINA project</a>).</li><li>ML is also being considered for use in dynamic analysis, observing how a program behaves to identify whether it is malicious or not. Research has been done on ways this can be accomplished, for example, converting a program’s API calls sequence into a 2D image (sequence order encoded in pixels) and then classifying it.</li><li>Using some form of AI/ML is now very common in antivirus and endpoint detection response (EDR) products.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-9WgcHblfSwt9RLq.png" /></figure><p>As we’ve seen across these key areas, AI and machine learning are not just theoretical tools. They are actively reshaping how digital forensic investigators approach complex, time-sensitive, and data-heavy challenges. Whether it’s detecting tampered images using CNNs, identifying phishing emails with advanced NLP models, or reconstructing incident timelines from fragmented data, AI/ML technologies are accelerating analysis, aiding detection, and making it possible to uncover patterns that might otherwise go unnoticed. While these tools don’t replace human expertise, they significantly enhance it, allowing analysts to work smarter and respond faster.</p><p>Answer the questions below</p><p>1.What type of neural network is commonly used in image and video forensics due to its ability to learn spatial patterns in visual data?</p><p>Answer : Convolutional Neural Network</p><p>2.What kind of analysis can be performed on social media or chat logs to assess the emotional tone of messages?</p><p>Answer : Sentiment Analysis</p><p>3.What type of data do AI systems correlate to reconstruct the timeline of an incident automatically?</p><p>Answer : Time-Sequenced</p><p>4.What type of analysis observes how a program behaves to determine whether it is malicious, e.g., using its API call sequence?</p><p>Answer : Dynamic Analysis</p><p><strong>Task 4 : AI Legal &amp; Ethical Implications</strong></p><p>As covered, artificial intelligence is increasingly being woven into DFIR, enabling investigators to save time collecting evidence, providing deep insights and integrating with tools which are already commonplace in the industry. While these advancements pose obvious benefits, they also raise complex legal and ethical questions. Courts and regulators worldwide are grappling with how AI-generated evidence fits into established evidentiary standards, and there are key issues that investigators need to consider when using AI in a DFIR context. In this task, we will explore these issues.</p><p><strong>Explainability and Transparency</strong></p><p>One of the core issues facing the implementation of AI in digital forensics is the explainability of AI tools. Many AI models are “black boxes”, meaning they don’t readily explain how they came to a conclusion. This clashes with a core tenet of forensics analysis, the need for transparency and defensibility of evidence interpretation. For example, in <a href="https://arxiv.org/html/2504.02963v1#:~:text=Interpretability%20and%20Explainability,exclusion%20of%20the%20generated%20evidence">one documented civil litigation case</a>, an LLM had been used to flag certain emails as “suspicious”, but when the opposing counsel demanded to know why they were suspicious, the legal team could not explain the model’s reasoning. As a result, the AI-generated evidence was excluded by the court. What we can learn from this event is that without explainability and expert validation, AI-generated insights may not survive a courtroom challenge, failing to meet admissibility standards like the U.S. Daubert test ( a U.S. legal rule that determines the admissibility of expert testimony, particularly scientific testimony, in federal court), underscoring the sentiment that AI is NOT a replacement for human expertise but a guiding light.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ClYEKNRpA58ny91b.png" /></figure><p><strong>Bias and Fairness</strong></p><p>AI systems can unintentionally introduce bias, raising ethical and legal concerns about fairness and due process. ML models are trained on historical data; if that data contains skewed representations or prejudices, the model’s output will reflect them. In a forensics context, bias can influence what conclusions are drawn and evidence is prioritised, for example, de-prioritising non-English communications in a multilingual data set, delaying the examination of relevant evidence. A stark real-world example of this bias in action is facial recognition technology being used by police. Studies have found that these algorithms misidentify black and other minority individuals at much higher rates than white individuals. This algorithmic bias can translate into real-world injustice, with it being found that in the U.S., there are <a href="https://www.aclu.org/news/privacy-technology/police-say-a-simple-warning-will-prevent-face-recognition-wrongful-arrests-thats-just-not-true#:~:text=often%20fails%20to%20generate%20a,person%20wrongfully%20arrested%20was%20Black">at least seven known wrongful arrests due to faulty face recognition</a>, and almost every one of these victims was an African American mistakenly identified by an AI. What this means is that:</p><ol><li>Legally, if a defence can show an AI technique is biased, judges may exclude its results.</li><li>Ethically, forensic experts have a duty to validate and correct biases present in AI tools (for example, using diverse training data or bias mitigation techniques). Doing this ensures equitable treatment and upholds the integrity of the investigation.</li></ol><p><strong>Accountability and Chain of Custody</strong></p><p>One of the biggest questions for forensic investigators in a legal context is, “Who is responsible for an algorithm’s output, and can it be trusted in the same way as a human?”. In terms of trust and accountability, courts require that digital evidence be handled in a <strong>traceable</strong> and <strong>preservable</strong> manner and that integrity is preserved at each step. We achieve this by maintaining the <strong>chain of custody</strong> and an audit trail. Regarding AI-generated digital evidence, this can create conflicts as many AI tools (especially cloud-based services) operate opaquely, clashing with these requirements. There was an instance recently where an <a href="https://arxiv.org/html/2504.02963v1#:~:text=Chain%20of%20Custody%20and%20Evidentiary%20Integrity,challenged%20on%20procedural%20grounds%20during%20judicial%20review">LLM was used to summarise a suspect’s mobile phone data</a>, which inadvertently violated the chain of custody (due to the intermediate AI outputs not being logged), causing the defence to challenge the forensic findings on procedural grounds. We can learn from this that AI processes must be <strong>carefully documented and secured</strong>, and using on-premises or controlled systems can help achieve this and satisfy legal scrutiny.</p><p><strong>Privacy and Data Protection</strong></p><p>As we have covered, AI models thrive on large datasets, whether through training, processing or analysing; however, their use in investigations can trigger privacy and legal compliance issues. Public cloud servers may inadvertently expose sensitive evidence to third-party servers, violating privacy laws or court orders. Legal frameworks like GDPR may restrict how personal data is processed, even for law enforcement purposes. So DFIR investigators face pressure to ensure AI is used in a privacy-preserving manner. This can be achieved, for example, by running AI tools in secure offline environments or using federated learning. These considerations cannot be understated in their importance as part of the ethical use of AI in forensics; as if AI systems use personal data without proper authority, any evidence gleaned might be ruled inadmissible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/0*63Cqm2Mvoa75tQKq.png" /></figure><p><strong>The Verdict</strong></p><p>This task has covered the many ethical and legal considerations that need to be made when using AI systems in a digital forensics context. While it is abundantly clear that AI can be a force of good, with its abilities enabling investigators to be more productive, efficient and effective than ever before in the pursuit of justice, it is also clear that this new tool needs to be wielded with a great amount of care. The classic Uncle Ben quote comes to mind: “With great power comes great responsibility”, which is especially true when it comes to forensics in a legal and ethical context. Therefore, investigators have a responsibility/duty to ensure that they are using AI following the legal and ethical guidelines outlined above to ensure justice can be served in a fair and ethical manner.</p><p>Answer the questions below</p><p><strong>1.What legal test used in the U.S. assesses whether expert or scientific testimony is admissible in court?</strong></p><p><strong>Answer : Daubert</strong></p><p><strong>2.What term describes AI models whose internal decision-making processes are difficult to interpret?</strong></p><p><strong>Answer : Black Box</strong></p><p><strong>3.What real-world technology used by law enforcement has been shown to produce racially biased results in identifying suspects?</strong></p><p><strong>Answer : Facial Recognition</strong></p><p><strong>4.What technique allows machine learning to be performed without transferring sensitive data to a central server, helping preserve privacy?</strong></p><p><strong>Answer : Federated Learning</strong></p><p><strong>Task 5 : Practical — The Digital Trail</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*EYhuuO0e4G1H5tvn5DhbgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*D2RscH0-RzeRpI_Q4Ypm2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*-qGANGb4IXQxtwPq6nL5WQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*sX94laAMTwN44Q9xbWLB5g.png" /></figure><p>Answer the questions below<br><strong>1.At what time does the attacker successfully log in as j.morgan?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*Lke1xDNvOhLHixw_y9RExA.png" /></figure><p><strong>Answer : 03:01:02</strong></p><p><strong>2. What attack method was used to gain initial access?</strong></p><p><strong>Answer : Phishing</strong></p><blockquote>From the reading content you can get the answer</blockquote><p><strong>3. Can you find the attacker’s email address?</strong></p><p><strong>Answer : </strong><a href="/service/mailto:akeane@poseidonenergy.net"><strong>akeane@poseidonenergy.net</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*JWckl4wjNgZueb-Ple-1eQ.png" /></figure><blockquote>Run this command cat /home/j.morgan/Mail/inbox/email_invoice.eml</blockquote><p><strong>4. What command did the attacker run as j.morgan to gain access to the r.house account?</strong></p><p><strong>Answer : sudo nano /home/r.house/.ssh/authorized_keys</strong></p><blockquote>Analyze /tmp/invoice_dump.txt to get the answer</blockquote><p><strong>5. What is the full path of the archive used to steal RobbCo’s source code?</strong></p><p><strong>Answer : /dev/shm/.core_dump_2025.tgz.enc</strong></p><blockquote>From Reading content you can get the answer</blockquote><p><strong>Task 6 : Conclusion</strong></p><p><strong>A Bright Light on the AI Forensics Landscape</strong></p><p>In this room, we have covered the undeniable potential AI has to help forensic analysts in the pursuit of justice. From understanding how intelligent systems can enhance our abilities to comprehending the responsibility that’s placed on us when we use them to aid in our investigations, here’s what we’ve covered in this lesson:</p><ul><li>How AI/ML enhances DFIR tasks like anomaly detection, phishing analysis, and timeline reconstruction</li><li>The strengths and limitations of models used in forensics (e.g. probabilistic behaviour, precision-recall trade-offs)</li><li>The legal and ethical challenges AI introduces, including explainability, chain of custody, and fairness</li><li>A hands-on case investigation where you worked alongside an AI assistant powered by scikit-learn to uncover a targeted breach at RobbCo</li></ul><p>If you take away one thing from this lesson, it should be the notion that has been echoed throughout this room: AI is not a replacement for human insight. In fact, human insight has never been more important than it is now, as the rapid adoption of these AI systems grows.</p><h3>Thanks for reading! Until next time, take care!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e05eba8b5c84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Fundamentals Part 1 | TryHackMe Writeups | By DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/linux-fundamentals-part-1-tryhackme-writeups-by-desync-9e6e26901197?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e6e26901197</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Sat, 10 May 2025 14:55:13 GMT</pubDate>
            <atom:updated>2025-05-17T11:22:12.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*etEp5FXMJO6dv3rP" /></figure><h3>Linux Fundamentals Part 1 | TryHackMe Writeups | By D3SYNC</h3><p>Embark on the journey of learning the fundamentals of Linux. Learn to run some of the first essential commands on an interactive terminal.</p><p>Room Access : “<a href="https://tryhackme.com/room/linuxfundamentalspart1">https://tryhackme.com/room/linuxfundamentalspart1</a>”</p><h3>Task 1 : Introduction</h3><p>Welcome to the first part of the “Linux Fundamentals” room series. You’re most likely using a Windows or Mac machine, both are different in visual design and how they operate. Just like Windows, iOS and MacOS, Linux is just another operating system and one of the most popular in the world powering smart cars, android devices, supercomputers, home appliances, enterprise servers, and more.</p><p>We’ll be covering some of the history behind Linux and then eventually starting your journey of being a Linux-wizard! This room will have you:</p><ul><li>Running your very first commands in an interactive Linux machine in your browser</li><li>Teaching you some essential commands used to interact with the file system</li><li>Demonstrate how you can search for files and introduce shell operators</li></ul><h3>Task 2 : A Bit of Background on Linux</h3><p><strong>Where is Linux Used?</strong></p><p>It’s fair to say that Linux is a lot more intimidating to approach than Operating System’s (OSs) such as Windows. Both variants have their own advantages and disadvantages. For example, Linux is considerably much more lightweight and you’d be surprised to know that there’s a good chance you’ve used Linux in some form or another every day! Linux powers things such as:</p><ul><li>Websites that you visit</li><li>Car entertainment/control panels</li><li>Point of Sale (PoS) systems such as checkout tills and registers in shops</li><li>Critical infrastructures such as traffic light controllers or industrial sensors</li></ul><p><strong>Flavours of Linux</strong></p><p>The name “Linux” is actually an umbrella term for multiple OS’s that are based on UNIX (another operating system). Thanks to Linux being open-source, variants of Linux come in all shapes and sizes — suited best for what the system is being used for.</p><p>For example, Ubuntu &amp; Debian are some of the more commonplace distributions of Linux because it is so extensible. I.e. you can run Ubuntu as a server (such as websites &amp; web applications) or as a fully-fledged desktop. For this series, we’re going to be using Ubuntu.</p><p><em>Note: Ubuntu Server can run on systems with only 512MB of RAM!</em></p><p>Similar to how you have different versions Windows (7, 8 and 10), there are many different versions/distributions of Linux.</p><h3>Answer the questions below</h3><p><strong>1.Research: What year was the first release of a Linux operating system?</strong></p><p>Answer :<strong> 1991.</strong></p><h3>Task 3 : Interacting With Your First Linux Machine (In-Browser)</h3><p>This room has a Ubuntu Linux machine that you can interact with all within your browser whilst following along with this room’s material.</p><p>However, to get started, simply press the green <strong>Start Machine</strong> button below.</p><p>Once deployed, a card will appear at the top of the room:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*g6v5ugfkObZ7qKTu.png" /></figure><p>This contains all of the information for the machine deployed in the room including the IP address and expiry timer — along with buttons to manage the machine. Remember to “<strong>Terminate</strong>” a machine once you are done with the room. More information on this can be found in the <a href="https://tryhackme.com/jr/tutorial">tutorial</a> room.</p><p>For now, press “<strong>Start Machine</strong>” where you will be able to interact with your own Linux machine within your browser whilst following along with this room:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FFZbbXUe1ObdB-AW.png" /></figure><h3>Task 4 : Running Your First few Commands</h3><p>As we previously discussed, a large selling point of using OSs such as Ubuntu is how lightweight they can be. This, of course, doesn’t come without its disadvantages, where for example, often there is no GUI (Graphical User Interface) or what is also known as a desktop environment that we can use to interact with the machine (unless it has been installed). A large part of interacting with these systems is using the “Terminal”.</p><p>The “Terminal” is purely text-based and is intimidating at first. However, if we break down some of the commands, after some time, you quickly become familiar with using the terminal!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*RBdKLIKUK6fU1FHW.png" /></figure><p>We need to be able to do basic functions like navigate to files, output their contents and make files! The commands to do so are self-explanatory (once you know what they are of course…)</p><p>Let’s get started with two of the first commands which I have broken down in the table below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*6NKUauP0ZKbWPUY1.png" /></figure><p>See the snippets below for an example of each command being used</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*XvmBvusXclY4osG2.png" /></figure><p>As shown in the terminal above, if we want to “echo” a single word, we don’t need to use double quotes, for example, echo Hello. However, the string should be enclosed within double quotes if one or more spaces are present, for example, echo &quot;Hello Friend!&quot;.</p><p>whoami can be used to find the username we are logged in as.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zWPolmGkvgdz1q4N.png" /></figure><p>Try this on your Linux machine now!</p><h3>Answer the questions below</h3><p><strong>1.If we wanted to output the text “TryHackMe”, what would our command be?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/0*y-gZVwjE6YYU8Vk3" /></figure><p>Answer :<strong> echo TryHackMe</strong></p><p><strong>2.What is the username of who you’re logged in as on your deployed Linux machine?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/0*ZSDmcis99fJPt8u2" /></figure><p>Answer :<strong> tryhackme</strong></p><h3>Task 5 : Interacting With the Filesystem!</h3><p>So far we’ve only covered the “<strong>echo</strong>” and “<strong>whoami</strong>” commands. Not all that useful when you consider things that we need to do — including navigating the filesystem, read and write to it as well.</p><p>In this task, we’re going to be learning the commands so that we can do just that. Just like the previous task, I’ll display the commands in the table in the next heading &amp; show examples of these commands being used.</p><p><strong>Interacting With the Filesystem</strong></p><p>As I previously stated, being able to navigate the machine that you are logged into without relying on a desktop environment is pretty important. After all, what’s the point of logging in if we can’t go anywhere?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EQ2sEWrp9C-mRbhl.png" /></figure><p><strong>Listing Files in Our Current Directory (ls)</strong></p><p>Before we can do anything such as finding out the contents of any files or folders, we need to know what exists in the first place. This can be done using the “ls” command (short for listing)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*DEVnWtJOoLSo8Pqs.png" /></figure><p>In the screenshot above, we can see there are the following directories/folders:</p><ul><li>Important Files</li><li>My Documents</li><li>Notes</li><li>Pictures</li></ul><p>Great! You can probably take a guess as to what to expect a folder to contain given by its name.</p><p><em>Pro tip: You can list the contents of a directory without having to navigate to it by using ls and the name of the directory. I.e. </em>ls Pictures</p><p><strong>Changing Our Current Directory (cd)</strong></p><p>Now that we know what folders exist, we need to use the “<strong>cd</strong>” command (short for <strong>c</strong>hange <strong>d</strong>irectory) to change to that directory. Say if I wanted to open the “Pictures” directory — I’d do “<strong>cd Pictures</strong>”. Where again, we want to find out the contents of this “Pictures” directory and to do so, we’d use “<strong>ls</strong>” again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*WkL6hJ6gjkLPVsct.png" /></figure><p>In this case, it looks like there are 4 pictures of dogs!</p><p><strong>Outputting the Contents of a File (cat)</strong></p><p>Whilst knowing about the existence of files is great — it’s not all that useful unless we’re able to view the contents of them.</p><p>We will come on to discuss some of the tools available to us that allows us to transfer files from one machine to another in a later room. But for now, we’re going to talk about simply seeing the contents of text files using a command called “<strong>cat”.</strong></p><p>“Cat” is short for concatenating &amp; is a fantastic way for us to output the contents of files (not just text files!).</p><p>In the screenshot below, you can see how I have combined the use of “ls” to list the files within a directory called “Documents”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Bv-xUwYd3W-QoHiF.png" /></figure><p>We’ve applied some knowledge from earlier in this task to do the following:</p><ol><li>Used “<strong>ls</strong>” to let us know what files are available in the “Documents” folder of this machine. In this case, it is called “todo.txt”.</li><li>We have then used cat todo.txt to concatenate/output the contents of this &quot;todo.txt&quot; file, where the contents are &quot;Here&#39;s something important for me to do later!&quot;</li></ol><p><em>Pro tip: You can use cat to output the contents of a file within directories without having to navigate to it by using cat and the name of the directory. I.e. </em>cat /home/ubuntu/Documents/todo.txt</p><p>Sometimes things like usernames, passwords (yes — really…), flags or configuration settings are stored within files where “cat” can be used to retrieve these.</p><p><strong>Finding out the full Path to our Current Working Directory (pwd)</strong></p><p>You’ll notice as you progress through navigating your Linux machine, the name of the directory that you are currently working in will be listed in your terminal.</p><p>It’s easy to lose track of where we are on the filesystem exactly, which is why I want to introduce “<strong>pwd</strong>”. This stands for <strong>p</strong>rint <strong>w</strong>orking <strong>d</strong>irectory.</p><p>Using the example machine from before, we are currently in the “Documents” folder — but where is this exactly on the Linux machine’s filesystem? We can find this out using this “pwd” command like within the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FmKu3lq0tVmovHDq.png" /></figure><p><strong>Let’s break this down:</strong></p><ol><li>We already know we’re in “Documents” thanks to our terminal, but at this point in time, we have no idea where “Documents” is stored so that we can get back to it easily in the future.</li><li>I have used the “<strong>pwd</strong>” (<strong>p</strong>rint <strong>w</strong>orking <strong>d</strong>irectory) command to find the full file path of this “Documents” folder.</li><li>We’re helpfully told by Linux that this “Documents” directory is stored at “/home/ubuntu/Documents” on the machine — great to know!</li><li>Now in the future, if we find ourselves in a different location, we can just use cd /home/ubuntu/Documents to change our working directory to this &quot;Documents&quot; directory.</li></ol><h3>Answer the questions below</h3><p><strong>1.On the Linux machine that you deploy, how many folders are there?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/0*jQ-dElg6tUpZIC5i" /></figure><p>Answer :<strong> 4</strong></p><p><strong>2.Which directory contains a file?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/0*GycZHS2NaS_7a9xq" /></figure><blockquote><em>In this we need to move in each directory and check if there is a file or not.</em></blockquote><p>Answer : <strong>folder4</strong></p><p><strong>3.What is the contents of this file?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/0*jPNbgoU1CeVF8YsS" /></figure><p>Answer : <strong>Hello World!</strong></p><p><strong>4.Use the cd command to navigate to this file and find out the new current working directory. What is the path?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*9jTvVj4Qxvb-1KW2" /></figure><p>Answer : <strong>/home/tryhackme/folder4</strong></p><h3>Task 6 : Searching for Files</h3><p>Although it doesn’t seem like it so far, one of the redeeming features of Linux is truly how efficient you can be with it. With that said, you can only be as efficient as you are familiar with it of course. As you interact with OSs such as Ubuntu over time, essential commands like those we’ve already covered will start to become muscle-memory.</p><p>One fantastic way to show just how efficient you can be with systems like this is using a set of commands to quickly search for files across the entire system that our user has access to. No need to consistently use cd and ls to find out what is where. Instead, we can use commands such as find to automate things like this for us!</p><p>This is where Linux starts to become a bit more intimidating to approach — but we’ll break this down and ease you into it.</p><p><strong>Using Find</strong></p><p>The find command is fantastic in the sense that it can be used both very simply or rather complex depending upon what it is you want to do exactly. However, let’s stick to the fundamentals first.</p><p>Take the snippet below; we can see a list of directories available to us:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*S8tDVpL-rxv6MP1c.png" /></figure><ol><li>Desktop</li><li>Documents</li><li>Pictures</li><li>folder1</li></ol><p>Now, of course, directories can contain even more directories within themselves. It becomes a headache when we’re having to look through every single one just to try and look for specific files. We can use find to do just this for us!</p><p>Let’s start simple and assume that we already know the name of the file we’re looking for — but can’t remember where it is exactly! In this case, we’re looking for “passwords.txt”</p><p>If we remember the filename, we can simply use find -name passwords.txt where the command will look through every folder in our current directory for that specific file like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*SAVnMzCi--nFXYWK.png" /></figure><p>“Find” has managed to <em>find</em> the file — it turns out it is located in folder1/passwords.txt — sweet. But let’s say that we don’t know the name of the file, or want to search for every file that has an extension such as “.txt”. Find let’s us do that too!</p><p>We can simply use what’s known as a wildcard (*) to search for anything that has .txt at the end. In our case, we want to find every .txt file that’s in our current directory. We will construct a command such as find -name *.txt . Where &quot;Find&quot; has been able to <em>find</em> every .txt file and has then given us the location of each one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*AMIvGBvat99hBrKt.png" /></figure><p>Find has managed to <em>find</em>:</p><ol><li>“passwords.txt” located within “folder1”</li><li>“todo.txt” located within “Documents”</li></ol><p>That wasn’t so tough, huh!</p><p><strong>Using Grep</strong></p><p>Another great utility that is a great one to learn about is the use of grep. The grep command allows us to search the contents of files for specific values that we are looking for.</p><p>Take for example, the access log of a web server. In this case, the access.log of a web server has 244 entries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*WXevJMdWdZnqCxia.png" /></figure><p>Using a command like cat isn&#39;t going to cut it too well here. Let&#39;s say for example if we wanted to search this log file to see the things that a certain user/IP address visited? Looking through 244 entries isn&#39;t all that efficient considering we want to find a specific value.</p><p>We can use grep to search the entire contents of this file for any entries of the value that we are searching for. Going with the example of a web server&#39;s access log, we want to see everything that the IP address &quot;81.143.211.90&quot; has visited (note that this is fictional)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2lN2rEqjOM6VI9PC.png" /></figure><p>“Grep” has searched through this file and has shown us any entries of what we’ve provided and that is contained within this log file for the IP.</p><p>Answer the questions below</p><p><strong>1.Use grep on “access.log” to find the flag that has a prefix of “THM”. What is the flag? Note: The “access.log” file is located in the “/home/tryhackme/” directory.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*D0Luvs-pPvjB7ioh" /></figure><p>Answer :<strong> THM{ACCESS}</strong></p><p>And I still haven’t found what I’m looking for!</p><p>ANSWER: <strong>No Answer Needed</strong></p><h3>Task 7 : An Introduction to Shell Operators</h3><p>Linux operators are a fantastic way to power up your knowledge of working with Linux. There are a few important operators that are worth noting. We’ll cover the basics and break them down accordingly to bite-sized chunks.</p><p>At an overview, I’m going to be showcasing the following operators:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*bwBV8PlEjhyTGX23.png" /></figure><p>Let’s cover these in a bit more detail.</p><p><strong>Operator “&amp;”</strong></p><p>This operator allows us to execute commands in the background. For example, let’s say we want to copy a large file. This will obviously take quite a long time and will leave us unable to do anything else until the file successfully copies.</p><p>The “&amp;” shell operator allows us to execute a command and have it run in the background (such as this file copy) allowing us to do other things!</p><p><strong>Operator “&amp;&amp;”</strong></p><p>This shell operator is a bit misleading in the sense of how familiar is to its partner “&amp;”. Unlike the “&amp;” operator, we can use “&amp;&amp;” to make a list of commands to run for example command1 &amp;&amp; command2. However, it&#39;s worth noting that command2 will only run if command1 was successful.</p><p><strong>Operator “&gt;”</strong></p><p>This operator is what’s known as an output redirector. What this essentially means is that we take the output from a command we run and send that output to somewhere else.</p><p>A great example of this is redirecting the output of the echo command that we learned in Task 4. Of course, running something such as echo howdy will return &quot;howdy&quot; back to our terminal — that isn&#39;t super useful. What we can do instead, is redirect &quot;howdy&quot; to something such as a new file!</p><p>Let’s say we wanted to create a file named “welcome” with the message “hey”. We can run echo hey &gt; welcome where we want the file created with the contents &quot;hey&quot; like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fTH_7N_7LjFfvIq2.png" /></figure><p>Note: If the file i.e. “welcome” already exists, the contents will be overwritten!</p><p><strong>Operator “&gt;&gt;”</strong></p><p>This operator is also an output redirector like in the previous operator (&gt;) we discussed. However, what makes this operator different is that rather than overwriting any contents within a file, for example, it instead just puts the output at the end.</p><p>Following on with our previous example where we have the file “welcome” that has the contents of “hey”. If were to use echo to add “hello” to the file using the &gt; operator, the file will now only have &quot;hello&quot; and not &quot;hey&quot;.</p><p>The &gt;&gt; operator allows to append the output to the bottom of the file — rather than replacing the contents like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*T_UORVWrsoGyeldV.png" /></figure><p>Answer the questions below</p><p><strong>1.If we wanted to run a command in the background, what operator would we want to use?</strong></p><p><strong>Answer : &amp;</strong></p><p><strong>2.If I wanted to replace the contents of a file named “passwords” with the word “password123”, what would my command be?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*u3SB5PfHgx78vBMJ" /></figure><p>Answer :<strong> echo password123 &gt; passwords</strong></p><p><strong>3.Now if I wanted to add “tryhackme” to this file named “passwords” but also keep “passwords123”, what would my command be</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*CS8eubuQA3rRkS7r" /></figure><p>Answer : <strong>echo tryhackme &gt;&gt; passwords</strong></p><p><strong>4.Now use the deployed Linux machine to put these into practice</strong></p><p>Answer:<strong> No answer needed</strong></p><h3>Conclusions &amp; Summaries</h3><p>Nice work on getting to this stage! We covered quite a bit for your first interactions with Linux. However, these are the most essential/functions you’re going to be using whenever you interact with a Linux machine.</p><p>I hope this room hasn’t been too daunting for you to power-on through with. It’s as I previously mentioned, you’re going to become familiar with these things very quickly because of how often you’re going to be using them.</p><p>To quickly recap, we’ve covered the following:</p><ul><li>Understanding why Linux is so commonplace today</li><li>Interacting with your first-ever Linux machine!</li><li>Ran some of the most fundamental commands</li><li>Had an introduction to navigating around the filesystem &amp; how we can use commands like find and grep to make finding data even more efficient!</li><li>Power up your commands by learning about some of the important shell operators.</li></ul><h3><strong>Thanks for reading! Until next time, take care!</strong></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e6e26901197" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Shells | TryHackMe Writeups | By DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/linux-shells-tryhackme-writeups-by-desync-109a6417b755?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/109a6417b755</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Sat, 10 May 2025 11:28:00 GMT</pubDate>
            <atom:updated>2025-05-17T11:22:36.892Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UtBcw3vrDg76fGIwaDN87Q.png" /></figure><h3>Linux Shells | TryHackMe Writeups | By D3SYNC</h3><p>Learn about scripting and the different types of Linux shells.<br>Room Access: “<a href="https://tryhackme.com/room/linuxshells">https://tryhackme.com/room/linuxshells</a>”</p><h3>Task 1: Introduction to Linux Shells</h3><p>As regular users of operating systems, we all extensively use the Graphical User Interface (GUI) to carry out most operations. It takes a few clicks on different options, and your task is done. However, you can perform almost every task by writing commands in the CLI of your operating system rather than using the GUI. The shells give you some great features for the commands you write in your CLI. This way of interacting with the OS is more efficient and resource-friendly.</p><p>Suppose you are in a restaurant and have two options for your food. The first option is to order food from the menu, and the waiter will serve it. The second option is to cook your desired dish yourself in the kitchen. In terms of a Linux system, the kitchen here is the OS, and using the GUI of the OS is just like ordering the food from the menu, and the waiter will serve it for you. However, using the CLI means you would have to go to the kitchen (OS) and cook your desired food. In this example, Shell would help you cook your desired dish by giving you some recipe suggestions. Using CLI to perform operations in a Linux system gives you more power and control while carrying out the tasks.</p><p>You may have seen hacking scenes in movies that show cool terminals with many commands getting executed. This is because most Linux users prefer to perform operations by writing commands on the CLI using shells instead of using the GUI. This room will teach us how to interact with a Linux shell. We will also explore different shells available in Linux and write some shell scripts in the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*RVwwlcxBJc9-vhnOVJPudA.png" /></figure><h3>Learning Objectives</h3><ul><li>Learn interaction with Linux shell</li><li>Use basic shell commands</li><li>Explore the types of Linux shells available</li><li>Write some shell scripts</li></ul><h3>Room Prerequisites</h3><ul><li><a href="https://tryhackme.com/module/linux-fundamentals">Linux Fundamentals module</a></li></ul><h3>Answer the questions below</h3><ol><li>Who is the facilitator between the user and the OS?</li></ol><p>ANSWER:<strong> Shell</strong></p><h3>Task 2: How To Interact With a Shell?</h3><p>We have prepared a machine for this room. First, let’s start the <strong>Virtual Machine</strong> by pressing the <strong>Start Machine</strong> button given below. The machine will start in split-screen view.</p><p><strong>START MACHINE</strong></p><p>Start Machine</p><p>In case the VM is not visible, use the blue <strong>Show Split View</strong> button at the top of the page. The machine will open in GUI for you. You can also connect with the machine via Attackbox or your own VPN-connected machine using the SSH credentials below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*tB5IJ2RA34fx59OQMDEMSw.png" /></figure><p>Once the machine opens in the split-screen view, you will have the shell prompt ready to accept commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPGDAYDwKsCizEP7EYgDIg.png" /></figure><p>Most Linux distributions use Bash (Bourne Again Shell) as their default shell. However, the default shell displayed when you open the terminal depends on your Linux distribution.</p><p><strong>Note:</strong> In the upcoming task, we will discuss different types of shells.</p><p>You would have already explored the basic Linux commands in the Linux Fundamentals module mentioned in this room’s prerequisites. Let’s briefly discuss some of the most important ones we use in the shell.</p><p>When interacting with a shell, you must be in the directory where you want to perform operations. By default, when you open a shell in most of the Linux distributions, you will be in your home directory. To see your current working directory, you can execute pwd, which stands for Print Working Directory, as shown in the terminal below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TW2Zk5Dtf-PSmcDAwGNp-w.png" /></figure><p>In the results of the above command, you can see that your current working directory is /home/ubuntu</p><p>However, you can change your directory as well. To do that, you can use cd (short for Change Directory), as shown in the terminal below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TD31noJz8eVlbYUDWTjTxg.png" /></figure><p>While using the GUI of an OS, you can see the contents of a directory on the screen. However, while using the shell, to see the contents of a directory, you must enter the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v03OJssoeqDrsgd9ITXBWw.png" /></figure><p>If you want to read the contents of a file, you can type the following command in your shell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JmKGhDKgHgO7FdtDfdkpEw.png" /></figure><p>The grep command is a very popular command among Linux users. This powerful command can search for any word or pattern inside a file. Suppose you want to search for specific entries in a huge file. You can use the grep command along with the pattern of those entries, which will extract them for you. It also helps you to search for a specific keyword in a big file.</p><p>The following terminal shows us how to use the grep command to search for the word “THM” inside a big text file. The output displays the specific line of that text file containing this word.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mcn1SnS7CTNWasafhTQgwg.png" /></figure><h3>Answer the questions below</h3><ol><li>What is the default shell in most Linux distributions?</li></ol><p>ANSWER: <strong>bash</strong></p><p>2. Which command utility is used to list down the contents of a directory?</p><p>ANSWER:<strong> ls</strong></p><p>3. Which command utility can help you search for anything in a file?</p><p>ANSWER: <strong>grep</strong></p><h3>Task 3: Types of Linux Shells</h3><p>Like the Command Prompt and PowerShell in Windows OS, Linux has different types of shells available, each with its own features and characteristics.</p><p>Multiple shells are installed in different Linux distributions. To see which shell you are using, type the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mvzZO_f00-YsN1HmDviN1g.png" /></figure><p>You can also list down the available shells in your Linux OS. The file /etc/shells contains all the installed shells on a Linux system. You can list down the available shells in your Linux OS by typing cat /etc/shells in the terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSywBFlbqre_Eo_JNIc05A.png" /></figure><p>To switch between these shells, you can type the shell name that is present on your OS, and it will open for you, as can be seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5_9fPkNCiALTKc5B-CBsA.png" /></figure><p>If you want to permanently change your default shell, you can use the command: chsh -s /usr/bin/zsh. This will make this shell as the default shell for your terminal.</p><p>There are many types of Linux shells. We will discuss a few of them and their features.</p><h3>Bourne Again Shell</h3><p>Bourne Again Shell (Bash) is the default shell for most Linux distributions. When you open the terminal, bash is present for you to enter commands. Before bash, some shells like sh, ksh, and csh had different capabilities. Bash came as an enhanced replacement for these shells, borrowing capabilities from all of them. This means that it has many of the features of these old shells and some of its unique abilities. Some of the key features provided by bash are listed below:</p><ul><li>Bash is a widely used shell with scripting capabilities.</li><li>It offers a tab completion feature, which means if you are in the middle of completing a command, you can press the tab key on your keyboard. It will automatically complete the command based on a possible match or give you multiple suggestions for completing it.</li><li>Bash keeps a history file and logs all of your commands. You can use the up and down arrow keys to use the previous commands without typing them again. You can also type history to display all your previous commands.</li></ul><h3>Friendly Interactive Shell</h3><p>Friendly Interactive Shell (Fish) is also not default in most Linux distributions. As its name suggests, it focuses more on user-friendliness than other shells. Some of the key features provided by fish are listed below:</p><ul><li>It offers a very simple syntax, which is feasible for beginner users.</li><li>Unlike bash, it has auto spell correction for the commands you write.</li><li>You can customize the command prompt with some cool themes using fish.</li><li>The syntax highlighting feature of fish colors different parts of a command based on their roles, which can improve the readability of commands. It also helps us to spot errors with their unique colors.</li><li>Fish also provides scripting, tab completion, and command history functionality like the shells mentioned in this task.</li></ul><h3>Z Shell</h3><p>Z Shell (Zsh) is not installed by default in most Linux distributions. It is considered a modern shell that combines the functionalities of some previous shells. Some of the key features provided by zsh are listed below:</p><ul><li>Zsh provides advanced tab completion and is also capable of writing scripts.</li><li>Just like fish, it also provides auto spell correction for the commands.</li><li>It offers extensive customization that may make it slower than other shells.</li><li>It also provides tab completion, command history functionality, and several other features.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rLOP1-3Qo-6WIbZn4prCwg.png" /></figure><p>Selecting the best Linux shell depends on your usage and its features. The shells discussed in this task are some of the many different shells available in Linux. You can compare the features of these different shells and choose the best one based on your tasks.</p><h3>Answer the questions below</h3><ol><li>Which shell comes with syntax highlighting as an out-of-the-box feature?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFlmwB2G1_-WAAvo2OeTiQ.png" /></figure><p>ANSWER: <strong>Fish</strong></p><p>2. Which shell does not have auto spell correction?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*rMfL91Yb8G-zN2fzHilWSw.png" /></figure><p>ANSWER: <strong>bash</strong></p><p>3. Which command displays all the previously executed commands of the current session?</p><p>ANSWER: <strong>History</strong></p><h3>Task 4: Shell Scripting and Component</h3><p>A shell script is nothing but a set of commands. Suppose a repetitive task requires you to enter multiple commands using a shell. Instead of entering them one after one on every repetition of that task, which may take more of your time, you can combine them into a script. To execute all those commands, you will only execute the script, and all the commands will be executed. All the shells mentioned in the previous tasks have scripting capabilities. Scripting helps us to automate tasks. Before learning how to write a script, we need to know that even though Linux shells have scripting capabilities, this does not mean that you can only make a script using a shell. Scripting can be done in various programming languages as well. However, the scope of this room is to cover scripting using a shell.</p><p>The first step is to open the terminal and select a shell. Let’s go with the bash shell, the default, and widely used shell in most distributions.</p><p>Unlike the other commands we type in the shell, we first need to create a file using any text editor for the script. The file must be named with an extension .sh, the default extension for bash scripts. The following terminal shows the script file creation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ykPcX5hoeL3QarN4udRqZA.png" /></figure><p>Every script should start from shebang. Shebang is a combination of some characters that are added at the beginning of a script, starting with #! followed by the name of the interpreter to use while executing the script. As we are writing our script in bash, let’s define it as the interpreter in the shebang.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A7iSGXO1O_wnW6Pr-a7euQ.png" /></figure><p>We are all set to write our first script now. There are some fundamental building blocks of a script that together make an efficient script. Let’s learn and utilize these script constructs to write one script ourselves.</p><h3>Variables</h3><p>A variable stores a value inside it. Suppose you need to use some complex values, like a URL, a file path, etc., several times in your script. Instead of memorizing and writing them repeatedly, you can store them in a variable and use the variable name wherever you need it.</p><p>The script below displays a string on the screen: “Hey, what’s your name?” This is done by echo command. The second line of the script contains the code read name. read is used to take input from the user, and name is the variable in which the input would be stored. The last line uses echo to display the welcome line for the user, along with its name stored in the variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ftutppPP0fO5XXv6gM8Hmw.png" /></figure><p>To execute the script, we first need to make sure that the script has execution permissions. To give these permissions to the script, we can type the following command in our terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JmKriVtHPIySckRy8YHFtA.png" /></figure><p>Now that the script has execution permissions use ./ before the script name to execute it. We use ./ before the script to run rather than typing the script name directly because ./ tells the shell to execute the file that is present in the current directory. If you don&#39;t define ./ before the script name, the shell will search the script in the PATH environment variable (that contains all the directories except the current one), and it will not find the defined script in any of those directories and generate an error. The below terminal shows the script in which we utilized the variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ouIo01Ndb-FkBskankZ9w.png" /></figure><h3>Loops</h3><p>Loop, as the name suggests, is something that is repeating. For example, you have a list of many friends, and you want to send them the same message. Instead of sending them individually, you can make a loop in your script, give your friend list to the loop and the message, and it will send that message to all your friends.</p><p>For a general explanation of loops, let’s write a loop that will display all numbers starting from 1 to 10 on the screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQRBLFbzpBbPHcxifg5iQg.png" /></figure><p>he first line has the variable i that will iterate from 1 to 10 and execute the below code every time. do indicates the start of the loop code, and done indicates the end. In between them, the code we want to execute in the loop is to be written. The for loop will take each number in the brackets and assign it to the variable i in each iteration. The echo $i will display this variable’s value every iteration.</p><p>Now, let’s execute the script after giving it the execution permission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6QI0MOppW4pvGl6R-QB3w.png" /></figure><p>The output of the above terminal is cut to 3 numbers only for demonstration. However, when executed according to the script&#39;s logic, it would display the numbers from 1 to 10.</p><h3>Conditional Statements</h3><p>Conditional statements are an essential part of scripting. They help you execute a specific code only when a condition is satisfied; otherwise, you can execute another code. Suppose you want to make a script that shows the user a secret. However, you want it to be shown to only some users, only to the high-authority user. You will create a conditional statement that will first ask the user their name, and if that name matches the high authority user’s name, it will display the secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*se5VrYD66zNcX69yt-slTA.png" /></figure><p>The above script takes the user’s name as input and stores it into a variable (studied in the Variables section). The conditional statement starts with if and compares the value of that variable with the string Stewart; if it’s a match, it will display the secret to the user, or else it will not. The fi is used to end the for loop.</p><p>Following is the terminal showing the script execution when the user name matches the authorized one defined in the script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ia49OqgSd36dWAzU6jxbNg.png" /></figure><p>However, the following terminal shows the script execution when the user name does not match the authorized one defined in the script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IO8Fe4VuUp1pNavrmsMDpA.png" /></figure><h3>Comments</h3><p>Sometimes, the code can be very lengthy. In this scenario, the code might confuse you when you look at it after some time or share it with somebody. An easy way to resolve this problem is to use comments in different parts of the code. A comment is a sentence that we write in our code just for the sake of our understanding. It is written with a # sign followed by a space and the sentence you need to write. For example, let’s rewrite the script we discussed in the conditional statements section and add comments to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fjamEXRf_1iLT3aOwHlfgw.png" /></figure><p>See how easy a script looks with comments. Comments don’t affect the working of any script. A good script always has some comments. The example shown above contains a comment for each line. This is just a better explanation of its concept. However, the best way to include comments is to define them in the major and complex areas of the script.</p><p><strong>Note:</strong> Other types of variables, loops, and conditional statements can also be used to achieve different tasks. Moreover, multiple lines of comments can also be added within a single comment. However, it is not the scope of this room.</p><h3>Answer the questions below</h3><ol><li>What is the shebang used in a Bash script?</li></ol><p>ANSWER: <strong>#!/bin/bash</strong></p><p>2. Which command gives executable permissions to a script?</p><p>ANSWER: <strong>chmod +x</strong></p><p>3. Which scripting functionality helps us configure iterative tasks?</p><p>ANSWER: <strong>loops</strong></p><h3>Task 5: The Locker Script</h3><p>In the previous task, we studied variables, loops, and conditional statements in shell scripting. Let’s use that knowledge to create a shell script that utilizes all these components.</p><h3>Requirement</h3><p>A user has a locker in a bank. To secure the locker, we have to have a script in place that verifies the user before opening it. When executed, the script should ask the user for their name, company name, and PIN. If the user enters the following details, they should be allowed to enter, or else they should be denied access.</p><ul><li>Username: John</li><li>Company name: Tryhackme</li><li>PIN: 7385</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*HGb5px6pZmcp8Iutu1gZrA.png" /></figure><h3>Script</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bILBrv644njXXITtqI1VYg.png" /></figure><h3>Script Execution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hKepYW9V1wz_viv-NvVqQ.png" /></figure><h3>Answer the questions below</h3><ol><li>What would be the correct PIN to authenticate in the locker script?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*fMZ_AsaSo-wqDr-oxgqqOw.png" /></figure><p>ANSWER: 7385</p><h3>Task 6: Practical Exercise</h3><p>We have placed a script on the default user directory /home/user of the attached Ubuntu machine. This script searches for a specific keyword in all the files (with .log extension) in a specific directory.</p><p><strong>Note:</strong> Some changes are required inside the script file before you execute it. When you open the machine according to the instructions in task #2, you will be able to gain the session as a normal user. However, we recommend you to become the root user in order to search for the flag in all the files of the given directory. To become one, you only need to type the following command and enter the password of the user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1WYCa4aIdxLRAORgiH5HTg.png" /></figure><p>You can make the changes in the script file by keeping in view the following details:</p><ul><li><strong>Flag:</strong> thm-flag01-script</li><li><strong>Directory:</strong> /var/log</li></ul><p><strong>Hint:</strong> Look for empty double quotes &quot; &quot; inside the script file and fill them. Make sure not to leave any space between them.</p><h3>Answer the questions below</h3><ol><li>Which file has the keyword?</li></ol><p>Run: <br><strong>ls</strong> (If flag_hunt.sh is not seen then cd /home/user then ls)<br><strong>nano</strong> flag_hunt.sh (<strong>Flag:</strong> thm-flag01-script ; <strong>Directory:</strong>/var/log ; for file in “$directory”/*.log;)<br><strong>./</strong>flag_hunt.sh<br>grep “cat” /var/log/<strong>authentication.log</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*er9H9_5uzSXtqXg-Hrp4OA.png" /></figure><p>ANSWER: <strong>authentication.log</strong></p><p>2. Where is the cat sleeping?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*KZPG3AVpvOHYRlaynEtHyQ.png" /></figure><p>ANSWER: <strong>under the table</strong></p><h3>Task 7: Conclusion</h3><p>In this room, we studied the importance of shells and flew to the world of Linux shells, exploring their major types. We gained a good understanding of shell scripting and its role in automating tasks. In the end, we created some cool shell scripts and solved a practical lab pertaining to a script that finds mysterious things out of different directories.</p><p><strong>Thanks for reading! Until next time, take care!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=109a6417b755" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows PowerShell | TryHackMe Writeups | By DEYSNC]]></title>
            <link>https://medium.com/@D3SYNCx/windows-powershell-tryhackme-writeups-by-deysnc-592a27f8afca?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/592a27f8afca</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Sat, 10 May 2025 10:31:55 GMT</pubDate>
            <atom:updated>2025-05-17T11:23:02.416Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*48X_KASJnfWYrhbnIMPcKQ.png" /></figure><h3>Windows PowerShell | TryHackMe Writeups | By D3YSNC</h3><p>Discover the “Power” in PowerShell and learn the basics.<br>Room Access: “<a href="https://tryhackme.com/room/windowspowershell">https://tryhackme.com/room/windowspowershell</a>”</p><h3>Task 1: Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*n6hZFvJGWeXqu-wElW1NHw.png" /></figure><p>Ahoy there! If you’re here, you’ve either heard whispers of the marvels of PowerShell and want to discover more, or you’ve sailed over from the first room of the Command Line module — <a href="https://tryhackme.com/r/room/windowscommandline">Windows Command Line</a>. Either way, you’re about to embark on a journey to discover the marvels of this powerful shell, learning how to use it to uncover the secrets of any Windows system. Avast, then — on board!</p><h3>Learning Objectives</h3><p>This is the second room in the <a href="https://tryhackme.com/module/command-line">Command Line</a> module. It is an introductory room to PowerShell, the second — only historically — command-line utility built for the Windows operating system.</p><ul><li>Learn what PowerShell is and its capabilities.</li><li>Understand the basic structure of PowerShell’s language.</li><li>Learn and run some basic PowerShell commands.</li><li>Understand PowerShell’s many applications in the cyber security industry.</li></ul><h3>Room Prerequisites</h3><p>Before approaching this room, it’s recommended that you have understood the concepts in the <a href="https://tryhackme.com/module/windows-and-active-directory-fundamentals">Windows and AD Fundamentals</a> module and the <a href="https://tryhackme.com/r/room/windowscommandline">Windows Command Line</a> room.</p><h3>TASK 2: What Is PowerShell</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*w0wJbfLGcbfUQJBwuC1EzQ.png" /></figure><p>rom the official Microsoft <a href="https://learn.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.4">page</a>: <em>“PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework.”</em></p><p>PowerShell is a powerful tool from Microsoft designed for task automation and configuration management. It combines a command-line interface and a scripting language built on the .NET framework. Unlike older text-based command-line tools, PowerShell is object-oriented, which means it can handle complex data types and interact with system components more effectively. Initially exclusive to Windows, PowerShell has lately expanded to support macOS and Linux, making it a versatile option for IT professionals across different operating systems.</p><h3>A Brief History of PowerShell</h3><p>PowerShell was developed to overcome the limitations of existing command-line tools and scripting environments in Windows. In the early 2000s, as Windows was increasingly used in complex enterprise environments, traditional tools like cmd.exe and batch files fell short in automating and managing these systems. Microsoft needed a tool that could handle more sophisticated administrative tasks and interact with Windows’ modern APIs.</p><p>Jeffrey Snover, a Microsoft engineer, realised that Windows and Unix handled system operations differently — Windows used structured data and APIs, while Unix treated everything as text files. This difference made porting Unix tools to Windows impractical. Snover’s solution was to develop an object-oriented approach, combining scripting simplicity with the power of the .NET framework. Released in 2006, PowerShell allowed administrators to automate tasks more effectively by manipulating objects, offering deeper integration with Windows systems.</p><p>As IT environments evolved to include various operating systems, the need for a versatile automation tool grew. In 2016, Microsoft responded by releasing PowerShell Core, an open-source and cross-platform version that runs on Windows, macOS, and Linux.</p><h3>The Power in PowerShell</h3><p>To fully grasp the power of PowerShell, we first need to understand what an <strong>object</strong> is in this context.</p><p>In programming, an <strong>object</strong> represents an item with <strong>properties</strong> (characteristics) and <strong>methods</strong> (actions). For example, a car object might have properties like Color, Model, and FuelLevel, and methods like Drive(), HonkHorn(), and Refuel().</p><p>Similarly, in PowerShell, objects are fundamental units that encapsulate data and functionality, making it easier to manage and manipulate information. An object in PowerShell can contain file names, usernames or sizes as data (<strong>properties</strong>), and carry functions (<strong>methods</strong>) such as copying a file or stopping a process.</p><p>The traditional Command Shell’s basic commands are text-based, meaning they process and output data as plain text. Instead, when a <strong>cmdlet</strong> (pronounced <em>command-let</em>) is run in PowerShell, it returns objects that retain their properties and methods. This allows for more powerful and flexible data manipulation since these objects do not require additional parsing of text.</p><p>We will explore more about PowerShell’s cmdlets and their capabilities in the upcoming sections.</p><h3>Answer the questions below</h3><ol><li>What do we call the advanced approach used to develop PowerShell?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*JnNr4NnboO0k9uOvY2H15g.png" /></figure><p>ANSWER: <strong>object-oriented</strong></p><h3>Task 3: PowerShell Basics</h3><p>Before continuing on our PowerShell journey, let’s connect to our lab environment. Press the Start Machine button, then start the <strong>AttackBox</strong> by pressing the Start AttackBox button at the top of this page. The AttackBox machine will start in <strong>Split-Screen view</strong>. If it is not visible, use the blue Show Split View button at the top of the page.</p><p>Start Machine</p><p>You can follow the steps below to connect to the target VM via SSH using the Remmina client.</p><p>Click on <strong>Applications</strong>, marked with number 1 in the screenshot below. Select <strong>Internet</strong> (number 2), then <strong>Remmina</strong> (number 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*49YqR-3BTmjYw5gW.png" /></figure><p>A popup window will appear, prompting you for a password to unlock the AttackBox’s keyring. Click on Cancel to ignore the prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QkrJY2Wls_EUsc0Y.png" /></figure><p>Select the <strong>SSH</strong> option from the dropdown (number 1 in the screenshot below), then paste the target IP: 10.10.169.205 in the bar at the top (number 2). Finally, click Enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l-pkGMIW4FAuzCsd.png" /></figure><p>In the next window, enter the credentials found in the card below, then click on OK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*G9fB1eN8KJyP_TXTh2gWAw.png" /></figure><h3>Launching PowerShell</h3><p>PowerShell can be launched in several ways, depending on your needs and environment. If you are working on a Windows system from the graphical interface (GUI), these are some of the possible ways to launch it:</p><ul><li><strong>Start Menu</strong>: Type powershell in the Windows Start Menu search bar, then click on Windows PowerShell or PowerShell from the results.</li><li><strong>Run Dialog</strong>: Press Win + R to open the Run dialog, type powershell, and hit Enter.</li><li><strong>File Explorer</strong>: Navigate to any folder, then type powershell in the address bar, and press Enter. This opens PowerShell in that specific directory.</li><li><strong>Task Manager</strong>: Open the Task Manager, go to File &gt; Run new task, type powershell, and press Enter.</li></ul><p>Alternatively, PowerShell can be launched from a Command Prompt (cmd.exe) by typing powershell, and pressing Enter.</p><p>In our case, where we only have access to the target VM’s Command Prompt, this is the method we’ll use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wIuz-yRwka-4yZ9rr2kQZg.png" /></figure><p>After PowerShell has launched, we’re presented with a PS (which stands for PowerShell) prompt in the current working directory.</p><h3>Basic Syntax: Verb-Noun</h3><p>As previously mentioned, PowerShell commands are known as cmdlets (pronounced command-lets). They are much more powerful than the traditional Windows commands and allow for more advanced data manipulation.</p><p>Cmdlets follow a consistent Verb-Noun naming convention. This structure makes it easy to understand what each cmdlet does. The Verb describes the action, and the Noun specifies the object on which action is performed. For example:</p><ul><li>Get-Content: Retrieves (gets) the content of a file and displays it in the console.</li><li>Set-Location: Changes (sets) the current working directory.</li></ul><h3>Basic Cmdlets</h3><p>To list all available cmdlets, functions, aliases, and scripts that can be executed in the current PowerShell session, we can use Get-Command. It’s an essential tool for discovering what commands one can use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_caGRNABvO4LWNSAFLdHg.png" /></figure><p>For each CommandInfo object retrieved by the cmdlet, some essential information (properties) is displayed on the console. It’s possible to filter the list of commands based on displayed property values. For example, if we want to display only the available commands of type “function”, we can use -CommandType &quot;Function&quot;, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVKCBRGa_KYgdvXM2X5ZTw.png" /></figure><p>We will learn more efficient ways to filter output from cmdlets in the upcoming tasks.</p><p>Another essential cmdlet to keep in our tool belt is Get-Help: it provides detailed information about cmdlets, including usage, parameters, and examples. It’s the go-to cmdlet for learning how to use PowerShell commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A9-5qSIMWHzPZNkp3ukU2Q.png" /></figure><p>As shown in the results above, Get-Help informs us that we can retrieve other useful information about a cmdlet by appending some options to the basic syntax. For example, by appending -examples to the command displayed above, we will be shown a list of common ways in which the chosen cmdlet can be used.</p><p>To make the transition easier for IT professionals, PowerShell includes aliases — which are shortcuts or alternative names for cmdlets — for many traditional Windows commands. Indispensable for users already familiar with other command-line tools, Get-Alias lists all aliases available. For example, dir is an alias for Get-ChildItem, and cd is an alias for Set-Location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XkqbAtRjtSIvN0kKRFSEQg.png" /></figure><h3>Where to Find and Download Cmdlets</h3><p>Another powerful feature of PowerShell is the possibility of extending its functionality by downloading additional cmdlets from online repositories.</p><p><strong>NOTE:</strong> Please note that the cmdlets listed in this section require a working internet connection to query online repositories. The attached machine doesn’t have access to the internet, therefore these commands won’t work in this environment.</p><p>To search for modules (collections of cmdlets) in online repositories like the PowerShell Gallery, we can use Find-Module. Sometimes, if we don’t know the exact name of the module, it can be useful to search for modules with a similar name. We can achieve this by filtering the Name property and appending a wildcard (*) to the module’s partial name, using the following standard PowerShell syntax: Cmdlet -Property &quot;pattern*&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MHauWr5favZ_3k1Sl5ziYA.png" /></figure><p>Once identified, the modules can be downloaded and installed from the repository with Install-Module, making new cmdlets contained in the module available for use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8PXbuCQ6UOLkYL9Qd_uHg.png" /></figure><p>With these essential tools in our belt, we can now start exploring PowerShell’s capabilities.</p><h3>Answer the questions below</h3><p>1.How would you retrieve a list of commands that <strong>start with</strong> the verb Remove? [for the sake of this question, avoid the use of quotes (&quot; or &#39;) in your answer]</p><p>ANSWER: <strong>Get-Command -Name Remove*</strong></p><p>2.What cmdlet has its traditional counterpart echo as an alias?</p><p>Run: Get-Alias</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*Nc7t2GcpKfhfmS8zzsnD8g.png" /></figure><p>ANSWER: <strong>Write-Output</strong></p><p>3.What is the command to retrieve some example usage for the cmdlet New-LocalUser?</p><p>ANSWER: <strong>Get-Help New-LocalUser -examples</strong></p><h3>Task 4: Navigating the File System and Working with Files</h3><p>owerShell provides a range of cmdlets for navigating the file system and managing files, many of which have counterparts in the traditional Windows CLI.</p><p>Similar to the dir command in Command Prompt (or ls in Unix-like systems), Get-ChildItem lists the files and directories in a location specified with the -Path parameter. It can be used to explore directories and view their contents. If no Path is specified, the cmdlet will display the content of the current working directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xxSaPKwmmcFqqXhjmK1VUA.png" /></figure><p>To navigate to a different directory, we can use the Set-Location cmdlet. It changes the current directory, bringing us to the specified path, akin to the cd command in Command Prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Lw63fUxzqseOwgQ5cbLMQ.png" /></figure><p>While the traditional Windows CLI uses separate commands to create and manage different items like directories and files, PowerShell simplifies this process by providing a single set of cmdlets to handle the creation and management of both files and directories.</p><p>To create an item in PowerShell, we can use New-Item. We will need to specify the path of the item and its type (whether it is a file or a directory).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a7X8drouYXxEOY26QuP8kw.png" /></figure><p>Similarly, the Remove-Item cmdlet removes both directories and files, whereas in Windows CLI we have separate commands rmdir and del.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GYBOn2aG3TjMfs9-8LpqOg.png" /></figure><p>We can copy or move files and directories alike, using respectively Copy-Item (equivalent to copy) and Move-Item (equivalent to move).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnPfSOSSs9goOHsWFI3MzQ.png" /></figure><p>Finally, to read and display the contents of a file, we can use the Get-Content cmdlet, which works similarly to the type command in Command Prompt (or cat in Unix-like systems).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rz5_0wRpuJCM-vYoxL8j5g.png" /></figure><h3>Answer the questions below</h3><ol><li>What cmdlet can you use instead of the traditional Windows command type?</li></ol><p>ANSWER: <strong>Get-Content</strong></p><p>2. What PowerShell command would you use to display the content of the “C:\Users” directory? [for the sake of this question, avoid the use of quotes (“ or ‘) in your answer]</p><p>ANSWER: <strong>Get-ChildItem -Path C:\Users</strong></p><p>3. How many items are displayed by the command described in the previous question?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*qtCHmShvR20oN9zEB6cJMA.png" /></figure><p>ANSWER: <strong>4</strong></p><h3>Task 5: Piping, Filtering, and Sorting Data</h3><p><strong>Piping</strong> is a technique used in command-line environments that allows the output of one command to be used as the input for another. This creates a sequence of operations where the data flows from one command to the next. Represented by the | symbol, piping is widely used in the Windows CLI, as introduced earlier in this module, as well as in Unix-based shells.</p><p>In PowerShell, piping is even more powerful because it passes <strong>objects</strong> rather than just text. These objects carry not only the data but also the properties and methods that describe and interact with the data.</p><p>For example, if you want to get a list of files in a directory and then sort them by size, you could use the following command in PowerShell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLVJo1hMAsEnShCE-a8Ksw.png" /></figure><p>Here, Get-ChildItem retrieves the files (as objects), and the pipe (|) sends those file objects to Sort-Object, which then sorts them by their Length (size) property. This object-based approach allows for more detailed and flexible command sequences.</p><p>In the example above, we have leveraged the Sort-Object cmdlet to sort objects based on specified properties. Beyond sorting, PowerShell provides a set of cmdlets that, when combined with piping, allow for advanced data manipulation and analysis.</p><p>To filter objects based on specified conditions, returning only those that meet the criteria, we can use the Where-Object cmdlet. For instance, to list only .txt files in a directory, we can use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lEAF7mB2AHxttbwM33f9mw.png" /></figure><p>Here, Where-Object filters the files by their Extension property, ensuring that only files with extension equal (-eq) to .txt are listed.</p><p>The operator -eq (i.e. &quot;<strong>equal to</strong>&quot;) is part of a set of <strong>comparison operators</strong> that are shared with other scripting languages (e.g. Bash, Python). To show the potentiality of the PowerShell&#39;s filtering, we have selected some of the most useful operators from that list:</p><ul><li>-ne: &quot;<strong>not equal</strong>&quot;. This operator can be used to exclude objects from the results based on specified criteria.</li><li>-gt: &quot;<strong>greater than</strong>&quot;. This operator will filter only objects which exceed a specified value. It is important to note that this is a strict comparison, meaning that objects that are equal to the specified value will be excluded from the results.</li><li>-ge: &quot;<strong>greater than or equal to</strong>&quot;. This is the non-strict version of the previous operator. A combination of -gt and -eq.</li><li>-lt: &quot;<strong>less than</strong>&quot;. Like its counterpart, &quot;greater than&quot;, this is a strict operator. It will include only objects which are strictly below a certain value.</li><li>-le: &quot;<strong>less than or equal to</strong>&quot;. Just like its counterpart -ge, this is the non-strict version of the previous operator. A combination of -lt and -eq.</li></ul><p>Below, another example shows that objects can also be filtered by selecting properties that match (-like) a specified pattern:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLMUUcrYLGD4pK56NuDp8Q.png" /></figure><p>The next filtering cmdlet, Select-Object, is used to select specific properties from objects or limit the number of objects returned. It’s useful for refining the output to show only the details one needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfzs-l1MMfCEseCDNK7Mcg.png" /></figure><p>The cmdlets pipeline can be extended by adding more commands, as the feature isn’t limited to just piping between two cmdlets. As an exercise, try and build a pipeline of cmdlets to sort and filter the output with the goal of displaying the largest file in the C:\Users\captain\Documents\captain-cabin directory.</p><p><strong>Click here to look at a possible solution. Don’t cheat!</strong></p><p>The last in this set of filtering cmdlets is Select-String. This cmdlet searches for text patterns within files, similar to grep in Unix-based systems or findstr in Windows Command Prompt. It’s commonly used for finding specific content within log files or documents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tGXw5NkR6Mq9Ezb4N5mCOw.png" /></figure><p>The Select-String cmdlet fully supports the use of regular expressions (<a href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expressions">regex</a>). This advanced feature allows for complex pattern matching within files, making it a powerful tool for searching and analysing text data.</p><h3>Answer the questions below</h3><p>How would you retrieve the items in the current directory with size greater than 100? [for the sake of this question, avoid the use of quotes (“ or ‘) in your answer]</p><p>ANSWER:<strong> Get-ChildItem | Where-Object -Property Length -gt 100</strong></p><h3>Task 6: System and Network Information</h3><p>PowerShell was created to address a growing need for a powerful automation and management tool to help system administrators and IT professionals. As such, it offers a range of cmdlets that allow the retrieval of detailed information about system configuration and network settings.</p><p>The Get-ComputerInfo cmdlet retrieves comprehensive system information, including operating system information, hardware specifications, BIOS details, and more. It provides a snapshot of the entire system configuration in a single command. Its traditional counterpart systeminfo retrieves only a small set of the same details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vEZkQT7dEML_Gx2-jiobTw.png" /></figure><p>Essential for managing user accounts and understanding the machine’s security configuration, Get-LocalUser lists all the local user accounts on the system. The default output displays, for each user, username, account status, and description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cw02o4oolZJxSGT67zlTzg.png" /></figure><p>Similar to the traditional ipconfig command, the following two cmdlets can be used to retrieve detailed information about the system’s network configuration.</p><p>Get-NetIPConfiguration provides detailed information about the network interfaces on the system, including IP addresses, DNS servers, and gateway configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UszIxAcrKvi7s_8Tn5MxzA.png" /></figure><p>In case we need specific details about the IP addresses assigned to the network interfaces, the Get-NetIPAddress cmdlet will show details for all IP addresses configured on the system, including those that are not currently active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZqPOQ0IabRs9ulCT8WvVw.png" /></figure><p>These cmdlets give IT professionals the ability to quickly access crucial system and network information directly from the command line, making it easier to monitor and manage both local and remote machines.</p><h3>Answer the questions below</h3><ol><li>Other than your current user and the default “Administrator” account, what other user is enabled on the target machine?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZqfYIpZa8xNbWTbgLSsAYQ.png" /><figcaption><strong>Run:</strong> Get-LocalUser</figcaption></figure><p>ANSWER: <strong>p1r4t3</strong></p><p>2. This lad has hidden his account among the others with no regard for our beloved captain! What is the motto he has so bluntly put as his account’s description?</p><p>ANSWER: <strong>A merry life and a short one.</strong></p><p>3. Now a small challenge to put it all together. This shady lad that we just found hidden among the local users has his own home folder in the “C:\Users” directory. <br>Can you navigate the filesystem and find the hidden treasure inside this pirate’s home?</p><blockquote>Run:<br>Set-location -path C:\Users</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*XyDLFT6irHblH_S4NseWIw.png" /></figure><p>Run: <strong>Set-location p1r4t3</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*fOOFfeyo3b4Revu1MzzBvg.png" /></figure><p>Run: <strong>Get-Content big-treasure.txt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*VHnNDzvSYfEF6KEDImKRnA.png" /></figure><p>ANSWER : <strong>THM{p34rlInAsh3ll}</strong></p><h3>Task 7: Real-Time System Analysis</h3><p>To gather more advanced system information, especially concerning dynamic aspects like running processes, services, and active network connections, we can leverage a set of cmdlets that go beyond static machine details.</p><p>Get-Process provides a detailed view of all currently running processes, including CPU and memory usage, making it a powerful tool for monitoring and troubleshooting.\</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztf0q_lr_W-QAahZitUBfg.png" /></figure><p>Similarly, Get-Service allows the retrieval of information about the status of services on the machine, such as which services are running, stopped, or paused. It is used extensively in troubleshooting by system administrators, but also by forensics analysts hunting for anomalous services installed on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YltJMzs7aEC_5AytZChF5Q.png" /></figure><p>To monitor active network connections, Get-NetTCPConnection displays current TCP connections, giving insights into both local and remote endpoints. This cmdlet is particularly handy during an incident response or malware analysis task, as it can uncover hidden backdoors or established connections towards an attacker-controlled server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJ9XE6SPTGQucjU0Nc84mw.png" /></figure><p>Additionally, we are going to mention Get-FileHash as a useful cmdlet for generating file hashes, which is particularly valuable in incident response, threat hunting, and malware analysis, as it helps verify file integrity and detect potential tampering.</p><h3>Answer the questions below</h3><ol><li>In the previous task, you found a marvellous treasure carefully hidden in the target machine. What is the hash of the file that contains it?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ElLmJLdnizIzH1wgBDwYA.png" /><figcaption>Run: Get-Filehash big-treasure.txt</figcaption></figure><p>ANSWER: <strong>71FC5EC11C2497A32F8F08E61399687D90ABE6E204D2964DF589543A613F3E08</strong></p><p>2. What property retrieved by default by Get-NetTCPConnection contains information about the process that has started the connection?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VmxrDI6qyQoR4xGbWCfKTQ.png" /><figcaption>Run: Get-nettcpconnection</figcaption></figure><p>ANSWER:<strong> OwningProcess</strong></p><p>3. It’s time for another small challenge. Some vital service has been installed on this pirate ship to guarantee that the captain can always navigate safely. But something isn’t working as expected, and the captain wonders why. Investigating, they find out the truth, at last: the service has been tampered with! The shady lad from before has modified the service DisplayName to reflect his very own motto, the same that he put in his user description.</p><p>With this information and the PowerShell knowledge you have built so far, can you find the service name?</p><p>Run: Get-Service | Where-Object DisplayName -like *merry* (beacause we got a shady line earlier in his user description “<strong>A merry life and a short one.”</strong></p><p>ANSWER: p1r4t3-s-compass</p><h3>Task 8: Scripting</h3><p><strong>cripting</strong> is the process of writing and executing a series of commands contained in a text file, known as a script, to automate tasks that one would generally perform manually in a shell, like PowerShell.</p><p>Simply speaking, scripting is like giving a computer a to-do list, where each line in the script is a task that the computer will carry out automatically. This saves time, reduces the chance of errors, and allows to perform tasks that are too complex or tedious to do manually. As you learn more about shells and scripting, you’ll discover that scripts can be powerful tools for managing systems, processing data, and much more.</p><p>Learning scripting with PowerShell goes beyond the scope of this room. Nonetheless, we must understand that its power makes it a crucial skill across all cyber security roles.</p><ul><li>For <strong>blue team</strong> professionals such as incident responders, malware analysts, and threat hunters, PowerShell scripts can automate many different tasks, including log analysis, detecting anomalies, and extracting indicators of compromise (IOCs). These scripts can also be used to reverse-engineer malicious code (malware) or automate the scanning of systems for signs of intrusion.</li><li>For the <strong>red team</strong>, including penetration testers and ethical hackers, PowerShell scripts can automate tasks like system enumeration, executing remote commands, and crafting obfuscated scripts to bypass defences. Its deep integration with all types of systems makes it a powerful tool for simulating attacks and testing systems’ resilience against real-world threats.</li><li>Staying in the context of cyber security, <strong>system administrators</strong> benefit from PowerShell scripting for automating integrity checks, managing system configurations, and securing networks, especially in remote or large-scale environments. PowerShell scripts can be designed to enforce security policies, monitor systems health, and respond automatically to security incidents, thus enhancing the overall security posture.</li></ul><p>Whether used defensively or offensively, PowerShell scripting is an essential capability in the cyber security toolkit.</p><p>Before concluding this task about scripting, we can’t go without mentioning the Invoke-Command cmdlet.</p><p>Invoke-Command is essential for executing commands on remote systems, making it fundamental for system administrators, security engineers and penetration testers. Invoke-Command enables efficient remote management and—combining it with scripting—automation of tasks across multiple machines. It can also be used to execute payloads or commands on target systems during an engagement by penetration testers—or attackers alike.</p><p>Let us discover some example usage for this powerful cmdlet by consulting the Get-Help &quot;examples&quot; page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OMTpXWbZuWSN8m0kCK16Q.png" /></figure><p>The first two examples provided by the Get-Help &quot;examples&quot; page and reported above are enough to grasp the simplicity and power of the Invoke-Command cmdlet.</p><p>The first example shows how the cmdlet can be very easily combined with any custom script to automate tasks on remote computers.</p><p>The second example demonstrates that we don’t need to know how to script to benefit from the power of Invoke-Command. In fact, by appending the -ScriptBlock { ... } parameter to the cmdlet&#39;s syntax, we can execute any command (or sequence of commands) on the remote computer. The result would be the same as if we were typing the commands in a local PowerShell session on the remote computer itself.</p><h3>Answer the questions below</h3><p>What is the syntax to execute the command Get-Service on a remote computer named &quot;RoyalFortune&quot;? Assume you don&#39;t need to provide credentials to establish the connection. [for the sake of this question, avoid the use of quotes (&quot; or &#39;) in your answer]</p><p>ANSWER: <strong>Invoke-Command -ComputerName RoyalFortune -ScriptBlock { Get-Service }</strong></p><h3>Task 9: Conclusion</h3><p>Well done, mateys! You’ve successfully navigated the treacherous waters of PowerShell, uncovering hidden treasures and elusive services aboard TheBlackPearl.</p><p>With these tools in your belt, you’re well-equipped to explore even the most guarded corners of any Windows system.</p><p>Remember, a true pirate never stops seeking treasure — so keep honing your skills, and who knows what pearls you’ll discover in the next adventure? Until then, may your cmdlets be sharp and your scripts swift. Fair winds, and happy hunting!</p><p><strong>Thanks for reading! Until next time, take care!<br>Next Room: “</strong><a href="https://medium.com/@DE_SYNC/linux-shells-tryhackme-writeups-by-desync-109a6417b755">https://medium.com/@DE_SYNC/linux-shells-tryhackme-writeups-by-desync-109a6417b755</a><strong>”</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=592a27f8afca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows Command Line| TryHackMe Writeups | By DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/windows-command-line-tryhackme-writeups-by-desync-0a99bcb88d8e?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a99bcb88d8e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Fri, 09 May 2025 11:39:08 GMT</pubDate>
            <atom:updated>2025-05-17T11:23:27.110Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXor01VE3KH5KC-AMA3Xpg.png" /><figcaption>by</figcaption></figure><h3>Windows Command Line | TryHackMe Writeups | By D3SYNC</h3><p>Learn the essential Windows commands.</p><p>Room Access: “<a href="https://tryhackme.com/room/windowscommandline">https://tryhackme.com/room/windowscommandline</a>”</p><h3>Task 1: Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*XUb6Q1s_4B15AljxuI4OLA.png" /></figure><p>Everyone prefers a graphical user interface (GUI) until they master a command-line interface (CLI). There are many reasons for that. One reason is that GUIs are usually intuitive. If someone offers you a GUI interface you are unfamiliar with, you can quickly poke around and discover a non-trivial part. Compare this with dealing with a CLI, i.e., a prompt.</p><p>CLI interfaces usually have a learning curve; however, as you master the command line, you will find it faster and more efficient. Consider this trivial example: How many clicks do you need to find your IP address using the graphical desktop? Using the command-line interface, you don’t even need to raise your hands off the keyboard. Let’s say you want to recheck your IP address. You need to issue the same command instead of moving the mouse pointer to every corner of your screen.</p><p>There are many other advantages to using a CLI besides speed and efficiency. We will mention a few:</p><ul><li><strong>Lower resource usage</strong>: CLIs require fewer system resources than graphics-intensive GUIs. In other words, you can run your CLI system on older hardware or systems with limited memory. If you are using cloud computing, your system will require lower resources, which in turn will lower your bill.</li><li><strong>Automation</strong>: While you can automate GUI tasks, creating a batch file or script with the commands you need to repeat is much easier.</li><li><strong>Remote management</strong>: CLI makes it very convenient to use SSH to manage a remote system such as a server, router, or an IoT device. This approach works well on slow network speeds and systems with limited resources.</li></ul><h3>Learning Objectives</h3><p>The purpose of this room is to teach you how to use MS Windows Command Prompt cmd.exe, the default command-line interpreter in the Windows environment. We will learn how to use the command line to:</p><ul><li>Display basic system information</li><li>Check and troubleshoot network configuration</li><li>Manage files and folders</li><li>Check running processes</li></ul><h3>Room Prerequisites</h3><p>Before starting this room, you should have finished the <a href="https://tryhackme.com/module/windows-and-active-directory-fundamentals">Windows and AD Fundamentals</a> module.</p><p>Press the <strong>Start Machine</strong> button below.</p><p><strong>START MACHINE</strong></p><p>Start the AttackBox by pressing the <strong>Start AttackBox</strong> button at the top of this page. The AttackBox machine will start in Split-Screen view. If it is not visible, use the blue <strong>Show Split View</strong> button at the top of the page.</p><p>You can use the SSH client on the AttackBox to connect to MACHINE_IP with the following credentials:</p><ul><li>Username: user</li><li>Password: Tryhackme123!</li></ul><h4>Establishing an SSH Connection from the AttackBox</h4><p>If this is the first time you initiate an SSH connection from the AttackBox to a target system, the steps are shown in the screenshot below, and they are the following:</p><ol><li>Start the AttackBox’s terminal by clicking the terminal icon marked with 1.</li><li>To connect to the target VM, issue the command ssh user@MACHINE_IP as user is the username in this case.</li><li>Because this is your first time connecting to this target VM, you will be asked to trust this connection. Answer with <strong>yes</strong> as marked with 3.</li><li>Enter your password Tryhackme123!. Please note that the password will not appear as you type it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*T5SGctFcgqhT0dSO.png" /></figure><h3>Answer the questions below</h3><ol><li>What is the default command line interpreter in the Windows environment?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*NVYYcLR2P_wj2xCZAbtENw.png" /></figure><p>ANSWER: <strong>cmd.exe</strong></p><h3>Task 2: Basic System Information</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/0*66ng2ZNNRxuQVlGy" /></figure><p>Before issuing commands, we should note that we can only issue the commands within the Windows Path. You can issue the command set to check your path from the command line. The terminal output below shows the path where MS Windows will execute commands, as indicated by the line starting with Path=.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*H_5KJKHfB1WbWR2CZyMvxw.png" /></figure><p>Let’s use the ver command to determine the operating system (OS) version. The terminal below shows an example output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*w95RMwB2SwkxWcHma_KyAg.png" /></figure><p>Before moving on, it is good to mention a couple of tricks.</p><p>First, you can pipe it through more if the output is too long. Then, you can view it page after page by pressing the space bar button. To demonstrate this, try running driverquery and compare it with running driverquery | more. In the latter, you can display the output page by page and you can exit it using CTRL + C.</p><ul><li>help - Provides help information for a specific command</li><li>cls - Clears the Command Prompt screen.</li></ul><h3>Answer the questions below</h3><ol><li>What is the OS version of the Windows VM?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*VD2qvfo912g1w-cwDDmkdg.png" /></figure><p>ANSWER: <strong>10.0.20348.2655</strong></p><p>2. What is the hostname of the Windows VM?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*supkkkjC9hTw3jqZsRrXmA.png" /></figure><p>ANSWER: <strong>WINSRV2022-CORE</strong></p><h3>Task 3: Network Troubleshooting</h3><p>Most of us are used to looking up MS Windows network configuration from the GUI interface. The command-line interface provides many networking-related commands to look up your current configuration, check ongoing connections, and troubleshoot networking issues.</p><h3>Network Configuration</h3><p>You can check your network information using ipconfig. The terminal output below shows our IP address, subnet mask, and default gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*sSSdHwuyrinj-MeKVNy3JQ.png" /></figure><p>You can also use ipconfig /all for more information about your network configuration. As shown in the terminal below, we can view our DNS servers and confirm that DHCP is enabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*F_-H2i1MRARBtHn7eWQyPw.png" /></figure><h3>Network Troubleshooting</h3><p>One common troubleshooting task is checking if the server can access a particular server on the Internet. The command syntax is ping target_name. Inspired by ping-pong, we send a specific ICMP packet and listen for a response. If a response is received, we know that we can reach the target and that the target can reach us.</p><p>Let’s find out if we reach example.com. In the terminal output below, we can see that we have successfully received four replies. Furthermore, we got some statistics; for instance, the average round trip time is 78 milliseconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*HA9vVPALm8EMnypU_arbEA.png" /></figure><p>Another valuable tool for troubleshooting is tracert, which stands for <em>trace route</em>. The command tracert target_name traces the network route traversed to reach the target. Without getting into more details, it expects the routers on the path to notify us if they drop a packet because its time-to-live (TTL) has reached zero. The terminal output below shows that we passed through 15 routers before reaching our target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*g2hYUybihxmgdzbFcWZQDA.png" /></figure><h3>More Networking Commands</h3><p>One networking command worth knowing is nslookup. It looks up a host or domain and returns its IP address. The syntax nslookup example.com will look up example.com using the default name server; however, nslookup example.com 1.1.1.1 will use the name server one.one.one.one. The terminal below shows the output of both commands. The results are identical; however, you can see that the answers were retrieved from different name servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*NoSI0qWsB206-jVYtl6UIQ.png" /></figure><p>The final networking command we will cover in this room is netstat. This command displays current network connections and listening ports. A basic netstat command with no arguments will show you established connections, as shown below. In this case, we only have one SSH connection; we figured out it is SSH because it is bound to port 22.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*ntHjtKlnWtvrMCM2oCWPew.png" /></figure><p>If you are curious about the other options, you can run netstat -h, where -h displays the help page. We opted for the following options:</p><ul><li>-a displays all established connections and listening ports</li><li>-b shows the program associated with each listening port and established connection</li><li>-o reveals the process ID (PID) associated with the connection</li><li>-n uses a numerical form for addresses and port numbers</li></ul><p>We combine these four options and execute the netstat -abon command. The result is quite long, but we display the first few lines in the terminal below. It is clear now that the executable sshd.exe is responsible for listening for incoming connections on port 22, as shown in the first line. We can also see the process ID (PID) associated with each connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*bywAr7hzE3Xzb-BpsYa3SA.png" /></figure><h3>Answer the questions below</h3><ol><li>Which command can we use to look up the server’s physical address (MAC address)?(<strong>HINT:</strong>Use ipconfig)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*Wy2kM1qGUENfwttNZr0QIA.png" /></figure><p>ANSWER: <strong>ipconfig/all</strong></p><p>2. What is the name of the process listening on port 3389?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*1-oY6Ju7OYfYcnamGmu6vw.png" /><figcaption><strong>Run: </strong>netstat -abon</figcaption></figure><p>ANSWER: <strong>TermService</strong></p><p>3. What is the subnet mask?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*roUuK6lVV-LULgHn_YRViw.png" /><figcaption>Run: Ipconfig</figcaption></figure><p>ANSWER: <strong>255.255.0.0</strong></p><h3>Task 4: File and Disk Management</h3><p>You have learned to look up basic system information and check the network configuration. Now, let’s discover how to browse the directories and move files around.</p><h3>Working With Directories</h3><p>You can use cd without parameters to display the current drive and directory. It is the equivalent of asking the system, <em>where am I?</em></p><p>You can view the child directories using dir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*dqVxpSLfMdU-3QziwcpYIg.png" /></figure><p>Note that you can use the following options with dir:</p><ul><li>dir /a - Displays hidden and system files as well.</li><li>dir /s - Displays files in the current directory and all subdirectories.</li></ul><p>You can type tree to visually represent the child directories and subdirectories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*QuknH1aCSFQMzFthCwXjeQ.png" /></figure><p>You can change to any directory by using the command cd target_directory; this is equivalent to double-clicking the target_directory on your desktop. Furthermore, you can use cd .. to go up one level. An example is shown in the terminal output below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*U4CuLk2yuPjLr66jbqngBA.png" /></figure><p>To create a directory, use mkdir directory_name; mkdir stands for <em>make directory</em>. To delete a directory, use rmdir directory_name; rmdir stands for <em>remove directory</em>. The terminal output below shows creating and deleting a directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*HHxtR54SJLHc_slS6ETVgg.png" /></figure><h3>Working With Files</h3><p>You are working with the command line. You are curious about the contents of a particular text file. You can easily view text files with the command type. This command will dump the contents of the text file on the screen; this is convenient for files that fit within your terminal window. You might want to consider more for longer text files. This command will display enough text file contents to fill your terminal window. In other words, for long text files, more will display a single page and wait for you to press Spacebar to move by one page (flip the page) or Enter to move by one line.</p><p>The copy command allows you to copy files from one location to another. The following terminal output provides an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*2JJWRZIv24PAcOfdxBB-ZQ.png" /></figure><p>Similarly, you can move files using the move command. An example is shown in the terminal output below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*b9QXmfxVZmIK6jmasCliIg.png" /></figure><p>Finally, we can delete a file using del or erase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*-o5BPFtZl7Qyhx1y6amlsQ.png" /></figure><p>We can use the wildcard character * to refer to multiple files. For example, copy *.md C:\Markdown will copy all files with the extension md to the directory C:\Markdown.</p><h3>Answer the questions below</h3><ol><li>What are the file’s contents in C:\Treasure\Hunt?</li></ol><p>Run:</p><blockquote>cd..<br>cd..<br>dir<br>cd Treasure<br>cd Hunt<br>type flag.txt</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*4ndk_G5LXKqbyxb9Wp-FNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*rx7ZIsH-joXkGNUTCMzbuQ.png" /></figure><p>ANSWER: THM{CLI_POWER}</p><h3>Task 5: Task and Process Management</h3><p>You must be familiar with MS Windows Task Manager and might be familiar with killing non-responsive processes. Let’s discover how to achieve a similar functionality using the command line.</p><p>We can list the running processes using tasklist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*ytHeZhIG85GKCqVaP_5TZA.png" /></figure><p>Some filtering is helpful because the output is expected to be very long. You can check all available filters by displaying the help page using tasklist /?. Let’s say that we want to search for tasks related to sshd.exe, we can do that with the command tasklist /FI &quot;imagename eq sshd.exe&quot;. Note that /FI is used to set the filter <em>image name equals</em> sshd.exe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*6HMMP5eE9qWUj03mlDSDig.png" /></figure><p>With the process ID (PID) known, we can terminate any task using taskkill /PID target_pid. For example, if we want to kill the process with PID 4567, we would issue the command taskkill /PID 4567.</p><h3>Answer the questions below</h3><ol><li>What command would you use to find the running processes related to notepad.exe?</li></ol><p>ANSWER: <strong>tasklist /FI “imagename eq notepad.exe”</strong></p><p>2. What command can you use to kill the process with PID 1516?</p><p>ANSWER: <strong>taskkill /PID 1516</strong></p><h3>Task 6: Conclusion</h3><p>In this room, we focused on the most practical commands for accessing a networked system over the command line.</p><p>We intentionally omitted a few common commands as we didn’t see a real value for including them in a beginner room. We mention them below so that you know that the command line can be used for other tasks.</p><ul><li>chkdsk: checks the file system and disk volumes for errors and bad sectors.</li><li>driverquery: displays a list of installed device drivers.</li><li>sfc /scannow: scans system files for corruption and repairs them if possible.</li></ul><p>It is important to remember all the commands covered in the previous tasks; moreover, it is equally important to know that /? can be used with most commands to display a help page.</p><p>In this room, we used the command more in two ways:</p><ul><li>Display text files: more file.txt</li><li>Pipe long output to view it page by page: some_command | more</li></ul><p>Equipped with this knowledge, we now know how to display the help page of a new command and how to display long output one page at a time.</p><p>Now that you know the Windows command line, it is time to move to the <a href="https://tryhackme.com/r/room/windowspowershell">Windows PowerShell</a> room.</p><h3>Answer the questions below</h3><ol><li>The command shutdown /s can shut down a system. What is the command you can use to restart a system?</li></ol><p>Run: shutdown?</p><p>ANSWER: <strong>shutdown /r</strong></p><p>2. What command can you use to abort a scheduled system shutdown?</p><p>ANSWER: <strong>shutdown /a</strong></p><p><strong>Thanks for reading! Until next time, take care!<br>Next Room: ‘</strong><a href="https://medium.com/@DE_SYNC/windows-powershell-tryhackme-writeups-by-deysnc-592a27f8afca">https://medium.com/@DE_SYNC/windows-powershell-tryhackme-writeups-by-deysnc-592a27f8afca</a><strong>’</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a99bcb88d8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Basics | TryHackMe Writeups | By DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/active-directory-basics-tryhackme-writeups-by-desync-1e9ed149feb5?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e9ed149feb5</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Fri, 09 May 2025 07:27:26 GMT</pubDate>
            <atom:updated>2025-05-17T11:23:46.780Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3YvpbilAoIWRXNUDNpnCOw.png" /></figure><h3>Active Directory Basics | TryHackMe Writeups | By D3SYNC</h3><p>This room will introduce the basic concepts and functionality provided by Active Directory.<br>Room Access: “<a href="https://tryhackme.com/room/winadbasics">https://tryhackme.com/room/winadbasics</a>”</p><h3>TASK 1: Introduction</h3><p>Microsoft’s Active Directory is the backbone of the corporate world. It simplifies the management of devices and users within a corporate environment. In this room, we’ll take a deep dive into the essential components of Active Directory.</p><p>Room Objectives</p><p>In this room, we will learn about Active Directory and will become familiar with the following topics</p><ul><li>What Active Directory is</li><li>What an Active Directory Domain is</li><li>What components go into an Active Directory Domain</li><li>Forests and Domain Trust</li><li>And much more!</li></ul><p>Room Prerequisites</p><ul><li>General familiarity with Windows. Check the <a href="https://tryhackme.com/module/windows-fundamentals">Windows Fundamentals module</a> for more information on this.</li></ul><h3>Answer the questions below</h3><p>Click and continue learning!</p><h3>Task 2: Windows Domains</h3><p>Picture yourself administering a small business network with only five computers and five employees. In such a tiny network, you will probably be able to configure each computer separately without a problem. You will manually log into each computer, create users for whoever will use them, and make specific configurations for each employee’s accounts. If a user’s computer stops working, you will probably go to their place and fix the computer on-site.</p><p>While this sounds like a very relaxed lifestyle, let’s suppose your business suddenly grows and now has 157 computers and 320 different users located across four different offices. Would you still be able to manage each computer as a separate entity, manually configure policies for each of the users across the network and provide on-site support for everyone? The answer is most likely no.</p><p>To overcome these limitations, we can use a Windows domain. Simply put, a <strong>Windows domain</strong> is a group of users and computers under the administration of a given business. The main idea behind a domain is to centralise the administration of common components of a Windows computer network in a single repository called <strong>Active Directory (AD)</strong>. The server that runs the Active Directory services is known as a <strong>Domain Controller (DC)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/0*ZRYuNBIBCDJh2OvK.png" /></figure><p>The main advantages of having a configured Windows domain are:</p><ul><li><strong>Centralised identity management:</strong> All users across the network can be configured from Active Directory with minimum effort.</li><li><strong>Managing security policies:</strong> You can configure security policies directly from Active Directory and apply them to users and computers across the network as needed.</li></ul><p>A Real-World Example</p><p>If this sounds a bit confusing, chances are that you have already interacted with a Windows domain at some point in your school, university or work.</p><p>In school/university networks, you will often be provided with a username and password that you can use on any of the computers available on campus. Your credentials are valid for all machines because whenever you input them on a machine, it will forward the authentication process back to the Active Directory, where your credentials will be checked. Thanks to Active Directory, your credentials don’t need to exist in each machine and are available throughout the network.</p><p>Active Directory is also the component that allows your school/university to restrict you from accessing the control panel on your school/university machines. Policies will usually be deployed throughout the network so that you don’t have administrative privileges over those computers.</p><p>Welcome to THM Inc.</p><p>During this task, we’ll assume the role of the new IT admin at THM Inc. As our first task, we have been asked to review the current domain “THM.local” and do some additional configurations. You will have administrative credentials over a pre-configured Domain Controller (DC) to do the tasks.</p><p>Be sure to click the <strong>Start Machine</strong> button below now, as you’ll use the same machine for all tasks. This should open a machine in your browser.</p><p><strong>START MACHINE</strong></p><p>Should you prefer to connect to it via RDP, you can use the following credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*TsnQFLkqU03Z-Tx2xMKqTQ.png" /></figure><p><strong>Note:</strong> When connecting via RDP, use THM\Administrator as the username to specify you want to log in using the user Administrator on the THM domain.</p><p>Since we will be connecting to the target machine via RDP, this is also a good time to start the AttackBox (unless you are using your own machine).</p><h3>Answer the questions below</h3><ol><li>In a Windows domain, credentials are stored in a centralised repository called…</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*uUAHO2YJq9sDkKUFgUdXcQ.png" /><figcaption>Fig 1</figcaption></figure><p>ANSWER: <strong>Active Directory</strong></p><p>2. The server in charge of running the Active Directory services is called…</p><blockquote>Refer to fig.1</blockquote><p>ANSWER: Domain Controller</p><h3>Task 3: Active Directory</h3><p>The core of any Windows Domain is the <strong>Active Directory Domain Service (AD DS)</strong>. This service acts as a catalogue that holds the information of all of the “objects” that exist on your network. Amongst the many objects supported by AD, we have users, groups, machines, printers, shares and many others. Let’s look at some of them:</p><p><strong><em>Users</em></strong></p><p>Users are one of the most common object types in Active Directory. Users are one of the objects known as <strong>security principals</strong>, meaning that they can be authenticated by the domain and can be assigned privileges over <strong>resources</strong> like files or printers. You could say that a security principal is an object that can act upon resources in the network.</p><p>Users can be used to represent two types of entities:</p><ul><li><strong>People:</strong> users will generally represent persons in your organisation that need to access the network, like employees.</li><li><strong>Services:</strong> you can also define users to be used by services like IIS or MSSQL. Every single service requires a user to run, but service users are different from regular users as they will only have the privileges needed to run their specific service.</li></ul><p><strong><em>Machines</em></strong></p><p>Machines are another type of object within Active Directory; for every computer that joins the Active Directory domain, a machine object will be created. Machines are also considered “security principals” and are assigned an account just as any regular user. This account has somewhat limited rights within the domain itself.</p><p>The machine accounts themselves are local administrators on the assigned computer, they are generally not supposed to be accessed by anyone except the computer itself, but as with any other account, if you have the password, you can use it to log in.</p><p><strong>Note:</strong> Machine Account passwords are automatically rotated out and are generally comprised of 120 random characters.</p><p>Identifying machine accounts is relatively easy. They follow a specific naming scheme. The machine account name is the computer’s name followed by a dollar sign. For example, a machine named DC01 will have a machine account called DC01$.</p><p><strong><em>Security Groups</em></strong></p><p>If you are familiar with Windows, you probably know that you can define user groups to assign access rights to files or other resources to entire groups instead of single users. This allows for better manageability as you can add users to an existing group, and they will automatically inherit all of the group’s privileges. Security groups are also considered security principals and, therefore, can have privileges over resources on the network.</p><p>Groups can have both users and machines as members. If needed, groups can include other groups as well.</p><p>Several groups are created by default in a domain that can be used to grant specific privileges to users. As an example, here are some of the most important groups in a domain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*otPkCatnXJ5ciJJlri7xyg.png" /><figcaption>Fig 2</figcaption></figure><p>You can obtain the complete list of default security groups from the <a href="https://docs.microsoft.com/en-us/windows/security/identity-protection/access-control/active-directory-security-groups">Microsoft documentation</a>.</p><p>Active Directory Users and Computers</p><p>To configure users, groups or machines in Active Directory, we need to log in to the Domain Controller and run “Active Directory Users and Computers” from the start menu:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/0*rN5fo8hScooacFpZ.png" /></figure><p>This will open up a window where you can see the hierarchy of users, computers and groups that exist in the domain. These objects are organised in <strong>Organizational Units (OUs)</strong> which are container objects that allow you to classify users and machines. OUs are mainly used to define sets of users with similar policing requirements. The people in the Sales department of your organisation are likely to have a different set of policies applied than the people in IT, for example. Keep in mind that a user can only be a part of a single OU at a time.</p><p>Checking our machine, we can see that there is already an OU called THM with four child OUs for the IT, Management, Marketing and Sales departments. It is very typical to see the OUs mimic the business&#39; structure, as it allows for efficiently deploying baseline policies that apply to entire departments. Remember that while this would be the expected model most of the time, you can define OUs arbitrarily. Feel free to right-click the THM OU and create a new OU under it called Students just for the fun of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*W_swYy0XHv3Ek1Da.png" /></figure><p>If you open any OUs, you can see the users they contain and perform simple tasks like creating, deleting or modifying them as needed. You can also reset passwords if needed (pretty useful for the helpdesk):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*iz5nBWoom4aoxwqs.png" /></figure><p>You probably noticed already that there are other default containers apart from the THM OU. These containers are created by Windows automatically and contain the following:</p><ul><li><strong>Builtin:</strong> Contains default groups available to any Windows host.</li><li><strong>Computers:</strong> Any machine joining the network will be put here by default. You can move them if needed.</li><li><strong>Domain Controllers:</strong> Default OU that contains the DCs in your network.</li><li><strong>Users:</strong> Default users and groups that apply to a domain-wide context.</li><li><strong>Managed Service Accounts:</strong> Holds accounts used by services in your Windows domain.</li></ul><p>Security Groups vs OUs</p><p>You are probably wondering why we have both groups and OUs. While both are used to classify users and computers, their purposes are entirely different:</p><ul><li><strong>OUs</strong> are handy for <strong>applying policies</strong> to users and computers, which include specific configurations that pertain to sets of users depending on their particular role in the enterprise. Remember, a user can only be a member of a single OU at a time, as it wouldn’t make sense to try to apply two different sets of policies to a single user.</li><li><strong>Security Groups</strong>, on the other hand, are used to <strong>grant permissions over resources</strong>. For example, you will use groups if you want to allow some users to access a shared folder or network printer. A user can be a part of many groups, which is needed to grant access to multiple resources.</li><li>groups, which is needed to grant access to multiple resources.</li></ul><h3>Answer the questions below</h3><ol><li>Which group normally administrates all computers and resources in a domain?</li></ol><blockquote>Refer: fig 2</blockquote><p>ANSWER: <strong>Domain Admins</strong></p><p>2. hat would be the name of the machine account associated with a machine named TOM-PC?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*9pvQnQday5cx9NSMkIukEg.png" /></figure><p>ANSWER: <strong>TOM-PC$</strong></p><p>3. Suppose our company creates a new department for Quality Assurance. What type of containers should we use to group all Quality Assurance users so that policies can be applied consistently to them?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*9DhYOxdH1Ole8rYnD516_g.png" /></figure><p>ANSWER: <strong>Organizational Units</strong></p><h3>Task 4: Managing Users in AD</h3><p>Your first task as the new domain administrator is to check the existing AD OUs and users, as some recent changes have happened to the business. You have been given the following organisational chart and are expected to make changes to the AD to match it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8FrWYHP2xUsgg0nh.png" /></figure><p>Deleting extra OUs and users</p><p>The first thing you should notice is that there is an additional department OU in your current AD configuration that doesn’t appear in the chart. We’ve been told it was closed due to budget cuts and should be removed from the domain. If you try to right-click and delete the OU, you will get the following error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/0*owHGgUgJiyrxo5x-.png" /></figure><p>By default, OUs are protected against accidental deletion. To delete the OU, we need to enable the <strong>Advanced Features</strong> in the View menu:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*db6-7h8Y0lA4cwdm.png" /></figure><p>This will show you some additional containers and enable you to disable the accidental deletion protection. To do so, right-click the OU and go to Properties. You will find a checkbox in the Object tab to disable the protection:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/0*lYgzraG61-4OtbEe.png" /></figure><p>Be sure to uncheck the box and try deleting the OU again. You will be prompted to confirm that you want to delete the OU, and as a result, any users, groups or OUs under it will also be deleted.</p><p>After deleting the extra OU, you should notice that for some of the departments, the users in the AD don’t match the ones in our organisational chart. Create and delete users as needed to match them.</p><p>Delegation</p><p>One of the nice things you can do in AD is to give specific users some control over some OUs. This process is known as <strong>delegation</strong> and allows you to grant users specific privileges to perform advanced tasks on OUs without needing a Domain Administrator to step in.</p><p>One of the most common use cases for this is granting IT support the privileges to reset other low-privilege users&#39; passwords. According to our organisational chart, Phillip is in charge of IT support, so we&#39;d probably want to delegate the control of resetting passwords over the Sales, Marketing and Management OUs to him.</p><p>For this example, we will delegate control over the Sales OU to Phillip. To delegate control over an OU, you can right-click it and select <strong>Delegate Control</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/0*6bp4TAKgauxsw5xK.png" /></figure><p>This should open a new window where you will first be asked for the users to whom you want to delegate control:</p><p><strong>Note:</strong> To avoid mistyping the user’s name, write “phillip” and click the <strong>Check Names</strong> button. Windows will autocomplete the user for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*gLUZ7lmuyW1NYfXb.png" /></figure><p>Click OK, and on the next step, select the following option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/0*ZnDw38CJwRS8UxKt.png" /></figure><p>Click next a couple of times, and now Phillip should be able to reset passwords for any user in the sales department. While you’d probably want to repeat these steps to delegate the password resets of the Marketing and Management departments, we’ll leave it here for this task. You are free to continue to configure the rest of the OUs if you so desire.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*MoYIR9OZ8ZluOvdq8UPhxQ.png" /><figcaption>Now let’s use Phillip’s account to try and reset Sophie’s password. Here are Phillip’s credentials for you to log in via RDP:</figcaption></figure><p><strong>Note:</strong> When connecting via RDP, use THM\phillip as the username to specify you want to log in using the user phillip on the THM domain.</p><p>While you may be tempted to go to <strong>Active Directory Users and Computers</strong> to try and test Phillip’s new powers, he doesn’t really have the privileges to open it, so you’ll have to use other methods to do password resets. In this case, we will be using Powershell to do so:</p><p>WindowsPowerShell(As Phillip)</p><pre>PS C:\Users\phillip&gt; Set-ADAccountPassword sophie -Reset -NewPassword (Read-Host -AsSecureString -Prompt &#39;New Password&#39;) -Verbose</pre><pre>New Password: *********</pre><pre>VERBOSE: Performing the operation &quot;Set-ADAccountPassword&quot; on target &quot;CN=Sophie,OU=Sales,OU=THM,DC=thm,DC=local&quot;.</pre><p>Since we wouldn’t want Sophie to keep on using a password we know, we can also force a password reset at the next logon with the following command:</p><p>WindowsPowerShell(as Phillip)</p><pre>PS C:\Users\phillip&gt; Set-ADUser -ChangePasswordAtLogon $true -Identity sophie -Verbose</pre><pre>VERBOSE: Performing the operation &quot;Set&quot; on target &quot;CN=Sophie,OU=Sales,OU=THM,DC=thm,DC=local&quot;.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/0*eLba7cWH5dSwBCRx.png" /></figure><p>Log into Sophie’s account with your new password and retrieve a flag from Sophie’s desktop.</p><p><strong>Note:</strong> When connecting via RDP, use THM\sophie as the username to specify you want to log in using the user sophie on the THM domain.</p><h3>Answer the questions below</h3><ol><li>What was the flag found on Sophie’s desktop?</li></ol><blockquote>“First, open Remote Desktop Connection (RDC) and enter the IP address of your target machine. Then, click on Connect.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*U1-slSMiWSuGzzHKbehngQ.png" /></figure><blockquote>“Log in using the credentials: username phillip and password Claire2008.&quot;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*7d1tvQ2uu1zI5Tx-wB3x8Q.png" /></figure><p>“Once you’re inside Phillip’s computer, open PowerShell and run the following command to reset Sophie’s password:</p><blockquote>Set-ADAccountPassword sophie -Reset -NewPassword (Read-Host -AsSecureString -Prompt ‘New Password’) -Verbose</blockquote><p>When prompted, enter a new password such as THM@123 (or any secure password of your choice).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UybbPBPg3zsxK0C4MkNfxQ.png" /><figcaption>Powershell overview</figcaption></figure><p>“Next, disconnect from the Remote Desktop session.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*U1-slSMiWSuGzzHKbehngQ.png" /></figure><p>“Reconnect using Remote Desktop and log in with Sophie’s credentials:<br> Username: sophie<br> Password: THM@123 (or the password you previously set).&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXgYNkmxftQ7olAOpnO38g.png" /></figure><p>“And just like that, you’re in!”</p><p>Re-login to Philip’s PC and run the second PowerShell command to initiate a password reset prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*HyDmcziTDNcQN1qdKVj_bg.png" /></figure><p>“When prompted to change the password upon login, enter a new one such as THM@456 (or any password of your choice).&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*WlyAvKxa0x-6phuDqKCL5w.png" /><figcaption>Sophie’s POV</figcaption></figure><p>Answer: <strong>THM{thanks_for_contacting_support}</strong></p><p>2. The process of granting privileges to a user over some OU or other AD Object is called…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*wQ2wkmzXHjJbkoeMF6d9Tw.png" /></figure><p>ANSWER: <strong>Delegation</strong></p><h3>Task 5: Managing Computers in AD</h3><p>By default, all the machines that join a domain (except for the DCs) will be put in the container called “Computers”. If we check our DC, we will see that some devices are already there:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*6Mqd6NPK0yn7NCNF.png" /></figure><p>We can see some servers, some laptops and some PCs corresponding to the users in our network. Having all of our devices there is not the best idea since it’s very likely that you want different policies for your servers and the machines that regular users use on a daily basis.</p><p>While there is no golden rule on how to organise your machines, an excellent starting point is segregating devices according to their use. In general, you’d expect to see devices divided into at least the three following categories:</p><p><strong>1. Workstations</strong></p><p>Workstations are one of the most common devices within an Active Directory domain. Each user in the domain will likely be logging into a workstation. This is the device they will use to do their work or normal browsing activities. These devices should never have a privileged user signed into them.</p><p><strong>2. Servers</strong></p><p>Servers are the second most common device within an Active Directory domain. Servers are generally used to provide services to users or other servers.</p><p><strong>3. Domain Controllers</strong></p><p>Domain Controllers are the third most common device within an Active Directory domain. Domain Controllers allow you to manage the Active Directory Domain. These devices are often deemed the most sensitive devices within the network as they contain hashed passwords for all user accounts within the environment.</p><p>Since we are tidying up our AD, let’s create two separate OUs for Workstations and Servers (Domain Controllers are already in an OU created by Windows). We will be creating them directly under the thm.local domain container. In the end, you should have the following OU structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*0tbvVIUH6pGIaAV7.png" /></figure><p>Now, move the personal computers and laptops to the Workstations OU and the servers to the Servers OU from the Computers container. Doing so will allow us to configure policies for each OU later.</p><h3>Answer the questions below</h3><ol><li>After organising the available computers, how many ended up in the Workstations OU?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*ZcAjR6-3obLF2xIajY58_A.png" /><figcaption>Right click on Thm local &lt; New &lt; Organizational Unit</figcaption></figure><p>Do it twice for Workstations &amp; Servers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*S1g_ULLPry9-ZGzj6fPbGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*8OMnTurpcLFAyq8m6O4Iew.png" /><figcaption>Right click &amp; use the move option to divide</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*lShq9HBXnSAY82dDMZ_oUg.png" /></figure><p>ANSWER: <strong>7</strong></p><p>2. Is it recommendable to create separate OUs for Servers and Workstations? (yay/nay)</p><p>ANSWER: <strong>Yay</strong></p><h3>Task 6: Group Policies</h3><p>So far, we have organised users and computers in OUs just for the sake of it, but the main idea behind this is to be able to deploy different policies for each OU individually. That way, we can push different configurations and security baselines to users depending on their department.</p><p>Windows manages such policies through <strong>Group Policy Objects (GPO)</strong>. GPOs are simply a collection of settings that can be applied to OUs. GPOs can contain policies aimed at either users or computers, allowing you to set a baseline on specific machines and identities.</p><p>To configure GPOs, you can use the <strong>Group Policy Management</strong> tool, available from the start menu:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/0*8KeLcYSGyi-H4-IZ.png" /></figure><p>The first thing you will see when opening it is your complete OU hierarchy, as defined before. To configure Group Policies, you first create a GPO under <strong>Group Policy Objects</strong> and then link it to the OU where you want the policies to apply. As an example, you can see there are some already existing GPOs in your machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*DcXy6_CzEIY0RxXi.png" /></figure><p>We can see in the image above that 3 GPOs have been created. From those, the Default Domain Policy and RDP Policy are linked to the thm.local domain as a whole, and the Default Domain Controllers Policy is linked to the Domain Controllers OU only. Something important to have in mind is that any GPO will apply to the linked OU and any sub-OUs under it. For example, the Sales OU will still be affected by the Default Domain Policy.</p><p>Let’s examine the Default Domain Policy to see what&#39;s inside a GPO. The first tab you&#39;ll see when selecting a GPO shows its <strong>scope</strong>, which is where the GPO is linked in the AD. For the current policy, we can see that it has only been linked to the thm.local domain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*BLYpklZwjzII-sWt.png" /></figure><p>As you can see, you can also apply <strong>Security Filtering</strong> to GPOs so that they are only applied to specific users/computers under an OU. By default, they will apply to the <strong>Authenticated Users</strong> group, which includes all users/PCs.</p><p>The <strong>Settings</strong> tab includes the actual contents of the GPO and lets us know what specific configurations it applies. As stated before, each GPO has configurations that apply to computers only and configurations that apply to users only. In this case, the Default Domain Policy only contains Computer Configurations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*wW7j9XH3RF2s9zkg.png" /></figure><p>Feel free to explore the GPO and expand on the available items using the “show” links on the right side of each configuration. In this case, the Default Domain Policy indicates really basic configurations that should apply to most domains, including password and account lockout policies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*gsb0UQmc0bNAxvn_.png" /></figure><p>Since this GPO applies to the whole domain, any change to it would affect all computers. Let’s change the minimum password length policy to require users to have at least 10 characters in their passwords. To do this, right-click the GPO and select <strong>Edit</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/0*VbKuUONEw8hOaXsh.png" /></figure><p>This will open a new window where we can navigate and edit all the available configurations. To change the minimum password length, go to Computer Configurations -&gt; Policies -&gt; Windows Setting -&gt; Security Settings -&gt; Account Policies -&gt; Password Policy and change the required policy value:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*yd4EUFpRJLdAmhbX.png" /></figure><p>As you can see, plenty of policies can be established in a GPO. While explaining every single of them would be impossible in a single room, do feel free to explore a bit, as some of the policies are straightforward. If more information on any of the policies is needed, you can double-click them and read the <strong>Explain</strong> tab on each of them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/0*l38imZGsXZ27ytzi.png" /></figure><p><strong>GPO distribution</strong></p><p>GPOs are distributed to the network via a network share called SYSVOL, which is stored in the DC. All users in a domain should typically have access to this share over the network to sync their GPOs periodically. The SYSVOL share points by default to the C:\Windows\SYSVOL\sysvol\ directory on each of the DCs in our network.</p><p>Once a change has been made to any GPOs, it might take up to 2 hours for computers to catch up. If you want to force any particular computer to sync its GPOs immediately, you can always run the following command on the desired computer:</p><p><strong>WindowsPowerShell</strong></p><p>As part of our new job, we have been tasked with implementing some GPOs to allow us to:</p><ol><li>Block non-IT users from accessing the Control Panel.</li><li>Make workstations and servers lock their screen automatically after 5 minutes of user inactivity to avoid people leaving their sessions exposed.</li></ol><p>Let’s focus on each of those and define what policies we should enable in each GPO and where they should be linked.</p><p><strong><em>Restrict Access to Control Panel</em></strong></p><p>We want to restrict access to the Control Panel across all machines to only the users that are part of the IT department. Users of other departments shouldn’t be able to change the system’s preferences.</p><p>Let’s create a new GPO called Restrict Control Panel Access and open it for editing. Since we want this GPO to apply to specific users, we will look under User Configuration for the following policy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*kCigO32MtSpxbrAX.png" /></figure><p>Notice we have enabled the <strong>Prohibit Access to Control Panel and PC settings</strong> policy.</p><p>Once the GPO is configured, we will need to link it to all of the OUs corresponding to users who shouldn’t have access to the Control Panel of their PCs. In this case, we will link the Marketing, Management and Sales OUs by dragging the GPO to each of them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*O9pxHtCnWaAmWzjp.png" /></figure><p><strong><em>Auto Lock Screen GPO</em></strong></p><p>For the first GPO, regarding screen locking for workstations and servers, we could directly apply it over the Workstations, Servers and Domain Controllers OUs we created previously.</p><p>While this solution should work, an alternative consists of simply applying the GPO to the root domain, as we want the GPO to affect all of our computers. Since the Workstations, Servers and Domain Controllers OUs are all child OUs of the root domain, they will inherit its policies.</p><p><strong>Note:</strong> You might notice that if our GPO is applied to the root domain, it will also be inherited by other OUs like Sales or Marketing. Since these OUs contain users only, any Computer Configuration in our GPO will be ignored by them.</p><p>Let’s create a new GPO, call it Auto Lock Screen, and edit it. The policy to achieve what we want is located in the following route:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*6JZudfz9l9QVo8FW.png" /></figure><p>We will set the inactivity limit to 5 minutes so that computers get locked automatically if any user leaves their session open. After closing the GPO editor, we will link the GPO to the root domain by dragging the GPO to it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*fk_WoTSxui1mxobm.png" /></figure><p>Once the GPOs have been applied to the correct OUs, we can log in as any users in either Marketing, Sales or Management for verification. For this task, let’s connect via RDP using Mark’s credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*dWDhgShEQE6YjzpeIXopSg.png" /></figure><p><strong>Note:</strong> When connecting via RDP, use THM\Mark as the username to specify you want to log in using the user Mark on the THM domain.</p><p>If we try opening the Control Panel, we should get a message indicating this operation is denied by the administrator. You can also wait 5 minutes to check if the screen is automatically locked if you want.</p><p>Since we didn’t apply the control panel GPO on IT, you should still be able to log into the machine as any of those users and access the control panel.</p><p><strong>Note:</strong> If you created and linked the GPOs, but for some reason, they still don’t work, remember you can run gpupdate /force to force GPOs to be updated.</p><h3>Answer the questions below</h3><ol><li>What is the name of the network share used to distribute GPOs to domain machines?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*0_VuhExmBmgTl0tSgPCPQw.png" /></figure><p>ANSWER: <strong>sysvol</strong></p><p>2.Can a GPO be used to apply settings to users and computers? (yay/nay)</p><p>ANSWER: <strong>Yay</strong></p><h3>Task 7: Authentication Methods</h3><p>When using Windows domains, all credentials are stored in the Domain Controllers. Whenever a user tries to authenticate to a service using domain credentials, the service will need to ask the Domain Controller to verify if they are correct. Two protocols can be used for network authentication in windows domains:</p><ul><li><strong>Kerberos:</strong> Used by any recent version of Windows. This is the default protocol in any recent domain.</li><li><strong>NetNTLM:</strong> Legacy authentication protocol kept for compatibility purposes.</li></ul><p>While NetNTLM should be considered obsolete, most networks will have both protocols enabled. Let’s take a deeper look at how each of these protocols works.</p><p>Kerberos Authentication</p><p>Kerberos authentication is the default authentication protocol for any recent version of Windows. Users who log into a service using Kerberos will be assigned tickets. Think of tickets as proof of a previous authentication. Users with tickets can present them to a service to demonstrate they have already authenticated into the network before and are therefore enabled to use it.</p><p>When Kerberos is used for authentication, the following process happens:</p><ol><li>The user sends their username and a timestamp encrypted using a key derived from their password to the <strong>Key Distribution Center (KDC)</strong>, a service usually installed on the Domain Controller in charge of creating Kerberos tickets on the network.</li><li>The KDC will create and send back a <strong>Ticket Granting Ticket (TGT)</strong>, which will allow the user to request additional tickets to access specific services. The need for a ticket to get more tickets may sound a bit weird, but it allows users to request service tickets without passing their credentials every time they want to connect to a service. Along with the TGT, a <strong>Session Key</strong> is given to the user, which they will need to generate the following requests.</li><li>Notice the TGT is encrypted using the <strong>krbtgt</strong> account’s password hash, and therefore the user can’t access its contents. It is essential to know that the encrypted TGT includes a copy of the Session Key as part of its contents, and the KDC has no need to store the Session Key as it can recover a copy by decrypting the TGT if needed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YZ9ekkeptOrlBRn2.png" /></figure><ol><li>When a user wants to connect to a service on the network like a share, website or database, they will use their TGT to ask the KDC for a <strong>Ticket Granting Service (TGS)</strong>. TGS are tickets that allow connection only to the specific service they were created for. To request a TGS, the user will send their username and a timestamp encrypted using the Session Key, along with the TGT and a <strong>Service Principal Name (SPN),</strong> which indicates the service and server name we intend to access.</li><li>As a result, the KDC will send us a TGS along with a <strong>Service Session Key</strong>, which we will need to authenticate to the service we want to access. The TGS is encrypted using a key derived from the <strong>Service Owner Hash</strong>. The Service Owner is the user or machine account that the service runs under. The TGS contains a copy of the Service Session Key on its encrypted contents so that the Service Owner can access it by decrypting the TGS.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I6i6vA-pvqiFhnQ3.png" /></figure><ol><li>The TGS can then be sent to the desired service to authenticate and establish a connection. The service will use its configured account’s password hash to decrypt the TGS and validate the Service Session Key.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dx1-Y2HukWO5eyMz.png" /></figure><p>NetNTLM Authentication</p><p>NetNTLM works using a challenge-response mechanism. The entire process is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zlCJySvxpkbE6sAh.png" /></figure><ol><li>The client sends an authentication request to the server they want to access.</li><li>The server generates a random number and sends it as a challenge to the client.</li><li>The client combines their NTLM password hash with the challenge (and other known data) to generate a response to the challenge and sends it back to the server for verification.</li><li>The server forwards the challenge and the response to the Domain Controller for verification.</li><li>The domain controller uses the challenge to recalculate the response and compares it to the original response sent by the client. If they both match, the client is authenticated; otherwise, access is denied. The authentication result is sent back to the server.</li><li>The server forwards the authentication result to the client.</li></ol><p>Note that the user’s password (or hash) is never transmitted through the network for security.</p><p><strong>Note:</strong> The described process applies when using a domain account. If a local account is used, the server can verify the response to the challenge itself without requiring interaction with the domain controller since it has the password hash stored locally on its SAM.</p><h3>Answer the questions below</h3><ol><li>Will a current version of Windows use NetNTLM as the preferred authentication protocol by default? (yay/nay)</li></ol><p>ANSWER: <strong>nay</strong></p><p>2. When referring to Kerberos, what type of ticket allows us to request further tickets known as TGS?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*LG9WVoHqwEUAb0yWbey5bg.png" /></figure><p>ANSWER: <strong>Ticket Granting Ticket</strong></p><p>3. When using NetNTLM, is a user’s password transmitted over the network at any point? (yay/nay)</p><p>ANSWER: nay</p><h3>Task 8: Trees, Forests and Trusts</h3><p>So far, we have discussed how to manage a single domain, the role of a Domain Controller and how it joins computers, servers and users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/0*CDEXILAvTTlHYOXk.png" /></figure><p>As companies grow, so do their networks. Having a single domain for a company is good enough to start, but in time some additional needs might push you into having more than one.</p><p>Trees</p><p>Imagine, for example, that suddenly your company expands to a new country. The new country has different laws and regulations that require you to update your GPOs to comply. In addition, you now have IT people in both countries, and each IT team needs to manage the resources that correspond to each country without interfering with the other team. While you could create a complex OU structure and use delegations to achieve this, having a huge AD structure might be hard to manage and prone to human errors.</p><p>Luckily for us, Active Directory supports integrating multiple domains so that you can partition your network into units that can be managed independently. If you have two domains that share the same namespace (thm.local in our example), those domains can be joined into a <strong>Tree</strong>.</p><p>If our thm.local domain was split into two subdomains for UK and US branches, you could build a tree with a root domain of thm.local and two subdomains called uk.thm.local and us.thm.local, each with its AD, computers and users:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5CCeH_RDxpnygpOG.png" /></figure><p>This partitioned structure gives us better control over who can access what in the domain. The IT people from the UK will have their own DC that manages the UK resources only. For example, a UK user would not be able to manage US users. In that way, the Domain Administrators of each branch will have complete control over their respective DCs, but not other branches’ DCs. Policies can also be configured independently for each domain in the tree.</p><p>A new security group needs to be introduced when talking about trees and forests. The <strong>Enterprise Admins</strong> group will grant a user administrative privileges over all of an enterprise’s domains. Each domain would still have its Domain Admins with administrator privileges over their single domains and the Enterprise Admins who can control everything in the enterprise.</p><p>Forests</p><p>The domains you manage can also be configured in different namespaces. Suppose your company continues growing and eventually acquires another company called MHT Inc. When both companies merge, you will probably have different domain trees for each company, each managed by its own IT department. The union of several trees with different namespaces into the same network is known as a <strong>forest</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3LYIzHYczuhav4Vi.png" /></figure><p>Trust Relationships</p><p>Having multiple domains organised in trees and forest allows you to have a nice compartmentalised network in terms of management and resources. But at a certain point, a user at THM UK might need to access a shared file in one of MHT ASIA servers. For this to happen, domains arranged in trees and forests are joined together by <strong>trust relationships</strong>.</p><p>In simple terms, having a trust relationship between domains allows you to authorise a user from domain THM UK to access resources from domain MHT EU.</p><p>The simplest trust relationship that can be established is a <strong>one-way trust relationship</strong>. In a one-way trust, if Domain AAA trusts Domain BBB, this means that a user on BBB can be authorised to access resources on AAA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/0*-gqRobW9KBudCJuU.png" /></figure><p>The direction of the one-way trust relationship is contrary to that of the access direction.</p><p><strong>Two-way trust relationships</strong> can also be made to allow both domains to mutually authorise users from the other. By default, joining several domains under a tree or a forest will form a two-way trust relationship.</p><p>It is important to note that having a trust relationship between domains doesn’t automatically grant access to all resources on other domains. Once a trust relationship is established, you have the chance to authorise users across different domains, but it’s up to you what is actually authorised or not.</p><h3>Answer the questions below</h3><ol><li>What is a group of Windows domains that share the same namespace called?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*jG6R6aNQ1RE1L_2zy82wAw.png" /></figure><p>ANSWER: <strong>Tree</strong></p><p>2. What should be configured between two domains for a user in Domain A to access a resource in Domain B?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zKm8fUN6fvMzyRZ8tM9d5w.png" /></figure><p>ANSWER: <strong>A Trust Relationship</strong></p><h3>Task 9: Conclusion</h3><p>In this room, we have shown the basic components and concepts related to Active Directories and Windows Domains. Keep in mind that this room should only serve as an introduction to the basic concepts, as there’s quite a bit more to explore to implement a production-ready Active Directory environment.</p><p>If you are interested in learning how to secure an Active Directory installation, be sure to check out the <a href="https://tryhackme.com/room/activedirectoryhardening">Active Directory Hardening Room</a>. If, on the other hand, you’d like to know how attackers can take advantage of common AD misconfigurations and other AD hacking techniques, the <a href="https://tryhackme.com/module/hacking-active-directory">Compromising Active Directory module</a> is the way to go.</p><p><strong>Thanks for reading! Stay tuned for more insights and updates. Until next time, take care!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e9ed149feb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pre Security | TryHackMe Writeups | By D3SYNC]]></title>
            <link>https://medium.com/@D3SYNCx/pre-security-dfd120d446a1?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfd120d446a1</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Fri, 09 May 2025 05:57:33 GMT</pubDate>
            <atom:updated>2025-05-17T11:25:58.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lqA8PSGPQq7YajMVKAPDtg.png" /></figure><h3>Search Skills| TryHackMe Writeups | By D3SYNC</h3><p>This learning path will teach you the pre-requisite technical knowledge to get started in cyber security. To attack or defend any technology, you have to first learn how this technology works.</p><p>The Pre-Security learning path is a beginner friendly and fun way to learn the basics. Your cyber security learning journey starts here!<br><strong>Room Access:</strong> “<a href="https://tryhackme.com/room/searchskills">https://tryhackme.com/room/searchskills</a>”</p><h3>TASK 1: Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*KYecA_mihFn1cu3z4KRImQ.png" /></figure><p>quick Google search for “learn cyber security” returned around 600 million hits, while a search for “learn hacking” returned more than double that number! The number might have grown even further when you go through this room.</p><p>We are surrounded by information. Do you prefer to surrender in the face of information overload and accept the first few results you get? Or do you like to acquire the necessary search skills to find and access what you are looking for? This room aims to help you with the latter.</p><h3>Learning Objectives</h3><p>The goal of this room is to teach:</p><ul><li>Evaluate information sources</li><li>Use search engines efficiently</li><li>Explore specialized search engines</li><li>Read technical documentation</li><li>Make use of social media</li><li>Check news outlets</li></ul><h3>Answer the questions below</h3><ol><li>Check how many results you get when searching for <strong>learn hacking</strong>. At the time of writing, we got 1.5 billion results when searching on Google.</li></ol><blockquote>Well, just search — it’s a question meant to encourage engagement.</blockquote><p>ANSWER: <strong>No need to answer.</strong></p><h3>TASK 2: Evaluation of Search Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*crhW9oYkm2WKZVmF" /></figure><p>On the Internet, everyone can publish their writings. It can be in the form of blog posts, articles, or social media posts. It can be even in more subtle ways, such as by editing a public wiki page. This ability makes it possible for anyone to voice their unfounded claims. Everyone can express their opinion about best cyber security practices, future programming trends, and how to best prepare for a DevSecOps interview.</p><p>It is our job, as readers, to evaluate the information. We will mention a few things to consider when evaluating information:</p><ul><li><strong>Source</strong>: Identify the author or organization publishing the information. Consider whether they are reputable and authoritative on the subject matter. Publishing a blog post does not make one an authority on the subject.</li><li><strong>Evidence and reasoning</strong>: Check whether the claims are backed by credible evidence and logical reasoning. We are seeking hard facts and solid arguments.</li><li><strong>Objectivity and bias</strong>: Evaluate whether the information is presented impartially and rationally, reflecting multiple perspectives. We are not interested in authors pushing shady agendas, whether to promote a product or attack a rival.</li><li><strong>Corroboration and consistency</strong>: Validate the presented information by corroboration from multiple independent sources. Check whether multiple reliable and reputable sources agree on the central claims.</li></ul><h3>Answer the questions below</h3><ol><li>What do you call a cryptographic method or product considered bogus or fraudulent? (<strong>HINT: </strong>Use your favourite search engine.)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*ApS-DVRuWsXC4EjVWouEVw.png" /><figcaption>Google Search</figcaption></figure><p>ANWER: <strong>Snake oil</strong></p><p>2. What is the name of the command replacing netstat in Linux systems?(<strong>HINT: </strong>Use your favourite search engine.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*kQ6WF8CkyJRYuK34sEDtSA.png" /><figcaption>Google Search</figcaption></figure><p>ANSWER: <strong>ss</strong></p><h3>TASK 3: Search Engines</h3><p>Every one of us has used an Internet search engine; however, not everyone has tried to harness the full power of an Internet search engine. Almost every Internet search engine allows you to carry out advanced searches. Consider the following examples:</p><ul><li><a href="https://www.google.com/advanced_search">Google</a></li><li><a href="https://support.microsoft.com/en-us/topic/advanced-search-options-b92e25f1-0085-4271-bdf9-14aaea720930">Bing</a></li><li><a href="https://duckduckgo.com/duckduckgo-help-pages/results/syntax/">DuckDuckGo</a></li></ul><p>Let’s consider the search operators supported by Google.</p><ul><li>&quot;exact phrase&quot;: Double quotes indicate that you are looking for pages with the exact word or phrase. For example, one might search for &quot;passive reconnaissance&quot; to get pages with this exact phrase.</li><li>site:: This operator lets you specify the domain name to which you want to limit your search. For example, we can search for success stories on TryHackMe using site:tryhackme.com success stories.</li><li>-: The minus sign allows you to omit search results that contain a particular word or phrase. For example, you might be interested in learning about the pyramids, but you don’t want to view tourism websites; one approach is to search for pyramids -tourism or -tourism pyramids.</li><li>filetype:: This search operator is indispensable for finding files instead of web pages. Some of the file types you can search for using Google are Portable Document Format (PDF), Microsoft Word Document (DOC), Microsoft Excel Spreadsheet (XLS), and Microsoft PowerPoint Presentation (PPT). For example, to find cyber security presentations, try searching for filetype:ppt cyber security.</li></ul><p>You can check more advanced controls in various search engines in this <a href="https://github.com/cipher387/Advanced-search-operators-list">advanced search operators list</a>; however, the above provides a good starting point. Check your favourite search engine for the supported search operators.</p><h3>Answer the questions below</h3><ol><li>How would you limit your Google search to PDF files containing the terms <strong>cyber warfare report</strong>? (HINT: Express your query as the search filter followed by the search terms.)</li></ol><blockquote>“According to the question and hint, we can limit our Google search using the filetype: operator. In this case, we use filetype:pdf followed by the search term — for example, cyber warfare report.&quot;</blockquote><p>ANSWER:<strong> filetype:pdf cyber warfare report</strong></p><p>2. What phrase does the Linux command ss stand for? (HINT: Use your <br>favourite search engine.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*J_eOgQqomEhzmpi8NK6xng.png" /></figure><p>ANSWER:<strong> Socket statistics</strong></p><h3>TASK 4: Specialized Search Engines</h3><p>You are familiar with Internet search engines; however, how much are you familiar with specialized search engines? By that, we refer to search engines used to find specific types of results.</p><h3>Shodan</h3><p>Let’s start with <a href="https://www.shodan.io/">Shodan</a>, a search engine for devices connected to the Internet. It allows you to search for specific types and versions of servers, networking equipment, industrial control systems, and IoT devices. You may want to see how many servers are still running Apache 2.4.1 and the distribution across countries. To find the answer, we can search for apache 2.4.1, which will return the list of servers with the string “apache 2.4.1” in their headers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s6mK_HfhDW_YIqR6" /></figure><p>Consider visiting Shodan <a href="https://www.shodan.io/search/examples">Search Query Examples</a> for more examples. Furthermore, you can check <a href="https://trends.shodan.io/">Shodan trends</a> for historical insights if you have a subscription.</p><h3>Censys</h3><p>At first glance, <a href="https://search.censys.io/">Censys</a> appears similar to Shodan. However, Shodan focuses on Internet-connected devices and systems, such as servers, routers, webcams, and IoT devices. Censys, on the other hand, focuses on Internet-connected hosts, websites, certificates, and other Internet assets. Some of its use cases include enumerating domains in use, auditing open ports and services, and discovering rogue assets within a network. You might want to check <a href="https://support.censys.io/hc/en-us/articles/20720064229140-Censys-Search-Use-Cases">Censys Search Use Cases</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5YRRugJx5vWsElkM" /></figure><h3>VirusTotal</h3><p><a href="https://www.virustotal.com/">VirusTotal</a> is an online website that provides a virus-scanning service for files using multiple antivirus engines. It allows users to upload files or provide URLs to scan them against numerous antivirus engines and website scanners in a single operation. They can even input file hashes to check the results of previously uploaded files.</p><p>The screenshot below shows the result of checking the submitted file against 67 antivirus engines. Furthermore, one can check the community’s comments for more insights. Occasionally, a file might be flagged as a virus or a Trojan; however, this might not be accurate for various reasons, and that’s when community members can provide a more in-depth explanation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OO1cJjyvdj2XfCoH" /></figure><h3>Have I Been Pwned</h3><p><a href="https://haveibeenpwned.com/">Have I Been Pwned</a> (HIBP) does one thing; it tells you if an email address has appeared in a leaked data breach. Finding one’s email within leaked data indicates leaked private information and, more importantly, passwords. Many users use the same password across multiple platforms, if one platform is breached, their password on other platforms is also exposed. Indeed, passwords are usually stored in encrypted format; however, many passwords are not that complex and can be recovered using a variety of attacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lJgXrwM3Gqwgkb-0" /></figure><h3>Answer the questions below</h3><ol><li>What is the top country with <strong>lighttpd</strong> servers?(HINT: Use shodan.io)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCSGng2wxhd158A9Tcx5Ow.png" /></figure><p>ANSWER: <strong>United States</strong></p><p>What does BitDefenderFalx detect the file with the hash 2de70ca737c1f4602517c555ddd54165432cf231ffc0e21fb2e23b9dd14e7fb4 as? (HINT: Use virustotal.com)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hI4egp9POEYlLKymhHFEAg.png" /></figure><p>ANSWER: <strong>Android.Riskware.Agent.LHH</strong></p><h3>Task 5: Vulnerabilities and Exploits</h3><h3>CVE</h3><p>We can think of the Common Vulnerabilities and Exposures (CVE) program as a dictionary of vulnerabilities. It provides a standardized identifier for vulnerabilities and security issues in software and hardware products. Each vulnerability is assigned a CVE ID with a standardized format like CVE-2024-29988. This unique identifier (CVE ID) ensures that everyone from security researchers to vendors and IT professionals is referring to the same vulnerability, <a href="https://nvd.nist.gov/vuln/detail/CVE-2024-29988">CVE-2024-29988</a> in this case.</p><p>The MITRE Corporation maintains the CVE system. For more information and to search for existing CVEs, visit the <a href="https://www.cve.org/">CVE Program</a> website. Alternatively, visit the <a href="https://nvd.nist.gov/">National Vulnerability Database</a> (NVD) website. The screenshot below shows CVE-2014–0160, also known as Heartbleed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OZtMKYdwmv5yOkoM" /></figure><h3>Exploit Database</h3><p>There are many reasons why you would want to exploit a vulnerable application; one would be assessing a company’s security as part of its red team. Needless to say, we should not try to exploit a vulnerable system unless we are given permission, usually via a legally binding agreement.</p><p>Now that we have permission to exploit a vulnerable system, we might need to find a working exploit code. One resource is the <a href="https://www.exploit-db.com/">Exploit Database</a>. The Exploit Database lists exploit codes from various authors; some of these exploit codes are tested and marked as verified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8kIW7MOaU7DEViXy" /></figure><p><a href="https://github.com/"><strong>GitHub</strong></a>, a web-based platform for software development, can contain many tools related to CVEs, along with proof-of-concept (PoC) and exploit codes. To demonstrate this idea, check the screenshot below of search results on GitHub that are related to the Heartbleed vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YzJkX71tls9sEpRN" /></figure><h3>Answer the questions below</h3><ol><li>What utility does CVE-2024–3094 refer to?</li></ol><blockquote>Recommended: Visit and search the site yourself at <a href="https://www.cve.org/">www.cve.org</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73p2TIrPks--CG3Br_G3Ig.png" /></figure><p>ANSWER: <strong>Xz</strong></p><h3>Task 6: Technical Documentation</h3><p>One vital skill to acquire is to look up official documentation. We will cover a few examples of official documentation pages.</p><h3>Linux Manual Pages</h3><p>Long before the Internet was everywhere, how would you get help using a command in a Linux or Unix-like system? The answer would be checking the manual page, man page for short. On Linux and every Unix-like system, each command is expected to have a man page. In fact, man pages also exist for system calls, library functions, and even configuration files.</p><p>Let’s say we want to check the manual page for the command ip. We issue the command man ip. The screenshot below shows the page we received. You might want to start the AttackBox and run man ip on the terminal. Press q to quit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eKT1fCOLvNLbJHLn" /></figure><p>If you prefer to read the man page of ip in your web browser, just type man ip in your favourite search engine. This <a href="https://linux.die.net/man/8/ip">page</a> might be at the top of the results.</p><p>The <strong>AttackBox</strong> is a Linux system accessible from your browser. Clicking on the <strong>Start AttackBox</strong> button will display the AttackBox in a split screen, making it convenient to read the task text and apply the instructions within the same browser window. If you hide the AttackBox window, you can show it again by clicking the blue Show Split View button at the top. In this task, you can start the AttackBox and use it to try Linux commands such as man.</p><h3>Microsoft Windows</h3><p>Microsoft provides an official <a href="https://learn.microsoft.com/">Technical Documentation</a> page for its products. The screenshot below shows the search results for the command ipconfig.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Pwoxc_i6zM8CgKma" /></figure><h3>Product Documentation</h3><p>Every popular product is expected to have well-organized documentation. This documentation provides an official and reliable source of information about the product features and functions. Examples include <a href="https://www.snort.org/documents">Snort Official Documentation</a>, <a href="https://httpd.apache.org/docs/">Apache HTTP Server Documentation</a>, <a href="https://www.php.net/manual/en/index.php">PHP Documentation</a>, and <a href="https://nodejs.org/docs/latest/api/">Node.js Documentation</a>.</p><p>It is always rewarding to check the official documentation as it is the most up-to-date and offers the most complete product information.</p><h3>Answer the questions below</h3><ol><li>What does the Linux command cat stand for? (<strong>HINT: </strong>Check its manual page.)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mabcN8dJ3esC888cwWSQtQ.png" /><figcaption>One of Linux Manual page’s available online</figcaption></figure><p>ANSWER: <strong>concatenate</strong></p><p>2. What is the netstat parameter in MS Windows that displays the executable associated with each active connection and listening port?</p><blockquote>“Try netstat -h to check for yourself.&quot;</blockquote><p>ANSWER: -b</p><h3>TASK 7: Social Media</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*BhXLsmr4p2iPyIKA6zlUhQ.png" /></figure><p>There are billions of users registered on social media platforms such as <a href="https://www.facebook.com/people/Tryhackme/100069557747714/">Facebook</a>, <a href="https://twitter.com/RealTryHackMe">Twitter</a>, and <a href="https://www.linkedin.com/company/tryhackme/">LinkedIn</a>. We expect you to be familiar with popular platforms. However, if you are aware of any platform you are not familiar with, we recommend that you check it out and learn about it. Ideally, one would want to explore a platform without creating an account; however, this severely limits your experience. Instead, one recommendation is to use a temporary email address to discover these platforms without linking them to your real email addresses; once done, you can terminate the accounts and associated email addresses. One reason for not using your primary account is that you don’t want your contacts to start connecting with you there when you are only temporarily exploring a platform.</p><p>The power of social media is that it allows you to connect with companies and people you are interested in. Furthermore, social media offers a wealth of information for cyber security professionals, whether they are searching for people or technical information. Why is searching for people important, you ask?</p><p>When protecting a company, you should ensure that the people you protect are not oversharing on social media. For instance, their social media might give away the answer to their secret questions, such as, “Which school did you go to as a child?”. Such information might allow adversaries to reset their passwords and take over their accounts effortlessly.</p><p>Furthermore, as a cyber security professional, you want to stay updated with new cyber security trends, technologies, and products. Following the proper channels and groups can provide a suitable environment for growing your technical expertise.</p><p>Besides staying updated via social media channels and groups, we should mention news outlets. Hundreds of news websites would offer valuable cyber-security-related news. Try different ones and stick with the ones you like most.</p><h3>Answer the questions below</h3><ol><li>You are hired to evaluate the security of a particular company. What is a popular social media website you would use to learn about the technical background of one of their employees?</li></ol><blockquote>“Well, that’s an easy one! If you’re looking to dig into someone’s technical background, LinkedIn is the place to go. It’s like the online resume for professionals, where everyone showcases their skills, work history, and certifications. Plus, it’s all there for you to see — just don’t get too carried away with stalking!”</blockquote><p>ANSWER: <strong>LinkedIn</strong></p><p>2. Continuing with the previous scenario, you are trying to find the answer to the secret question, “Which school did you go to as a child?”. What social media website would you consider checking to find the answer to such secret questions?</p><blockquote>“Well, if you’re trying to find out which school someone went to as a child, Facebook is your best bet. People love to post nostalgic throwbacks, school pictures, and tag their old friends. It’s like a treasure trove of personal history — just make sure you’re not snooping too much!”</blockquote><p>ANSWER: <strong>Facebook</strong></p><h3>Task 8: Conclusion</h3><p>This room focused on the most common sources of information for cyber security professionals. There are plenty more. As the information landscape keeps changing, it is impossible to cover all the sources. However, by subscribing to relevant cyber security groups, one can stay ahead and be aware whenever new interesting sources arise.</p><h3>Answer the questions below</h3><p>Ensure you have noted the various search engines and resources mentioned in this room as they will be convenient in any cyber security path you follow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfd120d446a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Net Sec Challenge | TryHackMe Challenge writeups | by DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/net-sec-challenge-tryhackme-challenge-writeups-by-desync-1596cac954b8?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/1596cac954b8</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Wed, 07 May 2025 07:02:22 GMT</pubDate>
            <atom:updated>2025-05-17T11:24:12.786Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*R7oZXlqSQPfiLPOfLrXKyA.png" /></figure><h3>Net Sec Challenge | TryHackMe Challenge writeups | by D3SYNC</h3><p>Practice the skills you have learned in the Network Security module.</p><p>Room Access: “<a href="https://tryhackme.com/room/netsecchallenge">https://tryhackme.com/room/netsecchallenge</a>”</p><h3>Task 1: Introduction [START MACHINE]</h3><p>Use this challenge to test your mastery of the skills you have acquired in the Network Security module. All the questions in this challenge can be solved using only nmap, telnet, and hydra.</p><h3>Answer the questions below</h3><p>Launch the AttackBox and the target VM.</p><p>ANSWER: <strong>No answer needed</strong></p><h3>TASK 2: Challenge Questions</h3><p>You can answer the following questions using Nmap, Telnet, and Hydra.</p><ol><li>What is the highest port number being open less than 10,000?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*YPgNw8zDNG9CzSJpgcp3Yg.png" /><figcaption><strong>Run:</strong> nmap MACHINE_IP</figcaption></figure><p>ANSWER: <strong>8080</strong></p><p>2. There is an open port outside the common 1000 ports; it is above 10,000. What is it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*AujecmwkpEgf01b-1fNQgg.png" /><figcaption><strong>Run:</strong> nmap -p- MACHINE_IP</figcaption></figure><p>ANSWER:<strong> 10021</strong></p><p>3. How many TCP ports are open?</p><blockquote>Refer to previous image</blockquote><p>ANSWER: <strong>6</strong></p><p>4. What is the flag hidden in the HTTP server header?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*vzwSYUEuZViBEw11RGhjtg.png" /><figcaption><strong>Run:</strong> nmap -sV — script=http-headers -p80 MACHINE_IP</figcaption></figure><p>ANSWER: <strong>THM{web_server_25352}</strong></p><p>5. What is the flag hidden in the SSH server header?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*7LrP1N7BSgINtCMmBbjvoA.png" /><figcaption><strong>Run:</strong> nmap -sV — script=ssh2-enum-algos -p22 MACHINE_IP</figcaption></figure><p>ANSWER: <strong>THM{946219583339}</strong></p><p>6. We have an FTP server listening on a non-standard port. What is the version of the FTP server?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*jqbBGsLqO5W3l_1XZDE6ag.png" /><figcaption><strong>Run:</strong> nmap -sV -p- MACHINE_IP</figcaption></figure><p>ANSWER: <strong>vsftpd 3.0.5</strong></p><p>7.We learned two usernames using social engineering: eddie and quinn. What is the flag hidden in one of these two account files and accessible via FTP?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uWe2iSzyYlz40_BVuwHFuw.png" /><figcaption><strong>Run:</strong> hydra -l TARGET_NAME-P rockyou.txt ftp://TARGET_IP:10021 (For both)</figcaption></figure><blockquote>USER: eddie<br>PASS: Jordan</blockquote><blockquote>USER: quinn<br>PASS: andrea</blockquote><p>RUN: <strong>ftp 10.10.127.131 10021<br></strong>Then enter the USER &amp; PASS (Do it indivisually for both and then use get to download the fpt_flag.txt file)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*ZLA8bAAIHspZGSDHIPExJA.png" /><figcaption>Nothing was found for Eddie</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*lVgVtFz8RCQ62vUskvj6Pg.png" /><figcaption>A txt file was found for quinn</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*Rf53noWaPlGdjmIrSzHCew.png" /></figure><p>ANSWER: <strong>THM{321452667098}</strong></p><p>8. Browsing to http://MACHINE_IP:8080 displays a small challenge that will give you a flag once you solve it. What is the flag?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L19Lf_uVk8bDzGnJpoHWvQ.png" /><figcaption><strong>Run:</strong> nmap -sN MACHINE_IP</figcaption></figure><p>ANSWER: <strong>THM{f7443f99}</strong></p><h3>Task 3: Summary</h3><p>Congratulations. In this module, we have learned about passive reconnaissance, active reconnaissance, Nmap, protocols and services, and attacking logins with Hydra.</p><h3>THANK YOU. I hoped it helped.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1596cac954b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Protocols and Servers 2 | TryHackMe Writeups | by DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/protocols-and-servers-2-tryhackme-writeups-by-desync-381981eed5ba?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/381981eed5ba</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Tue, 06 May 2025 14:26:20 GMT</pubDate>
            <atom:updated>2025-05-07T07:04:45.289Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*7OqFQcrh6OcgOZyqGjAyqw.png" /></figure><p>Learn about attacks against passwords and cleartext traffic; explore options for mitigation via SSH and SSL/TLS.</p><p>Room Access: “<a href="https://tryhackme.com/room/protocolsandservers2">https://tryhackme.com/room/protocolsandservers2</a>”</p><h3>TASK 1: Introduction</h3><p>The <a href="https://tryhackme.com/room/protocolsandservers">Protocols and Servers</a> room covered many protocols:</p><ul><li>Telnet</li><li>HTTP</li><li>FTP</li><li>SMTP</li><li>POP3</li><li>IMAP</li></ul><p>Servers implementing these protocols are subject to different kinds of attacks. To name a few, consider:</p><ol><li>Sniffing Attack (Network Packet Capture)</li><li>Man-in-the-Middle (MITM) Attack</li><li>Password Attack (Authentication Attack)</li><li>Vulnerabilities</li></ol><p>From a security perspective, we always need to think about what we aim to protect; consider the security triad: Confidentiality, Integrity, and Availability (CIA). <strong>Confidentiality</strong> refers to keeping the contents of the communications accessible to the intended parties. <strong>Integrity</strong> is the idea of assuring any data sent is accurate, consistent, and complete when reaching its destination. Finally, <strong>availability</strong> refers to being able to access the service when we need it. Different parties will put varying emphasis on these three. For instance, confidentiality would be the highest priority for an intelligence agency. Online banking will put most emphasis on the integrity of transactions. Availability is of the highest importance for any platform making money by serving ads.</p><p>Knowing that we are protecting the Confidentiality, Integrity, and Availability (CIA), an attack aims to cause Disclosure, Alteration, and Destruction (DAD). The figures below reflect this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k68tbj_AdFifXxmY.png" /></figure><p>These attacks directly affect the security of the system. For instance, network packet capture violates confidentiality and leads to the disclosure of information. A successful password attack can also lead to disclosure. On the other hand, a Man-in-the-Middle (MITM) attack breaks the system’s integrity as it can alter the communicated data. We will focus on these three attacks in this room as these attacks are integral to the protocol design and server implementation.</p><p>Vulnerabilities are of a broader spectrum, and exploited vulnerabilities have different impacts on the target systems. For instance, exploiting a Denial of Service (DoS) vulnerability can affect the system’s availability, while exploiting a Remote Code Execution (RCE) vulnerability can lead to more severe damages. It is important to note that a vulnerability by itself creates a risk; damage can occur only when the vulnerability is exploited. We don’t cover vulnerabilities in this room as they have their own module, <a href="https://tryhackme.com/module/vulnerability-research">Vulnerability Research</a>.</p><p>This room will focus on how a protocol can be upgraded or replaced to protect against disclosure and alteration, i.e. protecting the confidentiality and integrity of the transmitted data. We will be recommending other modules that cover additional topics.</p><p>Moreover, we introduce Hydra to find weak passwords.</p><h3>Answer the questions below</h3><ol><li>We suggest that you start the AttackBox and the virtual machine as you proceed to tackle the following tasks. You can connect to the different services over Telnet or Netcat for better practice and learning experience.</li></ol><p>ANSWER: No need to answer</p><h3><strong>TASK 2: Sniffing attack</strong></h3><p>Sniffing attack refers to using a network packet capture tool to collect information about the target. When a protocol communicates in cleartext, the data exchanged can be captured by a third party to analyse. A simple network packet capture can reveal information, such as the content of private messages and login credentials, if the data isn’t encrypted in transit.</p><p>A sniffing attack can be conducted using an Ethernet (802.3) network card, provided that the user has proper permissions (root permissions on Linux and administrator privileges on MS Windows). There are many programs available to capture network packets. We consider the following:</p><ol><li><strong>Tcpdump</strong> is a free open source command-line interface (CLI) program that has been ported to work on many operating systems.</li><li><strong>Wireshark</strong> is a free open source graphical user interface (GUI) program available for several operating systems, including Linux, macOS and MS Windows.</li><li><strong>Tshark</strong> is a CLI alternative to Wireshark.</li></ol><p>There are several specialized tools for capturing passwords and even complete messages; however, this can still be achieved by Tcpdump and Wireshark with some added effort.</p><p>Consider a user checking his email messages using POP3. First, we are going to use Tcpdump to attempt to capture the username and password. In the terminal output below, we used the command sudo tcpdump port 110 -A. Before explaining this command, we should mention that this attack requires access to the network traffic, for example, via a wiretap or a switch with port mirroring. Alternatively, we can access the traffic exchanged if we launch a successful Man-in-the-Middle (MITM) attack.</p><p>We need sudo as packet captures require root privileges. We wanted to limit the number of captured and displayed packets to those exchanged with the POP3 server. We know that POP3 uses port 110, so we filtered our packets using port 110. Finally, we wanted to display the contents of the captured packets in ASCII format, so we added -A.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AEq_SkohoWLZeQKyd1wm0w.png" /></figure><p>In the terminal output above, we have removed the unimportant packets to help you better focus on the ones that matter. In particular, the username and password were each sent in their own packet. The first packet explicitly displays “USER frank”, while the last packet reveals the password “PASS D2xc9CgD”.</p><p>We could also use Wireshark to achieve the same results. In the Wireshark window below, we can see that we have entered pop in the filter field. Now that we&#39;ve filtered just the traffic we&#39;re interested in, we can see a username and password were captured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/0*bpn_-R2-jLM6289J.png" /></figure><p>In brief, any protocol that uses cleartext communication is susceptible to this kind of attack. The only requirement for this attack to succeed is to have access to a system between the two communicating systems. This attack requires attention; the mitigation lies in adding an encryption layer on top of any network protocol. In particular, Transport Layer Security (TLS) has been added to HTTP, FTP, SMTP, POP3, IMAP and many others. For remote access, Telnet has been replaced by the secure alternative Secure Shell (SSH).</p><p>If you would like to learn more about Wireshark, we recommend the <a href="https://tryhackme.com/room/wireshark">Wireshark 101</a> room.</p><h3>Answer the questions below</h3><ol><li>What do you need to add to the command sudo tcpdump to capture only Telnet traffic?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*rDyhFQWnfWK28OaUetrdzA.png" /><figcaption>Google Search</figcaption></figure><p>ANSWER: <strong>PORT 23</strong></p><p>2. What is the simplest display filter you can use with Wireshark to show only IMAP traffic?</p><p>ANSWER: IMAP</p><h3>TASK 3: Man-in-the-Middle (MITM) Attack</h3><p>A Man-in-the-Middle (MITM) attack occurs when a victim (A) believes they are communicating with a legitimate destination (B) but is unknowingly communicating with an attacker (E). In the figure below, we have A requesting the transfer of $20 to M; however, E altered this message and replaced the original value with a new one. B received the modified messaged and acted on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*QxiNrpgFO9R_36WS.png" /></figure><p>This attack is relatively simple to carry out if the two parties do not confirm the authenticity and integrity of each message. In some cases, the chosen protocol does not provide secure authentication or integrity checking; moreover, some protocols have inherent insecurities that make them susceptible to this kind of attack.</p><p>Any time you browse over HTTP, you are susceptible to a MITM attack, and the scary thing is that you cannot recognize it. Many tools would aid you in carrying out such an attack, such as <a href="https://www.ettercap-project.org/">Ettercap</a> and <a href="https://www.bettercap.org/">Bettercap</a>.</p><p>MITM can also affect other cleartext protocols such as FTP, SMTP, and POP3. Mitigation against this attack requires the use of cryptography. The solution lies in proper authentication along with encryption or signing of the exchanged messages. With the help of Public Key Infrastructure (PKI) and trusted root certificates, Transport Layer Security (TLS) protects from MITM attacks.</p><h3>Answer the questions below</h3><ol><li>How many different interfaces does Ettercap offer? (<strong>Hint:</strong> Refer to <a href="https://www.ettercap-project.org/about.html">https://www.ettercap-project.org/about.html</a>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*NXv1VpMd2XYBvH5ZLkAQAA.png" /></figure><p>ANSWER: <strong>3</strong></p><p>2. In how many ways can you invoke Bettercap?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*novtc-4anal8sxkwtVZWog.png" /></figure><p>ANSWER: <strong>3</strong></p><h3><strong>TASK 4: Transport Layer Security (TLS)</strong></h3><p>In this task, we learn about a standard solution to protect the confidentiality and integrity of the exchanged packets. The following approach can protect against password sniffing and MITM attacks.</p><p>SSL (Secure Sockets Layer) started when the world wide web started to see new applications, such as online shopping and sending payment information. Netscape introduced SSL in 1994, with SSL 3.0 being released in 1996. But eventually, more security was needed, and TLS (Transport Layer Security) protocol was introduced in 1999. Before we explain what TLS and SSL provide, let’s see how they fit the networking model.</p><p>The common protocols we have covered so far send the data in cleartext; this makes it possible for anyone with access to the network to capture, save and analyze the exchanged messages. The image below shows the ISO/OSI network layers. The protocols we have covered so far in this room are on the application layer. Consider the ISO/OSI model; we can add encryption to our protocols via the presentation layer. Consequently, data will be presented in an encrypted format (ciphertext) instead of its original form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/0*lBRKTWZhTukPQyU0.png" /></figure><p>Because of the close relation between SSL and TLS, one might be used instead of the other. However, TLS is more secure than SSL, and it has practically replaced SSL. We could have dropped SSL and just written TLS instead of SSL/TLS, but we will continue to mention the two to avoid any ambiguity because the term SSL is still in wide use. However, we can expect all modern servers to be using TLS.</p><p>An existing cleartext protocol can be upgraded to use encryption via SSL/TLS. We can use TLS to upgrade HTTP, FTP, SMTP, POP3, and IMAP, to name a few. The following table lists the protocols we have covered and their default ports before and after the encryption upgrade via SSL/TLS. The list is not exhaustive; however, the purpose is to help us better understand the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eLDwEHqiBZJPhl6Fz_oJVQ.png" /></figure><p>Considering the case of HTTP. Initially, to retrieve a web page over HTTP, the web browser would need at least perform the following two steps:</p><ol><li>Establish a TCP connection with the remote web server</li><li>Send HTTP requests to the web server, such as GET and POST requests.</li></ol><p>HTTPS requires an additional step to encrypt the traffic. The new step takes place after establishing a TCP connection and before sending HTTP requests. This extra step can be inferred from the ISO/OSI model in the image presented earlier. Consequently, HTTPS requires at least the following three steps:</p><ol><li>Establish a TCP connection</li><li><strong>Establish SSL/TLS connection</strong></li><li>Send HTTP requests to the webserver</li></ol><p>To establish an SSL/TLS connection, the client needs to perform the proper handshake with the server. Based on <a href="https://datatracker.ietf.org/doc/html/rfc6101">RFC 6101</a>, the SSL connection establishment will look like the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*yLXsIPjflxXddaTl.png" /></figure><p>After establishing a TCP connection with the server, the client establishes an SSL/TLS connection, as shown in the figure above. The terms might look complicated depending on your knowledge of cryptography, but we can simplify the four steps as:</p><ol><li>The client sends a ClientHello to the server to indicate its capabilities, such as supported algorithms.</li><li>The server responds with a ServerHello, indicating the selected connection parameters. The server provides its certificate if server authentication is required. The certificate is a digital file to identify itself; it is usually digitally signed by a third party. Moreover, it might send additional information necessary to generate the master key, in its ServerKeyExchange message, before sending the ServerHelloDone message to indicate that it is done with the negotiation.</li><li>The client responds with a ClientKeyExchange, which contains additional information required to generate the master key. Furthermore, it switches to use encryption and informs the server using the ChangeCipherSpec message.</li><li>The server switches to use encryption as well and informs the client in the ChangeCipherSpec message.</li></ol><p>If this still sounds sophisticated, don’t worry; we only need the gist of it. A client was able to agree on a secret key with a server that has a public certificate. This secret key was securely generated so that a third party monitoring the channel wouldn’t be able to discover it. Further communication between the client and the server will be encrypted using the generated key.</p><p>Consequently, once an SSL/TLS handshake has been established, HTTP requests and exchanged data won’t be accessible to anyone watching the communication channel.</p><p>As a final note, for SSL/TLS to be effective, especially when browsing the web over HTTPS, we rely on public certificates signed by certificate authorities trusted by our systems. In other words, when we browse to <a href="https://tryhackme.com/">TryHackMe</a> over HTTPS, our browser expects the TryHackMe web server to provide a signed certificate from a trusted certificate authority, as per the example below. This way, our browser ensures that it is communicating with the correct server, and a MITM attack cannot occur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/0*Iiiuxxi3iP_JgXkw.png" /></figure><p>In the figure above, we can see the following information:</p><ol><li>To whom is the certificate issued? That is the name of the company that will use this certificate.</li><li>Who issued the certificate? This is the certificate authority that issued this certificate.</li><li>Validity period. You don’t want to use a certificate that has expired, for instance.</li></ol><p>Luckily, we don’t have to check the certificate manually for every site we visit; our web browser will do it for us. Our web browser will ensure that we are talking with the correct server and ensure that our communication is secure, thanks to the server’s certificate.</p><h3>Answer the questions below</h3><ol><li>DNS can also be secured using TLS. What is the three-letter acronym of the DNS protocol that uses TLS? (<strong>HINT:</strong> Requires research.)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*GymsarFFXe9Q8r8yNepYJA.png" /><figcaption>Google Search</figcaption></figure><p>ANSWER: <strong>DoT</strong></p><h3>TASK 5: Secure Shell (SSH)</h3><p>Secure Shell (SSH) was created to provide a secure way for remote system administration. In other words, it lets you securely connect to another system over the network and execute commands on the remote system. Put simply, the “S” in SSH stands for secure, which can be summarized simply as:</p><ol><li>You can confirm the identity of the remote server</li><li>Exchanged messages are encrypted and can only be decrypted by the intended recipient</li><li>Both sides can detect any modification in the messages</li></ol><p>The above three points are ensured by cryptography. In more technical terms, they are part of confidentiality and integrity, made possible through the proper use of different encryption algorithms.</p><p>To use SSH, you need an SSH server and an SSH client. The SSH server listens on port 22 by default. The SSH client can authenticate using:</p><ul><li>A username and a password</li><li>A private and public key (after the SSH server is configured to recognize the corresponding public key)</li></ul><p>On Linux, macOS, and MS Windows builds after 2018, you can connect to an SSH server using the following command ssh username@10.10.107.53. This command will try to connect to the server of IP address 10.10.107.53 with the login name username. If an SSH server is listening on the default port, it will ask you to provide the password for username. Once authenticated, the user will have access to the target server’s terminal. The terminal output below is an example of using SSH to access a Debian Linux server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cOlJT6ywYbLIFY_0DDLH8w.png" /></figure><p>In the example above, we issued the command ssh mark@10.10.107.53. Then, once we entered the correct password, we got access to the remote system’s terminal. SSH is very reliable for remote administration because our username and password were sent encrypted; moreover, all commands we execute on the remote system will be sent over an encrypted channel.</p><p>Note that if this is the first time we connect to this system, we will need to confirm the fingerprint of the SSH server’s public key to avoid man-in-the-middle (MITM) attacks. As explained earlier, MITM takes place when a malicious party, E, situates itself between A and B, and communicates with A, pretending to be B, and communicates with B pretending to be A, while A and B think that they are communicating directly with each other. In the case of SSH, we don’t usually have a third party to check if the public key is valid, so we need to do this manually. This attack is shown in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*HZeg4OsSrRKGdGWp.png" /></figure><p>We can use SSH to transfer files using SCP (Secure Copy Protocol) based on the SSH protocol. An example of the syntax is as follows: scp mark@10.10.107.53:/home/mark/archive.tar.gz ~. This command will copy a file named archive.tar.gz from the remote system located in the /home/mark directory to ~, i.e., the root of the home directory of the currently logged-in user.</p><p>Another example syntax is scp backup.tar.bz2 mark@10.10.107.53:/home/mark/. This command will copy the file backup.tar.bz2 from the local system to the directory /home/mark/ on the remote system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S56aOIAJb_bTR1DrBKpFYQ.png" /></figure><p>As a closing note, FTP could be secured using SSL/TLS by using the FTPS protocol which uses port 990. It is worth mentioning that FTP can also be secured using the SSH protocol which is the SFTP protocol. By default this service listens on port 22, just like SSH.</p><h3>Answer the questions below</h3><ol><li>Use SSH to connect to 10.10.107.53 as mark with the password XBtc49AB. Using uname -r, find the Kernel release?</li></ol><blockquote><strong>Run:</strong> ssh mark@MACHINE_IP<br>XBtc49AB</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*hwDpxthiPpvD7GBk9CClng.png" /></figure><p>Run: uname -r</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*n167zL0cA4lzMsfgcWubSw.png" /></figure><p>ANSWER: <strong>5.15.0–119-generic</strong></p><p>2. Use SSH to download the file book.txt from the remote system. How many KBs did scp display as download size?</p><p><strong>Run: </strong>scp mark@MACHINE_IP:/home/mark/book.txt .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*8V1P3aztxvWMAe6J8z6Gmw.png" /></figure><p>ANSWER: <strong>415</strong></p><h3>TASK 6: Password Attack</h3><p>We discussed network packet captures and MITM attacks as well as how these attacks can be mitigated using TLS and SSH. The third type of attack that we will cover in this room is a password attack.</p><p>Many protocols require you to authenticate. Authentication is proving who you claim to be. When we are using protocols such as POP3, we should not be given access to the mailbox before verifying our identity. The POP3 example from the <a href="https://tryhackme.com/room/protocolsandservers">Protocols and Servers</a> room is repeated below for your convenience. In this example, we are identified as the user frank, and the server authenticated us because we provided the correct password. In other words, the password is one way to authentication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*XIhvILINW-HDjRUXHVZdUQ.png" /></figure><p>Authentication, or proving your identity, can be achieved through one of the following, or a combination of two:</p><ol><li>Something you <em>know</em>, such as password and PIN code.</li><li>Something you <em>have</em>, such as a SIM card, RFID card, and USB dongle.</li><li>Something you <em>are</em>, such as fingerprint and iris.</li></ol><p>This task will focus on attacks against passwords, i.e. something the target <em>knows</em>. If you revisit the communication with several previous servers using protocols such as Telnet, SSH, POP3, and IMAP, we always need a password to gain access. Based on the 150 million usernames and passwords leaked from the Adobe breach in 2013, the top ten passwords are:</p><ul><li>123456</li><li>123456789</li><li>password</li><li>adobe123</li><li>12345678</li><li>qwerty</li><li>1234567</li><li>111111</li><li>photoshop</li><li>123123</li></ul><p>Only two passwords are related to Adobe and its products, but the rest are generic. You might think that this has changed over the past decade; however, 123456, 1234567, 12345678, and 123456789 are still common choices for many users. Others haven’t realized yet that qwerty is not secret, and it is used by many as their password.</p><p>Attacks against passwords are usually carried out by:</p><ol><li>Password Guessing: Guessing a password requires some knowledge of the target, such as their pet’s name and birth year.</li><li>Dictionary Attack: This approach expands on password guessing and attempts to include all valid words in a dictionary or a wordlist.</li><li>Brute Force Attack: This attack is the most exhaustive and time-consuming where an attacker can go as far as trying all possible character combinations, which grows fast (exponential growth with the number of characters).</li></ol><p>Let’s focus on dictionary attacks. Over time, hackers have compiled list after list containing leaked passwords from data breaches. One example is RockYou’s list of breached passwords, which you can find on the AttackBox at /usr/share/wordlists/rockyou.txt. The choice of the word list should depend on your knowledge of the target. For instance, a French user might use a French word instead of an English one. Consequently, a French word list might be more promising.</p><p>We want an automated way to try the common passwords or the entries from a word list; here comes <a href="https://github.com/vanhauser-thc/thc-hydra">THC Hydra</a>. Hydra supports many protocols, including FTP, POP3, IMAP, SMTP, SSH, and all methods related to HTTP. The general command-line syntax is: hydra -l username -P wordlist.txt server service where we specify the following options:</p><ul><li>-l username: -l should precede the username, i.e. the login name of the target.</li><li>-P wordlist.txt: -P precedes the wordlist.txt file, which is a text file containing the list of passwords you want to try with the provided username.</li><li>server is the hostname or IP address of the target server.</li><li>service indicates the service which you are trying to launch the dictionary attack.</li></ul><p>Consider the following concrete examples:</p><ul><li>hydra -l mark -P /usr/share/wordlists/rockyou.txt 10.10.107.53 ftp will use mark as the username as it iterates over the provided passwords against the FTP server.</li><li>hydra -l mark -P /usr/share/wordlists/rockyou.txt ftp://10.10.107.53 is identical to the previous example. 10.10.107.53 ftp is the same as ftp://10.10.107.53.</li><li>hydra -l frank -P /usr/share/wordlists/rockyou.txt 10.10.107.53 ssh will use frank as the user name as it tries to login via SSH using the different passwords.</li></ul><p>There are some extra optional arguments that you can add:</p><ul><li>-s PORT to specify a non-default port for the service in question.</li><li>-V or -vV, for verbose, makes Hydra show the username and password combinations that are being tried. This verbosity is very convenient to see the progress, especially if you are still not confident of your command-line syntax.</li><li>-t n where n is the number of parallel connections to the target. -t 16 will create 16 threads used to connect to the target.</li><li>-d, for debugging, to get more detailed information about what’s going on. The debugging output can save you much frustration; for instance, if Hydra tries to connect to a closed port and timing out, -d will reveal this right away.</li></ul><p>Once the password is found, you can issue CTRL-C to end the process. In TryHackMe tasks, we expect any attack to finish within less than five minutes; however, the attack would usually take longer in real-life scenarios. Options for verbosity or debugging can be pretty helpful if you want Hydra to update you about its progress.</p><p>In summary, attacks against login systems can be carried out efficiently using a tool, such as THC Hydra combined with a suitable word list. Mitigation against such attacks can be sophisticated and depends on the target system. A few of the approaches include:</p><ul><li>Password Policy: Enforces minimum complexity constraints on the passwords set by the user.</li><li>Account Lockout: Locks the account after a certain number of failed attempts.</li><li>Throttling Authentication Attempts: Delays the response to a login attempt. A couple of seconds of delay is tolerable for someone who knows the password, but they can severely hinder automated tools.</li><li>Using CAPTCHA: Requires solving a question difficult for machines. It works well if the login page is via a graphical user interface (GUI). (Note that CAPTCHA stands for Completely Automated Public Turing test to tell Computers and Humans Apart.)</li><li>Requiring the use of a public certificate for authentication. This approach works well with SSH, for instance.</li><li>Two-Factor Authentication: Ask the user to provide a code available via other means, such as email, smartphone app or SMS.</li><li>There are many other approaches that are more sophisticated or might require some established knowledge about the user, such as IP-based geolocation.</li></ul><p>Using a combination of the above approaches is an excellent approach to protect against password attacks.</p><h3>Answer the questions below</h3><ol><li>We learned that one of the email accounts is lazie. What is the password used to access the IMAP service on 10.10.107.53?</li></ol><p><strong>Run:</strong> hydra -l lazie -P rockyou.txt 10.10.107.53 imap -V (navigate to /usr/share/wordlists)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xmQXGVxUIlIyuW73vTzrGw.png" /></figure><p>ANSWER: <strong>butterfly</strong></p><h3>TASK 7: Summary</h3><p>This room covered various protocols, their usage, and how they work under the hood. Three common attacks are:</p><ol><li>Sniffing Attack</li><li>MITM Attack</li><li>Password Attack</li></ol><p>For each of the above, we focused both on the attack details and the mitigation steps.</p><p>Many other attacks can be conducted against specific servers and protocols. We will provide a list of some related modules.</p><ul><li><a href="https://tryhackme.com/module/vulnerability-research">Vulnerability Research</a>: This module provides more information about vulnerabilities and exploits.</li><li><a href="https://tryhackme.com/module/metasploit">Metasploit</a>: This module trains you on how to use Metasploit to exploit target systems.</li><li><a href="https://tryhackme.com/module/learn-burp-suite">Burp Suite</a>: This module teaches you how to use Burp Suite to intercept HTTP traffic and launch attacks related to the web.</li></ul><p>It is good to remember the default port number for common protocols. For convenience, the services we covered are listed in the following table sorted by alphabetical order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*HsLrL4GDXoX4MkEpd5Sa6Q.png" /></figure><p>Hydra remains a very efficient tool that you can launch from the terminal to try the different passwords. We summarize its main options in the following table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*1EZKdYVPwmSje1Wru_KJog.png" /></figure><h3>Answer the questions below</h3><p>By now, you have completed the eighth room of the <em>Network Security</em> module. Please proceed to the <a href="https://tryhackme.com/room/netsecchallenge">final room</a> of this module to test your skills.</p><p>ANSWER: <strong>No need to answer</strong></p><h3>THANK YOU. I hope it helped.</h3><p>NEXT ROOM: <a href="https://medium.com/@dassagnik360/net-sec-challenge-tryhackme-challenge-writeups-by-desync-1596cac954b8">Net Sec Challenge | TryHackMe Challenge Writeups | by DESYNC</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=381981eed5ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Protocols and Servers | TryHackMe Writeups | by DESYNC]]></title>
            <link>https://medium.com/@D3SYNCx/protocols-and-servers-tryhackme-writeups-by-desync-d4dd5e7f2c4b?source=rss-36700e22ec10------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4dd5e7f2c4b</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[D3SYNCx]]></dc:creator>
            <pubDate>Tue, 06 May 2025 06:36:43 GMT</pubDate>
            <atom:updated>2025-05-06T14:29:36.884Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*IRzXr0oDrYGE9zSXt7_hAQ.png" /></figure><h4>Learn about common protocols such as HTTP, FTP, POP3, SMTP and IMAP, along with related insecurities.</h4><p>Room Access: “<a href="https://tryhackme.com/room/protocolsandservers">https://tryhackme.com/room/protocolsandservers</a>”</p><h3><strong>Task 1: Introduction</strong></h3><p>This room introduces the user to a few protocols commonly used, such as:</p><ul><li>HTTP</li><li>FTP</li><li>POP3</li><li>SMTP</li><li>IMAP</li></ul><p>Each task about each protocol will be designed to help us understand what happens on the low level and is usually hidden by an elegant GUI (Graphical User Interface). We will “talk” using the above protocols using a simple Telnet client to fully understand what your GUI client is doing under the hood. Our purpose is not to memorize the protocol commands but rather to get a closer look at the protocol while it is working.</p><p>We also discuss some of the insecurities. In particular, we focus on passwords sent in cleartext.</p><h3><strong>Answer the questions below</strong></h3><p>We suggest that you start the AttackBox and the virtual machine as you proceed to tackle the following tasks. You can connect to the different services over Telnet for better practice and learning experience.</p><p>ANSWER: <strong>No answer needed</strong></p><h3>TASK 2: Telnet</h3><p>The Telnet protocol is an application layer protocol used to connect to a virtual terminal of another computer. Using Telnet, a user can log into another computer and access its terminal (console) to run programs, start batch processes, and perform system administration tasks remotely.</p><p>Telnet protocol is relatively simple. When a user connects, they will be asked for a username and password. Upon correct authentication, the user will access the remote system’s terminal. Unfortunately, all this communication between the Telnet client and the Telnet server is not encrypted, making it an easy target for attackers.</p><p>A Telnet server uses the Telnet protocol to listen for incoming connections on port 23. (Please note that the Telnet port is not open on the target VM.) Let’s consider the example shown below. A user is connecting to the telnetd, a Telnet server. The steps are as follows:</p><ol><li>First, he is asked to provide his login name (username). We can see the user entering frank.</li><li>Then, he is asked for the password, D2xc9CgD. The password is not shown on the screen; however, we display it below for demonstration purposes.</li><li>Once the system checks his login credentials, he is greeted with a welcome message.</li><li>And the remote server grants him a command prompt, frank@bento:~$. The $ indicates that this is not a root terminal.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIS6WWVaTJuAe1P0koZovg.png" /></figure><p>Although Telnet gave us access to the remote system’s terminal in no time, it is not a reliable protocol for remote administration as all the data are sent in cleartext. In the figure below, we captured the traffic generated by Telnet, and it was so easy to find the password. The figure below shows the ASCII data exchanged between our computer and the remote system. The text in red is the text that we are sending to the remote system, while the text in blue is the text that the remote system is sending. Notice how the user name was sent back (echoed at us to display them in our terminal); however, the password was not. In other words, if someone is watching us type, they won’t be able to see the password characters on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmdPHvBwx3jGA1QsSD5LGw.png" /></figure><p>Telnet is no longer considered a secure option, especially that anyone capturing your network traffic will be able to discover your usernames and passwords, which would grant them access to the remote system. The secure alternative is SSH, which we present in the next room.</p><h3>Answer the questions below</h3><p>1.To which port will the telnet command with the default parameters try to connect?</p><p>ANSWER: <strong>23</strong></p><h3>Task 3: Hypertext Transfer Protocol (HTTP)</h3><p>Hypertext Transfer Protocol (HTTP) is the protocol used to transfer web pages. Your web browser connects to the webserver and uses HTTP to request HTML pages and images among other files and submit forms and upload various files. Anytime you browse the World Wide Web (WWW), you are certainly using the HTTP protocol.</p><p>The image below shows a client requesting the HTML page index.html, which the webserver provides. Then the client requests an image, logo.jpg, and the web server sends it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cc_rbK1eRwOI3PwzgPrPNQ.png" /></figure><p>HTTP sends and receives data as cleartext (not encrypted); therefore, you can use a simple tool, such as Telnet (or Netcat), to communicate with a web server and act as a “web browser”. The key difference is that you need to input the HTTP-related commands instead of the web browser doing that for you.</p><p>In the following example, we will see how we can request a page from a web server; moreover, we will discover the webserver version. To accomplish this, we will use the Telnet client. We chose it because Telnet is a simple protocol; furthermore, it uses cleartext for communication. We will use telnet instead of a web browser to request a file from the webserver. The steps will be as follows:</p><ol><li>First, we connect to port 80 using telnet MACHINE_IP 80.</li><li>Next, we need to type GET /index.html HTTP/1.1 to retrieve the page index.html or GET / HTTP/1.1 to retrieve the default page.</li><li>Finally, you need to provide some value for the host like host: telnet and press the Enter/Return key <strong>twice</strong>.</li></ol><p>In the console output below, we could recover the requested page along with a trove of information not usually displayed by the web browser. If the page we requested is not found, we get error 404.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PB8m18Tmx92ICHCEZBG3tA.png" /></figure><p>Of particular interest in the output above is that the user needs only to type a couple of commands to get the page they need: GET /index.html HTTP/1.1 followed by host: telnet.</p><p>We need an HTTP server (webserver) and an HTTP client (web browser) to use the HTTP protocol. The web server will “serve” a specific set of files to the requesting web browser.</p><p>Three popular choices for HTTP servers are:</p><ul><li><a href="https://www.apache.org/">Apache</a></li><li><a href="https://www.iis.net/">Internet Information Services (IIS)</a></li><li><a href="https://nginx.org/">nginx</a></li></ul><p>Apache and Nginx are free and open-source software. However, IIS is closed source software and requires paying for a license.</p><p>There are many web browsers available. At the time of writing, the most popular web browsers are:</p><ul><li>Chrome by Google</li><li>Edge by Microsoft</li><li>Firefox by Mozilla</li><li>Safari by Apple.</li></ul><p>Web browsers are generally free to install and use; furthermore, tech giants battle for a higher market share for their browsers.</p><h3>Answer the questions below</h3><ol><li>Launch the attached VM. From the AttackBox terminal, connect using Telnet to MACHINE_IP 80 and retrieve the file flag.thm. What does it contain?</li></ol><blockquote><strong>Run</strong>: <br>telnet MACHINE_IP PORT_NO (ENTER)<br>GET /flag.thm HTTP/1.1(ENTER)<br>host: telnet (ENTER twice)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*M-7B72cyQKrvxej9HB2dMA.png" /></figure><p>ANSWER: <strong>THM{e3eb0a1df437f3f97a64aca5952c8ea0}</strong></p><h3>Task 4: File Transfer Protocol (FTP)</h3><p>File Transfer Protocol (FTP) was developed to make the transfer of files between different computers with different systems efficient.</p><p>FTP also sends and receives data as cleartext; therefore, we can use Telnet (or Netcat) to communicate with an FTP server and act as an FTP client. In the example below, we carried out the following steps:</p><ol><li>We connected to an FTP server using a Telnet client. Since FTP servers listen on port 21 by default, we had to specify to our Telnet client to attempt connection to port 21 instead of the default Telnet port.</li><li>We needed to provide the username with the command USER frank.</li><li>Then, we provided the password with the command PASS D2xc9CgD.</li><li>Because we supplied the correct username and password, we got logged in.</li></ol><p>A command like STAT can provide some added information. The SYST command shows the System Type of the target (UNIX in this case). PASV switches the mode to passive. It is worth noting that there are two modes for FTP:</p><ul><li>Active: In the active mode, the data is sent over a separate channel originating from the FTP server’s port 20.</li><li>Passive: In the passive mode, the data is sent over a separate channel originating from an FTP client’s port above port number 1023.</li></ul><p>The command TYPE A switches the file transfer mode to ASCII, while TYPE I switches the file transfer mode to binary. However, we cannot transfer a file using a simple client such as Telnet because FTP creates a separate connection for file transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Dv-Wsqo9YocZi36Yme9SQ.png" /></figure><p>The image below shows how an actual file transfer would be conducted using FTP. To keep things simple in this figure, let’s only focus on the fact that the FTP client will initiate a connection to an FTP server, which listens on port 21 by default. All commands will be sent over the control channel. Once the client requests a file, another TCP connection will be established between them. (The details of establishing the data connection/channel is beyond the scope of this room.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mvmzn8INBYRpibZ-XEwNgg.png" /></figure><p>Considering the sophistication of the data transfer over FTP, let’s use an actual FTP client to download a text file. We only needed a small number of commands to retrieve the file. After logging in successfully, we get the FTP prompt, ftp&gt;, to execute various FTP commands. We used ls to list the files and learn the file name; then, we switched to ascii since it is a text file (not binary). Finally, get FILENAME made the client and server establish another channel for file transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CdK9ZYkN-v4UHN4qSt-lTw.png" /></figure><p>FTP servers and FTP clients use the FTP protocol. There are various FTP server software that you can select from if you want to host your FTP file server. Examples of FTP server software include:</p><ul><li><a href="https://security.appspot.com/vsftpd.html">vsftpd</a></li><li><a href="http://www.proftpd.org/">ProFTPD</a></li><li><a href="https://www.uftpserver.com/">uFTP</a></li></ul><p>For FTP clients, in addition to the console FTP client commonly found on Linux systems, you can use an FTP client with GUI such as <a href="https://filezilla-project.org/">FileZilla</a>. Some web browsers also support FTP protocol.</p><p>Because FTP sends the login credentials along with the commands and files in cleartext, FTP traffic can be an easy target for attackers.</p><h3>Answer the questions below</h3><p>Using an FTP client, connect to the VM and try to recover the flag file. What is the flag?</p><ul><li>Username: frank</li><li>Password: D2xc9CgD</li></ul><p>In you VM Terminal/Own terminal if you are using a THM VPN:</p><blockquote><strong>Run:</strong><br>ftp MACHINE_IP<br>frank<br>D2xc9CgD<br>ascii (in order to make it readable)<br>ls<br>get ftp_flag.thm (leave README.txt)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*DTurSJPhK2xqVjrC1YglMw.png" /></figure><p>Close the terminal and open a fresh one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*vW0DDjOfitPOlPnViMQbUw.png" /></figure><p>ANSWER: <strong>THM{364db6ad0e3ddfe7bf0b1870fb06fbdf}</strong></p><h3>Task 5: Simple Mail Transfer Protocol (SMTP)</h3><p>Email is one of the most used services on the Internet. There are various configurations for email servers; for instance, you may set up an email system to allow local users to exchange emails with each other with no access to the Internet. However, we will consider the more general setup where different email servers connect over the Internet.</p><p>Email delivery over the Internet requires the following components:</p><ol><li>Mail Submission Agent (MSA)</li><li>Mail Transfer Agent (MTA)</li><li>Mail Delivery Agent (MDA)</li><li>Mail User Agent (MUA)</li></ol><p>The above four terms may look cryptic, but they are more straightforward than they appear. We will explain these terms using the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/0*jn3QXo20wnqA8RzC.png" /></figure><p>The figure shows the following five steps that an email needs to go through to reach the recipient’s inbox:</p><ol><li>A Mail User Agent (MUA), or simply an email client, has an email message to be sent. The MUA connects to a Mail Submission Agent (MSA) to send its message.</li><li>The MSA receives the message, checks for any errors before transferring it to the Mail Transfer Agent (MTA) server, commonly hosted on the same server.</li><li>The MTA will send the email message to the MTA of the recipient. The MTA can also function as a Mail Submission Agent (MSA).</li><li>A typical setup would have the MTA server also functioning as a Mail Delivery Agent (MDA).</li><li>The recipient will collect its email from the MDA using their email client.</li></ol><p>If the above steps sound confusing, consider the following analogy:</p><ol><li>You (MUA) want to send postal mail.</li><li>The post office employee (MSA) checks the postal mail for any issues before your local post office (MTA) accepts it.</li><li>The local post office checks the mail destination and sends it to the post office (MTA) in the correct country.</li><li>The post office (MTA) delivers the mail to the recipient mailbox (MDA).</li><li>The recipient (MUA) regularly checks the mailbox for new mail. They notice the new mail, and they take it.</li></ol><p>In the same way, we need to follow a protocol to communicate with an HTTP server, and we need to rely on email protocols to talk with an MTA and an MDA. The protocols are:</p><ol><li>Simple Mail Transfer Protocol (SMTP)</li><li>Post Office Protocol version 3 (POP3) or Internet Message Access Protocol (IMAP)</li></ol><p>We explain SMTP in this task and elaborate on POP3 and IMAP in the following two tasks.</p><p>Simple Mail Transfer Protocol (SMTP) is used to communicate with an MTA server. Because SMTP uses cleartext, where all commands are sent without encryption, we can use a basic Telnet client to connect to an SMTP server and act as an email client (MUA) sending a message.</p><p>SMTP server listens on port 25 by default. To see basic communication with an SMTP server, we used Telnet to connect to it. Once connected, we issue helo hostname and then start typing our email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9MeXCSaI2YGRXLiqFM_wYA.png" /></figure><p>After helo, we issue mail from:, rcpt to: to indicate the sender and the recipient. When we send our email message, we issue the command data and type our message. We issue &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; (or Enter . Enter to put it in simpler terms). The SMTP server now queues the message.</p><p>Generally speaking, we don’t need to memorize SMTP commands. The console output above aims to help better explain what a typical mail client does when it uses SMTP.</p><h3>Answer the questions below</h3><p>1.Using the AttackBox terminal, connect to the SMTP port of the target VM. What is the flag that you can get?</p><blockquote>Port No for SMTP port is : 25<br>So, according to the question:<br><strong>Run:<br>telnet MACHINE_IP 25</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*sqx0Z0DXjrLCjWekW-i6Gg.png" /></figure><p>ANSWER: <strong>THM{5b31ddfc0c11d81eba776e983c35e9b5}</strong></p><h3>Task 6: Post Office Protocol 3 (POP3)</h3><p>Post Office Protocol version 3 (POP3) is a protocol used to download the email messages from a Mail Delivery Agent (MDA) server, as shown in the figure below. The mail client connects to the POP3 server, authenticates, downloads the new email messages before (optionally) deleting them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*wQBnQGZUTMadBdTU.png" /></figure><p>The example below shows what a POP3 session would look like if conducted via a Telnet client. First, the user connects to the POP3 server at the POP3 default port 110. Authentication is required to access the email messages; the user authenticates by providing his username USER frank and password PASS D2xc9CgD. Using the command STAT, we get the reply +OK 1 179; based on <a href="https://datatracker.ietf.org/doc/html/rfc1939">RFC 1939</a>, a positive response to STAT has the format +OK nn mm, where <em>nn</em> is the number of email messages in the inbox, and <em>mm</em> is the size of the inbox in octets (byte). The command LIST provided a list of new messages on the server, and RETR 1 retrieved the first message in the list. We don’t need to concern ourselves with memorizing these commands; however, it is helpful to strengthen our understanding of such<br>protocol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9vJe-Kud2vsM0YnwUn-d9Q.png" /></figure><p>The example above shows that the commands are sent in cleartext. Using Telnet was enough to authenticate and retrieve an email message. As the username and password are sent in cleartext, any third party watching the network traffic can steal the login credentials.</p><p>In general, your mail client (MUA) will connect to the POP3 server (MDA), authenticate, and download the messages. Although the communication using the POP3 protocol will be hidden behind a sleek interface, similar commands will be issued, as shown in the Telnet session above.</p><p>Based on the default settings, the mail client deletes the mail message after it downloads it. The default behaviour can be changed from the mail client settings if you wish to download the emails again from another mail client. Accessing the same mail account via multiple clients using POP3 is usually not very convenient as one would lose track of read and unread messages. To keep all mailboxes synchronized, we need to consider other protocols, such as IMAP.</p><h3>Answer the questions below</h3><p>1.Connect to the VM (MACHINE_IP) at the POP3 port. Authenticate using the username frank and password D2xc9CgD. What is the response you get to STAT?</p><p>Port No for POP3 is: 110</p><blockquote><strong>Run:</strong><br>telnet MACHINE_IP 110<br>USER frank<br>PASS D2xc9CgD<br>STAT</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*exwP9WAA4IV5eqaoWhBXPQ.png" /></figure><p>ANSWER: <strong>+OK 0 0</strong></p><p>2.How many email messages are available to download via POP3 on MACHINE_IP?</p><p>ANSWER: 0</p><h3>Task 7: Internet Message Access Protocol (IMAP)</h3><p>Internet Message Access Protocol (IMAP) is more sophisticated than POP3. IMAP makes it possible to keep your email synchronized across multiple devices (and mail clients). In other words, if you mark an email message as read when checking your email on your smartphone, the change will be saved on the IMAP server (MDA) and replicated on your laptop when you synchronize your inbox.</p><p>Let’s take a look at sample IMAP commands. In the console output below, we use Telnet to connect to the IMAP server’s default port, and then we authenticate using LOGIN username password. IMAP requires each command to be preceded by a random string to be able to track the reply. So we added c1, then c2, and so on. Then we listed our mail folders using LIST &quot;&quot; &quot;*&quot;, before checking if we have any new messages in the inbox using EXAMINE INBOX. We don’t need to memorize these commands; however, we are simply providing the example below to give a vivid image of what happens when the mail client communicates with an IMAP server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wyaeJ6d8FnRB_vtKBx5nRA.png" /></figure><p>It is clear that IMAP sends the login credentials in cleartext, as we can see in the command LOGIN frank D2xc9CgD. Anyone watching the network traffic would be able to know Frank’s username and password.</p><h3>Answer the questions below</h3><p>What is the default port used by IMAP?</p><p>Referring to the picture given above it is using port 143.</p><p>ANSWER: <strong>143</strong></p><h3>TASK 8: Summary</h3><p>This room covered various protocols, their usage, and how they work under the hood. Many other standard protocols are of interest to attackers. For instance, Server Message Block (SMB) provides shared access to files and printers between networks, and it can be an exciting target. However, this room intends only to give you a good knowledge of a few common protocols and how they work under the hood. One room or even a complete module can’t cover all the network protocols.</p><p>It is good to remember the default port number for common protocols. Below is a summary of the protocols we covered, sorted in alphabetical order, along with their default port numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Ai_ggkaguEmQiKBo03ZDw.png" /></figure><p>In the next room of this module, we learn about various attacks against these protocols and servers along with mitigation steps.</p><p>In the next room of this module, we learn about various attacks against these protocols and servers along with mitigation steps.</p><h3>Answer the questions below</h3><p>1.By this, you have completed the seventh room of the <em>Network Security</em> module. Please proceed to the <a href="https://tryhackme.com/room/protocolsandservers2">Protocols and Servers 2</a> room “ to learn about related attacks and mitigations.</p><p>ANSWER: no answer needed.</p><p><strong>Thank you. I hope it helped you.</strong></p><p>NEXT ROOM: <a href="https://medium.com/@dassagnik360/protocols-and-servers-2-tryhackme-writeups-by-desync-381981eed5ba">Protocols &amp; Servers 2 | TryHackMe Writeups | by DESYNC</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4dd5e7f2c4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>