Research Article

A Detection Approach for Vulnerability Exploiter Based on the Features of the Exploiter

Algorithm 2

JCFG generation algorithm.
Input: CFG
Output: JCFG
(1)  JCFG = new JCFG (); / Initialize JCFG /
(2)  Stack cN = new Stack <> (); / Create a stack to store conditional jumps and path fork nodes /
(3)  Stack jN = new Stack <> (); / Create a stack to store conditional jumps and path fork nodes /
(4)  for (int i = 0; i < n; i++) do
(5)   if (node.instruction.exist (Call)) then
(6)    JCFGNode = new JCFG (nodeAttrExtract (node.instruction, node.adress));
(7)     if (JCFG.exist (JCFGNode)) then
(8)      Return (cN, jN);/ Return the CFG node of the last forked path, and make the current JCFG node become the CFG node of the last forked path /
(9)    else
(10)     JCFGAdd (JCFGNode);
(11)    end if;
(12)   else if (instruction.exist (JXX)) then
(13)    if (node.instruction.exist (jmp)) then
(14)     JCFGNode = new JCFG (nodeAttrExtract (node.instruction, node.adress));
(15)     if (JCFG.exist (JCFGNode)) then
(16)      Return (cN, jN);
(17)     else
(18)      JCFGAdd (JCFGNode);
(19)     end if;
(20)   else if (node.instruction.exist (jnz) or node.instruction.exist (jz)) then
(21)   JCFGNode = new JCFG (nodeAttrExtract (node.instruction, node.address));
(22)    if (!JCFG.exist (JCFGNode) or JCFG.second == null) then
(23)     JCFGAdd (JCFGNode);
(24)   else
(25)     Return (cN, jN);
(26)    end if;
(27)   end if;
(28)  end if;
(29)end for.