CREDITSCOM / node

Credits Node is the main module that provide an opportunity to run a node and participate in CREDITS blockchain network.
https://developers.credits.com/
GNU Affero General Public License v3.0
151 stars 16 forks source link

Stop any smart contract on the network #38

Open PresidentNavalny opened 5 years ago

PresidentNavalny commented 5 years ago

Describe the bug There is a way to paralyze the work of absolutely any smart contract in the network. Smart contract stops responding to requests of any user (whether it is a smart contract of the game application or any other, it does not matter). If we take the example of gambling application, the player will bet by sending a smart contract Credits coins, but the smart contract will not respond to him, moreover, the sent coins will be in limbo. Smart contract will not be able to get these coins and get back their coins to the user will also fail (coins hang in the air)

To Reproduce Сreate a transaction. enter the address of any smart contract, in the amount field, enter any value 0-0.000...1 cs, then enter in the commission 0.0005 cs and click send transaction. smart contract will not be able to accept these coins, because we have indicated too little сommission for the transfer. at this time, no one will be able to use the application, it simply will not respond to any user until the sending of coins with insufficient commission is canceled(this time varies depending on the speed of creating new blocks, from 1.5 minutes to 4 or more) so you can block the operation of all smart contracts in the network this procedure can be done as many times as you want, even with all smart contracts on the network at the same time during the whole day. no one will be able to use any smart contract in the Credits network all this time. you can permanently block the operation of any smart contract. according to my calculations with this method to block 1 smart contract of the popular application in the Credits network for the whole day, the attacker will need only $0.72) why $0.72? transactions with insufficient commission are rejected within 1.5 minutes and this is the fastest option, when the speed of creating new blocks is about 2 blocks per second. (if the block creation speed is slower, the transaction will be rejected longer). take as a basis of 2 minutes. Provided that the commission in the cs network will be at $0.001, the attacker will need only $0.03 to block the operation of the smart contract for one hour and $0.72 to block for 24 hours In the same way, you can paralyze the transaction of any token in the network. sent to the smart contract of token 0-0.000...1cs, set a commission of 0.0005 cs and then the transaction of this token, in respect of which we have committed this action will be impossible. all transactions with this token will be in the pending status until the Credits coin transaction with insufficient commission is rejected. If desired, as I said, you can permanently paralyze the transfer of all tokens and the operation of all applications in the Credits network. all you need to do is write a bot(or do it all manually), which is every 1.5-2 minutes will send credits coins to smart contracts with insufficient commission. the cost of such an attack on 1 smart contract per day will be only $0.72. 2

tkoen93 commented 5 years ago

Tried to reproduce this (on testnet) to add some logs.

[2019-07-04 19:42:28.469438] [0x00007f3837f0d700] [info] Smart: enqueue payable( = 0.001, bundle = <empty>)
[2019-07-04 19:42:28.469563] [0x00007f3837f0d700] [debug] Smart: {984041.*} is waiting from #984041
[2019-07-04 19:42:28.469580] [0x00007f3837f0d700] [debug] Smart: set running status to {984041.*} containing 1 jobs
[2019-07-04 19:42:28.469596] [0x00007f3837f0d700] [debug] Smart: lock contract AJBsqEoev9phzmrpfPVsVALbLVhJ1FCimByFZbUetcL3
[2019-07-04 19:42:28.469613] [0x00007f3837f0d700] [debug] Smart: {984041.*} is running from #984041
[...]
[2019-07-04 19:42:30.342409] [0x00007f3837f0d700] [info] Smart: {984041.0} is out of fee, cancel the whole queue item
[2019-07-04 19:42:30.342421] [0x00007f3837f0d700] [debug] Smart: {984041.*} is finished on #984042
[...]
[2019-07-04 19:42:31.609749] [0x00007f3837f0d700] [debug] Smart: {984041.*} is finished on #984043
[2019-07-04 19:42:31.609773] [0x00007f3837f0d700] [error] Smart: {0.4294967295} smart contract result packet must contain new state transaction
[2019-07-04 19:42:31.609787] [0x00007f3837f0d700] [debug] Smart: {984041*.} is splitted onto 0 completed + 1 rejected + 0 restart calls
[2019-07-04 19:42:31.609800] [0x00007f3837f0d700] [info] Smart: ======================  SMART-ROUND {0.4294967295} END =====================
[2019-07-04 19:42:31.609813] [0x00007f3837f0d700] [debug] The smartConsensus for {0.65535} is not active
[2019-07-04 19:42:31.616029] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.616089] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.616134] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.719373] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.719451] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.719464] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.731421] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.731501] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.731515] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.749650] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.749725] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.749741] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.763488] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.763573] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.763585] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.865804] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.865876] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.865891] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected

Did not manage to reproduce paralyze the work of absolutely any smart contract in the network. Executing another contract worked fine without any issues, within seconds from the attempt of stopping all contracts.

PresidentNavalny commented 5 years ago

Tried to reproduce this (on testnet) to add some logs.

[2019-07-04 19:42:28.469438] [0x00007f3837f0d700] [info] Smart: enqueue payable( = 0.001, bundle = <empty>)
[2019-07-04 19:42:28.469563] [0x00007f3837f0d700] [debug] Smart: {984041.*} is waiting from #984041
[2019-07-04 19:42:28.469580] [0x00007f3837f0d700] [debug] Smart: set running status to {984041.*} containing 1 jobs
[2019-07-04 19:42:28.469596] [0x00007f3837f0d700] [debug] Smart: lock contract AJBsqEoev9phzmrpfPVsVALbLVhJ1FCimByFZbUetcL3
[2019-07-04 19:42:28.469613] [0x00007f3837f0d700] [debug] Smart: {984041.*} is running from #984041
[...]
[2019-07-04 19:42:30.342409] [0x00007f3837f0d700] [info] Smart: {984041.0} is out of fee, cancel the whole queue item
[2019-07-04 19:42:30.342421] [0x00007f3837f0d700] [debug] Smart: {984041.*} is finished on #984042
[...]
[2019-07-04 19:42:31.609749] [0x00007f3837f0d700] [debug] Smart: {984041.*} is finished on #984043
[2019-07-04 19:42:31.609773] [0x00007f3837f0d700] [error] Smart: {0.4294967295} smart contract result packet must contain new state transaction
[2019-07-04 19:42:31.609787] [0x00007f3837f0d700] [debug] Smart: {984041*.} is splitted onto 0 completed + 1 rejected + 0 restart calls
[2019-07-04 19:42:31.609800] [0x00007f3837f0d700] [info] Smart: ======================  SMART-ROUND {0.4294967295} END =====================
[2019-07-04 19:42:31.609813] [0x00007f3837f0d700] [debug] The smartConsensus for {0.65535} is not active
[2019-07-04 19:42:31.616029] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.616089] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.616134] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.719373] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.719451] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.719464] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.731421] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.731501] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.731515] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.749650] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.749725] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.749741] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.763488] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.763573] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.763585] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected
[2019-07-04 19:42:31.865804] [0x00007f3837f0d700] [debug] Node: 1 rejected contract(s) received
[2019-07-04 19:42:31.865876] [0x00007f3837f0d700] [debug] Smart: get reject contract(s) signal
[2019-07-04 19:42:31.865891] [0x00007f3837f0d700] [debug] Smart: 1 contract(s) are rejected

Did not manage to reproduce paralyze the work of absolutely any smart contract in the network. Executing another contract worked fine without any issues, within seconds from the attempt of stopping all contracts.

attack on every smart contract should be made separate. you can attack 10 different smart contracts at the same time. other smart contracts that you do not attack at this time will work fine

PresidentNavalny commented 5 years ago

There is another way to paralyze any smart contract. Create a smart contract that will send transactions to other smart contracts. We specify in this smart contract, the smart contract that we want to attack. (preferably 400+ times). We send to the created smart contract 1 cs(or any other amount) in response, the smart contract sends 400 transactions to the address of the smart contract specified by us. after that, the same thing happens as I described in the report #38. the smart contract that we attacked stops responding to any account until those 400+ transactions are rejected. Let's say we want to attack the smart contract "Agq8sJ55tvMATLpR5gZSLcHZmBUDjhmjajhq7rgedxmd" Безымянный

Is a smart contract application egyptslot deployed in the network testnet. we create a smart contract that will forward 400 transactions to this smart contract. this smart contract "BPFWxS5tptukmCm2RZ7BD6sTABQQqFY6olt5eiaqygle". Безымянный2 send on this smart contract 1 cs. in response, the smart contract sends 397 transactions to the smart contract application. as a result, this game smart contract will not respond to anyone until such time as these 397 transactions are rejected.

Есть еще один способ парализовать любой смарт контракт. Создаем смарт контракт который будет отправлять другим смарт контрактам транзакции. Указываем в этом смарт контракте, тот смарт контракт, который мы хотим атаковать. (желательно 400+ раз). Отправляем на созданный смарт контракт 1 cs(либо любую другую сумму) в ответ смарт контракт отправляет 400 транзакций на адрес указанного нами смарт контракта. после этого происходит тоже самое, что я описывал в репорте #38. смарт контракт который мы атаковали перестает отвечать любому аккаунту до тех пор пока эти 400+ транзакций не отклонятся. Допустим мы хотим атаковать смарт контракт "Agq8sJ55tvMATLpR5gZSLcHZmBUDjhmjajhQ7RGEdxmD" это смарт контракт приложения egyptslot развернутый в сети testnet. создаем смарт контракт который будет пересылать на этот смарт контракт 400 транзакций. вот этот смарт контракт "BPFWxS5tptukmCm2RZ7BD6sTABQQqFY6oLT5eiaqyGLE". отправляем на этот смарт контракт 1 cs. в ответ на это смарт контракт отправляет 397 транзакций на смарт контракт приложения. в итоге этот игровой смарт контракт не будет никому отвечать до того момента пока не отклонятся эти 397 транзакций.

PresidentNavalny commented 4 years ago

Описание бага на русском языке: Есть способ парализовать работу абсолютно любого смарт контракта в сети. Смарт контракт перестает отвечать на запросы любого пользователя (будь то смарт игрового приложения, либо любой другой, неважно). Если брать в пример геймблинг приложение, то игрок будет делать ставку, отправляя смарт контракту монеты Credits, но смарт ему отвечать никак не будет, более того отправленные монеты будут находиться в подвешенном состоянии, их не сможет принять смарт контракт и получить обратно свои монеты пользователю тоже не удастся (монеты зависают в воздухе) Сделаем это на примере приложения Dice в сети дапс нет (эта дыра есть и в майннете или любой другой сети Credits доступной на данный момент) И так дапс нет, приложение DICE. Открываем веб кошелек (ну либо с десктопа можно сделать тоже самое) формируем транзакцию, вводим в адрес получателя смарт контракт этого приложения "AtPvLHpqrcrioixZWxCNkAGLRdZuh9mJaqKVtEzhaqLs", в поле сумма можно вбить любую сумму, 0.1-0.000...1 cs, в поле комиссия, меняем стандартную комиссию 0.1CS которую нам предлагает веб кошелек, на 0.0005CS, нажимаем отправить. смарт контракт не сможет принять эти монеты, потому что мы указали слишком маленькую комиссию для перевода. в это время никто не сможет пользоваться приложением, оно просто не будет отвечать никакому пользователю, пока не зафейлится отправка монет с недостаточной комиссией(это время варьируется в зависимости от скорости создания новых блоков, от 1.5 минут до 4 и больше) таким образом можно заблокировать работу всех смарт контрактов в сети. причем злоумышленник получит свои отправленные монеты назад, его расходы это только комиссия за перевод 0.00043cs. данную процедуру можно проделывать сколько угодно раз, хоть со всеми смарт контрактами в сети одновременно в течении целого дня. никто все это время не сможет пользоваться никаким смарт контрактом в сети Credits. можно навечно заблокировать работу любого смарта. по моим подсчетам с помощью этого способа, чтобы заблочить 1 смарт популярного приложения в сети Credits на целый день, злоумышленнику понадобится всего $0.72 довольно бюджетненько))) почему $0.72? фейлится транзакция с недостаточной комиссией в течении 1.5 минут и это в самом быстром варианте, когда скорость создания новых блоков примерно 2 блока в секунду. (если скорость создания блоков медленнее, то транзакция будет фейлится дольше). возьмем за основу показатель в 2 минуты. При условии что комиссия в сети cs будет находиться на уровне S0.001, то злоумышленнику понадобится всего $0.03 чтобы заблокировать работу смарт контракта на один час и $0.72 Тем же самым способом можно парализовать передачу любого токена в сети, хоть всех сразу. отправляем на смарт контракт токена 0.000...1cs, выставляем комиссию 0.0005cs и после этого отправка этого токена, в отношении которого мы совершили данное действие будет невозможна. все транзакции с этим токеном хоть 10, хоть 20, хоть 50 штук будут висеть в статусе пендинг, пока не зафейлится передача монет Credits с недостаточной комиссией. При желании как я уже сказал, можно навечно парализовать передачу всех токенов и работу любого приложения в сети Credits. все что для этого нужно, написать бота, который каждые 1.5-2 минуты будет отправлять на смарт контракты токенов или любого приложения монеты Сredits с недостаточной комиссией. стоимость такой атаки на 1 смарт контракт в день будет составлять всего $0.72.