Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

A signed payment can be altered (payee and amount) and still pass signature verification

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@tanujb03 is already working on this.

Since Oct 10, 2026.

  • #17 by @tanujb03 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
blockchain, cryptography, java
Domain
payments, security

Research direction

Start with the signing and verification code in the Transaction class: look at Transaction.create, the four-argument constructor, and hasValidSignature(), and check which fields the signature actually covers. Then look at Blockchain.addTransaction and isValid(). Run the Repro.java from the issue against target/classes. Done means the forged payment fails hasValidSignature(), the chain rejects it, and the existing tests still pass. Agree on the signed fields with the maintainer first.

Written by the indexing model from the issue text.

Description

advanced bug

What I did

  1. Fresh checkout of main, JDK 17, Maven.
  2. mvn compile
  3. Save this as Repro.java in the project folder:
package minichain;

import java.security.KeyPair;
import java.security.KeyPairGenerator;

public class Repro {
    public static void main(String[] args) throws Exception {
        KeyPairGenerator g = KeyPairGenerator.getInstance("RSA");
        g.initialize(1024);
        KeyPair asha = g.generateKeyPair();

        Blockchain chain = new Blockchain(2);
        chain.minePending("asha");   // asha now has 50 coins

        // asha signs a payment of 120 coins to "ravi"
        Transaction signed = Transaction.create("asha", "ravi", 120, asha.getPrivate(), asha.getPublic());
        // same id, key and signature, but a different payee and amount
        Transaction forged = new Transaction(signed.id(), "asha", "ravi1", 20, signed.senderKey(), signed.signature());

        System.out.println("signed:  " + signed);
        System.out.println("forged:  " + forged);
        System.out.println("signature valid for the forged payment: " + forged.hasValidSignature());
        chain.addTransaction(forged);
        chain.minePending("m");
        System.out.println("chain valid: " + chain.isValid() + ", ravi1 has " + chain.balanceOf("ravi1") + " coins");
    }
}
  1. Compile and run it (use : instead of ; on Linux/macOS):
mkdir out && javac -cp target/classes -d out Repro.java && java -cp "target/classes;out" minichain.Repro

What I expected
The README says: "The system uses digital signatures to prevent forging transactions." (README.md, Note on Security)

A payment whose payee or amount differs from what asha signed should fail hasValidSignature().

What happened instead

signed:  asha -> ravi: 120
forged:  asha -> ravi1: 20
signature valid for the forged payment: true
chain valid: true, ravi1 has 20 coins

The id, key and signature are all public in the chain.

Environment
main @ 0e92205, JDK 17, Maven 3.9.16, Windows 11.

I'd like to work on the fix for this.

Dominant language
Java
Stars
0
Forks
3
Avg merge
16h 38m
Merged PRs (30d)
7

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from techcsispit/mini-chain

All issues in techcsispit/mini-chain

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.