<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ElephantsLab on Medium]]></title>
        <description><![CDATA[Stories by ElephantsLab on Medium]]></description>
        <link>https://medium.com/@elephantslab?source=rss-2cec35809f6c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lylowzgC3gQd88smIK8SLQ.png</url>
            <title>Stories by ElephantsLab on Medium</title>
            <link>https://medium.com/@elephantslab?source=rss-2cec35809f6c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:17:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elephantslab/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ElephantsLab уклало договір про співпрацю з ВНТУ!]]></title>
            <link>https://elephantslab.medium.com/elephantslab-has-signed-a-cooperation-agreement-with-vntu-32f106a79266?source=rss-2cec35809f6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/32f106a79266</guid>
            <dc:creator><![CDATA[ElephantsLab]]></dc:creator>
            <pubDate>Wed, 07 Jul 2021 13:19:43 GMT</pubDate>
            <atom:updated>2021-07-07T13:20:46.249Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gCBC7LjdzCPY0qEEQWWHg.jpeg" /></figure><p>Нарешті це сталось! Приблизно рік тому ElephantsLab встановила зв’язки з Вінницьким національним технічним університетом (ВНТУ), які протягом року лише поглиблювались. Зокрема, два тижні тому студентами кафедри захисту інформації була захищено 5 бакалаврських дипломних робіт студентами спеціальності 125 “Кібербезпека”, які стосуються розробки DApp та безпеки програмних застосунків, причому їх тематика та технічне завдання були сформовані ElephantsLab, а технічна експертиза ElephantsLab дозволила студентам отримати практичний досвід та краще розуміння особливостей роботи в сфері ІТ та блокчейн-технологій.</p><p>Така спільна робота ElephantsLab та ВНТУ показала перспективи подальшої співпраці та зародила бажання її поглиблення в обох сторін. Логічним наслідком стала підготовка та підписання договору про співробітництво. Внаслідок зустрічі представників ElephantsLab із завідувачем кафедри захисту інформації Лужецьким В. А. та доцентом тієї ж кафедри Баришевим Ю. В. були визначені основні напрями співпраці (див. фото).</p><p>Таким чином команда ElephantsLab показує, що не лише на словах готова підтримувати та підвищувати якість освіти і темп розвитку науки України. Крім того, наукова співпраця дозволить ElephantsLab тримати “руку на пульсі” останніх теоретичних досліджень і захищати дані своїх користувачів ще краще, а спільні дослідження дозволять зменшити відстань між теорією та практикою. Тому варто очувати ще кращих продуктів від нашої команди, які використовуватимуть новинки з галузі криптографії та захисту програм!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32f106a79266" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Уязвимость в проектах DeFi фарминга]]></title>
            <link>https://elephantslab.medium.com/%D1%83%D1%8F%D0%B7%D0%B2%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D1%8C-%D0%B2-%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B0%D1%85-defi-%D1%84%D0%B0%D1%80%D0%BC%D0%B8%D0%BD%D0%B3%D0%B0-c6c9365d38e3?source=rss-2cec35809f6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6c9365d38e3</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[tron]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[ElephantsLab]]></dc:creator>
            <pubDate>Thu, 10 Sep 2020 15:18:08 GMT</pubDate>
            <atom:updated>2020-09-10T15:49:35.853Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vybJvghn8ku0aEJgR0RL2Q.png" /></figure><p>В последнее время широкую популярность приобрели проекты DeFi с моделью фарминга. Эта модель заключается в том, что пользователь может разместить (заморозить на контракте) определенное количество токенов <a href="https://tronprotocol.github.io/documentation-en/contracts/trc20/">TRC-20</a> (<a href="https://eips.ethereum.org/EIPS/eip-20">ERC-20</a> в блокчейне Ethereum) и получить вознаграждение в виде некоторого количества других токенов за размещение этих токенов.</p><p>Перед размещением токенов большинство контрактов просят пользователя подтвердить транзакцию для разрешения распоряжаться этими токенами от имени контракта проекта. Для этого пользователь должен подписать транзакцию с вызовом метода <strong><em>approve()</em></strong> на контракте соответствующего токена TRC-20 (ERC-20). Согласно <a href="https://eips.ethereum.org/EIPS/eip-20">стандарту ERC-20</a> метод <strong><em>approve()</em></strong> должен принимать два параметра:</p><ul><li><strong><em>address _spender</em></strong> — адрес, которому предоставляется доступ для распоряжения определенным количеством токенов. В нашем случае это будет адрес контракта проекта фарминга или адрес контракта, порожденного контрактом-фабрикой проекта.</li><li><strong><em>uint256 _value</em></strong> — количество токенов, которыми сможет распорядиться доверенный адрес.</li></ul><p>Но, как показывает наше исследование, в большинстве фарминг-проектов в качестве второго параметра этого метода передается отрицательное число. Таким образом, при вызове метода <strong><em>approve()</em></strong> происходит переполнение типа <strong>uint256</strong>, и пользователь фактически разрешает контракту распоряжаться всем количеством токенов, имеющихся на балансе пользователя.</p><p>Так выглядит транзакция в блокчейне TRON (Рис. 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pqzAXY3-4_XfOOu6m-ijFw.png" /><figcaption>Рис.1 — Транзакция, дающая контракту разрешение распоряжаться токенами.</figcaption></figure><p>Вы можете проверить количество токенов, которыми разрешено распоряжаться, вызвав метод контракта токена <strong><em>allowance()</em></strong> и передав ему адрес владельца токенов и адрес доверенного контракта (Рис. 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vxh6NGiDpVgXjyFacZ2NLg.png" /><figcaption>Рис. 2 — Проверка значения количества токенов, которыми разрешено распоряжаться.</figcaption></figure><p>Как видно из примера (Рис. 2), мы передали в распоряжение огромное количество токенов. Фактически, это число намного больше, чем фактическое количество токенов на любом адресе держателей этих токенов. Это дает контракту фарминга право распоряжаться всеми токенами тех участников проекта, которые предоставили доступ к токенам таким образом.</p><p>Если в контракте реализован метод, который может быть вызван только владельцем проекта и который переводит токены на его адрес (или любой другой указанный им адрес), то владельцы фарминг-проекта могут переводить токены с адресов участников проекта. Следует отметить, что <strong>большинство популярных фарминг-проектов не публиковали исходный код своих контрактов</strong>, и на данный момент невозможно проверить наличие такого метода в их контрактах, что не исключает такой возможности. Если такой метод присутствует в контракте фарминг-проекта, то владелец проекта может<br>осуществить эту передачу в любое время, даже после того, как проект был закрыт и участники забыли об этом.</p><p>Чтобы обезопасить себя от возможности скомпрометировать свой адрес и потерять токены, участнику проекта достаточно вызвать метод <strong><em>approve()</em></strong> на контракте соответствующего токена TRC-20 (ERC-20) с <strong>нулевым</strong> <strong>значением</strong> количества токенов, которые пользователь хочет доверить контракту фарминг-проекта (Рис. 3). Пользователь должен сделать это для всех фарминг-проектов, в которых он участвовал, и для всех токен-контрактов, токены которых он давал в распоряжение фарминг-проектам.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omzy43Io-Q6QWDMz_9qULQ.png" /><figcaption>Рис. 3 —Отклонения права распоряжаться токенами для контракта фарминг-проекта.</figcaption></figure><p>Затем вы можете проверить результат, снова вызвав метод <strong><em>allowance()</em></strong>, чтобы убедиться, что вы больше не разрешаете использование своих токенов (Рис. 4).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTgPIOHP7cxQQFQXXEqSAQ.png" /><figcaption>Рис. 4 — Проверка количества токенов, которыми в праве распоряжаться контракт.</figcaption></figure><h3>Выводы</h3><p>Данное исследование было сделано для блокчейна TRON и основными токенами подверженными этой уязвимости на момент написания статьи можно считать:</p><p>USDT (contract <a href="https://tronscan.org/#/contract/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t/code">TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t</a>)<br>USDJ (contract <a href="https://tronscan.org/#/contract/TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT/code">TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT</a>)<br>JST (contract <a href="https://tronscan.org/#/contract/TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9/code">TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9</a>)</p><p>Если вы участвовали в каких либо фарминг-проектах на блокчейне TRON, проверьте, давали ли вы право распоряжаться своими токенами контрактам этих проектов с помощью метода <strong><em>allowance() </em></strong>контрактов токенов. Держите свою криптовалюту в безопасности!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6c9365d38e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yield farming DeFi vulnerability]]></title>
            <link>https://elephantslab.medium.com/yield-farming-defi-vulnerability-af0ed443e14c?source=rss-2cec35809f6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/af0ed443e14c</guid>
            <category><![CDATA[tron]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[ElephantsLab]]></dc:creator>
            <pubDate>Wed, 09 Sep 2020 13:57:45 GMT</pubDate>
            <atom:updated>2020-09-10T10:04:46.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vybJvghn8ku0aEJgR0RL2Q.png" /></figure><p>Recently, DeFi projects with a farming model have gained wide popularity. This model is that a user can stake a certain amount of <a href="https://tronprotocol.github.io/documentation-en/contracts/trc20/">TRC-20</a> tokens (<a href="https://eips.ethereum.org/EIPS/eip-20">ERC-20</a> on the Ethereum blockchain) and receive a reward in the form of some amount of another tokens for staking these tokens.</p><p>Before tokens staking most contracts ask the user to confirm the transaction for permission to dispose of these tokens on project contract behalf. To do this, the user must sign a transaction with a call of the <strong><em>approve()</em></strong> method on the contract of the corresponding TRC-20 (ERC-20) token. According to the <a href="https://eips.ethereum.org/EIPS/eip-20">ERC-20</a> standard, the <strong><em>approve()</em></strong> method must assume two parameters:</p><ul><li><strong><em>address _spender </em></strong>—<strong><em> </em></strong>an address that is given the access to dispose of a certain number of tokens. In our case, this will be the address of the project contract or the address of the contract deployed by the factory contract.</li><li><strong><em>uint256 _value</em></strong> — the number of tokens that a trusted address can dispose of.</li></ul><p>But, as our research shows, most of the farming projects contracts pass a negative number as the second parameter of this method. Thus, when the <strong><em>approve()</em></strong> method is called, an overflow of the <strong><em>uint256</em></strong> type occurs and the user actually allows to the contract the right to dispose of the entire amount of tokens on his balance.</p><p>The is how transaction looks like in the Tron blockchain (Fig. 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pqzAXY3-4_XfOOu6m-ijFw.png" /><figcaption>Fig. 1 - Approve tokens for dispose of transaction in the Tron blockchain.</figcaption></figure><p>You can check the number of tokens allowed to dispose of by calling the <strong><em>allowance()</em></strong> method of the tokens contract and passing the tokens owner’s address and trusted contract address to it (Fig. 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vxh6NGiDpVgXjyFacZ2NLg.png" /><figcaption>Fig. 2 - Check tokens amount allowed to dispose of.</figcaption></figure><p>As you can see from the example (Fig. 2), we have transferred a huge number of tokens to the disposal. In fact, this number is much more than the actual number of tokens at any address of these tokens holders. This gives the project contract the right to dispose of all the tokens of those project participants who gave access to the tokens in such way.</p><p>If the contract implements a method that can only be called by the project owner and which transfers tokens to their address (or any other address specified by them), then the project owners can withdraw tokens from the addresses of project participants. It should be stated that <strong>most of the popular farming projects have not published the source code of their contracts</strong> and at the moment it is not possible to check the presence of such method in their contracts, which does not exclude such possibility. If such method is present in the project contract then project owner can do this transfer at any time, even after farming project was closed a long time ago and participants forgot about this.</p><p>In order to protect oneself from the possibility of compromising the address and losing tokens, a project participant just needs to call the <strong><em>approve()</em></strong> method on the contract of the corresponding TRC-20 (ERC-20) token with <strong>a zero value</strong> of the tokens amount allowed to the project contract (Fig. 3). User should do this for all projects he participated and for all token contracts he participated in these projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omzy43Io-Q6QWDMz_9qULQ.png" /><figcaption>Fig. 3 - Reject tokens allowance from the project contract address.</figcaption></figure><p>Then you can check the result by calling the <strong><em>allowance()</em></strong> method again to be sure that you don’t allow tokens anymore (Fig. 4).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTgPIOHP7cxQQFQXXEqSAQ.png" /><figcaption>Fig. 4 - Check allowance of the tokens dispose of.</figcaption></figure><h3>Conclusions</h3><p>This research was done for the TRON blockchain and the main tokens affected by this vulnerability at the time of writing can be considered:</p><ul><li>USDT (contract <a href="https://tronscan.org/#/contract/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t/code">TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t</a>)</li><li>USDJ (contract <a href="https://tronscan.org/#/contract/TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT/code">TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT</a>)</li><li>JST (contract <a href="https://tronscan.org/#/contract/TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9/code">TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9</a>)</li></ul><p>If you have participated in any of farming projects on the TRON blockchain, check the tokens allowance of these contracts and keep your cryptocurrency safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af0ed443e14c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>