Re: Extremely strange behavior with Fabric - modifying ledger out of band


David Enyeart
 

Remember that blockchains are decentralized ledgers. What you've done here is essentially tampered/corrupted your own local peer's state database so that it is not in sync with the blockchain blocks. This would be similar to tampering/corrupting a bitcoin node's chainstate database of unspent transactions. You won't be able to convince other nodes in the network that your data is correct. In fact they will detect the bad data upon the next endorsement request, and choose never to do business with you again, which was why you'd want to join a Fabric network consortium in the first place.
New blocks weren't created by changing the state database - you were able to submit a transaction which created a new block because you had an endorsement policy of 'one'. Real Fabric deployments should use an endorsement policy strong enough so that one corrupt peer (or a small number of colluding organizations) can't impact the blockchain.

See deeper discussion in prior threads such as https://lists.hyperledger.org/g/fabric/message/4896.


Dave Enyeart

Siddharth Jain ---11/17/2019 10:28:33 PM---see this video: https://youtu.be/KOS5CeP-mNY

From: Siddharth Jain <siddjain@...>
To: David Enyeart <enyeart@...>
Cc: "fabric@..." <fabric@...>
Date: 11/17/2019 10:28 PM
Subject: [EXTERNAL] Re: [Hyperledger Fabric] Extremely strange behavior with Fabric - modifying ledger out of band





see this video: https://youtu.be/KOS5CeP-mNY
Programming Hyperledger Fabric
youtu.be

the resolution is very poor but it contains the steps to repro the issue.



From: David Enyeart <enyeart@...>
Sent:
Saturday, November 16, 2019 6:52 AM
To:
Siddharth Jain <siddjain@...>
Cc:
fabric@... <fabric@...>
Subject:
Re: [Hyperledger Fabric] Extremely strange behavior with Fabric - modifying ledger out of band

Something else must be going on, since what you've described is not possible. New blocks with validated transactions drive the CouchDB state database updates, never the other way around. Watch the peer log as you make updates and I expect you'll discovery something else going on.

Use a logging string when starting peer such as:
FABRIC_LOGGING_SPEC=info:kvledger,statecouchdb,couchdb=debug


Dave Enyeart

"Siddharth Jain" ---11/15/2019 08:35:29 PM---Summary: we created a simple Fabric network that comes with the IBM Blockchain extension and uses Co

From:
"Siddharth Jain" <siddjain@...>
To:
"fabric@..." <fabric@...>
Date:
11/15/2019 08:35 PM
Subject:
[EXTERNAL] [Hyperledger Fabric] Extremely strange behavior with Fabric - modifying ledger out of band
Sent by:
fabric@...





Summary: we created a simple Fabric network that comes with the IBM Blockchain extension and uses CouchDB and one peer and one orderer. we made some chaincode invocation requests and created some data in the ledger. Then we made changes to CouchDB records from the CouchDB web based UI (
Fauxton) which can be accessed at http://localhost:17055/_utils.

Observed: It resulted in new blocks being appended to the ledger! When we re-started the network we could see the block height increased and changes made by Fauxton showed up!


Expected: No new blocks should have been appended to the ledger. Fauxton doesn't even know who I am. It doesn't know my X.509 certificate. Who signed the new blocks? How did the changes get endorsed? How did making changes from Fauxton result in generation of a Fabric transaction? This is truly bizarre.


Our understanding of Fabric was that the ledger data is stored in blocks under /var/hyperledger/production/ledgersData folder and the couchdb docker container would read these blocks and initialize the couchdb database. A user is not prevented from modifying records using Fauxton but that won't change anything under the /var/hyperledger/production/ledgersData folder which stores the actual blocks. So if the network is re-started, it should not show any out-of-band changes. But that simply did not turn out to be true.


Can anyone explain this?


e.g., we start with this:



we click on this record which gives



we change createdBy to david and click on save changes button




when we stop and re-start the network


the record has been permanently modified and its creator is now david! so anyone can make whatever changes they want to the ledger?!





Join fabric@lists.hyperledger.org to automatically receive all group messages.