Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEN input sanitisation #905

Closed
Ravenslofty opened this issue Nov 28, 2016 · 3 comments
Closed

FEN input sanitisation #905

Ravenslofty opened this issue Nov 28, 2016 · 3 comments

Comments

@Ravenslofty
Copy link

Ravenslofty commented Nov 28, 2016

Stockfish may not be an obvious attack vector for bugs, but I decided to let American Fuzzy Lop loose on the FEN parser, and it found issues very quickly, which should be fixed, even if they may never occur.

Non-ASCII characters should be rejected.

position fen rnbq�bnr/pppppppp/8/8/PPPPPPPP/RNBQKBNR

The bitboards should be checked for basic consistency (one king per colour)

position fen rnbqKbnr/pppppppp/8/8/PPPPPPPP/RNBQKBNR

I'll add more later when it's worked overnight.

@ajithcj
Copy link

ajithcj commented Nov 29, 2016

I think in the past maintainers have made it clear that providing correct FENs is the responsibility of the GUI.
Sanitising it is not the job of an engine.

@Ravenslofty
Copy link
Author

So far I have 67 unique crashes - all of them segfaults. The FEN parser is not performance critical code, and these could all be fixed with the Pareto principle of "reject invalid input"

Or do I need to demonstrate an arbitrary code execution exploit?

@mcostalba
Copy link

@ajithcj already answered you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants