メインコンテンツへスキップ
見出し画像

【AI開発のリアル #2】 AIが13,588回考えると、レポートが1本できる

    「ミツケル」というサービスを作った。

    Webサイト/CDN のアクセスログを解析して、どんな攻撃が来ているかをレポートにするものだ。

    中身はシンプルで、乱暴である。数億件のログを、AIに全部読ませる。

    とはいえ、数億件をそのままAIに渡せるわけではない。段階的に絞り込む。

    画像
    この例では5319万レコードを段階的に絞り込んでいる

    最初の絞り込みは、AIではなくただの集計プログラムがやる。リクエスト数、エラー率、アクセスしてきたユーザの振る舞いを観察し怪しい動きをしているIPを炙り出す。

    計算で済むことにAIは使わない。ここで数億件の中から、審問すべき怪しいIPが最大500件まで絞られる。

    残ったIPを、AIが1件ずつ審問する。

    防御の専門家として3つ、攻撃者の視点で4つ、締めの検証で4つ。合わせて11の問いを、1つのIPに投げる。

    500件やれば、これだけで5,500回。

    画像
    怪しいに対してAIが、ひとつづつ詳細に検査する

    その結果を、8人の専門家AIが引き継ぐ。

    5人の専門家が別々の視点で調査し、レッドチームが反論し、ファクトチェッカーが数字を検証し、最後に主席アナリストが1本の日本語レポートにまとめる。

    ここで約1,700回。調査する対象によって、この数は上下する。

    画像
    専門家が調査したものを、さらにチェックする担当AIがいる、
    最後に主席アナリストAIがレポートとしてまとめる

    仕上げに、レポートを多言語化する。日本語のレポートを英語と韓国語に切り替えられるようにしてあり、この翻訳もAIがやる。約6,400回。

    画像
    このようなレポートが出来上がる
    画像
    英語と韓国語に現状では翻訳も行っている

    合わせて、このサンプルではAIが13,588回考えて、レポートが1本できた。

    できあがるのは、経営層や担当者がそのまま読める日本語のレポートである。どんな攻撃が来ていて、何が防御を通り抜けていて、だから何をすべきか、までを書く。

    画像
    どんな攻撃が来ていたかも、AIは詳細に見つけてくる

    この1万回を超える推論は、すべて手元の機械の中で動いている。ローカルLLMと呼ばれるもので、顧客のログは1件も社外に出ていない。図の右下にある「外部送信 0」がそれだ。

    手元のAIは、最先端のAIほど賢くない。だから問いを小さく割ってある。「このIPは何を取得しようとしたのか」まで絞られた問いなら、手元のAIでも答えられる。賢さが足りない分は、回数と仕組みで補う。

    最初からこの形だったわけではないのです。

    最初は、たった1つのAIに「専門家として解析して」と丸投げして、見事に失敗した。

    ここにたどり着くまでの78日に何があったか。

    次回から順番に話していく。


    この連載は、Webサイト攻撃状況レポートサービス「ミツケル」ができるまでの記録です。

    開発した製品のリリース情報

    ミツケルが実際に何を見つけているかは、同僚が技術者向けの連載に書いています:



    資料:
    Detail / What actually got through
    — 実際に「通り抜けた」ものは何か


    Attack paths that reached the server

    Attack paths that reached the server (all)
    representative empty-page size: 13,725 B
    
    Path                        Attack class                200 resp   Response size range
    /xxxx/xxxx/xxxx/xxxx/xxxx   Malicious input injection   1,069      11,608–15,095 B
    /xxxx/xxxx/xxxx/xxxx/xxxx   Malicious input injection     682      11,273–14,732 B
    /xxxx/xxxx/xxxx/xxxx/xxxx   Malicious input injection     626      11,116–14,747 B
    /xxxx/xxxx                  Malicious input injection     422       9,513–11,378 B
    /xxxx/xxxx                  Malicious input injection     371      10,089–12,575 B
    /xxxx/xxxx/xxxx/xxxx        Malicious input injection     252      12,242–12,303 B

    SQLi attacks by technique

    SQLi attacks by technique (by presumed target DB)
    
    Technique (presumed target DB)   Basis signature            Requests  Src IPs  200    404    Other
    UNION-based                      UNION ... SELECT            12,249      12    5,526  4,964  1,759
    PostgreSQL time-based blind      PG_SLEEP(                   11,732       2    6,866  2,194  2,672
    MySQL sysdate time-based         SYSDATE()                    9,951       1    5,336  2,075  2,540
    MSSQL time-based blind           WAITFOR DELAY                7,843       4    4,596  1,461  1,786
    Oracle time-based blind          DBMS_PIPE.RECEIVE_MESSAGE    3,966       2    2,261    810    895
    time-based blind (sleep)         SLEEP(                       3,477       5    1,745  1,359    373
    MySQL benchmark time-based       BENCHMARK(                     336       2      244     92      0

    Representative observed payloads

    Representative observed payloads (1 per technique; variable parts masked)
    
    UNION-based:
      /xxxx?xxxx
    PostgreSQL time-based blind:
      /xxxx/xxxx/xxxx' OR 438=(SELECT 438 FROM PG_SLEEP(15))--/
    MySQL sysdate time-based:
      /xxxx/xxxx/xxxx"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z/
    MSSQL time-based blind:
      -1 waitfor delay '0:0:15' -- /
    Oracle time-based blind:
      '||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'/
    time-based blind (sleep):
      /(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
    MySQL benchmark time-based:
      /xxxx/xxxx?xxxx

    The signature in the string is the basis (sent attempts = observed facts; success is assessed separately via response breakdown). Each technique is machine-classified (deterministic) by the signature string in the "Basis" column appearing in the payload (URL query). The response breakdown counts received statuses; techniques dominated by 404 are brute-force probing of nonexistent paths (reconnaissance). Whether 200 responses delivered content is reviewed separately.


    Overall verdicts for attack-intent paths

    Overall verdicts for attack-intent paths (all)
    
    Attack path category                              Verdict                              Tally (reference)
    Attack attempt (type: to be confirmed)            No reach (target path absent)        req 227,908 / blocked 0 / reached 0
    Unauthorized access to environment file (.env)    Passed through                       req 18,861 / blocked 14,083 / reached 8
    PostgreSQL time-based SQL injection               reach 0 (soft-404/false-positive)    req 11,640 / blocked 0 / s200 6,866
    Unauthorized access to WordPress admin            No reach (target path absent)        req 9,262 / blocked 0 / reached 0
    Attempts against the WordPress login page         No reach (blocked or target absent)  req 2,492 / blocked 59 / reached 0
    Attempts against the WordPress API (XML-RPC)      No reach (target path absent)        req 1,432 / blocked 0 / reached 0
    Source-code exposure attempts (.git config)       No reach (blocked or target absent)  req 1,026 / blocked 508 / reached 0
    Unauthorized access to AWS access-key files       No reach (blocked or target absent)  req 774 / blocked 488 / reached 0
    Attempts against Spring Boot system-info          No reach (blocked or target absent)  req 715 / blocked 8 / reached 0
    Directory probing using URL encoding              reach 0 (soft-404/false-positive)    req 441 / blocked 93 / s200 6
    MySQL benchmark-based SQL injection               reach 0 (soft-404/false-positive)    req 244 / blocked 0 / s200 244
    Access to database admin tools (phpMyAdmin)       No reach (target path absent)        req 129 / blocked 0 / reached 0
    Version-control file exposure (SVN)               No reach (blocked or target absent)  req 85 / blocked 63 / reached 0
    Directory probing using double encoding           No reach (blocked or target absent)  req 55 / blocked 50 / reached 0
    Unauthorized access to API specs (Swagger)        No reach (target path absent)        req 43 / blocked 0 / reached 0


     
     

    toshi

     
     
    教育DXエンジニア / 生成AI活用研究家 コンピュータ理工学修士/元大手ICTエンジニア。誰もが技術を使いこなし、その恩恵を受けられる社会を目指し、公立高の教育現場と二児の子育てに情熱を注ぐ。専業主夫見習い

    あなたへのおすすめ