403 when saving text that contains 'create new database' #470

Closed
opened 2026-02-04 20:18:13 +03:00 by OVERLORD · 11 comments
Owner

Originally created by @Awinad on GitHub (Oct 15, 2017).

For Bug Reports

  • BookStack Version (Found in settings, Please don't put 'latest'): BookStack v0.18.3
  • PHP Version: 5.6
  • MySQL Version: ?
Expected Behavior

No permission error/403

Current Behavior

We had a text saying "Create new database". This seems to be interpreted and then blocked due to the fact that it's an SQL command. It should not even happen...

Steps to Reproduce

Create a page and write "Create new database" and save.
If you write "Create a new database" the error does NOT occur.

Originally created by @Awinad on GitHub (Oct 15, 2017). ### For Bug Reports * BookStack Version *(Found in settings, Please don't put 'latest')*: BookStack v0.18.3 * PHP Version: 5.6 * MySQL Version: ? ##### Expected Behavior No permission error/403 ##### Current Behavior We had a text saying "Create new database". This seems to be interpreted and then blocked due to the fact that it's an SQL command. It should not even happen... ##### Steps to Reproduce Create a page and write "Create new database" and save. If you write "Create a new database" the error does NOT occur.
Author
Owner

@Awinad commented on GitHub (Oct 15, 2017):

Additional comment: It seems to be the case with ALL SQL commands.
e.g. "select * from" causes the same error

@Awinad commented on GitHub (Oct 15, 2017): Additional comment: It seems to be the case with ALL SQL commands. e.g. "select * from" causes the same error
Author
Owner

@ssddanbrown commented on GitHub (Oct 15, 2017):

Hi @Awinad,

Thanks for raising this issue. The fact this happens is concerning. I have been unable to reproduce this issue on my dev setup.

Please can you confirm your version of MySQL?

Also, Please confirm your PHP-MySQL driver if possible. From the command line this can be fetched via php -i | grep mysql.

@ssddanbrown commented on GitHub (Oct 15, 2017): Hi @Awinad, Thanks for raising this issue. The fact this happens is concerning. I have been unable to reproduce this issue on my dev setup. Please can you confirm your version of MySQL? Also, Please confirm your PHP-MySQL driver if possible. From the command line this can be fetched via `php -i | grep mysql`.
Author
Owner

@Awinad commented on GitHub (Oct 15, 2017):

Hi @ssddanbrown

mysql -v:
mysql Ver 14.14 Distrib 5.6.33, for Linux (x86_64) using EditLine wrapper

php -i | grep mysql:
mysqli Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: ... $ mysqli.allow_local_infile => On => On mysqli.allow_persistent => On => On mysqli.default_host => no value => no value mysqli.default_port => 3306 => 3306 mysqli.default_pw => no value => no value mysqli.default_socket => no value => no value mysqli.default_user => no value => no value mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited mysqli.reconnect => Off => Off mysqli.rollback_on_cached_plink => Off => Off mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.12-dev - 20150407 - $Id: ... $ Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password API Extensions => mysqli,pdo_mysql mysqlnd statistics => PDO drivers => mysql, sqlite pdo_mysql Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: ... $ pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

I assume the PDO part was the thing you're looking for. I can provide access to the host if needed.
I do not have root access since it's a shared hosting the app runs on.

@Awinad commented on GitHub (Oct 15, 2017): Hi @ssddanbrown mysql -v: `mysql Ver 14.14 Distrib 5.6.33, for Linux (x86_64) using EditLine wrapper` php -i | grep mysql: `mysqli Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: ... $ mysqli.allow_local_infile => On => On mysqli.allow_persistent => On => On mysqli.default_host => no value => no value mysqli.default_port => 3306 => 3306 mysqli.default_pw => no value => no value mysqli.default_socket => no value => no value mysqli.default_user => no value => no value mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited mysqli.reconnect => Off => Off mysqli.rollback_on_cached_plink => Off => Off mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.12-dev - 20150407 - $Id: ... $ Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password API Extensions => mysqli,pdo_mysql mysqlnd statistics => PDO drivers => mysql, sqlite pdo_mysql Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: ... $ pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock` I assume the PDO part was the thing you're looking for. I can provide access to the host if needed. I do not have root access since it's a shared hosting the app runs on.
Author
Owner

@ssddanbrown commented on GitHub (Oct 15, 2017):

@Awinad Thanks for the quick reply.

This is strange, Was expecting to possibly see non-native driver in your details but looks like you're using mysqlnd.

Might be my testing method? Are you able to replicate the issue on the demo site at all? (Login is admin@example.com and password for password).

@ssddanbrown commented on GitHub (Oct 15, 2017): @Awinad Thanks for the quick reply. This is strange, Was expecting to possibly see non-native driver in your details but looks like you're using mysqlnd. Might be my testing method? Are you able to replicate the issue [on the demo site](https://demo.bookstackapp.com/) at all? (Login is `admin@example.com` and `password` for password).
Author
Owner

@Awinad commented on GitHub (Oct 15, 2017):

@ssddanbrown nope, it does not happen on demo site.
On our site it just shows me 403 right after saving.
screenshot 2017-10-15 20 39 42

Let me know if there's anything else I can do to help identify the issue.

@Awinad commented on GitHub (Oct 15, 2017): @ssddanbrown nope, it does not happen on demo site. On our site it just shows me 403 right after saving. <img width="1272" alt="screenshot 2017-10-15 20 39 42" src="https://user-images.githubusercontent.com/32814111/31587841-0c5c71ba-b1e9-11e7-891b-7f4557f034e5.png"> Let me know if there's anything else I can do to help identify the issue.
Author
Owner

@domainzero commented on GitHub (Nov 2, 2017):

I cannot reproduce this issue either.

@domainzero commented on GitHub (Nov 2, 2017): I cannot reproduce this issue either.
Author
Owner

@ssddanbrown commented on GitHub (Nov 11, 2017):

@Awinad Have you got any layers sitting in front of BookStack? Like cloudflare or some other caching/CDN service?

Thinking that SQL keywords are maybe triggering a security filter or something is not escaping SQL on a layer before bookstack. I've never seen that style of http error which is leading me to think this is something else.

@ssddanbrown commented on GitHub (Nov 11, 2017): @Awinad Have you got any layers sitting in front of BookStack? Like cloudflare or some other caching/CDN service? Thinking that SQL keywords are maybe triggering a security filter or something is not escaping SQL on a layer before bookstack. I've never seen that style of http error which is leading me to think this is something else.
Author
Owner

@ssddanbrown commented on GitHub (Nov 11, 2017):

Apologies for my late response btw

@ssddanbrown commented on GitHub (Nov 11, 2017): Apologies for my late response btw
Author
Owner

@lommes commented on GitHub (Nov 15, 2017):

Apache mod_security might cause this.

@lommes commented on GitHub (Nov 15, 2017): Apache `mod_security` might cause this.
Author
Owner

@deezaster commented on GitHub (May 29, 2018):

i had the same problem when i write "mysql.db". after deactivating the apache mod_security it works.

@deezaster commented on GitHub (May 29, 2018): i had the same problem when i write "mysql.db". after deactivating the apache mod_security it works.
Author
Owner

@ssddanbrown commented on GitHub (Sep 23, 2018):

Since the last comment on this issue is relatively old I'm going to close this. If the issue remains and is something you still require to be fixed please comment and this can be reopened if required.

@ssddanbrown commented on GitHub (Sep 23, 2018): Since the last comment on this issue is relatively old I'm going to close this. If the issue remains and is something you still require to be fixed please comment and this can be reopened if required.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#470