<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ronaldo Modesto</title>
    <description>The latest articles on DEV Community by Ronaldo Modesto (@r9n).</description>
    <link>https://dev.to/r9n</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F728302%2F66cf07e5-d022-40ac-85b3-259f39d5fed1.jpeg</url>
      <title>DEV Community: Ronaldo Modesto</title>
      <link>https://dev.to/r9n</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/r9n"/>
    <language>en</language>
    <item>
      <title>Using local LLMs in API log analysis for near real-time attack detection</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Fri, 26 Jun 2026 16:57:52 +0000</pubDate>
      <link>https://dev.to/r9n/using-local-llms-in-api-log-analysis-for-near-real-time-attack-detection-2dgi</link>
      <guid>https://dev.to/r9n/using-local-llms-in-api-log-analysis-for-near-real-time-attack-detection-2dgi</guid>
      <description>&lt;p&gt;A practical Proof of Concept (PoC): running a compact language model (&lt;code&gt;qwen2.5-coder:1.5b&lt;/code&gt;) locally via Ollama to inspect logs from a REST API and detect attacks — including semantic ones, such as IDOR — that slip past WAFs and static rules.&lt;/p&gt;

&lt;p&gt;The project used for this POC can be found here: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/R9n/api-logs-llm-analyze" rel="noopener noreferrer"&gt;github -&amp;gt; https://github.com/R9n/api-logs-llm-analyze&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;In recent years, Artificial Intelligence has gone from being a distant promise to becoming part of the day-to-day life of software engineering. Code generation, automated pull request review, assisted documentation, synthetic tests — the adoption curve of LLMs (Large Language Models) in the SDLC (Software Development Life Cycle) has grown almost exponentially. What once required specialized tools and dedicated teams can now be prototyped in an afternoon, on a personal machine.&lt;/p&gt;

&lt;p&gt;This same movement opens a fascinating (and ambiguous) chapter for &lt;strong&gt;defensive security (AppSec)&lt;/strong&gt;. On one hand, we gain a new kind of "analyst": a model capable of &lt;strong&gt;reading unstructured text, understanding context, and reasoning about intent&lt;/strong&gt; — something that tools based on fixed patterns were never able to do well. On the other hand, AI itself introduces &lt;strong&gt;new risks&lt;/strong&gt;: prompt injection, leakage of sensitive data in prompts, hallucinations that generate false positives, and the dependence on expensive infrastructure for inference at scale.&lt;/p&gt;

&lt;p&gt;At the center of this debate lies an old and increasingly acute problem: &lt;strong&gt;how do we monitor large volumes of API logs in real time?&lt;/strong&gt; A modern application generates thousands of log lines per minute. Most of it is legitimate operational noise. Hidden in that stream are the signs of attacks — a sequence of login attempts, a swapped ID, an exposed debug endpoint. Finding these signals manually is unfeasible, and traditional tools, as we will see, have structural limitations in detecting attacks that depend on &lt;strong&gt;context&lt;/strong&gt; rather than &lt;strong&gt;signature&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this article we will explore this idea a bit, trying to identify context-based attacks using an LLM and a simple but fast model.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Proposed Approach and Objectives
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;core&lt;/strong&gt; of this work is simple to state and challenging to execute: run a &lt;strong&gt;local LLM&lt;/strong&gt; as an automated security analyst, feeding it logs from a REST API in time windows, and measure its ability to &lt;strong&gt;detect attacks in (near) real time&lt;/strong&gt;. I say &lt;strong&gt;near&lt;/strong&gt; real time because we will always have the overhead of the model itself to analyze the logs, build the response, and return it to us.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not just Regex and signatures?
&lt;/h3&gt;

&lt;p&gt;Traditional detection approaches — rule-based WAFs, signature-based IDS, Regex filters — are excellent at what they were designed for: capturing &lt;strong&gt;known and textually explicit patterns&lt;/strong&gt;. A SQL Injection payload with &lt;code&gt;' OR '1'='1&lt;/code&gt;, a Path Traversal attempt with &lt;code&gt;../../etc/passwd&lt;/code&gt;, an XSS &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; — all of these have a clear "signature" that a static pattern recognizes.&lt;/p&gt;

&lt;p&gt;The problem is that &lt;strong&gt;an entire class of attacks has no signature at all&lt;/strong&gt;. Consider &lt;strong&gt;IDOR (Insecure Direct Object Reference)&lt;/strong&gt; / BOLA (Broken Object Level Authorization):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /users/47b4f0a3-d582-47e9-832f-1e80ac12fe4b
Authorization: Bearer &amp;lt;common-user-token&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Syntactically, this request is &lt;strong&gt;identical&lt;/strong&gt; to a legitimate one. There is no malicious character, no suspicious payload. What makes it an attack is the &lt;strong&gt;context&lt;/strong&gt;: a regular user accessing &lt;em&gt;another&lt;/em&gt; user's resource, or a single token touching many distinct IDs in a few seconds. Regex has no way of knowing this — it sees the line, not the story.&lt;/p&gt;

&lt;p&gt;This is exactly where AI changes the game. An LLM can &lt;strong&gt;understand the context&lt;/strong&gt; of a set of logs: correlate IPs, observe the cadence of requests, notice that a &lt;code&gt;PATCH /users/:id/promote-admin&lt;/code&gt; coming from a recently created token is semantically anomalous — even if each request, in isolation, seems legitimate. It analyzes the &lt;strong&gt;intent&lt;/strong&gt; inferred from behavior, not just the form.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scope: this is a PoC
&lt;/h3&gt;

&lt;p&gt;It is important to make clear from the outset: &lt;strong&gt;this work is a Proof of Concept (PoC)&lt;/strong&gt;. It is not a production-ready product, nor a replacement for corporate SIEM/WAF. It is a "start" — a controlled and reproducible experiment to answer a feasibility question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Is it possible to use a lightweight local LLM to point out real attacks in API logs, including the logical/semantic attacks that static tools don't catch?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The goal is to demonstrate the &lt;strong&gt;feasibility of the approach&lt;/strong&gt; and map out its pros, cons, and evolution paths toward a production scenario. This project &lt;strong&gt;THIS PROJECT IS NOT READY FOR PRODUCTION; IT LACKS ADEQUATE PROTECTION MECHANISMS&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Technology Stack
&lt;/h2&gt;

&lt;p&gt;To run the experiment we will adopt the &lt;strong&gt;"all local"&lt;/strong&gt; policy: no log data leaves the machine, no calls to third-party APIs, inference cost equal to zero. This is especially relevant for security, where logs frequently contain sensitive data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Execution platform: Ollama
&lt;/h3&gt;

&lt;p&gt;Inference runs on &lt;strong&gt;&lt;a href="https://ollama.com/" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt;&lt;/strong&gt;, which exposes the model locally at &lt;code&gt;http://localhost:11434&lt;/code&gt;. It handles loading the model onto the GPU, managing the context, and serving the responses via HTTP API — which makes it trivial to integrate into any Python pipeline.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model used: &lt;code&gt;qwen2.5-coder:1.5b&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The choice of model was deliberate and perhaps counterintuitive. Instead of a giant model with tens of billions of parameters, we opted for &lt;strong&gt;&lt;code&gt;qwen2.5-coder:1.5b&lt;/code&gt;&lt;/strong&gt; — a model with only &lt;strong&gt;1.5 billion parameters&lt;/strong&gt;. The rationale:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight and fast:&lt;/strong&gt; it fits comfortably in the VRAM of a more modest GPU and responds fast enough for analysis in 1-minute windows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimized for structured tasks:&lt;/strong&gt; being a &lt;em&gt;coder&lt;/em&gt; variant, it is particularly good at understanding and producing structured outputs (JSON), interpreting technical formats (HTTP, paths, query strings), and following format instructions — exactly the profile needed to classify logs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proof of efficiency:&lt;/strong&gt; part of the experiment's hypothesis is that analysis of &lt;strong&gt;text/structured logs does not require colossal models&lt;/strong&gt;. A compact, specialized model may be sufficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hardware configuration
&lt;/h3&gt;

&lt;p&gt;The experiment ran entirely on a developer workstation (consumer hardware, not a server):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Specification&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;NVIDIA RTX 3080 (10 GB VRAM)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Intel Core i5 13600KF&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;32 GB RAM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Storage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Standard NVMe SSD&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Language and main libraries
&lt;/h3&gt;

&lt;p&gt;The ecosystem is divided into two worlds, reflecting the real structure of the project:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitor and scripts (Python):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.crewai.com/" rel="noopener noreferrer"&gt;CrewAI&lt;/a&gt;&lt;/strong&gt; — orchestration of the analysis agent (definition of &lt;code&gt;Agent&lt;/code&gt;, &lt;code&gt;Task&lt;/code&gt;, and &lt;code&gt;Crew&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;langchain-ollama&lt;/code&gt; / Ollama integration&lt;/strong&gt; — bridge between CrewAI and the local model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;requests&lt;/code&gt;&lt;/strong&gt; — collecting API logs and running the traffic/attack scripts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;schedule&lt;/code&gt;&lt;/strong&gt; — scheduling the analysis windows (periodic execution).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;pydantic&lt;/code&gt;&lt;/strong&gt; — validation and typing of the model's output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Target API (Node.js / TypeScript):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://nestjs.com/" rel="noopener noreferrer"&gt;NestJS 11&lt;/a&gt;&lt;/strong&gt; — framework for the user management REST API. It's just an example API, only so we have something to analyze.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;@nestjs/jwt&lt;/code&gt; + &lt;code&gt;passport-jwt&lt;/code&gt;&lt;/strong&gt; — JWT authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;bcrypt&lt;/code&gt;&lt;/strong&gt; — password hashing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;class-validator&lt;/code&gt; / &lt;code&gt;class-transformer&lt;/code&gt;&lt;/strong&gt; — DTO validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;@nestjs/swagger&lt;/code&gt;&lt;/strong&gt; — automatic API documentation.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Architecture and Project Structure
&lt;/h2&gt;

&lt;p&gt;The project was organized into four major blocks: the &lt;strong&gt;target API&lt;/strong&gt;, the &lt;strong&gt;monitor (LLM agent)&lt;/strong&gt;, the &lt;strong&gt;simulation/attack scripts&lt;/strong&gt;, and the &lt;strong&gt;consolidation utilities&lt;/strong&gt;. The general data flow is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────┐     ┌──────────────────────┐     ┌─────────────────────┐
│  Simulation / Attack│────▶│   NestJS API         │────▶│  operations.log     │
│  (Python scripts)   │     │   (generates JSON    │     │  (api/logs/)        │
│                     │     │    logs)             │     │                     │
└─────────────────────┘     └──────────────────────┘     └──────────┬──────────┘
                                                                     │
                                                                     ▼
┌─────────────────────┐     ┌──────────────────────┐     ┌─────────────────────┐
│  Results (.json)    │◀────│   CrewAI Monitor     │◀────│  GET /logs          │
│  monitor/results/   │     │   + Ollama (Qwen)    │     │  (time window)      │
└─────────────────────┘     └──────────────────────┘     └─────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Macro role of each component
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;api/&lt;/code&gt;&lt;/strong&gt; — The target application. A user management API with JWT authentication. Its key role for the experiment lies in the &lt;code&gt;logging/&lt;/code&gt; module: a &lt;strong&gt;global interceptor&lt;/strong&gt; (&lt;code&gt;LoggingInterceptor&lt;/code&gt;) captures each request and writes a structured JSON record (method, path, IP, &lt;code&gt;userId&lt;/code&gt;, sanitized body, status code, latency). The &lt;code&gt;GET /logs&lt;/code&gt; endpoint allows querying these records by &lt;strong&gt;time window&lt;/strong&gt; (&lt;code&gt;?start=&amp;amp;end=&amp;amp;limit=&lt;/code&gt;) — it is the source the monitor consumes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;monitor/&lt;/code&gt;&lt;/strong&gt; — The AI agent. &lt;code&gt;main.py&lt;/code&gt; runs in a loop: every minute, it computes the time window, fetches the logs via &lt;code&gt;GET /logs&lt;/code&gt;, assembles the prompt, and triggers the CrewAI &lt;code&gt;Crew&lt;/code&gt;. The model's response is validated against the Pydantic schema and persisted as &lt;code&gt;analysis-YYYYMMDD-HHMMSS.json&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scripts/trafic-simulation/&lt;/code&gt;&lt;/strong&gt; — Generates the &lt;strong&gt;legitimate background noise&lt;/strong&gt;: sign-ups, correct and incorrect logins, profile editing, password reset, expected validation errors (400/401/409). This is fundamental for testing whether the model distinguishes normal traffic from attacks (and not simply "screams attack" at everything).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scripts/attacks/&lt;/code&gt;&lt;/strong&gt; — The &lt;strong&gt;controlled attacks&lt;/strong&gt;: password spray, user enumeration, and IDOR. All run only against the local API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scripts/utils/aggregate_results.py&lt;/code&gt;&lt;/strong&gt; — Consolidates all result JSONs into a Markdown report with aggregated metrics (the basis of Section 7).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Agent Configuration and Behavior
&lt;/h2&gt;

&lt;p&gt;The agent was modeled with &lt;strong&gt;CrewAI&lt;/strong&gt;, which cleanly separates the &lt;em&gt;persona&lt;/em&gt; (who the agent is) from the &lt;em&gt;task&lt;/em&gt; (what it should do). All the "intelligence" of the experiment lives in the prompt engineering of the configuration files.&lt;/p&gt;

&lt;h3&gt;
  
  
  The persona: a senior security analyst
&lt;/h3&gt;

&lt;p&gt;In the &lt;code&gt;config/agents.yml&lt;/code&gt; file, the &lt;code&gt;security_log_analyst&lt;/code&gt; agent receives a role, a goal, and a detailed &lt;em&gt;backstory&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; &lt;em&gt;"Senior cybersecurity analyst specializing in detecting vulnerabilities and anomalous behavior in application and API logs."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Goal:&lt;/strong&gt; detect and prioritize active attacks by analyzing API execution logs according to the &lt;strong&gt;OWASP API Security Top 10 (2023)&lt;/strong&gt; standards, producing concise findings with a triggered criterion, exact evidence, severity, confidence &lt;em&gt;score&lt;/em&gt; (0–100), and recommended action.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The real key is in the &lt;strong&gt;backstory&lt;/strong&gt;, which functions as the analyst's "brain". It instructs the model to inspect each log event — &lt;strong&gt;HTTP method, path, query string, headers, body, status code, latency, source IP, user-agent, token identity, and temporal correlation&lt;/strong&gt; — and classify it against the &lt;strong&gt;10 OWASP API Top 10 criteria&lt;/strong&gt;, each with explicit &lt;em&gt;match&lt;/em&gt; rules. Some examples embedded in the prompt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;[Detect:API1-BOLA]&lt;/code&gt;&lt;/strong&gt; — sequential IDs/foreign UUIDs in the path, the same token accessing many distinct IDs in a short interval, &lt;em&gt;ID swap&lt;/em&gt; returning 200 → &lt;strong&gt;IDOR&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;[Detect:API2-BrokenAuth]&lt;/code&gt;&lt;/strong&gt; — bursts of 401/403, &lt;em&gt;credential stuffing&lt;/em&gt;/brute force, high volume on &lt;code&gt;login&lt;/code&gt;/&lt;code&gt;token&lt;/code&gt;/&lt;code&gt;reset-password&lt;/code&gt; without rate limiting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;[Detect:API5-BFLA]&lt;/code&gt;&lt;/strong&gt; — calls to privileged routes (&lt;code&gt;/admin&lt;/code&gt;, &lt;code&gt;/users/:id/role&lt;/code&gt;) by low-privilege tokens; horizontal/vertical escalation.&lt;/li&gt;
&lt;li&gt;...and so on up to &lt;code&gt;API10-UnsafeConsumption&lt;/code&gt; (classic injections: SQLi, NoSQLi, XSS, Command Injection, Path Traversal).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Three behavioral guidelines are especially important:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;False positive reduction:&lt;/strong&gt; the prompt instructs the model to &lt;em&gt;correlate frequency, repetition, shared origin, and deviation from the route's expected baseline&lt;/em&gt; before classifying something as an attack, and to mark it as &lt;code&gt;[Benign]&lt;/code&gt; when no criterion is met.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safety of the analyst itself:&lt;/strong&gt; &lt;em&gt;"Never execute, reproduce, or echo malicious payloads actively — only reference them as evidence."&lt;/em&gt; — the agent never actively reproduces payloads, only cites them as evidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Correlation:&lt;/strong&gt; for distributed/correlated attacks, aggregate by IP/token/time window and escalate the severity.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The structured output
&lt;/h3&gt;

&lt;p&gt;The task (&lt;code&gt;tasks-analise-logs-owasp.yml&lt;/code&gt;) requires the model to return &lt;strong&gt;strict JSON&lt;/strong&gt;, which is then validated by the Pydantic schema in &lt;code&gt;models/analyze_result.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Any&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;severity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Literal&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Critical&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;High&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Medium&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;
    &lt;span class="n"&gt;recommendedAction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LogAnalyzeResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;threatDetected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;
    &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_factory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In other words: the agent reads the batch of logs, reasons about anomalies, and returns a list of &lt;strong&gt;suspicious events&lt;/strong&gt; — each with evidence, severity, &lt;strong&gt;confidence (0–100%)&lt;/strong&gt;, recommended action, and the full HTTP context. This structuring is what allows aggregating and measuring the results objectively.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Experiment Methodology (Execution Flow)
&lt;/h2&gt;

&lt;p&gt;The experiment was designed to be &lt;strong&gt;reproducible&lt;/strong&gt;. The chronological step-by-step:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 — Starting the target API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;api
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run start:dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API comes up at &lt;code&gt;http://localhost:3000&lt;/code&gt;, with a pre-seeded administrator (&lt;code&gt;admin123@company.com&lt;/code&gt; / &lt;code&gt;admin&lt;/code&gt;) and the logging interceptor already active recording each request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 — Starting the Agent Monitor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;monitor
python main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The monitor enters a loop, "listening" to the API logs every &lt;strong&gt;1 minute&lt;/strong&gt; (&lt;code&gt;time_window = 1&lt;/code&gt;), consuming the &lt;code&gt;GET /logs&lt;/code&gt; endpoint by time window and triggering the CrewAI agent over each batch (up to 50 lines per window, as per &lt;code&gt;defaultApiLimitLines&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3 — Running legitimate traffic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/trafic-simulation/normal-trafic.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script generates the &lt;strong&gt;realistic background noise&lt;/strong&gt;: successful and unsuccessful logins, valid and invalid sign-ups, profile edits, admin block/unblock cycles, password reset. It is the experiment's "control" — the traffic that the model should &lt;strong&gt;not&lt;/strong&gt; classify as an attack.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4 — Running the simulated attacks
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;scripts/attacks
python password-spray.py        &lt;span class="c"&gt;# one common password against many users&lt;/span&gt;
python user-enumeration.py      &lt;span class="c"&gt;# 401 vs 404 differentiation to map users&lt;/span&gt;
python idor.py                  &lt;span class="c"&gt;# semantic attack: GET/PATCH on others' resources&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With emphasis on &lt;strong&gt;&lt;code&gt;idor.py&lt;/code&gt;&lt;/strong&gt;, the central &lt;strong&gt;semantic&lt;/strong&gt; attack of the experiment: it creates a regular "attacker", logs in, and tries &lt;code&gt;GET /users/:id&lt;/code&gt;, &lt;code&gt;PATCH /users/:id/block&lt;/code&gt;, &lt;code&gt;.../unblock&lt;/code&gt;, and &lt;code&gt;.../promote-admin&lt;/code&gt; on a &lt;strong&gt;victim's&lt;/strong&gt; ID — requests that look perfectly legitimate in form, but are malicious in context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5 — Observation, collection, and analysis
&lt;/h3&gt;

&lt;p&gt;While normal traffic and attacks run in parallel (generating the &lt;strong&gt;mixed traffic&lt;/strong&gt; that makes the test realistic), the monitor produces one JSON per window in &lt;code&gt;monitor/results/&lt;/code&gt;. At the end, the consolidation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/utils/aggregate_results.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;generates the &lt;code&gt;analise-resultados.md&lt;/code&gt; report with all the aggregated metrics — exactly the data presented in the next section.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Observed Results and Critical Analysis
&lt;/h2&gt;

&lt;p&gt;The consolidation covered &lt;strong&gt;23 runs&lt;/strong&gt; of the agent over API logs, processing &lt;strong&gt;809 log lines&lt;/strong&gt; in mixed traffic (normal + attacks) over approximately 50 minutes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Experiment summary
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Period analyzed&lt;/td&gt;
&lt;td&gt;06/20/2026 14:46 – 06/20/2026 15:35 UTC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total analyses&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analyses with threat detected&lt;/td&gt;
&lt;td&gt;10 (43.5%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analyses without threat&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total logs processed&lt;/td&gt;
&lt;td&gt;809&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total events generated by the LLM&lt;/td&gt;
&lt;td&gt;221&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average events per analysis&lt;/td&gt;
&lt;td&gt;9.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Global average confidence&lt;/td&gt;
&lt;td&gt;79.9%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Global severity distribution
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Occurrences&lt;/th&gt;
&lt;th&gt;Share&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;10.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;187&lt;/td&gt;
&lt;td&gt;84.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;5.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Detections by attack type
&lt;/h3&gt;

&lt;p&gt;Heuristic classification of the events based on the endpoint, HTTP method, and description returned by the model, aligned with the repository's attack scripts.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attack&lt;/th&gt;
&lt;th&gt;Detections (events)&lt;/th&gt;
&lt;th&gt;Analyses with the pattern&lt;/th&gt;
&lt;th&gt;Average severity&lt;/th&gt;
&lt;th&gt;Average confidence&lt;/th&gt;
&lt;th&gt;Most cited endpoint&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Password Spray / Brute Force&lt;/td&gt;
&lt;td&gt;133&lt;/td&gt;
&lt;td&gt;10/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;78.0%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /auth/login&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sign-up abuse (POST /users)&lt;/td&gt;
&lt;td&gt;38&lt;/td&gt;
&lt;td&gt;5/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;83.8%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /users&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API scanning / reconnaissance&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;4/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;83.4%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET /debug/database&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Other / model noise&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;3/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;93.3%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /api-documentation&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User enumeration&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;1/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;67.7%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET /users/:id?&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IDOR (privilege escalation)&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;2/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;94.2%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PATCH /users/ee87a7c3-f69e-4a4b-ae0f-db425d26a741/unblock&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unauthorized access&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1/23&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;64.0%&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET /check-activity&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here we have some prints of the execution of POC execution&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fummkghe21o26wvld9qod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fummkghe21o26wvld9qod.png" alt="no threats detected" width="800" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxl3ezke04mq5ivecnl8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxl3ezke04mq5ivecnl8k.png" alt="example of threats detected" width="800" height="712"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh5yt1f22s2rsj8ji85jz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh5yt1f22s2rsj8ji85jz.png" alt="example of threats detected" width="571" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Coverage by analysis window
&lt;/h3&gt;

&lt;p&gt;How many monitor runs identified each attack pattern (regardless of the number of events within the same window).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attack&lt;/th&gt;
&lt;th&gt;Windows with detection&lt;/th&gt;
&lt;th&gt;Rate over 23 analyses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Password Spray / Brute Force&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;43.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sign-up abuse (POST /users)&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;21.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API scanning / reconnaissance&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;17.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Other / model noise&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;13.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IDOR (privilege escalation)&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;8.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unauthorized access&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;4.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User enumeration&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;4.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Critical analysis of the data
&lt;/h3&gt;

&lt;p&gt;The numbers tell an encouraging story for a PoC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The model detected the attacks that mattered.&lt;/strong&gt; In 10 of the 23 windows (43.5%), the agent raised a threat flag — and these detections are concentrated exactly on the vectors that were effectively simulated. &lt;strong&gt;Password Spray / Brute Force&lt;/strong&gt; was the detection champion (133 events, present in 10 windows), which is entirely consistent: &lt;code&gt;password-spray.py&lt;/code&gt; hammers &lt;code&gt;POST /auth/login&lt;/code&gt; repeatedly, and the burst of attempts from the same IP is precisely the kind of temporal pattern that the LLM correlates well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The high point: the semantic detection of IDOR.&lt;/strong&gt; This was the most difficult and most relevant test of the PoC. Remember: IDOR requests are &lt;em&gt;syntactically legitimate&lt;/em&gt; — a traditional WAF would let them through without blinking. Even so, the agent identified the pattern of &lt;strong&gt;privilege escalation via &lt;code&gt;PATCH /users/:id/unblock&lt;/code&gt; and administrative actions on others' resources&lt;/strong&gt;, and did so with the &lt;strong&gt;highest average confidence of the entire experiment: 94.2%&lt;/strong&gt;. In other words, the model not only caught the attack invisible to static rules, but it was also the finding it was &lt;em&gt;most confident&lt;/em&gt; about. This result, on its own, validates the central hypothesis of the work: &lt;strong&gt;the LLM's contextual analysis sees logical attacks that signatures don't see.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Confidence consistent with the clarity of the signal.&lt;/strong&gt; The global average confidence stood at 79.9%, but the variation by category is revealing and shows a "calibrated" model: patterns with a strong signature and unambiguous context (IDOR at 94.2%, sign-up abuse at 83.8%, reconnaissance at 83.4%) receive high confidence, while more ambiguous inferences (unauthorized access at 64.0%, enumeration at 67.7%) receive lower confidence. The model, in essence, "knows when it's not sure".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The severity was well distributed.&lt;/strong&gt; The predominance of &lt;strong&gt;High (84.6%)&lt;/strong&gt; is appropriate for the set of attacks tested, with &lt;strong&gt;Critical (10.4%)&lt;/strong&gt; appearing mainly in the windows of the most intense password spray — consistent with the &lt;code&gt;API2-BrokenAuth&lt;/code&gt; criterion, classified as critical in the prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And the cons already show up in the data.&lt;/strong&gt; The &lt;em&gt;"Other / model noise"&lt;/em&gt; category (12 events) is honest about the limit of the approach: it captures &lt;strong&gt;malformed or hallucinated responses&lt;/strong&gt; from the LLM — invented or duplicated paths (&lt;code&gt;POST /api-documentation&lt;/code&gt;, &lt;code&gt;/check-activity&lt;/code&gt;, &lt;code&gt;/token-authenticate&lt;/code&gt;) that don't correspond to real API endpoints. Curiously, these events came with high average confidence (93.3%), which is an important reminder: &lt;strong&gt;self-reported confidence by an LLM is no guarantee of correctness.&lt;/strong&gt; This connects directly to the next section.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Pros and Cons of the Approach
&lt;/h2&gt;

&lt;p&gt;A frank assessment, based on what the experiment showed in practice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Detection of advanced attacks (the real differentiator).&lt;/strong&gt;&lt;br&gt;
The biggest asset of the approach is mitigating vulnerabilities that go unnoticed by common firewalls and WAFs — especially &lt;strong&gt;business logic flaws&lt;/strong&gt; and &lt;strong&gt;IDOR/BOLA&lt;/strong&gt;. Since the traffic of these attacks is syntactically legitimate, signature-based tools simply don't see them. The LLM's ability to &lt;strong&gt;analyze the context&lt;/strong&gt; (who, accessing what, with what frequency, deviating from which baseline) allowed it to detect the simulated IDOR with 94.2% confidence. This is the kind of coverage that normally requires custom and expensive business rules — and that here emerged from the model's semantic understanding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Efficiency of compact models.&lt;/strong&gt;&lt;br&gt;
The experiment delivered an excellent hit rate using an &lt;strong&gt;extremely lightweight model (Qwen 1.5B)&lt;/strong&gt;. This demystifies the idea that AI-assisted security analysis requires gigantic models. For the task of &lt;strong&gt;interpreting text/structured logs&lt;/strong&gt;, a small, well-instructed model (with a good prompt based on the OWASP API Top 10) was sufficient. The practical implications are enormous: lower cost, lower latency, feasibility of running &lt;em&gt;on-premise&lt;/em&gt;, and total privacy of the log data.&lt;/p&gt;

&lt;p&gt;**3.Total control over data privacy.&lt;br&gt;
Another critical advantage of this architecture is how it handles data privacy. By utilizing local, lightweight models, no confidential or sensitive data ever leaves the user's controlled environment. The entire pipeline—from log collection and context parsing to the final LLM evaluation—runs within your own infrastructure (on-premise or private cloud). This eliminates compliance risks associated with exposing internal traffic data to third-party APIs, ensuring absolute governance over corporate information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cons
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. False positives (and hallucinations).&lt;/strong&gt;&lt;br&gt;
Under mixed traffic and in stress tests, the model &lt;strong&gt;classified legitimate/normal traffic as an attack&lt;/strong&gt; at some moments, and — more worryingly — even "hallucinated" endpoints that don't exist in the API (the &lt;em&gt;"Other / model noise"&lt;/em&gt; category), sometimes with high confidence. This shows that the approach &lt;strong&gt;requires continuous prompt refinement (Prompt Tuning)&lt;/strong&gt;, stricter output validation (whitelist of real endpoints, &lt;em&gt;grounding&lt;/em&gt; against the API inventory), and, above all, human supervision. An alert with 93% confidence about a non-existent endpoint is proof that &lt;strong&gt;self-reported confidence does not replace verification&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Local computational cost (Resource Exhaustion).&lt;/strong&gt;&lt;br&gt;
Even with a model of only 1.5B parameters, the &lt;strong&gt;GPU and VRAM&lt;/strong&gt; consumption on the RTX 3080 (10 GB) was significant during continuous inference. For a PoC with 1-minute windows and ~50 logs per batch, it is perfectly manageable. But the experiment makes it clear that &lt;strong&gt;the approach does not scale linearly without cost&lt;/strong&gt;: in a real production scenario — thousands of requests per second, multiple APIs, smaller windows — it would be necessary either to &lt;strong&gt;migrate to cloud models via API&lt;/strong&gt; (trading privacy and variable cost for scale) or to &lt;strong&gt;invest in dedicated GPU infrastructure&lt;/strong&gt; (raising Capex/Opex considerably). There is no free lunch: the inference cost is the tribute of semantic analysis.&lt;br&gt;
Here we have an print of the moment that the monitor was performing an analyze, as we can see, to run a llm model, even a tiny one, you need a considerable computational power&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fydp6x1kw1iiic77kaozl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fydp6x1kw1iiic77kaozl.png" alt="computational consumption" width="770" height="659"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Conclusion and Next Steps
&lt;/h2&gt;

&lt;p&gt;This experiment demonstrated, in practice, that AI opens up &lt;strong&gt;disruptive horizons for application security&lt;/strong&gt; — and not only in runtime detection, but at any stage of the SDLC. A lightweight local model, guided by a prompt grounded in the OWASP API Top 10, was able to detect not only classic attacks (password spray, enumeration, reconnaissance), but mainly the &lt;strong&gt;semantic attacks like IDOR&lt;/strong&gt;, which are the historical blind spot of signature-based tools. For a PoC running on consumer hardware, it is an expressive result.&lt;/p&gt;

&lt;p&gt;That said, the same PoC exposed the &lt;strong&gt;frontiers of the approach&lt;/strong&gt;: false positives, occasional hallucinations, and non-trivial computational cost. Therefore, the most important conclusion is also the most sober one: the &lt;strong&gt;"Human-in-the-loop" factor is indispensable&lt;/strong&gt;. AI should act as a &lt;strong&gt;force multiplier&lt;/strong&gt; for the analyst — triaging, prioritizing, and contextualizing — and not as an autonomous judge. Human review remains the quality control that separates a useful alert from expensive noise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next Steps: evolving the PoC with Vector DB / RAG
&lt;/h3&gt;

&lt;p&gt;The most structural limitation of the current design is that it analyzes &lt;strong&gt;isolated windows, without memory&lt;/strong&gt;. Each run sees only the last minute of logs — and this amnesia is a conceptual vulnerability.&lt;/p&gt;

&lt;p&gt;The next big leap is to integrate a &lt;strong&gt;Vector Database (Vector DB)&lt;/strong&gt; in a &lt;strong&gt;RAG (Retrieval-Augmented Generation)&lt;/strong&gt; architecture. The idea: store embeddings of the history of events and behaviors, so that each new analysis can &lt;strong&gt;retrieve relevant past context&lt;/strong&gt; before deciding.&lt;/p&gt;

&lt;p&gt;This would unlock the detection of a class of attacks that is today &lt;strong&gt;impossible&lt;/strong&gt; to capture by analyzing isolated lines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Low and Slow" attacks:&lt;/strong&gt; the attacker makes &lt;em&gt;one&lt;/em&gt; malicious request today, &lt;em&gt;another&lt;/em&gt; tomorrow, deliberately spacing out the actions to stay below rate limiting thresholds and correlation windows. Without memory, each request seems harmless; with semantic memory, the pattern distributed over time emerges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced Persistent Threats (APT):&lt;/strong&gt; long, multi-stage campaigns, where reconnaissance, escalation, and exfiltration happen over days or weeks. Only a correlatable long-term memory allows connecting the dots.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a Vector DB, the agent would stop being an analyst with amnesia every minute and become an analyst with &lt;strong&gt;long-term memory&lt;/strong&gt; — able to ask "have I seen this IP/token/behavior before?" and to reconstruct the &lt;em&gt;narrative&lt;/em&gt; of an attack that unfolds slowly. This is the natural path to transforming this PoC into something that approaches a truly contextual detection tool.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Legal disclaimer:&lt;/strong&gt; all attack scripts in this experiment are intended exclusively for controlled lab environments and educational purposes. Never use them against systems without express authorization.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://docs.crewai.com" rel="noopener noreferrer"&gt;CrewAi Docs&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://owasp.org/www-project-api-security" rel="noopener noreferrer"&gt;OWASP Top 10 API&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://docs.ollama.com" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://cloud.google.com/discover/what-is-prompt-engineering" rel="noopener noreferrer"&gt;Prompt Engineering Guide by Google&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;I hope this article serves at least to spark curiosity about how we can advance the monitoring of our applications.&lt;br&gt;
Stay well and see you next time 🙂&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>cybersecurity</category>
      <category>rest</category>
    </item>
    <item>
      <title>Protocols Visualizer: An Interactive Way to Learn Network Protocols</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Sat, 07 Mar 2026 13:35:49 +0000</pubDate>
      <link>https://dev.to/r9n/protocols-visualizer-an-interactive-way-to-learn-network-protocols-4nep</link>
      <guid>https://dev.to/r9n/protocols-visualizer-an-interactive-way-to-learn-network-protocols-4nep</guid>
      <description>&lt;p&gt;Understanding how network protocols work is often heavy going: RFCs and textbooks explain the concepts, but it's hard to "see" handshakes, packet structure, and attacks in action. &lt;strong&gt;Protocols Visualizer&lt;/strong&gt; is a free, interactive web app that turns those ideas into visual, step-by-step flows and simulations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://protocols-visualizer.vercel.app/en" rel="noopener noreferrer"&gt;Try it here: https://protocols-visualizer.vercel.app/en&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The app is built around the &lt;strong&gt;OSI model&lt;/strong&gt;. You can browse all seven layers — from Physical (Bluetooth, USB, Coaxial) up to Application (HTTP, DNS, FTP, SMTP) — and open each protocol to explore three main areas: &lt;strong&gt;Communication Flow&lt;/strong&gt; (animated sequence diagrams), &lt;strong&gt;Packet Anatomy&lt;/strong&gt; (interactive headers), and &lt;strong&gt;Attack Simulation&lt;/strong&gt; (e.g. SYN Flood, ARP Spoofing, deauth, Bad USB). The goal is to make dense topics like TCP handshakes, IP routing, or common attacks easier to grasp by showing them in motion instead of only in text.&lt;/p&gt;

&lt;p&gt;The project is implemented with &lt;strong&gt;Next.js&lt;/strong&gt;, &lt;strong&gt;React&lt;/strong&gt;, &lt;strong&gt;TypeScript&lt;/strong&gt;, and &lt;strong&gt;Tailwind CSS&lt;/strong&gt;, and is available in &lt;strong&gt;English&lt;/strong&gt; and &lt;strong&gt;Portuguese&lt;/strong&gt;. Whether you're studying for certs, teaching networking, or just curious how the stack works, Protocols Visualizer is a handy companion to see protocols in action.&lt;/p&gt;

&lt;p&gt;Feedbacks are welcome &lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>osi</category>
      <category>network</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Safeinstall: Um aliado no combate a ataques de Supply chain</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Thu, 19 Feb 2026 22:10:25 +0000</pubDate>
      <link>https://dev.to/r9n/safeinstall-um-aliado-no-combate-a-ataques-de-supply-chain-47mh</link>
      <guid>https://dev.to/r9n/safeinstall-um-aliado-no-combate-a-ataques-de-supply-chain-47mh</guid>
      <description>&lt;p&gt;Olá, pessoal!&lt;/p&gt;

&lt;p&gt;Se você é desenvolvedor ou, pelo menos, envolvido com a área tech, tenho certeza de que já ouviu falar de ataques de supply chain, ou ataques de cadeia de suprimentos.&lt;/p&gt;

&lt;p&gt;Esse tipo de ataque tem se tornado cada vez mais frequente, ainda mais com IAs gerando cada vez mais código sem supervisão. Com isso em mente, criei uma ferramenta que visa impedir que dependências comprometidas sejam instaladas em seu projeto, reduzindo o risco de um ataque bem-sucedido de cadeia de suprimentos.&lt;/p&gt;

&lt;p&gt;Chega mais para conhecer! E, claro, todo feedback é super bem-vindo. 🙂&lt;/p&gt;

&lt;p&gt;Ha e claro, se quiser saber mais sobre o que é supply chain atack, dá uma conferida aqui &lt;a href="https://dev.to/r9n/como-funciona-supply-chain-attack-ptbr-31i0"&gt;O que é Suply Chain Attack&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A Crise de Segurança na Cadeia de Suprimentos Open Source
&lt;/h2&gt;

&lt;p&gt;Os ataques de supply chain (cadeia de suprimentos) têm aumentado de forma alarmante nos últimos anos. Dados recentes revelam um cenário preocupante:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Malware em código aberto subiu 156%&lt;/strong&gt; de um ano para outro em 2024, com mais de 704 mil pacotes maliciosos identificados desde 2019.&lt;/li&gt;
&lt;li&gt;Em 2025, houve um &lt;strong&gt;aumento de 73% em pacotes open source maliciosos&lt;/strong&gt; detectados em comparação com 2024.&lt;/li&gt;
&lt;li&gt;Entre 2020 e 2023, as ameaças em repositórios open source &lt;strong&gt;cresceram 1.300%&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;O custo global anual projetado de ataques de supply chain deve alcançar &lt;strong&gt;US$ 60 bilhões em 2025&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;No ecossistema &lt;strong&gt;npm&lt;/strong&gt;, a atividade maliciosa mais do que dobrou em 2025, representando quase &lt;strong&gt;90% de todo o malware open source&lt;/strong&gt; detectado.&lt;/li&gt;
&lt;li&gt;Terceiros comprometidos passaram a representar &lt;strong&gt;30% de todas as violações de dados&lt;/strong&gt; em 2025.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instalar dependências sem verificação tornou-se uma operação de risco. Mesmo pacotes populares podem conter vulnerabilidades conhecidas ou, em cenários mais graves, serem comprometidos por atacantes.&lt;/p&gt;




&lt;h2&gt;
  
  
  O que é o SafeInstall ✅?
&lt;/h2&gt;

&lt;p&gt;O &lt;strong&gt;SafeInstall&lt;/strong&gt; é um wrapper de segurança para comandos de instalação de pacotes que consulta a API do &lt;a href="https://osv.dev" rel="noopener noreferrer"&gt;OSV (Open Source Vulnerabilities)&lt;/a&gt; para identificar vulnerabilidades conhecidas &lt;strong&gt;antes&lt;/strong&gt; de permitir que a instalação seja concluída. Assim, ele ajuda a reduzir ataques de supply chain alertando o desenvolvedor sobre pacotes vulneráveis antes que eles entrem no projeto.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repositório da ferramenta&lt;/strong&gt; 🚀: &lt;a href="https://github.com/R9n/safeinstall" rel="noopener noreferrer"&gt;Github&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Benefícios Principais
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Verificação antes da instalação&lt;/strong&gt; — Nada é instalado sem checagem de vulnerabilidades.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integração com OSV&lt;/strong&gt; — Usa dados agregados do GitHub Advisory, PyPI Advisory, CVE/NVD, RustSec, Go Vulnerability Database e outros.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Suporte a múltiplos ecossistemas&lt;/strong&gt; — npm, pip, Go, Cargo, RubyGems, Packagist, Pub.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instalações em lote&lt;/strong&gt; — Protege comandos como &lt;code&gt;npm install&lt;/code&gt; e &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controle nas suas mãos&lt;/strong&gt; — Permite confirmar ou cancelar instalações com risco identificado.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A seguir temos mostro exemplos de como a ferramenta funciona e como ela pode auxiliar na proteção desse tipo de ataque.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bloqueando instalação de biblioteca especificando uma versão&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6hf7e8bzuir5321o1qx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6hf7e8bzuir5321o1qx.png" alt="blocking specific version" width="668" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bloqueando instalação de biblioteca utilizando instalação em massa, por exemplo npm i&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvktyjhq1tw1wyi5z0b3f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvktyjhq1tw1wyi5z0b3f.png" alt="blocking batch instalation" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Permitindo instalação de bibliotecas mesmo com vulnerabilidades(ambientes de CI/CD por exemplo)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fht0ibcg8yobckrg74vsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fht0ibcg8yobckrg74vsh.png" alt="allowing vulnerable lib" width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quando uma versão não é especificada, a ferramenta tenta identificar automaticamente a última versão e então analisa para ver se alguma vulnerabilidade é encontrada&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2h25xs929wky2f99itmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2h25xs929wky2f99itmw.png" alt="identifying lib version automatically" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exemplo golang para instalação vulnerável vs instalação de última versão&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3oxcpcjzrg35kfd6ivdl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3oxcpcjzrg35kfd6ivdl.png" alt="example golang vulnerable and not vulnerable lib" width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exemplo de biblioteca python&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwk1astjk3xlxp5ypvid2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwk1astjk3xlxp5ypvid2.png" alt="python example pip lib manager" width="791" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exemplo de biblioteca sem vulnerabilidades em lotes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frfbk5156zofon5qozjhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frfbk5156zofon5qozjhq.png" alt="batch isntall with no vulnerability" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exemplo de biblioteca sem vulnerabilidade&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mv0iz9deic0vbbrwgq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mv0iz9deic0vbbrwgq7.png" alt="example of lib with no vulnerability" width="789" height="447"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Como Instalar 💥
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Pré-requisitos
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go 1.25.7+&lt;/strong&gt; — Necessário para compilar o SafeInstall e para o osv-scanner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;osv-scanner&lt;/strong&gt; — Necessário para varreduras em lote. É instalado automaticamente pelos scripts de instalação.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Para instalar o osv-scanner manualmente (se necessário):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;install &lt;/span&gt;github.com/google/osv-scanner/v2/cmd/osv-scanner@v2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Garanta que &lt;code&gt;$(go env GOPATH)/bin&lt;/code&gt; esteja no seu PATH.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instalação por plataforma
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Windows (PowerShell):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;\scripts\install.ps1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Windows (Prompt de Comando):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;scripts&lt;/span&gt;\install.bat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Linux / macOS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x scripts/install.sh
./scripts/install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Compilação manual:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go build &lt;span class="nt"&gt;-o&lt;/span&gt; safeinstall &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Comandos e Uso
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Sintaxe básica
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Sintaxe nova (recomendada):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;safeinstall [-y|--yes] &amp;lt;ecosistema&amp;gt; "&amp;lt;pacote&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sintaxe legada (comando completo):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;safeinstall [-y|--yes] "&amp;lt;comando de instalação&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Instalação de pacote único
&lt;/h3&gt;

&lt;p&gt;Ao especificar um pacote com versão, o SafeInstall:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Consulta a API do OSV em busca de vulnerabilidades conhecidas&lt;/li&gt;
&lt;li&gt;Aplica o algoritmo IsVulnerable para saber se sua versão exata é afetada&lt;/li&gt;
&lt;li&gt;Se houver vulnerabilidade: exibe CVE/GHSA em vermelho e pede confirmação&lt;/li&gt;
&lt;li&gt;Se estiver seguro: exibe mensagem em verde e prossegue automaticamente&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Exemplos (sintaxe nova):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;safeinstall npm &lt;span class="s2"&gt;"express"&lt;/span&gt;
safeinstall npm &lt;span class="s2"&gt;"express@4.17.1"&lt;/span&gt;
safeinstall pip &lt;span class="s2"&gt;"requests==2.25.1"&lt;/span&gt;
safeinstall pip &lt;span class="s2"&gt;"jinja2"&lt;/span&gt;
safeinstall go &lt;span class="s2"&gt;"golang.org/x/crypto@v0.1.0"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Exemplos (sintaxe legada):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;safeinstall &lt;span class="s2"&gt;"npm i express"&lt;/span&gt;
safeinstall &lt;span class="s2"&gt;"pip install -r requirements.txt"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Instalação em lote (npm i, pip install -r, etc.)
&lt;/h3&gt;

&lt;p&gt;Para comandos que não especificam um único pacote (ex.: &lt;code&gt;npm install&lt;/code&gt;, &lt;code&gt;npm ci&lt;/code&gt;, &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;O &lt;strong&gt;osv-scanner&lt;/strong&gt; roda &lt;strong&gt;antes&lt;/strong&gt; da instalação, analisando manifests e lockfiles&lt;/li&gt;
&lt;li&gt;Se forem encontradas vulnerabilidades e você não passou &lt;code&gt;-y&lt;/code&gt;/&lt;code&gt;--yes&lt;/code&gt;, o SafeInstall pede confirmação&lt;/li&gt;
&lt;li&gt;Se você recusar, a &lt;strong&gt;instalação é cancelada&lt;/strong&gt; — pacotes vulneráveis não são instalados&lt;/li&gt;
&lt;li&gt;Se não houver vulnerabilidades (ou você aceitar o risco), o comando de instalação é executado&lt;/li&gt;
&lt;li&gt;Após a instalação, o osv-scanner roda novamente para verificar as dependências instaladas&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Exemplos:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;safeinstall &lt;span class="s2"&gt;"npm install"&lt;/span&gt;
safeinstall &lt;span class="s2"&gt;"npm ci"&lt;/span&gt;
safeinstall &lt;span class="s2"&gt;"pip install -r requirements.txt"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modo CI/CD
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;-y&lt;/code&gt; ou &lt;code&gt;--yes&lt;/code&gt; para aceitar automaticamente os riscos em ambientes automatizados:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;safeinstall &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="s2"&gt;"npm install express@4.17.1"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Desinstalação
&lt;/h3&gt;

&lt;p&gt;Para remover o SafeInstall por completo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;safeinstall &lt;span class="nt"&gt;--uninstall&lt;/span&gt;
&lt;span class="c"&gt;# ou&lt;/span&gt;
safeinstall &lt;span class="nt"&gt;-u&lt;/span&gt;
&lt;span class="c"&gt;# ou&lt;/span&gt;
safeinstall uninstall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ou use os scripts de desinstalação:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Windows (PowerShell):&lt;/strong&gt; &lt;code&gt;.\scripts\uninstall.ps1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows (CMD):&lt;/strong&gt; &lt;code&gt;scripts\uninstall.bat&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux/macOS:&lt;/strong&gt; &lt;code&gt;./scripts/uninstall.sh&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Ecossistemas Suportados
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ecossistema&lt;/th&gt;
&lt;th&gt;Gerenciador de Pacotes&lt;/th&gt;
&lt;th&gt;Exemplo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;npm&lt;/td&gt;
&lt;td&gt;npm, yarn, pnpm&lt;/td&gt;
&lt;td&gt;&lt;code&gt;safeinstall npm "express@4.17.1"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PyPI&lt;/td&gt;
&lt;td&gt;pip, pip3, poetry&lt;/td&gt;
&lt;td&gt;&lt;code&gt;safeinstall pip "requests==2.25.1"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;go get&lt;/td&gt;
&lt;td&gt;&lt;code&gt;safeinstall go "golang.org/x/crypto@v0.1.0"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;crates.io&lt;/td&gt;
&lt;td&gt;cargo&lt;/td&gt;
&lt;td&gt;&lt;code&gt;safeinstall "cargo add serde@1.0"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RubyGems&lt;/td&gt;
&lt;td&gt;gem&lt;/td&gt;
&lt;td&gt;&lt;code&gt;safeinstall "gem install rails:7.0"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Packagist&lt;/td&gt;
&lt;td&gt;composer&lt;/td&gt;
&lt;td&gt;Pacotes PHP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pub&lt;/td&gt;
&lt;td&gt;pub&lt;/td&gt;
&lt;td&gt;Pacotes Dart&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Como o SafeInstall Reduz o Risco de Supply Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bloqueio proativo&lt;/strong&gt; — Evita instalações de pacotes conhecidamente vulneráveis ou maliciosos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uso de dados confiáveis&lt;/strong&gt; — OSV agrega bases como GitHub Advisory, PYSEC, CVE e RustSec.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avaliação precisa&lt;/strong&gt; — Usa o algoritmo oficial do OSV (IncludedInVersions, IncludedInRanges, BeforeLimits).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dupla verificação em lote&lt;/strong&gt; — Analisa antes e depois da instalação em cenários como &lt;code&gt;npm install&lt;/code&gt; e &lt;code&gt;pip install -r&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decisão consciente&lt;/strong&gt; — O desenvolvedor escolhe se aceita o risco em casos específicos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integração simples&lt;/strong&gt; — Substitui chamadas diretas aos gerenciadores de pacotes com um comando único.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Requisitos
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Conexão com a internet para consultas à API&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - Go e osv-scanner no PATH (para instalações em lote)
&lt;/h2&gt;




&lt;p&gt;&lt;strong&gt;Fontes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[1] Supply Chain Attack Statistics 2025: Costs &amp;amp; Defenses — DeepStrike. &lt;a href="https://deepstrike.io/blog/supply-chain-attack-statistics-2025" rel="noopener noreferrer"&gt;https://deepstrike.io/blog/supply-chain-attack-statistics-2025&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] The State of the Software Supply Chain 2025 — JFrog. &lt;a href="https://jfrog.com/blog/state-of-software-supply-chain-security-2025" rel="noopener noreferrer"&gt;https://jfrog.com/blog/state-of-software-supply-chain-security-2025&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] ReversingLabs 2026 Software Supply Chain Security Report — 73% aumento em pacotes open source maliciosos. &lt;a href="https://www.reversinglabs.com/press-releases/reversinglabs-2026-software-supply-chain-security-report-identifies-73-increase-in-malicious-open-source-packages" rel="noopener noreferrer"&gt;https://www.reversinglabs.com/press-releases/reversinglabs-2026-software-supply-chain-security-report-identifies-73-increase-in-malicious-open-source-packages&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[4] Sonatype's 10th Annual State of the Software Supply Chain Report — 156% de aumento em malware open source. &lt;a href="https://www.globenewswire.com/news-release/2024/10/10/2961239/0/en/Sonatype-s-10th-Annual-State-of-the-Software-Supply-Chain-Report-Reveals-156-Surge-in-Open-Source-Malware.html" rel="noopener noreferrer"&gt;https://www.globenewswire.com/news-release/2024/10/10/2961239/0/en/Sonatype-s-10th-Annual-State-of-the-Software-Supply-Chain-Report-Reveals-156-Surge-in-Open-Source-Malware.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cybersecurity</category>
      <category>node</category>
      <category>javascript</category>
      <category>npm</category>
    </item>
    <item>
      <title>Como Funciona Supply Chain Attack -PTBR</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Thu, 19 Feb 2026 22:08:09 +0000</pubDate>
      <link>https://dev.to/r9n/como-funciona-supply-chain-attack-ptbr-31i0</link>
      <guid>https://dev.to/r9n/como-funciona-supply-chain-attack-ptbr-31i0</guid>
      <description>&lt;p&gt;Access the english version here: &lt;a href="https://dev.to/r9n/how-supply-chain-attacks-work-5bc"&gt;Click Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Olá pessoal. &lt;br&gt;
Hoje quero trazer um pouquinho a mais de conhecimento a respeito de um tipo de ataque que tem se tornado cada vez mais frequente. O Supply Chain Attack, ou ataque de cadeia de suprimentos.&lt;br&gt;
Bora lá ver como isso funciona no ecossistema npm e o que podemos fazer para mitigar esse risco.&lt;br&gt;
&lt;strong&gt;Lembrando que aqui eu trouxe o npm apenas como exemplo, mas esse tipo de ataque pode ocorrer em outros gerenciadores de pacotes também!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Aqui você encontra uma ferramenta que eu desenvolvi para mitigar esse tipo de ataque: &lt;a href="https://github.com/R9n/safeinstall" rel="noopener noreferrer"&gt;Safeinstall&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Caso queira ver como a ferramenta funciona, dá uma olhada aqui &lt;a href="https://dev.to/r9n/safeinstall-um-aliado-no-combate-a-ataques-de-supply-chain-47mh"&gt;SafeInstall&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Introdução
&lt;/h2&gt;

&lt;p&gt;Quantas vezes por dia você executa &lt;code&gt;npm install&lt;/code&gt;? Para a maioria dos desenvolvedores JavaScript e Node.js, a resposta é: várias. Essa rotina aparentemente inocente — instalar uma dependência para resolver um problema — esconde um vetor de ataque cada vez mais explorado por cibercriminosos: o &lt;strong&gt;ataque de supply chain&lt;/strong&gt; (ou ataque de cadeia de suprimentos).&lt;/p&gt;

&lt;p&gt;Neste artigo, exploramos o que são esses ataques, como funcionam na prática usando um projeto de demonstração real, quais seriam as consequências em ambientes de produção e como você pode se proteger.&lt;/p&gt;

&lt;p&gt;O projeto utilizado no artigo pode ser encontrado aqui: &lt;a href="https://github.com/R9n/supply-chain-attack-example" rel="noopener noreferrer"&gt;Projeto Exemplo&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  O que é um Supply Chain Attack?
&lt;/h2&gt;

&lt;p&gt;Um &lt;strong&gt;ataque de supply chain&lt;/strong&gt; ocorre quando um atacante compromete algum componente que faz parte da cadeia de suprimentos de software — ou seja, algo que os desenvolvedores ou sistemas confiam e utilizam sem questionar. No ecossistema npm, isso se materializa principalmente através de:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pacotes maliciosos&lt;/strong&gt; criados do zero para parecerem legítimos&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pacotes legítimos comprometidos&lt;/strong&gt; (manutenção abandonada, conta hackeada, typosquatting)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scripts de lifecycle&lt;/strong&gt; que executam automaticamente durante &lt;code&gt;npm install&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;O ponto crítico é que &lt;strong&gt;o desenvolvedor não precisa fazer nada além de instalar o pacote&lt;/strong&gt;. Não é necessário abrir um arquivo suspeito, clicar em um link ou executar um binário desconhecido. O simples ato de adicionar uma dependência ao &lt;code&gt;package.json&lt;/code&gt; e rodar &lt;code&gt;npm install&lt;/code&gt; pode ser suficiente para comprometer a máquina, o repositório ou a infraestrutura.&lt;/p&gt;


&lt;h2&gt;
  
  
  Scripts de Lifecycle: A Porta de Entrada
&lt;/h2&gt;

&lt;p&gt;O npm define diversos scripts que são executados em momentos específicos do ciclo de vida de um pacote:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Script&lt;/th&gt;
&lt;th&gt;Momento de execução&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;preinstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Antes do pacote ser instalado&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;install&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Durante a instalação&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;postinstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Imediatamente após a instalação&lt;/strong&gt; — alvo preferido de ataques&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;preuninstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Antes de desinstalar&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;postuninstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Após desinstalar&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;prepublish&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Antes de publicar no registro npm&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Qualquer pessoa que execute &lt;code&gt;npm install&lt;/code&gt; rodará esses scripts automaticamente&lt;/strong&gt;, sem avisos claros. É aí que reside o perigo.&lt;/p&gt;


&lt;h2&gt;
  
  
  Projeto de Demonstração: Estrutura e Código
&lt;/h2&gt;

&lt;p&gt;Para ilustrar o vetor de ataque, criamos um projeto educacional composto por:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pacote “malicioso”&lt;/strong&gt; — um pacote que parece útil, mas executa código nas fases de instalação&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Projeto vítima&lt;/strong&gt; — um projeto que simplesmente depende desse pacote&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Estrutura do Pacote Malicioso
&lt;/h3&gt;

&lt;p&gt;O &lt;code&gt;package.json&lt;/code&gt; do pacote define os scripts que serão executados:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"utilidades-uteis"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Pacote útil que parece legítimo mas executa código no post-install"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"postinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node postinstall.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"preinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node preinstall.js"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"utility"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"helper"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Atacante Anônimo"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MIT"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note que &lt;code&gt;postinstall&lt;/code&gt; e &lt;code&gt;preinstall&lt;/code&gt; apontam para scripts Node.js. Esses scripts rodam automaticamente durante a instalação.&lt;/p&gt;

&lt;h3&gt;
  
  
  Script preinstall.js
&lt;/h3&gt;

&lt;p&gt;Este script executa &lt;strong&gt;antes&lt;/strong&gt; da instalação do pacote:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * PREINSTALL - Roda ANTES da instalação do pacote
 * Outra fase onde código malicioso pode executar
 */&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;u001b[35m[preinstall]&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;u001b[0m Este script roda antes mesmo do pacote ser instalado!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Em um ataque real, aqui poderia haver coleta inicial de dados ou preparação do ambiente.&lt;/p&gt;

&lt;h3&gt;
  
  
  Script postinstall.js — O Coração do Ataque
&lt;/h3&gt;

&lt;p&gt;Aqui está o script que simula a exfiltração de dados sensíveis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;os&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;os&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Simula o que um atacante PODERIA coletar (apenas mostra, não envia)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dadosSensiveis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;executadoEm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;usuario&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;diretorioAtual&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;nodeVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// Um atacante real tentaria ler:&lt;/span&gt;
  &lt;span class="c1"&gt;// env: process.env,  // Tokens, senhas, API keys&lt;/span&gt;
  &lt;span class="c1"&gt;// arquivos: fs.readdirSync(process.env.HOME)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Cria arquivo de "prova" - em ataque real seria enviado para servidor&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arquivoProva&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;PROVA_ATAQUE_SUPPLY_CHAIN.json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arquivoProva&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dadosSensiveis&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`\u001b[31m[ATAQUE SIMULADO]\u001b[0m Dados coletados salvos em: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;arquivoProva&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;Em um ataque REAL, isso seria enviado para o servidor do atacante.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exemplo de arquivo criado após o script executar&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlu8u1men5p4vzrl8qr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlu8u1men5p4vzrl8qr6.png" alt="exfiltrated information image" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;E ao executar a aplicação o usuário nem percebe o que aconteceu&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3k5rdxd80cd30px0vos6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3k5rdxd80cd30px0vos6.png" alt="Image showing that the user will not see the malware execution" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Em uma versão maliciosa real, o atacante trocaria &lt;code&gt;fs.writeFileSync&lt;/code&gt; por uma chamada HTTP (por exemplo, com &lt;code&gt;https.request&lt;/code&gt;) para enviar esses dados a um servidor sob seu controle. O pacote também expõe um módulo legítimo (&lt;code&gt;index.js&lt;/code&gt;) que faz algo útil — tornando o pacote plausível e reduzindo a suspeita.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fluxo do Ataque
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Desenvolvedor: npm install utilidades-uteis
2. npm baixa o pacote
3. npm executa preinstall  → código malicioso #1
4. npm executa postinstall → código malicioso #2 (coleta dados)
5. Pacote instalado normalmente
6. Desenvolvedor não percebe que foi comprometido
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Consequências em Ambientes Reais
&lt;/h2&gt;

&lt;p&gt;O que poderia acontecer se esse fosse um ataque real? As consequências variam conforme o contexto da vítima.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Exfiltração de Credenciais e Segredos
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Variáveis de ambiente&lt;/strong&gt; (&lt;code&gt;process.env&lt;/code&gt;): tokens de API (AWS, GitHub, Stripe), chaves de banco de dados, senhas&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arquivos &lt;code&gt;.env&lt;/code&gt;&lt;/strong&gt;: credenciais em texto plano em vários projetos&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arquivos de configuração&lt;/strong&gt;: &lt;code&gt;~/.npmrc&lt;/code&gt;, &lt;code&gt;~/.aws/credentials&lt;/code&gt;, &lt;code&gt;~/.ssh/config&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impacto&lt;/strong&gt;: Acesso a contas cloud, bancos de dados, repositórios privados e sistemas de terceiros.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Roubo de Chaves SSH e Certificados
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Leitura de &lt;code&gt;~/.ssh/&lt;/code&gt; (chaves privadas, &lt;code&gt;known_hosts&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Uso das chaves para acessar servidores, GitHub, repositórios privados&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impacto&lt;/strong&gt;: Invasão de servidores, clonagem de repositórios privados, commit de código malicioso em nome da vítima.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Cryptojacking
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Execução de minerador de criptomoeda em segundo plano&lt;/li&gt;
&lt;li&gt;Uso de CPU e energia da máquina ou servidor da vítima&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impacto&lt;/strong&gt;: Custos elevados de infraestrutura, degradação de desempenho, possível violação de políticas de uso de cloud.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Backdoors e Persistência
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Instalação de ferramentas de acesso remoto&lt;/li&gt;
&lt;li&gt;Adição de tarefas agendadas ou scripts de inicialização&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impacto&lt;/strong&gt;: Controle prolongado da máquina, espionagem, preparação para ataques futuros.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Modificação de Outros Pacotes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Alteração de código em &lt;code&gt;node_modules&lt;/code&gt; de outras dependências&lt;/li&gt;
&lt;li&gt;Injeção de backdoors em bibliotecas usadas em produção&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impacto&lt;/strong&gt;: Comprometimento em escala, propagação do ataque para todos os usuários da aplicação.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Em Ambientes CI/CD
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Acesso a secrets de pipelines (tokens, credenciais)&lt;/li&gt;
&lt;li&gt;Possibilidade de modificar artefatos de build ou imagens Docker&lt;/li&gt;
&lt;li&gt;Deploy de versões comprometidas em produção&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impacto&lt;/strong&gt;: Comprometimento de toda a cadeia de entrega, desde o build até produção.&lt;/p&gt;




&lt;h2&gt;
  
  
  Casos Reais Documentados
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Caso&lt;/th&gt;
&lt;th&gt;Ano&lt;/th&gt;
&lt;th&gt;Descrição&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;event-stream&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2018&lt;/td&gt;
&lt;td&gt;Pacote com ~2M downloads/semana. Código malicioso adicionado para roubar carteiras Bitcoin.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ua-parser-js&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2021&lt;/td&gt;
&lt;td&gt;Biblioteca popular comprometida; executava minerador de criptomoeda.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;coa&lt;/strong&gt; e &lt;strong&gt;rc&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;2021&lt;/td&gt;
&lt;td&gt;Typosquatting; pacotes roubavam variáveis de ambiente e as enviavam para servidor remoto.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;node-ipc&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2022&lt;/td&gt;
&lt;td&gt;Adicionou código que alterava arquivos em máquinas de desenvolvedores de certas regiões geográficas.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Medidas de Proteção
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Use &lt;code&gt;--ignore-scripts&lt;/code&gt;&lt;/strong&gt; quando possível: &lt;code&gt;npm install --ignore-scripts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audite dependências&lt;/strong&gt;: &lt;code&gt;npm audit&lt;/code&gt;, &lt;code&gt;npm audit fix&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifique scripts&lt;/strong&gt;: &lt;code&gt;npm view nome-do-pacote&lt;/code&gt; antes de instalar&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ferramentas especializadas&lt;/strong&gt;: Socket.dev, Snyk para detecção de comportamentos suspeitos&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mantenha &lt;code&gt;package-lock.json&lt;/code&gt;&lt;/strong&gt; versionado e revise mudanças&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifique procedência&lt;/strong&gt;: downloads, manutenção ativa, repositório aberto&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Conclusão
&lt;/h2&gt;

&lt;p&gt;O ecossistema npm é extremamente conveniente, mas essa conveniência traz riscos. O ato aparentemente trivial de &lt;code&gt;npm install&lt;/code&gt; pode executar código arbitrário na sua máquina. A consciência sobre supply chain attacks e a adoção de boas práticas de segurança são fundamentais para reduzir a superfície de ataque e proteger projetos e infraestrutura.&lt;/p&gt;

&lt;p&gt;O projeto de demonstração está disponível para que você possa testar o fluxo em um ambiente controlado e entender na prática como esses ataques funcionam.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>cybersecurity</category>
      <category>ai</category>
    </item>
    <item>
      <title>How Supply Chain Attacks Work</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Thu, 19 Feb 2026 22:08:03 +0000</pubDate>
      <link>https://dev.to/r9n/how-supply-chain-attacks-work-5bc</link>
      <guid>https://dev.to/r9n/how-supply-chain-attacks-work-5bc</guid>
      <description>&lt;p&gt;Acesse a versão em português aqui: &lt;a href="https://dev.to/r9n/como-funciona-supply-chain-attack-ptbr-31i0"&gt;Clique Aqui&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hi everyone.&lt;/p&gt;

&lt;p&gt;Today I want to share a little more knowledge about a type of attack that has become increasingly frequent: the Supply Chain Attack.&lt;/p&gt;

&lt;p&gt;Let's see how this works in the npm ecosystem and what we can do to mitigate this risk.&lt;br&gt;
&lt;strong&gt;Remember that I've only used npm as an example here, but this type of attack can occur in other package managers as well!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here you'll find a tool I developed to mitigate this type of attack. &lt;a href="https://github.com/R9n/safeinstall" rel="noopener noreferrer"&gt;Safeinstall&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to see how the tool works, take a look here &lt;a href="https://dev.to/r9n/safeinstall-um-aliado-no-combate-a-ataques-de-supply-chain-47mh"&gt;SafeInstall&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;How many times a day do you run &lt;code&gt;npm install&lt;/code&gt;? For most JavaScript and Node.js developers, the answer is: many. This seemingly innocent routine — installing a dependency to solve a problem — hides an attack vector increasingly exploited by cybercriminals: the &lt;strong&gt;supply chain attack&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this article, we explore what these attacks are, how they work in practice using a real demonstration project, what the consequences would be in production environments, and how you can protect yourself.&lt;/p&gt;

&lt;p&gt;The project used in the article can be found here: &lt;a href="https://github.com/R9n/supply-chain-attack-example" rel="noopener noreferrer"&gt;Example Project&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  What is a Supply Chain Attack?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;supply chain attack&lt;/strong&gt; occurs when an attacker compromises a component that is part of the software supply chain — something that developers or systems trust and use without question. In the npm ecosystem, this materializes mainly through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Malicious packages&lt;/strong&gt; created from scratch to appear legitimate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compromised legitimate packages&lt;/strong&gt; (abandoned maintenance, hacked account, typosquatting)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lifecycle scripts&lt;/strong&gt; that execute automatically during &lt;code&gt;npm install&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The critical point is that &lt;strong&gt;the developer does not need to do anything beyond installing the package&lt;/strong&gt;. No need to open a suspicious file, click a link, or run an unknown binary. The simple act of adding a dependency to &lt;code&gt;package.json&lt;/code&gt; and running &lt;code&gt;npm install&lt;/code&gt; can be enough to compromise the machine, repository, or infrastructure.&lt;/p&gt;


&lt;h2&gt;
  
  
  Lifecycle Scripts: The Entry Point
&lt;/h2&gt;

&lt;p&gt;npm defines various scripts that run at specific moments in a package's lifecycle:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Script&lt;/th&gt;
&lt;th&gt;When it runs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;preinstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Before the package is installed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;install&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;During installation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;postinstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Immediately after installation&lt;/strong&gt; — preferred target for attacks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;preuninstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Before uninstalling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;postuninstall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After uninstalling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;prepublish&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Before publishing to the npm registry&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Anyone who runs &lt;code&gt;npm install&lt;/code&gt; will execute these scripts automatically&lt;/strong&gt;, with no clear warning. That is where the danger lies.&lt;/p&gt;


&lt;h2&gt;
  
  
  Demonstration Project: Structure and Code
&lt;/h2&gt;

&lt;p&gt;To illustrate the attack vector, we built an educational project consisting of:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;"Malicious" package&lt;/strong&gt; — a package that appears useful but runs code during installation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Victim project&lt;/strong&gt; — a project that simply depends on that package&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Malicious Package Structure
&lt;/h3&gt;

&lt;p&gt;The package's &lt;code&gt;package.json&lt;/code&gt; defines the scripts that will be executed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"utilidades-uteis"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Pacote útil que parece legítimo mas executa código no post-install"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"postinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node postinstall.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"preinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node preinstall.js"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"utility"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"helper"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Atacante Anônimo"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MIT"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that &lt;code&gt;postinstall&lt;/code&gt; and &lt;code&gt;preinstall&lt;/code&gt; point to Node.js scripts. These scripts run automatically during installation.&lt;/p&gt;

&lt;h3&gt;
  
  
  preinstall.js Script
&lt;/h3&gt;

&lt;p&gt;This script runs &lt;strong&gt;before&lt;/strong&gt; the package is installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * PREINSTALL - Runs BEFORE the package is installed
 * Another phase where malicious code can execute
 */&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;u001b[35m[preinstall]&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;u001b[0m This script runs even before the package is installed!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a real attack, initial data collection or environment preparation could happen here.&lt;/p&gt;

&lt;h3&gt;
  
  
  postinstall.js Script — The Heart of the Attack
&lt;/h3&gt;

&lt;p&gt;Here is the script that simulates exfiltration of sensitive data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;os&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;os&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Simulates what an attacker COULD collect (only shows, does not send)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dadosSensiveis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;executadoEm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;usuario&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;diretorioAtual&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;nodeVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// A real attacker would try to read:&lt;/span&gt;
  &lt;span class="c1"&gt;// env: process.env,  // Tokens, passwords, API keys&lt;/span&gt;
  &lt;span class="c1"&gt;// arquivos: fs.readdirSync(process.env.HOME)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Creates "proof" file - in real attack would be sent to server&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arquivoProva&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;PROVA_ATAQUE_SUPPLY_CHAIN.json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arquivoProva&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dadosSensiveis&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`\u001b[31m[SIMULATED ATTACK]\u001b[0m Data collected saved to: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;arquivoProva&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;In a REAL attack, this would be sent to the attacker&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;s server.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example of a file created after the script runs:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlu8u1men5p4vzrl8qr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlu8u1men5p4vzrl8qr6.png" alt="exfiltrated information image" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And when running the application, the user doesn't even notice what happened:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3k5rdxd80cd30px0vos6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3k5rdxd80cd30px0vos6.png" alt="Image showing that the user will not see the malware execution" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In a real malicious version, the attacker would replace &lt;code&gt;fs.writeFileSync&lt;/code&gt; with an HTTP call (e.g., using &lt;code&gt;https.request&lt;/code&gt;) to send this data to a server under their control. The package also exposes a legitimate module (&lt;code&gt;index.js&lt;/code&gt;) that does something useful — making the package plausible and reducing suspicion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Attack Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Developer: npm install utilidades-uteis
2. npm downloads the package
3. npm runs preinstall  → malicious code #1
4. npm runs postinstall → malicious code #2 (collects data)
5. Package installed normally
6. Developer does not realize they have been compromised
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Consequences in Real Environments
&lt;/h2&gt;

&lt;p&gt;What could happen if this were a real attack? The consequences vary depending on the victim's context.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Exfiltration of Credentials and Secrets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Environment variables&lt;/strong&gt; (&lt;code&gt;process.env&lt;/code&gt;): API tokens (AWS, GitHub, Stripe), database keys, passwords&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.env&lt;/code&gt; files&lt;/strong&gt;: credentials in plain text across multiple projects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configuration files&lt;/strong&gt;: &lt;code&gt;~/.npmrc&lt;/code&gt;, &lt;code&gt;~/.aws/credentials&lt;/code&gt;, &lt;code&gt;~/.ssh/config&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: Access to cloud accounts, databases, private repositories, and third-party systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Theft of SSH Keys and Certificates
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reading &lt;code&gt;~/.ssh/&lt;/code&gt; (private keys, &lt;code&gt;known_hosts&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Using the keys to access servers, GitHub, private repositories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: Server intrusion, cloning of private repositories, malicious commits in the victim's name.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Cryptojacking
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Running a cryptocurrency miner in the background&lt;/li&gt;
&lt;li&gt;Consuming the victim's machine or server CPU and power&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: High infrastructure costs, performance degradation, possible violation of cloud usage policies.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Backdoors and Persistence
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Installing remote access tools&lt;/li&gt;
&lt;li&gt;Adding scheduled tasks or startup scripts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: Prolonged control of the machine, espionage, preparation for future attacks.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Modification of Other Packages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Altering code in &lt;code&gt;node_modules&lt;/code&gt; of other dependencies&lt;/li&gt;
&lt;li&gt;Injecting backdoors into libraries used in production&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: Compromise at scale, propagation of the attack to all application users.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. In CI/CD Environments
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Access to pipeline secrets (tokens, credentials)&lt;/li&gt;
&lt;li&gt;Ability to modify build artifacts or Docker images&lt;/li&gt;
&lt;li&gt;Deployment of compromised versions to production&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: Compromise of the entire delivery chain, from build to production.&lt;/p&gt;




&lt;h2&gt;
  
  
  Documented Real-World Cases
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Case&lt;/th&gt;
&lt;th&gt;Year&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;event-stream&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2018&lt;/td&gt;
&lt;td&gt;Package with ~2M weekly downloads. Malicious code added to steal Bitcoin wallets.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ua-parser-js&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2021&lt;/td&gt;
&lt;td&gt;Popular library compromised; ran cryptocurrency miner.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;coa&lt;/strong&gt; and &lt;strong&gt;rc&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;2021&lt;/td&gt;
&lt;td&gt;Typosquatting; packages stole environment variables and sent them to a remote server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;node-ipc&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2022&lt;/td&gt;
&lt;td&gt;Added code that modified files on machines of developers from certain geographic regions.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Protection Measures
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Use &lt;code&gt;--ignore-scripts&lt;/code&gt;&lt;/strong&gt; when possible: &lt;code&gt;npm install --ignore-scripts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit dependencies&lt;/strong&gt;: &lt;code&gt;npm audit&lt;/code&gt;, &lt;code&gt;npm audit fix&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify scripts&lt;/strong&gt;: &lt;code&gt;npm view package-name&lt;/code&gt; before installing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Specialized tools&lt;/strong&gt;: Socket.dev, Snyk for detecting suspicious behavior&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep &lt;code&gt;package-lock.json&lt;/code&gt;&lt;/strong&gt; in version control and review changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify package provenance&lt;/strong&gt;: download counts, active maintenance, open repository&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The npm ecosystem is extremely convenient, but that convenience carries risks. The seemingly trivial act of &lt;code&gt;npm install&lt;/code&gt; can execute arbitrary code on your machine. Awareness of supply chain attacks and adopting security best practices are essential to reduce the attack surface and protect projects and infrastructure.&lt;/p&gt;

&lt;p&gt;The demonstration project is available so you can test the flow in a controlled environment and understand how these attacks work in practice.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This article was written for educational purposes. The demonstration project contains only simulated code and does not perform any real malicious actions.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>node</category>
      <category>javascript</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Hi, I created Cyber Alerts, a collaborative website for reporting scams. The goal is to prevent more people from falling into traps. Feedback and ideas for improvement are very welcome 🚀
https://cyber-alerts.com.br</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Mon, 22 Dec 2025 16:43:13 +0000</pubDate>
      <link>https://dev.to/r9n/hi-i-created-cyber-alerts-a-collaborative-website-for-reporting-scams-the-goal-is-to-prevent-55ae</link>
      <guid>https://dev.to/r9n/hi-i-created-cyber-alerts-a-collaborative-website-for-reporting-scams-the-goal-is-to-prevent-55ae</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://cyber-alerts.com.br/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcyber-alerts.com.br%2Fassets%2Flogo-cyber-alerts.png" height="826" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://cyber-alerts.com.br/" rel="noopener noreferrer" class="c-link"&gt;
            CyberAlert: Mapa Comunitário de Golpes | Segurança Digital Colaborativa
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Plataforma colaborativa para reportar e mapear golpes digitais em tempo real. Proteja-se e ajude a proteger outros.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcyber-alerts.com.br%2Fassets%2Flogo-cyber-alerts.png" width="800" height="826"&gt;
          cyber-alerts.com.br
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>discuss</category>
      <category>ethics</category>
      <category>news</category>
    </item>
    <item>
      <title>Plataforma Para Reportar Golpes: Cyber Alerts 🛡️</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Mon, 22 Dec 2025 13:38:27 +0000</pubDate>
      <link>https://dev.to/r9n/plataforma-para-reportar-golpes-cyber-alerts-286k</link>
      <guid>https://dev.to/r9n/plataforma-para-reportar-golpes-cyber-alerts-286k</guid>
      <description>&lt;p&gt;Hi everyone, how are you?&lt;/p&gt;

&lt;p&gt;With the end of the year approaching and some free time to spare, I finally managed to bring to life an idea that had been on hold: Cyber ​​Alerts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br&gt;
We know that, with the use of AI, scams are becoming increasingly sophisticated (deepfakes, personalized phishing, etc.). I believe that the best defense, besides technology, is shared information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;br&gt;
I created this platform so that anyone can quickly report scams they've suffered. The goal is to create a community database where people can consult recent tactics and avoid falling into traps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's coming next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The platform is simple and intuitive.&lt;/p&gt;

&lt;p&gt;I will soon add support for multiple languages ​​(English is next on the list).&lt;/p&gt;

&lt;p&gt;I am open to suggestions for new features (filters by category, integration with security APIs, etc.).&lt;/p&gt;

&lt;p&gt;Project link: &lt;a href="https://cyber-alerts.com.br" rel="noopener noreferrer"&gt;https://cyber-alerts.com.br&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Suggestions for improvement, stack ideas, or constructive criticism are very welcome! As this community is tech-oriented, I'd love to know what you think of the usability and the project's concept 🙂.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>ai</category>
      <category>llm</category>
      <category>community</category>
    </item>
    <item>
      <title>Ebook: Desenvolvimento Seguro de Apis</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Wed, 19 Mar 2025 21:49:23 +0000</pubDate>
      <link>https://dev.to/r9n/ebook-desenvolvimento-seguro-de-apis-472d</link>
      <guid>https://dev.to/r9n/ebook-desenvolvimento-seguro-de-apis-472d</guid>
      <description>&lt;p&gt;Olá, pessoal! Tudo bem? 😀&lt;/p&gt;

&lt;p&gt;Hoje quero apresentar um projeto no qual venho trabalhando há algum tempo.&lt;/p&gt;

&lt;p&gt;Desde que a onda da inteligência artificial começou, muitos desenvolvedores passaram a utilizar assistentes de código para criar suas aplicações. Isso é ótimo, pois aumenta consideravelmente a produtividade. No entanto, essa prática também esconde um grande perigo: falhas de segurança.&lt;/p&gt;

&lt;p&gt;Infelizmente, a maioria dos desenvolvedores não se preocupa em validar o que a IA gera, e, com isso, muitas vulnerabilidades acabam indo para ambientes de produção, resultando em softwares com diversas brechas.&lt;/p&gt;

&lt;p&gt;Outro ponto que me incomoda ao pesquisar sobre cibersegurança é que a maioria dos sites ensina apenas a detectar vulnerabilidades, mas não oferece soluções eficazes para corrigi-las.&lt;/p&gt;

&lt;p&gt;Pensando nisso, criei este eBook, onde abordo várias falhas comuns em APIs. Diferente de outros materiais, não apenas mostro as vulnerabilidades, mas também explico em detalhes como elas surgem e apresento exemplos de código para mitigá-las. Dessa forma, qualquer desenvolvedor poderá identificar e corrigir essas falhas em qualquer tecnologia.&lt;/p&gt;

&lt;p&gt;Se quiser adquirir o eBook, basta acessar minha página de vendas. Por um valor simbólico de R$ 49,90, você terá acesso a um conteúdo valioso.&lt;/p&gt;

&lt;p&gt;Aqui está um exemplo do que você encontrará no eBook:&lt;/p&gt;

&lt;p&gt;Na imagem a seguir, apresento uma explicação detalhada sobre a vulnerabilidade de &lt;strong&gt;Path Traversal&lt;/strong&gt;, uma falha muito comum e extremamente perigosa em APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk8tk57xflqhtk72wb1bc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk8tk57xflqhtk72wb1bc.png" alt="Image description" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Com este eBook, você aprenderá a identificar e corrigir essa e muitas outras vulnerabilidades 🚀🚀.&lt;/p&gt;

&lt;p&gt;Caso queira adquirir o ebook pode fazê-lo aqui&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://rm-ebook-api-development.com.br" rel="noopener noreferrer"&gt;https://rm-ebook-api-development.com.br&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Espero que esse ebook possa te ajudar a escrever códigos melhores e mais seguros tanto para projetos pessoas quanto profissionais 🙂&lt;/p&gt;

&lt;p&gt;Fiquem bem e até a próxima 🙂&lt;/p&gt;

</description>
      <category>api</category>
      <category>cybersecurity</category>
      <category>javascript</category>
      <category>ai</category>
    </item>
    <item>
      <title>Flappy Bird Multiplyer</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Thu, 21 Nov 2024 01:34:34 +0000</pubDate>
      <link>https://dev.to/r9n/flappy-bird-multiplyer-3bnd</link>
      <guid>https://dev.to/r9n/flappy-bird-multiplyer-3bnd</guid>
      <description>&lt;p&gt;Hello everyone, how are you? I hope well 😃&lt;/p&gt;

&lt;p&gt;Today I'm here to show you something different.&lt;br&gt;
Nothing about cybersecurity or anything like that. &lt;br&gt;
Today I'm here to show you my new project, I'm a flappy bird game with single and multiplayer &lt;/p&gt;

&lt;p&gt;➡️ You can find the game here: &lt;a href="https://www.multibirds.dev" rel="noopener noreferrer"&gt;https://www.multibirds.dev&lt;/a&gt; ⬅️&lt;/p&gt;

&lt;p&gt;This game was made with the following technologies&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;io socket&lt;/li&gt;
&lt;li&gt;Angular&lt;/li&gt;
&lt;li&gt;NestJs&lt;/li&gt;
&lt;li&gt;Screen&lt;/li&gt;
&lt;li&gt;Nginx&lt;/li&gt;
&lt;li&gt;Google AdSense&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically there are 4 game modes &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single player&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The mode where you play alone move to get the highest possible score. This is the classic mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multiplayer Co-op&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this mode you play with a friend, it's a great way to kill time while waiting for something 😃&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multiplayer versus&lt;/strong&gt;&lt;br&gt;
In this mode you can challenge a friend to see who survived the most, it also looks really cool 🙂&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practice Mode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this mode you can practice withowt dying and you can play as long as you want.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to play&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To play, just copy your ID and send it to a friend or ask him to send you his ID and you can call him to play.&lt;br&gt;
No need to create an account or anything like that, just come and play :)&lt;/p&gt;

&lt;p&gt;Well that's it for today guys, I just wanted to present this little project that I intend to improve in the future, I have some really cool ideas, I just need time.&lt;br&gt;
Here are some screeshots, but this is a work in progress and will be updated soon :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsbpxmh360slk164lb97s.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsbpxmh360slk164lb97s.PNG" alt=" " width="800" height="954"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajmh3ipfrsz19c7rwoiv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajmh3ipfrsz19c7rwoiv.PNG" alt=" " width="800" height="833"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Stay safe and see you next time 😃&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>angular</category>
      <category>nestjs</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Removendo Dados Sensiveis de Images</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Fri, 17 May 2024 22:01:33 +0000</pubDate>
      <link>https://dev.to/r9n/removendo-dados-sensiveis-de-images-2k0e</link>
      <guid>https://dev.to/r9n/removendo-dados-sensiveis-de-images-2k0e</guid>
      <description>&lt;p&gt;Hoje quero falar sobre um tema importante quando falamos em segurança de dados e o que podemos fazer para melhorar a nossa segurança de dados quando processamos imagens com dados sensíveis de nossos usuários. Vou apresentar uma solução que construí pensando nessa situação. Vamos nessa 😃&lt;/p&gt;

&lt;h3&gt;
  
  
  Imagens e Dados Sensíveis
&lt;/h3&gt;

&lt;p&gt;A crescente capacidade de processamento e armazenamento de dados permitiu que empresas capturassem e analisassem um volume imenso de informações, muitas vezes sem o consentimento explícito dos indivíduos envolvidos.&lt;/p&gt;

&lt;p&gt;Em termos de cibersegurança, a proteção de dados pessoais em imagens é de suma importância. O vazamento de informações sensíveis, como CPF e e-mail, pode ter consequências desastrosas. Criminosos cibernéticos podem utilizar essas informações para realizar fraudes, roubo de identidade e outras atividades ilícitas. Por exemplo, com um CPF e um endereço de e-mail, um criminoso pode tentar abrir contas bancárias em nome da vítima, solicitar empréstimos ou realizar compras online, tudo isso sem o conhecimento da pessoa afetada.&lt;/p&gt;

&lt;p&gt;Além disso, a exposição de dados pessoais pode levar ao assédio e à violação de privacidade. Imagine uma situação onde fotos de uma reunião ou evento são compartilhadas publicamente e nelas estão visíveis documentos ou identificações pessoais. Essas informações podem ser exploradas maliciosamente, comprometendo a segurança e o bem-estar das pessoas envolvidas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Então, o que fazer?
&lt;/h3&gt;

&lt;p&gt;Sabemos que dados sensíveis em imagens podem ser um problema, então, o que fazer? Anonimizar!&lt;/p&gt;

&lt;p&gt;A anonimização de dados em imagens tornou-se uma prática crucial nos dias atuais, especialmente com o crescimento exponencial da coleta de dados por grandes empresas para treinar inteligências artificiais (IA).&lt;/p&gt;

&lt;p&gt;Portanto, a anonimização de dados em imagens é uma prática essencial não apenas para proteger a privacidade individual, mas também para garantir a segurança cibernética. Com a intensificação da coleta de dados por grandes corporações para o treinamento de IA, a adoção de medidas rigorosas de anonimização torna-se ainda mais crítica. É responsabilidade das empresas e desenvolvedores implementar técnicas eficazes para garantir que os dados pessoais sejam adequadamente protegidos, preservando a privacidade e a segurança dos indivíduos em um mundo cada vez mais digitalizado.&lt;/p&gt;

&lt;p&gt;Anonimizar dados em imagens envolve a remoção ou ocultação de informações identificáveis, como rostos, placas de veículos, endereços de e-mail, números de CPF, entre outros. Essa prática é vital para proteger a privacidade dos indivíduos, impedindo que dados pessoais sejam facilmente associados a pessoas específicas. Com a anonimização, mesmo que as imagens sejam acessadas por terceiros, a possibilidade de identificar e prejudicar os indivíduos retratados é significativamente reduzida.&lt;/p&gt;

&lt;p&gt;Com isso queria trazer uma API que construí pensando em viabilizar a anonimização de dados em imagens de forma sistemática.&lt;/p&gt;

&lt;p&gt;Ela possui os seguintes endpoints em sua versão V1:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/all&lt;/strong&gt;: Este endpoint remove todos os textos encontrados na imagem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/cep&lt;/strong&gt;: Este endpoint remove todos os ceps encontrados na imagem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/cnpj&lt;/strong&gt;: Aqui são removidos todos os cnpj's&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/cpf&lt;/strong&gt;: Este endpoint remove todos os cpf's&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/custom-text&lt;/strong&gt;: Aqui são removidos textos específicos que o usuário queira&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/email&lt;/strong&gt;: Remove todos os emails&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-&lt;strong&gt;/v1/remove/face&lt;/strong&gt;: Este endpoint remove todos os rostos detectados na imagem&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/ipv4&lt;/strong&gt;: Aqui são removidos os ipv4's que forem encontrados&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/phone&lt;/strong&gt;: Remove todos telefones&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/v1/remove/rg&lt;/strong&gt;: Remove todos os numeros de rg (por enquanto apenas Minas Gerais)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Caso queira acessar a API para checar todas as features e apoiar meu trabalho é só dar uma conferida aqui 😃&lt;/p&gt;

&lt;p&gt;&lt;a href="https://rapidapi.com/ocrapirmp/api/document-anonymize-api/" rel="noopener noreferrer"&gt;==&amp;gt;&amp;gt;&amp;gt;DOCK ANONYMIZE API&amp;lt;&amp;lt;&amp;lt;==&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Anonimizando dados
&lt;/h3&gt;

&lt;p&gt;Agora vamos explorar como utilizar a API para anonimizar dados em exemplos de imagens contendo informações sensíveis de usuários.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CPFs&lt;/strong&gt;&lt;br&gt;
Os CPFs são informações extremamente confidenciais e toda empresa deve garantir que essas informações não sejam vazadas na internet. A seguir, apresentamos um exemplo de anonimização de CPF em uma imagem de um contrato de trabalho. Este poderia ser um documento escaneado real.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagem original&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bjaov4ep8dp7fd6b6ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bjaov4ep8dp7fd6b6ux.png" alt="exemplo de carteira de trabalho com cpf" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagem anonimizada&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2918bydnf8hkldwkxors.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2918bydnf8hkldwkxors.png" alt="exemplo de carteira de trabalho com cpf anonimizado" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emails&lt;/strong&gt;&lt;br&gt;
Os emails também são informações que podem ser divulgadas inadvertidamente. Se for intencional, como na divulgação de um email de contato para um serviço, não há problema. Porém, quando se trata de emails pessoais, existe o risco de que pessoas maliciosas os utilizem para criar cadastros em diversos sites ou até mesmo realizar compras online.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagem original&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjwxaf030hn05wzhpq7h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjwxaf030hn05wzhpq7h.png" alt="exemplo de emails" width="651" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagem anonimizada&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgqz7q7zfs0dstowsf5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgqz7q7zfs0dstowsf5k.png" alt="exemplo de emails anonimizados" width="651" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mais Exemplos&lt;/strong&gt;&lt;br&gt;
Agora, vamos ver um exemplo de uma tela de sistema que pode conter informações pessoais do usuário ou da empresa cujo cadastro está sendo acessado.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5lzy33psfmsup65y4ff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5lzy33psfmsup65y4ff.png" alt="exemplo de imagem com dados sensiveis" width="796" height="629"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Perceba que na imagem original existem diversas informações de cunho pessoal, como CNPJ, email, CEP, entre outras.&lt;/p&gt;

&lt;p&gt;Imagine que você possui um serviço que lida com muitas imagens semelhantes (por exemplo, um serviço que processa notas fiscais e depois as armazena). Para garantir a segurança das informações do cliente, você pode anonimizar alguns dados. Neste caso, vamos anonimizar campos como email, CNPJ e um valor arbitrário, como o limite de crédito.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagem anonimizada&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42zil9jszwszsr93uvf4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42zil9jszwszsr93uvf4.png" alt="exemplo de imagem com dados sensiveis" width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Como pode ser visto é possível anonimizar de forma sistemática dados sensíveis em imagens, garantindo assim, a privacidade dos dados dos usuários.&lt;/p&gt;

&lt;h3&gt;
  
  
  Casos de uso
&lt;/h3&gt;

&lt;p&gt;Trago aqui mais alguns casos de uso onde pode ser extremamente necessário a anonimização dos dados presentes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Processamento de Documentos Fiscais&lt;/strong&gt;&lt;br&gt;
Empresas que lidam com um grande volume de documentos fiscais (notas fiscais, recibos, etc.) podem precisar anonimizar dados sensíveis antes de armazená-los ou compartilhá-los com terceiros.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Segurança em Sistemas de RH&lt;/strong&gt;&lt;br&gt;
Sistemas de Recursos Humanos que gerenciam documentos como contratos de trabalho, formulários de cadastro de funcionários, e declarações de imposto podem anonimizar informações sensíveis para proteger a privacidade dos funcionários.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compliance com Regulamentações&lt;/strong&gt;&lt;br&gt;
Organizações que precisam cumprir regulamentações de proteção de dados (como a GDPR na Europa ou a LGPD no Brasil).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serviços de Armazenamento em Nuvem&lt;/strong&gt;&lt;br&gt;
Provedores de serviços de armazenamento em nuvem podem querer oferecer um nível adicional de segurança, garantindo que dados sensíveis em documentos escaneados sejam automaticamente anonimizados antes de serem armazenados.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Aplicativos de Telemedicina&lt;/strong&gt;&lt;br&gt;
Plataformas de telemedicina que processam imagens de documentos médicos (receitas, laudos, etc.) podem anonimizar dados pessoais dos pacientes para proteger a privacidade e garantir a segurança das informações médicas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gestão de Imóveis&lt;/strong&gt;&lt;br&gt;
Empresas de gestão imobiliária podem querer anonimizar dados sensíveis em documentos como contratos de aluguel e comprovantes de residência antes de compartilhá-los com partes interessadas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bancos e Instituições Financeiras&lt;/strong&gt;&lt;br&gt;
Bancos podem anonimizar dados em imagens de documentos financeiros (extratos bancários, contratos de empréstimo) para proteger a privacidade dos clientes ao realizar auditorias ou ao compartilhar informações internamente.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sistemas de Educação&lt;/strong&gt;&lt;br&gt;
Instituições de ensino podem anonimizar dados em documentos estudantis (boletins, registros acadêmicos) ao compartilhar informações com terceiros ou ao armazená-las de forma segura.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Agências Governamentais&lt;/strong&gt;&lt;br&gt;
Agências governamentais podem anonimizar dados em documentos oficiais (identidade, passaportes, declarações de imposto) antes de processá-los ou arquivá-los para garantir a privacidade dos cidadãos.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Aplicações Jurídicas&lt;/strong&gt;&lt;br&gt;
Escritórios de advocacia e tribunais podem precisar anonimizar informações sensíveis em documentos legais (petições, contratos, depoimentos) para proteger a privacidade das partes envolvidas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Plataformas de Crowdsourcing&lt;/strong&gt;&lt;br&gt;
Plataformas que utilizam crowdsourcing para processamento de dados podem anonimizar informações sensíveis em documentos submetidos pelos usuários para garantir a segurança e privacidade durante o processo de revisão.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serviços de Análise de Dados&lt;/strong&gt;&lt;br&gt;
Empresas que oferecem serviços de análise de dados podem  anonimizar informações sensíveis em documentos antes de realizar análises, garantindo que nenhum dado pessoal seja comprometido.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusões
&lt;/h3&gt;

&lt;p&gt;Com isso podemos ver que em várias situações pode ser bom, e até necessário, a anonimização de dados em imagens, principalmente quando falamos de documentos.&lt;/p&gt;

&lt;p&gt;Se você trabalha com iamgens que podem conter dados sensíveis sempre considere a anonimização dos dados pois assim você colabora para a privacidade dos dados de seus usuários, além de evitar possíveis multas ou outros problemas decorrentes de vazamentos de dados  💯&lt;/p&gt;

&lt;p&gt;Bom por hora é isso, fiquem bem e até a próxima 🙂&lt;/p&gt;

</description>
      <category>security</category>
      <category>ia</category>
      <category>ocr</category>
      <category>api</category>
    </item>
    <item>
      <title>Otimizando Wordlists para Pentests</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Sat, 02 Mar 2024 20:48:12 +0000</pubDate>
      <link>https://dev.to/r9n/otimizando-wordlists-para-pentests-50dp</link>
      <guid>https://dev.to/r9n/otimizando-wordlists-para-pentests-50dp</guid>
      <description>&lt;p&gt;Olá, espero que este artigo encontre você e seus familiares todos bem e cheios de saúde 🙂.&lt;br&gt;
Hoje vamos falar sobre ataques de força bruta e como otimizar as wordlists utilizadas para conseguir ser mais assertivo em seus testes.&lt;br&gt;
Sem mais delongas, bora lá 💯.&lt;/p&gt;

&lt;h3&gt;
  
  
  Responsabilidade
&lt;/h3&gt;

&lt;p&gt;Antes de mais nada quero deixar bem claro que fiz esta ferramenta pensando em auxiliar pentesters e pessoas que queiram realizar estes testes em seus próprios sistemas.&lt;br&gt;
O que você fizer com ela é responsabilidade única e exclusivamente sua, ok?&lt;/p&gt;

&lt;h3&gt;
  
  
  O que é um ataque de força bruta (Brute Force Attack)
&lt;/h3&gt;

&lt;p&gt;Primeiro vamos começar definindo o que é um ataque do tipo brute force e em quais casos ele geralmente é utilizado.&lt;/p&gt;

&lt;p&gt;Um ataque de força bruta é um método de tentativa e erro usado para descobrir uma senha o chave criptográfica ao testar todas as combinações possíveis em rápida sucessão. Geralmente, esse tipo de ataque é automatizado através de programas ou scripts que tentam todas as combinações de caracteres, números e símbolos em uma sequência exaustiva até que a senha correta seja encontrada.&lt;/p&gt;

&lt;p&gt;Os ataques de força bruta são comumente usados em situações em que um invasor deseja obter acesso não autorizado a sistemas protegidos por autenticação baseada em senha. Alguns casos típicos de uso incluem:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quebra de senha&lt;/strong&gt;: Tentar descobrir a senha de uma conta de usuário ou administrador em sistemas online, como redes sociais, e-mails, bancos de dados, entre outros.&lt;br&gt;
&lt;strong&gt;Quebra de criptografia:&lt;/strong&gt; Tentar quebrar chaves criptográficas ao decifrar mensagens ou arquivos criptografados.&lt;br&gt;
Descoberta de chaves de segurança: Tentar encontrar a chave de segurança de uma rede sem fio protegida por criptografia WEP, WPA ou WPA2.&lt;br&gt;
&lt;strong&gt;Acesso não autorizado a sistemas&lt;/strong&gt;: Tentar ganhar acesso não autorizado a sistemas, servidores ou dispositivos protegidos por senha, como roteadores, firewalls, etc.&lt;/p&gt;

&lt;p&gt;Em resumo, ataques de força bruta são uma técnica de invasão que explora a vulnerabilidade de senhas fracas ou algoritmos de criptografia ineficientes, visando obter acesso não autorizado a sistemas e informações sensíveis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wordlists e sua importância neste tipo de ataque
&lt;/h2&gt;

&lt;p&gt;As wordlists desempenham um papel crucial nos ataques de força bruta, fornecendo uma lista predefinida de palavras ou combinações de caracteres que são usadas como tentativas durante o processo de tentativa e erro para descobrir uma senha ou chave.&lt;/p&gt;

&lt;p&gt;Essas listas podem conter uma ampla variedade de informações, incluindo:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Palavras comuns&lt;/strong&gt;: Palavras frequentemente usadas em senhas, como "password", "123456", "qwerty", entre outras.&lt;br&gt;
Dicionários de idiomas: Palavras de dicionários de diferentes idiomas são frequentemente incluídas, pois muitas pessoas usam palavras do seu próprio idioma como senha.&lt;br&gt;
&lt;strong&gt;Combinações de caracteres&lt;/strong&gt;: Sequências de caracteres como números, letras maiúsculas e minúsculas, símbolos, e suas combinações.&lt;br&gt;
&lt;strong&gt;Padrões&lt;/strong&gt;: Sequências de caracteres que seguem padrões comuns, como datas de nascimento, nomes próprios, palavras seguidas de números, entre outros.&lt;br&gt;
Ao usar uma wordlist durante um ataque de força bruta, o processo de tentativa e erro é agilizado, pois o atacante não precisa gerar as combinações de caracteres manualmente, aumentando as chances de sucesso.&lt;/p&gt;

&lt;h2&gt;
  
  
  O lado ruim...
&lt;/h2&gt;

&lt;p&gt;Bom como sabemos bem, tudo na vida tem um preço 😅.&lt;br&gt;
Neste caso o lado ruim desse tipo de ataque é o tempo!! Existem vários tipos de wordlists por ai e seus tamanhos variam de algumas linhas a milhões de registros. Dependendo do poder de processamento do seu alvo, no caso de um teste de brute force contra algum serviço, ou do poder de processamento de seu computador no caso de ser um brute force local, a conclusão desse teste pode durar horas ou até mesmo dias!! O que por mais que você tenha tempo disponível para isso é meio complicado esperar horas para descobrir que a senha que você procura não está naquela wordlist.  Se por um lado wordlists maiores aumentam a chance de sucesso, por outro elas aumentam também o tempo de execução do teste, e isso algo que definitivamente não queremos.&lt;br&gt;
Então o que podemos fazer ? Bom aí vem uma coisa chamada &lt;strong&gt;OsInt&lt;/strong&gt; 🙂 &lt;/p&gt;

&lt;h2&gt;
  
  
  Osint
&lt;/h2&gt;

&lt;p&gt;OSINT (Open Source Intelligence),ou inteligência de fontes abertas, refere-se à prática de coletar e analisar informações de fontes disponíveis ao público para obter insights e conhecimentos úteis. Essas fontes podem incluir redes sociais, sites da internet, fóruns online, notícias, registros públicos, e qualquer outra informação acessível ao público em geral, sem a necessidade de técnicas de invasão ou acesso não autorizado.&lt;br&gt;
Ou seja, significa tentar descobrir características que podem ser utilizadas para inferir informações acerca da senha ou dado que você busca. Trazendo isso para um contexto de pentest, imagine que você deseja testar a segurança de um site x, e você vai tentar fazer um brute force para ver como está a segurança das senhas dos usuários.&lt;/p&gt;

&lt;p&gt;Se você pegar uma wordlist genérica de 5 milhões de senhas, você pode acabar demorando demais e consumindo muito recurso de processamento para, no fim, não achar nenhuma senha que batesse para determinado login. Porém, você, como um bom pentester, resolveu ir lá no site e dar uma olhadinha para ver se conseguia descobrir algo sobre a senha daquele site. Você tenta criar uma conta e quando é questionado sobre a senha, insere uma senha qualquer e boom! O site te retorna uma mensagem dizendo que as senhas que ele aceita possuem um formato específico, geralmente algo parecido com isso:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbvpt08neyghx0jgat2r4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbvpt08neyghx0jgat2r4.png" alt="password rules" width="800" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ou seja, sobre esse site x, agora você sabe que não adianta testar senhas como 123, ou teste1234 pois as senhas precisam ter, pelo menos, letras minúsculas, maiúsculas entre outras combinações. &lt;br&gt;
Com isso você sabe que de alguma maneira precisa limpar a wordlist que vai ser utilizada senão tudo que vai conseguir é perder tempo. E como podemos fazer isso ? 🤔 &lt;br&gt;
Aí vem a uma ferramenta bem bacana, e simples, que fiz pensando nessa situação 🙂.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wordlist Optimizer
&lt;/h2&gt;

&lt;p&gt;Pensando nessa situação resolvi aproveitar que estou iniciando meus estudos em Go, que é uma linguagem compilada e por isso gera programas que possuem excelente performance, e criei uma ferramenta bem simples para ajudar nessa tarefa.&lt;br&gt;
Basicamente o wordlist optimizer é uma cli ( programa de linha de comando) que filtra dados de uma worldlist baseado em um filtro que você monta passando algumas flags como por exemplo, -l para letras minúsculas , -c para lestras maiúsculas, entre outras opções. A documentação completa você encontra no repositório da ferramenta no github &lt;a href="https://github.com/R9n/wordlist-optimizer" rel="noopener noreferrer"&gt;WorlistOptimizer&lt;/a&gt;.&lt;br&gt;
Com ela você pode criar filtros para selecionar apenas linhas que atendam, minimamente, ao que você quer. &lt;br&gt;
No exemplo a seguir eu filtrei a wordlist teste.txt para recuperar apenas as linhas que tivessem letras maiúsculas, números e tamanho mínimo de 5 caracteres. Senhas como teste123, teste3444 ficariam de fora desse filtro e não seriam gravadas no arquivo de saída teste-optimized.txt.&lt;br&gt;
Essa será nossa wordlist &lt;strong&gt;teste.txt&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjclayuweixiiikwn46h0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjclayuweixiiikwn46h0.png" alt="teste.txt wordlist" width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ao terminar de executar a ferramenta exibe as estatísticas do processamento dos dados&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgz048ltm06lbi4ej8478.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgz048ltm06lbi4ej8478.png" alt="test wordlist result" width="800" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Esse é o arquivo gerado com todas dos dados que deram match( minimamente) com o filtro passado.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98hbiifmf0q0af5lrj6r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98hbiifmf0q0af5lrj6r.png" alt="optimized result set" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;E esse é o arquivo gerado como complemento do arquivo de match, ou seja, são todos os dados que não deram match.&lt;br&gt;
É importante ter esse arquivo pois quando estamos fazendo pentest real, o as wordlists podem ser muito grandes, na casa de milhões e milhões e as vezes até mais, então é importante ir segmentando seu teste para caso você mude de estratégia já ter esses dados filtrados.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzgjwnum0qj48iiv411e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzgjwnum0qj48iiv411e.png" alt="removed set result" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Como vocês podem ver, no arquivo &lt;strong&gt;removed-teste.txt&lt;/strong&gt; estão as senhas que não deram match no filtro.&lt;br&gt;
Com essa simples ação você pode tornar seu teste muito mais efetivo, reduzindo o tamanho da sua wordlist e economizando processamento de seu alvo de testes 😃.&lt;/p&gt;

&lt;p&gt;E uma última dica é, sempre que for realizar um pentest e precisar utilizar utilizar um brute force, tome cuidado para não sobrecarregar o sistema de seu cliente, pois como ataques de forças bruta operam através de tentativa e erro, é normal que ele erre muito (mas muuuuuuito) antes de acertar, não é atoa que as wordlists possuem facilmente milhões e milhões de dados. Se conduzido de forma errada o seu teste pode ser mais prejudicial do que um ataque legítimo 😅. &lt;/p&gt;

&lt;p&gt;Além disso, deixo aqui uma sugestão para os programadores e arquitetos de software: sempre considerem a implementação de um RATE LIMIT em suas aplicações. Em um cenário de ataque mal-intencionado, é esse rate limit que cuidará para que sua aplicação não seja comprometida. Embora não exista uma solução única em segurança e haja métodos para burlar o rate limit, ter um rate limit configurado em sua aplicação ou WAF (&lt;a href="https://www.cloudflare.com/pt-br/learning/ddos/glossary/web-application-firewall-waf/" rel="noopener noreferrer"&gt;Web Application Firewal&lt;/a&gt;)  é uma prática recomendada.&lt;/p&gt;

&lt;p&gt;Bom por hoje é isso, espero que essa dica e essa ferramenta possam tornar seus testes mais efetivos 🚀. Segue aí para mais dicas 🙂. &lt;/p&gt;

&lt;p&gt;Fiquem bem, estudem bastante e descansem a cuca também porque a vida é para ser aproveitada 💯.&lt;/p&gt;

&lt;p&gt;Obrigado por chegar até aqui e até a próxima 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  Referências
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://owasp.org/www-chapter-ghana/assets/slides/OWASP_OSINT_Presentation.pdf" rel="noopener noreferrer"&gt;OsInt (Owasp)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://owasp.org/www-community/attacks/Brute_force_attack" rel="noopener noreferrer"&gt;BruteForce (owasp)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/topics/bruteforce-wordlist" rel="noopener noreferrer"&gt;Exemplos de wordlists (github)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.cloudflare.com/pt-br/learning/ddos/glossary/web-application-firewall-waf/" rel="noopener noreferrer"&gt;Web Application Firewall (cloudflare)&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>pentest</category>
      <category>hacking</category>
      <category>go</category>
    </item>
    <item>
      <title>Protegendo sua API NodeJs contra ReDos Attack[Parte 3]</title>
      <dc:creator>Ronaldo Modesto</dc:creator>
      <pubDate>Thu, 26 Jan 2023 16:52:10 +0000</pubDate>
      <link>https://dev.to/r9n/protegendo-sua-api-nodejs-contra-redos-attackparte-3-40g7</link>
      <guid>https://dev.to/r9n/protegendo-sua-api-nodejs-contra-redos-attackparte-3-40g7</guid>
      <description>&lt;p&gt;Ok! Vimos o que é uma expressão regular, como utilizá-la, o que é um ReDos e como podemos resolver esse problema!&lt;/p&gt;

&lt;p&gt;Caso você tenha caído aqui de paraquedas, seguem os links para as duas primeiras partes desse artigo:&lt;br&gt;
&lt;a href="https://dev.to/r9n/protegendo-sua-api-nodejs-contra-redos-attackparte-1-16mc"&gt;&lt;strong&gt;Parte 1 (Definição do problema)&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/r9n/protegendo-sua-api-nodejs-contra-redos-attackparte-2-2gfo"&gt;&lt;strong&gt;Parte 2 (Construção de uma possível solução)&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Agora chegou a hora de testar nossa solução e fazer algumas considerações acerca da mesma. Bora ver se o que construímos de fato funciona ? 🙂&lt;/p&gt;

&lt;p&gt;Primeiramente vamos executar o mesmo teste que fizemos quando utilizamos a abordagem que acabava travando toda a nossa API. &lt;br&gt;
Conforme podemos ver a seguir, ao utilizar o mesmo payload que causou problemas anteriormente, dessa vez nosso sistema não sofreu com nenhum impacto pois a thread que acabou travando foi a thread da micro vm que criamos, e dado que acabou gerando um timeout, nós apenas recebemos uma mensagem dizendo que um timeout ocorreu, mas nossa API segue firme e forte 💪.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2yevjclv4ti5dnp2kva.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2yevjclv4ti5dnp2kva.PNG" alt="Timeout" width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nosso endpoint de teste de responsividade também continua a todo vapor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9v7bmx5zow5gtijq4ms.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9v7bmx5zow5gtijq4ms.PNG" alt="Server up and running" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok vimos que de fato nossa API não está mais travando quando recebe um payload malicioso. Porém temos que nos fazer seguinte pergunta, &lt;strong&gt;Ok, funcionou, mas essa solução é escalável?&lt;/strong&gt;, sempre que implementamos uma solução para um dado problema.&lt;/p&gt;

&lt;p&gt;Então vamos testar a responsividade de nossa API sob alta carga e para isso vamos usar uma ferramenta de teste de carga chamada K6. &lt;/p&gt;

&lt;p&gt;O K6 é uma ferramenta utilizada para testar aplicação com diferentes cenários de teste de carga(teste de absorção, teste de estresse dentre outros). É uma ótima ferramenta e sugiro, para aqueles que não a conhecem, ler mais a respeito desse carinha. &lt;a href="https://k6.io" rel="noopener noreferrer"&gt;Clique aqui e conheça o K6&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A seguir temos o nosso arquivo de teste de carga. É um teste simples, basicamente vamos testar nossa API contra uma quantidade considerável de requisições simultâneas e ver como ela se comporta no que diz respeito à memória e uso de CPU.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import http from "k6/http";
import { check, sleep } from "k6";

export const options = {
  stages: [
    { duration: "2m", target: 250 }, // Simula um aumento de 0 até 100 requisições, em um período de 2 minutos
    { duration: "2m", target: 300 }, // Permaneçe em 300 requisições por 2 min
    { duration: "1m", target: 0 }, // Desce para 0 requisições ao longo de 1 minuto
  ],
};

const BASE_URL = "http://192.168.2.176:3000"; // Aqui eu coloquei o ip do computador que estava rodando a api, utilizei um outro computador para rodar o teste para garantir que não haveriam interferências

export default () =&amp;gt; {
  const headers = { "Content-Type": "application/json" };

  // Primeiro envio um payload malicioso, simulando um ataque
  const maliciusPatternResult = http.post(
    `${BASE_URL}/validate-form-safe`,
    JSON.stringify({
      email: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@gmail.com",
      password: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    }),
    { headers: headers }
  );

  // Verifico para ver se recebi um timeout como resposta
  check(maliciusPatternResult, {
    "Bad-request-blocked-successfully": (response) =&amp;gt; {
      return (
        JSON.parse(response.body).message === "Email ou senha são inválidos"
      );
    },
  });

  // Depois envio um payload válido paar verificar se a api está funcionando como deveria e não foi prejudicada pelo payload malicioso enviado anteriorment

  const validPatternResult = http.post(
    `${BASE_URL}/validate-form-safe`,
    JSON.stringify({
      email: "email-valido@gmail.com",
      password: "ab.cd.Zz",
    }),
    { headers: headers }
  );

  // Aqui verifico a resposta para checar se a resposta foi correta
  check(validPatternResult, {
    "Valid-Pattern-Accepted-successfully": (response) =&amp;gt;
      JSON.parse(response.body).isValidForm === true,
  });

  // Por fim faço uma requisição para o endpoint de checagem da api, para ver e ele ainda está respondendo
  const serverCheckResponse = http.get(`${BASE_URL}/test-server`).json();

  // e verifico se ele de fato está ativo
  check(serverCheckResponse, {
    "servidor responsivo": (obj) =&amp;gt;
      obj.message === "Servidor está respondendo normalmente",
  });

  sleep(1); // apenas um pequeno timer entre uma iteração do teste e outra
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Após rodar o teste de carga em outro computador para não afetar o desempenho de nossa API, utilizando um computador com processador de  4 núcles e 8GB de RAM, além de ter subido a nossa API utilizando o gerenciador de processos PM2 que consegue subir as aplicações NodeJs em forma de cluster, caso não conheça o PM2, &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;clique aqui e confira&lt;/a&gt;, consegui uma taxa de 300 request/segundo o que é um resultado considerável considerando o que computador não era muito forte e considerando que internamente o nodeJs tem sim um overhead a mais para executar esse script em um contexto separado. Cumprimos nosso objetivo 🙂.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4x5xdoumor9923ovaxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4x5xdoumor9923ovaxg.png" alt="load-test result" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Considerações e dicas&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Essa solução que foi apresentada aqui é extensível para outras tarefas que podem ser bloqueantes, (cálculo de hashes por exemplo).  Se você não tem certeza de que aquela operação será rápida ou se pode ou não ser bloqueante, a solução apresentada neste artigo pode ser uma forma de garantir que seu sistema não irá travar.&lt;/p&gt;

&lt;p&gt;Aqui vão algumas dicas que podem ajudar a manter essa falha longe de suas APIs NodeJs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Não escreva sua própria regex:&lt;/strong&gt; Evite criar suas próprias reges, principalmente se você não for expert em expressões regulares, pois a chance de você acabar criando um regex com essa falha é muito grande.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use expressões regulares já prontas e validadas:&lt;/strong&gt; Essa é um complemento à dica 1. Se precisar validar algo procure por expressões regulares que já foram validadas contra esse tipo de falha, e até mesmo outras falhas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use validadores:&lt;/strong&gt; Existem validadores já pronto que podem validar uma grande variedade de padrões e é muito provável que já exista um validador para o que você quer. Por exemplo:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/validator" rel="noopener noreferrer"&gt;Validator.js&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/safe-regex" rel="noopener noreferrer"&gt;Safe Regex&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/redos-detector" rel="noopener noreferrer"&gt;Redos Detector&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Valide sua regex caso precise fazer uma:&lt;/strong&gt; Se você de fato precisar construir sua própria expressão regular então tente validá-la para saber se ela está vulnerável a essa falha. Alguns são:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://devina.io/redos-checker" rel="noopener noreferrer"&gt;Devina&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://redosdetector.com/" rel="noopener noreferrer"&gt;RedosDetector&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://makenowjust-labs.github.io/recheck/" rel="noopener noreferrer"&gt;Recheck&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;E por fim, a mais importante dica de todas 🙂&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Entenda o que ela está fazendo!!!&lt;/strong&gt; Estude sobre a expressão que você quer usar, identifique o que ela está reconhecendo e como ela o está fazendo, estude expressões regulares para que você pelo menos consiga dizer o que aquela expressão está validando.&lt;/p&gt;

&lt;p&gt;E esse conselho se estende a todas as coisas que você precisar utilizar, evite copiar e colar coisas sem saber o que aquilo está fazendo pois você pode acabar inserindo brechas de segurança em seu sistema 🙂.&lt;/p&gt;

&lt;p&gt;Bom por hoje foi isso pessoal, espero que esse artigo lhe ajude de alguma forma, fiquem com Deus e ate a próxima 🙂.&lt;/p&gt;

</description>
      <category>node</category>
      <category>security</category>
      <category>hacking</category>
      <category>api</category>
    </item>
  </channel>
</rss>
