YAPC::Hakodate 2024での発表内容です。 https://yapcjapan.org/2024hakodate/
Intro CSRF という古の攻撃がある。この攻撃を「古(いにしえ)」のものにすることができたプラットフォームの進化の背景を、「Cookie が SameSite Lax by Default になったからだ」という解説を見ることがある。 確かに、現実的にそれによって攻撃の成立は難しくなり、救われているサービスもある。しかし、それはプラットフォームが用意した対策の本質から言うと、解釈が少しずれていると言えるだろう。 今回は、「CSRF がどうして成立していたのか」を振り返ることで、本当にプラットフォームに足りていなかったものと、それを補っていった経緯、本当にすべき対策は何であるかを解説していく。 結果として見えてくるのは、今サービスを実装する上での「ベース」(not ベスト)となるプラクティスだと筆者は考えている。 CSRF 成立の条件 例えば、攻撃者が用意した attack.examp
こんにちは、臼田です。 みなさん、AWSの最新情報はキャッチアップできていますか?(挨拶 社内で行っているAWSトレンドチェック勉強会の資料をブログにしました。 AWSトレンドチェック勉強会とは、「日々たくさん出るAWSの最新情報とかをブログでキャッチアップして、みんなでトレンディになろう」をテーマに実施している社内勉強会です。 このブログサイトであるDevelopersIOには日々ありとあらゆるブログが投稿されますが、その中でもAWSのアップデートを中心に私の独断と偏見で面白いと思ったもの(あと自分のブログの宣伝)をピックアップして、だいたい月1で簡単に紹介しています。 2月は64本のピックアップになりました。みんな調子を戻してきたのかな?というぐらい増えましたね。特に今回は書評も多くてかぶっちゃったのもいっぱいあります。 ちなみにAWSの最新情報をキャッチアップするだけなら週刊AWSが
idをautoincrementしない方が良い理由 こんにちは。株式会社プラハCEOの松原です。 最近プラハチャレンジの参加者とお話している際に 「PKのidはautoincrementするとして...」 とナチュラルにid=autoincrementするものという前提が見えたので、「本当にidをautoincrementしても良いものだろうか?」と気になったことを書いてみようと思います。もしフレームワークが自動的にautoincrementでテーブルを作るからなんとなく使っているという方がいたらご一読いただいた後、それでも連番を使いたい理由があれば教えて欲しいです・・! 不必要に情報を晒すことになる スクレイピングされたり もしも僕が某大手に勤めているエンジニアで「競合サービスAにのってる物件情報、全部コピーして新しいサービス作ろうぜ」と指示されたらですよ?「人としてそれはやっちゃダメで
Amazon Web Services (以下AWS)の利用開始時にやるべき設定作業を解説します。AWSの利用開始とは、AWSアカウントの開設を意味しますが、より安全に利用するため、AWSアカウント開設直後にやるべき設定がいくつかあります。この連載ではその設定内容を説明します。 AWS Organizationsを使用することで、複数のアカウントに自動的にこういった初期設定を行うことも可能ですが、この連載では新規で1アカウントを作成した場合を前提とします。複数アカウントの場合も、基本的な考え方は同じになります。 設定作業は全19個あり、作業内容の難しさや必要性に応じて以下3つに分類しています。 少なくともMUSTの作業については実施するようにしましょう。 MUST :アカウント開設後に必ず実施すべき作業 SHOULD :設定内容の検討または利用方法を決定のうえ、可能な限り実施すべき作業 B
MacのSafariやChromeの拡張を整理していく中、とあることに気が付きました。 「1Passwordの拡張が複数あるけどどうして」 1Passwordの拡張機能を意識するのは大体ログインフォーム入力時或いは新規アカウントを作成する時。後はたまに漏洩等でWatchTowerがお知らせしてくれる程度。そのため、入れ替えやら行う場合に大きく状況が変わっていると戸惑うわけです。 現状の1Passwordのブラウザ拡張について振り返りつつ整理してみました。 現在の1Password拡張機能 現在Chromeウェブストア上から検索にて辿れる拡張は以下一つ。 拡張の概要欄を見ると分かりますが、これは以前1Password Xと呼ばれていた拡張機能です。 1Password Xには1Passwordメンバーシップが必要です。まだアカウントを持っていない場合は、1Password Xをインストールし
CodeQLは、Semmleが提供しているコードセマンティック解析に使用するツールで、脆弱性やコードの品質の可視化を行うことができます。 2019年9月18日にGithubがCodeQLを開発しているSemmleを買収し、現在「GitHub Code Scanning」(リミテッドベータ)として利用することができるようになりました。 Welcoming Semmle to GitHub - The GitHub Blog GitHub、コードの脆弱性を発見してくれる「GitHub Code Scanning」発表、修正方法のアドバイスも。GitHub Satellite 2020 - Publickey 現在でもSemmleのLGTMからCodeQLを利用することができます。 CodeQLを少し使ってみたので紹介したいと思います。 CodeQLを使ってみる Github連携 Alert :
AWSアカウントを安全に運用したいなら最低限これだけはやっとけというTIPSです。 0.AWSのアカウントの種類 AWSアカウントを作ったときには、AWSのrootアカウントしか存在していません。 このままだと「メールアドレス」「パスワード」で「AWSリソースの操作が何でも」できてしまいます。 そこで管理コンソールへのログインはMFA(Multi-Factor Authentication)を利用したうえで、root以外にIAM Userというアカウントを作成し、限定した権限で利用することが強く推奨されています。 rootアカウント:AWSアカウント作成時に作成される何でもできるユーザー IAMユーザー:権限を限定して設定できるユーザー 1.Authyのセットアップ 2段階認証を導入するためにハードウェア型のMFAデバイスか、ソフトウェア型のVirtual MFAが使用可能です。今回はVi
HTTP リクエストに任意の値をセットすることで、Web アプリケーションからの HTTP 通信を傍受したり、中間者攻撃(Man-in-the-Middle)を可能にする脆弱性が見つかっています。 専用サイト httpoxyという名前が付けられ、専用サイトが立ち上がっています。詳細は、このサイトが詳しいです。 httpoxy.org 攻撃内容 アプリケーションからHTTP通信を行う際に、環境変数HTTP_PROXYの値を、HTTPプロキシとして見るライブラリがある。 HTTPリクエストにProxyヘッダを付けられると、環境変数HTTP_PROXYにその値がセットされる。(これは、CGIの仕様) つまり、任意のプロキシを外部から指定できてしまうので、通信内容の傍受や偽装ができてしまう。 対象となる PHP アプリケーション HTTP リクエストを受けて動作する PHP アプリケーション アプ
はじめに 脆弱性検知ツールVulsを使うとシステムに内在する脆弱性を一発で俯瞰することができ、非常に便利です。 ただ実際には、運用的にステージング環境で検証を行ったあとサービスのメンテナンス時間にアップデート作業を行うため、直ぐに最新版を適用することが難しかったり、脆弱性の深刻度・攻撃元区分(ローカルかリモートか)によっては適用しないといった判断をすることもあるかと思います。 そういった場合、Vulsで毎日自動スキャンしたあと見つかった脆弱性全部をレポートするのではなく、前日との差分だけ通知してくれたほうが運用的に管理しやすい場合もあります。 導入については各所に纏まった手順があるため、今回はスキャン後の差分レポートの作成についてのみ記載したいと思います。 スキャン後にレポートの差分だけメールする 当初、スキャンが終了したホストの順でレポート結果が出力されていたためタイミングによって順番が
robots.txtとは robots.txtは、検索エンジンのクローラー(bot)に、クロールされたいページや、クロールされたくないページを教えるテキストファイルのことです。多くの検索エンジンのクローラーは、そのドメインの最上位ディレクトリに設置されたrobotst.txtを最初に読み込んで、クロールするべきページとクロールするべきでないページを取得し、それに基づいて巡回します。ただ、一部のクローラーには、このrobots.txtを無視するものもあります。 robots.txtの書き方はおよそ以下の通りです。 User-agent:(ここにbotのユーザーエージェントを記述。ワイルドカード指定も可能) Crawl-Delay:(クロールの時間間隔を指定) Disallow:(クロールされたくないページやディレクトリを指定) Allow:(Disallowで指定されたディレクトリの小階層で
,、,, ,、,, ,, ,, _,,;' '" '' ゛''" ゛' ';;,, (rヽ,;''"""''゛゛゛'';, ノr) ,;'゛ i _ 、_ iヽ゛';, ,;'" ''| ヽ・〉 〈・ノ |゙゛ `';, ,;'' "| ▼ |゙゛ `';, ,;'' ヽ_人_ / ,;'_ /シ、 ヽ⌒⌒ / リ \ | "r,, `"'''゙´ ,,ミ゛ | | リ、 ,リ | | i ゛r、ノ,,r" i _| | `ー――----┴ ⌒´ ) (ヽ ______ ,, _´) (_⌒ ______ ,, ィ 丁 | | | 前回のエントリ で軽く触れましたが、ARPスプーフィングを用いると、サブネット内からデフォルトゲートウェイを通って外に出て行くはずのパケットを、自分のホ
#!/bin/bash ########################################################### # このスクリプトの特徴 # # 受信・通過については基本的に破棄し、ホワイトリストで許可するものを指定する。 # 送信については基本的に許可する。ただし、サーバが踏み台になり外部のサーバに迷惑をかける可能性があるので、 # 心配な場合は、送信も受信同様に基本破棄・ホワイトリストで許可するように書き換えると良い。 ########################################################### ########################################################### # 用語の統一 # わかりやすさのためルールとコメントの用語を以下に統一する # ACCEPT :
b-casカードの不正改造問題が騒がれているが、「カードがクラックされた」ということではなく「カードが交換できない」ということが問題の本質で、この点がクローズアップされるべきだと思う。 鍵を盗まれたのかアルゴリズムに欠陥があったのか? 2ちゃんねるでは「b-casカード完全解析」とか「b-casカード終了」とか言われているが、暗号化アルゴリズムが破られたわけではない。 「暗号化アルゴリズムが破られた」という言葉は、鍵無しで暗号文を復号する方法が発見された時に使うべきだ。暗号化アルゴリズムが知られても、鍵が無ければ破れない暗号はたくさんある。というか、本来は、暗号化アルゴリズムは公開され(てレビューを受け)るべきもので、中身を知られてから暗号文をどれだけたくさん集めて研究されても、鍵無しでは絶対に(現実的な計算時間では)復号されないということがアルゴリズムの役割である。 今回のクラッキングは
改ざんされてウィルス配布コード埋めこまれてから復旧までの作業や申請の手続きについてまとめていきます。 追記: 「改ざんされた場合そのものの対処方法」という意味で書かせて頂きました。phpMyAdmin の脆弱性についてではなく全般的な内容となっております。誤解を与える表現となってしまい申し訳御座いません。 今回埋めこまれた不正なコード 実際のコードは改行やスペースがなくなって一行のコードとなっておりますので非常に気づきにくいです。 <?php @error_reporting(0); if (!isset($eva1fYlbakBcVSir)) { $eva1fYlbakBcVSir = "7kyJ7kSKioDTWVWeRB3TiciL1UjcmRiLn4SKiAETs90cuZlTz5mROtHWHdWfRt0ZupmVRNTU2Y2MVZkT8h1Rn1XULdmbqxGU7h1Rn
(Last Updated On: 2018年8月13日)PHP Advent Calender用のエントリです。 PHPのセッション管理は非常に簡単です。セッションをsession_start()で開始して$_SESSION配列を使うだけです。便利で簡単なセッションモジュールですがセッションアダプションに脆弱であるため、一般に言われてる「ログインする時にはsession_regenerate_id()を呼ぶ」コーディングではセッションアダプションに脆弱になってしまいます。 まずは危険性と対策を紹介します。 セッションアダプションの危険性 セッションアダプションとは外部などから設定されたセッションIDを受け入れ初期化する脆弱性です。一番分かりやすい例はTrans SIDを有効にして http://example.com/index.php?PHPSESSID=1234567890 とアクセ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く