Esempio n. 1
0
    public void writeToVulnerableSink1(string file, TaintedStruct struct1)
    {
        FileStream   fos    = new FileStream(file, FileMode.CreateNew);
        StreamWriter writer = new StreamWriter(fos);

        writer.Write(struct1.m_tainted);
    }
Esempio n. 2
0
    public void writeToVulnerableSink2(string file, TaintedStruct struct1)
    {
        FileStream   fos    = new FileStream(file, FileMode.CreateNew);
        StreamWriter writer = new StreamWriter(fos);

        writer.Write(struct1.getTainted());
        writer.Close();
    }
Esempio n. 3
0
    public static void main(string[] args)
    {
        try {
            // first case
            TestCase_IOT_MemberTaint_OutParam testCase = new TestCase_IOT_MemberTaint_OutParam();
            TaintedStruct struct1 = new TaintedStruct();
            testCase.getTaintedStructSource1(args[0], struct1);
            testCase.writeToVulnerableSink1(args[0], struct1);

            // second case
            TaintedStruct struct2 = new TaintedStruct();
            testCase.getTaintedStructSource2(args[0], struct2);
            testCase.writeToVulnerableSink2(args[0], struct2);
        } catch (Exception e) {
            Console.Write(e.StackTrace);
        }
    }
    public static void main(string[] args)
    {
        try {
            // first case
            TestCase_IOT_MemberTaint testCase = new TestCase_IOT_MemberTaint();
            TaintedStruct            struct1  = new TaintedStruct();
            struct1.m_tainted = testCase.getVulnerableSource(args[0]);
            testCase.writeToVulnerableSink1(struct1.m_tainted);

            // second case
            TaintedStruct struct2 = new TaintedStruct(testCase.getVulnerableSource(args[0]));
            testCase.writeToVulnerableSink2(struct2.getTainted());

            // third case
            TaintedStruct struct3 = new TaintedStruct();
            struct3.setTainted(testCase.getVulnerableSource(args[0]));
            testCase.writeToVulnerableSink3(struct3.getTainted());
        } catch (Exception e) {
            Console.Write(e.StackTrace);
        }
    }
Esempio n. 5
0
    public static void main(string[] args)
    {
        try {
            string file = args[0];
            string key  = args[1];

            // first case
            TestCase_IOT_Lost_MemberTaint testCase = new TestCase_IOT_Lost_MemberTaint();
            TaintedStruct taintStruct = new TaintedStruct();
            taintStruct.m_tainted = testCase.getVulnerableSource(file);
            testCase.writeToUnknownSink1(key, taintStruct.m_tainted);

            // second case
            TaintedStruct struct2 = new TaintedStruct(testCase.getVulnerableSource(args[0]));
            testCase.writeToUnknownSink2(struct2.getTainted());

            // third case
            TaintedStruct struct3 = new TaintedStruct();
            struct3.setTainted(testCase.getVulnerableSource(args[0]));
            testCase.writeToUnknownSink3(key, struct3.getTainted());
        } catch (Exception e) {
            Console.Write(e.StackTrace);
        }
    }
Esempio n. 6
0
 public void getTaintedStructSource2(string file, TaintedStruct struct1)
 {
     struct1.setTainted(getVulnerableSource(file));
 }
Esempio n. 7
0
 public void getTaintedStructSource1(string file, TaintedStruct struct1)
 {
     struct1.m_tainted = getVulnerableSource(file);
 }