Skip to content

Commit 085d803

Browse files
Sim4n6yoff
authored andcommitted
Fix UnicodeDoS vulnerability in CWE-770
1 parent 31dc542 commit 085d803

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/ql/src/experimental/Security/CWE-770/UnicodeDoS.ql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ predicate underAValue(DataFlow::GuardNode g, ControlFlowNode node, boolean branc
6060
(op_gt = any(GtE gte) or op_gt = any(Gt gt)) and
6161
branch = true and
6262
cn.operands(_, op_gt, n.asCfgNode())
63+
or
64+
// not arg <= LIMIT OR not arg < LIMIT
65+
(op_lt = any(LtE lte) or op_lt = any(Lt lt)) and
66+
branch = false and
67+
cn.operands(n.asCfgNode(), op_lt, _)
68+
or
69+
// not LIMIT >= arg OR not LIMIT > arg
70+
(op_gt = any(GtE gte) or op_gt = any(Gt gt)) and
71+
branch = false and
72+
cn.operands(_, op_gt, n.asCfgNode())
6373
)
6474
|
6575
lenCall = API::builtin("len").getACall() and

0 commit comments

Comments
 (0)