Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8831535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:19:53+00:00 2026-06-14T08:19:53+00:00

Today I found a security hole in my web application (Pardon me if this

  • 0

Today I found a security hole in my web application (Pardon me if this is mentioned else where because I couldn’t able to find it on SO). Consider this code:

<html>
    <head>
        <script>
            intv = setTimeout(function(){test()} , 10000);
            function test(){
                val = document.getElementById('tt').value;
                alert(val);
                intv = setTimeout(function(){test()} , 10000);
            }
        </script>
    </head>
    <body>
       <input type="hidden" value="10" id="tt">
    </body>
</html>

The Problem:

This code will alert value of an Input Field with 10 seconds of interval. After first alert I change the input field value in Browser by viewing its source code. And it alerts the value which I added later on, which is not good for me.

Real Life Scenario:

I have a virtual classroom where student and teacher both attend a class session. I send the the ajax request after every 5 seconds to update the duration of class at backend and I add +5 in duration field in db, and later on student has to pay us according to the duration they spent in a class. I am afraid if any smart guy just edit the source code in browser and instead of sending request after 5 seconds he changed to it 1 hour (for sake of argument) to cheat my logic. How to prevent any kind of illegal activity on client side?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:19:54+00:00Added an answer on June 14, 2026 at 8:19 am

    There is nothing you can do to prevent users from changing JavaScript values.

    Instead you should validate input on the server.

    In this case, as suggested in the comments, you should log the start and end time using the servers time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I found a strange jquery selector in the following code: $(this).find(+div.parent).hide(); I've searched
Googling today I couldn't found sample or mentioning of best practice: how to escape
Today I found this code snippet: <object ID=FF CLASSID=clsid:guid CODEBASE=url VIEWASTEXT></object> <object ID=FileSaver CLASSID=clsid:guid
Today I found this query in our code that pulls up a list of
Today i found this site, 3D Meninas , with a nice effect of 3D
I'm using Kohana v3 for a web project, and today I found myself writing
I came across this File parsing programming challenge today and found it quite interesting.
Today I found the OracleCommand.InitialLOBFetchSize property ( documentation ). Because I'm using NHibernate (which
Just started with Sencha today and found it a bit overwhelming. Was able to
So, after 6 months of hard work finally released my application. Today I found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.