The Real Fullstack

The Dangerous Query

We escape quotes before building the query. Is the search safe now?

エクスプローラー7 分コード課題タイムラインシミュレーター
sqljavajdbcpythonnode

この課題はまだ日本語に翻訳されていません。英語版を表示しています。

ミッション:Try the payloads, then choose a query construction that keeps every input as data — in string, numeric and identifier positions.背景 · 学習目標 ▾

Fernway's back-office customer search builds SQL from the search box and a sort dropdown. A penetration test (on a local copy with synthetic data) showed the search can return every customer — or other tables entirely. A developer added quote escaping as a quick fix.

ミッション: Try the payloads, then choose a query construction that keeps every input as data — in string, numeric and identifier positions.

学習目標

  • See how concatenated input changes a query's structure.
  • Use parameterised queries for values.
  • Allow-list identifiers that can't be parameterised (ORDER BY, column names).
シミュレーションシミュレーション値

シミュレーションを実行すると出力が表示されます。

シミュレーションを実行
String sql = "SELECT id, name FROM customers WHERE name = '" + name + "'"           + " ORDER BY " + sort;                                   // user input becomes SQLreturn jdbc.query(sql, rowMapper);

簡略化

Payload detection is pattern-based and limited to five inputs; never test against systems you don't own. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

関連する課題

参考資料