0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

TsukuCTF 2021 - digits 100

Posted at

問題

image.png

解いてみた

まずは問題文のhttps://tsukuctf.sechack365.com/problems/digits にアクセスしてみます。

image.png

が返ってきます。
パラメータをつけてhttps://tsukuctf.sechack365.com/problems/digits?q=1234567890 にアクセスしてみます。

image.png

これはもちろん失敗ですが、何か成功するとフラグが出てくるということでしょうか。
0000000000~9999999999をやればどれか成功する?

とりあえず添付ファイルをダウンロードしてみてみます。

image.png

見た感じパラメータについてチェックしてるだけのようで

  • 10桁
  • 「-」や「+」が入ってない。
  • 整数(int型)

の条件を満たしてかつ 文字列の先頭4文字に 0より小さい数 or 9より大きい数があれば成功。ということでしょうか。
整数じゃないといけないのに0より小さいか9より大きい数字なんて10進数にはないはずです。
記号でもいれて文字コードで9より大きい数字をたたき出す感じでしょうか。

「.」を使えば小数だけどintの時はまるめてくれそう。

https://tsukuctf.sechack365.com/problems/digits?q=1.34567890 にアクセスしてみます。

image.png

ダメ。
小数点以下が0ならいけるか?
https://tsukuctf.sechack365.com/problems/digits?q=1.00000000 にアクセス。

image.png

ダメ。
先頭を0xにしたら16進数として読み込んでくれる?
https://tsukuctf.sechack365.com/problems/digits?q=0x34567890 にアクセス。

image.png

ダメ。

pythonの整数で使える記号をネットで調べてみると以下の記事が見つかった。

pythonのアンダーバーこれなんやねん
https://qiita.com/kiii142/items/6879cb065ad4c5f0b901

数字を見やすくするためだけに「_」を使うことができるらしい。
たとえば1_000なら1000として扱われる。
見た目だけ人間には見やすくなるけどプログラム的には無視されるらしい。

https://tsukuctf.sechack365.com/problems/digits?q=0_34567890 にアクセス。

image.png

できた。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?