PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 6th, 2013, 11:13 PM
Primux Primux is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 2 Primux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 7 sec
Reputation Power: 0
PHP-Security - Tamper Protection for PHP code I'm selling.

Hello everyone.

I'm currently working on a PHP project for a startup company that plans on selling this software to several small businesses in the area. The businesses will be charged based on how much they're using the database. I'm still talking to the other owners of the company to determine if it's going to be based on the number of queries, or just on the number of clients (rows) in the main table.

In any event, my concern is that if we sell this to someone, they could easily manipulate the raw PHP code when I'd check the number of rows in the table and have it return some static value (e.g. $numrows = 400; instead of $numrows = mysql_num_rows($result) I'm aware that mysql_* is depreciated, but it's just an example. Anyhow, I'm looking for good ways to ensure the code isn't tampered with after we set up the buyers with the software.

As of yet I've had two ideas: 1. To use apache's mod_rewrite to rewrite all URL's to a page that checks the hash of whatever page is being called (or just the page calculating the cost to them) that would shut it down if the hash doesn't match what it should. OR
2. Running a system service (if hosted on windows) that checks the hash and stops the server and removes permissions from the files (e.g. cacls index.php /P Guest:N ) if it detects that the hashes don't match.

I know that other people sell their PHP code that works in a similar fashion, and that they have some way of monitoring it, I just have no idea how they do it. I googled for "PHP tamper protection" but I just kept getting results from symantec's anti-tamper module files that people uploaded.

Does anyone have any recommendations?
Thanks everyone.
-Primux

Reply With Quote
  #2  
Old March 6th, 2013, 11:29 PM
requinix's Avatar
requinix requinix is online now
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,676 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 30 m 28 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Anything running on a client's machine can be compromised.

This business model is typically handled as an API: you give them code to access the API, or even let them write their own code, but you do the real work (including calculating billing) on the server.

Reply With Quote
  #3  
Old March 7th, 2013, 01:17 AM
Primux Primux is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 2 Primux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 7 sec
Reputation Power: 0
Unfortunately at present not an option. Hopefully in the future we could host the database elsewhere. Beyond that they can do whatever they wish with the code, since we're charging by db usage.

Reply With Quote
  #4  
Old March 7th, 2013, 01:53 AM
requinix's Avatar
requinix requinix is online now
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,676 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 30 m 28 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Then you might be stuck with something like ionCube. Does require the customer use an extension with PHP, I believe, but it's just about as close as you can get to something that's tamper-proof.

Reply With Quote
  #5  
Old March 7th, 2013, 02:53 AM
Northie's Avatar
Northie Northie is offline
Square Peg in a Round Hole
Click here for more information.
 
Join Date: Oct 2007
Location: North Yorkshire, UK
Posts: 3,412 Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level)Northie User rank is General 43rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 9 h 10 m 20 sec
Reputation Power: 3833
We're in a similar situation, although we're writing it our selves and selling it ourselves

Quite simply, we will never release the code - the code will always be run on our servers. With the cost of VPSs and 'cloud' computing tumbling I can commission a virtual-dedictaed server with full root access for as little as £7/month (for 10Gb HDD & 256Mb Ram) through my hosting company's API (so its automated).

This is known as "Software as a Service", SaaS, and it is software bought as if it were a service (eg paid for monthly, and we host, maintain, update etc etc)

Our software has a modular and event based plugin architecture for php-based extensions and a complete ReSTful API for remote (including JS-based client interface) management.

We charge based on number of users, number of modules, hard disk space used by the application and bandwidth. Pricing is initially tiered based on users & modules (as this tends to scale proportionally with the space and bandwidth requirements). Exceptional cases can commission extra space, extra servers, load balancers, solid state drives, etc etc.

Updates are managed by version control software: each server checks daily for a new release and if one is found then it downloads, runs tests and updates the 'local' code base.
__________________
PHP OOPS! <?php DB::Execute(SQL::makeFrom($_GET))->fetchArray()->FormatWith(Template::getInstance('default'))->printHtml(); ?>

PDO vs mysql_* functions: Find a Migration Guide Here

[ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-Security - Tamper Protection for PHP code I'm selling.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap