beefproject/beef — Issue #296: ERROR DataObjects::ConnectionError: database is locked
Author: passbe
Created: 2011-12-10 22:34:22+00:00
State: open

What steps will reproduce the problem?
1. Run BeEF and login on the BeEF admin interface.
2. Hook a victim browser.
3. Intercept the victim browser requests/responses to identify the failure.
4. Once the browser has been hooked, click over it on the "Online browsers" list.
5. The hooked browser info is retrieved on the right pane.
6. Leave the browser hooked without performing any action, and the error message will appear after a few polling requests from the BeEF JavaScript running on the victim (hook.js).

Browser request: (TIME 13:28:14 (GMT+1) or 12:28:14 GMT)
--
POST http://192.168.1.42:8080/hook.js HTTP/1.1
Host: 192.168.1.42:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 (.NET CLR 3.5.30729) Paros/3.2.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Referer: http://192.168.1.42:8080/demos/basic.html
Content-Length: 225
Content-Type: text/plain; charset=UTF-8
Cookie: BEEFHOOK=uKlt5ltNE3M1jMDhP0C2KYN10kN3BgSM90bt4kazHd0HNNWFeeXPcgeoFW5tL8qnRJgaoSUyUae4XJnI
Pragma: no-cache
Cache-Control: no-cache

beef_js_cmps=beef.browser,beef.browser.cookie,beef.session,beef.net.os,beef.dom,beef.net,beef.updater,beef.encode.base64,beef.net.local&BEEFHOOK=uKlt5ltNE3M1jMDhP0C2KYN10kN3BgSM90bt4kazHd0HNNWFeeXPcgeoFW5tL8qnRJgaoSUyUae4XJnI
--

The error is generated when BeEF replies back to the standard polling requests to hook.js with a 404 instead of a 200. See attached file with the whole session from Paros.

What is the expected output? What do you see instead?

- No error expected, but the error is generated on the BeEF console:
--
[2011-01-01 13:28:14] ERROR DataObjects::ConnectionError: database is locked
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:63:in `execute_non_query'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:63:in `execute'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:260:in `with_connection'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:61:in `execute'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:185:in `update'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/repository.rb:180:in `update'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource/state/dirty.rb:54:in `update_resource'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource/state/dirty.rb:22:in `commit'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:968:in `_persist'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:999:in `update_with_hooks'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:996:in `catch'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:996:in `update_with_hooks'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1033:in `save_self'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1018:in `_save'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1234:in `run_once'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1017:in `_save'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:417:in `save'
/var/www/beef-0.4.2.1-alpha/./lib/server/zombiehandler.rb:55:in `do_POST'
/usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `__send__'
/usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/www/beef-0.4.2.1-alpha/./lib/server/httphookserver.rb:97:in `start'
./beef.rb:33
--

- This issue is related with BeEF performance problems.

What version of the product are you using? On what operating system?

- BeEF 0.4.2.1-alpha rev 630 running on Samurai WTF 0.9
- Hooked browser: FFox 3.6.10 on Windows
- URL used for hooking:
http://192.168.1.42:8080/demos/basic.html

Please provide any additional information below.

- Time of the error message: 13:28:14
- The message appeared again at 13:28:19, and a new 404 response was generated (see attached file for the whole list of BeEF console error messages).

--
[2011-01-01 13:28:19] ERROR DataObjects::ConnectionError: database is locked
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:63:in `execute_non_query'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:63:in `execute'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:260:in `with_connection'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:61:in `execute'
/var/lib/gems/1.8/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:185:in `update'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/repository.rb:180:in `update'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource/state/dirty.rb:54:in `update_resource'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource/state/dirty.rb:22:in `commit'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:968:in `_persist'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:999:in `update_with_hooks'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:996:in `catch'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:996:in `update_with_hooks'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1033:in `save_self'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1018:in `_save'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1234:in `run_once'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:1017:in `_save'
/var/lib/gems/1.8/gems/dm-core-1.0.2/lib/dm-core/resource.rb:417:in `save'
/var/www/beef-0.4.2.1-alpha/./lib/server/zombiehandler.rb:55:in `do_POST'
/usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `__send__'
/usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/www/beef-0.4.2.1-alpha/./lib/server/httphookserver.rb:97:in `start'
./beef.rb:33
--
Google Code Issue: http://code.google.com/p/beef/issues/detail?id=221