Skip to content

Commit 0313933

Browse files
committed
Added javadoc
1 parent 59d53ea commit 0313933

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

src/main/java/it/unipr/analysis/taint/UncheckedExternalInfluenceAbstractDomain.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@
2424
* <li>Helps in detecting vulnerabilities where external inputs modify contract
2525
* state without verification.</li>
2626
* </ul>
27-
* <p>
28-
* <b>Implementation Details:</b>
29-
* </p>
30-
* <ul>
31-
* <li>Maintains an abstract stack where tainted values are tracked.</li>
32-
* <li>Defines tainted operators corresponding to EVM opcodes that introduce
33-
* untrusted values.</li>
34-
* <li>Provides methods to create TOP (fully tainted) and BOTTOM (untainted)
35-
* states.</li>
36-
* </ul>
3727
*
3828
* @see TaintAbstractDomain
3929
* @see UncheckedExternalInfluenceChecker

src/main/java/it/unipr/analysis/taint/UncheckedStateUpdateAbstractDomain.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
package it.unipr.analysis.taint;
22

33
import it.unipr.analysis.operator.*;
4+
import it.unipr.checker.UncheckedStateUpdateChecker;
45
import it.unive.lisa.symbolic.value.Operator;
56
import java.util.ArrayList;
67
import java.util.Collections;
78
import java.util.HashSet;
89
import java.util.Set;
910

11+
/**
12+
* This abstract domain represents the taint analysis for detecting unchecked
13+
* state updates in smart contracts. It extends TaintAbstractDomain to track whether
14+
* values derived from external calls (CALL, DELEGATECALL, STATICCALL) influence
15+
* the contract's state without validation.
16+
*
17+
* <p><b>Purpose:</b></p>
18+
* <ul>
19+
* <li>Identifies operations that introduce tainted values from external contract calls.</li>
20+
* <li>Tracks symbolic execution to determine if tainted values propagate to SSTORE.</li>
21+
* <li>Detects vulnerabilities where external calls modify the contract state without verification.</li>
22+
* </ul>
23+
*
24+
* @see TaintAbstractDomain
25+
* @see UncheckedStateUpdateChecker
26+
*/
1027
public class UncheckedStateUpdateAbstractDomain extends TaintAbstractDomain {
1128

1229
private static final UncheckedStateUpdateAbstractDomain TOP = new UncheckedStateUpdateAbstractDomain(

src/main/java/it/unipr/checker/UncheckedStateUpdateChecker.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import it.unipr.analysis.taint.TaintAbstractDomain;
44
import it.unipr.analysis.taint.TaintElement;
5+
import it.unipr.analysis.taint.UncheckedStateUpdateAbstractDomain;
56
import it.unipr.cfg.EVMCFG;
67
import it.unipr.cfg.ProgramCounterLocation;
78
import it.unipr.cfg.Sstore;
@@ -21,6 +22,27 @@
2122
import org.apache.logging.log4j.LogManager;
2223
import org.apache.logging.log4j.Logger;
2324

25+
/**
26+
* This checker detects cases where a contract updates its state using values
27+
* returned from external calls (CALL, DELEGATECALL, STATICCALL) without proper validation.
28+
*
29+
* <p><b>Purpose:</b></p>
30+
* <ul>
31+
* <li>Identifies operations where state updates (SSTORE) are influenced by external contract calls.</li>
32+
* <li>Ensures that state updates do not depend on unverified external data.</li>
33+
* <li>Prevents potential security vulnerabilities due to unchecked state modifications.</li>
34+
* </ul>
35+
*
36+
* <p><b>Analysis Process:</b></p>
37+
* <ul>
38+
* <li>Uses taint analysis to track the propagation of values from external calls.</li>
39+
* <li>Marks CALL, DELEGATECALL, and STATICCALL as taint sources.</li>
40+
* <li>Marks SSTORE as a sink where state is modified.</li>
41+
* <li>If a tainted value reaches SSTORE without encountering a validation step (JUMPI), the contract is vulnerable.</li>
42+
* </ul>
43+
*
44+
* @see UncheckedStateUpdateAbstractDomain
45+
*/
2446
public class UncheckedStateUpdateChecker implements
2547
SemanticCheck<SimpleAbstractState<MonolithicHeap, TaintAbstractDomain, TypeEnvironment<InferredTypes>>> {
2648

src/main/java/it/unipr/crossChainAnalysis/CrossChainAnalysis.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public void runCheckers() {
106106
futures.add(_executor.submit(() -> runEventOrderChecker(contract)));
107107
futures.add(_executor.submit(() -> runUncheckedStateUpdateChecker(contract)));
108108
futures.add(_executor.submit(() -> runUncheckedExternalInfluenceChecker(contract)));
109+
// TODO add tx.origin and timestamp dependency checker
109110
}
110111

111112
try {

0 commit comments

Comments
 (0)